Skip to content

Make the IR typed #487

Description

@LPTK

TODOs:

  • Q (separate PR): Can we split the IR's Ref into
      // case Ref(l: Local, disamb: Opt[DefinitionSymbol[?]])
      case Ref(l: LocalSymbol)
      case MemberRef(l: BlockMemberSymbol, disamb: DefinitionSymbol[?])
    Note: first (before refactoring), we can try to check the invariant at runtime, and if it holds, we should be able to do it
  • Define ErasedType – for now, just have case AnyRef(rsc: Bool, csym: ClassLikeSymol) and case Primitive(‹things like i31›)
  • For now, we add an ErasedType field to the symbols that represent values; it starts out as absent and will be populated by the resolution process. When absent, we just assime Object (ie AnyRef(false, ObjectSymol)).
  • Add resultType: ErasedType to functions
  • Add a pass of explicit coercions/unboxing, allowing to produce WASM that doesn't treat everything as anyref

Eventual goal: use this to compile resources (using refcounting).


Original items (probably won't do for now):

  • Define ErasedType – for now, just have case Object (top), case AnyRef(rsc: Bool), case Union(Ls[ErasedType]) and case Primitive(‹things like i31›)
  • Make params: Ls[BlockParamList] in functions
  • Change Ref, MemberRef, and Select wrap their symbol inside a new symbol kind BlockSymbol which includes an ErasedType

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions