Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with the stack-switching strategy #3268

Closed
LemonBoy opened this issue Sep 20, 2019 · 2 comments
Closed

Issue with the stack-switching strategy #3268

LemonBoy opened this issue Sep 20, 2019 · 2 comments
Labels
arch-aarch64 64-bit ARM backend-llvm The LLVM backend outputs an LLVM IR Module. bug Observed behavior contradicts documented or intended behavior miscompilation The compiler reports success but produces semantically incorrect code.
Milestone

Comments

@LemonBoy
Copy link
Contributor

A small excerpt from new_stack_call.zig compiled for AArch64, as you can see changing the value of the stack pointer doesn't stop LLVM from spilling stuff to/from it.

  2105fc:       90ffff89        adrp    x9, 200000 <os-0xbd0>                    
  210600:       91356129        add     x9, x9, #0xd58                           
  210604:       f940012a        ldr     x10, [x9]                                
  210608:       f9400529        ldr     x9, [x9, #8]                             
  21060c:       8b090149        add     x9, x10, x9                              
  210610:       92400d2a        and     x10, x9, #0xf                            
  210614:       eb0a0129        subs    x9, x9, x10                              
  210618:       910003e1        mov     x1, sp                                   
  21061c:       9100013f        mov     sp, x9 // The new SP is in place                     
  210620:       52809a48        mov     w8, #0x4d2 
  210624:       f90017e0        str     x0, [sp, #40] // Oh no!
  210628:       2a0803e0        mov     w0, w8                                   
  21062c:       f90013e1        str     x1, [sp, #32] // Oh no!
  210630:       b9001fe8        str     w8, [sp, #28] // Oh no!
  210634:       94000080        bl      210834 <targetFunction>     
@andrewrk andrewrk added this to the 0.6.0 milestone Sep 20, 2019
@andrewrk
Copy link
Member

Damn, looks like we'll have to rethink @newStackCall a bit. Thanks for the report.

@andrewrk andrewrk added the arch-aarch64 64-bit ARM label Sep 29, 2019
@andrewrk andrewrk modified the milestones: 0.6.0, 0.7.0 Oct 23, 2019
andrewrk added a commit that referenced this issue Dec 6, 2019
Calling with a new stack, with a runtime-known stack pointer (e.g.
not a global variable) is regressed with this branch. It is now a
compile-error, due to the Runtime Hint system not being smart enough
to mix a compile-time modifier field with a runtime stack field.
I'm OK with this regression because this feature is flawed (see #3268)
and may be deleted from the language.
@andrewrk andrewrk added bug Observed behavior contradicts documented or intended behavior miscompilation The compiler reports success but produces semantically incorrect code. labels Dec 6, 2019
@andrewrk andrewrk modified the milestones: 0.7.0, 0.6.0 Jan 30, 2020
@andrewrk andrewrk modified the milestones: 0.6.0, 0.7.0 Feb 13, 2020
@andrewrk andrewrk added the stage1 The process of building from source via WebAssembly and the C backend. label Feb 13, 2020
@andrewrk andrewrk modified the milestones: 0.7.0, 0.8.0 Oct 17, 2020
@andrewrk andrewrk modified the milestones: 0.8.0, 0.9.0 Nov 6, 2020
@andrewrk andrewrk modified the milestones: 0.9.0, 0.10.0 May 19, 2021
@Vexu Vexu added backend-llvm The LLVM backend outputs an LLVM IR Module. and removed stage1 The process of building from source via WebAssembly and the C backend. labels Dec 28, 2022
@andrewrk andrewrk modified the milestones: 0.14.0, 0.11.0 Jul 22, 2023
@andrewrk
Copy link
Member

@newStackCall was deleted from the language.

@andrewrk andrewrk closed this as not planned Won't fix, can't repro, duplicate, stale Jul 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-aarch64 64-bit ARM backend-llvm The LLVM backend outputs an LLVM IR Module. bug Observed behavior contradicts documented or intended behavior miscompilation The compiler reports success but produces semantically incorrect code.
Projects
None yet
Development

No branches or pull requests

3 participants