immunant / IA2-Phase2

5 stars 0 forks source link

Pass indirect call target in first register #436

Closed rinon closed 2 weeks ago

rinon commented 1 month ago

Rather than pass the indirect call target in a global static, this change passes the target in the first parameter register to the wrapper. The wrapper then shifts the remaining parameters so that the callee receives the correct parameters.

ayrtonm commented 1 month ago

Rather than pass the indirect call target in a global static, this change passes the target in the first parameter register to the wrapper

I agree this is a better approach than a thread-local in memory.

ayrtonm commented 1 month ago

I think at some point we'll want to generate scrub registers in GenCallAsm.cpp to avoid the redundant push/pops and avoid spilling the function pointer to the stack in indirect calls, but this is already better than what we currently do since it's only on a protected stack.