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

Reset function context when ending a function in IRBuilder #7081

Merged
merged 9 commits into from
Nov 15, 2024

Commits on Nov 15, 2024

  1. Use empty blocks instead of nops for empty scopes in IRBuilder

    When IRBuilder builds an empty non-block scope such as a function body,
    an if arm, a try block, etc, it needs to produce some expression to
    represent the empty contents. Previously it produced a nop, but change
    it to produce an empty block instead. The binary writer and printer have
    special logic to elide empty blocks, so this produces smaller output.
    
    Update J2CLOpts to recognize functions containing empty blocks as
    trivial to avoid regressing one of its tests.
    tlively committed Nov 15, 2024
    Configuration menu
    Copy the full SHA
    07c6b9b View commit details
    Browse the repository at this point in the history
  2. update source map test

    tlively committed Nov 15, 2024
    Configuration menu
    Copy the full SHA
    5e0c0b9 View commit details
    Browse the repository at this point in the history
  3. Reset function context when ending a function in IRBuilder

    IRBuilder contains a pointer to the current function that is used to
    create scratch locals, look up the operand types for returns, etc. This
    pointer is nullable because IRBuilder can also be used in non-function
    contexts such as global initializers. Visiting the start of a function
    sets the function pointer, and after this change visiting the end of a
    function resets the pointer to null. This avoids potential problems
    where code outside a function would be able to incorrectly use scratch
    locals and returns if the IRBuilder had previously been used to build a
    function.
    
    This change requires some adjustments to Outlining, which visits code
    out of order, so ends up visiting code from inside a function after
    visiting the end of the function. To support this use case, add a
    `setFunction` method to IRBuilder that lets the user explicitly control
    its function context. Also remove the optional function pointer
    parameter to the IRBuilder constructor since it is less flexible and not
    used.
    tlively committed Nov 15, 2024
    Configuration menu
    Copy the full SHA
    21ef873 View commit details
    Browse the repository at this point in the history
  4. fix gtest

    tlively committed Nov 15, 2024
    Configuration menu
    Copy the full SHA
    54134fd View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    fdeb5e4 View commit details
    Browse the repository at this point in the history
  6. update binaryen.js tests

    tlively committed Nov 15, 2024
    Configuration menu
    Copy the full SHA
    ab150cd View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    7e14525 View commit details
    Browse the repository at this point in the history
  8. Add missing CHECK_ERR

    tlively committed Nov 15, 2024
    Configuration menu
    Copy the full SHA
    fa07c51 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    cdfe642 View commit details
    Browse the repository at this point in the history