< prev index next >

src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp

Print this page




 118 #if COMPILER2_OR_JVMCI
 119   if (save_vectors) {
 120     // Save upper half of vector registers
 121     int vect_words = 32 * 8 / wordSize;
 122     additional_frame_words += vect_words;
 123   }
 124 #else
 125   assert(!save_vectors, "vectors are generated only by C2 and JVMCI");
 126 #endif
 127 
 128   int frame_size_in_bytes = align_up(additional_frame_words*wordSize +
 129                                      reg_save_size*BytesPerInt, 16);
 130   // OopMap frame size is in compiler stack slots (jint's) not bytes or words
 131   int frame_size_in_slots = frame_size_in_bytes / BytesPerInt;
 132   // The caller will allocate additional_frame_words
 133   int additional_frame_slots = additional_frame_words*wordSize / BytesPerInt;
 134   // CodeBlob frame size is in words.
 135   int frame_size_in_words = frame_size_in_bytes / wordSize;
 136   *total_frame_words = frame_size_in_words;
 137 
 138   // Save Integer and Float registers.

 139   __ enter();
 140   __ push_CPU_state(save_vectors);
 141 
 142   // Set an oopmap for the call site.  This oopmap will map all
 143   // oop-registers and debug-info registers as callee-saved.  This
 144   // will allow deoptimization at this safepoint to find all possible
 145   // debug-info recordings, as well as let GC find all oops.
 146 
 147   OopMapSet *oop_maps = new OopMapSet();
 148   OopMap* oop_map = new OopMap(frame_size_in_slots, 0);
 149 
 150   for (int i = 0; i < RegisterImpl::number_of_registers; i++) {
 151     Register r = as_Register(i);
 152     if (r < rheapbase && r != rscratch1 && r != rscratch2) {
 153       int sp_offset = 2 * (i + 32); // SP offsets are in 4-byte words,
 154                                     // register slots are 8 bytes
 155                                     // wide, 32 floating-point
 156                                     // registers
 157       oop_map->set_callee_saved(VMRegImpl::stack2reg(sp_offset + additional_frame_slots),
 158                                 r->as_VMReg());


2862 //------------------------------generate_handler_blob------
2863 //
2864 // Generate a special Compile2Runtime blob that saves all registers,
2865 // and setup oopmap.
2866 //
2867 SafepointBlob* SharedRuntime::generate_handler_blob(address call_ptr, int poll_type) {
2868   ResourceMark rm;
2869   OopMapSet *oop_maps = new OopMapSet();
2870   OopMap* map;
2871 
2872   // Allocate space for the code.  Setup code generation tools.
2873   CodeBuffer buffer("handler_blob", 2048, 1024);
2874   MacroAssembler* masm = new MacroAssembler(&buffer);
2875 
2876   address start   = __ pc();
2877   address call_pc = NULL;
2878   int frame_size_in_words;
2879   bool cause_return = (poll_type == POLL_AT_RETURN);
2880   bool save_vectors = (poll_type == POLL_AT_VECTOR_LOOP);
2881 
2882   // Save Integer and Float registers.
2883   map = RegisterSaver::save_live_registers(masm, 0, &frame_size_in_words, save_vectors);
2884 
2885   // The following is basically a call_VM.  However, we need the precise
2886   // address of the call in order to generate an oopmap. Hence, we do all the
2887   // work outselves.
2888 
2889   Label retaddr;
2890   __ set_last_Java_frame(sp, noreg, retaddr, rscratch1);
2891 
2892   // The return address must always be correct so that frame constructor never
2893   // sees an invalid pc.
2894 
2895   if (!cause_return) {
2896     // overwrite the return address pushed by save_live_registers
2897     // Additionally, r20 is a callee-saved register so we can look at
2898     // it later to determine if someone changed the return address for
2899     // us!
2900     __ ldr(r20, Address(rthread, JavaThread::saved_exception_pc_offset()));
2901     __ str(r20, Address(rfp, wordSize));
2902   }




 118 #if COMPILER2_OR_JVMCI
 119   if (save_vectors) {
 120     // Save upper half of vector registers
 121     int vect_words = 32 * 8 / wordSize;
 122     additional_frame_words += vect_words;
 123   }
 124 #else
 125   assert(!save_vectors, "vectors are generated only by C2 and JVMCI");
 126 #endif
 127 
 128   int frame_size_in_bytes = align_up(additional_frame_words*wordSize +
 129                                      reg_save_size*BytesPerInt, 16);
 130   // OopMap frame size is in compiler stack slots (jint's) not bytes or words
 131   int frame_size_in_slots = frame_size_in_bytes / BytesPerInt;
 132   // The caller will allocate additional_frame_words
 133   int additional_frame_slots = additional_frame_words*wordSize / BytesPerInt;
 134   // CodeBlob frame size is in words.
 135   int frame_size_in_words = frame_size_in_bytes / wordSize;
 136   *total_frame_words = frame_size_in_words;
 137 
 138   // Save registers, fpu state, and flags.
 139 
 140   __ enter();
 141   __ push_CPU_state(save_vectors);
 142 
 143   // Set an oopmap for the call site.  This oopmap will map all
 144   // oop-registers and debug-info registers as callee-saved.  This
 145   // will allow deoptimization at this safepoint to find all possible
 146   // debug-info recordings, as well as let GC find all oops.
 147 
 148   OopMapSet *oop_maps = new OopMapSet();
 149   OopMap* oop_map = new OopMap(frame_size_in_slots, 0);
 150 
 151   for (int i = 0; i < RegisterImpl::number_of_registers; i++) {
 152     Register r = as_Register(i);
 153     if (r < rheapbase && r != rscratch1 && r != rscratch2) {
 154       int sp_offset = 2 * (i + 32); // SP offsets are in 4-byte words,
 155                                     // register slots are 8 bytes
 156                                     // wide, 32 floating-point
 157                                     // registers
 158       oop_map->set_callee_saved(VMRegImpl::stack2reg(sp_offset + additional_frame_slots),
 159                                 r->as_VMReg());


2863 //------------------------------generate_handler_blob------
2864 //
2865 // Generate a special Compile2Runtime blob that saves all registers,
2866 // and setup oopmap.
2867 //
2868 SafepointBlob* SharedRuntime::generate_handler_blob(address call_ptr, int poll_type) {
2869   ResourceMark rm;
2870   OopMapSet *oop_maps = new OopMapSet();
2871   OopMap* map;
2872 
2873   // Allocate space for the code.  Setup code generation tools.
2874   CodeBuffer buffer("handler_blob", 2048, 1024);
2875   MacroAssembler* masm = new MacroAssembler(&buffer);
2876 
2877   address start   = __ pc();
2878   address call_pc = NULL;
2879   int frame_size_in_words;
2880   bool cause_return = (poll_type == POLL_AT_RETURN);
2881   bool save_vectors = (poll_type == POLL_AT_VECTOR_LOOP);
2882 
2883   // Save registers, fpu state, and flags
2884   map = RegisterSaver::save_live_registers(masm, 0, &frame_size_in_words, save_vectors);
2885 
2886   // The following is basically a call_VM.  However, we need the precise
2887   // address of the call in order to generate an oopmap. Hence, we do all the
2888   // work outselves.
2889 
2890   Label retaddr;
2891   __ set_last_Java_frame(sp, noreg, retaddr, rscratch1);
2892 
2893   // The return address must always be correct so that frame constructor never
2894   // sees an invalid pc.
2895 
2896   if (!cause_return) {
2897     // overwrite the return address pushed by save_live_registers
2898     // Additionally, r20 is a callee-saved register so we can look at
2899     // it later to determine if someone changed the return address for
2900     // us!
2901     __ ldr(r20, Address(rthread, JavaThread::saved_exception_pc_offset()));
2902     __ str(r20, Address(rfp, wordSize));
2903   }


< prev index next >