changeset 59215:fb39a8d1d101

8235262: Move c2i_entry_barrier for x86_32 to shared Reviewed-by: rkennke, eosterlund
author zgu
date Sun, 08 Dec 2019 10:05:57 -0500
parents 31882abe1494
children 046f9512418b
files src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.cpp src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.hpp
diffstat 3 files changed, 27 insertions(+), 56 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp	Sat Dec 07 09:40:28 2019 +0800
+++ b/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp	Sun Dec 08 10:05:57 2019 -0500
@@ -374,22 +374,41 @@
   __ cmpptr(rbx, 0); // rbx contains the incoming method for c2i adapters.
   __ jcc(Assembler::equal, bad_call);
 
+#ifdef _LP64
+  Register tmp1 = rscratch1;
+  Register tmp2 = rscratch2;
+#else
+  Register tmp1 = rax;
+  Register tmp2 = rcx;
+  __ push(tmp1);
+  __ push(tmp2);
+#endif // _LP64
+
   // Pointer chase to the method holder to find out if the method is concurrently unloading.
   Label method_live;
-  __ load_method_holder_cld(rscratch1, rbx);
+  __ load_method_holder_cld(tmp1, rbx);
 
-  // Is it a strong CLD?
-  __ movl(rscratch2, Address(rscratch1, ClassLoaderData::keep_alive_offset()));
-  __ cmpptr(rscratch2, 0);
+   // Is it a strong CLD?
+  __ cmpl(Address(tmp1, ClassLoaderData::keep_alive_offset()), 0);
   __ jcc(Assembler::greater, method_live);
 
-  // Is it a weak but alive CLD?
-  __ movptr(rscratch1, Address(rscratch1, ClassLoaderData::holder_offset()));
-  __ resolve_weak_handle(rscratch1, rscratch2);
-  __ cmpptr(rscratch1, 0);
+   // Is it a weak but alive CLD?
+  __ movptr(tmp1, Address(tmp1, ClassLoaderData::holder_offset()));
+  __ resolve_weak_handle(tmp1, tmp2);
+  __ cmpptr(tmp1, 0);
   __ jcc(Assembler::notEqual, method_live);
 
+#ifndef _LP64
+  __ pop(tmp2);
+  __ pop(tmp1);
+#endif
+
   __ bind(bad_call);
   __ jump(RuntimeAddress(SharedRuntime::get_handle_wrong_method_stub()));
   __ bind(method_live);
+
+#ifndef _LP64
+  __ pop(tmp2);
+  __ pop(tmp1);
+#endif
 }
--- a/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.cpp	Sat Dec 07 09:40:28 2019 +0800
+++ b/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.cpp	Sun Dec 08 10:05:57 2019 -0500
@@ -395,52 +395,6 @@
   __ block_comment("load_reference_barrier_native { ");
 }
 
-#ifdef _LP64
-void ShenandoahBarrierSetAssembler::c2i_entry_barrier(MacroAssembler* masm) {
-  // Use default version
-  BarrierSetAssembler::c2i_entry_barrier(masm);
-}
-#else
-void ShenandoahBarrierSetAssembler::c2i_entry_barrier(MacroAssembler* masm) {
-  BarrierSetNMethod* bs = BarrierSet::barrier_set()->barrier_set_nmethod();
-  if (bs == NULL) {
-    return;
-  }
-
-  Label bad_call;
-  __ cmpptr(rbx, 0); // rbx contains the incoming method for c2i adapters.
-  __ jcc(Assembler::equal, bad_call);
-
-  Register tmp1 = rax;
-  Register tmp2 = rcx;
-
-  __ push(tmp1);
-  __ push(tmp2);
-
-  // Pointer chase to the method holder to find out if the method is concurrently unloading.
-  Label method_live;
-  __ load_method_holder_cld(tmp1, rbx);
-
-   // Is it a strong CLD?
-  __ cmpl(Address(tmp1, ClassLoaderData::keep_alive_offset()), 0);
-  __ jcc(Assembler::greater, method_live);
-
-   // Is it a weak but alive CLD?
-  __ movptr(tmp1, Address(tmp1, ClassLoaderData::holder_offset()));
-  __ resolve_weak_handle(tmp1, tmp2);
-  __ cmpptr(tmp1, 0);
-  __ jcc(Assembler::notEqual, method_live);
-  __ pop(tmp2);
-  __ pop(tmp1);
-
-  __ bind(bad_call);
-  __ jump(RuntimeAddress(SharedRuntime::get_handle_wrong_method_stub()));
-  __ bind(method_live);
-  __ pop(tmp2);
-  __ pop(tmp1);
-}
-#endif
-
 void ShenandoahBarrierSetAssembler::storeval_barrier(MacroAssembler* masm, Register dst, Register tmp) {
   if (ShenandoahStoreValEnqueueBarrier) {
     storeval_barrier_impl(masm, dst, tmp);
--- a/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.hpp	Sat Dec 07 09:40:28 2019 +0800
+++ b/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.hpp	Sun Dec 08 10:05:57 2019 -0500
@@ -86,8 +86,6 @@
                         Address dst, Register val, Register tmp1, Register tmp2);
   virtual void try_resolve_jobject_in_native(MacroAssembler* masm, Register jni_env,
                                              Register obj, Register tmp, Label& slowpath);
-  virtual void c2i_entry_barrier(MacroAssembler* masm);
-
   virtual void barrier_stubs_init();
 
 };