< 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),

 654         } else {
 655           assert(id == fast_new_instance_init_check_id, "bad StubID");
 656           __ set_info("fast new_instance init check", dont_gc_arguments);
 657         }
 658 
 659         __ enter();
 660         OopMap* map = save_live_registers(sasm);
 661         int call_offset = __ call_RT(obj, noreg, CAST_FROM_FN_PTR(address, new_instance), klass);
 662         oop_maps = new OopMapSet();
 663         oop_maps->add_gc_map(call_offset, map);
 664         restore_live_registers_except_r0(sasm);
 665         __ verify_oop(obj);
 666         __ leave();
 667         __ ret(lr);
 668 
 669         // r0,: new instance
 670       }
 671 
 672       break;
 673 










 674     case counter_overflow_id:
 675       {
 676         Register bci = r0, method = r1;
 677         __ enter();
 678         OopMap* map = save_live_registers(sasm);
 679         // Retrieve bci
 680         __ ldrw(bci, Address(rfp, 2*BytesPerWord));
 681         // And a pointer to the Method*
 682         __ ldr(method, Address(rfp, 3*BytesPerWord));
 683         int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, counter_overflow), bci, method);
 684         oop_maps = new OopMapSet();
 685         oop_maps->add_gc_map(call_offset, map);
 686         restore_live_registers(sasm);
 687         __ leave();
 688         __ ret(lr);
 689       }
 690       break;
 691 
 692     case new_type_array_id:
 693     case new_object_array_id:

 842         __ pop(RegSet::of(r0, r2, r4, r5), sp);
 843         __ ret(lr);
 844 
 845         __ bind(miss);
 846         __ str(zr, Address(sp, (result_off) * VMRegImpl::stack_slot_size)); // result
 847         __ pop(RegSet::of(r0, r2, r4, r5), sp);
 848         __ ret(lr);
 849       }
 850       break;
 851 
 852     case monitorenter_nofpu_id:
 853       save_fpu_registers = false;
 854       // fall through
 855     case monitorenter_id:
 856       {
 857         StubFrame f(sasm, "monitorenter", dont_gc_arguments);
 858         OopMap* map = save_live_registers(sasm, save_fpu_registers);
 859 
 860         // Called with store_parameter and not C abi
 861 
 862         f.load_argument(1, r0); // r0,: object
 863         f.load_argument(0, r1); // r1,: lock address
 864 
 865         int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, monitorenter), r0, r1);
 866 
 867         oop_maps = new OopMapSet();
 868         oop_maps->add_gc_map(call_offset, map);
 869         restore_live_registers(sasm, save_fpu_registers);
 870       }
 871       break;
 872 
 873     case monitorexit_nofpu_id:
 874       save_fpu_registers = false;
 875       // fall through
 876     case monitorexit_id:
 877       {
 878         StubFrame f(sasm, "monitorexit", dont_gc_arguments);
 879         OopMap* map = save_live_registers(sasm, save_fpu_registers);
 880 
 881         // Called with store_parameter and not C abi
 882 
 883         f.load_argument(0, r0); // r0,: lock address
 884 
 885         // note: really a leaf routine but must setup last java sp
 886         //       => use call_RT for now (speed can be improved by
 887         //       doing last java sp setup manually)
 888         int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, monitorexit), r0);
 889 
 890         oop_maps = new OopMapSet();
 891         oop_maps->add_gc_map(call_offset, map);
 892         restore_live_registers(sasm, save_fpu_registers);
 893       }
 894       break;
 895 
 896     case deoptimize_id:
 897       {
 898         StubFrame f(sasm, "deoptimize", dont_gc_arguments, does_not_return);
 899         OopMap* oop_map = save_live_registers(sasm);
 900         f.load_argument(0, c_rarg1);
 901         int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, deoptimize), c_rarg1);
 902 
 903         oop_maps = new OopMapSet();

 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),

 658         } else {
 659           assert(id == fast_new_instance_init_check_id, "bad StubID");
 660           __ set_info("fast new_instance init check", dont_gc_arguments);
 661         }
 662 
 663         __ enter();
 664         OopMap* map = save_live_registers(sasm);
 665         int call_offset = __ call_RT(obj, noreg, CAST_FROM_FN_PTR(address, new_instance), klass);
 666         oop_maps = new OopMapSet();
 667         oop_maps->add_gc_map(call_offset, map);
 668         restore_live_registers_except_r0(sasm);
 669         __ verify_oop(obj);
 670         __ leave();
 671         __ ret(lr);
 672 
 673         // r0,: new instance
 674       }
 675 
 676       break;
 677 
 678     case load_klass_id:
 679       {
 680         StubFrame f(sasm, "load_klass", dont_gc_arguments);
 681         save_live_registers_no_oop_map(sasm, true);
 682         f.load_argument(0, r0); // obj
 683         __ call_VM_leaf(CAST_FROM_FN_PTR(address, oopDesc::load_nklass_runtime), r0);
 684         restore_live_registers_except_r0(sasm, true);
 685       }
 686       break;
 687 
 688     case counter_overflow_id:
 689       {
 690         Register bci = r0, method = r1;
 691         __ enter();
 692         OopMap* map = save_live_registers(sasm);
 693         // Retrieve bci
 694         __ ldrw(bci, Address(rfp, 2*BytesPerWord));
 695         // And a pointer to the Method*
 696         __ ldr(method, Address(rfp, 3*BytesPerWord));
 697         int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, counter_overflow), bci, method);
 698         oop_maps = new OopMapSet();
 699         oop_maps->add_gc_map(call_offset, map);
 700         restore_live_registers(sasm);
 701         __ leave();
 702         __ ret(lr);
 703       }
 704       break;
 705 
 706     case new_type_array_id:
 707     case new_object_array_id:

 856         __ pop(RegSet::of(r0, r2, r4, r5), sp);
 857         __ ret(lr);
 858 
 859         __ bind(miss);
 860         __ str(zr, Address(sp, (result_off) * VMRegImpl::stack_slot_size)); // result
 861         __ pop(RegSet::of(r0, r2, r4, r5), sp);
 862         __ ret(lr);
 863       }
 864       break;
 865 
 866     case monitorenter_nofpu_id:
 867       save_fpu_registers = false;
 868       // fall through
 869     case monitorenter_id:
 870       {
 871         StubFrame f(sasm, "monitorenter", dont_gc_arguments);
 872         OopMap* map = save_live_registers(sasm, save_fpu_registers);
 873 
 874         // Called with store_parameter and not C abi
 875 
 876         f.load_argument(0, r0); // r0,: object

 877 
 878         int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, monitorenter), r0);
 879 
 880         oop_maps = new OopMapSet();
 881         oop_maps->add_gc_map(call_offset, map);
 882         restore_live_registers(sasm, save_fpu_registers);
 883       }
 884       break;
 885 
 886     case monitorexit_nofpu_id:
 887       save_fpu_registers = false;
 888       // fall through
 889     case monitorexit_id:
 890       {
 891         StubFrame f(sasm, "monitorexit", dont_gc_arguments);
 892         OopMap* map = save_live_registers(sasm, save_fpu_registers);
 893 
 894         // Called with store_parameter and not C abi
 895 
 896         f.load_argument(0, r0); // r0: object
 897 
 898         // note: really a leaf routine but must setup last java sp
 899         //       => use call_RT for now (speed can be improved by
 900         //       doing last java sp setup manually)
 901         int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, monitorexit), r0);
 902 
 903         oop_maps = new OopMapSet();
 904         oop_maps->add_gc_map(call_offset, map);
 905         restore_live_registers(sasm, save_fpu_registers);
 906       }
 907       break;
 908 
 909     case deoptimize_id:
 910       {
 911         StubFrame f(sasm, "deoptimize", dont_gc_arguments, does_not_return);
 912         OopMap* oop_map = save_live_registers(sasm);
 913         f.load_argument(0, c_rarg1);
 914         int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, deoptimize), c_rarg1);
 915 
 916         oop_maps = new OopMapSet();
< prev index next >