Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • sac2c sac2c
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 401
    • Issues 401
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 19
    • Merge requests 19
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • sac-group
  • sac2csac2c
  • Merge requests
  • !446

Virtual shadow stack traces

  • Review changes

  • Download
  • Email patches
  • Plain diff
Open Quinten Cabo requested to merge virtual-shadow-stack-traces into develop Oct 30, 2025
  • Overview 9
  • Commits 130
  • Changes 50

What is this?

This pull request adds accurate stack traces to the runtime error messages of SaC even when large parts of the code have disappeared through optimisation. Instead of unwinding the memory stack that no longer relates to the source code as written by the programmer, this approach works by using a virtual shadow stack. The shadow stack is maintained at runtime by push and pop functions that the compiler inserts around function calls. Then when a runtime error is detected we can unwind the current virtual stack at the time of the error instead of the memory stack. Using SaC uniqueness types we can maintain the correct order of the pushes and pops to create accurate stack traces while still being able to aggressively optimise the code. The design of the stack trace was created by looking at stack traces of 30 other programming languages. Details about that are found here.

todo items

  • Fix the pipeline errors
  • Fix the failing tests
  • Make dish traversal insert flattened code
  • Fix pragma safe
  • Fix recursion over 1000 segfault
  • Fix the tensor comprehension error
  • Uniqueness types violation?
  • Compiler flags usage text
  • Compiler flags cli parser
  • Compiler flags globals
  • Do not copy expressions but copy the flat variable
  • Compiler flags make them actually work
    • Insert calls to configuration functions
    • Make the disable flags work
    • Track sel flag
    • Live trace flag
  • Fix order of shape and dim
  • Skip entire phase if -st-disable is set
  • Stack trace help section for compiler flags
  • Disable dimshape tracking configuration function?
  • Missing configuration functions
  • Check if -#d IVS breaks anything
  • Check if production build works?
  • Free unused source call strings
  • Fix with loop body assignments
  • Fix missing AP_PUSH links sometimes
    • Deal with push to main that should not have AP_PUSH
  • Fix correct dim shape
  • StringStack in Stack struct
  • Fix pretty string remvove all strings being overkill
  • Fix representation of empty stack
  • Fix renamed pragma safe functions appearing in stack
  • Add color to Stack trace
  • Fix arrow winding being wrong due to invisible color characters
Edited Jan 08, 2026 by Quinten Cabo
Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: virtual-shadow-stack-traces