Skip to content

A lightweight WebAssembly runtime that is fast, secure, and standards-compliant

3.4 KB
Raw Blame
;;! target = "x86_64"
;;! flags = "-W function-references,gc -C collector=null"
;;! test = "optimize"

(module
  (type $t1 (sub (func)))
  (type $t2 (sub $t1 (func)))
  (type $t3 (sub $t2 (func)))

  (import "" "f2" (func $f2 (type $t2)))
  (import "" "f3" (func $f3 (type $t3)))

  (table (ref null $t2) (elem $f2 $f3))

  (func (export "run") (param i32)
    (call_indirect (type $t1) (local.get 0))
  )
)
;; function u0:0(i64 vmctx, i64, i32) tail {
;;     region0 = 123 ""
;;     region1 = 160 ""
;;     region2 = 93 ""
;;     region3 = 117 ""
;;     region4 = 130 ""
;;     region5 = 134 ""
;;     region6 = 120 ""
;;     region7 = 100 ""
;;     gv0 = vmctx
;;     gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;;     gv2 = load.i64 notrap aligned region1 gv1+24
;;     sig0 = (i64 vmctx, i64) tail
;;     sig1 = (i64 vmctx, i32, i64) -> i64 tail
;;     sig2 = (i64 vmctx, i32, i32) -> i32 tail
;;     fn0 = colocated u805306368:6 sig1
;;     fn1 = colocated u805306368:26 sig2
;;     stack_limit = gv2
;;
;;                                 block0(v0: i64, v1: i64, v2: i32):
;; @005c                               v3 = iconst.i32 2
;; @005c                               v4 = icmp uge v2, v3  ; v3 = 2
;; @005c                               v10 = iconst.i64 0
;; @005c                               v6 = load.i64 notrap aligned readonly can_move region2 v0+112
;; @005c                               v5 = uextend.i64 v2
;; @005c                               v7 = iconst.i64 3
;; @005c                               v8 = ishl v5, v7  ; v7 = 3
;; @005c                               v9 = iadd v6, v8
;; @005c                               v11 = select_spectre_guard v4, v10, v9  ; v10 = 0
;; @005c                               v12 = load.i64 user6 aligned region3 v11
;; @005c                               v13 = iconst.i64 -2
;; @005c                               v14 = band v12, v13  ; v13 = -2
;; @005c                               brif v12, block3(v14), block2
;;
;;                                 block2 cold:
;; @005c                               v16 = iconst.i32 0
;; @005c                               v18 = call fn0(v0, v16, v5)  ; v16 = 0
;; @005c                               jump block3(v18)
;;
;;                                 block3(v15: i64):
;; @005c                               v21 = load.i32 user7 aligned readonly region1 v15+16
;; @005c                               v19 = load.i64 notrap aligned readonly can_move region4 v0+40
;; @005c                               v20 = load.i32 notrap aligned readonly can_move region5 v19
;; @005c                               v22 = icmp eq v21, v20
;; @005c                               v23 = uextend.i32 v22
;; @005c                               brif v22, block5(v23), block4
;;
;;                                 block4:
;; @005c                               v24 = call fn1(v0, v21, v20)
;; @005c                               jump block5(v24)
;;
;;                                 block5(v25: i32):
;; @005c                               trapz v25, user8
;; @005c                               v26 = load.i64 notrap aligned readonly region6 v15+8
;; @005c                               v27 = load.i64 notrap aligned readonly region7 v15+24
;; @005c                               call_indirect sig0, v26(v27, v0)
;; @005f                               jump block1
;;
;;                                 block1:
;; @005f                               return
;; }