Skip to content

Commit 7470656

Browse files
committed
Enable reference-types
1 parent c8763bc commit 7470656

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

packages/vm/src/cache.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1730,6 +1730,31 @@ mod tests {
17301730
assert_eq!(restored, HACKATOM);
17311731
}
17321732

1733+
#[test]
1734+
fn func_ref_test() {
1735+
let wasm = wat::parse_str(
1736+
r#"(module
1737+
(type (func))
1738+
(type (func (param funcref)))
1739+
(import "env" "abort" (func $f (type 1)))
1740+
(func (type 0) nop)
1741+
(export "add_one" (func 0))
1742+
(export "allocate" (func 0))
1743+
(export "interface_version_8" (func 0))
1744+
(export "deallocate" (func 0))
1745+
(export "memory" (memory 0))
1746+
(memory 3)
1747+
)"#,
1748+
)
1749+
.unwrap();
1750+
1751+
let cache: Cache<MockApi, MockStorage, MockQuerier> =
1752+
unsafe { Cache::new(make_testing_options()).unwrap() };
1753+
1754+
// making sure this doesn't panic
1755+
cache.store_code(&wasm, true, true).unwrap();
1756+
}
1757+
17331758
#[test]
17341759
fn test_wasm_limits_checked() {
17351760
let tmp_dir = TempDir::new().unwrap();

packages/vm/src/parsed_wasm.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ impl<'a> ParsedWasm<'a> {
7777
| WasmFeatures::SATURATING_FLOAT_TO_INT
7878
| WasmFeatures::SIGN_EXTENSION
7979
| WasmFeatures::MULTI_VALUE
80-
| WasmFeatures::FLOATS;
80+
| WasmFeatures::FLOATS
81+
| WasmFeatures::REFERENCE_TYPES;
8182

8283
let mut validator = Validator::new_with_features(features);
8384

0 commit comments

Comments
 (0)