6688137: c++ interpreter fails on 64bit sparc

Thu, 17 Apr 2008 07:16:03 -0700

author
sgoldman
date
Thu, 17 Apr 2008 07:16:03 -0700
changeset 558
9e5a7340635e
parent 554
d1a5218d7eaf
child 559
b130b98db9cf

6688137: c++ interpreter fails on 64bit sparc
Summary: Misc. 64bit and endian fixes for sparc
Reviewed-by: never, kvn, rasbold
Contributed-by: volker.simonis@gmail.com

src/cpu/sparc/vm/bytecodeInterpreter_sparc.hpp file | annotate | diff | comparison | revisions
src/cpu/sparc/vm/cppInterpreter_sparc.cpp file | annotate | diff | comparison | revisions
src/share/vm/interpreter/bytecodeInterpreter.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/cpu/sparc/vm/bytecodeInterpreter_sparc.hpp	Wed Apr 16 19:19:48 2008 -0700
     1.2 +++ b/src/cpu/sparc/vm/bytecodeInterpreter_sparc.hpp	Thu Apr 17 07:16:03 2008 -0700
     1.3 @@ -78,7 +78,7 @@
     1.4  
     1.5  #define LOCALS_SLOT(offset)    ((intptr_t*)&locals[-(offset)])
     1.6  #define LOCALS_ADDR(offset)    ((address)locals[-(offset)])
     1.7 -#define LOCALS_INT(offset)     ((jint)(locals[-(offset)]))
     1.8 +#define LOCALS_INT(offset)     (*((jint*)&locals[-(offset)]))
     1.9  #define LOCALS_FLOAT(offset)   (*((jfloat*)&locals[-(offset)]))
    1.10  #define LOCALS_OBJECT(offset)  ((oop)locals[-(offset)])
    1.11  #define LOCALS_DOUBLE(offset)  (((VMJavaVal64*)&locals[-((offset) + 1)])->d)
     2.1 --- a/src/cpu/sparc/vm/cppInterpreter_sparc.cpp	Wed Apr 16 19:19:48 2008 -0700
     2.2 +++ b/src/cpu/sparc/vm/cppInterpreter_sparc.cpp	Thu Apr 17 07:16:03 2008 -0700
     2.3 @@ -159,7 +159,7 @@
     2.4        break;
     2.5      case T_LONG   :
     2.6  #ifndef _LP64
     2.7 -#if !defined(_LP64) && defined(COMPILER2)
     2.8 +#if defined(COMPILER2)
     2.9    // All return values are where we want them, except for Longs.  C2 returns
    2.10    // longs in G1 in the 32-bit build whereas the interpreter wants them in O0/O1.
    2.11    // Since the interpreter will return longs in G1 and O0/O1 in the 32bit
    2.12 @@ -173,10 +173,9 @@
    2.13        // native result is in O0, O1
    2.14        __ st(O1, L1_scratch, 0);                      // Low order
    2.15        __ st(O0, L1_scratch, -wordSize);              // High order
    2.16 -#endif /* !_LP64 && COMPILER2 */
    2.17 +#endif /* COMPILER2 */
    2.18  #else
    2.19 -      __ stx(O0, L1_scratch, 0);
    2.20 -__ breakpoint_trap();
    2.21 +      __ stx(O0, L1_scratch, -wordSize);
    2.22  #endif
    2.23        __ sub(L1_scratch, 2*wordSize, L1_scratch);
    2.24        break;
    2.25 @@ -237,7 +236,6 @@
    2.26      case T_VOID:  break;
    2.27        break;
    2.28      case T_FLOAT  :
    2.29 -      __ breakpoint_trap(Assembler::zero);
    2.30      case T_BOOLEAN:
    2.31      case T_CHAR   :
    2.32      case T_BYTE   :
    2.33 @@ -255,11 +253,7 @@
    2.34        // except we allocated one extra word for this intepretState so we won't overwrite it
    2.35        // when we return a two word result.
    2.36  #ifdef _LP64
    2.37 -__ breakpoint_trap();
    2.38 -      // Hmm now that longs are in one entry should "_ptr" really be "x"?
    2.39        __ ld_ptr(O0, 0, O2);
    2.40 -      __ ld_ptr(O0, wordSize, O3);
    2.41 -      __ st_ptr(O3, O1, 0);
    2.42        __ st_ptr(O2, O1, -wordSize);
    2.43  #else
    2.44        __ ld(O0, 0, O2);
    2.45 @@ -319,10 +313,7 @@
    2.46        // except we allocated one extra word for this intepretState so we won't overwrite it
    2.47        // when we return a two word result.
    2.48  #ifdef _LP64
    2.49 -__ breakpoint_trap();
    2.50 -      // Hmm now that longs are in one entry should "_ptr" really be "x"?
    2.51        __ ld_ptr(O0, 0, O0->after_save());
    2.52 -      __ ld_ptr(O0, wordSize, O1->after_save());
    2.53  #else
    2.54        __ ld(O0, wordSize, O1->after_save());
    2.55        __ ld(O0, 0, O0->after_save());
    2.56 @@ -1373,7 +1364,7 @@
    2.57    __ delayed()->ld_ptr(L1_scratch, entry_size, L3_scratch);
    2.58  
    2.59    // now zero the slot so we can find it.
    2.60 -  __ st(G0, L4_scratch, BasicObjectLock::obj_offset_in_bytes());
    2.61 +  __ st_ptr(G0, L4_scratch, BasicObjectLock::obj_offset_in_bytes());
    2.62  
    2.63  }
    2.64  
    2.65 @@ -1713,7 +1704,7 @@
    2.66    __ lduh(L4_scratch, in_bytes(methodOopDesc::size_of_parameters_offset()), L2_scratch); // get parameter size
    2.67    __ sll(L2_scratch, LogBytesPerWord, L2_scratch     );                           // parameter size in bytes
    2.68    __ add(L1_scratch, L2_scratch, L1_scratch);                                      // stack destination for result
    2.69 -  __ ld_ptr(L4_scratch, in_bytes(methodOopDesc::result_index_offset()), L3_scratch); // called method result type index
    2.70 +  __ ld(L4_scratch, in_bytes(methodOopDesc::result_index_offset()), L3_scratch); // called method result type index
    2.71  
    2.72    // tosca is really just native abi
    2.73    __ set((intptr_t)CppInterpreter::_tosca_to_stack, L4_scratch);
    2.74 @@ -1757,7 +1748,7 @@
    2.75  
    2.76    __ ld_ptr(STATE(_prev_link), L1_scratch);
    2.77    __ ld_ptr(STATE(_method), L2_scratch);                               // get method just executed
    2.78 -  __ ld_ptr(L2_scratch, in_bytes(methodOopDesc::result_index_offset()), L2_scratch);
    2.79 +  __ ld(L2_scratch, in_bytes(methodOopDesc::result_index_offset()), L2_scratch);
    2.80    __ tst(L1_scratch);
    2.81    __ brx(Assembler::zero, false, Assembler::pt, return_to_initial_caller);
    2.82    __ delayed()->sll(L2_scratch, LogBytesPerWord, L2_scratch);
    2.83 @@ -1923,10 +1914,10 @@
    2.84    // compute the unused java stack size
    2.85    __ sub(Gargs, L1_scratch, L2_scratch);                       // compute unused space
    2.86  
    2.87 -  // Round down the unused space to that stack is always aligned
    2.88 -  // by making the unused space a multiple of the size of a long.
    2.89 +  // Round down the unused space to that stack is always 16-byte aligned
    2.90 +  // by making the unused space a multiple of the size of two longs.
    2.91  
    2.92 -  __ and3(L2_scratch, -BytesPerLong, L2_scratch);
    2.93 +  __ and3(L2_scratch, -2*BytesPerLong, L2_scratch);
    2.94  
    2.95    // Now trim the stack
    2.96    __ add(SP, L2_scratch, SP);
    2.97 @@ -2176,6 +2167,9 @@
    2.98      // MUCHO HACK
    2.99  
   2.100      intptr_t* frame_bottom = interpreter_frame->sp() - (full_frame_words - frame_words);
   2.101 +    // 'interpreter_frame->sp()' is unbiased while 'frame_bottom' must be a biased value in 64bit mode.
   2.102 +    assert(((intptr_t)frame_bottom & 0xf) == 0, "SP biased in layout_activation");
   2.103 +    frame_bottom = (intptr_t*)((intptr_t)frame_bottom - STACK_BIAS);
   2.104  
   2.105      /* Now fillin the interpreterState object */
   2.106  
     3.1 --- a/src/share/vm/interpreter/bytecodeInterpreter.cpp	Wed Apr 16 19:19:48 2008 -0700
     3.2 +++ b/src/share/vm/interpreter/bytecodeInterpreter.cpp	Thu Apr 17 07:16:03 2008 -0700
     3.3 @@ -518,16 +518,16 @@
     3.4  
     3.5  /* 0xC0 */ &&opc_checkcast,   &&opc_instanceof,     &&opc_monitorenter, &&opc_monitorexit,
     3.6  /* 0xC4 */ &&opc_wide,        &&opc_multianewarray, &&opc_ifnull,       &&opc_ifnonnull,
     3.7 -/* 0xC8 */ &&opc_goto_w,      &&opc_jsr_w,          &&opc_breakpoint,   &&opc_fast_igetfield,
     3.8 -/* 0xCC */ &&opc_fastagetfield,&&opc_fast_aload_0,  &&opc_fast_iaccess_0, &&opc__fast_aaccess_0,
     3.9 -
    3.10 -/* 0xD0 */ &&opc_fast_linearswitch, &&opc_fast_binaryswitch, &&opc_return_register_finalizer,      &&opc_default,
    3.11 +/* 0xC8 */ &&opc_goto_w,      &&opc_jsr_w,          &&opc_breakpoint,   &&opc_default,
    3.12 +/* 0xCC */ &&opc_default,     &&opc_default,        &&opc_default,      &&opc_default,
    3.13 +
    3.14 +/* 0xD0 */ &&opc_default,     &&opc_default,        &&opc_default,      &&opc_default,
    3.15  /* 0xD4 */ &&opc_default,     &&opc_default,        &&opc_default,      &&opc_default,
    3.16  /* 0xD8 */ &&opc_default,     &&opc_default,        &&opc_default,      &&opc_default,
    3.17  /* 0xDC */ &&opc_default,     &&opc_default,        &&opc_default,      &&opc_default,
    3.18  
    3.19  /* 0xE0 */ &&opc_default,     &&opc_default,        &&opc_default,      &&opc_default,
    3.20 -/* 0xE4 */ &&opc_default,     &&opc_default,        &&opc_default,      &&opc_default,
    3.21 +/* 0xE4 */ &&opc_default,     &&opc_return_register_finalizer,        &&opc_default,      &&opc_default,
    3.22  /* 0xE8 */ &&opc_default,     &&opc_default,        &&opc_default,      &&opc_default,
    3.23  /* 0xEC */ &&opc_default,     &&opc_default,        &&opc_default,      &&opc_default,
    3.24  

mercurial