fwsGonzo / libriscv

The fastest RISC-V sandbox
BSD 3-Clause "New" or "Revised" License
526 stars 46 forks source link

Add Registers& argument to setup_call #117

Closed fwsGonzo closed 6 months ago

fwsGonzo commented 6 months ago

Adding a reference to registers to setup_call, followed by adding a reference to a stack pointer to each stack_push function, will allow the preempt() function to have an inline portion that sets up the unknowable side of the call, as well as a hidden implementation that saves the old registers, runs the new function and then restores everything.

This will reduce the impact of preempt() when it is seen inlined everywhere. It most likely adds code size where we want to be nimble.

fwsGonzo commented 6 months ago

Turns out to be not necessary, as it will likely pessimize preempt(), the one use-case where it was needed