Skip to content

Commit d049d28

Browse files
committed
update deps
Note that I'm currently handling `Type::ErrorContext` (which is part of the new Component Model Async feature) as if it were just another integer type, which is not what we'll want once we properly add async support, but it's enough to satisfy the compiler for now. Signed-off-by: Joel Dice <joel.dice@fermyon.com>
1 parent c50822c commit d049d28

File tree

14 files changed

+434
-397
lines changed

14 files changed

+434
-397
lines changed

Cargo.lock

Lines changed: 342 additions & 300 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,23 @@ tar = "0.4.42"
1515
tempfile = "3.13.0"
1616
zstd = "0.13.2"
1717
componentize-py-shared = { path = "shared" }
18-
wasm-encoder = "0.219.0"
19-
wit-parser = "0.219.0"
20-
wit-component = "0.219.0"
21-
wasmparser = "0.219.0"
18+
wasm-encoder = "0.227.0"
19+
wit-parser = "0.227.0"
20+
wit-component = "0.227.0"
21+
wasmparser = "0.227.0"
2222
indexmap = "2.6.0"
2323
bincode = "1.3.3"
2424
heck = "0.5.0"
2525
pyo3 = { version = "0.22.5", features = [
2626
"abi3-py39",
2727
"extension-module",
2828
], optional = true }
29-
wasmtime = "25.0.2"
30-
wasmtime-wasi = "25.0.2"
31-
wasi-common = "25.0.2"
29+
wasmtime = "30.0.2"
30+
wasmtime-wasi = "30.0.2"
31+
wasi-common = "30.0.2"
3232
once_cell = "1.20.2"
33-
component-init = { git = "https://github.com/dicej/component-init", rev = "6964d14" }
34-
wasm-convert = { git = "https://github.com/dicej/wasm-convert", rev = "a42b419" }
33+
component-init = { git = "https://github.com/dicej/component-init", rev = "2db53ece" }
34+
wasm-convert = { git = "https://github.com/dicej/wasm-convert", rev = "713e2d6a" }
3535
async-trait = "0.1.83"
3636
futures = "0.3.31"
3737
tokio = { version = "1.41.0", features = [

runtime/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ once_cell = "1.20.2"
1212
pyo3 = { version = "0.22.5", features = ["abi3-py312", "num-bigint"] }
1313
componentize-py-shared = { path = "../shared" }
1414
num-bigint = "0.4.6"
15-
wit-bindgen = "0.34.0"
15+
wit-bindgen = { version = "0.40.0", default-features = false, features = ["macros", "realloc"] }
16+
wit-bindgen-rt = { version = "0.40.0" }

runtime/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
#![deny(warnings)]
2+
#![allow(
3+
clippy::useless_conversion,
4+
reason = "some pyo3 macros produce code that does this"
5+
)]
6+
#![allow(static_mut_refs, reason = "wit-bindgen produces code that does this")]
27

