511 __ movptr(STATE(_stack), rsp); // set current expression stack tos |
511 __ movptr(STATE(_stack), rsp); // set current expression stack tos |
512 |
512 |
513 // compute full expression stack limit |
513 // compute full expression stack limit |
514 |
514 |
515 const Address size_of_stack (rbx, methodOopDesc::max_stack_offset()); |
515 const Address size_of_stack (rbx, methodOopDesc::max_stack_offset()); |
516 __ load_unsigned_word(rdx, size_of_stack); // get size of expression stack in words |
516 __ load_unsigned_short(rdx, size_of_stack); // get size of expression stack in words |
517 __ negptr(rdx); // so we can subtract in next step |
517 __ negptr(rdx); // so we can subtract in next step |
518 // Allocate expression stack |
518 // Allocate expression stack |
519 __ lea(rsp, Address(rsp, rdx, Address::times_ptr)); |
519 __ lea(rsp, Address(rsp, rdx, Address::times_ptr)); |
520 __ movptr(STATE(_stack_limit), rsp); |
520 __ movptr(STATE(_stack_limit), rsp); |
521 } |
521 } |
522 |
522 |
523 #ifdef _LP64 |
523 #ifdef _LP64 |
524 // Make sure stack is properly aligned and sized for the abi |
524 // Make sure stack is properly aligned and sized for the abi |
525 __ subptr(rsp, frame::arg_reg_save_area_bytes); // windows |
525 __ subptr(rsp, frame::arg_reg_save_area_bytes); // windows |
526 __ andptr(rsp, -16); // must be 16 byte boundry (see amd64 ABI) |
526 __ andptr(rsp, -16); // must be 16 byte boundary (see amd64 ABI) |
527 #endif // _LP64 |
527 #endif // _LP64 |
528 |
528 |
529 |
529 |
530 |
530 |
531 } |
531 } |
657 // locals + overhead, in bytes |
657 // locals + overhead, in bytes |
658 const Address size_of_stack (rbx, methodOopDesc::max_stack_offset()); |
658 const Address size_of_stack (rbx, methodOopDesc::max_stack_offset()); |
659 // Always give one monitor to allow us to start interp if sync method. |
659 // Always give one monitor to allow us to start interp if sync method. |
660 // Any additional monitors need a check when moving the expression stack |
660 // Any additional monitors need a check when moving the expression stack |
661 const int one_monitor = frame::interpreter_frame_monitor_size() * wordSize; |
661 const int one_monitor = frame::interpreter_frame_monitor_size() * wordSize; |
662 __ load_unsigned_word(rax, size_of_stack); // get size of expression stack in words |
662 __ load_unsigned_short(rax, size_of_stack); // get size of expression stack in words |
663 __ lea(rax, Address(noreg, rax, Interpreter::stackElementScale(), one_monitor)); |
663 __ lea(rax, Address(noreg, rax, Interpreter::stackElementScale(), one_monitor)); |
664 __ lea(rax, Address(rax, rdx, Interpreter::stackElementScale(), overhead_size)); |
664 __ lea(rax, Address(rax, rdx, Interpreter::stackElementScale(), overhead_size)); |
665 |
665 |
666 #ifdef ASSERT |
666 #ifdef ASSERT |
667 Label stack_base_okay, stack_size_okay; |
667 Label stack_base_okay, stack_size_okay; |
861 __ jmp(xreturn_path); |
861 __ jmp(xreturn_path); |
862 |
862 |
863 __ bind(notByte); |
863 __ bind(notByte); |
864 __ cmpl(rdx, stos); |
864 __ cmpl(rdx, stos); |
865 __ jcc(Assembler::notEqual, notShort); |
865 __ jcc(Assembler::notEqual, notShort); |
866 __ load_signed_word(rax, field_address); |
866 __ load_signed_short(rax, field_address); |
867 __ jmp(xreturn_path); |
867 __ jmp(xreturn_path); |
868 |
868 |
869 __ bind(notShort); |
869 __ bind(notShort); |
870 __ cmpl(rdx, ctos); |
870 __ cmpl(rdx, ctos); |
871 __ jcc(Assembler::notEqual, notChar); |
871 __ jcc(Assembler::notEqual, notChar); |
872 __ load_unsigned_word(rax, field_address); |
872 __ load_unsigned_short(rax, field_address); |
873 __ jmp(xreturn_path); |
873 __ jmp(xreturn_path); |
874 |
874 |
875 __ bind(notChar); |
875 __ bind(notChar); |
876 #ifdef ASSERT |
876 #ifdef ASSERT |
877 Label okay; |
877 Label okay; |
935 |
935 |
936 // rsi/r13 == state/locals rdi == prevstate |
936 // rsi/r13 == state/locals rdi == prevstate |
937 const Register locals = rdi; |
937 const Register locals = rdi; |
938 |
938 |
939 // get parameter size (always needed) |
939 // get parameter size (always needed) |
940 __ load_unsigned_word(rcx, size_of_parameters); |
940 __ load_unsigned_short(rcx, size_of_parameters); |
941 |
941 |
942 // rbx: methodOop |
942 // rbx: methodOop |
943 // rcx: size of parameters |
943 // rcx: size of parameters |
944 __ pop(rax); // get return address |
944 __ pop(rax); // get return address |
945 // for natives the size of locals is zero |
945 // for natives the size of locals is zero |
968 { Label L; |
968 { Label L; |
969 __ movptr(rax, STATE(_stack_base)); |
969 __ movptr(rax, STATE(_stack_base)); |
970 #ifdef _LP64 |
970 #ifdef _LP64 |
971 // duplicate the alignment rsp got after setting stack_base |
971 // duplicate the alignment rsp got after setting stack_base |
972 __ subptr(rax, frame::arg_reg_save_area_bytes); // windows |
972 __ subptr(rax, frame::arg_reg_save_area_bytes); // windows |
973 __ andptr(rax, -16); // must be 16 byte boundry (see amd64 ABI) |
973 __ andptr(rax, -16); // must be 16 byte boundary (see amd64 ABI) |
974 #endif // _LP64 |
974 #endif // _LP64 |
975 __ cmpptr(rax, rsp); |
975 __ cmpptr(rax, rsp); |
976 __ jcc(Assembler::equal, L); |
976 __ jcc(Assembler::equal, L); |
977 __ stop("broken stack frame setup in interpreter"); |
977 __ stop("broken stack frame setup in interpreter"); |
978 __ bind(L); |
978 __ bind(L); |
1060 const Register t = InterpreterRuntime::SignatureHandlerGenerator::temp(); // rcx|rscratch1 |
1060 const Register t = InterpreterRuntime::SignatureHandlerGenerator::temp(); // rcx|rscratch1 |
1061 |
1061 |
1062 // allocate space for parameters |
1062 // allocate space for parameters |
1063 __ movptr(method, STATE(_method)); |
1063 __ movptr(method, STATE(_method)); |
1064 __ verify_oop(method); |
1064 __ verify_oop(method); |
1065 __ load_unsigned_word(t, Address(method, methodOopDesc::size_of_parameters_offset())); |
1065 __ load_unsigned_short(t, Address(method, methodOopDesc::size_of_parameters_offset())); |
1066 __ shll(t, 2); |
1066 __ shll(t, 2); |
1067 #ifdef _LP64 |
1067 #ifdef _LP64 |
1068 __ subptr(rsp, t); |
1068 __ subptr(rsp, t); |
1069 __ subptr(rsp, frame::arg_reg_save_area_bytes); // windows |
1069 __ subptr(rsp, frame::arg_reg_save_area_bytes); // windows |
1070 __ andptr(rsp, -16); // must be 16 byte boundry (see amd64 ABI) |
1070 __ andptr(rsp, -16); // must be 16 byte boundary (see amd64 ABI) |
1071 #else |
1071 #else |
1072 __ addptr(t, 2*wordSize); // allocate two more slots for JNIEnv and possible mirror |
1072 __ addptr(t, 2*wordSize); // allocate two more slots for JNIEnv and possible mirror |
1073 __ subptr(rsp, t); |
1073 __ subptr(rsp, t); |
1074 __ andptr(rsp, -(StackAlignmentInBytes)); // gcc needs 16 byte aligned stacks to do XMM intrinsics |
1074 __ andptr(rsp, -(StackAlignmentInBytes)); // gcc needs 16 byte aligned stacks to do XMM intrinsics |
1075 #endif // _LP64 |
1075 #endif // _LP64 |
1657 // const Address monitor_block_top (rbp, frame::interpreter_frame_monitor_block_top_offset * wordSize); |
1657 // const Address monitor_block_top (rbp, frame::interpreter_frame_monitor_block_top_offset * wordSize); |
1658 // const Address monitor_block_bot (rbp, frame::interpreter_frame_initial_sp_offset * wordSize); |
1658 // const Address monitor_block_bot (rbp, frame::interpreter_frame_initial_sp_offset * wordSize); |
1659 // const Address monitor(rbp, frame::interpreter_frame_initial_sp_offset * wordSize - (int)sizeof(BasicObjectLock)); |
1659 // const Address monitor(rbp, frame::interpreter_frame_initial_sp_offset * wordSize - (int)sizeof(BasicObjectLock)); |
1660 |
1660 |
1661 // get parameter size (always needed) |
1661 // get parameter size (always needed) |
1662 __ load_unsigned_word(rcx, size_of_parameters); |
1662 __ load_unsigned_short(rcx, size_of_parameters); |
1663 |
1663 |
1664 // rbx: methodOop |
1664 // rbx: methodOop |
1665 // rcx: size of parameters |
1665 // rcx: size of parameters |
1666 __ load_unsigned_word(rdx, size_of_locals); // get size of locals in words |
1666 __ load_unsigned_short(rdx, size_of_locals); // get size of locals in words |
1667 |
1667 |
1668 __ subptr(rdx, rcx); // rdx = no. of additional locals |
1668 __ subptr(rdx, rcx); // rdx = no. of additional locals |
1669 |
1669 |
1670 // see if we've got enough room on the stack for locals plus overhead. |
1670 // see if we've got enough room on the stack for locals plus overhead. |
1671 generate_stack_overflow_check(); // C++ |
1671 generate_stack_overflow_check(); // C++ |
1947 |
1947 |
1948 // get method just executed |
1948 // get method just executed |
1949 __ movptr(rbx, STATE(_result._to_call._callee)); |
1949 __ movptr(rbx, STATE(_result._to_call._callee)); |
1950 |
1950 |
1951 // callee left args on top of expression stack, remove them |
1951 // callee left args on top of expression stack, remove them |
1952 __ load_unsigned_word(rcx, Address(rbx, methodOopDesc::size_of_parameters_offset())); |
1952 __ load_unsigned_short(rcx, Address(rbx, methodOopDesc::size_of_parameters_offset())); |
1953 __ lea(rsp, Address(rsp, rcx, Address::times_ptr)); |
1953 __ lea(rsp, Address(rsp, rcx, Address::times_ptr)); |
1954 |
1954 |
1955 __ movl(rcx, Address(rbx, methodOopDesc::result_index_offset())); |
1955 __ movl(rcx, Address(rbx, methodOopDesc::result_index_offset())); |
1956 ExternalAddress tosca_to_stack((address)CppInterpreter::_tosca_to_stack); |
1956 ExternalAddress tosca_to_stack((address)CppInterpreter::_tosca_to_stack); |
1957 // Address index(noreg, rax, Address::times_ptr); |
1957 // Address index(noreg, rax, Address::times_ptr); |
2117 // don't need a return address if reinvoking interpreter |
2117 // don't need a return address if reinvoking interpreter |
2118 |
2118 |
2119 // Make it look like call_stub calling conventions |
2119 // Make it look like call_stub calling conventions |
2120 |
2120 |
2121 // Get (potential) receiver |
2121 // Get (potential) receiver |
2122 __ load_unsigned_word(rcx, size_of_parameters); // get size of parameters in words |
2122 __ load_unsigned_short(rcx, size_of_parameters); // get size of parameters in words |
2123 |
2123 |
2124 ExternalAddress recursive(CAST_FROM_FN_PTR(address, RecursiveInterpreterActivation)); |
2124 ExternalAddress recursive(CAST_FROM_FN_PTR(address, RecursiveInterpreterActivation)); |
2125 __ pushptr(recursive.addr()); // make it look good in the debugger |
2125 __ pushptr(recursive.addr()); // make it look good in the debugger |
2126 |
2126 |
2127 InternalAddress entry(entry_point); |
2127 InternalAddress entry(entry_point); |