From 38246250babddd05833f20338f4f77e9ef598a38 Mon Sep 17 00:00:00 2001 From: Joachim Breitner Date: Fri, 14 Nov 2025 14:04:28 +0100 Subject: [PATCH 1/2] sideconditions: also traverse function clauses --- spectec/src/middlend/sideconditions.ml | 20 +++- .../specification.05-sideconditions.exp | 103 +++++++++++++++++- .../test-middlend/specification.06-sub.exp | 103 +++++++++++++++++- .../specification.07-alias-demut.exp | 103 +++++++++++++++++- 4 files changed, 322 insertions(+), 7 deletions(-) diff --git a/spectec/src/middlend/sideconditions.ml b/spectec/src/middlend/sideconditions.ml index 1daee6b9c3..72f5d5d1b2 100644 --- a/spectec/src/middlend/sideconditions.ml +++ b/spectec/src/middlend/sideconditions.ml @@ -7,7 +7,7 @@ of terms in premises and conclusions: * Option projection !(e) e =!= null (The option projection would probably be nicer by rewriting !(e) to a fresh -variable x and require e=?x. Maybe later.) +variable x and require e=?x, see the UnThe pass for that.) *) open Util @@ -185,10 +185,28 @@ let t_rule x = { x with it = t_rule' x.it } let t_rules = List.map t_rule +let t_clause' = function + | DefD (binds, args, exp, prems) -> + let env = List.fold_left (fun env bind -> + match bind.it with + | ExpB (v, t) -> Env.add v.it t env + | _ -> env) Env.empty binds + in + let prems' = t_prems env prems in + let extra_prems = t_exp env exp in + let reduced_prems = reduce_prems (extra_prems @ prems') in + DefD (binds, args, exp, reduced_prems) + +let t_clause x = { x with it = t_clause' x.it } + +let t_clauses = List.map t_clause + let rec t_def' = function | RecD defs -> RecD (List.map t_def defs) | RelD (id, mixop, typ, rules) -> RelD (id, mixop, typ, t_rules rules) + | DecD (id, params, typ, clauses) -> + DecD (id, params, typ, t_clauses clauses) | def -> def and t_def x = { x with it = t_def' x.it } diff --git a/spectec/test-middlend/specification.05-sideconditions.exp b/spectec/test-middlend/specification.05-sideconditions.exp index 040456341e..9afb087b0f 100644 --- a/spectec/test-middlend/specification.05-sideconditions.exp +++ b/spectec/test-middlend/specification.05-sideconditions.exp @@ -96,6 +96,7 @@ def $disjoint_(syntax X, X*) : bool def $disjoint_{syntax X}(syntax X, []) = true ;; ../../../../specification/wasm-3.0/0.3-aux.seq.spectec:37.1-37.68 def $disjoint_{syntax X, w : X, `w'*` : X*}(syntax X, [w] ++ w'*{w' <- `w'*`}) = (~ (w <- w'*{w' <- `w'*`}) /\ $disjoint_(syntax X, w'*{w' <- `w'*`})) + -- if (|w'*{w' <- `w'*`}| > 0) } ;; ../../../../specification/wasm-3.0/0.3-aux.seq.spectec @@ -1352,6 +1353,7 @@ def $inv_jsize(nat : nat) : Jnn? def $inv_jsize(16) = ?(I16_Jnn) ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec def $inv_jsize{n : nat}(n) = ?((!($inv_isize(n)) : addrtype <: Jnn)) + -- if ($inv_isize(n) =/= ?()) def $inv_jsize{x0 : nat}(x0) = ?() ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec @@ -1411,6 +1413,7 @@ def $jsizenn(Jnn : Jnn) : nat def $inv_jsizenn(nat : nat) : Jnn? ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec def $inv_jsizenn{n : nat}(n) = ?(!($inv_jsize(n))) + -- if ($inv_jsize(n) =/= ?()) def $inv_jsizenn{x0 : nat}(x0) = ?() ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec @@ -1922,6 +1925,7 @@ def $rolldt(typeidx : typeidx, rectype : rectype) : deftype* def $unrolldt(deftype : deftype) : subtype ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec def $unrolldt{rectype : rectype, i : nat, `subtype*` : subtype*}(_DEF_deftype(rectype, i)) = subtype*{subtype <- `subtype*`}[i] + -- if (i < |subtype*{subtype <- `subtype*`}|) -- (wf_subtype: `%`(subtype))*{subtype <- `subtype*`} -- if ($unrollrt(rectype) = REC_rectype(`%`_list(subtype*{subtype <- `subtype*`}))) @@ -5392,10 +5396,12 @@ def $unrollht(context : context, heaptype : heaptype) : subtype -- wf_context: `%`(C) ;; ../../../../specification/wasm-3.0/2.1-validation.types.spectec def $unrollht{C : context, typeidx : uN}(C, _IDX_heaptype(typeidx)) = $unrolldt(C.TYPES_context[typeidx!`%`_uN.0]) + -- if (typeidx!`%`_uN.0 < |C.TYPES_context|) -- wf_context: `%`(C) -- wf_uN: `%%`(32, typeidx) ;; ../../../../specification/wasm-3.0/2.1-validation.types.spectec def $unrollht{C : context, i : nat}(C, REC_heaptype(i)) = C.RECS_context[i] + -- if (i < |C.RECS_context|) -- wf_context: `%`(C) ;; ../../../../specification/wasm-3.0/2.1-validation.types.spectec @@ -7876,6 +7882,7 @@ relation wf_relaxed4: `%`(relaxed4) def $relaxed2(relaxed2 : relaxed2, syntax X, X : X, X : X) : X ;; ../../../../specification/wasm-3.0/3.0-numerics.relaxed.spectec def $relaxed2{i : relaxed2, syntax X, X_1 : X, X_2 : X}(i, syntax X, X_1, X_2) = [X_1 X_2][i!`%`_relaxed2.0] + -- if (i!`%`_relaxed2.0 < |[X_1 X_2]|) -- wf_relaxed2: `%`(i) -- if $ND ;; ../../../../specification/wasm-3.0/3.0-numerics.relaxed.spectec @@ -7887,6 +7894,7 @@ def $relaxed2(relaxed2 : relaxed2, syntax X, X : X, X : X) : X def $relaxed4(relaxed4 : relaxed4, syntax X, X : X, X : X, X : X, X : X) : X ;; ../../../../specification/wasm-3.0/3.0-numerics.relaxed.spectec def $relaxed4{i : relaxed4, syntax X, X_1 : X, X_2 : X, X_3 : X, X_4 : X}(i, syntax X, X_1, X_2, X_3, X_4) = [X_1 X_2 X_3 X_4][i!`%`_relaxed4.0] + -- if (i!`%`_relaxed4.0 < |[X_1 X_2 X_3 X_4]|) -- wf_relaxed4: `%`(i) -- if $ND ;; ../../../../specification/wasm-3.0/3.0-numerics.relaxed.spectec @@ -8445,6 +8453,7 @@ def $cunpacknum_(storagetype : storagetype, lit_ : lit_) : lit_ -- wf_lit_: `%%`((consttype : consttype <: storagetype), c) ;; ../../../../specification/wasm-3.0/3.1-numerics.scalar.spectec def $cunpacknum_{packtype : packtype, c : uN}((packtype : packtype <: storagetype), mk_lit__2_lit_(packtype, c)) = mk_lit__0_lit_(I32_numtype, mk_num__0_num_(I32_Inn, $extend__($psize(packtype), $size($lunpack((packtype : packtype <: lanetype))), U_sx, c))) + -- if ($cunpack((packtype : packtype <: storagetype)) =/= ?()) -- wf_lit_: `%%`((!($cunpack((packtype : packtype <: storagetype))) : consttype <: storagetype), mk_lit__0_lit_(I32_numtype, mk_num__0_num_(I32_Inn, $extend__($psize(packtype), $size($lunpack((packtype : packtype <: lanetype))), U_sx, c)))) ;; ../../../../specification/wasm-3.0/3.1-numerics.scalar.spectec @@ -8679,9 +8688,9 @@ def $half(half : half, nat : nat, nat : nat) : nat def $iswizzle_lane_(N : N, iN*, iN : iN) : iN ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec def $iswizzle_lane_{N : nat, `c*` : iN*, i : uN}(N, c*{c <- `c*`}, i) = c*{c <- `c*`}[i!`%`_uN.0] + -- if (i!`%`_uN.0 < |c*{c <- `c*`}|) -- (wf_uN: `%%`(N, c))*{c <- `c*`} -- wf_uN: `%%`(N, i) - -- if (i!`%`_uN.0 < |c*{c <- `c*`}|) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec def $iswizzle_lane_{N : nat, `c*` : iN*, i : uN}(N, c*{c <- `c*`}, i) = `%`_iN(0) -- (wf_uN: `%%`(N, c))*{c <- `c*`} @@ -8693,9 +8702,9 @@ def $iswizzle_lane_(N : N, iN*, iN : iN) : iN def $irelaxed_swizzle_lane_(N : N, iN*, iN : iN) : iN ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec def $irelaxed_swizzle_lane_{N : nat, `c*` : iN*, i : uN}(N, c*{c <- `c*`}, i) = c*{c <- `c*`}[i!`%`_uN.0] + -- if (i!`%`_uN.0 < |c*{c <- `c*`}|) -- (wf_uN: `%%`(N, c))*{c <- `c*`} -- wf_uN: `%%`(N, i) - -- if (i!`%`_uN.0 < |c*{c <- `c*`}|) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec def $irelaxed_swizzle_lane_{N : nat, `c*` : iN*, i : uN}(N, c*{c <- `c*`}, i) = `%`_iN(0) -- (wf_uN: `%%`(N, c))*{c <- `c*`} @@ -8704,6 +8713,7 @@ def $irelaxed_swizzle_lane_(N : N, iN*, iN : iN) : iN -- if ($signed_(N, i!`%`_uN.0) < (0 : nat <:> int)) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec def $irelaxed_swizzle_lane_{N : nat, `c*` : iN*, i : uN}(N, c*{c <- `c*`}, i) = $relaxed2($R_swizzle, syntax iN, `%`_iN(0), c*{c <- `c*`}[(i!`%`_uN.0 \ |c*{c <- `c*`}|)]) + -- if ((i!`%`_uN.0 \ |c*{c <- `c*`}|) < |c*{c <- `c*`}|) -- (wf_uN: `%%`(N, c))*{c <- `c*`} -- wf_uN: `%%`(N, i) -- wf_uN: `%%`(N, `%`_uN(0)) @@ -8718,6 +8728,7 @@ def $ivunop_(shape : shape, def $f_(N : N, iN : iN) : iN, vec_ : vec_) : vec_* -- wf_shape: `%`(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))) -- (wf_lane_: `%%`($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))), mk_lane__2_lane_(Jnn, c)))*{c <- `c*`} -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), v_1)) + -- (if ($proj_lane__2(Jnn, c_1) =/= ?()))*{c_1 <- `c_1*`} -- if (c*{c <- `c*`} = $f_($lsizenn((Jnn : Jnn <: lanetype)), !($proj_lane__2(Jnn, c_1)))*{c_1 <- `c_1*`}) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec @@ -8743,6 +8754,8 @@ def $ivbinop_(shape : shape, def $f_(N : N, iN : iN, iN : iN) : iN, vec_ : vec_, -- (wf_lane_: `%%`($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))), mk_lane__2_lane_(Jnn, c)))*{c <- `c*`} -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), v_1)) -- if (c_2*{c_2 <- `c_2*`} = $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), v_2)) + -- (if ($proj_lane__2(Jnn, c_1) =/= ?()))*{c_1 <- `c_1*`} + -- (if ($proj_lane__2(Jnn, c_2) =/= ?()))*{c_2 <- `c_2*`} -- if (c*{c <- `c*`} = $f_($lsizenn((Jnn : Jnn <: lanetype)), !($proj_lane__2(Jnn, c_1)), !($proj_lane__2(Jnn, c_2)))*{c_1 <- `c_1*`, c_2 <- `c_2*`}) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec @@ -8757,6 +8770,8 @@ def $ivbinopsx_(shape : shape, def $f_(N : N, sx : sx, iN : iN, iN : iN) : iN, s -- (wf_lane_: `%%`($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))), mk_lane__2_lane_(Jnn, c)))*{c <- `c*`} -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), v_1)) -- if (c_2*{c_2 <- `c_2*`} = $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), v_2)) + -- (if ($proj_lane__2(Jnn, c_1) =/= ?()))*{c_1 <- `c_1*`} + -- (if ($proj_lane__2(Jnn, c_2) =/= ?()))*{c_2 <- `c_2*`} -- if (c*{c <- `c*`} = $f_($lsizenn((Jnn : Jnn <: lanetype)), sx, !($proj_lane__2(Jnn, c_1)), !($proj_lane__2(Jnn, c_2)))*{c_1 <- `c_1*`, c_2 <- `c_2*`}) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec @@ -8767,6 +8782,7 @@ def $ivbinopsxnd_(shape : shape, def $f_(N : N, sx : sx, iN : iN, iN : iN) : iN* -- wf_uN: `%%`(128, v_2) -- (wf_lane_: `%%`((Jnn : Jnn <: lanetype), c))*{c <- `c*`}*{`c*` <- `c**`} -- wf_shape: `%`(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))) + -- if (|`c_1*`| = |`c_2*`|) -- (wf_lane_: `%%`((Jnn : Jnn <: lanetype), mk_lane__2_lane_(Jnn, iter_0)))*{iter_0 <- $f_($lsizenn((Jnn : Jnn <: lanetype)), sx, !($proj_lane__2(Jnn, c_1)), !($proj_lane__2(Jnn, c_2)))}*{c_1 <- `c_1*`, c_2 <- `c_2*`} -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), v_1)) -- if (c_2*{c_2 <- `c_2*`} = $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), v_2)) @@ -8780,6 +8796,7 @@ def $fvbinop_(shape : shape, def $f_(N : N, fN : fN, fN : fN) : fN*, vec_ : vec_ -- wf_uN: `%%`(128, v_2) -- (wf_lane_: `%%`((Fnn : Fnn <: lanetype), c))*{c <- `c*`}*{`c*` <- `c**`} -- wf_shape: `%`(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M))) + -- if (|`c_1*`| = |`c_2*`|) -- (wf_lane_: `%%`((Fnn : Fnn <: lanetype), mk_lane__0_lane_((Fnn : Fnn <: numtype), mk_num__1_num_(Fnn, iter_0))))*{iter_0 <- $f_($sizenn((Fnn : Fnn <: numtype)), !($proj_num__1(Fnn, !($proj_lane__0((Fnn : Fnn <: numtype), c_1)))), !($proj_num__1(Fnn, !($proj_lane__0((Fnn : Fnn <: numtype), c_2)))))}*{c_1 <- `c_1*`, c_2 <- `c_2*`} -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), v_1)) -- if (c_2*{c_2 <- `c_2*`} = $lanes_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), v_2)) @@ -8794,6 +8811,8 @@ def $ivternopnd_(shape : shape, def $f_(N : N, iN : iN, iN : iN, iN : iN) : iN*, -- wf_uN: `%%`(128, v_3) -- (wf_lane_: `%%`((Jnn : Jnn <: lanetype), c))*{c <- `c*`}*{`c*` <- `c**`} -- wf_shape: `%`(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))) + -- if (|`c_1*`| = |`c_2*`|) + -- if (|`c_1*`| = |`c_3*`|) -- (wf_lane_: `%%`((Jnn : Jnn <: lanetype), mk_lane__2_lane_(Jnn, iter_0)))*{iter_0 <- $f_($lsizenn((Jnn : Jnn <: lanetype)), !($proj_lane__2(Jnn, c_1)), !($proj_lane__2(Jnn, c_2)), !($proj_lane__2(Jnn, c_3)))}*{c_1 <- `c_1*`, c_2 <- `c_2*`, c_3 <- `c_3*`} -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), v_1)) -- if (c_2*{c_2 <- `c_2*`} = $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), v_2)) @@ -8809,6 +8828,8 @@ def $fvternop_(shape : shape, def $f_(N : N, fN : fN, fN : fN, fN : fN) : fN*, v -- wf_uN: `%%`(128, v_3) -- (wf_lane_: `%%`((Fnn : Fnn <: lanetype), c))*{c <- `c*`}*{`c*` <- `c**`} -- wf_shape: `%`(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M))) + -- if (|`c_1*`| = |`c_2*`|) + -- if (|`c_1*`| = |`c_3*`|) -- (wf_lane_: `%%`((Fnn : Fnn <: lanetype), mk_lane__0_lane_((Fnn : Fnn <: numtype), mk_num__1_num_(Fnn, iter_0))))*{iter_0 <- $f_($sizenn((Fnn : Fnn <: numtype)), !($proj_num__1(Fnn, !($proj_lane__0((Fnn : Fnn <: numtype), c_1)))), !($proj_num__1(Fnn, !($proj_lane__0((Fnn : Fnn <: numtype), c_2)))), !($proj_num__1(Fnn, !($proj_lane__0((Fnn : Fnn <: numtype), c_3)))))}*{c_1 <- `c_1*`, c_2 <- `c_2*`, c_3 <- `c_3*`} -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), v_1)) -- if (c_2*{c_2 <- `c_2*`} = $lanes_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), v_2)) @@ -8824,6 +8845,7 @@ def $ivtestop_(shape : shape, def $f_(N : N, iN : iN) : u32, vec_ : vec_) : u32 -- wf_uN: `%%`(32, `%`_uN($prod(c!`%`_uN.0*{c <- `c*`}))) -- wf_shape: `%`(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))) -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), v_1)) + -- (if ($proj_lane__2(Jnn, c_1) =/= ?()))*{c_1 <- `c_1*`} -- if (c*{c <- `c*`} = $f_($lsizenn((Jnn : Jnn <: lanetype)), !($proj_lane__2(Jnn, c_1)))*{c_1 <- `c_1*`}) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec @@ -8835,6 +8857,8 @@ def $fvtestop_(shape : shape, def $f_(N : N, fN : fN) : u32, vec_ : vec_) : u32 -- wf_uN: `%%`(32, `%`_uN($prod(c!`%`_uN.0*{c <- `c*`}))) -- wf_shape: `%`(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M))) -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), v_1)) + -- (if ($proj_num__1(Fnn, !($proj_lane__0((Fnn : Fnn <: numtype), c_1))) =/= ?()))*{c_1 <- `c_1*`} + -- (if ($proj_lane__0((Fnn : Fnn <: numtype), c_1) =/= ?()))*{c_1 <- `c_1*`} -- if (c*{c <- `c*`} = $f_($sizenn((Fnn : Fnn <: numtype)), !($proj_num__1(Fnn, !($proj_lane__0((Fnn : Fnn <: numtype), c_1)))))*{c_1 <- `c_1*`}) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec @@ -8845,6 +8869,9 @@ def $ivrelop_(shape : shape, def $f_(N : N, iN : iN, iN : iN) : u32, vec_ : vec_ -- wf_uN: `%%`(128, v_2) -- wf_shape: `%`(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))) -- (wf_lane_: `%%`($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))), mk_lane__2_lane_(Jnn, c)))*{c <- `c*`} + -- if (|`c_1*`| = |`c_2*`|) + -- (if ($proj_lane__2(Jnn, c_1) =/= ?()))*{c_1 <- `c_1*`} + -- (if ($proj_lane__2(Jnn, c_2) =/= ?()))*{c_2 <- `c_2*`} -- (wf_uN: `%%`(1, `%`_uN($f_($lsizenn((Jnn : Jnn <: lanetype)), !($proj_lane__2(Jnn, c_1)), !($proj_lane__2(Jnn, c_2)))!`%`_uN.0)))*{c_1 <- `c_1*`, c_2 <- `c_2*`} -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), v_1)) -- if (c_2*{c_2 <- `c_2*`} = $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), v_2)) @@ -8858,6 +8885,9 @@ def $ivrelopsx_(shape : shape, def $f_(N : N, sx : sx, iN : iN, iN : iN) : u32, -- wf_uN: `%%`(128, v_2) -- wf_shape: `%`(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))) -- (wf_lane_: `%%`($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))), mk_lane__2_lane_(Jnn, c)))*{c <- `c*`} + -- if (|`c_1*`| = |`c_2*`|) + -- (if ($proj_lane__2(Jnn, c_1) =/= ?()))*{c_1 <- `c_1*`} + -- (if ($proj_lane__2(Jnn, c_2) =/= ?()))*{c_2 <- `c_2*`} -- (wf_uN: `%%`(1, `%`_uN($f_($lsizenn((Jnn : Jnn <: lanetype)), sx, !($proj_lane__2(Jnn, c_1)), !($proj_lane__2(Jnn, c_2)))!`%`_uN.0)))*{c_1 <- `c_1*`, c_2 <- `c_2*`} -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), v_1)) -- if (c_2*{c_2 <- `c_2*`} = $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), v_2)) @@ -8872,6 +8902,11 @@ def $fvrelop_(shape : shape, def $f_(N : N, fN : fN, fN : fN) : u32, vec_ : vec_ -- wf_shape: `%`(`%X%`_shape((Inn : addrtype <: lanetype), `%`_dim(M))) -- (wf_lane_: `%%`($lanetype(`%X%`_shape((Inn : addrtype <: lanetype), `%`_dim(M))), mk_lane__0_lane_((Inn : addrtype <: numtype), mk_num__0_num_(Inn, `%`_uN(c!`%`_uN.0)))))*{c <- `c*`} -- wf_shape: `%`(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M))) + -- if (|`c_1*`| = |`c_2*`|) + -- (if ($proj_num__1(Fnn, !($proj_lane__0((Fnn : Fnn <: numtype), c_1))) =/= ?()))*{c_1 <- `c_1*`} + -- (if ($proj_lane__0((Fnn : Fnn <: numtype), c_1) =/= ?()))*{c_1 <- `c_1*`} + -- (if ($proj_num__1(Fnn, !($proj_lane__0((Fnn : Fnn <: numtype), c_2))) =/= ?()))*{c_2 <- `c_2*`} + -- (if ($proj_lane__0((Fnn : Fnn <: numtype), c_2) =/= ?()))*{c_2 <- `c_2*`} -- (wf_uN: `%%`(1, `%`_uN($f_($sizenn((Fnn : Fnn <: numtype)), !($proj_num__1(Fnn, !($proj_lane__0((Fnn : Fnn <: numtype), c_1)))), !($proj_num__1(Fnn, !($proj_lane__0((Fnn : Fnn <: numtype), c_2)))))!`%`_uN.0)))*{c_1 <- `c_1*`, c_2 <- `c_2*`} -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), v_1)) -- if (c_2*{c_2 <- `c_2*`} = $lanes_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), v_2)) @@ -8888,6 +8923,7 @@ def $ivshiftop_(shape : shape, def $f_(N : N, iN : iN, u32 : u32) : iN, vec_ : v -- wf_shape: `%`(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))) -- (wf_lane_: `%%`($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))), mk_lane__2_lane_(Jnn, c)))*{c <- `c*`} -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), v_1)) + -- (if ($proj_lane__2(Jnn, c_1) =/= ?()))*{c_1 <- `c_1*`} -- if (c*{c <- `c*`} = $f_($lsizenn((Jnn : Jnn <: lanetype)), !($proj_lane__2(Jnn, c_1)), i)*{c_1 <- `c_1*`}) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec @@ -8900,6 +8936,7 @@ def $ivshiftopsx_(shape : shape, def $f_(N : N, sx : sx, iN : iN, u32 : u32) : i -- wf_shape: `%`(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))) -- (wf_lane_: `%%`($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))), mk_lane__2_lane_(Jnn, c)))*{c <- `c*`} -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), v_1)) + -- (if ($proj_lane__2(Jnn, c_1) =/= ?()))*{c_1 <- `c_1*`} -- if (c*{c <- `c*`} = $f_($lsizenn((Jnn : Jnn <: lanetype)), sx, !($proj_lane__2(Jnn, c_1)), i)*{c_1 <- `c_1*`}) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec @@ -8909,6 +8946,7 @@ def $ivbitmaskop_(shape : shape, vec_ : vec_) : u32 -- wf_uN: `%%`(128, v_1) -- wf_uN: `%%`(32, c) -- wf_shape: `%`(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))) + -- (if ($proj_lane__2(Jnn, c_1) =/= ?()))*{c_1 <- `c_1*`} -- (wf_bit: `%`(`%`_bit($ilt_($lsizenn((Jnn : Jnn <: lanetype)), S_sx, !($proj_lane__2(Jnn, c_1)), `%`_iN(0))!`%`_uN.0)))*{c_1 <- `c_1*`} -- wf_bit: `%`(`%`_bit(0)) -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), v_1)) @@ -8926,6 +8964,8 @@ def $ivswizzlop_(shape : shape, def $f_(N : N, iN*, iN : iN) : iN, vec_ : vec_, -- (wf_lane_: `%%`($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))), mk_lane__2_lane_(Jnn, c)))*{c <- `c*`} -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), v_1)) -- if (c_2*{c_2 <- `c_2*`} = $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), v_2)) + -- (if ($proj_lane__2(Jnn, c_1) =/= ?()))*{c_1 <- `c_1*`}*{c_2 <- `c_2*`} + -- (if ($proj_lane__2(Jnn, c_2) =/= ?()))*{c_2 <- `c_2*`} -- if (c*{c <- `c*`} = $f_($lsizenn((Jnn : Jnn <: lanetype)), !($proj_lane__2(Jnn, c_1))*{c_1 <- `c_1*`}, !($proj_lane__2(Jnn, c_2)))*{c_2 <- `c_2*`}) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec @@ -8941,6 +8981,7 @@ def $ivshufflop_(shape : shape, laneidx*, vec_ : vec_, vec_ : vec_) : vec_ -- wf_shape: `%`(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))) -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), v_1)) -- if (c_2*{c_2 <- `c_2*`} = $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), v_2)) + -- (if (i!`%`_uN.0 < |c_1*{c_1 <- `c_1*`} ++ c_2*{c_2 <- `c_2*`}|))*{i <- `i*`} -- if (c*{c <- `c*`} = c_1*{c_1 <- `c_1*`} ++ c_2*{c_2 <- `c_2*`}[i!`%`_uN.0]*{i <- `i*`}) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec @@ -9260,6 +9301,7 @@ def $vcvtop__(shape_1 : shape, shape_2 : shape, vcvtop__ : vcvtop__, vec_ : vec_ -- if (($halfop(`%X%`_shape(Lnn_1, `%`_dim(M)), `%X%`_shape(Lnn_2, `%`_dim(M)), vcvtop) = ?()) /\ ($zeroop(`%X%`_shape(Lnn_1, `%`_dim(M)), `%X%`_shape(Lnn_2, `%`_dim(M)), vcvtop) = ?())) -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape(Lnn_1, `%`_dim(M)), v_1)) -- if (c*{c <- `c*`}*{`c*` <- `c**`} = $setproduct_(syntax lane_, $lcvtop__(`%X%`_shape(Lnn_1, `%`_dim(M)), `%X%`_shape(Lnn_2, `%`_dim(M)), vcvtop, c_1)*{c_1 <- `c_1*`})) + -- if (|$inv_lanes_(`%X%`_shape(Lnn_2, `%`_dim(M)), c*{c <- `c*`})*{`c*` <- `c**`}| > 0) -- if (v <- $inv_lanes_(`%X%`_shape(Lnn_2, `%`_dim(M)), c*{c <- `c*`})*{`c*` <- `c**`}) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec def $vcvtop__{Lnn_1 : lanetype, M_1 : nat, Lnn_2 : lanetype, M_2 : nat, vcvtop : vcvtop__, v_1 : uN, v : uN, half : half, `c_1*` : lane_*, `c**` : lane_**}(`%X%`_shape(Lnn_1, `%`_dim(M_1)), `%X%`_shape(Lnn_2, `%`_dim(M_2)), vcvtop, v_1) = v @@ -9273,6 +9315,7 @@ def $vcvtop__(shape_1 : shape, shape_2 : shape, vcvtop__ : vcvtop__, vec_ : vec_ -- if ($halfop(`%X%`_shape(Lnn_1, `%`_dim(M_1)), `%X%`_shape(Lnn_2, `%`_dim(M_2)), vcvtop) = ?(half)) -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape(Lnn_1, `%`_dim(M_1)), v_1)[$half(half, 0, M_2) : M_2]) -- if (c*{c <- `c*`}*{`c*` <- `c**`} = $setproduct_(syntax lane_, $lcvtop__(`%X%`_shape(Lnn_1, `%`_dim(M_1)), `%X%`_shape(Lnn_2, `%`_dim(M_2)), vcvtop, c_1)*{c_1 <- `c_1*`})) + -- if (|$inv_lanes_(`%X%`_shape(Lnn_2, `%`_dim(M_2)), c*{c <- `c*`})*{`c*` <- `c**`}| > 0) -- if (v <- $inv_lanes_(`%X%`_shape(Lnn_2, `%`_dim(M_2)), c*{c <- `c*`})*{`c*` <- `c**`}) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec def $vcvtop__{Lnn_1 : lanetype, M_1 : nat, Lnn_2 : lanetype, M_2 : nat, vcvtop : vcvtop__, v_1 : uN, v : uN, `c_1*` : lane_*, `c**` : lane_**}(`%X%`_shape(Lnn_1, `%`_dim(M_1)), `%X%`_shape(Lnn_2, `%`_dim(M_2)), vcvtop, v_1) = v @@ -9286,6 +9329,7 @@ def $vcvtop__(shape_1 : shape, shape_2 : shape, vcvtop__ : vcvtop__, vec_ : vec_ -- if ($zeroop(`%X%`_shape(Lnn_1, `%`_dim(M_1)), `%X%`_shape(Lnn_2, `%`_dim(M_2)), vcvtop) = ?(ZERO_zero)) -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape(Lnn_1, `%`_dim(M_1)), v_1)) -- if (c*{c <- `c*`}*{`c*` <- `c**`} = $setproduct_(syntax lane_, $lcvtop__(`%X%`_shape(Lnn_1, `%`_dim(M_1)), `%X%`_shape(Lnn_2, `%`_dim(M_2)), vcvtop, c_1)*{c_1 <- `c_1*`} ++ [$zero(Lnn_2)]^M_1{})) + -- if (|$inv_lanes_(`%X%`_shape(Lnn_2, `%`_dim(M_2)), c*{c <- `c*`})*{`c*` <- `c**`}| > 0) -- if (v <- $inv_lanes_(`%X%`_shape(Lnn_2, `%`_dim(M_2)), c*{c <- `c*`})*{`c*` <- `c**`}) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec @@ -9345,7 +9389,9 @@ def $vnarrowop__(shape_1 : shape, shape_2 : shape, sx : sx, vec_ : vec_, vec_ : -- (wf_lane_: `%%`($lanetype(`%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2))), mk_lane__2_lane_(Jnn_2, c'_2)))*{c'_2 <- `c'_2*`} -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), v_1)) -- if (c_2*{c_2 <- `c_2*`} = $lanes_(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), v_2)) + -- (if ($proj_lane__2(Jnn_1, c_1) =/= ?()))*{c_1 <- `c_1*`} -- if (c'_1*{c'_1 <- `c'_1*`} = $narrow__($lsize((Jnn_1 : Jnn <: lanetype)), $lsize((Jnn_2 : Jnn <: lanetype)), sx, !($proj_lane__2(Jnn_1, c_1)))*{c_1 <- `c_1*`}) + -- (if ($proj_lane__2(Jnn_1, c_2) =/= ?()))*{c_2 <- `c_2*`} -- if (c'_2*{c'_2 <- `c'_2*`} = $narrow__($lsize((Jnn_1 : Jnn <: lanetype)), $lsize((Jnn_2 : Jnn <: lanetype)), sx, !($proj_lane__2(Jnn_1, c_2)))*{c_2 <- `c_2*`}) -- if (v = $inv_lanes_(`%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2)), mk_lane__2_lane_(Jnn_2, c'_1)*{c'_1 <- `c'_1*`} ++ mk_lane__2_lane_(Jnn_2, c'_2)*{c'_2 <- `c'_2*`})) @@ -9369,6 +9415,7 @@ def $ivextunop__(shape_1 : shape, shape_2 : shape, def $f_(N : N, iN*) : iN*, sx -- (wf_lane_: `%%`($lanetype(`%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2))), mk_lane__2_lane_(Jnn_2, c)))*{c <- `c*`} -- wf_shape: `%`(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1))) -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), v_1)) + -- (if ($proj_lane__2(Jnn_1, c_1) =/= ?()))*{c_1 <- `c_1*`} -- if (c'_1*{c'_1 <- `c'_1*`} = $extend__($lsizenn1((Jnn_1 : Jnn <: lanetype)), $lsizenn2((Jnn_2 : Jnn <: lanetype)), sx, !($proj_lane__2(Jnn_1, c_1)))*{c_1 <- `c_1*`}) -- if (c*{c <- `c*`} = $f_($lsizenn2((Jnn_2 : Jnn <: lanetype)), c'_1*{c'_1 <- `c'_1*`})) @@ -9417,7 +9464,9 @@ def $ivextbinop__(shape_1 : shape, shape_2 : shape, def $f_(N : N, iN*, iN*) : i -- wf_shape: `%`(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1))) -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), v_1)[i!`%`_uN.0 : k!`%`_uN.0]) -- if (c_2*{c_2 <- `c_2*`} = $lanes_(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), v_2)[i!`%`_uN.0 : k!`%`_uN.0]) + -- (if ($proj_lane__2(Jnn_1, c_1) =/= ?()))*{c_1 <- `c_1*`} -- if (c'_1*{c'_1 <- `c'_1*`} = $extend__($lsizenn1((Jnn_1 : Jnn <: lanetype)), $lsizenn2((Jnn_2 : Jnn <: lanetype)), sx_1, !($proj_lane__2(Jnn_1, c_1)))*{c_1 <- `c_1*`}) + -- (if ($proj_lane__2(Jnn_1, c_2) =/= ?()))*{c_2 <- `c_2*`} -- if (c'_2*{c'_2 <- `c'_2*`} = $extend__($lsizenn1((Jnn_1 : Jnn <: lanetype)), $lsizenn2((Jnn_2 : Jnn <: lanetype)), sx_2, !($proj_lane__2(Jnn_1, c_2)))*{c_2 <- `c_2*`}) -- if (c*{c <- `c*`} = $f_($lsizenn2((Jnn_2 : Jnn <: lanetype)), c'_1*{c'_1 <- `c'_1*`}, c'_2*{c'_2 <- `c'_2*`})) @@ -9476,6 +9525,7 @@ def $vextternop__(ishape_1 : ishape, ishape_2 : ishape, vextternop__ : vextterno -- if (M = (2 * M_2)) -- if (c' = $vextbinop__(`%`_ishape(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1))), `%`_ishape(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))), mk_vextbinop___0_vextbinop__(Jnn_1, M_1, Jnn, M, `RELAXED_DOTS`_vextbinop__Jnn_1_M_1_Jnn_2_M_2), c_1, c_2)) -- if (c'' = $vextunop__(`%`_ishape(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))), `%`_ishape(`%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2))), mk_vextunop___0_vextunop__(Jnn, M, Jnn_2, M_2, EXTADD_PAIRWISE_vextunop__Jnn_1_M_1_Jnn_2_M_2(S_sx)), c')) + -- if (|$vbinop_(`%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2)), mk_vbinop__0_vbinop_(Jnn_2, M_2, ADD_vbinop_Jnn_M), c'', c_3)| > 0) -- if (c <- $vbinop_(`%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2)), mk_vbinop__0_vbinop_(Jnn_2, M_2, ADD_vbinop_Jnn_M), c'', c_3)) ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec @@ -10064,6 +10114,7 @@ def $exninst(state : state) : exninst* def $type(state : state, typeidx : typeidx) : deftype ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $type{s : store, f : frame, x : uN}(`%;%`_state(s, f), x) = f.MODULE_frame.TYPES_moduleinst[x!`%`_uN.0] + -- if (x!`%`_uN.0 < |f.MODULE_frame.TYPES_moduleinst|) -- wf_store: `%`(s) -- wf_frame: `%`(f) -- wf_uN: `%%`(32, x) @@ -10072,6 +10123,8 @@ def $type(state : state, typeidx : typeidx) : deftype def $tag(state : state, tagidx : tagidx) : taginst ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $tag{s : store, f : frame, x : uN}(`%;%`_state(s, f), x) = s.TAGS_store[f.MODULE_frame.TAGS_moduleinst[x!`%`_uN.0]] + -- if (f.MODULE_frame.TAGS_moduleinst[x!`%`_uN.0] < |s.TAGS_store|) + -- if (x!`%`_uN.0 < |f.MODULE_frame.TAGS_moduleinst|) -- wf_store: `%`(s) -- wf_frame: `%`(f) -- wf_uN: `%%`(32, x) @@ -10080,6 +10133,8 @@ def $tag(state : state, tagidx : tagidx) : taginst def $global(state : state, globalidx : globalidx) : globalinst ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $global{s : store, f : frame, x : uN}(`%;%`_state(s, f), x) = s.GLOBALS_store[f.MODULE_frame.GLOBALS_moduleinst[x!`%`_uN.0]] + -- if (f.MODULE_frame.GLOBALS_moduleinst[x!`%`_uN.0] < |s.GLOBALS_store|) + -- if (x!`%`_uN.0 < |f.MODULE_frame.GLOBALS_moduleinst|) -- wf_store: `%`(s) -- wf_frame: `%`(f) -- wf_uN: `%%`(32, x) @@ -10088,6 +10143,8 @@ def $global(state : state, globalidx : globalidx) : globalinst def $mem(state : state, memidx : memidx) : meminst ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $mem{s : store, f : frame, x : uN}(`%;%`_state(s, f), x) = s.MEMS_store[f.MODULE_frame.MEMS_moduleinst[x!`%`_uN.0]] + -- if (f.MODULE_frame.MEMS_moduleinst[x!`%`_uN.0] < |s.MEMS_store|) + -- if (x!`%`_uN.0 < |f.MODULE_frame.MEMS_moduleinst|) -- wf_store: `%`(s) -- wf_frame: `%`(f) -- wf_uN: `%%`(32, x) @@ -10096,6 +10153,8 @@ def $mem(state : state, memidx : memidx) : meminst def $table(state : state, tableidx : tableidx) : tableinst ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $table{s : store, f : frame, x : uN}(`%;%`_state(s, f), x) = s.TABLES_store[f.MODULE_frame.TABLES_moduleinst[x!`%`_uN.0]] + -- if (f.MODULE_frame.TABLES_moduleinst[x!`%`_uN.0] < |s.TABLES_store|) + -- if (x!`%`_uN.0 < |f.MODULE_frame.TABLES_moduleinst|) -- wf_store: `%`(s) -- wf_frame: `%`(f) -- wf_uN: `%%`(32, x) @@ -10104,6 +10163,8 @@ def $table(state : state, tableidx : tableidx) : tableinst def $func(state : state, funcidx : funcidx) : funcinst ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $func{s : store, f : frame, x : uN}(`%;%`_state(s, f), x) = s.FUNCS_store[f.MODULE_frame.FUNCS_moduleinst[x!`%`_uN.0]] + -- if (f.MODULE_frame.FUNCS_moduleinst[x!`%`_uN.0] < |s.FUNCS_store|) + -- if (x!`%`_uN.0 < |f.MODULE_frame.FUNCS_moduleinst|) -- wf_store: `%`(s) -- wf_frame: `%`(f) -- wf_uN: `%%`(32, x) @@ -10112,6 +10173,8 @@ def $func(state : state, funcidx : funcidx) : funcinst def $data(state : state, dataidx : dataidx) : datainst ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $data{s : store, f : frame, x : uN}(`%;%`_state(s, f), x) = s.DATAS_store[f.MODULE_frame.DATAS_moduleinst[x!`%`_uN.0]] + -- if (f.MODULE_frame.DATAS_moduleinst[x!`%`_uN.0] < |s.DATAS_store|) + -- if (x!`%`_uN.0 < |f.MODULE_frame.DATAS_moduleinst|) -- wf_store: `%`(s) -- wf_frame: `%`(f) -- wf_uN: `%%`(32, x) @@ -10120,6 +10183,8 @@ def $data(state : state, dataidx : dataidx) : datainst def $elem(state : state, tableidx : tableidx) : eleminst ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $elem{s : store, f : frame, x : uN}(`%;%`_state(s, f), x) = s.ELEMS_store[f.MODULE_frame.ELEMS_moduleinst[x!`%`_uN.0]] + -- if (f.MODULE_frame.ELEMS_moduleinst[x!`%`_uN.0] < |s.ELEMS_store|) + -- if (x!`%`_uN.0 < |f.MODULE_frame.ELEMS_moduleinst|) -- wf_store: `%`(s) -- wf_frame: `%`(f) -- wf_uN: `%%`(32, x) @@ -10128,6 +10193,7 @@ def $elem(state : state, tableidx : tableidx) : eleminst def $local(state : state, localidx : localidx) : val? ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $local{s : store, f : frame, x : uN}(`%;%`_state(s, f), x) = f.LOCALS_frame[x!`%`_uN.0] + -- if (x!`%`_uN.0 < |f.LOCALS_frame|) -- wf_store: `%`(s) -- wf_frame: `%`(f) -- wf_uN: `%%`(32, x) @@ -10142,42 +10208,49 @@ def $with_local(state : state, localidx : localidx, val : val) : state def $with_global(state : state, globalidx : globalidx, val : val) : state ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $with_global{s : store, f : frame, x : uN, v : val}(`%;%`_state(s, f), x, v) = `%;%`_state(s[GLOBALS_store[f.MODULE_frame.GLOBALS_moduleinst[x!`%`_uN.0]].VALUE_globalinst = v], f) + -- if (x!`%`_uN.0 < |f.MODULE_frame.GLOBALS_moduleinst|) -- wf_state: `%`(`%;%`_state(s[GLOBALS_store[f.MODULE_frame.GLOBALS_moduleinst[x!`%`_uN.0]].VALUE_globalinst = v], f)) ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $with_table(state : state, tableidx : tableidx, nat : nat, ref : ref) : state ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $with_table{s : store, f : frame, x : uN, i : nat, r : ref}(`%;%`_state(s, f), x, i, r) = `%;%`_state(s[TABLES_store[f.MODULE_frame.TABLES_moduleinst[x!`%`_uN.0]].REFS_tableinst[i] = r], f) + -- if (x!`%`_uN.0 < |f.MODULE_frame.TABLES_moduleinst|) -- wf_state: `%`(`%;%`_state(s[TABLES_store[f.MODULE_frame.TABLES_moduleinst[x!`%`_uN.0]].REFS_tableinst[i] = r], f)) ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $with_tableinst(state : state, tableidx : tableidx, tableinst : tableinst) : state ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $with_tableinst{s : store, f : frame, x : uN, ti : tableinst}(`%;%`_state(s, f), x, ti) = `%;%`_state(s[TABLES_store[f.MODULE_frame.TABLES_moduleinst[x!`%`_uN.0]] = ti], f) + -- if (x!`%`_uN.0 < |f.MODULE_frame.TABLES_moduleinst|) -- wf_state: `%`(`%;%`_state(s[TABLES_store[f.MODULE_frame.TABLES_moduleinst[x!`%`_uN.0]] = ti], f)) ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $with_mem(state : state, memidx : memidx, nat : nat, nat : nat, byte*) : state ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $with_mem{s : store, f : frame, x : uN, i : nat, j : nat, `b*` : byte*}(`%;%`_state(s, f), x, i, j, b*{b <- `b*`}) = `%;%`_state(s[MEMS_store[f.MODULE_frame.MEMS_moduleinst[x!`%`_uN.0]].BYTES_meminst[i : j] = b*{b <- `b*`}], f) + -- if (x!`%`_uN.0 < |f.MODULE_frame.MEMS_moduleinst|) -- wf_state: `%`(`%;%`_state(s[MEMS_store[f.MODULE_frame.MEMS_moduleinst[x!`%`_uN.0]].BYTES_meminst[i : j] = b*{b <- `b*`}], f)) ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $with_meminst(state : state, memidx : memidx, meminst : meminst) : state ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $with_meminst{s : store, f : frame, x : uN, mi : meminst}(`%;%`_state(s, f), x, mi) = `%;%`_state(s[MEMS_store[f.MODULE_frame.MEMS_moduleinst[x!`%`_uN.0]] = mi], f) + -- if (x!`%`_uN.0 < |f.MODULE_frame.MEMS_moduleinst|) -- wf_state: `%`(`%;%`_state(s[MEMS_store[f.MODULE_frame.MEMS_moduleinst[x!`%`_uN.0]] = mi], f)) ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $with_elem(state : state, elemidx : elemidx, ref*) : state ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $with_elem{s : store, f : frame, x : uN, `r*` : ref*}(`%;%`_state(s, f), x, r*{r <- `r*`}) = `%;%`_state(s[ELEMS_store[f.MODULE_frame.ELEMS_moduleinst[x!`%`_uN.0]].REFS_eleminst = r*{r <- `r*`}], f) + -- if (x!`%`_uN.0 < |f.MODULE_frame.ELEMS_moduleinst|) -- wf_state: `%`(`%;%`_state(s[ELEMS_store[f.MODULE_frame.ELEMS_moduleinst[x!`%`_uN.0]].REFS_eleminst = r*{r <- `r*`}], f)) ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $with_data(state : state, dataidx : dataidx, byte*) : state ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $with_data{s : store, f : frame, x : uN, `b*` : byte*}(`%;%`_state(s, f), x, b*{b <- `b*`}) = `%;%`_state(s[DATAS_store[f.MODULE_frame.DATAS_moduleinst[x!`%`_uN.0]].BYTES_datainst = b*{b <- `b*`}], f) + -- if (x!`%`_uN.0 < |f.MODULE_frame.DATAS_moduleinst|) -- wf_state: `%`(`%;%`_state(s[DATAS_store[f.MODULE_frame.DATAS_moduleinst[x!`%`_uN.0]].BYTES_datainst = b*{b <- `b*`}], f)) ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec @@ -13220,18 +13293,23 @@ def $allocelems(store : store, elemtype*, ref**) : (store, elemaddr*) def $allocexport(moduleinst : moduleinst, export : export) : exportinst ;; ../../../../specification/wasm-3.0/4.4-execution.modules.spectec def $allocexport{moduleinst : moduleinst, name : name, x : uN}(moduleinst, EXPORT_export(name, TAG_externidx(x))) = {NAME name, ADDR TAG_externaddr(moduleinst.TAGS_moduleinst[x!`%`_uN.0])} + -- if (x!`%`_uN.0 < |moduleinst.TAGS_moduleinst|) -- wf_exportinst: `%`({NAME name, ADDR TAG_externaddr(moduleinst.TAGS_moduleinst[x!`%`_uN.0])}) ;; ../../../../specification/wasm-3.0/4.4-execution.modules.spectec def $allocexport{moduleinst : moduleinst, name : name, x : uN}(moduleinst, EXPORT_export(name, GLOBAL_externidx(x))) = {NAME name, ADDR GLOBAL_externaddr(moduleinst.GLOBALS_moduleinst[x!`%`_uN.0])} + -- if (x!`%`_uN.0 < |moduleinst.GLOBALS_moduleinst|) -- wf_exportinst: `%`({NAME name, ADDR GLOBAL_externaddr(moduleinst.GLOBALS_moduleinst[x!`%`_uN.0])}) ;; ../../../../specification/wasm-3.0/4.4-execution.modules.spectec def $allocexport{moduleinst : moduleinst, name : name, x : uN}(moduleinst, EXPORT_export(name, MEM_externidx(x))) = {NAME name, ADDR MEM_externaddr(moduleinst.MEMS_moduleinst[x!`%`_uN.0])} + -- if (x!`%`_uN.0 < |moduleinst.MEMS_moduleinst|) -- wf_exportinst: `%`({NAME name, ADDR MEM_externaddr(moduleinst.MEMS_moduleinst[x!`%`_uN.0])}) ;; ../../../../specification/wasm-3.0/4.4-execution.modules.spectec def $allocexport{moduleinst : moduleinst, name : name, x : uN}(moduleinst, EXPORT_export(name, TABLE_externidx(x))) = {NAME name, ADDR TABLE_externaddr(moduleinst.TABLES_moduleinst[x!`%`_uN.0])} + -- if (x!`%`_uN.0 < |moduleinst.TABLES_moduleinst|) -- wf_exportinst: `%`({NAME name, ADDR TABLE_externaddr(moduleinst.TABLES_moduleinst[x!`%`_uN.0])}) ;; ../../../../specification/wasm-3.0/4.4-execution.modules.spectec def $allocexport{moduleinst : moduleinst, name : name, x : uN}(moduleinst, EXPORT_export(name, FUNC_externidx(x))) = {NAME name, ADDR FUNC_externaddr(moduleinst.FUNCS_moduleinst[x!`%`_uN.0])} + -- if (x!`%`_uN.0 < |moduleinst.FUNCS_moduleinst|) -- wf_exportinst: `%`({NAME name, ADDR FUNC_externaddr(moduleinst.FUNCS_moduleinst[x!`%`_uN.0])}) ;; ../../../../specification/wasm-3.0/4.4-execution.modules.spectec @@ -13260,11 +13338,18 @@ def $allocmodule(store : store, module : module, externaddr*, val*, ref*, ref**) -- wf_store: `%`(s_6) -- wf_module: `%`(MODULE_module(type*{type <- `type*`}, import*{import <- `import*`}, tag*{tag <- `tag*`}, global*{global <- `global*`}, mem*{mem <- `mem*`}, table*{table <- `table*`}, func*{func <- `func*`}, data*{data <- `data*`}, elem*{elem <- `elem*`}, start?{start <- `start?`}, export*{export <- `export*`})) -- (wf_tag: `%`(TAG_tag(tagtype)))*{tagtype <- `tagtype*`} + -- if (|`expr_G*`| = |`globaltype*`|) -- (wf_global: `%`(GLOBAL_global(globaltype, expr_G)))*{expr_G <- `expr_G*`, globaltype <- `globaltype*`} -- (wf_mem: `%`(MEMORY_mem(memtype)))*{memtype <- `memtype*`} + -- if (|`expr_T*`| = |`tabletype*`|) -- (wf_table: `%`(TABLE_table(tabletype, expr_T)))*{expr_T <- `expr_T*`, tabletype <- `tabletype*`} + -- if (|`expr_F*`| = |`local**`|) + -- if (|`expr_F*`| = |`x*`|) -- (wf_func: `%`(FUNC_func(x, local*{local <- `local*`}, expr_F)))*{expr_F <- `expr_F*`, `local*` <- `local**`, x <- `x*`} + -- if (|`byte**`| = |`datamode*`|) -- (wf_data: `%`(DATA_data(byte*{byte <- `byte*`}, datamode)))*{`byte*` <- `byte**`, datamode <- `datamode*`} + -- if (|`elemmode*`| = |`elemtype*`|) + -- if (|`elemmode*`| = |`expr_E**`|) -- (wf_elem: `%`(ELEM_elem(elemtype, expr_E*{expr_E <- `expr_E*`}, elemmode)))*{elemmode <- `elemmode*`, elemtype <- `elemtype*`, `expr_E*` <- `expr_E**`} -- wf_moduleinst: `%`({TYPES [], TAGS aa_I*{aa_I <- `aa_I*`} ++ aa*{aa <- `aa*`}, GLOBALS ga_I*{ga_I <- `ga_I*`} ++ ga*{ga <- `ga*`}, MEMS ma_I*{ma_I <- `ma_I*`} ++ ma*{ma <- `ma*`}, TABLES ta_I*{ta_I <- `ta_I*`} ++ ta*{ta <- `ta*`}, FUNCS fa_I*{fa_I <- `fa_I*`} ++ fa*{fa <- `fa*`}, DATAS [], ELEMS [], EXPORTS []}) -- wf_moduleinst: `%`({TYPES dt*{dt <- `dt*`}, TAGS aa_I*{aa_I <- `aa_I*`} ++ aa*{aa <- `aa*`}, GLOBALS ga_I*{ga_I <- `ga_I*`} ++ ga*{ga <- `ga*`}, MEMS ma_I*{ma_I <- `ma_I*`} ++ ma*{ma <- `ma*`}, TABLES ta_I*{ta_I <- `ta_I*`} ++ ta*{ta <- `ta*`}, FUNCS fa_I*{fa_I <- `fa_I*`} ++ fa*{fa <- `fa*`}, DATAS da*{da <- `da*`}, ELEMS ea*{ea <- `ea*`}, EXPORTS xi*{xi <- `xi*`}}) @@ -13289,6 +13374,7 @@ def $allocmodule(store : store, module : module, externaddr*, val*, ref*, ref**) -- if ((s_4, ta*{ta <- `ta*`}) = $alloctables(s_3, $subst_all_tabletype(tabletype, (dt : deftype <: typeuse)*{dt <- `dt*`})*{tabletype <- `tabletype*`}, ref_T*{ref_T <- `ref_T*`})) -- if ((s_5, da*{da <- `da*`}) = $allocdatas(s_4, OK_datatype^|data*{data <- `data*`}|{}, byte*{byte <- `byte*`}*{`byte*` <- `byte**`})) -- if ((s_6, ea*{ea <- `ea*`}) = $allocelems(s_5, $subst_all_reftype(elemtype, (dt : deftype <: typeuse)*{dt <- `dt*`})*{elemtype <- `elemtype*`}, ref_E*{ref_E <- `ref_E*`}*{`ref_E*` <- `ref_E**`})) + -- (if (x!`%`_uN.0 < |dt*{dt <- `dt*`}|))*{x <- `x*`} -- if ((s_7, fa*{fa <- `fa*`}) = $allocfuncs(s_6, dt*{dt <- `dt*`}[x!`%`_uN.0]*{x <- `x*`}, FUNC_funccode(x, local*{local <- `local*`}, expr_F)*{expr_F <- `expr_F*`, `local*` <- `local**`, x <- `x*`}, moduleinst^|func*{func <- `func*`}|{})) -- if (xi*{xi <- `xi*`} = $allocexports({TYPES [], TAGS aa_I*{aa_I <- `aa_I*`} ++ aa*{aa <- `aa*`}, GLOBALS ga_I*{ga_I <- `ga_I*`} ++ ga*{ga <- `ga*`}, MEMS ma_I*{ma_I <- `ma_I*`} ++ ma*{ma <- `ma*`}, TABLES ta_I*{ta_I <- `ta_I*`} ++ ta*{ta <- `ta*`}, FUNCS fa_I*{fa_I <- `fa_I*`} ++ fa*{fa <- `fa*`}, DATAS [], ELEMS [], EXPORTS []}, export*{export <- `export*`})) -- if (moduleinst = {TYPES dt*{dt <- `dt*`}, TAGS aa_I*{aa_I <- `aa_I*`} ++ aa*{aa <- `aa*`}, GLOBALS ga_I*{ga_I <- `ga_I*`} ++ ga*{ga <- `ga*`}, MEMS ma_I*{ma_I <- `ma_I*`} ++ ma*{ma <- `ma*`}, TABLES ta_I*{ta_I <- `ta_I*`} ++ ta*{ta <- `ta*`}, FUNCS fa_I*{fa_I <- `fa_I*`} ++ fa*{fa <- `fa*`}, DATAS da*{da <- `da*`}, ELEMS ea*{ea <- `ea*`}, EXPORTS xi*{xi <- `xi*`}}) @@ -13369,9 +13455,14 @@ def $instantiate(store : store, module : module, externaddr*) : config -- wf_config: `%`(`%;%`_config(`%;%`_state(s', {LOCALS [], MODULE moduleinst}), instr_E*{instr_E <- `instr_E*`} ++ instr_D*{instr_D <- `instr_D*`} ++ lift(instr_S?{instr_S <- `instr_S?`}))) -- wf_moduletype: `%`(`%->%`_moduletype(xt_I*{xt_I <- `xt_I*`}, xt_E*{xt_E <- `xt_E*`})) -- wf_module: `%`(MODULE_module(type*{type <- `type*`}, import*{import <- `import*`}, tag*{tag <- `tag*`}, global*{global <- `global*`}, mem*{mem <- `mem*`}, table*{table <- `table*`}, func*{func <- `func*`}, data*{data <- `data*`}, elem*{elem <- `elem*`}, start?{start <- `start?`}, export*{export <- `export*`})) + -- if (|`expr_G*`| = |`globaltype*`|) -- (wf_global: `%`(GLOBAL_global(globaltype, expr_G)))*{expr_G <- `expr_G*`, globaltype <- `globaltype*`} + -- if (|`expr_T*`| = |`tabletype*`|) -- (wf_table: `%`(TABLE_table(tabletype, expr_T)))*{expr_T <- `expr_T*`, tabletype <- `tabletype*`} + -- if (|`byte**`| = |`datamode*`|) -- (wf_data: `%`(DATA_data(byte*{byte <- `byte*`}, datamode)))*{`byte*` <- `byte**`, datamode <- `datamode*`} + -- if (|`elemmode*`| = |`expr_E**`|) + -- if (|`elemmode*`| = |`reftype*`|) -- (wf_elem: `%`(ELEM_elem(reftype, expr_E*{expr_E <- `expr_E*`}, elemmode)))*{elemmode <- `elemmode*`, `expr_E*` <- `expr_E**`, reftype <- `reftype*`} -- (wf_start: `%`(START_start(x)))?{x <- `x?`} -- wf_moduleinst: `%`({TYPES $alloctypes(type*{type <- `type*`}), TAGS [], GLOBALS $globalsxa(externaddr*{externaddr <- `externaddr*`}), MEMS [], TABLES [], FUNCS $funcsxa(externaddr*{externaddr <- `externaddr*`}) ++ (|s.FUNCS_store| + i_F)^(i_F<|func*{func <- `func*`}|){i_F <- `i_F*`}, DATAS [], ELEMS [], EXPORTS []}) @@ -13380,6 +13471,7 @@ def $instantiate(store : store, module : module, externaddr*) : config -- (wf_uN: `%%`(32, `%`_uN(i_E)))^(i_E<|elem*{elem <- `elem*`}|){i_E <- `i_E*`} -- (wf_instr: `%`(CALL_instr(x)))?{x <- `x?`} -- Module_ok: `|-%:%`(module, `%->%`_moduletype(xt_I*{xt_I <- `xt_I*`}, xt_E*{xt_E <- `xt_E*`})) + -- if (|`externaddr*`| = |`xt_I*`|) -- (Externaddr_ok: `%|-%:%`(s, externaddr, xt_I))*{externaddr <- `externaddr*`, xt_I <- `xt_I*`} -- if (module = MODULE_module(type*{type <- `type*`}, import*{import <- `import*`}, tag*{tag <- `tag*`}, global*{global <- `global*`}, mem*{mem <- `mem*`}, table*{table <- `table*`}, func*{func <- `func*`}, data*{data <- `data*`}, elem*{elem <- `elem*`}, start?{start <- `start?`}, export*{export <- `export*`})) -- if (global*{global <- `global*`} = GLOBAL_global(globaltype, expr_G)*{expr_G <- `expr_G*`, globaltype <- `globaltype*`}) @@ -13390,10 +13482,15 @@ def $instantiate(store : store, module : module, externaddr*) : config -- if (moduleinst_0 = {TYPES $alloctypes(type*{type <- `type*`}), TAGS [], GLOBALS $globalsxa(externaddr*{externaddr <- `externaddr*`}), MEMS [], TABLES [], FUNCS $funcsxa(externaddr*{externaddr <- `externaddr*`}) ++ (|s.FUNCS_store| + i_F)^(i_F<|func*{func <- `func*`}|){i_F <- `i_F*`}, DATAS [], ELEMS [], EXPORTS []}) -- if (z = `%;%`_state(s, {LOCALS [], MODULE moduleinst_0})) -- if ((z', val_G*{val_G <- `val_G*`}) = $evalglobals(z, globaltype*{globaltype <- `globaltype*`}, expr_G*{expr_G <- `expr_G*`})) + -- if (|`expr_T*`| = |`ref_T*`|) -- (Eval_expr: `%;%~>*%;%`(z', expr_T, z', [(ref_T : ref <: val)]))*{expr_T <- `expr_T*`, ref_T <- `ref_T*`} + -- if (|`expr_E**`| = |`ref_E**`|) + -- (if (|`expr_E*`| = |`ref_E*`|))*{`expr_E*` <- `expr_E**`, `ref_E*` <- `ref_E**`} -- (Eval_expr: `%;%~>*%;%`(z', expr_E, z', [(ref_E : ref <: val)]))*{expr_E <- `expr_E*`, ref_E <- `ref_E*`}*{`expr_E*` <- `expr_E**`, `ref_E*` <- `ref_E**`} -- if ((s', moduleinst) = $allocmodule(s, module, externaddr*{externaddr <- `externaddr*`}, val_G*{val_G <- `val_G*`}, ref_T*{ref_T <- `ref_T*`}, ref_E*{ref_E <- `ref_E*`}*{`ref_E*` <- `ref_E**`})) + -- (if (i_D < |data*{data <- `data*`}|))^(i_D<|data*{data <- `data*`}|){i_D <- `i_D*`} -- if (instr_D*{instr_D <- `instr_D*`} = $concat_(syntax instr, $rundata_(`%`_dataidx(i_D), data*{data <- `data*`}[i_D])^(i_D<|data*{data <- `data*`}|){i_D <- `i_D*`})) + -- (if (i_E < |elem*{elem <- `elem*`}|))^(i_E<|elem*{elem <- `elem*`}|){i_E <- `i_E*`} -- if (instr_E*{instr_E <- `instr_E*`} = $concat_(syntax instr, $runelem_(`%`_elemidx(i_E), elem*{elem <- `elem*`}[i_E])^(i_E<|elem*{elem <- `elem*`}|){i_E <- `i_E*`})) -- if (instr_S?{instr_S <- `instr_S?`} = CALL_instr(x)?{x <- `x?`}) @@ -13401,9 +13498,11 @@ def $instantiate(store : store, module : module, externaddr*) : config def $invoke(store : store, funcaddr : funcaddr, val*) : config ;; ../../../../specification/wasm-3.0/4.4-execution.modules.spectec def $invoke{s : store, funcaddr : nat, `val*` : val*, `t_1*` : valtype*, `t_2*` : valtype*}(s, funcaddr, val*{val <- `val*`}) = `%;%`_config(`%;%`_state(s, {LOCALS [], MODULE {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], EXPORTS []}}), (val : val <: instr)*{val <- `val*`} ++ [REF.FUNC_ADDR_instr(funcaddr) CALL_REF_instr((s.FUNCS_store[funcaddr].TYPE_funcinst : deftype <: typeuse))]) + -- if (funcaddr < |s.FUNCS_store|) -- wf_config: `%`(`%;%`_config(`%;%`_state(s, {LOCALS [], MODULE {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], EXPORTS []}}), (val : val <: instr)*{val <- `val*`} ++ [REF.FUNC_ADDR_instr(funcaddr) CALL_REF_instr((s.FUNCS_store[funcaddr].TYPE_funcinst : deftype <: typeuse))])) -- wf_comptype: `%`(`FUNC%->%`_comptype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`}))) -- Expand: `%~~%`(s.FUNCS_store[funcaddr].TYPE_funcinst, `FUNC%->%`_comptype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`}))) + -- if (|`t_1*`| = |`val*`|) -- (Val_ok: `%|-%:%`(s, val, t_1))*{t_1 <- `t_1*`, val <- `val*`} ;; ../../../../specification/wasm-3.0/5.1-binary.values.spectec diff --git a/spectec/test-middlend/specification.06-sub.exp b/spectec/test-middlend/specification.06-sub.exp index bdd5efbb0e..35acc05fbd 100644 --- a/spectec/test-middlend/specification.06-sub.exp +++ b/spectec/test-middlend/specification.06-sub.exp @@ -96,6 +96,7 @@ def $disjoint_(syntax X, X*) : bool def $disjoint_{syntax X}(syntax X, []) = true ;; ../../../../specification/wasm-3.0/0.3-aux.seq.spectec:37.1-37.68 def $disjoint_{syntax X, w : X, `w'*` : X*}(syntax X, [w] ++ w'*{w' <- `w'*`}) = (~ (w <- w'*{w' <- `w'*`}) /\ $disjoint_(syntax X, w'*{w' <- `w'*`})) + -- if (|w'*{w' <- `w'*`}| > 0) } ;; ../../../../specification/wasm-3.0/0.3-aux.seq.spectec @@ -1491,6 +1492,7 @@ def $inv_jsize(nat : nat) : Jnn? def $inv_jsize(16) = ?(I16_Jnn) ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec def $inv_jsize{n : nat}(n) = ?($Jnn_addrtype(!($inv_isize(n)))) + -- if ($inv_isize(n) =/= ?()) def $inv_jsize{x0 : nat}(x0) = ?() ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec @@ -1550,6 +1552,7 @@ def $jsizenn(Jnn : Jnn) : nat def $inv_jsizenn(nat : nat) : Jnn? ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec def $inv_jsizenn{n : nat}(n) = ?(!($inv_jsize(n))) + -- if ($inv_jsize(n) =/= ?()) def $inv_jsizenn{x0 : nat}(x0) = ?() ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec @@ -2061,6 +2064,7 @@ def $rolldt(typeidx : typeidx, rectype : rectype) : deftype* def $unrolldt(deftype : deftype) : subtype ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec def $unrolldt{rectype : rectype, i : nat, `subtype*` : subtype*}(_DEF_deftype(rectype, i)) = subtype*{subtype <- `subtype*`}[i] + -- if (i < |subtype*{subtype <- `subtype*`}|) -- (wf_subtype: `%`(subtype))*{subtype <- `subtype*`} -- if ($unrollrt(rectype) = REC_rectype(`%`_list(subtype*{subtype <- `subtype*`}))) @@ -5552,10 +5556,12 @@ def $unrollht(context : context, heaptype : heaptype) : subtype -- wf_context: `%`(C) ;; ../../../../specification/wasm-3.0/2.1-validation.types.spectec def $unrollht{C : context, typeidx : uN}(C, _IDX_heaptype(typeidx)) = $unrolldt(C.TYPES_context[typeidx!`%`_uN.0]) + -- if (typeidx!`%`_uN.0 < |C.TYPES_context|) -- wf_context: `%`(C) -- wf_uN: `%%`(32, typeidx) ;; ../../../../specification/wasm-3.0/2.1-validation.types.spectec def $unrollht{C : context, i : nat}(C, REC_heaptype(i)) = C.RECS_context[i] + -- if (i < |C.RECS_context|) -- wf_context: `%`(C) ;; ../../../../specification/wasm-3.0/2.1-validation.types.spectec @@ -8036,6 +8042,7 @@ relation wf_relaxed4: `%`(relaxed4) def $relaxed2(relaxed2 : relaxed2, syntax X, X : X, X : X) : X ;; ../../../../specification/wasm-3.0/3.0-numerics.relaxed.spectec def $relaxed2{i : relaxed2, syntax X, X_1 : X, X_2 : X}(i, syntax X, X_1, X_2) = [X_1 X_2][i!`%`_relaxed2.0] + -- if (i!`%`_relaxed2.0 < |[X_1 X_2]|) -- wf_relaxed2: `%`(i) -- if $ND ;; ../../../../specification/wasm-3.0/3.0-numerics.relaxed.spectec @@ -8047,6 +8054,7 @@ def $relaxed2(relaxed2 : relaxed2, syntax X, X : X, X : X) : X def $relaxed4(relaxed4 : relaxed4, syntax X, X : X, X : X, X : X, X : X) : X ;; ../../../../specification/wasm-3.0/3.0-numerics.relaxed.spectec def $relaxed4{i : relaxed4, syntax X, X_1 : X, X_2 : X, X_3 : X, X_4 : X}(i, syntax X, X_1, X_2, X_3, X_4) = [X_1 X_2 X_3 X_4][i!`%`_relaxed4.0] + -- if (i!`%`_relaxed4.0 < |[X_1 X_2 X_3 X_4]|) -- wf_relaxed4: `%`(i) -- if $ND ;; ../../../../specification/wasm-3.0/3.0-numerics.relaxed.spectec @@ -8605,6 +8613,7 @@ def $cunpacknum_(storagetype : storagetype, lit_ : lit_) : lit_ -- wf_lit_: `%%`($storagetype_consttype(consttype), c) ;; ../../../../specification/wasm-3.0/3.1-numerics.scalar.spectec def $cunpacknum_{packtype : packtype, c : uN}($storagetype_packtype(packtype), mk_lit__2_lit_(packtype, c)) = mk_lit__0_lit_(I32_numtype, mk_num__0_num_(I32_Inn, $extend__($psize(packtype), $size($lunpack($lanetype_packtype(packtype))), U_sx, c))) + -- if ($cunpack($storagetype_packtype(packtype)) =/= ?()) -- wf_lit_: `%%`($storagetype_consttype(!($cunpack($storagetype_packtype(packtype)))), mk_lit__0_lit_(I32_numtype, mk_num__0_num_(I32_Inn, $extend__($psize(packtype), $size($lunpack($lanetype_packtype(packtype))), U_sx, c)))) ;; ../../../../specification/wasm-3.0/3.1-numerics.scalar.spectec @@ -8839,9 +8848,9 @@ def $half(half : half, nat : nat, nat : nat) : nat def $iswizzle_lane_(N : N, iN*, iN : iN) : iN ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec def $iswizzle_lane_{N : nat, `c*` : iN*, i : uN}(N, c*{c <- `c*`}, i) = c*{c <- `c*`}[i!`%`_uN.0] + -- if (i!`%`_uN.0 < |c*{c <- `c*`}|) -- (wf_uN: `%%`(N, c))*{c <- `c*`} -- wf_uN: `%%`(N, i) - -- if (i!`%`_uN.0 < |c*{c <- `c*`}|) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec def $iswizzle_lane_{N : nat, `c*` : iN*, i : uN}(N, c*{c <- `c*`}, i) = `%`_iN(0) -- (wf_uN: `%%`(N, c))*{c <- `c*`} @@ -8853,9 +8862,9 @@ def $iswizzle_lane_(N : N, iN*, iN : iN) : iN def $irelaxed_swizzle_lane_(N : N, iN*, iN : iN) : iN ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec def $irelaxed_swizzle_lane_{N : nat, `c*` : iN*, i : uN}(N, c*{c <- `c*`}, i) = c*{c <- `c*`}[i!`%`_uN.0] + -- if (i!`%`_uN.0 < |c*{c <- `c*`}|) -- (wf_uN: `%%`(N, c))*{c <- `c*`} -- wf_uN: `%%`(N, i) - -- if (i!`%`_uN.0 < |c*{c <- `c*`}|) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec def $irelaxed_swizzle_lane_{N : nat, `c*` : iN*, i : uN}(N, c*{c <- `c*`}, i) = `%`_iN(0) -- (wf_uN: `%%`(N, c))*{c <- `c*`} @@ -8864,6 +8873,7 @@ def $irelaxed_swizzle_lane_(N : N, iN*, iN : iN) : iN -- if ($signed_(N, i!`%`_uN.0) < (0 : nat <:> int)) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec def $irelaxed_swizzle_lane_{N : nat, `c*` : iN*, i : uN}(N, c*{c <- `c*`}, i) = $relaxed2($R_swizzle, syntax iN, `%`_iN(0), c*{c <- `c*`}[(i!`%`_uN.0 \ |c*{c <- `c*`}|)]) + -- if ((i!`%`_uN.0 \ |c*{c <- `c*`}|) < |c*{c <- `c*`}|) -- (wf_uN: `%%`(N, c))*{c <- `c*`} -- wf_uN: `%%`(N, i) -- wf_uN: `%%`(N, `%`_uN(0)) @@ -8878,6 +8888,7 @@ def $ivunop_(shape : shape, def $f_(N : N, iN : iN) : iN, vec_ : vec_) : vec_* -- wf_shape: `%`(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M))) -- (wf_lane_: `%%`($lanetype(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M))), mk_lane__2_lane_(Jnn, c)))*{c <- `c*`} -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M)), v_1)) + -- (if ($proj_lane__2(Jnn, c_1) =/= ?()))*{c_1 <- `c_1*`} -- if (c*{c <- `c*`} = $f_($lsizenn($lanetype_Jnn(Jnn)), !($proj_lane__2(Jnn, c_1)))*{c_1 <- `c_1*`}) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec @@ -8903,6 +8914,8 @@ def $ivbinop_(shape : shape, def $f_(N : N, iN : iN, iN : iN) : iN, vec_ : vec_, -- (wf_lane_: `%%`($lanetype(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M))), mk_lane__2_lane_(Jnn, c)))*{c <- `c*`} -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M)), v_1)) -- if (c_2*{c_2 <- `c_2*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M)), v_2)) + -- (if ($proj_lane__2(Jnn, c_1) =/= ?()))*{c_1 <- `c_1*`} + -- (if ($proj_lane__2(Jnn, c_2) =/= ?()))*{c_2 <- `c_2*`} -- if (c*{c <- `c*`} = $f_($lsizenn($lanetype_Jnn(Jnn)), !($proj_lane__2(Jnn, c_1)), !($proj_lane__2(Jnn, c_2)))*{c_1 <- `c_1*`, c_2 <- `c_2*`}) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec @@ -8917,6 +8930,8 @@ def $ivbinopsx_(shape : shape, def $f_(N : N, sx : sx, iN : iN, iN : iN) : iN, s -- (wf_lane_: `%%`($lanetype(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M))), mk_lane__2_lane_(Jnn, c)))*{c <- `c*`} -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M)), v_1)) -- if (c_2*{c_2 <- `c_2*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M)), v_2)) + -- (if ($proj_lane__2(Jnn, c_1) =/= ?()))*{c_1 <- `c_1*`} + -- (if ($proj_lane__2(Jnn, c_2) =/= ?()))*{c_2 <- `c_2*`} -- if (c*{c <- `c*`} = $f_($lsizenn($lanetype_Jnn(Jnn)), sx, !($proj_lane__2(Jnn, c_1)), !($proj_lane__2(Jnn, c_2)))*{c_1 <- `c_1*`, c_2 <- `c_2*`}) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec @@ -8927,6 +8942,7 @@ def $ivbinopsxnd_(shape : shape, def $f_(N : N, sx : sx, iN : iN, iN : iN) : iN* -- wf_uN: `%%`(128, v_2) -- (wf_lane_: `%%`($lanetype_Jnn(Jnn), c))*{c <- `c*`}*{`c*` <- `c**`} -- wf_shape: `%`(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M))) + -- if (|`c_1*`| = |`c_2*`|) -- (wf_lane_: `%%`($lanetype_Jnn(Jnn), mk_lane__2_lane_(Jnn, iter_0)))*{iter_0 <- $f_($lsizenn($lanetype_Jnn(Jnn)), sx, !($proj_lane__2(Jnn, c_1)), !($proj_lane__2(Jnn, c_2)))}*{c_1 <- `c_1*`, c_2 <- `c_2*`} -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M)), v_1)) -- if (c_2*{c_2 <- `c_2*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M)), v_2)) @@ -8940,6 +8956,7 @@ def $fvbinop_(shape : shape, def $f_(N : N, fN : fN, fN : fN) : fN*, vec_ : vec_ -- wf_uN: `%%`(128, v_2) -- (wf_lane_: `%%`($lanetype_Fnn(Fnn), c))*{c <- `c*`}*{`c*` <- `c**`} -- wf_shape: `%`(`%X%`_shape($lanetype_Fnn(Fnn), `%`_dim(M))) + -- if (|`c_1*`| = |`c_2*`|) -- (wf_lane_: `%%`($lanetype_Fnn(Fnn), mk_lane__0_lane_($numtype_Fnn(Fnn), mk_num__1_num_(Fnn, iter_0))))*{iter_0 <- $f_($sizenn($numtype_Fnn(Fnn)), !($proj_num__1(Fnn, !($proj_lane__0($numtype_Fnn(Fnn), c_1)))), !($proj_num__1(Fnn, !($proj_lane__0($numtype_Fnn(Fnn), c_2)))))}*{c_1 <- `c_1*`, c_2 <- `c_2*`} -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape($lanetype_Fnn(Fnn), `%`_dim(M)), v_1)) -- if (c_2*{c_2 <- `c_2*`} = $lanes_(`%X%`_shape($lanetype_Fnn(Fnn), `%`_dim(M)), v_2)) @@ -8954,6 +8971,8 @@ def $ivternopnd_(shape : shape, def $f_(N : N, iN : iN, iN : iN, iN : iN) : iN*, -- wf_uN: `%%`(128, v_3) -- (wf_lane_: `%%`($lanetype_Jnn(Jnn), c))*{c <- `c*`}*{`c*` <- `c**`} -- wf_shape: `%`(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M))) + -- if (|`c_1*`| = |`c_2*`|) + -- if (|`c_1*`| = |`c_3*`|) -- (wf_lane_: `%%`($lanetype_Jnn(Jnn), mk_lane__2_lane_(Jnn, iter_0)))*{iter_0 <- $f_($lsizenn($lanetype_Jnn(Jnn)), !($proj_lane__2(Jnn, c_1)), !($proj_lane__2(Jnn, c_2)), !($proj_lane__2(Jnn, c_3)))}*{c_1 <- `c_1*`, c_2 <- `c_2*`, c_3 <- `c_3*`} -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M)), v_1)) -- if (c_2*{c_2 <- `c_2*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M)), v_2)) @@ -8969,6 +8988,8 @@ def $fvternop_(shape : shape, def $f_(N : N, fN : fN, fN : fN, fN : fN) : fN*, v -- wf_uN: `%%`(128, v_3) -- (wf_lane_: `%%`($lanetype_Fnn(Fnn), c))*{c <- `c*`}*{`c*` <- `c**`} -- wf_shape: `%`(`%X%`_shape($lanetype_Fnn(Fnn), `%`_dim(M))) + -- if (|`c_1*`| = |`c_2*`|) + -- if (|`c_1*`| = |`c_3*`|) -- (wf_lane_: `%%`($lanetype_Fnn(Fnn), mk_lane__0_lane_($numtype_Fnn(Fnn), mk_num__1_num_(Fnn, iter_0))))*{iter_0 <- $f_($sizenn($numtype_Fnn(Fnn)), !($proj_num__1(Fnn, !($proj_lane__0($numtype_Fnn(Fnn), c_1)))), !($proj_num__1(Fnn, !($proj_lane__0($numtype_Fnn(Fnn), c_2)))), !($proj_num__1(Fnn, !($proj_lane__0($numtype_Fnn(Fnn), c_3)))))}*{c_1 <- `c_1*`, c_2 <- `c_2*`, c_3 <- `c_3*`} -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape($lanetype_Fnn(Fnn), `%`_dim(M)), v_1)) -- if (c_2*{c_2 <- `c_2*`} = $lanes_(`%X%`_shape($lanetype_Fnn(Fnn), `%`_dim(M)), v_2)) @@ -8984,6 +9005,7 @@ def $ivtestop_(shape : shape, def $f_(N : N, iN : iN) : u32, vec_ : vec_) : u32 -- wf_uN: `%%`(32, `%`_uN($prod(c!`%`_uN.0*{c <- `c*`}))) -- wf_shape: `%`(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M))) -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M)), v_1)) + -- (if ($proj_lane__2(Jnn, c_1) =/= ?()))*{c_1 <- `c_1*`} -- if (c*{c <- `c*`} = $f_($lsizenn($lanetype_Jnn(Jnn)), !($proj_lane__2(Jnn, c_1)))*{c_1 <- `c_1*`}) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec @@ -8995,6 +9017,8 @@ def $fvtestop_(shape : shape, def $f_(N : N, fN : fN) : u32, vec_ : vec_) : u32 -- wf_uN: `%%`(32, `%`_uN($prod(c!`%`_uN.0*{c <- `c*`}))) -- wf_shape: `%`(`%X%`_shape($lanetype_Fnn(Fnn), `%`_dim(M))) -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape($lanetype_Fnn(Fnn), `%`_dim(M)), v_1)) + -- (if ($proj_num__1(Fnn, !($proj_lane__0($numtype_Fnn(Fnn), c_1))) =/= ?()))*{c_1 <- `c_1*`} + -- (if ($proj_lane__0($numtype_Fnn(Fnn), c_1) =/= ?()))*{c_1 <- `c_1*`} -- if (c*{c <- `c*`} = $f_($sizenn($numtype_Fnn(Fnn)), !($proj_num__1(Fnn, !($proj_lane__0($numtype_Fnn(Fnn), c_1)))))*{c_1 <- `c_1*`}) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec @@ -9005,6 +9029,9 @@ def $ivrelop_(shape : shape, def $f_(N : N, iN : iN, iN : iN) : u32, vec_ : vec_ -- wf_uN: `%%`(128, v_2) -- wf_shape: `%`(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M))) -- (wf_lane_: `%%`($lanetype(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M))), mk_lane__2_lane_(Jnn, c)))*{c <- `c*`} + -- if (|`c_1*`| = |`c_2*`|) + -- (if ($proj_lane__2(Jnn, c_1) =/= ?()))*{c_1 <- `c_1*`} + -- (if ($proj_lane__2(Jnn, c_2) =/= ?()))*{c_2 <- `c_2*`} -- (wf_uN: `%%`(1, `%`_uN($f_($lsizenn($lanetype_Jnn(Jnn)), !($proj_lane__2(Jnn, c_1)), !($proj_lane__2(Jnn, c_2)))!`%`_uN.0)))*{c_1 <- `c_1*`, c_2 <- `c_2*`} -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M)), v_1)) -- if (c_2*{c_2 <- `c_2*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M)), v_2)) @@ -9018,6 +9045,9 @@ def $ivrelopsx_(shape : shape, def $f_(N : N, sx : sx, iN : iN, iN : iN) : u32, -- wf_uN: `%%`(128, v_2) -- wf_shape: `%`(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M))) -- (wf_lane_: `%%`($lanetype(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M))), mk_lane__2_lane_(Jnn, c)))*{c <- `c*`} + -- if (|`c_1*`| = |`c_2*`|) + -- (if ($proj_lane__2(Jnn, c_1) =/= ?()))*{c_1 <- `c_1*`} + -- (if ($proj_lane__2(Jnn, c_2) =/= ?()))*{c_2 <- `c_2*`} -- (wf_uN: `%%`(1, `%`_uN($f_($lsizenn($lanetype_Jnn(Jnn)), sx, !($proj_lane__2(Jnn, c_1)), !($proj_lane__2(Jnn, c_2)))!`%`_uN.0)))*{c_1 <- `c_1*`, c_2 <- `c_2*`} -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M)), v_1)) -- if (c_2*{c_2 <- `c_2*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M)), v_2)) @@ -9032,6 +9062,11 @@ def $fvrelop_(shape : shape, def $f_(N : N, fN : fN, fN : fN) : u32, vec_ : vec_ -- wf_shape: `%`(`%X%`_shape($lanetype_addrtype(Inn), `%`_dim(M))) -- (wf_lane_: `%%`($lanetype(`%X%`_shape($lanetype_addrtype(Inn), `%`_dim(M))), mk_lane__0_lane_($numtype_addrtype(Inn), mk_num__0_num_(Inn, `%`_uN(c!`%`_uN.0)))))*{c <- `c*`} -- wf_shape: `%`(`%X%`_shape($lanetype_Fnn(Fnn), `%`_dim(M))) + -- if (|`c_1*`| = |`c_2*`|) + -- (if ($proj_num__1(Fnn, !($proj_lane__0($numtype_Fnn(Fnn), c_1))) =/= ?()))*{c_1 <- `c_1*`} + -- (if ($proj_lane__0($numtype_Fnn(Fnn), c_1) =/= ?()))*{c_1 <- `c_1*`} + -- (if ($proj_num__1(Fnn, !($proj_lane__0($numtype_Fnn(Fnn), c_2))) =/= ?()))*{c_2 <- `c_2*`} + -- (if ($proj_lane__0($numtype_Fnn(Fnn), c_2) =/= ?()))*{c_2 <- `c_2*`} -- (wf_uN: `%%`(1, `%`_uN($f_($sizenn($numtype_Fnn(Fnn)), !($proj_num__1(Fnn, !($proj_lane__0($numtype_Fnn(Fnn), c_1)))), !($proj_num__1(Fnn, !($proj_lane__0($numtype_Fnn(Fnn), c_2)))))!`%`_uN.0)))*{c_1 <- `c_1*`, c_2 <- `c_2*`} -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape($lanetype_Fnn(Fnn), `%`_dim(M)), v_1)) -- if (c_2*{c_2 <- `c_2*`} = $lanes_(`%X%`_shape($lanetype_Fnn(Fnn), `%`_dim(M)), v_2)) @@ -9048,6 +9083,7 @@ def $ivshiftop_(shape : shape, def $f_(N : N, iN : iN, u32 : u32) : iN, vec_ : v -- wf_shape: `%`(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M))) -- (wf_lane_: `%%`($lanetype(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M))), mk_lane__2_lane_(Jnn, c)))*{c <- `c*`} -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M)), v_1)) + -- (if ($proj_lane__2(Jnn, c_1) =/= ?()))*{c_1 <- `c_1*`} -- if (c*{c <- `c*`} = $f_($lsizenn($lanetype_Jnn(Jnn)), !($proj_lane__2(Jnn, c_1)), i)*{c_1 <- `c_1*`}) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec @@ -9060,6 +9096,7 @@ def $ivshiftopsx_(shape : shape, def $f_(N : N, sx : sx, iN : iN, u32 : u32) : i -- wf_shape: `%`(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M))) -- (wf_lane_: `%%`($lanetype(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M))), mk_lane__2_lane_(Jnn, c)))*{c <- `c*`} -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M)), v_1)) + -- (if ($proj_lane__2(Jnn, c_1) =/= ?()))*{c_1 <- `c_1*`} -- if (c*{c <- `c*`} = $f_($lsizenn($lanetype_Jnn(Jnn)), sx, !($proj_lane__2(Jnn, c_1)), i)*{c_1 <- `c_1*`}) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec @@ -9069,6 +9106,7 @@ def $ivbitmaskop_(shape : shape, vec_ : vec_) : u32 -- wf_uN: `%%`(128, v_1) -- wf_uN: `%%`(32, c) -- wf_shape: `%`(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M))) + -- (if ($proj_lane__2(Jnn, c_1) =/= ?()))*{c_1 <- `c_1*`} -- (wf_bit: `%`(`%`_bit($ilt_($lsizenn($lanetype_Jnn(Jnn)), S_sx, !($proj_lane__2(Jnn, c_1)), `%`_iN(0))!`%`_uN.0)))*{c_1 <- `c_1*`} -- wf_bit: `%`(`%`_bit(0)) -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M)), v_1)) @@ -9086,6 +9124,8 @@ def $ivswizzlop_(shape : shape, def $f_(N : N, iN*, iN : iN) : iN, vec_ : vec_, -- (wf_lane_: `%%`($lanetype(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M))), mk_lane__2_lane_(Jnn, c)))*{c <- `c*`} -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M)), v_1)) -- if (c_2*{c_2 <- `c_2*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M)), v_2)) + -- (if ($proj_lane__2(Jnn, c_1) =/= ?()))*{c_1 <- `c_1*`}*{c_2 <- `c_2*`} + -- (if ($proj_lane__2(Jnn, c_2) =/= ?()))*{c_2 <- `c_2*`} -- if (c*{c <- `c*`} = $f_($lsizenn($lanetype_Jnn(Jnn)), !($proj_lane__2(Jnn, c_1))*{c_1 <- `c_1*`}, !($proj_lane__2(Jnn, c_2)))*{c_2 <- `c_2*`}) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec @@ -9101,6 +9141,7 @@ def $ivshufflop_(shape : shape, laneidx*, vec_ : vec_, vec_ : vec_) : vec_ -- wf_shape: `%`(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M))) -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M)), v_1)) -- if (c_2*{c_2 <- `c_2*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M)), v_2)) + -- (if (i!`%`_uN.0 < |c_1*{c_1 <- `c_1*`} ++ c_2*{c_2 <- `c_2*`}|))*{i <- `i*`} -- if (c*{c <- `c*`} = c_1*{c_1 <- `c_1*`} ++ c_2*{c_2 <- `c_2*`}[i!`%`_uN.0]*{i <- `i*`}) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec @@ -9420,6 +9461,7 @@ def $vcvtop__(shape_1 : shape, shape_2 : shape, vcvtop__ : vcvtop__, vec_ : vec_ -- if (($halfop(`%X%`_shape(Lnn_1, `%`_dim(M)), `%X%`_shape(Lnn_2, `%`_dim(M)), vcvtop) = ?()) /\ ($zeroop(`%X%`_shape(Lnn_1, `%`_dim(M)), `%X%`_shape(Lnn_2, `%`_dim(M)), vcvtop) = ?())) -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape(Lnn_1, `%`_dim(M)), v_1)) -- if (c*{c <- `c*`}*{`c*` <- `c**`} = $setproduct_(syntax lane_, $lcvtop__(`%X%`_shape(Lnn_1, `%`_dim(M)), `%X%`_shape(Lnn_2, `%`_dim(M)), vcvtop, c_1)*{c_1 <- `c_1*`})) + -- if (|$inv_lanes_(`%X%`_shape(Lnn_2, `%`_dim(M)), c*{c <- `c*`})*{`c*` <- `c**`}| > 0) -- if (v <- $inv_lanes_(`%X%`_shape(Lnn_2, `%`_dim(M)), c*{c <- `c*`})*{`c*` <- `c**`}) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec def $vcvtop__{Lnn_1 : lanetype, M_1 : nat, Lnn_2 : lanetype, M_2 : nat, vcvtop : vcvtop__, v_1 : uN, v : uN, half : half, `c_1*` : lane_*, `c**` : lane_**}(`%X%`_shape(Lnn_1, `%`_dim(M_1)), `%X%`_shape(Lnn_2, `%`_dim(M_2)), vcvtop, v_1) = v @@ -9433,6 +9475,7 @@ def $vcvtop__(shape_1 : shape, shape_2 : shape, vcvtop__ : vcvtop__, vec_ : vec_ -- if ($halfop(`%X%`_shape(Lnn_1, `%`_dim(M_1)), `%X%`_shape(Lnn_2, `%`_dim(M_2)), vcvtop) = ?(half)) -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape(Lnn_1, `%`_dim(M_1)), v_1)[$half(half, 0, M_2) : M_2]) -- if (c*{c <- `c*`}*{`c*` <- `c**`} = $setproduct_(syntax lane_, $lcvtop__(`%X%`_shape(Lnn_1, `%`_dim(M_1)), `%X%`_shape(Lnn_2, `%`_dim(M_2)), vcvtop, c_1)*{c_1 <- `c_1*`})) + -- if (|$inv_lanes_(`%X%`_shape(Lnn_2, `%`_dim(M_2)), c*{c <- `c*`})*{`c*` <- `c**`}| > 0) -- if (v <- $inv_lanes_(`%X%`_shape(Lnn_2, `%`_dim(M_2)), c*{c <- `c*`})*{`c*` <- `c**`}) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec def $vcvtop__{Lnn_1 : lanetype, M_1 : nat, Lnn_2 : lanetype, M_2 : nat, vcvtop : vcvtop__, v_1 : uN, v : uN, `c_1*` : lane_*, `c**` : lane_**}(`%X%`_shape(Lnn_1, `%`_dim(M_1)), `%X%`_shape(Lnn_2, `%`_dim(M_2)), vcvtop, v_1) = v @@ -9446,6 +9489,7 @@ def $vcvtop__(shape_1 : shape, shape_2 : shape, vcvtop__ : vcvtop__, vec_ : vec_ -- if ($zeroop(`%X%`_shape(Lnn_1, `%`_dim(M_1)), `%X%`_shape(Lnn_2, `%`_dim(M_2)), vcvtop) = ?(ZERO_zero)) -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape(Lnn_1, `%`_dim(M_1)), v_1)) -- if (c*{c <- `c*`}*{`c*` <- `c**`} = $setproduct_(syntax lane_, $lcvtop__(`%X%`_shape(Lnn_1, `%`_dim(M_1)), `%X%`_shape(Lnn_2, `%`_dim(M_2)), vcvtop, c_1)*{c_1 <- `c_1*`} ++ [$zero(Lnn_2)]^M_1{})) + -- if (|$inv_lanes_(`%X%`_shape(Lnn_2, `%`_dim(M_2)), c*{c <- `c*`})*{`c*` <- `c**`}| > 0) -- if (v <- $inv_lanes_(`%X%`_shape(Lnn_2, `%`_dim(M_2)), c*{c <- `c*`})*{`c*` <- `c**`}) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec @@ -9505,7 +9549,9 @@ def $vnarrowop__(shape_1 : shape, shape_2 : shape, sx : sx, vec_ : vec_, vec_ : -- (wf_lane_: `%%`($lanetype(`%X%`_shape($lanetype_Jnn(Jnn_2), `%`_dim(M_2))), mk_lane__2_lane_(Jnn_2, c'_2)))*{c'_2 <- `c'_2*`} -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn_1), `%`_dim(M_1)), v_1)) -- if (c_2*{c_2 <- `c_2*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn_1), `%`_dim(M_1)), v_2)) + -- (if ($proj_lane__2(Jnn_1, c_1) =/= ?()))*{c_1 <- `c_1*`} -- if (c'_1*{c'_1 <- `c'_1*`} = $narrow__($lsize($lanetype_Jnn(Jnn_1)), $lsize($lanetype_Jnn(Jnn_2)), sx, !($proj_lane__2(Jnn_1, c_1)))*{c_1 <- `c_1*`}) + -- (if ($proj_lane__2(Jnn_1, c_2) =/= ?()))*{c_2 <- `c_2*`} -- if (c'_2*{c'_2 <- `c'_2*`} = $narrow__($lsize($lanetype_Jnn(Jnn_1)), $lsize($lanetype_Jnn(Jnn_2)), sx, !($proj_lane__2(Jnn_1, c_2)))*{c_2 <- `c_2*`}) -- if (v = $inv_lanes_(`%X%`_shape($lanetype_Jnn(Jnn_2), `%`_dim(M_2)), mk_lane__2_lane_(Jnn_2, c'_1)*{c'_1 <- `c'_1*`} ++ mk_lane__2_lane_(Jnn_2, c'_2)*{c'_2 <- `c'_2*`})) @@ -9529,6 +9575,7 @@ def $ivextunop__(shape_1 : shape, shape_2 : shape, def $f_(N : N, iN*) : iN*, sx -- (wf_lane_: `%%`($lanetype(`%X%`_shape($lanetype_Jnn(Jnn_2), `%`_dim(M_2))), mk_lane__2_lane_(Jnn_2, c)))*{c <- `c*`} -- wf_shape: `%`(`%X%`_shape($lanetype_Jnn(Jnn_1), `%`_dim(M_1))) -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn_1), `%`_dim(M_1)), v_1)) + -- (if ($proj_lane__2(Jnn_1, c_1) =/= ?()))*{c_1 <- `c_1*`} -- if (c'_1*{c'_1 <- `c'_1*`} = $extend__($lsizenn1($lanetype_Jnn(Jnn_1)), $lsizenn2($lanetype_Jnn(Jnn_2)), sx, !($proj_lane__2(Jnn_1, c_1)))*{c_1 <- `c_1*`}) -- if (c*{c <- `c*`} = $f_($lsizenn2($lanetype_Jnn(Jnn_2)), c'_1*{c'_1 <- `c'_1*`})) @@ -9577,7 +9624,9 @@ def $ivextbinop__(shape_1 : shape, shape_2 : shape, def $f_(N : N, iN*, iN*) : i -- wf_shape: `%`(`%X%`_shape($lanetype_Jnn(Jnn_1), `%`_dim(M_1))) -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn_1), `%`_dim(M_1)), v_1)[i!`%`_uN.0 : k!`%`_uN.0]) -- if (c_2*{c_2 <- `c_2*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn_1), `%`_dim(M_1)), v_2)[i!`%`_uN.0 : k!`%`_uN.0]) + -- (if ($proj_lane__2(Jnn_1, c_1) =/= ?()))*{c_1 <- `c_1*`} -- if (c'_1*{c'_1 <- `c'_1*`} = $extend__($lsizenn1($lanetype_Jnn(Jnn_1)), $lsizenn2($lanetype_Jnn(Jnn_2)), sx_1, !($proj_lane__2(Jnn_1, c_1)))*{c_1 <- `c_1*`}) + -- (if ($proj_lane__2(Jnn_1, c_2) =/= ?()))*{c_2 <- `c_2*`} -- if (c'_2*{c'_2 <- `c'_2*`} = $extend__($lsizenn1($lanetype_Jnn(Jnn_1)), $lsizenn2($lanetype_Jnn(Jnn_2)), sx_2, !($proj_lane__2(Jnn_1, c_2)))*{c_2 <- `c_2*`}) -- if (c*{c <- `c*`} = $f_($lsizenn2($lanetype_Jnn(Jnn_2)), c'_1*{c'_1 <- `c'_1*`}, c'_2*{c'_2 <- `c'_2*`})) @@ -9636,6 +9685,7 @@ def $vextternop__(ishape_1 : ishape, ishape_2 : ishape, vextternop__ : vextterno -- if (M = (2 * M_2)) -- if (c' = $vextbinop__(`%`_ishape(`%X%`_shape($lanetype_Jnn(Jnn_1), `%`_dim(M_1))), `%`_ishape(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M))), mk_vextbinop___0_vextbinop__(Jnn_1, M_1, Jnn, M, `RELAXED_DOTS`_vextbinop__Jnn_1_M_1_Jnn_2_M_2), c_1, c_2)) -- if (c'' = $vextunop__(`%`_ishape(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M))), `%`_ishape(`%X%`_shape($lanetype_Jnn(Jnn_2), `%`_dim(M_2))), mk_vextunop___0_vextunop__(Jnn, M, Jnn_2, M_2, EXTADD_PAIRWISE_vextunop__Jnn_1_M_1_Jnn_2_M_2(S_sx)), c')) + -- if (|$vbinop_(`%X%`_shape($lanetype_Jnn(Jnn_2), `%`_dim(M_2)), mk_vbinop__0_vbinop_(Jnn_2, M_2, ADD_vbinop_Jnn_M), c'', c_3)| > 0) -- if (c <- $vbinop_(`%X%`_shape($lanetype_Jnn(Jnn_2), `%`_dim(M_2)), mk_vbinop__0_vbinop_(Jnn_2, M_2, ADD_vbinop_Jnn_M), c'', c_3)) ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec @@ -10271,6 +10321,7 @@ def $exninst(state : state) : exninst* def $type(state : state, typeidx : typeidx) : deftype ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $type{s : store, f : frame, x : uN}(`%;%`_state(s, f), x) = f.MODULE_frame.TYPES_moduleinst[x!`%`_uN.0] + -- if (x!`%`_uN.0 < |f.MODULE_frame.TYPES_moduleinst|) -- wf_store: `%`(s) -- wf_frame: `%`(f) -- wf_uN: `%%`(32, x) @@ -10279,6 +10330,8 @@ def $type(state : state, typeidx : typeidx) : deftype def $tag(state : state, tagidx : tagidx) : taginst ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $tag{s : store, f : frame, x : uN}(`%;%`_state(s, f), x) = s.TAGS_store[f.MODULE_frame.TAGS_moduleinst[x!`%`_uN.0]] + -- if (f.MODULE_frame.TAGS_moduleinst[x!`%`_uN.0] < |s.TAGS_store|) + -- if (x!`%`_uN.0 < |f.MODULE_frame.TAGS_moduleinst|) -- wf_store: `%`(s) -- wf_frame: `%`(f) -- wf_uN: `%%`(32, x) @@ -10287,6 +10340,8 @@ def $tag(state : state, tagidx : tagidx) : taginst def $global(state : state, globalidx : globalidx) : globalinst ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $global{s : store, f : frame, x : uN}(`%;%`_state(s, f), x) = s.GLOBALS_store[f.MODULE_frame.GLOBALS_moduleinst[x!`%`_uN.0]] + -- if (f.MODULE_frame.GLOBALS_moduleinst[x!`%`_uN.0] < |s.GLOBALS_store|) + -- if (x!`%`_uN.0 < |f.MODULE_frame.GLOBALS_moduleinst|) -- wf_store: `%`(s) -- wf_frame: `%`(f) -- wf_uN: `%%`(32, x) @@ -10295,6 +10350,8 @@ def $global(state : state, globalidx : globalidx) : globalinst def $mem(state : state, memidx : memidx) : meminst ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $mem{s : store, f : frame, x : uN}(`%;%`_state(s, f), x) = s.MEMS_store[f.MODULE_frame.MEMS_moduleinst[x!`%`_uN.0]] + -- if (f.MODULE_frame.MEMS_moduleinst[x!`%`_uN.0] < |s.MEMS_store|) + -- if (x!`%`_uN.0 < |f.MODULE_frame.MEMS_moduleinst|) -- wf_store: `%`(s) -- wf_frame: `%`(f) -- wf_uN: `%%`(32, x) @@ -10303,6 +10360,8 @@ def $mem(state : state, memidx : memidx) : meminst def $table(state : state, tableidx : tableidx) : tableinst ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $table{s : store, f : frame, x : uN}(`%;%`_state(s, f), x) = s.TABLES_store[f.MODULE_frame.TABLES_moduleinst[x!`%`_uN.0]] + -- if (f.MODULE_frame.TABLES_moduleinst[x!`%`_uN.0] < |s.TABLES_store|) + -- if (x!`%`_uN.0 < |f.MODULE_frame.TABLES_moduleinst|) -- wf_store: `%`(s) -- wf_frame: `%`(f) -- wf_uN: `%%`(32, x) @@ -10311,6 +10370,8 @@ def $table(state : state, tableidx : tableidx) : tableinst def $func(state : state, funcidx : funcidx) : funcinst ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $func{s : store, f : frame, x : uN}(`%;%`_state(s, f), x) = s.FUNCS_store[f.MODULE_frame.FUNCS_moduleinst[x!`%`_uN.0]] + -- if (f.MODULE_frame.FUNCS_moduleinst[x!`%`_uN.0] < |s.FUNCS_store|) + -- if (x!`%`_uN.0 < |f.MODULE_frame.FUNCS_moduleinst|) -- wf_store: `%`(s) -- wf_frame: `%`(f) -- wf_uN: `%%`(32, x) @@ -10319,6 +10380,8 @@ def $func(state : state, funcidx : funcidx) : funcinst def $data(state : state, dataidx : dataidx) : datainst ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $data{s : store, f : frame, x : uN}(`%;%`_state(s, f), x) = s.DATAS_store[f.MODULE_frame.DATAS_moduleinst[x!`%`_uN.0]] + -- if (f.MODULE_frame.DATAS_moduleinst[x!`%`_uN.0] < |s.DATAS_store|) + -- if (x!`%`_uN.0 < |f.MODULE_frame.DATAS_moduleinst|) -- wf_store: `%`(s) -- wf_frame: `%`(f) -- wf_uN: `%%`(32, x) @@ -10327,6 +10390,8 @@ def $data(state : state, dataidx : dataidx) : datainst def $elem(state : state, tableidx : tableidx) : eleminst ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $elem{s : store, f : frame, x : uN}(`%;%`_state(s, f), x) = s.ELEMS_store[f.MODULE_frame.ELEMS_moduleinst[x!`%`_uN.0]] + -- if (f.MODULE_frame.ELEMS_moduleinst[x!`%`_uN.0] < |s.ELEMS_store|) + -- if (x!`%`_uN.0 < |f.MODULE_frame.ELEMS_moduleinst|) -- wf_store: `%`(s) -- wf_frame: `%`(f) -- wf_uN: `%%`(32, x) @@ -10335,6 +10400,7 @@ def $elem(state : state, tableidx : tableidx) : eleminst def $local(state : state, localidx : localidx) : val? ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $local{s : store, f : frame, x : uN}(`%;%`_state(s, f), x) = f.LOCALS_frame[x!`%`_uN.0] + -- if (x!`%`_uN.0 < |f.LOCALS_frame|) -- wf_store: `%`(s) -- wf_frame: `%`(f) -- wf_uN: `%%`(32, x) @@ -10349,42 +10415,49 @@ def $with_local(state : state, localidx : localidx, val : val) : state def $with_global(state : state, globalidx : globalidx, val : val) : state ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $with_global{s : store, f : frame, x : uN, v : val}(`%;%`_state(s, f), x, v) = `%;%`_state(s[GLOBALS_store[f.MODULE_frame.GLOBALS_moduleinst[x!`%`_uN.0]].VALUE_globalinst = v], f) + -- if (x!`%`_uN.0 < |f.MODULE_frame.GLOBALS_moduleinst|) -- wf_state: `%`(`%;%`_state(s[GLOBALS_store[f.MODULE_frame.GLOBALS_moduleinst[x!`%`_uN.0]].VALUE_globalinst = v], f)) ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $with_table(state : state, tableidx : tableidx, nat : nat, ref : ref) : state ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $with_table{s : store, f : frame, x : uN, i : nat, r : ref}(`%;%`_state(s, f), x, i, r) = `%;%`_state(s[TABLES_store[f.MODULE_frame.TABLES_moduleinst[x!`%`_uN.0]].REFS_tableinst[i] = r], f) + -- if (x!`%`_uN.0 < |f.MODULE_frame.TABLES_moduleinst|) -- wf_state: `%`(`%;%`_state(s[TABLES_store[f.MODULE_frame.TABLES_moduleinst[x!`%`_uN.0]].REFS_tableinst[i] = r], f)) ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $with_tableinst(state : state, tableidx : tableidx, tableinst : tableinst) : state ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $with_tableinst{s : store, f : frame, x : uN, ti : tableinst}(`%;%`_state(s, f), x, ti) = `%;%`_state(s[TABLES_store[f.MODULE_frame.TABLES_moduleinst[x!`%`_uN.0]] = ti], f) + -- if (x!`%`_uN.0 < |f.MODULE_frame.TABLES_moduleinst|) -- wf_state: `%`(`%;%`_state(s[TABLES_store[f.MODULE_frame.TABLES_moduleinst[x!`%`_uN.0]] = ti], f)) ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $with_mem(state : state, memidx : memidx, nat : nat, nat : nat, byte*) : state ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $with_mem{s : store, f : frame, x : uN, i : nat, j : nat, `b*` : byte*}(`%;%`_state(s, f), x, i, j, b*{b <- `b*`}) = `%;%`_state(s[MEMS_store[f.MODULE_frame.MEMS_moduleinst[x!`%`_uN.0]].BYTES_meminst[i : j] = b*{b <- `b*`}], f) + -- if (x!`%`_uN.0 < |f.MODULE_frame.MEMS_moduleinst|) -- wf_state: `%`(`%;%`_state(s[MEMS_store[f.MODULE_frame.MEMS_moduleinst[x!`%`_uN.0]].BYTES_meminst[i : j] = b*{b <- `b*`}], f)) ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $with_meminst(state : state, memidx : memidx, meminst : meminst) : state ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $with_meminst{s : store, f : frame, x : uN, mi : meminst}(`%;%`_state(s, f), x, mi) = `%;%`_state(s[MEMS_store[f.MODULE_frame.MEMS_moduleinst[x!`%`_uN.0]] = mi], f) + -- if (x!`%`_uN.0 < |f.MODULE_frame.MEMS_moduleinst|) -- wf_state: `%`(`%;%`_state(s[MEMS_store[f.MODULE_frame.MEMS_moduleinst[x!`%`_uN.0]] = mi], f)) ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $with_elem(state : state, elemidx : elemidx, ref*) : state ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $with_elem{s : store, f : frame, x : uN, `r*` : ref*}(`%;%`_state(s, f), x, r*{r <- `r*`}) = `%;%`_state(s[ELEMS_store[f.MODULE_frame.ELEMS_moduleinst[x!`%`_uN.0]].REFS_eleminst = r*{r <- `r*`}], f) + -- if (x!`%`_uN.0 < |f.MODULE_frame.ELEMS_moduleinst|) -- wf_state: `%`(`%;%`_state(s[ELEMS_store[f.MODULE_frame.ELEMS_moduleinst[x!`%`_uN.0]].REFS_eleminst = r*{r <- `r*`}], f)) ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $with_data(state : state, dataidx : dataidx, byte*) : state ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $with_data{s : store, f : frame, x : uN, `b*` : byte*}(`%;%`_state(s, f), x, b*{b <- `b*`}) = `%;%`_state(s[DATAS_store[f.MODULE_frame.DATAS_moduleinst[x!`%`_uN.0]].BYTES_datainst = b*{b <- `b*`}], f) + -- if (x!`%`_uN.0 < |f.MODULE_frame.DATAS_moduleinst|) -- wf_state: `%`(`%;%`_state(s[DATAS_store[f.MODULE_frame.DATAS_moduleinst[x!`%`_uN.0]].BYTES_datainst = b*{b <- `b*`}], f)) ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec @@ -13427,18 +13500,23 @@ def $allocelems(store : store, elemtype*, ref**) : (store, elemaddr*) def $allocexport(moduleinst : moduleinst, export : export) : exportinst ;; ../../../../specification/wasm-3.0/4.4-execution.modules.spectec def $allocexport{moduleinst : moduleinst, name : name, x : uN}(moduleinst, EXPORT_export(name, TAG_externidx(x))) = {NAME name, ADDR TAG_externaddr(moduleinst.TAGS_moduleinst[x!`%`_uN.0])} + -- if (x!`%`_uN.0 < |moduleinst.TAGS_moduleinst|) -- wf_exportinst: `%`({NAME name, ADDR TAG_externaddr(moduleinst.TAGS_moduleinst[x!`%`_uN.0])}) ;; ../../../../specification/wasm-3.0/4.4-execution.modules.spectec def $allocexport{moduleinst : moduleinst, name : name, x : uN}(moduleinst, EXPORT_export(name, GLOBAL_externidx(x))) = {NAME name, ADDR GLOBAL_externaddr(moduleinst.GLOBALS_moduleinst[x!`%`_uN.0])} + -- if (x!`%`_uN.0 < |moduleinst.GLOBALS_moduleinst|) -- wf_exportinst: `%`({NAME name, ADDR GLOBAL_externaddr(moduleinst.GLOBALS_moduleinst[x!`%`_uN.0])}) ;; ../../../../specification/wasm-3.0/4.4-execution.modules.spectec def $allocexport{moduleinst : moduleinst, name : name, x : uN}(moduleinst, EXPORT_export(name, MEM_externidx(x))) = {NAME name, ADDR MEM_externaddr(moduleinst.MEMS_moduleinst[x!`%`_uN.0])} + -- if (x!`%`_uN.0 < |moduleinst.MEMS_moduleinst|) -- wf_exportinst: `%`({NAME name, ADDR MEM_externaddr(moduleinst.MEMS_moduleinst[x!`%`_uN.0])}) ;; ../../../../specification/wasm-3.0/4.4-execution.modules.spectec def $allocexport{moduleinst : moduleinst, name : name, x : uN}(moduleinst, EXPORT_export(name, TABLE_externidx(x))) = {NAME name, ADDR TABLE_externaddr(moduleinst.TABLES_moduleinst[x!`%`_uN.0])} + -- if (x!`%`_uN.0 < |moduleinst.TABLES_moduleinst|) -- wf_exportinst: `%`({NAME name, ADDR TABLE_externaddr(moduleinst.TABLES_moduleinst[x!`%`_uN.0])}) ;; ../../../../specification/wasm-3.0/4.4-execution.modules.spectec def $allocexport{moduleinst : moduleinst, name : name, x : uN}(moduleinst, EXPORT_export(name, FUNC_externidx(x))) = {NAME name, ADDR FUNC_externaddr(moduleinst.FUNCS_moduleinst[x!`%`_uN.0])} + -- if (x!`%`_uN.0 < |moduleinst.FUNCS_moduleinst|) -- wf_exportinst: `%`({NAME name, ADDR FUNC_externaddr(moduleinst.FUNCS_moduleinst[x!`%`_uN.0])}) ;; ../../../../specification/wasm-3.0/4.4-execution.modules.spectec @@ -13467,11 +13545,18 @@ def $allocmodule(store : store, module : module, externaddr*, val*, ref*, ref**) -- wf_store: `%`(s_6) -- wf_module: `%`(MODULE_module(type*{type <- `type*`}, import*{import <- `import*`}, tag*{tag <- `tag*`}, global*{global <- `global*`}, mem*{mem <- `mem*`}, table*{table <- `table*`}, func*{func <- `func*`}, data*{data <- `data*`}, elem*{elem <- `elem*`}, start?{start <- `start?`}, export*{export <- `export*`})) -- (wf_tag: `%`(TAG_tag(tagtype)))*{tagtype <- `tagtype*`} + -- if (|`expr_G*`| = |`globaltype*`|) -- (wf_global: `%`(GLOBAL_global(globaltype, expr_G)))*{expr_G <- `expr_G*`, globaltype <- `globaltype*`} -- (wf_mem: `%`(MEMORY_mem(memtype)))*{memtype <- `memtype*`} + -- if (|`expr_T*`| = |`tabletype*`|) -- (wf_table: `%`(TABLE_table(tabletype, expr_T)))*{expr_T <- `expr_T*`, tabletype <- `tabletype*`} + -- if (|`expr_F*`| = |`local**`|) + -- if (|`expr_F*`| = |`x*`|) -- (wf_func: `%`(FUNC_func(x, local*{local <- `local*`}, expr_F)))*{expr_F <- `expr_F*`, `local*` <- `local**`, x <- `x*`} + -- if (|`byte**`| = |`datamode*`|) -- (wf_data: `%`(DATA_data(byte*{byte <- `byte*`}, datamode)))*{`byte*` <- `byte**`, datamode <- `datamode*`} + -- if (|`elemmode*`| = |`elemtype*`|) + -- if (|`elemmode*`| = |`expr_E**`|) -- (wf_elem: `%`(ELEM_elem(elemtype, expr_E*{expr_E <- `expr_E*`}, elemmode)))*{elemmode <- `elemmode*`, elemtype <- `elemtype*`, `expr_E*` <- `expr_E**`} -- wf_moduleinst: `%`({TYPES [], TAGS aa_I*{aa_I <- `aa_I*`} ++ aa*{aa <- `aa*`}, GLOBALS ga_I*{ga_I <- `ga_I*`} ++ ga*{ga <- `ga*`}, MEMS ma_I*{ma_I <- `ma_I*`} ++ ma*{ma <- `ma*`}, TABLES ta_I*{ta_I <- `ta_I*`} ++ ta*{ta <- `ta*`}, FUNCS fa_I*{fa_I <- `fa_I*`} ++ fa*{fa <- `fa*`}, DATAS [], ELEMS [], EXPORTS []}) -- wf_moduleinst: `%`({TYPES dt*{dt <- `dt*`}, TAGS aa_I*{aa_I <- `aa_I*`} ++ aa*{aa <- `aa*`}, GLOBALS ga_I*{ga_I <- `ga_I*`} ++ ga*{ga <- `ga*`}, MEMS ma_I*{ma_I <- `ma_I*`} ++ ma*{ma <- `ma*`}, TABLES ta_I*{ta_I <- `ta_I*`} ++ ta*{ta <- `ta*`}, FUNCS fa_I*{fa_I <- `fa_I*`} ++ fa*{fa <- `fa*`}, DATAS da*{da <- `da*`}, ELEMS ea*{ea <- `ea*`}, EXPORTS xi*{xi <- `xi*`}}) @@ -13496,6 +13581,7 @@ def $allocmodule(store : store, module : module, externaddr*, val*, ref*, ref**) -- if ((s_4, ta*{ta <- `ta*`}) = $alloctables(s_3, $subst_all_tabletype(tabletype, $typeuse_deftype(dt)*{dt <- `dt*`})*{tabletype <- `tabletype*`}, ref_T*{ref_T <- `ref_T*`})) -- if ((s_5, da*{da <- `da*`}) = $allocdatas(s_4, OK_datatype^|data*{data <- `data*`}|{}, byte*{byte <- `byte*`}*{`byte*` <- `byte**`})) -- if ((s_6, ea*{ea <- `ea*`}) = $allocelems(s_5, $subst_all_reftype(elemtype, $typeuse_deftype(dt)*{dt <- `dt*`})*{elemtype <- `elemtype*`}, ref_E*{ref_E <- `ref_E*`}*{`ref_E*` <- `ref_E**`})) + -- (if (x!`%`_uN.0 < |dt*{dt <- `dt*`}|))*{x <- `x*`} -- if ((s_7, fa*{fa <- `fa*`}) = $allocfuncs(s_6, dt*{dt <- `dt*`}[x!`%`_uN.0]*{x <- `x*`}, FUNC_funccode(x, local*{local <- `local*`}, expr_F)*{expr_F <- `expr_F*`, `local*` <- `local**`, x <- `x*`}, moduleinst^|func*{func <- `func*`}|{})) -- if (xi*{xi <- `xi*`} = $allocexports({TYPES [], TAGS aa_I*{aa_I <- `aa_I*`} ++ aa*{aa <- `aa*`}, GLOBALS ga_I*{ga_I <- `ga_I*`} ++ ga*{ga <- `ga*`}, MEMS ma_I*{ma_I <- `ma_I*`} ++ ma*{ma <- `ma*`}, TABLES ta_I*{ta_I <- `ta_I*`} ++ ta*{ta <- `ta*`}, FUNCS fa_I*{fa_I <- `fa_I*`} ++ fa*{fa <- `fa*`}, DATAS [], ELEMS [], EXPORTS []}, export*{export <- `export*`})) -- if (moduleinst = {TYPES dt*{dt <- `dt*`}, TAGS aa_I*{aa_I <- `aa_I*`} ++ aa*{aa <- `aa*`}, GLOBALS ga_I*{ga_I <- `ga_I*`} ++ ga*{ga <- `ga*`}, MEMS ma_I*{ma_I <- `ma_I*`} ++ ma*{ma <- `ma*`}, TABLES ta_I*{ta_I <- `ta_I*`} ++ ta*{ta <- `ta*`}, FUNCS fa_I*{fa_I <- `fa_I*`} ++ fa*{fa <- `fa*`}, DATAS da*{da <- `da*`}, ELEMS ea*{ea <- `ea*`}, EXPORTS xi*{xi <- `xi*`}}) @@ -13576,9 +13662,14 @@ def $instantiate(store : store, module : module, externaddr*) : config -- wf_config: `%`(`%;%`_config(`%;%`_state(s', {LOCALS [], MODULE moduleinst}), instr_E*{instr_E <- `instr_E*`} ++ instr_D*{instr_D <- `instr_D*`} ++ lift(instr_S?{instr_S <- `instr_S?`}))) -- wf_moduletype: `%`(`%->%`_moduletype(xt_I*{xt_I <- `xt_I*`}, xt_E*{xt_E <- `xt_E*`})) -- wf_module: `%`(MODULE_module(type*{type <- `type*`}, import*{import <- `import*`}, tag*{tag <- `tag*`}, global*{global <- `global*`}, mem*{mem <- `mem*`}, table*{table <- `table*`}, func*{func <- `func*`}, data*{data <- `data*`}, elem*{elem <- `elem*`}, start?{start <- `start?`}, export*{export <- `export*`})) + -- if (|`expr_G*`| = |`globaltype*`|) -- (wf_global: `%`(GLOBAL_global(globaltype, expr_G)))*{expr_G <- `expr_G*`, globaltype <- `globaltype*`} + -- if (|`expr_T*`| = |`tabletype*`|) -- (wf_table: `%`(TABLE_table(tabletype, expr_T)))*{expr_T <- `expr_T*`, tabletype <- `tabletype*`} + -- if (|`byte**`| = |`datamode*`|) -- (wf_data: `%`(DATA_data(byte*{byte <- `byte*`}, datamode)))*{`byte*` <- `byte**`, datamode <- `datamode*`} + -- if (|`elemmode*`| = |`expr_E**`|) + -- if (|`elemmode*`| = |`reftype*`|) -- (wf_elem: `%`(ELEM_elem(reftype, expr_E*{expr_E <- `expr_E*`}, elemmode)))*{elemmode <- `elemmode*`, `expr_E*` <- `expr_E**`, reftype <- `reftype*`} -- (wf_start: `%`(START_start(x)))?{x <- `x?`} -- wf_moduleinst: `%`({TYPES $alloctypes(type*{type <- `type*`}), TAGS [], GLOBALS $globalsxa(externaddr*{externaddr <- `externaddr*`}), MEMS [], TABLES [], FUNCS $funcsxa(externaddr*{externaddr <- `externaddr*`}) ++ (|s.FUNCS_store| + i_F)^(i_F<|func*{func <- `func*`}|){i_F <- `i_F*`}, DATAS [], ELEMS [], EXPORTS []}) @@ -13587,6 +13678,7 @@ def $instantiate(store : store, module : module, externaddr*) : config -- (wf_uN: `%%`(32, `%`_uN(i_E)))^(i_E<|elem*{elem <- `elem*`}|){i_E <- `i_E*`} -- (wf_instr: `%`(CALL_instr(x)))?{x <- `x?`} -- Module_ok: `|-%:%`(module, `%->%`_moduletype(xt_I*{xt_I <- `xt_I*`}, xt_E*{xt_E <- `xt_E*`})) + -- if (|`externaddr*`| = |`xt_I*`|) -- (Externaddr_ok: `%|-%:%`(s, externaddr, xt_I))*{externaddr <- `externaddr*`, xt_I <- `xt_I*`} -- if (module = MODULE_module(type*{type <- `type*`}, import*{import <- `import*`}, tag*{tag <- `tag*`}, global*{global <- `global*`}, mem*{mem <- `mem*`}, table*{table <- `table*`}, func*{func <- `func*`}, data*{data <- `data*`}, elem*{elem <- `elem*`}, start?{start <- `start?`}, export*{export <- `export*`})) -- if (global*{global <- `global*`} = GLOBAL_global(globaltype, expr_G)*{expr_G <- `expr_G*`, globaltype <- `globaltype*`}) @@ -13597,10 +13689,15 @@ def $instantiate(store : store, module : module, externaddr*) : config -- if (moduleinst_0 = {TYPES $alloctypes(type*{type <- `type*`}), TAGS [], GLOBALS $globalsxa(externaddr*{externaddr <- `externaddr*`}), MEMS [], TABLES [], FUNCS $funcsxa(externaddr*{externaddr <- `externaddr*`}) ++ (|s.FUNCS_store| + i_F)^(i_F<|func*{func <- `func*`}|){i_F <- `i_F*`}, DATAS [], ELEMS [], EXPORTS []}) -- if (z = `%;%`_state(s, {LOCALS [], MODULE moduleinst_0})) -- if ((z', val_G*{val_G <- `val_G*`}) = $evalglobals(z, globaltype*{globaltype <- `globaltype*`}, expr_G*{expr_G <- `expr_G*`})) + -- if (|`expr_T*`| = |`ref_T*`|) -- (Eval_expr: `%;%~>*%;%`(z', expr_T, z', [$val_ref(ref_T)]))*{expr_T <- `expr_T*`, ref_T <- `ref_T*`} + -- if (|`expr_E**`| = |`ref_E**`|) + -- (if (|`expr_E*`| = |`ref_E*`|))*{`expr_E*` <- `expr_E**`, `ref_E*` <- `ref_E**`} -- (Eval_expr: `%;%~>*%;%`(z', expr_E, z', [$val_ref(ref_E)]))*{expr_E <- `expr_E*`, ref_E <- `ref_E*`}*{`expr_E*` <- `expr_E**`, `ref_E*` <- `ref_E**`} -- if ((s', moduleinst) = $allocmodule(s, module, externaddr*{externaddr <- `externaddr*`}, val_G*{val_G <- `val_G*`}, ref_T*{ref_T <- `ref_T*`}, ref_E*{ref_E <- `ref_E*`}*{`ref_E*` <- `ref_E**`})) + -- (if (i_D < |data*{data <- `data*`}|))^(i_D<|data*{data <- `data*`}|){i_D <- `i_D*`} -- if (instr_D*{instr_D <- `instr_D*`} = $concat_(syntax instr, $rundata_(`%`_dataidx(i_D), data*{data <- `data*`}[i_D])^(i_D<|data*{data <- `data*`}|){i_D <- `i_D*`})) + -- (if (i_E < |elem*{elem <- `elem*`}|))^(i_E<|elem*{elem <- `elem*`}|){i_E <- `i_E*`} -- if (instr_E*{instr_E <- `instr_E*`} = $concat_(syntax instr, $runelem_(`%`_elemidx(i_E), elem*{elem <- `elem*`}[i_E])^(i_E<|elem*{elem <- `elem*`}|){i_E <- `i_E*`})) -- if (instr_S?{instr_S <- `instr_S?`} = CALL_instr(x)?{x <- `x?`}) @@ -13608,9 +13705,11 @@ def $instantiate(store : store, module : module, externaddr*) : config def $invoke(store : store, funcaddr : funcaddr, val*) : config ;; ../../../../specification/wasm-3.0/4.4-execution.modules.spectec def $invoke{s : store, funcaddr : nat, `val*` : val*, `t_1*` : valtype*, `t_2*` : valtype*}(s, funcaddr, val*{val <- `val*`}) = `%;%`_config(`%;%`_state(s, {LOCALS [], MODULE {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], EXPORTS []}}), $instr_val(val)*{val <- `val*`} ++ [REF.FUNC_ADDR_instr(funcaddr) CALL_REF_instr($typeuse_deftype(s.FUNCS_store[funcaddr].TYPE_funcinst))]) + -- if (funcaddr < |s.FUNCS_store|) -- wf_config: `%`(`%;%`_config(`%;%`_state(s, {LOCALS [], MODULE {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], EXPORTS []}}), $instr_val(val)*{val <- `val*`} ++ [REF.FUNC_ADDR_instr(funcaddr) CALL_REF_instr($typeuse_deftype(s.FUNCS_store[funcaddr].TYPE_funcinst))])) -- wf_comptype: `%`(`FUNC%->%`_comptype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`}))) -- Expand: `%~~%`(s.FUNCS_store[funcaddr].TYPE_funcinst, `FUNC%->%`_comptype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`}))) + -- if (|`t_1*`| = |`val*`|) -- (Val_ok: `%|-%:%`(s, val, t_1))*{t_1 <- `t_1*`, val <- `val*`} ;; ../../../../specification/wasm-3.0/5.1-binary.values.spectec diff --git a/spectec/test-middlend/specification.07-alias-demut.exp b/spectec/test-middlend/specification.07-alias-demut.exp index 313a76b23f..8bb1593a1f 100644 --- a/spectec/test-middlend/specification.07-alias-demut.exp +++ b/spectec/test-middlend/specification.07-alias-demut.exp @@ -96,6 +96,7 @@ def $disjoint_(syntax X, X*) : bool def $disjoint_{syntax X}(syntax X, []) = true ;; ../../../../specification/wasm-3.0/0.3-aux.seq.spectec:37.1-37.68 def $disjoint_{syntax X, w : X, `w'*` : X*}(syntax X, [w] ++ w'*{w' <- `w'*`}) = (~ (w <- w'*{w' <- `w'*`}) /\ $disjoint_(syntax X, w'*{w' <- `w'*`})) + -- if (|w'*{w' <- `w'*`}| > 0) } ;; ../../../../specification/wasm-3.0/0.3-aux.seq.spectec @@ -1491,6 +1492,7 @@ def $inv_jsize(nat : nat) : Jnn? def $inv_jsize(16) = ?(I16_Jnn) ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec def $inv_jsize{n : nat}(n) = ?($Jnn_addrtype(!($inv_isize(n)))) + -- if ($inv_isize(n) =/= ?()) def $inv_jsize{x0 : nat}(x0) = ?() ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec @@ -1550,6 +1552,7 @@ def $jsizenn(Jnn : Jnn) : nat def $inv_jsizenn(nat : nat) : Jnn? ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec def $inv_jsizenn{n : nat}(n) = ?(!($inv_jsize(n))) + -- if ($inv_jsize(n) =/= ?()) def $inv_jsizenn{x0 : nat}(x0) = ?() ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec @@ -2061,6 +2064,7 @@ def $rolldt(typeidx : typeidx, rectype : rectype) : deftype* def $unrolldt(deftype : deftype) : subtype ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec def $unrolldt{rectype : rectype, i : nat, `subtype*` : subtype*}(_DEF_deftype(rectype, i)) = subtype*{subtype <- `subtype*`}[i] + -- if (i < |subtype*{subtype <- `subtype*`}|) -- (wf_subtype: `%`(subtype))*{subtype <- `subtype*`} -- if ($unrollrt(rectype) = REC_rectype(`%`_list(subtype*{subtype <- `subtype*`}))) @@ -5552,10 +5556,12 @@ def $unrollht(context : context, heaptype : heaptype) : subtype -- wf_context: `%`(C) ;; ../../../../specification/wasm-3.0/2.1-validation.types.spectec def $unrollht{C : context, typeidx : uN}(C, _IDX_heaptype(typeidx)) = $unrolldt(C.TYPES_context[typeidx!`%`_uN.0]) + -- if (typeidx!`%`_uN.0 < |C.TYPES_context|) -- wf_context: `%`(C) -- wf_uN: `%%`(32, typeidx) ;; ../../../../specification/wasm-3.0/2.1-validation.types.spectec def $unrollht{C : context, i : nat}(C, REC_heaptype(i)) = C.RECS_context[i] + -- if (i < |C.RECS_context|) -- wf_context: `%`(C) ;; ../../../../specification/wasm-3.0/2.1-validation.types.spectec @@ -8036,6 +8042,7 @@ relation wf_relaxed4: `%`(relaxed4) def $relaxed2(relaxed2 : relaxed2, syntax X, X : X, X : X) : X ;; ../../../../specification/wasm-3.0/3.0-numerics.relaxed.spectec def $relaxed2{i : relaxed2, syntax X, X_1 : X, X_2 : X}(i, syntax X, X_1, X_2) = [X_1 X_2][i!`%`_relaxed2.0] + -- if (i!`%`_relaxed2.0 < |[X_1 X_2]|) -- wf_relaxed2: `%`(i) -- if $ND ;; ../../../../specification/wasm-3.0/3.0-numerics.relaxed.spectec @@ -8047,6 +8054,7 @@ def $relaxed2(relaxed2 : relaxed2, syntax X, X : X, X : X) : X def $relaxed4(relaxed4 : relaxed4, syntax X, X : X, X : X, X : X, X : X) : X ;; ../../../../specification/wasm-3.0/3.0-numerics.relaxed.spectec def $relaxed4{i : relaxed4, syntax X, X_1 : X, X_2 : X, X_3 : X, X_4 : X}(i, syntax X, X_1, X_2, X_3, X_4) = [X_1 X_2 X_3 X_4][i!`%`_relaxed4.0] + -- if (i!`%`_relaxed4.0 < |[X_1 X_2 X_3 X_4]|) -- wf_relaxed4: `%`(i) -- if $ND ;; ../../../../specification/wasm-3.0/3.0-numerics.relaxed.spectec @@ -8605,6 +8613,7 @@ def $cunpacknum_(storagetype : storagetype, lit_ : lit_) : lit_ -- wf_lit_: `%%`($storagetype_consttype(consttype), c) ;; ../../../../specification/wasm-3.0/3.1-numerics.scalar.spectec def $cunpacknum_{packtype : packtype, c : uN}($storagetype_packtype(packtype), mk_lit__2_lit_(packtype, c)) = mk_lit__0_lit_(I32_numtype, mk_num__0_num_(I32_Inn, $extend__($psize(packtype), $size($lunpack($lanetype_packtype(packtype))), U_sx, c))) + -- if ($cunpack($storagetype_packtype(packtype)) =/= ?()) -- wf_lit_: `%%`($storagetype_consttype(!($cunpack($storagetype_packtype(packtype)))), mk_lit__0_lit_(I32_numtype, mk_num__0_num_(I32_Inn, $extend__($psize(packtype), $size($lunpack($lanetype_packtype(packtype))), U_sx, c)))) ;; ../../../../specification/wasm-3.0/3.1-numerics.scalar.spectec @@ -8839,9 +8848,9 @@ def $half(half : half, nat : nat, nat : nat) : nat def $iswizzle_lane_(N : N, iN*, iN : iN) : iN ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec def $iswizzle_lane_{N : nat, `c*` : iN*, i : uN}(N, c*{c <- `c*`}, i) = c*{c <- `c*`}[i!`%`_uN.0] + -- if (i!`%`_uN.0 < |c*{c <- `c*`}|) -- (wf_uN: `%%`(N, c))*{c <- `c*`} -- wf_uN: `%%`(N, i) - -- if (i!`%`_uN.0 < |c*{c <- `c*`}|) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec def $iswizzle_lane_{N : nat, `c*` : iN*, i : uN}(N, c*{c <- `c*`}, i) = `%`_iN(0) -- (wf_uN: `%%`(N, c))*{c <- `c*`} @@ -8853,9 +8862,9 @@ def $iswizzle_lane_(N : N, iN*, iN : iN) : iN def $irelaxed_swizzle_lane_(N : N, iN*, iN : iN) : iN ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec def $irelaxed_swizzle_lane_{N : nat, `c*` : iN*, i : uN}(N, c*{c <- `c*`}, i) = c*{c <- `c*`}[i!`%`_uN.0] + -- if (i!`%`_uN.0 < |c*{c <- `c*`}|) -- (wf_uN: `%%`(N, c))*{c <- `c*`} -- wf_uN: `%%`(N, i) - -- if (i!`%`_uN.0 < |c*{c <- `c*`}|) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec def $irelaxed_swizzle_lane_{N : nat, `c*` : iN*, i : uN}(N, c*{c <- `c*`}, i) = `%`_iN(0) -- (wf_uN: `%%`(N, c))*{c <- `c*`} @@ -8864,6 +8873,7 @@ def $irelaxed_swizzle_lane_(N : N, iN*, iN : iN) : iN -- if ($signed_(N, i!`%`_uN.0) < (0 : nat <:> int)) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec def $irelaxed_swizzle_lane_{N : nat, `c*` : iN*, i : uN}(N, c*{c <- `c*`}, i) = $relaxed2($R_swizzle, syntax iN, `%`_iN(0), c*{c <- `c*`}[(i!`%`_uN.0 \ |c*{c <- `c*`}|)]) + -- if ((i!`%`_uN.0 \ |c*{c <- `c*`}|) < |c*{c <- `c*`}|) -- (wf_uN: `%%`(N, c))*{c <- `c*`} -- wf_uN: `%%`(N, i) -- wf_uN: `%%`(N, `%`_uN(0)) @@ -8878,6 +8888,7 @@ def $ivunop_(shape : shape, def $f_(N : N, iN : iN) : iN, vec_ : vec_) : vec_* -- wf_shape: `%`(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M))) -- (wf_lane_: `%%`($lanetype(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M))), mk_lane__2_lane_(Jnn, c)))*{c <- `c*`} -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M)), v_1)) + -- (if ($proj_lane__2(Jnn, c_1) =/= ?()))*{c_1 <- `c_1*`} -- if (c*{c <- `c*`} = $f_($lsizenn($lanetype_Jnn(Jnn)), !($proj_lane__2(Jnn, c_1)))*{c_1 <- `c_1*`}) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec @@ -8903,6 +8914,8 @@ def $ivbinop_(shape : shape, def $f_(N : N, iN : iN, iN : iN) : iN, vec_ : vec_, -- (wf_lane_: `%%`($lanetype(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M))), mk_lane__2_lane_(Jnn, c)))*{c <- `c*`} -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M)), v_1)) -- if (c_2*{c_2 <- `c_2*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M)), v_2)) + -- (if ($proj_lane__2(Jnn, c_1) =/= ?()))*{c_1 <- `c_1*`} + -- (if ($proj_lane__2(Jnn, c_2) =/= ?()))*{c_2 <- `c_2*`} -- if (c*{c <- `c*`} = $f_($lsizenn($lanetype_Jnn(Jnn)), !($proj_lane__2(Jnn, c_1)), !($proj_lane__2(Jnn, c_2)))*{c_1 <- `c_1*`, c_2 <- `c_2*`}) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec @@ -8917,6 +8930,8 @@ def $ivbinopsx_(shape : shape, def $f_(N : N, sx : sx, iN : iN, iN : iN) : iN, s -- (wf_lane_: `%%`($lanetype(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M))), mk_lane__2_lane_(Jnn, c)))*{c <- `c*`} -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M)), v_1)) -- if (c_2*{c_2 <- `c_2*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M)), v_2)) + -- (if ($proj_lane__2(Jnn, c_1) =/= ?()))*{c_1 <- `c_1*`} + -- (if ($proj_lane__2(Jnn, c_2) =/= ?()))*{c_2 <- `c_2*`} -- if (c*{c <- `c*`} = $f_($lsizenn($lanetype_Jnn(Jnn)), sx, !($proj_lane__2(Jnn, c_1)), !($proj_lane__2(Jnn, c_2)))*{c_1 <- `c_1*`, c_2 <- `c_2*`}) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec @@ -8927,6 +8942,7 @@ def $ivbinopsxnd_(shape : shape, def $f_(N : N, sx : sx, iN : iN, iN : iN) : iN* -- wf_uN: `%%`(128, v_2) -- (wf_lane_: `%%`($lanetype_Jnn(Jnn), c))*{c <- `c*`}*{`c*` <- `c**`} -- wf_shape: `%`(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M))) + -- if (|`c_1*`| = |`c_2*`|) -- (wf_lane_: `%%`($lanetype_Jnn(Jnn), mk_lane__2_lane_(Jnn, iter_0)))*{iter_0 <- $f_($lsizenn($lanetype_Jnn(Jnn)), sx, !($proj_lane__2(Jnn, c_1)), !($proj_lane__2(Jnn, c_2)))}*{c_1 <- `c_1*`, c_2 <- `c_2*`} -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M)), v_1)) -- if (c_2*{c_2 <- `c_2*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M)), v_2)) @@ -8940,6 +8956,7 @@ def $fvbinop_(shape : shape, def $f_(N : N, fN : fN, fN : fN) : fN*, vec_ : vec_ -- wf_uN: `%%`(128, v_2) -- (wf_lane_: `%%`($lanetype_Fnn(Fnn), c))*{c <- `c*`}*{`c*` <- `c**`} -- wf_shape: `%`(`%X%`_shape($lanetype_Fnn(Fnn), `%`_dim(M))) + -- if (|`c_1*`| = |`c_2*`|) -- (wf_lane_: `%%`($lanetype_Fnn(Fnn), mk_lane__0_lane_($numtype_Fnn(Fnn), mk_num__1_num_(Fnn, iter_0))))*{iter_0 <- $f_($sizenn($numtype_Fnn(Fnn)), !($proj_num__1(Fnn, !($proj_lane__0($numtype_Fnn(Fnn), c_1)))), !($proj_num__1(Fnn, !($proj_lane__0($numtype_Fnn(Fnn), c_2)))))}*{c_1 <- `c_1*`, c_2 <- `c_2*`} -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape($lanetype_Fnn(Fnn), `%`_dim(M)), v_1)) -- if (c_2*{c_2 <- `c_2*`} = $lanes_(`%X%`_shape($lanetype_Fnn(Fnn), `%`_dim(M)), v_2)) @@ -8954,6 +8971,8 @@ def $ivternopnd_(shape : shape, def $f_(N : N, iN : iN, iN : iN, iN : iN) : iN*, -- wf_uN: `%%`(128, v_3) -- (wf_lane_: `%%`($lanetype_Jnn(Jnn), c))*{c <- `c*`}*{`c*` <- `c**`} -- wf_shape: `%`(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M))) + -- if (|`c_1*`| = |`c_2*`|) + -- if (|`c_1*`| = |`c_3*`|) -- (wf_lane_: `%%`($lanetype_Jnn(Jnn), mk_lane__2_lane_(Jnn, iter_0)))*{iter_0 <- $f_($lsizenn($lanetype_Jnn(Jnn)), !($proj_lane__2(Jnn, c_1)), !($proj_lane__2(Jnn, c_2)), !($proj_lane__2(Jnn, c_3)))}*{c_1 <- `c_1*`, c_2 <- `c_2*`, c_3 <- `c_3*`} -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M)), v_1)) -- if (c_2*{c_2 <- `c_2*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M)), v_2)) @@ -8969,6 +8988,8 @@ def $fvternop_(shape : shape, def $f_(N : N, fN : fN, fN : fN, fN : fN) : fN*, v -- wf_uN: `%%`(128, v_3) -- (wf_lane_: `%%`($lanetype_Fnn(Fnn), c))*{c <- `c*`}*{`c*` <- `c**`} -- wf_shape: `%`(`%X%`_shape($lanetype_Fnn(Fnn), `%`_dim(M))) + -- if (|`c_1*`| = |`c_2*`|) + -- if (|`c_1*`| = |`c_3*`|) -- (wf_lane_: `%%`($lanetype_Fnn(Fnn), mk_lane__0_lane_($numtype_Fnn(Fnn), mk_num__1_num_(Fnn, iter_0))))*{iter_0 <- $f_($sizenn($numtype_Fnn(Fnn)), !($proj_num__1(Fnn, !($proj_lane__0($numtype_Fnn(Fnn), c_1)))), !($proj_num__1(Fnn, !($proj_lane__0($numtype_Fnn(Fnn), c_2)))), !($proj_num__1(Fnn, !($proj_lane__0($numtype_Fnn(Fnn), c_3)))))}*{c_1 <- `c_1*`, c_2 <- `c_2*`, c_3 <- `c_3*`} -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape($lanetype_Fnn(Fnn), `%`_dim(M)), v_1)) -- if (c_2*{c_2 <- `c_2*`} = $lanes_(`%X%`_shape($lanetype_Fnn(Fnn), `%`_dim(M)), v_2)) @@ -8984,6 +9005,7 @@ def $ivtestop_(shape : shape, def $f_(N : N, iN : iN) : u32, vec_ : vec_) : u32 -- wf_uN: `%%`(32, `%`_uN($prod(c!`%`_uN.0*{c <- `c*`}))) -- wf_shape: `%`(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M))) -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M)), v_1)) + -- (if ($proj_lane__2(Jnn, c_1) =/= ?()))*{c_1 <- `c_1*`} -- if (c*{c <- `c*`} = $f_($lsizenn($lanetype_Jnn(Jnn)), !($proj_lane__2(Jnn, c_1)))*{c_1 <- `c_1*`}) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec @@ -8995,6 +9017,8 @@ def $fvtestop_(shape : shape, def $f_(N : N, fN : fN) : u32, vec_ : vec_) : u32 -- wf_uN: `%%`(32, `%`_uN($prod(c!`%`_uN.0*{c <- `c*`}))) -- wf_shape: `%`(`%X%`_shape($lanetype_Fnn(Fnn), `%`_dim(M))) -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape($lanetype_Fnn(Fnn), `%`_dim(M)), v_1)) + -- (if ($proj_num__1(Fnn, !($proj_lane__0($numtype_Fnn(Fnn), c_1))) =/= ?()))*{c_1 <- `c_1*`} + -- (if ($proj_lane__0($numtype_Fnn(Fnn), c_1) =/= ?()))*{c_1 <- `c_1*`} -- if (c*{c <- `c*`} = $f_($sizenn($numtype_Fnn(Fnn)), !($proj_num__1(Fnn, !($proj_lane__0($numtype_Fnn(Fnn), c_1)))))*{c_1 <- `c_1*`}) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec @@ -9005,6 +9029,9 @@ def $ivrelop_(shape : shape, def $f_(N : N, iN : iN, iN : iN) : u32, vec_ : vec_ -- wf_uN: `%%`(128, v_2) -- wf_shape: `%`(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M))) -- (wf_lane_: `%%`($lanetype(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M))), mk_lane__2_lane_(Jnn, c)))*{c <- `c*`} + -- if (|`c_1*`| = |`c_2*`|) + -- (if ($proj_lane__2(Jnn, c_1) =/= ?()))*{c_1 <- `c_1*`} + -- (if ($proj_lane__2(Jnn, c_2) =/= ?()))*{c_2 <- `c_2*`} -- (wf_uN: `%%`(1, `%`_uN($f_($lsizenn($lanetype_Jnn(Jnn)), !($proj_lane__2(Jnn, c_1)), !($proj_lane__2(Jnn, c_2)))!`%`_uN.0)))*{c_1 <- `c_1*`, c_2 <- `c_2*`} -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M)), v_1)) -- if (c_2*{c_2 <- `c_2*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M)), v_2)) @@ -9018,6 +9045,9 @@ def $ivrelopsx_(shape : shape, def $f_(N : N, sx : sx, iN : iN, iN : iN) : u32, -- wf_uN: `%%`(128, v_2) -- wf_shape: `%`(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M))) -- (wf_lane_: `%%`($lanetype(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M))), mk_lane__2_lane_(Jnn, c)))*{c <- `c*`} + -- if (|`c_1*`| = |`c_2*`|) + -- (if ($proj_lane__2(Jnn, c_1) =/= ?()))*{c_1 <- `c_1*`} + -- (if ($proj_lane__2(Jnn, c_2) =/= ?()))*{c_2 <- `c_2*`} -- (wf_uN: `%%`(1, `%`_uN($f_($lsizenn($lanetype_Jnn(Jnn)), sx, !($proj_lane__2(Jnn, c_1)), !($proj_lane__2(Jnn, c_2)))!`%`_uN.0)))*{c_1 <- `c_1*`, c_2 <- `c_2*`} -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M)), v_1)) -- if (c_2*{c_2 <- `c_2*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M)), v_2)) @@ -9032,6 +9062,11 @@ def $fvrelop_(shape : shape, def $f_(N : N, fN : fN, fN : fN) : u32, vec_ : vec_ -- wf_shape: `%`(`%X%`_shape($lanetype_addrtype(Inn), `%`_dim(M))) -- (wf_lane_: `%%`($lanetype(`%X%`_shape($lanetype_addrtype(Inn), `%`_dim(M))), mk_lane__0_lane_($numtype_addrtype(Inn), mk_num__0_num_(Inn, `%`_uN(c!`%`_uN.0)))))*{c <- `c*`} -- wf_shape: `%`(`%X%`_shape($lanetype_Fnn(Fnn), `%`_dim(M))) + -- if (|`c_1*`| = |`c_2*`|) + -- (if ($proj_num__1(Fnn, !($proj_lane__0($numtype_Fnn(Fnn), c_1))) =/= ?()))*{c_1 <- `c_1*`} + -- (if ($proj_lane__0($numtype_Fnn(Fnn), c_1) =/= ?()))*{c_1 <- `c_1*`} + -- (if ($proj_num__1(Fnn, !($proj_lane__0($numtype_Fnn(Fnn), c_2))) =/= ?()))*{c_2 <- `c_2*`} + -- (if ($proj_lane__0($numtype_Fnn(Fnn), c_2) =/= ?()))*{c_2 <- `c_2*`} -- (wf_uN: `%%`(1, `%`_uN($f_($sizenn($numtype_Fnn(Fnn)), !($proj_num__1(Fnn, !($proj_lane__0($numtype_Fnn(Fnn), c_1)))), !($proj_num__1(Fnn, !($proj_lane__0($numtype_Fnn(Fnn), c_2)))))!`%`_uN.0)))*{c_1 <- `c_1*`, c_2 <- `c_2*`} -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape($lanetype_Fnn(Fnn), `%`_dim(M)), v_1)) -- if (c_2*{c_2 <- `c_2*`} = $lanes_(`%X%`_shape($lanetype_Fnn(Fnn), `%`_dim(M)), v_2)) @@ -9048,6 +9083,7 @@ def $ivshiftop_(shape : shape, def $f_(N : N, iN : iN, u32 : u32) : iN, vec_ : v -- wf_shape: `%`(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M))) -- (wf_lane_: `%%`($lanetype(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M))), mk_lane__2_lane_(Jnn, c)))*{c <- `c*`} -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M)), v_1)) + -- (if ($proj_lane__2(Jnn, c_1) =/= ?()))*{c_1 <- `c_1*`} -- if (c*{c <- `c*`} = $f_($lsizenn($lanetype_Jnn(Jnn)), !($proj_lane__2(Jnn, c_1)), i)*{c_1 <- `c_1*`}) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec @@ -9060,6 +9096,7 @@ def $ivshiftopsx_(shape : shape, def $f_(N : N, sx : sx, iN : iN, u32 : u32) : i -- wf_shape: `%`(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M))) -- (wf_lane_: `%%`($lanetype(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M))), mk_lane__2_lane_(Jnn, c)))*{c <- `c*`} -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M)), v_1)) + -- (if ($proj_lane__2(Jnn, c_1) =/= ?()))*{c_1 <- `c_1*`} -- if (c*{c <- `c*`} = $f_($lsizenn($lanetype_Jnn(Jnn)), sx, !($proj_lane__2(Jnn, c_1)), i)*{c_1 <- `c_1*`}) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec @@ -9069,6 +9106,7 @@ def $ivbitmaskop_(shape : shape, vec_ : vec_) : u32 -- wf_uN: `%%`(128, v_1) -- wf_uN: `%%`(32, c) -- wf_shape: `%`(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M))) + -- (if ($proj_lane__2(Jnn, c_1) =/= ?()))*{c_1 <- `c_1*`} -- (wf_bit: `%`(`%`_bit($ilt_($lsizenn($lanetype_Jnn(Jnn)), S_sx, !($proj_lane__2(Jnn, c_1)), `%`_iN(0))!`%`_uN.0)))*{c_1 <- `c_1*`} -- wf_bit: `%`(`%`_bit(0)) -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M)), v_1)) @@ -9086,6 +9124,8 @@ def $ivswizzlop_(shape : shape, def $f_(N : N, iN*, iN : iN) : iN, vec_ : vec_, -- (wf_lane_: `%%`($lanetype(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M))), mk_lane__2_lane_(Jnn, c)))*{c <- `c*`} -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M)), v_1)) -- if (c_2*{c_2 <- `c_2*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M)), v_2)) + -- (if ($proj_lane__2(Jnn, c_1) =/= ?()))*{c_1 <- `c_1*`}*{c_2 <- `c_2*`} + -- (if ($proj_lane__2(Jnn, c_2) =/= ?()))*{c_2 <- `c_2*`} -- if (c*{c <- `c*`} = $f_($lsizenn($lanetype_Jnn(Jnn)), !($proj_lane__2(Jnn, c_1))*{c_1 <- `c_1*`}, !($proj_lane__2(Jnn, c_2)))*{c_2 <- `c_2*`}) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec @@ -9101,6 +9141,7 @@ def $ivshufflop_(shape : shape, laneidx*, vec_ : vec_, vec_ : vec_) : vec_ -- wf_shape: `%`(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M))) -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M)), v_1)) -- if (c_2*{c_2 <- `c_2*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M)), v_2)) + -- (if (i!`%`_uN.0 < |c_1*{c_1 <- `c_1*`} ++ c_2*{c_2 <- `c_2*`}|))*{i <- `i*`} -- if (c*{c <- `c*`} = c_1*{c_1 <- `c_1*`} ++ c_2*{c_2 <- `c_2*`}[i!`%`_uN.0]*{i <- `i*`}) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec @@ -9420,6 +9461,7 @@ def $vcvtop__(shape_1 : shape, shape_2 : shape, vcvtop__ : vcvtop__, vec_ : vec_ -- if (($halfop(`%X%`_shape(Lnn_1, `%`_dim(M)), `%X%`_shape(Lnn_2, `%`_dim(M)), vcvtop) = ?()) /\ ($zeroop(`%X%`_shape(Lnn_1, `%`_dim(M)), `%X%`_shape(Lnn_2, `%`_dim(M)), vcvtop) = ?())) -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape(Lnn_1, `%`_dim(M)), v_1)) -- if (c*{c <- `c*`}*{`c*` <- `c**`} = $setproduct_(syntax lane_, $lcvtop__(`%X%`_shape(Lnn_1, `%`_dim(M)), `%X%`_shape(Lnn_2, `%`_dim(M)), vcvtop, c_1)*{c_1 <- `c_1*`})) + -- if (|$inv_lanes_(`%X%`_shape(Lnn_2, `%`_dim(M)), c*{c <- `c*`})*{`c*` <- `c**`}| > 0) -- if (v <- $inv_lanes_(`%X%`_shape(Lnn_2, `%`_dim(M)), c*{c <- `c*`})*{`c*` <- `c**`}) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec def $vcvtop__{Lnn_1 : lanetype, M_1 : nat, Lnn_2 : lanetype, M_2 : nat, vcvtop : vcvtop__, v_1 : uN, v : uN, half : half, `c_1*` : lane_*, `c**` : lane_**}(`%X%`_shape(Lnn_1, `%`_dim(M_1)), `%X%`_shape(Lnn_2, `%`_dim(M_2)), vcvtop, v_1) = v @@ -9433,6 +9475,7 @@ def $vcvtop__(shape_1 : shape, shape_2 : shape, vcvtop__ : vcvtop__, vec_ : vec_ -- if ($halfop(`%X%`_shape(Lnn_1, `%`_dim(M_1)), `%X%`_shape(Lnn_2, `%`_dim(M_2)), vcvtop) = ?(half)) -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape(Lnn_1, `%`_dim(M_1)), v_1)[$half(half, 0, M_2) : M_2]) -- if (c*{c <- `c*`}*{`c*` <- `c**`} = $setproduct_(syntax lane_, $lcvtop__(`%X%`_shape(Lnn_1, `%`_dim(M_1)), `%X%`_shape(Lnn_2, `%`_dim(M_2)), vcvtop, c_1)*{c_1 <- `c_1*`})) + -- if (|$inv_lanes_(`%X%`_shape(Lnn_2, `%`_dim(M_2)), c*{c <- `c*`})*{`c*` <- `c**`}| > 0) -- if (v <- $inv_lanes_(`%X%`_shape(Lnn_2, `%`_dim(M_2)), c*{c <- `c*`})*{`c*` <- `c**`}) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec def $vcvtop__{Lnn_1 : lanetype, M_1 : nat, Lnn_2 : lanetype, M_2 : nat, vcvtop : vcvtop__, v_1 : uN, v : uN, `c_1*` : lane_*, `c**` : lane_**}(`%X%`_shape(Lnn_1, `%`_dim(M_1)), `%X%`_shape(Lnn_2, `%`_dim(M_2)), vcvtop, v_1) = v @@ -9446,6 +9489,7 @@ def $vcvtop__(shape_1 : shape, shape_2 : shape, vcvtop__ : vcvtop__, vec_ : vec_ -- if ($zeroop(`%X%`_shape(Lnn_1, `%`_dim(M_1)), `%X%`_shape(Lnn_2, `%`_dim(M_2)), vcvtop) = ?(ZERO_zero)) -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape(Lnn_1, `%`_dim(M_1)), v_1)) -- if (c*{c <- `c*`}*{`c*` <- `c**`} = $setproduct_(syntax lane_, $lcvtop__(`%X%`_shape(Lnn_1, `%`_dim(M_1)), `%X%`_shape(Lnn_2, `%`_dim(M_2)), vcvtop, c_1)*{c_1 <- `c_1*`} ++ [$zero(Lnn_2)]^M_1{})) + -- if (|$inv_lanes_(`%X%`_shape(Lnn_2, `%`_dim(M_2)), c*{c <- `c*`})*{`c*` <- `c**`}| > 0) -- if (v <- $inv_lanes_(`%X%`_shape(Lnn_2, `%`_dim(M_2)), c*{c <- `c*`})*{`c*` <- `c**`}) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec @@ -9505,7 +9549,9 @@ def $vnarrowop__(shape_1 : shape, shape_2 : shape, sx : sx, vec_ : vec_, vec_ : -- (wf_lane_: `%%`($lanetype(`%X%`_shape($lanetype_Jnn(Jnn_2), `%`_dim(M_2))), mk_lane__2_lane_(Jnn_2, c'_2)))*{c'_2 <- `c'_2*`} -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn_1), `%`_dim(M_1)), v_1)) -- if (c_2*{c_2 <- `c_2*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn_1), `%`_dim(M_1)), v_2)) + -- (if ($proj_lane__2(Jnn_1, c_1) =/= ?()))*{c_1 <- `c_1*`} -- if (c'_1*{c'_1 <- `c'_1*`} = $narrow__($lsize($lanetype_Jnn(Jnn_1)), $lsize($lanetype_Jnn(Jnn_2)), sx, !($proj_lane__2(Jnn_1, c_1)))*{c_1 <- `c_1*`}) + -- (if ($proj_lane__2(Jnn_1, c_2) =/= ?()))*{c_2 <- `c_2*`} -- if (c'_2*{c'_2 <- `c'_2*`} = $narrow__($lsize($lanetype_Jnn(Jnn_1)), $lsize($lanetype_Jnn(Jnn_2)), sx, !($proj_lane__2(Jnn_1, c_2)))*{c_2 <- `c_2*`}) -- if (v = $inv_lanes_(`%X%`_shape($lanetype_Jnn(Jnn_2), `%`_dim(M_2)), mk_lane__2_lane_(Jnn_2, c'_1)*{c'_1 <- `c'_1*`} ++ mk_lane__2_lane_(Jnn_2, c'_2)*{c'_2 <- `c'_2*`})) @@ -9529,6 +9575,7 @@ def $ivextunop__(shape_1 : shape, shape_2 : shape, def $f_(N : N, iN*) : iN*, sx -- (wf_lane_: `%%`($lanetype(`%X%`_shape($lanetype_Jnn(Jnn_2), `%`_dim(M_2))), mk_lane__2_lane_(Jnn_2, c)))*{c <- `c*`} -- wf_shape: `%`(`%X%`_shape($lanetype_Jnn(Jnn_1), `%`_dim(M_1))) -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn_1), `%`_dim(M_1)), v_1)) + -- (if ($proj_lane__2(Jnn_1, c_1) =/= ?()))*{c_1 <- `c_1*`} -- if (c'_1*{c'_1 <- `c'_1*`} = $extend__($lsizenn1($lanetype_Jnn(Jnn_1)), $lsizenn2($lanetype_Jnn(Jnn_2)), sx, !($proj_lane__2(Jnn_1, c_1)))*{c_1 <- `c_1*`}) -- if (c*{c <- `c*`} = $f_($lsizenn2($lanetype_Jnn(Jnn_2)), c'_1*{c'_1 <- `c'_1*`})) @@ -9577,7 +9624,9 @@ def $ivextbinop__(shape_1 : shape, shape_2 : shape, def $f_(N : N, iN*, iN*) : i -- wf_shape: `%`(`%X%`_shape($lanetype_Jnn(Jnn_1), `%`_dim(M_1))) -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn_1), `%`_dim(M_1)), v_1)[i!`%`_uN.0 : k!`%`_uN.0]) -- if (c_2*{c_2 <- `c_2*`} = $lanes_(`%X%`_shape($lanetype_Jnn(Jnn_1), `%`_dim(M_1)), v_2)[i!`%`_uN.0 : k!`%`_uN.0]) + -- (if ($proj_lane__2(Jnn_1, c_1) =/= ?()))*{c_1 <- `c_1*`} -- if (c'_1*{c'_1 <- `c'_1*`} = $extend__($lsizenn1($lanetype_Jnn(Jnn_1)), $lsizenn2($lanetype_Jnn(Jnn_2)), sx_1, !($proj_lane__2(Jnn_1, c_1)))*{c_1 <- `c_1*`}) + -- (if ($proj_lane__2(Jnn_1, c_2) =/= ?()))*{c_2 <- `c_2*`} -- if (c'_2*{c'_2 <- `c'_2*`} = $extend__($lsizenn1($lanetype_Jnn(Jnn_1)), $lsizenn2($lanetype_Jnn(Jnn_2)), sx_2, !($proj_lane__2(Jnn_1, c_2)))*{c_2 <- `c_2*`}) -- if (c*{c <- `c*`} = $f_($lsizenn2($lanetype_Jnn(Jnn_2)), c'_1*{c'_1 <- `c'_1*`}, c'_2*{c'_2 <- `c'_2*`})) @@ -9636,6 +9685,7 @@ def $vextternop__(ishape_1 : ishape, ishape_2 : ishape, vextternop__ : vextterno -- if (M = (2 * M_2)) -- if (c' = $vextbinop__(`%`_ishape(`%X%`_shape($lanetype_Jnn(Jnn_1), `%`_dim(M_1))), `%`_ishape(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M))), mk_vextbinop___0_vextbinop__(Jnn_1, M_1, Jnn, M, `RELAXED_DOTS`_vextbinop__Jnn_1_M_1_Jnn_2_M_2), c_1, c_2)) -- if (c'' = $vextunop__(`%`_ishape(`%X%`_shape($lanetype_Jnn(Jnn), `%`_dim(M))), `%`_ishape(`%X%`_shape($lanetype_Jnn(Jnn_2), `%`_dim(M_2))), mk_vextunop___0_vextunop__(Jnn, M, Jnn_2, M_2, EXTADD_PAIRWISE_vextunop__Jnn_1_M_1_Jnn_2_M_2(S_sx)), c')) + -- if (|$vbinop_(`%X%`_shape($lanetype_Jnn(Jnn_2), `%`_dim(M_2)), mk_vbinop__0_vbinop_(Jnn_2, M_2, ADD_vbinop_Jnn_M), c'', c_3)| > 0) -- if (c <- $vbinop_(`%X%`_shape($lanetype_Jnn(Jnn_2), `%`_dim(M_2)), mk_vbinop__0_vbinop_(Jnn_2, M_2, ADD_vbinop_Jnn_M), c'', c_3)) ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec @@ -10271,6 +10321,7 @@ def $exninst(state : state) : exninst* def $type(state : state, typeidx : typeidx) : deftype ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $type{s : store, f : frame, x : uN}(`%;%`_state(s, f), x) = f.MODULE_frame.TYPES_moduleinst[x!`%`_uN.0] + -- if (x!`%`_uN.0 < |f.MODULE_frame.TYPES_moduleinst|) -- wf_store: `%`(s) -- wf_frame: `%`(f) -- wf_uN: `%%`(32, x) @@ -10279,6 +10330,8 @@ def $type(state : state, typeidx : typeidx) : deftype def $tag(state : state, tagidx : tagidx) : taginst ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $tag{s : store, f : frame, x : uN}(`%;%`_state(s, f), x) = s.TAGS_store[f.MODULE_frame.TAGS_moduleinst[x!`%`_uN.0]] + -- if (f.MODULE_frame.TAGS_moduleinst[x!`%`_uN.0] < |s.TAGS_store|) + -- if (x!`%`_uN.0 < |f.MODULE_frame.TAGS_moduleinst|) -- wf_store: `%`(s) -- wf_frame: `%`(f) -- wf_uN: `%%`(32, x) @@ -10287,6 +10340,8 @@ def $tag(state : state, tagidx : tagidx) : taginst def $global(state : state, globalidx : globalidx) : globalinst ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $global{s : store, f : frame, x : uN}(`%;%`_state(s, f), x) = s.GLOBALS_store[f.MODULE_frame.GLOBALS_moduleinst[x!`%`_uN.0]] + -- if (f.MODULE_frame.GLOBALS_moduleinst[x!`%`_uN.0] < |s.GLOBALS_store|) + -- if (x!`%`_uN.0 < |f.MODULE_frame.GLOBALS_moduleinst|) -- wf_store: `%`(s) -- wf_frame: `%`(f) -- wf_uN: `%%`(32, x) @@ -10295,6 +10350,8 @@ def $global(state : state, globalidx : globalidx) : globalinst def $mem(state : state, memidx : memidx) : meminst ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $mem{s : store, f : frame, x : uN}(`%;%`_state(s, f), x) = s.MEMS_store[f.MODULE_frame.MEMS_moduleinst[x!`%`_uN.0]] + -- if (f.MODULE_frame.MEMS_moduleinst[x!`%`_uN.0] < |s.MEMS_store|) + -- if (x!`%`_uN.0 < |f.MODULE_frame.MEMS_moduleinst|) -- wf_store: `%`(s) -- wf_frame: `%`(f) -- wf_uN: `%%`(32, x) @@ -10303,6 +10360,8 @@ def $mem(state : state, memidx : memidx) : meminst def $table(state : state, tableidx : tableidx) : tableinst ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $table{s : store, f : frame, x : uN}(`%;%`_state(s, f), x) = s.TABLES_store[f.MODULE_frame.TABLES_moduleinst[x!`%`_uN.0]] + -- if (f.MODULE_frame.TABLES_moduleinst[x!`%`_uN.0] < |s.TABLES_store|) + -- if (x!`%`_uN.0 < |f.MODULE_frame.TABLES_moduleinst|) -- wf_store: `%`(s) -- wf_frame: `%`(f) -- wf_uN: `%%`(32, x) @@ -10311,6 +10370,8 @@ def $table(state : state, tableidx : tableidx) : tableinst def $func(state : state, funcidx : funcidx) : funcinst ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $func{s : store, f : frame, x : uN}(`%;%`_state(s, f), x) = s.FUNCS_store[f.MODULE_frame.FUNCS_moduleinst[x!`%`_uN.0]] + -- if (f.MODULE_frame.FUNCS_moduleinst[x!`%`_uN.0] < |s.FUNCS_store|) + -- if (x!`%`_uN.0 < |f.MODULE_frame.FUNCS_moduleinst|) -- wf_store: `%`(s) -- wf_frame: `%`(f) -- wf_uN: `%%`(32, x) @@ -10319,6 +10380,8 @@ def $func(state : state, funcidx : funcidx) : funcinst def $data(state : state, dataidx : dataidx) : datainst ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $data{s : store, f : frame, x : uN}(`%;%`_state(s, f), x) = s.DATAS_store[f.MODULE_frame.DATAS_moduleinst[x!`%`_uN.0]] + -- if (f.MODULE_frame.DATAS_moduleinst[x!`%`_uN.0] < |s.DATAS_store|) + -- if (x!`%`_uN.0 < |f.MODULE_frame.DATAS_moduleinst|) -- wf_store: `%`(s) -- wf_frame: `%`(f) -- wf_uN: `%%`(32, x) @@ -10327,6 +10390,8 @@ def $data(state : state, dataidx : dataidx) : datainst def $elem(state : state, tableidx : tableidx) : eleminst ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $elem{s : store, f : frame, x : uN}(`%;%`_state(s, f), x) = s.ELEMS_store[f.MODULE_frame.ELEMS_moduleinst[x!`%`_uN.0]] + -- if (f.MODULE_frame.ELEMS_moduleinst[x!`%`_uN.0] < |s.ELEMS_store|) + -- if (x!`%`_uN.0 < |f.MODULE_frame.ELEMS_moduleinst|) -- wf_store: `%`(s) -- wf_frame: `%`(f) -- wf_uN: `%%`(32, x) @@ -10335,6 +10400,7 @@ def $elem(state : state, tableidx : tableidx) : eleminst def $local(state : state, localidx : localidx) : val? ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $local{s : store, f : frame, x : uN}(`%;%`_state(s, f), x) = f.LOCALS_frame[x!`%`_uN.0] + -- if (x!`%`_uN.0 < |f.LOCALS_frame|) -- wf_store: `%`(s) -- wf_frame: `%`(f) -- wf_uN: `%%`(32, x) @@ -10349,42 +10415,49 @@ def $with_local(state : state, localidx : localidx, val : val) : state def $with_global(state : state, globalidx : globalidx, val : val) : state ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $with_global{s : store, f : frame, x : uN, v : val}(`%;%`_state(s, f), x, v) = `%;%`_state(s[GLOBALS_store[f.MODULE_frame.GLOBALS_moduleinst[x!`%`_uN.0]].VALUE_globalinst = v], f) + -- if (x!`%`_uN.0 < |f.MODULE_frame.GLOBALS_moduleinst|) -- wf_state: `%`(`%;%`_state(s[GLOBALS_store[f.MODULE_frame.GLOBALS_moduleinst[x!`%`_uN.0]].VALUE_globalinst = v], f)) ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $with_table(state : state, tableidx : tableidx, nat : nat, ref : ref) : state ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $with_table{s : store, f : frame, x : uN, i : nat, r : ref}(`%;%`_state(s, f), x, i, r) = `%;%`_state(s[TABLES_store[f.MODULE_frame.TABLES_moduleinst[x!`%`_uN.0]].REFS_tableinst[i] = r], f) + -- if (x!`%`_uN.0 < |f.MODULE_frame.TABLES_moduleinst|) -- wf_state: `%`(`%;%`_state(s[TABLES_store[f.MODULE_frame.TABLES_moduleinst[x!`%`_uN.0]].REFS_tableinst[i] = r], f)) ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $with_tableinst(state : state, tableidx : tableidx, tableinst : tableinst) : state ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $with_tableinst{s : store, f : frame, x : uN, ti : tableinst}(`%;%`_state(s, f), x, ti) = `%;%`_state(s[TABLES_store[f.MODULE_frame.TABLES_moduleinst[x!`%`_uN.0]] = ti], f) + -- if (x!`%`_uN.0 < |f.MODULE_frame.TABLES_moduleinst|) -- wf_state: `%`(`%;%`_state(s[TABLES_store[f.MODULE_frame.TABLES_moduleinst[x!`%`_uN.0]] = ti], f)) ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $with_mem(state : state, memidx : memidx, nat : nat, nat : nat, byte*) : state ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $with_mem{s : store, f : frame, x : uN, i : nat, j : nat, `b*` : byte*}(`%;%`_state(s, f), x, i, j, b*{b <- `b*`}) = `%;%`_state(s[MEMS_store[f.MODULE_frame.MEMS_moduleinst[x!`%`_uN.0]].BYTES_meminst[i : j] = b*{b <- `b*`}], f) + -- if (x!`%`_uN.0 < |f.MODULE_frame.MEMS_moduleinst|) -- wf_state: `%`(`%;%`_state(s[MEMS_store[f.MODULE_frame.MEMS_moduleinst[x!`%`_uN.0]].BYTES_meminst[i : j] = b*{b <- `b*`}], f)) ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $with_meminst(state : state, memidx : memidx, meminst : meminst) : state ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $with_meminst{s : store, f : frame, x : uN, mi : meminst}(`%;%`_state(s, f), x, mi) = `%;%`_state(s[MEMS_store[f.MODULE_frame.MEMS_moduleinst[x!`%`_uN.0]] = mi], f) + -- if (x!`%`_uN.0 < |f.MODULE_frame.MEMS_moduleinst|) -- wf_state: `%`(`%;%`_state(s[MEMS_store[f.MODULE_frame.MEMS_moduleinst[x!`%`_uN.0]] = mi], f)) ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $with_elem(state : state, elemidx : elemidx, ref*) : state ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $with_elem{s : store, f : frame, x : uN, `r*` : ref*}(`%;%`_state(s, f), x, r*{r <- `r*`}) = `%;%`_state(s[ELEMS_store[f.MODULE_frame.ELEMS_moduleinst[x!`%`_uN.0]].REFS_eleminst = r*{r <- `r*`}], f) + -- if (x!`%`_uN.0 < |f.MODULE_frame.ELEMS_moduleinst|) -- wf_state: `%`(`%;%`_state(s[ELEMS_store[f.MODULE_frame.ELEMS_moduleinst[x!`%`_uN.0]].REFS_eleminst = r*{r <- `r*`}], f)) ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $with_data(state : state, dataidx : dataidx, byte*) : state ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec def $with_data{s : store, f : frame, x : uN, `b*` : byte*}(`%;%`_state(s, f), x, b*{b <- `b*`}) = `%;%`_state(s[DATAS_store[f.MODULE_frame.DATAS_moduleinst[x!`%`_uN.0]].BYTES_datainst = b*{b <- `b*`}], f) + -- if (x!`%`_uN.0 < |f.MODULE_frame.DATAS_moduleinst|) -- wf_state: `%`(`%;%`_state(s[DATAS_store[f.MODULE_frame.DATAS_moduleinst[x!`%`_uN.0]].BYTES_datainst = b*{b <- `b*`}], f)) ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec @@ -13427,18 +13500,23 @@ def $allocelems(store : store, elemtype*, ref**) : (store, elemaddr*) def $allocexport(moduleinst : moduleinst, export : export) : exportinst ;; ../../../../specification/wasm-3.0/4.4-execution.modules.spectec def $allocexport{moduleinst : moduleinst, name : name, x : uN}(moduleinst, EXPORT_export(name, TAG_externidx(x))) = {NAME name, ADDR TAG_externaddr(moduleinst.TAGS_moduleinst[x!`%`_uN.0])} + -- if (x!`%`_uN.0 < |moduleinst.TAGS_moduleinst|) -- wf_exportinst: `%`({NAME name, ADDR TAG_externaddr(moduleinst.TAGS_moduleinst[x!`%`_uN.0])}) ;; ../../../../specification/wasm-3.0/4.4-execution.modules.spectec def $allocexport{moduleinst : moduleinst, name : name, x : uN}(moduleinst, EXPORT_export(name, GLOBAL_externidx(x))) = {NAME name, ADDR GLOBAL_externaddr(moduleinst.GLOBALS_moduleinst[x!`%`_uN.0])} + -- if (x!`%`_uN.0 < |moduleinst.GLOBALS_moduleinst|) -- wf_exportinst: `%`({NAME name, ADDR GLOBAL_externaddr(moduleinst.GLOBALS_moduleinst[x!`%`_uN.0])}) ;; ../../../../specification/wasm-3.0/4.4-execution.modules.spectec def $allocexport{moduleinst : moduleinst, name : name, x : uN}(moduleinst, EXPORT_export(name, MEM_externidx(x))) = {NAME name, ADDR MEM_externaddr(moduleinst.MEMS_moduleinst[x!`%`_uN.0])} + -- if (x!`%`_uN.0 < |moduleinst.MEMS_moduleinst|) -- wf_exportinst: `%`({NAME name, ADDR MEM_externaddr(moduleinst.MEMS_moduleinst[x!`%`_uN.0])}) ;; ../../../../specification/wasm-3.0/4.4-execution.modules.spectec def $allocexport{moduleinst : moduleinst, name : name, x : uN}(moduleinst, EXPORT_export(name, TABLE_externidx(x))) = {NAME name, ADDR TABLE_externaddr(moduleinst.TABLES_moduleinst[x!`%`_uN.0])} + -- if (x!`%`_uN.0 < |moduleinst.TABLES_moduleinst|) -- wf_exportinst: `%`({NAME name, ADDR TABLE_externaddr(moduleinst.TABLES_moduleinst[x!`%`_uN.0])}) ;; ../../../../specification/wasm-3.0/4.4-execution.modules.spectec def $allocexport{moduleinst : moduleinst, name : name, x : uN}(moduleinst, EXPORT_export(name, FUNC_externidx(x))) = {NAME name, ADDR FUNC_externaddr(moduleinst.FUNCS_moduleinst[x!`%`_uN.0])} + -- if (x!`%`_uN.0 < |moduleinst.FUNCS_moduleinst|) -- wf_exportinst: `%`({NAME name, ADDR FUNC_externaddr(moduleinst.FUNCS_moduleinst[x!`%`_uN.0])}) ;; ../../../../specification/wasm-3.0/4.4-execution.modules.spectec @@ -13467,11 +13545,18 @@ def $allocmodule(store : store, module : module, externaddr*, val*, ref*, ref**) -- wf_store: `%`(s_6) -- wf_module: `%`(MODULE_module(type*{type <- `type*`}, import*{import <- `import*`}, tag*{tag <- `tag*`}, global*{global <- `global*`}, mem*{mem <- `mem*`}, table*{table <- `table*`}, func*{func <- `func*`}, data*{data <- `data*`}, elem*{elem <- `elem*`}, start?{start <- `start?`}, export*{export <- `export*`})) -- (wf_tag: `%`(TAG_tag(tagtype)))*{tagtype <- `tagtype*`} + -- if (|`expr_G*`| = |`globaltype*`|) -- (wf_global: `%`(GLOBAL_global(globaltype, expr_G)))*{expr_G <- `expr_G*`, globaltype <- `globaltype*`} -- (wf_mem: `%`(MEMORY_mem(memtype)))*{memtype <- `memtype*`} + -- if (|`expr_T*`| = |`tabletype*`|) -- (wf_table: `%`(TABLE_table(tabletype, expr_T)))*{expr_T <- `expr_T*`, tabletype <- `tabletype*`} + -- if (|`expr_F*`| = |`local**`|) + -- if (|`expr_F*`| = |`x*`|) -- (wf_func: `%`(FUNC_func(x, local*{local <- `local*`}, expr_F)))*{expr_F <- `expr_F*`, `local*` <- `local**`, x <- `x*`} + -- if (|`byte**`| = |`datamode*`|) -- (wf_data: `%`(DATA_data(byte*{byte <- `byte*`}, datamode)))*{`byte*` <- `byte**`, datamode <- `datamode*`} + -- if (|`elemmode*`| = |`elemtype*`|) + -- if (|`elemmode*`| = |`expr_E**`|) -- (wf_elem: `%`(ELEM_elem(elemtype, expr_E*{expr_E <- `expr_E*`}, elemmode)))*{elemmode <- `elemmode*`, elemtype <- `elemtype*`, `expr_E*` <- `expr_E**`} -- wf_moduleinst: `%`({TYPES [], TAGS aa_I*{aa_I <- `aa_I*`} ++ aa*{aa <- `aa*`}, GLOBALS ga_I*{ga_I <- `ga_I*`} ++ ga*{ga <- `ga*`}, MEMS ma_I*{ma_I <- `ma_I*`} ++ ma*{ma <- `ma*`}, TABLES ta_I*{ta_I <- `ta_I*`} ++ ta*{ta <- `ta*`}, FUNCS fa_I*{fa_I <- `fa_I*`} ++ fa*{fa <- `fa*`}, DATAS [], ELEMS [], EXPORTS []}) -- wf_moduleinst: `%`({TYPES dt*{dt <- `dt*`}, TAGS aa_I*{aa_I <- `aa_I*`} ++ aa*{aa <- `aa*`}, GLOBALS ga_I*{ga_I <- `ga_I*`} ++ ga*{ga <- `ga*`}, MEMS ma_I*{ma_I <- `ma_I*`} ++ ma*{ma <- `ma*`}, TABLES ta_I*{ta_I <- `ta_I*`} ++ ta*{ta <- `ta*`}, FUNCS fa_I*{fa_I <- `fa_I*`} ++ fa*{fa <- `fa*`}, DATAS da*{da <- `da*`}, ELEMS ea*{ea <- `ea*`}, EXPORTS xi*{xi <- `xi*`}}) @@ -13496,6 +13581,7 @@ def $allocmodule(store : store, module : module, externaddr*, val*, ref*, ref**) -- if ((s_4, ta*{ta <- `ta*`}) = $alloctables(s_3, $subst_all_tabletype(tabletype, $typeuse_deftype(dt)*{dt <- `dt*`})*{tabletype <- `tabletype*`}, ref_T*{ref_T <- `ref_T*`})) -- if ((s_5, da*{da <- `da*`}) = $allocdatas(s_4, OK_datatype^|data*{data <- `data*`}|{}, byte*{byte <- `byte*`}*{`byte*` <- `byte**`})) -- if ((s_6, ea*{ea <- `ea*`}) = $allocelems(s_5, $subst_all_reftype(elemtype, $typeuse_deftype(dt)*{dt <- `dt*`})*{elemtype <- `elemtype*`}, ref_E*{ref_E <- `ref_E*`}*{`ref_E*` <- `ref_E**`})) + -- (if (x!`%`_uN.0 < |dt*{dt <- `dt*`}|))*{x <- `x*`} -- if ((s_7, fa*{fa <- `fa*`}) = $allocfuncs(s_6, dt*{dt <- `dt*`}[x!`%`_uN.0]*{x <- `x*`}, FUNC_funccode(x, local*{local <- `local*`}, expr_F)*{expr_F <- `expr_F*`, `local*` <- `local**`, x <- `x*`}, moduleinst^|func*{func <- `func*`}|{})) -- if (xi*{xi <- `xi*`} = $allocexports({TYPES [], TAGS aa_I*{aa_I <- `aa_I*`} ++ aa*{aa <- `aa*`}, GLOBALS ga_I*{ga_I <- `ga_I*`} ++ ga*{ga <- `ga*`}, MEMS ma_I*{ma_I <- `ma_I*`} ++ ma*{ma <- `ma*`}, TABLES ta_I*{ta_I <- `ta_I*`} ++ ta*{ta <- `ta*`}, FUNCS fa_I*{fa_I <- `fa_I*`} ++ fa*{fa <- `fa*`}, DATAS [], ELEMS [], EXPORTS []}, export*{export <- `export*`})) -- if (moduleinst = {TYPES dt*{dt <- `dt*`}, TAGS aa_I*{aa_I <- `aa_I*`} ++ aa*{aa <- `aa*`}, GLOBALS ga_I*{ga_I <- `ga_I*`} ++ ga*{ga <- `ga*`}, MEMS ma_I*{ma_I <- `ma_I*`} ++ ma*{ma <- `ma*`}, TABLES ta_I*{ta_I <- `ta_I*`} ++ ta*{ta <- `ta*`}, FUNCS fa_I*{fa_I <- `fa_I*`} ++ fa*{fa <- `fa*`}, DATAS da*{da <- `da*`}, ELEMS ea*{ea <- `ea*`}, EXPORTS xi*{xi <- `xi*`}}) @@ -13576,9 +13662,14 @@ def $instantiate(store : store, module : module, externaddr*) : config -- wf_config: `%`(`%;%`_config(`%;%`_state(s', {LOCALS [], MODULE moduleinst}), instr_E*{instr_E <- `instr_E*`} ++ instr_D*{instr_D <- `instr_D*`} ++ lift(instr_S?{instr_S <- `instr_S?`}))) -- wf_moduletype: `%`(`%->%`_moduletype(xt_I*{xt_I <- `xt_I*`}, xt_E*{xt_E <- `xt_E*`})) -- wf_module: `%`(MODULE_module(type*{type <- `type*`}, import*{import <- `import*`}, tag*{tag <- `tag*`}, global*{global <- `global*`}, mem*{mem <- `mem*`}, table*{table <- `table*`}, func*{func <- `func*`}, data*{data <- `data*`}, elem*{elem <- `elem*`}, start?{start <- `start?`}, export*{export <- `export*`})) + -- if (|`expr_G*`| = |`globaltype*`|) -- (wf_global: `%`(GLOBAL_global(globaltype, expr_G)))*{expr_G <- `expr_G*`, globaltype <- `globaltype*`} + -- if (|`expr_T*`| = |`tabletype*`|) -- (wf_table: `%`(TABLE_table(tabletype, expr_T)))*{expr_T <- `expr_T*`, tabletype <- `tabletype*`} + -- if (|`byte**`| = |`datamode*`|) -- (wf_data: `%`(DATA_data(byte*{byte <- `byte*`}, datamode)))*{`byte*` <- `byte**`, datamode <- `datamode*`} + -- if (|`elemmode*`| = |`expr_E**`|) + -- if (|`elemmode*`| = |`reftype*`|) -- (wf_elem: `%`(ELEM_elem(reftype, expr_E*{expr_E <- `expr_E*`}, elemmode)))*{elemmode <- `elemmode*`, `expr_E*` <- `expr_E**`, reftype <- `reftype*`} -- (wf_start: `%`(START_start(x)))?{x <- `x?`} -- wf_moduleinst: `%`({TYPES $alloctypes(type*{type <- `type*`}), TAGS [], GLOBALS $globalsxa(externaddr*{externaddr <- `externaddr*`}), MEMS [], TABLES [], FUNCS $funcsxa(externaddr*{externaddr <- `externaddr*`}) ++ (|s.FUNCS_store| + i_F)^(i_F<|func*{func <- `func*`}|){i_F <- `i_F*`}, DATAS [], ELEMS [], EXPORTS []}) @@ -13587,6 +13678,7 @@ def $instantiate(store : store, module : module, externaddr*) : config -- (wf_uN: `%%`(32, `%`_uN(i_E)))^(i_E<|elem*{elem <- `elem*`}|){i_E <- `i_E*`} -- (wf_instr: `%`(CALL_instr(x)))?{x <- `x?`} -- Module_ok: `|-%:%`(module, `%->%`_moduletype(xt_I*{xt_I <- `xt_I*`}, xt_E*{xt_E <- `xt_E*`})) + -- if (|`externaddr*`| = |`xt_I*`|) -- (Externaddr_ok: `%|-%:%`(s, externaddr, xt_I))*{externaddr <- `externaddr*`, xt_I <- `xt_I*`} -- if (module = MODULE_module(type*{type <- `type*`}, import*{import <- `import*`}, tag*{tag <- `tag*`}, global*{global <- `global*`}, mem*{mem <- `mem*`}, table*{table <- `table*`}, func*{func <- `func*`}, data*{data <- `data*`}, elem*{elem <- `elem*`}, start?{start <- `start?`}, export*{export <- `export*`})) -- if (global*{global <- `global*`} = GLOBAL_global(globaltype, expr_G)*{expr_G <- `expr_G*`, globaltype <- `globaltype*`}) @@ -13597,10 +13689,15 @@ def $instantiate(store : store, module : module, externaddr*) : config -- if (moduleinst_0 = {TYPES $alloctypes(type*{type <- `type*`}), TAGS [], GLOBALS $globalsxa(externaddr*{externaddr <- `externaddr*`}), MEMS [], TABLES [], FUNCS $funcsxa(externaddr*{externaddr <- `externaddr*`}) ++ (|s.FUNCS_store| + i_F)^(i_F<|func*{func <- `func*`}|){i_F <- `i_F*`}, DATAS [], ELEMS [], EXPORTS []}) -- if (z = `%;%`_state(s, {LOCALS [], MODULE moduleinst_0})) -- if ((z', val_G*{val_G <- `val_G*`}) = $evalglobals(z, globaltype*{globaltype <- `globaltype*`}, expr_G*{expr_G <- `expr_G*`})) + -- if (|`expr_T*`| = |`ref_T*`|) -- (Eval_expr: `%;%~>*%;%`(z', expr_T, z', [$val_ref(ref_T)]))*{expr_T <- `expr_T*`, ref_T <- `ref_T*`} + -- if (|`expr_E**`| = |`ref_E**`|) + -- (if (|`expr_E*`| = |`ref_E*`|))*{`expr_E*` <- `expr_E**`, `ref_E*` <- `ref_E**`} -- (Eval_expr: `%;%~>*%;%`(z', expr_E, z', [$val_ref(ref_E)]))*{expr_E <- `expr_E*`, ref_E <- `ref_E*`}*{`expr_E*` <- `expr_E**`, `ref_E*` <- `ref_E**`} -- if ((s', moduleinst) = $allocmodule(s, module, externaddr*{externaddr <- `externaddr*`}, val_G*{val_G <- `val_G*`}, ref_T*{ref_T <- `ref_T*`}, ref_E*{ref_E <- `ref_E*`}*{`ref_E*` <- `ref_E**`})) + -- (if (i_D < |data*{data <- `data*`}|))^(i_D<|data*{data <- `data*`}|){i_D <- `i_D*`} -- if (instr_D*{instr_D <- `instr_D*`} = $concat_(syntax instr, $rundata_(`%`_dataidx(i_D), data*{data <- `data*`}[i_D])^(i_D<|data*{data <- `data*`}|){i_D <- `i_D*`})) + -- (if (i_E < |elem*{elem <- `elem*`}|))^(i_E<|elem*{elem <- `elem*`}|){i_E <- `i_E*`} -- if (instr_E*{instr_E <- `instr_E*`} = $concat_(syntax instr, $runelem_(`%`_elemidx(i_E), elem*{elem <- `elem*`}[i_E])^(i_E<|elem*{elem <- `elem*`}|){i_E <- `i_E*`})) -- if (instr_S?{instr_S <- `instr_S?`} = CALL_instr(x)?{x <- `x?`}) @@ -13608,9 +13705,11 @@ def $instantiate(store : store, module : module, externaddr*) : config def $invoke(store : store, funcaddr : funcaddr, val*) : config ;; ../../../../specification/wasm-3.0/4.4-execution.modules.spectec def $invoke{s : store, funcaddr : nat, `val*` : val*, `t_1*` : valtype*, `t_2*` : valtype*}(s, funcaddr, val*{val <- `val*`}) = `%;%`_config(`%;%`_state(s, {LOCALS [], MODULE {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], EXPORTS []}}), $instr_val(val)*{val <- `val*`} ++ [REF.FUNC_ADDR_instr(funcaddr) CALL_REF_instr($typeuse_deftype(s.FUNCS_store[funcaddr].TYPE_funcinst))]) + -- if (funcaddr < |s.FUNCS_store|) -- wf_config: `%`(`%;%`_config(`%;%`_state(s, {LOCALS [], MODULE {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], EXPORTS []}}), $instr_val(val)*{val <- `val*`} ++ [REF.FUNC_ADDR_instr(funcaddr) CALL_REF_instr($typeuse_deftype(s.FUNCS_store[funcaddr].TYPE_funcinst))])) -- wf_comptype: `%`(`FUNC%->%`_comptype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`}))) -- Expand: `%~~%`(s.FUNCS_store[funcaddr].TYPE_funcinst, `FUNC%->%`_comptype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`}))) + -- if (|`t_1*`| = |`val*`|) -- (Val_ok: `%|-%:%`(s, val, t_1))*{t_1 <- `t_1*`, val <- `val*`} ;; ../../../../specification/wasm-3.0/5.1-binary.values.spectec From cbef9ddd34d67c94f08057bb3d8dc38e614bf35b Mon Sep 17 00:00:00 2001 From: Joachim Breitner Date: Fri, 14 Nov 2025 14:09:05 +0100 Subject: [PATCH 2/2] Update test output --- spectec/test-prose/TEST.md | 933 +++++++++++++++++++++++++------------ 1 file changed, 638 insertions(+), 295 deletions(-) diff --git a/spectec/test-prose/TEST.md b/spectec/test-prose/TEST.md index ba144b6071..accabf736c 100644 --- a/spectec/test-prose/TEST.md +++ b/spectec/test-prose/TEST.md @@ -2404,42 +2404,62 @@ The module :math:`(\mathsf{module}~{{\mathit{type}}^\ast}~{{\mathit{import}}^\as .................................... -1. Return :math:`f{.}\mathsf{module}{.}\mathsf{types}{}[x]`. +1. Assert: Due to validation, :math:`x < {|f{.}\mathsf{module}{.}\mathsf{types}|}`. + +#. Return :math:`f{.}\mathsf{module}{.}\mathsf{types}{}[x]`. :math:`(s, f){.}\mathsf{funcs}{}[x]` .................................... -1. Return :math:`s{.}\mathsf{funcs}{}[f{.}\mathsf{module}{.}\mathsf{funcs}{}[x]]`. +1. Assert: Due to validation, :math:`f{.}\mathsf{module}{.}\mathsf{funcs}{}[x] < {|s{.}\mathsf{funcs}|}`. + +#. Assert: Due to validation, :math:`x < {|f{.}\mathsf{module}{.}\mathsf{funcs}|}`. + +#. Return :math:`s{.}\mathsf{funcs}{}[f{.}\mathsf{module}{.}\mathsf{funcs}{}[x]]`. :math:`(s, f){.}\mathsf{globals}{}[x]` ...................................... -1. Return :math:`s{.}\mathsf{globals}{}[f{.}\mathsf{module}{.}\mathsf{globals}{}[x]]`. +1. Assert: Due to validation, :math:`f{.}\mathsf{module}{.}\mathsf{globals}{}[x] < {|s{.}\mathsf{globals}|}`. + +#. Assert: Due to validation, :math:`x < {|f{.}\mathsf{module}{.}\mathsf{globals}|}`. + +#. Return :math:`s{.}\mathsf{globals}{}[f{.}\mathsf{module}{.}\mathsf{globals}{}[x]]`. :math:`(s, f){.}\mathsf{tables}{}[x]` ..................................... -1. Return :math:`s{.}\mathsf{tables}{}[f{.}\mathsf{module}{.}\mathsf{tables}{}[x]]`. +1. Assert: Due to validation, :math:`f{.}\mathsf{module}{.}\mathsf{tables}{}[x] < {|s{.}\mathsf{tables}|}`. + +#. Assert: Due to validation, :math:`x < {|f{.}\mathsf{module}{.}\mathsf{tables}|}`. + +#. Return :math:`s{.}\mathsf{tables}{}[f{.}\mathsf{module}{.}\mathsf{tables}{}[x]]`. :math:`(s, f){.}\mathsf{mems}{}[x]` ................................... -1. Return :math:`s{.}\mathsf{mems}{}[f{.}\mathsf{module}{.}\mathsf{mems}{}[x]]`. +1. Assert: Due to validation, :math:`f{.}\mathsf{module}{.}\mathsf{mems}{}[x] < {|s{.}\mathsf{mems}|}`. + +#. Assert: Due to validation, :math:`x < {|f{.}\mathsf{module}{.}\mathsf{mems}|}`. + +#. Return :math:`s{.}\mathsf{mems}{}[f{.}\mathsf{module}{.}\mathsf{mems}{}[x]]`. :math:`(s, f){.}\mathsf{locals}{}[x]` ..................................... -1. Return :math:`f{.}\mathsf{locals}{}[x]`. +1. Assert: Due to validation, :math:`x < {|f{.}\mathsf{locals}|}`. + +#. Return :math:`f{.}\mathsf{locals}{}[x]`. :math:`(s, f){}[{.}\mathsf{locals}{}[x] = v]` @@ -2453,35 +2473,45 @@ The module :math:`(\mathsf{module}~{{\mathit{type}}^\ast}~{{\mathit{import}}^\as ............................................................... -1. Replace :math:`s{.}\mathsf{globals}{}[f{.}\mathsf{module}{.}\mathsf{globals}{}[x]]{.}\mathsf{value}` with :math:`v`. +1. Assert: Due to validation, :math:`x < {|f{.}\mathsf{module}{.}\mathsf{globals}|}`. + +#. Replace :math:`s{.}\mathsf{globals}{}[f{.}\mathsf{module}{.}\mathsf{globals}{}[x]]{.}\mathsf{value}` with :math:`v`. :math:`(s, f){}[{.}\mathsf{tables}{}[x]{.}\mathsf{refs}{}[i] = a]` .................................................................. -1. Replace :math:`s{.}\mathsf{tables}{}[f{.}\mathsf{module}{.}\mathsf{tables}{}[x]]{.}\mathsf{refs}{}[i]` with :math:`a`. +1. Assert: Due to validation, :math:`x < {|f{.}\mathsf{module}{.}\mathsf{tables}|}`. + +#. Replace :math:`s{.}\mathsf{tables}{}[f{.}\mathsf{module}{.}\mathsf{tables}{}[x]]{.}\mathsf{refs}{}[i]` with :math:`a`. :math:`(s, f){}[{.}\mathsf{tables}{}[x] = {\mathit{ti}}]` ......................................................... -1. Replace :math:`s{.}\mathsf{tables}{}[f{.}\mathsf{module}{.}\mathsf{tables}{}[x]]` with :math:`{\mathit{ti}}`. +1. Assert: Due to validation, :math:`x < {|f{.}\mathsf{module}{.}\mathsf{tables}|}`. + +#. Replace :math:`s{.}\mathsf{tables}{}[f{.}\mathsf{module}{.}\mathsf{tables}{}[x]]` with :math:`{\mathit{ti}}`. :math:`(s, f){}[{.}\mathsf{mems}{}[x]{.}\mathsf{bytes}{}[i : j] = {b^\ast}]` ............................................................................ -1. Replace :math:`s{.}\mathsf{mems}{}[f{.}\mathsf{module}{.}\mathsf{mems}{}[x]]{.}\mathsf{bytes}{}[i : j]` with :math:`{b^\ast}`. +1. Assert: Due to validation, :math:`x < {|f{.}\mathsf{module}{.}\mathsf{mems}|}`. + +#. Replace :math:`s{.}\mathsf{mems}{}[f{.}\mathsf{module}{.}\mathsf{mems}{}[x]]{.}\mathsf{bytes}{}[i : j]` with :math:`{b^\ast}`. :math:`(s, f){}[{.}\mathsf{mems}{}[x] = {\mathit{mi}}]` ....................................................... -1. Replace :math:`s{.}\mathsf{mems}{}[f{.}\mathsf{module}{.}\mathsf{mems}{}[x]]` with :math:`{\mathit{mi}}`. +1. Assert: Due to validation, :math:`x < {|f{.}\mathsf{module}{.}\mathsf{mems}|}`. + +#. Replace :math:`s{.}\mathsf{mems}{}[f{.}\mathsf{module}{.}\mathsf{mems}{}[x]]` with :math:`{\mathit{mi}}`. :math:`{\mathrm{growtable}}({\mathit{ti}}, n)` @@ -2608,6 +2638,8 @@ The module :math:`(\mathsf{module}~{{\mathit{type}}^\ast}~{{\mathit{import}}^\as 1. Let :math:`(\mathsf{func}~x~{{\mathit{local}}^\ast}~{\mathit{expr}})` be the destructuring of :math:`{\mathit{func}}`. +#. Assert: :math:`x < {|{\mathit{moduleinst}}{.}\mathsf{types}|}`. + #. Let :math:`{\mathit{fi}}` be the function instance :math:`\{ \mathsf{type}~{\mathit{moduleinst}}{.}\mathsf{types}{}[x],\;\allowbreak \mathsf{module}~{\mathit{moduleinst}},\;\allowbreak \mathsf{code}~{\mathit{func}} \}`. #. Let :math:`a` be the length of :math:`s{.}\mathsf{funcs}`. @@ -2740,24 +2772,32 @@ The module :math:`(\mathsf{module}~{{\mathit{type}}^\ast}~{{\mathit{import}}^\as a. Let :math:`(\mathsf{func}~x)` be the destructuring of :math:`{\mathit{externidx}}`. - #. Return :math:`\{ \mathsf{name}~{\mathit{name}},\;\allowbreak \mathsf{addr}~(\mathsf{func}~{{\mathit{fa}}^\ast}{}[x]) \}`. + #. If :math:`x < {|{{\mathit{fa}}^\ast}|}`, then: + + 1) Return :math:`\{ \mathsf{name}~{\mathit{name}},\;\allowbreak \mathsf{addr}~(\mathsf{func}~{{\mathit{fa}}^\ast}{}[x]) \}`. #. If :math:`{\mathit{externidx}}` is some :math:`\mathsf{global}~{\mathit{globalidx}}`, then: a. Let :math:`(\mathsf{global}~x)` be the destructuring of :math:`{\mathit{externidx}}`. - #. Return :math:`\{ \mathsf{name}~{\mathit{name}},\;\allowbreak \mathsf{addr}~(\mathsf{global}~{{\mathit{ga}}^\ast}{}[x]) \}`. + #. If :math:`x < {|{{\mathit{ga}}^\ast}|}`, then: + + 1) Return :math:`\{ \mathsf{name}~{\mathit{name}},\;\allowbreak \mathsf{addr}~(\mathsf{global}~{{\mathit{ga}}^\ast}{}[x]) \}`. #. If :math:`{\mathit{externidx}}` is some :math:`\mathsf{table}~{\mathit{tableidx}}`, then: a. Let :math:`(\mathsf{table}~x)` be the destructuring of :math:`{\mathit{externidx}}`. - #. Return :math:`\{ \mathsf{name}~{\mathit{name}},\;\allowbreak \mathsf{addr}~(\mathsf{table}~{{\mathit{ta}}^\ast}{}[x]) \}`. + #. If :math:`x < {|{{\mathit{ta}}^\ast}|}`, then: + + 1) Return :math:`\{ \mathsf{name}~{\mathit{name}},\;\allowbreak \mathsf{addr}~(\mathsf{table}~{{\mathit{ta}}^\ast}{}[x]) \}`. #. Assert: :math:`{\mathit{externidx}}` is some :math:`\mathsf{mem}~{\mathit{memidx}}`. #. Let :math:`(\mathsf{mem}~x)` be the destructuring of :math:`{\mathit{externidx}}`. +#. Assert: :math:`x < {|{{\mathit{ma}}^\ast}|}`. + #. Return :math:`\{ \mathsf{name}~{\mathit{name}},\;\allowbreak \mathsf{addr}~(\mathsf{mem}~{{\mathit{ma}}^\ast}{}[x]) \}`. @@ -2844,6 +2884,8 @@ The module :math:`(\mathsf{module}~{{\mathit{type}}^\ast}~{{\mathit{import}}^\as #. Let :math:`i~{{i'}^\ast}` be :math:`{{\mathit{u{\kern-0.1em\scriptstyle 32}}}^\ast}`. + #. Assert: :math:`0 < {|{\mathit{moduleinst}}{.}\mathsf{tables}|}`. + #. Replace :math:`s{.}\mathsf{tables}{}[{\mathit{moduleinst}}{.}\mathsf{tables}{}[0]]{.}\mathsf{refs}{}[i : {|{a^\ast}|}]` with :math:`{a^\ast}`. #. Perform :math:`{\mathrm{initelem}}(s, {\mathit{moduleinst}}, {{i'}^\ast}, {{{a'}^\ast}^\ast})`. @@ -2869,6 +2911,8 @@ The module :math:`(\mathsf{module}~{{\mathit{type}}^\ast}~{{\mathit{import}}^\as #. Let :math:`i~{{i'}^\ast}` be :math:`{{\mathit{u{\kern-0.1em\scriptstyle 32}}}^\ast}`. + #. Assert: :math:`0 < {|{\mathit{moduleinst}}{.}\mathsf{mems}|}`. + #. Replace :math:`s{.}\mathsf{mems}{}[{\mathit{moduleinst}}{.}\mathsf{mems}{}[0]]{.}\mathsf{bytes}{}[i : {|{b^\ast}|}]` with :math:`{b^\ast}`. #. Perform :math:`{\mathrm{initdata}}(s, {\mathit{moduleinst}}, {{i'}^\ast}, {{{b'}^\ast}^\ast})`. @@ -2892,6 +2936,8 @@ The module :math:`(\mathsf{module}~{{\mathit{type}}^\ast}~{{\mathit{import}}^\as #. Let :math:`n_{\mathsf{f}}` be the length of :math:`{{\mathit{func}}^\ast}`. +#. Let :math:`{(\mathsf{start}~{x'})^?}` be :math:`{{\mathit{start}}^?}`. + #. Let :math:`{{b^\ast}^\ast}` be the byte sequence sequence :math:`\epsilon`. #. Let :math:`{{\mathit{expr}}_{\mathsf{d}}^\ast}` be the expression sequence :math:`\epsilon`. @@ -2960,8 +3006,16 @@ The module :math:`(\mathsf{module}~{{\mathit{type}}^\ast}~{{\mathit{import}}^\as #. Pop the :math:`\mathsf{frame}` from the stack. +#. Assert: :math:`{|{{\mathit{expr}}_{\mathsf{g}}^\ast}|} = {|{{\mathit{val}}^\ast}|}`. + +#. Assert: :math:`{|{{\mathit{expr}}_{\mathsf{e}}^\ast}|} = {|{i_{\mathsf{e}}^\ast}|}`. + +#. Assert: :math:`{|{{\mathit{expr}}_{\mathsf{d}}^\ast}|} = {|{i_{\mathsf{d}}^\ast}|}`. + #. Let :math:`{\mathit{moduleinst}}` be :math:`{\mathrm{allocmodule}}(s, {\mathit{module}}, {{\mathit{externaddr}}^\ast}, {{\mathit{val}}^\ast})`. +#. Assert: :math:`{{(x < {|{\mathit{moduleinst}}{.}\mathsf{funcs}|})^\ast}^\ast}`. + #. Let :math:`f` be the frame :math:`\{ \mathsf{module}~{\mathit{moduleinst}} \}`. #. Perform :math:`{\mathrm{initelem}}(s, {\mathit{moduleinst}}, {i_{\mathsf{e}}^\ast}, {{{\mathit{moduleinst}}{.}\mathsf{funcs}{}[x]^\ast}^\ast})`. @@ -2972,11 +3026,9 @@ The module :math:`(\mathsf{module}~{{\mathit{type}}^\ast}~{{\mathit{import}}^\as #. Push the :math:`\mathsf{frame}` :math:`{f'}`. -#. If :math:`{{\mathit{start}}^?}` is defined, then: - - a. Let :math:`(\mathsf{start}~{x'})` be :math:`{{\mathit{start}}^?}`. +#. If :math:`{(\mathsf{call}~{x'})^?}` is defined, then: - #. Let :math:`{\mathit{instr}}_0` be the administrative instruction :math:`(\mathsf{call}~{x'})`. + a. Let :math:`{\mathit{instr}}_0` be :math:`{(\mathsf{call}~{x'})^?}`. #. Execute the instruction :math:`{\mathit{instr}}_0`. @@ -2995,6 +3047,12 @@ The module :math:`(\mathsf{module}~{{\mathit{type}}^\ast}~{{\mathit{import}}^\as #. Push the :math:`\mathsf{frame}` :math:`F`. +#. Assert: :math:`{\mathit{fa}} < {|(s, f){.}\mathsf{funcs}|}`. + +#. Let :math:`{F'}` be the :math:`\mathsf{frame}` :math:`(s, f)`. + +#. Push the :math:`\mathsf{frame}` :math:`{F'}`. + #. Let :math:`{t_1^{n}}~\rightarrow~{t_2^\ast}` be the destructuring of :math:`(s, f){.}\mathsf{funcs}{}[{\mathit{fa}}]{.}\mathsf{type}`. #. Pop the :math:`\mathsf{frame}` from the stack. @@ -4191,40 +4249,55 @@ moduleinst (s, f) 1. Return f.MODULE. type (s, f) x -1. Return f.MODULE.TYPES[x]. +1. Assert: Due to validation, (x < |f.MODULE.TYPES|). +2. Return f.MODULE.TYPES[x]. func (s, f) x -1. Return s.FUNCS[f.MODULE.FUNCS[x]]. +1. Assert: Due to validation, (f.MODULE.FUNCS[x] < |s.FUNCS|). +2. Assert: Due to validation, (x < |f.MODULE.FUNCS|). +3. Return s.FUNCS[f.MODULE.FUNCS[x]]. global (s, f) x -1. Return s.GLOBALS[f.MODULE.GLOBALS[x]]. +1. Assert: Due to validation, (f.MODULE.GLOBALS[x] < |s.GLOBALS|). +2. Assert: Due to validation, (x < |f.MODULE.GLOBALS|). +3. Return s.GLOBALS[f.MODULE.GLOBALS[x]]. table (s, f) x -1. Return s.TABLES[f.MODULE.TABLES[x]]. +1. Assert: Due to validation, (f.MODULE.TABLES[x] < |s.TABLES|). +2. Assert: Due to validation, (x < |f.MODULE.TABLES|). +3. Return s.TABLES[f.MODULE.TABLES[x]]. mem (s, f) x -1. Return s.MEMS[f.MODULE.MEMS[x]]. +1. Assert: Due to validation, (f.MODULE.MEMS[x] < |s.MEMS|). +2. Assert: Due to validation, (x < |f.MODULE.MEMS|). +3. Return s.MEMS[f.MODULE.MEMS[x]]. local (s, f) x -1. Return f.LOCALS[x]. +1. Assert: Due to validation, (x < |f.LOCALS|). +2. Return f.LOCALS[x]. with_local (s, f) x v 1. Replace f.LOCALS[x] with v. with_global (s, f) x v -1. Replace s.GLOBALS[f.MODULE.GLOBALS[x]].VALUE with v. +1. Assert: Due to validation, (x < |f.MODULE.GLOBALS|). +2. Replace s.GLOBALS[f.MODULE.GLOBALS[x]].VALUE with v. with_table (s, f) x i a -1. Replace s.TABLES[f.MODULE.TABLES[x]].REFS[i] with ?(a). +1. Assert: Due to validation, (x < |f.MODULE.TABLES|). +2. Replace s.TABLES[f.MODULE.TABLES[x]].REFS[i] with ?(a). with_tableinst (s, f) x ti -1. Replace s.TABLES[f.MODULE.TABLES[x]] with ti. +1. Assert: Due to validation, (x < |f.MODULE.TABLES|). +2. Replace s.TABLES[f.MODULE.TABLES[x]] with ti. with_mem (s, f) x i j b* -1. Replace s.MEMS[f.MODULE.MEMS[x]].BYTES[i : j] with b*. +1. Assert: Due to validation, (x < |f.MODULE.MEMS|). +2. Replace s.MEMS[f.MODULE.MEMS[x]].BYTES[i : j] with b*. with_meminst (s, f) x mi -1. Replace s.MEMS[f.MODULE.MEMS[x]] with mi. +1. Assert: Due to validation, (x < |f.MODULE.MEMS|). +2. Replace s.MEMS[f.MODULE.MEMS[x]] with mi. growtable ti n 1. Let { TYPE: ([ i .. j? ]); REFS: ?(a)* } be ti. @@ -4284,10 +4357,11 @@ mems externaddr''* allocfunc s moduleinst func 1. Let (FUNC x local* expr) be func. -2. Let fi be { TYPE: moduleinst.TYPES[x]; MODULE: moduleinst; CODE: func }. -3. Let a be |s.FUNCS|. -4. Append fi to the s.FUNCS. -5. Return a. +2. Assert: Due to validation, (x < |moduleinst.TYPES|). +3. Let fi be { TYPE: moduleinst.TYPES[x]; MODULE: moduleinst; CODE: func }. +4. Let a be |s.FUNCS|. +5. Append fi to the s.FUNCS. +6. Return a. allocfuncs s moduleinst func''* 1. If (func''* = []), then: @@ -4346,16 +4420,20 @@ allocmems s memtype''* instexport fa* ga* ta* ma* (EXPORT name externidx) 1. If externidx is some FUNC, then: a. Let (FUNC x) be externidx. - b. Return { NAME: name; ADDR: (FUNC fa*[x]) }. + b. If (x < |fa*|), then: + 1) Return { NAME: name; ADDR: (FUNC fa*[x]) }. 2. If externidx is some GLOBAL, then: a. Let (GLOBAL x) be externidx. - b. Return { NAME: name; ADDR: (GLOBAL ga*[x]) }. + b. If (x < |ga*|), then: + 1) Return { NAME: name; ADDR: (GLOBAL ga*[x]) }. 3. If externidx is some TABLE, then: a. Let (TABLE x) be externidx. - b. Return { NAME: name; ADDR: (TABLE ta*[x]) }. + b. If (x < |ta*|), then: + 1) Return { NAME: name; ADDR: (TABLE ta*[x]) }. 4. Assert: Due to validation, externidx is some MEM. 5. Let (MEM x) be externidx. -6. Return { NAME: name; ADDR: (MEM ma*[x]) }. +6. Assert: Due to validation, (x < |ma*|). +7. Return { NAME: name; ADDR: (MEM ma*[x]) }. allocmodule s module externaddr* val* 1. Let (MODULE type_0* import* func^n_func global_1* table_2* mem_3* elem* data* start? export*) be module. @@ -4397,9 +4475,10 @@ initelem s moduleinst u32* funcaddr* a. Let [a*] :: a'** be funcaddr*. b. Assert: Due to validation, (|u32*| >= 1). c. Let [i] :: i'* be u32*. - d. Replace s.TABLES[moduleinst.TABLES[0]].REFS[i : |a*|] with ?(a)*. - e. Perform $initelem(s, moduleinst, i'*, a'**). - f. Return. + d. Assert: Due to validation, (0 < |moduleinst.TABLES|). + e. Replace s.TABLES[moduleinst.TABLES[0]].REFS[i : |a*|] with ?(a)*. + f. Perform $initelem(s, moduleinst, i'*, a'**). + g. Return. initdata s moduleinst u32* byte* 1. If (byte* = []), then: @@ -4409,9 +4488,10 @@ initdata s moduleinst u32* byte* a. Let [b*] :: b'** be byte*. b. Assert: Due to validation, (|u32*| >= 1). c. Let [i] :: i'* be u32*. - d. Replace s.MEMS[moduleinst.MEMS[0]].BYTES[i : |b*|] with b*. - e. Perform $initdata(s, moduleinst, i'*, b'**). - f. Return. + d. Assert: Due to validation, (0 < |moduleinst.MEMS|). + e. Replace s.MEMS[moduleinst.MEMS[0]].BYTES[i : |b*|] with b*. + f. Perform $initdata(s, moduleinst, i'*, b'**). + g. Return. instantiate s module externaddr* 1. Let (MODULE type* import* func* global* table* mem* elem* data* start? export*) be module. @@ -4420,63 +4500,69 @@ instantiate s module externaddr* a. Let (TYPE functype) be type. b. Append functype to the functype*. 4. Let n_F be |func*|. -5. Let b** be []. -6. Let expr_D* be []. -7. For each data in data*, do: +5. Let (START x')? be start?. +6. Let b** be []. +7. Let expr_D* be []. +8. For each data in data*, do: a. Let (DATA expr_D b*) be data. b. Append b* to the b**. c. Append expr_D to the expr_D*. -8. Let expr_E* be []. -9. Let x** be []. -10. For each elem in elem*, do: +9. Let expr_E* be []. +10. Let x** be []. +11. For each elem in elem*, do: a. Let (ELEM expr_E x*) be elem. b. Append expr_E to the expr_E*. c. Append x* to the x**. -11. Let expr_G* be []. -12. For each global in global*, do: +12. Let expr_G* be []. +13. For each global in global*, do: a. Let (GLOBAL globaltype expr_G) be global. b. Append expr_G to the expr_G*. -13. Let moduleinst_init be { TYPES: functype*; FUNCS: $funcs(externaddr*) :: (|s.FUNCS| + i_F)^(i_F t_2* be $funcinst((s, f))[fa].TYPE. -4. Pop the frame (FRAME_ 0 { _f }) from the stack. -5. Let k be |t_2*|. -6. Push the frame (FRAME_ k { f }) to the stack. -7. Push the values val^n to the stack. -8. Execute the instruction (CALL_ADDR fa). -9. Pop the values val'^k from the stack. -10. Pop the frame (FRAME_ k { f }) from the stack. -11. Return val'^k. +3. Assert: Due to validation, (fa < |$funcinst((s, f))|). +4. Push the frame (FRAME_ 0 { (s, f) }) to the stack. +5. Let t_1^n -> t_2* be $funcinst((s, f))[fa].TYPE. +6. Pop the frame (FRAME_ 0 { _f }) from the stack. +7. Let k be |t_2*|. +8. Push the frame (FRAME_ k { f }) to the stack. +9. Push the values val^n to the stack. +10. Execute the instruction (CALL_ADDR fa). +11. Pop the values val'^k from the stack. +12. Pop the frame (FRAME_ k { f }) from the stack. +13. Return val'^k. Eval_expr instr* 1. Execute the sequence instr*. @@ -9969,56 +10055,84 @@ The module :math:`(\mathsf{module}~{{\mathit{type}}^\ast}~{{\mathit{import}}^\as .................................... -1. Return :math:`f{.}\mathsf{module}{.}\mathsf{types}{}[x]`. +1. Assert: Due to validation, :math:`x < {|f{.}\mathsf{module}{.}\mathsf{types}|}`. + +#. Return :math:`f{.}\mathsf{module}{.}\mathsf{types}{}[x]`. :math:`(s, f){.}\mathsf{funcs}{}[x]` .................................... -1. Return :math:`s{.}\mathsf{funcs}{}[f{.}\mathsf{module}{.}\mathsf{funcs}{}[x]]`. +1. Assert: Due to validation, :math:`f{.}\mathsf{module}{.}\mathsf{funcs}{}[x] < {|s{.}\mathsf{funcs}|}`. + +#. Assert: Due to validation, :math:`x < {|f{.}\mathsf{module}{.}\mathsf{funcs}|}`. + +#. Return :math:`s{.}\mathsf{funcs}{}[f{.}\mathsf{module}{.}\mathsf{funcs}{}[x]]`. :math:`(s, f){.}\mathsf{globals}{}[x]` ...................................... -1. Return :math:`s{.}\mathsf{globals}{}[f{.}\mathsf{module}{.}\mathsf{globals}{}[x]]`. +1. Assert: Due to validation, :math:`f{.}\mathsf{module}{.}\mathsf{globals}{}[x] < {|s{.}\mathsf{globals}|}`. + +#. Assert: Due to validation, :math:`x < {|f{.}\mathsf{module}{.}\mathsf{globals}|}`. + +#. Return :math:`s{.}\mathsf{globals}{}[f{.}\mathsf{module}{.}\mathsf{globals}{}[x]]`. :math:`(s, f){.}\mathsf{tables}{}[x]` ..................................... -1. Return :math:`s{.}\mathsf{tables}{}[f{.}\mathsf{module}{.}\mathsf{tables}{}[x]]`. +1. Assert: Due to validation, :math:`f{.}\mathsf{module}{.}\mathsf{tables}{}[x] < {|s{.}\mathsf{tables}|}`. + +#. Assert: Due to validation, :math:`x < {|f{.}\mathsf{module}{.}\mathsf{tables}|}`. + +#. Return :math:`s{.}\mathsf{tables}{}[f{.}\mathsf{module}{.}\mathsf{tables}{}[x]]`. :math:`(s, f){.}\mathsf{mems}{}[x]` ................................... -1. Return :math:`s{.}\mathsf{mems}{}[f{.}\mathsf{module}{.}\mathsf{mems}{}[x]]`. +1. Assert: Due to validation, :math:`f{.}\mathsf{module}{.}\mathsf{mems}{}[x] < {|s{.}\mathsf{mems}|}`. + +#. Assert: Due to validation, :math:`x < {|f{.}\mathsf{module}{.}\mathsf{mems}|}`. + +#. Return :math:`s{.}\mathsf{mems}{}[f{.}\mathsf{module}{.}\mathsf{mems}{}[x]]`. :math:`(s, f){.}\mathsf{elems}{}[x]` .................................... -1. Return :math:`s{.}\mathsf{elems}{}[f{.}\mathsf{module}{.}\mathsf{elems}{}[x]]`. +1. Assert: Due to validation, :math:`f{.}\mathsf{module}{.}\mathsf{elems}{}[x] < {|s{.}\mathsf{elems}|}`. + +#. Assert: Due to validation, :math:`x < {|f{.}\mathsf{module}{.}\mathsf{elems}|}`. + +#. Return :math:`s{.}\mathsf{elems}{}[f{.}\mathsf{module}{.}\mathsf{elems}{}[x]]`. :math:`(s, f){.}\mathsf{datas}{}[x]` .................................... -1. Return :math:`s{.}\mathsf{datas}{}[f{.}\mathsf{module}{.}\mathsf{datas}{}[x]]`. +1. Assert: Due to validation, :math:`f{.}\mathsf{module}{.}\mathsf{datas}{}[x] < {|s{.}\mathsf{datas}|}`. + +#. Assert: Due to validation, :math:`x < {|f{.}\mathsf{module}{.}\mathsf{datas}|}`. + +#. Return :math:`s{.}\mathsf{datas}{}[f{.}\mathsf{module}{.}\mathsf{datas}{}[x]]`. :math:`(s, f){.}\mathsf{locals}{}[x]` ..................................... -1. Return :math:`f{.}\mathsf{locals}{}[x]`. +1. Assert: Due to validation, :math:`x < {|f{.}\mathsf{locals}|}`. + +#. Return :math:`f{.}\mathsf{locals}{}[x]`. :math:`(s, f){}[{.}\mathsf{locals}{}[x] = v]` @@ -10032,49 +10146,63 @@ The module :math:`(\mathsf{module}~{{\mathit{type}}^\ast}~{{\mathit{import}}^\as ............................................................... -1. Replace :math:`s{.}\mathsf{globals}{}[f{.}\mathsf{module}{.}\mathsf{globals}{}[x]]{.}\mathsf{value}` with :math:`v`. +1. Assert: Due to validation, :math:`x < {|f{.}\mathsf{module}{.}\mathsf{globals}|}`. + +#. Replace :math:`s{.}\mathsf{globals}{}[f{.}\mathsf{module}{.}\mathsf{globals}{}[x]]{.}\mathsf{value}` with :math:`v`. :math:`(s, f){}[{.}\mathsf{tables}{}[x]{.}\mathsf{refs}{}[i] = r]` .................................................................. -1. Replace :math:`s{.}\mathsf{tables}{}[f{.}\mathsf{module}{.}\mathsf{tables}{}[x]]{.}\mathsf{refs}{}[i]` with :math:`r`. +1. Assert: Due to validation, :math:`x < {|f{.}\mathsf{module}{.}\mathsf{tables}|}`. + +#. Replace :math:`s{.}\mathsf{tables}{}[f{.}\mathsf{module}{.}\mathsf{tables}{}[x]]{.}\mathsf{refs}{}[i]` with :math:`r`. :math:`(s, f){}[{.}\mathsf{tables}{}[x] = {\mathit{ti}}]` ......................................................... -1. Replace :math:`s{.}\mathsf{tables}{}[f{.}\mathsf{module}{.}\mathsf{tables}{}[x]]` with :math:`{\mathit{ti}}`. +1. Assert: Due to validation, :math:`x < {|f{.}\mathsf{module}{.}\mathsf{tables}|}`. + +#. Replace :math:`s{.}\mathsf{tables}{}[f{.}\mathsf{module}{.}\mathsf{tables}{}[x]]` with :math:`{\mathit{ti}}`. :math:`(s, f){}[{.}\mathsf{mems}{}[x]{.}\mathsf{bytes}{}[i : j] = {b^\ast}]` ............................................................................ -1. Replace :math:`s{.}\mathsf{mems}{}[f{.}\mathsf{module}{.}\mathsf{mems}{}[x]]{.}\mathsf{bytes}{}[i : j]` with :math:`{b^\ast}`. +1. Assert: Due to validation, :math:`x < {|f{.}\mathsf{module}{.}\mathsf{mems}|}`. + +#. Replace :math:`s{.}\mathsf{mems}{}[f{.}\mathsf{module}{.}\mathsf{mems}{}[x]]{.}\mathsf{bytes}{}[i : j]` with :math:`{b^\ast}`. :math:`(s, f){}[{.}\mathsf{mems}{}[x] = {\mathit{mi}}]` ....................................................... -1. Replace :math:`s{.}\mathsf{mems}{}[f{.}\mathsf{module}{.}\mathsf{mems}{}[x]]` with :math:`{\mathit{mi}}`. +1. Assert: Due to validation, :math:`x < {|f{.}\mathsf{module}{.}\mathsf{mems}|}`. + +#. Replace :math:`s{.}\mathsf{mems}{}[f{.}\mathsf{module}{.}\mathsf{mems}{}[x]]` with :math:`{\mathit{mi}}`. :math:`(s, f){}[{.}\mathsf{elems}{}[x]{.}\mathsf{refs} = {r^\ast}]` ................................................................... -1. Replace :math:`s{.}\mathsf{elems}{}[f{.}\mathsf{module}{.}\mathsf{elems}{}[x]]{.}\mathsf{refs}` with :math:`{r^\ast}`. +1. Assert: Due to validation, :math:`x < {|f{.}\mathsf{module}{.}\mathsf{elems}|}`. + +#. Replace :math:`s{.}\mathsf{elems}{}[f{.}\mathsf{module}{.}\mathsf{elems}{}[x]]{.}\mathsf{refs}` with :math:`{r^\ast}`. :math:`(s, f){}[{.}\mathsf{datas}{}[x]{.}\mathsf{bytes} = {b^\ast}]` .................................................................... -1. Replace :math:`s{.}\mathsf{datas}{}[f{.}\mathsf{module}{.}\mathsf{datas}{}[x]]{.}\mathsf{bytes}` with :math:`{b^\ast}`. +1. Assert: Due to validation, :math:`x < {|f{.}\mathsf{module}{.}\mathsf{datas}|}`. + +#. Replace :math:`s{.}\mathsf{datas}{}[f{.}\mathsf{module}{.}\mathsf{datas}{}[x]]{.}\mathsf{bytes}` with :math:`{b^\ast}`. :math:`{\mathrm{growtable}}({\mathit{ti}}, n, r)` @@ -10226,6 +10354,8 @@ The module :math:`(\mathsf{module}~{{\mathit{type}}^\ast}~{{\mathit{import}}^\as 1. Let :math:`(\mathsf{func}~x~{{\mathit{local}}^\ast}~{\mathit{expr}})` be the destructuring of :math:`{\mathit{func}}`. +#. Assert: :math:`x < {|{\mathit{moduleinst}}{.}\mathsf{types}|}`. + #. Let :math:`{\mathit{fi}}` be the function instance :math:`\{ \mathsf{type}~{\mathit{moduleinst}}{.}\mathsf{types}{}[x],\;\allowbreak \mathsf{module}~{\mathit{moduleinst}},\;\allowbreak \mathsf{code}~{\mathit{func}} \}`. #. Let :math:`a` be the length of :math:`s{.}\mathsf{funcs}`. @@ -10426,24 +10556,32 @@ The module :math:`(\mathsf{module}~{{\mathit{type}}^\ast}~{{\mathit{import}}^\as a. Let :math:`(\mathsf{func}~x)` be the destructuring of :math:`{\mathit{externidx}}`. - #. Return :math:`\{ \mathsf{name}~{\mathit{name}},\;\allowbreak \mathsf{addr}~(\mathsf{func}~{{\mathit{fa}}^\ast}{}[x]) \}`. + #. If :math:`x < {|{{\mathit{fa}}^\ast}|}`, then: + + 1) Return :math:`\{ \mathsf{name}~{\mathit{name}},\;\allowbreak \mathsf{addr}~(\mathsf{func}~{{\mathit{fa}}^\ast}{}[x]) \}`. #. If :math:`{\mathit{externidx}}` is some :math:`\mathsf{global}~{\mathit{globalidx}}`, then: a. Let :math:`(\mathsf{global}~x)` be the destructuring of :math:`{\mathit{externidx}}`. - #. Return :math:`\{ \mathsf{name}~{\mathit{name}},\;\allowbreak \mathsf{addr}~(\mathsf{global}~{{\mathit{ga}}^\ast}{}[x]) \}`. + #. If :math:`x < {|{{\mathit{ga}}^\ast}|}`, then: + + 1) Return :math:`\{ \mathsf{name}~{\mathit{name}},\;\allowbreak \mathsf{addr}~(\mathsf{global}~{{\mathit{ga}}^\ast}{}[x]) \}`. #. If :math:`{\mathit{externidx}}` is some :math:`\mathsf{table}~{\mathit{tableidx}}`, then: a. Let :math:`(\mathsf{table}~x)` be the destructuring of :math:`{\mathit{externidx}}`. - #. Return :math:`\{ \mathsf{name}~{\mathit{name}},\;\allowbreak \mathsf{addr}~(\mathsf{table}~{{\mathit{ta}}^\ast}{}[x]) \}`. + #. If :math:`x < {|{{\mathit{ta}}^\ast}|}`, then: + + 1) Return :math:`\{ \mathsf{name}~{\mathit{name}},\;\allowbreak \mathsf{addr}~(\mathsf{table}~{{\mathit{ta}}^\ast}{}[x]) \}`. #. Assert: :math:`{\mathit{externidx}}` is some :math:`\mathsf{mem}~{\mathit{memidx}}`. #. Let :math:`(\mathsf{mem}~x)` be the destructuring of :math:`{\mathit{externidx}}`. +#. Assert: :math:`x < {|{{\mathit{ma}}^\ast}|}`. + #. Return :math:`\{ \mathsf{name}~{\mathit{name}},\;\allowbreak \mathsf{addr}~(\mathsf{mem}~{{\mathit{ma}}^\ast}{}[x]) \}`. @@ -10588,6 +10726,8 @@ The module :math:`(\mathsf{module}~{{\mathit{type}}^\ast}~{{\mathit{import}}^\as #. Let :math:`n_{\mathsf{f}}` be the length of :math:`{{\mathit{func}}^\ast}`. +#. Let :math:`{(\mathsf{start}~x)^?}` be :math:`{{\mathit{start}}^?}`. + #. Let :math:`{{\mathit{expr}}_{\mathsf{g}}^\ast}` be the expression sequence :math:`\epsilon`. #. For each :math:`{\mathit{global}}` in :math:`{{\mathit{global}}^\ast}`, do: @@ -10604,6 +10744,10 @@ The module :math:`(\mathsf{module}~{{\mathit{type}}^\ast}~{{\mathit{import}}^\as #. Append :math:`{{\mathit{expr}}_{\mathsf{e}}^\ast}` to :math:`{{{\mathit{expr}}_{\mathsf{e}}^\ast}^\ast}`. +#. Assert: :math:`{(i < {|{{\mathit{elem}}^\ast}|})^{i` of :math:`{{\mathrm{rundata}}({{\mathit{data}}^\ast}{}[j], j)^{j` of :math:`{{\mathrm{runelem}}({{\mathit{elem}}^\ast}{}[i], i)^{i t_2* be $funcinst((s, f))[fa].TYPE. -4. Pop the frame (FRAME_ 0 { _f }) from the stack. -5. Let k be |t_2*|. -6. Push the frame (FRAME_ k { f }) to the stack. -7. Push the values val^n to the stack. -8. Execute the instruction (CALL_ADDR fa). -9. Pop the values val'^k from the stack. -10. Pop the frame (FRAME_ k { f }) from the stack. -11. Return val'^k. +3. Assert: Due to validation, (fa < |$funcinst((s, f))|). +4. Push the frame (FRAME_ 0 { (s, f) }) to the stack. +5. Let t_1^n -> t_2* be $funcinst((s, f))[fa].TYPE. +6. Pop the frame (FRAME_ 0 { _f }) from the stack. +7. Let k be |t_2*|. +8. Push the frame (FRAME_ k { f }) to the stack. +9. Push the values val^n to the stack. +10. Execute the instruction (CALL_ADDR fa). +11. Pop the values val'^k from the stack. +12. Pop the frame (FRAME_ k { f }) from the stack. +13. Return val'^k. Eval_expr instr* 1. Execute the sequence instr*. @@ -21019,6 +21206,8 @@ The instruction sequence :math:`(\mathsf{block}~{\mathit{blocktype}}~{{\mathit{i #. Let :math:`w~{{w'}^\ast}` be :math:`{X^\ast}`. +#. Assert: Due to validation, :math:`{|{{w'}^\ast}|} > 0`. + #. Return :math:`w` is not contained in :math:`{{w'}^\ast}` and :math:`{{w'}^\ast}~{\mathrm{disjoint}}`. @@ -22325,6 +22514,8 @@ The instruction sequence :math:`(\mathsf{block}~{\mathit{blocktype}}~{{\mathit{i 1. Let :math:`(\mathsf{rec}~{{\mathit{subtype}}^\ast})` be the destructuring of :math:`{\mathrm{unroll}}({\mathit{rectype}})`. +#. Assert: Due to validation, :math:`i < {|{{\mathit{subtype}}^\ast}|}`. + #. Return :math:`{{\mathit{subtype}}^\ast}{}[i]`. @@ -23560,12 +23751,16 @@ The instruction sequence :math:`(\mathsf{block}~{\mathit{blocktype}}~{{\mathit{i a. Let :math:`{\mathit{typeidx}}` be the heap type :math:`{\mathit{heaptype}}`. - #. Return :math:`{\mathrm{unroll}}(C{.}\mathsf{types}{}[{\mathit{typeidx}}])`. + #. If :math:`{\mathit{typeidx}} < {|C{.}\mathsf{types}|}`, then: + + 1) Return :math:`{\mathrm{unroll}}(C{.}\mathsf{types}{}[{\mathit{typeidx}}])`. #. Assert: Due to validation, :math:`{\mathit{heaptype}}` is some :math:`\mathsf{rec}~{.}~{.}`. #. Let :math:`(\mathsf{rec}~{.}~{.})` be the destructuring of :math:`{\mathit{heaptype}}`. +#. Assert: Due to validation, :math:`i < {|C{.}\mathsf{recs}|}`. + #. Return :math:`C{.}\mathsf{recs}{}[i]`. @@ -23616,7 +23811,11 @@ The instruction sequence :math:`(\mathsf{block}~{\mathit{blocktype}}~{{\mathit{i ............................................... -1. If :math:`{\mathrm{ND}}`, then: +1. If :math:`i \geq {|X_1~X_2|}`, then: + + a. Return :math:`X_1~X_2{}[0]`. + +#. If :math:`{\mathrm{ND}}`, then: a. Return :math:`X_1~X_2{}[i]`. @@ -23627,7 +23826,11 @@ The instruction sequence :math:`(\mathsf{block}~{\mathit{blocktype}}~{{\mathit{i ......................................................... -1. If :math:`{\mathrm{ND}}`, then: +1. If :math:`i \geq {|X_1~X_2~X_3~X_4|}`, then: + + a. Return :math:`X_1~X_2~X_3~X_4{}[0]`. + +#. If :math:`{\mathrm{ND}}`, then: a. Return :math:`X_1~X_2~X_3~X_4{}[i]`. @@ -24434,6 +24637,8 @@ The instruction sequence :math:`(\mathsf{block}~{\mathit{blocktype}}~{{\mathit{i a. Return :math:`0`. +#. Assert: Due to validation, :math:`i \mathbin{\mathrm{mod}} {|{c^\ast}|} < {|{c^\ast}|}`. + #. Return :math:`{{\mathrm{relaxed}}({\mathrm{R}}_{\mathit{swizzle}})}{{}[ 0, {c^\ast}{}[i \mathbin{\mathrm{mod}} {|{c^\ast}|}] ]}`. @@ -24724,6 +24929,8 @@ The instruction sequence :math:`(\mathsf{block}~{\mathit{blocktype}}~{{\mathit{i #. Let :math:`{c_2^\ast}` be :math:`{{\mathrm{lanes}}}_{{{\mathsf{i}}{N}}{\mathsf{x}}{M}}(v_2)`. +#. Assert: Due to validation, :math:`{(i < {|{c_1^\ast}~{c_2^\ast}|})^\ast}`. + #. Let :math:`{c^\ast}` be :math:`\epsilon`. #. For each :math:`i` in :math:`{i^\ast}`, do: @@ -25074,9 +25281,11 @@ The instruction sequence :math:`(\mathsf{block}~{\mathit{blocktype}}~{{\mathit{i #. Let :math:`{{c^\ast}^\ast}` be :math:`{\Large\times}~{{{\mathrm{lcvtop}}}_{{{{\mathsf{i}}{N}}_1}{\mathsf{x}}{{M'}}, {{{\mathsf{i}}{N}}_2}{\mathsf{x}}{{M'}}}({\mathit{vcvtop}}, c_1)^\ast}`. - #. Let :math:`v` be an element of :math:`{{{{{\mathrm{lanes}}}_{{{{\mathsf{i}}{N}}_2}{\mathsf{x}}{{M'}}}^{{-1}}}}{({c^\ast})}^\ast}`. + #. If :math:`{|{{{{{\mathrm{lanes}}}_{{{{\mathsf{i}}{N}}_2}{\mathsf{x}}{{M'}}}^{{-1}}}}{({c^\ast})}^\ast}|} > 0`, then: - #. Return :math:`v`. + 1) Let :math:`v` be an element of :math:`{{{{{\mathrm{lanes}}}_{{{{\mathsf{i}}{N}}_2}{\mathsf{x}}{{M'}}}^{{-1}}}}{({c^\ast})}^\ast}`. + + #) Return :math:`v`. #. If :math:`{\mathrm{halfop}}({{{\mathsf{i}}{N}}_1}{\mathsf{x}}{M}, {{{\mathsf{i}}{N}}_2}{\mathsf{x}}{{M'}}, {\mathit{vcvtop}})` is defined, then: @@ -25086,9 +25295,11 @@ The instruction sequence :math:`(\mathsf{block}~{\mathit{blocktype}}~{{\mathit{i #. Let :math:`{{c^\ast}^\ast}` be :math:`{\Large\times}~{{{\mathrm{lcvtop}}}_{{{{\mathsf{i}}{N}}_1}{\mathsf{x}}{M}, {{{\mathsf{i}}{N}}_2}{\mathsf{x}}{{M'}}}({\mathit{vcvtop}}, c_1)^\ast}`. - #. Let :math:`v` be an element of :math:`{{{{{\mathrm{lanes}}}_{{{{\mathsf{i}}{N}}_2}{\mathsf{x}}{{M'}}}^{{-1}}}}{({c^\ast})}^\ast}`. + #. If :math:`{|{{{{{\mathrm{lanes}}}_{{{{\mathsf{i}}{N}}_2}{\mathsf{x}}{{M'}}}^{{-1}}}}{({c^\ast})}^\ast}|} > 0`, then: + + 1) Let :math:`v` be an element of :math:`{{{{{\mathrm{lanes}}}_{{{{\mathsf{i}}{N}}_2}{\mathsf{x}}{{M'}}}^{{-1}}}}{({c^\ast})}^\ast}`. - #. Return :math:`v`. + #) Return :math:`v`. #. Assert: Due to validation, :math:`{\mathrm{zeroop}}({{{\mathsf{i}}{N}}_1}{\mathsf{x}}{M}, {{{\mathsf{i}}{N}}_2}{\mathsf{x}}{{M'}}, {\mathit{vcvtop}}) = \mathsf{zero}`. @@ -25096,6 +25307,8 @@ The instruction sequence :math:`(\mathsf{block}~{\mathit{blocktype}}~{{\mathit{i #. Let :math:`{{c^\ast}^\ast}` be :math:`{\Large\times}~{{{\mathrm{lcvtop}}}_{{{{\mathsf{i}}{N}}_1}{\mathsf{x}}{M}, {{{\mathsf{i}}{N}}_2}{\mathsf{x}}{{M'}}}({\mathit{vcvtop}}, c_1)^\ast}~{0^{M}}`. +#. Assert: Due to validation, :math:`{|{{{{{\mathrm{lanes}}}_{{{{\mathsf{i}}{N}}_2}{\mathsf{x}}{{M'}}}^{{-1}}}}{({c^\ast})}^\ast}|} > 0`. + #. Let :math:`v` be an element of :math:`{{{{{\mathrm{lanes}}}_{{{{\mathsf{i}}{N}}_2}{\mathsf{x}}{{M'}}}^{{-1}}}}{({c^\ast})}^\ast}`. #. Return :math:`v`. @@ -25292,6 +25505,8 @@ The instruction sequence :math:`(\mathsf{block}~{\mathit{blocktype}}~{{\mathit{i #. Let :math:`{c''}` be :math:`{{\mathsf{extadd\_pairwise}}{\mathsf{\_}}{\mathsf{s}}}{{}_{{{\mathsf{i}}{N}}{\mathsf{x}}{M}, {{{\mathsf{i}}{N}}_2}{\mathsf{x}}{M_2}}({c'})}`. +#. Assert: Due to validation, :math:`{|{\mathsf{add}}{{}_{{{{\mathsf{i}}{N}}_2}{\mathsf{x}}{M_2}}({c''}, c_3)}|} > 0`. + #. Let :math:`c` be an element of :math:`{\mathsf{add}}{{}_{{{{\mathsf{i}}{N}}_2}{\mathsf{x}}{M_2}}({c''}, c_3)}`. #. Return :math:`c`. @@ -25551,63 +25766,95 @@ The instruction sequence :math:`(\mathsf{block}~{\mathit{blocktype}}~{{\mathit{i .................................... -1. Return :math:`f{.}\mathsf{module}{.}\mathsf{types}{}[x]`. +1. Assert: Due to validation, :math:`x < {|f{.}\mathsf{module}{.}\mathsf{types}|}`. + +#. Return :math:`f{.}\mathsf{module}{.}\mathsf{types}{}[x]`. :math:`(s, f){.}\mathsf{tags}{}[x]` ................................... -1. Return :math:`s{.}\mathsf{tags}{}[f{.}\mathsf{module}{.}\mathsf{tags}{}[x]]`. +1. Assert: Due to validation, :math:`f{.}\mathsf{module}{.}\mathsf{tags}{}[x] < {|s{.}\mathsf{tags}|}`. + +#. Assert: Due to validation, :math:`x < {|f{.}\mathsf{module}{.}\mathsf{tags}|}`. + +#. Return :math:`s{.}\mathsf{tags}{}[f{.}\mathsf{module}{.}\mathsf{tags}{}[x]]`. :math:`(s, f){.}\mathsf{globals}{}[x]` ...................................... -1. Return :math:`s{.}\mathsf{globals}{}[f{.}\mathsf{module}{.}\mathsf{globals}{}[x]]`. +1. Assert: Due to validation, :math:`f{.}\mathsf{module}{.}\mathsf{globals}{}[x] < {|s{.}\mathsf{globals}|}`. + +#. Assert: Due to validation, :math:`x < {|f{.}\mathsf{module}{.}\mathsf{globals}|}`. + +#. Return :math:`s{.}\mathsf{globals}{}[f{.}\mathsf{module}{.}\mathsf{globals}{}[x]]`. :math:`(s, f){.}\mathsf{mems}{}[x]` ................................... -1. Return :math:`s{.}\mathsf{mems}{}[f{.}\mathsf{module}{.}\mathsf{mems}{}[x]]`. +1. Assert: Due to validation, :math:`f{.}\mathsf{module}{.}\mathsf{mems}{}[x] < {|s{.}\mathsf{mems}|}`. + +#. Assert: Due to validation, :math:`x < {|f{.}\mathsf{module}{.}\mathsf{mems}|}`. + +#. Return :math:`s{.}\mathsf{mems}{}[f{.}\mathsf{module}{.}\mathsf{mems}{}[x]]`. :math:`(s, f){.}\mathsf{tables}{}[x]` ..................................... -1. Return :math:`s{.}\mathsf{tables}{}[f{.}\mathsf{module}{.}\mathsf{tables}{}[x]]`. +1. Assert: Due to validation, :math:`f{.}\mathsf{module}{.}\mathsf{tables}{}[x] < {|s{.}\mathsf{tables}|}`. + +#. Assert: Due to validation, :math:`x < {|f{.}\mathsf{module}{.}\mathsf{tables}|}`. + +#. Return :math:`s{.}\mathsf{tables}{}[f{.}\mathsf{module}{.}\mathsf{tables}{}[x]]`. :math:`(s, f){.}\mathsf{funcs}{}[x]` .................................... -1. Return :math:`s{.}\mathsf{funcs}{}[f{.}\mathsf{module}{.}\mathsf{funcs}{}[x]]`. +1. Assert: Due to validation, :math:`f{.}\mathsf{module}{.}\mathsf{funcs}{}[x] < {|s{.}\mathsf{funcs}|}`. + +#. Assert: Due to validation, :math:`x < {|f{.}\mathsf{module}{.}\mathsf{funcs}|}`. + +#. Return :math:`s{.}\mathsf{funcs}{}[f{.}\mathsf{module}{.}\mathsf{funcs}{}[x]]`. :math:`(s, f){.}\mathsf{datas}{}[x]` .................................... -1. Return :math:`s{.}\mathsf{datas}{}[f{.}\mathsf{module}{.}\mathsf{datas}{}[x]]`. +1. Assert: Due to validation, :math:`f{.}\mathsf{module}{.}\mathsf{datas}{}[x] < {|s{.}\mathsf{datas}|}`. + +#. Assert: Due to validation, :math:`x < {|f{.}\mathsf{module}{.}\mathsf{datas}|}`. + +#. Return :math:`s{.}\mathsf{datas}{}[f{.}\mathsf{module}{.}\mathsf{datas}{}[x]]`. :math:`(s, f){.}\mathsf{elems}{}[x]` .................................... -1. Return :math:`s{.}\mathsf{elems}{}[f{.}\mathsf{module}{.}\mathsf{elems}{}[x]]`. +1. Assert: Due to validation, :math:`f{.}\mathsf{module}{.}\mathsf{elems}{}[x] < {|s{.}\mathsf{elems}|}`. + +#. Assert: Due to validation, :math:`x < {|f{.}\mathsf{module}{.}\mathsf{elems}|}`. + +#. Return :math:`s{.}\mathsf{elems}{}[f{.}\mathsf{module}{.}\mathsf{elems}{}[x]]`. :math:`(s, f){.}\mathsf{locals}{}[x]` ..................................... -1. Return :math:`f{.}\mathsf{locals}{}[x]`. +1. Assert: Due to validation, :math:`x < {|f{.}\mathsf{locals}|}`. + +#. Return :math:`f{.}\mathsf{locals}{}[x]`. :math:`(s, f){}[{.}\mathsf{locals}{}[x] = v]` @@ -25621,49 +25868,63 @@ The instruction sequence :math:`(\mathsf{block}~{\mathit{blocktype}}~{{\mathit{i ............................................................... -1. Replace :math:`s{.}\mathsf{globals}{}[f{.}\mathsf{module}{.}\mathsf{globals}{}[x]]{.}\mathsf{value}` with :math:`v`. +1. Assert: Due to validation, :math:`x < {|f{.}\mathsf{module}{.}\mathsf{globals}|}`. + +#. Replace :math:`s{.}\mathsf{globals}{}[f{.}\mathsf{module}{.}\mathsf{globals}{}[x]]{.}\mathsf{value}` with :math:`v`. :math:`(s, f){}[{.}\mathsf{tables}{}[x]{.}\mathsf{refs}{}[i] = r]` .................................................................. -1. Replace :math:`s{.}\mathsf{tables}{}[f{.}\mathsf{module}{.}\mathsf{tables}{}[x]]{.}\mathsf{refs}{}[i]` with :math:`r`. +1. Assert: Due to validation, :math:`x < {|f{.}\mathsf{module}{.}\mathsf{tables}|}`. + +#. Replace :math:`s{.}\mathsf{tables}{}[f{.}\mathsf{module}{.}\mathsf{tables}{}[x]]{.}\mathsf{refs}{}[i]` with :math:`r`. :math:`(s, f){}[{.}\mathsf{tables}{}[x] = {\mathit{ti}}]` ......................................................... -1. Replace :math:`s{.}\mathsf{tables}{}[f{.}\mathsf{module}{.}\mathsf{tables}{}[x]]` with :math:`{\mathit{ti}}`. +1. Assert: Due to validation, :math:`x < {|f{.}\mathsf{module}{.}\mathsf{tables}|}`. + +#. Replace :math:`s{.}\mathsf{tables}{}[f{.}\mathsf{module}{.}\mathsf{tables}{}[x]]` with :math:`{\mathit{ti}}`. :math:`(s, f){}[{.}\mathsf{mems}{}[x]{.}\mathsf{bytes}{}[i : j] = {b^\ast}]` ............................................................................ -1. Replace :math:`s{.}\mathsf{mems}{}[f{.}\mathsf{module}{.}\mathsf{mems}{}[x]]{.}\mathsf{bytes}{}[i : j]` with :math:`{b^\ast}`. +1. Assert: Due to validation, :math:`x < {|f{.}\mathsf{module}{.}\mathsf{mems}|}`. + +#. Replace :math:`s{.}\mathsf{mems}{}[f{.}\mathsf{module}{.}\mathsf{mems}{}[x]]{.}\mathsf{bytes}{}[i : j]` with :math:`{b^\ast}`. :math:`(s, f){}[{.}\mathsf{mems}{}[x] = {\mathit{mi}}]` ....................................................... -1. Replace :math:`s{.}\mathsf{mems}{}[f{.}\mathsf{module}{.}\mathsf{mems}{}[x]]` with :math:`{\mathit{mi}}`. +1. Assert: Due to validation, :math:`x < {|f{.}\mathsf{module}{.}\mathsf{mems}|}`. + +#. Replace :math:`s{.}\mathsf{mems}{}[f{.}\mathsf{module}{.}\mathsf{mems}{}[x]]` with :math:`{\mathit{mi}}`. :math:`(s, f){}[{.}\mathsf{elems}{}[x]{.}\mathsf{refs} = {r^\ast}]` ................................................................... -1. Replace :math:`s{.}\mathsf{elems}{}[f{.}\mathsf{module}{.}\mathsf{elems}{}[x]]{.}\mathsf{refs}` with :math:`{r^\ast}`. +1. Assert: Due to validation, :math:`x < {|f{.}\mathsf{module}{.}\mathsf{elems}|}`. + +#. Replace :math:`s{.}\mathsf{elems}{}[f{.}\mathsf{module}{.}\mathsf{elems}{}[x]]{.}\mathsf{refs}` with :math:`{r^\ast}`. :math:`(s, f){}[{.}\mathsf{datas}{}[x]{.}\mathsf{bytes} = {b^\ast}]` .................................................................... -1. Replace :math:`s{.}\mathsf{datas}{}[f{.}\mathsf{module}{.}\mathsf{datas}{}[x]]{.}\mathsf{bytes}` with :math:`{b^\ast}`. +1. Assert: Due to validation, :math:`x < {|f{.}\mathsf{module}{.}\mathsf{datas}|}`. + +#. Replace :math:`s{.}\mathsf{datas}{}[f{.}\mathsf{module}{.}\mathsf{datas}{}[x]]{.}\mathsf{bytes}` with :math:`{b^\ast}`. :math:`(s, f){}[{.}\mathsf{structs}{}[a]{.}\mathsf{fields}{}[i] = {\mathit{fv}}]` @@ -26086,30 +26347,40 @@ The instruction sequence :math:`(\mathsf{block}~{\mathit{blocktype}}~{{\mathit{i a. Let :math:`(\mathsf{tag}~x)` be the destructuring of :math:`{\mathit{externidx}}`. - #. Return :math:`\{ \mathsf{name}~{\mathit{name}},\;\allowbreak \mathsf{addr}~(\mathsf{tag}~{\mathit{moduleinst}}{.}\mathsf{tags}{}[x]) \}`. + #. If :math:`x < {|{\mathit{moduleinst}}{.}\mathsf{tags}|}`, then: + + 1) Return :math:`\{ \mathsf{name}~{\mathit{name}},\;\allowbreak \mathsf{addr}~(\mathsf{tag}~{\mathit{moduleinst}}{.}\mathsf{tags}{}[x]) \}`. #. If :math:`{\mathit{externidx}}` is some :math:`\mathsf{global}~{\mathit{globalidx}}`, then: a. Let :math:`(\mathsf{global}~x)` be the destructuring of :math:`{\mathit{externidx}}`. - #. Return :math:`\{ \mathsf{name}~{\mathit{name}},\;\allowbreak \mathsf{addr}~(\mathsf{global}~{\mathit{moduleinst}}{.}\mathsf{globals}{}[x]) \}`. + #. If :math:`x < {|{\mathit{moduleinst}}{.}\mathsf{globals}|}`, then: + + 1) Return :math:`\{ \mathsf{name}~{\mathit{name}},\;\allowbreak \mathsf{addr}~(\mathsf{global}~{\mathit{moduleinst}}{.}\mathsf{globals}{}[x]) \}`. #. If :math:`{\mathit{externidx}}` is some :math:`\mathsf{mem}~{\mathit{memidx}}`, then: a. Let :math:`(\mathsf{mem}~x)` be the destructuring of :math:`{\mathit{externidx}}`. - #. Return :math:`\{ \mathsf{name}~{\mathit{name}},\;\allowbreak \mathsf{addr}~(\mathsf{mem}~{\mathit{moduleinst}}{.}\mathsf{mems}{}[x]) \}`. + #. If :math:`x < {|{\mathit{moduleinst}}{.}\mathsf{mems}|}`, then: + + 1) Return :math:`\{ \mathsf{name}~{\mathit{name}},\;\allowbreak \mathsf{addr}~(\mathsf{mem}~{\mathit{moduleinst}}{.}\mathsf{mems}{}[x]) \}`. #. If :math:`{\mathit{externidx}}` is some :math:`\mathsf{table}~{\mathit{tableidx}}`, then: a. Let :math:`(\mathsf{table}~x)` be the destructuring of :math:`{\mathit{externidx}}`. - #. Return :math:`\{ \mathsf{name}~{\mathit{name}},\;\allowbreak \mathsf{addr}~(\mathsf{table}~{\mathit{moduleinst}}{.}\mathsf{tables}{}[x]) \}`. + #. If :math:`x < {|{\mathit{moduleinst}}{.}\mathsf{tables}|}`, then: + + 1) Return :math:`\{ \mathsf{name}~{\mathit{name}},\;\allowbreak \mathsf{addr}~(\mathsf{table}~{\mathit{moduleinst}}{.}\mathsf{tables}{}[x]) \}`. #. Assert: Due to validation, :math:`{\mathit{externidx}}` is some :math:`\mathsf{func}~{\mathit{funcidx}}`. #. Let :math:`(\mathsf{func}~x)` be the destructuring of :math:`{\mathit{externidx}}`. +#. Assert: Due to validation, :math:`x < {|{\mathit{moduleinst}}{.}\mathsf{funcs}|}`. + #. Return :math:`\{ \mathsf{name}~{\mathit{name}},\;\allowbreak \mathsf{addr}~(\mathsf{func}~{\mathit{moduleinst}}{.}\mathsf{funcs}{}[x]) \}`. @@ -26204,6 +26475,8 @@ The instruction sequence :math:`(\mathsf{block}~{\mathit{blocktype}}~{{\mathit{i #. Append :math:`x` to :math:`{x^\ast}`. +#. Assert: Due to validation, :math:`{(x < {|{{\mathit{dt}}^\ast}|})^\ast}`. + #. Let :math:`{{\mathit{aa}}^\ast}` be :math:`\epsilon`. #. For each :math:`{\mathit{tagtype}}` in :math:`{{\mathit{tagtype}}^\ast}`, do: @@ -26352,6 +26625,12 @@ The instruction sequence :math:`(\mathsf{block}~{\mathit{blocktype}}~{{\mathit{i #. Let :math:`(\mathsf{module}~{{\mathit{type}}^\ast}~{{\mathit{import}}^\ast}~{{\mathit{tag}}^\ast}~{{\mathit{global}}^\ast}~{{\mathit{mem}}^\ast}~{{\mathit{table}}^\ast}~{{\mathit{func}}^\ast}~{{\mathit{data}}^\ast}~{{\mathit{elem}}^\ast}~{{\mathit{start}}^?}~{{\mathit{export}}^\ast})` be the destructuring of :math:`{\mathit{module}}`. +#. Assert: Due to validation, :math:`{|{{\mathit{externaddr}}^\ast}|} = {|{{\mathit{xt}}_{\mathsf{i}}^\ast}|}`. + +#. Assert: Due to validation, :math:`{(i_{\mathsf{d}} < {|{{\mathit{data}}^\ast}|})^{i_{\mathsf{d}}<{|{{\mathit{data}}^\ast}|}}}`. + +#. Assert: Due to validation, :math:`{(i_{\mathsf{e}} < {|{{\mathit{elem}}^\ast}|})^{i_{\mathsf{e}}<{|{{\mathit{elem}}^\ast}|}}}`. + #. If :math:`{|{{\mathit{externaddr}}^\ast}|} \neq {|{{\mathit{xt}}_{\mathsf{i}}^\ast}|}`, then: a. Fail. @@ -26366,6 +26645,8 @@ The instruction sequence :math:`(\mathsf{block}~{\mathit{blocktype}}~{{\mathit{i #. Let :math:`{{\mathit{instr}}_{\mathsf{e}}^\ast}` be the :ref:`concatenation ` of :math:`{{{\mathrm{runelem}}}_{i_{\mathsf{e}}}({{\mathit{elem}}^\ast}{}[i_{\mathsf{e}}])^{i_{\mathsf{e}}<{|{{\mathit{elem}}^\ast}|}}}`. +#. Let :math:`{(\mathsf{start}~x)^?}` be :math:`{{\mathit{start}}^?}`. + #. Let :math:`{\mathit{moduleinst}}_0` be the module instance :math:`\{ \mathsf{types}~{{{\mathrm{alloctype}}^\ast}}{({{\mathit{type}}^\ast})},\;\allowbreak \mathsf{globals}~{\mathrm{globals}}({{\mathit{externaddr}}^\ast}),\;\allowbreak \mathsf{funcs}~{\mathrm{funcs}}({{\mathit{externaddr}}^\ast})~{({|s{.}\mathsf{funcs}|} + i_{\mathsf{f}})^{i_{\mathsf{f}}<{|{{\mathit{func}}^\ast}|}}} \}`. #. Let :math:`{{\mathit{expr}}_{\mathsf{t}}^\ast}` be the expression sequence :math:`\epsilon`. @@ -26396,6 +26677,8 @@ The instruction sequence :math:`(\mathsf{block}~{\mathit{blocktype}}~{{\mathit{i #. Append :math:`{{\mathit{expr}}_{\mathsf{e}}^\ast}` to :math:`{{{\mathit{expr}}_{\mathsf{e}}^\ast}^\ast}`. +#. Let :math:`{{\mathit{instr}}_{\mathsf{s}}^?}` be :math:`{(\mathsf{call}~x)^?}`. + #. Let :math:`z` be the state :math:`(s, \{ \mathsf{module}~{\mathit{moduleinst}}_0 \})`. #. Let :math:`F` be the :math:`\mathsf{frame}` :math:`z{.}\mathsf{frame}`. @@ -26428,6 +26711,12 @@ The instruction sequence :math:`(\mathsf{block}~{\mathit{blocktype}}~{{\mathit{i #. Pop the :math:`\mathsf{frame}` from the stack. +#. Assert: Due to validation, :math:`{|{{\mathit{expr}}_{\mathsf{t}}^\ast}|} = {|{{\mathit{ref}}_{\mathsf{t}}^\ast}|}`. + +#. Assert: Due to validation, :math:`{|{{{\mathit{expr}}_{\mathsf{e}}^\ast}^\ast}|} = {|{{{\mathit{ref}}_{\mathsf{e}}^\ast}^\ast}|}`. + +#. Assert: Due to validation, :math:`{({|{{\mathit{expr}}_{\mathsf{e}}^\ast}|} = {|{{\mathit{ref}}_{\mathsf{e}}^\ast}|})^\ast}`. + #. Let :math:`{\mathit{moduleinst}}` be :math:`{\mathrm{allocmodule}}(s, {\mathit{module}}, {{\mathit{externaddr}}^\ast}, {{\mathit{val}}_{\mathsf{g}}^\ast}, {{\mathit{ref}}_{\mathsf{t}}^\ast}, {{{\mathit{ref}}_{\mathsf{e}}^\ast}^\ast})`. #. Let :math:`{F'}` be the :math:`\mathsf{frame}` :math:`\{ \mathsf{module}~{\mathit{moduleinst}} \}`. @@ -26438,13 +26727,11 @@ The instruction sequence :math:`(\mathsf{block}~{\mathit{blocktype}}~{{\mathit{i #. Execute the sequence :math:`{{\mathit{instr}}_{\mathsf{d}}^\ast}`. -#. If :math:`{{\mathit{start}}^?}` is defined, then: - - a. Let :math:`(\mathsf{start}~x)` be :math:`{{\mathit{start}}^?}`. +#. If :math:`{{\mathit{instr}}_{\mathsf{s}}^?}` is defined, then: - #. Let :math:`{\mathit{instr}}_{\mathsf{s}}` be the instruction :math:`(\mathsf{call}~x)`. + a. Let :math:`{\mathit{instr}}_0` be :math:`{{\mathit{instr}}_{\mathsf{s}}^?}`. - #. Execute the instruction :math:`{\mathit{instr}}_{\mathsf{s}}`. + #. Execute the instruction :math:`{\mathit{instr}}_0`. #. Pop the :math:`\mathsf{frame}` from the stack. @@ -26455,10 +26742,14 @@ The instruction sequence :math:`(\mathsf{block}~{\mathit{blocktype}}~{{\mathit{i ........................................................................ -1. Assert: Due to validation, the :ref:`expansion ` of :math:`s{.}\mathsf{funcs}{}[{\mathit{funcaddr}}]{.}\mathsf{type}` is some :math:`\mathsf{func}~{\mathit{resulttype}} \rightarrow {\mathit{resulttype}}`. +1. Assert: Due to validation, :math:`{\mathit{funcaddr}} < {|s{.}\mathsf{funcs}|}`. + +#. Assert: Due to validation, the :ref:`expansion ` of :math:`s{.}\mathsf{funcs}{}[{\mathit{funcaddr}}]{.}\mathsf{type}` is some :math:`\mathsf{func}~{\mathit{resulttype}} \rightarrow {\mathit{resulttype}}`. #. Let :math:`(\mathsf{func}~{t_1^\ast}~\rightarrow~{t_2^\ast})` be the destructuring of the :ref:`expansion ` of :math:`s{.}\mathsf{funcs}{}[{\mathit{funcaddr}}]{.}\mathsf{type}`. +#. Assert: Due to validation, :math:`{|{t_1^\ast}|} = {|{{\mathit{val}}^\ast}|}`. + #. If :math:`{|{t_1^\ast}|} \neq {|{{\mathit{val}}^\ast}|}`, then: a. Fail. @@ -30327,7 +30618,8 @@ disjoint_ `X X* 1. If (X* = []), then: a. Return true. 2. Let [w] :: w'* be X*. -3. Return (w is not contained in w'* /\ $disjoint_(`X, w'*)). +3. Assert: Due to validation, (|w'*| > 0). +4. Return (w is not contained in w'* /\ $disjoint_(`X, w'*)). setminus1_ `X w X* 1. If (X* = []), then: @@ -30922,7 +31214,8 @@ rolldt x rectype unrolldt (_DEF rectype i) 1. Let (REC subtype*) be $unrollrt(rectype). -2. Return subtype*[i]. +2. Assert: Due to validation, (i < |subtype*|). +3. Return subtype*[i]. expanddt deftype 1. Let (SUB final? typeuse* comptype) be $unrolldt(deftype). @@ -31507,10 +31800,12 @@ unrollht C heaptype a. Return $unrolldt(heaptype). 2. If heaptype is some _IDX, then: a. Let (_IDX typeidx) be heaptype. - b. Return $unrolldt(C.TYPES[typeidx]). + b. If (typeidx < |C.TYPES|), then: + 1) Return $unrolldt(C.TYPES[typeidx]). 3. Assert: Due to validation, heaptype is some REC. 4. Let (REC i) be heaptype. -5. Return C.RECS[i]. +5. Assert: Due to validation, (i < |C.RECS|). +6. Return C.RECS[i]. default_ valtype 1. If valtype is addrtype, then: @@ -31533,14 +31828,18 @@ funcidx_nonfuncs (global* mem* table* elem*) 1. Return $funcidx_module((MODULE [] [] [] global* mem* table* [] [] elem* ?() [])). relaxed2 i `X X_1 X_2 -1. If $ND(), then: +1. If (i >= |[X_1, X_2]|), then: + a. Return [X_1, X_2][0]. +2. If $ND(), then: a. Return [X_1, X_2][i]. -2. Return [X_1, X_2][0]. +3. Return [X_1, X_2][0]. relaxed4 i `X X_1 X_2 X_3 X_4 -1. If $ND(), then: +1. If (i >= |[X_1, X_2, X_3, X_4]|), then: + a. Return [X_1, X_2, X_3, X_4][0]. +2. If $ND(), then: a. Return [X_1, X_2, X_3, X_4][i]. -2. Return [X_1, X_2, X_3, X_4][0]. +3. Return [X_1, X_2, X_3, X_4][0]. signed_ N i 1. If (i < (2 ^ (N - 1))), then: @@ -31921,7 +32220,8 @@ irelaxed_swizzle_lane_ N c* i a. Return c*[i]. 2. If ($signed_(N, i) < 0), then: a. Return 0. -3. Return $relaxed2($R_swizzle(), `iN(N), 0, c*[(i \ |c*|)]). +3. Assert: Due to validation, ((i \ |c*|) < |c*|). +4. Return $relaxed2($R_swizzle(), `iN(N), 0, c*[(i \ |c*|)]). ivunop_ Jnn X M $f_ v_1 1. Let c_1* be $lanes_(Jnn X M, v_1). @@ -32057,11 +32357,12 @@ ivswizzlop_ Jnn X M $f_ v_1 v_2 ivshufflop_ Jnn X M i* v_1 v_2 1. Let c_1* be $lanes_(Jnn X M, v_1). 2. Let c_2* be $lanes_(Jnn X M, v_2). -3. Let c* be []. -4. For each i in i*, do: +3. Assert: Due to validation, (i < |c_1* :: c_2*|)*. +4. Let c* be []. +5. For each i in i*, do: a. Let c be c_1* :: c_2*[i]. b. Append c to the c*. -5. Return $inv_lanes_(Jnn X M, c*). +6. Return $inv_lanes_(Jnn X M, c*). vvunop_ Vnn NOT v 1. Return [$inot_($vsizenn(Vnn), v)]. @@ -32227,19 +32528,22 @@ vcvtop__ Lnn_1 X M Lnn_2 X M' vcvtop v_1 1. If ((M = M') /\ ($halfop(Lnn_1 X M', Lnn_2 X M', vcvtop) is not defined /\ $zeroop(Lnn_1 X M', Lnn_2 X M', vcvtop) is not defined)), then: a. Let c_1* be $lanes_(Lnn_1 X M', v_1). b. Let c** be $setproduct_(`lane_(Lnn_2), $lcvtop__(Lnn_1 X M', Lnn_2 X M', vcvtop, c_1)*). - c. Let v be an element of $inv_lanes_(Lnn_2 X M', c*)*. - d. Return v. + c. If (|$inv_lanes_(Lnn_2 X M', c*)*| > 0), then: + 1) Let v be an element of $inv_lanes_(Lnn_2 X M', c*)*. + 2) Return v. 2. If $halfop(Lnn_1 X M, Lnn_2 X M', vcvtop) is defined, then: a. Let ?(half) be $halfop(Lnn_1 X M, Lnn_2 X M', vcvtop). b. Let c_1* be $lanes_(Lnn_1 X M, v_1)[$half(half, 0, M') : M']. c. Let c** be $setproduct_(`lane_(Lnn_2), $lcvtop__(Lnn_1 X M, Lnn_2 X M', vcvtop, c_1)*). - d. Let v be an element of $inv_lanes_(Lnn_2 X M', c*)*. - e. Return v. + d. If (|$inv_lanes_(Lnn_2 X M', c*)*| > 0), then: + 1) Let v be an element of $inv_lanes_(Lnn_2 X M', c*)*. + 2) Return v. 3. Assert: Due to validation, ($zeroop(Lnn_1 X M, Lnn_2 X M', vcvtop) = ?(ZERO)). 4. Let c_1* be $lanes_(Lnn_1 X M, v_1). 5. Let c** be $setproduct_(`lane_(Lnn_2), $lcvtop__(Lnn_1 X M, Lnn_2 X M', vcvtop, c_1)* :: [$zero(Lnn_2)]^M). -6. Let v be an element of $inv_lanes_(Lnn_2 X M', c*)*. -7. Return v. +6. Assert: Due to validation, (|$inv_lanes_(Lnn_2 X M', c*)*| > 0). +7. Let v be an element of $inv_lanes_(Lnn_2 X M', c*)*. +8. Return v. vshiftop_ Jnn X M vshiftop_ v i 1. If (vshiftop_ = SHL), then: @@ -32329,8 +32633,9 @@ vextternop__ Jnn_1 X M_1 Jnn_2 X M_2 RELAXED_DOT_ADDS c_1 c_2 c_3 2. Let Jnn be $jsizenn^-1((2 * $lsizenn1(Jnn_1))). 3. Let c' be $vextbinop__(Jnn_1 X M_1, Jnn X M, RELAXED_DOTS, c_1, c_2). 4. Let c'' be $vextunop__(Jnn X M, Jnn_2 X M_2, (EXTADD_PAIRWISE S), c'). -5. Let c be an element of $vbinop_(Jnn_2 X M_2, ADD, c'', c_3). -6. Return c. +5. Assert: Due to validation, (|$vbinop_(Jnn_2 X M_2, ADD, c'', c_3)| > 0). +6. Let c be an element of $vbinop_(Jnn_2 X M_2, ADD, c'', c_3). +7. Return c. Ki 1. Return 1024. @@ -32447,55 +32752,78 @@ exninst (s, f) 1. Return s.EXNS. type (s, f) x -1. Return f.MODULE.TYPES[x]. +1. Assert: Due to validation, (x < |f.MODULE.TYPES|). +2. Return f.MODULE.TYPES[x]. tag (s, f) x -1. Return s.TAGS[f.MODULE.TAGS[x]]. +1. Assert: Due to validation, (f.MODULE.TAGS[x] < |s.TAGS|). +2. Assert: Due to validation, (x < |f.MODULE.TAGS|). +3. Return s.TAGS[f.MODULE.TAGS[x]]. global (s, f) x -1. Return s.GLOBALS[f.MODULE.GLOBALS[x]]. +1. Assert: Due to validation, (f.MODULE.GLOBALS[x] < |s.GLOBALS|). +2. Assert: Due to validation, (x < |f.MODULE.GLOBALS|). +3. Return s.GLOBALS[f.MODULE.GLOBALS[x]]. mem (s, f) x -1. Return s.MEMS[f.MODULE.MEMS[x]]. +1. Assert: Due to validation, (f.MODULE.MEMS[x] < |s.MEMS|). +2. Assert: Due to validation, (x < |f.MODULE.MEMS|). +3. Return s.MEMS[f.MODULE.MEMS[x]]. table (s, f) x -1. Return s.TABLES[f.MODULE.TABLES[x]]. +1. Assert: Due to validation, (f.MODULE.TABLES[x] < |s.TABLES|). +2. Assert: Due to validation, (x < |f.MODULE.TABLES|). +3. Return s.TABLES[f.MODULE.TABLES[x]]. func (s, f) x -1. Return s.FUNCS[f.MODULE.FUNCS[x]]. +1. Assert: Due to validation, (f.MODULE.FUNCS[x] < |s.FUNCS|). +2. Assert: Due to validation, (x < |f.MODULE.FUNCS|). +3. Return s.FUNCS[f.MODULE.FUNCS[x]]. data (s, f) x -1. Return s.DATAS[f.MODULE.DATAS[x]]. +1. Assert: Due to validation, (f.MODULE.DATAS[x] < |s.DATAS|). +2. Assert: Due to validation, (x < |f.MODULE.DATAS|). +3. Return s.DATAS[f.MODULE.DATAS[x]]. elem (s, f) x -1. Return s.ELEMS[f.MODULE.ELEMS[x]]. +1. Assert: Due to validation, (f.MODULE.ELEMS[x] < |s.ELEMS|). +2. Assert: Due to validation, (x < |f.MODULE.ELEMS|). +3. Return s.ELEMS[f.MODULE.ELEMS[x]]. local (s, f) x -1. Return f.LOCALS[x]. +1. Assert: Due to validation, (x < |f.LOCALS|). +2. Return f.LOCALS[x]. with_local (s, f) x v 1. Replace f.LOCALS[x] with ?(v). with_global (s, f) x v -1. Replace s.GLOBALS[f.MODULE.GLOBALS[x]].VALUE with v. +1. Assert: Due to validation, (x < |f.MODULE.GLOBALS|). +2. Replace s.GLOBALS[f.MODULE.GLOBALS[x]].VALUE with v. with_table (s, f) x i r -1. Replace s.TABLES[f.MODULE.TABLES[x]].REFS[i] with r. +1. Assert: Due to validation, (x < |f.MODULE.TABLES|). +2. Replace s.TABLES[f.MODULE.TABLES[x]].REFS[i] with r. with_tableinst (s, f) x ti -1. Replace s.TABLES[f.MODULE.TABLES[x]] with ti. +1. Assert: Due to validation, (x < |f.MODULE.TABLES|). +2. Replace s.TABLES[f.MODULE.TABLES[x]] with ti. with_mem (s, f) x i j b* -1. Replace s.MEMS[f.MODULE.MEMS[x]].BYTES[i : j] with b*. +1. Assert: Due to validation, (x < |f.MODULE.MEMS|). +2. Replace s.MEMS[f.MODULE.MEMS[x]].BYTES[i : j] with b*. with_meminst (s, f) x mi -1. Replace s.MEMS[f.MODULE.MEMS[x]] with mi. +1. Assert: Due to validation, (x < |f.MODULE.MEMS|). +2. Replace s.MEMS[f.MODULE.MEMS[x]] with mi. with_elem (s, f) x r* -1. Replace s.ELEMS[f.MODULE.ELEMS[x]].REFS with r*. +1. Assert: Due to validation, (x < |f.MODULE.ELEMS|). +2. Replace s.ELEMS[f.MODULE.ELEMS[x]].REFS with r*. with_data (s, f) x b* -1. Replace s.DATAS[f.MODULE.DATAS[x]].BYTES with b*. +1. Assert: Due to validation, (x < |f.MODULE.DATAS|). +2. Replace s.DATAS[f.MODULE.DATAS[x]].BYTES with b*. with_struct (s, f) a i fv 1. Replace s.STRUCTS[a].FIELDS[i] with fv. @@ -32692,19 +33020,24 @@ allocelems s elemtype* ref''* allocexport moduleinst (EXPORT name externidx) 1. If externidx is some TAG, then: a. Let (TAG x) be externidx. - b. Return { NAME: name; ADDR: (TAG moduleinst.TAGS[x]) }. + b. If (x < |moduleinst.TAGS|), then: + 1) Return { NAME: name; ADDR: (TAG moduleinst.TAGS[x]) }. 2. If externidx is some GLOBAL, then: a. Let (GLOBAL x) be externidx. - b. Return { NAME: name; ADDR: (GLOBAL moduleinst.GLOBALS[x]) }. + b. If (x < |moduleinst.GLOBALS|), then: + 1) Return { NAME: name; ADDR: (GLOBAL moduleinst.GLOBALS[x]) }. 3. If externidx is some MEM, then: a. Let (MEM x) be externidx. - b. Return { NAME: name; ADDR: (MEM moduleinst.MEMS[x]) }. + b. If (x < |moduleinst.MEMS|), then: + 1) Return { NAME: name; ADDR: (MEM moduleinst.MEMS[x]) }. 4. If externidx is some TABLE, then: a. Let (TABLE x) be externidx. - b. Return { NAME: name; ADDR: (TABLE moduleinst.TABLES[x]) }. + b. If (x < |moduleinst.TABLES|), then: + 1) Return { NAME: name; ADDR: (TABLE moduleinst.TABLES[x]) }. 5. Assert: Due to validation, externidx is some FUNC. 6. Let (FUNC x) be externidx. -7. Return { NAME: name; ADDR: (FUNC moduleinst.FUNCS[x]) }. +7. Assert: Due to validation, (x < |moduleinst.FUNCS|). +8. Return { NAME: name; ADDR: (FUNC moduleinst.FUNCS[x]) }. allocexports moduleinst export* 1. Return $allocexport(moduleinst, export)*. @@ -32750,41 +33083,42 @@ allocmodule s module externaddr* val_G* ref_T* ref_E** b. Append expr_F to the expr_F*. c. Append local* to the local**. d. Append x to the x*. -25. Let aa* be []. -26. For each tagtype in tagtype*, do: +25. Assert: Due to validation, (x < |dt*|)*. +26. Let aa* be []. +27. For each tagtype in tagtype*, do: a. Let aa be $alloctag(s, $subst_all_tagtype(tagtype, dt*)). b. Append aa to the aa*. -27. Let ga* be []. -28. For each globaltype in globaltype* and val_G in val_G*, do: +28. Let ga* be []. +29. For each globaltype in globaltype* and val_G in val_G*, do: a. Let ga be $allocglobal(s, $subst_all_globaltype(globaltype, dt*), val_G). b. Append ga to the ga*. -29. Let ma* be []. -30. For each memtype in memtype*, do: +30. Let ma* be []. +31. For each memtype in memtype*, do: a. Let ma be $allocmem(s, $subst_all_memtype(memtype, dt*)). b. Append ma to the ma*. -31. Let ta* be []. -32. For each tabletype in tabletype* and ref_T in ref_T*, do: +32. Let ta* be []. +33. For each tabletype in tabletype* and ref_T in ref_T*, do: a. Let ta be $alloctable(s, $subst_all_tabletype(tabletype, dt*), ref_T). b. Append ta to the ta*. -33. Let xi* be []. -34. For each export in export*, do: +34. Let xi* be []. +35. For each export in export*, do: a. Let xi be $allocexport({ TAGS: aa_I* :: aa*; GLOBALS: ga_I* :: ga*; MEMS: ma_I* :: ma*; TABLES: ta_I* :: ta*; FUNCS: fa_I* :: fa* }, export). b. Append xi to the xi*. -35. Let da* be []. -36. For each byte* in byte**, do: +36. Let da* be []. +37. For each byte* in byte**, do: a. Let da be $allocdata(s, OK, byte*). b. Append da to the da*. -37. Let ea* be []. -38. For each elemtype in elemtype* and ref_E* in ref_E**, do: +38. Let ea* be []. +39. For each elemtype in elemtype* and ref_E* in ref_E**, do: a. Let ea be $allocelem(s, $subst_all_reftype(elemtype, dt*), ref_E*). b. Append ea to the ea*. -39. Let moduleinst be { TYPES: dt*; TAGS: aa_I* :: aa*; GLOBALS: ga_I* :: ga*; MEMS: ma_I* :: ma*; TABLES: ta_I* :: ta*; FUNCS: fa_I* :: fa*; DATAS: da*; ELEMS: ea*; EXPORTS: xi* }. -40. Let funcaddr_0* be []. -41. For each expr_F in expr_F* and local* in local** and x in x*, do: +40. Let moduleinst be { TYPES: dt*; TAGS: aa_I* :: aa*; GLOBALS: ga_I* :: ga*; MEMS: ma_I* :: ma*; TABLES: ta_I* :: ta*; FUNCS: fa_I* :: fa*; DATAS: da*; ELEMS: ea*; EXPORTS: xi* }. +41. Let funcaddr_0* be []. +42. For each expr_F in expr_F* and local* in local** and x in x*, do: a. Let funcaddr_0 be $allocfunc(s, dt*[x], (FUNC x local* expr_F), moduleinst). b. Append funcaddr_0 to the funcaddr_0*. -42. Assert: Due to validation, (funcaddr_0* = fa*). -43. Return moduleinst. +43. Assert: Due to validation, (funcaddr_0* = fa*). +44. Return moduleinst. rundata_ x (DATA b^n datamode) 1. If (datamode = PASSIVE), then: @@ -32820,64 +33154,73 @@ evalglobals z globaltype* expr''* instantiate s module externaddr* 1. Let xt_I* -> xt_E* be $Module_ok(module). 2. Let (MODULE type* import* tag* global* mem* table* func* data* elem* start? export*) be module. -3. If not $Externaddr_ok(externaddr, xt_I)*, then: +3. Assert: Due to validation, (|externaddr*| = |xt_I*|). +4. Assert: Due to validation, (i_D < |data*|)^(i_D<|data*|). +5. Assert: Due to validation, (i_E < |elem*|)^(i_E<|elem*|). +6. If not $Externaddr_ok(externaddr, xt_I)*, then: a. Fail. -4. Let instr_D* be $concat_(`instr, $rundata_(i_D, data*[i_D])^(i_D<|data*|)). -5. Let instr_E* be $concat_(`instr, $runelem_(i_E, elem*[i_E])^(i_E<|elem*|)). -6. Let moduleinst_0 be { TYPES: $alloctypes(type*); GLOBALS: $globalsxa(externaddr*); FUNCS: $funcsxa(externaddr*) :: (|s.FUNCS| + i_F)^(i_F<|func*|) }. -7. Let expr_T* be []. -8. For each table in table*, do: +7. Let instr_D* be $concat_(`instr, $rundata_(i_D, data*[i_D])^(i_D<|data*|)). +8. Let instr_E* be $concat_(`instr, $runelem_(i_E, elem*[i_E])^(i_E<|elem*|)). +9. Let (START x)? be start?. +10. Let moduleinst_0 be { TYPES: $alloctypes(type*); GLOBALS: $globalsxa(externaddr*); FUNCS: $funcsxa(externaddr*) :: (|s.FUNCS| + i_F)^(i_F<|func*|) }. +11. Let expr_T* be []. +12. For each table in table*, do: a. Let (TABLE tabletype expr_T) be table. b. Append expr_T to the expr_T*. -9. Let expr_G* be []. -10. Let globaltype* be []. -11. For each global in global*, do: +13. Let expr_G* be []. +14. Let globaltype* be []. +15. For each global in global*, do: a. Let (GLOBAL globaltype expr_G) be global. b. Append expr_G to the expr_G*. c. Append globaltype to the globaltype*. -12. Let expr_E** be []. -13. For each elem in elem*, do: +16. Let expr_E** be []. +17. For each elem in elem*, do: a. Let (ELEM reftype expr_E* elemmode) be elem. b. Append expr_E* to the expr_E**. -14. Let z be (s, { MODULE: moduleinst_0 }). -15. Push the frame (FRAME_ 0 { $frame(z) }) to the stack. -16. Let val_G* be $evalglobals(z, globaltype*, expr_G*). -17. Let ref_T* be []. -18. For each expr_T in expr_T*, do: +18. Let instr_S? be (CALL x)?. +19. Let z be (s, { MODULE: moduleinst_0 }). +20. Push the frame (FRAME_ 0 { $frame(z) }) to the stack. +21. Let val_G* be $evalglobals(z, globaltype*, expr_G*). +22. Let ref_T* be []. +23. For each expr_T in expr_T*, do: a. Let [ref_T] be $Eval_expr(z, expr_T). b. Append ref_T to the ref_T*. -19. Let ref_E** be []. -20. For each expr_E* in expr_E**, do: +24. Let ref_E** be []. +25. For each expr_E* in expr_E**, do: a. Let ref_E* be []. b. For each expr_E in expr_E*, do: 1) Let [ref_E] be $Eval_expr(z, expr_E). 2) Append ref_E to the ref_E*. c. Append ref_E* to the ref_E**. -21. Pop the frame (FRAME_ 0 { f }) from the stack. -22. Let moduleinst be $allocmodule(s, module, externaddr*, val_G*, ref_T*, ref_E**). -23. Push the frame (FRAME_ 0 { { MODULE: moduleinst } }) to the stack. -24. Execute the sequence instr_E*. -25. Execute the sequence instr_D*. -26. If start? is defined, then: - a. Let ?((START x)) be start?. - b. Let instr_S be (CALL x). - c. Execute the instruction instr_S. -27. Pop the frame (FRAME_ 0 { { MODULE: moduleinst } }) from the stack. -28. Return moduleinst. +26. Pop the frame (FRAME_ 0 { f }) from the stack. +27. Assert: Due to validation, (|expr_T*| = |ref_T*|). +28. Assert: Due to validation, (|expr_E**| = |ref_E**|). +29. Assert: Due to validation, (|expr_E*| = |ref_E*|)*. +30. Let moduleinst be $allocmodule(s, module, externaddr*, val_G*, ref_T*, ref_E**). +31. Push the frame (FRAME_ 0 { { MODULE: moduleinst } }) to the stack. +32. Execute the sequence instr_E*. +33. Execute the sequence instr_D*. +34. If instr_S? is defined, then: + a. Let ?(instr_0) be instr_S?. + b. Execute the instruction instr_0. +35. Pop the frame (FRAME_ 0 { { MODULE: moduleinst } }) from the stack. +36. Return moduleinst. invoke s funcaddr val* -1. Assert: Due to validation, $Expand(s.FUNCS[funcaddr].TYPE) is some FUNC. -2. Let (FUNC t_1* -> t_2*) be $Expand(s.FUNCS[funcaddr].TYPE). -3. If not $Val_ok(val, t_1)*, then: +1. Assert: Due to validation, (funcaddr < |s.FUNCS|). +2. Assert: Due to validation, $Expand(s.FUNCS[funcaddr].TYPE) is some FUNC. +3. Let (FUNC t_1* -> t_2*) be $Expand(s.FUNCS[funcaddr].TYPE). +4. Assert: Due to validation, (|t_1*| = |val*|). +5. If not $Val_ok(val, t_1)*, then: a. Fail. -4. Let k be |t_2*|. -5. Push the frame (FRAME_ k { { MODULE: {} } }) to the stack. -6. Push the values val* to the stack. -7. Push the value (REF.FUNC_ADDR funcaddr) to the stack. -8. Execute the instruction (CALL_REF s.FUNCS[funcaddr].TYPE). -9. Pop the values val'^k from the stack. -10. Pop the frame (FRAME_ k { { MODULE: {} } }) from the stack. -11. Return val'^k. +6. Let k be |t_2*|. +7. Push the frame (FRAME_ k { { MODULE: {} } }) to the stack. +8. Push the values val* to the stack. +9. Push the value (REF.FUNC_ADDR funcaddr) to the stack. +10. Execute the instruction (CALL_REF s.FUNCS[funcaddr].TYPE). +11. Pop the values val'^k from the stack. +12. Pop the frame (FRAME_ k { { MODULE: {} } }) from the stack. +13. Return val'^k. concat_idctxt idctxt* 1. If (idctxt* = []), then: