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

Validate modules while translating #2059

Merged
merged 2 commits into from
Oct 5, 2020

Commits on Sep 30, 2020

  1. Validate modules while translating

    This commit is a change to cranelift-wasm to validate each function body
    as it is translated. Additionally top-level module translation functions
    will perform module validation. This commit builds on changes in
    wasmparser to perform module validation interwtwined with parsing and
    translation. This will be necessary for future wasm features such as
    module linking where the type behind a function index, for example, can
    be far away in another module. Additionally this also brings a nice
    benefit where parsing the binary only happens once (instead of having an
    up-front serial validation step) and validation can happen in parallel
    for each function.
    
    Most of the changes in this commit are plumbing to make sure everything
    lines up right. The major functional change here is that module
    compilation should be faster by validating in parallel (or skipping
    function validation entirely in the case of a cache hit). Otherwise from
    a user-facing perspective nothing should be that different.
    
    This commit does mean that cranelift's translation now inherently
    validates the input wasm module. This means that the Spidermonkey
    integration of cranelift-wasm will also be validating the function as
    it's being translated with cranelift. The associated PR for wasmparser
    (bytecodealliance/wasmparser#62) provides the necessary tools to create
    a `FuncValidator` for Gecko, but this is something I'll want careful
    review for before landing!
    alexcrichton committed Sep 30, 2020
    Configuration menu
    Copy the full SHA
    6415589 View commit details
    Browse the repository at this point in the history
  2. Read function operators until EOF

    This way we can let the validator take care of any issues with
    mismatched `end` instructions and/or trailing operators/bytes.
    alexcrichton committed Sep 30, 2020
    Configuration menu
    Copy the full SHA
    5eab0bb View commit details
    Browse the repository at this point in the history