-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Align the start of stackslots instead of the end
The alignment for stackslots was commputed wrongly, because the end of the slot was being aligned instead of the beginning. This effectively meant that the _next_ stackslot was being aligned on the alignment of the current slot.
- Loading branch information
1 parent
fed24ee
commit 5d7b1dc
Showing
3 changed files
with
94 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
cranelift/filetests/filetests/isa/x64/stackslot_alignment.clif
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
test compile precise-output | ||
target x86_64 | ||
|
||
function %f0(i64 vmctx) -> i64, i64 { | ||
gv0 = vmctx | ||
stack_limit = gv0 | ||
ss0 = explicit_slot 8 | ||
ss1 = explicit_slot 32, align=16 | ||
|
||
block0(v0: i64): | ||
v1 = stack_addr.i64 ss0 | ||
v2 = stack_addr.i64 ss1 | ||
return v1, v2 | ||
} | ||
|
||
; VCode: | ||
; pushq %rbp | ||
; movq %rsp, %rbp | ||
; movq %rdi, %r10 | ||
; addq %r10, $48, %r10 | ||
; cmpq %rsp, %r10 | ||
; jnbe #trap=stk_ovf | ||
; subq %rsp, $48, %rsp | ||
; block0: | ||
; lea rsp(0 + virtual offset), %rax | ||
; lea rsp(16 + virtual offset), %rdx | ||
; addq %rsp, $48, %rsp | ||
; movq %rbp, %rsp | ||
; popq %rbp | ||
; ret | ||
; | ||
; Disassembled: | ||
; block0: ; offset 0x0 | ||
; pushq %rbp | ||
; movq %rsp, %rbp | ||
; movq %rdi, %r10 | ||
; addq $0x30, %r10 | ||
; cmpq %rsp, %r10 | ||
; ja 0x2a | ||
; subq $0x30, %rsp | ||
; block1: ; offset 0x18 | ||
; leaq (%rsp), %rax | ||
; leaq 0x10(%rsp), %rdx | ||
; addq $0x30, %rsp | ||
; movq %rbp, %rsp | ||
; popq %rbp | ||
; retq | ||
; ud2 ; trap: stk_ovf |