comparison src/cpu/sparc/vm/interp_masm_sparc.cpp @ 3839:3d42f82cd811

7063628: Use cbcond on T4 Summary: Add new short branch instruction to Hotspot sparc assembler. Reviewed-by: never, twisti, jrose
author kvn
date Thu, 21 Jul 2011 11:25:07 -0700
parents 38fea01eb669
children fdb992d83a87
comparison
equal deleted inserted replaced
3838:6a991dcb52bb 3839:3d42f82cd811
234 void InterpreterMacroAssembler::check_and_handle_earlyret(Register scratch_reg) { 234 void InterpreterMacroAssembler::check_and_handle_earlyret(Register scratch_reg) {
235 if (JvmtiExport::can_force_early_return()) { 235 if (JvmtiExport::can_force_early_return()) {
236 Label L; 236 Label L;
237 Register thr_state = G3_scratch; 237 Register thr_state = G3_scratch;
238 ld_ptr(G2_thread, JavaThread::jvmti_thread_state_offset(), thr_state); 238 ld_ptr(G2_thread, JavaThread::jvmti_thread_state_offset(), thr_state);
239 tst(thr_state); 239 br_null_short(thr_state, pt, L); // if (thread->jvmti_thread_state() == NULL) exit;
240 br(zero, false, pt, L); // if (thread->jvmti_thread_state() == NULL) exit;
241 delayed()->nop();
242 240
243 // Initiate earlyret handling only if it is not already being processed. 241 // Initiate earlyret handling only if it is not already being processed.
244 // If the flag has the earlyret_processing bit set, it means that this code 242 // If the flag has the earlyret_processing bit set, it means that this code
245 // is called *during* earlyret handling - we don't want to reenter. 243 // is called *during* earlyret handling - we don't want to reenter.
246 ld(thr_state, JvmtiThreadState::earlyret_state_offset(), G4_scratch); 244 ld(thr_state, JvmtiThreadState::earlyret_state_offset(), G4_scratch);
247 cmp(G4_scratch, JvmtiThreadState::earlyret_pending); 245 cmp_and_br_short(G4_scratch, JvmtiThreadState::earlyret_pending, Assembler::notEqual, pt, L);
248 br(Assembler::notEqual, false, pt, L);
249 delayed()->nop();
250 246
251 // Call Interpreter::remove_activation_early_entry() to get the address of the 247 // Call Interpreter::remove_activation_early_entry() to get the address of the
252 // same-named entrypoint in the generated interpreter code 248 // same-named entrypoint in the generated interpreter code
253 ld(thr_state, JvmtiThreadState::earlyret_tos_offset(), Otos_l1); 249 ld(thr_state, JvmtiThreadState::earlyret_tos_offset(), Otos_l1);
254 call_VM_leaf(noreg, CAST_FROM_FN_PTR(address, Interpreter::remove_activation_early_entry), Otos_l1); 250 call_VM_leaf(noreg, CAST_FROM_FN_PTR(address, Interpreter::remove_activation_early_entry), Otos_l1);
564 // Saved SP, plus register window size, must not be above FP. 560 // Saved SP, plus register window size, must not be above FP.
565 add(Rsp, frame::register_save_words * wordSize, Rtemp); 561 add(Rsp, frame::register_save_words * wordSize, Rtemp);
566 #ifdef _LP64 562 #ifdef _LP64
567 sub(Rtemp, STACK_BIAS, Rtemp); // Bias Rtemp before cmp to FP 563 sub(Rtemp, STACK_BIAS, Rtemp); // Bias Rtemp before cmp to FP
568 #endif 564 #endif
569 cmp(Rtemp, FP); 565 cmp_and_brx_short(Rtemp, FP, Assembler::greaterUnsigned, Assembler::pn, Bad);
570 brx(Assembler::greaterUnsigned, false, Assembler::pn, Bad);
571 delayed()->nop();
572 566
573 // Saved SP must not be ridiculously below current SP. 567 // Saved SP must not be ridiculously below current SP.
574 size_t maxstack = MAX2(JavaThread::stack_size_at_create(), (size_t) 4*K*K); 568 size_t maxstack = MAX2(JavaThread::stack_size_at_create(), (size_t) 4*K*K);
575 set(maxstack, Rtemp); 569 set(maxstack, Rtemp);
576 sub(SP, Rtemp, Rtemp); 570 sub(SP, Rtemp, Rtemp);
577 #ifdef _LP64 571 #ifdef _LP64
578 add(Rtemp, STACK_BIAS, Rtemp); // Unbias Rtemp before cmp to Rsp 572 add(Rtemp, STACK_BIAS, Rtemp); // Unbias Rtemp before cmp to Rsp
579 #endif 573 #endif
580 cmp(Rsp, Rtemp); 574 cmp_and_brx_short(Rsp, Rtemp, Assembler::lessUnsigned, Assembler::pn, Bad);
581 brx(Assembler::lessUnsigned, false, Assembler::pn, Bad); 575
582 delayed()->nop(); 576 ba_short(OK);
583
584 br(Assembler::always, false, Assembler::pn, OK);
585 delayed()->nop();
586 577
587 bind(Bad); 578 bind(Bad);
588 stop("on return to interpreted call, restored SP is corrupted"); 579 stop("on return to interpreted call, restored SP is corrupted");
589 580
590 bind(OK); 581 bind(OK);
628 verify_thread(); 619 verify_thread();
629 Label skip_compiled_code; 620 Label skip_compiled_code;
630 621
631 const Address interp_only(G2_thread, JavaThread::interp_only_mode_offset()); 622 const Address interp_only(G2_thread, JavaThread::interp_only_mode_offset());
632 ld(interp_only, scratch); 623 ld(interp_only, scratch);
633 tst(scratch); 624 cmp_zero_and_br(Assembler::notZero, scratch, skip_compiled_code, true, Assembler::pn);
634 br(Assembler::notZero, true, Assembler::pn, skip_compiled_code);
635 delayed()->ld_ptr(G5_method, in_bytes(methodOopDesc::interpreter_entry_offset()), target); 625 delayed()->ld_ptr(G5_method, in_bytes(methodOopDesc::interpreter_entry_offset()), target);
636 bind(skip_compiled_code); 626 bind(skip_compiled_code);
637 } 627 }
638 628
639 // the i2c_adapters need methodOop in G5_method (right? %%%) 629 // the i2c_adapters need methodOop in G5_method (right? %%%)
640 // do the call 630 // do the call
641 #ifdef ASSERT 631 #ifdef ASSERT
642 { 632 {
643 Label ok; 633 Label ok;
644 br_notnull(target, false, Assembler::pt, ok); 634 br_notnull_short(target, Assembler::pt, ok);
645 delayed()->nop();
646 stop("null entry point"); 635 stop("null entry point");
647 bind(ok); 636 bind(ok);
648 } 637 }
649 #endif // ASSERT 638 #endif // ASSERT
650 639
980 br(zero, false, pt, unlocked); 969 br(zero, false, pt, unlocked);
981 delayed()->nop(); 970 delayed()->nop();
982 971
983 // Don't unlock anything if the _do_not_unlock_if_synchronized flag 972 // Don't unlock anything if the _do_not_unlock_if_synchronized flag
984 // is set. 973 // is set.
985 tstbool(G1_scratch); 974 cmp_zero_and_br(Assembler::notZero, G1_scratch, no_unlock);
986 br(Assembler::notZero, false, pn, no_unlock);
987 delayed()->nop(); 975 delayed()->nop();
988 976
989 // BasicObjectLock will be first in list, since this is a synchronized method. However, need 977 // BasicObjectLock will be first in list, since this is a synchronized method. However, need
990 // to check that the object has not been unlocked by an explicit monitorexit bytecode. 978 // to check that the object has not been unlocked by an explicit monitorexit bytecode.
991 979
995 983
996 // pass top-most monitor elem 984 // pass top-most monitor elem
997 add( top_most_monitor(), O1 ); 985 add( top_most_monitor(), O1 );
998 986
999 ld_ptr(O1, BasicObjectLock::obj_offset_in_bytes(), G3_scratch); 987 ld_ptr(O1, BasicObjectLock::obj_offset_in_bytes(), G3_scratch);
1000 br_notnull(G3_scratch, false, pt, unlock); 988 br_notnull_short(G3_scratch, pt, unlock);
1001 delayed()->nop();
1002 989
1003 if (throw_monitor_exception) { 990 if (throw_monitor_exception) {
1004 // Entry already unlocked need to throw an exception 991 // Entry already unlocked need to throw an exception
1005 MacroAssembler::call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_illegal_monitor_state_exception)); 992 MacroAssembler::call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_illegal_monitor_state_exception));
1006 should_not_reach_here(); 993 should_not_reach_here();
1009 // If requested, install an illegal_monitor_state_exception. 996 // If requested, install an illegal_monitor_state_exception.
1010 // Continue with stack unrolling. 997 // Continue with stack unrolling.
1011 if (install_monitor_exception) { 998 if (install_monitor_exception) {
1012 MacroAssembler::call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::new_illegal_monitor_state_exception)); 999 MacroAssembler::call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::new_illegal_monitor_state_exception));
1013 } 1000 }
1014 ba(false, unlocked); 1001 ba_short(unlocked);
1015 delayed()->nop();
1016 } 1002 }
1017 1003
1018 bind(unlock); 1004 bind(unlock);
1019 1005
1020 unlock_object(O1); 1006 unlock_object(O1);
1035 1021
1036 #ifdef ASSERT 1022 #ifdef ASSERT
1037 add(top_most_monitor(), Rmptr, delta); 1023 add(top_most_monitor(), Rmptr, delta);
1038 { Label L; 1024 { Label L;
1039 // ensure that Rmptr starts out above (or at) Rlimit 1025 // ensure that Rmptr starts out above (or at) Rlimit
1040 cmp(Rmptr, Rlimit); 1026 cmp_and_brx_short(Rmptr, Rlimit, Assembler::greaterEqualUnsigned, pn, L);
1041 brx(Assembler::greaterEqualUnsigned, false, pn, L);
1042 delayed()->nop();
1043 stop("monitor stack has negative size"); 1027 stop("monitor stack has negative size");
1044 bind(L); 1028 bind(L);
1045 } 1029 }
1046 #endif 1030 #endif
1047 bind(restart); 1031 bind(restart);
1048 ba(false, entry); 1032 ba(entry);
1049 delayed()-> 1033 delayed()->
1050 add(top_most_monitor(), Rmptr, delta); // points to current entry, starting with bottom-most entry 1034 add(top_most_monitor(), Rmptr, delta); // points to current entry, starting with bottom-most entry
1051 1035
1052 // Entry is still locked, need to throw exception 1036 // Entry is still locked, need to throw exception
1053 bind(exception); 1037 bind(exception);
1059 // Unlock does not block, so don't have to worry about the frame 1043 // Unlock does not block, so don't have to worry about the frame
1060 unlock_object(Rmptr); 1044 unlock_object(Rmptr);
1061 if (install_monitor_exception) { 1045 if (install_monitor_exception) {
1062 MacroAssembler::call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::new_illegal_monitor_state_exception)); 1046 MacroAssembler::call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::new_illegal_monitor_state_exception));
1063 } 1047 }
1064 ba(false, restart); 1048 ba_short(restart);
1065 delayed()->nop();
1066 } 1049 }
1067 1050
1068 bind(loop); 1051 bind(loop);
1069 cmp(Rtemp, G0); // check if current entry is used 1052 cmp(Rtemp, G0); // check if current entry is used
1070 brx(Assembler::notEqual, false, pn, exception); 1053 brx(Assembler::notEqual, false, pn, exception);
1071 delayed()-> 1054 delayed()->
1072 dec(Rmptr, delta); // otherwise advance to next entry 1055 dec(Rmptr, delta); // otherwise advance to next entry
1073 #ifdef ASSERT 1056 #ifdef ASSERT
1074 { Label L; 1057 { Label L;
1075 // ensure that Rmptr has not somehow stepped below Rlimit 1058 // ensure that Rmptr has not somehow stepped below Rlimit
1076 cmp(Rmptr, Rlimit); 1059 cmp_and_brx_short(Rmptr, Rlimit, Assembler::greaterEqualUnsigned, pn, L);
1077 brx(Assembler::greaterEqualUnsigned, false, pn, L);
1078 delayed()->nop();
1079 stop("ran off the end of the monitor stack"); 1060 stop("ran off the end of the monitor stack");
1080 bind(L); 1061 bind(L);
1081 } 1062 }
1082 #endif 1063 #endif
1083 bind(entry); 1064 bind(entry);
1194 assert(mark_addr.disp() == 0, "cas must take a zero displacement"); 1175 assert(mark_addr.disp() == 0, "cas must take a zero displacement");
1195 casx_under_lock(mark_addr.base(), mark_reg, temp_reg, 1176 casx_under_lock(mark_addr.base(), mark_reg, temp_reg,
1196 (address)StubRoutines::Sparc::atomic_memory_operation_lock_addr()); 1177 (address)StubRoutines::Sparc::atomic_memory_operation_lock_addr());
1197 1178
1198 // if the compare and exchange succeeded we are done (we saw an unlocked object) 1179 // if the compare and exchange succeeded we are done (we saw an unlocked object)
1199 cmp(mark_reg, temp_reg); 1180 cmp_and_brx_short(mark_reg, temp_reg, Assembler::equal, Assembler::pt, done);
1200 brx(Assembler::equal, true, Assembler::pt, done);
1201 delayed()->nop();
1202 1181
1203 // We did not see an unlocked object so try the fast recursive case 1182 // We did not see an unlocked object so try the fast recursive case
1204 1183
1205 // Check if owner is self by comparing the value in the markOop of object 1184 // Check if owner is self by comparing the value in the markOop of object
1206 // with the stack pointer 1185 // with the stack pointer
1322 1301
1323 // Test ImethodDataPtr. If it is null, continue at the specified label 1302 // Test ImethodDataPtr. If it is null, continue at the specified label
1324 1303
1325 void InterpreterMacroAssembler::test_method_data_pointer(Label& zero_continue) { 1304 void InterpreterMacroAssembler::test_method_data_pointer(Label& zero_continue) {
1326 assert(ProfileInterpreter, "must be profiling interpreter"); 1305 assert(ProfileInterpreter, "must be profiling interpreter");
1327 #ifdef _LP64 1306 br_null_short(ImethodDataPtr, Assembler::pn, zero_continue);
1328 bpr(Assembler::rc_z, false, Assembler::pn, ImethodDataPtr, zero_continue);
1329 #else
1330 tst(ImethodDataPtr);
1331 br(Assembler::zero, false, Assembler::pn, zero_continue);
1332 #endif
1333 delayed()->nop();
1334 } 1307 }
1335 1308
1336 void InterpreterMacroAssembler::verify_method_data_pointer() { 1309 void InterpreterMacroAssembler::verify_method_data_pointer() {
1337 assert(ProfileInterpreter, "must be profiling interpreter"); 1310 assert(ProfileInterpreter, "must be profiling interpreter");
1338 #ifdef ASSERT 1311 #ifdef ASSERT
1374 // limit or if we call profile_method() 1347 // limit or if we call profile_method()
1375 1348
1376 Label done; 1349 Label done;
1377 1350
1378 // if no method data exists, and the counter is high enough, make one 1351 // if no method data exists, and the counter is high enough, make one
1379 #ifdef _LP64 1352 br_notnull_short(ImethodDataPtr, Assembler::pn, done);
1380 bpr(Assembler::rc_nz, false, Assembler::pn, ImethodDataPtr, done);
1381 #else
1382 tst(ImethodDataPtr);
1383 br(Assembler::notZero, false, Assembler::pn, done);
1384 #endif
1385 1353
1386 // Test to see if we should create a method data oop 1354 // Test to see if we should create a method data oop
1387 AddressLiteral profile_limit((address) &InvocationCounter::InterpreterProfileLimit); 1355 AddressLiteral profile_limit((address) &InvocationCounter::InterpreterProfileLimit);
1388 #ifdef _LP64
1389 delayed()->nop();
1390 sethi(profile_limit, Rtmp); 1356 sethi(profile_limit, Rtmp);
1391 #else
1392 delayed()->sethi(profile_limit, Rtmp);
1393 #endif
1394 ld(Rtmp, profile_limit.low10(), Rtmp); 1357 ld(Rtmp, profile_limit.low10(), Rtmp);
1395 cmp(invocation_count, Rtmp); 1358 cmp_and_br_short(invocation_count, Rtmp, Assembler::lessUnsigned, Assembler::pn, profile_continue);
1396 br(Assembler::lessUnsigned, false, Assembler::pn, profile_continue);
1397 delayed()->nop();
1398 1359
1399 // Build it now. 1360 // Build it now.
1400 call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::profile_method)); 1361 call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::profile_method));
1401 set_method_data_pointer_for_bcp(); 1362 set_method_data_pointer_for_bcp();
1402 ba(false, profile_continue); 1363 ba_short(profile_continue);
1403 delayed()->nop();
1404 bind(done); 1364 bind(done);
1405 } 1365 }
1406 1366
1407 // Store a value at some constant offset from the method data pointer. 1367 // Store a value at some constant offset from the method data pointer.
1408 1368
1630 1590
1631 1591
1632 Label skip_receiver_profile; 1592 Label skip_receiver_profile;
1633 if (receiver_can_be_null) { 1593 if (receiver_can_be_null) {
1634 Label not_null; 1594 Label not_null;
1635 tst(receiver); 1595 br_notnull_short(receiver, Assembler::pt, not_null);
1636 brx(Assembler::notZero, false, Assembler::pt, not_null);
1637 delayed()->nop();
1638 // We are making a call. Increment the count for null receiver. 1596 // We are making a call. Increment the count for null receiver.
1639 increment_mdp_data_at(in_bytes(CounterData::count_offset()), scratch); 1597 increment_mdp_data_at(in_bytes(CounterData::count_offset()), scratch);
1640 ba(false, skip_receiver_profile); 1598 ba_short(skip_receiver_profile);
1641 delayed()->nop();
1642 bind(not_null); 1599 bind(not_null);
1643 } 1600 }
1644 1601
1645 // Record the receiver type. 1602 // Record the receiver type.
1646 record_klass_in_profile(receiver, scratch, true); 1603 record_klass_in_profile(receiver, scratch, true);
1680 // delayed()->tst(scratch); 1637 // delayed()->tst(scratch);
1681 1638
1682 // The receiver is receiver[n]. Increment count[n]. 1639 // The receiver is receiver[n]. Increment count[n].
1683 int count_offset = in_bytes(VirtualCallData::receiver_count_offset(row)); 1640 int count_offset = in_bytes(VirtualCallData::receiver_count_offset(row));
1684 increment_mdp_data_at(count_offset, scratch); 1641 increment_mdp_data_at(count_offset, scratch);
1685 ba(false, done); 1642 ba_short(done);
1686 delayed()->nop();
1687 bind(next_test); 1643 bind(next_test);
1688 1644
1689 if (test_for_null_also) { 1645 if (test_for_null_also) {
1690 Label found_null; 1646 Label found_null;
1691 // Failed the equality check on receiver[n]... Test for null. 1647 // Failed the equality check on receiver[n]... Test for null.
1695 brx(Assembler::zero, false, Assembler::pn, found_null); 1651 brx(Assembler::zero, false, Assembler::pn, found_null);
1696 delayed()->nop(); 1652 delayed()->nop();
1697 // Receiver did not match any saved receiver and there is no empty row for it. 1653 // Receiver did not match any saved receiver and there is no empty row for it.
1698 // Increment total counter to indicate polymorphic case. 1654 // Increment total counter to indicate polymorphic case.
1699 increment_mdp_data_at(in_bytes(CounterData::count_offset()), scratch); 1655 increment_mdp_data_at(in_bytes(CounterData::count_offset()), scratch);
1700 ba(false, done); 1656 ba_short(done);
1701 delayed()->nop();
1702 bind(found_null); 1657 bind(found_null);
1703 } else { 1658 } else {
1704 brx(Assembler::notZero, false, Assembler::pt, done); 1659 brx(Assembler::notZero, false, Assembler::pt, done);
1705 delayed()->nop(); 1660 delayed()->nop();
1706 } 1661 }
1727 set_mdp_data_at(recvr_offset, receiver); 1682 set_mdp_data_at(recvr_offset, receiver);
1728 int count_offset = in_bytes(VirtualCallData::receiver_count_offset(start_row)); 1683 int count_offset = in_bytes(VirtualCallData::receiver_count_offset(start_row));
1729 mov(DataLayout::counter_increment, scratch); 1684 mov(DataLayout::counter_increment, scratch);
1730 set_mdp_data_at(count_offset, scratch); 1685 set_mdp_data_at(count_offset, scratch);
1731 if (start_row > 0) { 1686 if (start_row > 0) {
1732 ba(false, done); 1687 ba_short(done);
1733 delayed()->nop();
1734 } 1688 }
1735 } 1689 }
1736 1690
1737 void InterpreterMacroAssembler::record_klass_in_profile(Register receiver, 1691 void InterpreterMacroAssembler::record_klass_in_profile(Register receiver,
1738 Register scratch, bool is_virtual_call) { 1692 Register scratch, bool is_virtual_call) {
1770 // return_bci is equal to bci[n]. Increment the count. 1724 // return_bci is equal to bci[n]. Increment the count.
1771 increment_mdp_data_at(in_bytes(RetData::bci_count_offset(row)), scratch); 1725 increment_mdp_data_at(in_bytes(RetData::bci_count_offset(row)), scratch);
1772 1726
1773 // The method data pointer needs to be updated to reflect the new target. 1727 // The method data pointer needs to be updated to reflect the new target.
1774 update_mdp_by_offset(in_bytes(RetData::bci_displacement_offset(row)), scratch); 1728 update_mdp_by_offset(in_bytes(RetData::bci_displacement_offset(row)), scratch);
1775 ba(false, profile_continue); 1729 ba_short(profile_continue);
1776 delayed()->nop();
1777 bind(next_test); 1730 bind(next_test);
1778 } 1731 }
1779 1732
1780 update_mdp_for_ret(state, return_bci); 1733 update_mdp_for_ret(state, return_bci);
1781 1734
1920 1873
1921 Label start_copying, next; 1874 Label start_copying, next;
1922 1875
1923 // untested("monitor stack expansion"); 1876 // untested("monitor stack expansion");
1924 compute_stack_base(Rtemp); 1877 compute_stack_base(Rtemp);
1925 ba( false, start_copying ); 1878 ba(start_copying);
1926 delayed()->cmp( Rtemp, Rlimit); // done? duplicated below 1879 delayed()->cmp(Rtemp, Rlimit); // done? duplicated below
1927 1880
1928 // note: must copy from low memory upwards 1881 // note: must copy from low memory upwards
1929 // On entry to loop, 1882 // On entry to loop,
1930 // Rtemp points to new base of stack, Lesp points to new end of stack (1 past TOS) 1883 // Rtemp points to new base of stack, Lesp points to new end of stack (1 past TOS)
1931 // Loop mutates Rtemp 1884 // Loop mutates Rtemp
2008 assert(Rscratch1 != Rscratch, "Registers cannot be same"); 1961 assert(Rscratch1 != Rscratch, "Registers cannot be same");
2009 1962
2010 // untested("reg area corruption"); 1963 // untested("reg area corruption");
2011 add(Rindex, offset, Rscratch); 1964 add(Rindex, offset, Rscratch);
2012 add(Rlimit, 64 + STACK_BIAS, Rscratch1); 1965 add(Rlimit, 64 + STACK_BIAS, Rscratch1);
2013 cmp(Rscratch, Rscratch1); 1966 cmp_and_brx_short(Rscratch, Rscratch1, Assembler::greaterEqualUnsigned, pn, L);
2014 brx(Assembler::greaterEqualUnsigned, false, pn, L);
2015 delayed()->nop();
2016 stop("regsave area is being clobbered"); 1967 stop("regsave area is being clobbered");
2017 bind(L); 1968 bind(L);
2018 } 1969 }
2019 #endif // ASSERT 1970 #endif // ASSERT
2020 1971
2172 assert_different_registers(backedge_count, Rtmp, branch_bcp); 2123 assert_different_registers(backedge_count, Rtmp, branch_bcp);
2173 assert(UseOnStackReplacement,"Must UseOnStackReplacement to test_backedge_count_for_osr"); 2124 assert(UseOnStackReplacement,"Must UseOnStackReplacement to test_backedge_count_for_osr");
2174 2125
2175 AddressLiteral limit(&InvocationCounter::InterpreterBackwardBranchLimit); 2126 AddressLiteral limit(&InvocationCounter::InterpreterBackwardBranchLimit);
2176 load_contents(limit, Rtmp); 2127 load_contents(limit, Rtmp);
2177 cmp(backedge_count, Rtmp); 2128 cmp_and_br_short(backedge_count, Rtmp, Assembler::lessUnsigned, Assembler::pt, did_not_overflow);
2178 br(Assembler::lessUnsigned, false, Assembler::pt, did_not_overflow);
2179 delayed()->nop();
2180 2129
2181 // When ProfileInterpreter is on, the backedge_count comes from the 2130 // When ProfileInterpreter is on, the backedge_count comes from the
2182 // methodDataOop, which value does not get reset on the call to 2131 // methodDataOop, which value does not get reset on the call to
2183 // frequency_counter_overflow(). To avoid excessive calls to the overflow 2132 // frequency_counter_overflow(). To avoid excessive calls to the overflow
2184 // routine while the method is being compiled, add a second test to make sure 2133 // routine while the method is being compiled, add a second test to make sure
2194 set(6,Rtmp); 2143 set(6,Rtmp);
2195 call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::frequency_counter_overflow), branch_bcp, Rtmp); 2144 call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::frequency_counter_overflow), branch_bcp, Rtmp);
2196 2145
2197 // Was an OSR adapter generated? 2146 // Was an OSR adapter generated?
2198 // O0 = osr nmethod 2147 // O0 = osr nmethod
2199 tst(O0); 2148 br_null_short(O0, Assembler::pn, overflow_with_error);
2200 brx(Assembler::zero, false, Assembler::pn, overflow_with_error);
2201 delayed()->nop();
2202 2149
2203 // Has the nmethod been invalidated already? 2150 // Has the nmethod been invalidated already?
2204 ld(O0, nmethod::entry_bci_offset(), O2); 2151 ld(O0, nmethod::entry_bci_offset(), O2);
2205 cmp(O2, InvalidOSREntryBci); 2152 cmp_and_br_short(O2, InvalidOSREntryBci, Assembler::equal, Assembler::pn, overflow_with_error);
2206 br(Assembler::equal, false, Assembler::pn, overflow_with_error);
2207 delayed()->nop();
2208 2153
2209 // migrate the interpreter frame off of the stack 2154 // migrate the interpreter frame off of the stack
2210 2155
2211 mov(G2_thread, L7); 2156 mov(G2_thread, L7);
2212 // save nmethod 2157 // save nmethod
2268 // See if it is an address (in the current method): 2213 // See if it is an address (in the current method):
2269 2214
2270 mov(reg, Rtmp); 2215 mov(reg, Rtmp);
2271 const int log2_bytecode_size_limit = 16; 2216 const int log2_bytecode_size_limit = 16;
2272 srl(Rtmp, log2_bytecode_size_limit, Rtmp); 2217 srl(Rtmp, log2_bytecode_size_limit, Rtmp);
2273 br_notnull( Rtmp, false, pt, test ); 2218 br_notnull_short( Rtmp, pt, test );
2274 delayed()->nop();
2275 2219
2276 // %%% should use call_VM_leaf here? 2220 // %%% should use call_VM_leaf here?
2277 save_frame_and_mov(0, Lmethod, O0, reg, O1); 2221 save_frame_and_mov(0, Lmethod, O0, reg, O1);
2278 save_thread(L7_thread_cache); 2222 save_thread(L7_thread_cache);
2279 call(CAST_FROM_FN_PTR(address,verify_return_address), relocInfo::none); 2223 call(CAST_FROM_FN_PTR(address,verify_return_address), relocInfo::none);
2318 if (JvmtiExport::can_post_interpreter_events()) { 2262 if (JvmtiExport::can_post_interpreter_events()) {
2319 Label L; 2263 Label L;
2320 Register temp_reg = O5; 2264 Register temp_reg = O5;
2321 const Address interp_only(G2_thread, JavaThread::interp_only_mode_offset()); 2265 const Address interp_only(G2_thread, JavaThread::interp_only_mode_offset());
2322 ld(interp_only, temp_reg); 2266 ld(interp_only, temp_reg);
2323 tst(temp_reg); 2267 cmp_and_br_short(temp_reg, 0, equal, pt, L);
2324 br(zero, false, pt, L);
2325 delayed()->nop();
2326 call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::post_method_entry)); 2268 call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::post_method_entry));
2327 bind(L); 2269 bind(L);
2328 } 2270 }
2329 2271
2330 { 2272 {
2370 if (mode == NotifyJVMTI && JvmtiExport::can_post_interpreter_events()) { 2312 if (mode == NotifyJVMTI && JvmtiExport::can_post_interpreter_events()) {
2371 Label L; 2313 Label L;
2372 Register temp_reg = O5; 2314 Register temp_reg = O5;
2373 const Address interp_only(G2_thread, JavaThread::interp_only_mode_offset()); 2315 const Address interp_only(G2_thread, JavaThread::interp_only_mode_offset());
2374 ld(interp_only, temp_reg); 2316 ld(interp_only, temp_reg);
2375 tst(temp_reg); 2317 cmp_and_br_short(temp_reg, 0, equal, pt, L);
2376 br(zero, false, pt, L);
2377 delayed()->nop();
2378 2318
2379 // Note: frame::interpreter_frame_result has a dependency on how the 2319 // Note: frame::interpreter_frame_result has a dependency on how the
2380 // method result is saved across the call to post_method_exit. For 2320 // method result is saved across the call to post_method_exit. For
2381 // native methods it assumes the result registers are saved to 2321 // native methods it assumes the result registers are saved to
2382 // l_scratch and d_scratch. If this changes then the interpreter_frame_result 2322 // l_scratch and d_scratch. If this changes then the interpreter_frame_result