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

Properly fix alignment of bytes on stack #794

Closed
phischu opened this issue Jan 23, 2025 · 0 comments · Fixed by #803
Closed

Properly fix alignment of bytes on stack #794

phischu opened this issue Jan 23, 2025 · 0 comments · Fixed by #803
Assignees

Comments

@phischu
Copy link
Collaborator

phischu commented Jan 23, 2025

The following example still segfaults:

def foo { action: (Byte, Byte) => Unit }: Unit =
  action(42.toByte, 42.toByte)

def main() = {
  foo { (b0, b1) =>
    println(42)
    println(b0)
    println(b1)
  }
}

I see three solutions:

  1. Undo the optimization and reserve stack space twice when pushing a frame: once for the environment and once for the header.
  2. Change the definition of %Byte to i64 in llvm and hope for the best. This will require greate care in extern functions acting on bytes.
  3. Insert getelementptr instructions to ask llvm to calculate the size of a frame for us.

Unsurprisingly I am for (1).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants