< prev index next >

src/hotspot/cpu/aarch64/c1_Runtime1_aarch64.cpp

Print this page

 256     if (i <= 18 && i != rscratch1->encoding() && i != rscratch2->encoding()) {
 257       int sp_offset = cpu_reg_save_offsets[i];
 258       oop_map->set_callee_saved(VMRegImpl::stack2reg(sp_offset),
 259                                 r->as_VMReg());
 260     }
 261   }
 262 
 263   if (save_fpu_registers) {
 264     for (int i = 0; i < FrameMap::nof_fpu_regs; i++) {
 265       FloatRegister r = as_FloatRegister(i);
 266       {
 267         int sp_offset = fpu_reg_save_offsets[i];
 268         oop_map->set_callee_saved(VMRegImpl::stack2reg(sp_offset),
 269                                   r->as_VMReg());
 270       }
 271     }
 272   }
 273   return oop_map;
 274 }
 275 
 276 static OopMap* save_live_registers(StubAssembler* sasm,
 277                                    bool save_fpu_registers = true) {
 278   __ block_comment("save_live_registers");
 279 
 280   __ push(RegSet::range(r0, r29), sp);         // integer registers except lr & sp
 281 
 282   if (save_fpu_registers) {
 283     for (int i = 31; i>= 0; i -= 4) {
 284       __ sub(sp, sp, 4 * wordSize); // no pre-increment for st1. Emulate it without modifying other registers
 285       __ st1(as_FloatRegister(i-3), as_FloatRegister(i-2), as_FloatRegister(i-1),
 286           as_FloatRegister(i), __ T1D, Address(sp));
 287     }
 288   } else {
 289     __ add(sp, sp, -32 * wordSize);
 290   }

 291 



 292   return generate_oop_map(sasm, save_fpu_registers);
 293 }
 294 
 295 static void restore_live_registers(StubAssembler* sasm, bool restore_fpu_registers = true) {
 296   if (restore_fpu_registers) {
 297     for (int i = 0; i < 32; i += 4)
 298       __ ld1(as_FloatRegister(i), as_FloatRegister(i+1), as_FloatRegister(i+2),
 299           as_FloatRegister(i+3), __ T1D, Address(__ post(sp, 4 * wordSize)));
 300   } else {
 301     __ add(sp, sp, 32 * wordSize);
 302   }
 303 
 304   __ pop(RegSet::range(r0, r29), sp);
 305 }
 306 
 307 static void restore_live_registers_except_r0(StubAssembler* sasm, bool restore_fpu_registers = true)  {
 308 
 309   if (restore_fpu_registers) {
 310     for (int i = 0; i < 32; i += 4)
 311       __ ld1(as_FloatRegister(i), as_FloatRegister(i+1), as_FloatRegister(i+2),

 698 
 699           __ bind(slow_path);
 700           __ ldp(r19, zr, Address(__ post(sp, 2 * wordSize)));
 701         }
 702 
 703         __ enter();
 704         OopMap* map = save_live_registers(sasm);
 705         int call_offset = __ call_RT(obj, noreg, CAST_FROM_FN_PTR(address, new_instance), klass);
 706         oop_maps = new OopMapSet();
 707         oop_maps->add_gc_map(call_offset, map);
 708         restore_live_registers_except_r0(sasm);
 709         __ verify_oop(obj);
 710         __ leave();
 711         __ ret(lr);
 712 
 713         // r0,: new instance
 714       }
 715 
 716       break;
 717 










 718     case counter_overflow_id:
 719       {
 720         Register bci = r0, method = r1;
 721         __ enter();
 722         OopMap* map = save_live_registers(sasm);
 723         // Retrieve bci
 724         __ ldrw(bci, Address(rfp, 2*BytesPerWord));
 725         // And a pointer to the Method*
 726         __ ldr(method, Address(rfp, 3*BytesPerWord));
 727         int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, counter_overflow), bci, method);
 728         oop_maps = new OopMapSet();
 729         oop_maps->add_gc_map(call_offset, map);
 730         restore_live_registers(sasm);
 731         __ leave();
 732         __ ret(lr);
 733       }
 734       break;
 735 
 736     case new_type_array_id:
 737     case new_object_array_id:

 256     if (i <= 18 && i != rscratch1->encoding() && i != rscratch2->encoding()) {
 257       int sp_offset = cpu_reg_save_offsets[i];
 258       oop_map->set_callee_saved(VMRegImpl::stack2reg(sp_offset),
 259                                 r->as_VMReg());
 260     }
 261   }
 262 
 263   if (save_fpu_registers) {
 264     for (int i = 0; i < FrameMap::nof_fpu_regs; i++) {
 265       FloatRegister r = as_FloatRegister(i);
 266       {
 267         int sp_offset = fpu_reg_save_offsets[i];
 268         oop_map->set_callee_saved(VMRegImpl::stack2reg(sp_offset),
 269                                   r->as_VMReg());
 270       }
 271     }
 272   }
 273   return oop_map;
 274 }
 275 
 276 static void save_live_registers_no_oop_map(StubAssembler* sasm,
 277                                               bool save_fpu_registers = true) {
 278   __ block_comment("save_live_registers");
 279 
 280   __ push(RegSet::range(r0, r29), sp);         // integer registers except lr & sp
 281 
 282   if (save_fpu_registers) {
 283     for (int i = 31; i>= 0; i -= 4) {
 284       __ sub(sp, sp, 4 * wordSize); // no pre-increment for st1. Emulate it without modifying other registers
 285       __ st1(as_FloatRegister(i-3), as_FloatRegister(i-2), as_FloatRegister(i-1),
 286           as_FloatRegister(i), __ T1D, Address(sp));
 287     }
 288   } else {
 289     __ add(sp, sp, -32 * wordSize);
 290   }
 291 }
 292 
 293 static OopMap* save_live_registers(StubAssembler* sasm,
 294                                    bool save_fpu_registers = true) {
 295   save_live_registers_no_oop_map(sasm, save_fpu_registers);
 296   return generate_oop_map(sasm, save_fpu_registers);
 297 }
 298 
 299 static void restore_live_registers(StubAssembler* sasm, bool restore_fpu_registers = true) {
 300   if (restore_fpu_registers) {
 301     for (int i = 0; i < 32; i += 4)
 302       __ ld1(as_FloatRegister(i), as_FloatRegister(i+1), as_FloatRegister(i+2),
 303           as_FloatRegister(i+3), __ T1D, Address(__ post(sp, 4 * wordSize)));
 304   } else {
 305     __ add(sp, sp, 32 * wordSize);
 306   }
 307 
 308   __ pop(RegSet::range(r0, r29), sp);
 309 }
 310 
 311 static void restore_live_registers_except_r0(StubAssembler* sasm, bool restore_fpu_registers = true)  {
 312 
 313   if (restore_fpu_registers) {
 314     for (int i = 0; i < 32; i += 4)
 315       __ ld1(as_FloatRegister(i), as_FloatRegister(i+1), as_FloatRegister(i+2),

 702 
 703           __ bind(slow_path);
 704           __ ldp(r19, zr, Address(__ post(sp, 2 * wordSize)));
 705         }
 706 
 707         __ enter();
 708         OopMap* map = save_live_registers(sasm);
 709         int call_offset = __ call_RT(obj, noreg, CAST_FROM_FN_PTR(address, new_instance), klass);
 710         oop_maps = new OopMapSet();
 711         oop_maps->add_gc_map(call_offset, map);
 712         restore_live_registers_except_r0(sasm);
 713         __ verify_oop(obj);
 714         __ leave();
 715         __ ret(lr);
 716 
 717         // r0,: new instance
 718       }
 719 
 720       break;
 721 
 722     case load_klass_id:
 723       {
 724         StubFrame f(sasm, "load_klass", dont_gc_arguments);
 725         save_live_registers_no_oop_map(sasm, true);
 726         f.load_argument(0, r0); // obj
 727         __ call_VM_leaf(CAST_FROM_FN_PTR(address, oopDesc::load_klass_runtime), r0);
 728         restore_live_registers_except_r0(sasm, true);
 729       }
 730       break;
 731 
 732     case counter_overflow_id:
 733       {
 734         Register bci = r0, method = r1;
 735         __ enter();
 736         OopMap* map = save_live_registers(sasm);
 737         // Retrieve bci
 738         __ ldrw(bci, Address(rfp, 2*BytesPerWord));
 739         // And a pointer to the Method*
 740         __ ldr(method, Address(rfp, 3*BytesPerWord));
 741         int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, counter_overflow), bci, method);
 742         oop_maps = new OopMapSet();
 743         oop_maps->add_gc_map(call_offset, map);
 744         restore_live_registers(sasm);
 745         __ leave();
 746         __ ret(lr);
 747       }
 748       break;
 749 
 750     case new_type_array_id:
 751     case new_object_array_id:
< prev index next >