Skip to content

Commit 0c8b57e

Browse files
authored
Bump to 38.0.0 (#297)
* Bump to 38.0.0 * Only test bindings generation on Linux * More trying to not run on Windows
1 parent 6cba270 commit 0c8b57e

File tree

11 files changed

+98
-81
lines changed

11 files changed

+98
-81
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
37.0.0
1+
38.0.0

ci/cbindgen.py

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# with lots of extra an unnecessary boilerplate.
88

99
from pycparser import c_ast, parse_file
10-
10+
import sys
1111

1212
class Visitor(c_ast.NodeVisitor):
1313
def __init__(self):
@@ -252,36 +252,38 @@ def type_name(ty, ptr=False, typing=False):
252252
raise RuntimeError("unknown {}".format(ty))
253253

254254

255-
ast = parse_file(
256-
'./wasmtime/include/wasmtime.h',
257-
use_cpp=True,
258-
cpp_path='gcc',
259-
cpp_args=[
260-
'-E',
261-
'-I./wasmtime/include',
262-
'-D__attribute__(x)=',
263-
'-D__asm__(x)=',
264-
'-D__asm(x)=',
265-
'-D__volatile__(x)=',
266-
'-D_Static_assert(x, y)=',
267-
'-Dstatic_assert(x, y)=',
268-
'-D__restrict=',
269-
'-D__restrict__=',
270-
'-D__extension__=',
271-
'-D__inline__=',
272-
'-D__signed=',
273-
'-D__builtin_va_list=int',
274-
]
275-
)
276-
277-
v = Visitor()
278-
v.visit(ast)
255+
def run():
256+
ast = parse_file(
257+
'./wasmtime/include/wasmtime.h',
258+
use_cpp=True,
259+
cpp_path='gcc',
260+
cpp_args=[
261+
'-E',
262+
'-I./wasmtime/include',
263+
'-D__attribute__(x)=',
264+
'-D__asm__(x)=',
265+
'-D__asm(x)=',
266+
'-D__volatile__(x)=',
267+
'-D_Static_assert(x, y)=',
268+
'-Dstatic_assert(x, y)=',
269+
'-D__restrict=',
270+
'-D__restrict__=',
271+
'-D__extension__=',
272+
'-D__inline__=',
273+
'-D__signed=',
274+
'-D__builtin_va_list=int',
275+
]
276+
)
277+
278+
v = Visitor()
279+
v.visit(ast)
280+
return v.ret
279281

280282
if __name__ == "__main__":
281283
with open("wasmtime/_bindings.py", "w") as f:
282-
f.write(v.ret)
283-
else:
284+
f.write(run())
285+
elif sys.platform == 'linux':
284286
with open("wasmtime/_bindings.py", "r") as f:
285287
contents = f.read()
286-
if contents != v.ret:
288+
if contents != run():
287289
raise RuntimeError("bindings need an update, run this script")

ci/download-wasmtime.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
# set to "dev" to download the latest or pick a tag from
1414
# https://github.com/bytecodealliance/wasmtime/tags
15-
WASMTIME_VERSION = "v37.0.2"
15+
WASMTIME_VERSION = "v38.0.1"
1616

1717

1818
def main(platform, arch):

rust/Cargo.lock

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

rust/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ heck = { version = "0.4", features = ["unicode"] }
1212
wit-parser = "0.239.0"
1313
wit-component = "0.239.0"
1414
indexmap = "2.0"
15-
wasmtime-environ = { version = "37.0.0", features = ['component-model', 'compile'] }
15+
wasmtime-environ = { version = "38.0.0", features = ['component-model', 'compile'] }
1616
wit-bindgen = "0.46.0"
1717
wit-bindgen-core = "0.46.0"
1818

rust/src/bindgen.rs

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -198,17 +198,32 @@ impl WasmtimePy {
198198
}
199199
Trampoline::Transcoder { .. } => unimplemented!(),
200200
Trampoline::AlwaysTrap => unimplemented!(),
201-
Trampoline::ResourceNew(idx) => {
202-
self.resource_trampolines
203-
.push((trampoline_index, Trampoline::ResourceNew(*idx)));
201+
Trampoline::ResourceNew { ty, instance } => {
202+
self.resource_trampolines.push((
203+
trampoline_index,
204+
Trampoline::ResourceNew {
205+
ty: *ty,
206+
instance: *instance,
207+
},
208+
));
204209
}
205-
Trampoline::ResourceRep(idx) => {
206-
self.resource_trampolines
207-
.push((trampoline_index, Trampoline::ResourceRep(*idx)));
210+
Trampoline::ResourceRep { ty, instance } => {
211+
self.resource_trampolines.push((
212+
trampoline_index,
213+
Trampoline::ResourceRep {
214+
ty: *ty,
215+
instance: *instance,
216+
},
217+
));
208218
}
209-
Trampoline::ResourceDrop(idx) => {
210-
self.resource_trampolines
211-
.push((trampoline_index, Trampoline::ResourceDrop(*idx)));
219+
Trampoline::ResourceDrop { ty, instance } => {
220+
self.resource_trampolines.push((
221+
trampoline_index,
222+
Trampoline::ResourceDrop {
223+
ty: *ty,
224+
instance: *instance,
225+
},
226+
));
212227
}
213228
Trampoline::ResourceEnterCall => unimplemented!(),
214229
Trampoline::ResourceExitCall => unimplemented!(),
@@ -248,8 +263,8 @@ impl WasmtimePy {
248263
Trampoline::PrepareCall { .. } => unimplemented!(),
249264
Trampoline::SyncStartCall { .. } => unimplemented!(),
250265
Trampoline::AsyncStartCall { .. } => unimplemented!(),
251-
Trampoline::ContextGet(_) => unimplemented!(),
252-
Trampoline::ContextSet(_) => unimplemented!(),
266+
Trampoline::ContextGet { .. } => unimplemented!(),
267+
Trampoline::ContextSet { .. } => unimplemented!(),
253268
Trampoline::BackpressureInc { .. } => unimplemented!(),
254269
Trampoline::BackpressureDec { .. } => unimplemented!(),
255270
}
@@ -615,7 +630,7 @@ impl<'a> Instantiator<'a> {
615630
for (tid, trampoline) in self.gen.resource_trampolines.iter() {
616631
let tidx = tid.as_u32();
617632
match trampoline {
618-
Trampoline::ResourceNew(rid) => {
633+
Trampoline::ResourceNew { ty: rid, .. } => {
619634
let resource_id = rid.as_u32();
620635
let handle_add = &format!("_handle_add_{resource_id}");
621636
uwriteln!(self.gen.init, "def _resource_new_{resource_id}(rep):");
@@ -631,7 +646,7 @@ impl<'a> Instantiator<'a> {
631646
"trampoline{tidx} = wasmtime.Func(store, _resource_new_{resource_id}_ty, _resource_new_{resource_id})"
632647
)
633648
}
634-
Trampoline::ResourceDrop(rid) => {
649+
Trampoline::ResourceDrop { ty: rid, .. } => {
635650
let resource_id = rid.as_u32();
636651
uwriteln!(self.gen.init, "def _resource_drop_{resource_id}(rep):");
637652
self.gen.init.indent();
@@ -646,7 +661,7 @@ impl<'a> Instantiator<'a> {
646661
"trampoline{tidx} = wasmtime.Func(store, _resource_drop_{resource_id}_ty, _resource_drop_{resource_id})"
647662
);
648663
}
649-
Trampoline::ResourceRep(rid) => {
664+
Trampoline::ResourceRep { ty: rid, .. } => {
650665
let resource_id = rid.as_u32();
651666
uwriteln!(self.gen.init, "def _resource_rep_{resource_id}(handle):");
652667
self.gen.init.indent();
@@ -672,9 +687,9 @@ impl<'a> Instantiator<'a> {
672687
.resource_trampolines
673688
.iter()
674689
.map(|(_, trampoline)| match trampoline {
675-
Trampoline::ResourceNew(idx)
676-
| Trampoline::ResourceRep(idx)
677-
| Trampoline::ResourceDrop(idx) => *idx,
690+
Trampoline::ResourceNew { ty, .. }
691+
| Trampoline::ResourceRep { ty, .. }
692+
| Trampoline::ResourceDrop { ty, .. } => *ty,
678693
_ => unreachable!(),
679694
})
680695
.collect::<Vec<_>>();

wasmtime/_bindings.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2822,15 +2822,15 @@ class wasmtime_anyref(Structure):
28222822

28232823
_wasmtime_anyref_clone = dll.wasmtime_anyref_clone
28242824
_wasmtime_anyref_clone.restype = None
2825-
_wasmtime_anyref_clone.argtypes = [POINTER(wasmtime_context_t), POINTER(wasmtime_anyref_t), POINTER(wasmtime_anyref_t)]
2826-
def wasmtime_anyref_clone(context: Any, anyref: Any, out: Any) -> None:
2827-
return _wasmtime_anyref_clone(context, anyref, out) # type: ignore
2825+
_wasmtime_anyref_clone.argtypes = [POINTER(wasmtime_anyref_t), POINTER(wasmtime_anyref_t)]
2826+
def wasmtime_anyref_clone(anyref: Any, out: Any) -> None:
2827+
return _wasmtime_anyref_clone(anyref, out) # type: ignore
28282828

28292829
_wasmtime_anyref_unroot = dll.wasmtime_anyref_unroot
28302830
_wasmtime_anyref_unroot.restype = None
2831-
_wasmtime_anyref_unroot.argtypes = [POINTER(wasmtime_context_t), POINTER(wasmtime_anyref_t)]
2832-
def wasmtime_anyref_unroot(context: Any, ref: Any) -> None:
2833-
return _wasmtime_anyref_unroot(context, ref) # type: ignore
2831+
_wasmtime_anyref_unroot.argtypes = [POINTER(wasmtime_anyref_t)]
2832+
def wasmtime_anyref_unroot(ref: Any) -> None:
2833+
return _wasmtime_anyref_unroot(ref) # type: ignore
28342834

28352835
_wasmtime_anyref_from_raw = dll.wasmtime_anyref_from_raw
28362836
_wasmtime_anyref_from_raw.restype = None
@@ -2890,15 +2890,15 @@ def wasmtime_externref_data(context: Any, data: Any) -> int:
28902890

28912891
_wasmtime_externref_clone = dll.wasmtime_externref_clone
28922892
_wasmtime_externref_clone.restype = None
2893-
_wasmtime_externref_clone.argtypes = [POINTER(wasmtime_context_t), POINTER(wasmtime_externref_t), POINTER(wasmtime_externref_t)]
2894-
def wasmtime_externref_clone(context: Any, ref: Any, out: Any) -> None:
2895-
return _wasmtime_externref_clone(context, ref, out) # type: ignore
2893+
_wasmtime_externref_clone.argtypes = [POINTER(wasmtime_externref_t), POINTER(wasmtime_externref_t)]
2894+
def wasmtime_externref_clone(ref: Any, out: Any) -> None:
2895+
return _wasmtime_externref_clone(ref, out) # type: ignore
28962896

28972897
_wasmtime_externref_unroot = dll.wasmtime_externref_unroot
28982898
_wasmtime_externref_unroot.restype = None
2899-
_wasmtime_externref_unroot.argtypes = [POINTER(wasmtime_context_t), POINTER(wasmtime_externref_t)]
2900-
def wasmtime_externref_unroot(context: Any, ref: Any) -> None:
2901-
return _wasmtime_externref_unroot(context, ref) # type: ignore
2899+
_wasmtime_externref_unroot.argtypes = [POINTER(wasmtime_externref_t)]
2900+
def wasmtime_externref_unroot(ref: Any) -> None:
2901+
return _wasmtime_externref_unroot(ref) # type: ignore
29022902

29032903
_wasmtime_externref_from_raw = dll.wasmtime_externref_from_raw
29042904
_wasmtime_externref_from_raw.restype = None
@@ -2972,15 +2972,15 @@ class wasmtime_val(Structure):
29722972

29732973
_wasmtime_val_unroot = dll.wasmtime_val_unroot
29742974
_wasmtime_val_unroot.restype = None
2975-
_wasmtime_val_unroot.argtypes = [POINTER(wasmtime_context_t), POINTER(wasmtime_val_t)]
2976-
def wasmtime_val_unroot(context: Any, val: Any) -> None:
2977-
return _wasmtime_val_unroot(context, val) # type: ignore
2975+
_wasmtime_val_unroot.argtypes = [POINTER(wasmtime_val_t)]
2976+
def wasmtime_val_unroot(val: Any) -> None:
2977+
return _wasmtime_val_unroot(val) # type: ignore
29782978

29792979
_wasmtime_val_clone = dll.wasmtime_val_clone
29802980
_wasmtime_val_clone.restype = None
2981-
_wasmtime_val_clone.argtypes = [POINTER(wasmtime_context_t), POINTER(wasmtime_val_t), POINTER(wasmtime_val_t)]
2982-
def wasmtime_val_clone(context: Any, src: Any, dst: Any) -> None:
2983-
return _wasmtime_val_clone(context, src, dst) # type: ignore
2981+
_wasmtime_val_clone.argtypes = [POINTER(wasmtime_val_t), POINTER(wasmtime_val_t)]
2982+
def wasmtime_val_clone(src: Any, dst: Any) -> None:
2983+
return _wasmtime_val_clone(src, dst) # type: ignore
29842984

29852985
class wasmtime_caller(Structure):
29862986
pass

wasmtime/_func.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def __call__(self, store: Storelike, *params: Any) -> Any:
103103
raise WasmtimeError._from_ptr(error)
104104
finally:
105105
for i in range(0, params_set):
106-
ffi.wasmtime_val_unroot(store._context(), byref(params_ptr[i]))
106+
ffi.wasmtime_val_unroot(byref(params_ptr[i]))
107107

108108
results = []
109109
for i in range(0, len(result_tys)):

wasmtime/_globals.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def __init__(self, store: Storelike, ty: GlobalType, val: Any):
1818
ty.ptr(),
1919
byref(val),
2020
byref(global_))
21-
ffi.wasmtime_val_unroot(store._context(), byref(val))
21+
ffi.wasmtime_val_unroot(byref(val))
2222
if error:
2323
raise WasmtimeError._from_ptr(error)
2424
self._global = global_
@@ -57,7 +57,7 @@ def set_value(self, store: Storelike, val: Any) -> None:
5757
"""
5858
val = Val._convert_to_raw(store, self.type(store).content, val)
5959
error = ffi.wasmtime_global_set(store._context(), byref(self._global), byref(val))
60-
ffi.wasmtime_val_unroot(store._context(), byref(val))
60+
ffi.wasmtime_val_unroot(byref(val))
6161
if error:
6262
raise WasmtimeError._from_ptr(error)
6363

wasmtime/_table.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def __init__(self, store: Store, ty: TableType, init: Any):
1717

1818
table = ffi.wasmtime_table_t()
1919
error = ffi.wasmtime_table_new(store._context(), ty.ptr(), byref(init_val), byref(table))
20-
ffi.wasmtime_val_unroot(store._context(), byref(init_val))
20+
ffi.wasmtime_val_unroot(byref(init_val))
2121
if error:
2222
raise WasmtimeError._from_ptr(error)
2323
self._table = table
@@ -53,7 +53,7 @@ def grow(self, store: Storelike, amt: int, init: Any) -> int:
5353
init_val = Val._convert_to_raw(store, self.type(store).element, init)
5454
prev = c_uint64(0)
5555
error = ffi.wasmtime_table_grow(store._context(), byref(self._table), c_uint64(amt), byref(init_val), byref(prev))
56-
ffi.wasmtime_val_unroot(store._context(), byref(init_val))
56+
ffi.wasmtime_val_unroot(byref(init_val))
5757
if error:
5858
raise WasmtimeError._from_ptr(error)
5959
return prev.value
@@ -96,7 +96,7 @@ def set(self, store: Store, idx: int, val: Any) -> None:
9696
"""
9797
value = Val._convert_to_raw(store, self.type(store).element, val)
9898
error = ffi.wasmtime_table_set(store._context(), byref(self._table), idx, byref(value))
99-
ffi.wasmtime_val_unroot(store._context(), byref(value))
99+
ffi.wasmtime_val_unroot(byref(value))
100100
if error:
101101
raise WasmtimeError._from_ptr(error)
102102

0 commit comments

Comments
 (0)