提交 9b208dd6 编写于 作者: C coleenp

6791168: Fix invalid code in bytecodeInterpreter that can cause gcc ICE

Summary: Fix compilation errors from latest gcc in CC_INTERP including offending missing void* cast.
Reviewed-by: xlu
上级 0d8cc082
...@@ -6943,29 +6943,32 @@ void MacroAssembler::trigfunc(char trig, int num_fpu_regs_in_use) { ...@@ -6943,29 +6943,32 @@ void MacroAssembler::trigfunc(char trig, int num_fpu_regs_in_use) {
Label slow_case, done; Label slow_case, done;
// x ?<= pi/4 ExternalAddress pi4_adr = (address)&pi_4;
fld_d(ExternalAddress((address)&pi_4)); if (reachable(pi4_adr)) {
fld_s(1); // Stack: X PI/4 X // x ?<= pi/4
fabs(); // Stack: |X| PI/4 X fld_d(pi4_adr);
fcmp(tmp); fld_s(1); // Stack: X PI/4 X
jcc(Assembler::above, slow_case); fabs(); // Stack: |X| PI/4 X
fcmp(tmp);
jcc(Assembler::above, slow_case);
// fastest case: -pi/4 <= x <= pi/4 // fastest case: -pi/4 <= x <= pi/4
switch(trig) { switch(trig) {
case 's': case 's':
fsin(); fsin();
break; break;
case 'c': case 'c':
fcos(); fcos();
break; break;
case 't': case 't':
ftan(); ftan();
break; break;
default: default:
assert(false, "bad intrinsic"); assert(false, "bad intrinsic");
break; break;
}
jmp(done);
} }
jmp(done);
// slow case: runtime call // slow case: runtime call
bind(slow_case); bind(slow_case);
......
...@@ -213,7 +213,7 @@ inline jint BytecodeInterpreter::VMintAnd(jint op1, jint op2) { ...@@ -213,7 +213,7 @@ inline jint BytecodeInterpreter::VMintAnd(jint op1, jint op2) {
inline jint BytecodeInterpreter::VMintDiv(jint op1, jint op2) { inline jint BytecodeInterpreter::VMintDiv(jint op1, jint op2) {
/* it's possible we could catch this special case implicitly */ /* it's possible we could catch this special case implicitly */
if (op1 == 0x80000000 && op2 == -1) return op1; if ((juint)op1 == 0x80000000 && op2 == -1) return op1;
else return op1 / op2; else return op1 / op2;
} }
...@@ -231,7 +231,7 @@ inline jint BytecodeInterpreter::VMintOr(jint op1, jint op2) { ...@@ -231,7 +231,7 @@ inline jint BytecodeInterpreter::VMintOr(jint op1, jint op2) {
inline jint BytecodeInterpreter::VMintRem(jint op1, jint op2) { inline jint BytecodeInterpreter::VMintRem(jint op1, jint op2) {
/* it's possible we could catch this special case implicitly */ /* it's possible we could catch this special case implicitly */
if (op1 == 0x80000000 && op2 == -1) return 0; if ((juint)op1 == 0x80000000 && op2 == -1) return 0;
else return op1 % op2; else return op1 % op2;
} }
......
...@@ -594,7 +594,7 @@ void InterpreterGenerator::generate_counter_overflow(Label* do_continue) { ...@@ -594,7 +594,7 @@ void InterpreterGenerator::generate_counter_overflow(Label* do_continue) {
__ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::frequency_counter_overflow), rax); __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::frequency_counter_overflow), rax);
// for c++ interpreter can rsi really be munged? // for c++ interpreter can rsi really be munged?
__ lea(state, Address(rbp, -sizeof(BytecodeInterpreter))); // restore state __ lea(state, Address(rbp, -(int)sizeof(BytecodeInterpreter))); // restore state
__ movptr(rbx, Address(state, byte_offset_of(BytecodeInterpreter, _method))); // restore method __ movptr(rbx, Address(state, byte_offset_of(BytecodeInterpreter, _method))); // restore method
__ movptr(rdi, Address(state, byte_offset_of(BytecodeInterpreter, _locals))); // get locals pointer __ movptr(rdi, Address(state, byte_offset_of(BytecodeInterpreter, _locals))); // get locals pointer
...@@ -658,7 +658,7 @@ void InterpreterGenerator::generate_stack_overflow_check(void) { ...@@ -658,7 +658,7 @@ void InterpreterGenerator::generate_stack_overflow_check(void) {
const Address size_of_stack (rbx, methodOopDesc::max_stack_offset()); const Address size_of_stack (rbx, methodOopDesc::max_stack_offset());
// Always give one monitor to allow us to start interp if sync method. // Always give one monitor to allow us to start interp if sync method.
// Any additional monitors need a check when moving the expression stack // Any additional monitors need a check when moving the expression stack
const one_monitor = frame::interpreter_frame_monitor_size() * wordSize; const int one_monitor = frame::interpreter_frame_monitor_size() * wordSize;
__ load_unsigned_word(rax, size_of_stack); // get size of expression stack in words __ load_unsigned_word(rax, size_of_stack); // get size of expression stack in words
__ lea(rax, Address(noreg, rax, Interpreter::stackElementScale(), one_monitor)); __ lea(rax, Address(noreg, rax, Interpreter::stackElementScale(), one_monitor));
__ lea(rax, Address(rax, rdx, Interpreter::stackElementScale(), overhead_size)); __ lea(rax, Address(rax, rdx, Interpreter::stackElementScale(), overhead_size));
...@@ -1829,7 +1829,7 @@ address InterpreterGenerator::generate_normal_entry(bool synchronized) { ...@@ -1829,7 +1829,7 @@ address InterpreterGenerator::generate_normal_entry(bool synchronized) {
Label unwind_and_forward; Label unwind_and_forward;
// restore state pointer. // restore state pointer.
__ lea(state, Address(rbp, -sizeof(BytecodeInterpreter))); __ lea(state, Address(rbp, -(int)sizeof(BytecodeInterpreter)));
__ movptr(rbx, STATE(_method)); // get method __ movptr(rbx, STATE(_method)); // get method
#ifdef _LP64 #ifdef _LP64
...@@ -1877,14 +1877,14 @@ address InterpreterGenerator::generate_normal_entry(bool synchronized) { ...@@ -1877,14 +1877,14 @@ address InterpreterGenerator::generate_normal_entry(bool synchronized) {
// The FPU stack is clean if UseSSE >= 2 but must be cleaned in other cases // The FPU stack is clean if UseSSE >= 2 but must be cleaned in other cases
if (UseSSE < 2) { if (UseSSE < 2) {
__ lea(state, Address(rbp, -sizeof(BytecodeInterpreter))); __ lea(state, Address(rbp, -(int)sizeof(BytecodeInterpreter)));
__ movptr(rbx, STATE(_result._to_call._callee)); // get method just executed __ movptr(rbx, STATE(_result._to_call._callee)); // get method just executed
__ movl(rcx, Address(rbx, methodOopDesc::result_index_offset())); __ movl(rcx, Address(rbx, methodOopDesc::result_index_offset()));
__ cmpl(rcx, AbstractInterpreter::BasicType_as_index(T_FLOAT)); // Result stub address array index __ cmpl(rcx, AbstractInterpreter::BasicType_as_index(T_FLOAT)); // Result stub address array index
__ jcc(Assembler::equal, do_float); __ jcc(Assembler::equal, do_float);
__ cmpl(rcx, AbstractInterpreter::BasicType_as_index(T_DOUBLE)); // Result stub address array index __ cmpl(rcx, AbstractInterpreter::BasicType_as_index(T_DOUBLE)); // Result stub address array index
__ jcc(Assembler::equal, do_double); __ jcc(Assembler::equal, do_double);
#ifdef COMPILER2 #if !defined(_LP64) || defined(COMPILER1) || !defined(COMPILER2)
__ empty_FPU_stack(); __ empty_FPU_stack();
#endif // COMPILER2 #endif // COMPILER2
__ jmp(done_conv); __ jmp(done_conv);
...@@ -1928,7 +1928,7 @@ address InterpreterGenerator::generate_normal_entry(bool synchronized) { ...@@ -1928,7 +1928,7 @@ address InterpreterGenerator::generate_normal_entry(bool synchronized) {
// Restore rsi/r13 as compiled code may not preserve it // Restore rsi/r13 as compiled code may not preserve it
__ lea(state, Address(rbp, -sizeof(BytecodeInterpreter))); __ lea(state, Address(rbp, -(int)sizeof(BytecodeInterpreter)));
// restore stack to what we had when we left (in case i2c extended it) // restore stack to what we had when we left (in case i2c extended it)
...@@ -1942,7 +1942,7 @@ address InterpreterGenerator::generate_normal_entry(bool synchronized) { ...@@ -1942,7 +1942,7 @@ address InterpreterGenerator::generate_normal_entry(bool synchronized) {
#else #else
__ movptr(rcx, STATE(_thread)); // get thread __ movptr(rcx, STATE(_thread)); // get thread
__ cmpptr(Address(rcx, Thread::pending_exception_offset()), (int32_t)NULL_WORD); __ cmpptr(Address(rcx, Thread::pending_exception_offset()), (int32_t)NULL_WORD);
#endif / __LP64 #endif // _LP64
__ jcc(Assembler::notZero, return_with_exception); __ jcc(Assembler::notZero, return_with_exception);
// get method just executed // get method just executed
......
...@@ -139,7 +139,7 @@ inline address* frame::native_param_addr(int idx) const { return (address*) addr ...@@ -139,7 +139,7 @@ inline address* frame::native_param_addr(int idx) const { return (address*) addr
#ifdef CC_INTERP #ifdef CC_INTERP
inline interpreterState frame::get_interpreterState() const { inline interpreterState frame::get_interpreterState() const {
return ((interpreterState)addr_at( -sizeof(BytecodeInterpreter)/wordSize )); return ((interpreterState)addr_at( -((int)sizeof(BytecodeInterpreter))/wordSize ));
} }
inline intptr_t* frame::sender_sp() const { inline intptr_t* frame::sender_sp() const {
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#ifdef CC_INTERP #ifdef CC_INTERP
void InterpreterMacroAssembler::get_method(Register reg) { void InterpreterMacroAssembler::get_method(Register reg) {
movptr(reg, Address(rbp, -(sizeof(BytecodeInterpreter) + 2 * wordSize))); movptr(reg, Address(rbp, -((int)sizeof(BytecodeInterpreter) + 2 * wordSize)));
movptr(reg, Address(reg, byte_offset_of(BytecodeInterpreter, _method))); movptr(reg, Address(reg, byte_offset_of(BytecodeInterpreter, _method)));
} }
#endif // CC_INTERP #endif // CC_INTERP
......
...@@ -2954,10 +2954,16 @@ void SharedRuntime::generate_uncommon_trap_blob() { ...@@ -2954,10 +2954,16 @@ void SharedRuntime::generate_uncommon_trap_blob() {
__ pushptr(Address(rcx, 0)); // Save return address __ pushptr(Address(rcx, 0)); // Save return address
__ enter(); // Save old & set new rbp __ enter(); // Save old & set new rbp
__ subptr(rsp, rbx); // Prolog __ subptr(rsp, rbx); // Prolog
#ifdef CC_INTERP
__ movptr(Address(rbp,
-(sizeof(BytecodeInterpreter)) + in_bytes(byte_offset_of(BytecodeInterpreter, _sender_sp))),
sender_sp); // Make it walkable
#else // CC_INTERP
__ movptr(Address(rbp, frame::interpreter_frame_sender_sp_offset * wordSize), __ movptr(Address(rbp, frame::interpreter_frame_sender_sp_offset * wordSize),
sender_sp); // Make it walkable sender_sp); // Make it walkable
// This value is corrected by layout_activation_impl // This value is corrected by layout_activation_impl
__ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), (int32_t)NULL_WORD ); __ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), (int32_t)NULL_WORD );
#endif // CC_INTERP
__ mov(sender_sp, rsp); // Pass sender_sp to next frame __ mov(sender_sp, rsp); // Pass sender_sp to next frame
__ addptr(rsi, wordSize); // Bump array pointer (sizes) __ addptr(rsi, wordSize); // Bump array pointer (sizes)
__ addptr(rcx, wordSize); // Bump array pointer (pcs) __ addptr(rcx, wordSize); // Bump array pointer (pcs)
......
...@@ -163,7 +163,7 @@ ...@@ -163,7 +163,7 @@
#ifdef USELABELS #ifdef USELABELS
// Have to do this dispatch this way in C++ because otherwise gcc complains about crossing an // Have to do this dispatch this way in C++ because otherwise gcc complains about crossing an
// initialization (which is is the initialization of the table pointer...) // initialization (which is is the initialization of the table pointer...)
#define DISPATCH(opcode) goto *dispatch_table[opcode] #define DISPATCH(opcode) goto *(void*)dispatch_table[opcode]
#define CONTINUE { \ #define CONTINUE { \
opcode = *pc; \ opcode = *pc; \
DO_UPDATE_INSTRUCTION_COUNT(opcode); \ DO_UPDATE_INSTRUCTION_COUNT(opcode); \
...@@ -341,7 +341,7 @@ ...@@ -341,7 +341,7 @@
*/ */
#undef CHECK_NULL #undef CHECK_NULL
#define CHECK_NULL(obj_) \ #define CHECK_NULL(obj_) \
if ((obj_) == 0) { \ if ((obj_) == NULL) { \
VM_JAVA_ERROR(vmSymbols::java_lang_NullPointerException(), ""); \ VM_JAVA_ERROR(vmSymbols::java_lang_NullPointerException(), ""); \
} }
...@@ -1362,7 +1362,7 @@ run: ...@@ -1362,7 +1362,7 @@ run:
#define NULL_COMPARISON_NOT_OP(name) \ #define NULL_COMPARISON_NOT_OP(name) \
CASE(_if##name): { \ CASE(_if##name): { \
int skip = (!(STACK_OBJECT(-1) == 0)) \ int skip = (!(STACK_OBJECT(-1) == NULL)) \
? (int16_t)Bytes::get_Java_u2(pc + 1) : 3; \ ? (int16_t)Bytes::get_Java_u2(pc + 1) : 3; \
address branch_pc = pc; \ address branch_pc = pc; \
UPDATE_PC_AND_TOS(skip, -1); \ UPDATE_PC_AND_TOS(skip, -1); \
...@@ -1372,7 +1372,7 @@ run: ...@@ -1372,7 +1372,7 @@ run:
#define NULL_COMPARISON_OP(name) \ #define NULL_COMPARISON_OP(name) \
CASE(_if##name): { \ CASE(_if##name): { \
int skip = ((STACK_OBJECT(-1) == 0)) \ int skip = ((STACK_OBJECT(-1) == NULL)) \
? (int16_t)Bytes::get_Java_u2(pc + 1) : 3; \ ? (int16_t)Bytes::get_Java_u2(pc + 1) : 3; \
address branch_pc = pc; \ address branch_pc = pc; \
UPDATE_PC_AND_TOS(skip, -1); \ UPDATE_PC_AND_TOS(skip, -1); \
......
...@@ -66,7 +66,6 @@ friend class CppInterpreterGenerator; ...@@ -66,7 +66,6 @@ friend class CppInterpreterGenerator;
friend class InterpreterGenerator; friend class InterpreterGenerator;
friend class InterpreterMacroAssembler; friend class InterpreterMacroAssembler;
friend class frame; friend class frame;
friend class SharedRuntime;
friend class VMStructs; friend class VMStructs;
public: public:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册