Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change way types are stored and represented + allow for more than u16::MAX types #120

Open
kaleidawave opened this issue Mar 3, 2024 · 4 comments
Assignees
Labels
architecture type checking and compiler related general structuring blocking These issues are blocking the checker being used in projects bug Something isn't working checking Issues around checking compiler-performance Making parsing / type checking / transformations faster v2 Big updates

Comments

@kaleidawave
Copy link
Owner

Currently all types are currently held under a single Vec<Type>, and TypeId is pointer into this vector. TypeId is a wrapped for a u16. To support larger files/codebases this needs to increase

  • Currently the sequential ids require the whole program to be checked (from a starting point). Adding more incremental parts will create problems if an intermediate file is changed. TypeId has to be split between libraries/files somehow.

  • Also from Add binary type caching back and think about TypeId #103: Adding versioning or something to the binary format that can be checked on deserialization. This is because new versions of the compiler might have a different representation in byte form (new fields, removed enum members, etc) that isn't compatible to be parsed with binary files generated by older compilers

@kaleidawave kaleidawave added bug Something isn't working checking Issues around checking compiler-performance Making parsing / type checking / transformations faster labels Mar 3, 2024
@kaleidawave kaleidawave self-assigned this Mar 3, 2024
@kaleidawave kaleidawave added the architecture type checking and compiler related general structuring label Mar 3, 2024
@kaleidawave
Copy link
Owner Author

Quick thoughts:

Considering struct TypeId { block: u16, offset: u16 }. Where BlockId points to a collection of Vec<Type> that can span multiple files / packages. But each block only contains types per module so that invalidations have a limited effect or something.

@kaleidawave kaleidawave changed the title Allow for more than u16::MAX types Change way types are stored and represented + allow for more than u16::MAX types May 29, 2024
@kaleidawave kaleidawave added the blocking These issues are blocking the checker being used in projects label Jun 20, 2024
@kaleidawave
Copy link
Owner Author

I think the first thing is to split types apart.

TypeId should be InterfaceTypeId | ConstantId | FunctionId | ... with each of them having their own Vec

Could try splitting types that an expression can represent from conventional types again at some point. Although makes subtyping less simple

@kaleidawave
Copy link
Owner Author

Worth considering whether Type::And and Type::Or should be Vec rather than binary tree

@kaleidawave
Copy link
Owner Author

Additionally for Type::Object(AnonomousObjectLiteral) it would be great if the properties could be inline rather than on through environment (they are fixed for this type, can't be modified or merged)

@kaleidawave kaleidawave added the v2 Big updates label Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
architecture type checking and compiler related general structuring blocking These issues are blocking the checker being used in projects bug Something isn't working checking Issues around checking compiler-performance Making parsing / type checking / transformations faster v2 Big updates
Projects
None yet
Development

No branches or pull requests

1 participant