< prev index next >

src/hotspot/cpu/x86/macroAssembler_x86.cpp

Print this page
@@ -33,10 +33,11 @@
  #include "gc/shared/barrierSetAssembler.hpp"
  #include "gc/shared/collectedHeap.inline.hpp"
  #include "gc/shared/tlab_globals.hpp"
  #include "interpreter/bytecodeHistogram.hpp"
  #include "interpreter/interpreter.hpp"
+ #include "interpreter/interpreterRuntime.hpp"
  #include "jvm.h"
  #include "memory/resourceArea.hpp"
  #include "memory/universe.hpp"
  #include "oops/accessDecorators.hpp"
  #include "oops/compressedKlass.inline.hpp"

@@ -527,10 +528,20 @@
  #ifdef _WIN64
    // restore stack pointer
    addq(rsp, frame::arg_reg_save_area_bytes);
  #endif
  
+   if (entry_point == CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorenter) ||
+       entry_point == CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorenter_obj)) {
+     Label not_preempted;
+     movptr(rscratch1, Address(r15_thread, JavaThread::preempt_alternate_return_offset()));
+     cmpptr(rscratch1, NULL_WORD);
+     jccb(Assembler::zero, not_preempted);
+     movptr(Address(r15_thread, JavaThread::preempt_alternate_return_offset()), NULL_WORD);
+     jmp(rscratch1);
+     bind(not_preempted);
+   }
  }
  
  void MacroAssembler::cmp64(Register src1, AddressLiteral src2, Register rscratch) {
    assert(!src2.is_lval(), "should use cmpptr");
    assert(rscratch != noreg || always_reachable(src2), "missing");
< prev index next >