RFR: 8233232: AArch64: jni_fast_GetLongField is broken
Roman Kennke
rkennke at redhat.com
Wed Oct 30 17:45:09 UTC 2019
Is it not possible to use the gc_state Address directly in ldrb?
Roman
> 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);
>
More information about the hotspot-gc-dev
mailing list