Mercurial > hg > graal-jvmci-8
comparison src/cpu/sparc/vm/cppInterpreter_sparc.cpp @ 7402:fd74228fd5ca
8004076: Move _max_locals and _size_of_parameters to ConstMethod for better sharing.
Summary: Move _max_locals and _size_of_parameters to ConstMethod for better sharing.
Reviewed-by: coleenp, minqi, jrose
author | jiangli |
---|---|
date | Tue, 11 Dec 2012 12:41:31 -0500 |
parents | b2dbd323c668 |
children | ffa87474d7a4 |
comparison
equal
deleted
inserted
replaced
7396:4a2ed49abd51 | 7402:fd74228fd5ca |
---|---|
580 address entry = __ pc(); | 580 address entry = __ pc(); |
581 | 581 |
582 // the following temporary registers are used during frame creation | 582 // the following temporary registers are used during frame creation |
583 const Register Gtmp1 = G3_scratch ; | 583 const Register Gtmp1 = G3_scratch ; |
584 const Register Gtmp2 = G1_scratch; | 584 const Register Gtmp2 = G1_scratch; |
585 const Address size_of_parameters(G5_method, 0, in_bytes(Method::size_of_parameters_offset())); | 585 const Register RconstMethod = Gtmp1; |
586 const Address constMethod(G5_method, 0, in_bytes(Method::const_offset())); | |
587 const Address size_of_parameters(RconstMethod, 0, in_bytes(ConstMethod::size_of_parameters_offset())); | |
586 | 588 |
587 bool inc_counter = UseCompiler || CountCompiledCalls; | 589 bool inc_counter = UseCompiler || CountCompiledCalls; |
588 | 590 |
589 // make sure registers are different! | 591 // make sure registers are different! |
590 assert_different_registers(G2_thread, G5_method, Gargs, Gtmp1, Gtmp2); | 592 assert_different_registers(G2_thread, G5_method, Gargs, Gtmp1, Gtmp2); |
616 __ stop("tried to execute abstract method as non-abstract"); | 618 __ stop("tried to execute abstract method as non-abstract"); |
617 __ bind(L); | 619 __ bind(L); |
618 } | 620 } |
619 #endif // ASSERT | 621 #endif // ASSERT |
620 | 622 |
623 __ ld_ptr(constMethod, RconstMethod); | |
621 __ lduh(size_of_parameters, Gtmp1); | 624 __ lduh(size_of_parameters, Gtmp1); |
622 __ sll(Gtmp1, LogBytesPerWord, Gtmp2); // parameter size in bytes | 625 __ sll(Gtmp1, LogBytesPerWord, Gtmp2); // parameter size in bytes |
623 __ add(Gargs, Gtmp2, Gargs); // points to first local + BytesPerWord | 626 __ add(Gargs, Gtmp2, Gargs); // points to first local + BytesPerWord |
624 // NEW | 627 // NEW |
625 __ add(Gargs, -wordSize, Gargs); // points to first local[0] | 628 __ add(Gargs, -wordSize, Gargs); // points to first local[0] |
1045 assert_different_registers(state, prev_state); | 1048 assert_different_registers(state, prev_state); |
1046 assert_different_registers(prev_state, G3_scratch); | 1049 assert_different_registers(prev_state, G3_scratch); |
1047 const Register Gtmp = G3_scratch; | 1050 const Register Gtmp = G3_scratch; |
1048 const Address constMethod (G5_method, 0, in_bytes(Method::const_offset())); | 1051 const Address constMethod (G5_method, 0, in_bytes(Method::const_offset())); |
1049 const Address access_flags (G5_method, 0, in_bytes(Method::access_flags_offset())); | 1052 const Address access_flags (G5_method, 0, in_bytes(Method::access_flags_offset())); |
1050 const Address size_of_parameters(G5_method, 0, in_bytes(Method::size_of_parameters_offset())); | |
1051 const Address size_of_locals (G5_method, 0, in_bytes(Method::size_of_locals_offset())); | |
1052 | 1053 |
1053 // slop factor is two extra slots on the expression stack so that | 1054 // slop factor is two extra slots on the expression stack so that |
1054 // we always have room to store a result when returning from a call without parameters | 1055 // we always have room to store a result when returning from a call without parameters |
1055 // that returns a result. | 1056 // that returns a result. |
1056 | 1057 |
1064 // XXX G5_method valid | 1065 // XXX G5_method valid |
1065 | 1066 |
1066 // Now compute new frame size | 1067 // Now compute new frame size |
1067 | 1068 |
1068 if (native) { | 1069 if (native) { |
1070 const Register RconstMethod = Gtmp; | |
1071 const Address size_of_parameters(RconstMethod, 0, in_bytes(ConstMethod::size_of_parameters_offset())); | |
1072 __ ld_ptr(constMethod, RconstMethod); | |
1069 __ lduh( size_of_parameters, Gtmp ); | 1073 __ lduh( size_of_parameters, Gtmp ); |
1070 __ calc_mem_param_words(Gtmp, Gtmp); // space for native call parameters passed on the stack in words | 1074 __ calc_mem_param_words(Gtmp, Gtmp); // space for native call parameters passed on the stack in words |
1071 } else { | 1075 } else { |
1072 // Full size expression stack | 1076 // Full size expression stack |
1073 __ ld_ptr(constMethod, Gtmp); | 1077 __ ld_ptr(constMethod, Gtmp); |
1234 __ set( 0x0F0F0F0F, init_value ); | 1238 __ set( 0x0F0F0F0F, init_value ); |
1235 #endif // ASSERT | 1239 #endif // ASSERT |
1236 } | 1240 } |
1237 if (init_value != noreg) { | 1241 if (init_value != noreg) { |
1238 Label clear_loop; | 1242 Label clear_loop; |
1243 const Register RconstMethod = O1; | |
1244 const Address size_of_parameters(RconstMethod, 0, in_bytes(ConstMethod::size_of_parameters_offset())); | |
1245 const Address size_of_locals (RconstMethod, 0, in_bytes(ConstMethod::size_of_locals_offset())); | |
1239 | 1246 |
1240 // NOTE: If you change the frame layout, this code will need to | 1247 // NOTE: If you change the frame layout, this code will need to |
1241 // be updated! | 1248 // be updated! |
1249 __ ld_ptr( constMethod, RconstMethod ); | |
1242 __ lduh( size_of_locals, O2 ); | 1250 __ lduh( size_of_locals, O2 ); |
1243 __ lduh( size_of_parameters, O1 ); | 1251 __ lduh( size_of_parameters, O1 ); |
1244 __ sll( O2, LogBytesPerWord, O2); | 1252 __ sll( O2, LogBytesPerWord, O2); |
1245 __ sll( O1, LogBytesPerWord, O1 ); | 1253 __ sll( O1, LogBytesPerWord, O1 ); |
1246 __ ld_ptr(XXX_STATE(_locals), L2_scratch); | 1254 __ ld_ptr(XXX_STATE(_locals), L2_scratch); |
1481 // Destroys args, G3_scratch, G3_scratch | 1489 // Destroys args, G3_scratch, G3_scratch |
1482 // In/Out O5_savedSP (sender's original SP) | 1490 // In/Out O5_savedSP (sender's original SP) |
1483 // | 1491 // |
1484 // assert_different_registers(state, prev_state); | 1492 // assert_different_registers(state, prev_state); |
1485 const Register Gtmp = G3_scratch; | 1493 const Register Gtmp = G3_scratch; |
1494 const RconstMethod = G3_scratch; | |
1486 const Register tmp = O2; | 1495 const Register tmp = O2; |
1487 const Address size_of_parameters(G5_method, 0, in_bytes(Method::size_of_parameters_offset())); | 1496 const Address constMethod(G5_method, 0, in_bytes(Method::const_offset())); |
1488 const Address size_of_locals (G5_method, 0, in_bytes(Method::size_of_locals_offset())); | 1497 const Address size_of_parameters(RconstMethod, 0, in_bytes(ConstMethod::size_of_parameters_offset())); |
1489 | 1498 const Address size_of_locals (RconstMethod, 0, in_bytes(ConstMethod::size_of_locals_offset())); |
1499 | |
1500 __ ld_ptr(constMethod, RconstMethod); | |
1490 __ lduh(size_of_parameters, tmp); | 1501 __ lduh(size_of_parameters, tmp); |
1491 __ sll(tmp, LogBytesPerWord, Gtmp); // parameter size in bytes | 1502 __ sll(tmp, LogBytesPerWord, Gargs); // parameter size in bytes |
1492 __ add(args, Gtmp, Gargs); // points to first local + BytesPerWord | 1503 __ add(args, Gargs, Gargs); // points to first local + BytesPerWord |
1493 // NEW | 1504 // NEW |
1494 __ add(Gargs, -wordSize, Gargs); // points to first local[0] | 1505 __ add(Gargs, -wordSize, Gargs); // points to first local[0] |
1495 // determine extra space for non-argument locals & adjust caller's SP | 1506 // determine extra space for non-argument locals & adjust caller's SP |
1496 // Gtmp1: parameter size in words | 1507 // Gtmp1: parameter size in words |
1497 __ lduh(size_of_locals, Gtmp); | 1508 __ lduh(size_of_locals, Gtmp); |
1539 const Register Gtmp1 = G3_scratch; | 1550 const Register Gtmp1 = G3_scratch; |
1540 // const Register Lmirror = L1; // native mirror (native calls only) | 1551 // const Register Lmirror = L1; // native mirror (native calls only) |
1541 | 1552 |
1542 const Address constMethod (G5_method, 0, in_bytes(Method::const_offset())); | 1553 const Address constMethod (G5_method, 0, in_bytes(Method::const_offset())); |
1543 const Address access_flags (G5_method, 0, in_bytes(Method::access_flags_offset())); | 1554 const Address access_flags (G5_method, 0, in_bytes(Method::access_flags_offset())); |
1544 const Address size_of_parameters(G5_method, 0, in_bytes(Method::size_of_parameters_offset())); | |
1545 const Address size_of_locals (G5_method, 0, in_bytes(Method::size_of_locals_offset())); | |
1546 | 1555 |
1547 address entry_point = __ pc(); | 1556 address entry_point = __ pc(); |
1548 __ mov(G0, prevState); // no current activation | 1557 __ mov(G0, prevState); // no current activation |
1549 | 1558 |
1550 | 1559 |
1748 | 1757 |
1749 // Process the native abi result to java expression stack | 1758 // Process the native abi result to java expression stack |
1750 | 1759 |
1751 __ ld_ptr(STATE(_result._to_call._callee), L4_scratch); // called method | 1760 __ ld_ptr(STATE(_result._to_call._callee), L4_scratch); // called method |
1752 __ ld_ptr(STATE(_stack), L1_scratch); // get top of java expr stack | 1761 __ ld_ptr(STATE(_stack), L1_scratch); // get top of java expr stack |
1753 __ lduh(L4_scratch, in_bytes(Method::size_of_parameters_offset()), L2_scratch); // get parameter size | 1762 // get parameter size |
1763 __ ld_ptr(L4_scratch, in_bytes(Method::const_offset()), L2_scratch); | |
1764 __ lduh(L2_scratch, in_bytes(ConstMethod::size_of_parameters_offset()), L2_scratch); | |
1754 __ sll(L2_scratch, LogBytesPerWord, L2_scratch ); // parameter size in bytes | 1765 __ sll(L2_scratch, LogBytesPerWord, L2_scratch ); // parameter size in bytes |
1755 __ add(L1_scratch, L2_scratch, L1_scratch); // stack destination for result | 1766 __ add(L1_scratch, L2_scratch, L1_scratch); // stack destination for result |
1756 __ ld(L4_scratch, in_bytes(Method::result_index_offset()), L3_scratch); // called method result type index | 1767 __ ld(L4_scratch, in_bytes(Method::result_index_offset()), L3_scratch); // called method result type index |
1757 | 1768 |
1758 // tosca is really just native abi | 1769 // tosca is really just native abi |