Skip to content

Preload functions addresses #133

@syldium

Description

@syldium

The virtual machine loads and resolves external variables once the bytecode is fully loaded. It ensures that all symbols exists before executing the program and avoids a string lookup at runtime to determine the effective position of the value in memory.

Functions on the other hand are not resolved ahead of time, despite being known at load time.

Representing functions as dynamic symbols would be beneficial to know before executing if all the required functions to be present are found. It would also mean a direct access to the function code for the VM, without having to look for a string in a map.

Doing this change requires the compiler to also emits dynamic symbols for function calls. You can find this given code here. The VM msh::loader class will then need to be updated to account for those new symbols that may not be variable. The msh::pager class will also require an update to store those function declaration pointers behind each constant pool, and have a way to retrieve them from the interpreter.

Relevant files:

Metadata

Metadata

Assignees

No one assigned

    Labels

    VMThe scope is related to the virtual machinecompilerThe scope is related to the compilergood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions