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

Fix stack overflows when compiling high-recursion_limit programs #93056

Closed

Commits on Apr 28, 2022

  1. Add ensure_sufficient_stack to recursive algorithms

    The ensure_sufficient_stack function executes its callback in a
    dynamically allocated stack when the current stack is low on space.
    Using it in recursive algorithms such as visitors prevents the compiler
    from overflowing its stack when compiling modules with a high
    recursion_limit.
    LegionMammal978 committed Apr 28, 2022
    Configuration menu
    Copy the full SHA
    a2f4017 View commit details
    Browse the repository at this point in the history
  2. Fix stack overflow in rustc_ast::ptr::P<_> destructor

    In rustc_ast, an Expr contains an ExprKind, which can contain a P<Expr>.
    To prevent the stack from overflowing when dropping an Expr, one of the
    types must use ManuallyDrop for its fields. Since both Expr and ExprKind
    are frequently deconstructed into their fields using match expressions,
    I chose to attach it to P::ptr.
    LegionMammal978 committed Apr 28, 2022
    Configuration menu
    Copy the full SHA
    b347aa5 View commit details
    Browse the repository at this point in the history
  3. Fix stack overflow in llvm::Verifier::visitMDNode()

    This code is a proof-of-concept more than anything else. It is not ready
    to be merged in its current state. Any version of this fix must somehow
    measure the depth of the metadata nodes (or a rough upper bound), and it
    must somehow send that depth to the LLVM codegen entry point. There is
    likely a tradeoff to be made between performance and readability here.
    LegionMammal978 committed Apr 28, 2022
    Configuration menu
    Copy the full SHA
    a68b894 View commit details
    Browse the repository at this point in the history