forked from WebAssembly/binaryen
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Validator: ArrayNew|InitData require Bulk Memory (WebAssembly#6331)
Those instructions refer to a data segment, which mean the DataCount section must be emitted before them (so that, per the spec, they can be validated by looking only at previous sections), which implies bulk-memory is needed.
- Loading branch information
1 parent
1886322
commit 9320e18
Showing
3 changed files
with
60 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
;; array.init_data refers to a data segment and therefore requires the datacount | ||
;; section be emitted (so it can be validated, per the spec, using only previous | ||
;; sections), which means bulk memory must be enabled. | ||
|
||
;; RUN: not wasm-opt --enable-reference-types --enable-gc %s 2>&1 | filecheck %s | ||
|
||
;; CHECK: Data segment operations require bulk memory | ||
|
||
(module | ||
(type $0 (array i8)) | ||
|
||
(memory $0 16 17) | ||
|
||
(data $0 (i32.const 0) "") | ||
|
||
(func $0 | ||
(array.init_data $0 $0 | ||
(ref.null $0) | ||
(i32.const 0) | ||
(i32.const 0) | ||
(i32.const 0) | ||
) | ||
) | ||
) | ||
|
||
;; But it passes with the feature enabled. | ||
;; RUN: wasm-opt --enable-reference-types --enable-gc --enable-bulk-memory %s |
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,25 @@ | ||
;; array.new_data refers to a data segment and therefore requires the datacount | ||
;; section be emitted (so it can be validated, per the spec, using only previous | ||
;; sections), which means bulk memory must be enabled. | ||
|
||
;; RUN: not wasm-opt --enable-reference-types --enable-gc %s 2>&1 | filecheck %s | ||
|
||
;; CHECK: Data segment operations require bulk memory | ||
|
||
(module | ||
(type $0 (array i8)) | ||
|
||
(memory $0 16 17) | ||
|
||
(data $0 (i32.const 0) "") | ||
|
||
(func $0 (result (ref $0)) | ||
(array.new_data $0 $0 | ||
(i32.const 0) | ||
(i32.const 0) | ||
) | ||
) | ||
) | ||
|
||
;; But it passes with the feature enabled. | ||
;; RUN: wasm-opt --enable-reference-types --enable-gc --enable-bulk-memory %s |