| ;; 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=ctor --kept-exports=ctor,main --quiet -all -S -o - | filecheck %s |
| |
| ;; Test that we properly stop precomputing at an unhandled suspend. $ctor will |
| ;; decrement $global, and we apply that to the global. We should remove that |
| ;; decrement from the export, which will only contain the suspend that we |
| ;; stopped at. (After that, $main will print the same value, 99, as if we didn't |
| ;; precompute.) |
| |
| (module |
| ;; CHECK: (type $none-none (func)) |
| |
| ;; CHECK: (type $i32-none (func (param i32))) |
| (type $i32-none (func (param i32))) |
| (type $none-none (func)) |
| |
| ;; CHECK: (import "fuzzing-support" "log-i32" (func $log (type $i32-none) (param i32))) |
| (import "fuzzing-support" "log-i32" (func $log (type $i32-none))) |
| |
| ;; CHECK: (global $global (mut i32) (i32.const 99)) |
| (global $global (mut i32) (i32.const 100)) |
| |
| ;; CHECK: (tag $tag (type $none-none)) |
| (tag $tag (type $none-none)) |
| |
| (export "ctor" (func $ctor)) |
| ;; CHECK: (export "ctor" (func $ctor_3)) |
| |
| ;; CHECK: (export "main" (func $main)) |
| (export "main" (func $main)) |
| |
| (func $ctor (type $none-none) |
| (global.set $global |
| (i32.sub |
| (global.get $global) |
| (i32.const 1) |
| ) |
| ) |
| (suspend $tag) |
| ) |
| |
| ;; CHECK: (func $main (type $none-none) |
| ;; CHECK-NEXT: (call $log |
| ;; CHECK-NEXT: (global.get $global) |
| ;; CHECK-NEXT: ) |
| ;; CHECK-NEXT: ) |
| (func $main (type $none-none) |
| (global.get $global) |
| (call $log) |
| ) |
| ) |
| ;; CHECK: (func $ctor_3 (type $none-none) |
| ;; CHECK-NEXT: (suspend $tag) |
| ;; CHECK-NEXT: ) |