Skip to content

Remove dependency on TargetIsa from Wasmtime crates #3178

Merged
alexcrichton merged 1 commit intobytecodealliance:mainfrom
alexcrichton:less-target-isa
Aug 16, 2021
Merged

Remove dependency on TargetIsa from Wasmtime crates #3178
alexcrichton merged 1 commit intobytecodealliance:mainfrom
alexcrichton:less-target-isa

Conversation

@alexcrichton
Copy link
Member

@alexcrichton alexcrichton commented Aug 11, 2021

This commit started off by deleting the cranelift_codegen::settings
reexport in the wasmtime-environ crate and then basically played
whack-a-mole until everything compiled again. The main result of this is
that the wasmtime-* family of crates have generally less of a
dependency on the TargetIsa trait and type from Cranelift. While the
dependency isn't entirely severed yet this is at least a significant
start.

This commit is intended to be largely refactorings, no functional
changes are intended here. The refactorings are:

  • A CompilerBuilder trait has been added to wasmtime_environ which
    server as an abstraction used to create compilers and configure them
    in a uniform fashion. The wasmtime::Config type now uses this
    instead of cranelift-specific settings. The wasmtime-jit crate
    exports the ability to create a compiler builder from a
    CompilationStrategy, which only works for Cranelift right now. In a
    cranelift-less build of Wasmtime this is expected to return a trait
    object that fails all requests to compile.

  • The Compiler trait in the wasmtime_environ crate has been souped
    up with a number of methods that Wasmtime and other crates needed.

  • The wasmtime-debug crate is now moved entirely behind the
    wasmtime-cranelift crate.

  • The wasmtime-cranelift crate is now only depended on by the
    wasmtime-jit crate.

  • Wasm types in cranelift-wasm no longer contain their IR type,
    instead they only contain the WasmType. This is required to get
    everything to align correctly but will also be required in a future
    refactoring where the types used by cranelift-wasm will be extracted
    to a separate crate.

  • I moved around a fair bit of code in wasmtime-cranelift.

  • Some gdb-specific jit-specific code has moved from wasmtime-debug to
    wasmtime-jit.

Note that this is built on #3176, but I wanted to keep all these refactorings ideally bite-ish sized to be more easily digestable

@github-actions github-actions bot added cranelift Issues related to the Cranelift code generator cranelift:wasm lightbeam Issues related to the Lightbeam compiler labels Aug 11, 2021
@alexcrichton alexcrichton force-pushed the less-target-isa branch 3 times, most recently from e1eb4e3 to e65df46 Compare August 12, 2021 22:08
This commit started off by deleting the `cranelift_codegen::settings`
reexport in the `wasmtime-environ` crate and then basically played
whack-a-mole until everything compiled again. The main result of this is
that the `wasmtime-*` family of crates have generally less of a
dependency on the `TargetIsa` trait and type from Cranelift. While the
dependency isn't entirely severed yet this is at least a significant
start.

This commit is intended to be largely refactorings, no functional
changes are intended here. The refactorings are:

* A `CompilerBuilder` trait has been added to `wasmtime_environ` which
  server as an abstraction used to create compilers and configure them
  in a uniform fashion. The `wasmtime::Config` type now uses this
  instead of cranelift-specific settings. The `wasmtime-jit` crate
  exports the ability to create a compiler builder from a
  `CompilationStrategy`, which only works for Cranelift right now. In a
  cranelift-less build of Wasmtime this is expected to return a trait
  object that fails all requests to compile.

* The `Compiler` trait in the `wasmtime_environ` crate has been souped
  up with a number of methods that Wasmtime and other crates needed.

* The `wasmtime-debug` crate is now moved entirely behind the
  `wasmtime-cranelift` crate.

* The `wasmtime-cranelift` crate is now only depended on by the
  `wasmtime-jit` crate.

* Wasm types in `cranelift-wasm` no longer contain their IR type,
  instead they only contain the `WasmType`. This is required to get
  everything to align correctly but will also be required in a future
  refactoring where the types used by `cranelift-wasm` will be extracted
  to a separate crate.

* I moved around a fair bit of code in `wasmtime-cranelift`.

* Some gdb-specific jit-specific code has moved from `wasmtime-debug` to
  `wasmtime-jit`.
style: TableStyle::CallerChecksSignature,
table: Table {
wasm_ty: WasmType::FuncRef,
ty: TableElementType::Func,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am grateful that we have gotten rid of all these redundant duplications!

@alexcrichton alexcrichton merged commit 0313e30 into bytecodealliance:main Aug 16, 2021
@alexcrichton alexcrichton deleted the less-target-isa branch August 16, 2021 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cranelift:wasm cranelift Issues related to the Cranelift code generator lightbeam Issues related to the Lightbeam compiler

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants