Skip to content

Commit

Permalink
Fix merge conflicts introduced w/ PRs WebAssembly#84 and WebAssembly#86
Browse files Browse the repository at this point in the history
… (WebAssembly#87)

Change the test generators to use `ref.func` and remove `passive`.

At some point we'll want to remove the generators, but for let's try to
maintain them.
  • Loading branch information
binji authored May 13, 2019
1 parent 08be05a commit e2e3383
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 31 deletions.
6 changes: 3 additions & 3 deletions test/core/memory_init.wast
Original file line number Diff line number Diff line change
Expand Up @@ -281,21 +281,21 @@

(module
(memory 1)
(data passive "\37")
(data "\37")
(func (export "test")
(memory.init 0 (i32.const 0x10001) (i32.const 0) (i32.const 0))))
(assert_trap (invoke "test") "out of bounds")

(module
(memory 1)
(data passive "\37")
(data "\37")
(func (export "test")
(memory.init 0 (i32.const 0x10000) (i32.const 0) (i32.const 0))))
(invoke "test")

(module
(memory 1)
(data passive "\37")
(data "\37")
(func (export "test")
(memory.init 0 (i32.const 0x10000) (i32.const 1) (i32.const 0))))
(invoke "test")
Expand Down
22 changes: 16 additions & 6 deletions test/core/table_copy.wast
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
;;
;; Generated by ../meta/generate_table_copy.js
;;

(module
(func (export "ef0") (result i32) (i32.const 0))
(func (export "ef1") (result i32) (i32.const 1))
Expand Down Expand Up @@ -634,9 +638,11 @@
(module
(table 30 30 funcref)
(elem (i32.const 2) 3 1 4 1)
(elem passive funcref 2 7 1 8)
(elem funcref
(ref.func 2) (ref.func 7) (ref.func 1) (ref.func 8))
(elem (i32.const 12) 7 5 2 3 6)
(elem passive funcref 5 9 2 7 6)
(elem funcref
(ref.func 5) (ref.func 9) (ref.func 2) (ref.func 7) (ref.func 6))
(func (result i32) (i32.const 0))
(func (result i32) (i32.const 1))
(func (result i32) (i32.const 2))
Expand All @@ -656,9 +662,11 @@
(module
(table 30 30 funcref)
(elem (i32.const 2) 3 1 4 1)
(elem passive funcref 2 7 1 8)
(elem funcref
(ref.func 2) (ref.func 7) (ref.func 1) (ref.func 8))
(elem (i32.const 12) 7 5 2 3 6)
(elem passive funcref 5 9 2 7 6)
(elem funcref
(ref.func 5) (ref.func 9) (ref.func 2) (ref.func 7) (ref.func 6))
(func (result i32) (i32.const 0))
(func (result i32) (i32.const 1))
(func (result i32) (i32.const 2))
Expand All @@ -678,9 +686,11 @@
(module
(table 30 30 funcref)
(elem (i32.const 2) 3 1 4 1)
(elem passive funcref 2 7 1 8)
(elem funcref
(ref.func 2) (ref.func 7) (ref.func 1) (ref.func 8))
(elem (i32.const 12) 7 5 2 3 6)
(elem passive funcref 5 9 2 7 6)
(elem funcref
(ref.func 5) (ref.func 9) (ref.func 2) (ref.func 7) (ref.func 6))
(func (result i32) (i32.const 0))
(func (result i32) (i32.const 1))
(func (result i32) (i32.const 2))
Expand Down
22 changes: 16 additions & 6 deletions test/core/table_init.wast
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
;;
;; Generated by ../meta/generate_table_init.js
;;

(module
(func (export "ef0") (result i32) (i32.const 0))
(func (export "ef1") (result i32) (i32.const 1))
Expand Down Expand Up @@ -447,9 +451,11 @@
(module
(table 30 30 funcref)
(elem (i32.const 2) 3 1 4 1)
(elem passive funcref 2 7 1 8)
(elem funcref
(ref.func 2) (ref.func 7) (ref.func 1) (ref.func 8))
(elem (i32.const 12) 7 5 2 3 6)
(elem passive funcref 5 9 2 7 6)
(elem funcref
(ref.func 5) (ref.func 9) (ref.func 2) (ref.func 7) (ref.func 6))
(func (result i32) (i32.const 0))
(func (result i32) (i32.const 1))
(func (result i32) (i32.const 2))
Expand All @@ -468,9 +474,11 @@
(module
(table 30 30 funcref)
(elem (i32.const 2) 3 1 4 1)
(elem passive funcref 2 7 1 8)
(elem funcref
(ref.func 2) (ref.func 7) (ref.func 1) (ref.func 8))
(elem (i32.const 12) 7 5 2 3 6)
(elem passive funcref 5 9 2 7 6)
(elem funcref
(ref.func 5) (ref.func 9) (ref.func 2) (ref.func 7) (ref.func 6))
(func (result i32) (i32.const 0))
(func (result i32) (i32.const 1))
(func (result i32) (i32.const 2))
Expand All @@ -489,9 +497,11 @@
(module
(table 30 30 funcref)
(elem (i32.const 2) 3 1 4 1)
(elem passive funcref 2 7 1 8)
(elem funcref
(ref.func 2) (ref.func 7) (ref.func 1) (ref.func 8))
(elem (i32.const 12) 7 5 2 3 6)
(elem passive funcref 5 9 2 7 6)
(elem funcref
(ref.func 5) (ref.func 9) (ref.func 2) (ref.func 7) (ref.func 6))
(func (result i32) (i32.const 0))
(func (result i32) (i32.const 1))
(func (result i32) (i32.const 2))
Expand Down
8 changes: 4 additions & 4 deletions test/meta/generate_memory_init.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ function mem_test(instruction, expected_result_vector) {
(module
(memory (export "memory0") 1 1)
(data (i32.const 2) "\\03\\01\\04\\01")
(data passive "\\02\\07\\01\\08")
(data "\\02\\07\\01\\08")
(data (i32.const 12) "\\07\\05\\02\\03\\06")
(data passive "\\05\\09\\02\\07\\06")
(data "\\05\\09\\02\\07\\06")
(func (export "test")
${instruction})
(func (export "load8_u") (param i32) (result i32)
Expand Down Expand Up @@ -57,7 +57,7 @@ mem_test(`(memory.init 1 (i32.const 7) (i32.const 0) (i32.const 4))

let PREAMBLE =
`(memory 1)
(data passive "\\37")`;
(data "\\37")`;

// drop with no memory
print(
Expand Down Expand Up @@ -242,7 +242,7 @@ function mem_init(min, max, shared, backup, write) {
print(
`(module
(memory ${min} ${max} ${shared})
(data passive "\\42\\42\\42\\42\\42\\42\\42\\42\\42\\42\\42\\42\\42\\42\\42\\42")
(data "\\42\\42\\42\\42\\42\\42\\42\\42\\42\\42\\42\\42\\42\\42\\42\\42")
${checkRangeCode()}
(func (export "run") (param $offs i32) (param $len i32)
(memory.init 0 (local.get $offs) (i32.const 0) (local.get $len))))
Expand Down
12 changes: 8 additions & 4 deletions test/meta/generate_table_copy.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ function emit_b(insn) {
(import "a" "ef4" (func (result i32))) ;; index 4
(table 30 30 funcref)
(elem (i32.const 2) 3 1 4 1)
(elem passive funcref 2 7 1 8)
(elem funcref
(ref.func 2) (ref.func 7) (ref.func 1) (ref.func 8))
(elem (i32.const 12) 7 5 2 3 6)
(elem passive funcref 5 9 2 7 6)
(elem funcref
(ref.func 5) (ref.func 9) (ref.func 2) (ref.func 7) (ref.func 6))
(func (result i32) (i32.const 5)) ;; index 5
(func (result i32) (i32.const 6))
(func (result i32) (i32.const 7))
Expand Down Expand Up @@ -119,9 +121,11 @@ function do_test(insn1, insn2, errText)
(module
(table 30 30 funcref)
(elem (i32.const 2) 3 1 4 1)
(elem passive funcref 2 7 1 8)
(elem funcref
(ref.func 2) (ref.func 7) (ref.func 1) (ref.func 8))
(elem (i32.const 12) 7 5 2 3 6)
(elem passive funcref 5 9 2 7 6)
(elem funcref
(ref.func 5) (ref.func 9) (ref.func 2) (ref.func 7) (ref.func 6))
(func (result i32) (i32.const 0))
(func (result i32) (i32.const 1))
(func (result i32) (i32.const 2))
Expand Down
24 changes: 16 additions & 8 deletions test/meta/generate_table_init.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ function emit_b(insn) {
(import "a" "ef4" (func (result i32))) ;; index 4
(table 30 30 funcref)
(elem (i32.const 2) 3 1 4 1)
(elem passive funcref 2 7 1 8)
(elem funcref
(ref.func 2) (ref.func 7) (ref.func 1) (ref.func 8))
(elem (i32.const 12) 7 5 2 3 6)
(elem passive funcref 5 9 2 7 6)
(elem funcref
(ref.func 5) (ref.func 9) (ref.func 2) (ref.func 7) (ref.func 6))
(func (result i32) (i32.const 5)) ;; index 5
(func (result i32) (i32.const 6))
(func (result i32) (i32.const 7))
Expand Down Expand Up @@ -121,7 +123,7 @@ print(
print(
`(assert_invalid
(module
(elem passive funcref 0)
(elem funcref (ref.func 0))
(func (result i32) (i32.const 0))
(func (export "test")
(elem.drop 4)))
Expand All @@ -132,7 +134,7 @@ print(
print(
`(assert_invalid
(module
(elem passive funcref 0)
(elem funcref (ref.func 0))
(func (result i32) (i32.const 0))
(func (export "test")
(table.init 4 (i32.const 12) (i32.const 1) (i32.const 1))))
Expand All @@ -145,9 +147,11 @@ function do_test(insn1, insn2, errText)
(module
(table 30 30 funcref)
(elem (i32.const 2) 3 1 4 1)
(elem passive funcref 2 7 1 8)
(elem funcref
(ref.func 2) (ref.func 7) (ref.func 1) (ref.func 8))
(elem (i32.const 12) 7 5 2 3 6)
(elem passive funcref 5 9 2 7 6)
(elem funcref
(ref.func 5) (ref.func 9) (ref.func 2) (ref.func 7) (ref.func 6))
(func (result i32) (i32.const 0))
(func (result i32) (i32.const 1))
(func (result i32) (i32.const 2))
Expand Down Expand Up @@ -255,7 +259,7 @@ tab_test1("(table.init 1 (i32.const 30) (i32.const 4) (i32.const 0))",
(assert_invalid
(module
(table 10 funcref)
(elem passive funcref $f0 $f0 $f0)
(elem funcref (ref.func $f0) (ref.func $f0) (ref.func $f0))
(func $f0)
(func (export "test")
(table.init 0 (${ty1}.const 1) (${ty2}.const 1) (${ty3}.const 1))))
Expand All @@ -278,7 +282,11 @@ function tbl_init(min, max, backup, write, segoffs=0) {
(module
(type (func (result i32)))
(table ${min} ${max} funcref)
(elem passive funcref $f0 $f1 $f2 $f3 $f4 $f5 $f6 $f7 $f8 $f9 $f10 $f11 $f12 $f13 $f14 $f15)
(elem funcref
(ref.func $f0) (ref.func $f1) (ref.func $f2) (ref.func $f3)
(ref.func $f4) (ref.func $f5) (ref.func $f6) (ref.func $f7)
(ref.func $f8) (ref.func $f9) (ref.func $f10) (ref.func $f11)
(ref.func $f12) (ref.func $f13) (ref.func $f14) (ref.func $f15))
(func $f0 (export "f0") (result i32) (i32.const 0))
(func $f1 (export "f1") (result i32) (i32.const 1))
(func $f2 (export "f2") (result i32) (i32.const 2))
Expand Down

0 comments on commit e2e3383

Please sign in to comment.