< prev index next >

src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp

Print this page
@@ -59,10 +59,13 @@
  #endif
  #ifdef COMPILER2
  #include "adfiles/ad_aarch64.hpp"
  #include "opto/runtime.hpp"
  #endif
+ #if INCLUDE_SHENANDOAHGC
+ #include "gc/shenandoah/shenandoahRuntime.hpp"
+ #endif
  #if INCLUDE_JVMCI
  #include "jvmci/jvmciJavaClasses.hpp"
  #endif
  
  #define __ masm->

@@ -2903,5 +2906,61 @@
                                    oop_maps, false);
    return stub;
  }
  
  #endif // INCLUDE_JFR
+ 
+ RuntimeStub* SharedRuntime::generate_gc_slow_call_blob(StubId stub_id, address stub_addr, bool has_return, bool save_registers, bool save_vectors) {
+   const char* name = SharedRuntime::stub_name(stub_id);
+ 
+   CodeBuffer code(name, 2048, 64);
+   MacroAssembler* masm = new MacroAssembler(&code);
+   address start = __ pc();
+ 
+   RegisterSaver reg_save(save_vectors);
+ 
+   int frame_size_in_words = 0;
+   OopMap* map = nullptr;
+   if (save_registers) {
+     map = reg_save.save_live_registers(masm, 0, &frame_size_in_words);
+   } else {
+     map = new OopMap(frame_size_in_words, 0);
+   }
+   address frame_complete_pc = __ pc();
+ 
+   // Call the runtime. This is what MacroAssember::call_VM_leaf does,
+   // but we also want to have exact post-call PC for oop map location.
+   #ifdef _WIN64
+     // Windows always allocates space for it's register args
+     __ subptr(rsp, frame::arg_reg_save_area_bytes);
+   #endif
+ 
+   // Stacks on aarch64 are always aligned, no need to worry about that here
+   __ lea(rscratch1, RuntimeAddress(stub_addr));
+   __ blr(rscratch1);
+   address post_call_pc = __ pc();
+ 
+   #ifdef _WIN64
+     __ addptr(rsp, frame::arg_reg_save_area_bytes);
+   #endif
+ 
+   if (save_registers && has_return) {
+     // RegisterSaver would clobber the call result when restoring.
+     // Carry the result out of this stub by overwriting saved register.
+     __ str(r0, Address(sp, reg_save.reg_offset_in_bytes(r0)));
+   }
+ 
+   OopMapSet* oop_maps = new OopMapSet();
+   oop_maps->add_gc_map(post_call_pc - start, map);
+ 
+   if (save_registers) {
+     reg_save.restore_live_registers(masm);
+   }
+   __ ret(lr);
+ 
+   return RuntimeStub::new_runtime_stub(name,
+                                        &code,
+                                        frame_complete_pc - start,
+                                        frame_size_in_words,
+                                        oop_maps,
+                                        true);
+ }
< prev index next >