8202479: Add missing try_resolve_jobject_in_native calls
authoreosterlund
Thu, 17 May 2018 11:56:21 +0200
changeset 50164 88bf53770be5
parent 50163 268ea94772da
child 50165 86f038c25410
8202479: Add missing try_resolve_jobject_in_native calls Reviewed-by: coleenp, pliden
src/hotspot/cpu/sparc/jniFastGetField_sparc.cpp
src/hotspot/cpu/x86/jniFastGetField_x86_64.cpp
--- a/src/hotspot/cpu/sparc/jniFastGetField_sparc.cpp	Thu May 17 14:31:31 2018 +0200
+++ b/src/hotspot/cpu/sparc/jniFastGetField_sparc.cpp	Thu May 17 11:56:21 2018 +0200
@@ -153,8 +153,13 @@
   __ andcc (G4, 1, G0);
   __ br (Assembler::notZero, false, Assembler::pn, label1);
   __ delayed()->srl (O2, 2, O4);
-  __ andn (O1, JNIHandles::weak_tag_mask, O1);
-  __ ld_ptr (O1, 0, O5);
+  __ mov(O1, O5);
+
+  // Both O5 and G1 are clobbered by try_resolve_jobject_in_native.
+  BarrierSetAssembler *bs = BarrierSet::barrier_set()->barrier_set_assembler();
+  bs->try_resolve_jobject_in_native(masm, /* jni_env */ O0, /* obj */ O5, /* tmp */ G1, label1);
+  DEBUG_ONLY(__ set(0xDEADC0DE, G1);)
+
   __ add (O5, O4, O5);
 
   assert(count < LIST_CAPACITY, "LIST_CAPACITY too small");
@@ -206,8 +211,12 @@
   __ andcc (G4, 1, G0);
   __ br (Assembler::notZero, false, Assembler::pn, label1);
   __ delayed()->srl (O2, 2, O4);
-  __ andn (O1, JNIHandles::weak_tag_mask, O1);
-  __ ld_ptr (O1, 0, O5);
+  __ mov(O1, O5);
+
+  // Both O5 and G3 are clobbered by try_resolve_jobject_in_native.
+  BarrierSetAssembler *bs = BarrierSet::barrier_set()->barrier_set_assembler();
+  bs->try_resolve_jobject_in_native(masm, /* jni_env */ O0, /* obj */ O5, /* tmp */ G3, label1);
+  DEBUG_ONLY(__ set(0xDEADC0DE, G3);)
 
   assert(count < LIST_CAPACITY, "LIST_CAPACITY too small");
   speculative_load_pclist[count] = __ pc();
--- a/src/hotspot/cpu/x86/jniFastGetField_x86_64.cpp	Thu May 17 14:31:31 2018 +0200
+++ b/src/hotspot/cpu/x86/jniFastGetField_x86_64.cpp	Thu May 17 11:56:21 2018 +0200
@@ -188,9 +188,11 @@
                                                 // robj is data dependent on rcounter.
   }
 
-  __ clear_jweak_tag(robj);
+  // Both robj and rtmp are clobbered by try_resolve_jobject_in_native.
+  BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
+  bs->try_resolve_jobject_in_native(masm, /* jni_env */ c_rarg0, robj, rtmp, slow);
+  DEBUG_ONLY(__ movl(rtmp, 0xDEADC0DE);)
 
-  __ movptr(robj, Address(robj, 0));             // *obj
   __ mov   (roffset, c_rarg2);
   __ shrptr(roffset, 2);                         // offset