hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp
changeset 5419 f2e8cc8c12ea
parent 5416 5f6377fcfd3e
child 5688 9052dc91ea67
child 5547 f4b087cbb361
equal deleted inserted replaced
5418:c4955cb6ed33 5419:f2e8cc8c12ea
   195   __ get_cache_and_index_at_bcp(cache, G1_scratch, 1);
   195   __ get_cache_and_index_at_bcp(cache, G1_scratch, 1);
   196   __ bind(L_got_cache);
   196   __ bind(L_got_cache);
   197   __ ld_ptr(cache, constantPoolCacheOopDesc::base_offset() +
   197   __ ld_ptr(cache, constantPoolCacheOopDesc::base_offset() +
   198                    ConstantPoolCacheEntry::flags_offset(), size);
   198                    ConstantPoolCacheEntry::flags_offset(), size);
   199   __ and3(size, 0xFF, size);                   // argument size in words
   199   __ and3(size, 0xFF, size);                   // argument size in words
   200   __ sll(size, Interpreter::logStackElementSize(), size); // each argument size in bytes
   200   __ sll(size, Interpreter::logStackElementSize, size); // each argument size in bytes
   201   __ add(Lesp, size, Lesp);                    // pop arguments
   201   __ add(Lesp, size, Lesp);                    // pop arguments
   202   __ dispatch_next(state, step);
   202   __ dispatch_next(state, step);
   203 
   203 
   204   // out of the main line of code...
   204   // out of the main line of code...
   205   if (EnableInvokeDynamic) {
   205   if (EnableInvokeDynamic) {
   493 
   493 
   494   // Gargs points to first local + BytesPerWord
   494   // Gargs points to first local + BytesPerWord
   495   // Set the saved SP after the register window save
   495   // Set the saved SP after the register window save
   496   //
   496   //
   497   assert_different_registers(Gargs, Glocals_size, Gframe_size, O5_savedSP);
   497   assert_different_registers(Gargs, Glocals_size, Gframe_size, O5_savedSP);
   498   __ sll(Glocals_size, Interpreter::logStackElementSize(), Otmp1);
   498   __ sll(Glocals_size, Interpreter::logStackElementSize, Otmp1);
   499   __ add(Gargs, Otmp1, Gargs);
   499   __ add(Gargs, Otmp1, Gargs);
   500 
   500 
   501   if (native_call) {
   501   if (native_call) {
   502     __ calc_mem_param_words( Glocals_size, Gframe_size );
   502     __ calc_mem_param_words( Glocals_size, Gframe_size );
   503     __ add( Gframe_size,  extra_space, Gframe_size);
   503     __ add( Gframe_size,  extra_space, Gframe_size);
   509     // Compute number of locals in method apart from incoming parameters
   509     // Compute number of locals in method apart from incoming parameters
   510     //
   510     //
   511     __ lduh( size_of_locals, Otmp1 );
   511     __ lduh( size_of_locals, Otmp1 );
   512     __ sub( Otmp1, Glocals_size, Glocals_size );
   512     __ sub( Otmp1, Glocals_size, Glocals_size );
   513     __ round_to( Glocals_size, WordsPerLong );
   513     __ round_to( Glocals_size, WordsPerLong );
   514     __ sll( Glocals_size, Interpreter::logStackElementSize(), Glocals_size );
   514     __ sll( Glocals_size, Interpreter::logStackElementSize, Glocals_size );
   515 
   515 
   516     // see if the frame is greater than one page in size. If so,
   516     // see if the frame is greater than one page in size. If so,
   517     // then we need to verify there is enough stack space remaining
   517     // then we need to verify there is enough stack space remaining
   518     // Frame_size = (max_stack + extra_space) * BytesPerWord;
   518     // Frame_size = (max_stack + extra_space) * BytesPerWord;
   519     __ lduh( max_stack, Gframe_size );
   519     __ lduh( max_stack, Gframe_size );
   520     __ add( Gframe_size, extra_space, Gframe_size );
   520     __ add( Gframe_size, extra_space, Gframe_size );
   521     __ round_to( Gframe_size, WordsPerLong );
   521     __ round_to( Gframe_size, WordsPerLong );
   522     __ sll( Gframe_size, Interpreter::logStackElementSize(), Gframe_size);
   522     __ sll( Gframe_size, Interpreter::logStackElementSize, Gframe_size);
   523 
   523 
   524     // Add in java locals size for stack overflow check only
   524     // Add in java locals size for stack overflow check only
   525     __ add( Gframe_size, Glocals_size, Gframe_size );
   525     __ add( Gframe_size, Glocals_size, Gframe_size );
   526 
   526 
   527     const Register Otmp2 = O4;
   527     const Register Otmp2 = O4;
  1232 
  1232 
  1233   // NOTE: If you change the frame layout, this code will need to
  1233   // NOTE: If you change the frame layout, this code will need to
  1234   // be updated!
  1234   // be updated!
  1235   __ lduh( size_of_locals, O2 );
  1235   __ lduh( size_of_locals, O2 );
  1236   __ lduh( size_of_parameters, O1 );
  1236   __ lduh( size_of_parameters, O1 );
  1237   __ sll( O2, Interpreter::logStackElementSize(), O2);
  1237   __ sll( O2, Interpreter::logStackElementSize, O2);
  1238   __ sll( O1, Interpreter::logStackElementSize(), O1 );
  1238   __ sll( O1, Interpreter::logStackElementSize, O1 );
  1239   __ sub( Llocals, O2, O2 );
  1239   __ sub( Llocals, O2, O2 );
  1240   __ sub( Llocals, O1, O1 );
  1240   __ sub( Llocals, O1, O1 );
  1241 
  1241 
  1242   __ bind( clear_loop );
  1242   __ bind( clear_loop );
  1243   __ inc( O2, wordSize );
  1243   __ inc( O2, wordSize );
  1468   //
  1468   //
  1469   const int rounded_vm_local_words =
  1469   const int rounded_vm_local_words =
  1470        round_to(frame::interpreter_frame_vm_local_words,WordsPerLong);
  1470        round_to(frame::interpreter_frame_vm_local_words,WordsPerLong);
  1471   // callee_locals and max_stack are counts, not the size in frame.
  1471   // callee_locals and max_stack are counts, not the size in frame.
  1472   const int locals_size =
  1472   const int locals_size =
  1473        round_to(callee_extra_locals * Interpreter::stackElementWords(), WordsPerLong);
  1473        round_to(callee_extra_locals * Interpreter::stackElementWords, WordsPerLong);
  1474   const int max_stack_words = max_stack * Interpreter::stackElementWords();
  1474   const int max_stack_words = max_stack * Interpreter::stackElementWords;
  1475   return (round_to((max_stack_words
  1475   return (round_to((max_stack_words
  1476                    //6815692//+ methodOopDesc::extra_stack_words()
  1476                    //6815692//+ methodOopDesc::extra_stack_words()
  1477                    + rounded_vm_local_words
  1477                    + rounded_vm_local_words
  1478                    + frame::memory_parameter_word_sp_offset), WordsPerLong)
  1478                    + frame::memory_parameter_word_sp_offset), WordsPerLong)
  1479                    // already rounded
  1479                    // already rounded
  1568     // preallocate monitors (cf. __ add_monitor_to_stack)
  1568     // preallocate monitors (cf. __ add_monitor_to_stack)
  1569     intptr_t* monitors = montop - monitor_size;
  1569     intptr_t* monitors = montop - monitor_size;
  1570 
  1570 
  1571     // preallocate stack space
  1571     // preallocate stack space
  1572     intptr_t*  esp = monitors - 1 -
  1572     intptr_t*  esp = monitors - 1 -
  1573                      (tempcount * Interpreter::stackElementWords()) -
  1573                      (tempcount * Interpreter::stackElementWords) -
  1574                      popframe_extra_args;
  1574                      popframe_extra_args;
  1575 
  1575 
  1576     int local_words = method->max_locals() * Interpreter::stackElementWords();
  1576     int local_words = method->max_locals() * Interpreter::stackElementWords;
  1577     int parm_words  = method->size_of_parameters() * Interpreter::stackElementWords();
  1577     int parm_words  = method->size_of_parameters() * Interpreter::stackElementWords;
  1578     NEEDS_CLEANUP;
  1578     NEEDS_CLEANUP;
  1579     intptr_t* locals;
  1579     intptr_t* locals;
  1580     if (caller->is_interpreted_frame()) {
  1580     if (caller->is_interpreted_frame()) {
  1581       // Can force the locals area to end up properly overlapping the top of the expression stack.
  1581       // Can force the locals area to end up properly overlapping the top of the expression stack.
  1582       intptr_t* Lesp_ptr = caller->interpreter_frame_tos_address() - 1;
  1582       intptr_t* Lesp_ptr = caller->interpreter_frame_tos_address() - 1;
  1660 
  1660 
  1661 #ifdef ASSERT
  1661 #ifdef ASSERT
  1662     BasicObjectLock* mp = (BasicObjectLock*)monitors;
  1662     BasicObjectLock* mp = (BasicObjectLock*)monitors;
  1663 
  1663 
  1664     assert(interpreter_frame->interpreter_frame_method() == method, "method matches");
  1664     assert(interpreter_frame->interpreter_frame_method() == method, "method matches");
  1665     assert(interpreter_frame->interpreter_frame_local_at(9) == (intptr_t *)((intptr_t)locals - (9 * Interpreter::stackElementSize())+Interpreter::value_offset_in_bytes()), "locals match");
  1665     assert(interpreter_frame->interpreter_frame_local_at(9) == (intptr_t *)((intptr_t)locals - (9 * Interpreter::stackElementSize)), "locals match");
  1666     assert(interpreter_frame->interpreter_frame_monitor_end()   == mp, "monitor_end matches");
  1666     assert(interpreter_frame->interpreter_frame_monitor_end()   == mp, "monitor_end matches");
  1667     assert(((intptr_t *)interpreter_frame->interpreter_frame_monitor_begin()) == ((intptr_t *)mp)+monitor_size, "monitor_begin matches");
  1667     assert(((intptr_t *)interpreter_frame->interpreter_frame_monitor_begin()) == ((intptr_t *)mp)+monitor_size, "monitor_begin matches");
  1668     assert(interpreter_frame->interpreter_frame_tos_address()-1 == esp, "esp matches");
  1668     assert(interpreter_frame->interpreter_frame_tos_address()-1 == esp, "esp matches");
  1669 
  1669 
  1670     // check bounds
  1670     // check bounds
  1756     const Register Gtmp1 = G3_scratch;
  1756     const Register Gtmp1 = G3_scratch;
  1757     const Register Gtmp2 = G1_scratch;
  1757     const Register Gtmp2 = G1_scratch;
  1758 
  1758 
  1759     // Compute size of arguments for saving when returning to deoptimized caller
  1759     // Compute size of arguments for saving when returning to deoptimized caller
  1760     __ lduh(Lmethod, in_bytes(methodOopDesc::size_of_parameters_offset()), Gtmp1);
  1760     __ lduh(Lmethod, in_bytes(methodOopDesc::size_of_parameters_offset()), Gtmp1);
  1761     __ sll(Gtmp1, Interpreter::logStackElementSize(), Gtmp1);
  1761     __ sll(Gtmp1, Interpreter::logStackElementSize, Gtmp1);
  1762     __ sub(Llocals, Gtmp1, Gtmp2);
  1762     __ sub(Llocals, Gtmp1, Gtmp2);
  1763     __ add(Gtmp2, wordSize, Gtmp2);
  1763     __ add(Gtmp2, wordSize, Gtmp2);
  1764     // Save these arguments
  1764     // Save these arguments
  1765     __ call_VM_leaf(L7_thread_cache, CAST_FROM_FN_PTR(address, Deoptimization::popframe_preserve_args), G2_thread, Gtmp1, Gtmp2);
  1765     __ call_VM_leaf(L7_thread_cache, CAST_FROM_FN_PTR(address, Deoptimization::popframe_preserve_args), G2_thread, Gtmp1, Gtmp2);
  1766     // Inform deoptimization that it is responsible for restoring these arguments
  1766     // Inform deoptimization that it is responsible for restoring these arguments