src/cpu/sparc/vm/cppInterpreter_sparc.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 8004537 Sdiff src/cpu/sparc/vm

src/cpu/sparc/vm/cppInterpreter_sparc.cpp

Print this page




 120     case T_BOOLEAN: __ subcc(G0, O0, G0); __ addc(G0, 0, Itos_i); break; // !0 => true; 0 => false
 121     case T_CHAR   : __ sll(O0, 16, O0); __ srl(O0, 16, Itos_i);   break; // cannot use and3, 0xFFFF too big as immediate value!
 122     case T_BYTE   : __ sll(O0, 24, O0); __ sra(O0, 24, Itos_i);   break;
 123     case T_SHORT  : __ sll(O0, 16, O0); __ sra(O0, 16, Itos_i);   break;
 124     case T_LONG   :
 125 #ifndef _LP64
 126                     __ mov(O1, Itos_l2);  // move other half of long
 127 #endif              // ifdef or no ifdef, fall through to the T_INT case
 128     case T_INT    : __ mov(O0, Itos_i);                         break;
 129     case T_VOID   : /* nothing to do */                         break;
 130     case T_FLOAT  : assert(F0 == Ftos_f, "fix this code" );     break;
 131     case T_DOUBLE : assert(F0 == Ftos_d, "fix this code" );     break;
 132     case T_OBJECT :
 133       __ ld_ptr(STATE(_oop_temp), Itos_i);
 134       __ verify_oop(Itos_i);
 135       break;
 136     default       : ShouldNotReachHere();
 137   }
 138   __ ret();                           // return from interpreter activation
 139   __ delayed()->restore(I5_savedSP, G0, SP);  // remove interpreter frame
 140   NOT_PRODUCT(__ emit_long(0);)       // marker for disassembly
 141   return entry;
 142 }
 143 
 144 // tosca based result to c++ interpreter stack based result.
 145 // Result goes to address in L1_scratch
 146 
 147 address CppInterpreterGenerator::generate_tosca_to_stack_converter(BasicType type) {
 148   // A result is in the native abi result register from a native method call.
 149   // We need to return this result to the interpreter by pushing the result on the interpreter's
 150   // stack. This is relatively simple the destination is in L1_scratch
 151   // i.e. L1_scratch is the first free element on the stack. If we "push" a return value we must
 152   // adjust L1_scratch
 153   address entry = __ pc();
 154   switch (type) {
 155     case T_BOOLEAN:
 156       // !0 => true; 0 => false
 157       __ subcc(G0, O0, G0);
 158       __ addc(G0, 0, O0);
 159       __ st(O0, L1_scratch, 0);
 160       __ sub(L1_scratch, wordSize, L1_scratch);


 215     case T_FLOAT  :
 216       __ stf(FloatRegisterImpl::S, F0, L1_scratch, 0);
 217       __ sub(L1_scratch, wordSize, L1_scratch);
 218       break;
 219 
 220     case T_DOUBLE :
 221       // Every stack slot is aligned on 64 bit, However is this
 222       // the correct stack slot on 64bit?? QQQ
 223       __ stf(FloatRegisterImpl::D, F0, L1_scratch, -wordSize);
 224       __ sub(L1_scratch, 2*wordSize, L1_scratch);
 225       break;
 226     case T_OBJECT :
 227       __ verify_oop(O0);
 228       __ st_ptr(O0, L1_scratch, 0);
 229       __ sub(L1_scratch, wordSize, L1_scratch);
 230       break;
 231     default       : ShouldNotReachHere();
 232   }
 233   __ retl();                          // return from interpreter activation
 234   __ delayed()->nop();                // schedule this better
 235   NOT_PRODUCT(__ emit_long(0);)       // marker for disassembly
 236   return entry;
 237 }
 238 
 239 address CppInterpreterGenerator::generate_stack_to_stack_converter(BasicType type) {
 240   // A result is in the java expression stack of the interpreted method that has just
 241   // returned. Place this result on the java expression stack of the caller.
 242   //
 243   // The current interpreter activation in Lstate is for the method just returning its
 244   // result. So we know that the result of this method is on the top of the current
 245   // execution stack (which is pre-pushed) and will be return to the top of the caller
 246   // stack. The top of the callers stack is the bottom of the locals of the current
 247   // activation.
 248   // Because of the way activation are managed by the frame manager the value of esp is
 249   // below both the stack top of the current activation and naturally the stack top
 250   // of the calling activation. This enable this routine to leave the return address
 251   // to the frame manager on the stack and do a vanilla return.
 252   //
 253   // On entry: O0 - points to source (callee stack top)
 254   //           O1 - points to destination (caller stack top [i.e. free location])
 255   // destroys O2, O3


1448 // [ parameter 1        ]
1449 // [ expression stack   ]
1450 //
1451 //
1452 // We are free to blow any registers we like because the call_stub which brought us here
1453 // initially has preserved the callee save registers already.
1454 //
1455 //
1456 
1457 static address interpreter_frame_manager = NULL;
1458 
1459 #ifdef ASSERT
1460   #define VALIDATE_STATE(scratch, marker)                         \
1461   {                                                               \
1462     Label skip;                                                   \
1463     __ ld_ptr(STATE(_self_link), scratch);                        \
1464     __ cmp(Lstate, scratch);                                      \
1465     __ brx(Assembler::equal, false, Assembler::pt, skip);         \
1466     __ delayed()->nop();                                          \
1467     __ breakpoint_trap();                                         \
1468     __ emit_long(marker);                                         \
1469     __ bind(skip);                                                \
1470   }
1471 #else
1472   #define VALIDATE_STATE(scratch, marker)
1473 #endif /* ASSERT */
1474 
1475 void CppInterpreterGenerator::adjust_callers_stack(Register args) {
1476 //
1477 // Adjust caller's stack so that all the locals can be contiguous with
1478 // the parameters.
1479 // Worries about stack overflow make this a pain.
1480 //
1481 // Destroys args, G3_scratch, G3_scratch
1482 // In/Out O5_savedSP (sender's original SP)
1483 //
1484 //  assert_different_registers(state, prev_state);
1485   const Register Gtmp = G3_scratch;
1486   const Register tmp = O2;
1487   const Address size_of_parameters(G5_method, 0, in_bytes(Method::size_of_parameters_offset()));
1488   const Address size_of_locals    (G5_method, 0, in_bytes(Method::size_of_locals_offset()));




 120     case T_BOOLEAN: __ subcc(G0, O0, G0); __ addc(G0, 0, Itos_i); break; // !0 => true; 0 => false
 121     case T_CHAR   : __ sll(O0, 16, O0); __ srl(O0, 16, Itos_i);   break; // cannot use and3, 0xFFFF too big as immediate value!
 122     case T_BYTE   : __ sll(O0, 24, O0); __ sra(O0, 24, Itos_i);   break;
 123     case T_SHORT  : __ sll(O0, 16, O0); __ sra(O0, 16, Itos_i);   break;
 124     case T_LONG   :
 125 #ifndef _LP64
 126                     __ mov(O1, Itos_l2);  // move other half of long
 127 #endif              // ifdef or no ifdef, fall through to the T_INT case
 128     case T_INT    : __ mov(O0, Itos_i);                         break;
 129     case T_VOID   : /* nothing to do */                         break;
 130     case T_FLOAT  : assert(F0 == Ftos_f, "fix this code" );     break;
 131     case T_DOUBLE : assert(F0 == Ftos_d, "fix this code" );     break;
 132     case T_OBJECT :
 133       __ ld_ptr(STATE(_oop_temp), Itos_i);
 134       __ verify_oop(Itos_i);
 135       break;
 136     default       : ShouldNotReachHere();
 137   }
 138   __ ret();                           // return from interpreter activation
 139   __ delayed()->restore(I5_savedSP, G0, SP);  // remove interpreter frame
 140   NOT_PRODUCT(__ emit_int32(0);)       // marker for disassembly
 141   return entry;
 142 }
 143 
 144 // tosca based result to c++ interpreter stack based result.
 145 // Result goes to address in L1_scratch
 146 
 147 address CppInterpreterGenerator::generate_tosca_to_stack_converter(BasicType type) {
 148   // A result is in the native abi result register from a native method call.
 149   // We need to return this result to the interpreter by pushing the result on the interpreter's
 150   // stack. This is relatively simple the destination is in L1_scratch
 151   // i.e. L1_scratch is the first free element on the stack. If we "push" a return value we must
 152   // adjust L1_scratch
 153   address entry = __ pc();
 154   switch (type) {
 155     case T_BOOLEAN:
 156       // !0 => true; 0 => false
 157       __ subcc(G0, O0, G0);
 158       __ addc(G0, 0, O0);
 159       __ st(O0, L1_scratch, 0);
 160       __ sub(L1_scratch, wordSize, L1_scratch);


 215     case T_FLOAT  :
 216       __ stf(FloatRegisterImpl::S, F0, L1_scratch, 0);
 217       __ sub(L1_scratch, wordSize, L1_scratch);
 218       break;
 219 
 220     case T_DOUBLE :
 221       // Every stack slot is aligned on 64 bit, However is this
 222       // the correct stack slot on 64bit?? QQQ
 223       __ stf(FloatRegisterImpl::D, F0, L1_scratch, -wordSize);
 224       __ sub(L1_scratch, 2*wordSize, L1_scratch);
 225       break;
 226     case T_OBJECT :
 227       __ verify_oop(O0);
 228       __ st_ptr(O0, L1_scratch, 0);
 229       __ sub(L1_scratch, wordSize, L1_scratch);
 230       break;
 231     default       : ShouldNotReachHere();
 232   }
 233   __ retl();                          // return from interpreter activation
 234   __ delayed()->nop();                // schedule this better
 235   NOT_PRODUCT(__ emit_int32(0);)       // marker for disassembly
 236   return entry;
 237 }
 238 
 239 address CppInterpreterGenerator::generate_stack_to_stack_converter(BasicType type) {
 240   // A result is in the java expression stack of the interpreted method that has just
 241   // returned. Place this result on the java expression stack of the caller.
 242   //
 243   // The current interpreter activation in Lstate is for the method just returning its
 244   // result. So we know that the result of this method is on the top of the current
 245   // execution stack (which is pre-pushed) and will be return to the top of the caller
 246   // stack. The top of the callers stack is the bottom of the locals of the current
 247   // activation.
 248   // Because of the way activation are managed by the frame manager the value of esp is
 249   // below both the stack top of the current activation and naturally the stack top
 250   // of the calling activation. This enable this routine to leave the return address
 251   // to the frame manager on the stack and do a vanilla return.
 252   //
 253   // On entry: O0 - points to source (callee stack top)
 254   //           O1 - points to destination (caller stack top [i.e. free location])
 255   // destroys O2, O3


1448 // [ parameter 1        ]
1449 // [ expression stack   ]
1450 //
1451 //
1452 // We are free to blow any registers we like because the call_stub which brought us here
1453 // initially has preserved the callee save registers already.
1454 //
1455 //
1456 
1457 static address interpreter_frame_manager = NULL;
1458 
1459 #ifdef ASSERT
1460   #define VALIDATE_STATE(scratch, marker)                         \
1461   {                                                               \
1462     Label skip;                                                   \
1463     __ ld_ptr(STATE(_self_link), scratch);                        \
1464     __ cmp(Lstate, scratch);                                      \
1465     __ brx(Assembler::equal, false, Assembler::pt, skip);         \
1466     __ delayed()->nop();                                          \
1467     __ breakpoint_trap();                                         \
1468     __ emit_int32(marker);                                         \
1469     __ bind(skip);                                                \
1470   }
1471 #else
1472   #define VALIDATE_STATE(scratch, marker)
1473 #endif /* ASSERT */
1474 
1475 void CppInterpreterGenerator::adjust_callers_stack(Register args) {
1476 //
1477 // Adjust caller's stack so that all the locals can be contiguous with
1478 // the parameters.
1479 // Worries about stack overflow make this a pain.
1480 //
1481 // Destroys args, G3_scratch, G3_scratch
1482 // In/Out O5_savedSP (sender's original SP)
1483 //
1484 //  assert_different_registers(state, prev_state);
1485   const Register Gtmp = G3_scratch;
1486   const Register tmp = O2;
1487   const Address size_of_parameters(G5_method, 0, in_bytes(Method::size_of_parameters_offset()));
1488   const Address size_of_locals    (G5_method, 0, in_bytes(Method::size_of_locals_offset()));


src/cpu/sparc/vm/cppInterpreter_sparc.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File