RFR 8228532: Shenandoah: Implement SBSA::try_resolve_jobject_in_native()

Andrew Haley aph at redhat.com
Wed Oct 30 16:50:36 UTC 2019


On 7/26/19 2:18 AM, Zhengyu Gu wrote:
> Updated Webrev: http://cr.openjdk.java.net/~zgu/JDK-8228532/webrev.01/
> 
> On X86 platforms, r15 does not have valid thread value, instead, it 
> should be derived from jni_env argument.
> 
> Test:
>    hotspot_gc_shenandoah (fastdebug and release) on
>    Linux x86_64, x86_32
>    Windows x86_64.

FYI:

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.

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

Has this bug been backported? How should we handle it?

Suggested patch:

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