Skip to content

Commit 3e58410

Browse files
authored
Bump to 40.0.0 (#325)
1 parent 48a2b8e commit 3e58410

File tree

5 files changed

+37
-10
lines changed

5 files changed

+37
-10
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
39.0.0
1+
40.0.0

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 = "v39.0.0"
15+
WASMTIME_VERSION = "v40.0.0"
1616

1717

1818
def main(platform, arch):

tests/test_shared_memory.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@
22

33
from wasmtime import *
44

5+
def engine_with_shared_memory() -> Engine:
6+
config = Config()
7+
config.shared_memory = True
8+
return Engine(config)
59

610
class TestSharedMemory(unittest.TestCase):
711
def test_new(self):
8-
engine = Store().engine
12+
engine = engine_with_shared_memory()
913
memory_type = MemoryType(Limits(1, 2), is_64=False, shared=True)
1014
assert(not memory_type.is_64)
1115
shared_memory = SharedMemory(engine, memory_type)
@@ -18,7 +22,7 @@ def test_new(self):
1822
self.assertTrue(isinstance(shared_memory.type(), MemoryType))
1923

2024
def test_grow(self):
21-
engine = Store().engine
25+
engine = engine_with_shared_memory()
2226
memory_type = MemoryType(Limits(1, 2), shared=True)
2327
shared_memory = SharedMemory(engine, memory_type)
2428
assert(shared_memory.grow(1) == 1)
@@ -27,7 +31,7 @@ def test_grow(self):
2731
shared_memory.grow(1)
2832

2933
def test_errors(self):
30-
engine = Store().engine
34+
engine = engine_with_shared_memory()
3135
ty = MemoryType(Limits(1, 2), shared=True)
3236
with self.assertRaises(AttributeError):
3337
SharedMemory(1, ty) # type: ignore
@@ -44,13 +48,13 @@ def test_shared_memory_type_works_if_min_max_i64_is_set(self):
4448
assert(ty.limits.min == 0x100000000)
4549
assert(ty.limits.max == 0x100000000)
4650
assert(ty.is_64)
47-
51+
4852
def test_shared_memory_type_fails_if_is_too_large(self):
4953
with self.assertRaises(WasmtimeError):
5054
MemoryType(Limits(1, 0x100000000), shared=True)
5155

5256
def test_memory_type_has_to_be_shared(self):
53-
engine = Store().engine
57+
engine = engine_with_shared_memory()
5458
ty = MemoryType(Limits(1, 2))
5559
with self.assertRaises(WasmtimeError):
5660
SharedMemory(engine, ty)

wasmtime/_bindings.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2087,6 +2087,12 @@ def wasmtime_config_max_wasm_stack_set(arg0: Any, arg1: Any) -> None:
20872087
def wasmtime_config_wasm_threads_set(arg0: Any, arg1: Any) -> None:
20882088
return _wasmtime_config_wasm_threads_set(arg0, arg1) # type: ignore
20892089

2090+
_wasmtime_config_shared_memory_set = dll.wasmtime_config_shared_memory_set
2091+
_wasmtime_config_shared_memory_set.restype = None
2092+
_wasmtime_config_shared_memory_set.argtypes = [ctypes.POINTER(wasm_config_t), ctypes.c_bool]
2093+
def wasmtime_config_shared_memory_set(arg0: Any, arg1: Any) -> None:
2094+
return _wasmtime_config_shared_memory_set(arg0, arg1) # type: ignore
2095+
20902096
_wasmtime_config_wasm_tail_call_set = dll.wasmtime_config_wasm_tail_call_set
20912097
_wasmtime_config_wasm_tail_call_set.restype = None
20922098
_wasmtime_config_wasm_tail_call_set.argtypes = [ctypes.POINTER(wasm_config_t), ctypes.c_bool]
@@ -3318,9 +3324,9 @@ class wasmtime_guestprofiler_modules(ctypes.Structure):
33183324

33193325
_wasmtime_guestprofiler_new = dll.wasmtime_guestprofiler_new
33203326
_wasmtime_guestprofiler_new.restype = ctypes.POINTER(wasmtime_guestprofiler_t)
3321-
_wasmtime_guestprofiler_new.argtypes = [ctypes.POINTER(wasm_name_t), ctypes.c_uint64, ctypes.POINTER(wasmtime_guestprofiler_modules_t), ctypes.c_size_t]
3322-
def wasmtime_guestprofiler_new(module_name: Any, interval_nanos: Any, modules: Any, modules_len: Any) -> ctypes._Pointer:
3323-
return _wasmtime_guestprofiler_new(module_name, interval_nanos, modules, modules_len) # type: ignore
3327+
_wasmtime_guestprofiler_new.argtypes = [ctypes.POINTER(wasm_engine_t), ctypes.POINTER(wasm_name_t), ctypes.c_uint64, ctypes.POINTER(wasmtime_guestprofiler_modules_t), ctypes.c_size_t]
3328+
def wasmtime_guestprofiler_new(engine: Any, module_name: Any, interval_nanos: Any, modules: Any, modules_len: Any) -> ctypes._Pointer:
3329+
return _wasmtime_guestprofiler_new(engine, module_name, interval_nanos, modules, modules_len) # type: ignore
33243330

33253331
_wasmtime_guestprofiler_sample = dll.wasmtime_guestprofiler_sample
33263332
_wasmtime_guestprofiler_sample.restype = None
@@ -3966,6 +3972,12 @@ def wasmtime_component_func_type_clone(ty: Any) -> ctypes._Pointer:
39663972
def wasmtime_component_func_type_delete(ty: Any) -> None:
39673973
return _wasmtime_component_func_type_delete(ty) # type: ignore
39683974

3975+
_wasmtime_component_func_type_async = dll.wasmtime_component_func_type_async
3976+
_wasmtime_component_func_type_async.restype = ctypes.c_bool
3977+
_wasmtime_component_func_type_async.argtypes = [ctypes.POINTER(wasmtime_component_func_type_t)]
3978+
def wasmtime_component_func_type_async(ty: Any) -> bool:
3979+
return _wasmtime_component_func_type_async(ty) # type: ignore
3980+
39693981
_wasmtime_component_func_type_param_count = dll.wasmtime_component_func_type_param_count
39703982
_wasmtime_component_func_type_param_count.restype = ctypes.c_size_t
39713983
_wasmtime_component_func_type_param_count.argtypes = [ctypes.POINTER(wasmtime_component_func_type_t)]

wasmtime/_config.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,3 +278,14 @@ def parallel_compilation(self, enable: bool) -> None:
278278
if not isinstance(enable, bool):
279279
raise TypeError('expected a bool')
280280
ffi.wasmtime_config_parallel_compilation_set(self.ptr(), enable)
281+
282+
@setter_property
283+
def shared_memory(self, enable: bool) -> None:
284+
"""
285+
Configures whether shared memories can be created.
286+
287+
This is disabled by default.
288+
"""
289+
if not isinstance(enable, bool):
290+
raise TypeError('expected a bool')
291+
ffi.wasmtime_config_shared_memory_set(self.ptr(), enable)

0 commit comments

Comments
 (0)