aboutsummaryrefslogtreecommitdiff
path: root/src/cpu/x86
diff options
context:
space:
mode:
Diffstat (limited to 'src/cpu/x86')
-rw-r--r--src/cpu/x86/vm/macroAssembler_x86.cpp4
-rw-r--r--src/cpu/x86/vm/x86_32.ad6
-rw-r--r--src/cpu/x86/vm/x86_64.ad6
3 files changed, 13 insertions, 3 deletions
diff --git a/src/cpu/x86/vm/macroAssembler_x86.cpp b/src/cpu/x86/vm/macroAssembler_x86.cpp
index d6f179770..b3a72ab0e 100644
--- a/src/cpu/x86/vm/macroAssembler_x86.cpp
+++ b/src/cpu/x86/vm/macroAssembler_x86.cpp
@@ -6143,7 +6143,9 @@ void MacroAssembler::verified_entry(int framesize, int stack_bang_size, bool fp_
// Save caller's stack pointer into RBP if the frame pointer is preserved.
if (PreserveFramePointer) {
movptr(rbp, rsp);
- addptr(rbp, framesize + wordSize);
+ if (framesize > 0) {
+ addptr(rbp, framesize);
+ }
}
}
diff --git a/src/cpu/x86/vm/x86_32.ad b/src/cpu/x86/vm/x86_32.ad
index 6575ceca2..42aba5b21 100644
--- a/src/cpu/x86/vm/x86_32.ad
+++ b/src/cpu/x86/vm/x86_32.ad
@@ -566,7 +566,11 @@ void MachPrologNode::format(PhaseRegAlloc* ra_, outputStream* st) const {
st->print("MOV [ESP + #%d], EBP\t# Save EBP",framesize);
if (PreserveFramePointer) {
st->print("\n\t");
- st->print("MOV EBP, [ESP + #%d]\t# Save the caller's SP into EBP", (framesize + wordSize));
+ st->print("MOV EBP, ESP\t# Save the caller's SP into EBP");
+ if (framesize > 0) {
+ st->print("\n\t");
+ st->print("ADD EBP, #%d", framesize);
+ }
}
}
diff --git a/src/cpu/x86/vm/x86_64.ad b/src/cpu/x86/vm/x86_64.ad
index 49b3ec54e..52bc63507 100644
--- a/src/cpu/x86/vm/x86_64.ad
+++ b/src/cpu/x86/vm/x86_64.ad
@@ -863,7 +863,11 @@ void MachPrologNode::format(PhaseRegAlloc* ra_, outputStream* st) const {
st->print("movq [rsp + #%d], rbp\t# Save rbp",framesize);
if (PreserveFramePointer) {
st->print("\n\t");
- st->print("movq rbp, [rsp + #%d]\t# Save the caller's SP into rbp", (framesize + wordSize));
+ st->print("movq rbp, rsp\t# Save the caller's SP into rbp");
+ if (framesize > 0) {
+ st->print("\n\t");
+ st->print("addq rbp, #%d", framesize);
+ }
}
}