Skip to content

Commit f19009e

Browse files
benbrandtdicej
andauthored
Update deps (#108)
* Update deps Highlights are that all wasm-tools packages and wasmtime are at their latest versions. * Update to upstream wasm-convert * update wasmtime for security release * Update to wit-bindgen v0.19 * update to wit-bindgen 0.34.0 Signed-off-by: Joel Dice <joel.dice@fermyon.com> * Update to upstream component-init --------- Signed-off-by: Joel Dice <joel.dice@fermyon.com> Co-authored-by: Joel Dice <joel.dice@fermyon.com>
1 parent 5aa9438 commit f19009e

14 files changed

Lines changed: 463 additions & 501 deletions

File tree

Cargo.lock

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

Cargo.toml

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,52 +9,51 @@ name = "componentize_py"
99
crate-type = ["cdylib", "rlib"]
1010

1111
[dependencies]
12-
anyhow = { version = "1.0.86", features = ["backtrace"] }
13-
clap = { version = "4.5.17", features = ["derive"] }
14-
tar = "0.4.41"
15-
tempfile = "3.12.0"
12+
anyhow = { version = "1.0.89", features = ["backtrace"] }
13+
clap = { version = "4.5.20", features = ["derive"] }
14+
tar = "0.4.42"
15+
tempfile = "3.13.0"
1616
zstd = "0.13.2"
1717
componentize-py-shared = { path = "shared" }
18-
wasm-encoder = "0.216.0"
19-
wit-parser = "0.216.0"
20-
wit-component = "0.216.0"
21-
wasmparser = "0.216.0"
22-
indexmap = "2.5.0"
18+
wasm-encoder = "0.219.0"
19+
wit-parser = "0.219.0"
20+
wit-component = "0.219.0"
21+
wasmparser = "0.219.0"
22+
indexmap = "2.6.0"
2323
bincode = "1.3.3"
2424
heck = "0.5.0"
2525
pyo3 = { version = "0.20.0", features = [
2626
"abi3-py37",
2727
"extension-module",
2828
], optional = true }
29-
wasmtime = "24.0.0"
30-
wasmtime-wasi = "24.0.0"
31-
wasi-common = "24.0.0"
32-
once_cell = "1.19.0"
33-
component-init = { git = "https://github.com/dicej/component-init", rev = "bc276826" }
34-
wasm-convert = { git = "https://github.com/dicej/wasm-convert", rev = "afbec48b" }
35-
async-trait = "0.1.82"
36-
futures = "0.3.30"
29+
wasmtime = "25.0.2"
30+
wasmtime-wasi = "25.0.2"
31+
wasi-common = "25.0.2"
32+
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" }
35+
async-trait = "0.1.83"
36+
futures = "0.3.31"
3737
tokio = { version = "1.40.0", features = [
3838
"macros",
3939
"rt",
4040
"rt-multi-thread",
4141
"fs",
4242
] }
43-
bytes = "1.7.1"
43+
bytes = "1.7.2"
4444
pretty_env_logger = "0.5.0"
45-
cap-std = "3.2.0"
45+
cap-std = "3.3.0"
4646
im-rc = "15.1.0"
47-
serde = { version = "1.0.209", features = ["derive"] }
47+
serde = { version = "1.0.210", features = ["derive"] }
4848
toml = "0.8.19"
4949
semver = "1.0.23"
5050

5151
[dev-dependencies]
52-
async-trait = "0.1.82"
5352
proptest = "1.5.0"
5453
hex = "0.4.3"
5554

5655
[build-dependencies]
57-
anyhow = "1.0.86"
56+
anyhow = "1.0.89"
5857
tar = "0.4.41"
5958
zstd = "0.13.2"
6059
test-generator = { path = "test-generator" }

runtime/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ edition = "2021"
77
crate-type = ["staticlib"]
88

99
[dependencies]
10-
anyhow = "1.0.86"
11-
once_cell = "1.19.0"
10+
anyhow = "1.0.89"
11+
once_cell = "1.20.2"
1212
pyo3 = { version = "0.20.0", features = ["abi3-py311", "num-bigint"] }
1313
componentize-py-shared = { path = "../shared" }
1414
num-bigint = "0.4.6"
15-
wit-bindgen = "0.16.0"
15+
wit-bindgen = "0.34.0"

runtime/src/lib.rs

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ use {
2828
wit_bindgen::generate!({
2929
world: "init",
3030
path: "../wit",
31-
exports: {
32-
"exports": MyExports
33-
}
31+
generate_all,
3432
});
3533

34+
export!(MyExports);
35+
3636
static STUB_WASI: OnceCell<bool> = OnceCell::new();
3737
static EXPORTS: OnceCell<Vec<Export>> = OnceCell::new();
3838
static TYPES: OnceCell<Vec<Type>> = OnceCell::new();
@@ -1281,3 +1281,21 @@ pub mod dl {
12811281
static _CLOCK_PROCESS_CPUTIME_ID: u8 = 2;
12821282
#[no_mangle]
12831283
static _CLOCK_THREAD_CPUTIME_ID: u8 = 3;
1284+
1285+
// Traditionally, `wit-bindgen` would provide a `cabi_realloc` implementation, but recent versions use a weak
1286+
// symbol trick to avoid conflicts when more than one `wit-bindgen` version is used, and that trick does not
1287+
// currently play nice with how we build this library. So for now, we just define it ourselves here:
1288+
/// # Safety
1289+
/// TODO
1290+
#[export_name = "cabi_realloc"]
1291+
pub unsafe extern "C" fn cabi_realloc(
1292+
old_ptr: *mut u8,
1293+
old_len: usize,
1294+
align: usize,
1295+
new_size: usize,
1296+
) -> *mut u8 {
1297+
assert!(old_ptr.is_null());
1298+
assert!(old_len == 0);
1299+
1300+
alloc::alloc(Layout::from_size_align(new_size, align).unwrap())
1301+
}

src/bindings.rs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ pub fn make_bindings(
4444

4545
for (name, params, results) in IMPORT_SIGNATURES {
4646
let offset = types.len();
47-
types.function(params.iter().copied(), results.iter().copied());
47+
types
48+
.ty()
49+
.function(params.iter().copied(), results.iter().copied());
4850
imports.import("env", name, EntityType::Function(offset));
4951
function_names.push((offset, (*name).to_owned()));
5052
}
@@ -95,7 +97,7 @@ pub fn make_bindings(
9597
let (params, results) = function.core_import_type(resolve);
9698
let offset = types.len();
9799

98-
types.function(params, results);
100+
types.ty().function(params, results);
99101
imports.import(module, name, EntityType::Function(offset));
100102
function_names.push((
101103
offset,
@@ -176,7 +178,7 @@ pub fn make_bindings(
176178
for (index, function) in summary.functions.iter().enumerate() {
177179
let offset = types.len();
178180
let (params, results) = function.core_export_type(resolve);
179-
types.function(params, results);
181+
types.ty().function(params, results);
180182
functions.function(offset);
181183
function_names.push((offset, function.internal_name(resolve)));
182184
let mut gen = FunctionBindgen::new(summary, function, stack_pointer);
@@ -259,9 +261,13 @@ pub fn make_bindings(
259261

260262
{
261263
let dispatch_offset = types.len();
262-
types.function([ValType::I32; DISPATCH_CORE_PARAM_COUNT], []);
264+
types
265+
.ty()
266+
.function([ValType::I32; DISPATCH_CORE_PARAM_COUNT], []);
263267
let dispatchable_offset = types.len();
264-
types.function([ValType::I32; DISPATCHABLE_CORE_PARAM_COUNT], []);
268+
types
269+
.ty()
270+
.function([ValType::I32; DISPATCHABLE_CORE_PARAM_COUNT], []);
265271
functions.function(dispatch_offset);
266272
let name = "componentize-py#CallIndirect";
267273
function_names.push((dispatch_offset, name.to_owned()));
@@ -300,7 +306,7 @@ pub fn make_bindings(
300306
Some(0),
301307
&ConstExpr::global_get(table_base),
302308
Elements::Functions(
303-
&summary
309+
summary
304310
.functions
305311
.iter()
306312
.enumerate()
@@ -309,7 +315,8 @@ pub fn make_bindings(
309315
.is_dispatchable()
310316
.then_some(import_function_count + u32::try_from(index).unwrap())
311317
})
312-
.collect::<Vec<_>>(),
318+
.collect::<Vec<_>>()
319+
.into(),
313320
),
314321
);
315322

src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ impl Invoker for MyInvoker {
139139
Ok(result)
140140
}
141141

142-
async fn call_float32(&mut self, function: &str) -> Result<f32> {
142+
async fn call_f32(&mut self, function: &str) -> Result<f32> {
143143
let func = self
144144
.instance
145145
.get_typed_func::<(), (f32,)>(&mut self.store, function)?;
@@ -148,7 +148,7 @@ impl Invoker for MyInvoker {
148148
Ok(result)
149149
}
150150

151-
async fn call_float64(&mut self, function: &str) -> Result<f64> {
151+
async fn call_f64(&mut self, function: &str) -> Result<f64> {
152152
let func = self
153153
.instance
154154
.get_typed_func::<(), (f64,)>(&mut self.store, function)?;
@@ -532,7 +532,7 @@ pub async fn componentize(
532532

533533
let pre = InitPre::new(linker.instantiate_pre(component)?)?;
534534
let instance = pre.instance_pre.instantiate_async(&mut store).await?;
535-
let guest = pre.interface0.load(&mut store, &instance)?;
535+
let guest = pre.indices.interface0.load(&mut store, &instance)?;
536536

537537
guest
538538
.call_init(&mut store, &app_name, &symbols, stub_wasi)
@@ -721,7 +721,7 @@ fn make_stub_adapter(_module: &str, stubs: &HashMap<&str, FuncType>) -> Vec<u8>
721721

722722
for (index, (name, ty)) in stubs.iter().enumerate() {
723723
let index = u32::try_from(index).unwrap();
724-
types.function(
724+
types.ty().function(
725725
ty.params().iter().map(|&v| IntoValType(v).into()),
726726
ty.results().iter().map(|&v| IntoValType(v).into()),
727727
);

src/test.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,18 +82,18 @@ async fn make_component(
8282
}
8383

8484
#[derive(Debug, Copy, Clone)]
85-
struct MyFloat32(f32);
85+
struct MyF32(f32);
8686

87-
impl PartialEq<MyFloat32> for MyFloat32 {
87+
impl PartialEq<MyF32> for MyF32 {
8888
fn eq(&self, other: &Self) -> bool {
8989
(self.0.is_nan() && other.0.is_nan()) || (self.0 == other.0)
9090
}
9191
}
9292

9393
#[derive(Debug, Copy, Clone)]
94-
struct MyFloat64(f64);
94+
struct MyF64(f64);
9595

96-
impl PartialEq<MyFloat64> for MyFloat64 {
96+
impl PartialEq<MyF64> for MyF64 {
9797
fn eq(&self, other: &Self) -> bool {
9898
(self.0.is_nan() && other.0.is_nan()) || (self.0 == other.0)
9999
}

0 commit comments

Comments
 (0)