Skip to content
This repository has been archived by the owner on Mar 24, 2022. It is now read-only.

Commit

Permalink
Merge pull request #591 from bytecodealliance/pch/wasmtime_0.20
Browse files Browse the repository at this point in the history
Update to wasmtime 0.20
  • Loading branch information
pchickey committed Sep 24, 2020
2 parents 9761ce3 + f5efdac commit 7d6b3b4
Show file tree
Hide file tree
Showing 14 changed files with 127 additions and 112 deletions.
51 changes: 26 additions & 25 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lucet-module/Cargo.toml
Expand Up @@ -11,7 +11,7 @@ edition = "2018"

[dependencies]
anyhow = "1.0"
cranelift-entity = { path = "../wasmtime/cranelift/entity", version = "0.66.0" }
cranelift-entity = { path = "../wasmtime/cranelift/entity", version = "0.67.0" }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
bincode = "1.1.4"
Expand Down
2 changes: 1 addition & 1 deletion lucet-spectest/Cargo.toml
Expand Up @@ -25,5 +25,5 @@ serde = "1.0"
serde_json = "1.0"
clap="2.32"
tempfile = "3.0"
target-lexicon = "0.10"
target-lexicon = "0.11"
thiserror = "1.0.4"
2 changes: 1 addition & 1 deletion lucet-wasi-sdk/Cargo.toml
Expand Up @@ -19,4 +19,4 @@ thiserror = "1.0.4"
anyhow = "1"
lucetc = { path = "../lucetc", version = "=0.7.0-dev" }
lucet-wasi = { path = "../lucet-wasi", version = "=0.7.0-dev" }
target-lexicon = "0.10"
target-lexicon = "0.11"
3 changes: 2 additions & 1 deletion lucet-wasi/Cargo.toml
Expand Up @@ -22,7 +22,8 @@ lucet-wiggle = { path = "../lucet-wiggle", version = "=0.7.0-dev" }
libc = "0.2.65"
nix = "0.17"
rand = "0.6"
wasi-common = { path = "../wasmtime/crates/wasi-common", version = "0.19.0", default-features = false, features = ["wiggle_metadata"] }
wasi-common = { path = "../wasmtime/crates/wasi-common", version = "0.20.0", default-features = false, features = ["wiggle_metadata"] }
tracing = "0.1.19"
tracing-subscriber = "0.2.0"

[dev-dependencies]
Expand Down
4 changes: 2 additions & 2 deletions lucet-wasi/generate/Cargo.toml
Expand Up @@ -13,8 +13,8 @@ proc-macro = true

[dependencies]
lucet-wiggle = { path = "../../lucet-wiggle", version = "0.7.0-dev" }
wasi-common = { path = "../../wasmtime/crates/wasi-common", version = "0.19.0", features = ["wiggle_metadata"] }
wiggle-generate = { path = "../../wasmtime/crates/wiggle/generate", version = "0.19.0" }
wasi-common = { path = "../../wasmtime/crates/wasi-common", version = "0.20.0", features = ["wiggle_metadata"] }
wiggle-generate = { path = "../../wasmtime/crates/wiggle/generate", version = "0.20.0" }
syn = { version = "1.0", features = ["full"] }
quote = "1.0"
proc-macro2 = "1.0"
13 changes: 13 additions & 0 deletions lucet-wasi/generate/src/config.rs
Expand Up @@ -5,11 +5,13 @@ use syn::{
punctuated::Punctuated,
Error, Ident, Result, Token,
};
use wiggle_generate::config::ErrorConf;

#[derive(Debug, Clone)]
pub struct Config {
pub ctx_name: Ident,
pub constructor: TokenStream,
pub error_conf: Option<ErrorConf>,
pub pre_hook: Option<TokenStream>,
pub post_hook: Option<TokenStream>,
}
Expand All @@ -20,12 +22,14 @@ pub enum ConfigField {
Constructor(TokenStream),
PreHook(TokenStream),
PostHook(TokenStream),
Error(ErrorConf),
}
mod kw {
syn::custom_keyword!(ctx);
syn::custom_keyword!(constructor);
syn::custom_keyword!(pre_hook);
syn::custom_keyword!(post_hook);
syn::custom_keyword!(errors);
}

impl Parse for ConfigField {
Expand Down Expand Up @@ -53,6 +57,10 @@ impl Parse for ConfigField {
let contents;
let _lbrace = braced!(contents in input);
Ok(ConfigField::PostHook(contents.parse()?))
} else if lookahead.peek(kw::errors) {
input.parse::<kw::errors>()?;
input.parse::<Token![:]>()?;
Ok(ConfigField::Error(input.parse()?))
} else {
Err(lookahead.error())
}
Expand All @@ -65,6 +73,7 @@ impl Config {
let mut constructor = None;
let mut pre_hook = None;
let mut post_hook = None;
let mut error_conf = None;
for f in fields {
match f {
ConfigField::Constructor(c) => {
Expand All @@ -79,6 +88,9 @@ impl Config {
ConfigField::PostHook(c) => {
post_hook = Some(c);
}
ConfigField::Error(c) => {
error_conf = Some(c);
}
}
}
Ok(Config {
Expand All @@ -88,6 +100,7 @@ impl Config {
constructor: constructor
.take()
.ok_or_else(|| Error::new(err_loc, "`constructor` field required"))?,
error_conf: error_conf.take(),
pre_hook,
post_hook,
})
Expand Down
7 changes: 6 additions & 1 deletion lucet-wasi/generate/src/lib.rs
Expand Up @@ -12,7 +12,12 @@ pub fn bindings(args: TokenStream) -> TokenStream {
let doc = wasi_common::wasi::metadata::document();
let names = Names::new(&config.ctx_name, quote!(lucet_wiggle));

let error_transform = wiggle_generate::ErrorTransform::empty();
let error_transform = if let Some(error_conf) = config.error_conf {
wiggle_generate::ErrorTransform::new(&error_conf, &doc)
.expect("constructing error transform")
} else {
wiggle_generate::ErrorTransform::empty()
};

let modules = doc.modules().map(|module| {
let modname = names.module(&module.name);
Expand Down

0 comments on commit 7d6b3b4

Please sign in to comment.