|
| 1 | +;;! target = "x86_64" |
| 2 | +;;! flags = "-W function-references,gc" |
| 3 | +;;! test = "optimize" |
| 4 | + |
| 5 | +(module |
| 6 | + (import "" "observe" (func $observe (param anyref))) |
| 7 | + (import "" "safepoint" (func $safepoint)) |
| 8 | + |
| 9 | + (func (param structref i31ref i32) |
| 10 | + ;; Select from two types, one of which requires inclusion in stack maps, |
| 11 | + ;; resulting in a value that also requires inclusion in stack maps. |
| 12 | + (select (result anyref) |
| 13 | + (local.get 0) |
| 14 | + (local.get 1) |
| 15 | + (local.get 2)) |
| 16 | + |
| 17 | + ;; Make a call, which is a safepoint and has stack maps. |
| 18 | + (call $safepoint) |
| 19 | + |
| 20 | + ;; Observe the result of the select to keep it alive across the call. |
| 21 | + call $observe |
| 22 | + ) |
| 23 | + |
| 24 | + (func (param i31ref i31ref i32) |
| 25 | + ;; Select from two types that do not require inclusion in stack maps, |
| 26 | + ;; resulting in one that (normally) does. In this case, however, we |
| 27 | + ;; shouldn't include the value in a stack map, because we know that the |
| 28 | + ;; anyref cannot be an instance of a subtype that actually does require |
| 29 | + ;; inclusion in stack maps. |
| 30 | + (select (result anyref) |
| 31 | + (local.get 0) |
| 32 | + (local.get 1) |
| 33 | + (local.get 2)) |
| 34 | + |
| 35 | + ;; Make a call, which is a safepoint and has stack maps. |
| 36 | + (call $safepoint) |
| 37 | + |
| 38 | + ;; Observe the result of the select to keep it alive across the call. |
| 39 | + call $observe |
| 40 | + ) |
| 41 | +) |
| 42 | +;; function u0:0(i64 vmctx, i64, i32, i32, i32) tail { |
| 43 | +;; ss0 = explicit_slot 4, align = 4 |
| 44 | +;; gv0 = vmctx |
| 45 | +;; gv1 = load.i64 notrap aligned readonly gv0+8 |
| 46 | +;; gv2 = load.i64 notrap aligned gv1+24 |
| 47 | +;; gv3 = vmctx |
| 48 | +;; sig0 = (i64 vmctx, i64) tail |
| 49 | +;; sig1 = (i64 vmctx, i64, i32) tail |
| 50 | +;; stack_limit = gv2 |
| 51 | +;; |
| 52 | +;; block0(v0: i64, v1: i64, v2: i32, v3: i32, v4: i32): |
| 53 | +;; @0049 v5 = select v4, v2, v3 |
| 54 | +;; v14 = stack_addr.i64 ss0 |
| 55 | +;; store notrap v5, v14 |
| 56 | +;; @004c v8 = load.i64 notrap aligned readonly can_move v0+72 |
| 57 | +;; @004c v7 = load.i64 notrap aligned readonly can_move v0+88 |
| 58 | +;; @004c call_indirect sig0, v8(v7, v0), stack_map=[i32 @ ss0+0] |
| 59 | +;; v12 = load.i32 notrap v14 |
| 60 | +;; @004e v11 = load.i64 notrap aligned readonly can_move v0+48 |
| 61 | +;; @004e v10 = load.i64 notrap aligned readonly can_move v0+64 |
| 62 | +;; @004e call_indirect sig1, v11(v10, v0, v12) |
| 63 | +;; @0050 jump block1 |
| 64 | +;; |
| 65 | +;; block1: |
| 66 | +;; @0050 return |
| 67 | +;; } |
| 68 | +;; |
| 69 | +;; function u0:1(i64 vmctx, i64, i32, i32, i32) tail { |
| 70 | +;; gv0 = vmctx |
| 71 | +;; gv1 = load.i64 notrap aligned readonly gv0+8 |
| 72 | +;; gv2 = load.i64 notrap aligned gv1+24 |
| 73 | +;; gv3 = vmctx |
| 74 | +;; sig0 = (i64 vmctx, i64) tail |
| 75 | +;; sig1 = (i64 vmctx, i64, i32) tail |
| 76 | +;; stack_limit = gv2 |
| 77 | +;; |
| 78 | +;; block0(v0: i64, v1: i64, v2: i32, v3: i32, v4: i32): |
| 79 | +;; @005c v8 = load.i64 notrap aligned readonly can_move v0+72 |
| 80 | +;; @005c v7 = load.i64 notrap aligned readonly can_move v0+88 |
| 81 | +;; @005c call_indirect sig0, v8(v7, v0) |
| 82 | +;; @005e v11 = load.i64 notrap aligned readonly can_move v0+48 |
| 83 | +;; @005e v10 = load.i64 notrap aligned readonly can_move v0+64 |
| 84 | +;; @0059 v5 = select v4, v2, v3 |
| 85 | +;; @005e call_indirect sig1, v11(v10, v0, v5) |
| 86 | +;; @0060 jump block1 |
| 87 | +;; |
| 88 | +;; block1: |
| 89 | +;; @0060 return |
| 90 | +;; } |
0 commit comments