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

Support for Wast table initialisation syntactic sugar with typeful references #952

Closed
wants to merge 5 commits into from

Commits on Mar 6, 2023

  1. Elaboration of table initialisation with typeful references

    This commit fixes a bug in the elaboration of table initialisation
    when the element has a typeful reference type. Previsouly, the
    elaborator would assume that the initialising element has type
    `funcref`. Concretely, in code this meant that the following module
    
    ```wast
    (module
      (type $t (func))
      (func $tf)
      (table $t (ref null $t) (elem $tf)))
    ```
    
    would elaborate to something like
    
    ```wast
    (module
      (type $t (func))
      (func $tf (type $t))
      (table $t 1 1 (ref null 0))
      (elem 0 (i32.const 0) func (ref.func $tf)))
    ```
    
    The problem here is that the type of `ref.func $tf` is `ref null 0`
    which is not a subtype of `func`. So, now the wast parser correctly
    elaborates the above module, such that the it reads `(ref null 0)`
    rather than `func` in the type component of `elem`.
    
    The current implementation uses a slight hack to back patch a parsed
    `ElemPayload` as the parser do not have access to the sufficient
    context information to parse `ElemPayload` correctly for the above
    example.
    dhil committed Mar 6, 2023
    Configuration menu
    Copy the full SHA
    a707aae View commit details
    Browse the repository at this point in the history
  2. Generalise

    dhil committed Mar 6, 2023
    Configuration menu
    Copy the full SHA
    a35a876 View commit details
    Browse the repository at this point in the history

Commits on Mar 7, 2023

  1. Refactor and document

    dhil committed Mar 7, 2023
    Configuration menu
    Copy the full SHA
    4aee763 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f17bf92 View commit details
    Browse the repository at this point in the history
  3. Add br_table.wast snapshot

    dhil committed Mar 7, 2023
    Configuration menu
    Copy the full SHA
    7c025ed View commit details
    Browse the repository at this point in the history