6688137: c++ interpreter fails on 64bit sparc
authorsgoldman
Thu, 17 Apr 2008 07:16:03 -0700
changeset 370 33ba64c16c1f
parent 366 449c27706bac
child 371 1aacedc9db7c
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
hotspot/src/cpu/sparc/vm/bytecodeInterpreter_sparc.hpp
hotspot/src/cpu/sparc/vm/cppInterpreter_sparc.cpp
hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp
--- a/hotspot/src/cpu/sparc/vm/bytecodeInterpreter_sparc.hpp	Wed Apr 16 19:19:48 2008 -0700
+++ b/hotspot/src/cpu/sparc/vm/bytecodeInterpreter_sparc.hpp	Thu Apr 17 07:16:03 2008 -0700
@@ -78,7 +78,7 @@
 
 #define LOCALS_SLOT(offset)    ((intptr_t*)&locals[-(offset)])
 #define LOCALS_ADDR(offset)    ((address)locals[-(offset)])
-#define LOCALS_INT(offset)     ((jint)(locals[-(offset)]))
+#define LOCALS_INT(offset)     (*((jint*)&locals[-(offset)]))
 #define LOCALS_FLOAT(offset)   (*((jfloat*)&locals[-(offset)]))
 #define LOCALS_OBJECT(offset)  ((oop)locals[-(offset)])
 #define LOCALS_DOUBLE(offset)  (((VMJavaVal64*)&locals[-((offset) + 1)])->d)
--- a/hotspot/src/cpu/sparc/vm/cppInterpreter_sparc.cpp	Wed Apr 16 19:19:48 2008 -0700
+++ b/hotspot/src/cpu/sparc/vm/cppInterpreter_sparc.cpp	Thu Apr 17 07:16:03 2008 -0700
@@ -159,7 +159,7 @@
       break;
     case T_LONG   :
 #ifndef _LP64
-#if !defined(_LP64) && defined(COMPILER2)
+#if defined(COMPILER2)
   // All return values are where we want them, except for Longs.  C2 returns
   // longs in G1 in the 32-bit build whereas the interpreter wants them in O0/O1.
   // Since the interpreter will return longs in G1 and O0/O1 in the 32bit
@@ -173,10 +173,9 @@
       // native result is in O0, O1
       __ st(O1, L1_scratch, 0);                      // Low order
       __ st(O0, L1_scratch, -wordSize);              // High order
-#endif /* !_LP64 && COMPILER2 */
+#endif /* COMPILER2 */
 #else
-      __ stx(O0, L1_scratch, 0);
-__ breakpoint_trap();
+      __ stx(O0, L1_scratch, -wordSize);
 #endif
       __ sub(L1_scratch, 2*wordSize, L1_scratch);
       break;
@@ -237,7 +236,6 @@
     case T_VOID:  break;
       break;
     case T_FLOAT  :
-      __ breakpoint_trap(Assembler::zero);
     case T_BOOLEAN:
     case T_CHAR   :
     case T_BYTE   :
@@ -255,11 +253,7 @@
       // except we allocated one extra word for this intepretState so we won't overwrite it
       // when we return a two word result.
 #ifdef _LP64
-__ breakpoint_trap();
-      // Hmm now that longs are in one entry should "_ptr" really be "x"?
       __ ld_ptr(O0, 0, O2);
-      __ ld_ptr(O0, wordSize, O3);
-      __ st_ptr(O3, O1, 0);
       __ st_ptr(O2, O1, -wordSize);
 #else
       __ ld(O0, 0, O2);
@@ -319,10 +313,7 @@
       // except we allocated one extra word for this intepretState so we won't overwrite it
       // when we return a two word result.
 #ifdef _LP64
-__ breakpoint_trap();
-      // Hmm now that longs are in one entry should "_ptr" really be "x"?
       __ ld_ptr(O0, 0, O0->after_save());
-      __ ld_ptr(O0, wordSize, O1->after_save());
 #else
       __ ld(O0, wordSize, O1->after_save());
       __ ld(O0, 0, O0->after_save());
@@ -1373,7 +1364,7 @@
   __ delayed()->ld_ptr(L1_scratch, entry_size, L3_scratch);
 
   // now zero the slot so we can find it.
-  __ st(G0, L4_scratch, BasicObjectLock::obj_offset_in_bytes());
+  __ st_ptr(G0, L4_scratch, BasicObjectLock::obj_offset_in_bytes());
 
 }
 
