Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 52 additions & 45 deletions Cargo.lock

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

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ version = "0.1.0"
edition = "2021"

[dependencies]
anyhow = "1.0.86"
wasm-convert = { git = "https://github.com/dicej/wasm-convert", rev = "afbec48b" }
async-trait = "0.1.82"
futures = "0.3.30"
wasm-encoder = "0.216.0"
wasmparser = "0.216.0"
anyhow = "1.0.89"
wasm-convert = { git = "https://github.com/dicej/wasm-convert", rev = "a42b419" }
async-trait = "0.1.83"
futures = "0.3.31"
wasm-encoder = "0.219.0"
wasmparser = "0.219.0"
15 changes: 9 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ const MAX_CONSECUTIVE_ZEROS: usize = 64;
pub trait Invoker {
async fn call_s32(&mut self, function: &str) -> Result<i32>;
async fn call_s64(&mut self, function: &str) -> Result<i64>;
async fn call_float32(&mut self, function: &str) -> Result<f32>;
async fn call_float64(&mut self, function: &str) -> Result<f64>;
async fn call_f32(&mut self, function: &str) -> Result<f32>;
async fn call_f64(&mut self, function: &str) -> Result<f64>;
async fn call_list_u8(&mut self, function: &str) -> Result<Vec<u8>>;
}

Expand Down Expand Up @@ -326,6 +326,9 @@ pub async fn initialize_staged(
CanonicalFunction::Lift { .. } => {
function_count += 1;
}
// Unused for now
CanonicalFunction::ThreadSpawn { .. }
| CanonicalFunction::ThreadHwConcurrency => {}
}
}
copy_component_section(section, component_stage1, &mut instrumented_component);
Expand Down Expand Up @@ -386,7 +389,7 @@ pub async fn initialize_staged(
for (global_index, (name, ty)) in globals_to_export {
let ty = IntoValType(*ty).into();
let offset = types.len();
types.function([], [ty]);
types.ty().function([], [ty]);
let name = name.as_deref().unwrap();
imports.import(
&module_index.to_string(),
Expand Down Expand Up @@ -448,7 +451,7 @@ pub async fn initialize_staged(
),
};
let offset = types.len();
types.function([], [wasm_encoder::ValType::I32]);
types.ty().function([], [wasm_encoder::ValType::I32]);
imports.import(
&module_index.to_string(),
name,
Expand Down Expand Up @@ -558,13 +561,13 @@ pub async fn initialize_staged(
),
wasmparser::ValType::F32 => ConstExpr::f32_const(
invoker
.call_float32(name)
.call_f32(name)
.await
.with_context(|| name.to_owned())?,
),
wasmparser::ValType::F64 => ConstExpr::f64_const(
invoker
.call_float64(name)
.call_f64(name)
.await
.with_context(|| name.to_owned())?,
),
Expand Down