Print this page


Split Close
Expand all
Collapse all
          --- old/src/cpu/sparc/vm/cppInterpreter_sparc.cpp
          +++ new/src/cpu/sparc/vm/cppInterpreter_sparc.cpp
↓ open down ↓ 151 lines elided ↑ open up ↑
 152  152        break;
 153  153  
 154  154      case T_SHORT  :
 155  155        __ sll(O0, 16, O0);
 156  156        __ sra(O0, 16, O0);
 157  157        __ st(O0, L1_scratch, 0);
 158  158        __ sub(L1_scratch, wordSize, L1_scratch);
 159  159        break;
 160  160      case T_LONG   :
 161  161  #ifndef _LP64
 162      -#if !defined(_LP64) && defined(COMPILER2)
      162 +#if defined(COMPILER2) 
 163  163    // All return values are where we want them, except for Longs.  C2 returns
 164  164    // longs in G1 in the 32-bit build whereas the interpreter wants them in O0/O1.
 165  165    // Since the interpreter will return longs in G1 and O0/O1 in the 32bit
 166  166    // build even if we are returning from interpreted we just do a little
 167  167    // stupid shuffing.
 168  168    // Note: I tried to make c2 return longs in O0/O1 and G1 so we wouldn't have to
 169  169    // do this here. Unfortunately if we did a rethrow we'd see an machepilog node
 170  170    // first which would move g1 -> O0/O1 and destroy the exception we were throwing.
 171  171        __ stx(G1, L1_scratch, -wordSize);
 172  172  #else
 173  173        // native result is in O0, O1
 174  174        __ st(O1, L1_scratch, 0);                      // Low order
 175  175        __ st(O0, L1_scratch, -wordSize);              // High order
 176      -#endif /* !_LP64 && COMPILER2 */
      176 +#endif /* COMPILER2 */
 177  177  #else
 178      -      __ stx(O0, L1_scratch, 0);
 179      -__ breakpoint_trap();
      178 +      __ stx(O0, L1_scratch, -wordSize);
 180  179  #endif
 181  180        __ sub(L1_scratch, 2*wordSize, L1_scratch);
 182  181        break;
 183  182  
 184  183      case T_INT    :
 185  184        __ st(O0, L1_scratch, 0);
 186  185        __ sub(L1_scratch, wordSize, L1_scratch);
 187  186        break;
 188  187  
 189  188      case T_VOID   : /* nothing to do */