@@ -1713,7 +1704,7 @@
   __ lduh(L4_scratch, in_bytes(methodOopDesc::size_of_parameters_offset()), L2_scratch); // get parameter size
   __ sll(L2_scratch, LogBytesPerWord, L2_scratch     );                           // parameter size in bytes
   __ add(L1_scratch, L2_scratch, L1_scratch);                                      // stack destination for result
-  __ ld_ptr(L4_scratch, in_bytes(methodOopDesc::result_index_offset()), L3_scratch); // called method result type index
+  __ ld(L4_scratch, in_bytes(methodOopDesc::result_index_offset()), L3_scratch); // called method result type index
 
   // tosca is really just native abi
   __ set((intptr_t)CppInterpreter::_tosca_to_stack, L4_scratch);
@@ -1757,7 +1748,7 @@
 
   __ ld_ptr(STATE(_prev_link), L1_scratch);
   __ ld_ptr(STATE(_method), L2_scratch);                               // get method just executed
-  __ ld_ptr(L2_scratch, in_bytes(methodOopDesc::result_index_offset()), L2_scratch);
+  __ ld(L2_scratch, in_bytes(methodOopDesc::result_index_offset()), L2_scratch);
   __ tst(L1_scratch);
   __ brx(Assembler::zero, false, Assembler::pt, return_to_initial_caller);
   __ delayed()->sll(L2_scratch, LogBytesPerWord, L2_scratch);
@@ -1923,10 +1914,10 @@
   // compute the unused java stack size
   __ sub(Gargs, L1_scratch, L2_scratch);                       // compute unused space
 
-  // Round down the unused space to that stack is always aligned
-  // by making the unused space a multiple of the size of a long.
+  // Round down the unused space to that stack is always 16-byte aligned
+  // by making the unused space a multiple of the size of two longs.
 
-  __ and3(L2_scratch, -BytesPerLong, L2_scratch);
+  __ and3(L2_scratch, -2*BytesPerLong, L2_scratch);
 
   // Now trim the stack
   __ add(SP, L2_scratch, SP);
@@ -2176,6 +2167,9 @@
     // MUCHO HACK
 
     intptr_t* frame_bottom = interpreter_frame->sp() - (full_frame_words - frame_words);
+    // 'interpreter_frame->sp()' is unbiased while 'frame_bottom' must be a biased value in 64bit mode.
+    assert(((intptr_t)frame_bottom & 0xf) == 0, "SP biased in layout_activation");
+    frame_bottom = (intptr_t*)((intptr_t)frame_bottom - STACK_BIAS);
 
     /* Now fillin the interpreterState object */
 
--- a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp	Wed Apr 16 19:19:48 2008 -0700
+++ b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp	Thu Apr 17 07:16:03 2008 -0700
@@ -518,16 +518,16 @@
 
 /* 0xC0 */ &&opc_checkcast,   &&opc_instanceof,     &&opc_monitorenter, &&opc_monitorexit,
 /* 0xC4 */ &&opc_wide,        &&opc_multianewarray, &&opc_ifnull,       &&opc_ifnonnull,
-/* 0xC8 */ &&opc_goto_w,      &&opc_jsr_w,          &&opc_breakpoint,   &&opc_fast_igetfield,
-/* 0xCC */ &&opc_fastagetfield,&&opc_fast_aload_0,  &&opc_fast_iaccess_0, &&opc__fast_aaccess_0,
-
-/* 0xD0 */ &&opc_fast_linearswitch, &&opc_fast_binaryswitch, &&opc_return_register_finalizer,      &&opc_default,
+/* 0xC8 */ &&opc_goto_w,      &&opc_jsr_w,          &&opc_breakpoint,   &&opc_default,
+/* 0xCC */ &&opc_default,     &&opc_default,        &&opc_default,      &&opc_default,
+
+/* 0xD0 */ &&opc_default,     &&opc_default,        &&opc_default,      &&opc_default,
 /* 0xD4 */ &&opc_default,     &&opc_default,        &&opc_default,      &&opc_default,
 /* 0xD8 */ &&opc_default,     &&opc_default,        &&opc_default,      &&opc_default,
 /* 0xDC */ &&opc_default,     &&opc_default,        &&opc_default,      &&opc_default,
 
 /* 0xE0 */ &&opc_default,     &&opc_default,        &&opc_default,      &&opc_default,
-/* 0xE4 */ &&opc_default,     &&opc_default,        &&opc_default,      &&opc_default,
+/* 0xE4 */ &&opc_default,     &&opc_return_register_finalizer,        &&opc_default,      &&opc_default,
 /* 0xE8 */ &&opc_default,     &&opc_default,        &&opc_default,      &&opc_default,
 /* 0xEC */ &&opc_default,     &&opc_default,        &&opc_default,      &&opc_default,