Merge pull request #3009 from bjorn3/bye_x86_backend

[RFC] Remove the old x86 backend
This commit is contained in:
Chris Fallin
2021-09-30 09:20:14 -07:00
committed by GitHub
383 changed files with 258 additions and 40125 deletions

View File

@@ -31,4 +31,3 @@ wat = "1.0"
default = ["shuffling-allocator"]
wasi-crypto = ["wasmtime-wasi-crypto"]
wasi-nn = ["wasmtime-wasi-nn"]
old-x86-backend = ["wasmtime/old-x86-backend"]

View File

@@ -27,4 +27,3 @@ thiserror = "1.0.4"
[features]
all-arch = ["cranelift-codegen/all-arch"]
old-x86-backend = ["cranelift-codegen/old-x86-backend"]

View File

@@ -71,9 +71,6 @@ parallel-compilation = ["rayon"]
# Enables support for automatic cache configuration to be enabled in `Config`.
cache = ["wasmtime-cache"]
# Use Cranelift's old x86 backend.
old-x86-backend = ["wasmtime-cranelift/old-x86-backend"]
# Enables support for "async stores" as well as defining host functions as
# `async fn` and calling functions asynchronously.
async = ["wasmtime-fiber", "wasmtime-runtime/async"]

View File

@@ -1129,9 +1129,7 @@ impl Func {
/// and similarly if a function has multiple results you can bind that too
///
/// ```
/// # #[cfg(not(feature = "old-x86-backend"))]
/// # use wasmtime::*;
/// # #[cfg(not(feature = "old-x86-backend"))]
/// # fn foo(add_with_overflow: &Func, mut store: Store<()>) -> anyhow::Result<()> {
/// let typed = add_with_overflow.typed::<(u32, u32), (u32, i32), _>(&store)?;
/// let (result, overflow) = typed.call(&mut store, (u32::max_value(), 2))?;
@@ -1564,12 +1562,10 @@ macro_rules! impl_host_abi {
#[doc(hidden)]
#[allow(non_snake_case)]
#[repr(C)]
#[cfg(not(feature = "old-x86-backend"))]
pub struct [<TupleRet $n>]<$($u,)*> {
$($u: $u,)*
}
#[cfg(not(feature = "old-x86-backend"))]
#[allow(non_snake_case, unused_assignments)]
impl<$t: Copy, $($u: Copy,)*> HostAbi for ($t, $($u,)*) {
type Abi = $t;

View File

@@ -134,54 +134,7 @@ impl ModuleInfo for RegisteredModule {
// Because we know we are in Wasm code, and we must be at some kind
// of call/safepoint, then the Cranelift backend must have avoided
// emitting a stack map for this location because no refs were live.
#[cfg(not(feature = "old-x86-backend"))]
Err(_) => return None,
// ### Old x86_64 backend specific code.
//
// Because GC safepoints are technically only associated with a
// single PC, we should ideally only care about `Ok(index)` values
// returned from the binary search. However, safepoints are inserted
// right before calls, and there are two things that can disturb the
// PC/offset associated with the safepoint versus the PC we actually
// use to query for the stack map:
//
// 1. The `backtrace` crate gives us the PC in a frame that will be
// *returned to*, and where execution will continue from, rather than
// the PC of the call we are currently at. So we would need to
// disassemble one instruction backwards to query the actual PC for
// the stack map.
//
// TODO: One thing we *could* do to make this a little less error
// prone, would be to assert/check that the nearest GC safepoint
// found is within `max_encoded_size(any kind of call instruction)`
// our queried PC for the target architecture.
//
// 2. Cranelift's stack maps only handle the stack, not
// registers. However, some references that are arguments to a call
// may need to be in registers. In these cases, what Cranelift will
// do is:
//
// a. spill all the live references,
// b. insert a GC safepoint for those references,
// c. reload the references into registers, and finally
// d. make the call.
//
// Step (c) adds drift between the GC safepoint and the location of
// the call, which is where we actually walk the stack frame and
// collect its live references.
//
// Luckily, the spill stack slots for the live references are still
// up to date, so we can still find all the on-stack roots.
// Furthermore, we do not have a moving GC, so we don't need to worry
// whether the following code will reuse the references in registers
// (which would not have been updated to point to the moved objects)
// or reload from the stack slots (which would have been updated to
// point to the moved objects).
#[cfg(feature = "old-x86-backend")]
Err(0) => return None,
#[cfg(feature = "old-x86-backend")]
Err(i) => i - 1,
};
Some(&info.stack_maps[index].stack_map)