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

Remove the called function from the stack #50

Open
p7g opened this issue Jan 11, 2025 · 0 comments
Open

Remove the called function from the stack #50

p7g opened this issue Jan 11, 2025 · 0 comments

Comments

@p7g
Copy link
Owner

p7g commented Jan 11, 2025

To avoid needing to add/remove 1 in multiple places at runtime (for example when loading locals), it would be nice to store the called function in the cb_frame instead of on the stack. To do so means that the function should be at the top of the stack when evaluating OP_CALL, which requires reordering the code emitted by the compiler. The way to do this that comes to mind is buffering the bytecode from nud and appending it after compiling the arguments.

See the branch function-last for a WIP implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant