Skip to content

Commit

Permalink
Move test to wasm-3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
titzer committed Oct 25, 2024
1 parent 9cbddfb commit 039e4e6
Show file tree
Hide file tree
Showing 3 changed files with 181 additions and 249 deletions.
98 changes: 8 additions & 90 deletions test/regress/core/instance.bin.wast
Original file line number Diff line number Diff line change
@@ -1,96 +1,14 @@
(module definition $M binary
"\00\61\73\6d\01\00\00\00\01\84\80\80\80\00\01\60"
"\00\00\04\84\80\80\80\00\01\70\00\0a\05\83\80\80"
"\80\00\01\00\01\0d\83\80\80\80\00\01\00\00\06\86"
"\80\80\80\00\01\7f\01\41\00\0b\07\9a\80\80\80\00"
"\04\04\67\6c\6f\62\03\00\03\74\61\62\01\00\03\6d"
"\65\6d\02\00\03\74\61\67\04\00"
"\00\61\73\6d\01\00\00\00\01\89\80\80\80\00\02\60"
"\00\01\7f\60\01\7f\00\03\83\80\80\80\00\02\00\01"
"\06\86\80\80\80\00\01\7f\01\41\00\0b\07\94\80\80"
"\80\00\03\04\67\6c\6f\62\03\00\03\67\65\74\00\00"
"\03\73\65\74\00\01\0a\95\80\80\80\00\02\84\80\80"
"\80\00\00\23\00\0b\86\80\80\80\00\00\20\00\24\00"
"\0b"
)
(module instance $I1 $M)
(module instance $I2 $M)
(register "I1" $I1)
(register "I2" $I2)
(module definition binary
"\00\61\73\6d\01\00\00\00\01\8c\80\80\80\00\03\60"
"\00\00\60\00\01\7f\60\00\01\70\02\d5\80\80\80\00"
"\08\02\49\31\04\67\6c\6f\62\03\7f\01\02\49\32\04"
"\67\6c\6f\62\03\7f\01\02\49\31\03\74\61\62\01\70"
"\00\0a\02\49\32\03\74\61\62\01\70\00\0a\02\49\31"
"\03\6d\65\6d\02\00\01\02\49\32\03\6d\65\6d\02\00"
"\01\02\49\31\03\74\61\67\04\00\00\02\49\32\03\74"
"\61\67\04\00\00\03\86\80\80\80\00\05\00\01\02\01"
"\01\07\9a\80\80\80\00\04\04\67\6c\6f\62\00\01\03"
"\74\61\62\00\02\03\6d\65\6d\00\03\03\74\61\67\00"
"\04\09\85\80\80\80\00\01\03\00\01\00\0a\d9\80\80"
"\80\00\05\82\80\80\80\00\00\0b\88\80\80\80\00\00"
"\41\01\24\00\23\01\0b\8c\80\80\80\00\00\41\00\d2"
"\00\26\00\41\00\25\01\0b\8f\80\80\80\00\00\41\00"
"\41\01\36\02\00\41\00\28\42\01\00\0b\9a\80\80\80"
"\00\00\02\40\02\40\1f\40\02\00\00\01\02\00\08\01"
"\0b\00\0b\41\00\0f\0b\41\01\0f\0b"
)
(module instance)
(assert_return (invoke "glob") (i32.const 0x0))
(assert_return (invoke "tab") (ref.null))
(assert_return (invoke "mem") (i32.const 0x0))
(assert_return (invoke "tag") (i32.const 0x0))
(module definition binary
"\00\61\73\6d\01\00\00\00\01\8c\80\80\80\00\03\60"
"\00\00\60\00\01\7f\60\00\01\70\02\d5\80\80\80\00"
"\08\02\49\31\04\67\6c\6f\62\03\7f\01\02\49\31\04"
"\67\6c\6f\62\03\7f\01\02\49\31\03\74\61\62\01\70"
"\00\0a\02\49\31\03\74\61\62\01\70\00\0a\02\49\31"
"\03\6d\65\6d\02\00\01\02\49\31\03\6d\65\6d\02\00"
"\01\02\49\31\03\74\61\67\04\00\00\02\49\31\03\74"
"\61\67\04\00\00\03\86\80\80\80\00\05\00\01\02\01"
"\01\07\9a\80\80\80\00\04\04\67\6c\6f\62\00\01\03"
"\74\61\62\00\02\03\6d\65\6d\00\03\03\74\61\67\00"
"\04\09\85\80\80\80\00\01\03\00\01\00\0a\d9\80\80"
"\80\00\05\82\80\80\80\00\00\0b\88\80\80\80\00\00"
"\41\01\24\00\23\01\0b\8c\80\80\80\00\00\41\00\d2"
"\00\26\00\41\00\25\01\0b\8f\80\80\80\00\00\41\00"
"\41\01\36\02\00\41\00\28\42\01\00\0b\9a\80\80\80"
"\00\00\02\40\02\40\1f\40\02\00\00\01\02\00\08\01"
"\0b\00\0b\41\00\0f\0b\41\01\0f\0b"
)
(module instance)
(assert_return (invoke "glob") (i32.const 0x1))
(assert_return (invoke "tab") (ref.func))
(assert_return (invoke "mem") (i32.const 0x1))
(assert_return (invoke "tag") (i32.const 0x1))
(module definition $N binary
"\00\61\73\6d\01\00\00\00\01\84\80\80\80\00\01\60"
"\00\00\04\84\80\80\80\00\01\70\00\0a\05\83\80\80"
"\80\00\01\00\01\0d\83\80\80\80\00\01\00\00\06\86"
"\80\80\80\00\01\7f\01\41\00\0b\07\bb\80\80\80\00"
"\08\05\67\6c\6f\62\31\03\00\05\67\6c\6f\62\32\03"
"\00\04\74\61\62\31\01\00\04\74\61\62\32\01\00\04"
"\6d\65\6d\31\02\00\04\6d\65\6d\32\02\00\04\74\61"
"\67\31\04\00\04\74\61\67\32\04\00"
)
(module instance $I $N)
(register "I" $I)
(module definition binary
"\00\61\73\6d\01\00\00\00\01\8c\80\80\80\00\03\60"
"\00\00\60\00\01\7f\60\00\01\70\02\d5\80\80\80\00"
"\08\01\49\05\67\6c\6f\62\31\03\7f\01\01\49\05\67"
"\6c\6f\62\32\03\7f\01\01\49\04\74\61\62\31\01\70"
"\00\0a\01\49\04\74\61\62\32\01\70\00\0a\01\49\04"
"\6d\65\6d\31\02\00\01\01\49\04\6d\65\6d\32\02\00"
"\01\01\49\04\74\61\67\31\04\00\00\01\49\04\74\61"
"\67\32\04\00\00\03\86\80\80\80\00\05\00\01\02\01"
"\01\07\9a\80\80\80\00\04\04\67\6c\6f\62\00\01\03"
"\74\61\62\00\02\03\6d\65\6d\00\03\03\74\61\67\00"
"\04\09\85\80\80\80\00\01\03\00\01\00\0a\d9\80\80"
"\80\00\05\82\80\80\80\00\00\0b\88\80\80\80\00\00"
"\41\01\24\00\23\01\0b\8c\80\80\80\00\00\41\00\d2"
"\00\26\00\41\00\25\01\0b\8f\80\80\80\00\00\41\00"
"\41\01\36\02\00\41\00\28\42\01\00\0b\9a\80\80\80"
"\00\00\02\40\02\40\1f\40\02\00\00\01\02\00\08\01"
"\0b\00\0b\41\00\0f\0b\41\01\0f\0b"
)
(module instance)
(assert_return (invoke "glob") (i32.const 0x1))
(assert_return (invoke "tab") (ref.func))
(assert_return (invoke "mem") (i32.const 0x1))
(assert_return (invoke "tag") (i32.const 0x1))
(assert_return (invoke $I1 "set" (i32.const 0x1)))
162 changes: 3 additions & 159 deletions test/regress/core/instance.wast
Original file line number Diff line number Diff line change
Expand Up @@ -2,169 +2,13 @@