↓ open down ↓ 40 lines elided ↑ open up ↑
 230  229    // On entry: O0 - points to source (callee stack top)
 231  230    //           O1 - points to destination (caller stack top [i.e. free location])
 232  231    // destroys O2, O3
 233  232    //
 234  233  
 235  234    address entry = __ pc();
 236  235    switch (type) {
 237  236      case T_VOID:  break;
 238  237        break;
 239  238      case T_FLOAT  :
 240      -      __ breakpoint_trap(Assembler::zero);
 241  239      case T_BOOLEAN:
 242  240      case T_CHAR   :
 243  241      case T_BYTE   :
 244  242      case T_SHORT  :
 245  243      case T_INT    :
 246  244        // 1 word result
 247  245        __ ld(O0, 0, O2);
 248  246        __ st(O2, O1, 0);
 249  247        __ sub(O1, wordSize, O1);
 250  248        break;
 251  249      case T_DOUBLE  :
 252  250      case T_LONG    :
 253  251        // return top two words on current expression stack to caller's expression stack
 254  252        // The caller's expression stack is adjacent to the current frame manager's intepretState
 255  253        // except we allocated one extra word for this intepretState so we won't overwrite it
 256  254        // when we return a two word result.
 257  255  #ifdef _LP64
 258      -__ breakpoint_trap();
 259      -      // Hmm now that longs are in one entry should "_ptr" really be "x"?
 260  256        __ ld_ptr(O0, 0, O2);
 261      -      __ ld_ptr(O0, wordSize, O3);
 262      -      __ st_ptr(O3, O1, 0);
 263  257        __ st_ptr(O2, O1, -wordSize);
 264  258  #else
 265  259        __ ld(O0, 0, O2);
 266  260        __ ld(O0, wordSize, O3);
 267  261        __ st(O3, O1, 0);
 268  262        __ st(O2, O1, -wordSize);
 269  263  #endif
 270  264        __ sub(O1, 2*wordSize, O1);
 271  265        break;
 272  266      case T_OBJECT :
↓ open down ↓ 39 lines elided ↑ open up ↑
 312  306        break;
 313  307      case T_DOUBLE  :
 314  308        __ ldf(FloatRegisterImpl::D, O0, 0, F0);
 315  309        break;
 316  310      case T_LONG    :
 317  311        // return top two words on current expression stack to caller's expression stack
 318  312        // The caller's expression stack is adjacent to the current frame manager's interpretState
 319  313        // except we allocated one extra word for this intepretState so we won't overwrite it
 320  314        // when we return a two word result.
 321  315  #ifdef _LP64
 322      -__ breakpoint_trap();
 323      -      // Hmm now that longs are in one entry should "_ptr" really be "x"?
 324  316        __ ld_ptr(O0, 0, O0->after_save());
 325      -      __ ld_ptr(O0, wordSize, O1->after_save());
 326  317  #else
 327  318        __ ld(O0, wordSize, O1->after_save());
 328  319        __ ld(O0, 0, O0->after_save());
 329  320  #endif
 330  321  #if defined(COMPILER2) && !defined(_LP64)
 331  322        // C2 expects long results in G1 we can't tell if we're returning to interpreted
 332  323        // or compiled so just be safe use G1 and O0/O1
 333  324  
 334  325        // Shift bits into high (msb) of G1
 335  326        __ sllx(Otos_l1->after_save(), 32, G1);
↓ open down ↓ 1030 lines elided ↑ open up ↑
1366 1357  
1367 1358    __ bind(loop);
1368 1359    __ st_ptr(L3_scratch, Address(L1_scratch, 0));
1369 1360    __ add(L1_scratch, wordSize, L1_scratch);
1370 1361    __ bind(entry);
1371 1362    __ cmp(L1_scratch, L4_scratch);
1372 1363    __ br(Assembler::notEqual, false, Assembler::pt, loop);
1373 1364    __ delayed()->ld_ptr(L1_scratch, entry_size, L3_scratch);
1374 1365  
1375 1366    // now zero the slot so we can find it.
1376      -  __ st(G0, L4_scratch, BasicObjectLock::obj_offset_in_bytes());
     1367 +  __ st_ptr(G0, L4_scratch, BasicObjectLock::obj_offset_in_bytes());
1377 1368  
1378 1369  }
1379 1370  
1380 1371  // Initial entry to C++ interpreter from the call_stub.
1381 1372  // This entry point is called the frame manager since it handles the generation
1382 1373  // of interpreter activation frames via requests directly from the vm (via call_stub)
1383 1374  // and via requests from the interpreter. The requests from the call_stub happen
1384 1375  // directly thru the entry point. Requests from the interpreter happen via returning
1385 1376  // from the interpreter and examining the message the interpreter has returned to
1386 1377  // the frame manager. The frame manager can take the following requests:
↓ open down ↓ 319 lines elided ↑ open up ↑
1706 1697    __ brx(Assembler::notZero, false, Assembler::pt, return_with_exception);
1707 1698    __ delayed()->nop();
1708 1699  
1709 1700    // Process the native abi result to java expression stack
1710 1701  
1711 1702    __ ld_ptr(STATE(_result._to_call._callee), L4_scratch);                        // called method
1712 1703    __ ld_ptr(STATE(_stack), L1_scratch);                                          // get top of java expr stack
1713 1704    __ lduh(L4_scratch, in_bytes(methodOopDesc::size_of_parameters_offset()), L2_scratch); // get parameter size
1714 1705    __ sll(L2_scratch, LogBytesPerWord, L2_scratch     );                           // parameter size in bytes
1715 1706    __ add(L1_scratch, L2_scratch, L1_scratch);                                      // stack destination for result
1716      -  __ ld_ptr(L4_scratch, in_bytes(methodOopDesc::result_index_offset()), L3_scratch); // called method result type index
     1707 +  __ ld(L4_scratch, in_bytes(methodOopDesc::result_index_offset()), L3_scratch); // called method result type index
