Merge branch 'master' into feat-c-api-cross-compilation-2

This commit is contained in:
Ivan Enderlin
2021-02-02 09:51:01 +01:00
10 changed files with 38 additions and 37 deletions

View File

@@ -3,7 +3,7 @@ name: Run Benchmarks and upload results
on:
push:
branches:
- master
- benchmark # TODO: change it back to master once we really track the results. We commented this as speed.wasmer.io is failing
jobs:
run_benchmark:

View File

@@ -43,14 +43,14 @@ jobs:
- build: linux-x64
os: ubuntu-18.04
rust: 1.48
llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/10.x/linux-amd64.tar.gz'
llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/11.x/linux-amd64.tar.gz'
artifact_name: 'wasmer-linux-amd64'
cross_compilation_artifact_name: 'cross_compiled_from_linux'
run_integration_tests: true
- build: macos-x64
os: macos-latest
rust: 1.48
llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/10.x/darwin-amd64.tar.gz'
llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/11.x/darwin-amd64.tar.gz'
artifact_name: 'wasmer-darwin-amd64'
cross_compilation_artifact_name: 'cross_compiled_from_mac'
run_integration_tests: true
@@ -62,7 +62,7 @@ jobs:
- build: windows-x64
os: windows-latest
rust: 1.48
# llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/10.x/windows-amd64.tar.gz'
# llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/11.x/windows-amd64.tar.gz'
artifact_name: 'wasmer-windows-amd64'
cross_compilation_artifact_name: 'cross_compiled_from_win'
run_integration_tests: true
@@ -70,7 +70,7 @@ jobs:
os: [self-hosted, linux, ARM64]
random_sccache_port: true
rust: 1.48
llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/10.x/linux-aarch64.tar.gz'
llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/11.x/linux-aarch64.tar.gz'
artifact_name: 'wasmer-linux-aarch64'
run_integration_tests: false
env:
@@ -108,9 +108,9 @@ jobs:
mkdir ${{ env.LLVM_DIR }}
tar xf llvm.tar.gz --strip-components=1 -C ${{ env.LLVM_DIR }}
echo "${{ env.LLVM_DIR }}/bin" >> $GITHUB_PATH
echo "LLVM_SYS_100_PREFIX=${{ env.LLVM_DIR }}" >> $GITHUB_ENV
echo "LLVM_SYS_110_PREFIX=${{ env.LLVM_DIR }}" >> $GITHUB_ENV
env:
LLVM_DIR: ${{ github.workspace }}/llvm-10
LLVM_DIR: ${{ github.workspace }}/llvm-11
- name: Set up dependencies for Mac OS
run: |
brew install automake

View File

