Move all trampoline compilation to wasmtime-cranelift (#3176)

* Move all trampoline compilation to `wasmtime-cranelift`

This commit moves compilation of all the trampolines used in wasmtime
behind the `Compiler` trait object to live in `wasmtime-cranelift`. The
long-term goal of this is to enable depending on cranelift *only* from
the `wasmtime-cranelift` crate, so by moving these dependencies we
should make that a little more flexible.

* Fix windows build
This commit is contained in:
Alex Crichton
2021-08-12 16:58:21 -05:00
committed by GitHub
parent 2da1b9d375
commit e9f33fc618
24 changed files with 396 additions and 482 deletions

View File

@@ -7,6 +7,7 @@ use crate::code_memory::CodeMemory;
use crate::compiler::{Compilation, Compiler};
use crate::link::link_module;
use crate::object::ObjectUnwindInfo;
use anyhow::{Context, Result};
use object::File as ObjectFile;
use serde::{Deserialize, Serialize};
use std::ops::Range;
@@ -483,16 +484,13 @@ fn build_code_memory(
obj: &[u8],
module: &Module,
unwind_info: &[ObjectUnwindInfo],
) -> Result<
(
CodeMemory,
(*const u8, usize),
PrimaryMap<DefinedFuncIndex, *mut [VMFunctionBody]>,
Vec<(SignatureIndex, VMTrampoline)>,
),
String,
> {
let obj = ObjectFile::parse(obj).map_err(|_| "Unable to read obj".to_string())?;
) -> Result<(
CodeMemory,
(*const u8, usize),
PrimaryMap<DefinedFuncIndex, *mut [VMFunctionBody]>,
Vec<(SignatureIndex, VMTrampoline)>,
)> {
let obj = ObjectFile::parse(obj).with_context(|| "Unable to read obj")?;
let mut code_memory = CodeMemory::new();