Mercurial > hg > truffle
comparison src/cpu/sparc/vm/templateInterpreter_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 | d2f8c38e543d |
children | c52660592f37 |
comparison
equal
deleted
inserted
replaced
7396:4a2ed49abd51 | 7402:fd74228fd5ca |
---|---|
492 // is necessary. | 492 // is necessary. |
493 // | 493 // |
494 // (gri - 2/25/2000) | 494 // (gri - 2/25/2000) |
495 | 495 |
496 | 496 |
497 const Address size_of_parameters(G5_method, Method::size_of_parameters_offset()); | |
498 const Address size_of_locals (G5_method, Method::size_of_locals_offset()); | |
499 const Address constMethod (G5_method, Method::const_offset()); | |
500 int rounded_vm_local_words = round_to( frame::interpreter_frame_vm_local_words, WordsPerLong ); | 497 int rounded_vm_local_words = round_to( frame::interpreter_frame_vm_local_words, WordsPerLong ); |
501 | 498 |
502 const int extra_space = | 499 const int extra_space = |
503 rounded_vm_local_words + // frame local scratch space | 500 rounded_vm_local_words + // frame local scratch space |
504 //6815692//Method::extra_stack_words() + // extra push slots for MH adapters | 501 //6815692//Method::extra_stack_words() + // extra push slots for MH adapters |
505 frame::memory_parameter_word_sp_offset + // register save area | 502 frame::memory_parameter_word_sp_offset + // register save area |
506 (native_call ? frame::interpreter_frame_extra_outgoing_argument_words : 0); | 503 (native_call ? frame::interpreter_frame_extra_outgoing_argument_words : 0); |
507 | 504 |
508 const Register Glocals_size = G3; | 505 const Register Glocals_size = G3; |
506 const Register RconstMethod = Glocals_size; | |
509 const Register Otmp1 = O3; | 507 const Register Otmp1 = O3; |
510 const Register Otmp2 = O4; | 508 const Register Otmp2 = O4; |
511 // Lscratch can't be used as a temporary because the call_stub uses | 509 // Lscratch can't be used as a temporary because the call_stub uses |
512 // it to assert that the stack frame was setup correctly. | 510 // it to assert that the stack frame was setup correctly. |
513 | 511 const Address constMethod (G5_method, Method::const_offset()); |
512 const Address size_of_parameters(RconstMethod, ConstMethod::size_of_parameters_offset()); | |
513 | |
514 __ ld_ptr( constMethod, RconstMethod ); | |
514 __ lduh( size_of_parameters, Glocals_size); | 515 __ lduh( size_of_parameters, Glocals_size); |
515 | 516 |
516 // Gargs points to first local + BytesPerWord | 517 // Gargs points to first local + BytesPerWord |
517 // Set the saved SP after the register window save | 518 // Set the saved SP after the register window save |
518 // | 519 // |
528 } else { | 529 } else { |
529 | 530 |
530 // | 531 // |
531 // Compute number of locals in method apart from incoming parameters | 532 // Compute number of locals in method apart from incoming parameters |
532 // | 533 // |
534 const Address size_of_locals (Otmp1, ConstMethod::size_of_locals_offset()); | |
535 __ ld_ptr( constMethod, Otmp1 ); | |
533 __ lduh( size_of_locals, Otmp1 ); | 536 __ lduh( size_of_locals, Otmp1 ); |
534 __ sub( Otmp1, Glocals_size, Glocals_size ); | 537 __ sub( Otmp1, Glocals_size, Glocals_size ); |
535 __ round_to( Glocals_size, WordsPerLong ); | 538 __ round_to( Glocals_size, WordsPerLong ); |
536 __ sll( Glocals_size, Interpreter::logStackElementSize, Glocals_size ); | 539 __ sll( Glocals_size, Interpreter::logStackElementSize, Glocals_size ); |
537 | 540 |
1254 const Register Gtmp2 = G1_scratch; | 1257 const Register Gtmp2 = G1_scratch; |
1255 | 1258 |
1256 // make sure registers are different! | 1259 // make sure registers are different! |
1257 assert_different_registers(G2_thread, G5_method, Gargs, Gtmp1, Gtmp2); | 1260 assert_different_registers(G2_thread, G5_method, Gargs, Gtmp1, Gtmp2); |
1258 | 1261 |
1259 const Address size_of_parameters(G5_method, Method::size_of_parameters_offset()); | 1262 const Address constMethod (G5_method, Method::const_offset()); |
1260 const Address size_of_locals (G5_method, Method::size_of_locals_offset()); | |
1261 // Seems like G5_method is live at the point this is used. So we could make this look consistent | 1263 // Seems like G5_method is live at the point this is used. So we could make this look consistent |
1262 // and use in the asserts. | 1264 // and use in the asserts. |
1263 const Address access_flags (Lmethod, Method::access_flags_offset()); | 1265 const Address access_flags (Lmethod, Method::access_flags_offset()); |
1264 | 1266 |
1265 const Register Glocals_size = G3; | 1267 const Register Glocals_size = G3; |
1305 // initialized. We removed this extra complication to already over complicated code. | 1307 // initialized. We removed this extra complication to already over complicated code. |
1306 | 1308 |
1307 init_value = G0; | 1309 init_value = G0; |
1308 Label clear_loop; | 1310 Label clear_loop; |
1309 | 1311 |
1312 const Register RconstMethod = O1; | |
1313 const Address size_of_parameters(RconstMethod, ConstMethod::size_of_parameters_offset()); | |
1314 const Address size_of_locals (RconstMethod, ConstMethod::size_of_locals_offset()); | |
1315 | |
1310 // NOTE: If you change the frame layout, this code will need to | 1316 // NOTE: If you change the frame layout, this code will need to |
1311 // be updated! | 1317 // be updated! |
1318 __ ld_ptr( constMethod, RconstMethod ); | |
1312 __ lduh( size_of_locals, O2 ); | 1319 __ lduh( size_of_locals, O2 ); |
1313 __ lduh( size_of_parameters, O1 ); | 1320 __ lduh( size_of_parameters, O1 ); |
1314 __ sll( O2, Interpreter::logStackElementSize, O2); | 1321 __ sll( O2, Interpreter::logStackElementSize, O2); |
1315 __ sll( O1, Interpreter::logStackElementSize, O1 ); | 1322 __ sll( O1, Interpreter::logStackElementSize, O1 ); |
1316 __ sub( Llocals, O2, O2 ); | 1323 __ sub( Llocals, O2, O2 ); |
1821 __ call_VM_leaf(L7_thread_cache, CAST_FROM_FN_PTR(address, InterpreterRuntime::interpreter_contains), I7); | 1828 __ call_VM_leaf(L7_thread_cache, CAST_FROM_FN_PTR(address, InterpreterRuntime::interpreter_contains), I7); |
1822 __ br_notnull_short(O0, Assembler::pt, caller_not_deoptimized); | 1829 __ br_notnull_short(O0, Assembler::pt, caller_not_deoptimized); |
1823 | 1830 |
1824 const Register Gtmp1 = G3_scratch; | 1831 const Register Gtmp1 = G3_scratch; |
1825 const Register Gtmp2 = G1_scratch; | 1832 const Register Gtmp2 = G1_scratch; |
1833 const Register RconstMethod = Gtmp1; | |
1834 const Address constMethod(Lmethod, Method::const_offset()); | |
1835 const Address size_of_parameters(RconstMethod, ConstMethod::size_of_parameters_offset()); | |
1826 | 1836 |
1827 // Compute size of arguments for saving when returning to deoptimized caller | 1837 // Compute size of arguments for saving when returning to deoptimized caller |
1828 __ lduh(Lmethod, in_bytes(Method::size_of_parameters_offset()), Gtmp1); | 1838 __ ld_ptr(constMethod, RconstMethod); |
1839 __ lduh(size_of_parameters, Gtmp1); | |
1829 __ sll(Gtmp1, Interpreter::logStackElementSize, Gtmp1); | 1840 __ sll(Gtmp1, Interpreter::logStackElementSize, Gtmp1); |
1830 __ sub(Llocals, Gtmp1, Gtmp2); | 1841 __ sub(Llocals, Gtmp1, Gtmp2); |
1831 __ add(Gtmp2, wordSize, Gtmp2); | 1842 __ add(Gtmp2, wordSize, Gtmp2); |
1832 // Save these arguments | 1843 // Save these arguments |
1833 __ call_VM_leaf(L7_thread_cache, CAST_FROM_FN_PTR(address, Deoptimization::popframe_preserve_args), G2_thread, Gtmp1, Gtmp2); | 1844 __ call_VM_leaf(L7_thread_cache, CAST_FROM_FN_PTR(address, Deoptimization::popframe_preserve_args), G2_thread, Gtmp1, Gtmp2); |