src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp
changeset 52142 ca0c25e01c5b
parent 50728 9375184cec98
child 54786 ebf733a324d4
--- a/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp	Tue Oct 16 13:16:11 2018 +0200
+++ b/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp	Tue Oct 16 13:18:22 2018 +0200
@@ -23,7 +23,9 @@
  */
 
 #include "precompiled.hpp"
+#include "gc/shared/barrierSet.hpp"
 #include "gc/shared/barrierSetAssembler.hpp"
+#include "gc/shared/barrierSetNMethod.hpp"
 #include "gc/shared/collectedHeap.hpp"
 #include "interpreter/interp_masm.hpp"
 #include "runtime/jniHandles.hpp"
@@ -322,3 +324,22 @@
   __ adcl(Address(thread, in_bytes(JavaThread::allocated_bytes_offset())+4), 0);
 #endif
 }
+
+void BarrierSetAssembler::nmethod_entry_barrier(MacroAssembler* masm) {
+  BarrierSetNMethod* bs_nm = BarrierSet::barrier_set()->barrier_set_nmethod();
+  if (bs_nm == NULL) {
+    return;
+  }
+#ifndef _LP64
+  ShouldNotReachHere();
+#else
+  Label continuation;
+  Register thread = LP64_ONLY(r15_thread);
+  Address disarmed_addr(thread, in_bytes(bs_nm->thread_disarmed_offset()));
+  __ align(8);
+  __ cmpl(disarmed_addr, 0);
+  __ jcc(Assembler::equal, continuation);
+  __ call(RuntimeAddress(StubRoutines::x86::method_entry_barrier()));
+  __ bind(continuation);
+#endif
+}