Skip to content

Commit c70113e

Browse files
committed
test passes with modified wasmtime
1 parent f87010d commit c70113e

File tree

9 files changed

+422
-97
lines changed

9 files changed

+422
-97
lines changed

Cargo.lock

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

crates/c/src/lib.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1665,8 +1665,14 @@ impl<'a> wit_bindgen_core::AnonymousTypeGenerator<'a> for InterfaceGenerator<'a>
16651665
fn anonymous_type_type(&mut self, _id: TypeId, _ty: &Type, _docs: &Docs) {
16661666
todo!("print_anonymous_type for type");
16671667
}
1668-
1669-
fn anonymous_type_fixed_size_list(&mut self, _id: TypeId, _ty: &Type, _size: u32, _docs: &Docs) {
1668+
1669+
fn anonymous_type_fixed_size_list(
1670+
&mut self,
1671+
_id: TypeId,
1672+
_ty: &Type,
1673+
_size: u32,
1674+
_docs: &Docs,
1675+
) {
16701676
todo!("print_anonymous_type for fixed size list");
16711677
}
16721678
}

crates/core/src/abi.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1779,12 +1779,15 @@ impl<'a, B: Bindgen> Generator<'a, B> {
17791779

17801780
TypeDefKind::Unknown => unreachable!(),
17811781
TypeDefKind::FixedSizeList(ty, size) => {
1782-
let increment = self.bindgen.sizes().size(ty);
1783-
let mut position = offset;
1784-
for _ in 0..*size {
1785-
self.write_to_memory(ty, addr.clone(), position);
1786-
position = position + increment;
1787-
}
1782+
// let increment = self.bindgen.sizes().size(ty);
1783+
// let mut position = offset;
1784+
// let resultvar = self.stack[0];
1785+
// for _ in 0..*size {
1786+
// // push index
1787+
// self.stack.push("", );
1788+
// self.write_to_memory(ty, addr.clone(), position);
1789+
// position = position + increment;
1790+
// }
17881791
self.emit(&FixedSizeListLower {
17891792
elements: ty,
17901793
size: *size,

crates/rust/src/bindgen.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1214,7 +1214,7 @@ impl Bindgen for FunctionBindgen<'_, '_> {
12141214
} => {
12151215
let tmp = self.tmp();
12161216
let result = format!("result{tmp}");
1217-
self.push_str(&format!("let mut {result} = [",));
1217+
self.push_str(&format!("let {result} = [",));
12181218
for a in operands.drain(0..(*size as usize)) {
12191219
self.push_str(&a);
12201220
self.push_str(", ");

crates/rust/src/interface.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2930,6 +2930,6 @@ impl<'a, 'b> wit_bindgen_core::AnonymousTypeGenerator<'a> for AnonTypeGenerator<
29302930
style: TypeOwnershipStyle::Owned,
29312931
},
29322932
);
2933-
self.interface.push_str(&format!(", {size}]"));
2933+
self.interface.push_str(&format!("; {size}]"));
29342934
}
29352935
}

crates/test/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ regex = "1.11.1"
2424
serde = { workspace = true }
2525
toml = "0.8.20"
2626
wasi-preview1-component-adapter-provider = "30.0.2"
27-
wac-parser = "0.6.1"
28-
wac-types = "0.6.1"
29-
wac-graph = "0.6.1"
27+
wac-parser = { path = "../../../wac/crates/wac-parser" }
28+
wac-types = { path = "../../../wac/crates/wac-types" }
29+
wac-graph = { path = "../../../wac/crates/wac-graph" }
3030
wasm-compose = { workspace = true }
3131
indexmap = { workspace = true }
3232
wasm-encoder = { workspace = true }
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
include!(env!("BINDINGS"));
22

3-
use test::lists::to_test::*;
3+
use test::fixed_size_lists::to_test::*;
44

55
fn main() {
6+
list_param([1,2,3,4]);
7+
list_param2([[1,2],[3,4]]);
68
}

tests/runtime/fixed-size-list/test.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,8 @@ struct Component;
44

55
export!(Component);
66

7-
impl exports::test::lists::to_test::Guest for Component {
7+
impl exports::test::fixed_size_lists::to_test::Guest for Component {
8+
fn list_param(_a: [u32; 4]) {}
9+
fn list_param2(_a: [[u32; 2]; 2]) {}
10+
// fn list_param3(_a: [i32; 20]) {}
811
}

tests/runtime/fixed-size-list/test.wit

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
package test:lists;
1+
package test:fixed-size-lists;
22

33
interface to-test {
44
list-param: func(a: list<u32, 4>);
55
list-param2: func(a: list<list<u32, 2>, 2>);
6-
list-param3: func(a: list<s32, 20>);
7-
list-result: func() -> list<u8, 8>;
6+
// list-param3: func(a: list<s32, 20>);s
7+
//list-result: func() -> list<u8, 8>;
88

9-
list-minmax16: func(a: list<u16, 4>, b: list<s16, 4>) -> tuple<list<u16, 4>, list<s16, 4>>;
10-
list-minmax-float: func(a: list<f32, 2>, b: list<f64, 2>)
11-
-> tuple<list<f32, 2>, list<f64, 2>>;
9+
// list-minmax16: func(a: list<u16, 4>, b: list<s16, 4>) -> tuple<list<u16, 4>, list<s16, 4>>;
10+
// list-minmax-float: func(a: list<f32, 2>, b: list<f64, 2>)
11+
// -> tuple<list<f32, 2>, list<f64, 2>>;
1212

13-
list-roundtrip: func(a: list<u8, 12>) -> list<u8, 12>;
13+
// list-roundtrip: func(a: list<u8, 12>) -> list<u8, 12>;
1414
}
1515

1616
world test {

0 commit comments

Comments
 (0)