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

register save/restore refactor #359

Open
Wuerfel21 opened this issue Feb 1, 2023 · 0 comments
Open

register save/restore refactor #359

Wuerfel21 opened this issue Feb 1, 2023 · 0 comments

Comments

@Wuerfel21
Copy link
Contributor

Wuerfel21 commented Feb 1, 2023

I feel there's some pretty decent size and performance savings to be had by re-doing pushregs/popregs . On the P2 side, mostly, anyways.

If the other three save registers are moved in front of the locals and the semantics of COUNT_ are changed (such that it always holds the saved local count for the current stack frame), the entire save/restore can be done in one big block transfer and the check for the zero count case is eliminated. Push could obviously be called with CALLPA to save a decent bit of space. Also, is popregs ever not the last thing before RET? (unwind aside) That could be turned into a tail call instead then.

I tried to make it happen, but got stuck on getting it to emit the registers in the right place.

On P1, the COUNT_ and frame pointer could be stored in words for a RAM save. Would that cause issues when the stack is allocated from heap? (Is that even supported/viable on P1?) EDIT: should work with now GC allocator if pointer is in lower word?

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