(module definition $M
(global (export "glob") (mut i32) (i32.const 0))
(table (export "tab") 10 funcref (ref.null func))
(memory (export "mem") 1)
(tag (export "tag"))
(func (export "get") (result i32) (global.get 0))
(func (export "set") (param i32) (global.set 0 (local.get 0)))
)

(module instance $I1 $M)
(module instance $I2 $M)
(register "I1" $I1)
(register "I2" $I2)

(module
(import "I1" "glob" (global $glob1 (mut i32)))
(import "I2" "glob" (global $glob2 (mut i32)))
(import "I1" "tab" (table $tab1 10 funcref))
(import "I2" "tab" (table $tab2 10 funcref))
(import "I1" "mem" (memory $mem1 1))
(import "I2" "mem" (memory $mem2 1))
(import "I1" "tag" (tag $tag1))
(import "I2" "tag" (tag $tag2))

(func $f)
(elem declare func $f)

(func (export "glob") (result i32)
(global.set $glob1 (i32.const 1))
(global.get $glob2)
)
(func (export "tab") (result funcref)
(table.set $tab1 (i32.const 0) (ref.func $f))
(table.get $tab2 (i32.const 0))
)
(func (export "mem") (result i32)
(i32.store $mem1 (i32.const 0) (i32.const 1))
(i32.load $mem2 (i32.const 0))
)
(func (export "tag") (result i32)
(block $on_tag1
(block $on_other
(try_table (catch $tag1 $on_tag1) (catch_all $on_other)
(throw $tag2)
)
(unreachable)
)
(return (i32.const 0))
)
(return (i32.const 1))
)
)