1717 1708  
1718 1709    // tosca is really just native abi
1719 1710    __ set((intptr_t)CppInterpreter::_tosca_to_stack, L4_scratch);
1720 1711    __ sll(L3_scratch, LogBytesPerWord, L3_scratch);
1721 1712    __ ld_ptr(L4_scratch, L3_scratch, Lscratch);                                       // get typed result converter address
1722 1713    __ jmpl(Lscratch, G0, O7);                                                   // and convert it
1723 1714    __ delayed()->nop();
1724 1715  
1725 1716    // L1_scratch points to top of stack (prepushed)
1726 1717  
↓ open down ↓ 23 lines elided ↑ open up ↑
1750 1741    // Interpreted result is on the top of the completed activation expression stack.
1751 1742    // We must return it to the top of the callers stack if caller was interpreted
1752 1743    // otherwise we convert to native abi result and return to call_stub/c1/c2
1753 1744    // The caller's expression stack was truncated by the call however the current activation
1754 1745    // has enough stuff on the stack that we have usable space there no matter what. The
1755 1746    // other thing that makes it easy is that the top of the caller's stack is stored in STATE(_locals)
1756 1747    // for the current activation
1757 1748  
1758 1749    __ ld_ptr(STATE(_prev_link), L1_scratch);
1759 1750    __ ld_ptr(STATE(_method), L2_scratch);                               // get method just executed
1760      -  __ ld_ptr(L2_scratch, in_bytes(methodOopDesc::result_index_offset()), L2_scratch);
     1751 +  __ ld(L2_scratch, in_bytes(methodOopDesc::result_index_offset()), L2_scratch);
1761 1752    __ tst(L1_scratch);
1762 1753    __ brx(Assembler::zero, false, Assembler::pt, return_to_initial_caller);
1763 1754    __ delayed()->sll(L2_scratch, LogBytesPerWord, L2_scratch);
1764 1755  
1765 1756    // Copy result to callers java stack
1766 1757  
1767 1758    __ set((intptr_t)CppInterpreter::_stack_to_stack, L4_scratch);
1768 1759    __ ld_ptr(L4_scratch, L2_scratch, Lscratch);                          // get typed result converter address
1769 1760    __ ld_ptr(STATE(_stack), O0);                                       // current top (prepushed)
1770 1761    __ ld_ptr(STATE(_locals), O1);                                      // stack destination
↓ open down ↓ 145 lines elided ↑ open up ↑
1916 1907    // we trim back sp by the amount of unused java expression stack
1917 1908    // there will be automagically the 2 extra words we need.
1918 1909    // We also have to worry about keeping SP aligned.
1919 1910  
1920 1911    __ ld_ptr(STATE(_stack), Gargs);
1921 1912    __ ld_ptr(STATE(_stack_limit), L1_scratch);
1922 1913  
1923 1914    // compute the unused java stack size
1924 1915    __ sub(Gargs, L1_scratch, L2_scratch);                       // compute unused space
1925 1916  
1926      -  // Round down the unused space to that stack is always aligned
1927      -  // by making the unused space a multiple of the size of a long.
     1917 +  // Round down the unused space to that stack is always 16-byte aligned
     1918 +  // by making the unused space a multiple of the size of two longs. (vs)
1928 1919  
1929      -  __ and3(L2_scratch, -BytesPerLong, L2_scratch);
     1920 +  __ and3(L2_scratch, -2*BytesPerLong, L2_scratch);
1930 1921  
1931 1922    // Now trim the stack
1932 1923    __ add(SP, L2_scratch, SP);
1933 1924  
1934 1925  
1935 1926    // Now point to the final argument (account for prepush)
1936 1927    __ add(Gargs, wordSize, Gargs);
1937 1928  #ifdef ASSERT
1938 1929    // Make sure we have space for the window
1939 1930    __ sub(Gargs, SP, L1_scratch);
↓ open down ↓ 229 lines elided ↑ open up ↑
2169 2160  
2170 2161    /*
2171 2162      if we actually have a frame to layout we must now fill in all the pieces. This means both
2172 2163      the interpreterState and the registers.
2173 2164    */
2174 2165    if (interpreter_frame != NULL) {
2175 2166  
2176 2167      // MUCHO HACK
2177 2168  
2178 2169      intptr_t* frame_bottom = interpreter_frame->sp() - (full_frame_words - frame_words);
     2170 +    // 'interpreter_frame->sp()' is unbiased while 'frame_bottom' must be a biased value in 64bit mode. (vs)
     2171 +    assert(((intptr_t)frame_bottom & 0xf) == 0, "SP biased in layout_activation");
     2172 +    frame_bottom = (intptr_t*)((intptr_t)frame_bottom - STACK_BIAS);
2179 2173  
2180 2174      /* Now fillin the interpreterState object */
2181 2175  
2182 2176      interpreterState cur_state = (interpreterState) ((intptr_t)interpreter_frame->fp() -  sizeof(BytecodeInterpreter));
2183 2177  
2184 2178  
2185 2179      intptr_t* locals;
2186 2180  
2187 2181      // Calculate the postion of locals[0]. This is painful because of
2188 2182      // stack alignment (same as ia64). The problem is that we can
↓ open down ↓ 55 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX