Mercurial > hg > truffle
diff 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 |
line wrap: on
line diff
--- a/src/cpu/sparc/vm/cppInterpreter_sparc.cpp Fri Dec 07 10:55:16 2012 -0800 +++ b/src/cpu/sparc/vm/cppInterpreter_sparc.cpp Tue Dec 11 12:41:31 2012 -0500 @@ -582,7 +582,9 @@ // the following temporary registers are used during frame creation const Register Gtmp1 = G3_scratch ; const Register Gtmp2 = G1_scratch; - const Address size_of_parameters(G5_method, 0, in_bytes(Method::size_of_parameters_offset())); + const Register RconstMethod = Gtmp1; + const Address constMethod(G5_method, 0, in_bytes(Method::const_offset())); + const Address size_of_parameters(RconstMethod, 0, in_bytes(ConstMethod::size_of_parameters_offset())); bool inc_counter = UseCompiler || CountCompiledCalls; @@ -618,6 +620,7 @@ } #endif // ASSERT + __ ld_ptr(constMethod, RconstMethod); __ lduh(size_of_parameters, Gtmp1); __ sll(Gtmp1, LogBytesPerWord, Gtmp2); // parameter size in bytes __ add(Gargs, Gtmp2, Gargs); // points to first local + BytesPerWord @@ -1047,8 +1050,6 @@ const Register Gtmp = G3_scratch; const Address constMethod (G5_method, 0, in_bytes(Method::const_offset())); const Address access_flags (G5_method, 0, in_bytes(Method::access_flags_offset())); - const Address size_of_parameters(G5_method, 0, in_bytes(Method::size_of_parameters_offset())); - const Address size_of_locals (G5_method, 0, in_bytes(Method::size_of_locals_offset())); // slop factor is two extra slots on the expression stack so that // we always have room to store a result when returning from a call without parameters @@ -1066,6 +1067,9 @@ // Now compute new frame size if (native) { + const Register RconstMethod = Gtmp; + const Address size_of_parameters(RconstMethod, 0, in_bytes(ConstMethod::size_of_parameters_offset())); + __ ld_ptr(constMethod, RconstMethod); __ lduh( size_of_parameters, Gtmp ); __ calc_mem_param_words(Gtmp, Gtmp); // space for native call parameters passed on the stack in words } else { @@ -1236,9 +1240,13 @@ } if (init_value != noreg) { Label clear_loop; + const Register RconstMethod = O1; + const Address size_of_parameters(RconstMethod, 0, in_bytes(ConstMethod::size_of_parameters_offset())); + const Address size_of_locals (RconstMethod, 0, in_bytes(ConstMethod::size_of_locals_offset())); // NOTE: If you change the frame layout, this code will need to // be updated! + __ ld_ptr( constMethod, RconstMethod ); __ lduh( size_of_locals, O2 ); __ lduh( size_of_parameters, O1 ); __ sll( O2, LogBytesPerWord, O2); @@ -1483,13 +1491,16 @@ // // assert_different_registers(state, prev_state); const Register Gtmp = G3_scratch; + const RconstMethod = G3_scratch; const Register tmp = O2; - const Address size_of_parameters(G5_method, 0, in_bytes(Method::size_of_parameters_offset())); - const Address size_of_locals (G5_method, 0, in_bytes(Method::size_of_locals_offset())); + const Address constMethod(G5_method, 0, in_bytes(Method::const_offset())); + const Address size_of_parameters(RconstMethod, 0, in_bytes(ConstMethod::size_of_parameters_offset())); + const Address size_of_locals (RconstMethod, 0, in_bytes(ConstMethod::size_of_locals_offset())); + __ ld_ptr(constMethod, RconstMethod); __ lduh(size_of_parameters, tmp); - __ sll(tmp, LogBytesPerWord, Gtmp); // parameter size in bytes - __ add(args, Gtmp, Gargs); // points to first local + BytesPerWord + __ sll(tmp, LogBytesPerWord, Gargs); // parameter size in bytes + __ add(args, Gargs, Gargs); // points to first local + BytesPerWord // NEW __ add(Gargs, -wordSize, Gargs); // points to first local[0] // determine extra space for non-argument locals & adjust caller's SP @@ -1541,8 +1552,6 @@ const Address constMethod (G5_method, 0, in_bytes(Method::const_offset())); const Address access_flags (G5_method, 0, in_bytes(Method::access_flags_offset())); - const Address size_of_parameters(G5_method, 0, in_bytes(Method::size_of_parameters_offset())); - const Address size_of_locals (G5_method, 0, in_bytes(Method::size_of_locals_offset())); address entry_point = __ pc(); __ mov(G0, prevState); // no current activation @@ -1750,7 +1759,9 @@ __ ld_ptr(STATE(_result._to_call._callee), L4_scratch); // called method __ ld_ptr(STATE(_stack), L1_scratch); // get top of java expr stack - __ lduh(L4_scratch, in_bytes(Method::size_of_parameters_offset()), L2_scratch); // get parameter size + // get parameter size + __ ld_ptr(L4_scratch, in_bytes(Method::const_offset()), L2_scratch); + __ lduh(L2_scratch, in_bytes(ConstMethod::size_of_parameters_offset()), L2_scratch); __ sll(L2_scratch, LogBytesPerWord, L2_scratch ); // parameter size in bytes __ add(L1_scratch, L2_scratch, L1_scratch); // stack destination for result __ ld(L4_scratch, in_bytes(Method::result_index_offset()), L3_scratch); // called method result type index