-
Enhancement
-
Resolution: Fixed
-
P4
-
None
-
repo-panama
We currently pass 2 special values between stubs and Java code: the target address for downcalls, and the return buffer address for both down and up calls.
We pick a special register to hold these values which doesn't conflict with the rest of the ABI. This register is decided in CallingSequenceBuilder. The stub then reads or writes the special value from this register in the argument shuffle, and uses the special value around that.
There are some issues with that though:
- If we want to add more special values, such as a storage location for preserved thread-local values, than we will run out of registers at some point
- Instead of storing the special value in a register, in some cases the stack is a better destination, but the current approach doesn't really support using STACK storage, since it is also potentially offset by shadow space, and because we only _really_ know when generating the sub code what the offset on the stack should be.
Instead, I suggest refactoring this to use place-holder locations in the Java code, which index indicates which special value they pertain to, and then letting the stub generation code fill in these placeholders however it wants.
We pick a special register to hold these values which doesn't conflict with the rest of the ABI. This register is decided in CallingSequenceBuilder. The stub then reads or writes the special value from this register in the argument shuffle, and uses the special value around that.
There are some issues with that though:
- If we want to add more special values, such as a storage location for preserved thread-local values, than we will run out of registers at some point
- Instead of storing the special value in a register, in some cases the stack is a better destination, but the current approach doesn't really support using STACK storage, since it is also potentially offset by shadow space, and because we only _really_ know when generating the sub code what the offset on the stack should be.
Instead, I suggest refactoring this to use place-holder locations in the Java code, which index indicates which special value they pertain to, and then letting the stub generation code fill in these placeholders however it wants.