[GR-60350] Correctly handle in-memory return for direct upcalls. #11202
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We identified direct upcalls by the cracked direct method handle (i.e. using
DirectMethodHandleDesc
). However, it is possible that the same target method may be called with different C signatures. For example:If we have static method
and if there are two different C structs:
Then it is possible to create two (different) upcall stubs:
In case of
stub0
, the return value fits into registers but in case ofstub1
, the return value must be passed in a buffer. Therefore, the method handle invoked by the call stub is different.In order to fix that, we need to identify a direct upcall by its method handle descriptor AND the
JavaEntryPointInfo
.Furthermore, when re-creating the method handle for the direct upcall stub, we also need to adapt the direct method handle for in-memory return.