RFR: 8233232: AArch64: jni_fast_GetLongField is broken

Andrew Haley aph at redhat.com
Wed Oct 30 17:38:05 UTC 2019


I found a bug in AArch64. When we are resolving an object in native,
rthread does not contain a valid thread value. Instead it should be
derived from the jni_env argument. x86 does not use rthread, and is
OK.

I believe this is true for all platforms: none will have a valid
rthread when called from native code.

Fixed thusly, the same as x86. OK?

diff -r 6a05019acb67 src/hotspot/cpu/aarch64/gc/shenandoah/shenandoahBarrierSetAssembler_aarch64.cpp
--- a/src/hotspot/cpu/aarch64/gc/shenandoah/shenandoahBarrierSetAssembler_aarch64.cpp	Tue Sep 17 14:00:36 2019 -0400
+++ b/src/hotspot/cpu/aarch64/gc/shenandoah/shenandoahBarrierSetAssembler_aarch64.cpp	Wed Oct 30 12:44:23 2019 -0400
@@ -424,9 +448,12 @@
   // Check for null.
   __ cbz(obj, done);

   assert(obj != rscratch2, "need rscratch2");
-  Address gc_state(rthread, in_bytes(ShenandoahThreadLocalData::gc_state_offset()));
-  __ ldrb(rscratch2, gc_state);
+  Address gc_state(jni_env, ShenandoahThreadLocalData::gc_state_offset() - JavaThread::jni_environment_offset());
+  __ lea(rscratch2, gc_state);
+  __ ldrb(rscratch2, Address(rscratch2));

   // Check for heap in evacuation phase
   __ tbnz(rscratch2, ShenandoahHeap::EVACUATION_BITPOS, slowpath);

-- 
Andrew Haley  (he/him)
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
https://keybase.io/andrewhaley
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671




More information about the hotspot-gc-dev mailing list