< prev index next >

src/hotspot/cpu/aarch64/c2_MacroAssembler_aarch64.cpp

Print this page
@@ -43,10 +43,33 @@
  
  #define BIND(label) bind(label); BLOCK_COMMENT(#label ":")
  
  typedef void (MacroAssembler::* chr_insn)(Register Rt, const Address &adr);
  
+ void C2_MacroAssembler::entry_barrier() {
+   BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
+   if (BarrierSet::barrier_set()->barrier_set_nmethod() != nullptr) {
+     // Dummy labels for just measuring the code size
+     Label dummy_slow_path;
+     Label dummy_continuation;
+     Label dummy_guard;
+     Label* slow_path = &dummy_slow_path;
+     Label* continuation = &dummy_continuation;
+     Label* guard = &dummy_guard;
+     if (!Compile::current()->output()->in_scratch_emit_size()) {
+       // Use real labels from actual stub when not emitting code for the purpose of measuring its size
+       C2EntryBarrierStub* stub = new (Compile::current()->comp_arena()) C2EntryBarrierStub();
+       Compile::current()->output()->add_stub(stub);
+       slow_path = &stub->entry();
+       continuation = &stub->continuation();
+       guard = &stub->guard();
+     }
+     // In the C2 code, we move the non-hot part of nmethod entry barriers out-of-line to a stub.
+     bs->nmethod_entry_barrier(this, slow_path, continuation, guard);
+   }
+ }
+ 
  // Search for str1 in str2 and return index or -1
  // Clobbers: rscratch1, rscratch2, rflags. May also clobber v0-v1, when icnt1==-1.
  void C2_MacroAssembler::string_indexof(Register str2, Register str1,
                                         Register cnt2, Register cnt1,
                                         Register tmp1, Register tmp2,
< prev index next >