On 10/10/23 18:24, Andrew Waterman wrote:
I remembered another concern since we discussed this patch privately.
Using ra for long calls results in a sequence that will corrupt the
return-address stack.
Yup. We've actually got data on that internally, it's not showing up in a significant way in practice.


  I know nothing
about the complexity of register scavenging, but it would be nice to
opportunistically use a scratch register (other than t0), falling back
to ra only when necessary.
The nice thing about making $ra fixed is some can add a register scavenging approach, then fall back to $ra if they're unable to find a register to reuse.


Tangentially, I noticed the patch uses `jump label, ra' for far
branches but uses `call label' for far jumps.  These corrupt the RAS
in opposite ways (the former pops the RAS and the latter pushes it.
Any reason for using a different sequence in one than the other?
I'd noticed it as well -- that's the way it was in the patch that was already in Ventana's tree ;-) My plan was to address that separately after dropping in enough infrastructure to allow me to force everything to be far branches for testing purposes.

jeff

Reply via email to