Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • M mu-impl-fast
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 40
    • Issues 40
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 1
    • Merge requests 1
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • mumu
  • mu-impl-fast
  • Issues
  • #17
Closed
Open
Issue created Mar 22, 2017 by Yi Lin@u4776528Owner

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.

Assignee
Assign to
Time tracking