< prev index next >

src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp

Print this page

  44 #include "runtime/continuation.hpp"
  45 #include "runtime/continuationEntry.inline.hpp"
  46 #include "runtime/globals.hpp"
  47 #include "runtime/jniHandles.hpp"
  48 #include "runtime/safepointMechanism.hpp"
  49 #include "runtime/sharedRuntime.hpp"
  50 #include "runtime/signature.hpp"
  51 #include "runtime/stubRoutines.hpp"
  52 #include "runtime/timerTrace.hpp"
  53 #include "runtime/vframeArray.hpp"
  54 #include "utilities/align.hpp"
  55 #include "utilities/formatBuffer.hpp"
  56 #include "vmreg_aarch64.inline.hpp"
  57 #ifdef COMPILER1
  58 #include "c1/c1_Runtime1.hpp"
  59 #endif
  60 #ifdef COMPILER2
  61 #include "adfiles/ad_aarch64.hpp"
  62 #include "opto/runtime.hpp"
  63 #endif



  64 #if INCLUDE_JVMCI
  65 #include "jvmci/jvmciJavaClasses.hpp"
  66 #endif
  67 
  68 #define __ masm->
  69 
  70 #ifdef PRODUCT
  71 #define BLOCK_COMMENT(str) /* nothing */
  72 #else
  73 #define BLOCK_COMMENT(str) __ block_comment(str)
  74 #endif
  75 
  76 const int StackAlignmentInSlots = StackAlignmentInBytes / VMRegImpl::stack_slot_size;
  77 
  78 // FIXME -- this is used by C1
  79 class RegisterSaver {
  80   const bool _save_vectors;
  81  public:
  82   RegisterSaver(bool save_vectors) : _save_vectors(save_vectors) {}
  83 

2888   int frame_complete = __ pc() - start;
2889   address the_pc = __ pc();
2890   jfr_prologue(the_pc, masm, rthread);
2891   __ call_VM_leaf(CAST_FROM_FN_PTR(address, JfrIntrinsicSupport::return_lease), 1);
2892   jfr_epilogue(masm);
2893 
2894   __ leave();
2895   __ ret(lr);
2896 
2897   OopMap* map = new OopMap(framesize, 1); // rfp
2898   oop_maps->add_gc_map(the_pc - start, map);
2899 
2900   RuntimeStub* stub = // codeBlob framesize is in words (not VMRegImpl::slot_size)
2901     RuntimeStub::new_runtime_stub(name, &code, frame_complete,
2902                                   (framesize >> (LogBytesPerWord - LogBytesPerInt)),
2903                                   oop_maps, false);
2904   return stub;
2905 }
2906 
2907 #endif // INCLUDE_JFR

























































  44 #include "runtime/continuation.hpp"
  45 #include "runtime/continuationEntry.inline.hpp"
  46 #include "runtime/globals.hpp"
  47 #include "runtime/jniHandles.hpp"
  48 #include "runtime/safepointMechanism.hpp"
  49 #include "runtime/sharedRuntime.hpp"
  50 #include "runtime/signature.hpp"
  51 #include "runtime/stubRoutines.hpp"
  52 #include "runtime/timerTrace.hpp"
  53 #include "runtime/vframeArray.hpp"
  54 #include "utilities/align.hpp"
  55 #include "utilities/formatBuffer.hpp"
  56 #include "vmreg_aarch64.inline.hpp"
  57 #ifdef COMPILER1
  58 #include "c1/c1_Runtime1.hpp"
  59 #endif
  60 #ifdef COMPILER2
  61 #include "adfiles/ad_aarch64.hpp"
  62 #include "opto/runtime.hpp"
  63 #endif
  64 #if INCLUDE_SHENANDOAHGC
  65 #include "gc/shenandoah/shenandoahRuntime.hpp"
  66 #endif
  67 #if INCLUDE_JVMCI
  68 #include "jvmci/jvmciJavaClasses.hpp"
  69 #endif
  70 
  71 #define __ masm->
  72 
  73 #ifdef PRODUCT
  74 #define BLOCK_COMMENT(str) /* nothing */
  75 #else
  76 #define BLOCK_COMMENT(str) __ block_comment(str)
  77 #endif
  78 
  79 const int StackAlignmentInSlots = StackAlignmentInBytes / VMRegImpl::stack_slot_size;
  80 
  81 // FIXME -- this is used by C1
  82 class RegisterSaver {
  83   const bool _save_vectors;
  84  public:
  85   RegisterSaver(bool save_vectors) : _save_vectors(save_vectors) {}
  86 

2891   int frame_complete = __ pc() - start;
2892   address the_pc = __ pc();
2893   jfr_prologue(the_pc, masm, rthread);
2894   __ call_VM_leaf(CAST_FROM_FN_PTR(address, JfrIntrinsicSupport::return_lease), 1);
2895   jfr_epilogue(masm);
2896 
2897   __ leave();
2898   __ ret(lr);
2899 
2900   OopMap* map = new OopMap(framesize, 1); // rfp
2901   oop_maps->add_gc_map(the_pc - start, map);
2902 
2903   RuntimeStub* stub = // codeBlob framesize is in words (not VMRegImpl::slot_size)
2904     RuntimeStub::new_runtime_stub(name, &code, frame_complete,
2905                                   (framesize >> (LogBytesPerWord - LogBytesPerInt)),
2906                                   oop_maps, false);
2907   return stub;
2908 }
2909 
2910 #endif // INCLUDE_JFR
2911 
2912 RuntimeStub* SharedRuntime::generate_gc_slow_call_blob(StubId stub_id, address stub_addr, bool has_return, bool save_registers, bool save_vectors) {
2913   const char* name = SharedRuntime::stub_name(stub_id);
2914 
2915   CodeBuffer code(name, 2048, 64);
2916   MacroAssembler* masm = new MacroAssembler(&code);
2917   address start = __ pc();
2918 
2919   RegisterSaver reg_save(save_vectors);
2920 
2921   int frame_size_in_words = 0;
2922   OopMap* map = nullptr;
2923   if (save_registers) {
2924     map = reg_save.save_live_registers(masm, 0, &frame_size_in_words);
2925   } else {
2926     map = new OopMap(frame_size_in_words, 0);
2927   }
2928   address frame_complete_pc = __ pc();
2929 
2930   // Call the runtime. This is what MacroAssember::call_VM_leaf does,
2931   // but we also want to have exact post-call PC for oop map location.
2932   #ifdef _WIN64
2933     // Windows always allocates space for it's register args
2934     __ subptr(rsp, frame::arg_reg_save_area_bytes);
2935   #endif
2936 
2937   // Stacks on aarch64 are always aligned, no need to worry about that here
2938   __ lea(rscratch1, RuntimeAddress(stub_addr));
2939   __ blr(rscratch1);
2940   address post_call_pc = __ pc();
2941 
2942   #ifdef _WIN64
2943     __ addptr(rsp, frame::arg_reg_save_area_bytes);
2944   #endif
2945 
2946   if (save_registers && has_return) {
2947     // RegisterSaver would clobber the call result when restoring.
2948     // Carry the result out of this stub by overwriting saved register.
2949     __ str(r0, Address(sp, reg_save.reg_offset_in_bytes(r0)));
2950   }
2951 
2952   OopMapSet* oop_maps = new OopMapSet();
2953   oop_maps->add_gc_map(post_call_pc - start, map);
2954 
2955   if (save_registers) {
2956     reg_save.restore_live_registers(masm);
2957   }
2958   __ ret(lr);
2959 
2960   return RuntimeStub::new_runtime_stub(name,
2961                                        &code,
2962                                        frame_complete_pc - start,
2963                                        frame_size_in_words,
2964                                        oop_maps,
2965                                        true);
2966 }
< prev index next >