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

Switch wasm emission to a custom encoder #30

Merged
merged 4 commits into from
Jan 28, 2019

Commits on Jan 28, 2019

  1. Switch wasm emission to a custom encoder

    This commit moves emission of the wasm module away from the
    `parity-wasm` crate to instead using custom code within this crate.
    Similar to parsing with `wasmparser`, this is motivated twofold:
    
    * First, we want the ability to record binary offsets of where functions
      and instructions are located. This allows us encode dwarf debug
      information eventually.
    
    * Second, this avoids a "lowering to a different IR" problem where we
      will be able to implement more efficient emission than if we go to
      parity-wasm first.
    
    Ideally this would all be separated to an external crate and/or maybe
    even sharing `wasmparser` types or something like that, but for now it
    should be relatively easy enough to inline it and with the spec tests we
    can have a pretty high degree of confidence it's not full of bugs at
    least.
    
    Some other changes included here are:
    
    * Functions are now serialized in parallel
    * The handling of mapping a local id to an index is now done in a
      per-function fashion rather than through `IdsToIndices`. This way the
      maps can be built in parallel and then aggregated at the end into the
      one global map serially.
    alexcrichton committed Jan 28, 2019
    Configuration menu
    Copy the full SHA
    59027fd View commit details
    Browse the repository at this point in the history
  2. Avoid collecting used locals twice

    Turns out we forgot that `Used` was already collecting used locals, so
    there's no need to do it again in `emit_locals`!
    alexcrichton committed Jan 28, 2019
    Configuration menu
    Copy the full SHA
    125d2c0 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    44d04ba View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    e16a6c1 View commit details
    Browse the repository at this point in the history