1501
1502 ___(stdux) stdux(R1_SP, R1_SP, tmp);
1503 }
1504 }
1505 #if 0 // TODO: PPC port
1506 // For testing large constant pools, emit a lot of constants to constant pool.
1507 // "Randomize" const_size.
1508 if (ConstantsALot) {
1509 const int num_consts = const_size();
1510 for (int i = 0; i < num_consts; i++) {
1511 __ long_constant(0xB0B5B00BBABE);
1512 }
1513 }
1514 #endif
1515 if (!method_is_frameless) {
1516 // Save return pc.
1517 ___(std) std(return_pc, _abi(lr), callers_sp);
1518 }
1519
1520 C->set_frame_complete(cbuf.insts_size());
1521 }
1522 #undef ___
1523 #undef ___stop
1524 #undef ___advance
1525
1526 uint MachPrologNode::size(PhaseRegAlloc *ra_) const {
1527 // Variable size. determine dynamically.
1528 return MachNode::size(ra_);
1529 }
1530
1531 int MachPrologNode::reloc() const {
1532 // Return number of relocatable values contained in this instruction.
1533 return 1; // 1 reloc entry for load_const(toc).
1534 }
1535
1536 //=============================================================================
1537
1538 #ifndef PRODUCT
1539 void MachEpilogNode::format(PhaseRegAlloc *ra_, outputStream *st) const {
1540 Compile* C = ra_->C;
1541
1542 st->print("EPILOG\n\t");
1543 st->print("restore return pc\n\t");
1544 st->print("pop frame\n\t");
1545
1546 if (do_polling() && C->is_method_compilation()) {
1547 st->print("touch polling page\n\t");
1548 }
1549 }
1550 #endif
1551
1552 void MachEpilogNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
1553 Compile* C = ra_->C;
1554 MacroAssembler _masm(&cbuf);
1555
1556 const long framesize = ((long)C->frame_slots()) << LogBytesPerInt;
1557 assert(framesize >= 0, "negative frame-size?");
1558
1559 const bool method_needs_polling = do_polling() && C->is_method_compilation();
1560 const bool method_is_frameless = false /* TODO: PPC port C->is_frameless_method()*/;
1561 const Register return_pc = R31; // Must survive C-call to enable_stack_reserved_zone().
1562 const Register polling_page = R12;
1563
1564 if (!method_is_frameless) {
1565 // Restore return pc relative to callers' sp.
1566 __ ld(return_pc, ((int)framesize) + _abi(lr), R1_SP);
1567 }
1568
1569 if (method_needs_polling) {
1570 if (SafepointMechanism::uses_thread_local_poll()) {
1571 __ ld(polling_page, in_bytes(JavaThread::polling_page_offset()), R16_thread);
1572 } else {
1573 __ load_const_optimized(polling_page, (long)(address) os::get_polling_page());
1574 }
|
1501
1502 ___(stdux) stdux(R1_SP, R1_SP, tmp);
1503 }
1504 }
1505 #if 0 // TODO: PPC port
1506 // For testing large constant pools, emit a lot of constants to constant pool.
1507 // "Randomize" const_size.
1508 if (ConstantsALot) {
1509 const int num_consts = const_size();
1510 for (int i = 0; i < num_consts; i++) {
1511 __ long_constant(0xB0B5B00BBABE);
1512 }
1513 }
1514 #endif
1515 if (!method_is_frameless) {
1516 // Save return pc.
1517 ___(std) std(return_pc, _abi(lr), callers_sp);
1518 }
1519
1520 C->set_frame_complete(cbuf.insts_size());
1521
1522 #ifndef PRODUCT
1523 if (currMethod && currMethod->has_option("crashOnEntry")) {
1524 __ illtrap();
1525 }
1526 #endif
1527 }
1528 #undef ___
1529 #undef ___stop
1530 #undef ___advance
1531
1532 uint MachPrologNode::size(PhaseRegAlloc *ra_) const {
1533 // Variable size. determine dynamically.
1534 return MachNode::size(ra_);
1535 }
1536
1537 int MachPrologNode::reloc() const {
1538 // Return number of relocatable values contained in this instruction.
1539 return 1; // 1 reloc entry for load_const(toc).
1540 }
1541
1542 //=============================================================================
1543
1544 #ifndef PRODUCT
1545 void MachEpilogNode::format(PhaseRegAlloc *ra_, outputStream *st) const {
1546 Compile* C = ra_->C;
1547
1548 st->print("EPILOG\n\t");
1549 st->print("restore return pc\n\t");
1550 st->print("pop frame\n\t");
1551
1552 if (do_polling() && C->is_method_compilation()) {
1553 st->print("touch polling page\n\t");
1554 }
1555 }
1556 #endif
1557
1558 void MachEpilogNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
1559 Compile* C = ra_->C;
1560 MacroAssembler _masm(&cbuf);
1561
1562 #ifndef PRODUCT
1563 ciMethod *currMethod = C->method();
1564 if (currMethod && currMethod->has_option("crashOnExit")) {
1565 __ illtrap();
1566 }
1567 #endif
1568
1569 const long framesize = ((long)C->frame_slots()) << LogBytesPerInt;
1570 assert(framesize >= 0, "negative frame-size?");
1571
1572 const bool method_needs_polling = do_polling() && C->is_method_compilation();
1573 const bool method_is_frameless = false /* TODO: PPC port C->is_frameless_method()*/;
1574 const Register return_pc = R31; // Must survive C-call to enable_stack_reserved_zone().
1575 const Register polling_page = R12;
1576
1577 if (!method_is_frameless) {
1578 // Restore return pc relative to callers' sp.
1579 __ ld(return_pc, ((int)framesize) + _abi(lr), R1_SP);
1580 }
1581
1582 if (method_needs_polling) {
1583 if (SafepointMechanism::uses_thread_local_poll()) {
1584 __ ld(polling_page, in_bytes(JavaThread::polling_page_offset()), R16_thread);
1585 } else {
1586 __ load_const_optimized(polling_page, (long)(address) os::get_polling_page());
1587 }
|