This repository was archived by the owner on Jun 1, 2023. It is now read-only.
This repository was archived by the owner on Jun 1, 2023. It is now read-only.
type optimizer #415
Open
Description
Add several improvements for types, esp. runtype hints.
We need 3 new type bits per type to specifiy its origin:
- TYPE_DECLARED: if the type was statically declared by the user. This is fixed and cannot be changed
- TYPE_INFERRED: if the type was inferred by the compiler. This is also fixed, but has weaker guarantees. Esp. warnings and error messages are different. Not sure if we need that, but looks nice.
- TYPE_HINT: if the type was optionally observed/guessed by the compiler or run-time. such as
array[int]
vsarray[any]
which can be broken by any change. This can be taken away, fallback to the original generalized code. (OSR?)
This is pre-work for the jit. In principle everything which can be done in the jit, can also be done in C before, such as observing run-time types, adding type hints, spezialising code (loops, methods), backout to the old code, method cache for generics (PIC - polymorphic inline cache) (needed for multi). Just rt patching (PIC or hooks) not.