Mercurial > hg > truffle
comparison src/cpu/x86/vm/templateInterpreter_x86_64.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 | cd3d6a6b95d9 |
children | 989155e2d07a db9981fd3124 |
comparison
equal
deleted
inserted
replaced
7396:4a2ed49abd51 | 7402:fd74228fd5ca |
---|---|
367 | 367 |
368 // On return (i.e. jump to entry_point) [ back to invocation of interpreter ] | 368 // On return (i.e. jump to entry_point) [ back to invocation of interpreter ] |
369 // Everything as it was on entry | 369 // Everything as it was on entry |
370 // rdx is not restored. Doesn't appear to really be set. | 370 // rdx is not restored. Doesn't appear to really be set. |
371 | 371 |
372 const Address size_of_parameters(rbx, | |
373 Method::size_of_parameters_offset()); | |
374 | |
375 // InterpreterRuntime::frequency_counter_overflow takes two | 372 // InterpreterRuntime::frequency_counter_overflow takes two |
376 // arguments, the first (thread) is passed by call_VM, the second | 373 // arguments, the first (thread) is passed by call_VM, the second |
377 // indicates if the counter overflow occurs at a backwards branch | 374 // indicates if the counter overflow occurs at a backwards branch |
378 // (NULL bcp). We pass zero for it. The call returns the address | 375 // (NULL bcp). We pass zero for it. The call returns the address |
379 // of the verified entry point for the method or NULL if the | 376 // of the verified entry point for the method or NULL if the |
842 // rbx: Method* | 839 // rbx: Method* |
843 // r13: sender sp | 840 // r13: sender sp |
844 | 841 |
845 address entry_point = __ pc(); | 842 address entry_point = __ pc(); |
846 | 843 |
847 const Address size_of_parameters(rbx, Method:: | 844 const Address constMethod (rbx, Method::const_offset()); |
848 size_of_parameters_offset()); | |
849 const Address invocation_counter(rbx, Method:: | 845 const Address invocation_counter(rbx, Method:: |
850 invocation_counter_offset() + | 846 invocation_counter_offset() + |
851 InvocationCounter::counter_offset()); | 847 InvocationCounter::counter_offset()); |
852 const Address access_flags (rbx, Method::access_flags_offset()); | 848 const Address access_flags (rbx, Method::access_flags_offset()); |
849 const Address size_of_parameters(rcx, ConstMethod:: | |
850 size_of_parameters_offset()); | |
851 | |
853 | 852 |
854 // get parameter size (always needed) | 853 // get parameter size (always needed) |
854 __ movptr(rcx, constMethod); | |
855 __ load_unsigned_short(rcx, size_of_parameters); | 855 __ load_unsigned_short(rcx, size_of_parameters); |
856 | 856 |
857 // native calls don't need the stack size check since they have no | 857 // native calls don't need the stack size check since they have no |
858 // expression stack and the arguments are already on the stack and | 858 // expression stack and the arguments are already on the stack and |
859 // we only add a handful of words to the stack | 859 // we only add a handful of words to the stack |
965 const Register method = rbx; | 965 const Register method = rbx; |
966 const Register t = r11; | 966 const Register t = r11; |
967 | 967 |
968 // allocate space for parameters | 968 // allocate space for parameters |
969 __ get_method(method); | 969 __ get_method(method); |
970 __ load_unsigned_short(t, | 970 __ movptr(t, Address(method, Method::const_offset())); |
971 Address(method, | 971 __ load_unsigned_short(t, Address(t, ConstMethod::size_of_parameters_offset())); |
972 Method::size_of_parameters_offset())); | |
973 __ shll(t, Interpreter::logStackElementSize); | 972 __ shll(t, Interpreter::logStackElementSize); |
974 | 973 |
975 __ subptr(rsp, t); | 974 __ subptr(rsp, t); |
976 __ subptr(rsp, frame::arg_reg_save_area_bytes); // windows | 975 __ subptr(rsp, frame::arg_reg_save_area_bytes); // windows |
977 __ andptr(rsp, -16); // must be 16 byte boundary (see amd64 ABI) | 976 __ andptr(rsp, -16); // must be 16 byte boundary (see amd64 ABI) |
1300 | 1299 |
1301 // ebx: Method* | 1300 // ebx: Method* |
1302 // r13: sender sp | 1301 // r13: sender sp |
1303 address entry_point = __ pc(); | 1302 address entry_point = __ pc(); |
1304 | 1303 |
1305 const Address size_of_parameters(rbx, | 1304 const Address constMethod(rbx, Method::const_offset()); |
1306 Method::size_of_parameters_offset()); | |
1307 const Address size_of_locals(rbx, Method::size_of_locals_offset()); | |
1308 const Address invocation_counter(rbx, | 1305 const Address invocation_counter(rbx, |
1309 Method::invocation_counter_offset() + | 1306 Method::invocation_counter_offset() + |
1310 InvocationCounter::counter_offset()); | 1307 InvocationCounter::counter_offset()); |
1311 const Address access_flags(rbx, Method::access_flags_offset()); | 1308 const Address access_flags(rbx, Method::access_flags_offset()); |
1309 const Address size_of_parameters(rdx, | |
1310 ConstMethod::size_of_parameters_offset()); | |
1311 const Address size_of_locals(rdx, ConstMethod::size_of_locals_offset()); | |
1312 | |
1312 | 1313 |
1313 // get parameter size (always needed) | 1314 // get parameter size (always needed) |
1315 __ movptr(rdx, constMethod); | |
1314 __ load_unsigned_short(rcx, size_of_parameters); | 1316 __ load_unsigned_short(rcx, size_of_parameters); |
1315 | 1317 |
1316 // rbx: Method* | 1318 // rbx: Method* |
1317 // rcx: size of parameters | 1319 // rcx: size of parameters |
1318 // r13: sender_sp (could differ from sp+wordSize if we were called via c2i ) | 1320 // r13: sender_sp (could differ from sp+wordSize if we were called via c2i ) |
1750 __ jcc(Assembler::notZero, caller_not_deoptimized); | 1752 __ jcc(Assembler::notZero, caller_not_deoptimized); |
1751 | 1753 |
1752 // Compute size of arguments for saving when returning to | 1754 // Compute size of arguments for saving when returning to |
1753 // deoptimized caller | 1755 // deoptimized caller |
1754 __ get_method(rax); | 1756 __ get_method(rax); |
1755 __ load_unsigned_short(rax, Address(rax, in_bytes(Method:: | 1757 __ movptr(rax, Address(rax, Method::const_offset())); |
1758 __ load_unsigned_short(rax, Address(rax, in_bytes(ConstMethod:: | |
1756 size_of_parameters_offset()))); | 1759 size_of_parameters_offset()))); |
1757 __ shll(rax, Interpreter::logStackElementSize); | 1760 __ shll(rax, Interpreter::logStackElementSize); |
1758 __ restore_locals(); // XXX do we need this? | 1761 __ restore_locals(); // XXX do we need this? |
1759 __ subptr(r14, rax); | 1762 __ subptr(r14, rax); |
1760 __ addptr(r14, wordSize); | 1763 __ addptr(r14, wordSize); |