< prev index next >

src/hotspot/cpu/aarch64/gc/shared/barrierSetNMethod_aarch64.cpp

Print this page
@@ -161,10 +161,35 @@
    NativeNMethodBarrier* barrier = reinterpret_cast<NativeNMethodBarrier*>(barrier_address);
    debug_only(barrier->verify());
    return barrier;
  }
  
+ static void set_value(nmethod* nm, jint val) {
+   NativeNMethodBarrier* cmp1 = native_nmethod_barrier(nm);
+   cmp1->set_value(nm, val);
+ 
+   if (!nm->is_osr_method() && nm->method()->has_scalarized_args()) {
+     // nmethods with scalarized arguments have multiple entry points that each have an own nmethod entry barrier
+     assert(nm->verified_entry_point() != nm->verified_inline_entry_point(), "scalarized entry point not found");
+     address method_body = nm->is_compiled_by_c1() ? nm->verified_inline_entry_point() : nm->verified_entry_point();
+     address entry_point2 = nm->is_compiled_by_c1() ? nm->verified_entry_point() : nm->verified_inline_entry_point();
+ 
+     int barrier_offset = reinterpret_cast<address>(cmp1) - method_body;
+     NativeNMethodBarrier* cmp2 = reinterpret_cast<NativeNMethodBarrier*>(entry_point2 + barrier_offset);
+     assert(cmp1 != cmp2, "sanity");
+     debug_only(cmp2->verify());
+     cmp2->set_value(nm, val);
+ 
+     if (method_body != nm->verified_inline_ro_entry_point() && entry_point2 != nm->verified_inline_ro_entry_point()) {
+       NativeNMethodBarrier* cmp3 = reinterpret_cast<NativeNMethodBarrier*>(nm->verified_inline_ro_entry_point() + barrier_offset);
+       assert(cmp1 != cmp3 && cmp2 != cmp3, "sanity");
+       debug_only(cmp3->verify());
+       cmp3->set_value(nm, val);
+     }
+   }
+ }
+ 
  void BarrierSetNMethod::disarm(nmethod* nm) {
    if (!supports_entry_barrier(nm)) {
      return;
    }
  

@@ -177,12 +202,11 @@
    BarrierSetAssembler* bs_asm = BarrierSet::barrier_set()->barrier_set_assembler();
    bs_asm->increment_patching_epoch();
  
    // Disarms the nmethod guard emitted by BarrierSetAssembler::nmethod_entry_barrier.
    // Symmetric "LDR; DMB ISHLD" is in the nmethod barrier.
-   NativeNMethodBarrier* barrier = native_nmethod_barrier(nm);
-   barrier->set_value(nm, disarmed_value());
+   set_value(nm, disarmed_value());
  }
  
  void BarrierSetNMethod::arm(nmethod* nm, int arm_value) {
    if (!supports_entry_barrier(nm)) {
      return;

@@ -197,12 +221,11 @@
      // further fencing by mutators, before they are allowed to enter.
      BarrierSetAssembler* bs_asm = BarrierSet::barrier_set()->barrier_set_assembler();
      bs_asm->increment_patching_epoch();
    }
  
-   NativeNMethodBarrier* barrier = native_nmethod_barrier(nm);
-   barrier->set_value(nm, arm_value);
+   set_value(nm, arm_value);
  }
  
  bool BarrierSetNMethod::is_armed(nmethod* nm) {
    if (!supports_entry_barrier(nm)) {
      return false;
< prev index next >