Mercurial > hg > graal-jvmci-8
diff src/cpu/x86/vm/interp_masm_x86_32.cpp @ 1513:df736661d0c8
Merge
author | jrose |
---|---|
date | Tue, 11 May 2010 15:19:19 -0700 |
parents | 2338d41fbd81 |
children | c18cbe5936b8 ab102d5d923e |
line wrap: on
line diff
--- a/src/cpu/x86/vm/interp_masm_x86_32.cpp Mon May 10 14:58:38 2010 -0700 +++ b/src/cpu/x86/vm/interp_masm_x86_32.cpp Tue May 11 15:19:19 2010 -0700 @@ -265,89 +265,30 @@ // Java Expression Stack -#ifdef ASSERT -void InterpreterMacroAssembler::verify_stack_tag(frame::Tag t) { - if (TaggedStackInterpreter) { - Label okay; - cmpptr(Address(rsp, wordSize), (int32_t)t); - jcc(Assembler::equal, okay); - // Also compare if the stack value is zero, then the tag might - // not have been set coming from deopt. - cmpptr(Address(rsp, 0), 0); - jcc(Assembler::equal, okay); - stop("Java Expression stack tag value is bad"); - bind(okay); - } -} -#endif // ASSERT - void InterpreterMacroAssembler::pop_ptr(Register r) { - debug_only(verify_stack_tag(frame::TagReference)); pop(r); - if (TaggedStackInterpreter) addptr(rsp, 1 * wordSize); -} - -void InterpreterMacroAssembler::pop_ptr(Register r, Register tag) { - pop(r); - // Tag may not be reference for jsr, can be returnAddress - if (TaggedStackInterpreter) pop(tag); } void InterpreterMacroAssembler::pop_i(Register r) { - debug_only(verify_stack_tag(frame::TagValue)); pop(r); - if (TaggedStackInterpreter) addptr(rsp, 1 * wordSize); } void InterpreterMacroAssembler::pop_l(Register lo, Register hi) { - debug_only(verify_stack_tag(frame::TagValue)); pop(lo); - if (TaggedStackInterpreter) addptr(rsp, 1 * wordSize); - debug_only(verify_stack_tag(frame::TagValue)); pop(hi); - if (TaggedStackInterpreter) addptr(rsp, 1 * wordSize); } void InterpreterMacroAssembler::pop_f() { - debug_only(verify_stack_tag(frame::TagValue)); fld_s(Address(rsp, 0)); addptr(rsp, 1 * wordSize); - if (TaggedStackInterpreter) addptr(rsp, 1 * wordSize); } void InterpreterMacroAssembler::pop_d() { - // Write double to stack contiguously and load into ST0 - pop_dtos_to_rsp(); fld_d(Address(rsp, 0)); addptr(rsp, 2 * wordSize); } -// Pop the top of the java expression stack to execution stack (which -// happens to be the same place). -void InterpreterMacroAssembler::pop_dtos_to_rsp() { - if (TaggedStackInterpreter) { - // Pop double value into scratch registers - debug_only(verify_stack_tag(frame::TagValue)); - pop(rax); - addptr(rsp, 1* wordSize); - debug_only(verify_stack_tag(frame::TagValue)); - pop(rdx); - addptr(rsp, 1* wordSize); - push(rdx); - push(rax); - } -} - -void InterpreterMacroAssembler::pop_ftos_to_rsp() { - if (TaggedStackInterpreter) { - debug_only(verify_stack_tag(frame::TagValue)); - pop(rax); - addptr(rsp, 1 * wordSize); - push(rax); // ftos is at rsp - } -} - void InterpreterMacroAssembler::pop(TosState state) { switch (state) { case atos: pop_ptr(rax); break; @@ -365,54 +306,28 @@ } void InterpreterMacroAssembler::push_ptr(Register r) { - if (TaggedStackInterpreter) push(frame::TagReference); - push(r); -} - -void InterpreterMacroAssembler::push_ptr(Register r, Register tag) { - if (TaggedStackInterpreter) push(tag); // tag first push(r); } void InterpreterMacroAssembler::push_i(Register r) { - if (TaggedStackInterpreter) push(frame::TagValue); push(r); } void InterpreterMacroAssembler::push_l(Register lo, Register hi) { - if (TaggedStackInterpreter) push(frame::TagValue); push(hi); - if (TaggedStackInterpreter) push(frame::TagValue); push(lo); } void InterpreterMacroAssembler::push_f() { - if (TaggedStackInterpreter) push(frame::TagValue); // Do not schedule for no AGI! Never write beyond rsp! subptr(rsp, 1 * wordSize); fstp_s(Address(rsp, 0)); } void InterpreterMacroAssembler::push_d(Register r) { - if (TaggedStackInterpreter) { - // Double values are stored as: - // tag - // high - // tag - // low - push(frame::TagValue); - subptr(rsp, 3 * wordSize); - fstp_d(Address(rsp, 0)); - // move high word up to slot n-1 - movl(r, Address(rsp, 1*wordSize)); - movl(Address(rsp, 2*wordSize), r); - // move tag - movl(Address(rsp, 1*wordSize), frame::TagValue); - } else { - // Do not schedule for no AGI! Never write beyond rsp! - subptr(rsp, 2 * wordSize); - fstp_d(Address(rsp, 0)); - } + // Do not schedule for no AGI! Never write beyond rsp! + subptr(rsp, 2 * wordSize); + fstp_d(Address(rsp, 0)); } @@ -433,118 +348,15 @@ } -// Tagged stack helpers for swap and dup -void InterpreterMacroAssembler::load_ptr_and_tag(int n, Register val, - Register tag) { +// Helpers for swap and dup +void InterpreterMacroAssembler::load_ptr(int n, Register val) { movptr(val, Address(rsp, Interpreter::expr_offset_in_bytes(n))); - if (TaggedStackInterpreter) { - movptr(tag, Address(rsp, Interpreter::expr_tag_offset_in_bytes(n))); - } -} - -void InterpreterMacroAssembler::store_ptr_and_tag(int n, Register val, - Register tag) { - movptr(Address(rsp, Interpreter::expr_offset_in_bytes(n)), val); - if (TaggedStackInterpreter) { - movptr(Address(rsp, Interpreter::expr_tag_offset_in_bytes(n)), tag); - } -} - - -// Tagged local support -void InterpreterMacroAssembler::tag_local(frame::Tag tag, int n) { - if (TaggedStackInterpreter) { - if (tag == frame::TagCategory2) { - movptr(Address(rdi, Interpreter::local_tag_offset_in_bytes(n+1)), (int32_t)frame::TagValue); - movptr(Address(rdi, Interpreter::local_tag_offset_in_bytes(n)), (int32_t)frame::TagValue); - } else { - movptr(Address(rdi, Interpreter::local_tag_offset_in_bytes(n)), (int32_t)tag); - } - } -} - -void InterpreterMacroAssembler::tag_local(frame::Tag tag, Register idx) { - if (TaggedStackInterpreter) { - if (tag == frame::TagCategory2) { - movptr(Address(rdi, idx, Interpreter::stackElementScale(), - Interpreter::local_tag_offset_in_bytes(1)), (int32_t)frame::TagValue); - movptr(Address(rdi, idx, Interpreter::stackElementScale(), - Interpreter::local_tag_offset_in_bytes(0)), (int32_t)frame::TagValue); - } else { - movptr(Address(rdi, idx, Interpreter::stackElementScale(), - Interpreter::local_tag_offset_in_bytes(0)), (int32_t)tag); - } - } -} - -void InterpreterMacroAssembler::tag_local(Register tag, Register idx) { - if (TaggedStackInterpreter) { - // can only be TagValue or TagReference - movptr(Address(rdi, idx, Interpreter::stackElementScale(), - Interpreter::local_tag_offset_in_bytes(0)), tag); - } } - -void InterpreterMacroAssembler::tag_local(Register tag, int n) { - if (TaggedStackInterpreter) { - // can only be TagValue or TagReference - movptr(Address(rdi, Interpreter::local_tag_offset_in_bytes(n)), tag); - } +void InterpreterMacroAssembler::store_ptr(int n, Register val) { + movptr(Address(rsp, Interpreter::expr_offset_in_bytes(n)), val); } -#ifdef ASSERT -void InterpreterMacroAssembler::verify_local_tag(frame::Tag tag, int n) { - if (TaggedStackInterpreter) { - frame::Tag t = tag; - if (tag == frame::TagCategory2) { - Label nbl; - t = frame::TagValue; // change to what is stored in locals - cmpptr(Address(rdi, Interpreter::local_tag_offset_in_bytes(n+1)), (int32_t)t); - jcc(Assembler::equal, nbl); - stop("Local tag is bad for long/double"); - bind(nbl); - } - Label notBad; - cmpptr(Address(rdi, Interpreter::local_tag_offset_in_bytes(n)), (int32_t)t); - jcc(Assembler::equal, notBad); - // Also compare if the local value is zero, then the tag might - // not have been set coming from deopt. - cmpptr(Address(rdi, Interpreter::local_offset_in_bytes(n)), 0); - jcc(Assembler::equal, notBad); - stop("Local tag is bad"); - bind(notBad); - } -} - -void InterpreterMacroAssembler::verify_local_tag(frame::Tag tag, Register idx) { - if (TaggedStackInterpreter) { - frame::Tag t = tag; - if (tag == frame::TagCategory2) { - Label nbl; - t = frame::TagValue; // change to what is stored in locals - cmpptr(Address(rdi, idx, Interpreter::stackElementScale(), - Interpreter::local_tag_offset_in_bytes(1)), (int32_t)t); - jcc(Assembler::equal, nbl); - stop("Local tag is bad for long/double"); - bind(nbl); - } - Label notBad; - cmpl(Address(rdi, idx, Interpreter::stackElementScale(), - Interpreter::local_tag_offset_in_bytes(0)), (int32_t)t); - jcc(Assembler::equal, notBad); - // Also compare if the local value is zero, then the tag might - // not have been set coming from deopt. - cmpptr(Address(rdi, idx, Interpreter::stackElementScale(), - Interpreter::local_offset_in_bytes(0)), 0); - jcc(Assembler::equal, notBad); - stop("Local tag is bad"); - bind(notBad); - - } -} -#endif // ASSERT - void InterpreterMacroAssembler::super_call_VM_leaf(address entry_point) { MacroAssembler::call_VM_leaf_base(entry_point, 0); }