-
Notifications
You must be signed in to change notification settings - Fork 244
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a feature for disabling GC types (#1731)
* Add a feature for disabling GC types This commit adds support for a new wasm feature named `WasmFeatures::GC_TYPES`. This does not correspond to any upstream proposal and is intended for use in Wasmtime for disabling the runtime garbage collector at compile time. This serves as a finer-grained switch to disable the runtime dependency at validation time on a garbage collector without disabling all the features that were added in other proposals. For example the `reference-types` proposal also added support for multi-table which disabling a runtime garbage collector doesn't need to disable. * Fix wasm-smith tests * Fix test expectation
- Loading branch information
1 parent
56cf001
commit c5bd644
Showing
10 changed files
with
134 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
error: invalid value 'unknown' for '--features <FEATURES>': unknown feature `unknown` | ||
Valid features: mutable-global, saturating-float-to-int, sign-extension, reference-types, multi-value, bulk-memory, simd, relaxed-simd, threads, shared-everything-threads, tail-call, floats, multi-memory, exceptions, memory64, extended-const, component-model, function-references, memory-control, gc, custom-page-sizes, component-model-values, component-model-nested-names, component-model-more-flags, component-model-multiple-returns, legacy-exceptions | ||
Valid features: mutable-global, saturating-float-to-int, sign-extension, reference-types, multi-value, bulk-memory, simd, relaxed-simd, threads, shared-everything-threads, tail-call, floats, multi-memory, exceptions, memory64, extended-const, component-model, function-references, memory-control, gc, custom-page-sizes, component-model-values, component-model-nested-names, component-model-more-flags, component-model-multiple-returns, legacy-exceptions, gc-types | ||
|
||
For more information, try '--help'. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
(assert_invalid | ||
(module | ||
(type (func (result externref))) | ||
) | ||
"gc types are disallowed") | ||
|
||
(assert_invalid | ||
(module | ||
(type (func (result (ref any)))) | ||
) | ||
"gc types are disallowed") | ||
|
||
(module | ||
(table 1 funcref) | ||
) | ||
|
||
(module | ||
(type $t (func)) | ||
(table 1 (ref null $t)) | ||
) | ||
|
||
(assert_invalid | ||
(module | ||
(type (array i8)) | ||
) | ||
"cannot define array types") | ||
|
||
(assert_invalid | ||
(module | ||
(type (struct)) | ||
) | ||
"cannot define struct types") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
tests/snapshots/local/missing-features/gc/gc-types-disabled.wast.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
"source_filename": "tests/local/missing-features/gc/gc-types-disabled.wast", | ||
"commands": [ | ||
{ | ||
"type": "assert_invalid", | ||
"line": 2, | ||
"filename": "gc-types-disabled.0.wasm", | ||
"text": "gc types are disallowed", | ||
"module_type": "binary" | ||
}, | ||
{ | ||
"type": "assert_invalid", | ||
"line": 8, | ||
"filename": "gc-types-disabled.1.wasm", | ||
"text": "gc types are disallowed", | ||
"module_type": "binary" | ||
}, | ||
{ | ||
"type": "module", | ||
"line": 13, | ||
"filename": "gc-types-disabled.2.wasm" | ||
}, | ||
{ | ||
"type": "module", | ||
"line": 17, | ||
"filename": "gc-types-disabled.3.wasm" | ||
}, | ||
{ | ||
"type": "assert_invalid", | ||
"line": 23, | ||
"filename": "gc-types-disabled.4.wasm", | ||
"text": "cannot define array types", | ||
"module_type": "binary" | ||
}, | ||
{ | ||
"type": "assert_invalid", | ||
"line": 29, | ||
"filename": "gc-types-disabled.5.wasm", | ||
"text": "cannot define struct types", | ||
"module_type": "binary" | ||
} | ||
] | ||
} |
3 changes: 3 additions & 0 deletions
3
tests/snapshots/local/missing-features/gc/gc-types-disabled.wast/2.print
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
(module | ||
(table (;0;) 1 funcref) | ||
) |
4 changes: 4 additions & 0 deletions
4
tests/snapshots/local/missing-features/gc/gc-types-disabled.wast/3.print
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
(module | ||
(type $t (;0;) (func)) | ||
(table (;0;) 1 (ref null $t)) | ||
) |