hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp
changeset 5419 f2e8cc8c12ea
parent 5046 27e801a857cb
child 5688 9052dc91ea67
child 5547 f4b087cbb361
equal deleted inserted replaced
5418:c4955cb6ed33 5419:f2e8cc8c12ea
   303     case T_INT    : /* nothing to do */        break;
   303     case T_INT    : /* nothing to do */        break;
   304     case T_DOUBLE :
   304     case T_DOUBLE :
   305     case T_FLOAT  :
   305     case T_FLOAT  :
   306       { const Register t = InterpreterRuntime::SignatureHandlerGenerator::temp();
   306       { const Register t = InterpreterRuntime::SignatureHandlerGenerator::temp();
   307         __ pop(t);                            // remove return address first
   307         __ pop(t);                            // remove return address first
   308         __ pop_dtos_to_rsp();
       
   309         // Must return a result for interpreter or compiler. In SSE
   308         // Must return a result for interpreter or compiler. In SSE
   310         // mode, results are returned in xmm0 and the FPU stack must
   309         // mode, results are returned in xmm0 and the FPU stack must
   311         // be empty.
   310         // be empty.
   312         if (type == T_FLOAT && UseSSE >= 1) {
   311         if (type == T_FLOAT && UseSSE >= 1) {
   313           // Load ST0
   312           // Load ST0
   466   Label after_frame_check;
   465   Label after_frame_check;
   467 
   466 
   468   // see if the frame is greater than one page in size. If so,
   467   // see if the frame is greater than one page in size. If so,
   469   // then we need to verify there is enough stack space remaining
   468   // then we need to verify there is enough stack space remaining
   470   // for the additional locals.
   469   // for the additional locals.
   471   __ cmpl(rdx, (page_size - overhead_size)/Interpreter::stackElementSize());
   470   __ cmpl(rdx, (page_size - overhead_size)/Interpreter::stackElementSize);
   472   __ jcc(Assembler::belowEqual, after_frame_check);
   471   __ jcc(Assembler::belowEqual, after_frame_check);
   473 
   472 
   474   // compute rsp as if this were going to be the last frame on
   473   // compute rsp as if this were going to be the last frame on
   475   // the stack before the red zone
   474   // the stack before the red zone
   476 
   475 
   880 
   879 
   881   // allocate space for parameters
   880   // allocate space for parameters
   882   __ get_method(method);
   881   __ get_method(method);
   883   __ verify_oop(method);
   882   __ verify_oop(method);
   884   __ load_unsigned_short(t, Address(method, methodOopDesc::size_of_parameters_offset()));
   883   __ load_unsigned_short(t, Address(method, methodOopDesc::size_of_parameters_offset()));
   885   __ shlptr(t, Interpreter::logStackElementSize());
   884   __ shlptr(t, Interpreter::logStackElementSize);
   886   __ addptr(t, 2*wordSize);     // allocate two more slots for JNIEnv and possible mirror
   885   __ addptr(t, 2*wordSize);     // allocate two more slots for JNIEnv and possible mirror
   887   __ subptr(rsp, t);
   886   __ subptr(rsp, t);
   888   __ andptr(rsp, -(StackAlignmentInBytes)); // gcc needs 16 byte aligned stacks to do XMM intrinsics
   887   __ andptr(rsp, -(StackAlignmentInBytes)); // gcc needs 16 byte aligned stacks to do XMM intrinsics
   889 
   888 
   890   // get signature handler
   889   // get signature handler
  1223   {
  1222   {
  1224     Label exit, loop;
  1223     Label exit, loop;
  1225     __ testl(rdx, rdx);
  1224     __ testl(rdx, rdx);
  1226     __ jcc(Assembler::lessEqual, exit);               // do nothing if rdx <= 0
  1225     __ jcc(Assembler::lessEqual, exit);               // do nothing if rdx <= 0
  1227     __ bind(loop);
  1226     __ bind(loop);
  1228     if (TaggedStackInterpreter) {
       
  1229       __ push((int32_t)NULL_WORD);                    // push tag
       
  1230     }
       
  1231     __ push((int32_t)NULL_WORD);                      // initialize local variables
  1227     __ push((int32_t)NULL_WORD);                      // initialize local variables
  1232     __ decrement(rdx);                                // until everything initialized
  1228     __ decrement(rdx);                                // until everything initialized
  1233     __ jcc(Assembler::greater, loop);
  1229     __ jcc(Assembler::greater, loop);
  1234     __ bind(exit);
  1230     __ bind(exit);
  1235   }
  1231   }
  1461   // be sure to change this if you add/subtract anything to/from the overhead area
  1457   // be sure to change this if you add/subtract anything to/from the overhead area
  1462   const int overhead_size = -frame::interpreter_frame_initial_sp_offset;
  1458   const int overhead_size = -frame::interpreter_frame_initial_sp_offset;
  1463 
  1459 
  1464   const int extra_stack = methodOopDesc::extra_stack_entries();
  1460   const int extra_stack = methodOopDesc::extra_stack_entries();
  1465   const int method_stack = (method->max_locals() + method->max_stack() + extra_stack) *
  1461   const int method_stack = (method->max_locals() + method->max_stack() + extra_stack) *
  1466                            Interpreter::stackElementWords();
  1462                            Interpreter::stackElementWords;
  1467   return overhead_size + method_stack + stub_code;
  1463   return overhead_size + method_stack + stub_code;
  1468 }
  1464 }
  1469 
  1465 
  1470 // asm based interpreter deoptimization helpers
  1466 // asm based interpreter deoptimization helpers
  1471 
  1467 
  1485   // as determined by a previous call to this method.
  1481   // as determined by a previous call to this method.
  1486   // It is also guaranteed to be walkable even though it is in a skeletal state
  1482   // It is also guaranteed to be walkable even though it is in a skeletal state
  1487   // NOTE: return size is in words not bytes
  1483   // NOTE: return size is in words not bytes
  1488 
  1484 
  1489   // fixed size of an interpreter frame:
  1485   // fixed size of an interpreter frame:
  1490   int max_locals = method->max_locals() * Interpreter::stackElementWords();
  1486   int max_locals = method->max_locals() * Interpreter::stackElementWords;
  1491   int extra_locals = (method->max_locals() - method->size_of_parameters()) *
  1487   int extra_locals = (method->max_locals() - method->size_of_parameters()) *
  1492                      Interpreter::stackElementWords();
  1488                      Interpreter::stackElementWords;
  1493 
  1489 
  1494   int overhead = frame::sender_sp_offset - frame::interpreter_frame_initial_sp_offset;
  1490   int overhead = frame::sender_sp_offset - frame::interpreter_frame_initial_sp_offset;
  1495 
  1491 
  1496   // Our locals were accounted for by the caller (or last_frame_adjust on the transistion)
  1492   // Our locals were accounted for by the caller (or last_frame_adjust on the transistion)
  1497   // Since the callee parameters already account for the callee's params we only need to account for
  1493   // Since the callee parameters already account for the callee's params we only need to account for
  1498   // the extra locals.
  1494   // the extra locals.
  1499 
  1495 
  1500 
  1496 
  1501   int size = overhead +
  1497   int size = overhead +
  1502          ((callee_locals - callee_param_count)*Interpreter::stackElementWords()) +
  1498          ((callee_locals - callee_param_count)*Interpreter::stackElementWords) +
  1503          (moncount*frame::interpreter_frame_monitor_size()) +
  1499          (moncount*frame::interpreter_frame_monitor_size()) +
  1504          tempcount*Interpreter::stackElementWords() + popframe_extra_args;
  1500          tempcount*Interpreter::stackElementWords + popframe_extra_args;
  1505 
  1501 
  1506   if (interpreter_frame != NULL) {
  1502   if (interpreter_frame != NULL) {
  1507 #ifdef ASSERT
  1503 #ifdef ASSERT
  1508     if (!EnableMethodHandles)
  1504     if (!EnableMethodHandles)
  1509       // @@@ FIXME: Should we correct interpreter_frame_sender_sp in the calling sequences?
  1505       // @@@ FIXME: Should we correct interpreter_frame_sender_sp in the calling sequences?
  1523     BasicObjectLock* monbot = montop - moncount;
  1519     BasicObjectLock* monbot = montop - moncount;
  1524     interpreter_frame->interpreter_frame_set_monitor_end(monbot);
  1520     interpreter_frame->interpreter_frame_set_monitor_end(monbot);
  1525 
  1521 
  1526     // Set last_sp
  1522     // Set last_sp
  1527     intptr_t*  rsp = (intptr_t*) monbot  -
  1523     intptr_t*  rsp = (intptr_t*) monbot  -
  1528                      tempcount*Interpreter::stackElementWords() -
  1524                      tempcount*Interpreter::stackElementWords -
  1529                      popframe_extra_args;
  1525                      popframe_extra_args;
  1530     interpreter_frame->interpreter_frame_set_last_sp(rsp);
  1526     interpreter_frame->interpreter_frame_set_last_sp(rsp);
  1531 
  1527 
  1532     // All frames but the initial (oldest) interpreter frame we fill in have a
  1528     // All frames but the initial (oldest) interpreter frame we fill in have a
  1533     // value for sender_sp that allows walking the stack but isn't
  1529     // value for sender_sp that allows walking the stack but isn't
  1623 
  1619 
  1624     // Compute size of arguments for saving when returning to deoptimized caller
  1620     // Compute size of arguments for saving when returning to deoptimized caller
  1625     __ get_method(rax);
  1621     __ get_method(rax);
  1626     __ verify_oop(rax);
  1622     __ verify_oop(rax);
  1627     __ load_unsigned_short(rax, Address(rax, in_bytes(methodOopDesc::size_of_parameters_offset())));
  1623     __ load_unsigned_short(rax, Address(rax, in_bytes(methodOopDesc::size_of_parameters_offset())));
  1628     __ shlptr(rax, Interpreter::logStackElementSize());
  1624     __ shlptr(rax, Interpreter::logStackElementSize);
  1629     __ restore_locals();
  1625     __ restore_locals();
  1630     __ subptr(rdi, rax);
  1626     __ subptr(rdi, rax);
  1631     __ addptr(rdi, wordSize);
  1627     __ addptr(rdi, wordSize);
  1632     // Save these arguments
  1628     // Save these arguments
  1633     __ get_thread(thread);
  1629     __ get_thread(thread);