(assert_return (invoke "glob") (i32.const 0))
(assert_return (invoke "tab") (ref.null))
(assert_return (invoke "mem") (i32.const 0))
(assert_return (invoke "tag") (i32.const 0))


;; Import is not generative

(module
(import "I1" "glob" (global $glob1 (mut i32)))
(import "I1" "glob" (global $glob2 (mut i32)))
(import "I1" "tab" (table $tab1 10 funcref))
(import "I1" "tab" (table $tab2 10 funcref))
(import "I1" "mem" (memory $mem1 1))
(import "I1" "mem" (memory $mem2 1))
(import "I1" "tag" (tag $tag1))
(import "I1" "tag" (tag $tag2))

(func $f)
(elem declare func $f)

(func (export "glob") (result i32)
(global.set $glob1 (i32.const 1))
(global.get $glob2)
)
(func (export "tab") (result funcref)
(table.set $tab1 (i32.const 0) (ref.func $f))
(table.get $tab2 (i32.const 0))
)
(func (export "mem") (result i32)
(i32.store $mem1 (i32.const 0) (i32.const 1))
(i32.load $mem2 (i32.const 0))
)
(func (export "tag") (result i32)
(block $on_tag1
(block $on_other
(try_table (catch $tag1 $on_tag1) (catch_all $on_other)
(throw $tag2)
)
(unreachable)
)
(return (i32.const 0))
)
(return (i32.const 1))
)
)

(assert_return (invoke "glob") (i32.const 1))
(assert_return (invoke "tab") (ref.func))
(assert_return (invoke "mem") (i32.const 1))
(assert_return (invoke "tag") (i32.const 1))


;; Export is not generative

(module definition $N
(global $glob (mut i32) (i32.const 0))
(table $tab 10 funcref (ref.null func))
(memory $mem 1)
(tag $tag)

(export "glob1" (global $glob))
(export "glob2" (global $glob))
(export "tab1" (table $tab))
(export "tab2" (table $tab))
(export "mem1" (memory $mem))
(export "mem2" (memory $mem))
(export "tag1" (tag $tag))
(export "tag2" (tag $tag))
)

(module instance $I $N)
(register "I" $I)

(module
(import "I" "glob1" (global $glob1 (mut i32)))
(import "I" "glob2" (global $glob2 (mut i32)))
(import "I" "tab1" (table $tab1 10 funcref))
(import "I" "tab2" (table $tab2 10 funcref))
(import "I" "mem1" (memory $mem1 1))
(import "I" "mem2" (memory $mem2 1))
(import "I" "tag1" (tag $tag1))
(import "I" "tag2" (tag $tag2))

(func $f)
(elem declare func $f)

(func (export "glob") (result i32)
(global.set $glob1 (i32.const 1))
(global.get $glob2)
)
(func (export "tab") (result funcref)
(table.set $tab1 (i32.const 0) (ref.func $f))
(table.get $tab2 (i32.const 0))
)
(func (export "mem") (result i32)
(i32.store $mem1 (i32.const 0) (i32.const 1))
(i32.load $mem2 (i32.const 0))
)
(func (export "tag") (result i32)
(block $on_tag1
(block $on_other
(try_table (catch $tag1 $on_tag1) (catch_all $on_other)
(throw $tag2)
)
(unreachable)
)
(return (i32.const 0))
)
(return (i32.const 1))
)
)

(assert_return (invoke "glob") (i32.const 1))
(assert_return (invoke "tab") (ref.func))
(assert_return (invoke "mem") (i32.const 1))
(assert_return (invoke "tag") (i32.const 1))
(assert_return (invoke $I1 "set" (i32.const 1)))
Loading

0 comments on commit 039e4e6

Please sign in to comment.