-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
bytecodeIssues related to bytecodeIssues related to bytecodecompilerIssues related to compilation & parsingIssues related to compilation & parsingenhancementNew feature or requestNew feature or requestinstructionBytecode instructionBytecode instruction
Description
- Create a
class_register
pipe instruction that does not modify the stack but copies the class' function layout to a shared (Gc<GcCell>
) vtable mapped to a unique integer id before memory contents are initialized with the constructor. - Create a
class_alloc
instruction. If the class memory/function layout is known, it preallocates the known size of member variables and returns an uninitialized class, then jumps {N} instructions. Otherwise, fall through to build the class vtable at runtime like normal and store it with aclass_register.
- Change the memory layout of classes: one
Gc<GcCell>
to include instance variables and anotherGc<VTABLE>
for functions
Example
function Dog
arg 0
store_fast constructor_arg0
store_fast constructor_arg{N}
class_alloc 12345 {N}
make_function Dog::bark a b c
make_function Dog::...
class_register 12345
done
...
load_fast constructor_arg0
...
call path/to/file.mmm#Dog::constructor
ret
end
Metadata
Metadata
Assignees
Labels
bytecodeIssues related to bytecodeIssues related to bytecodecompilerIssues related to compilation & parsingIssues related to compilation & parsingenhancementNew feature or requestNew feature or requestinstructionBytecode instructionBytecode instruction