RFR: 8233232: AArch64: jni_fast_GetLongField is broken
Aleksey Shipilev
shade at redhat.com
Wed Oct 30 20:40:26 UTC 2019
On 10/30/19 6:38 PM, Andrew Haley wrote:
> 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);
Looks good.
--
Thanks,
-Aleksey
More information about the hotspot-gc-dev
mailing list