| ;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. |
| ;; RUN: foreach %s %t wasm-ctor-eval --ctors=test --kept-exports=test --quiet -all -S -o - | filecheck %s |
| |
| ;; The start function traps here, so we cannot eval anything. None of the |
| ;; globals should change. |
| |
| (module |
| ;; CHECK: (type $0 (func)) |
| |
| ;; CHECK: (type $1 (func (result i32))) |
| |
| ;; CHECK: (global $global1 (mut i32) (i32.const 0)) |
| (global $global1 (mut i32) (i32.const 0)) |
| |
| ;; CHECK: (global $global2 (mut i32) (i32.const 0)) |
| (global $global2 (mut i32) (i32.const 0)) |
| |
| ;; CHECK: (export "test" (func $test)) |
| |
| ;; CHECK: (export "keepalive" (func $keepalive)) |
| |
| ;; CHECK: (start $start) |
| (start $start) |
| |
| ;; CHECK: (func $start (type $0) |
| ;; CHECK-NEXT: (global.set $global2 |
| ;; CHECK-NEXT: (i32.const 42) |
| ;; CHECK-NEXT: ) |
| ;; CHECK-NEXT: (unreachable) |
| ;; CHECK-NEXT: ) |
| (func $start |
| (global.set $global2 |
| (i32.const 42) |
| ) |
| (unreachable) |
| ) |
| |
| ;; CHECK: (func $test (type $0) |
| ;; CHECK-NEXT: (global.set $global1 |
| ;; CHECK-NEXT: (i32.const 1337) |
| ;; CHECK-NEXT: ) |
| ;; CHECK-NEXT: ) |
| (func $test (export "test") |
| (global.set $global1 |
| (i32.const 1337) |
| ) |
| ) |
| |
| ;; CHECK: (func $keepalive (type $1) (result i32) |
| ;; CHECK-NEXT: (i32.add |
| ;; CHECK-NEXT: (global.get $global1) |
| ;; CHECK-NEXT: (global.get $global2) |
| ;; CHECK-NEXT: ) |
| ;; CHECK-NEXT: ) |
| (func $keepalive (export "keepalive") (result i32) |
| ;; Keep the globals alive to show changes. |
| (i32.add |
| (global.get $global1) |
| (global.get $global2) |
| ) |
| ) |
| ) |