38
use {
49
anyhow::{Error, Result},

src/abi.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ pub fn has_pointer(resolve: &Resolve, ty: Type) -> bool {
120120
| Type::U64
121121
| Type::S64
122122
| Type::F32
123-
| Type::F64 => false,
123+
| Type::F64
124+
| Type::ErrorContext => false,
124125
Type::String => true,
125126
Type::Id(id) => match &resolve.types[id].kind {
126127
TypeDefKind::Record(record) => record
@@ -164,7 +165,7 @@ pub fn abi(resolve: &Resolve, ty: Type) -> Abi {
164165
align: 2,
165166
flattened: vec![ValType::I32],
166167
},
167-
Type::U32 | Type::S32 | Type::Char => Abi {
168+
Type::U32 | Type::S32 | Type::Char | Type::ErrorContext => Abi {
168169
size: 4,
169170
align: 4,
170171
flattened: vec![ValType::I32],

src/bindgen.rs

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use {
99
once_cell::sync::Lazy,
1010
std::collections::HashMap,
1111
wasm_encoder::{BlockType, Instruction as Ins, MemArg, ValType},
12-
wit_parser::{Handle, Resolve, Results, Type, TypeDefKind, TypeId},
12+
wit_parser::{Handle, Resolve, Type, TypeDefKind, TypeId},
1313
};
1414

1515
// Assume Wasm32
@@ -184,7 +184,7 @@ pub struct FunctionBindgen<'a> {
184184
stack_pointer: u32,
185185
types: &'a IndexSet<TypeId>,
186186
params: &'a [(String, Type)],
187-
results: &'a Results,
187+
result: &'a Option<Type>,
188188
params_abi: Abi,
189189
results_abi: Abi,
190190
local_stack: Vec<bool>,
@@ -204,9 +204,9 @@ impl<'a> FunctionBindgen<'a> {
204204
stack_pointer,
205205
types: &summary.types,
206206
params: function.params,
207-
results: function.results,
207+
result: function.result,
208208
params_abi: abi::record_abi(summary.resolve, function.params.types()),
209-
results_abi: abi::record_abi(summary.resolve, function.results.types()),
209+
results_abi: abi::record_abi(summary.resolve, function.result.types()),
210210
local_types: Vec::new(),
211211
local_stack: Vec::new(),
212212
instructions: Vec::new(),
@@ -332,7 +332,7 @@ impl<'a> FunctionBindgen<'a> {
332332
})
333333
.collect::<Vec<_>>();
334334

335-
self.from_canon_record(self.results.types(), context, &locals, output);
335+
self.from_canon_record(self.result.types(), context, &locals, output);
336336

337337
for (local, ty) in locals.iter().zip(&self.results_abi.flattened.clone()).rev() {
338338
self.pop_local(*local, *ty);
@@ -343,7 +343,7 @@ impl<'a> FunctionBindgen<'a> {
343343
self.get_stack();
344344
self.push(Ins::LocalSet(source));
345345

346-
self.load_record(self.results.types(), context, source, output);
346+
self.load_record(self.result.types(), context, source, output);
347347

348348
self.pop_local(source, ValType::I32);
349349
self.pop_stack(self.results_abi.size);
@@ -369,7 +369,7 @@ impl<'a> FunctionBindgen<'a> {
369369
}
370370

371371
pub fn compile_export(&mut self, index: i32, from_canon: i32, to_canon: i32) {
372-
let return_style = match self.results.types().collect::<Vec<_>>().as_slice() {
372+
let return_style = match self.result.types().collect::<Vec<_>>().as_slice() {
373373
[Type::Id(id)] if matches!(&self.resolve.types[*id].kind, TypeDefKind::Result(_)) => {
374374
ReturnStyle::Result
375375
}
@@ -429,7 +429,7 @@ impl<'a> FunctionBindgen<'a> {
429429
self.get_stack();
430430
self.push(Ins::LocalSet(source));
431431

432-
self.load_copy_record(self.results.types(), source);
432+
self.load_copy_record(self.result.types(), source);
433433

434434
self.pop_local(source, ValType::I32);
435435

@@ -462,7 +462,7 @@ impl<'a> FunctionBindgen<'a> {
462462

463463
let mut store_offset = 0;
464464
let mut load_offset = 0;
465-
for ty in self.results.types() {
465+
for ty in self.result.types() {
466466
let abi = abi::abi(self.resolve, ty);
467467
store_offset = abi::align(store_offset, abi.align);
468468

@@ -496,7 +496,7 @@ impl<'a> FunctionBindgen<'a> {
496496
// Arg 0: *mut MyResults
497497
let value = 0;
498498

499-
self.free_stored_record(self.results.types(), value);
499+
self.free_stored_record(self.result.types(), value);
500500

501501
self.push(Ins::LocalGet(value));
502502
self.push(Ins::I32Const(self.results_abi.size.try_into().unwrap()));
@@ -619,7 +619,7 @@ impl<'a> FunctionBindgen<'a> {
619619
*IMPORTS.get("componentize-py#ToCanonI32").unwrap(),
620620
));
621621
}
622-
Type::U8 | Type::U16 | Type::U32 => {
622+
Type::U8 | Type::U16 | Type::U32 | Type::ErrorContext => {
623623
self.push(Ins::LocalGet(context));
624624
self.push(Ins::LocalGet(value));
625625
self.push(Ins::Call(
@@ -920,7 +920,7 @@ impl<'a> FunctionBindgen<'a> {
920920
self.to_canon(ty, context, value);
921921
self.push(Ins::I32Store16(mem_arg(0, 1)));
922922
}
923-
Type::U32 | Type::S32 => {
923+
Type::U32 | Type::S32 | Type::ErrorContext => {
924924
self.push(Ins::LocalGet(destination));
925925
self.to_canon(ty, context, value);
926926
self.push(Ins::I32Store(mem_arg(0, 2)));
@@ -1212,7 +1212,7 @@ impl<'a> FunctionBindgen<'a> {
12121212
self.push(Ins::LocalGet(source[0]));
12131213
self.push(Ins::I32Store16(mem_arg(0, 1)));
12141214
}
1215-
Type::U32 | Type::S32 | Type::Char => {
1215+
Type::U32 | Type::S32 | Type::Char | Type::ErrorContext => {
12161216
self.push(Ins::LocalGet(destination));
12171217
self.push(Ins::LocalGet(source[0]));
12181218
self.push(Ins::I32Store(mem_arg(0, 2)));
@@ -1458,7 +1458,7 @@ impl<'a> FunctionBindgen<'a> {
14581458
*IMPORTS.get("componentize-py#FromCanonI32").unwrap(),
14591459
));
14601460
}
1461-
Type::U8 | Type::U16 | Type::U32 => {
1461+
Type::U8 | Type::U16 | Type::U32 | Type::ErrorContext => {
14621462
self.push(Ins::LocalGet(context));
14631463
self.push(Ins::LocalGet(value[0]));
14641464
self.push(Ins::Call(
@@ -1793,7 +1793,7 @@ impl<'a> FunctionBindgen<'a> {
17931793
self.from_canon(ty, context, &[value]);
17941794
self.pop_local(value, ValType::I32);
17951795
}
1796-
Type::U32 | Type::S32 | Type::Char => {
1796+
Type::U32 | Type::S32 | Type::Char | Type::ErrorContext => {
17971797
let value = self.push_local(ValType::I32);
17981798
self.push(Ins::LocalGet(source));
17991799
self.push(Ins::I32Load(mem_arg(0, 2)));
@@ -2091,7 +2091,7 @@ impl<'a> FunctionBindgen<'a> {
20912091
self.push(Ins::LocalGet(source));
20922092
self.push(Ins::I32Load16S(mem_arg(0, 1)));
20932093
}
2094-
Type::U32 | Type::S32 | Type::Char => {
2094+
Type::U32 | Type::S32 | Type::Char | Type::ErrorContext => {
20952095
self.push(Ins::LocalGet(source));
20962096
self.push(Ins::I32Load(mem_arg(0, 2)));
20972097
}
@@ -2307,7 +2307,8 @@ impl<'a> FunctionBindgen<'a> {
23072307
| Type::U64
23082308
| Type::S64
23092309
| Type::F32
2310-
| Type::F64 => {}
2310+
| Type::F64
2311+
| Type::ErrorContext => {}
23112312

23122313
Type::String => {
23132314
self.push(Ins::LocalGet(value[0]));
@@ -2466,7 +2467,8 @@ impl<'a> FunctionBindgen<'a> {
24662467
| Type::U64
24672468
| Type::S64
24682469
| Type::F32
2469-
| Type::F64 => {}
2470+
| Type::F64
2471+
| Type::ErrorContext => {}
24702472

24712473
Type::String => {
24722474
self.push(Ins::LocalGet(value));

src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use {
2323
},
2424
wasmtime_wasi::{
2525
pipe::{MemoryInputPipe, MemoryOutputPipe},
26-
DirPerms, FilePerms, WasiCtx, WasiCtxBuilder, WasiView,
26+
DirPerms, FilePerms, IoView, WasiCtx, WasiCtxBuilder, WasiView,
2727
},
2828
wit_parser::{Resolve, TypeDefKind, UnresolvedPackageGroup, WorldId, WorldItem, WorldKey},
2929
};
@@ -63,6 +63,9 @@ impl WasiView for Ctx {
6363
fn ctx(&mut self) -> &mut WasiCtx {
6464
&mut self.wasi
6565
}
66+
}
67+
68+
impl IoView for Ctx {
6669
fn table(&mut self) -> &mut ResourceTable {
6770
&mut self.table
6871
}

src/python.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
#![allow(
2+
clippy::useless_conversion,
3+
reason = "some pyo3 macros produce code that does this"
4+
)]
5+
16
use {
27
pyo3::{
38
exceptions::PyAssertionError,

0 commit comments

Comments
 (0)