built as part of NI-RUN CVUT course
implementation of LOX
from scratch implementation C++23/26 + libc/c++
values are clasified in 3 categories Linerizer
- global
- stored in static array
GLOBALS_TABLE
- stored in static array
- local
- stored in stack frames
- caputured
- stored in
FunctionRefobjects - linked list of
FunctionRef - those can be const
LoxValue/ mutableLoxValue*
- stored in
values are represented with 8B NaN boxing
- 3bit tag => 8 types
ValueType2 - tags are placed so some operations can be more performant
- falsy values
- callable values
- addable values
- 1 bit diff between true/false
- older version used 16B enum taging
program is lowered into custom SSA IR Compiler which is then compiled into x86_64 X86MilaAssembler
- generated code calls backs into runtime for more complex operation
callBuiltin&namespace builtin - most simpler operations are implemented directly in assembly (arithmetics, type guards)
- readField
- writeField
- callMethod
- bit of static analysis to deduce types, remove guards, speculate globals
- proper GC
- speculative optimizations, use ICs feedback to generate more optimal code
- would require deopt into generic code?
- tracking of values registers/stack
- clone ccutils