RFR(S): 8232108: [lworld] Reflective method invocation with scalarized return is not GC safe
tobias.hartmann at oracle.com
Thu Oct 10 13:04:13 UTC 2019
please review the following patch:
For reflective method invocations, we pre-allocate an inline type buffer in JavaCalls::call_helper
that is then initialized in the call stub after returning from the callee. If a GC happens in the
callee, that buffer might be moved and we initialize/return random memory.
The fix is to create a local JNIHandle to pass the buffer to the call stub and resolve the buffer
oop when returning from the call. Because the code in MacroAssembler::resolve_jobject calls
BarrierSet::barrier_set(), I had to change the init sequence. I couldn't find a reason why
universe_init() would depend on stubRoutines_init1().
This spuriously showed up with TestCallingConvention. I've added a new tests that reliably
reproduces the bug.
More information about the valhalla-dev