hotspot/src/cpu/x86/vm/cppInterpreter_x86.cpp
changeset 14745 03904dd8649b
parent 14633 58caa6fc3b7c
child 15482 470d0b0c09f1
equal deleted inserted replaced
14739:12125dacc077 14745:03904dd8649b
   609   // rsp - sender_sp
   609   // rsp - sender_sp
   610 
   610 
   611   // C++ interpreter only
   611   // C++ interpreter only
   612   // rsi/r13 - previous interpreter state pointer
   612   // rsi/r13 - previous interpreter state pointer
   613 
   613 
   614   const Address size_of_parameters(rbx, Method::size_of_parameters_offset());
       
   615 
       
   616   // InterpreterRuntime::frequency_counter_overflow takes one argument
   614   // InterpreterRuntime::frequency_counter_overflow takes one argument
   617   // indicating if the counter overflow occurs at a backwards branch (non-NULL bcp).
   615   // indicating if the counter overflow occurs at a backwards branch (non-NULL bcp).
   618   // The call returns the address of the verified entry point for the method or NULL
   616   // The call returns the address of the verified entry point for the method or NULL
   619   // if the compilation did not complete (either went background or bailed out).
   617   // if the compilation did not complete (either went background or bailed out).
   620   __ movptr(rax, (int32_t)false);
   618   __ movptr(rax, (int32_t)false);
   975   // rsi/r13: previous interpreter state (if called from C++ interpreter) must preserve
   973   // rsi/r13: previous interpreter state (if called from C++ interpreter) must preserve
   976   //      in any case. If called via c1/c2/call_stub rsi/r13 is junk (to use) but harmless
   974   //      in any case. If called via c1/c2/call_stub rsi/r13 is junk (to use) but harmless
   977   //      to save/restore.
   975   //      to save/restore.
   978   address entry_point = __ pc();
   976   address entry_point = __ pc();
   979 
   977 
   980   const Address size_of_parameters(rbx, Method::size_of_parameters_offset());
   978   const Address constMethod       (rbx, Method::const_offset());
   981   const Address size_of_locals    (rbx, Method::size_of_locals_offset());
       
   982   const Address invocation_counter(rbx, Method::invocation_counter_offset() + InvocationCounter::counter_offset());
   979   const Address invocation_counter(rbx, Method::invocation_counter_offset() + InvocationCounter::counter_offset());
   983   const Address access_flags      (rbx, Method::access_flags_offset());
   980   const Address access_flags      (rbx, Method::access_flags_offset());
       
   981   const Address size_of_parameters(rcx, ConstMethod::size_of_parameters_offset());
   984 
   982 
   985   // rsi/r13 == state/locals rdi == prevstate
   983   // rsi/r13 == state/locals rdi == prevstate
   986   const Register locals = rdi;
   984   const Register locals = rdi;
   987 
   985 
   988   // get parameter size (always needed)
   986   // get parameter size (always needed)
       
   987   __ movptr(rcx, constMethod);
   989   __ load_unsigned_short(rcx, size_of_parameters);
   988   __ load_unsigned_short(rcx, size_of_parameters);
   990 
   989 
   991   // rbx: Method*
   990   // rbx: Method*
   992   // rcx: size of parameters
   991   // rcx: size of parameters
   993   __ pop(rax);                                       // get return address
   992   __ pop(rax);                                       // get return address
   994   // for natives the size of locals is zero
   993   // for natives the size of locals is zero
   995 
   994 
   996   // compute beginning of parameters /locals
   995   // compute beginning of parameters /locals
       
   996 
   997   __ lea(locals, Address(rsp, rcx, Address::times_ptr, -wordSize));
   997   __ lea(locals, Address(rsp, rcx, Address::times_ptr, -wordSize));
   998 
   998 
   999   // initialize fixed part of activation frame
   999   // initialize fixed part of activation frame
  1000 
  1000 
  1001   // Assumes rax = return address
  1001   // Assumes rax = return address
  1105 
  1105 
  1106   // work registers
  1106   // work registers
  1107   const Register method = rbx;
  1107   const Register method = rbx;
  1108   const Register thread = LP64_ONLY(r15_thread) NOT_LP64(rdi);
  1108   const Register thread = LP64_ONLY(r15_thread) NOT_LP64(rdi);
  1109   const Register t      = InterpreterRuntime::SignatureHandlerGenerator::temp();    // rcx|rscratch1
  1109   const Register t      = InterpreterRuntime::SignatureHandlerGenerator::temp();    // rcx|rscratch1
       
  1110   const Address constMethod       (method, Method::const_offset());
       
  1111   const Address size_of_parameters(t, ConstMethod::size_of_parameters_offset());
  1110 
  1112 
  1111   // allocate space for parameters
  1113   // allocate space for parameters
  1112   __ movptr(method, STATE(_method));
  1114   __ movptr(method, STATE(_method));
  1113   __ verify_method_ptr(method);
  1115   __ verify_method_ptr(method);
  1114   __ load_unsigned_short(t, Address(method, Method::size_of_parameters_offset()));
  1116   __ movptr(t, constMethod);
       
  1117   __ load_unsigned_short(t, size_of_parameters);
  1115   __ shll(t, 2);
  1118   __ shll(t, 2);
  1116 #ifdef _LP64
  1119 #ifdef _LP64
  1117   __ subptr(rsp, t);
  1120   __ subptr(rsp, t);
  1118   __ subptr(rsp, frame::arg_reg_save_area_bytes); // windows
  1121   __ subptr(rsp, frame::arg_reg_save_area_bytes); // windows
  1119   __ andptr(rsp, -16); // must be 16 byte boundary (see amd64 ABI)
  1122   __ andptr(rsp, -16); // must be 16 byte boundary (see amd64 ABI)
  1698   __ bind(dispatch_entry_2);
  1701   __ bind(dispatch_entry_2);
  1699 
  1702 
  1700   // save sender sp
  1703   // save sender sp
  1701   __ push(rcx);
  1704   __ push(rcx);
  1702 
  1705 
  1703   const Address size_of_parameters(rbx, Method::size_of_parameters_offset());
  1706   const Address constMethod       (rbx, Method::const_offset());
  1704   const Address size_of_locals    (rbx, Method::size_of_locals_offset());
       
  1705   const Address access_flags      (rbx, Method::access_flags_offset());
  1707   const Address access_flags      (rbx, Method::access_flags_offset());
       
  1708   const Address size_of_parameters(rdx, ConstMethod::size_of_parameters_offset());
       
  1709   const Address size_of_locals    (rdx, ConstMethod::size_of_locals_offset());
  1706 
  1710 
  1707   // const Address monitor_block_top (rbp, frame::interpreter_frame_monitor_block_top_offset * wordSize);
  1711   // const Address monitor_block_top (rbp, frame::interpreter_frame_monitor_block_top_offset * wordSize);
  1708   // const Address monitor_block_bot (rbp, frame::interpreter_frame_initial_sp_offset        * wordSize);
  1712   // const Address monitor_block_bot (rbp, frame::interpreter_frame_initial_sp_offset        * wordSize);
  1709   // const Address monitor(rbp, frame::interpreter_frame_initial_sp_offset * wordSize - (int)sizeof(BasicObjectLock));
  1713   // const Address monitor(rbp, frame::interpreter_frame_initial_sp_offset * wordSize - (int)sizeof(BasicObjectLock));
  1710 
  1714 
  1711   // get parameter size (always needed)
  1715   // get parameter size (always needed)
       
  1716   __ movptr(rdx, constMethod);
  1712   __ load_unsigned_short(rcx, size_of_parameters);
  1717   __ load_unsigned_short(rcx, size_of_parameters);
  1713 
  1718 
  1714   // rbx: Method*
  1719   // rbx: Method*
  1715   // rcx: size of parameters
  1720   // rcx: size of parameters
  1716   __ load_unsigned_short(rdx, size_of_locals);                     // get size of locals in words
  1721   __ load_unsigned_short(rdx, size_of_locals);                     // get size of locals in words
  1987 
  1992 
  1988   // get method just executed
  1993   // get method just executed
  1989   __ movptr(rbx, STATE(_result._to_call._callee));
  1994   __ movptr(rbx, STATE(_result._to_call._callee));
  1990 
  1995 
  1991   // callee left args on top of expression stack, remove them
  1996   // callee left args on top of expression stack, remove them
  1992   __ load_unsigned_short(rcx, Address(rbx, Method::size_of_parameters_offset()));
  1997   __ movptr(rcx, constMethod);
       
  1998   __ load_unsigned_short(rcx, Address(rcx, ConstMethod::size_of_parameters_offset()));
       
  1999 
  1993   __ lea(rsp, Address(rsp, rcx, Address::times_ptr));
  2000   __ lea(rsp, Address(rsp, rcx, Address::times_ptr));
  1994 
  2001 
  1995   __ movl(rcx, Address(rbx, Method::result_index_offset()));
  2002   __ movl(rcx, Address(rbx, Method::result_index_offset()));
  1996   ExternalAddress tosca_to_stack((address)CppInterpreter::_tosca_to_stack);
  2003   ExternalAddress tosca_to_stack((address)CppInterpreter::_tosca_to_stack);
  1997   // Address index(noreg, rax, Address::times_ptr);
  2004   // Address index(noreg, rax, Address::times_ptr);
  2157   // don't need a return address if reinvoking interpreter
  2164   // don't need a return address if reinvoking interpreter
  2158 
  2165 
  2159   // Make it look like call_stub calling conventions
  2166   // Make it look like call_stub calling conventions
  2160 
  2167 
  2161   // Get (potential) receiver
  2168   // Get (potential) receiver
  2162   __ load_unsigned_short(rcx, size_of_parameters);                   // get size of parameters in words
  2169   // get size of parameters in words
       
  2170   __ movptr(rcx, constMethod);
       
  2171   __ load_unsigned_short(rcx, Address(rcx, ConstMethod::size_of_parameters_offset()));
  2163 
  2172 
  2164   ExternalAddress recursive(CAST_FROM_FN_PTR(address, RecursiveInterpreterActivation));
  2173   ExternalAddress recursive(CAST_FROM_FN_PTR(address, RecursiveInterpreterActivation));
  2165   __ pushptr(recursive.addr());                                      // make it look good in the debugger
  2174   __ pushptr(recursive.addr());                                      // make it look good in the debugger
  2166 
  2175 
  2167   InternalAddress entry(entry_point);
  2176   InternalAddress entry(entry_point);