8244433: Remove saving of RSP in Assembler::pusha_uncached()
Remove move instruction to save the actual value of RSP in Assembler::pusha_uncached() on x86. Reviewed-by: eosterlund, thartmann, kvn
This commit is contained in:
parent
ed9cbe252d
commit
6bd9391f03
@ -8789,7 +8789,8 @@ void Assembler::popa_uncached() { // 64bit
|
||||
movq(rdi, Address(rsp, 8 * wordSize));
|
||||
movq(rsi, Address(rsp, 9 * wordSize));
|
||||
movq(rbp, Address(rsp, 10 * wordSize));
|
||||
// skip rsp
|
||||
// Skip rsp as it is restored automatically to the value
|
||||
// before the corresponding pusha when popa is done.
|
||||
movq(rbx, Address(rsp, 12 * wordSize));
|
||||
movq(rdx, Address(rsp, 13 * wordSize));
|
||||
movq(rcx, Address(rsp, 14 * wordSize));
|
||||
@ -8798,22 +8799,24 @@ void Assembler::popa_uncached() { // 64bit
|
||||
addq(rsp, 16 * wordSize);
|
||||
}
|
||||
|
||||
// Does not actually store the value of rsp on the stack.
|
||||
// The slot for rsp just contains an arbitrary value.
|
||||
void Assembler::pusha() { // 64bit
|
||||
emit_copy(code_section(), pusha_code, pusha_len);
|
||||
}
|
||||
|
||||
// Does not actually store the value of rsp on the stack.
|
||||
// The slot for rsp just contains an arbitrary value.
|
||||
void Assembler::pusha_uncached() { // 64bit
|
||||
// we have to store original rsp. ABI says that 128 bytes
|
||||
// below rsp are local scratch.
|
||||
movq(Address(rsp, -5 * wordSize), rsp);
|
||||
|
||||
subq(rsp, 16 * wordSize);
|
||||
|
||||
movq(Address(rsp, 15 * wordSize), rax);
|
||||
movq(Address(rsp, 14 * wordSize), rcx);
|
||||
movq(Address(rsp, 13 * wordSize), rdx);
|
||||
movq(Address(rsp, 12 * wordSize), rbx);
|
||||
// skip rsp
|
||||
// Skip rsp as the value is normally not used. There are a few places where
|
||||
// the original value of rsp needs to be known but that can be computed
|
||||
// from the value of rsp immediately after pusha (rsp + 16 * wordSize).
|
||||
movq(Address(rsp, 10 * wordSize), rbp);
|
||||
movq(Address(rsp, 9 * wordSize), rsi);
|
||||
movq(Address(rsp, 8 * wordSize), rdi);
|
||||
|
@ -898,7 +898,8 @@ void MacroAssembler::print_state64(int64_t pc, int64_t regs[]) {
|
||||
PRINT_REG(rdi, regs[8]);
|
||||
PRINT_REG(rsi, regs[9]);
|
||||
PRINT_REG(rbp, regs[10]);
|
||||
PRINT_REG(rsp, regs[11]);
|
||||
// rsp is actually not stored by pusha(), compute the old rsp from regs (rsp after pusha): regs + 16 = old rsp
|
||||
PRINT_REG(rsp, (intptr_t)(®s[16]));
|
||||
PRINT_REG(r8 , regs[7]);
|
||||
PRINT_REG(r9 , regs[6]);
|
||||
PRINT_REG(r10, regs[5]);
|
||||
@ -908,8 +909,8 @@ void MacroAssembler::print_state64(int64_t pc, int64_t regs[]) {
|
||||
PRINT_REG(r14, regs[1]);
|
||||
PRINT_REG(r15, regs[0]);
|
||||
#undef PRINT_REG
|
||||
// Print some words near top of staack.
|
||||
int64_t* rsp = (int64_t*) regs[11];
|
||||
// Print some words near the top of the stack.
|
||||
int64_t* rsp = ®s[16];
|
||||
int64_t* dump_sp = rsp;
|
||||
for (int col1 = 0; col1 < 8; col1++) {
|
||||
tty->print("(rsp+0x%03x) 0x%016lx: ", (int)((intptr_t)dump_sp - (intptr_t)rsp), (intptr_t)dump_sp);
|
||||
|
@ -507,7 +507,17 @@ void trace_method_handle_stub(const char* adaptername,
|
||||
for (int i = 0; i < saved_regs_count; i++) {
|
||||
Register r = as_Register(i);
|
||||
// The registers are stored in reverse order on the stack (by pusha).
|
||||
#ifdef AMD64
|
||||
assert(RegisterImpl::number_of_registers == 16, "sanity");
|
||||
if (r == rsp) {
|
||||
// rsp is actually not stored by pusha(), compute the old rsp from saved_regs (rsp after pusha): saved_regs + 16 = old rsp
|
||||
tty->print("%3s=" PTR_FORMAT, r->name(), (intptr_t)(&saved_regs[16]));
|
||||
} else {
|
||||
tty->print("%3s=" PTR_FORMAT, r->name(), saved_regs[((saved_regs_count - 1) - i)]);
|
||||
}
|
||||
#else
|
||||
tty->print("%3s=" PTR_FORMAT, r->name(), saved_regs[((saved_regs_count - 1) - i)]);
|
||||
#endif
|
||||
if ((i + 1) % 4 == 0) {
|
||||
tty->cr();
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user