Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
115 commits
Select commit Hold shift + click to select a range
387dd0c
add memory64 support to `wasmi::Config`
Robbepop Feb 6, 2025
0f1154a
add memory64 spec tests
Robbepop Feb 6, 2025
f4c5463
rename memory64 test cases
Robbepop Feb 7, 2025
0b707a0
Merge branch 'main' into rf-implement-memory64
Robbepop Feb 11, 2025
573415b
add MemoryTypeInner internal type
Robbepop Feb 13, 2025
b22dbbf
use new MemoryTypeInner in MemoryType[Builder]
Robbepop Feb 13, 2025
0df4f11
add some new memory64 specific methods
Robbepop Feb 13, 2025
8f8660e
apply rustfmt
Robbepop Feb 13, 2025
5e14e00
refactor MemoryTypeBuilder::validate method
Robbepop Feb 13, 2025
15ec410
MemoryType subtyping now checks index type
Robbepop Feb 13, 2025
209c7b3
remove MemoryEntity::size field and use `u64`
Robbepop Feb 13, 2025
a432d06
support memory64 in wasmparser::MemoryType conversion
Robbepop Feb 13, 2025
8bbb2ba
adjust memory.grow execution handler
Robbepop Feb 13, 2025
63448d4
make table.grow execution handler compile for now
Robbepop Feb 13, 2025
2970f35
adjust memory.copy execution handler
Robbepop Feb 14, 2025
5461713
adjust memory.fill execution handlers
Robbepop Feb 14, 2025
e655ab0
adjust memory.init execution handlers
Robbepop Feb 14, 2025
adef0a2
adjust Wasmi IR memory instructions
Robbepop Feb 14, 2025
c34014c
update memory.init translation tests
Robbepop Feb 14, 2025
a658172
adjust translation tests for memory.copy
Robbepop Feb 14, 2025
5fbe14e
adjust translation tests for memory.fill
Robbepop Feb 14, 2025
f6f1a2e
make C-API compile again
Robbepop Feb 14, 2025
564fc2c
fix bug in MemoryTypeBuilder::validate
Robbepop Feb 14, 2025
9702c25
make FuncTranslator memory64 aware
Robbepop Feb 14, 2025
4808ce0
more explicit feature usage in Wasm spec testsuite
Robbepop Feb 14, 2025
f341ea4
fix querying of memory64 in translator
Robbepop Feb 14, 2025
e2e2aba
no longer explicitly disable memory64 in translation tests
Robbepop Feb 14, 2025
d72cde9
improve panic message
Robbepop Feb 14, 2025
830326d
Merge branch 'main' into rf-implement-memory64
Robbepop Mar 3, 2025
0a45a15
make MemoryType accept proper limits for memory64
Robbepop Mar 5, 2025
12a59c7
implement new load store instruction encoding
Robbepop Mar 5, 2025
329630e
update UntypedVal load store handlers
Robbepop Mar 6, 2025
8483126
update Wasmi executor load instruction handlers
Robbepop Mar 6, 2025
25a4f99
pull fetch_reg_and_imm32 into instrs.rs module
Robbepop Mar 6, 2025
b756838
fix: use delta parameter
Robbepop Mar 6, 2025
30e2d89
add support in executor store instruction handlers
Robbepop Mar 6, 2025
8c4025b
remove old effective_address and rename new one
Robbepop Mar 6, 2025
69b3053
use MemoryTypeInner::page_size (dedups code)
Robbepop Mar 6, 2025
a7affea
rename Offset64::new to split
Robbepop Mar 6, 2025
077ff6f
replace Const32<u64> with Address32 in Wasmi IR
Robbepop Mar 6, 2025
5f34b94
remove unused From impl
Robbepop Mar 6, 2025
221d49e
refactor how ptr+offset is calculated
Robbepop Mar 6, 2025
fd46081
remove Offset64::zero constructor
Robbepop Mar 6, 2025
cb09211
add APIs to query load/store parameters type safely
Robbepop Mar 6, 2025
d18e8f9
add Offset16 type to replace Const16<u64> usage
Robbepop Mar 6, 2025
14c64d6
add unit test for Offset64::{split,combine} methods
Robbepop Mar 6, 2025
8bf6c5a
add more test values to unit test
Robbepop Mar 6, 2025
65ba511
fix bug in fetch_optional_memory
Robbepop Mar 6, 2025
f123ab6
fix bug in memory.grow
Robbepop Mar 6, 2025
0177d71
remove overzealous check in Memory::new
Robbepop Mar 6, 2025
54bbc82
add explaining comment
Robbepop Mar 6, 2025
eb118c9
make memory.grow check more generic
Robbepop Mar 6, 2025
4cdbd17
bail out if memory.grow exceeds system limits
Robbepop Mar 6, 2025
131ee23
apply clippy suggestions
Robbepop Mar 6, 2025
6c8ce6f
fix existing load translation tests
Robbepop Mar 6, 2025
3ea041a
change import formatting
Robbepop Mar 6, 2025
32a6740
move offset16 method to top of file
Robbepop Mar 6, 2025
1a4baf3
add new load reg and reg_mem0 tests for memory64
Robbepop Mar 6, 2025
ae3bb70
clean up new tests and test infra
Robbepop Mar 6, 2025
62f82b2
extend more load translation tests
Robbepop Mar 7, 2025
2171d3b
update more load_at translation tests
Robbepop Mar 7, 2025
9fee1f0
update load::at_overflow[_mem0] translation tests
Robbepop Mar 7, 2025
7b94fb0
add new memory64 load translation tests
Robbepop Mar 7, 2025
cd8842d
deduplicate mem0 load translation test impls
Robbepop Mar 7, 2025
bc68cbb
add docs to the MemIdx type
Robbepop Mar 7, 2025
77ff2a9
improve macro hygiene a bit
Robbepop Mar 7, 2025
9c80ba9
make existing store translation tests compile and work again
Robbepop Mar 7, 2025
63c399c
apply clippy suggestion
Robbepop Mar 7, 2025
6f1de25
fix broken doc links
Robbepop Mar 7, 2025
53bef7c
improve imports formatting
Robbepop Mar 7, 2025
785108b
move utilities from load to parent submodule
Robbepop Mar 8, 2025
115f441
use &self instead of self in IndexType and MemIdx methods
Robbepop Mar 8, 2025
088de6a
update, extend and adjust some store translation tests
Robbepop Mar 8, 2025
9c267f2
add comments describing the different sets of test cases
Robbepop Mar 8, 2025
18b6fa9
update and extend existing store[_offset16] translation tests
Robbepop Mar 8, 2025
dafd18a
update and extend remaining existing store translation tests
Robbepop Mar 8, 2025
229a48a
apply clippy suggestion
Robbepop Mar 8, 2025
3d853ad
remove unused generics
Robbepop Mar 8, 2025
1519768
add new store_at fallback translation tests
Robbepop Mar 8, 2025
df275f8
dedup test code
Robbepop Mar 8, 2025
ec6b264
remove unused trait bound in test code
Robbepop Mar 8, 2025
b72203f
addat_imm_fallback store translation tests
Robbepop Mar 8, 2025
46cee72
reformat i32_store translation tests
Robbepop Mar 8, 2025
563ebe4
reformat some i64_store translation tests
Robbepop Mar 8, 2025
383a862
add some more test values to some f{32,64}_store translation tests
Robbepop Mar 8, 2025
c10a1e1
clean up and modernize f32_store translation tests
Robbepop Mar 8, 2025
491c374
update and modernize f64_store translation tests
Robbepop Mar 8, 2025
33201f1
replace iterators with for-loop
Robbepop Mar 8, 2025
ceda99d
rename some store translation test generators
Robbepop Mar 8, 2025
861d982
deduplicate some load translation tests
Robbepop Mar 8, 2025
7c7c001
apply rustfmt
Robbepop Mar 8, 2025
9421aaa
add store_at_imm_fallback translation tests
Robbepop Mar 9, 2025
3cbccac
dedup some test code
Robbepop Mar 9, 2025
2564c34
fix memory.init memory64 implementation
Robbepop Mar 9, 2025
647942c
apply clippy suggestions
Robbepop Mar 9, 2025
35c4419
move IndexType into its own submodule
Robbepop Mar 9, 2025
0684e46
update and adjust TableType, TableEntity and Table types
Robbepop Mar 9, 2025
2540c9a
update docs of ModuleHeader::get_type_of_memory
Robbepop Mar 9, 2025
caac0a1
add MemoryType::index_ty getter
Robbepop Mar 9, 2025
02c4fff
implement basic table64 support
Robbepop Mar 9, 2025
e40d139
fix bug in wasmparser to Wasmi TableType conversion
Robbepop Mar 9, 2025
fa07a6e
apply rustfmt
Robbepop Mar 9, 2025
3b9fed6
apply clippy suggestions
Robbepop Mar 9, 2025
ce7bbe0
apply another clippy suggestion
Robbepop Mar 9, 2025
6c16ee9
add Git submodule for memory64 proposal tests
Robbepop Mar 10, 2025
60bffe5
update memory64 wast tests
Robbepop Mar 10, 2025
923b6af
fix bug in MemoryType::dynamic_ty
Robbepop Mar 10, 2025
767ec1a
add table64 to spectest module
Robbepop Mar 10, 2025
af687b4
update memory64 tests
Robbepop Mar 10, 2025
7f99344
remove the faulty memory64 submodule
Robbepop Mar 10, 2025
8f3690e
add new Git submodule with memory64 tests
Robbepop Mar 10, 2025
1750828
use new Wasmi specific memory64 tests
Robbepop Mar 10, 2025
af03761
fix broken doc link
Robbepop Mar 10, 2025
3cfc9a2
update wasmi-tests Git submodule to new URL
Robbepop Mar 10, 2025
a841eb9
remove faulty Git submodule from earlier
Robbepop Mar 10, 2025
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
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "crates/wasmi/benches/rust"]
path = crates/wasmi/benches/rust
url = https://github.com/wasmi-labs/rust-benchmarks
[submodule "crates/wasmi/tests/spec/wasmi-tests"]
path = crates/wasmi/tests/spec/wasmi-tests
url = https://github.com/wasmi-labs/wasmi-tests
8 changes: 6 additions & 2 deletions crates/c_api/src/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,11 @@ pub unsafe extern "C" fn wasm_memory_data_size(m: &wasm_memory_t) -> usize {
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
pub unsafe extern "C" fn wasm_memory_size(m: &wasm_memory_t) -> wasm_memory_pages_t {
m.memory().size(m.inner.store.context())
let size = m.memory().size(m.inner.store.context());
let Ok(size32) = u32::try_from(size) else {
panic!("linear memory pages out of bounds: {size}")
};
size32
}

/// Grows the [`wasm_memory_t`] by `delta` Wasm pages.
Expand All @@ -153,5 +157,5 @@ pub unsafe extern "C" fn wasm_memory_grow(
) -> bool {
let memory = m.memory();
let mut store = m.inner.store.context_mut();
memory.grow(&mut store, delta).is_ok()
memory.grow(&mut store, u64::from(delta)).is_ok()
}
13 changes: 9 additions & 4 deletions crates/c_api/src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ pub unsafe extern "C" fn wasm_table_get(
index: wasm_table_size_t,
) -> Option<Box<wasm_ref_t>> {
let table = t.table();
let value = table.get(t.inner.store.context_mut(), index)?;
let value = table.get(t.inner.store.context_mut(), u64::from(index))?;
let wasm_ref = match value {
wasmi::Val::FuncRef(r) => WasmRef::Func(r),
wasmi::Val::ExternRef(r) => WasmRef::Extern(r),
Expand All @@ -137,7 +137,11 @@ pub unsafe extern "C" fn wasm_table_set(
let table = t.table();
let new_value = option_wasm_ref_t_to_ref(new_value, &table.ty(t.inner.store.context()));
table
.set(t.inner.store.context_mut(), index, new_value.into())
.set(
t.inner.store.context_mut(),
u64::from(index),
new_value.into(),
)
.is_ok()
}

Expand All @@ -154,7 +158,8 @@ pub unsafe extern "C" fn wasm_table_set(
pub unsafe extern "C" fn wasm_table_size(t: &wasm_table_t) -> wasm_table_size_t {
let table = t.table();
let store = t.inner.store.context();
table.size(store)
let size = table.size(store);
u32::try_from(size).unwrap()
}
/// Grows the number of cells of the [`wasm_table_t`] by `delta`.
///
Expand All @@ -176,7 +181,7 @@ pub unsafe extern "C" fn wasm_table_grow(
let table = t.table();
let init = option_wasm_ref_t_to_ref(init, &table.ty(t.inner.store.context()));
table
.grow(t.inner.store.context_mut(), delta, init.into())
.grow(t.inner.store.context_mut(), u64::from(delta), init.into())
.is_ok()
}

Expand Down
8 changes: 6 additions & 2 deletions crates/c_api/src/types/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,12 @@ impl wasm_memorytype_t {

impl CMemoryType {
pub(crate) fn new(ty: MemoryType) -> CMemoryType {
let min: u32 = ty.minimum();
let max: u32 = ty.maximum().unwrap_or(u32::MAX);
let Ok(min) = u32::try_from(ty.minimum()) else {
panic!("memory minimum size out of bounds: {}", ty.minimum())
};
let Ok(max) = u32::try_from(ty.maximum().unwrap_or(u64::from(u32::MAX))) else {
panic!("memory maximum size out of bounds: {:?}", ty.maximum())
};
CMemoryType {
ty,
limits: wasm_limits_t { min, max },
Expand Down
7 changes: 5 additions & 2 deletions crates/c_api/src/types/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,11 @@ impl CTableType {
ty,
element: wasm_valtype_t { ty: ty.element() },
limits: wasm_limits_t {
min: ty.minimum(),
max: ty.maximum().unwrap_or(u32::MAX),
min: u32::try_from(ty.minimum()).unwrap(),
max: ty
.maximum()
.map(|max| u32::try_from(max).unwrap())
.unwrap_or(u32::MAX),
},
}
}
Expand Down
Loading
Loading