Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce separate bytecode for applying combinator #11

Open
Abhiroop opened this issue Apr 30, 2021 · 0 comments
Open

Introduce separate bytecode for applying combinator #11

Abhiroop opened this issue Apr 30, 2021 · 0 comments
Labels
backend enhancement New feature or request

Comments

@Abhiroop
Copy link
Collaborator

Currently, in the VM a combinator is represented on the heap using a dummy value

(combinator_label, 4294967295) // the dummy value is UINT_MAX

Represented here in the code: https://github.com/svenssonjoel/Sense-VM/blob/master/backend/src/CAM.c#L1110-L1115

Later when evaluating an APP bytecode a runtime check is done to determine if applying on a combinator or a closure done here: https://github.com/svenssonjoel/Sense-VM/blob/master/backend/src/CAM.c#L372-L418

This runtime check is expensive. Instead, we should try to generate an APPCOMB separate bytecode when applying a combinator to avoid the runtime check. The peephole optimisation should be extended to add rules with APPCOMB etc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant