1640 // for real runtime callouts it will be six instructions |
1640 // for real runtime callouts it will be six instructions |
1641 // see aarch64_enc_java_to_runtime |
1641 // see aarch64_enc_java_to_runtime |
1642 // adr(rscratch2, retaddr) |
1642 // adr(rscratch2, retaddr) |
1643 // lea(rscratch1, RuntimeAddress(addr) |
1643 // lea(rscratch1, RuntimeAddress(addr) |
1644 // stp(zr, rscratch2, Address(__ pre(sp, -2 * wordSize))) |
1644 // stp(zr, rscratch2, Address(__ pre(sp, -2 * wordSize))) |
1645 // blrt rscratch1 |
1645 // blr(rscratch1) |
1646 CodeBlob *cb = CodeCache::find_blob(_entry_point); |
1646 CodeBlob *cb = CodeCache::find_blob(_entry_point); |
1647 if (cb) { |
1647 if (cb) { |
1648 return MacroAssembler::far_branch_size(); |
1648 return MacroAssembler::far_branch_size(); |
1649 } else { |
1649 } else { |
1650 return 6 * NativeInstruction::instruction_size; |
1650 return 6 * NativeInstruction::instruction_size; |
1776 if (C->need_stack_bang(bangsize) && UseStackBanging) |
1776 if (C->need_stack_bang(bangsize) && UseStackBanging) |
1777 __ generate_stack_overflow_check(bangsize); |
1777 __ generate_stack_overflow_check(bangsize); |
1778 |
1778 |
1779 __ build_frame(framesize); |
1779 __ build_frame(framesize); |
1780 |
1780 |
1781 if (NotifySimulator) { |
|
1782 __ notify(Assembler::method_entry); |
|
1783 } |
|
1784 |
|
1785 if (VerifyStackAtCalls) { |
1781 if (VerifyStackAtCalls) { |
1786 Unimplemented(); |
1782 Unimplemented(); |
1787 } |
1783 } |
1788 |
1784 |
1789 C->set_frame_complete(cbuf.insts_size()); |
1785 C->set_frame_complete(cbuf.insts_size()); |
1839 Compile* C = ra_->C; |
1835 Compile* C = ra_->C; |
1840 MacroAssembler _masm(&cbuf); |
1836 MacroAssembler _masm(&cbuf); |
1841 int framesize = C->frame_slots() << LogBytesPerInt; |
1837 int framesize = C->frame_slots() << LogBytesPerInt; |
1842 |
1838 |
1843 __ remove_frame(framesize); |
1839 __ remove_frame(framesize); |
1844 |
|
1845 if (NotifySimulator) { |
|
1846 __ notify(Assembler::method_reentry); |
|
1847 } |
|
1848 |
1840 |
1849 if (StackReservedPages > 0 && C->has_reserved_stack_access()) { |
1841 if (StackReservedPages > 0 && C->has_reserved_stack_access()) { |
1850 __ reserved_stack_check(); |
1842 __ reserved_stack_check(); |
1851 } |
1843 } |
1852 |
1844 |
2505 } |
2497 } |
2506 |
2498 |
2507 void Compile::reshape_address(AddPNode* addp) { |
2499 void Compile::reshape_address(AddPNode* addp) { |
2508 } |
2500 } |
2509 |
2501 |
2510 // helper for encoding java_to_runtime calls on sim |
|
2511 // |
|
2512 // this is needed to compute the extra arguments required when |
|
2513 // planting a call to the simulator blrt instruction. the TypeFunc |
|
2514 // can be queried to identify the counts for integral, and floating |
|
2515 // arguments and the return type |
|
2516 |
|
2517 static void getCallInfo(const TypeFunc *tf, int &gpcnt, int &fpcnt, int &rtype) |
|
2518 { |
|
2519 int gps = 0; |
|
2520 int fps = 0; |
|
2521 const TypeTuple *domain = tf->domain(); |
|
2522 int max = domain->cnt(); |
|
2523 for (int i = TypeFunc::Parms; i < max; i++) { |
|
2524 const Type *t = domain->field_at(i); |
|
2525 switch(t->basic_type()) { |
|
2526 case T_FLOAT: |
|
2527 case T_DOUBLE: |
|
2528 fps++; |
|
2529 default: |
|
2530 gps++; |
|
2531 } |
|
2532 } |
|
2533 gpcnt = gps; |
|
2534 fpcnt = fps; |
|
2535 BasicType rt = tf->return_type(); |
|
2536 switch (rt) { |
|
2537 case T_VOID: |
|
2538 rtype = MacroAssembler::ret_type_void; |
|
2539 break; |
|
2540 default: |
|
2541 rtype = MacroAssembler::ret_type_integral; |
|
2542 break; |
|
2543 case T_FLOAT: |
|
2544 rtype = MacroAssembler::ret_type_float; |
|
2545 break; |
|
2546 case T_DOUBLE: |
|
2547 rtype = MacroAssembler::ret_type_double; |
|
2548 break; |
|
2549 } |
|
2550 } |
|
2551 |
2502 |
2552 #define MOV_VOLATILE(REG, BASE, INDEX, SCALE, DISP, SCRATCH, INSN) \ |
2503 #define MOV_VOLATILE(REG, BASE, INDEX, SCALE, DISP, SCRATCH, INSN) \ |
2553 MacroAssembler _masm(&cbuf); \ |
2504 MacroAssembler _masm(&cbuf); \ |
2554 { \ |
2505 { \ |
2555 guarantee(INDEX == -1, "mode not permitted for volatile"); \ |
2506 guarantee(INDEX == -1, "mode not permitted for volatile"); \ |
3495 enc_class aarch64_enc_java_to_runtime(method meth) %{ |
3446 enc_class aarch64_enc_java_to_runtime(method meth) %{ |
3496 MacroAssembler _masm(&cbuf); |
3447 MacroAssembler _masm(&cbuf); |
3497 |
3448 |
3498 // some calls to generated routines (arraycopy code) are scheduled |
3449 // some calls to generated routines (arraycopy code) are scheduled |
3499 // by C2 as runtime calls. if so we can call them using a br (they |
3450 // by C2 as runtime calls. if so we can call them using a br (they |
3500 // will be in a reachable segment) otherwise we have to use a blrt |
3451 // will be in a reachable segment) otherwise we have to use a blr |
3501 // which loads the absolute address into a register. |
3452 // which loads the absolute address into a register. |
3502 address entry = (address)$meth$$method; |
3453 address entry = (address)$meth$$method; |
3503 CodeBlob *cb = CodeCache::find_blob(entry); |
3454 CodeBlob *cb = CodeCache::find_blob(entry); |
3504 if (cb) { |
3455 if (cb) { |
3505 address call = __ trampoline_call(Address(entry, relocInfo::runtime_call_type)); |
3456 address call = __ trampoline_call(Address(entry, relocInfo::runtime_call_type)); |
3506 if (call == NULL) { |
3457 if (call == NULL) { |
3507 ciEnv::current()->record_failure("CodeCache is full"); |
3458 ciEnv::current()->record_failure("CodeCache is full"); |
3508 return; |
3459 return; |
3509 } |
3460 } |
3510 } else { |
3461 } else { |
3511 int gpcnt; |
|
3512 int fpcnt; |
|
3513 int rtype; |
|
3514 getCallInfo(tf(), gpcnt, fpcnt, rtype); |
|
3515 Label retaddr; |
3462 Label retaddr; |
3516 __ adr(rscratch2, retaddr); |
3463 __ adr(rscratch2, retaddr); |
3517 __ lea(rscratch1, RuntimeAddress(entry)); |
3464 __ lea(rscratch1, RuntimeAddress(entry)); |
3518 // Leave a breadcrumb for JavaFrameAnchor::capture_last_Java_pc() |
3465 // Leave a breadcrumb for JavaFrameAnchor::capture_last_Java_pc() |
3519 __ stp(zr, rscratch2, Address(__ pre(sp, -2 * wordSize))); |
3466 __ stp(zr, rscratch2, Address(__ pre(sp, -2 * wordSize))); |
3520 __ blrt(rscratch1, gpcnt, fpcnt, rtype); |
3467 __ blr(rscratch1); |
3521 __ bind(retaddr); |
3468 __ bind(retaddr); |
3522 __ add(sp, sp, 2 * wordSize); |
3469 __ add(sp, sp, 2 * wordSize); |
3523 } |
3470 } |
3524 %} |
3471 %} |
3525 |
3472 |