@@ -18,6 +18,7 @@
- [#2056](https://github.com/wasmerio/wasmer/pull/2056) Change back to depend on the `enumset` crate instead of `wasmer_enumset`
### Fixed
- [#2084](https://github.com/wasmerio/wasmer/pull/2084) Avoid calling the function environment finalizer more than once when the environment has been cloned in the C API.
- [#2069](https://github.com/wasmerio/wasmer/pull/2069) Use the new documentation for `include/README.md` in the Wasmer package.
- [#2042](https://github.com/wasmerio/wasmer/pull/2042) Parse more exotic environment variables in `wasmer run`.
- [#2041](https://github.com/wasmerio/wasmer/pull/2041) Documentation diagrams now have a solid white background rather than a transparent background.

14
Cargo.lock generated
View File

@@ -971,9 +971,9 @@ dependencies = [
[[package]]
name = "inkwell"
version = "0.1.0-llvm10sample"
version = "0.1.0-beta.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e079c12273d96e41481454a37ad968e607e1ce51b39b9facd3a802a12df6e9dc"
checksum = "f5fe0be1e47c0c0f3da4397693e08f5d78329ae095c25d529e12ade78420fb41"
dependencies = [
"either",
"inkwell_internals",
@@ -986,9 +986,9 @@ dependencies = [
[[package]]
name = "inkwell_internals"
version = "0.2.0"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b22cf4eda09069b48204cce4b7cd9a25311da813780e95a038524f2210fab44e"
checksum = "c2e1f71330ccec54ee62533ae88574c4169b67fb4b95cbb1196a1322582abd11"
dependencies = [
"proc-macro2",
"quote",
@@ -1128,15 +1128,15 @@ dependencies = [
[[package]]
name = "llvm-sys"
version = "100.2.0"
version = "110.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9109e19fbfac3458f2970189719fa19f1007c6fd4e08c44fdebf4be0ddbe261d"
checksum = "b0062a0c6635fb5d57c6ebba072dcae50e41651030363cf06d220b0d016840f2"
dependencies = [
"cc",
"lazy_static",
"libc",
"regex",
"semver 0.9.0",
"semver 0.11.0",
]
[[package]]

View File

@@ -163,7 +163,7 @@ build-docs:
build-docs-capi:
cd lib/c-api/doc/deprecated/ && doxygen doxyfile
cargo doc --manifest-path lib/c-api/Cargo.toml --no-deps --features wat,jit,object-file,native,cranelift,wasi
cargo doc --manifest-path lib/c-api/Cargo.toml --no-deps --features wat,jit,object-file,native,cranelift,wasi $(capi_default_features)
# We use cranelift as the default backend for the capi for now
build-capi: build-capi-cranelift

View File

@@ -105,7 +105,7 @@ pub unsafe extern "C" fn wasm_func_new_with_env(
#[repr(C)]
struct WrapperEnv {
env: *mut c_void,
finalizer: Option<wasm_env_finalizer_t>,
finalizer: Arc<Option<wasm_env_finalizer_t>>,
}
// Only relevant when using multiple threads in the C API;
@@ -115,11 +115,16 @@ pub unsafe extern "C" fn wasm_func_new_with_env(
impl Drop for WrapperEnv {
fn drop(&mut self) {
if let Some(finalizer) = self.finalizer {
if let Some(finalizer) = Arc::get_mut(&mut self.finalizer)
.map(Option::take)
.flatten()
{
if !self.env.is_null() {
unsafe { (finalizer)(self.env as _) }
}
}
}
}
let inner_callback = move |env: &WrapperEnv, args: &[Val]| -> Result<Vec<Val>, RuntimeError> {
let processed_args: wasm_val_vec_t = args
@@ -160,7 +165,10 @@ pub unsafe extern "C" fn wasm_func_new_with_env(
let function = Function::new_with_env(
&store.inner,
func_sig,
WrapperEnv { env, finalizer },
WrapperEnv {
env,
finalizer: Arc::new(finalizer),
},
inner_callback,
);

View File

@@ -24,9 +24,9 @@ itertools = "0.9"
rayon = "1.5"
[dependencies.inkwell]
version = "=0.1.0-llvm10sample"
version = "=0.1.0-beta.2"
default-features = false
features = ["llvm10-0", "target-x86", "target-aarch64"]
features = ["llvm11-0", "target-x86", "target-aarch64"]
[build-dependencies]
cc = "1.0"

View File

@@ -5674,13 +5674,7 @@ impl<'a> FuncGen<'a> {
);
self.emit_call_sysv(
|this| {
let label = this.assembler.get_label();
let after = this.assembler.get_label();
this.assembler.emit_jmp(Condition::None, after);
this.assembler.emit_label(label);
this.assembler.emit_host_redirection(GPR::RAX);
this.assembler.emit_label(after);
this.assembler.emit_call_label(label);
this.assembler.emit_call_register(GPR::RAX);
},
// [vmctx, memory_index]
iter::once(Location::Imm32(memory_index.index() as u32)),
@@ -5719,13 +5713,7 @@ impl<'a> FuncGen<'a> {
self.emit_call_sysv(
|this| {
let label = this.assembler.get_label();
let after = this.assembler.get_label();
this.assembler.emit_jmp(Condition::None, after);
this.assembler.emit_label(label);
this.assembler.emit_host_redirection(GPR::RAX);
this.assembler.emit_label(after);
this.assembler.emit_call_label(label);
this.assembler.emit_call_register(GPR::RAX);
},
// [vmctx, val, memory_index]
iter::once(param_pages)

View File

@@ -205,6 +205,8 @@ pub trait Emitter {
fn emit_call_label(&mut self, label: Self::Label);
fn emit_call_location(&mut self, loc: Location);
fn emit_call_register(&mut self, reg: GPR);
fn emit_bkpt(&mut self);
fn emit_host_redirection(&mut self, target: GPR);
@@ -1389,6 +1391,10 @@ impl Emitter for Assembler {
}
}
fn emit_call_register(&mut self, reg: GPR) {
dynasm!(self ; call Rq(reg as u8));
}
fn emit_bkpt(&mut self) {
dynasm!(self ; int 0x3);
}

View File

@@ -20,8 +20,6 @@ let wasi_env = WasiState::new("command name")
let import_object = wasi_env.import_object(&module)?;
let instance = Instance::new(&module, &import_object)?;
wasi_env.set_memory(instance.exports.get_memory("memory")?.clone());
let start = instance.exports.get_function("_start")?;
start.call(&[])?;
```