Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
    • Help
    • Support
    • Submit feedback
    • Contribute to GitLab
  • Sign in
M
mu-impl-fast
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 40
    • Issues 40
    • List
    • Boards
    • Labels
    • Milestones
  • Merge Requests 1
    • Merge Requests 1
  • Analytics
    • Analytics
    • Repository
    • Value Stream
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
  • mu
  • mu-impl-fast
  • Issues
  • #17

Closed
Open
Opened Mar 22, 2017 by Yi Lin@u4776528
  • Report abuse
  • New issue
Report abuse New issue

Implementing ALLOCA/ALLOCA_HYBRID

Currently the compiler assumes that frame size is constant at compile time.

For x86_64, stack pointer needs to be 16-bytes aligned before a function call. The compiler ensures this by:

  • rbp is always 16-bytes aligned.
  • frame size is a multiple of 16-bytes (align up to 16-bytes if it is not, see frame.rs).
  • if any call argument is passed on stack, if necessary, push a padding value to stack so that rsp is still 16-bytes aligned after pushing call arguments.
  • restoring from an exception will set rsp from rbp and the constant frame size.

We can implement ALLOCA by computing allocating size during compile time, and frame size is still a compile-time constant. However, the implementation of ALLOCA_HYBRID will break this assumption. A straightforward solution is to make the alloca'd size always a multiple of 16-bytes (for alignment requirement), and record a current frame size somewhere (for restoring from exception) - this would keep most of the above unchanged. This issue tracks related discussion.

  • Discussion
  • Designs
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
2
Labels
spec coverage unimplemented
Assign labels
  • View project labels
Reference: mu/mu-impl-fast#17