Skip to content

Commit 99682d9

Browse files
committed
[[ LCB Machine ]] Rework VM to make result reg optional in invoke and merge the idea of local variables and registers.
This is the first part (VM) of reworking LCB internals so that result registers are inferred from the signature in invokes, and local variables and registers are unified. At this point the result register in an invoke will be assumed not to be present if the signature of the handler it is calling does not return a value. Exceptions to this are multi-invokes, and indirect invokes which do not know the signature ahead of time and so must always provide a result register 'just in case' (in the case of a non-value returning handler being called, the specified register will be set to undefined - which is what no-value return 'means' in LCB). Additionally the fetch-local and store-local opcodes have been removed and their global variants renamed to be fetch and store. The latter take an optional 'level' argument which indicates which scope to fetch and store definitions from. Currently assumed not to be present, this argument will allow fetching and storing of defns from nested scopes - for example, nested handler, outer handler; or object, module. The register file now has type annotations for the parameter variables and local variables. All fetches and stores to the register file are now checked to ensure that if fetching from a typed register it conforms to definedness requirement (depending on the optionality of the type) and if storing to a register the type conforms to the type annotation. Work on the builder abstraction and compiler abstraction is till to be done.
1 parent 1ac460c commit 99682d9

3 files changed

Lines changed: 265 additions & 310 deletions

File tree

0 commit comments

Comments
 (0)