< prev index next >

src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp

Print this page
@@ -37,10 +37,11 @@
  #include "gc/shared/cardTable.hpp"
  #include "gc/shared/collectedHeap.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 "nativeInst_aarch64.hpp"
  #include "oops/accessDecorators.hpp"

@@ -1953,19 +1954,34 @@
  }
  
  void MacroAssembler::call_VM_leaf_base(address entry_point,
                                         int number_of_arguments,
                                         Label *retaddr) {
-   Label E, L;
+   Label not_preempted;
  
    stp(rscratch1, rmethod, Address(pre(sp, -2 * wordSize)));
+   str(zr, Address(rthread, JavaThread::preempt_alternate_return_offset()));
  
    mov(rscratch1, entry_point);
    blr(rscratch1);
    if (retaddr)
      bind(*retaddr);
  
+   if (entry_point == CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorenter) || 
+       entry_point == CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorenter_obj)) {
+     ldr(rscratch1, Address(rthread, JavaThread::preempt_alternate_return_offset()));
+     ldr(rscratch2, Address(rthread, in_bytes(JavaThread::preempt_alternate_return_offset()) + wordSize));
+     cbz(rscratch1, not_preempted);
+     mov(r4, sp); // r4 is clobbered by VM calls, so free here
+     cmp(rscratch2, r4);
+     br(LT, not_preempted);
+     str(zr, Address(rthread, JavaThread::preempt_alternate_return_offset()));
+     str(zr, Address(rthread, in_bytes(JavaThread::preempt_alternate_return_offset()) + wordSize));
+     br(rscratch1);
+   }
+ 
+   bind(not_preempted);
    ldp(rscratch1, rmethod, Address(post(sp, 2 * wordSize)));
  }
  
  void MacroAssembler::call_VM_leaf(address entry_point, int number_of_arguments) {
    call_VM_leaf_base(entry_point, number_of_arguments);

@@ -5200,10 +5216,42 @@
                                     Label& slow_case) {
    BarrierSetAssembler *bs = BarrierSet::barrier_set()->barrier_set_assembler();
    bs->tlab_allocate(this, obj, var_size_in_bytes, con_size_in_bytes, t1, t2, slow_case);
  }
  
+ void MacroAssembler::inc_held_monitor_count() {
+   Address dst = Address(rthread, JavaThread::held_monitor_count_offset());
+ #ifdef ASSERT
+   ldr(rscratch2, dst);
+   increment(rscratch2);
+   str(rscratch2, dst);
+   Label ok;
+   tbz(rscratch2, 63, ok);
+   STOP("assert(held monitor count underflow)");
+   should_not_reach_here();
+   bind(ok);
+ #else
+   increment(dst);
+ #endif
+ }
+ 
+ void MacroAssembler::dec_held_monitor_count() {
+   Address dst = Address(rthread, JavaThread::held_monitor_count_offset());
+ #ifdef ASSERT
+   ldr(rscratch2, dst);
+   decrement(rscratch2);
+   str(rscratch2, dst);
+   Label ok;
+   tbz(rscratch2, 63, ok);
+   STOP("assert(held monitor count underflow)");
+   should_not_reach_here();
+   bind(ok);
+ #else
+   decrement(dst);
+ #endif
+ }
+ 
  void MacroAssembler::verify_tlab() {
  #ifdef ASSERT
    if (UseTLAB && VerifyOops) {
      Label next, ok;
  
< prev index next >