Skip to content

register save/restore refactor #359

@Wuerfel21

Description

@Wuerfel21

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions