From 6c4883f8932637360e2cc88f08a607fb2deeaafa Mon Sep 17 00:00:00 2001 From: Andreas Rossberg Date: Wed, 30 Oct 2024 19:17:18 +0100 Subject: [PATCH 01/10] always try infer first --- spectec/src/el/print.ml | 28 +++- spectec/src/el/print.mli | 4 +- spectec/src/frontend/elab.ml | 278 ++++++++++++++++------------------ spectec/src/util/debug_log.ml | 3 +- 4 files changed, 151 insertions(+), 162 deletions(-) diff --git a/spectec/src/el/print.ml b/spectec/src/el/print.ml index 3844cd05ec..c24576ed19 100644 --- a/spectec/src/el/print.ml +++ b/spectec/src/el/print.ml @@ -2,6 +2,7 @@ open Util.Source open Ast open Convert open Xl +open Util (* Helpers *) @@ -65,7 +66,7 @@ and string_of_numtyp t = | Num.RatT -> "rat" | Num.RealT -> "real" -and string_of_typ t = +and string_of_typ ?(short=false) t = match t.it with | VarT (id, args) -> string_of_typid id ^ string_of_args args | BoolT -> "bool" @@ -74,13 +75,21 @@ and string_of_typ t = | ParenT t -> "(" ^ string_of_typ t ^ ")" | TupT ts -> "(" ^ string_of_typs ", " ts ^ ")" | IterT (t1, iter) -> string_of_typ t1 ^ string_of_iter iter + | StrT tfs when short && List.length tfs > 3 -> + "{" ^ concat ", " (map_filter_nl_list (string_of_typfield ~short) (Lib.List.take 3 tfs)) ^ ", ..}" | StrT tfs -> - "{" ^ concat ", " (map_filter_nl_list string_of_typfield tfs) ^ "}" - | CaseT (dots1, ts, tcases, dots2) -> + "{" ^ concat ", " (map_filter_nl_list (string_of_typfield ~short) tfs) ^ "}" + | CaseT (dots1, ts, tcs, dots2) when short && List.length tcs > 3 -> "| " ^ concat " | " (strings_of_dots dots1 @ map_filter_nl_list string_of_typ ts @ - map_filter_nl_list string_of_typcase tcases @ strings_of_dots dots2) - | ConT tc -> string_of_typcon tc + map_filter_nl_list (string_of_typcase ~short) (Lib.List.take 3 tcs) @ ".." :: strings_of_dots dots2) + | CaseT (dots1, ts, tcs, dots2) -> + "| " ^ concat " | " + (strings_of_dots dots1 @ map_filter_nl_list string_of_typ ts @ + map_filter_nl_list (string_of_typcase ~short) tcs @ strings_of_dots dots2) + | ConT tc -> string_of_typcon ~short tc + | RangeT tes when short && List.length tes > 3 -> + concat " | " (map_filter_nl_list string_of_typenum (Lib.List.take 3 tes)) ^ " | .." | RangeT tes -> concat " | " (map_filter_nl_list string_of_typenum tes) | AtomT atom -> string_of_atom atom | SeqT ts -> "{" ^ string_of_typs " " ts ^ "}" @@ -92,16 +101,19 @@ and string_of_typ t = and string_of_typs sep ts = concat sep (List.map string_of_typ ts) -and string_of_typfield (atom, (t, prems), _hints) = +and string_of_typfield ?(short=false) (atom, (t, prems), _hints) = string_of_atom atom ^ " " ^ string_of_typ t ^ + if short && prems <> [] then " -- .." else concat "" (map_filter_nl_list (prefix "\n -- " string_of_prem) prems) -and string_of_typcase (_atom, (t, prems), _hints) = +and string_of_typcase ?(short=false) (_atom, (t, prems), _hints) = string_of_typ t ^ + if short && prems <> [] then " -- .." else concat "" (map_filter_nl_list (prefix "\n -- " string_of_prem) prems) -and string_of_typcon ((t, prems), _hints) = +and string_of_typcon ?(short=false) ((t, prems), _hints) = string_of_typ t ^ + if short && prems <> [] then " -- .." else concat "" (map_filter_nl_list (prefix "\n -- " string_of_prem) prems) and string_of_typenum (e, eo) = diff --git a/spectec/src/el/print.mli b/spectec/src/el/print.mli index 06822aad2a..a78a6acd91 100644 --- a/spectec/src/el/print.mli +++ b/spectec/src/el/print.mli @@ -5,8 +5,8 @@ val string_of_unop : unop -> string val string_of_binop : binop -> string val string_of_cmpop : cmpop -> string val string_of_iter : iter -> string -val string_of_typ : typ -> string -val string_of_typfield : typfield -> string +val string_of_typ : ?short:bool -> typ -> string +val string_of_typfield : ?short:bool -> typfield -> string val string_of_exp : exp -> string val string_of_exps : string -> exp list -> string val string_of_expfield : expfield -> string diff --git a/spectec/src/frontend/elab.ml b/spectec/src/frontend/elab.ml index a9c37c343e..7300c60f5e 100644 --- a/spectec/src/frontend/elab.ml +++ b/spectec/src/frontend/elab.ml @@ -21,7 +21,7 @@ exception Error = Error.Error let error at msg = Error.error at "type" msg let error_atom at atom t msg = - error at (msg ^ " `" ^ string_of_atom atom ^ "` in type `" ^ string_of_typ t ^ "`") + error at (msg ^ " `" ^ string_of_atom atom ^ "` in type `" ^ string_of_typ ~short:true t ^ "`") let error_id id msg = error id.at (msg ^ " `" ^ id.it ^ "`") @@ -214,9 +214,9 @@ let valid_tid id = id.it <> "" let typ_string env t = let t' = Eval.reduce_typ (to_eval_env env) t in if Eq.eq_typ t t' then - "`" ^ string_of_typ t ^ "`" + "`" ^ string_of_typ ~short:true t ^ "`" else - "`" ^ string_of_typ t ^ "` = `" ^ string_of_typ t' ^ "`" + "`" ^ string_of_typ ~short:true t ^ "` = `" ^ string_of_typ ~short:true t' ^ "`" let error_typ env at phrase t = error at (phrase ^ " does not match expected type " ^ typ_string env t) @@ -231,7 +231,7 @@ let error_dir_typ env at phrase dir t expected = match dir with | Check -> error_typ env at phrase t | Infer -> - error at (phrase ^ "'s type `" ^ string_of_typ t ^ "`" ^ + error at (phrase ^ "'s type `" ^ string_of_typ ~short:true t ^ "`" ^ " does not match expected type " ^ expected) @@ -437,7 +437,7 @@ let rec as_cat_typid' phrase env dir id args at = Convert.iter_nl_list (fun (_, (t, _), _) -> as_cat_typ phrase env dir t at) tfs | _ -> - error at (phrase ^ "'s type `" ^ string_of_typ (VarT (id, args) $ id.at) ^ + error at (phrase ^ "'s type `" ^ string_of_typ ~short:true (VarT (id, args) $ id.at) ^ "` is not concatenable") and as_cat_typ phrase env dir t at = @@ -445,7 +445,7 @@ and as_cat_typ phrase env dir t at = | VarT (id, args) -> as_cat_typid' phrase env dir id args at | IterT _ -> () | _ -> - error at (phrase ^ "'s type `" ^ string_of_typ t ^ "` is not concatenable") + error at (phrase ^ "'s type `" ^ string_of_typ ~short:true t ^ "` is not concatenable") let rec as_variant_typid' phrase env id args at : typcase list * dots = match as_defined_typid' env id args at with @@ -567,7 +567,7 @@ let infer_unop env op t1 at : Il.unop * numtyp option * typ * typ = | Some (op', nt, t1', t2') -> op', nt, t1' $ at, t2' $ at | None -> error at ("unary operator `" ^ string_of_unop op ^ - "` is not defined for operand type `" ^ string_of_typ t1 ^ "`") + "` is not defined for operand type `" ^ string_of_typ ~short:true t1 ^ "`") let infer_binop env op t1 t2 at : Il.binop * numtyp option * typ * typ * typ = let ops = infer_binop' op in @@ -579,7 +579,7 @@ let infer_binop env op t1 t2 at : Il.binop * numtyp option * typ * typ * typ = | None -> error at ("binary operator `" ^ string_of_binop op ^ "` is not defined for operand types `" ^ - string_of_typ t1 ^ "` and `" ^ string_of_typ t2 ^ "`") + string_of_typ ~short:true t1 ^ "` and `" ^ string_of_typ ~short:true t2 ^ "`") let infer_cmpop env op : [`Poly of Il.cmpop | `Over of typ -> typ -> region -> Il.cmpop * numtyp option * typ] = @@ -594,7 +594,7 @@ let infer_cmpop env op | None -> error at ("comparison operator `" ^ string_of_cmpop op ^ "` is not defined for operand types `" ^ - string_of_typ t1 ^ "` and `" ^ string_of_typ t2 ^ "`") + string_of_typ ~short:true t1 ^ "` and `" ^ string_of_typ ~short:true t2 ^ "`") ) let merge_mixop mixop1 mixop2 = @@ -806,7 +806,7 @@ and elab_typcon env tid at (((t, prems), hints) as tc) : Il.typcase = and elab_typenum env tid (e1, e2o) : typ * (Il.exp -> numtyp -> Il.exp) = assert (valid_tid tid); let _e1' = elab_exp env e1 (NumT IntT $ e1.at) in (* ensure it's <= int *) - let _, t1 = infer_exp env e1 in (* get precise type *) + let t1 = typ_of (infer_exp env e1) in (* get precise type *) match e2o with | None -> t1, @@ -816,7 +816,7 @@ and elab_typenum env tid (e1, e2o) : typ * (Il.exp -> numtyp -> Il.exp) = | Some e2 -> let at = Source.over_region [e1.at; e2.at] in let _e2' = elab_exp env e2 (NumT IntT $ e2.at) in - let _, t2 = infer_exp env e2 in + let t2 = typ_of (infer_exp env e2) in (if narrow_typ env t2 t1 then t1 else t2).it $ at, fun eid' nt -> let e1' = elab_exp env e1 (NumT nt $ e1.at) in @@ -899,119 +899,128 @@ and must_elab_exp env e = | TupE es -> List.exists (must_elab_exp env) es | _ -> false -and infer_exp env e : Il.exp * typ = +(* Returns + * - Ok (il_exp, typ, b) if the type can be inferred, b is true if the type is principal + * - Error (at, s) when it cannot, where s is the name of the failing construct + * - raises Error.Error on unrecoverable errors + *) +and infer_exp env e : (Il.exp * typ * bool, region * string) result = Debug.(log_at "el.infer_exp" e.at (fun _ -> fmt "%s" (el_exp e)) - (fun (e', t) -> fmt "%s : %s" (il_exp e') (el_typ t)) + (result (fun (e', t, b) -> fmt "%s : %s (%b)" (il_exp e') (el_typ t) b) snd) ) @@ fun _ -> - let e', t = infer_exp' env e in - e' $$ e.at % elab_typ env t, t + match infer_exp' env e with + | Ok (e', t', b) -> let t = t' $ e.at in Ok (e' $$ e.at % elab_typ env t, t, b) + | Error err -> Error err -and infer_exp' env e : Il.exp' * typ = +and infer_exp' env e : (Il.exp' * typ' * bool, region * string) result = + let ( let* ) = Result.bind in match e.it with | VarE (id, args) -> if args <> [] then (* Args may only occur due to syntactic overloading with types *) error e.at "malformed expression"; if id.it = "_" then - error e.at "cannot infer type of wildcard"; - let t = - if bound env.vars id then - find "variable" env.vars id - else - (* If the variable itself is not yet declared, use type hint if available. *) - let t = - try find "variable" env.gvars (strip_var_suffix id) with Error _ -> - find "variable" env.vars id (* just to get the proper error message *) - in - env.vars <- bind "variable" env.vars id t; - t - in - Il.VarE id, t + Error (e.at, "wildcard") + else + (match + if bound env.vars id then + Some (find "variable" env.vars id) + else + (* If the variable itself is not yet declared, use type hint if available. *) + try + let t = find "variable" env.gvars (strip_var_suffix id) in + env.vars <- bind "variable" env.vars id t; + Some t + with Error _ -> None + with + | Some t -> Ok (Il.VarE id, t.it, true) + | None -> Error (e.at, "variable") + ) | AtomE _ -> - error e.at "cannot infer type of atom" + Error (e.at, "atom") | BoolE b -> - Il.BoolE b, BoolT $ e.at + Ok (Il.BoolE b, BoolT, true) | NumE (_op, n) -> - Il.NumE n, NumT (Num.to_typ n) $ e.at + Ok (Il.NumE n, NumT (Num.to_typ n), true) | TextE s -> - Il.TextE s, TextT $ e.at + Ok (Il.TextE s, TextT, true) | CvtE (e1, nt) -> - let e1', t1 = infer_exp env e1 in + let* e1', t1, _ = infer_exp env e1 in let nt1 = as_num_typ "conversion" env Infer t1 e1.at in - Il.CvtE (cast_exp "operand" env e1' t1 (NumT nt1 $ e1.at), nt1, nt), NumT nt $ e.at + Ok (Il.CvtE (cast_exp "operand" env e1' t1 (NumT nt1 $ e1.at), nt1, nt), NumT nt, true) | UnE (op, e1) -> - let e1', t1 = infer_exp env e1 in + let* e1', t1, _ = infer_exp env e1 in let op', nt, t1', t = infer_unop env op (typ_rep env t1) e.at in - Il.UnE (op', nt, cast_exp "operand" env e1' t1 t1'), t + Ok (Il.UnE (op', nt, cast_exp "operand" env e1' t1 t1'), t.it, true) | BinE (e1, op, e2) -> - let e1', t1 = infer_exp env e1 in - let e2', t2 = infer_exp env e2 in + let* e1', t1, _ = infer_exp env e1 in + let* e2', t2, _ = infer_exp env e2 in let op', nt, t1', t2', t = infer_binop env op (typ_rep env t1) (typ_rep env t2) e.at in - Il.BinE (op', nt, + Ok (Il.BinE (op', nt, cast_exp "operand" env e1' t1 t1', cast_exp "operand" env e2' t2 t2' - ), t + ), t.it, true) | CmpE (e1, op, ({it = CmpE (e21, _, _); _} as e2)) -> - let e1', _t1 = infer_exp env (CmpE (e1, op, e21) $ e.at) in - let e2', _t2 = infer_exp env e2 in - Il.BinE (`AndOp, None, e1', e2'), BoolT $ e.at + let* e1', _t1, _ = infer_exp env (CmpE (e1, op, e21) $ e.at) in + let* e2', _t2, _ = infer_exp env e2 in + Ok (Il.BinE (`AndOp, None, e1', e2'), BoolT, true) | CmpE (e1, op, e2) -> (match infer_cmpop env op with | `Poly op' -> - let e1', e2' = + let* e1', e2' = if must_elab_exp env e1 then - let e2', t2 = infer_exp env e2 in + let* e2', t2, _ = infer_exp env e2 in let e1' = elab_exp env e1 t2 in - e1', e2' + Ok (e1', e2') else - let e1', t1 = infer_exp env e1 in + let* e1', t1, _ = infer_exp env e1 in let e2' = elab_exp env e2 t1 in - e1', e2' + Ok (e1', e2') in - Il.CmpE (op', None, e1', e2'), BoolT $ e.at + Ok (Il.CmpE (op', None, e1', e2'), BoolT, true) | `Over elab_cmpop' -> - let e1', t1 = infer_exp env e1 in - let e2', t2 = infer_exp env e2 in + let* e1', t1, _ = infer_exp env e1 in + let* e2', t2, _ = infer_exp env e2 in let op', nt, t = elab_cmpop' (typ_rep env t1) (typ_rep env t2) e.at in - Il.CmpE (op', nt, + Ok (Il.CmpE (op', nt, cast_exp "operand" env e1' t1 t, cast_exp "operand" env e2' t2 t - ), BoolT $ e.at + ), BoolT, true) ) | IdxE (e1, e2) -> - let e1', t1 = infer_exp env e1 in + let* e1', t1, _ = infer_exp env e1 in let t = as_list_typ "expression" env Infer t1 e1.at in let e2' = elab_exp env e2 (NumT Num.NatT $ e2.at) in - Il.IdxE (e1', e2'), t + Ok (Il.IdxE (e1', e2'), t.it, true) | SliceE (e1, e2, e3) -> - let e1', t1 = infer_exp env e1 in + let* e1', t1, b = infer_exp env e1 in let _t' = as_list_typ "expression" env Infer t1 e1.at in let e2' = elab_exp env e2 (NumT Num.NatT $ e2.at) in let e3' = elab_exp env e3 (NumT Num.NatT $ e3.at) in - Il.SliceE (e1', e2', e3'), t1 + Ok (Il.SliceE (e1', e2', e3'), t1.it, b) | UpdE (e1, p, e2) -> - let e1', t1 = infer_exp env e1 in + let* e1', t1, b = infer_exp env e1 in let p', t2 = elab_path env p t1 in let e2' = elab_exp env e2 t2 in - Il.UpdE (e1', p', e2'), t1 + Ok (Il.UpdE (e1', p', e2'), t1.it, b) | ExtE (e1, p, e2) -> - let e1', t1 = infer_exp env e1 in + let* e1', t1, b = infer_exp env e1 in let p', t2 = elab_path env p t1 in let _t21 = as_list_typ "path" env Infer t2 p.at in let e2' = elab_exp env e2 t2 in - Il.ExtE (e1', p', e2'), t1 + Ok (Il.ExtE (e1', p', e2'), t1.it, b) | StrE _ -> - error e.at "cannot infer type of record" + Error (e.at, "record") | DotE (e1, atom) -> - let e1', t1 = infer_exp env e1 in + let* e1', t1, _ = infer_exp env e1 in let tfs = as_struct_typ "expression" env Infer t1 e1.at in let t, prems = find_field tfs atom e1.at t1 in let e' = Il.DotE (e1', elab_atom atom (expand_id env t1)) in let e'' = if prems = [] then e' else Il.ProjE (e' $$ e.at % elab_typ env t, 0) in - e'', t + Ok (e'', t.it, true) | CommaE (e1, e2) -> - let e1', t1 = infer_exp env e1 in + let* e1', t1, b = infer_exp env e1 in let tfs = as_struct_typ "expression" env Infer t1 e1.at in let _ = as_cat_typ "expression" env Infer t1 e.at in (* TODO(4, rossberg): this is a bit of a hack, can we avoid it? *) @@ -1020,58 +1029,70 @@ and infer_exp' env e : Il.exp' * typ = let _t2 = find_field tfs atom at t1 in let e2 = match es2 with [e2] -> e2 | _ -> SeqE es2 $ e2.at in let e2' = elab_exp env (StrE [Elem (atom, e2)] $ e2.at) t1 in - Il.CompE (e2', e1'), t1 + Ok (Il.CompE (e2', e1'), t1.it, b) | _ -> error e.at "malformed comma operator" ) | CatE (e1, e2) -> - let e1', t1 = infer_exp env e1 in + let* e1', t1, b = infer_exp env e1 in let _ = as_cat_typ "operand" env Infer t1 e.at in let e2' = elab_exp env e2 t1 in - (if is_iter_typ env t1 then Il.CatE (e1', e2') else Il.CompE (e1', e2')), t1 + Ok ((if is_iter_typ env t1 then Il.CatE (e1', e2') else Il.CompE (e1', e2')), t1.it, b) | MemE (e1, e2) -> - let e1', t1 = infer_exp env e1 in + let* e1', t1, _ = infer_exp env e1 in let e2' = elab_exp env e2 (IterT (t1, List) $ e2.at) in - Il.MemE (e1', e2'), BoolT $ e.at + Ok (Il.MemE (e1', e2'), BoolT, true) | LenE e1 -> - let e1', t1 = infer_exp env e1 in + let* e1', t1, _ = infer_exp env e1 in let _t11 = as_list_typ "expression" env Infer t1 e1.at in - Il.LenE e1', NumT Num.NatT $ e.at + Ok (Il.LenE e1', NumT Num.NatT, true) | SizeE id -> let _ = find "grammar" env.grams id in - Il.NumE (Num.Nat Z.zero), NumT Num.NatT $ e.at + Ok (Il.NumE (Num.Nat Z.zero), NumT Num.NatT, true) | ParenE (e1, _) | ArithE e1 -> infer_exp' env e1 | TupE es -> - let es', ts = List.split (List.map (infer_exp env) es) in - Il.TupE es', TupT ts $ e.at + let* es', ts, b = infer_exp_list env es in + Ok (Il.TupE es', TupT ts, b) | CallE (id, as_) -> let ps, t, _ = find "definition" env.defs id in let as', s = elab_args `Rhs env as_ ps e.at in - Il.CallE (id, as'), Subst.subst_typ s t - | EpsE -> error e.at "cannot infer type of empty sequence" + Ok (Il.CallE (id, as'), (Subst.subst_typ s t).it, true) + | EpsE -> + Error (e.at, "empty sequence") | SeqE [] -> (* empty tuples *) - Il.TupE [], TupT [] $ e.at - | SeqE es -> - let es', ts = List.split (List.map (infer_exp env) es) in + Ok (Il.TupE [], TupT [], false) + | SeqE es -> (* not principal *) + let* es', ts, _ = infer_exp_list env es in let t = List.hd ts in if List.for_all (equiv_typ env t) (List.tl ts) then - Il.ListE es', IterT (t, List) $ e.at + Ok (Il.ListE es', IterT (t, List), false) else - error e.at "cannot infer type of expression sequence" - | InfixE _ -> error e.at "cannot infer type of infix expression" - | BrackE _ -> error e.at "cannot infer type of bracket expression" + Error (e.at, "expression sequence") + | InfixE _ -> Error (e.at, "infix expression") + | BrackE _ -> Error (e.at, "bracket expression") | IterE (e1, iter) -> let iter' = elab_iterexp env iter in - let e1', t1 = infer_exp env e1 in - Il.IterE (e1', iter'), IterT (t1, match iter with ListN _ -> List | _ -> iter) $ e.at + let* e1', t1, _ = infer_exp env e1 in + Ok (Il.IterE (e1', iter'), IterT (t1, match iter with ListN _ -> List | _ -> iter), false) | TypE (e1, t) -> let _t' = elab_typ env t in - (elab_exp env e1 t).it, t + Ok ((elab_exp env e1 t).it, t.it, true) | HoleE _ -> error e.at "misplaced hole" | FuseE _ -> error e.at "misplaced token concatenation" | UnparenE _ -> error e.at "misplaced unparenthesize" | LatexE _ -> error e.at "misplaced latex literal" +and infer_exp_list env = function + | [] -> Ok ([], [], true) + | e::es -> + let ( let* ) = Result.bind in + let* e', t, b1 = infer_exp env e in + let* es', ts, b2 = infer_exp_list env es in + Ok (e'::es', t::ts, b1 && b2) + +and typ_of = function + | Ok (_, t, _) -> t + | Error (at, construct) -> error at ("cannot infer type of " ^ construct) and elab_exp env e t : Il.exp = try @@ -1090,17 +1111,19 @@ and elab_exp' env e t : Il.exp' = (fun _ -> fmt "%s : %s" (el_exp e) (el_typ t)) (fun e' -> fmt "%s" (il_exp (e' $$ no_region % elab_typ env t))) ) @@ fun _ -> + match infer_exp env e with + | Ok (e', t', true) -> + cast_exp' "expression" env e' t' t + | result -> match e.it with - | VarE (id, []) when id.it = "_" -> + | BoolE _ | NumE _ | TextE _ | CvtE _ | UnE _ | BinE _ | CmpE _ + | IdxE _ | DotE _ | MemE _ | LenE _ | SizeE _ | CallE _ | TypE _ + | HoleE _ | FuseE _ | UnparenE _ | LatexE _ -> + ignore (typ_of result) (* will throw *); assert false + | VarE (id, _) when id.it = "_" -> Il.VarE id - | VarE (id, []) when not (bound env.vars id) -> - if bound env.gvars (strip_var_suffix id) then - (* Variable type must be consistent with possible type hint. *) - let t' = find "" env.gvars (strip_var_suffix id) in - env.vars <- bind "variable" env.vars id t'; - let e' = elab_exp env e t' in - cast_exp' "variable" env e' t' t - else if is_iter_typ env t then + | VarE (id, _) -> + if is_iter_typ env t then (* Never infer an iteration type for a variable *) let t1, iter = as_iter_typ "" env Check t e.at in let e' = elab_exp env e t1 in @@ -1109,33 +1132,6 @@ and elab_exp' env e t : Il.exp' = env.vars <- bind "variable" env.vars id t; Il.VarE id ) - | VarE _ -> - let e', t' = infer_exp env e in - cast_exp' "variable" env e' t' t - | BoolE _ -> - let e', t' = infer_exp env e in - cast_exp' "boolean" env e' t' t - | NumE _ -> - let e', t' = infer_exp env e in - cast_exp' "number" env e' t' t - | TextE _ -> - let e', t' = infer_exp env e in - cast_exp' "text" env e' t' t - | CvtE _ -> - let e', t' = infer_exp env e in - cast_exp' "conversion" env e' t' t - | UnE _ -> - let e', t' = infer_exp env e in - cast_exp' "unary operator" env e' t' t - | BinE _ -> - let e', t' = infer_exp env e in - cast_exp' "binary operator" env e' t' t - | CmpE _ -> - let e', t' = infer_exp env e in - cast_exp' "comparison operator" env e' t' t - | IdxE _ -> - let e', t' = infer_exp env e in - cast_exp' "list element" env e' t' t | SliceE (e1, e2, e3) -> let _t' = as_list_typ "expression" env Check t e1.at in let e1' = elab_exp env e1 t in @@ -1157,9 +1153,6 @@ and elab_exp' env e t : Il.exp' = let tfs = as_struct_typ "record" env Check t e.at in let efs' = elab_expfields env (expand_id env t) (filter_nl efs) tfs t e.at in Il.StrE efs' - | DotE _ -> - let e', t' = infer_exp env e in - cast_exp' "projection" env e' t' t | CommaE (e1, e2) -> let e1' = elab_exp env e1 t in let tfs = as_struct_typ "expression" env Check t e1.at in @@ -1178,15 +1171,6 @@ and elab_exp' env e t : Il.exp' = let e1' = elab_exp env e1 t in let e2' = elab_exp env e2 t in if is_iter_typ env t then Il.CatE (e1', e2') else Il.CompE (e1', e2') - | MemE _ -> - let e', t' = infer_exp env e in - cast_exp' "element operator" env e' t' t - | LenE _ -> - let e', t' = infer_exp env e in - cast_exp' "list length" env e' t' t - | SizeE _ -> - let e', t' = infer_exp env e in - cast_exp' "expansion length" env e' t' t | ParenE (e1, `Sig) when is_iter_typ env t -> (* Significant parentheses indicate a singleton *) let t1, _iter = as_iter_typ "expression" env Check t e.at in @@ -1200,12 +1184,11 @@ and elab_exp' env e t : Il.exp' = error e.at "arity mismatch for expression list"; let es' = List.map2 (elab_exp env) es ts in Il.TupE es' - | CallE _ -> - let e', t' = infer_exp env e in - cast_exp' "function application" env e' t' t | SeqE [] when is_empty_typ env t -> - let e', t' = infer_exp env e in - cast_exp' "empty expression" env e' t' t + (match infer_exp env e with + | Ok (e', t', _) -> cast_exp' "empty expression" env e' t' t + | Error _ -> assert false + ) | EpsE | SeqE _ when is_iter_typ env t -> let es = unseq_exp e in elab_exp_iter' env es (as_iter_typ "" env Check t e.at) t e.at @@ -1234,13 +1217,6 @@ and elab_exp' env e t : Il.exp' = let iter2' = elab_iterexp env iter2 in let e1' = elab_exp env e1 t1 in Il.IterE (e1', iter2') - | TypE _ -> - let e', t' = infer_exp env e in - cast_exp' "type annotation" env e' t' t - | HoleE _ -> error e.at "misplaced hole" - | FuseE _ -> error e.at "misplaced token concatenation" - | UnparenE _ -> error e.at "misplaced unparenthesize" - | LatexE _ -> error e.at "misplaced latex literal" and elab_expfields env tid efs tfs t0 at : Il.expfield list = Debug.(log_in_at "el.elab_expfields" at @@ -1879,9 +1855,9 @@ and elab_arg in_lhs env a p s : Il.arg list * Subst.subst = let ps, t, _ = find "definition" env.defs id in if not (Eval.equiv_functyp (to_eval_env env) (ps, t) (ps', t')) then error a.at ("type mismatch in function argument, expected `" ^ - (spaceid "definition" id').it ^ Print.(string_of_params ps' ^ " : " ^ string_of_typ t') ^ + (spaceid "definition" id').it ^ Print.(string_of_params ps' ^ " : " ^ string_of_typ ~short:true t') ^ "` but got `" ^ - (spaceid "definition" id).it ^ Print.(string_of_params ps ^ " : " ^ string_of_typ t ^ "`") + (spaceid "definition" id).it ^ Print.(string_of_params ps ^ " : " ^ string_of_typ ~short:true t ^ "`") ); [Il.DefA id $ a.at], Subst.add_defid s id id' | _, _ -> diff --git a/spectec/src/util/debug_log.ml b/spectec/src/util/debug_log.ml index 0d4e801b46..f8e5976606 100644 --- a/spectec/src/util/debug_log.ml +++ b/spectec/src/util/debug_log.ml @@ -32,7 +32,8 @@ let log_if label = log_if_at label Source.no_region module MySet = Set.Make(String) module MyMap = Map.Make(String) -let opt f xo = match xo with None -> "-" | Some x -> f x +let opt f = function None -> "-" | Some x -> f x +let result f g = function Ok x -> f x | Error y -> g y let seq f xs = String.concat " " (List.map f xs) let list f xs = String.concat ", " (List.map f xs) let set s = seq Fun.id (MySet.elements s) From 881e89d94faeac6e1d4af68ba38e0a7cf097f8b4 Mon Sep 17 00:00:00 2001 From: Andreas Rossberg Date: Wed, 30 Oct 2024 20:33:22 +0100 Subject: [PATCH 02/10] Only invoke infer for principal cases --- spectec/src/frontend/elab.ml | 156 ++++++++++++++++++----------------- 1 file changed, 81 insertions(+), 75 deletions(-) diff --git a/spectec/src/frontend/elab.ml b/spectec/src/frontend/elab.ml index 7300c60f5e..39ae7ef614 100644 --- a/spectec/src/frontend/elab.ml +++ b/spectec/src/frontend/elab.ml @@ -900,20 +900,20 @@ and must_elab_exp env e = | _ -> false (* Returns - * - Ok (il_exp, typ, b) if the type can be inferred, b is true if the type is principal + * - Ok (il_exp, typ) if the type can be inferred * - Error (at, s) when it cannot, where s is the name of the failing construct * - raises Error.Error on unrecoverable errors *) -and infer_exp env e : (Il.exp * typ * bool, region * string) result = +and infer_exp env e : (Il.exp * typ, region * string) result = Debug.(log_at "el.infer_exp" e.at (fun _ -> fmt "%s" (el_exp e)) - (result (fun (e', t, b) -> fmt "%s : %s (%b)" (il_exp e') (el_typ t) b) snd) + (result (fun (e', t) -> fmt "%s : %s" (il_exp e') (el_typ t)) snd) ) @@ fun _ -> match infer_exp' env e with - | Ok (e', t', b) -> let t = t' $ e.at in Ok (e' $$ e.at % elab_typ env t, t, b) + | Ok (e', t') -> let t = t' $ e.at in Ok (e' $$ e.at % elab_typ env t, t) | Error err -> Error err -and infer_exp' env e : (Il.exp' * typ' * bool, region * string) result = +and infer_exp' env e : (Il.exp' * typ', region * string) result = let ( let* ) = Result.bind in match e.it with | VarE (id, args) -> @@ -934,93 +934,93 @@ and infer_exp' env e : (Il.exp' * typ' * bool, region * string) result = Some t with Error _ -> None with - | Some t -> Ok (Il.VarE id, t.it, true) + | Some t -> Ok (Il.VarE id, t.it) | None -> Error (e.at, "variable") ) | AtomE _ -> Error (e.at, "atom") | BoolE b -> - Ok (Il.BoolE b, BoolT, true) + Ok (Il.BoolE b, BoolT) | NumE (_op, n) -> - Ok (Il.NumE n, NumT (Num.to_typ n), true) + Ok (Il.NumE n, NumT (Num.to_typ n)) | TextE s -> - Ok (Il.TextE s, TextT, true) + Ok (Il.TextE s, TextT) | CvtE (e1, nt) -> - let* e1', t1, _ = infer_exp env e1 in + let* e1', t1 = infer_exp env e1 in let nt1 = as_num_typ "conversion" env Infer t1 e1.at in - Ok (Il.CvtE (cast_exp "operand" env e1' t1 (NumT nt1 $ e1.at), nt1, nt), NumT nt, true) + Ok (Il.CvtE (cast_exp "operand" env e1' t1 (NumT nt1 $ e1.at), nt1, nt), NumT nt) | UnE (op, e1) -> - let* e1', t1, _ = infer_exp env e1 in + let* e1', t1 = infer_exp env e1 in let op', nt, t1', t = infer_unop env op (typ_rep env t1) e.at in - Ok (Il.UnE (op', nt, cast_exp "operand" env e1' t1 t1'), t.it, true) + Ok (Il.UnE (op', nt, cast_exp "operand" env e1' t1 t1'), t.it) | BinE (e1, op, e2) -> - let* e1', t1, _ = infer_exp env e1 in - let* e2', t2, _ = infer_exp env e2 in + let* e1', t1 = infer_exp env e1 in + let* e2', t2 = infer_exp env e2 in let op', nt, t1', t2', t = infer_binop env op (typ_rep env t1) (typ_rep env t2) e.at in Ok (Il.BinE (op', nt, cast_exp "operand" env e1' t1 t1', cast_exp "operand" env e2' t2 t2' - ), t.it, true) + ), t.it) | CmpE (e1, op, ({it = CmpE (e21, _, _); _} as e2)) -> - let* e1', _t1, _ = infer_exp env (CmpE (e1, op, e21) $ e.at) in - let* e2', _t2, _ = infer_exp env e2 in - Ok (Il.BinE (`AndOp, None, e1', e2'), BoolT, true) + let* e1', _t1 = infer_exp env (CmpE (e1, op, e21) $ e.at) in + let* e2', _t2 = infer_exp env e2 in + Ok (Il.BinE (`AndOp, None, e1', e2'), BoolT) | CmpE (e1, op, e2) -> (match infer_cmpop env op with | `Poly op' -> let* e1', e2' = - if must_elab_exp env e1 then - let* e2', t2, _ = infer_exp env e2 in + if must_elab_exp env e1 then (* TODO: use backtracking *) + let* e2', t2 = infer_exp env e2 in let e1' = elab_exp env e1 t2 in Ok (e1', e2') else - let* e1', t1, _ = infer_exp env e1 in + let* e1', t1 = infer_exp env e1 in let e2' = elab_exp env e2 t1 in Ok (e1', e2') in - Ok (Il.CmpE (op', None, e1', e2'), BoolT, true) + Ok (Il.CmpE (op', None, e1', e2'), BoolT) | `Over elab_cmpop' -> - let* e1', t1, _ = infer_exp env e1 in - let* e2', t2, _ = infer_exp env e2 in + let* e1', t1 = infer_exp env e1 in + let* e2', t2 = infer_exp env e2 in let op', nt, t = elab_cmpop' (typ_rep env t1) (typ_rep env t2) e.at in Ok (Il.CmpE (op', nt, cast_exp "operand" env e1' t1 t, cast_exp "operand" env e2' t2 t - ), BoolT, true) + ), BoolT) ) | IdxE (e1, e2) -> - let* e1', t1, _ = infer_exp env e1 in + let* e1', t1 = infer_exp env e1 in let t = as_list_typ "expression" env Infer t1 e1.at in let e2' = elab_exp env e2 (NumT Num.NatT $ e2.at) in - Ok (Il.IdxE (e1', e2'), t.it, true) + Ok (Il.IdxE (e1', e2'), t.it) | SliceE (e1, e2, e3) -> - let* e1', t1, b = infer_exp env e1 in + let* e1', t1 = infer_exp env e1 in let _t' = as_list_typ "expression" env Infer t1 e1.at in let e2' = elab_exp env e2 (NumT Num.NatT $ e2.at) in let e3' = elab_exp env e3 (NumT Num.NatT $ e3.at) in - Ok (Il.SliceE (e1', e2', e3'), t1.it, b) + Ok (Il.SliceE (e1', e2', e3'), t1.it) | UpdE (e1, p, e2) -> - let* e1', t1, b = infer_exp env e1 in + let* e1', t1 = infer_exp env e1 in let p', t2 = elab_path env p t1 in let e2' = elab_exp env e2 t2 in - Ok (Il.UpdE (e1', p', e2'), t1.it, b) + Ok (Il.UpdE (e1', p', e2'), t1.it) | ExtE (e1, p, e2) -> - let* e1', t1, b = infer_exp env e1 in + let* e1', t1 = infer_exp env e1 in let p', t2 = elab_path env p t1 in let _t21 = as_list_typ "path" env Infer t2 p.at in let e2' = elab_exp env e2 t2 in - Ok (Il.ExtE (e1', p', e2'), t1.it, b) + Ok (Il.ExtE (e1', p', e2'), t1.it) | StrE _ -> Error (e.at, "record") | DotE (e1, atom) -> - let* e1', t1, _ = infer_exp env e1 in + let* e1', t1 = infer_exp env e1 in let tfs = as_struct_typ "expression" env Infer t1 e1.at in let t, prems = find_field tfs atom e1.at t1 in let e' = Il.DotE (e1', elab_atom atom (expand_id env t1)) in let e'' = if prems = [] then e' else Il.ProjE (e' $$ e.at % elab_typ env t, 0) in - Ok (e'', t.it, true) + Ok (e'', t.it) | CommaE (e1, e2) -> - let* e1', t1, b = infer_exp env e1 in + let* e1', t1 = infer_exp env e1 in let tfs = as_struct_typ "expression" env Infer t1 e1.at in let _ = as_cat_typ "expression" env Infer t1 e.at in (* TODO(4, rossberg): this is a bit of a hack, can we avoid it? *) @@ -1029,69 +1029,69 @@ and infer_exp' env e : (Il.exp' * typ' * bool, region * string) result = let _t2 = find_field tfs atom at t1 in let e2 = match es2 with [e2] -> e2 | _ -> SeqE es2 $ e2.at in let e2' = elab_exp env (StrE [Elem (atom, e2)] $ e2.at) t1 in - Ok (Il.CompE (e2', e1'), t1.it, b) + Ok (Il.CompE (e2', e1'), t1.it) | _ -> error e.at "malformed comma operator" ) | CatE (e1, e2) -> - let* e1', t1, b = infer_exp env e1 in + let* e1', t1 = infer_exp env e1 in let _ = as_cat_typ "operand" env Infer t1 e.at in let e2' = elab_exp env e2 t1 in - Ok ((if is_iter_typ env t1 then Il.CatE (e1', e2') else Il.CompE (e1', e2')), t1.it, b) + Ok ((if is_iter_typ env t1 then Il.CatE (e1', e2') else Il.CompE (e1', e2')), t1.it) | MemE (e1, e2) -> - let* e1', t1, _ = infer_exp env e1 in + let* e1', t1 = infer_exp env e1 in let e2' = elab_exp env e2 (IterT (t1, List) $ e2.at) in - Ok (Il.MemE (e1', e2'), BoolT, true) + Ok (Il.MemE (e1', e2'), BoolT) | LenE e1 -> - let* e1', t1, _ = infer_exp env e1 in + let* e1', t1 = infer_exp env e1 in let _t11 = as_list_typ "expression" env Infer t1 e1.at in - Ok (Il.LenE e1', NumT Num.NatT, true) + Ok (Il.LenE e1', NumT Num.NatT) | SizeE id -> let _ = find "grammar" env.grams id in - Ok (Il.NumE (Num.Nat Z.zero), NumT Num.NatT, true) + Ok (Il.NumE (Num.Nat Z.zero), NumT Num.NatT) | ParenE (e1, _) | ArithE e1 -> infer_exp' env e1 | TupE es -> - let* es', ts, b = infer_exp_list env es in - Ok (Il.TupE es', TupT ts, b) + let* es', ts = infer_exp_list env es in + Ok (Il.TupE es', TupT ts) | CallE (id, as_) -> let ps, t, _ = find "definition" env.defs id in let as', s = elab_args `Rhs env as_ ps e.at in - Ok (Il.CallE (id, as'), (Subst.subst_typ s t).it, true) + Ok (Il.CallE (id, as'), (Subst.subst_typ s t).it) | EpsE -> Error (e.at, "empty sequence") - | SeqE [] -> (* empty tuples *) - Ok (Il.TupE [], TupT [], false) - | SeqE es -> (* not principal *) - let* es', ts, _ = infer_exp_list env es in + | SeqE [] -> (* treat as empty tuple, not principal *) + Ok (Il.TupE [], TupT []) + | SeqE es -> (* treat as homogeneous sequence, not principal *) + let* es', ts = infer_exp_list env es in let t = List.hd ts in if List.for_all (equiv_typ env t) (List.tl ts) then - Ok (Il.ListE es', IterT (t, List), false) + Ok (Il.ListE es', IterT (t, List)) else Error (e.at, "expression sequence") | InfixE _ -> Error (e.at, "infix expression") | BrackE _ -> Error (e.at, "bracket expression") | IterE (e1, iter) -> let iter' = elab_iterexp env iter in - let* e1', t1, _ = infer_exp env e1 in - Ok (Il.IterE (e1', iter'), IterT (t1, match iter with ListN _ -> List | _ -> iter), false) + let* e1', t1 = infer_exp env e1 in + Ok (Il.IterE (e1', iter'), IterT (t1, match iter with ListN _ -> List | _ -> iter)) | TypE (e1, t) -> let _t' = elab_typ env t in - Ok ((elab_exp env e1 t).it, t.it, true) + Ok ((elab_exp env e1 t).it, t.it) | HoleE _ -> error e.at "misplaced hole" | FuseE _ -> error e.at "misplaced token concatenation" | UnparenE _ -> error e.at "misplaced unparenthesize" | LatexE _ -> error e.at "misplaced latex literal" and infer_exp_list env = function - | [] -> Ok ([], [], true) + | [] -> Ok ([], []) | e::es -> let ( let* ) = Result.bind in - let* e', t, b1 = infer_exp env e in - let* es', ts, b2 = infer_exp_list env es in - Ok (e'::es', t::ts, b1 && b2) + let* e', t = infer_exp env e in + let* es', ts = infer_exp_list env es in + Ok (e'::es', t::ts) and typ_of = function - | Ok (_, t, _) -> t + | Ok (_, t) -> t | Error (at, construct) -> error at ("cannot infer type of " ^ construct) and elab_exp env e t : Il.exp = @@ -1111,26 +1111,32 @@ and elab_exp' env e t : Il.exp' = (fun _ -> fmt "%s : %s" (el_exp e) (el_typ t)) (fun e' -> fmt "%s" (il_exp (e' $$ no_region % elab_typ env t))) ) @@ fun _ -> - match infer_exp env e with - | Ok (e', t', true) -> - cast_exp' "expression" env e' t' t - | result -> match e.it with | BoolE _ | NumE _ | TextE _ | CvtE _ | UnE _ | BinE _ | CmpE _ | IdxE _ | DotE _ | MemE _ | LenE _ | SizeE _ | CallE _ | TypE _ | HoleE _ | FuseE _ | UnparenE _ | LatexE _ -> - ignore (typ_of result) (* will throw *); assert false + (match infer_exp env e with + | Ok (e', t') -> + cast_exp' "expression" env e' t' t + | Error (at, construct) -> + error at ("cannot infer type of " ^ construct) + ) | VarE (id, _) when id.it = "_" -> Il.VarE id | VarE (id, _) -> - if is_iter_typ env t then - (* Never infer an iteration type for a variable *) - let t1, iter = as_iter_typ "" env Check t e.at in - let e' = elab_exp env e t1 in - lift_exp' e' iter - else ( - env.vars <- bind "variable" env.vars id t; - Il.VarE id + (match infer_exp env e with + | Ok (e', t') -> + cast_exp' "expression" env e' t' t + | Error _ -> (* TODO: use backtracking *) + if is_iter_typ env t then + (* Never infer an iteration type for a variable *) + let t1, iter = as_iter_typ "" env Check t e.at in + let e' = elab_exp env e t1 in + lift_exp' e' iter + else ( + env.vars <- bind "variable" env.vars id t; + Il.VarE id + ) ) | SliceE (e1, e2, e3) -> let _t' = as_list_typ "expression" env Check t e1.at in @@ -1186,7 +1192,7 @@ and elab_exp' env e t : Il.exp' = Il.TupE es' | SeqE [] when is_empty_typ env t -> (match infer_exp env e with - | Ok (e', t', _) -> cast_exp' "empty expression" env e' t' t + | Ok (e', t') -> cast_exp' "empty expression" env e' t' t | Error _ -> assert false ) | EpsE | SeqE _ when is_iter_typ env t -> From 7fdbe5b4bb47fd569efd6fadaef5486241a3c8ed Mon Sep 17 00:00:00 2001 From: Andreas Rossberg Date: Thu, 7 Nov 2024 09:53:10 +0100 Subject: [PATCH 03/10] WIP --- spectec/src/el/convert.ml | 1 + spectec/src/el/convert.mli | 1 + spectec/src/el/debug.ml | 4 +- spectec/src/frontend/elab.ml | 931 ++++++++++++++++++++--------------- 4 files changed, 547 insertions(+), 390 deletions(-) diff --git a/spectec/src/el/convert.ml b/spectec/src/el/convert.ml index b1c1f7fb54..fba43ed368 100644 --- a/spectec/src/el/convert.ml +++ b/spectec/src/el/convert.ml @@ -13,6 +13,7 @@ let forall_nl_list f xs = List.for_all f (filter_nl xs) let exists_nl_list f xs = List.exists f (filter_nl xs) let find_nl_list f xs = List.find_opt f (filter_nl xs) let iter_nl_list f xs = List.iter f (filter_nl xs) +let fold_nl_list f y xs = List.fold_left f y (filter_nl xs) let map_filter_nl_list f xs = List.map f (filter_nl xs) let map_nl_list f xs = List.map (function Nl -> Nl | Elem x -> Elem (f x)) xs let filter_nl_list f xs = List.filter (function Nl -> true | Elem x -> f x) xs diff --git a/spectec/src/el/convert.mli b/spectec/src/el/convert.mli index 7613cab6f3..97d04af19a 100644 --- a/spectec/src/el/convert.mli +++ b/spectec/src/el/convert.mli @@ -9,6 +9,7 @@ val forall_nl_list : ('a -> bool) -> 'a nl_list -> bool val exists_nl_list : ('a -> bool) -> 'a nl_list -> bool val find_nl_list : ('a -> bool) -> 'a nl_list -> 'a option val iter_nl_list : ('a -> unit) -> 'a nl_list -> unit +val fold_nl_list : ('a -> 'b -> 'a) -> 'a -> 'b nl_list -> 'a val map_nl_list : ('a -> 'b) -> 'a nl_list -> 'b nl_list val map_filter_nl_list : ('a -> 'b) -> 'a nl_list -> 'b list val concat_map_nl_list : ('a -> 'b nl_list) -> 'a nl_list -> 'b nl_list diff --git a/spectec/src/el/debug.ml b/spectec/src/el/debug.ml index 28b2dd2b58..df863be149 100644 --- a/spectec/src/el/debug.ml +++ b/spectec/src/el/debug.ml @@ -5,8 +5,8 @@ open Print let el_id = Util.Source.it let el_atom = string_of_atom let el_iter = string_of_iter -let el_typ = string_of_typ -let el_typfield = string_of_typfield +let el_typ = string_of_typ ~short:true +let el_typfield = string_of_typfield ~short:true let el_exp = string_of_exp let el_expfield = string_of_expfield let el_sym = string_of_sym diff --git a/spectec/src/frontend/elab.ml b/spectec/src/frontend/elab.ml index f31e5d1033..0be496830c 100644 --- a/spectec/src/frontend/elab.ml +++ b/spectec/src/frontend/elab.ml @@ -11,6 +11,8 @@ module Il = struct include Il include Ast end module Set = Free.Set module Map = Map.Make (String) +module Debug = struct include El.Debug include Il.Debug end + (* Errors *) @@ -26,8 +28,6 @@ let error_atom at atom t msg = let error_id id msg = error id.at (msg ^ " `" ^ id.it ^ "`") -module Debug = struct include El.Debug include Il.Debug end - (* Helpers *) @@ -209,6 +209,97 @@ let to_eval_env env = let valid_tid id = id.it <> "" +(* Backtracking *) + +type trace = Trace of region * string * trace list +type 'a attempt = Ok of 'a | Fail of trace list + +let ( let* ) r f = + match r with + | Ok x -> f x + | Fail traces -> Fail traces + +let choice' p env f1 f2 = (* backtracking *) + let env1 = local_env env in + match f1 env1 with + | Ok x -> promote_env env1 env; Ok x + | Fail traces1 -> + let env2 = local_env env in + match f2 env2 with + | Ok x -> promote_env env2 env; Ok x + | Fail traces2 -> Fail (p traces1 @ traces2) +(* +let choice' p env f1 f2 = (* backtracking *) +Printf.printf "[choice] %x\n%!" (Obj.magic env); + let env1 = local_env env in +Printf.printf "[choice left] %x -> %x\n%!" (Obj.magic env) (Obj.magic env1); + match f1 env1 with + | Ok x -> Printf.printf "[choice left] %x <- %x\n[choice]\n%!" (Obj.magic env) (Obj.magic env1); promote_env env1 env; Ok x + | Fail traces1 -> +Printf.printf "[choice left] %x ! %x\n%!" (Obj.magic env) (Obj.magic env1); +Printf.printf "|||\n%!"; + let env2 = local_env env in +Printf.printf "[choice right] %x -> %x\n%!" (Obj.magic env) (Obj.magic env2); + match f2 env2 with + | Ok x -> Printf.printf "[choice right] %x <- %x\n[choice]\n%!" (Obj.magic env) (Obj.magic env2); promote_env env2 env; Ok x + | Fail traces2 -> Printf.printf "[choice right] %x ! %x\n[choice]\n%!" (Obj.magic env) (Obj.magic env2); Fail (p traces1 @ traces2) +*) + +let choice env f1 f2 = choice' Fun.id env f1 f2 +let choice_forget env f1 f2 = choice' (Fun.const []) env f1 f2 + +let nest at t r = + match r with + | Ok _ | Fail [_] -> r + | Fail traces -> + Fail [Trace (at, "cannot parse expression as `" ^ string_of_typ ~short:true t ^ "`", traces)] + +let rec map_attempt f = function + | [] -> Ok [] + | x::xs -> + let* y = f x in + let* ys = map_attempt f xs in + Ok (y::ys) + +let iter_attempt f xs = + let* _ = map_attempt f xs in Ok () + +let map2_attempt f xs ys = + map_attempt (fun (x, y) -> f x y) (List.combine xs ys) + +let fail at msg = Fail [Trace (at, msg, [])] +let fail_silent = Fail [] + +let fail_atom at atom t msg = + fail at (msg ^ " `" ^ string_of_atom atom ^ "` in type `" ^ string_of_typ ~short:true t ^ "`") + +let fail_infer at construct = + fail at ("cannot infer type of " ^ construct) + +let indent n = String.make (2*n) ' ' + +let rec msg_trace n = function + | Trace (_, _, [trace]) -> msg_trace n trace + | Trace (at, msg, traces) -> + indent n ^ string_of_region at ^ ": " ^ msg_traces (n + 1) msg traces + +and msg_traces n msg = function + | [] -> Printf.printf "[msg] %s\n%!" msg;msg + | traces -> msg ^ ", because\n" ^ String.concat "\n" (List.map (msg_trace n) traces) + +let rec error_trace = function + | Trace (_, _, [trace]) -> error_trace trace + | Trace (at, msg, traces) -> error at (msg_traces 0 msg traces) + +let checkpoint = function + | Ok x -> x + | Fail [trace] -> Printf.printf "[checkpoint]\n%!";error_trace trace + | Fail _ -> assert false (* we only checkpoint around nest *) + +let attempt f x = + try Ok (f x) with Error.Error (at, msg) -> fail at msg + + (* More Errors *) let typ_string env t = @@ -218,20 +309,32 @@ let typ_string env t = else "`" ^ string_of_typ ~short:true t ^ "` = `" ^ string_of_typ ~short:true t' ^ "`" +let msg_typ env phrase t = + phrase ^ " does not match expected type " ^ typ_string env t + +let msg_typ2 env phrase t1 t2 reason = + phrase ^ "'s type " ^ typ_string env t1 ^ + " does not match expected type " ^ typ_string env t2 ^ reason + let error_typ env at phrase t = - error at (phrase ^ " does not match expected type " ^ typ_string env t) + error at (msg_typ env phrase t) let error_typ2 env at phrase t1 t2 reason = - error at (phrase ^ "'s type " ^ typ_string env t1 ^ - " does not match expected type " ^ typ_string env t2 ^ reason) + error at (msg_typ2 env phrase t1 t2 reason) + +let fail_typ env at phrase t = + fail at (msg_typ env phrase t) + +let fail_typ2 env at phrase t1 t2 reason = + fail at (msg_typ2 env phrase t1 t2 reason) type direction = Infer | Check -let error_dir_typ env at phrase dir t expected = +let fail_dir_typ env at phrase dir t expected = match dir with - | Check -> error_typ env at phrase t + | Check -> fail_typ env at phrase t | Infer -> - error at (phrase ^ "'s type `" ^ string_of_typ ~short:true t ^ "`" ^ + fail at (phrase ^ "'s type `" ^ string_of_typ ~short:true t ^ "`" ^ " does not match expected type " ^ expected) @@ -274,7 +377,7 @@ let as_defined_typid' env id args at : typ' * [`Alias | `NoAlias] = let env' = to_eval_env env in let args = List.map (Eval.reduce_arg env') args in let rec lookup = function - | [] -> error_id (id.it $ at) "undefined case of syntax type family" + | [] -> error_id (id.it $ at) "undefined or undetermined case of syntax type family" | (args', t, inst')::insts' -> Debug.(log "el.lookup" (fun _ -> fmt "%s(%s) =: %s(%s)" id.it (el_args args) id.it (el_args args')) @@ -339,6 +442,7 @@ let rec expand_notation env t = | ConT ((t1, _), _), _ -> expand_notation env t1 | RangeT _ as t', _ -> t' | _ -> t' + | exception Error _ -> t' ) | ConT ((t1, _), _) -> expand_notation env t1 | t' -> t' @@ -350,6 +454,7 @@ let rec expand_iter_notation env t = | IterT _ as t'', _ -> t'' | ConT ((t1, _), _), _ -> expand_iter_notation env t1 | _ -> t' + | exception Error _ -> t' ) | ConT ((t1, _), _) -> expand_iter_notation env t1 | t' -> t' @@ -387,8 +492,8 @@ let as_empty_typ_opt env t : unit option = let as_x_typ as_t_opt phrase env dir t at shape = match as_t_opt env t with - | Some x -> x - | None -> error_dir_typ env at phrase dir t shape + | Some x -> Ok x + | None -> fail_dir_typ env at phrase dir t shape let as_num_typ phrase env dir t at = as_x_typ as_num_typ_opt phrase env dir t at "(nat|int|rat|real)" @@ -406,74 +511,79 @@ let as_empty_typ phrase env dir t at = as_x_typ as_empty_typ_opt phrase env dir t at "()" -let rec as_notation_typid' phrase env id args at : typ = +let rec as_notation_typid' phrase env id args at : typ attempt = match as_defined_typid' env id args at with | VarT (id', args'), `Alias -> as_notation_typid' phrase env id' args' at - | ConT ((t, _), _), _ -> t - | (AtomT _ | SeqT _ | InfixT _ | BrackT _ | IterT _) as t, _ -> t $ at - | _ -> error_dir_typ env at phrase Infer (VarT (id, args) $ id.at) "_ ... _" + | ConT ((t, _), _), _ -> Ok t + | (AtomT _ | SeqT _ | InfixT _ | BrackT _ | IterT _) as t, _ -> Ok (t $ at) + | _ -> fail_dir_typ env at phrase Infer (VarT (id, args) $ id.at) "_ ... _" + | exception Error (at', msg) -> fail at' msg -let as_notation_typ phrase env dir t at : typ = +let as_notation_typ phrase env dir t at : typ attempt = match expand_singular env t with | VarT (id, args) -> as_notation_typid' phrase env id args at - | _ -> error_dir_typ env at phrase dir t "_ ... _" + | _ -> fail_dir_typ env at phrase dir t "_ ... _" -let rec as_struct_typid' phrase env id args at : typfield list = +let rec as_struct_typid' phrase env id args at : typfield list attempt = match as_defined_typid' env id args at with | VarT (id', args'), `Alias -> as_struct_typid' phrase env id' args' at - | StrT tfs, _ -> filter_nl tfs - | _ -> error_dir_typ env at phrase Infer (VarT (id, args) $ id.at) "| ..." + | StrT tfs, _ -> Ok (filter_nl tfs) + | _ -> fail_dir_typ env at phrase Infer (VarT (id, args) $ id.at) "| ..." + | exception Error (at', msg) -> fail at' msg -let as_struct_typ phrase env dir t at : typfield list = +let as_struct_typ phrase env dir t at : typfield list attempt = match expand_singular env t with | VarT (id, args) -> as_struct_typid' phrase env id args at - | _ -> error_dir_typ env at phrase dir t "{...}" + | _ -> fail_dir_typ env at phrase dir t "{...}" let rec as_cat_typid' phrase env dir id args at = match as_defined_typid' env id args at with | VarT (id', args'), `Alias -> as_cat_typid' phrase env dir id' args' at - | IterT _, _ -> () + | IterT _, _ -> Ok () | StrT tfs, _ -> - Convert.iter_nl_list (fun (_, (t, _), _) -> - as_cat_typ phrase env dir t at) tfs + iter_attempt (fun (_, (t, _), _) -> as_cat_typ phrase env dir t at) (filter_nl tfs) | _ -> - error at (phrase ^ "'s type `" ^ string_of_typ ~short:true (VarT (id, args) $ id.at) ^ + fail at (phrase ^ "'s type `" ^ string_of_typ ~short:true (VarT (id, args) $ id.at) ^ "` is not concatenable") + | exception Error (at', msg) -> fail at' msg and as_cat_typ phrase env dir t at = match expand env t with | VarT (id, args) -> as_cat_typid' phrase env dir id args at - | IterT _ -> () + | IterT _ -> Ok () | _ -> - error at (phrase ^ "'s type `" ^ string_of_typ ~short:true t ^ "` is not concatenable") + fail at (phrase ^ "'s type `" ^ string_of_typ ~short:true t ^ "` is not concatenable") -let rec as_variant_typid' phrase env id args at : typcase list * dots = +let rec as_variant_typid' phrase env id args at : (typcase list * dots) attempt = match as_defined_typid' env id args at with | VarT (id', args'), `Alias -> as_variant_typid' phrase env id' args' at | CaseT (_dots1, ts, cases, dots2), _ -> - let casess = map_filter_nl_list (fun t -> as_variant_typ "" env Infer t at) ts in - List.concat (filter_nl cases :: List.map fst casess), dots2 - | _ -> error_dir_typ env id.at phrase Infer (VarT (id, args) $ id.at) "| ..." + let* casess = map_attempt (fun t -> as_variant_typ "" env Infer t at) (filter_nl ts) in + Ok (List.concat (filter_nl cases :: List.map fst casess), dots2) + | _ -> fail_dir_typ env id.at phrase Infer (VarT (id, args) $ id.at) "| ..." + | exception Error (at', msg) -> fail at' msg -and as_variant_typid phrase env id args : typcase list * dots = +and as_variant_typid phrase env id args : (typcase list * dots) attempt = as_variant_typid' phrase env id args id.at -and as_variant_typ phrase env dir t at : typcase list * dots = +and as_variant_typ phrase env dir t at : (typcase list * dots) attempt = match expand_singular env t with | VarT (id, args) -> as_variant_typid' phrase env id args at - | _ -> error_dir_typ env at phrase dir t "| ..." + | _ -> fail_dir_typ env at phrase dir t "| ..." let case_has_args env t op at : bool = - let cases, _ = as_variant_typ "" env Check t at in + let cases, _ = checkpoint (as_variant_typ "" env Check t at) in let t, _prems = find_case_sub cases op at t in match t.it with | SeqT ({it = AtomT _; _}::_) -> true | _ -> false + | exception Error _ -> false let is_x_typ as_x_typ env t = - try ignore (as_x_typ "" env Check t no_region); true - with Error _ -> false + match as_x_typ "" env Check t no_region with + | Ok _ -> true + | Fail _ -> false let is_empty_typ = is_x_typ as_empty_typ let is_iter_typ = is_x_typ as_iter_typ @@ -559,28 +669,28 @@ let infer_cmpop' = function | #Bool.cmpop as op -> `Poly op | #Num.cmpop as op -> `Over (infer_cmpop'' op [`NatT; `IntT; `RatT; `RealT]) -let infer_unop env op t1 at : Il.unop * Il.optyp * typ * typ = +let infer_unop env op t1 at : (Il.unop * Il.optyp * typ * typ) attempt = let ops = infer_unop' op in match List.find_opt (fun (_, _, t1', _) -> narrow_typ env t1 (t1' $ at)) ops with - | Some (op', nt, t1', t2') -> op', nt, t1' $ at, t2' $ at + | Some (op', nt, t1', t2') -> Ok (op', nt, t1' $ at, t2' $ at) | None -> - error at ("unary operator `" ^ string_of_unop op ^ + fail at ("unary operator `" ^ string_of_unop op ^ "` is not defined for operand type `" ^ string_of_typ ~short:true t1 ^ "`") -let infer_binop env op t1 t2 at : Il.binop * Il.optyp * typ * typ * typ = +let infer_binop env op t1 t2 at : (Il.binop * Il.optyp * typ * typ * typ) attempt = let ops = infer_binop' op in match List.find_opt (fun (_, _, t1', t2', _) -> narrow_typ env t1 (t1' $ at) && (lax_num || narrow_typ env t2 (t2' $ at))) ops with - | Some (op', nt, t1', t2', t3') -> op', nt, t1' $ at, t2' $ at, t3' $ at + | Some (op', nt, t1', t2', t3') -> Ok (op', nt, t1' $ at, t2' $ at, t3' $ at) | None -> - error at ("binary operator `" ^ string_of_binop op ^ + fail at ("binary operator `" ^ string_of_binop op ^ "` is not defined for operand types `" ^ string_of_typ ~short:true t1 ^ "` and `" ^ string_of_typ ~short:true t2 ^ "`") let infer_cmpop env op - : [`Poly of Il.cmpop | `Over of typ -> typ -> region -> Il.cmpop * Il.optyp * typ] = + : [`Poly of Il.cmpop | `Over of (typ -> typ -> region -> (Il.cmpop * Il.optyp * typ) attempt)] = match infer_cmpop' op with | `Poly op' -> `Poly op' | `Over ops -> `Over (fun t1 t2 at -> @@ -588,9 +698,9 @@ let infer_cmpop env op List.find_opt (fun (_, _, t) -> narrow_typ env t1 (t $ at) && narrow_typ env t2 (t $ at)) ops with - | Some (op', nt, t) -> op', nt, t $ at + | Some (op', nt, t) -> Ok (op', nt, t $ at) | None -> - error at ("comparison operator `" ^ string_of_cmpop op ^ + fail at ("comparison operator `" ^ string_of_cmpop op ^ "` is not defined for operand types `" ^ string_of_typ ~short:true t1 ^ "` and `" ^ string_of_typ ~short:true t2 ^ "`") ) @@ -625,13 +735,14 @@ let rec elab_iter env iter : Il.iter = | List1 -> Il.List1 | ListN (e, id_opt) -> Option.iter (fun id -> - let e' = elab_exp env (VarE (id, []) $ id.at) (NumT `NatT $ id.at) in + let e' = checkpoint (elab_exp env (VarE (id, []) $ id.at) (NumT `NatT $ id.at)) in (* TODO(4, rossberg): extend IL to allow arbitrary pattern exps *) match e'.it with | Il.VarE _ -> () | _ -> error_typ env id.at "iteration variable" (NumT `NatT $ id.at) ) id_opt; - Il.ListN (elab_exp env e (NumT `NatT $ e.at), id_opt) + let e' = checkpoint (elab_exp env e (NumT `NatT $ e.at)) in + Il.ListN (e', id_opt) (* Types *) @@ -662,6 +773,9 @@ and elab_typ env t : Il.typ = error t.at "this type is only allowed in type definitions" and elab_typ_definition env tid t : Il.deftyp = + Debug.(log_at "el.elab_typ_definition" t.at + (fun _ -> fmt "%s = %s" tid.it (el_typ t)) il_deftyp + ) @@ fun _ -> assert (valid_tid tid); (match t.it with | StrT tfs -> @@ -670,10 +784,13 @@ and elab_typ_definition env tid t : Il.deftyp = Il.StructT (map_filter_nl_list (elab_typfield env tid t.at) tfs) | CaseT (dots1, ts, cases, _dots2) -> let cases0 = - if dots1 = Dots then fst (as_variant_typid "own type" env tid []) else [] in + if dots1 = Dots then + fst (checkpoint (as_variant_typid "own type" env tid [])) + else [] + in let casess = map_filter_nl_list (fun t -> - let cases, dots = as_variant_typ "parent type" env Infer t t.at in + let cases, dots = checkpoint (as_variant_typ "parent type" env Infer t t.at) in if dots = Dots then error t.at "cannot include incomplete syntax type"; List.map Iter.clone_typcase cases (* ensure atom annotations are fresh *) @@ -731,7 +848,8 @@ and elab_typfield env tid at ((atom, (t, prems), hints) as tf) : Il.typfield = let es = Convert.pats_of_typs ts in let dims = Dim.check_typdef t prems in let dims' = Dim.Env.map (List.map (elab_iter env')) dims in - let es' = List.map (Dim.annot_exp dims') (List.map2 (elab_exp env') es ts) in + let es' = checkpoint (map2_attempt (elab_exp env') es ts) in + let es' = List.map (Dim.annot_exp dims') es' in let prems' = List.map (Dim.annot_prem dims') (concat_map_filter_nl_list (elab_prem env') prems) in let det = Free.(diff (union (free_list det_exp es) (det_prems prems)) (bound_env env)) in @@ -755,7 +873,8 @@ and elab_typcase env tid at ((_atom, (t, prems), hints) as tc) : Il.typcase = let es = Convert.pats_of_typs ts in let dims = Dim.check_typdef t prems in let dims' = Dim.Env.map (List.map (elab_iter env')) dims in - let es' = List.map (Dim.annot_exp dims') (List.map2 (elab_exp env') es ts) in + let es' = checkpoint (map_attempt Fun.id (List.map2 (elab_exp env') es ts)) in + let es' = List.map (Dim.annot_exp dims') es' in let prems' = List.map (Dim.annot_prem dims') (concat_map_filter_nl_list (elab_prem env') prems) in let det = Free.(diff (union (free_list det_exp es) (det_prems prems)) (bound_env env)) in @@ -784,7 +903,8 @@ and elab_typcon env tid at (((t, prems), hints) as tc) : Il.typcase = let es = Convert.pats_of_typs ts in let dims = Dim.check_typdef t prems in let dims' = Dim.Env.map (List.map (elab_iter env')) dims in - let es' = List.map (Dim.annot_exp dims') (List.map2 (elab_exp env') es ts) in + let es' = checkpoint (map_attempt Fun.id (List.map2 (elab_exp env') es ts)) in + let es' = List.map (Dim.annot_exp dims') es' in let prems' = List.map (Dim.annot_prem dims') (concat_map_filter_nl_list (elab_prem env') prems) in let det = Free.(diff (union (free_list det_exp es) (det_prems prems)) (bound_env env)) in @@ -804,21 +924,21 @@ and elab_typcon env tid at (((t, prems), hints) as tc) : Il.typcase = and elab_typenum env tid (e1, e2o) : typ * (Il.exp -> numtyp -> Il.exp) = assert (valid_tid tid); let _e1' = elab_exp env e1 (NumT `IntT $ e1.at) in (* ensure it's <= int *) - let t1 = typ_of (infer_exp env e1) in (* get precise type *) + let _, t1 = checkpoint (infer_exp env e1) in (* get precise type *) match e2o with | None -> t1, fun eid' nt -> - let e1' = elab_exp env e1 (NumT nt $ e1.at) in (* redo with overall type *) + let e1' = checkpoint (elab_exp env e1 (NumT nt $ e1.at)) in (* redo with overall type *) Il.(CmpE (`EqOp, `BoolT, eid', e1') $$ e1'.at % (BoolT $ e1.at)) | Some e2 -> let at = Source.over_region [e1.at; e2.at] in let _e2' = elab_exp env e2 (NumT `IntT $ e2.at) in - let t2 = typ_of (infer_exp env e2) in + let _, t2 = checkpoint (infer_exp env e2) in (if narrow_typ env t2 t1 then t1 else t2).it $ at, fun eid' nt -> - let e1' = elab_exp env e1 (NumT nt $ e1.at) in - let e2' = elab_exp env e2 (NumT nt $ e2.at) in + let e1' = checkpoint (elab_exp env e1 (NumT nt $ e1.at)) in + let e2' = checkpoint (elab_exp env e2 (NumT nt $ e2.at)) in Il.(BinE (`AndOp, `BoolT, CmpE (`GeOp, (nt :> Il.optyp), eid', e1') $$ e1'.at % (BoolT $ e1.at), CmpE (`LeOp, (nt :> Il.optyp), eid', e2') $$ e2'.at % (BoolT $ e2.at) @@ -899,44 +1019,41 @@ and must_elab_exp env e = (* Returns * - Ok (il_exp, typ) if the type can be inferred - * - Error (at, s) when it cannot, where s is the name of the failing construct - * - raises Error.Error on unrecoverable errors + * - Fail (at, s) when it cannot, where s is the name of the failing construct + * - raises Error.Error on fatal, unrecoverable errors *) -and infer_exp env e : (Il.exp * typ, region * string) result = +and infer_exp env e : (Il.exp * typ) attempt = Debug.(log_at "el.infer_exp" e.at (fun _ -> fmt "%s" (el_exp e)) - (result (fun (e', t) -> fmt "%s : %s" (il_exp e') (el_typ t)) snd) + (function Ok (e', t) -> fmt "%s : %s" (il_exp e') (el_typ t) | _ -> "fail") ) @@ fun _ -> - match infer_exp' env e with - | Ok (e', t') -> let t = t' $ e.at in Ok (e' $$ e.at % elab_typ env t, t) - | Error err -> Error err + let* e', t' = infer_exp' env e in + let t = t' $ e.at in + Ok (e' $$ e.at % elab_typ env t, t) -and infer_exp' env e : (Il.exp' * typ', region * string) result = - let ( let* ) = Result.bind in +and infer_exp' env e : (Il.exp' * typ') attempt = match e.it with | VarE (id, args) -> if args <> [] then (* Args may only occur due to syntactic overloading with types *) error e.at "malformed expression"; if id.it = "_" then - Error (e.at, "wildcard") + fail_infer e.at "wildcard" else - (match + let* t = if bound env.vars id then - Some (find "variable" env.vars id) + Ok (find "variable" env.vars id) else (* If the variable itself is not yet declared, use type hint if available. *) - try - let t = find "variable" env.gvars (strip_var_suffix id) in - env.vars <- bind "variable" env.vars id t; - Some t - with Error _ -> None - with - | Some t -> Ok (Il.VarE id, t.it) - | None -> Error (e.at, "variable") - ) + let* t = choice_forget env + (fun env -> attempt (find "variable" env.gvars) (strip_var_suffix id)) + (fun _env -> fail_infer e.at "variable") + in + env.vars <- bind "variable" env.vars id t; + Ok t + in Ok (Il.VarE id, t.it) | AtomE _ -> - Error (e.at, "atom") + fail_infer e.at "atom" | BoolE b -> Ok (Il.BoolE b, BoolT) | NumE (_op, n) -> @@ -945,20 +1062,21 @@ and infer_exp' env e : (Il.exp' * typ', region * string) result = Ok (Il.TextE s, TextT) | CvtE (e1, nt) -> let* e1', t1 = infer_exp env e1 in - let nt1 = as_num_typ "conversion" env Infer t1 e1.at in - Ok (Il.CvtE (cast_exp "operand" env e1' t1 (NumT nt1 $ e1.at), nt1, nt), NumT nt) + let* nt1 = as_num_typ "conversion" env Infer t1 e1.at in + let* e1'' = cast_exp "operand" env e1' t1 (NumT nt1 $ e1.at) in + Ok (Il.CvtE (e1'', nt1, nt), NumT nt) | UnE (op, e1) -> let* e1', t1 = infer_exp env e1 in - let op', ot, t1', t = infer_unop env op (typ_rep env t1) e.at in - Ok (Il.UnE (op', ot, cast_exp "operand" env e1' t1 t1'), t.it) + let* op', ot, t1', t = infer_unop env op (typ_rep env t1) e.at in + let* e1'' = cast_exp "operand" env e1' t1 t1' in + Ok (Il.UnE (op', ot, e1''), t.it) | BinE (e1, op, e2) -> let* e1', t1 = infer_exp env e1 in let* e2', t2 = infer_exp env e2 in - let op', ot, t1', t2', t = infer_binop env op (typ_rep env t1) (typ_rep env t2) e.at in - Ok (Il.BinE (op', ot, - cast_exp "operand" env e1' t1 t1', - cast_exp "operand" env e2' t2 t2' - ), t.it) + let* op', ot, t1', t2', t = infer_binop env op (typ_rep env t1) (typ_rep env t2) e.at in + let* e1'' = cast_exp "operand" env e1' t1 t1' in + let* e2'' = cast_exp "operand" env e2' t2 t2' in + Ok (Il.BinE (op', ot, e1'', e2''), t.it) | CmpE (e1, op, ({it = CmpE (e21, _, _); _} as e2)) -> let* e1', _t1 = infer_exp env (CmpE (e1, op, e21) $ e.at) in let* e2', _t2 = infer_exp env e2 in @@ -969,79 +1087,78 @@ and infer_exp' env e : (Il.exp' * typ', region * string) result = let* e1', e2' = if must_elab_exp env e1 then (* TODO: use backtracking *) let* e2', t2 = infer_exp env e2 in - let e1' = elab_exp env e1 t2 in + let* e1' = elab_exp env e1 t2 in Ok (e1', e2') else let* e1', t1 = infer_exp env e1 in - let e2' = elab_exp env e2 t1 in + let* e2' = elab_exp env e2 t1 in Ok (e1', e2') in Ok (Il.CmpE (op', `BoolT, e1', e2'), BoolT) | `Over elab_cmpop' -> let* e1', t1 = infer_exp env e1 in let* e2', t2 = infer_exp env e2 in - let op', ot, t = elab_cmpop' (typ_rep env t1) (typ_rep env t2) e.at in - Ok (Il.CmpE (op', ot, - cast_exp "operand" env e1' t1 t, - cast_exp "operand" env e2' t2 t - ), BoolT) + let* op', ot, t = elab_cmpop' (typ_rep env t1) (typ_rep env t2) e.at in + let* e1'' = cast_exp "operand" env e1' t1 t in + let* e2'' = cast_exp "operand" env e2' t2 t in + Ok (Il.CmpE (op', ot, e1'', e2''), BoolT) ) | IdxE (e1, e2) -> let* e1', t1 = infer_exp env e1 in - let t = as_list_typ "expression" env Infer t1 e1.at in - let e2' = elab_exp env e2 (NumT `NatT $ e2.at) in + let* t = as_list_typ "expression" env Infer t1 e1.at in + let* e2' = elab_exp env e2 (NumT `NatT $ e2.at) in Ok (Il.IdxE (e1', e2'), t.it) | SliceE (e1, e2, e3) -> let* e1', t1 = infer_exp env e1 in - let _t' = as_list_typ "expression" env Infer t1 e1.at in - let e2' = elab_exp env e2 (NumT `NatT $ e2.at) in - let e3' = elab_exp env e3 (NumT `NatT $ e3.at) in + let* _t' = as_list_typ "expression" env Infer t1 e1.at in + let* e2' = elab_exp env e2 (NumT `NatT $ e2.at) in + let* e3' = elab_exp env e3 (NumT `NatT $ e3.at) in Ok (Il.SliceE (e1', e2', e3'), t1.it) | UpdE (e1, p, e2) -> let* e1', t1 = infer_exp env e1 in - let p', t2 = elab_path env p t1 in - let e2' = elab_exp env e2 t2 in + let* p', t2 = elab_path env p t1 in + let* e2' = elab_exp env e2 t2 in Ok (Il.UpdE (e1', p', e2'), t1.it) | ExtE (e1, p, e2) -> let* e1', t1 = infer_exp env e1 in - let p', t2 = elab_path env p t1 in - let _t21 = as_list_typ "path" env Infer t2 p.at in - let e2' = elab_exp env e2 t2 in + let* p', t2 = elab_path env p t1 in + let* _t21 = as_list_typ "path" env Infer t2 p.at in + let* e2' = elab_exp env e2 t2 in Ok (Il.ExtE (e1', p', e2'), t1.it) | StrE _ -> - Error (e.at, "record") + fail_infer e.at "record" | DotE (e1, atom) -> let* e1', t1 = infer_exp env e1 in - let tfs = as_struct_typ "expression" env Infer t1 e1.at in - let t, prems = find_field tfs atom e1.at t1 in + let* tfs = as_struct_typ "expression" env Infer t1 e1.at in + let* t, prems = attempt (find_field tfs atom e1.at) t1 in let e' = Il.DotE (e1', elab_atom atom (expand_id env t1)) in let e'' = if prems = [] then e' else Il.ProjE (e' $$ e.at % elab_typ env t, 0) in Ok (e'', t.it) | CommaE (e1, e2) -> let* e1', t1 = infer_exp env e1 in - let tfs = as_struct_typ "expression" env Infer t1 e1.at in - let _ = as_cat_typ "expression" env Infer t1 e.at in + let* tfs = as_struct_typ "expression" env Infer t1 e1.at in + let* _ = as_cat_typ "expression" env Infer t1 e.at in (* TODO(4, rossberg): this is a bit of a hack, can we avoid it? *) (match e2.it with | SeqE ({it = AtomE atom; at; _} :: es2) -> - let _t2 = find_field tfs atom at t1 in + let* _t2 = attempt (find_field tfs atom at) t1 in let e2 = match es2 with [e2] -> e2 | _ -> SeqE es2 $ e2.at in - let e2' = elab_exp env (StrE [Elem (atom, e2)] $ e2.at) t1 in + let* e2' = elab_exp env (StrE [Elem (atom, e2)] $ e2.at) t1 in Ok (Il.CompE (e2', e1'), t1.it) | _ -> error e.at "malformed comma operator" ) | CatE (e1, e2) -> let* e1', t1 = infer_exp env e1 in - let _ = as_cat_typ "operand" env Infer t1 e.at in - let e2' = elab_exp env e2 t1 in + let* _ = as_cat_typ "operand" env Infer t1 e.at in + let* e2' = elab_exp env e2 t1 in Ok ((if is_iter_typ env t1 then Il.CatE (e1', e2') else Il.CompE (e1', e2')), t1.it) | MemE (e1, e2) -> let* e1', t1 = infer_exp env e1 in - let e2' = elab_exp env e2 (IterT (t1, List) $ e2.at) in + let* e2' = elab_exp env e2 (IterT (t1, List) $ e2.at) in Ok (Il.MemE (e1', e2'), BoolT) | LenE e1 -> let* e1', t1 = infer_exp env e1 in - let _t11 = as_list_typ "expression" env Infer t1 e1.at in + let* _t11 = as_list_typ "expression" env Infer t1 e1.at in Ok (Il.LenE e1', NumT `NatT) | SizeE id -> let _ = find "grammar" env.grams id in @@ -1056,7 +1173,7 @@ and infer_exp' env e : (Il.exp' * typ', region * string) result = let as', s = elab_args `Rhs env as_ ps e.at in Ok (Il.CallE (id, as'), (Subst.subst_typ s t).it) | EpsE -> - Error (e.at, "empty sequence") + fail_infer e.at "empty sequence" | SeqE [] -> (* treat as empty tuple, not principal *) Ok (Il.TupE [], TupT []) | SeqE es -> (* treat as homogeneous sequence, not principal *) @@ -1065,16 +1182,17 @@ and infer_exp' env e : (Il.exp' * typ', region * string) result = if List.for_all (equiv_typ env t) (List.tl ts) then Ok (Il.ListE es', IterT (t, List)) else - Error (e.at, "expression sequence") - | InfixE _ -> Error (e.at, "infix expression") - | BrackE _ -> Error (e.at, "bracket expression") + fail_infer e.at "expression sequence" + | InfixE _ -> fail_infer e.at "infix expression" + | BrackE _ -> fail_infer e.at "bracket expression" | IterE (e1, iter) -> let iter' = elab_iterexp env iter in let* e1', t1 = infer_exp env e1 in Ok (Il.IterE (e1', iter'), IterT (t1, match iter with ListN _ -> List | _ -> iter)) | TypE (e1, t) -> let _t' = elab_typ env t in - Ok ((elab_exp env e1 t).it, t.it) + let* e1' = elab_exp env e1 t in + Ok (e1'.it, t.it) | HoleE _ -> error e.at "misplaced hole" | FuseE _ -> error e.at "misplaced token concatenation" | UnparenE _ -> error e.at "misplaced unparenthesize" @@ -1083,119 +1201,119 @@ and infer_exp' env e : (Il.exp' * typ', region * string) result = and infer_exp_list env = function | [] -> Ok ([], []) | e::es -> - let ( let* ) = Result.bind in let* e', t = infer_exp env e in let* es', ts = infer_exp_list env es in Ok (e'::es', t::ts) -and typ_of = function - | Ok (_, t) -> t - | Error (at, construct) -> error at ("cannot infer type of " ^ construct) -and elab_exp env e t : Il.exp = - try - let env' = local_env env in - let e' = elab_exp' env' e t in - promote_env env' env; - e' $$ e.at % elab_typ env t - with Error _ when is_notation_typ env t -> - Debug.(log_in_at "el.elab_exp" e.at - (fun _ -> fmt "%s : %s # backtrack" (el_exp e) (el_typ t)) - ); - elab_exp_notation env (expand_id env t) e (as_notation_typ "" env Check t e.at) t +and elab_exp env e t : Il.exp attempt = + nest e.at t (choice env + (fun env -> + let* e' = elab_exp' env e t in + let* t' = attempt (elab_typ env) t in + Ok (e' $$ e.at % t') + ) + (fun env -> + if not (is_notation_typ env t) then fail_silent else + ( + Debug.(log_in_at "el.elab_exp" e.at + (fun _ -> fmt "%s : %s # backtrack" (el_exp e) (el_typ t)) + ); + let* t1 = as_notation_typ "" env Check t e.at in + elab_exp_notation env (expand_id env t) e t1 t + ) + ) + ) -and elab_exp' env e t : Il.exp' = +and elab_exp' env e t : Il.exp' attempt = Debug.(log_at "el.elab_exp" e.at (fun _ -> fmt "%s : %s" (el_exp e) (el_typ t)) - (fun e' -> fmt "%s" (il_exp (e' $$ no_region % elab_typ env t))) + (function Ok e' -> fmt "%s" (il_exp (e' $$ no_region % elab_typ env t)) | _ -> "fail") ) @@ fun _ -> match e.it with | BoolE _ | NumE _ | TextE _ | CvtE _ | UnE _ | BinE _ | CmpE _ | IdxE _ | DotE _ | MemE _ | LenE _ | SizeE _ | CallE _ | TypE _ | HoleE _ | FuseE _ | UnparenE _ | LatexE _ -> - (match infer_exp env e with - | Ok (e', t') -> - cast_exp' "expression" env e' t' t - | Error (at, construct) -> - error at ("cannot infer type of " ^ construct) - ) + let* e', t' = infer_exp env e in + cast_exp' "expression" env e' t' t | VarE (id, _) when id.it = "_" -> - Il.VarE id + Ok (Il.VarE id) | VarE (id, _) -> - (match infer_exp env e with - | Ok (e', t') -> + choice env + (fun env -> + let* e', t' = infer_exp env e in cast_exp' "expression" env e' t' t - | Error _ -> (* TODO: use backtracking *) + ) + (fun env -> if is_iter_typ env t then (* Never infer an iteration type for a variable *) - let t1, iter = as_iter_typ "" env Check t e.at in - let e' = elab_exp env e t1 in - lift_exp' e' iter - else ( + let* t1, iter = as_iter_typ "" env Check t e.at in + let* e' = elab_exp env e t1 in + Ok (lift_exp' e' iter) + else if not (bound env.gvars (strip_var_suffix id)) then + let _ = () in env.vars <- bind "variable" env.vars id t; - Il.VarE id - ) + Ok (Il.VarE id) + else + fail_silent (* suitable error was produced by infer_exp already *) ) | SliceE (e1, e2, e3) -> - let _t' = as_list_typ "expression" env Check t e1.at in - let e1' = elab_exp env e1 t in - let e2' = elab_exp env e2 (NumT `NatT $ e2.at) in - let e3' = elab_exp env e3 (NumT `NatT $ e3.at) in - Il.SliceE (e1', e2', e3') + let* _t' = as_list_typ "expression" env Check t e1.at in + let* e1' = elab_exp env e1 t in + let* e2' = elab_exp env e2 (NumT `NatT $ e2.at) in + let* e3' = elab_exp env e3 (NumT `NatT $ e3.at) in + Ok (Il.SliceE (e1', e2', e3')) | UpdE (e1, p, e2) -> - let e1' = elab_exp env e1 t in - let p', t2 = elab_path env p t in - let e2' = elab_exp env e2 t2 in - Il.UpdE (e1', p', e2') + let* e1' = elab_exp env e1 t in + let* p', t2 = elab_path env p t in + let* e2' = elab_exp env e2 t2 in + Ok (Il.UpdE (e1', p', e2')) | ExtE (e1, p, e2) -> - let e1' = elab_exp env e1 t in - let p', t2 = elab_path env p t in - let _t21 = as_list_typ "path" env Check t2 p.at in - let e2' = elab_exp env e2 t2 in - Il.ExtE (e1', p', e2') + let* e1' = elab_exp env e1 t in + let* p', t2 = elab_path env p t in + let* _t21 = as_list_typ "path" env Check t2 p.at in + let* e2' = elab_exp env e2 t2 in + Ok (Il.ExtE (e1', p', e2')) | StrE efs -> - let tfs = as_struct_typ "record" env Check t e.at in - let efs' = elab_expfields env (expand_id env t) (filter_nl efs) tfs t e.at in - Il.StrE efs' + let* tfs = as_struct_typ "record" env Check t e.at in + let* efs' = elab_expfields env (expand_id env t) (filter_nl efs) tfs t e.at in + Ok (Il.StrE efs') | CommaE (e1, e2) -> - let e1' = elab_exp env e1 t in - let tfs = as_struct_typ "expression" env Check t e1.at in - let _ = as_cat_typ "expression" env Check t e.at in + let* e1' = elab_exp env e1 t in + let* tfs = as_struct_typ "expression" env Check t e1.at in + let* _ = as_cat_typ "expression" env Check t e.at in (* TODO(4, rossberg): this is a bit of a hack, can we avoid it? *) (match e2.it with | SeqE ({it = AtomE atom; at; _} :: es2) -> - let _t2 = find_field tfs atom at t in + let* _t2 = attempt (find_field tfs atom at) t in let e2 = match es2 with [e2] -> e2 | _ -> SeqE es2 $ e2.at in - let e2' = elab_exp env (StrE [Elem (atom, e2)] $ e2.at) t in - Il.CompE (e2', e1') + let* e2' = elab_exp env (StrE [Elem (atom, e2)] $ e2.at) t in + Ok (Il.CompE (e2', e1')) | _ -> error e.at "malformed comma operator" ) | CatE (e1, e2) -> - let _ = as_cat_typ "expression" env Check t e.at in - let e1' = elab_exp env e1 t in - let e2' = elab_exp env e2 t in - if is_iter_typ env t then Il.CatE (e1', e2') else Il.CompE (e1', e2') + let* _ = as_cat_typ "expression" env Check t e.at in + let* e1' = elab_exp env e1 t in + let* e2' = elab_exp env e2 t in + Ok (if is_iter_typ env t then Il.CatE (e1', e2') else Il.CompE (e1', e2')) | ParenE (e1, `Sig) when is_iter_typ env t -> (* Significant parentheses indicate a singleton *) - let t1, _iter = as_iter_typ "expression" env Check t e.at in - let e1' = elab_exp env e1 t1 in + let* t1, _iter = as_iter_typ "expression" env Check t e.at in + let* e1' = elab_exp env e1 t1 in cast_exp' "expression" env e1' t1 t | ParenE (e1, _) | ArithE e1 -> elab_exp' env e1 t | TupE es -> - let ts = as_tup_typ "tuple" env Check t e.at in - if List.length es <> List.length ts then - error e.at "arity mismatch for expression list"; - let es' = List.map2 (elab_exp env) es ts in - Il.TupE es' + let* ts = as_tup_typ "tuple" env Check t e.at in + let* es' = elab_exp_list env es ts e.at in + Ok (Il.TupE es') | SeqE [] when is_empty_typ env t -> - (match infer_exp env e with - | Ok (e', t') -> cast_exp' "empty expression" env e' t' t - | Error _ -> assert false - ) + let* e', t' = infer_exp env e in + cast_exp' "empty expression" env e' t' t | EpsE | SeqE _ when is_iter_typ env t -> let es = unseq_exp e in - elab_exp_iter' env es (as_iter_typ "" env Check t e.at) t e.at + let* t1, iter = as_iter_typ "" env Check t e.at in + elab_exp_iter' env es (t1, iter) t e.at | EpsE | AtomE _ | InfixE _ @@ -1205,177 +1323,193 @@ and elab_exp' env e t : Il.exp' = * either a defined notation/variant type or (for SeqE) an iteration type; * the latter case is already captured above *) if is_notation_typ env t then - let nt = as_notation_typ "" env Check t e.at in - (elab_exp_notation env (expand_id env t) e nt t).it + let* nt = as_notation_typ "" env Check t e.at in + let* e' = elab_exp_notation env (expand_id env t) e nt t in + Ok e'.it else if is_variant_typ env t then - let tcs, _ = as_variant_typ "" env Check t e.at in - (elab_exp_variant env (expand_id env t) e tcs t e.at).it + let* tcs, _ = as_variant_typ "" env Check t e.at in + let* e' = elab_exp_variant env (expand_id env t) e tcs t e.at in + Ok e'.it else - error_typ env e.at "expression" t + fail_typ env e.at "expression" t | IterE (e1, iter2) -> (* An iteration expression must match the expected type directly, * significant parentheses have to be used otherwise *) - let t1, iter = as_iter_typ "iteration" env Check t e.at in + let* t1, iter = as_iter_typ "iteration" env Check t e.at in if (iter = Opt) <> (iter2 = Opt) then - error_typ env e.at "iteration expression" t; + fail_typ env e.at "iteration expression" t else let iter2' = elab_iterexp env iter2 in - let e1' = elab_exp env e1 t1 in - Il.IterE (e1', iter2') + let* e1' = elab_exp env e1 t1 in + Ok (Il.IterE (e1', iter2')) + +and elab_exp_list env es ts at : Il.exp list attempt = + match es, ts with + | [], [] -> Ok [] + | e::es, t::ts -> + let* e' = elab_exp env e t in + let* es' = elab_exp_list env es ts at in + Ok (e'::es') + | _, _ -> + fail at "arity mismatch for expression list" -and elab_expfields env tid efs tfs t0 at : Il.expfield list = +and elab_expfields env tid efs tfs t0 at : Il.expfield list attempt = Debug.(log_in_at "el.elab_expfields" at (fun _ -> fmt "{%s} : {%s} = %s" (list el_expfield efs) (list el_typfield tfs) (el_typ t0)) ); assert (valid_tid tid); match efs, tfs with - | [], [] -> [] + | [], [] -> Ok [] | (atom1, e)::efs2, (atom2, (t, prems), _)::tfs2 when atom1.it = atom2.it -> - let es', _s = elab_exp_notation' env tid e t in - let efs2' = elab_expfields env tid efs2 tfs2 t0 at in + let* es', _s = elab_exp_notation' env tid e t in + let* efs2' = elab_expfields env tid efs2 tfs2 t0 at in let e' = (if prems = [] then tup_exp' else tup_exp_bind') es' e.at in - (elab_atom atom1 tid, e') :: efs2' + Ok ((elab_atom atom1 tid, e') :: efs2') | _, (atom, (t, prems), _)::tfs2 -> let atom' = string_of_atom atom in - let es' = - [cast_empty ("omitted record field `" ^ atom' ^ "`") env t at (elab_typ env t)] in - let e' = (if prems = [] then tup_exp' else tup_exp_bind') es' at in - let efs2' = elab_expfields env tid efs tfs2 t0 at in - (elab_atom atom tid, e') :: efs2' + let* e1' = + cast_empty ("omitted record field `" ^ atom' ^ "`") env t at (elab_typ env t) in + let e' = (if prems = [] then tup_exp' else tup_exp_bind') [e1'] at in + let* efs2' = elab_expfields env tid efs tfs2 t0 at in + Ok ((elab_atom atom tid, e') :: efs2') | (atom, e)::_, [] -> - error_atom e.at atom t0 "undefined or misplaced record field" + fail_atom e.at atom t0 "undefined or misplaced record field" -and elab_exp_iter env es (t1, iter) t at : Il.exp = - let e' = elab_exp_iter' env es (t1, iter) t at in - e' $$ at % elab_typ env t +and elab_exp_iter env es (t1, iter) t at : Il.exp attempt = + let* e' = elab_exp_iter' env es (t1, iter) t at in + Ok (e' $$ at % elab_typ env t) -and elab_exp_iter' env es (t1, iter) t at : Il.exp' = +and elab_exp_iter' env es (t1, iter) t at : Il.exp' attempt = Debug.(log_at "el.elab_exp_iter" at (fun _ -> fmt "%s : %s = (%s)%s" (seq el_exp es) (el_typ t) (el_typ t1) (el_iter iter)) - (fun e' -> fmt "%s" (il_exp (e' $$ at % elab_typ env t))) + (function Ok e' -> fmt "%s" (il_exp (e' $$ at % elab_typ env t)) | _ -> "fail") ) @@ fun _ -> match es, iter with (* If the sequence actually starts with a non-nullary constructor, * then assume this is a singleton iteration and fallback to variant *) | {it = AtomE atom; at = at1; _}::_, _ when is_variant_typ env t1 && case_has_args env t1 atom at1 -> - let cases, _dots = as_variant_typ "" env Check t1 at in - lift_exp' (elab_exp_variant env (expand_id env t1) (SeqE es $ at) cases t1 at) iter + let* cases, _dots = as_variant_typ "" env Check t1 at in + let* e' = elab_exp_variant env (expand_id env t1) (SeqE es $ at) cases t1 at in + Ok (lift_exp' e' iter) (* An empty sequence represents the None case for options *) | [], Opt -> - Il.OptE None + Ok (Il.OptE None) (* An empty sequence represents the Nil case for lists *) | [], List -> - Il.ListE [] + Ok (Il.ListE []) (* All other elements are either splices or (by cast injection) elements *) | e1::es2, List -> - let e1' = elab_exp env e1 t in - let e2' = elab_exp_iter env es2 (t1, iter) t at in - cat_exp' e1' e2' + let* e1' = elab_exp env e1 t in + let* e2' = elab_exp_iter env es2 (t1, iter) t at in + Ok (cat_exp' e1' e2') | _, _ -> - error_typ env at "expression" t + fail_typ env at "expression" t -and elab_exp_notation env tid e nt t : Il.exp = +and elab_exp_notation env tid e nt t : Il.exp attempt = (* Convert notation into applications of mixin operators *) assert (valid_tid tid); - let es', _s = elab_exp_notation' env tid e nt in + let* es', _s = elab_exp_notation' env tid e nt in let mixop, _, _ = elab_typ_notation env tid nt in - Il.CaseE (mixop, tup_exp_bind' es' e.at) $$ e.at % elab_typ env t + Ok (Il.CaseE (mixop, tup_exp_bind' es' e.at) $$ e.at % elab_typ env t) -and elab_exp_notation' env tid e t : Il.exp list * Subst.t = +and elab_exp_notation' env tid e t : (Il.exp list * Subst.t) attempt = Debug.(log_at "el.elab_exp_notation" e.at (fun _ -> fmt "%s : %s" (el_exp e) (el_typ t)) - (fun (es', _) -> fmt "%s" (seq il_exp es')) + (function Ok (es', _) -> fmt "%s" (seq il_exp es') | _ -> "fail") ) @@ fun _ -> assert (valid_tid tid); match e.it, t.it with | AtomE atom, AtomT atom' -> - if atom.it <> atom'.it then error_typ env e.at "atom" t; - ignore (elab_atom atom tid); - [], Subst.empty + if atom.it <> atom'.it then fail_typ env e.at "atom" t else + let _ = elab_atom atom tid in + Ok ([], Subst.empty) | InfixE (e1, atom, e2), InfixT (_, atom', _) when Atom.sub atom' atom -> let e21 = ParenE (SeqE [] $ e2.at, `Insig) $ e2.at in elab_exp_notation' env tid (InfixE (e1, atom', SeqE [e21; e2] $ e2.at) $ e.at) t | InfixE (e1, atom, e2), InfixT (t1, atom', t2) -> - if atom.it <> atom'.it then error_typ env e.at "infix expression" t; - let es1', s1 = elab_exp_notation' env tid e1 t1 in - let es2', s2 = elab_exp_notation' env tid e2 (Subst.subst_typ s1 t2) in - ignore (elab_atom atom tid); - es1' @ es2', Subst.union s1 s2 + if atom.it <> atom'.it then fail_typ env e.at "infix expression" t else + let* es1', s1 = elab_exp_notation' env tid e1 t1 in + let* es2', s2 = elab_exp_notation' env tid e2 (Subst.subst_typ s1 t2) in + let _ = elab_atom atom tid in + Ok (es1' @ es2', Subst.union s1 s2) | BrackE (l, e1, r), BrackT (l', t1, r') -> - if (l.it, r.it) <> (l'.it, r'.it) then error_typ env e.at "bracket expression" t; - ignore (elab_atom l tid); - ignore (elab_atom r tid); + if (l.it, r.it) <> (l'.it, r'.it) then fail_typ env e.at "bracket expression" t else + let _ = elab_atom l tid in + let _ = elab_atom r tid in elab_exp_notation' env tid e1 t1 | SeqE [], SeqT [] -> - [], Subst.empty + Ok ([], Subst.empty) (* Iterations at the end of a sequence may be inlined *) | _, SeqT [t1] when is_iter_typ env t1 -> elab_exp_notation' env tid e t1 (* Optional iterations may always be inlined, use backtracking *) | SeqE (e1::es2), SeqT (t1::ts2) when is_opt_notation_typ env t1 -> - (try - let env' = local_env env in - let es1' = [cast_empty "omitted sequence tail" env' t1 e.at (!!!env' tid t1)] in - let es2', s2 = elab_exp_notation' env' tid e (SeqT ts2 $ t.at) in - promote_env env' env; - es1' @ es2', s2 - with Error _ -> + choice env + (fun env -> + let* e1' = cast_empty "omitted sequence tail" env t1 e.at (!!!env tid t1) in + let* es2', s2 = elab_exp_notation' env tid e (SeqT ts2 $ t.at) in + Ok (e1' :: es2', s2) + ) + (fun env -> Debug.(log_in_at "el.elab_exp_notation" e.at (fun _ -> fmt "%s : %s # backtrack" (el_exp e) (el_typ t)) ); - let es1', s1 = elab_exp_notation' env tid e1 t1 in - let es2', s2 = + let* es1', s1 = elab_exp_notation' env tid e1 t1 in + let* es2', s2 = elab_exp_notation' env tid (SeqE es2 $ e.at) (Subst.subst_typ s1 (SeqT ts2 $ t.at)) in - es1' @ es2', Subst.union s2 s2 + Ok (es1' @ es2', Subst.union s2 s2) ) | SeqE ({it = AtomE atom; at; _}::es2), SeqT ({it = AtomT atom'; _}::_) when Atom.sub atom' atom -> let e21 = ParenE (SeqE [] $ at, `Insig) $ at in elab_exp_notation' env tid (SeqE ((AtomE atom' $ at) :: e21 :: es2) $ e.at) t | SeqE (e1::es2), SeqT (t1::ts2) -> - let es1', s1 = elab_exp_notation' env tid (unparen_exp e1) t1 in - let es2', s2 = + let* es1', s1 = elab_exp_notation' env tid (unparen_exp e1) t1 in + let* es2', s2 = elab_exp_notation' env tid (SeqE es2 $ e.at) (Subst.subst_typ s1 (SeqT ts2 $ t.at)) in - es1' @ es2', Subst.union s1 s2 + Ok (es1' @ es2', Subst.union s1 s2) (* Trailing elements can be omitted if they can be eps *) | SeqE [], SeqT (t1::ts2) -> - let es1' = [cast_empty "omitted sequence tail" env t1 e.at (!!!env tid t1)] in - let es2', s2 = + let* e1' = cast_empty "omitted sequence tail" env t1 e.at (!!!env tid t1) in + let* es2', s2 = elab_exp_notation' env tid (SeqE [] $ e.at) (SeqT ts2 $ t.at) in - es1' @ es2', s2 + Ok (e1' :: es2', s2) | SeqE (e1::_), SeqT [] -> - error e1.at + fail e1.at "superfluous expression does not match expected empty notation type" (* Since trailing elements can be omitted, a singleton may match a sequence *) | _, SeqT _ -> elab_exp_notation' env tid (SeqE [e] $ e.at) t | SeqE [e1], IterT _ -> - [elab_exp env e1 t], Subst.empty + let* e1' = elab_exp env e1 t in + Ok ([e1'], Subst.empty) | (EpsE | SeqE _), IterT (t1, iter) -> - [elab_exp_notation_iter env tid (unseq_exp e) (t1, iter) t e.at], Subst.empty + let* e' = elab_exp_notation_iter env tid (unseq_exp e) (t1, iter) t e.at in + Ok ([e'], Subst.empty) | IterE (e1, iter1), IterT (t1, iter) -> if iter = Opt && iter1 <> Opt then - error_typ env e.at "iteration expression" t; + fail_typ env e.at "iteration expression" t else let iter1' = elab_iterexp env iter1 in - let es1', _s1 = elab_exp_notation' env tid e1 t1 in - [Il.IterE (tup_exp' es1' e1.at, iter1') $$ e.at % !!!env tid t], Subst.empty + let* es1', _s1 = elab_exp_notation' env tid e1 t1 in + Ok ([Il.IterE (tup_exp' es1' e1.at, iter1') $$ e.at % !!!env tid t], Subst.empty) (* Significant parentheses indicate a singleton *) | ParenE (e1, `Sig), IterT (t1, iter) -> - let es', _s = elab_exp_notation' env tid e1 t1 in - [lift_exp' (tup_exp' es' e.at) iter $$ e.at % elab_typ env t], Subst.empty + let* es', _s = elab_exp_notation' env tid e1 t1 in + Ok ([lift_exp' (tup_exp' es' e.at) iter $$ e.at % elab_typ env t], Subst.empty) (* Elimination forms are considered splices *) | (IdxE _ | SliceE _ | UpdE _ | ExtE _ | DotE _ | CallE _), IterT _ -> - [elab_exp env e t], Subst.empty + let* e' = elab_exp env e t in + Ok ([e'], Subst.empty) (* All other expressions are considered splices *) (* TODO(4, rossberg): can't they be splices, too? *) | _, IterT (t1, iter) -> - let es', _s = elab_exp_notation' env tid e t1 in - [lift_exp' (tup_exp' es' e.at) iter $$ e.at % !!!env tid t], Subst.empty + let* es', _s = elab_exp_notation' env tid e t1 in + Ok ([lift_exp' (tup_exp' es' e.at) iter $$ e.at % !!!env tid t], Subst.empty) | ParenE (e1, _), _ | ArithE e1, _ -> @@ -1384,19 +1518,20 @@ and elab_exp_notation' env tid e t : Il.exp list * Subst.t = elab_exp_notation' env tid e t1 | _, _ -> - [elab_exp env e t], Subst.add_varid Subst.empty (Convert.varid_of_typ t) e + let* e' = elab_exp env e t in + Ok ([e'], Subst.add_varid Subst.empty (Convert.varid_of_typ t) e) -and elab_exp_notation_iter env tid es (t1, iter) t at : Il.exp = +and elab_exp_notation_iter env tid es (t1, iter) t at : Il.exp attempt = assert (valid_tid tid); - let e' = elab_exp_notation_iter' env tid es (t1, iter) t at in + let* e' = elab_exp_notation_iter' env tid es (t1, iter) t at in let _, ts', _ = elab_typ_notation env tid t in - e' $$ at % tup_typ' ts' t.at + Ok (e' $$ at % tup_typ' ts' t.at) -and elab_exp_notation_iter' env tid es (t1, iter) t at : Il.exp' = +and elab_exp_notation_iter' env tid es (t1, iter) t at : Il.exp' attempt = Debug.(log_at "el.elab_exp_notation_iter" at (fun _ -> fmt "%s : %s = (%s)%s" (seq el_exp es) (el_typ t) (el_typ t1) (el_iter iter)) - (fun e' -> fmt "%s" (il_exp (e' $$ at % elab_typ env t))) + (function Ok e' -> fmt "%s" (il_exp (e' $$ at % (Il.TupT [] $ at))) | _ -> "fail") ) @@ fun _ -> assert (tid.it <> ""); match es, iter with @@ -1404,41 +1539,42 @@ and elab_exp_notation_iter' env tid es (t1, iter) t at : Il.exp' = * then assume this is a singleton iteration and fallback to variant *) | {it = AtomE atom; at = at1; _}::_, _ when is_variant_typ env t1 && case_has_args env t1 atom at1 -> - let cases, _ = as_variant_typ "expression" env Check t1 at in - lift_exp' (elab_exp_variant env (expand_id env t1) (SeqE es $ at) cases t1 at) iter + let* cases, _ = as_variant_typ "expression" env Check t1 at in + let* e' = elab_exp_variant env (expand_id env t1) (SeqE es $ at) cases t1 at in + Ok (lift_exp' e' iter) (* An empty sequence represents the None case for options *) | [], Opt -> - Il.OptE None + Ok (Il.OptE None) (* An empty sequence represents the Nil case for lists *) | [], List -> - Il.ListE [] + Ok (Il.ListE []) (* All other elements are either splices or (by cast injection) elements; * nested expressions must be lifted into a tuple *) | e1::es2, List -> - let es1', _s1 = elab_exp_notation' env tid e1 t in - let e2' = elab_exp_notation_iter env tid es2 (t1, iter) t at in - cat_exp' (tup_exp' es1' e1.at) e2' + let* es1', _s1 = elab_exp_notation' env tid e1 t in + let* e2' = elab_exp_notation_iter env tid es2 (t1, iter) t at in + Ok (cat_exp' (tup_exp' es1' e1.at) e2') | _, _ -> - error_typ env at "expression" t + fail_typ env at "expression" t -and elab_exp_variant env tid e cases t at : Il.exp = +and elab_exp_variant env tid e cases t at : Il.exp attempt = Debug.(log_at "el.elab_exp_variant" e.at (fun _ -> fmt "%s : %s = %s" (el_exp e) tid.it (el_typ t)) - (fun e' -> fmt "%s" (il_exp e')) + (function Ok e' -> fmt "%s" (il_exp e') | _ -> "fail") ) @@ fun _ -> assert (valid_tid tid); - let atom = + let* atom = match e.it with | AtomE atom | SeqE ({it = AtomE atom; _}::_) | InfixE (_, atom, _) - | BrackE (atom, _, _) -> atom - | _ -> error_typ env at "expression" t + | BrackE (atom, _, _) -> Ok atom + | _ -> fail_typ env at "expression" t in - let t1, _prems = find_case_sub cases atom at t in - let es', _s = elab_exp_notation' env tid e t1 in + let* t1, _prems = attempt (find_case_sub cases atom at) t in + let* es', _s = elab_exp_notation' env tid e t1 in let t2 = expand_singular env t $ at in let t2' = elab_typ env t2 in let mixop, _, _ = elab_typ_notation env tid t1 in @@ -1446,40 +1582,40 @@ and elab_exp_variant env tid e cases t at : Il.exp = (Il.CaseE (mixop, tup_exp_bind' es' at) $$ at % t2') t2 t -and elab_path env p t : Il.path * typ = - let p', t' = elab_path' env p t in - p' $$ p.at % elab_typ env t', t' +and elab_path env p t : (Il.path * typ) attempt = + let* p', t' = elab_path' env p t in + Ok (p' $$ p.at % elab_typ env t', t') -and elab_path' env p t : Il.path' * typ = +and elab_path' env p t : (Il.path' * typ) attempt = match p.it with | RootP -> - Il.RootP, t + Ok (Il.RootP, t) | IdxP (p1, e1) -> - let p1', t1 = elab_path env p1 t in - let e1' = elab_exp env e1 (NumT `NatT $ e1.at) in - let t' = as_list_typ "path" env Check t1 p1.at in - Il.IdxP (p1', e1'), t' + let* p1', t1 = elab_path env p1 t in + let e1' = checkpoint (elab_exp env e1 (NumT `NatT $ e1.at)) in + let* t' = as_list_typ "path" env Check t1 p1.at in + Ok (Il.IdxP (p1', e1'), t') | SliceP (p1, e1, e2) -> - let p1', t1 = elab_path env p1 t in - let e1' = elab_exp env e1 (NumT `NatT $ e1.at) in - let e2' = elab_exp env e2 (NumT `NatT $ e2.at) in - let _ = as_list_typ "path" env Check t1 p1.at in - Il.SliceP (p1', e1', e2'), t1 + let* p1', t1 = elab_path env p1 t in + let e1' = checkpoint (elab_exp env e1 (NumT `NatT $ e1.at)) in + let e2' = checkpoint (elab_exp env e2 (NumT `NatT $ e2.at)) in + let* _ = as_list_typ "path" env Check t1 p1.at in + Ok (Il.SliceP (p1', e1', e2'), t1) | DotP (p1, atom) -> - let p1', t1 = elab_path env p1 t in - let tfs = as_struct_typ "path" env Check t1 p1.at in - let t', _prems = find_field tfs atom p1.at t1 in - Il.DotP (p1', elab_atom atom (expand_id env t1)), t' + let* p1', t1 = elab_path env p1 t in + let* tfs = as_struct_typ "path" env Check t1 p1.at in + let* t', _prems = attempt (find_field tfs atom p1.at) t1 in + Ok (Il.DotP (p1', elab_atom atom (expand_id env t1)), t') -and cast_empty phrase env t at t' : Il.exp = +and cast_empty phrase env t at t' : Il.exp attempt = Debug.(log_at "el.cast_empty" at (fun _ -> fmt "%s >> (%s)" (el_typ t) (el_typ (expand env t $ t.at))) - (fun r -> fmt "%s" (il_exp r)) + (function Ok r -> fmt "%s" (il_exp r) | _ -> "fail") ) @@ fun _ -> match expand env t with - | IterT (_, Opt) -> Il.OptE None $$ at % t' - | IterT (_, List) -> Il.ListE [] $$ at % t' + | IterT (_, Opt) -> Ok (Il.OptE None $$ at % t') + | IterT (_, List) -> Ok (Il.ListE [] $$ at % t') | VarT _ when is_iter_notation_typ env t -> assert (is_notation_typ env t); (match expand_iter_notation env t with @@ -1487,45 +1623,47 @@ and cast_empty phrase env t at t' : Il.exp = let mixop, ts', _ts = elab_typ_notation env (expand_id env t) (t1 $ t.at) in assert (List.length ts' = 1); let e1' = if iter = Opt then Il.OptE None else Il.ListE [] in - Il.CaseE (mixop, tup_exp_bind' [e1' $$ at % List.hd ts'] at) $$ at % t' - | _ -> error_typ env at phrase t + Ok (Il.CaseE (mixop, tup_exp_bind' [e1' $$ at % List.hd ts'] at) $$ at % t') + | _ -> fail_typ env at phrase t ) - | _ -> error_typ env at phrase t + | _ -> fail_typ env at phrase t -and cast_exp phrase env e' t1 t2 : Il.exp = - let e'' = cast_exp' phrase env e' t1 t2 in - e'' $$ e'.at % elab_typ env (expand_nondef env t2) +and cast_exp phrase env e' t1 t2 : Il.exp attempt = + let* e'' = cast_exp' phrase env e' t1 t2 in + Ok (e'' $$ e'.at % elab_typ env (expand_nondef env t2)) -and cast_exp' phrase env e' t1 t2 : Il.exp' = +and cast_exp' phrase env e' t1 t2 : Il.exp' attempt = Debug.(log_at "el.cast_exp" e'.at (fun _ -> fmt "%s <: %s >> (%s) <: (%s) = (%s)" (el_typ t1) (el_typ t2) (el_typ (expand_def env t1 $ t1.at)) (el_typ (expand_def env t2 $ t2.at)) (el_typ (expand_nondef env t2)) ) - (fun r -> fmt "%s" (il_exp (r $$ e'.at % elab_typ env t2))) + (function Ok r -> fmt "%s" (il_exp (r $$ e'.at % elab_typ env t2)) | _ -> "fail") ) @@ fun _ -> - if equiv_typ env t1 t2 then e'.it else + if equiv_typ env t1 t2 then Ok e'.it else match expand_def env t1, expand_def env t2 with | _, _ when sub_typ env t1 t2 -> let t1' = elab_typ env (expand_nondef env t1) in let t2' = elab_typ env (expand_nondef env t2) in - Il.SubE (e', t1', t2') + Ok (Il.SubE (e', t1', t2')) | NumT nt1, NumT nt2 when nt1 < nt2 || lax_num && nt1 <> `RealT -> - Il.CvtE (e', nt1, nt2) + Ok (Il.CvtE (e', nt1, nt2)) | TupT [], SeqT [] -> - e'.it + Ok e'.it | ConT ((t11, _), _), ConT ((t21, _), _) -> - (try + choice env + (fun env -> let mixop1, ts1', ts1 = elab_typ_notation env (expand_id env t1) t11 in let mixop2, _ts2', ts2 = elab_typ_notation env (expand_id env t2) t21 in if mixop1 <> mixop2 then - error_typ2 env e'.at phrase t1 t2 ""; + fail_typ2 env e'.at phrase t1 t2 "" else let e'' = Il.UncaseE (e', mixop1) $$ e'.at % tup_typ' ts1' e'.at in let es' = List.mapi (fun i t1I' -> Il.ProjE (e'', i) $$ e''.at % t1I') ts1' in - let es'' = List.map2 (fun eI' (t1I, t2I) -> + let* es'' = map2_attempt (fun eI' (t1I, t2I) -> cast_exp phrase env eI' t1I t2I) es' (List.combine ts1 ts2) in - Il.CaseE (mixop2, tup_exp_bind' es'' e'.at) - with Error _ -> (* backtrack *) + Ok (Il.CaseE (mixop2, tup_exp_bind' es'' e'.at)) + ) + (fun env -> Debug.(log_in_at "el.cast_exp" e'.at (fun _ -> fmt "%s <: %s >> (%s) <: (%s) = (%s) # backtrack 1" (el_typ t1) (el_typ t2) (el_typ (expand_def env t1 $ t1.at)) (el_typ (expand_def env t2 $ t2.at)) @@ -1533,25 +1671,28 @@ and cast_exp' phrase env e' t1 t2 : Il.exp' = ) ); let mixop, ts', ts = elab_typ_notation env (expand_id env t1) t11 in - let t111, t111' = match ts, ts' with [t111], [t111'] -> t111, t111' | _ -> - error_typ2 env e'.at phrase t1 t2 "" in + let* t111, t111' = match ts, ts' with [t111], [t111'] -> Ok (t111, t111') | _ -> + fail_typ2 env e'.at phrase t1 t2 "" in let e'' = Il.UncaseE (e', mixop) $$ e'.at % tup_typ' ts' e'.at in cast_exp' phrase env (Il.ProjE (e'', 0) $$ e'.at % t111') t111 t2 ) | ConT ((t11, _), _), t2' -> - (try - let env' = local_env env in - let e' = + choice env + (fun env -> + let* e'' = match t2' with - | IterT (t21, Opt) -> - Il.OptE (Some (cast_exp phrase env' e' t1 t21)) - | IterT (t21, (List | List1)) -> - Il.ListE [cast_exp phrase env' e' t1 t21] - | _ -> raise (Error (e'.at, "")) + | IterT (t21, iter) -> + let* e1' = cast_exp phrase env e' t1 t21 in + (match iter with + | Opt -> Ok (Il.OptE (Some e1')) + | List -> Ok (Il.ListE [e1']) + | _ -> assert false + ) + | _ -> fail_silent in - promote_env env' env; - e' - with Error _ -> (* backtrack *) + Ok e'' + ) + (fun env -> Debug.(log_in_at "el.cast_exp" e'.at (fun _ -> fmt "%s <: %s >> (%s) <: (%s) = (%s) # backtrack 2" (el_typ t1) (el_typ t2) (el_typ (expand_def env t1 $ t1.at)) (el_typ (expand_def env t2 $ t2.at)) @@ -1559,30 +1700,34 @@ and cast_exp' phrase env e' t1 t2 : Il.exp' = ) ); let mixop, ts', ts = elab_typ_notation env (expand_id env t1) t11 in - let t111, t111' = match ts, ts' with [t111], [t111'] -> t111, t111' | _ -> - error_typ2 env e'.at phrase t1 t2 "" in + let* t111, t111' = match ts, ts' with [t111], [t111'] -> Ok (t111, t111') | _ -> + fail_typ2 env e'.at phrase t1 t2 "" in let e'' = Il.UncaseE (e', mixop) $$ e'.at % tup_typ' ts' e'.at in cast_exp' phrase env (Il.ProjE (e'', 0) $$ e'.at % t111') t111 t2 ) | _, ConT ((t21, _), _) -> let mixop, _ts', ts = elab_typ_notation env (expand_id env t2) t21 in - let t211 = match ts with [t211] -> t211 | _ -> - error_typ2 env e'.at phrase t1 t2 "" in - Il.CaseE (mixop, tup_exp_bind' [cast_exp phrase env e' t1 t211] e'.at) + let* t211 = match ts with [t211] -> Ok t211 | _ -> + fail_typ2 env e'.at phrase t1 t2 "" in + let* e1' = cast_exp phrase env e' t1 t211 in + Ok (Il.CaseE (mixop, tup_exp_bind' [e1'] e'.at)) | RangeT _, t2' -> - (try - let env' = local_env env in - let e' = + choice env + (fun env -> + let* e'' = match t2' with - | IterT (t21, Opt) -> - Il.OptE (Some (cast_exp phrase env e' t1 t21)) - | IterT (t21, (List | List1)) -> - Il.ListE [cast_exp phrase env e' t1 t21] - | _ -> raise (Error (e'.at, "")) + | IterT (t21, iter) -> + let* e1' = cast_exp phrase env e' t1 t21 in + (match iter with + | Opt -> Ok (Il.OptE (Some e1')) + | List -> Ok (Il.ListE [e1']) + | _ -> assert false + ) + | _ -> fail_silent in - promote_env env' env; - e' - with Error _ -> (* backtrack *) + Ok e'' + ) + (fun env -> Debug.(log_in_at "el.cast_exp" e'.at (fun _ -> fmt "%s <: %s >> (%s) <: (%s) = (%s) # backtrack 3" (el_typ t1) (el_typ t2) (el_typ (expand_def env t1 $ t1.at)) (el_typ (expand_def env t2 $ t2.at)) @@ -1597,35 +1742,42 @@ and cast_exp' phrase env e' t1 t2 : Il.exp' = ) | _, RangeT _ -> let t21 = typ_rep env t2 in - let e'' = cast_exp phrase env e' t1 t21 in - Il.CaseE ([[]; []], tup_exp_bind' [e''] e'.at) + let* e'' = cast_exp phrase env e' t1 t21 in + Ok (Il.CaseE ([[]; []], tup_exp_bind' [e''] e'.at)) | _, IterT (t21, Opt) -> - Il.OptE (Some (cast_exp phrase env e' t1 t21)) + let* e'' = cast_exp phrase env e' t1 t21 in + Ok (Il.OptE (Some e'')) | _, IterT (t21, (List | List1)) -> - Il.ListE [cast_exp phrase env e' t1 t21] + let* e'' = cast_exp phrase env e' t1 t21 in + Ok (Il.ListE [e'']) | _, _ when is_variant_typ env t1 && is_variant_typ env t2 && not (is_iter_typ env t1) -> - let cases1, dots1 = as_variant_typ "" env Check t1 e'.at in - let cases2, _dots2 = as_variant_typ "" env Check t2 e'.at in + let cases1, dots1 = checkpoint (as_variant_typ "" env Check t1 e'.at) in + let cases2, _dots2 = checkpoint (as_variant_typ "" env Check t2 e'.at) in if dots1 = Dots then error e'.at "used variant type is only partially defined at this point"; - (try - List.iter (fun (atom, (t1', _prems1), _) -> - let t2', _prems2 = find_case cases2 atom t1.at t2 in - (* Shallow subtyping on variants *) - let env' = to_eval_env env in - if not (Eq.eq_typ (Eval.reduce_typ env' t1') (Eval.reduce_typ env' t2')) then - error_atom e'.at atom t1 "type mismatch for case" - ) cases1 - with Error (_, msg) -> error_typ2 env e'.at phrase t1 t2 (", " ^ msg) - ); + let* _ = + match + iter_attempt (fun (atom, (t1', _prems1), _) -> + let* t2', _prems2 = attempt (find_case cases2 atom t1.at) t2 in + (* Shallow subtyping on variants *) + let env' = to_eval_env env in + if Eq.eq_typ (Eval.reduce_typ env' t1') (Eval.reduce_typ env' t2') then Ok () else + fail_atom e'.at atom t1 "type mismatch for case" + ) cases1 + with + | Ok () -> Ok () + | Fail (Trace (_, msg, _) :: _) -> fail_typ2 env e'.at phrase t1 t2 (", " ^ msg) + | Fail [] -> assert false + in let t11 = expand_singular env t1 $ t1.at in let t21 = expand_singular env t2 $ t2.at in let t11' = elab_typ env (expand_nondef env t1) in let t21' = elab_typ env (expand_nondef env t2) in - let e'' = Il.SubE (cast_exp phrase env e' t1 t11, t11', t21') in - cast_exp' phrase env (e'' $$ e'.at % t21') t21 t2 + let* e'' = cast_exp phrase env e' t1 t11 in + let e''' = Il.SubE (e'', t11', t21') in + cast_exp' phrase env (e''' $$ e'.at % t21') t21 t2 | _, _ -> - error_typ2 env e'.at phrase t1 t2 "" + fail_typ2 env e'.at phrase t1 t2 "" and elab_iterexp env iter : Il.iterexp = @@ -1642,10 +1794,10 @@ and elab_prem env prem : Il.prem list = | RulePr (id, e) -> let t, _ = find "relation" env.rels id in let mixop, _, _ = elab_typ_notation env id t in - let es', _s = elab_exp_notation' env id e t in + let es', _s = checkpoint (elab_exp_notation' env id e t) in [Il.RulePr (id, mixop, tup_exp' es' e.at) $ prem.at] | IfPr e -> - let e' = elab_exp env e (BoolT $ e.at) in + let e' = checkpoint (elab_exp env e (BoolT $ e.at)) in [Il.IfPr e' $ prem.at] | ElsePr -> [Il.ElsePr $ prem.at] @@ -1701,7 +1853,7 @@ and elab_sym env g : Il.sym * typ * env = IterT (t1, match iter with Opt -> Opt | _ -> List) $ g.at, env1 | AttrG (e, g1) -> let g1', t1, env1 = elab_sym env g1 in - let e' = elab_exp env1 e t1 in + let e' = checkpoint (elab_exp env1 e t1) in Il.AttrG (e', g1') $ g.at, t1, env | FuseG _ -> error g.at "misplaced token concatenation" | UnparenG _ -> error g.at "misplaced token unparenthesize" @@ -1720,7 +1872,8 @@ and elab_prod env prod t : Il.prod = let dims' = Dim.Env.map (List.map (elab_iter env')) dims in let g', _t', env'' = elab_sym env' g in let g' = Dim.annot_sym dims' g' in - let e' = Dim.annot_exp dims' (elab_exp env' e t) in + let e' = checkpoint (elab_exp env' e t) in + let e' = Dim.annot_exp dims' e' in let prems' = List.map (Dim.annot_prem dims') (concat_map_filter_nl_list (elab_prem env') prems) in let det = Free.(diff (union (det_sym g) (det_prems prems)) (bound_env env)) in @@ -1825,7 +1978,7 @@ and elab_arg in_lhs env a p s : Il.arg list * Subst.subst = ); match !(a.it), (Subst.subst_param s p).it with | ExpA e, ExpP (id, t) -> - let e' = elab_exp env e t in + let e' = checkpoint (elab_exp env e t) in [Il.ExpA e' $ a.at], Subst.add_varid s id e | TypA ({it = VarT (id', []); _} as t), TypP id when in_lhs = `Lhs -> let id'' = strip_var_suffix id' in @@ -2136,7 +2289,8 @@ let elab_def env d : Il.def list = let dims' = Dim.Env.map (List.map (elab_iter env')) dims in let t, rules' = find "relation" env.rels id1 in let mixop, _, _ = elab_typ_notation env id1 t in - let es' = List.map (Dim.annot_exp dims') (fst (elab_exp_notation' env' id1 e t)) in + let es', _ = checkpoint (elab_exp_notation' env' id1 e t) in + let es' = List.map (Dim.annot_exp dims') es' in let prems' = List.map (Dim.annot_prem dims') (concat_map_filter_nl_list (elab_prem env') prems) in let bs' = infer_binds env env' dims d in @@ -2165,7 +2319,8 @@ let elab_def env d : Il.def list = let ps, t, clauses' = find "definition" env.defs id in let as', s = elab_args `Lhs env' as_ ps d.at in let as' = List.map (Dim.annot_arg dims') as' in - let e' = Dim.annot_exp dims' (elab_exp env' e (Subst.subst_typ s t)) in + let e' = checkpoint (elab_exp env' e (Subst.subst_typ s t)) in + let e' = Dim.annot_exp dims' e' in let prems' = List.map (Dim.annot_prem dims') (concat_map_filter_nl_list (elab_prem env') prems) in let bs' = infer_binds env env' dims d in @@ -2295,7 +2450,7 @@ let elab ds : Il.script * env = let elab_exp env e t : Il.exp = let _ = elab_typ env t in - elab_exp env e t + checkpoint (elab_exp env e t) let elab_rel env e id : Il.exp = match elab_prem env (RulePr (id, e) $ e.at) with From ea76cdbde68511c22e0d54f82c373a73b1f164bc Mon Sep 17 00:00:00 2001 From: Andreas Rossberg Date: Wed, 4 Dec 2024 16:23:17 +0100 Subject: [PATCH 04/10] WIP --- spectec/src/frontend/elab.ml | 54 ++++++++++++++++++++++++++++-------- 1 file changed, 42 insertions(+), 12 deletions(-) diff --git a/spectec/src/frontend/elab.ml b/spectec/src/frontend/elab.ml index 0be496830c..511c9504a0 100644 --- a/spectec/src/frontend/elab.ml +++ b/spectec/src/frontend/elab.ml @@ -1,3 +1,26 @@ +(* + +Elaboration of expressions is type-directed, in order to disambiguate syntax. +Effectively, it implements custom parsing based on type definitions. + +The trickiest bit are iterations, since they can be empty. It is further +complicated by the ability of various expression forms to return iterations. + +We call _generic_ expressions those that can generally have any type. These are: + +- VarE, IdxE, DotE, ParenE, CallE, TypE +- SeqE, SliceE, UpdE, ExtE, CommaE, CatE, IterE + + +e1 e2... : t* --> ( eps : t* ) ; ( e1 e2... ) ;; t* empty +| +e1 e2... : t* --> ( e1 : t* ) ++ ( e2... : t* ) ;; sequencing + +g : t* --> +| +e : t* --> [( e : t )] +*) + open Util open Source open El @@ -571,9 +594,9 @@ and as_variant_typ phrase env dir t at : (typcase list * dots) attempt = | VarT (id, args) -> as_variant_typid' phrase env id args at | _ -> fail_dir_typ env at phrase dir t "| ..." -let case_has_args env t op at : bool = - let cases, _ = checkpoint (as_variant_typ "" env Check t at) in - let t, _prems = find_case_sub cases op at t in +let case_has_args env t op : bool = + let cases, _ = checkpoint (as_variant_typ "" env Check t op.at) in + let t, _prems = find_case_sub cases op op.at t in match t.it with | SeqT ({it = AtomT _; _}::_) -> true | _ -> false @@ -1307,13 +1330,13 @@ and elab_exp' env e t : Il.exp' attempt = let* ts = as_tup_typ "tuple" env Check t e.at in let* es' = elab_exp_list env es ts e.at in Ok (Il.TupE es') +(* TODO: remove *) | SeqE [] when is_empty_typ env t -> let* e', t' = infer_exp env e in cast_exp' "empty expression" env e' t' t | EpsE | SeqE _ when is_iter_typ env t -> - let es = unseq_exp e in let* t1, iter = as_iter_typ "" env Check t e.at in - elab_exp_iter' env es (t1, iter) t e.at + elab_exp_iter' env (unseq_exp e) (t1, iter) t e.at | EpsE | AtomE _ | InfixE _ @@ -1386,8 +1409,9 @@ and elab_exp_iter' env es (t1, iter) t at : Il.exp' attempt = match es, iter with (* If the sequence actually starts with a non-nullary constructor, * then assume this is a singleton iteration and fallback to variant *) - | {it = AtomE atom; at = at1; _}::_, _ - when is_variant_typ env t1 && case_has_args env t1 atom at1 -> + (* TODO: use backtracking *) + | {it = AtomE atom; _}::_, _ + when is_variant_typ env t1 && case_has_args env t1 atom -> let* cases, _dots = as_variant_typ "" env Check t1 at in let* e' = elab_exp_variant env (expand_id env t1) (SeqE es $ at) cases t1 at in Ok (lift_exp' e' iter) @@ -1395,6 +1419,12 @@ and elab_exp_iter' env es (t1, iter) t at : Il.exp' attempt = (* An empty sequence represents the None case for options *) | [], Opt -> Ok (Il.OptE None) + | [e1], Opt -> + let* e1' = elab_exp env e1 t1 in + Ok (Il.OptE (Some e1')) + | _::_::_, Opt -> + fail_typ env at "expression" t + (* An empty sequence represents the Nil case for lists *) | [], List -> Ok (Il.ListE []) @@ -1404,8 +1434,8 @@ and elab_exp_iter' env es (t1, iter) t at : Il.exp' attempt = let* e2' = elab_exp_iter env es2 (t1, iter) t at in Ok (cat_exp' e1' e2') - | _, _ -> - fail_typ env at "expression" t + | _, (List1 | ListN _) -> + assert false and elab_exp_notation env tid e nt t : Il.exp attempt = (* Convert notation into applications of mixin operators *) @@ -1537,8 +1567,8 @@ and elab_exp_notation_iter' env tid es (t1, iter) t at : Il.exp' attempt = match es, iter with (* If the sequence actually starts with a non-nullary constructor, * then assume this is a singleton iteration and fallback to variant *) - | {it = AtomE atom; at = at1; _}::_, _ - when is_variant_typ env t1 && case_has_args env t1 atom at1 -> + | {it = AtomE atom; _}::_, _ + when is_variant_typ env t1 && case_has_args env t1 atom -> let* cases, _ = as_variant_typ "expression" env Check t1 at in let* e' = elab_exp_variant env (expand_id env t1) (SeqE es $ at) cases t1 at in Ok (lift_exp' e' iter) @@ -1573,7 +1603,7 @@ and elab_exp_variant env tid e cases t at : Il.exp attempt = | BrackE (atom, _, _) -> Ok atom | _ -> fail_typ env at "expression" t in - let* t1, _prems = attempt (find_case_sub cases atom at) t in + let* t1, _prems = attempt (find_case_sub cases atom atom.at) t in let* es', _s = elab_exp_notation' env tid e t1 in let t2 = expand_singular env t $ at in let t2' = elab_typ env t2 in From a0051b45d341cb7f3f43f44f6717d8171186e3ef Mon Sep 17 00:00:00 2001 From: Andreas Rossberg Date: Sat, 7 Dec 2024 13:14:40 +0100 Subject: [PATCH 05/10] Make multiple newlines at end of file work --- spectec/src/frontend/lexer.mll | 7 ++++--- spectec/src/frontend/parser.mly | 6 ++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/spectec/src/frontend/lexer.mll b/spectec/src/frontend/lexer.mll index e2482336e1..15dfefb63e 100644 --- a/spectec/src/frontend/lexer.mll +++ b/spectec/src/frontend/lexer.mll @@ -123,6 +123,7 @@ and after_nl_nl = parse | indent* "|"[' ''\t'] { NL_BAR } | indent* '\n' { Lexing.new_line lexbuf; NL_NL_NL } | indent* line_comment '\n' { Lexing.new_line lexbuf; after_nl_nl lexbuf } + | indent* line_comment? eof { EOF } | "" { NL_NL } and token = parse @@ -255,9 +256,9 @@ and token = parse | "`"(loid as s) "(" { UPID_LPAREN s } | "."(id as s) { DOTID s } - | ";;"utf8_no_nl*eof { EOF } - | ";;"utf8_no_nl*'\n' { Lexing.new_line lexbuf; token lexbuf } - | ";;"utf8_no_nl* { token lexbuf (* causes error on following position *) } + | line_comment eof { EOF } + | line_comment '\n' { Lexing.new_line lexbuf; token lexbuf } + | line_comment { token lexbuf (* causes error on following position *) } | "(;" { comment (Lexing.lexeme_start_p lexbuf) lexbuf; token lexbuf } | space#'\n' { token lexbuf } | "\n" { Lexing.new_line lexbuf; token lexbuf } diff --git a/spectec/src/frontend/parser.mly b/spectec/src/frontend/parser.mly index cbc07d337f..ec958ae24f 100644 --- a/spectec/src/frontend/parser.mly +++ b/spectec/src/frontend/parser.mly @@ -802,9 +802,7 @@ param_ : def : - | def_ { $1 $ $sloc } - | NL_NL def - { $2 } + | def_ NL_NL* { $1 $ $loc($1) } def_ : | SYNTAX varid_bind_lparen enter_scope comma_list(arg) RPAREN ruleid_list hint* exit_scope { FamD ($2, List.map El.Convert.param_of_arg $4, $7) } @@ -874,7 +872,7 @@ hint : (* Scripts *) script : - | def* EOF { $1 } + | NL_NL* def* EOF { $2 } typ_eof : | typ EOF { $1 } From e499ab6c5281bf8fc1f2c7e0458adda39644abb8 Mon Sep 17 00:00:00 2001 From: Andreas Rossberg Date: Sat, 7 Dec 2024 14:05:52 +0100 Subject: [PATCH 06/10] Clean up elabpration of iterations --- spectec/spec/wasm-2.0/8-reduction.watsup | 2 +- spectec/src/al/al_util.ml | 1 + spectec/src/al/ast.ml | 1 + spectec/src/al/eq.ml | 1 + spectec/src/al/eval.ml | 7 + spectec/src/al/free.ml | 1 + spectec/src/al/print.ml | 2 + spectec/src/al/valid.ml | 7 + spectec/src/al/walk.ml | 3 +- .../src/backend-interpreter/interpreter.ml | 2 + spectec/src/backend-prose/print.ml | 1 + spectec/src/backend-prose/render.ml | 5 + spectec/src/frontend/dim.ml | 3 + spectec/src/frontend/elab.ml | 153 +++++------ spectec/src/il/ast.ml | 1 + spectec/src/il/eq.ml | 1 + spectec/src/il/eval.ml | 13 +- spectec/src/il/free.ml | 2 +- spectec/src/il/iter.ml | 2 +- spectec/src/il/print.ml | 1 + spectec/src/il/subst.ml | 10 +- spectec/src/il/valid.ml | 11 +- spectec/src/il2al/free.ml | 2 +- spectec/src/il2al/il_walk.ml | 1 + spectec/src/il2al/translate.ml | 1 + spectec/src/il2al/unify.ml | 3 + spectec/src/middlend/sideconditions.ml | 1 + spectec/src/middlend/sub.ml | 3 +- spectec/src/middlend/totalize.ml | 3 +- spectec/src/middlend/unthe.ml | 1 + spectec/src/middlend/wild.ml | 1 + spectec/test-frontend/TEST.md | 64 ++--- spectec/test-middlend/TEST.md | 256 +++++++++--------- spectec/test-prose/TEST.md | 91 +++---- 34 files changed, 351 insertions(+), 306 deletions(-) diff --git a/spectec/spec/wasm-2.0/8-reduction.watsup b/spectec/spec/wasm-2.0/8-reduction.watsup index bb5af45892..450f06de19 100644 --- a/spectec/spec/wasm-2.0/8-reduction.watsup +++ b/spectec/spec/wasm-2.0/8-reduction.watsup @@ -307,7 +307,7 @@ rule Step_pure/vswizzle: rule Step_pure/vshuffle: (VCONST V128 c_1) (VCONST V128 c_2) (VSHUFFLE (Pnn X N) i*) ~> (VCONST V128 c) -- var c' : iN($lsize(Pnn)) - -- if c'* = $lanes_(Pnn X N, c_1) $lanes_(Pnn X N, c_2) + -- if c'* = $lanes_(Pnn X N, c_1) ++ $lanes_(Pnn X N, c_2) -- if c = $invlanes_(Pnn X N, c'*[$(i*[k])]^(k mk_expr at note let extE ?(at = no) ~note (e1, pl, e2, dir) = ExtE (e1, pl, e2, dir) |> mk_expr at note let strE ?(at = no) ~note r = StrE r |> mk_expr at note let compE ?(at = no) ~note (e1, e2) = CompE (e1, e2) |> mk_expr at note +let liftE ?(at = no) ~note e = LiftE e |> mk_expr at note let catE ?(at = no) ~note (e1, e2) = CatE (e1, e2) |> mk_expr at note let memE ?(at = no) ~note (e1, e2) = MemE (e1, e2) |> mk_expr at note let lenE ?(at = no) ~note e = LenE e |> mk_expr at note diff --git a/spectec/src/al/ast.ml b/spectec/src/al/ast.ml index 56539a268d..07b2feed13 100644 --- a/spectec/src/al/ast.ml +++ b/spectec/src/al/ast.ml @@ -82,6 +82,7 @@ and expr' = | IterE of expr * iterexp (* expr (`{` id* `}`)* *) | OptE of expr option (* expr? *) | ListE of expr list (* `[` expr* `]` *) + | LiftE of expr (* convert option to list *) | GetCurStateE (* "the current state" *) | GetCurContextE of atom option (* "the current context of certain (Some) or any (None) type" *) | ChooseE of expr (* "an element of" expr *) diff --git a/spectec/src/al/eq.ml b/spectec/src/al/eq.ml index 818e2cbc8d..7328cfe494 100644 --- a/spectec/src/al/eq.ml +++ b/spectec/src/al/eq.ml @@ -38,6 +38,7 @@ let rec eq_expr e1 e2 = eq_expr e1 e2 && eq_iterexp ie1 ie2 | OptE eo1, OptE eo2 -> eq_expr_opt eo1 eo2 | ListE el1, ListE el2 -> eq_exprs el1 el2 + | LiftE e1, LiftE e2 -> eq_expr e1 e2 | GetCurStateE, GetCurStateE -> true | GetCurContextE i1, GetCurContextE i2 -> Option.equal (=) i1 i2 | ChooseE e1, ChooseE e2 -> eq_expr e1 e2 diff --git a/spectec/src/al/eval.ml b/spectec/src/al/eval.ml index 47ba0b143d..8881ae2adc 100644 --- a/spectec/src/al/eval.ml +++ b/spectec/src/al/eval.ml @@ -216,6 +216,13 @@ let rec reduce_exp s e : expr = | ListE es2' when is_normal_exp e1' && List.for_all is_normal_exp es2' -> BoolE false | _ -> MemE (e1', e2') ) $> e + | LiftE e1 -> + let e1' = reduce_exp s e1 in + (match e1'.it with + | OptE None -> ListE [] + | OptE (Some e11) -> ListE [e11] + | _ -> LiftE e1' + ) $> e | LenE e1 -> let e1' = reduce_exp s e1 in (match e1'.it with diff --git a/spectec/src/al/free.ml b/spectec/src/al/free.ml index 12846bdd96..a5ba36fc49 100644 --- a/spectec/src/al/free.ml +++ b/spectec/src/al/free.ml @@ -26,6 +26,7 @@ let rec free_expr expr = | SubE (id, _) -> free_id id | CvtE (e, _, _) | UnE (_, e) + | LiftE e | LenE e | ChooseE e -> free_expr e | BinE (_, e1, e2) diff --git a/spectec/src/al/print.ml b/spectec/src/al/print.ml index 5a013e0ad8..20bdacef66 100644 --- a/spectec/src/al/print.ml +++ b/spectec/src/al/print.ml @@ -140,6 +140,7 @@ and string_of_expr expr = | GetCurContextE None -> "current_context()" | GetCurContextE (Some a) -> sprintf "current_context(%s)" (string_of_atom a) | ListE el -> "[" ^ string_of_exprs ", " el ^ "]" + | LiftE e -> "lift(" ^ string_of_expr e ^ ")" | AccE (e, p) -> sprintf "%s%s" (string_of_expr e) (string_of_path p) | ExtE (e1, ps, e2, dir) -> ( match dir with @@ -448,6 +449,7 @@ and structured_string_of_expr expr = | GetCurContextE None -> "GetCurContextE" | GetCurContextE (Some a) -> sprintf "GetCurContextE (%s)" (string_of_atom a) | ListE el -> "ListE ([" ^ structured_string_of_exprs el ^ "])" + | LiftE e -> "LiftE (" ^ structured_string_of_expr e ^ ")" | AccE (e, p) -> "AccE (" ^ structured_string_of_expr e diff --git a/spectec/src/al/valid.ml b/spectec/src/al/valid.ml index 8bffe529dd..87ad6f46b8 100644 --- a/spectec/src/al/valid.ml +++ b/spectec/src/al/valid.ml @@ -604,6 +604,13 @@ and valid_expr env (expr: expr) : unit = l |> List.map note |> List.iter (check_match source elem_typ) + | LiftE expr1 -> + valid_expr env expr; + check_list source expr.note; + check_opt source expr1.note; + let elem_typ = unwrap_iter_typ expr.note in + let elem1_typ = unwrap_iter_typ expr1.note in + check_match source elem1_typ elem_typ | GetCurStateE -> check_context source expr.note | GetCurContextE _ -> diff --git a/spectec/src/al/walk.ml b/spectec/src/al/walk.ml index 377095b465..08e28de651 100644 --- a/spectec/src/al/walk.ml +++ b/spectec/src/al/walk.ml @@ -37,7 +37,7 @@ let walk_expr (walker: unit_walker) (expr: expr) : unit = | GetCurContextE _ | YetE _ | TopValueE None | ContextKindE _ -> () - | CvtE (e, _, _) | UnE (_, e) | LenE e + | CvtE (e, _, _) | UnE (_, e) | LiftE e | LenE e | IsDefinedE e | IsCaseOfE (e, _) | HasTypeE (e, _) | IsValidE e | TopValueE (Some e) | TopValuesE e | ChooseE e -> walker.walk_expr walker e @@ -141,6 +141,7 @@ let walk_expr (walker: walker) (expr: expr) : expr = | CompE (e1, e2) -> CompE (walk_expr e1, walk_expr e2) | CatE (e1, e2) -> CatE (walk_expr e1, walk_expr e2) | MemE (e1, e2) -> MemE (walk_expr e1, walk_expr e2) + | LiftE e -> LiftE (walk_expr e) | LenE e -> LenE (walk_expr e) | StrE r -> StrE (Record.map (fun x -> x) walk_expr r) | AccE (e, p) -> AccE (walk_expr e, walk_path p) diff --git a/spectec/src/backend-interpreter/interpreter.ml b/spectec/src/backend-interpreter/interpreter.ml index 61b4f52489..1877e36275 100644 --- a/spectec/src/backend-interpreter/interpreter.ml +++ b/spectec/src/backend-interpreter/interpreter.ml @@ -278,6 +278,8 @@ and eval_expr env expr = in (id, Array.append !arr1 !arr2 |> listV |> ref) ) s1 |> strV + | LiftE e1 -> + eval_expr env e1 |> unwrap_optv |> Option.to_list |> listV_of_list | CatE (e1, e2) -> let a1 = eval_expr env e1 |> unwrap_seq_to_array in let a2 = eval_expr env e2 |> unwrap_seq_to_array in diff --git a/spectec/src/backend-prose/print.ml b/spectec/src/backend-prose/print.ml index 051571e1b4..f3cf86d472 100644 --- a/spectec/src/backend-prose/print.ml +++ b/spectec/src/backend-prose/print.ml @@ -105,6 +105,7 @@ and string_of_expr expr = | GetCurContextE None -> "the current context" | GetCurContextE (Some a) -> sprintf "the current %s context" (string_of_atom a) | ListE el -> "[" ^ string_of_exprs ", " el ^ "]" + | LiftE e -> string_of_expr e | AccE (e, p) -> sprintf "%s%s" (string_of_expr e) (string_of_path p) | ExtE (e1, ps, e2, dir) -> ( match dir with diff --git a/spectec/src/backend-prose/render.ml b/spectec/src/backend-prose/render.ml index 0b382203cb..531db4877c 100644 --- a/spectec/src/backend-prose/render.ml +++ b/spectec/src/backend-prose/render.ml @@ -199,6 +199,9 @@ and al_to_el_expr expr = let* elel = al_to_el_exprs el in if (List.length elel > 0) then Some (El.Ast.SeqE elel) else Some (El.Ast.EpsE) + | Al.Ast.LiftE e -> + let* ele = al_to_el_expr e in + Some ele.it | Al.Ast.AccE (e, p) -> let* ele = al_to_el_expr e in (match p.it with @@ -434,6 +437,8 @@ and render_expr' env expr = let se1 = render_expr env e1 in let se2 = render_expr env e2 in sprintf "%s is contained in %s" se1 se2 + | Al.Ast.LiftE e -> + render_expr env e | Al.Ast.LenE e -> let se = render_expr env e in sprintf "the length of %s" se diff --git a/spectec/src/frontend/dim.ml b/spectec/src/frontend/dim.ml index ce23670c29..b89509f2c5 100644 --- a/spectec/src/frontend/dim.ml +++ b/spectec/src/frontend/dim.ml @@ -430,6 +430,9 @@ and annot_exp env e : Il.Ast.exp * occur = | ListE es -> let es', occurs = List.split (List.map (annot_exp env) es) in ListE es', List.fold_left union Env.empty occurs + | LiftE e1 -> + let e1', occur1 = annot_exp env e1 in + LiftE e1', occur1 | MemE (e1, e2) -> let e1', occur1 = annot_exp env e1 in let e2', occur2 = annot_exp env e2 in diff --git a/spectec/src/frontend/elab.ml b/spectec/src/frontend/elab.ml index 511c9504a0..81c26741a2 100644 --- a/spectec/src/frontend/elab.ml +++ b/spectec/src/frontend/elab.ml @@ -1,26 +1,3 @@ -(* - -Elaboration of expressions is type-directed, in order to disambiguate syntax. -Effectively, it implements custom parsing based on type definitions. - -The trickiest bit are iterations, since they can be empty. It is further -complicated by the ability of various expression forms to return iterations. - -We call _generic_ expressions those that can generally have any type. These are: - -- VarE, IdxE, DotE, ParenE, CallE, TypE -- SeqE, SliceE, UpdE, ExtE, CommaE, CatE, IterE - - -e1 e2... : t* --> ( eps : t* ) ; ( e1 e2... ) ;; t* empty -| -e1 e2... : t* --> ( e1 : t* ) ++ ( e2... : t* ) ;; sequencing - -g : t* --> -| -e : t* --> [( e : t )] -*) - open Util open Source open El @@ -452,10 +429,9 @@ let expand_def env t = ) | t' -> t' -let rec expand_id env t = +let expand_id env t = match (expand_nondef env t).it with | VarT (id, _) -> strip_var_suffix id - | IterT (t1, _) -> expand_id env t1 (* TODO(4, rossberg): this shouldn't be needed, but goes along with the as_*_typ functions unrolling iterations *) | _ -> "" $ no_region let rec expand_notation env t = @@ -482,11 +458,6 @@ let rec expand_iter_notation env t = | ConT ((t1, _), _) -> expand_iter_notation env t1 | t' -> t' -let expand_singular env t = - match expand env t with - | IterT (t1, (Opt | List | List1)) -> expand env t1 - | t' -> t' - let as_num_typ_opt env t : numtyp option = match expand_notation env t with @@ -507,7 +478,7 @@ let as_opt_notation_typ_opt env t : typ option = match expand_iter_notation env t with IterT (t1, Opt) -> Some t1 | _ -> None let as_tup_typ_opt env t : typ list option = - match expand_singular env t with TupT ts -> Some ts | _ -> None + match expand env t with TupT ts -> Some ts | _ -> None let as_empty_typ_opt env t : unit option = match expand env t with SeqT [] -> Some () | _ -> None @@ -543,7 +514,7 @@ let rec as_notation_typid' phrase env id args at : typ attempt = | exception Error (at', msg) -> fail at' msg let as_notation_typ phrase env dir t at : typ attempt = - match expand_singular env t with + match expand env t with | VarT (id, args) -> as_notation_typid' phrase env id args at | _ -> fail_dir_typ env at phrase dir t "_ ... _" @@ -555,7 +526,7 @@ let rec as_struct_typid' phrase env id args at : typfield list attempt = | exception Error (at', msg) -> fail at' msg let as_struct_typ phrase env dir t at : typfield list attempt = - match expand_singular env t with + match expand env t with | VarT (id, args) -> as_struct_typid' phrase env id args at | _ -> fail_dir_typ env at phrase dir t "{...}" @@ -590,7 +561,7 @@ and as_variant_typid phrase env id args : (typcase list * dots) attempt = as_variant_typid' phrase env id args id.at and as_variant_typ phrase env dir t at : (typcase list * dots) attempt = - match expand_singular env t with + match expand env t with | VarT (id, args) -> as_variant_typid' phrase env id args at | _ -> fail_dir_typ env at phrase dir t "| ..." @@ -969,7 +940,7 @@ and elab_typenum env tid (e1, e2o) : typ * (Il.exp -> numtyp -> Il.exp) = and elab_typ_notation env tid t : Il.mixop * Il.typ list * typ list = Debug.(log_at "el.elab_typ_notation" t.at - (fun _ -> fmt "%s = %s" tid.it (el_typ t)) + (fun _ -> fmt "(%s) %s" tid.it (el_typ t)) (fun (mixop, ts', _) -> fmt "%s(%s)" (il_mixop mixop) (list il_typ ts')) ) @@ fun _ -> assert (valid_tid tid); @@ -1032,14 +1003,6 @@ and (!!!) env tid t = (* Expressions *) -and must_elab_exp env e = - match e.it with - | VarE (id, _) -> not (bound env.vars id || bound env.gvars (strip_var_suffix id)) - | AtomE _ | BrackE _ | InfixE _ | EpsE | SeqE _ | StrE _ -> true - | ParenE (e1, _) | IterE (e1, _) | ArithE e1 -> must_elab_exp env e1 - | TupE es -> List.exists (must_elab_exp env) es - | _ -> false - (* Returns * - Ok (il_exp, typ) if the type can be inferred * - Fail (at, s) when it cannot, where s is the name of the failing construct @@ -1108,14 +1071,17 @@ and infer_exp' env e : (Il.exp' * typ') attempt = (match infer_cmpop env op with | `Poly op' -> let* e1', e2' = - if must_elab_exp env e1 then (* TODO: use backtracking *) - let* e2', t2 = infer_exp env e2 in - let* e1' = elab_exp env e1 t2 in - Ok (e1', e2') - else - let* e1', t1 = infer_exp env e1 in - let* e2' = elab_exp env e2 t1 in - Ok (e1', e2') + choice env + (fun env -> + let* e2', t2 = infer_exp env e2 in + let* e1' = elab_exp env e1 t2 in + Ok (e1', e2') + ) + (fun env -> + let* e1', t1 = infer_exp env e1 in + let* e2' = elab_exp env e2 t1 in + Ok (e1', e2') + ) in Ok (Il.CmpE (op', `BoolT, e1', e2'), BoolT) | `Over elab_cmpop' -> @@ -1230,29 +1196,41 @@ and infer_exp_list env = function and elab_exp env e t : Il.exp attempt = - nest e.at t (choice env - (fun env -> - let* e' = elab_exp' env e t in - let* t' = attempt (elab_typ env) t in - Ok (e' $$ e.at % t') - ) - (fun env -> - if not (is_notation_typ env t) then fail_silent else - ( - Debug.(log_in_at "el.elab_exp" e.at - (fun _ -> fmt "%s : %s # backtrack" (el_exp e) (el_typ t)) - ); - let* t1 = as_notation_typ "" env Check t e.at in - elab_exp_notation env (expand_id env t) e t1 t - ) - ) + Debug.(log_at "el.elab_exp" e.at + (fun _ -> fmt "%s : %s" (el_exp e) (el_typ t)) + (function Ok e' -> fmt "%s" (il_exp e') | _ -> "fail") + ) @@ fun _ -> + nest e.at t ( + if is_iter_typ env t then + let* t1, iter = as_iter_typ "" env Check t e.at in + choice env + (* Need to try plain first, otherwise something ambiguous like + * the pattern _ : t* would become [_ : t] : t*, which isn't useful. *) + (fun env -> elab_exp_plain env e t) + (fun env -> + let* e' = elab_exp_plain env e t1 in + let t' = elab_typ env t in + Ok (lift_exp' e' iter $$ e.at % t') + ) + else if is_notation_typ env t then + let* t1 = as_notation_typ "" env Check t e.at in + choice env + (fun env -> elab_exp_plain env e t) + (fun env -> elab_exp_notation env (expand_id env t) e t1 t) + else + elab_exp_plain env e t ) -and elab_exp' env e t : Il.exp' attempt = - Debug.(log_at "el.elab_exp" e.at +and elab_exp_plain env e t : Il.exp attempt = + Debug.(log_at "el.elab_exp_plain" e.at (fun _ -> fmt "%s : %s" (el_exp e) (el_typ t)) - (function Ok e' -> fmt "%s" (il_exp (e' $$ no_region % elab_typ env t)) | _ -> "fail") + (function Ok e' -> fmt "%s" (il_exp e') | _ -> "fail") ) @@ fun _ -> + let* e' = elab_exp_plain' env e t in + let t' = elab_typ env t in + Ok (e' $$ e.at % t') + +and elab_exp_plain' env e t : Il.exp' attempt = match e.it with | BoolE _ | NumE _ | TextE _ | CvtE _ | UnE _ | BinE _ | CmpE _ | IdxE _ | DotE _ | MemE _ | LenE _ | SizeE _ | CallE _ | TypE _ @@ -1268,7 +1246,7 @@ and elab_exp' env e t : Il.exp' attempt = cast_exp' "expression" env e' t' t ) (fun env -> - if is_iter_typ env t then + if is_iter_typ env t && id.it <> "_" then (* Never infer an iteration type for a variable *) let* t1, iter = as_iter_typ "" env Check t e.at in let* e' = elab_exp env e t1 in @@ -1325,7 +1303,7 @@ and elab_exp' env e t : Il.exp' attempt = let* e1' = elab_exp env e1 t1 in cast_exp' "expression" env e1' t1 t | ParenE (e1, _) | ArithE e1 -> - elab_exp' env e1 t + elab_exp_plain' env e1 t | TupE es -> let* ts = as_tup_typ "tuple" env Check t e.at in let* es' = elab_exp_list env es ts e.at in @@ -1359,11 +1337,15 @@ and elab_exp' env e t : Il.exp' attempt = (* An iteration expression must match the expected type directly, * significant parentheses have to be used otherwise *) let* t1, iter = as_iter_typ "iteration" env Check t e.at in - if (iter = Opt) <> (iter2 = Opt) then - fail_typ env e.at "iteration expression" t else let iter2' = elab_iterexp env iter2 in let* e1' = elab_exp env e1 t1 in - Ok (Il.IterE (e1', iter2')) + let e' = Il.IterE (e1', iter2') in + match iter, iter2 with + | Opt, Opt -> Ok e' + | Opt, _ -> + Ok (Il.LiftE (e' $$ e.at % (Il.IterT (elab_typ env t1, Opt) $ e1.at))) + | _, Opt -> fail_typ env e.at "iteration expression" t + | _, _ -> Ok e' and elab_exp_list env es ts at : Il.exp list attempt = match es, ts with @@ -1526,7 +1508,15 @@ and elab_exp_notation' env tid e t : (Il.exp list * Subst.t) attempt = fail_typ env e.at "iteration expression" t else let iter1' = elab_iterexp env iter1 in let* es1', _s1 = elab_exp_notation' env tid e1 t1 in - Ok ([Il.IterE (tup_exp' es1' e1.at, iter1') $$ e.at % !!!env tid t], Subst.empty) + let t' iter' = !!!env tid (IterT (t1, iter') $ t.at) in + let e' iter' = Il.IterE (tup_exp' es1' e1.at, iter1') $$ e.at % t' iter' in + let* e'' = + match iter1, iter with + | Opt, Opt -> Ok (e' Opt) + | Opt, _ -> Ok (Il.LiftE (e' Opt) $$ e.at % !!!env tid t) + | _, Opt -> fail_typ env e.at "iteration expression" t + | _, _ -> Ok (e' List) + in Ok ([e''], Subst.empty) (* Significant parentheses indicate a singleton *) | ParenE (e1, `Sig), IterT (t1, iter) -> let* es', _s = elab_exp_notation' env tid e1 t1 in @@ -1547,11 +1537,13 @@ and elab_exp_notation' env tid e t : (Il.exp list * Subst.t) attempt = | _, ParenT t1 -> elab_exp_notation' env tid e t1 + | _, (AtomT _ | InfixT _ | BrackT _) -> + fail_typ env e.at "expression" t + | _, _ -> let* e' = elab_exp env e t in Ok ([e'], Subst.add_varid Subst.empty (Convert.varid_of_typ t) e) - and elab_exp_notation_iter env tid es (t1, iter) t at : Il.exp attempt = assert (valid_tid tid); let* e' = elab_exp_notation_iter' env tid es (t1, iter) t at in @@ -1605,7 +1597,7 @@ and elab_exp_variant env tid e cases t at : Il.exp attempt = in let* t1, _prems = attempt (find_case_sub cases atom atom.at) t in let* es', _s = elab_exp_notation' env tid e t1 in - let t2 = expand_singular env t $ at in + let t2 = expand env t $ at in let t2' = elab_typ env t2 in let mixop, _, _ = elab_typ_notation env tid t1 in cast_exp "variant case" env @@ -1647,7 +1639,6 @@ and cast_empty phrase env t at t' : Il.exp attempt = | IterT (_, Opt) -> Ok (Il.OptE None $$ at % t') | IterT (_, List) -> Ok (Il.ListE [] $$ at % t') | VarT _ when is_iter_notation_typ env t -> - assert (is_notation_typ env t); (match expand_iter_notation env t with | IterT (_, iter) as t1 -> let mixop, ts', _ts = elab_typ_notation env (expand_id env t) (t1 $ t.at) in @@ -1799,8 +1790,8 @@ and cast_exp' phrase env e' t1 t2 : Il.exp' attempt = | Fail (Trace (_, msg, _) :: _) -> fail_typ2 env e'.at phrase t1 t2 (", " ^ msg) | Fail [] -> assert false in - let t11 = expand_singular env t1 $ t1.at in - let t21 = expand_singular env t2 $ t2.at in + let t11 = expand env t1 $ t1.at in + let t21 = expand env t2 $ t2.at in let t11' = elab_typ env (expand_nondef env t1) in let t21' = elab_typ env (expand_nondef env t2) in let* e'' = cast_exp phrase env e' t1 t11 in diff --git a/spectec/src/il/ast.ml b/spectec/src/il/ast.ml index 1e3c0fee1a..ef80f9b62e 100644 --- a/spectec/src/il/ast.ml +++ b/spectec/src/il/ast.ml @@ -69,6 +69,7 @@ and exp' = | DotE of exp * atom (* exp.atom *) | CompE of exp * exp (* exp @ exp *) | ListE of exp list (* [exp ... exp] *) + | LiftE of exp (* exp : _? <: _* *) | MemE of exp * exp (* exp `<-` exp *) | LenE of exp (* |exp| *) | CatE of exp * exp (* exp :: exp *) diff --git a/spectec/src/il/eq.ml b/spectec/src/il/eq.ml index 3c6ebd9419..c002877536 100644 --- a/spectec/src/il/eq.ml +++ b/spectec/src/il/eq.ml @@ -72,6 +72,7 @@ and eq_exp e1 e2 = op1 = op2 && ot1 = ot2 && eq_exp e11 e21 && eq_exp e12 e22 | CmpE (op1, ot1, e11, e12), CmpE (op2, ot2, e21, e22) -> op1 = op2 && ot1 = ot2 && eq_exp e11 e21 && eq_exp e12 e22 + | LiftE e11, LiftE e21 | LenE e11, LenE e21 -> eq_exp e11 e21 | IdxE (e11, e12), IdxE (e21, e22) | CompE (e11, e12), CompE (e21, e22) diff --git a/spectec/src/il/eval.ml b/spectec/src/il/eval.ml index 28559d4195..a5f52d9253 100644 --- a/spectec/src/il/eval.ml +++ b/spectec/src/il/eval.ml @@ -338,6 +338,13 @@ and reduce_exp env e : exp = | _ -> TheE e1' $> e ) | ListE es -> ListE (List.map (reduce_exp env) es) $> e + | LiftE e1 -> + let e1' = reduce_exp env e1 in + (match e1'.it with + | OptE None -> ListE [] + | OptE (Some e11') -> ListE [e11'] + | _ -> LiftE e1' + ) $> e | CatE (e1, e2) -> let e1' = reduce_exp env e1 in let e2' = reduce_exp env e2 in @@ -650,7 +657,8 @@ and match_exp' env s e1 e2 : subst option = let* s'' = List.fold_left (fun s_opt (xI, exI) -> let* s = s_opt in - match_exp' env s (OptE (Some (Subst.subst_exp s' (VarE xI $> exI))) $> e2) exI + let tI = match exI.note.it with IterT (tI, _) -> tI | _ -> assert false in + match_exp' env s (OptE (Some (Subst.subst_exp s' (VarE xI $$ exI.at % tI))) $> e2) exI ) (Some (List.fold_left Subst.remove_varid s (List.map fst xes))) xes in Some (Subst.union s'' s) (* re-add possibly locally shadowed bindings *) | ListE _es1, IterE (e21, (List, xes)) -> @@ -680,7 +688,8 @@ and match_exp' env s e1 e2 : subst option = let xs, exs = List.split xes in let* s''' = match_list (fun env s xI exI -> - let eI = ListE (List.map (fun sJ -> Subst.subst_exp sJ (VarE xI $> exI)) ss) $> e2 in + let tI = match exI.note.it with IterT (tI, _) -> tI | _ -> assert false in + let eI = ListE (List.map (fun sJ -> Subst.subst_exp sJ (VarE xI $$ exI.at % tI)) ss) $> e2 in match_exp' env s eI exI ) env s' xs exs in Some (Subst.union s''' s) (* re-add possibly locally shadowed bindings *) diff --git a/spectec/src/il/free.ml b/spectec/src/il/free.ml index df4237d82e..bce500e9c6 100644 --- a/spectec/src/il/free.ml +++ b/spectec/src/il/free.ml @@ -125,7 +125,7 @@ and free_exp e = match e.it with | VarE id -> free_varid id | BoolE _ | NumE _ | TextE _ -> empty - | UnE (_, _, e1) | LenE e1 | ProjE (e1, _) | TheE e1 | DotE (e1, _) -> free_exp e1 + | UnE (_, _, e1) | LiftE e1 | LenE e1 | ProjE (e1, _) | TheE e1 | DotE (e1, _) -> free_exp e1 | BinE (_, _, e1, e2) | CmpE (_, _, e1, e2) | IdxE (e1, e2) | CompE (e1, e2) | MemE (e1, e2) | CatE (e1, e2) -> free_exp e1 + free_exp e2 | SliceE (e1, e2, e3) -> free_list free_exp [e1; e2; e3] diff --git a/spectec/src/il/iter.ml b/spectec/src/il/iter.ml index e3ce7c81f4..7db263fbcf 100644 --- a/spectec/src/il/iter.ml +++ b/spectec/src/il/iter.ml @@ -127,7 +127,7 @@ and exp e = | BinE (op, ot, e1, e2) -> binop op; optyp ot; exp e1; exp e2 | CmpE (op, ot, e1, e2) -> cmpop op; optyp ot; exp e1; exp e2 | TupE es | ListE es -> list exp es - | ProjE (e1, _) | TheE e1 | LenE e1 -> exp e1 + | ProjE (e1, _) | TheE e1 | LiftE e1 | LenE e1 -> exp e1 | CaseE (op, e1) -> mixop op; exp e1 | UncaseE (e1, op) -> exp e1; mixop op | OptE eo -> opt exp eo diff --git a/spectec/src/il/print.ml b/spectec/src/il/print.ml index 13cc89739c..2da7cd6f9c 100644 --- a/spectec/src/il/print.ml +++ b/spectec/src/il/print.ml @@ -143,6 +143,7 @@ and string_of_exp e = | OptE eo -> "?(" ^ string_of_exps "" (Option.to_list eo) ^ ")" | TheE e1 -> "!(" ^ string_of_exp e1 ^ ")" | ListE es -> "[" ^ string_of_exps " " es ^ "]" + | LiftE e1 -> "lift(" ^ string_of_exp e1 ^ ")" | CatE (e1, e2) -> string_of_exp e1 ^ " ++ " ^ string_of_exp e2 | CaseE (op, e1) -> string_of_mixop op ^ "_" ^ string_of_typ_name e.note ^ string_of_exp_args e1 diff --git a/spectec/src/il/subst.ml b/spectec/src/il/subst.ml index 0dd393cb0b..7e1bde0280 100644 --- a/spectec/src/il/subst.ml +++ b/spectec/src/il/subst.ml @@ -155,12 +155,18 @@ and subst_exp s e = let it', s' = subst_iterexp s iterexp in IterE (subst_exp s' e1, it') | ProjE (e1, i) -> ProjE (subst_exp s e1, i) - | UncaseE (e1, op) -> UncaseE (subst_exp s e1, op) + | UncaseE (e1, op) -> + let e1' = subst_exp s e1 in + assert (match e1'.note.it with VarT _ -> true | _ -> false); + UncaseE (subst_exp s e1, op) | OptE eo -> OptE (subst_opt subst_exp s eo) | TheE e -> TheE (subst_exp s e) | ListE es -> ListE (subst_list subst_exp s es) + | LiftE e -> LiftE (subst_exp s e) | CatE (e1, e2) -> CatE (subst_exp s e1, subst_exp s e2) - | CaseE (op, e1) -> CaseE (op, subst_exp s e1) + | CaseE (op, e1) -> + assert (match e.note.it with VarT _ -> true | _ -> false); + CaseE (op, subst_exp s e1) | CvtE (e1, nt1, nt2) -> CvtE (subst_exp s e1, nt1, nt2) | SubE (e1, t1, t2) -> SubE (subst_exp s e1, subst_typ s t1, subst_typ s t2) ) $$ e.at % subst_typ s e.note diff --git a/spectec/src/il/valid.ml b/spectec/src/il/valid.ml index d57c01843d..52b74093a8 100644 --- a/spectec/src/il/valid.ml +++ b/spectec/src/il/valid.ml @@ -53,12 +53,9 @@ let as_error at phrase dir t expected = string_of_typ t ^ "`" ) -let match_iter iter1 iter2 = - iter2 = List || Eq.eq_iter iter1 iter2 - let as_iter_typ iter phrase env dir t at : typ = match expand_typ env t with - | IterT (t1, iter2) when match_iter iter iter2 -> t1 + | IterT (t1, iter2) when iter = iter2 -> t1 | _ -> as_error at phrase dir t ("(_)" ^ string_of_iter iter) let as_list_typ phrase env dir t at : typ = @@ -307,6 +304,9 @@ and infer_exp (env : Env.t) e : typ = else error e.at "cannot infer type of list" ) + | LiftE e1 -> + let t1 = as_iter_typ Opt "lifting" env Check (infer_exp env e1) e1.at in + IterT (t1, List) $ e.at | LenE _ -> NumT `NatT $ e.at | CatE (e1, e2) -> let t1 = infer_exp env e1 in @@ -443,6 +443,9 @@ try | ListE es -> let t1 = as_iter_typ List "list" env Check t e.at in List.iter (fun eI -> valid_exp ~side env eI t1) es + | LiftE e1 -> + let t1 = as_iter_typ List "lifting" env Check t e.at in + valid_exp ~side env e1 (IterT (t1, Opt) $ e1.at) | CatE (e1, ({it = ListE _ | CatE ({it = ListE _; _}, _); _} as e2)) | CatE (({it = ListE _ | CatE ({it = ListE _; _}, _); _} as e1), e2) when side = `Lhs -> let _typ1 = as_iter_typ List "list" env Check t e.at in diff --git a/spectec/src/il2al/free.ml b/spectec/src/il2al/free.ml index 3746761e39..5b7343bea1 100644 --- a/spectec/src/il2al/free.ml +++ b/spectec/src/il2al/free.ml @@ -21,7 +21,7 @@ let rec free_exp ignore_listN e = match e.it with | VarE id -> free_varid id | BoolE _ | NumE _ | TextE _ -> empty - | CvtE (e1, _, _) | UnE (_, _, e1) | LenE e1 | TheE e1 | SubE (e1, _, _) + | CvtE (e1, _, _) | UnE (_, _, e1) | LiftE e1 | LenE e1 | TheE e1 | SubE (e1, _, _) | DotE (e1, _) | CaseE (_, e1) | ProjE (e1, _) | UncaseE (e1, _) -> f e1 | BinE (_, _, e1, e2) | CmpE (_, _, e1, e2) | IdxE (e1, e2) | CompE (e1, e2) | MemE (e1, e2) | CatE (e1, e2) -> diff --git a/spectec/src/il2al/il_walk.ml b/spectec/src/il2al/il_walk.ml index 1fc8510131..8730f4bb61 100644 --- a/spectec/src/il2al/il_walk.ml +++ b/spectec/src/il2al/il_walk.ml @@ -47,6 +47,7 @@ let rec transform_exp t e = | OptE eo -> OptE ((Option.map t_exp) eo) | TheE e1 -> TheE (t_exp e1) | ListE es -> ListE ((List.map t_exp) es) + | LiftE e1 -> LiftE (t_exp e1) | CatE (e1, e2) -> CatE (t_exp e1, t_exp e2) | MemE (e1, e2) -> MemE (t_exp e1, t_exp e2) | CaseE (mixop, e1) -> CaseE (mixop, t_exp e1) diff --git a/spectec/src/il2al/translate.ml b/spectec/src/il2al/translate.ml index aad87fd488..67ed95107e 100644 --- a/spectec/src/il2al/translate.ml +++ b/spectec/src/il2al/translate.ml @@ -192,6 +192,7 @@ and translate_exp exp = (* List *) | Il.LenE inner_exp -> lenE (translate_exp inner_exp) ~at ~note | Il.ListE exps -> listE (List.map translate_exp exps) ~at ~note + | Il.LiftE inner_exp -> liftE (translate_exp inner_exp) ~at ~note | Il.IdxE (exp1, exp2) -> accE (translate_exp exp1, idxP (translate_exp exp2)) ~at ~note | Il.SliceE (exp1, exp2, exp3) -> diff --git a/spectec/src/il2al/unify.ml b/spectec/src/il2al/unify.ml index c8a6369b87..8e9d026380 100644 --- a/spectec/src/il2al/unify.ml +++ b/spectec/src/il2al/unify.ml @@ -199,6 +199,8 @@ let rec overlap env e1 e2 = if eq_exp e1 e2 then e1 else TheE (overlap env e1 e2) |> replace_it | ListE es1, ListE es2 when List.length es1 = List.length es2 -> ListE (List.map2 (overlap env) es1 es2) |> replace_it + | LiftE e1, LiftE e2 -> + LiftE (overlap env e1 e2) |> replace_it | CatE (e1, e1'), CatE (e2, e2') -> CatE (overlap env e1 e2, overlap env e1' e2') |> replace_it | MemE (e1, e1'), MemE (e2, e2') -> @@ -252,6 +254,7 @@ let rec collect_unified template e = if eq_exp template e then [], [] else [ExpB (id, template.note) $ e.at] | UnE (_, _, e1), UnE (_, _, e2) | DotE (e1, _), DotE (e2, _) + | LiftE e1, LiftE e2 | LenE e1, LenE e2 | IterE (e1, _), IterE (e2, _) | ProjE (e1, _), ProjE (e2, _) diff --git a/spectec/src/middlend/sideconditions.ml b/spectec/src/middlend/sideconditions.ml index 3d450e7d1b..5e3fa71818 100644 --- a/spectec/src/middlend/sideconditions.ml +++ b/spectec/src/middlend/sideconditions.ml @@ -80,6 +80,7 @@ let rec t_exp env e : prem list = | UncaseE (exp, _) | OptE (Some exp) | TheE exp + | LiftE exp | CaseE (_, exp) | CvtE (exp, _, _) | SubE (exp, _, _) diff --git a/spectec/src/middlend/sub.ml b/spectec/src/middlend/sub.ml index 57df88feeb..97de47859d 100644 --- a/spectec/src/middlend/sub.ml +++ b/spectec/src/middlend/sub.ml @@ -151,7 +151,8 @@ and t_exp' env = function | StrE fields -> StrE (List.map (fun (a, e) -> a, t_exp env e) fields) | DotE (e, a) -> DotE (t_exp env e, a) | CompE (exp1, exp2) -> CompE (t_exp env exp1, t_exp env exp2) - | LenE exp -> LenE exp + | LiftE exp -> LiftE (t_exp env exp) + | LenE exp -> LenE (t_exp env exp) | TupE es -> TupE (List.map (t_exp env) es) | CallE (a, args) -> CallE (a, t_args env args) | IterE (e, iterexp) -> IterE (t_exp env e, t_iterexp env iterexp) diff --git a/spectec/src/middlend/totalize.ml b/spectec/src/middlend/totalize.ml index 7d1f6a0911..ea995d35db 100644 --- a/spectec/src/middlend/totalize.ml +++ b/spectec/src/middlend/totalize.ml @@ -97,8 +97,9 @@ and t_exp' env = function | UncaseE (e, mixop) -> UncaseE (t_exp env e, mixop) | OptE None -> OptE None | OptE (Some exp) -> OptE (Some (t_exp env exp)) - | TheE exp -> TheE exp + | TheE exp -> TheE (t_exp env exp) | ListE es -> ListE (List.map (t_exp env) es) + | LiftE exp -> LiftE (t_exp env exp) | CatE (exp1, exp2) -> CatE (t_exp env exp1, t_exp env exp2) | MemE (exp1, exp2) -> MemE (t_exp env exp1, t_exp env exp2) | CaseE (mixop, e) -> CaseE (mixop, t_exp env e) diff --git a/spectec/src/middlend/unthe.ml b/spectec/src/middlend/unthe.ml index a044848770..f1ec243a0d 100644 --- a/spectec/src/middlend/unthe.ml +++ b/spectec/src/middlend/unthe.ml @@ -132,6 +132,7 @@ and t_exp' n e : eqns * exp' = | UncaseE (exp, mo) -> t_e n exp (fun exp' -> UncaseE (exp', mo)) | OptE (Some exp) -> t_e n exp (fun exp' -> OptE (Some exp')) | TheE exp -> t_e n exp (fun exp' -> TheE exp') + | LiftE exp -> t_e n exp (fun exp' -> LiftE exp') | CaseE (mixop, exp) -> t_e n exp (fun exp' -> CaseE (mixop, exp')) | CvtE (exp, a, b) -> t_e n exp (fun exp' -> CvtE (exp', a, b)) | SubE (exp, a, b) -> t_e n exp (fun exp' -> SubE (exp', a, b)) diff --git a/spectec/src/middlend/wild.ml b/spectec/src/middlend/wild.ml index f171a1c157..ef0f4b8320 100644 --- a/spectec/src/middlend/wild.ml +++ b/spectec/src/middlend/wild.ml @@ -149,6 +149,7 @@ and t_exp' env e : bind list * exp' = | UncaseE (exp, mo) -> t_e env exp (fun exp' -> UncaseE (exp', mo)) | OptE (Some exp) -> t_e env exp (fun exp' -> OptE (Some exp')) | TheE exp -> t_e env exp (fun exp' -> TheE exp') + | LiftE exp -> t_e env exp (fun exp' -> LiftE exp') | CaseE (mixop, exp) -> t_e env exp (fun exp' -> CaseE (mixop, exp')) | CvtE (exp, a, b) -> t_e env exp (fun exp' -> CvtE (exp', a, b)) | SubE (exp, a, b) -> t_e env exp (fun exp' -> SubE (exp', a, b)) diff --git a/spectec/test-frontend/TEST.md b/spectec/test-frontend/TEST.md index 3571b7d02c..74d4882910 100644 --- a/spectec/test-frontend/TEST.md +++ b/spectec/test-frontend/TEST.md @@ -309,19 +309,19 @@ def $utf8(char*) : byte* ;; A-binary.watsup:54.1-56.15 def $utf8{ch : char, b : byte}([ch]) = [b] -- if (ch!`%`_char.0 < 128) - -- if (ch = `%`_char(b!`%`_byte.0)) + -- if (`%`_byte(ch!`%`_char.0) = b) ;; A-binary.watsup:57.1-59.46 def $utf8{ch : char, b_1 : byte, b_2 : byte}([ch]) = [b_1 b_2] -- if ((128 <= ch!`%`_char.0) /\ (ch!`%`_char.0 < 2048)) - -- if (ch = `%`_char((((2 ^ 6) * (((b_1!`%`_byte.0 : nat <:> int) - (192 : nat <:> int)) : int <:> nat)) + $cont(b_2)))) + -- if (ch!`%`_char.0 = (((2 ^ 6) * (((b_1!`%`_byte.0 : nat <:> int) - (192 : nat <:> int)) : int <:> nat)) + $cont(b_2))) ;; A-binary.watsup:60.1-62.64 def $utf8{ch : char, b_1 : byte, b_2 : byte, b_3 : byte}([ch]) = [b_1 b_2 b_3] -- if (((2048 <= ch!`%`_char.0) /\ (ch!`%`_char.0 < 55296)) \/ ((57344 <= ch!`%`_char.0) /\ (ch!`%`_char.0 < 65536))) - -- if (ch = `%`_char(((((2 ^ 12) * (((b_1!`%`_byte.0 : nat <:> int) - (224 : nat <:> int)) : int <:> nat)) + ((2 ^ 6) * $cont(b_2))) + $cont(b_3)))) + -- if (ch!`%`_char.0 = ((((2 ^ 12) * (((b_1!`%`_byte.0 : nat <:> int) - (224 : nat <:> int)) : int <:> nat)) + ((2 ^ 6) * $cont(b_2))) + $cont(b_3))) ;; A-binary.watsup:63.1-65.82 def $utf8{ch : char, b_1 : byte, b_2 : byte, b_3 : byte, b_4 : byte}([ch]) = [b_1 b_2 b_3 b_4] -- if ((65536 <= ch!`%`_char.0) /\ (ch!`%`_char.0 < 69632)) - -- if (ch = `%`_char((((((2 ^ 18) * (((b_1!`%`_byte.0 : nat <:> int) - (240 : nat <:> int)) : int <:> nat)) + ((2 ^ 12) * $cont(b_2))) + ((2 ^ 6) * $cont(b_3))) + $cont(b_4)))) + -- if (ch!`%`_char.0 = (((((2 ^ 18) * (((b_1!`%`_byte.0 : nat <:> int) - (240 : nat <:> int)) : int <:> nat)) + ((2 ^ 12) * $cont(b_2))) + ((2 ^ 6) * $cont(b_3))) + $cont(b_4))) } ;; 1-syntax.watsup @@ -1217,7 +1217,7 @@ syntax storeop_{Inn : Inn}((Inn : Inn <: numtype)) = ;; 1-syntax.watsup syntax vloadop_{vectype : vectype}(vectype) = | `SHAPE%X%%`{sz : sz, M : M, sx : sx}(sz : sz, M : M, sx : sx) - -- if ((sz!`%`_sz.0 * M) = ((($vsize(vectype) : nat <:> rat) / (2 : nat <:> rat)) : rat <:> nat)) + -- if (((sz!`%`_sz.0 * M) : nat <:> rat) = (($vsize(vectype) : nat <:> rat) / (2 : nat <:> rat))) | SPLAT{sz : sz}(sz : sz) | ZERO{sz : sz}(sz : sz) -- if (sz!`%`_sz.0 >= 32) @@ -1382,7 +1382,7 @@ syntax instr = | VBITMASK{ishape : ishape}(ishape : ishape) | VSWIZZLOP{bshape : bshape, vswizzlop_ : vswizzlop_(bshape)}(bshape : bshape, vswizzlop_ : vswizzlop_(bshape)) | VSHUFFLE{bshape : bshape, `laneidx*` : laneidx*}(bshape : bshape, laneidx*{laneidx <- `laneidx*`} : laneidx*) - -- if (|laneidx*{laneidx <- `laneidx*`}| = $dim(bshape!`%`_bshape.0)!`%`_dim.0) + -- if (`%`_dim(|laneidx*{laneidx <- `laneidx*`}|) = $dim(bshape!`%`_bshape.0)) | VEXTUNOP{ishape_1 : ishape, ishape_2 : ishape, vextunop__ : vextunop__(ishape_2, ishape_1)}(ishape_1 : ishape, ishape_2 : ishape, vextunop__ : vextunop__(ishape_2, ishape_1)) | VEXTBINOP{ishape_1 : ishape, ishape_2 : ishape, vextbinop__ : vextbinop__(ishape_2, ishape_1)}(ishape_1 : ishape, ishape_2 : ishape, vextbinop__ : vextbinop__(ishape_2, ishape_1)) | VEXTTERNOP{ishape_1 : ishape, ishape_2 : ishape, vextternop__ : vextternop__(ishape_2, ishape_1)}(ishape_1 : ishape, ishape_2 : ishape, vextternop__ : vextternop__(ishape_2, ishape_1)) @@ -3204,7 +3204,7 @@ relation Externtype_sub: `%|-%<:%`(context, externtype, externtype) relation Blocktype_ok: `%|-%:%`(context, blocktype, instrtype) ;; 3-typing.watsup rule valtype{C : context, `valtype?` : valtype?}: - `%|-%:%`(C, _RESULT_blocktype(valtype?{valtype <- `valtype?`}), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype(valtype?{valtype <- `valtype?`}))) + `%|-%:%`(C, _RESULT_blocktype(valtype?{valtype <- `valtype?`}), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype(lift(valtype?{valtype <- `valtype?`})))) -- (Valtype_ok: `%|-%:OK`(C, valtype))?{valtype <- `valtype?`} ;; 3-typing.watsup @@ -3309,13 +3309,13 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) ;; 3-typing.watsup:623.1-626.42 rule br{C : context, l : labelidx, `t_1*` : valtype*, `t*` : valtype*, `t_2*` : valtype*}: `%|-%:%`(C, BR_instr(l), `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`} ++ t*{t <- `t*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) - -- if (C.LABELS_context[l!`%`_labelidx.0] = `%`_resulttype(t*{t <- `t*`})) + -- if (C.LABELS_context[l!`%`_labelidx.0]!`%`_resulttype.0 = t*{t <- `t*`}) -- Instrtype_ok: `%|-%:OK`(C, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) ;; 3-typing.watsup:628.1-630.25 rule br_if{C : context, l : labelidx, `t*` : valtype*}: `%|-%:%`(C, BR_IF_instr(l), `%->_%%`_instrtype(`%`_resulttype(t*{t <- `t*`} ++ [I32_valtype]), [], `%`_resulttype(t*{t <- `t*`}))) - -- if (C.LABELS_context[l!`%`_labelidx.0] = `%`_resulttype(t*{t <- `t*`})) + -- if (C.LABELS_context[l!`%`_labelidx.0]!`%`_resulttype.0 = t*{t <- `t*`}) ;; 3-typing.watsup:632.1-636.42 rule br_table{C : context, `l*` : labelidx*, l' : labelidx, `t_1*` : valtype*, `t*` : valtype*, `t_2*` : valtype*}: @@ -3327,7 +3327,7 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) ;; 3-typing.watsup:638.1-641.31 rule br_on_null{C : context, l : labelidx, `t*` : valtype*, ht : heaptype}: `%|-%:%`(C, BR_ON_NULL_instr(l), `%->_%%`_instrtype(`%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(`NULL%?`_nul(?(())), ht)]), [], `%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(`NULL%?`_nul(?()), ht)]))) - -- if (C.LABELS_context[l!`%`_labelidx.0] = `%`_resulttype(t*{t <- `t*`})) + -- if (C.LABELS_context[l!`%`_labelidx.0]!`%`_resulttype.0 = t*{t <- `t*`}) -- Heaptype_ok: `%|-%:OK`(C, ht) ;; 3-typing.watsup:643.1-645.34 @@ -3976,7 +3976,7 @@ relation Type_ok: `%|-%:%`(context, type, deftype*) ;; 3-typing.watsup rule _{C : context, rectype : rectype, `dt*` : deftype*, x : idx}: `%|-%:%`(C, TYPE_type(rectype), dt*{dt <- `dt*`}) - -- if (x = `%`_idx(|C.TYPES_context|)) + -- if (x!`%`_idx.0 = |C.TYPES_context|) -- if (dt*{dt <- `dt*`} = $rolldt(x, rectype)) -- Rectype_ok: `%|-%:%`(C +++ {TYPES dt*{dt <- `dt*`}, RECS [], FUNCS [], GLOBALS [], TABLES [], MEMS [], TAGS [], ELEMS [], DATAS [], LOCALS [], LABELS [], RETURN ?(), REFS []}, rectype, OK_oktypeidx(x)) @@ -4466,12 +4466,12 @@ def $irelaxed_laneselect_(N : N, iN : iN(N), iN : iN(N), iN : iN(N)) : iN(N)* ;; 4-numerics.watsup def $ieqz_(N : N, iN : iN(N)) : u32 ;; 4-numerics.watsup - def $ieqz_{N : N, i_1 : iN(N)}(N, i_1) = `%`_u32($bool((i_1 = `%`_iN(0)))) + def $ieqz_{N : N, i_1 : iN(N)}(N, i_1) = `%`_u32($bool((i_1!`%`_iN.0 = 0))) ;; 4-numerics.watsup def $inez_(N : N, iN : iN(N)) : u32 ;; 4-numerics.watsup - def $inez_{N : N, i_1 : iN(N)}(N, i_1) = `%`_u32($bool((i_1 =/= `%`_iN(0)))) + def $inez_{N : N, i_1 : iN(N)}(N, i_1) = `%`_u32($bool((i_1!`%`_iN.0 =/= 0))) ;; 4-numerics.watsup def $ieq_(N : N, iN : iN(N), iN : iN(N)) : u32 @@ -4876,14 +4876,14 @@ def $ivtestop_(shape : shape, def $f_(N : N, iN : iN(N)) : u32, vec_ : vec_(V128 ;; 4-numerics.watsup def $ivtestop_{Jnn : Jnn, M : M, def $f_(N : N, iN : iN(N)) : u32, v_1 : vec_(V128_Vnn), `c*` : nat*, `c_1*` : lane_($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))))*}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), def $f_, v_1) = `%`_u32($prod(c*{c <- `c*`})) -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), v_1)) - -- if (c*{c <- `c*`} = $f_($lsizenn((Jnn : Jnn <: lanetype)), c_1)!`%`_u32.0*{c_1 <- `c_1*`}) + -- if (`%`_u32(c)*{c <- `c*`} = $f_($lsizenn((Jnn : Jnn <: lanetype)), c_1)*{c_1 <- `c_1*`}) ;; 4-numerics.watsup def $fvtestop_(shape : shape, def $f_(N : N, fN : fN(N)) : u32, vec_ : vec_(V128_Vnn)) : u32 ;; 4-numerics.watsup def $fvtestop_{Fnn : Fnn, M : M, def $f_(N : N, fN : fN(N)) : u32, v_1 : vec_(V128_Vnn), `c*` : nat*, `c_1*` : lane_($lanetype(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M))))*}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), def $f_, v_1) = `%`_u32($prod(c*{c <- `c*`})) -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), v_1)) - -- if (c*{c <- `c*`} = $f_($sizenn((Fnn : Fnn <: numtype)), c_1)!`%`_u32.0*{c_1 <- `c_1*`}) + -- if (`%`_u32(c)*{c <- `c*`} = $f_($sizenn((Fnn : Fnn <: numtype)), c_1)*{c_1 <- `c_1*`}) ;; 4-numerics.watsup def $ivrelop_(shape : shape, def $f_(N : N, iN : iN(N), iN : iN(N)) : u32, vec_ : vec_(V128_Vnn), vec_ : vec_(V128_Vnn)) : vec_(V128_Vnn) @@ -4907,7 +4907,7 @@ def $fvrelop_(shape : shape, def $f_(N : N, fN : fN(N), fN : fN(N)) : u32, vec_ def $fvrelop_{Fnn : Fnn, M : M, def $f_(N : N, fN : fN(N), fN : fN(N)) : u32, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn), Inn : Inn, `c*` : lane_($lanetype(`%X%`_shape((Inn : Inn <: lanetype), `%`_dim(M))))*, `c_1*` : lane_($lanetype(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M))))*, `c_2*` : lane_($lanetype(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M))))*}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), def $f_, v_1, v_2) = $invlanes_(`%X%`_shape((Inn : Inn <: lanetype), `%`_dim(M)), c*{c <- `c*`}) -- 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)) - -- if (c*{c <- `c*`} = `%`_lane_($extend__(1, $sizenn((Fnn : Fnn <: numtype)), S_sx, `%`_iN($f_($sizenn((Fnn : Fnn <: numtype)), c_1, c_2)!`%`_u32.0))!`%`_iN.0)*{c_1 <- `c_1*`, c_2 <- `c_2*`}) + -- if (`%`_iN(c!`%`_lane_.0)*{c <- `c*`} = $extend__(1, $sizenn((Fnn : Fnn <: numtype)), S_sx, `%`_iN($f_($sizenn((Fnn : Fnn <: numtype)), c_1, c_2)!`%`_u32.0))*{c_1 <- `c_1*`, c_2 <- `c_2*`}) -- if ($size((Inn : Inn <: numtype)) = $size((Fnn : Fnn <: numtype))) ;; 4-numerics.watsup @@ -5198,7 +5198,7 @@ def $ivmul_(N : N, iN(N)*, iN(N)*) : iN(N)* def $vextbinop__(ishape_1 : ishape, ishape_2 : ishape, vextbinop__ : vextbinop__(ishape_1, ishape_2), vec_ : vec_(V128_Vnn), vec_ : vec_(V128_Vnn)) : vec_(V128_Vnn) ;; 4-numerics.watsup def $vextbinop__{Jnn_1 : Jnn, M_1 : M, Jnn_2 : Jnn, M_2 : M, sx : sx, half : half__(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2))), v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn), i : laneidx}(`%`_ishape(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1))), `%`_ishape(`%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2))), EXTMUL_vextbinop__(sx, half), v_1, v_2) = $ivextbinop__(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2)), def $ivmul_, sx, sx, i, `%`_laneidx(M_2), v_1, v_2) - -- if (i = `%`_laneidx($half__(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2)), half, 0, M_2))) + -- if (i!`%`_laneidx.0 = $half__(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2)), half, 0, M_2)) ;; 4-numerics.watsup def $vextbinop__{Jnn_1 : Jnn, M_1 : M, Jnn_2 : Jnn, M_2 : M, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn)}(`%`_ishape(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1))), `%`_ishape(`%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2))), `DOTS`_vextbinop__, v_1, v_2) = $ivextbinop__(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2)), def $ivdot_, S_sx, S_sx, `%`_laneidx(0), `%`_laneidx(M_1), v_1, v_2) ;; 4-numerics.watsup @@ -5663,7 +5663,7 @@ def $growtable(tableinst : tableinst, nat : nat, ref : ref) : tableinst def $growtable{tableinst : tableinst, n : n, r : ref, tableinst' : tableinst, at : addrtype, i : u64, j : u64, rt : reftype, `r'*` : ref*, i' : u64}(tableinst, n, r) = tableinst' -- if (tableinst = {TYPE `%%%`_tabletype(at, `[%..%]`_limits(i, j), rt), REFS r'*{r' <- `r'*`}}) -- if (tableinst' = {TYPE `%%%`_tabletype(at, `[%..%]`_limits(i', j), rt), REFS r'*{r' <- `r'*`} ++ r^n{}}) - -- if ((i' = `%`_u64((|r'*{r' <- `r'*`}| + n))) /\ ((|r'*{r' <- `r'*`}| + n) <= j!`%`_u64.0)) + -- if ((i'!`%`_u64.0 = (|r'*{r' <- `r'*`}| + n)) /\ ((|r'*{r' <- `r'*`}| + n) <= j!`%`_u64.0)) ;; 6-runtime-aux.watsup def $growmem(meminst : meminst, nat : nat) : meminst @@ -5671,7 +5671,7 @@ def $growmem(meminst : meminst, nat : nat) : meminst def $growmem{meminst : meminst, n : n, meminst' : meminst, at : addrtype, i : u64, j : u64, `b*` : byte*, i' : u64}(meminst, n) = meminst' -- if (meminst = {TYPE `%%PAGE`_memtype(at, `[%..%]`_limits(i, j)), BYTES b*{b <- `b*`}}) -- if (meminst' = {TYPE `%%PAGE`_memtype(at, `[%..%]`_limits(i', j)), BYTES b*{b <- `b*`} ++ `%`_byte(0)^(n * (64 * $Ki)){}}) - -- if ((i' = `%`_u64(((((|b*{b <- `b*`}| : nat <:> rat) / ((64 * $Ki) : nat <:> rat)) + (n : nat <:> rat)) : rat <:> nat))) /\ ((((|b*{b <- `b*`}| : nat <:> rat) / ((64 * $Ki) : nat <:> rat)) + (n : nat <:> rat)) <= (j!`%`_u64.0 : nat <:> rat))) + -- if (((i'!`%`_u64.0 : nat <:> rat) = (((|b*{b <- `b*`}| : nat <:> rat) / ((64 * $Ki) : nat <:> rat)) + (n : nat <:> rat))) /\ ((((|b*{b <- `b*`}| : nat <:> rat) / ((64 * $Ki) : nat <:> rat)) + (n : nat <:> rat)) <= (j!`%`_u64.0 : nat <:> rat))) ;; 7-runtime-typing.watsup relation Num_type: `%|-%:%`(store, num, numtype) @@ -5803,22 +5803,22 @@ relation Step_pure: `%~>%`(instr*, instr*) ;; 8-reduction.watsup rule `select-true`{val_1 : val, val_2 : val, c : num_(I32_numtype), `t*?` : valtype*?}: `%~>%`([(val_1 : val <: instr) (val_2 : val <: instr) CONST_instr(I32_numtype, c) `SELECT()%?`_instr(t*{t <- `t*`}?{`t*` <- `t*?`})], [(val_1 : val <: instr)]) - -- if (c =/= `%`_num_(0)) + -- if (c!`%`_num_.0 =/= 0) ;; 8-reduction.watsup rule `select-false`{val_1 : val, val_2 : val, c : num_(I32_numtype), `t*?` : valtype*?}: `%~>%`([(val_1 : val <: instr) (val_2 : val <: instr) CONST_instr(I32_numtype, c) `SELECT()%?`_instr(t*{t <- `t*`}?{`t*` <- `t*?`})], [(val_2 : val <: instr)]) - -- if (c = `%`_num_(0)) + -- if (c!`%`_num_.0 = 0) ;; 8-reduction.watsup rule `if-true`{c : num_(I32_numtype), bt : blocktype, `instr_1*` : instr*, `instr_2*` : instr*}: `%~>%`([CONST_instr(I32_numtype, c) `IF%%ELSE%`_instr(bt, instr_1*{instr_1 <- `instr_1*`}, instr_2*{instr_2 <- `instr_2*`})], [BLOCK_instr(bt, instr_1*{instr_1 <- `instr_1*`})]) - -- if (c =/= `%`_num_(0)) + -- if (c!`%`_num_.0 =/= 0) ;; 8-reduction.watsup rule `if-false`{c : num_(I32_numtype), bt : blocktype, `instr_1*` : instr*, `instr_2*` : instr*}: `%~>%`([CONST_instr(I32_numtype, c) `IF%%ELSE%`_instr(bt, instr_1*{instr_1 <- `instr_1*`}, instr_2*{instr_2 <- `instr_2*`})], [BLOCK_instr(bt, instr_2*{instr_2 <- `instr_2*`})]) - -- if (c = `%`_num_(0)) + -- if (c!`%`_num_.0 = 0) ;; 8-reduction.watsup rule `label-vals`{n : n, `instr*` : instr*, `val*` : val*}: @@ -5827,7 +5827,7 @@ relation Step_pure: `%~>%`(instr*, instr*) ;; 8-reduction.watsup rule `br-label-zero`{n : n, `instr'*` : instr*, `val'*` : val*, `val*` : val*, l : labelidx, `instr*` : instr*}: `%~>%`([`LABEL_%{%}%`_instr(n, instr'*{instr' <- `instr'*`}, (val' : val <: instr)*{val' <- `val'*`} ++ (val : val <: instr)^n{val <- `val*`} ++ [BR_instr(l)] ++ instr*{instr <- `instr*`})], (val : val <: instr)^n{val <- `val*`} ++ instr'*{instr' <- `instr'*`}) - -- if (l = `%`_labelidx(0)) + -- if (l!`%`_labelidx.0 = 0) ;; 8-reduction.watsup rule `br-label-succ`{n : n, `instr'*` : instr*, `val*` : val*, l : labelidx, `instr*` : instr*}: @@ -5841,12 +5841,12 @@ relation Step_pure: `%~>%`(instr*, instr*) ;; 8-reduction.watsup rule `br_if-true`{c : num_(I32_numtype), l : labelidx}: `%~>%`([CONST_instr(I32_numtype, c) BR_IF_instr(l)], [BR_instr(l)]) - -- if (c =/= `%`_num_(0)) + -- if (c!`%`_num_.0 =/= 0) ;; 8-reduction.watsup rule `br_if-false`{c : num_(I32_numtype), l : labelidx}: `%~>%`([CONST_instr(I32_numtype, c) BR_IF_instr(l)], []) - -- if (c = `%`_num_(0)) + -- if (c!`%`_num_.0 = 0) ;; 8-reduction.watsup rule `br_table-lt`{i : num_(I32_numtype), `l*` : labelidx*, l' : labelidx}: @@ -6162,7 +6162,7 @@ def $blocktype_(state : state, blocktype : blocktype) : functype def $blocktype_{z : state, x : idx, ft : functype}(z, _IDX_blocktype(x)) = ft -- Expand: `%~~%`($type(z, x), FUNC_comptype(ft)) ;; 8-reduction.watsup - def $blocktype_{z : state, `t?` : valtype?}(z, _RESULT_blocktype(t?{t <- `t?`})) = `%->%`_functype(`%`_resulttype([]), `%`_resulttype(t?{t <- `t?`})) + def $blocktype_{z : state, `t?` : valtype?}(z, _RESULT_blocktype(t?{t <- `t?`})) = `%->%`_functype(`%`_resulttype([]), `%`_resulttype(lift(t?{t <- `t?`}))) ;; 8-reduction.watsup relation Step_read: `%~>%`(config, instr*) @@ -6626,7 +6626,7 @@ relation Step_read: `%~>%`(config, instr*) `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VLOAD_instr(V128_vectype, ?(SPLAT_vloadop_(`%`_sz(N))), x, ao)]), [VCONST_instr(V128_vectype, c)]) -- if ($ibytes_(N, j) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) : (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) -- if (N = $lsize((Jnn : Jnn <: lanetype))) - -- if (M = (((128 : nat <:> rat) / (N : nat <:> rat)) : rat <:> nat)) + -- if ((M : nat <:> rat) = ((128 : nat <:> rat) / (N : nat <:> rat))) -- if (c = $invlanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), `%`_lane_(j!`%`_iN.0)^M{})) ;; 8-reduction.watsup @@ -6650,7 +6650,7 @@ relation Step_read: `%~>%`(config, instr*) `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c_1) VLOAD_LANE_instr(V128_vectype, `%`_sz(N), x, ao, j)]), [VCONST_instr(V128_vectype, c)]) -- if ($ibytes_(N, k) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) : (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) -- if (N = $lsize((Jnn : Jnn <: lanetype))) - -- if (M = ((($vsize(V128_vectype) : nat <:> rat) / (N : nat <:> rat)) : rat <:> nat)) + -- if ((M : nat <:> rat) = (($vsize(V128_vectype) : nat <:> rat) / (N : nat <:> rat))) -- if (c = $invlanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), c_1)[[j!`%`_laneidx.0] = `%`_lane_(k!`%`_iN.0)])) ;; 8-reduction.watsup @@ -6857,7 +6857,7 @@ relation Step: `%~>%`(config, config) rule `vstore_lane-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c : vec_(V128_Vnn), N : N, x : idx, ao : memarg, j : laneidx, `b*` : byte*, Jnn : Jnn, M : M}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_LANE_instr(V128_vectype, `%`_sz(N), x, ao, j)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0), (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) -- if (N = $lsize((Jnn : Jnn <: lanetype))) - -- if (M = (((128 : nat <:> rat) / (N : nat <:> rat)) : rat <:> nat)) + -- if ((M : nat <:> rat) = ((128 : nat <:> rat) / (N : nat <:> rat))) -- if (b*{b <- `b*`} = $ibytes_(N, `%`_iN($lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), c)[j!`%`_laneidx.0]!`%`_lane_.0))) ;; 8-reduction.watsup:1019.1-1022.37 @@ -6909,7 +6909,7 @@ def $alloctypes(type*) : deftype* -- if (deftype'*{deftype' <- `deftype'*`} = $alloctypes(type'*{type' <- `type'*`})) -- if (type = TYPE_type(rectype)) -- if (deftype*{deftype <- `deftype*`} = $subst_all_deftypes($rolldt(x, rectype), (deftype' : deftype <: heaptype)*{deftype' <- `deftype'*`})) - -- if (x = `%`_idx(|deftype'*{deftype' <- `deftype'*`}|)) + -- if (x!`%`_idx.0 = |deftype'*{deftype' <- `deftype'*`}|) } ;; 9-module.watsup @@ -7132,7 +7132,7 @@ def $evalglobals(state : state, globaltype*, expr*) : (state, val*) ;; 9-module.watsup def $instantiate(store : store, module : module, externaddr*) : config ;; 9-module.watsup - def $instantiate{s : store, module : module, `externaddr*` : externaddr*, s' : store, f : frame, `instr_E*` : instr*, `instr_D*` : instr*, `instr_S?` : instr?, `xt_I*` : externtype*, `xt_E*` : externtype*, `type*` : type*, `import*` : import*, `func*` : func*, `global*` : global*, `table*` : table*, `mem*` : mem*, `tag*` : tag*, `elem*` : elem*, `data*` : data*, `start?` : start?, `export*` : export*, `globaltype*` : globaltype*, `expr_G*` : expr*, `tabletype*` : tabletype*, `expr_T*` : expr*, `reftype*` : reftype*, `expr_E**` : expr**, `elemmode*` : elemmode*, `byte**` : byte**, `datamode*` : datamode*, `x?` : idx?, moduleinst_0 : moduleinst, `i_F*` : nat*, z : state, z' : state, `val_G*` : val*, `ref_T*` : ref*, `ref_E**` : ref**, moduleinst : moduleinst, `i_E*` : nat*, `i_D*` : nat*}(s, module, externaddr*{externaddr <- `externaddr*`}) = `%;%`_config(`%;%`_state(s', f), instr_E*{instr_E <- `instr_E*`} ++ instr_D*{instr_D <- `instr_D*`} ++ instr_S?{instr_S <- `instr_S?`}) + def $instantiate{s : store, module : module, `externaddr*` : externaddr*, s' : store, f : frame, `instr_E*` : instr*, `instr_D*` : instr*, `instr_S?` : instr?, `xt_I*` : externtype*, `xt_E*` : externtype*, `type*` : type*, `import*` : import*, `func*` : func*, `global*` : global*, `table*` : table*, `mem*` : mem*, `tag*` : tag*, `elem*` : elem*, `data*` : data*, `start?` : start?, `export*` : export*, `globaltype*` : globaltype*, `expr_G*` : expr*, `tabletype*` : tabletype*, `expr_T*` : expr*, `reftype*` : reftype*, `expr_E**` : expr**, `elemmode*` : elemmode*, `byte**` : byte**, `datamode*` : datamode*, `x?` : idx?, moduleinst_0 : moduleinst, `i_F*` : nat*, z : state, z' : state, `val_G*` : val*, `ref_T*` : ref*, `ref_E**` : ref**, moduleinst : moduleinst, `i_E*` : nat*, `i_D*` : nat*}(s, module, externaddr*{externaddr <- `externaddr*`}) = `%;%`_config(`%;%`_state(s', f), instr_E*{instr_E <- `instr_E*`} ++ instr_D*{instr_D <- `instr_D*`} ++ lift(instr_S?{instr_S <- `instr_S?`})) -- Module_ok: `|-%:%`(module, `%->%`_moduletype(xt_I*{xt_I <- `xt_I*`}, xt_E*{xt_E <- `xt_E*`})) -- (Externaddr_type: `%|-%:%`(s, externaddr, xt_I))*{externaddr <- `externaddr*`, xt_I <- `xt_I*`} -- if (module = MODULE_module(type*{type <- `type*`}, import*{import <- `import*`}, func*{func <- `func*`}, global*{global <- `global*`}, table*{table <- `table*`}, mem*{mem <- `mem*`}, tag*{tag <- `tag*`}, elem*{elem <- `elem*`}, data*{data <- `data*`}, start?{start <- `start?`}, export*{export <- `export*`})) diff --git a/spectec/test-middlend/TEST.md b/spectec/test-middlend/TEST.md index 65a0486064..c6dbb6ccec 100644 --- a/spectec/test-middlend/TEST.md +++ b/spectec/test-middlend/TEST.md @@ -299,19 +299,19 @@ def $utf8(char*) : byte* ;; A-binary.watsup:54.1-56.15 def $utf8{ch : char, b : byte}([ch]) = [b] -- if (ch!`%`_char.0 < 128) - -- if (ch = `%`_char(b!`%`_byte.0)) + -- if (`%`_byte(ch!`%`_char.0) = b) ;; A-binary.watsup:57.1-59.46 def $utf8{ch : char, b_1 : byte, b_2 : byte}([ch]) = [b_1 b_2] -- if ((128 <= ch!`%`_char.0) /\ (ch!`%`_char.0 < 2048)) - -- if (ch = `%`_char((((2 ^ 6) * (((b_1!`%`_byte.0 : nat <:> int) - (192 : nat <:> int)) : int <:> nat)) + $cont(b_2)))) + -- if (ch!`%`_char.0 = (((2 ^ 6) * (((b_1!`%`_byte.0 : nat <:> int) - (192 : nat <:> int)) : int <:> nat)) + $cont(b_2))) ;; A-binary.watsup:60.1-62.64 def $utf8{ch : char, b_1 : byte, b_2 : byte, b_3 : byte}([ch]) = [b_1 b_2 b_3] -- if (((2048 <= ch!`%`_char.0) /\ (ch!`%`_char.0 < 55296)) \/ ((57344 <= ch!`%`_char.0) /\ (ch!`%`_char.0 < 65536))) - -- if (ch = `%`_char(((((2 ^ 12) * (((b_1!`%`_byte.0 : nat <:> int) - (224 : nat <:> int)) : int <:> nat)) + ((2 ^ 6) * $cont(b_2))) + $cont(b_3)))) + -- if (ch!`%`_char.0 = ((((2 ^ 12) * (((b_1!`%`_byte.0 : nat <:> int) - (224 : nat <:> int)) : int <:> nat)) + ((2 ^ 6) * $cont(b_2))) + $cont(b_3))) ;; A-binary.watsup:63.1-65.82 def $utf8{ch : char, b_1 : byte, b_2 : byte, b_3 : byte, b_4 : byte}([ch]) = [b_1 b_2 b_3 b_4] -- if ((65536 <= ch!`%`_char.0) /\ (ch!`%`_char.0 < 69632)) - -- if (ch = `%`_char((((((2 ^ 18) * (((b_1!`%`_byte.0 : nat <:> int) - (240 : nat <:> int)) : int <:> nat)) + ((2 ^ 12) * $cont(b_2))) + ((2 ^ 6) * $cont(b_3))) + $cont(b_4)))) + -- if (ch!`%`_char.0 = (((((2 ^ 18) * (((b_1!`%`_byte.0 : nat <:> int) - (240 : nat <:> int)) : int <:> nat)) + ((2 ^ 12) * $cont(b_2))) + ((2 ^ 6) * $cont(b_3))) + $cont(b_4))) } ;; 1-syntax.watsup @@ -1207,7 +1207,7 @@ syntax storeop_{Inn : Inn}((Inn : Inn <: numtype)) = ;; 1-syntax.watsup syntax vloadop_{vectype : vectype}(vectype) = | `SHAPE%X%%`{sz : sz, M : M, sx : sx}(sz : sz, M : M, sx : sx) - -- if ((sz!`%`_sz.0 * M) = ((($vsize(vectype) : nat <:> rat) / (2 : nat <:> rat)) : rat <:> nat)) + -- if (((sz!`%`_sz.0 * M) : nat <:> rat) = (($vsize(vectype) : nat <:> rat) / (2 : nat <:> rat))) | SPLAT{sz : sz}(sz : sz) | ZERO{sz : sz}(sz : sz) -- if (sz!`%`_sz.0 >= 32) @@ -1372,7 +1372,7 @@ syntax instr = | VBITMASK{ishape : ishape}(ishape : ishape) | VSWIZZLOP{bshape : bshape, vswizzlop_ : vswizzlop_(bshape)}(bshape : bshape, vswizzlop_ : vswizzlop_(bshape)) | VSHUFFLE{bshape : bshape, `laneidx*` : laneidx*}(bshape : bshape, laneidx*{laneidx <- `laneidx*`} : laneidx*) - -- if (|laneidx*{laneidx <- `laneidx*`}| = $dim(bshape!`%`_bshape.0)!`%`_dim.0) + -- if (`%`_dim(|laneidx*{laneidx <- `laneidx*`}|) = $dim(bshape!`%`_bshape.0)) | VEXTUNOP{ishape_1 : ishape, ishape_2 : ishape, vextunop__ : vextunop__(ishape_2, ishape_1)}(ishape_1 : ishape, ishape_2 : ishape, vextunop__ : vextunop__(ishape_2, ishape_1)) | VEXTBINOP{ishape_1 : ishape, ishape_2 : ishape, vextbinop__ : vextbinop__(ishape_2, ishape_1)}(ishape_1 : ishape, ishape_2 : ishape, vextbinop__ : vextbinop__(ishape_2, ishape_1)) | VEXTTERNOP{ishape_1 : ishape, ishape_2 : ishape, vextternop__ : vextternop__(ishape_2, ishape_1)}(ishape_1 : ishape, ishape_2 : ishape, vextternop__ : vextternop__(ishape_2, ishape_1)) @@ -3194,7 +3194,7 @@ relation Externtype_sub: `%|-%<:%`(context, externtype, externtype) relation Blocktype_ok: `%|-%:%`(context, blocktype, instrtype) ;; 3-typing.watsup rule valtype{C : context, `valtype?` : valtype?}: - `%|-%:%`(C, _RESULT_blocktype(valtype?{valtype <- `valtype?`}), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype(valtype?{valtype <- `valtype?`}))) + `%|-%:%`(C, _RESULT_blocktype(valtype?{valtype <- `valtype?`}), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype(lift(valtype?{valtype <- `valtype?`})))) -- (Valtype_ok: `%|-%:OK`(C, valtype))?{valtype <- `valtype?`} ;; 3-typing.watsup @@ -3299,13 +3299,13 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) ;; 3-typing.watsup:623.1-626.42 rule br{C : context, l : labelidx, `t_1*` : valtype*, `t*` : valtype*, `t_2*` : valtype*}: `%|-%:%`(C, BR_instr(l), `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`} ++ t*{t <- `t*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) - -- if (C.LABELS_context[l!`%`_labelidx.0] = `%`_resulttype(t*{t <- `t*`})) + -- if (C.LABELS_context[l!`%`_labelidx.0]!`%`_resulttype.0 = t*{t <- `t*`}) -- Instrtype_ok: `%|-%:OK`(C, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) ;; 3-typing.watsup:628.1-630.25 rule br_if{C : context, l : labelidx, `t*` : valtype*}: `%|-%:%`(C, BR_IF_instr(l), `%->_%%`_instrtype(`%`_resulttype(t*{t <- `t*`} ++ [I32_valtype]), [], `%`_resulttype(t*{t <- `t*`}))) - -- if (C.LABELS_context[l!`%`_labelidx.0] = `%`_resulttype(t*{t <- `t*`})) + -- if (C.LABELS_context[l!`%`_labelidx.0]!`%`_resulttype.0 = t*{t <- `t*`}) ;; 3-typing.watsup:632.1-636.42 rule br_table{C : context, `l*` : labelidx*, l' : labelidx, `t_1*` : valtype*, `t*` : valtype*, `t_2*` : valtype*}: @@ -3317,7 +3317,7 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) ;; 3-typing.watsup:638.1-641.31 rule br_on_null{C : context, l : labelidx, `t*` : valtype*, ht : heaptype}: `%|-%:%`(C, BR_ON_NULL_instr(l), `%->_%%`_instrtype(`%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(`NULL%?`_nul(?(())), ht)]), [], `%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(`NULL%?`_nul(?()), ht)]))) - -- if (C.LABELS_context[l!`%`_labelidx.0] = `%`_resulttype(t*{t <- `t*`})) + -- if (C.LABELS_context[l!`%`_labelidx.0]!`%`_resulttype.0 = t*{t <- `t*`}) -- Heaptype_ok: `%|-%:OK`(C, ht) ;; 3-typing.watsup:643.1-645.34 @@ -3966,7 +3966,7 @@ relation Type_ok: `%|-%:%`(context, type, deftype*) ;; 3-typing.watsup rule _{C : context, rectype : rectype, `dt*` : deftype*, x : idx}: `%|-%:%`(C, TYPE_type(rectype), dt*{dt <- `dt*`}) - -- if (x = `%`_idx(|C.TYPES_context|)) + -- if (x!`%`_idx.0 = |C.TYPES_context|) -- if (dt*{dt <- `dt*`} = $rolldt(x, rectype)) -- Rectype_ok: `%|-%:%`(C +++ {TYPES dt*{dt <- `dt*`}, RECS [], FUNCS [], GLOBALS [], TABLES [], MEMS [], TAGS [], ELEMS [], DATAS [], LOCALS [], LABELS [], RETURN ?(), REFS []}, rectype, OK_oktypeidx(x)) @@ -4456,12 +4456,12 @@ def $irelaxed_laneselect_(N : N, iN : iN(N), iN : iN(N), iN : iN(N)) : iN(N)* ;; 4-numerics.watsup def $ieqz_(N : N, iN : iN(N)) : u32 ;; 4-numerics.watsup - def $ieqz_{N : N, i_1 : iN(N)}(N, i_1) = `%`_u32($bool((i_1 = `%`_iN(0)))) + def $ieqz_{N : N, i_1 : iN(N)}(N, i_1) = `%`_u32($bool((i_1!`%`_iN.0 = 0))) ;; 4-numerics.watsup def $inez_(N : N, iN : iN(N)) : u32 ;; 4-numerics.watsup - def $inez_{N : N, i_1 : iN(N)}(N, i_1) = `%`_u32($bool((i_1 =/= `%`_iN(0)))) + def $inez_{N : N, i_1 : iN(N)}(N, i_1) = `%`_u32($bool((i_1!`%`_iN.0 =/= 0))) ;; 4-numerics.watsup def $ieq_(N : N, iN : iN(N), iN : iN(N)) : u32 @@ -4866,14 +4866,14 @@ def $ivtestop_(shape : shape, def $f_(N : N, iN : iN(N)) : u32, vec_ : vec_(V128 ;; 4-numerics.watsup def $ivtestop_{Jnn : Jnn, M : M, def $f_(N : N, iN : iN(N)) : u32, v_1 : vec_(V128_Vnn), `c*` : nat*, `c_1*` : lane_($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))))*}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), def $f_, v_1) = `%`_u32($prod(c*{c <- `c*`})) -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), v_1)) - -- if (c*{c <- `c*`} = $f_($lsizenn((Jnn : Jnn <: lanetype)), c_1)!`%`_u32.0*{c_1 <- `c_1*`}) + -- if (`%`_u32(c)*{c <- `c*`} = $f_($lsizenn((Jnn : Jnn <: lanetype)), c_1)*{c_1 <- `c_1*`}) ;; 4-numerics.watsup def $fvtestop_(shape : shape, def $f_(N : N, fN : fN(N)) : u32, vec_ : vec_(V128_Vnn)) : u32 ;; 4-numerics.watsup def $fvtestop_{Fnn : Fnn, M : M, def $f_(N : N, fN : fN(N)) : u32, v_1 : vec_(V128_Vnn), `c*` : nat*, `c_1*` : lane_($lanetype(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M))))*}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), def $f_, v_1) = `%`_u32($prod(c*{c <- `c*`})) -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), v_1)) - -- if (c*{c <- `c*`} = $f_($sizenn((Fnn : Fnn <: numtype)), c_1)!`%`_u32.0*{c_1 <- `c_1*`}) + -- if (`%`_u32(c)*{c <- `c*`} = $f_($sizenn((Fnn : Fnn <: numtype)), c_1)*{c_1 <- `c_1*`}) ;; 4-numerics.watsup def $ivrelop_(shape : shape, def $f_(N : N, iN : iN(N), iN : iN(N)) : u32, vec_ : vec_(V128_Vnn), vec_ : vec_(V128_Vnn)) : vec_(V128_Vnn) @@ -4897,7 +4897,7 @@ def $fvrelop_(shape : shape, def $f_(N : N, fN : fN(N), fN : fN(N)) : u32, vec_ def $fvrelop_{Fnn : Fnn, M : M, def $f_(N : N, fN : fN(N), fN : fN(N)) : u32, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn), Inn : Inn, `c*` : lane_($lanetype(`%X%`_shape((Inn : Inn <: lanetype), `%`_dim(M))))*, `c_1*` : lane_($lanetype(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M))))*, `c_2*` : lane_($lanetype(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M))))*}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), def $f_, v_1, v_2) = $invlanes_(`%X%`_shape((Inn : Inn <: lanetype), `%`_dim(M)), c*{c <- `c*`}) -- 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)) - -- if (c*{c <- `c*`} = `%`_lane_($extend__(1, $sizenn((Fnn : Fnn <: numtype)), S_sx, `%`_iN($f_($sizenn((Fnn : Fnn <: numtype)), c_1, c_2)!`%`_u32.0))!`%`_iN.0)*{c_1 <- `c_1*`, c_2 <- `c_2*`}) + -- if (`%`_iN(c!`%`_lane_.0)*{c <- `c*`} = $extend__(1, $sizenn((Fnn : Fnn <: numtype)), S_sx, `%`_iN($f_($sizenn((Fnn : Fnn <: numtype)), c_1, c_2)!`%`_u32.0))*{c_1 <- `c_1*`, c_2 <- `c_2*`}) -- if ($size((Inn : Inn <: numtype)) = $size((Fnn : Fnn <: numtype))) ;; 4-numerics.watsup @@ -5188,7 +5188,7 @@ def $ivmul_(N : N, iN(N)*, iN(N)*) : iN(N)* def $vextbinop__(ishape_1 : ishape, ishape_2 : ishape, vextbinop__ : vextbinop__(ishape_1, ishape_2), vec_ : vec_(V128_Vnn), vec_ : vec_(V128_Vnn)) : vec_(V128_Vnn) ;; 4-numerics.watsup def $vextbinop__{Jnn_1 : Jnn, M_1 : M, Jnn_2 : Jnn, M_2 : M, sx : sx, half : half__(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2))), v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn), i : laneidx}(`%`_ishape(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1))), `%`_ishape(`%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2))), EXTMUL_vextbinop__(sx, half), v_1, v_2) = $ivextbinop__(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2)), def $ivmul_, sx, sx, i, `%`_laneidx(M_2), v_1, v_2) - -- if (i = `%`_laneidx($half__(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2)), half, 0, M_2))) + -- if (i!`%`_laneidx.0 = $half__(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2)), half, 0, M_2)) ;; 4-numerics.watsup def $vextbinop__{Jnn_1 : Jnn, M_1 : M, Jnn_2 : Jnn, M_2 : M, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn)}(`%`_ishape(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1))), `%`_ishape(`%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2))), `DOTS`_vextbinop__, v_1, v_2) = $ivextbinop__(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2)), def $ivdot_, S_sx, S_sx, `%`_laneidx(0), `%`_laneidx(M_1), v_1, v_2) ;; 4-numerics.watsup @@ -5653,7 +5653,7 @@ def $growtable(tableinst : tableinst, nat : nat, ref : ref) : tableinst def $growtable{tableinst : tableinst, n : n, r : ref, tableinst' : tableinst, at : addrtype, i : u64, j : u64, rt : reftype, `r'*` : ref*, i' : u64}(tableinst, n, r) = tableinst' -- if (tableinst = {TYPE `%%%`_tabletype(at, `[%..%]`_limits(i, j), rt), REFS r'*{r' <- `r'*`}}) -- if (tableinst' = {TYPE `%%%`_tabletype(at, `[%..%]`_limits(i', j), rt), REFS r'*{r' <- `r'*`} ++ r^n{}}) - -- if ((i' = `%`_u64((|r'*{r' <- `r'*`}| + n))) /\ ((|r'*{r' <- `r'*`}| + n) <= j!`%`_u64.0)) + -- if ((i'!`%`_u64.0 = (|r'*{r' <- `r'*`}| + n)) /\ ((|r'*{r' <- `r'*`}| + n) <= j!`%`_u64.0)) ;; 6-runtime-aux.watsup def $growmem(meminst : meminst, nat : nat) : meminst @@ -5661,7 +5661,7 @@ def $growmem(meminst : meminst, nat : nat) : meminst def $growmem{meminst : meminst, n : n, meminst' : meminst, at : addrtype, i : u64, j : u64, `b*` : byte*, i' : u64}(meminst, n) = meminst' -- if (meminst = {TYPE `%%PAGE`_memtype(at, `[%..%]`_limits(i, j)), BYTES b*{b <- `b*`}}) -- if (meminst' = {TYPE `%%PAGE`_memtype(at, `[%..%]`_limits(i', j)), BYTES b*{b <- `b*`} ++ `%`_byte(0)^(n * (64 * $Ki)){}}) - -- if ((i' = `%`_u64(((((|b*{b <- `b*`}| : nat <:> rat) / ((64 * $Ki) : nat <:> rat)) + (n : nat <:> rat)) : rat <:> nat))) /\ ((((|b*{b <- `b*`}| : nat <:> rat) / ((64 * $Ki) : nat <:> rat)) + (n : nat <:> rat)) <= (j!`%`_u64.0 : nat <:> rat))) + -- if (((i'!`%`_u64.0 : nat <:> rat) = (((|b*{b <- `b*`}| : nat <:> rat) / ((64 * $Ki) : nat <:> rat)) + (n : nat <:> rat))) /\ ((((|b*{b <- `b*`}| : nat <:> rat) / ((64 * $Ki) : nat <:> rat)) + (n : nat <:> rat)) <= (j!`%`_u64.0 : nat <:> rat))) ;; 7-runtime-typing.watsup relation Num_type: `%|-%:%`(store, num, numtype) @@ -5793,22 +5793,22 @@ relation Step_pure: `%~>%`(instr*, instr*) ;; 8-reduction.watsup rule `select-true`{val_1 : val, val_2 : val, c : num_(I32_numtype), `t*?` : valtype*?}: `%~>%`([(val_1 : val <: instr) (val_2 : val <: instr) CONST_instr(I32_numtype, c) `SELECT()%?`_instr(t*{t <- `t*`}?{`t*` <- `t*?`})], [(val_1 : val <: instr)]) - -- if (c =/= `%`_num_(0)) + -- if (c!`%`_num_.0 =/= 0) ;; 8-reduction.watsup rule `select-false`{val_1 : val, val_2 : val, c : num_(I32_numtype), `t*?` : valtype*?}: `%~>%`([(val_1 : val <: instr) (val_2 : val <: instr) CONST_instr(I32_numtype, c) `SELECT()%?`_instr(t*{t <- `t*`}?{`t*` <- `t*?`})], [(val_2 : val <: instr)]) - -- if (c = `%`_num_(0)) + -- if (c!`%`_num_.0 = 0) ;; 8-reduction.watsup rule `if-true`{c : num_(I32_numtype), bt : blocktype, `instr_1*` : instr*, `instr_2*` : instr*}: `%~>%`([CONST_instr(I32_numtype, c) `IF%%ELSE%`_instr(bt, instr_1*{instr_1 <- `instr_1*`}, instr_2*{instr_2 <- `instr_2*`})], [BLOCK_instr(bt, instr_1*{instr_1 <- `instr_1*`})]) - -- if (c =/= `%`_num_(0)) + -- if (c!`%`_num_.0 =/= 0) ;; 8-reduction.watsup rule `if-false`{c : num_(I32_numtype), bt : blocktype, `instr_1*` : instr*, `instr_2*` : instr*}: `%~>%`([CONST_instr(I32_numtype, c) `IF%%ELSE%`_instr(bt, instr_1*{instr_1 <- `instr_1*`}, instr_2*{instr_2 <- `instr_2*`})], [BLOCK_instr(bt, instr_2*{instr_2 <- `instr_2*`})]) - -- if (c = `%`_num_(0)) + -- if (c!`%`_num_.0 = 0) ;; 8-reduction.watsup rule `label-vals`{n : n, `instr*` : instr*, `val*` : val*}: @@ -5817,7 +5817,7 @@ relation Step_pure: `%~>%`(instr*, instr*) ;; 8-reduction.watsup rule `br-label-zero`{n : n, `instr'*` : instr*, `val'*` : val*, `val*` : val*, l : labelidx, `instr*` : instr*}: `%~>%`([`LABEL_%{%}%`_instr(n, instr'*{instr' <- `instr'*`}, (val' : val <: instr)*{val' <- `val'*`} ++ (val : val <: instr)^n{val <- `val*`} ++ [BR_instr(l)] ++ instr*{instr <- `instr*`})], (val : val <: instr)^n{val <- `val*`} ++ instr'*{instr' <- `instr'*`}) - -- if (l = `%`_labelidx(0)) + -- if (l!`%`_labelidx.0 = 0) ;; 8-reduction.watsup rule `br-label-succ`{n : n, `instr'*` : instr*, `val*` : val*, l : labelidx, `instr*` : instr*}: @@ -5831,12 +5831,12 @@ relation Step_pure: `%~>%`(instr*, instr*) ;; 8-reduction.watsup rule `br_if-true`{c : num_(I32_numtype), l : labelidx}: `%~>%`([CONST_instr(I32_numtype, c) BR_IF_instr(l)], [BR_instr(l)]) - -- if (c =/= `%`_num_(0)) + -- if (c!`%`_num_.0 =/= 0) ;; 8-reduction.watsup rule `br_if-false`{c : num_(I32_numtype), l : labelidx}: `%~>%`([CONST_instr(I32_numtype, c) BR_IF_instr(l)], []) - -- if (c = `%`_num_(0)) + -- if (c!`%`_num_.0 = 0) ;; 8-reduction.watsup rule `br_table-lt`{i : num_(I32_numtype), `l*` : labelidx*, l' : labelidx}: @@ -6152,7 +6152,7 @@ def $blocktype_(state : state, blocktype : blocktype) : functype def $blocktype_{z : state, x : idx, ft : functype}(z, _IDX_blocktype(x)) = ft -- Expand: `%~~%`($type(z, x), FUNC_comptype(ft)) ;; 8-reduction.watsup - def $blocktype_{z : state, `t?` : valtype?}(z, _RESULT_blocktype(t?{t <- `t?`})) = `%->%`_functype(`%`_resulttype([]), `%`_resulttype(t?{t <- `t?`})) + def $blocktype_{z : state, `t?` : valtype?}(z, _RESULT_blocktype(t?{t <- `t?`})) = `%->%`_functype(`%`_resulttype([]), `%`_resulttype(lift(t?{t <- `t?`}))) ;; 8-reduction.watsup relation Step_read: `%~>%`(config, instr*) @@ -6616,7 +6616,7 @@ relation Step_read: `%~>%`(config, instr*) `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VLOAD_instr(V128_vectype, ?(SPLAT_vloadop_(`%`_sz(N))), x, ao)]), [VCONST_instr(V128_vectype, c)]) -- if ($ibytes_(N, j) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) : (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) -- if (N = $lsize((Jnn : Jnn <: lanetype))) - -- if (M = (((128 : nat <:> rat) / (N : nat <:> rat)) : rat <:> nat)) + -- if ((M : nat <:> rat) = ((128 : nat <:> rat) / (N : nat <:> rat))) -- if (c = $invlanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), `%`_lane_(j!`%`_iN.0)^M{})) ;; 8-reduction.watsup @@ -6640,7 +6640,7 @@ relation Step_read: `%~>%`(config, instr*) `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c_1) VLOAD_LANE_instr(V128_vectype, `%`_sz(N), x, ao, j)]), [VCONST_instr(V128_vectype, c)]) -- if ($ibytes_(N, k) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) : (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) -- if (N = $lsize((Jnn : Jnn <: lanetype))) - -- if (M = ((($vsize(V128_vectype) : nat <:> rat) / (N : nat <:> rat)) : rat <:> nat)) + -- if ((M : nat <:> rat) = (($vsize(V128_vectype) : nat <:> rat) / (N : nat <:> rat))) -- if (c = $invlanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), c_1)[[j!`%`_laneidx.0] = `%`_lane_(k!`%`_iN.0)])) ;; 8-reduction.watsup @@ -6847,7 +6847,7 @@ relation Step: `%~>%`(config, config) rule `vstore_lane-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c : vec_(V128_Vnn), N : N, x : idx, ao : memarg, j : laneidx, `b*` : byte*, Jnn : Jnn, M : M}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_LANE_instr(V128_vectype, `%`_sz(N), x, ao, j)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0), (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) -- if (N = $lsize((Jnn : Jnn <: lanetype))) - -- if (M = (((128 : nat <:> rat) / (N : nat <:> rat)) : rat <:> nat)) + -- if ((M : nat <:> rat) = ((128 : nat <:> rat) / (N : nat <:> rat))) -- if (b*{b <- `b*`} = $ibytes_(N, `%`_iN($lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), c)[j!`%`_laneidx.0]!`%`_lane_.0))) ;; 8-reduction.watsup:1019.1-1022.37 @@ -6899,7 +6899,7 @@ def $alloctypes(type*) : deftype* -- if (deftype'*{deftype' <- `deftype'*`} = $alloctypes(type'*{type' <- `type'*`})) -- if (type = TYPE_type(rectype)) -- if (deftype*{deftype <- `deftype*`} = $subst_all_deftypes($rolldt(x, rectype), (deftype' : deftype <: heaptype)*{deftype' <- `deftype'*`})) - -- if (x = `%`_idx(|deftype'*{deftype' <- `deftype'*`}|)) + -- if (x!`%`_idx.0 = |deftype'*{deftype' <- `deftype'*`}|) } ;; 9-module.watsup @@ -7122,7 +7122,7 @@ def $evalglobals(state : state, globaltype*, expr*) : (state, val*) ;; 9-module.watsup def $instantiate(store : store, module : module, externaddr*) : config ;; 9-module.watsup - def $instantiate{s : store, module : module, `externaddr*` : externaddr*, s' : store, f : frame, `instr_E*` : instr*, `instr_D*` : instr*, `instr_S?` : instr?, `xt_I*` : externtype*, `xt_E*` : externtype*, `type*` : type*, `import*` : import*, `func*` : func*, `global*` : global*, `table*` : table*, `mem*` : mem*, `tag*` : tag*, `elem*` : elem*, `data*` : data*, `start?` : start?, `export*` : export*, `globaltype*` : globaltype*, `expr_G*` : expr*, `tabletype*` : tabletype*, `expr_T*` : expr*, `reftype*` : reftype*, `expr_E**` : expr**, `elemmode*` : elemmode*, `byte**` : byte**, `datamode*` : datamode*, `x?` : idx?, moduleinst_0 : moduleinst, `i_F*` : nat*, z : state, z' : state, `val_G*` : val*, `ref_T*` : ref*, `ref_E**` : ref**, moduleinst : moduleinst, `i_E*` : nat*, `i_D*` : nat*}(s, module, externaddr*{externaddr <- `externaddr*`}) = `%;%`_config(`%;%`_state(s', f), instr_E*{instr_E <- `instr_E*`} ++ instr_D*{instr_D <- `instr_D*`} ++ instr_S?{instr_S <- `instr_S?`}) + def $instantiate{s : store, module : module, `externaddr*` : externaddr*, s' : store, f : frame, `instr_E*` : instr*, `instr_D*` : instr*, `instr_S?` : instr?, `xt_I*` : externtype*, `xt_E*` : externtype*, `type*` : type*, `import*` : import*, `func*` : func*, `global*` : global*, `table*` : table*, `mem*` : mem*, `tag*` : tag*, `elem*` : elem*, `data*` : data*, `start?` : start?, `export*` : export*, `globaltype*` : globaltype*, `expr_G*` : expr*, `tabletype*` : tabletype*, `expr_T*` : expr*, `reftype*` : reftype*, `expr_E**` : expr**, `elemmode*` : elemmode*, `byte**` : byte**, `datamode*` : datamode*, `x?` : idx?, moduleinst_0 : moduleinst, `i_F*` : nat*, z : state, z' : state, `val_G*` : val*, `ref_T*` : ref*, `ref_E**` : ref**, moduleinst : moduleinst, `i_E*` : nat*, `i_D*` : nat*}(s, module, externaddr*{externaddr <- `externaddr*`}) = `%;%`_config(`%;%`_state(s', f), instr_E*{instr_E <- `instr_E*`} ++ instr_D*{instr_D <- `instr_D*`} ++ lift(instr_S?{instr_S <- `instr_S?`})) -- Module_ok: `|-%:%`(module, `%->%`_moduletype(xt_I*{xt_I <- `xt_I*`}, xt_E*{xt_E <- `xt_E*`})) -- (Externaddr_type: `%|-%:%`(s, externaddr, xt_I))*{externaddr <- `externaddr*`, xt_I <- `xt_I*`} -- if (module = MODULE_module(type*{type <- `type*`}, import*{import <- `import*`}, func*{func <- `func*`}, global*{global <- `global*`}, table*{table <- `table*`}, mem*{mem <- `mem*`}, tag*{tag <- `tag*`}, elem*{elem <- `elem*`}, data*{data <- `data*`}, start?{start <- `start?`}, export*{export <- `export*`})) @@ -9152,19 +9152,19 @@ def $utf8(char*) : byte* ;; A-binary.watsup:54.1-56.15 def $utf8{ch : char, b : byte}([ch]) = [b] -- if (ch!`%`_char.0 < 128) - -- if (ch = `%`_char(b!`%`_byte.0)) + -- if (`%`_byte(ch!`%`_char.0) = b) ;; A-binary.watsup:57.1-59.46 def $utf8{ch : char, b_1 : byte, b_2 : byte}([ch]) = [b_1 b_2] -- if ((128 <= ch!`%`_char.0) /\ (ch!`%`_char.0 < 2048)) - -- if (ch = `%`_char((((2 ^ 6) * (((b_1!`%`_byte.0 : nat <:> int) - (192 : nat <:> int)) : int <:> nat)) + $cont(b_2)))) + -- if (ch!`%`_char.0 = (((2 ^ 6) * (((b_1!`%`_byte.0 : nat <:> int) - (192 : nat <:> int)) : int <:> nat)) + $cont(b_2))) ;; A-binary.watsup:60.1-62.64 def $utf8{ch : char, b_1 : byte, b_2 : byte, b_3 : byte}([ch]) = [b_1 b_2 b_3] -- if (((2048 <= ch!`%`_char.0) /\ (ch!`%`_char.0 < 55296)) \/ ((57344 <= ch!`%`_char.0) /\ (ch!`%`_char.0 < 65536))) - -- if (ch = `%`_char(((((2 ^ 12) * (((b_1!`%`_byte.0 : nat <:> int) - (224 : nat <:> int)) : int <:> nat)) + ((2 ^ 6) * $cont(b_2))) + $cont(b_3)))) + -- if (ch!`%`_char.0 = ((((2 ^ 12) * (((b_1!`%`_byte.0 : nat <:> int) - (224 : nat <:> int)) : int <:> nat)) + ((2 ^ 6) * $cont(b_2))) + $cont(b_3))) ;; A-binary.watsup:63.1-65.82 def $utf8{ch : char, b_1 : byte, b_2 : byte, b_3 : byte, b_4 : byte}([ch]) = [b_1 b_2 b_3 b_4] -- if ((65536 <= ch!`%`_char.0) /\ (ch!`%`_char.0 < 69632)) - -- if (ch = `%`_char((((((2 ^ 18) * (((b_1!`%`_byte.0 : nat <:> int) - (240 : nat <:> int)) : int <:> nat)) + ((2 ^ 12) * $cont(b_2))) + ((2 ^ 6) * $cont(b_3))) + $cont(b_4)))) + -- if (ch!`%`_char.0 = (((((2 ^ 18) * (((b_1!`%`_byte.0 : nat <:> int) - (240 : nat <:> int)) : int <:> nat)) + ((2 ^ 12) * $cont(b_2))) + ((2 ^ 6) * $cont(b_3))) + $cont(b_4))) } ;; 1-syntax.watsup @@ -10063,7 +10063,7 @@ syntax storeop_{Inn : Inn}((Inn : Inn <: numtype)) = ;; 1-syntax.watsup syntax vloadop_{vectype : vectype}(vectype) = | `SHAPE%X%%`{sz : sz, M : M, sx : sx}(sz : sz, M : M, sx : sx) - -- if ((sz!`%`_sz.0 * M) = ((($vsize(vectype) : nat <:> rat) / (2 : nat <:> rat)) : rat <:> nat)) + -- if (((sz!`%`_sz.0 * M) : nat <:> rat) = (($vsize(vectype) : nat <:> rat) / (2 : nat <:> rat))) | SPLAT{sz : sz}(sz : sz) | ZERO{sz : sz}(sz : sz) -- if (sz!`%`_sz.0 >= 32) @@ -10228,7 +10228,7 @@ syntax instr = | VBITMASK{ishape : ishape}(ishape : ishape) | VSWIZZLOP{bshape : bshape, vswizzlop_ : vswizzlop_(bshape)}(bshape : bshape, vswizzlop_ : vswizzlop_(bshape)) | VSHUFFLE{bshape : bshape, `laneidx*` : laneidx*}(bshape : bshape, laneidx*{laneidx <- `laneidx*`} : laneidx*) - -- if (|laneidx*{laneidx <- `laneidx*`}| = $dim(bshape!`%`_bshape.0)!`%`_dim.0) + -- if (`%`_dim(|laneidx*{laneidx <- `laneidx*`}|) = $dim(bshape!`%`_bshape.0)) | VEXTUNOP{ishape_1 : ishape, ishape_2 : ishape, vextunop__ : vextunop__(ishape_2, ishape_1)}(ishape_1 : ishape, ishape_2 : ishape, vextunop__ : vextunop__(ishape_2, ishape_1)) | VEXTBINOP{ishape_1 : ishape, ishape_2 : ishape, vextbinop__ : vextbinop__(ishape_2, ishape_1)}(ishape_1 : ishape, ishape_2 : ishape, vextbinop__ : vextbinop__(ishape_2, ishape_1)) | VEXTTERNOP{ishape_1 : ishape, ishape_2 : ishape, vextternop__ : vextternop__(ishape_2, ishape_1)}(ishape_1 : ishape, ishape_2 : ishape, vextternop__ : vextternop__(ishape_2, ishape_1)) @@ -12050,7 +12050,7 @@ relation Externtype_sub: `%|-%<:%`(context, externtype, externtype) relation Blocktype_ok: `%|-%:%`(context, blocktype, instrtype) ;; 3-typing.watsup rule valtype{C : context, `valtype?` : valtype?}: - `%|-%:%`(C, _RESULT_blocktype(valtype?{valtype <- `valtype?`}), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype(valtype?{valtype <- `valtype?`}))) + `%|-%:%`(C, _RESULT_blocktype(valtype?{valtype <- `valtype?`}), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype(lift(valtype?{valtype <- `valtype?`})))) -- (Valtype_ok: `%|-%:OK`(C, valtype))?{valtype <- `valtype?`} ;; 3-typing.watsup @@ -12155,13 +12155,13 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) ;; 3-typing.watsup:623.1-626.42 rule br{C : context, l : labelidx, `t_1*` : valtype*, `t*` : valtype*, `t_2*` : valtype*}: `%|-%:%`(C, BR_instr(l), `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`} ++ t*{t <- `t*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) - -- if (C.LABELS_context[l!`%`_labelidx.0] = `%`_resulttype(t*{t <- `t*`})) + -- if (C.LABELS_context[l!`%`_labelidx.0]!`%`_resulttype.0 = t*{t <- `t*`}) -- Instrtype_ok: `%|-%:OK`(C, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) ;; 3-typing.watsup:628.1-630.25 rule br_if{C : context, l : labelidx, `t*` : valtype*}: `%|-%:%`(C, BR_IF_instr(l), `%->_%%`_instrtype(`%`_resulttype(t*{t <- `t*`} ++ [I32_valtype]), [], `%`_resulttype(t*{t <- `t*`}))) - -- if (C.LABELS_context[l!`%`_labelidx.0] = `%`_resulttype(t*{t <- `t*`})) + -- if (C.LABELS_context[l!`%`_labelidx.0]!`%`_resulttype.0 = t*{t <- `t*`}) ;; 3-typing.watsup:632.1-636.42 rule br_table{C : context, `l*` : labelidx*, l' : labelidx, `t_1*` : valtype*, `t*` : valtype*, `t_2*` : valtype*}: @@ -12173,7 +12173,7 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) ;; 3-typing.watsup:638.1-641.31 rule br_on_null{C : context, l : labelidx, `t*` : valtype*, ht : heaptype}: `%|-%:%`(C, BR_ON_NULL_instr(l), `%->_%%`_instrtype(`%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(`NULL%?`_nul(?(())), ht)]), [], `%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(`NULL%?`_nul(?()), ht)]))) - -- if (C.LABELS_context[l!`%`_labelidx.0] = `%`_resulttype(t*{t <- `t*`})) + -- if (C.LABELS_context[l!`%`_labelidx.0]!`%`_resulttype.0 = t*{t <- `t*`}) -- Heaptype_ok: `%|-%:OK`(C, ht) ;; 3-typing.watsup:643.1-645.34 @@ -12822,7 +12822,7 @@ relation Type_ok: `%|-%:%`(context, type, deftype*) ;; 3-typing.watsup rule _{C : context, rectype : rectype, `dt*` : deftype*, x : idx}: `%|-%:%`(C, TYPE_type(rectype), dt*{dt <- `dt*`}) - -- if (x = `%`_idx(|C.TYPES_context|)) + -- if (x!`%`_idx.0 = |C.TYPES_context|) -- if (dt*{dt <- `dt*`} = $rolldt(x, rectype)) -- Rectype_ok: `%|-%:%`(C +++ {TYPES dt*{dt <- `dt*`}, RECS [], FUNCS [], GLOBALS [], TABLES [], MEMS [], TAGS [], ELEMS [], DATAS [], LOCALS [], LABELS [], RETURN ?(), REFS []}, rectype, OK_oktypeidx(x)) @@ -13312,12 +13312,12 @@ def $irelaxed_laneselect_(N : N, iN : iN(N), iN : iN(N), iN : iN(N)) : iN(N)* ;; 4-numerics.watsup def $ieqz_(N : N, iN : iN(N)) : u32 ;; 4-numerics.watsup - def $ieqz_{N : N, i_1 : iN(N)}(N, i_1) = `%`_u32($bool((i_1 = `%`_iN(0)))) + def $ieqz_{N : N, i_1 : iN(N)}(N, i_1) = `%`_u32($bool((i_1!`%`_iN.0 = 0))) ;; 4-numerics.watsup def $inez_(N : N, iN : iN(N)) : u32 ;; 4-numerics.watsup - def $inez_{N : N, i_1 : iN(N)}(N, i_1) = `%`_u32($bool((i_1 =/= `%`_iN(0)))) + def $inez_{N : N, i_1 : iN(N)}(N, i_1) = `%`_u32($bool((i_1!`%`_iN.0 =/= 0))) ;; 4-numerics.watsup def $ieq_(N : N, iN : iN(N), iN : iN(N)) : u32 @@ -13722,14 +13722,14 @@ def $ivtestop_(shape : shape, def $f_(N : N, iN : iN(N)) : u32, vec_ : vec_(V128 ;; 4-numerics.watsup def $ivtestop_{Jnn : Jnn, M : M, def $f_(N : N, iN : iN(N)) : u32, v_1 : vec_(V128_Vnn), `c*` : nat*, `c_1*` : lane_($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))))*}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), def $f_, v_1) = `%`_u32($prod(c*{c <- `c*`})) -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), v_1)) - -- if (c*{c <- `c*`} = $f_($lsizenn((Jnn : Jnn <: lanetype)), c_1)!`%`_u32.0*{c_1 <- `c_1*`}) + -- if (`%`_u32(c)*{c <- `c*`} = $f_($lsizenn((Jnn : Jnn <: lanetype)), c_1)*{c_1 <- `c_1*`}) ;; 4-numerics.watsup def $fvtestop_(shape : shape, def $f_(N : N, fN : fN(N)) : u32, vec_ : vec_(V128_Vnn)) : u32 ;; 4-numerics.watsup def $fvtestop_{Fnn : Fnn, M : M, def $f_(N : N, fN : fN(N)) : u32, v_1 : vec_(V128_Vnn), `c*` : nat*, `c_1*` : lane_($lanetype(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M))))*}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), def $f_, v_1) = `%`_u32($prod(c*{c <- `c*`})) -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), v_1)) - -- if (c*{c <- `c*`} = $f_($sizenn((Fnn : Fnn <: numtype)), c_1)!`%`_u32.0*{c_1 <- `c_1*`}) + -- if (`%`_u32(c)*{c <- `c*`} = $f_($sizenn((Fnn : Fnn <: numtype)), c_1)*{c_1 <- `c_1*`}) ;; 4-numerics.watsup def $ivrelop_(shape : shape, def $f_(N : N, iN : iN(N), iN : iN(N)) : u32, vec_ : vec_(V128_Vnn), vec_ : vec_(V128_Vnn)) : vec_(V128_Vnn) @@ -13753,7 +13753,7 @@ def $fvrelop_(shape : shape, def $f_(N : N, fN : fN(N), fN : fN(N)) : u32, vec_ def $fvrelop_{Fnn : Fnn, M : M, def $f_(N : N, fN : fN(N), fN : fN(N)) : u32, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn), Inn : Inn, `c*` : lane_($lanetype(`%X%`_shape((Inn : Inn <: lanetype), `%`_dim(M))))*, `c_1*` : lane_($lanetype(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M))))*, `c_2*` : lane_($lanetype(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M))))*}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), def $f_, v_1, v_2) = $invlanes_(`%X%`_shape((Inn : Inn <: lanetype), `%`_dim(M)), c*{c <- `c*`}) -- 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)) - -- if (c*{c <- `c*`} = `%`_lane_($extend__(1, $sizenn((Fnn : Fnn <: numtype)), S_sx, `%`_iN($f_($sizenn((Fnn : Fnn <: numtype)), c_1, c_2)!`%`_u32.0))!`%`_iN.0)*{c_1 <- `c_1*`, c_2 <- `c_2*`}) + -- if (`%`_iN(c!`%`_lane_.0)*{c <- `c*`} = $extend__(1, $sizenn((Fnn : Fnn <: numtype)), S_sx, `%`_iN($f_($sizenn((Fnn : Fnn <: numtype)), c_1, c_2)!`%`_u32.0))*{c_1 <- `c_1*`, c_2 <- `c_2*`}) -- if ($size((Inn : Inn <: numtype)) = $size((Fnn : Fnn <: numtype))) ;; 4-numerics.watsup @@ -14044,7 +14044,7 @@ def $ivmul_(N : N, iN(N)*, iN(N)*) : iN(N)* def $vextbinop__(ishape_1 : ishape, ishape_2 : ishape, vextbinop__ : vextbinop__(ishape_1, ishape_2), vec_ : vec_(V128_Vnn), vec_ : vec_(V128_Vnn)) : vec_(V128_Vnn) ;; 4-numerics.watsup def $vextbinop__{Jnn_1 : Jnn, M_1 : M, Jnn_2 : Jnn, M_2 : M, sx : sx, half : half__(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2))), v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn), i : laneidx}(`%`_ishape(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1))), `%`_ishape(`%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2))), EXTMUL_vextbinop__(sx, half), v_1, v_2) = $ivextbinop__(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2)), def $ivmul_, sx, sx, i, `%`_laneidx(M_2), v_1, v_2) - -- if (i = `%`_laneidx($half__(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2)), half, 0, M_2))) + -- if (i!`%`_laneidx.0 = $half__(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2)), half, 0, M_2)) ;; 4-numerics.watsup def $vextbinop__{Jnn_1 : Jnn, M_1 : M, Jnn_2 : Jnn, M_2 : M, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn)}(`%`_ishape(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1))), `%`_ishape(`%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2))), `DOTS`_vextbinop__, v_1, v_2) = $ivextbinop__(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2)), def $ivdot_, S_sx, S_sx, `%`_laneidx(0), `%`_laneidx(M_1), v_1, v_2) ;; 4-numerics.watsup @@ -14509,7 +14509,7 @@ def $growtable(tableinst : tableinst, nat : nat, ref : ref) : tableinst? def $growtable{tableinst : tableinst, n : n, r : ref, tableinst' : tableinst, at : addrtype, i : u64, j : u64, rt : reftype, `r'*` : ref*, i' : u64}(tableinst, n, r) = ?(tableinst') -- if (tableinst = {TYPE `%%%`_tabletype(at, `[%..%]`_limits(i, j), rt), REFS r'*{r' <- `r'*`}}) -- if (tableinst' = {TYPE `%%%`_tabletype(at, `[%..%]`_limits(i', j), rt), REFS r'*{r' <- `r'*`} ++ r^n{}}) - -- if ((i' = `%`_u64((|r'*{r' <- `r'*`}| + n))) /\ ((|r'*{r' <- `r'*`}| + n) <= j!`%`_u64.0)) + -- if ((i'!`%`_u64.0 = (|r'*{r' <- `r'*`}| + n)) /\ ((|r'*{r' <- `r'*`}| + n) <= j!`%`_u64.0)) def $growtable{x0 : tableinst, x1 : nat, x2 : ref}(x0, x1, x2) = ?() ;; 6-runtime-aux.watsup @@ -14518,7 +14518,7 @@ def $growmem(meminst : meminst, nat : nat) : meminst? def $growmem{meminst : meminst, n : n, meminst' : meminst, at : addrtype, i : u64, j : u64, `b*` : byte*, i' : u64}(meminst, n) = ?(meminst') -- if (meminst = {TYPE `%%PAGE`_memtype(at, `[%..%]`_limits(i, j)), BYTES b*{b <- `b*`}}) -- if (meminst' = {TYPE `%%PAGE`_memtype(at, `[%..%]`_limits(i', j)), BYTES b*{b <- `b*`} ++ `%`_byte(0)^(n * (64 * $Ki)){}}) - -- if ((i' = `%`_u64(((((|b*{b <- `b*`}| : nat <:> rat) / ((64 * $Ki) : nat <:> rat)) + (n : nat <:> rat)) : rat <:> nat))) /\ ((((|b*{b <- `b*`}| : nat <:> rat) / ((64 * $Ki) : nat <:> rat)) + (n : nat <:> rat)) <= (j!`%`_u64.0 : nat <:> rat))) + -- if (((i'!`%`_u64.0 : nat <:> rat) = (((|b*{b <- `b*`}| : nat <:> rat) / ((64 * $Ki) : nat <:> rat)) + (n : nat <:> rat))) /\ ((((|b*{b <- `b*`}| : nat <:> rat) / ((64 * $Ki) : nat <:> rat)) + (n : nat <:> rat)) <= (j!`%`_u64.0 : nat <:> rat))) def $growmem{x0 : meminst, x1 : nat}(x0, x1) = ?() ;; 7-runtime-typing.watsup @@ -14651,22 +14651,22 @@ relation Step_pure: `%~>%`(instr*, instr*) ;; 8-reduction.watsup rule `select-true`{val_1 : val, val_2 : val, c : num_(I32_numtype), `t*?` : valtype*?}: `%~>%`([(val_1 : val <: instr) (val_2 : val <: instr) CONST_instr(I32_numtype, c) `SELECT()%?`_instr(t*{t <- `t*`}?{`t*` <- `t*?`})], [(val_1 : val <: instr)]) - -- if (c =/= `%`_num_(0)) + -- if (c!`%`_num_.0 =/= 0) ;; 8-reduction.watsup rule `select-false`{val_1 : val, val_2 : val, c : num_(I32_numtype), `t*?` : valtype*?}: `%~>%`([(val_1 : val <: instr) (val_2 : val <: instr) CONST_instr(I32_numtype, c) `SELECT()%?`_instr(t*{t <- `t*`}?{`t*` <- `t*?`})], [(val_2 : val <: instr)]) - -- if (c = `%`_num_(0)) + -- if (c!`%`_num_.0 = 0) ;; 8-reduction.watsup rule `if-true`{c : num_(I32_numtype), bt : blocktype, `instr_1*` : instr*, `instr_2*` : instr*}: `%~>%`([CONST_instr(I32_numtype, c) `IF%%ELSE%`_instr(bt, instr_1*{instr_1 <- `instr_1*`}, instr_2*{instr_2 <- `instr_2*`})], [BLOCK_instr(bt, instr_1*{instr_1 <- `instr_1*`})]) - -- if (c =/= `%`_num_(0)) + -- if (c!`%`_num_.0 =/= 0) ;; 8-reduction.watsup rule `if-false`{c : num_(I32_numtype), bt : blocktype, `instr_1*` : instr*, `instr_2*` : instr*}: `%~>%`([CONST_instr(I32_numtype, c) `IF%%ELSE%`_instr(bt, instr_1*{instr_1 <- `instr_1*`}, instr_2*{instr_2 <- `instr_2*`})], [BLOCK_instr(bt, instr_2*{instr_2 <- `instr_2*`})]) - -- if (c = `%`_num_(0)) + -- if (c!`%`_num_.0 = 0) ;; 8-reduction.watsup rule `label-vals`{n : n, `instr*` : instr*, `val*` : val*}: @@ -14675,7 +14675,7 @@ relation Step_pure: `%~>%`(instr*, instr*) ;; 8-reduction.watsup rule `br-label-zero`{n : n, `instr'*` : instr*, `val'*` : val*, `val*` : val*, l : labelidx, `instr*` : instr*}: `%~>%`([`LABEL_%{%}%`_instr(n, instr'*{instr' <- `instr'*`}, (val' : val <: instr)*{val' <- `val'*`} ++ (val : val <: instr)^n{val <- `val*`} ++ [BR_instr(l)] ++ instr*{instr <- `instr*`})], (val : val <: instr)^n{val <- `val*`} ++ instr'*{instr' <- `instr'*`}) - -- if (l = `%`_labelidx(0)) + -- if (l!`%`_labelidx.0 = 0) ;; 8-reduction.watsup rule `br-label-succ`{n : n, `instr'*` : instr*, `val*` : val*, l : labelidx, `instr*` : instr*}: @@ -14689,12 +14689,12 @@ relation Step_pure: `%~>%`(instr*, instr*) ;; 8-reduction.watsup rule `br_if-true`{c : num_(I32_numtype), l : labelidx}: `%~>%`([CONST_instr(I32_numtype, c) BR_IF_instr(l)], [BR_instr(l)]) - -- if (c =/= `%`_num_(0)) + -- if (c!`%`_num_.0 =/= 0) ;; 8-reduction.watsup rule `br_if-false`{c : num_(I32_numtype), l : labelidx}: `%~>%`([CONST_instr(I32_numtype, c) BR_IF_instr(l)], []) - -- if (c = `%`_num_(0)) + -- if (c!`%`_num_.0 = 0) ;; 8-reduction.watsup rule `br_table-lt`{i : num_(I32_numtype), `l*` : labelidx*, l' : labelidx}: @@ -15010,7 +15010,7 @@ def $blocktype_(state : state, blocktype : blocktype) : functype def $blocktype_{z : state, x : idx, ft : functype}(z, _IDX_blocktype(x)) = ft -- Expand: `%~~%`($type(z, x), FUNC_comptype(ft)) ;; 8-reduction.watsup - def $blocktype_{z : state, `t?` : valtype?}(z, _RESULT_blocktype(t?{t <- `t?`})) = `%->%`_functype(`%`_resulttype([]), `%`_resulttype(t?{t <- `t?`})) + def $blocktype_{z : state, `t?` : valtype?}(z, _RESULT_blocktype(t?{t <- `t?`})) = `%->%`_functype(`%`_resulttype([]), `%`_resulttype(lift(t?{t <- `t?`}))) ;; 8-reduction.watsup relation Step_read: `%~>%`(config, instr*) @@ -15474,7 +15474,7 @@ relation Step_read: `%~>%`(config, instr*) `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VLOAD_instr(V128_vectype, ?(SPLAT_vloadop_(`%`_sz(N))), x, ao)]), [VCONST_instr(V128_vectype, c)]) -- if ($ibytes_(N, j) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) : (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) -- if (N = $lsize((Jnn : Jnn <: lanetype))) - -- if (M = (((128 : nat <:> rat) / (N : nat <:> rat)) : rat <:> nat)) + -- if ((M : nat <:> rat) = ((128 : nat <:> rat) / (N : nat <:> rat))) -- if (c = $invlanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), `%`_lane_(j!`%`_iN.0)^M{})) ;; 8-reduction.watsup @@ -15498,7 +15498,7 @@ relation Step_read: `%~>%`(config, instr*) `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c_1) VLOAD_LANE_instr(V128_vectype, `%`_sz(N), x, ao, j)]), [VCONST_instr(V128_vectype, c)]) -- if ($ibytes_(N, k) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) : (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) -- if (N = $lsize((Jnn : Jnn <: lanetype))) - -- if (M = ((($vsize(V128_vectype) : nat <:> rat) / (N : nat <:> rat)) : rat <:> nat)) + -- if ((M : nat <:> rat) = (($vsize(V128_vectype) : nat <:> rat) / (N : nat <:> rat))) -- if (c = $invlanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), c_1)[[j!`%`_laneidx.0] = `%`_lane_(k!`%`_iN.0)])) ;; 8-reduction.watsup @@ -15705,7 +15705,7 @@ relation Step: `%~>%`(config, config) rule `vstore_lane-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c : vec_(V128_Vnn), N : N, x : idx, ao : memarg, j : laneidx, `b*` : byte*, Jnn : Jnn, M : M}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_LANE_instr(V128_vectype, `%`_sz(N), x, ao, j)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0), (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) -- if (N = $lsize((Jnn : Jnn <: lanetype))) - -- if (M = (((128 : nat <:> rat) / (N : nat <:> rat)) : rat <:> nat)) + -- if ((M : nat <:> rat) = ((128 : nat <:> rat) / (N : nat <:> rat))) -- if (b*{b <- `b*`} = $ibytes_(N, `%`_iN($lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), c)[j!`%`_laneidx.0]!`%`_lane_.0))) ;; 8-reduction.watsup:1019.1-1022.37 @@ -15757,7 +15757,7 @@ def $alloctypes(type*) : deftype* -- if (deftype'*{deftype' <- `deftype'*`} = $alloctypes(type'*{type' <- `type'*`})) -- if (type = TYPE_type(rectype)) -- if (deftype*{deftype <- `deftype*`} = $subst_all_deftypes($rolldt(x, rectype), (deftype' : deftype <: heaptype)*{deftype' <- `deftype'*`})) - -- if (x = `%`_idx(|deftype'*{deftype' <- `deftype'*`}|)) + -- if (x!`%`_idx.0 = |deftype'*{deftype' <- `deftype'*`}|) } ;; 9-module.watsup @@ -15980,7 +15980,7 @@ def $evalglobals(state : state, globaltype*, expr*) : (state, val*) ;; 9-module.watsup def $instantiate(store : store, module : module, externaddr*) : config ;; 9-module.watsup - def $instantiate{s : store, module : module, `externaddr*` : externaddr*, s' : store, f : frame, `instr_E*` : instr*, `instr_D*` : instr*, `instr_S?` : instr?, `xt_I*` : externtype*, `xt_E*` : externtype*, `type*` : type*, `import*` : import*, `func*` : func*, `global*` : global*, `table*` : table*, `mem*` : mem*, `tag*` : tag*, `elem*` : elem*, `data*` : data*, `start?` : start?, `export*` : export*, `globaltype*` : globaltype*, `expr_G*` : expr*, `tabletype*` : tabletype*, `expr_T*` : expr*, `reftype*` : reftype*, `expr_E**` : expr**, `elemmode*` : elemmode*, `byte**` : byte**, `datamode*` : datamode*, `x?` : idx?, moduleinst_0 : moduleinst, `i_F*` : nat*, z : state, z' : state, `val_G*` : val*, `ref_T*` : ref*, `ref_E**` : ref**, moduleinst : moduleinst, `i_E*` : nat*, `i_D*` : nat*}(s, module, externaddr*{externaddr <- `externaddr*`}) = `%;%`_config(`%;%`_state(s', f), instr_E*{instr_E <- `instr_E*`} ++ instr_D*{instr_D <- `instr_D*`} ++ instr_S?{instr_S <- `instr_S?`}) + def $instantiate{s : store, module : module, `externaddr*` : externaddr*, s' : store, f : frame, `instr_E*` : instr*, `instr_D*` : instr*, `instr_S?` : instr?, `xt_I*` : externtype*, `xt_E*` : externtype*, `type*` : type*, `import*` : import*, `func*` : func*, `global*` : global*, `table*` : table*, `mem*` : mem*, `tag*` : tag*, `elem*` : elem*, `data*` : data*, `start?` : start?, `export*` : export*, `globaltype*` : globaltype*, `expr_G*` : expr*, `tabletype*` : tabletype*, `expr_T*` : expr*, `reftype*` : reftype*, `expr_E**` : expr**, `elemmode*` : elemmode*, `byte**` : byte**, `datamode*` : datamode*, `x?` : idx?, moduleinst_0 : moduleinst, `i_F*` : nat*, z : state, z' : state, `val_G*` : val*, `ref_T*` : ref*, `ref_E**` : ref**, moduleinst : moduleinst, `i_E*` : nat*, `i_D*` : nat*}(s, module, externaddr*{externaddr <- `externaddr*`}) = `%;%`_config(`%;%`_state(s', f), instr_E*{instr_E <- `instr_E*`} ++ instr_D*{instr_D <- `instr_D*`} ++ lift(instr_S?{instr_S <- `instr_S?`})) -- Module_ok: `|-%:%`(module, `%->%`_moduletype(xt_I*{xt_I <- `xt_I*`}, xt_E*{xt_E <- `xt_E*`})) -- (Externaddr_type: `%|-%:%`(s, externaddr, xt_I))*{externaddr <- `externaddr*`, xt_I <- `xt_I*`} -- if (module = MODULE_module(type*{type <- `type*`}, import*{import <- `import*`}, func*{func <- `func*`}, global*{global <- `global*`}, table*{table <- `table*`}, mem*{mem <- `mem*`}, tag*{tag <- `tag*`}, elem*{elem <- `elem*`}, data*{data <- `data*`}, start?{start <- `start?`}, export*{export <- `export*`})) @@ -18010,19 +18010,19 @@ def $utf8(char*) : byte* ;; A-binary.watsup:54.1-56.15 def $utf8{ch : char, b : byte}([ch]) = [b] -- if (ch!`%`_char.0 < 128) - -- if (ch = `%`_char(b!`%`_byte.0)) + -- if (`%`_byte(ch!`%`_char.0) = b) ;; A-binary.watsup:57.1-59.46 def $utf8{ch : char, b_1 : byte, b_2 : byte}([ch]) = [b_1 b_2] -- if ((128 <= ch!`%`_char.0) /\ (ch!`%`_char.0 < 2048)) - -- if (ch = `%`_char((((2 ^ 6) * (((b_1!`%`_byte.0 : nat <:> int) - (192 : nat <:> int)) : int <:> nat)) + $cont(b_2)))) + -- if (ch!`%`_char.0 = (((2 ^ 6) * (((b_1!`%`_byte.0 : nat <:> int) - (192 : nat <:> int)) : int <:> nat)) + $cont(b_2))) ;; A-binary.watsup:60.1-62.64 def $utf8{ch : char, b_1 : byte, b_2 : byte, b_3 : byte}([ch]) = [b_1 b_2 b_3] -- if (((2048 <= ch!`%`_char.0) /\ (ch!`%`_char.0 < 55296)) \/ ((57344 <= ch!`%`_char.0) /\ (ch!`%`_char.0 < 65536))) - -- if (ch = `%`_char(((((2 ^ 12) * (((b_1!`%`_byte.0 : nat <:> int) - (224 : nat <:> int)) : int <:> nat)) + ((2 ^ 6) * $cont(b_2))) + $cont(b_3)))) + -- if (ch!`%`_char.0 = ((((2 ^ 12) * (((b_1!`%`_byte.0 : nat <:> int) - (224 : nat <:> int)) : int <:> nat)) + ((2 ^ 6) * $cont(b_2))) + $cont(b_3))) ;; A-binary.watsup:63.1-65.82 def $utf8{ch : char, b_1 : byte, b_2 : byte, b_3 : byte, b_4 : byte}([ch]) = [b_1 b_2 b_3 b_4] -- if ((65536 <= ch!`%`_char.0) /\ (ch!`%`_char.0 < 69632)) - -- if (ch = `%`_char((((((2 ^ 18) * (((b_1!`%`_byte.0 : nat <:> int) - (240 : nat <:> int)) : int <:> nat)) + ((2 ^ 12) * $cont(b_2))) + ((2 ^ 6) * $cont(b_3))) + $cont(b_4)))) + -- if (ch!`%`_char.0 = (((((2 ^ 18) * (((b_1!`%`_byte.0 : nat <:> int) - (240 : nat <:> int)) : int <:> nat)) + ((2 ^ 12) * $cont(b_2))) + ((2 ^ 6) * $cont(b_3))) + $cont(b_4))) } ;; 1-syntax.watsup @@ -18921,7 +18921,7 @@ syntax storeop_{Inn : Inn}((Inn : Inn <: numtype)) = ;; 1-syntax.watsup syntax vloadop_{vectype : vectype}(vectype) = | `SHAPE%X%%`{sz : sz, M : M, sx : sx}(sz : sz, M : M, sx : sx) - -- if ((sz!`%`_sz.0 * M) = ((($vsize(vectype) : nat <:> rat) / (2 : nat <:> rat)) : rat <:> nat)) + -- if (((sz!`%`_sz.0 * M) : nat <:> rat) = (($vsize(vectype) : nat <:> rat) / (2 : nat <:> rat))) | SPLAT{sz : sz}(sz : sz) | ZERO{sz : sz}(sz : sz) -- if (sz!`%`_sz.0 >= 32) @@ -19086,7 +19086,7 @@ syntax instr = | VBITMASK{ishape : ishape}(ishape : ishape) | VSWIZZLOP{bshape : bshape, vswizzlop_ : vswizzlop_(bshape)}(bshape : bshape, vswizzlop_ : vswizzlop_(bshape)) | VSHUFFLE{bshape : bshape, `laneidx*` : laneidx*}(bshape : bshape, laneidx*{laneidx <- `laneidx*`} : laneidx*) - -- if (|laneidx*{laneidx <- `laneidx*`}| = $dim(bshape!`%`_bshape.0)!`%`_dim.0) + -- if (`%`_dim(|laneidx*{laneidx <- `laneidx*`}|) = $dim(bshape!`%`_bshape.0)) | VEXTUNOP{ishape_1 : ishape, ishape_2 : ishape, vextunop__ : vextunop__(ishape_2, ishape_1)}(ishape_1 : ishape, ishape_2 : ishape, vextunop__ : vextunop__(ishape_2, ishape_1)) | VEXTBINOP{ishape_1 : ishape, ishape_2 : ishape, vextbinop__ : vextbinop__(ishape_2, ishape_1)}(ishape_1 : ishape, ishape_2 : ishape, vextbinop__ : vextbinop__(ishape_2, ishape_1)) | VEXTTERNOP{ishape_1 : ishape, ishape_2 : ishape, vextternop__ : vextternop__(ishape_2, ishape_1)}(ishape_1 : ishape, ishape_2 : ishape, vextternop__ : vextternop__(ishape_2, ishape_1)) @@ -20908,7 +20908,7 @@ relation Externtype_sub: `%|-%<:%`(context, externtype, externtype) relation Blocktype_ok: `%|-%:%`(context, blocktype, instrtype) ;; 3-typing.watsup rule valtype{C : context, `valtype?` : valtype?}: - `%|-%:%`(C, _RESULT_blocktype(valtype?{valtype <- `valtype?`}), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype(valtype?{valtype <- `valtype?`}))) + `%|-%:%`(C, _RESULT_blocktype(valtype?{valtype <- `valtype?`}), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype(lift(valtype?{valtype <- `valtype?`})))) -- (Valtype_ok: `%|-%:OK`(C, valtype))?{valtype <- `valtype?`} ;; 3-typing.watsup @@ -21013,13 +21013,13 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) ;; 3-typing.watsup:623.1-626.42 rule br{C : context, l : labelidx, `t_1*` : valtype*, `t*` : valtype*, `t_2*` : valtype*}: `%|-%:%`(C, BR_instr(l), `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`} ++ t*{t <- `t*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) - -- if (C.LABELS_context[l!`%`_labelidx.0] = `%`_resulttype(t*{t <- `t*`})) + -- if (C.LABELS_context[l!`%`_labelidx.0]!`%`_resulttype.0 = t*{t <- `t*`}) -- Instrtype_ok: `%|-%:OK`(C, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) ;; 3-typing.watsup:628.1-630.25 rule br_if{C : context, l : labelidx, `t*` : valtype*}: `%|-%:%`(C, BR_IF_instr(l), `%->_%%`_instrtype(`%`_resulttype(t*{t <- `t*`} ++ [I32_valtype]), [], `%`_resulttype(t*{t <- `t*`}))) - -- if (C.LABELS_context[l!`%`_labelidx.0] = `%`_resulttype(t*{t <- `t*`})) + -- if (C.LABELS_context[l!`%`_labelidx.0]!`%`_resulttype.0 = t*{t <- `t*`}) ;; 3-typing.watsup:632.1-636.42 rule br_table{C : context, `l*` : labelidx*, l' : labelidx, `t_1*` : valtype*, `t*` : valtype*, `t_2*` : valtype*}: @@ -21031,7 +21031,7 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) ;; 3-typing.watsup:638.1-641.31 rule br_on_null{C : context, l : labelidx, `t*` : valtype*, ht : heaptype}: `%|-%:%`(C, BR_ON_NULL_instr(l), `%->_%%`_instrtype(`%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(`NULL%?`_nul(?(())), ht)]), [], `%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(`NULL%?`_nul(?()), ht)]))) - -- if (C.LABELS_context[l!`%`_labelidx.0] = `%`_resulttype(t*{t <- `t*`})) + -- if (C.LABELS_context[l!`%`_labelidx.0]!`%`_resulttype.0 = t*{t <- `t*`}) -- Heaptype_ok: `%|-%:OK`(C, ht) ;; 3-typing.watsup:643.1-645.34 @@ -21680,7 +21680,7 @@ relation Type_ok: `%|-%:%`(context, type, deftype*) ;; 3-typing.watsup rule _{C : context, rectype : rectype, `dt*` : deftype*, x : idx}: `%|-%:%`(C, TYPE_type(rectype), dt*{dt <- `dt*`}) - -- if (x = `%`_idx(|C.TYPES_context|)) + -- if (x!`%`_idx.0 = |C.TYPES_context|) -- if (dt*{dt <- `dt*`} = $rolldt(x, rectype)) -- Rectype_ok: `%|-%:%`(C +++ {TYPES dt*{dt <- `dt*`}, RECS [], FUNCS [], GLOBALS [], TABLES [], MEMS [], TAGS [], ELEMS [], DATAS [], LOCALS [], LABELS [], RETURN ?(), REFS []}, rectype, OK_oktypeidx(x)) @@ -22170,12 +22170,12 @@ def $irelaxed_laneselect_(N : N, iN : iN(N), iN : iN(N), iN : iN(N)) : iN(N)* ;; 4-numerics.watsup def $ieqz_(N : N, iN : iN(N)) : u32 ;; 4-numerics.watsup - def $ieqz_{N : N, i_1 : iN(N)}(N, i_1) = `%`_u32($bool((i_1 = `%`_iN(0)))) + def $ieqz_{N : N, i_1 : iN(N)}(N, i_1) = `%`_u32($bool((i_1!`%`_iN.0 = 0))) ;; 4-numerics.watsup def $inez_(N : N, iN : iN(N)) : u32 ;; 4-numerics.watsup - def $inez_{N : N, i_1 : iN(N)}(N, i_1) = `%`_u32($bool((i_1 =/= `%`_iN(0)))) + def $inez_{N : N, i_1 : iN(N)}(N, i_1) = `%`_u32($bool((i_1!`%`_iN.0 =/= 0))) ;; 4-numerics.watsup def $ieq_(N : N, iN : iN(N), iN : iN(N)) : u32 @@ -22580,14 +22580,14 @@ def $ivtestop_(shape : shape, def $f_(N : N, iN : iN(N)) : u32, vec_ : vec_(V128 ;; 4-numerics.watsup def $ivtestop_{Jnn : Jnn, M : M, def $f_(N : N, iN : iN(N)) : u32, v_1 : vec_(V128_Vnn), `c*` : nat*, `c_1*` : lane_($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))))*}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), def $f_, v_1) = `%`_u32($prod(c*{c <- `c*`})) -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), v_1)) - -- if (c*{c <- `c*`} = $f_($lsizenn((Jnn : Jnn <: lanetype)), c_1)!`%`_u32.0*{c_1 <- `c_1*`}) + -- if (`%`_u32(c)*{c <- `c*`} = $f_($lsizenn((Jnn : Jnn <: lanetype)), c_1)*{c_1 <- `c_1*`}) ;; 4-numerics.watsup def $fvtestop_(shape : shape, def $f_(N : N, fN : fN(N)) : u32, vec_ : vec_(V128_Vnn)) : u32 ;; 4-numerics.watsup def $fvtestop_{Fnn : Fnn, M : M, def $f_(N : N, fN : fN(N)) : u32, v_1 : vec_(V128_Vnn), `c*` : nat*, `c_1*` : lane_($lanetype(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M))))*}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), def $f_, v_1) = `%`_u32($prod(c*{c <- `c*`})) -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), v_1)) - -- if (c*{c <- `c*`} = $f_($sizenn((Fnn : Fnn <: numtype)), c_1)!`%`_u32.0*{c_1 <- `c_1*`}) + -- if (`%`_u32(c)*{c <- `c*`} = $f_($sizenn((Fnn : Fnn <: numtype)), c_1)*{c_1 <- `c_1*`}) ;; 4-numerics.watsup def $ivrelop_(shape : shape, def $f_(N : N, iN : iN(N), iN : iN(N)) : u32, vec_ : vec_(V128_Vnn), vec_ : vec_(V128_Vnn)) : vec_(V128_Vnn) @@ -22611,7 +22611,7 @@ def $fvrelop_(shape : shape, def $f_(N : N, fN : fN(N), fN : fN(N)) : u32, vec_ def $fvrelop_{Fnn : Fnn, M : M, def $f_(N : N, fN : fN(N), fN : fN(N)) : u32, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn), Inn : Inn, `c*` : lane_($lanetype(`%X%`_shape((Inn : Inn <: lanetype), `%`_dim(M))))*, `c_1*` : lane_($lanetype(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M))))*, `c_2*` : lane_($lanetype(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M))))*}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), def $f_, v_1, v_2) = $invlanes_(`%X%`_shape((Inn : Inn <: lanetype), `%`_dim(M)), c*{c <- `c*`}) -- 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)) - -- if (c*{c <- `c*`} = `%`_lane_($extend__(1, $sizenn((Fnn : Fnn <: numtype)), S_sx, `%`_iN($f_($sizenn((Fnn : Fnn <: numtype)), c_1, c_2)!`%`_u32.0))!`%`_iN.0)*{c_1 <- `c_1*`, c_2 <- `c_2*`}) + -- if (`%`_iN(c!`%`_lane_.0)*{c <- `c*`} = $extend__(1, $sizenn((Fnn : Fnn <: numtype)), S_sx, `%`_iN($f_($sizenn((Fnn : Fnn <: numtype)), c_1, c_2)!`%`_u32.0))*{c_1 <- `c_1*`, c_2 <- `c_2*`}) -- if ($size((Inn : Inn <: numtype)) = $size((Fnn : Fnn <: numtype))) ;; 4-numerics.watsup @@ -22902,7 +22902,7 @@ def $ivmul_(N : N, iN(N)*, iN(N)*) : iN(N)* def $vextbinop__(ishape_1 : ishape, ishape_2 : ishape, vextbinop__ : vextbinop__(ishape_1, ishape_2), vec_ : vec_(V128_Vnn), vec_ : vec_(V128_Vnn)) : vec_(V128_Vnn) ;; 4-numerics.watsup def $vextbinop__{Jnn_1 : Jnn, M_1 : M, Jnn_2 : Jnn, M_2 : M, sx : sx, half : half__(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2))), v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn), i : laneidx}(`%`_ishape(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1))), `%`_ishape(`%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2))), EXTMUL_vextbinop__(sx, half), v_1, v_2) = $ivextbinop__(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2)), def $ivmul_, sx, sx, i, `%`_laneidx(M_2), v_1, v_2) - -- if (i = `%`_laneidx($half__(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2)), half, 0, M_2))) + -- if (i!`%`_laneidx.0 = $half__(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2)), half, 0, M_2)) ;; 4-numerics.watsup def $vextbinop__{Jnn_1 : Jnn, M_1 : M, Jnn_2 : Jnn, M_2 : M, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn)}(`%`_ishape(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1))), `%`_ishape(`%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2))), `DOTS`_vextbinop__, v_1, v_2) = $ivextbinop__(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2)), def $ivdot_, S_sx, S_sx, `%`_laneidx(0), `%`_laneidx(M_1), v_1, v_2) ;; 4-numerics.watsup @@ -23367,7 +23367,7 @@ def $growtable(tableinst : tableinst, nat : nat, ref : ref) : tableinst? def $growtable{tableinst : tableinst, n : n, r : ref, tableinst' : tableinst, at : addrtype, i : u64, j : u64, rt : reftype, `r'*` : ref*, i' : u64}(tableinst, n, r) = ?(tableinst') -- if (tableinst = {TYPE `%%%`_tabletype(at, `[%..%]`_limits(i, j), rt), REFS r'*{r' <- `r'*`}}) -- if (tableinst' = {TYPE `%%%`_tabletype(at, `[%..%]`_limits(i', j), rt), REFS r'*{r' <- `r'*`} ++ r^n{}}) - -- if ((i' = `%`_u64((|r'*{r' <- `r'*`}| + n))) /\ ((|r'*{r' <- `r'*`}| + n) <= j!`%`_u64.0)) + -- if ((i'!`%`_u64.0 = (|r'*{r' <- `r'*`}| + n)) /\ ((|r'*{r' <- `r'*`}| + n) <= j!`%`_u64.0)) def $growtable{x0 : tableinst, x1 : nat, x2 : ref}(x0, x1, x2) = ?() ;; 6-runtime-aux.watsup @@ -23376,7 +23376,7 @@ def $growmem(meminst : meminst, nat : nat) : meminst? def $growmem{meminst : meminst, n : n, meminst' : meminst, at : addrtype, i : u64, j : u64, `b*` : byte*, i' : u64}(meminst, n) = ?(meminst') -- if (meminst = {TYPE `%%PAGE`_memtype(at, `[%..%]`_limits(i, j)), BYTES b*{b <- `b*`}}) -- if (meminst' = {TYPE `%%PAGE`_memtype(at, `[%..%]`_limits(i', j)), BYTES b*{b <- `b*`} ++ `%`_byte(0)^(n * (64 * $Ki)){}}) - -- if ((i' = `%`_u64(((((|b*{b <- `b*`}| : nat <:> rat) / ((64 * $Ki) : nat <:> rat)) + (n : nat <:> rat)) : rat <:> nat))) /\ ((((|b*{b <- `b*`}| : nat <:> rat) / ((64 * $Ki) : nat <:> rat)) + (n : nat <:> rat)) <= (j!`%`_u64.0 : nat <:> rat))) + -- if (((i'!`%`_u64.0 : nat <:> rat) = (((|b*{b <- `b*`}| : nat <:> rat) / ((64 * $Ki) : nat <:> rat)) + (n : nat <:> rat))) /\ ((((|b*{b <- `b*`}| : nat <:> rat) / ((64 * $Ki) : nat <:> rat)) + (n : nat <:> rat)) <= (j!`%`_u64.0 : nat <:> rat))) def $growmem{x0 : meminst, x1 : nat}(x0, x1) = ?() ;; 7-runtime-typing.watsup @@ -23509,22 +23509,22 @@ relation Step_pure: `%~>%`(instr*, instr*) ;; 8-reduction.watsup rule `select-true`{val_1 : val, val_2 : val, c : num_(I32_numtype), `t*?` : valtype*?}: `%~>%`([(val_1 : val <: instr) (val_2 : val <: instr) CONST_instr(I32_numtype, c) `SELECT()%?`_instr(t*{t <- `t*`}?{`t*` <- `t*?`})], [(val_1 : val <: instr)]) - -- if (c =/= `%`_num_(0)) + -- if (c!`%`_num_.0 =/= 0) ;; 8-reduction.watsup rule `select-false`{val_1 : val, val_2 : val, c : num_(I32_numtype), `t*?` : valtype*?}: `%~>%`([(val_1 : val <: instr) (val_2 : val <: instr) CONST_instr(I32_numtype, c) `SELECT()%?`_instr(t*{t <- `t*`}?{`t*` <- `t*?`})], [(val_2 : val <: instr)]) - -- if (c = `%`_num_(0)) + -- if (c!`%`_num_.0 = 0) ;; 8-reduction.watsup rule `if-true`{c : num_(I32_numtype), bt : blocktype, `instr_1*` : instr*, `instr_2*` : instr*}: `%~>%`([CONST_instr(I32_numtype, c) `IF%%ELSE%`_instr(bt, instr_1*{instr_1 <- `instr_1*`}, instr_2*{instr_2 <- `instr_2*`})], [BLOCK_instr(bt, instr_1*{instr_1 <- `instr_1*`})]) - -- if (c =/= `%`_num_(0)) + -- if (c!`%`_num_.0 =/= 0) ;; 8-reduction.watsup rule `if-false`{c : num_(I32_numtype), bt : blocktype, `instr_1*` : instr*, `instr_2*` : instr*}: `%~>%`([CONST_instr(I32_numtype, c) `IF%%ELSE%`_instr(bt, instr_1*{instr_1 <- `instr_1*`}, instr_2*{instr_2 <- `instr_2*`})], [BLOCK_instr(bt, instr_2*{instr_2 <- `instr_2*`})]) - -- if (c = `%`_num_(0)) + -- if (c!`%`_num_.0 = 0) ;; 8-reduction.watsup rule `label-vals`{n : n, `instr*` : instr*, `val*` : val*}: @@ -23533,7 +23533,7 @@ relation Step_pure: `%~>%`(instr*, instr*) ;; 8-reduction.watsup rule `br-label-zero`{n : n, `instr'*` : instr*, `val'*` : val*, `val*` : val*, l : labelidx, `instr*` : instr*}: `%~>%`([`LABEL_%{%}%`_instr(n, instr'*{instr' <- `instr'*`}, (val' : val <: instr)*{val' <- `val'*`} ++ (val : val <: instr)^n{val <- `val*`} ++ [BR_instr(l)] ++ instr*{instr <- `instr*`})], (val : val <: instr)^n{val <- `val*`} ++ instr'*{instr' <- `instr'*`}) - -- if (l = `%`_labelidx(0)) + -- if (l!`%`_labelidx.0 = 0) ;; 8-reduction.watsup rule `br-label-succ`{n : n, `instr'*` : instr*, `val*` : val*, l : labelidx, `instr*` : instr*}: @@ -23547,12 +23547,12 @@ relation Step_pure: `%~>%`(instr*, instr*) ;; 8-reduction.watsup rule `br_if-true`{c : num_(I32_numtype), l : labelidx}: `%~>%`([CONST_instr(I32_numtype, c) BR_IF_instr(l)], [BR_instr(l)]) - -- if (c =/= `%`_num_(0)) + -- if (c!`%`_num_.0 =/= 0) ;; 8-reduction.watsup rule `br_if-false`{c : num_(I32_numtype), l : labelidx}: `%~>%`([CONST_instr(I32_numtype, c) BR_IF_instr(l)], []) - -- if (c = `%`_num_(0)) + -- if (c!`%`_num_.0 = 0) ;; 8-reduction.watsup rule `br_table-lt`{i : num_(I32_numtype), `l*` : labelidx*, l' : labelidx}: @@ -23868,7 +23868,7 @@ def $blocktype_(state : state, blocktype : blocktype) : functype def $blocktype_{z : state, x : idx, ft : functype}(z, _IDX_blocktype(x)) = ft -- Expand: `%~~%`($type(z, x), FUNC_comptype(ft)) ;; 8-reduction.watsup - def $blocktype_{z : state, `t?` : valtype?}(z, _RESULT_blocktype(t?{t <- `t?`})) = `%->%`_functype(`%`_resulttype([]), `%`_resulttype(t?{t <- `t?`})) + def $blocktype_{z : state, `t?` : valtype?}(z, _RESULT_blocktype(t?{t <- `t?`})) = `%->%`_functype(`%`_resulttype([]), `%`_resulttype(lift(t?{t <- `t?`}))) ;; 8-reduction.watsup relation Step_read: `%~>%`(config, instr*) @@ -24332,7 +24332,7 @@ relation Step_read: `%~>%`(config, instr*) `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VLOAD_instr(V128_vectype, ?(SPLAT_vloadop_(`%`_sz(N))), x, ao)]), [VCONST_instr(V128_vectype, c)]) -- if ($ibytes_(N, j) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) : (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) -- if (N = $lsize((Jnn : Jnn <: lanetype))) - -- if (M = (((128 : nat <:> rat) / (N : nat <:> rat)) : rat <:> nat)) + -- if ((M : nat <:> rat) = ((128 : nat <:> rat) / (N : nat <:> rat))) -- if (c = $invlanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), `%`_lane_(j!`%`_iN.0)^M{})) ;; 8-reduction.watsup @@ -24356,7 +24356,7 @@ relation Step_read: `%~>%`(config, instr*) `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c_1) VLOAD_LANE_instr(V128_vectype, `%`_sz(N), x, ao, j)]), [VCONST_instr(V128_vectype, c)]) -- if ($ibytes_(N, k) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) : (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) -- if (N = $lsize((Jnn : Jnn <: lanetype))) - -- if (M = ((($vsize(V128_vectype) : nat <:> rat) / (N : nat <:> rat)) : rat <:> nat)) + -- if ((M : nat <:> rat) = (($vsize(V128_vectype) : nat <:> rat) / (N : nat <:> rat))) -- if (c = $invlanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), c_1)[[j!`%`_laneidx.0] = `%`_lane_(k!`%`_iN.0)])) ;; 8-reduction.watsup @@ -24563,7 +24563,7 @@ relation Step: `%~>%`(config, config) rule `vstore_lane-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c : vec_(V128_Vnn), N : N, x : idx, ao : memarg, j : laneidx, `b*` : byte*, Jnn : Jnn, M : M}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_LANE_instr(V128_vectype, `%`_sz(N), x, ao, j)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0), (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) -- if (N = $lsize((Jnn : Jnn <: lanetype))) - -- if (M = (((128 : nat <:> rat) / (N : nat <:> rat)) : rat <:> nat)) + -- if ((M : nat <:> rat) = ((128 : nat <:> rat) / (N : nat <:> rat))) -- if (b*{b <- `b*`} = $ibytes_(N, `%`_iN($lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), c)[j!`%`_laneidx.0]!`%`_lane_.0))) ;; 8-reduction.watsup:1019.1-1022.37 @@ -24615,7 +24615,7 @@ def $alloctypes(type*) : deftype* -- if (deftype'*{deftype' <- `deftype'*`} = $alloctypes(type'*{type' <- `type'*`})) -- if (type = TYPE_type(rectype)) -- if (deftype*{deftype <- `deftype*`} = $subst_all_deftypes($rolldt(x, rectype), (deftype' : deftype <: heaptype)*{deftype' <- `deftype'*`})) - -- if (x = `%`_idx(|deftype'*{deftype' <- `deftype'*`}|)) + -- if (x!`%`_idx.0 = |deftype'*{deftype' <- `deftype'*`}|) } ;; 9-module.watsup @@ -24838,7 +24838,7 @@ def $evalglobals(state : state, globaltype*, expr*) : (state, val*) ;; 9-module.watsup def $instantiate(store : store, module : module, externaddr*) : config ;; 9-module.watsup - def $instantiate{s : store, module : module, `externaddr*` : externaddr*, s' : store, f : frame, `instr_E*` : instr*, `instr_D*` : instr*, `instr_S?` : instr?, `xt_I*` : externtype*, `xt_E*` : externtype*, `type*` : type*, `import*` : import*, `func*` : func*, `global*` : global*, `table*` : table*, `mem*` : mem*, `tag*` : tag*, `elem*` : elem*, `data*` : data*, `start?` : start?, `export*` : export*, `globaltype*` : globaltype*, `expr_G*` : expr*, `tabletype*` : tabletype*, `expr_T*` : expr*, `reftype*` : reftype*, `expr_E**` : expr**, `elemmode*` : elemmode*, `byte**` : byte**, `datamode*` : datamode*, `x?` : idx?, moduleinst_0 : moduleinst, `i_F*` : nat*, z : state, z' : state, `val_G*` : val*, `ref_T*` : ref*, `ref_E**` : ref**, moduleinst : moduleinst, `i_E*` : nat*, `i_D*` : nat*}(s, module, externaddr*{externaddr <- `externaddr*`}) = `%;%`_config(`%;%`_state(s', f), instr_E*{instr_E <- `instr_E*`} ++ instr_D*{instr_D <- `instr_D*`} ++ instr_S?{instr_S <- `instr_S?`}) + def $instantiate{s : store, module : module, `externaddr*` : externaddr*, s' : store, f : frame, `instr_E*` : instr*, `instr_D*` : instr*, `instr_S?` : instr?, `xt_I*` : externtype*, `xt_E*` : externtype*, `type*` : type*, `import*` : import*, `func*` : func*, `global*` : global*, `table*` : table*, `mem*` : mem*, `tag*` : tag*, `elem*` : elem*, `data*` : data*, `start?` : start?, `export*` : export*, `globaltype*` : globaltype*, `expr_G*` : expr*, `tabletype*` : tabletype*, `expr_T*` : expr*, `reftype*` : reftype*, `expr_E**` : expr**, `elemmode*` : elemmode*, `byte**` : byte**, `datamode*` : datamode*, `x?` : idx?, moduleinst_0 : moduleinst, `i_F*` : nat*, z : state, z' : state, `val_G*` : val*, `ref_T*` : ref*, `ref_E**` : ref**, moduleinst : moduleinst, `i_E*` : nat*, `i_D*` : nat*}(s, module, externaddr*{externaddr <- `externaddr*`}) = `%;%`_config(`%;%`_state(s', f), instr_E*{instr_E <- `instr_E*`} ++ instr_D*{instr_D <- `instr_D*`} ++ lift(instr_S?{instr_S <- `instr_S?`})) -- Module_ok: `|-%:%`(module, `%->%`_moduletype(xt_I*{xt_I <- `xt_I*`}, xt_E*{xt_E <- `xt_E*`})) -- (Externaddr_type: `%|-%:%`(s, externaddr, xt_I))*{externaddr <- `externaddr*`, xt_I <- `xt_I*`} -- if (module = MODULE_module(type*{type <- `type*`}, import*{import <- `import*`}, func*{func <- `func*`}, global*{global <- `global*`}, table*{table <- `table*`}, mem*{mem <- `mem*`}, tag*{tag <- `tag*`}, elem*{elem <- `elem*`}, data*{data <- `data*`}, start?{start <- `start?`}, export*{export <- `export*`})) @@ -26868,19 +26868,19 @@ def $utf8(char*) : byte* ;; A-binary.watsup:54.1-56.15 def $utf8{ch : char, b : byte}([ch]) = [b] -- if (ch!`%`_char.0 < 128) - -- if (ch = `%`_char(b!`%`_byte.0)) + -- if (`%`_byte(ch!`%`_char.0) = b) ;; A-binary.watsup:57.1-59.46 def $utf8{ch : char, b_1 : byte, b_2 : byte}([ch]) = [b_1 b_2] -- if ((128 <= ch!`%`_char.0) /\ (ch!`%`_char.0 < 2048)) - -- if (ch = `%`_char((((2 ^ 6) * (((b_1!`%`_byte.0 : nat <:> int) - (192 : nat <:> int)) : int <:> nat)) + $cont(b_2)))) + -- if (ch!`%`_char.0 = (((2 ^ 6) * (((b_1!`%`_byte.0 : nat <:> int) - (192 : nat <:> int)) : int <:> nat)) + $cont(b_2))) ;; A-binary.watsup:60.1-62.64 def $utf8{ch : char, b_1 : byte, b_2 : byte, b_3 : byte}([ch]) = [b_1 b_2 b_3] -- if (((2048 <= ch!`%`_char.0) /\ (ch!`%`_char.0 < 55296)) \/ ((57344 <= ch!`%`_char.0) /\ (ch!`%`_char.0 < 65536))) - -- if (ch = `%`_char(((((2 ^ 12) * (((b_1!`%`_byte.0 : nat <:> int) - (224 : nat <:> int)) : int <:> nat)) + ((2 ^ 6) * $cont(b_2))) + $cont(b_3)))) + -- if (ch!`%`_char.0 = ((((2 ^ 12) * (((b_1!`%`_byte.0 : nat <:> int) - (224 : nat <:> int)) : int <:> nat)) + ((2 ^ 6) * $cont(b_2))) + $cont(b_3))) ;; A-binary.watsup:63.1-65.82 def $utf8{ch : char, b_1 : byte, b_2 : byte, b_3 : byte, b_4 : byte}([ch]) = [b_1 b_2 b_3 b_4] -- if ((65536 <= ch!`%`_char.0) /\ (ch!`%`_char.0 < 69632)) - -- if (ch = `%`_char((((((2 ^ 18) * (((b_1!`%`_byte.0 : nat <:> int) - (240 : nat <:> int)) : int <:> nat)) + ((2 ^ 12) * $cont(b_2))) + ((2 ^ 6) * $cont(b_3))) + $cont(b_4)))) + -- if (ch!`%`_char.0 = (((((2 ^ 18) * (((b_1!`%`_byte.0 : nat <:> int) - (240 : nat <:> int)) : int <:> nat)) + ((2 ^ 12) * $cont(b_2))) + ((2 ^ 6) * $cont(b_3))) + $cont(b_4))) } ;; 1-syntax.watsup @@ -27779,7 +27779,7 @@ syntax storeop_{Inn : Inn}((Inn : Inn <: numtype)) = ;; 1-syntax.watsup syntax vloadop_{vectype : vectype}(vectype) = | `SHAPE%X%%`{sz : sz, M : M, sx : sx}(sz : sz, M : M, sx : sx) - -- if ((sz!`%`_sz.0 * M) = ((($vsize(vectype) : nat <:> rat) / (2 : nat <:> rat)) : rat <:> nat)) + -- if (((sz!`%`_sz.0 * M) : nat <:> rat) = (($vsize(vectype) : nat <:> rat) / (2 : nat <:> rat))) | SPLAT{sz : sz}(sz : sz) | ZERO{sz : sz}(sz : sz) -- if (sz!`%`_sz.0 >= 32) @@ -27944,7 +27944,7 @@ syntax instr = | VBITMASK{ishape : ishape}(ishape : ishape) | VSWIZZLOP{bshape : bshape, vswizzlop_ : vswizzlop_(bshape)}(bshape : bshape, vswizzlop_ : vswizzlop_(bshape)) | VSHUFFLE{bshape : bshape, `laneidx*` : laneidx*}(bshape : bshape, laneidx*{laneidx <- `laneidx*`} : laneidx*) - -- if (|laneidx*{laneidx <- `laneidx*`}| = $dim(bshape!`%`_bshape.0)!`%`_dim.0) + -- if (`%`_dim(|laneidx*{laneidx <- `laneidx*`}|) = $dim(bshape!`%`_bshape.0)) | VEXTUNOP{ishape_1 : ishape, ishape_2 : ishape, vextunop__ : vextunop__(ishape_2, ishape_1)}(ishape_1 : ishape, ishape_2 : ishape, vextunop__ : vextunop__(ishape_2, ishape_1)) | VEXTBINOP{ishape_1 : ishape, ishape_2 : ishape, vextbinop__ : vextbinop__(ishape_2, ishape_1)}(ishape_1 : ishape, ishape_2 : ishape, vextbinop__ : vextbinop__(ishape_2, ishape_1)) | VEXTTERNOP{ishape_1 : ishape, ishape_2 : ishape, vextternop__ : vextternop__(ishape_2, ishape_1)}(ishape_1 : ishape, ishape_2 : ishape, vextternop__ : vextternop__(ishape_2, ishape_1)) @@ -29784,7 +29784,7 @@ relation Externtype_sub: `%|-%<:%`(context, externtype, externtype) relation Blocktype_ok: `%|-%:%`(context, blocktype, instrtype) ;; 3-typing.watsup rule valtype{C : context, `valtype?` : valtype?}: - `%|-%:%`(C, _RESULT_blocktype(valtype?{valtype <- `valtype?`}), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype(valtype?{valtype <- `valtype?`}))) + `%|-%:%`(C, _RESULT_blocktype(valtype?{valtype <- `valtype?`}), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype(lift(valtype?{valtype <- `valtype?`})))) -- (Valtype_ok: `%|-%:OK`(C, valtype))?{valtype <- `valtype?`} ;; 3-typing.watsup @@ -29897,14 +29897,14 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) rule br{C : context, l : labelidx, `t_1*` : valtype*, `t*` : valtype*, `t_2*` : valtype*}: `%|-%:%`(C, BR_instr(l), `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`} ++ t*{t <- `t*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) -- if (l!`%`_labelidx.0 < |C.LABELS_context|) - -- if (C.LABELS_context[l!`%`_labelidx.0] = `%`_resulttype(t*{t <- `t*`})) + -- if (C.LABELS_context[l!`%`_labelidx.0]!`%`_resulttype.0 = t*{t <- `t*`}) -- Instrtype_ok: `%|-%:OK`(C, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) ;; 3-typing.watsup:628.1-630.25 rule br_if{C : context, l : labelidx, `t*` : valtype*}: `%|-%:%`(C, BR_IF_instr(l), `%->_%%`_instrtype(`%`_resulttype(t*{t <- `t*`} ++ [I32_valtype]), [], `%`_resulttype(t*{t <- `t*`}))) -- if (l!`%`_labelidx.0 < |C.LABELS_context|) - -- if (C.LABELS_context[l!`%`_labelidx.0] = `%`_resulttype(t*{t <- `t*`})) + -- if (C.LABELS_context[l!`%`_labelidx.0]!`%`_resulttype.0 = t*{t <- `t*`}) ;; 3-typing.watsup:632.1-636.42 rule br_table{C : context, `l*` : labelidx*, l' : labelidx, `t_1*` : valtype*, `t*` : valtype*, `t_2*` : valtype*}: @@ -29919,7 +29919,7 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) rule br_on_null{C : context, l : labelidx, `t*` : valtype*, ht : heaptype}: `%|-%:%`(C, BR_ON_NULL_instr(l), `%->_%%`_instrtype(`%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(`NULL%?`_nul(?(())), ht)]), [], `%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(`NULL%?`_nul(?()), ht)]))) -- if (l!`%`_labelidx.0 < |C.LABELS_context|) - -- if (C.LABELS_context[l!`%`_labelidx.0] = `%`_resulttype(t*{t <- `t*`})) + -- if (C.LABELS_context[l!`%`_labelidx.0]!`%`_resulttype.0 = t*{t <- `t*`}) -- Heaptype_ok: `%|-%:OK`(C, ht) ;; 3-typing.watsup:643.1-645.34 @@ -30642,7 +30642,7 @@ relation Type_ok: `%|-%:%`(context, type, deftype*) ;; 3-typing.watsup rule _{C : context, rectype : rectype, `dt*` : deftype*, x : idx}: `%|-%:%`(C, TYPE_type(rectype), dt*{dt <- `dt*`}) - -- if (x = `%`_idx(|C.TYPES_context|)) + -- if (x!`%`_idx.0 = |C.TYPES_context|) -- if (dt*{dt <- `dt*`} = $rolldt(x, rectype)) -- Rectype_ok: `%|-%:%`(C +++ {TYPES dt*{dt <- `dt*`}, RECS [], FUNCS [], GLOBALS [], TABLES [], MEMS [], TAGS [], ELEMS [], DATAS [], LOCALS [], LABELS [], RETURN ?(), REFS []}, rectype, OK_oktypeidx(x)) @@ -31152,12 +31152,12 @@ def $irelaxed_laneselect_(N : N, iN : iN(N), iN : iN(N), iN : iN(N)) : iN(N)* ;; 4-numerics.watsup def $ieqz_(N : N, iN : iN(N)) : u32 ;; 4-numerics.watsup - def $ieqz_{N : N, i_1 : iN(N)}(N, i_1) = `%`_u32($bool((i_1 = `%`_iN(0)))) + def $ieqz_{N : N, i_1 : iN(N)}(N, i_1) = `%`_u32($bool((i_1!`%`_iN.0 = 0))) ;; 4-numerics.watsup def $inez_(N : N, iN : iN(N)) : u32 ;; 4-numerics.watsup - def $inez_{N : N, i_1 : iN(N)}(N, i_1) = `%`_u32($bool((i_1 =/= `%`_iN(0)))) + def $inez_{N : N, i_1 : iN(N)}(N, i_1) = `%`_u32($bool((i_1!`%`_iN.0 =/= 0))) ;; 4-numerics.watsup def $ieq_(N : N, iN : iN(N), iN : iN(N)) : u32 @@ -31562,14 +31562,14 @@ def $ivtestop_(shape : shape, def $f_(N : N, iN : iN(N)) : u32, vec_ : vec_(V128 ;; 4-numerics.watsup def $ivtestop_{Jnn : Jnn, M : M, def $f_(N : N, iN : iN(N)) : u32, v_1 : vec_(V128_Vnn), `c*` : nat*, `c_1*` : lane_($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))))*}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), def $f_, v_1) = `%`_u32($prod(c*{c <- `c*`})) -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), v_1)) - -- if (c*{c <- `c*`} = $f_($lsizenn((Jnn : Jnn <: lanetype)), c_1)!`%`_u32.0*{c_1 <- `c_1*`}) + -- if (`%`_u32(c)*{c <- `c*`} = $f_($lsizenn((Jnn : Jnn <: lanetype)), c_1)*{c_1 <- `c_1*`}) ;; 4-numerics.watsup def $fvtestop_(shape : shape, def $f_(N : N, fN : fN(N)) : u32, vec_ : vec_(V128_Vnn)) : u32 ;; 4-numerics.watsup def $fvtestop_{Fnn : Fnn, M : M, def $f_(N : N, fN : fN(N)) : u32, v_1 : vec_(V128_Vnn), `c*` : nat*, `c_1*` : lane_($lanetype(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M))))*}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), def $f_, v_1) = `%`_u32($prod(c*{c <- `c*`})) -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), v_1)) - -- if (c*{c <- `c*`} = $f_($sizenn((Fnn : Fnn <: numtype)), c_1)!`%`_u32.0*{c_1 <- `c_1*`}) + -- if (`%`_u32(c)*{c <- `c*`} = $f_($sizenn((Fnn : Fnn <: numtype)), c_1)*{c_1 <- `c_1*`}) ;; 4-numerics.watsup def $ivrelop_(shape : shape, def $f_(N : N, iN : iN(N), iN : iN(N)) : u32, vec_ : vec_(V128_Vnn), vec_ : vec_(V128_Vnn)) : vec_(V128_Vnn) @@ -31593,7 +31593,7 @@ def $fvrelop_(shape : shape, def $f_(N : N, fN : fN(N), fN : fN(N)) : u32, vec_ def $fvrelop_{Fnn : Fnn, M : M, def $f_(N : N, fN : fN(N), fN : fN(N)) : u32, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn), Inn : Inn, `c*` : lane_($lanetype(`%X%`_shape((Inn : Inn <: lanetype), `%`_dim(M))))*, `c_1*` : lane_($lanetype(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M))))*, `c_2*` : lane_($lanetype(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M))))*}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), def $f_, v_1, v_2) = $invlanes_(`%X%`_shape((Inn : Inn <: lanetype), `%`_dim(M)), c*{c <- `c*`}) -- 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)) - -- if (c*{c <- `c*`} = `%`_lane_($extend__(1, $sizenn((Fnn : Fnn <: numtype)), S_sx, `%`_iN($f_($sizenn((Fnn : Fnn <: numtype)), c_1, c_2)!`%`_u32.0))!`%`_iN.0)*{c_1 <- `c_1*`, c_2 <- `c_2*`}) + -- if (`%`_iN(c!`%`_lane_.0)*{c <- `c*`} = $extend__(1, $sizenn((Fnn : Fnn <: numtype)), S_sx, `%`_iN($f_($sizenn((Fnn : Fnn <: numtype)), c_1, c_2)!`%`_u32.0))*{c_1 <- `c_1*`, c_2 <- `c_2*`}) -- if ($size((Inn : Inn <: numtype)) = $size((Fnn : Fnn <: numtype))) ;; 4-numerics.watsup @@ -31884,7 +31884,7 @@ def $ivmul_(N : N, iN(N)*, iN(N)*) : iN(N)* def $vextbinop__(ishape_1 : ishape, ishape_2 : ishape, vextbinop__ : vextbinop__(ishape_1, ishape_2), vec_ : vec_(V128_Vnn), vec_ : vec_(V128_Vnn)) : vec_(V128_Vnn) ;; 4-numerics.watsup def $vextbinop__{Jnn_1 : Jnn, M_1 : M, Jnn_2 : Jnn, M_2 : M, sx : sx, half : half__(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2))), v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn), i : laneidx}(`%`_ishape(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1))), `%`_ishape(`%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2))), EXTMUL_vextbinop__(sx, half), v_1, v_2) = $ivextbinop__(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2)), def $ivmul_, sx, sx, i, `%`_laneidx(M_2), v_1, v_2) - -- if (i = `%`_laneidx($half__(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2)), half, 0, M_2))) + -- if (i!`%`_laneidx.0 = $half__(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2)), half, 0, M_2)) ;; 4-numerics.watsup def $vextbinop__{Jnn_1 : Jnn, M_1 : M, Jnn_2 : Jnn, M_2 : M, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn)}(`%`_ishape(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1))), `%`_ishape(`%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2))), `DOTS`_vextbinop__, v_1, v_2) = $ivextbinop__(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2)), def $ivdot_, S_sx, S_sx, `%`_laneidx(0), `%`_laneidx(M_1), v_1, v_2) ;; 4-numerics.watsup @@ -32349,7 +32349,7 @@ def $growtable(tableinst : tableinst, nat : nat, ref : ref) : tableinst? def $growtable{tableinst : tableinst, n : n, r : ref, tableinst' : tableinst, at : addrtype, i : u64, j : u64, rt : reftype, `r'*` : ref*, i' : u64}(tableinst, n, r) = ?(tableinst') -- if (tableinst = {TYPE `%%%`_tabletype(at, `[%..%]`_limits(i, j), rt), REFS r'*{r' <- `r'*`}}) -- if (tableinst' = {TYPE `%%%`_tabletype(at, `[%..%]`_limits(i', j), rt), REFS r'*{r' <- `r'*`} ++ r^n{}}) - -- if ((i' = `%`_u64((|r'*{r' <- `r'*`}| + n))) /\ ((|r'*{r' <- `r'*`}| + n) <= j!`%`_u64.0)) + -- if ((i'!`%`_u64.0 = (|r'*{r' <- `r'*`}| + n)) /\ ((|r'*{r' <- `r'*`}| + n) <= j!`%`_u64.0)) def $growtable{x0 : tableinst, x1 : nat, x2 : ref}(x0, x1, x2) = ?() ;; 6-runtime-aux.watsup @@ -32358,7 +32358,7 @@ def $growmem(meminst : meminst, nat : nat) : meminst? def $growmem{meminst : meminst, n : n, meminst' : meminst, at : addrtype, i : u64, j : u64, `b*` : byte*, i' : u64}(meminst, n) = ?(meminst') -- if (meminst = {TYPE `%%PAGE`_memtype(at, `[%..%]`_limits(i, j)), BYTES b*{b <- `b*`}}) -- if (meminst' = {TYPE `%%PAGE`_memtype(at, `[%..%]`_limits(i', j)), BYTES b*{b <- `b*`} ++ `%`_byte(0)^(n * (64 * $Ki)){}}) - -- if ((i' = `%`_u64(((((|b*{b <- `b*`}| : nat <:> rat) / ((64 * $Ki) : nat <:> rat)) + (n : nat <:> rat)) : rat <:> nat))) /\ ((((|b*{b <- `b*`}| : nat <:> rat) / ((64 * $Ki) : nat <:> rat)) + (n : nat <:> rat)) <= (j!`%`_u64.0 : nat <:> rat))) + -- if (((i'!`%`_u64.0 : nat <:> rat) = (((|b*{b <- `b*`}| : nat <:> rat) / ((64 * $Ki) : nat <:> rat)) + (n : nat <:> rat))) /\ ((((|b*{b <- `b*`}| : nat <:> rat) / ((64 * $Ki) : nat <:> rat)) + (n : nat <:> rat)) <= (j!`%`_u64.0 : nat <:> rat))) def $growmem{x0 : meminst, x1 : nat}(x0, x1) = ?() ;; 7-runtime-typing.watsup @@ -32499,22 +32499,22 @@ relation Step_pure: `%~>%`(instr*, instr*) ;; 8-reduction.watsup rule `select-true`{val_1 : val, val_2 : val, c : num_(I32_numtype), `t*?` : valtype*?}: `%~>%`([(val_1 : val <: instr) (val_2 : val <: instr) CONST_instr(I32_numtype, c) `SELECT()%?`_instr(t*{t <- `t*`}?{`t*` <- `t*?`})], [(val_1 : val <: instr)]) - -- if (c =/= `%`_num_(0)) + -- if (c!`%`_num_.0 =/= 0) ;; 8-reduction.watsup rule `select-false`{val_1 : val, val_2 : val, c : num_(I32_numtype), `t*?` : valtype*?}: `%~>%`([(val_1 : val <: instr) (val_2 : val <: instr) CONST_instr(I32_numtype, c) `SELECT()%?`_instr(t*{t <- `t*`}?{`t*` <- `t*?`})], [(val_2 : val <: instr)]) - -- if (c = `%`_num_(0)) + -- if (c!`%`_num_.0 = 0) ;; 8-reduction.watsup rule `if-true`{c : num_(I32_numtype), bt : blocktype, `instr_1*` : instr*, `instr_2*` : instr*}: `%~>%`([CONST_instr(I32_numtype, c) `IF%%ELSE%`_instr(bt, instr_1*{instr_1 <- `instr_1*`}, instr_2*{instr_2 <- `instr_2*`})], [BLOCK_instr(bt, instr_1*{instr_1 <- `instr_1*`})]) - -- if (c =/= `%`_num_(0)) + -- if (c!`%`_num_.0 =/= 0) ;; 8-reduction.watsup rule `if-false`{c : num_(I32_numtype), bt : blocktype, `instr_1*` : instr*, `instr_2*` : instr*}: `%~>%`([CONST_instr(I32_numtype, c) `IF%%ELSE%`_instr(bt, instr_1*{instr_1 <- `instr_1*`}, instr_2*{instr_2 <- `instr_2*`})], [BLOCK_instr(bt, instr_2*{instr_2 <- `instr_2*`})]) - -- if (c = `%`_num_(0)) + -- if (c!`%`_num_.0 = 0) ;; 8-reduction.watsup rule `label-vals`{n : n, `instr*` : instr*, `val*` : val*}: @@ -32523,7 +32523,7 @@ relation Step_pure: `%~>%`(instr*, instr*) ;; 8-reduction.watsup rule `br-label-zero`{n : n, `instr'*` : instr*, `val'*` : val*, `val*` : val*, l : labelidx, `instr*` : instr*}: `%~>%`([`LABEL_%{%}%`_instr(n, instr'*{instr' <- `instr'*`}, (val' : val <: instr)*{val' <- `val'*`} ++ (val : val <: instr)^n{val <- `val*`} ++ [BR_instr(l)] ++ instr*{instr <- `instr*`})], (val : val <: instr)^n{val <- `val*`} ++ instr'*{instr' <- `instr'*`}) - -- if (l = `%`_labelidx(0)) + -- if (l!`%`_labelidx.0 = 0) ;; 8-reduction.watsup rule `br-label-succ`{n : n, `instr'*` : instr*, `val*` : val*, l : labelidx, `instr*` : instr*}: @@ -32537,12 +32537,12 @@ relation Step_pure: `%~>%`(instr*, instr*) ;; 8-reduction.watsup rule `br_if-true`{c : num_(I32_numtype), l : labelidx}: `%~>%`([CONST_instr(I32_numtype, c) BR_IF_instr(l)], [BR_instr(l)]) - -- if (c =/= `%`_num_(0)) + -- if (c!`%`_num_.0 =/= 0) ;; 8-reduction.watsup rule `br_if-false`{c : num_(I32_numtype), l : labelidx}: `%~>%`([CONST_instr(I32_numtype, c) BR_IF_instr(l)], []) - -- if (c = `%`_num_(0)) + -- if (c!`%`_num_.0 = 0) ;; 8-reduction.watsup rule `br_table-lt`{i : num_(I32_numtype), `l*` : labelidx*, l' : labelidx}: @@ -32869,7 +32869,7 @@ def $blocktype_(state : state, blocktype : blocktype) : functype def $blocktype_{z : state, x : idx, ft : functype}(z, _IDX_blocktype(x)) = ft -- Expand: `%~~%`($type(z, x), FUNC_comptype(ft)) ;; 8-reduction.watsup - def $blocktype_{z : state, `t?` : valtype?}(z, _RESULT_blocktype(t?{t <- `t?`})) = `%->%`_functype(`%`_resulttype([]), `%`_resulttype(t?{t <- `t?`})) + def $blocktype_{z : state, `t?` : valtype?}(z, _RESULT_blocktype(t?{t <- `t?`})) = `%->%`_functype(`%`_resulttype([]), `%`_resulttype(lift(t?{t <- `t?`}))) ;; 8-reduction.watsup relation Step_read: `%~>%`(config, instr*) @@ -33361,7 +33361,7 @@ relation Step_read: `%~>%`(config, instr*) `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VLOAD_instr(V128_vectype, ?(SPLAT_vloadop_(`%`_sz(N))), x, ao)]), [VCONST_instr(V128_vectype, c)]) -- if ($ibytes_(N, j) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) : (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) -- if (N = $lsize((Jnn : Jnn <: lanetype))) - -- if (M = (((128 : nat <:> rat) / (N : nat <:> rat)) : rat <:> nat)) + -- if ((M : nat <:> rat) = ((128 : nat <:> rat) / (N : nat <:> rat))) -- if (c = $invlanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), `%`_lane_(j!`%`_iN.0)^M{})) ;; 8-reduction.watsup @@ -33385,7 +33385,7 @@ relation Step_read: `%~>%`(config, instr*) `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c_1) VLOAD_LANE_instr(V128_vectype, `%`_sz(N), x, ao, j)]), [VCONST_instr(V128_vectype, c)]) -- if ($ibytes_(N, k) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) : (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) -- if (N = $lsize((Jnn : Jnn <: lanetype))) - -- if (M = ((($vsize(V128_vectype) : nat <:> rat) / (N : nat <:> rat)) : rat <:> nat)) + -- if ((M : nat <:> rat) = (($vsize(V128_vectype) : nat <:> rat) / (N : nat <:> rat))) -- if (c = $invlanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), c_1)[[j!`%`_laneidx.0] = `%`_lane_(k!`%`_iN.0)])) ;; 8-reduction.watsup @@ -33597,7 +33597,7 @@ relation Step: `%~>%`(config, config) rule `vstore_lane-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c : vec_(V128_Vnn), N : N, x : idx, ao : memarg, j : laneidx, `b*` : byte*, Jnn : Jnn, M : M}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_LANE_instr(V128_vectype, `%`_sz(N), x, ao, j)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0), (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) -- if (N = $lsize((Jnn : Jnn <: lanetype))) - -- if (M = (((128 : nat <:> rat) / (N : nat <:> rat)) : rat <:> nat)) + -- if ((M : nat <:> rat) = ((128 : nat <:> rat) / (N : nat <:> rat))) -- if (j!`%`_laneidx.0 < |$lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), c)|) -- if (b*{b <- `b*`} = $ibytes_(N, `%`_iN($lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), c)[j!`%`_laneidx.0]!`%`_lane_.0))) @@ -33651,7 +33651,7 @@ def $alloctypes(type*) : deftype* -- if (deftype'*{deftype' <- `deftype'*`} = $alloctypes(type'*{type' <- `type'*`})) -- if (type = TYPE_type(rectype)) -- if (deftype*{deftype <- `deftype*`} = $subst_all_deftypes($rolldt(x, rectype), (deftype' : deftype <: heaptype)*{deftype' <- `deftype'*`})) - -- if (x = `%`_idx(|deftype'*{deftype' <- `deftype'*`}|)) + -- if (x!`%`_idx.0 = |deftype'*{deftype' <- `deftype'*`}|) } ;; 9-module.watsup @@ -33874,7 +33874,7 @@ def $evalglobals(state : state, globaltype*, expr*) : (state, val*) ;; 9-module.watsup def $instantiate(store : store, module : module, externaddr*) : config ;; 9-module.watsup - def $instantiate{s : store, module : module, `externaddr*` : externaddr*, s' : store, f : frame, `instr_E*` : instr*, `instr_D*` : instr*, `instr_S?` : instr?, `xt_I*` : externtype*, `xt_E*` : externtype*, `type*` : type*, `import*` : import*, `func*` : func*, `global*` : global*, `table*` : table*, `mem*` : mem*, `tag*` : tag*, `elem*` : elem*, `data*` : data*, `start?` : start?, `export*` : export*, `globaltype*` : globaltype*, `expr_G*` : expr*, `tabletype*` : tabletype*, `expr_T*` : expr*, `reftype*` : reftype*, `expr_E**` : expr**, `elemmode*` : elemmode*, `byte**` : byte**, `datamode*` : datamode*, `x?` : idx?, moduleinst_0 : moduleinst, `i_F*` : nat*, z : state, z' : state, `val_G*` : val*, `ref_T*` : ref*, `ref_E**` : ref**, moduleinst : moduleinst, `i_E*` : nat*, `i_D*` : nat*}(s, module, externaddr*{externaddr <- `externaddr*`}) = `%;%`_config(`%;%`_state(s', f), instr_E*{instr_E <- `instr_E*`} ++ instr_D*{instr_D <- `instr_D*`} ++ instr_S?{instr_S <- `instr_S?`}) + def $instantiate{s : store, module : module, `externaddr*` : externaddr*, s' : store, f : frame, `instr_E*` : instr*, `instr_D*` : instr*, `instr_S?` : instr?, `xt_I*` : externtype*, `xt_E*` : externtype*, `type*` : type*, `import*` : import*, `func*` : func*, `global*` : global*, `table*` : table*, `mem*` : mem*, `tag*` : tag*, `elem*` : elem*, `data*` : data*, `start?` : start?, `export*` : export*, `globaltype*` : globaltype*, `expr_G*` : expr*, `tabletype*` : tabletype*, `expr_T*` : expr*, `reftype*` : reftype*, `expr_E**` : expr**, `elemmode*` : elemmode*, `byte**` : byte**, `datamode*` : datamode*, `x?` : idx?, moduleinst_0 : moduleinst, `i_F*` : nat*, z : state, z' : state, `val_G*` : val*, `ref_T*` : ref*, `ref_E**` : ref**, moduleinst : moduleinst, `i_E*` : nat*, `i_D*` : nat*}(s, module, externaddr*{externaddr <- `externaddr*`}) = `%;%`_config(`%;%`_state(s', f), instr_E*{instr_E <- `instr_E*`} ++ instr_D*{instr_D <- `instr_D*`} ++ lift(instr_S?{instr_S <- `instr_S?`})) -- Module_ok: `|-%:%`(module, `%->%`_moduletype(xt_I*{xt_I <- `xt_I*`}, xt_E*{xt_E <- `xt_E*`})) -- (Externaddr_type: `%|-%:%`(s, externaddr, xt_I))*{externaddr <- `externaddr*`, xt_I <- `xt_I*`} -- if (module = MODULE_module(type*{type <- `type*`}, import*{import <- `import*`}, func*{func <- `func*`}, global*{global <- `global*`}, table*{table <- `table*`}, mem*{mem <- `mem*`}, tag*{tag <- `tag*`}, elem*{elem <- `elem*`}, data*{data <- `data*`}, start?{start <- `start?`}, export*{export <- `export*`})) diff --git a/spectec/test-prose/TEST.md b/spectec/test-prose/TEST.md index 3ac132a76f..60b45a2f14 100644 --- a/spectec/test-prose/TEST.md +++ b/spectec/test-prose/TEST.md @@ -296,7 +296,7 @@ The instruction :math:`(\mathsf{br\_table}~{l^\ast}~{l'})` is valid with the fun * The result type :math:`C{.}\mathsf{labels}{}[{l'}]` exists. - * The number type :math:`{t^?}` is equal to :math:`C{.}\mathsf{labels}{}[{l'}]`. + * The result type :math:`{t^?}` is equal to :math:`C{.}\mathsf{labels}{}[{l'}]`. * For all :math:`l` in :math:`{l^\ast}`: @@ -304,7 +304,7 @@ The instruction :math:`(\mathsf{br\_table}~{l^\ast}~{l'})` is valid with the fun * For all :math:`l` in :math:`{l^\ast}`: - * The number type :math:`{t^?}` is equal to :math:`C{.}\mathsf{labels}{}[l]`. + * The result type :math:`{t^?}` is equal to :math:`C{.}\mathsf{labels}{}[l]`. @@ -2845,9 +2845,7 @@ The module :math:`(\mathsf{module}~{{\mathit{type}}^\ast}~{{\mathit{import}}^\as #. Push the evaluation context :math:`({\mathsf{frame}}_{0}\,\{~f~\})` to the stack. -#. If :math:`{(\mathsf{call}~{x'})^?}` is defined, then: - - a. Execute the instruction :math:`(\mathsf{call}~{x'})`. +#. Execute the sequence :math:`{(\mathsf{call}~{x'})^?}`. #. Pop the evaluation context :math:`({\mathsf{frame}}_{0}\,\{~f~\})` from the stack. @@ -3050,7 +3048,7 @@ Instr_ok/br_if Instr_ok/br_table - the instruction (BR_TABLE l* l') is valid with the function type t_1* :: t? :: [I32] -> t_2* if: - the result type C.LABELS[l'] exists. - - the number type t? is C.LABELS[l']. + - the result type t? is C.LABELS[l']. - For all l in l*: - the result type C.LABELS[l] exists. - For all l in l*: @@ -4279,8 +4277,7 @@ instantiate z module externaddr* 28. Perform $initelem(moduleinst, i_E*, moduleinst.FUNCS[x]**). 29. Perform $initdata(moduleinst, i_D*, b**). 30. Push the evaluation context (FRAME_ 0 { f }) to the stack. -31. If (CALL x')? is defined, then: - a. Execute the instruction (CALL x'). +31. Execute the sequence ((CALL x')?). 32. Pop the evaluation context (FRAME_ 0 { f }) from the stack. 33. Return f.MODULE. @@ -9942,9 +9939,7 @@ The module :math:`(\mathsf{module}~{{\mathit{type}}^\ast}~{{\mathit{import}}^\as #. Execute the sequence :math:`{{\mathit{instr}}_{\mathsf{d}}^\ast}`. -#. If :math:`{(\mathsf{call}~x)^?}` is defined, then: - - a. Execute the instruction :math:`(\mathsf{call}~x)`. +#. Execute the sequence :math:`{(\mathsf{call}~x)^?}`. #. Pop the evaluation context :math:`({\mathsf{frame}}_{0}\,\{~f~\})` from the stack. @@ -12749,8 +12744,7 @@ instantiate z module externaddr* 27. Push the evaluation context (FRAME_ 0 { f }) to the stack. 28. Execute the sequence (instr_E*). 29. Execute the sequence (instr_D*). -30. If (CALL x)? is defined, then: - a. Execute the instruction (CALL x). +30. Execute the sequence ((CALL x)?). 31. Pop the evaluation context (FRAME_ 0 { f }) from the stack. 32. Return f.MODULE. @@ -13901,7 +13895,7 @@ The instruction type :math:`{t_{11}^\ast}~{\rightarrow}_{{x_1^\ast}}\,{t_{12}^\a * The value type sequence :math:`{t_{12}^\ast}` matches the value type sequence :math:`{t_{22}^\ast}`. - * The index sequence :math:`{x^\ast}` is equal to :math:`{x_2^\ast} \setminus {x_1^\ast}`. + * The local index sequence :math:`{x^\ast}` is equal to :math:`{x_2^\ast} \setminus {x_1^\ast}`. * :math:`{|{\mathit{x*}}|}` is equal to :math:`{|{\mathit{t*}}|}`. @@ -16235,7 +16229,7 @@ The module :math:`(\mathsf{module}~{{\mathit{type}}^\ast}~{{\mathit{import}}^\as * The context :math:`{C'}` is equal to :math:`\{ \begin{array}[t]{@{}l@{}}\mathsf{types}~{{\mathit{dt}'}^\ast},\; \mathsf{recs}~\epsilon,\; \mathsf{funcs}~{{\mathit{dt}}_{\mathsf{i}}^\ast}~{{\mathit{dt}}^\ast},\; \mathsf{globals}~{{\mathit{gt}}_{\mathsf{i}}^\ast},\; \mathsf{tables}~\epsilon,\; \mathsf{mems}~\epsilon,\; \mathsf{tags}~\epsilon,\; \mathsf{elems}~\epsilon,\; \mathsf{datas}~\epsilon,\; \mathsf{locals}~\epsilon,\; \mathsf{labels}~\epsilon,\; \mathsf{return}~\epsilon,\; \mathsf{refs}~{x^\ast} \}\end{array}`. - * The index sequence :math:`{x^\ast}` is equal to :math:`{\mathrm{funcidx}}(({{\mathit{global}}^\ast}, {{\mathit{table}}^\ast}, {{\mathit{mem}}^\ast}, {{\mathit{elem}}^\ast}, {{\mathit{data}}^\ast}))`. + * The function index sequence :math:`{x^\ast}` is equal to :math:`{\mathrm{funcidx}}(({{\mathit{global}}^\ast}, {{\mathit{table}}^\ast}, {{\mathit{mem}}^\ast}, {{\mathit{elem}}^\ast}, {{\mathit{data}}^\ast}))`. * The defined type sequence :math:`{{\mathit{dt}}_{\mathsf{i}}^\ast}` is equal to :math:`{\mathrm{funcs}}({{\mathit{xt}}_{\mathsf{i}}^\ast})`. @@ -24286,33 +24280,33 @@ The instruction sequence :math:`(\mathsf{block}~{\mathit{blocktype}}~{{\mathit{i #. Let :math:`{\mathit{moduleinst}}` be :math:`\{ \begin{array}[t]{@{}l@{}}\mathsf{types}~{{\mathit{dt}}^\ast},\; \mathsf{funcs}~{{\mathit{fa}}_{\mathsf{i}}^\ast}~{{\mathit{fa}}^\ast},\; \mathsf{globals}~{{\mathit{ga}}_{\mathsf{i}}^\ast}~{{\mathit{ga}}^\ast},\; \mathsf{tables}~{{\mathit{ta}}_{\mathsf{i}}^\ast}~{{\mathit{ta}}^\ast},\; \mathsf{mems}~{{\mathit{ma}}_{\mathsf{i}}^\ast}~{{\mathit{ma}}^\ast},\; \mathsf{tags}~{{\mathit{aa}}_{\mathsf{i}}^\ast}~{{\mathit{aa}}^\ast},\; \mathsf{elems}~{{\mathit{ea}}^\ast},\; \mathsf{datas}~{{\mathit{da}}^\ast},\; \mathsf{exports}~{{\mathit{xi}}^\ast} \}\end{array}`. -#. Let :math:`n_0` be :math:`{\mathrm{allocfuncs}}({{{\mathit{dt}}^\ast}{}[x]^\ast}, {(\mathsf{func}~x~{{\mathit{local}}^\ast}~{\mathit{expr}}_{\mathsf{f}})^\ast}, {{\mathit{moduleinst}}^{{|{{\mathit{func}}^\ast}|}}})`. +#. Let :math:`{\mathit{funcaddr}}_0` be :math:`{\mathrm{allocfuncs}}({{{\mathit{dt}}^\ast}{}[x]^\ast}, {(\mathsf{func}~x~{{\mathit{local}}^\ast}~{\mathit{expr}}_{\mathsf{f}})^\ast}, {{\mathit{moduleinst}}^{{|{{\mathit{func}}^\ast}|}}})`. -#. Assert: Due to validation, :math:`n_0` is :math:`{{\mathit{fa}}^\ast}`. +#. Assert: Due to validation, :math:`{\mathit{funcaddr}}_0` is :math:`{{\mathit{fa}}^\ast}`. -#. Let :math:`n_0` be :math:`{\mathrm{allocglobals}}({{{\mathit{globaltype}}}{{}[ {:=}\, {{\mathit{dt}}^\ast} ]}^\ast}, {{\mathit{val}}_{\mathsf{g}}^\ast})`. +#. Let :math:`{\mathit{globaladdr}}_0` be :math:`{\mathrm{allocglobals}}({{{\mathit{globaltype}}}{{}[ {:=}\, {{\mathit{dt}}^\ast} ]}^\ast}, {{\mathit{val}}_{\mathsf{g}}^\ast})`. -#. Assert: Due to validation, :math:`n_0` is :math:`{{\mathit{ga}}^\ast}`. +#. Assert: Due to validation, :math:`{\mathit{globaladdr}}_0` is :math:`{{\mathit{ga}}^\ast}`. -#. Let :math:`n_0` be :math:`{\mathrm{alloctables}}({{{\mathit{tabletype}}}{{}[ {:=}\, {{\mathit{dt}}^\ast} ]}^\ast}, {{\mathit{ref}}_{\mathsf{t}}^\ast})`. +#. Let :math:`{\mathit{tableaddr}}_0` be :math:`{\mathrm{alloctables}}({{{\mathit{tabletype}}}{{}[ {:=}\, {{\mathit{dt}}^\ast} ]}^\ast}, {{\mathit{ref}}_{\mathsf{t}}^\ast})`. -#. Assert: Due to validation, :math:`n_0` is :math:`{{\mathit{ta}}^\ast}`. +#. Assert: Due to validation, :math:`{\mathit{tableaddr}}_0` is :math:`{{\mathit{ta}}^\ast}`. -#. Let :math:`n_0` be :math:`{\mathrm{allocmems}}({{{\mathit{memtype}}}{{}[ {:=}\, {{\mathit{dt}}^\ast} ]}^\ast})`. +#. Let :math:`{\mathit{memaddr}}_0` be :math:`{\mathrm{allocmems}}({{{\mathit{memtype}}}{{}[ {:=}\, {{\mathit{dt}}^\ast} ]}^\ast})`. -#. Assert: Due to validation, :math:`n_0` is :math:`{{\mathit{ma}}^\ast}`. +#. Assert: Due to validation, :math:`{\mathit{memaddr}}_0` is :math:`{{\mathit{ma}}^\ast}`. -#. Let :math:`n_0` be :math:`{\mathrm{alloctags}}({{{\mathit{dt}}^\ast}{}[y]^\ast})`. +#. Let :math:`{\mathit{tagaddr}}_0` be :math:`{\mathrm{alloctags}}({{{\mathit{dt}}^\ast}{}[y]^\ast})`. -#. Assert: Due to validation, :math:`n_0` is :math:`{{\mathit{aa}}^\ast}`. +#. Assert: Due to validation, :math:`{\mathit{tagaddr}}_0` is :math:`{{\mathit{aa}}^\ast}`. -#. Let :math:`n_0` be :math:`{\mathrm{allocelems}}({{{\mathit{elemtype}}}{{}[ {:=}\, {{\mathit{dt}}^\ast} ]}^\ast}, {{{\mathit{ref}}_{\mathsf{e}}^\ast}^\ast})`. +#. Let :math:`{\mathit{elemaddr}}_0` be :math:`{\mathrm{allocelems}}({{{\mathit{elemtype}}}{{}[ {:=}\, {{\mathit{dt}}^\ast} ]}^\ast}, {{{\mathit{ref}}_{\mathsf{e}}^\ast}^\ast})`. -#. Assert: Due to validation, :math:`n_0` is :math:`{{\mathit{ea}}^\ast}`. +#. Assert: Due to validation, :math:`{\mathit{elemaddr}}_0` is :math:`{{\mathit{ea}}^\ast}`. -#. Let :math:`n_0` be :math:`{\mathrm{allocdatas}}({\mathsf{ok}^{{|{{\mathit{data}}^\ast}|}}}, {{{\mathit{byte}}^\ast}^\ast})`. +#. Let :math:`{\mathit{dataaddr}}_0` be :math:`{\mathrm{allocdatas}}({\mathsf{ok}^{{|{{\mathit{data}}^\ast}|}}}, {{{\mathit{byte}}^\ast}^\ast})`. -#. Assert: Due to validation, :math:`n_0` is :math:`{{\mathit{da}}^\ast}`. +#. Assert: Due to validation, :math:`{\mathit{dataaddr}}_0` is :math:`{{\mathit{da}}^\ast}`. #. Return :math:`{\mathit{moduleinst}}`. @@ -24450,9 +24444,7 @@ The instruction sequence :math:`(\mathsf{block}~{\mathit{blocktype}}~{{\mathit{i #. Execute the sequence :math:`{{\mathit{instr}}_{\mathsf{d}}^\ast}`. -#. If :math:`{{\mathit{instr}}_{\mathsf{s}}^?}` is defined, then: - - a. Execute the instruction :math:`{\mathit{instr}}_{\mathsf{s}}`. +#. Execute the sequence :math:`{{\mathit{instr}}_{\mathsf{s}}^?}`. #. Pop the evaluation context :math:`({\mathsf{frame}}_{0}\,\{~f~\})` from the stack. @@ -25126,7 +25118,7 @@ Instrtype_sub - the instruction type t_11* ->_ x_1* t_12* matches the instruction type t_21* ->_ x_2* t_22* if: - the value type sequence t_21* matches the value type sequence t_11*. - the value type sequence t_12* matches the value type sequence t_22*. - - the index sequence x* is $setminus_(localidx, x_2*, x_1*). + - the local index sequence x* is $setminus_(localidx, x_2*, x_1*). - |x*| is |t*|. - For all x in x*: - the local type C.LOCALS[x] exists. @@ -26329,7 +26321,7 @@ Module_ok - $disjoint_(name, nm*) is true. - the context C is C' with .GLOBALS appended by gt* with .TABLES appended by tt_I* :: tt* with .MEMS appended by mt_I* :: mt* with .TAGS appended by jt_I* :: jt* with .ELEMS appended by rt* with .DATAS appended by ok*. - the context C' is { TYPES: dt'*; RECS: []; FUNCS: dt_I* :: dt*; GLOBALS: gt_I*; TABLES: []; MEMS: []; TAGS: []; ELEMS: []; DATAS: []; LOCALS: []; LABELS: []; RETURN: ?(); REFS: x*; }. - - the index sequence x* is $funcidx_nonfuncs((global*, table*, mem*, elem*, data*)). + - the function index sequence x* is $funcidx_nonfuncs((global*, table*, mem*, elem*, data*)). - the defined type sequence dt_I* is $funcsxt(xt_I*). - the global type sequence gt_I* is $globalsxt(xt_I*). - the table type sequence tt_I* is $tablesxt(xt_I*). @@ -30133,20 +30125,20 @@ allocmodule module externaddr* val_G* ref_T* ref_E** 29. Let (FUNC x local* expr_F)* be func*. 30. Let xi* be $allocexports({ TYPES: []; FUNCS: fa_I* :: fa*; GLOBALS: ga_I* :: ga*; TABLES: ta_I* :: ta*; MEMS: ma_I* :: ma*; TAGS: aa_I* :: aa*; ELEMS: []; DATAS: []; EXPORTS: []; }, export*). 31. Let moduleinst be { TYPES: dt*; FUNCS: fa_I* :: fa*; GLOBALS: ga_I* :: ga*; TABLES: ta_I* :: ta*; MEMS: ma_I* :: ma*; TAGS: aa_I* :: aa*; ELEMS: ea*; DATAS: da*; EXPORTS: xi*; }. -32. Let n_0 be $allocfuncs(dt*[x]*, (FUNC x local* expr_F)*, moduleinst^|func*|). -33. Assert: Due to validation, (n_0 = fa*). -34. Let n_0 be $allocglobals($subst_all_globaltype(globaltype, dt*)*, val_G*). -35. Assert: Due to validation, (n_0 = ga*). -36. Let n_0 be $alloctables($subst_all_tabletype(tabletype, dt*)*, ref_T*). -37. Assert: Due to validation, (n_0 = ta*). -38. Let n_0 be $allocmems($subst_all_memtype(memtype, dt*)*). -39. Assert: Due to validation, (n_0 = ma*). -40. Let n_0 be $alloctags(dt*[y]*). -41. Assert: Due to validation, (n_0 = aa*). -42. Let n_0 be $allocelems($subst_all_reftype(elemtype, dt*)*, ref_E**). -43. Assert: Due to validation, (n_0 = ea*). -44. Let n_0 be $allocdatas(OK^|data*|, byte**). -45. Assert: Due to validation, (n_0 = da*). +32. Let funcaddr_0 be $allocfuncs(dt*[x]*, (FUNC x local* expr_F)*, moduleinst^|func*|). +33. Assert: Due to validation, (funcaddr_0 = fa*). +34. Let globaladdr_0 be $allocglobals($subst_all_globaltype(globaltype, dt*)*, val_G*). +35. Assert: Due to validation, (globaladdr_0 = ga*). +36. Let tableaddr_0 be $alloctables($subst_all_tabletype(tabletype, dt*)*, ref_T*). +37. Assert: Due to validation, (tableaddr_0 = ta*). +38. Let memaddr_0 be $allocmems($subst_all_memtype(memtype, dt*)*). +39. Assert: Due to validation, (memaddr_0 = ma*). +40. Let tagaddr_0 be $alloctags(dt*[y]*). +41. Assert: Due to validation, (tagaddr_0 = aa*). +42. Let elemaddr_0 be $allocelems($subst_all_reftype(elemtype, dt*)*, ref_E**). +43. Assert: Due to validation, (elemaddr_0 = ea*). +44. Let dataaddr_0 be $allocdatas(OK^|data*|, byte**). +45. Assert: Due to validation, (dataaddr_0 = da*). 46. Return moduleinst. runelem_ x (ELEM rt e^n elemmode_u1) @@ -30213,8 +30205,7 @@ instantiate z module externaddr* 30. Push the evaluation context (FRAME_ 0 { f }) to the stack. 31. Execute the sequence (instr_E*). 32. Execute the sequence (instr_D*). -33. If instr_S? is defined, then: - a. Execute the instruction instr_S. +33. Execute the sequence (instr_S?). 34. Pop the evaluation context (FRAME_ 0 { f }) from the stack. 35. Return f.MODULE. From 237dab9160d9027e89a8e18c4cf8a56fe29f1d7b Mon Sep 17 00:00:00 2001 From: Andreas Rossberg Date: Mon, 9 Dec 2024 12:05:16 +0100 Subject: [PATCH 07/10] Fix trace --- spectec/src/frontend/elab.ml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spectec/src/frontend/elab.ml b/spectec/src/frontend/elab.ml index 81c26741a2..faf458325d 100644 --- a/spectec/src/frontend/elab.ml +++ b/spectec/src/frontend/elab.ml @@ -281,11 +281,11 @@ let indent n = String.make (2*n) ' ' let rec msg_trace n = function | Trace (_, _, [trace]) -> msg_trace n trace | Trace (at, msg, traces) -> - indent n ^ string_of_region at ^ ": " ^ msg_traces (n + 1) msg traces + indent n ^ string_of_region at ^ ": " ^ msg_traces n msg traces and msg_traces n msg = function | [] -> Printf.printf "[msg] %s\n%!" msg;msg - | traces -> msg ^ ", because\n" ^ String.concat "\n" (List.map (msg_trace n) traces) + | traces -> msg ^ ", because\n" ^ String.concat "\n" (List.map (msg_trace (n + 1)) traces) let rec error_trace = function | Trace (_, _, [trace]) -> error_trace trace @@ -1340,11 +1340,11 @@ and elab_exp_plain' env e t : Il.exp' attempt = let iter2' = elab_iterexp env iter2 in let* e1' = elab_exp env e1 t1 in let e' = Il.IterE (e1', iter2') in - match iter, iter2 with + match iter2, iter with | Opt, Opt -> Ok e' | Opt, _ -> Ok (Il.LiftE (e' $$ e.at % (Il.IterT (elab_typ env t1, Opt) $ e1.at))) - | _, Opt -> fail_typ env e.at "iteration expression" t + | _, Opt -> fail_typ env e.at "iteration" t | _, _ -> Ok e' and elab_exp_list env es ts at : Il.exp list attempt = From 753bfb70773d38224ef7e548e9862e832600f62c Mon Sep 17 00:00:00 2001 From: Andreas Rossberg Date: Wed, 11 Dec 2024 14:12:50 +0100 Subject: [PATCH 08/10] Use backtracking consistently for sequences; introduce list exp for disambiguation --- spectec/doc/Language.md | 1 + spectec/spec/wasm-2.0/8-reduction.watsup | 2 +- spectec/spec/wasm-3.0/4-numerics.watsup | 2 +- spectec/src/al/al_util.ml | 4 +- spectec/src/backend-interpreter/construct.ml | 12 +- spectec/src/backend-latex/render.ml | 27 +- spectec/src/backend-prose/render.ml | 6 +- spectec/src/el/ast.ml | 3 +- spectec/src/el/convert.ml | 10 +- spectec/src/el/eq.ml | 3 +- spectec/src/el/free.ml | 14 +- spectec/src/el/iter.ml | 7 +- spectec/src/el/print.ml | 6 +- spectec/src/el/subst.ml | 3 +- spectec/src/exe-watsup/main.ml | 6 +- spectec/src/frontend/dim.ml | 3 +- spectec/src/frontend/elab.ml | 591 +- spectec/src/frontend/eval.ml | 7 +- spectec/src/frontend/parser.mly | 92 +- spectec/src/middlend/dune | 1 - spectec/src/middlend/wild.ml | 255 - spectec/src/middlend/wild.mli | 1 - spectec/src/util/source.ml | 9 +- spectec/src/util/source.mli | 3 + spectec/test-frontend/TEST.md | 272 +- spectec/test-latex/TEST.md | 2 +- spectec/test-middlend/TEST.md | 9753 +----------------- spectec/test-prose/TEST.md | 369 +- 28 files changed, 1159 insertions(+), 10305 deletions(-) delete mode 100644 spectec/src/middlend/wild.ml delete mode 100644 spectec/src/middlend/wild.mli diff --git a/spectec/doc/Language.md b/spectec/doc/Language.md index c666f12039..021d86e4b2 100644 --- a/spectec/doc/Language.md +++ b/spectec/doc/Language.md @@ -133,6 +133,7 @@ exp ::= "eps" empty sequence exp exp sequencing exp iter iteration + "[" exp* "]" list exp "[" arith "]" list indexing exp "[" arith ":" arith "]" list slicing exp "[" path "=" exp "]" list update diff --git a/spectec/spec/wasm-2.0/8-reduction.watsup b/spectec/spec/wasm-2.0/8-reduction.watsup index 450f06de19..01cfb44ea7 100644 --- a/spectec/spec/wasm-2.0/8-reduction.watsup +++ b/spectec/spec/wasm-2.0/8-reduction.watsup @@ -365,7 +365,7 @@ rule Step_pure/vcvtop-half: rule Step_pure/vcvtop-zero: (VCONST V128 c_1) (VCVTOP (nt_2 X M_2) (nt_1 X M_1) vcvtop eps zero) ~> (VCONST V128 c) -- if ci* = $lanes_(nt_1 X M_1, c_1) - -- if cj** = $setproduct_(lane_(nt_2), ($vcvtop__(nt_1 X M_1, nt_2 X M_2, vcvtop, ci)* ++ $zero(nt_2)^M_1)) + -- if cj** = $setproduct_(lane_(nt_2), ($vcvtop__(nt_1 X M_1, nt_2 X M_2, vcvtop, ci)* ++ [$zero(nt_2)]^M_1)) -- if c <- $invlanes_(nt_2 X M_2, cj*)* diff --git a/spectec/spec/wasm-3.0/4-numerics.watsup b/spectec/spec/wasm-3.0/4-numerics.watsup index ea594e1dc0..4ae1dc1ca0 100644 --- a/spectec/spec/wasm-3.0/4-numerics.watsup +++ b/spectec/spec/wasm-3.0/4-numerics.watsup @@ -674,7 +674,7 @@ def $vcvtop__(Lnn_1 X M_1, Lnn_2 X M_2, vcvtop, half, eps, v_1) = v -- if v <- $invlanes_(Lnn_2 X M_2, c*)* def $vcvtop__(Lnn_1 X M_1, Lnn_2 X M_2, vcvtop, eps, zero, v_1) = v -- if c_1* = $lanes_(Lnn_1 X M_1, v_1) - -- if c** = $setproduct_(lane_(Lnn_2), ($lcvtop__(Lnn_1 X M_1, Lnn_2 X M_2, vcvtop, c_1)* ++ $zero(Lnn_2)^M_1)) + -- if c** = $setproduct_(lane_(Lnn_2), ($lcvtop__(Lnn_1 X M_1, Lnn_2 X M_2, vcvtop, c_1)* ++ [$zero(Lnn_2)]^M_1)) -- if v <- $invlanes_(Lnn_2 X M_2, c*)* def $vnarrowop__(Jnn_1 X M_1, Jnn_2 X M_2, sx, v_1, v_2) = v diff --git a/spectec/src/al/al_util.ml b/spectec/src/al/al_util.ml index 31e703c1de..54f291fd45 100644 --- a/spectec/src/al/al_util.ml +++ b/spectec/src/al/al_util.ml @@ -111,8 +111,8 @@ let iter_var ?(at = no) x iter t = ~at:at ~note:iter_note - let some x = caseV (x, [optV (Some (tupV []))]) -let none x = caseV (x, [optV None]) +let some x = optV (Some (caseV (x, []))) +let none _x = optV None (* Failures *) diff --git a/spectec/src/backend-interpreter/construct.ml b/spectec/src/backend-interpreter/construct.ml index 3f97003d69..3100953fc8 100644 --- a/spectec/src/backend-interpreter/construct.ml +++ b/spectec/src/backend-interpreter/construct.ml @@ -94,18 +94,18 @@ let al_to_bool = unwrap_boolv (* Destruct type *) let al_to_null: value -> null = function - | CaseV ("NULL", [ OptV None ]) -> NoNull - | CaseV ("NULL", [ OptV _ ]) -> Null + | OptV None -> NoNull + | OptV _ -> Null | v -> error_value "null" v let al_to_final: value -> final = function - | CaseV ("FINAL", [ OptV None ]) -> NoFinal - | CaseV ("FINAL", [ OptV _ ]) -> Final + | OptV None -> NoFinal + | OptV _ -> Final | v -> error_value "final" v let al_to_mut: value -> mut = function - | CaseV ("MUT", [ OptV None ]) -> Cons - | CaseV ("MUT", [ OptV _ ]) -> Var + | OptV None -> Cons + | OptV _ -> Var | v -> error_value "mut" v let rec al_to_storage_type: value -> storage_type = function diff --git a/spectec/src/backend-latex/render.ml b/spectec/src/backend-latex/render.ml index b5d90201f6..a79bd95d1a 100644 --- a/spectec/src/backend-latex/render.ml +++ b/spectec/src/backend-latex/render.ml @@ -70,13 +70,13 @@ let as_arith_exp e = let as_paren_exp e = match e.it with - | ParenE (e1, _) -> e1 + | ParenE e1 -> e1 | _ -> e let as_tup_exp e = match e.it with | TupE es -> es - | ParenE (e1, _) -> [e1] + | ParenE e1 -> [e1] | _ -> [e] let as_seq_exp e = @@ -86,7 +86,7 @@ let as_seq_exp e = let rec fuse_exp e deep = match e.it with - | ParenE (e1, b) when deep -> ParenE (fuse_exp e1 false, b) $ e.at + | ParenE e1 when deep -> ParenE (fuse_exp e1 false) $ e.at | IterE (e1, iter) -> IterE (fuse_exp e1 deep, iter) $ e.at | SeqE (e1::es) -> List.fold_left (fun e1 e2 -> FuseE (e1, e2) $ e.at) e1 es | _ -> e @@ -638,6 +638,7 @@ let rec expand_iter env ctxt iter = | ListN (e, id_opt) -> ListN (expand_exp env ctxt e, id_opt) and expand_exp env ctxt e = + (* Involves side effects, be careful to order recursive calls! *) (match e.it with | AtomE atom -> let atom' = expand_atom env ctxt atom in @@ -665,6 +666,9 @@ and expand_exp env ctxt e = | SeqE es -> let es' = List.map (expand_exp env ctxt) es in SeqE es' + | ListE es -> + let es' = List.map (expand_exp env ctxt) es in + ListE es' | IdxE (e1, e2) -> let e1' = expand_exp env ctxt e1 in let e2' = expand_exp env ctxt e2 in @@ -708,9 +712,9 @@ and expand_exp env ctxt e = LenE e1' | SizeE id -> SizeE id - | ParenE (e1, b) -> + | ParenE e1 -> let e1' = expand_exp env ctxt e1 in - ParenE (e1', b) + ParenE e1' | TupE es -> let es' = List.map (expand_exp env ctxt) es in TupE es' @@ -1102,7 +1106,7 @@ let rec render_iter env = function | Opt -> "^?" | List -> "^\\ast" | List1 -> "^{+}" - | ListN ({it = ParenE (e, _); _}, None) | ListN (e, None) -> + | ListN ({it = ParenE e; _}, None) | ListN (e, None) -> "^{" ^ render_exp env e ^ "}" | ListN (e, Some id) -> "^{" ^ render_varid env id ^ "<" ^ render_exp env e ^ "}" @@ -1222,7 +1226,7 @@ and render_exp env e = | TextE t -> "\\mbox{\\texttt{`" ^ t ^ "'}}" | CvtE (e1, _) -> render_exp env e1 | UnE (op, e2) -> "{" ^ render_unop op ^ render_exp env e2 ^ "}" - | BinE (e1, `PowOp, ({it = ParenE (e2, _); _ } | e2)) -> + | BinE (e1, `PowOp, ({it = ParenE e2; _ } | e2)) -> "{" ^ render_exp env e1 ^ "^{" ^ render_exp env e2 ^ "}}" | BinE (({it = NumE (`DecOp, `Nat _); _} as e1), `MulOp, ({it = VarE _ | CallE (_, []) | ParenE _; _ } as e2)) -> @@ -1252,6 +1256,7 @@ Printf.eprintf "[render %s:X @ %s] try expansion\n%!" (Source.string_of_region e ) | _ -> render_exp_seq env es ) + | ListE es -> "{}[" ^ render_exp_seq env es ^ "]" | IdxE (e1, e2) -> render_exp env e1 ^ "{}[" ^ render_exp env e2 ^ "]" | SliceE (e1, e2, e3) -> render_exp env e1 ^ @@ -1273,10 +1278,10 @@ Printf.eprintf "[render %s:X @ %s] try expansion\n%!" (Source.string_of_region e | MemE (e1, e2) -> render_exp env e1 ^ " \\in " ^ render_exp env e2 | LenE e1 -> "{|" ^ render_exp env e1 ^ "|}" | SizeE id -> "||" ^ render_gramid env id ^ "||" - | ParenE ({it = SeqE [{it = AtomE atom; _}; _]; _} as e1, _) + | ParenE ({it = SeqE [{it = AtomE atom; _}; _]; _} as e1) when render_atom env atom = "" -> render_exp env e1 - | ParenE (e1, _) -> "(" ^ render_exp env e1 ^ ")" + | ParenE e1 -> "(" ^ render_exp env e1 ^ ")" | TupE es -> "(" ^ render_exps ", " env es ^ ")" | InfixE (e1, atom, e2) -> let id = typed_id atom in @@ -1323,7 +1328,7 @@ Printf.eprintf "[render %s:X @ %s] try expansion\n%!" (Source.string_of_region e let es = e2' :: flatten_fuse_exp_rev e1 in String.concat "" (List.map (fun e -> "{" ^ render_exp env e ^ "}") (List.rev es)) | UnparenE {it = ArithE e1; _} -> render_exp env (UnparenE e1 $ e.at) - | UnparenE ({it = ParenE (e1, _); _} | e1) -> render_exp env e1 + | UnparenE ({it = ParenE e1; _} | e1) -> render_exp env e1 | HoleE `None -> "" | HoleE _ -> error e.at "misplaced hole" | LatexE s -> s @@ -1497,7 +1502,7 @@ and render_sym_seq env = function and render_prod env prod : row list = let (g, e, prems) = prod.it in match e.it, prems with - | (TupE [] | ParenE ({it = SeqE []; _}, _)), [] -> + | (TupE [] | ParenE {it = SeqE []; _}), [] -> [Row [Col (render_sym env g)]] | _ when not env.config.display -> prefix_rows_hd diff --git a/spectec/src/backend-prose/render.ml b/spectec/src/backend-prose/render.ml index 531db4877c..fc4f1fbbe7 100644 --- a/spectec/src/backend-prose/render.ml +++ b/spectec/src/backend-prose/render.ml @@ -236,7 +236,7 @@ and al_to_el_expr expr = let ele = match ele.it with | El.Ast.IterE (_, eliter2) when eliter2 <> eliter -> - El.Ast.ParenE (ele, `Insig) $ ele.at + El.Ast.ParenE ele $ ele.at | _ -> ele in Some (El.Ast.IterE (ele, eliter)) @@ -250,7 +250,7 @@ and al_to_el_expr expr = (match elal, elel with | _, [] -> Some ele | None :: Some _ :: _, _ -> Some ele - | _ -> Some (El.Ast.ParenE (ele $ no_region, `Insig)) + | _ -> Some (El.Ast.ParenE (ele $ no_region)) ) | Al.Ast.OptE (Some e) -> let* ele = al_to_el_expr e in @@ -788,7 +788,7 @@ let render_atom_title env name params = let params = List.filter_map (fun a -> match a.it with Al.Ast.ExpA e -> Some e | _ -> None) params in let expr = Al.Al_util.caseE (op, params) ~at:no_region ~note:Al.Al_util.no_note in match al_to_el_expr expr with - | Some ({ it = El.Ast.ParenE (exp, _); _ }) -> render_el_exp env exp + | Some ({ it = El.Ast.ParenE exp; _ }) -> render_el_exp env exp | Some exp -> render_el_exp env exp | None -> render_expr' env expr diff --git a/spectec/src/el/ast.ml b/spectec/src/el/ast.ml index b855bad0e1..595c2d818f 100644 --- a/spectec/src/el/ast.ml +++ b/spectec/src/el/ast.ml @@ -86,6 +86,7 @@ and exp' = | CmpE of exp * cmpop * exp (* exp cmpop exp *) | EpsE (* `eps` *) | SeqE of exp list (* exp exp *) + | ListE of exp list (* `[` exp* `]` *) | IdxE of exp * exp (* exp `[` exp `]` *) | SliceE of exp * exp * exp (* exp `[` exp `:` exp `]` *) | UpdE of exp * path * exp (* exp `[` path `=` exp `]` *) @@ -97,7 +98,7 @@ and exp' = | MemE of exp * exp (* exp `<-` exp *) | LenE of exp (* `|` exp `|` *) | SizeE of id (* `||` exp `||` *) - | ParenE of exp * [`Sig | `Insig] (* `(` exp `)` *) + | ParenE of exp (* `(` exp `)` *) | TupE of exp list (* `(` list2(exp, `,`) `)` *) | InfixE of exp * atom * exp (* exp atom exp *) | BrackE of atom * exp * atom (* ``` ([{ exp }]) *) diff --git a/spectec/src/el/convert.ml b/spectec/src/el/convert.ml index fba43ed368..39d9be46db 100644 --- a/spectec/src/el/convert.ml +++ b/spectec/src/el/convert.ml @@ -68,7 +68,7 @@ let rec typ_of_exp e = (match e.it with | VarE (id, []) -> (typ_of_varid id).it | VarE (id, args) -> VarT (id, args) - | ParenE (e1, _) -> ParenT (typ_of_exp e1) + | ParenE e1 -> ParenT (typ_of_exp e1) | TupE es -> TupT (List.map typ_of_exp es) | IterE (e1, iter) -> IterT (typ_of_exp e1, iter) | StrE efs -> StrT (map_nl_list typfield_of_expfield efs) @@ -87,7 +87,7 @@ let rec exp_of_typ t = (match t.it with | VarT (id, args) -> VarE (id, args) | BoolT | NumT _ | TextT -> VarE (varid_of_typ t, []) - | ParenT t1 -> ParenE (exp_of_typ t1, `Insig) + | ParenT t1 -> ParenE (exp_of_typ t1) | TupT ts -> TupE (List.map exp_of_typ ts) | IterT (t1, iter) -> IterE (exp_of_typ t1, iter) | StrT tfs -> StrE (map_nl_list expfield_of_typfield tfs) @@ -128,7 +128,7 @@ let rec pat_of_typ' s t : exp option = ) | ParenT t1 -> let* e1 = pat_of_typ' s t1 in - Some (ParenE (e1, `Insig) $ t.at) + Some (ParenE e1 $ t.at) | TupT ts -> let* es = pats_of_typs' s ts in Some (TupE es $ t.at) @@ -157,7 +157,7 @@ let rec sym_of_exp e = | TextE s -> TextG s | EpsE -> EpsG | SeqE es -> SeqG (List.map (fun e -> Elem (sym_of_exp e)) es) - | ParenE (e1, _) -> ParenG (sym_of_exp e1) + | ParenE e1 -> ParenG (sym_of_exp e1) | TupE es -> TupG (List.map sym_of_exp es) | IterE (e1, iter) -> IterG (sym_of_exp e1, iter) | TypE (e1, t) -> AttrG (e1, sym_of_exp (exp_of_typ t)) @@ -174,7 +174,7 @@ let rec exp_of_sym g = | TextG t -> TextE t | EpsG -> EpsE | SeqG gs -> SeqE (map_filter_nl_list exp_of_sym gs) - | ParenG g1 -> ParenE (exp_of_sym g1, `Insig) + | ParenG g1 -> ParenE (exp_of_sym g1) | TupG gs -> TupE (List.map exp_of_sym gs) | IterG (g1, iter) -> IterE (exp_of_sym g1, iter) | ArithG e -> ArithE e diff --git a/spectec/src/el/eq.ml b/spectec/src/el/eq.ml index e6529756cd..f7709b8506 100644 --- a/spectec/src/el/eq.ml +++ b/spectec/src/el/eq.ml @@ -87,6 +87,7 @@ and eq_exp e1 e2 = | CmpE (e11, op1, e12), CmpE (e21, op2, e22) -> eq_exp e11 e21 && op1 = op2 && eq_exp e12 e22 | LenE e11, LenE e21 + | ParenE e11, ParenE e21 | ArithE e11, ArithE e21 | UnparenE e11, UnparenE e21 -> eq_exp e11 e21 | IdxE (e11, e12), IdxE (e21, e22) @@ -99,8 +100,8 @@ and eq_exp e1 e2 = | UpdE (e11, p1, e12), UpdE (e21, p2, e22) | ExtE (e11, p1, e12), ExtE (e21, p2, e22) -> eq_exp e11 e21 && eq_path p1 p2 && eq_exp e12 e22 - | ParenE (e11, b1), ParenE (e21, b2) -> eq_exp e11 e21 && b1 = b2 | SeqE es1, SeqE es2 + | ListE es1, ListE es2 | TupE es1, TupE es2 -> eq_list eq_exp es1 es2 | StrE efs1, StrE efs2 -> eq_nl_list eq_expfield efs1 efs2 | DotE (e11, atom1), DotE (e21, atom2) -> eq_exp e11 e21 && eq_atom atom1 atom2 diff --git a/spectec/src/el/free.ml b/spectec/src/el/free.ml index f33207d16a..17b2cd5364 100644 --- a/spectec/src/el/free.ml +++ b/spectec/src/el/free.ml @@ -132,13 +132,13 @@ and free_exp e = | VarE (id, as_) -> free_varid id + free_list free_arg as_ | AtomE _ | BoolE _ | NumE _ | TextE _ | EpsE | HoleE _ | LatexE _ -> empty | CvtE (e1, _) | UnE (_, e1) | DotE (e1, _) | LenE e1 - | ParenE (e1, _) | BrackE (_, e1, _) | ArithE e1 | UnparenE e1 -> free_exp e1 + | ParenE e1 | BrackE (_, e1, _) | ArithE e1 | UnparenE e1 -> free_exp e1 | SizeE id -> free_gramid id | BinE (e1, _, e2) | CmpE (e1, _, e2) | IdxE (e1, e2) | CommaE (e1, e2) | CatE (e1, e2) | MemE (e1, e2) | InfixE (e1, _, e2) | FuseE (e1, e2) -> free_exp e1 + free_exp e2 | SliceE (e1, e2, e3) -> free_exp e1 + free_exp e2 + free_exp e3 - | SeqE es | TupE es -> free_list free_exp es + | SeqE es | ListE es | TupE es -> free_list free_exp es | UpdE (e1, p, e2) | ExtE (e1, p, e2) -> free_exp e1 + free_path p + free_exp e2 | StrE efs -> free_nl_list free_expfield efs @@ -161,12 +161,12 @@ and det_exp e = | VarE (id, []) -> bound_varid id | VarE _ -> assert false | CvtE (e1, _) | UnE (#Num.unop, e1) - | ParenE (e1, _) | BrackE (_, e1, _) | ArithE e1 -> det_exp e1 + | ParenE e1 | BrackE (_, e1, _) | ArithE e1 -> det_exp e1 (* We consider arithmetic expressions determinate, * since we sometimes need to use invertible formulas. *) | BinE (e1, #Num.binop, e2) | InfixE (e1, _, e2) -> det_exp e1 + det_exp e2 - | SeqE es | TupE es -> free_list det_exp es + | SeqE es | ListE es | TupE es -> free_list det_exp es | StrE efs -> free_nl_list det_expfield efs | IterE (e1, iter) -> det_exp e1 + det_iter iter (* As a special hack to work with bijective functions, @@ -191,9 +191,9 @@ and det_iter iter = and idx_exp e = match e.it with | VarE _ -> empty - | ParenE (e1, _) | BrackE (_, e1, _) | ArithE e1 -> idx_exp e1 + | ParenE e1 | BrackE (_, e1, _) | ArithE e1 -> idx_exp e1 | InfixE (e1, _, e2) -> idx_exp e1 + idx_exp e2 - | SeqE es | TupE es -> free_list idx_exp es + | SeqE es | ListE es | TupE es -> free_list idx_exp es | StrE efs -> free_nl_list idx_expfield efs | IterE (e1, iter) -> idx_exp e1 + idx_iter iter | CallE (_, as_) -> free_list idx_arg as_ @@ -214,7 +214,7 @@ and det_cond_exp e = | BinE (e1, #Bool.binop, e2) -> det_cond_exp e1 + det_cond_exp e2 | CmpE (e1, `EqOp, e2) -> det_exp e1 + det_exp e2 | MemE (e1, _) -> det_exp e1 - | ParenE (e1, _) | ArithE e1 -> det_cond_exp e1 + | ParenE e1 | ArithE e1 -> det_cond_exp e1 | _ -> empty diff --git a/spectec/src/el/iter.ml b/spectec/src/el/iter.ml index caf7193cac..6aac738289 100644 --- a/spectec/src/el/iter.ml +++ b/spectec/src/el/iter.ml @@ -128,7 +128,7 @@ and exp e = | EpsE | HoleE _ | LatexE _ -> () | CvtE (e1, nt) -> exp e1; numtyp nt | UnE (op, e1) -> unop op; exp e1 - | LenE e1 | ArithE e1 | ParenE (e1, _) | UnparenE e1 -> exp e1 + | LenE e1 | ArithE e1 | ParenE e1 | UnparenE e1 -> exp e1 | DotE (e1, at) -> exp e1; atom at | SizeE x -> gramid x | BinE (e1, op, e2) -> exp e1; binop op; exp e2 @@ -136,7 +136,7 @@ and exp e = | IdxE (e1, e2) | CommaE (e1, e2) | CatE (e1, e2) | MemE (e1, e2) | FuseE (e1, e2) -> exp e1; exp e2 | SliceE (e1, e2, e3) -> exp e1; exp e2; exp e3 - | SeqE es | TupE es -> list exp es + | SeqE es | ListE es | TupE es -> list exp es | UpdE (e1, p, e2) | ExtE (e1, p, e2) -> exp e1; path p; exp e2 | StrE efs -> nl_list expfield efs | CallE (x, as_) -> defid x; args as_ @@ -277,6 +277,7 @@ and clone_exp e = | BinE (e1, op, e2) -> BinE (clone_exp e1, op, clone_exp e2) | CmpE (e1, op, e2) -> CmpE (clone_exp e1, op, clone_exp e2) | SeqE es -> SeqE (List.map clone_exp es) + | ListE es -> ListE (List.map clone_exp es) | IdxE (e1, e2) -> IdxE (clone_exp e1, clone_exp e2) | SliceE (e1, e2, e3) -> SliceE (clone_exp e1, clone_exp e2, clone_exp e3) | UpdE (e1, p, e2) -> UpdE (clone_exp e1, clone_path p, clone_exp e2) @@ -287,7 +288,7 @@ and clone_exp e = | CatE (e1, e2) -> CatE (clone_exp e1, clone_exp e2) | MemE (e1, e2) -> MemE (clone_exp e1, clone_exp e2) | LenE e1 -> LenE (clone_exp e1) - | ParenE (e1, b) -> ParenE (clone_exp e1, b) + | ParenE e1 -> ParenE (clone_exp e1) | TupE es -> TupE (List.map clone_exp es) | InfixE (e1, atom, e2) -> InfixE (clone_exp e1, clone_atom atom, clone_exp e2) | BrackE (atom1, e1, atom2) -> BrackE (clone_atom atom1, clone_exp e1, clone_atom atom2) diff --git a/spectec/src/el/print.ml b/spectec/src/el/print.ml index bb5e1a9f26..0013f2202f 100644 --- a/spectec/src/el/print.ml +++ b/spectec/src/el/print.ml @@ -138,7 +138,8 @@ and string_of_exp e = | CmpE (e1, op, e2) -> string_of_exp e1 ^ space string_of_cmpop op ^ string_of_exp e2 | EpsE -> "eps" - | SeqE es -> "{" ^ string_of_exps " " es ^ "}" + | SeqE es -> string_of_exps " " es + | ListE es -> "[" ^ string_of_exps " " es ^ "]" | IdxE (e1, e2) -> string_of_exp e1 ^ "[" ^ string_of_exp e2 ^ "]" | SliceE (e1, e2, e3) -> string_of_exp e1 ^ @@ -156,8 +157,7 @@ and string_of_exp e = | MemE (e1, e2) -> string_of_exp e1 ^ " <- " ^ string_of_exp e2 | LenE e1 -> "|" ^ string_of_exp e1 ^ "|" | SizeE id -> "||" ^ string_of_gramid id ^ "||" - | ParenE (e, signif) -> - "(" ^ string_of_exp e ^ ")" ^ (match signif with `Sig -> "!" | `Insig -> "") + | ParenE e -> "(" ^ string_of_exp e ^ ")" | TupE es -> "(" ^ string_of_exps ", " es ^ ")" | InfixE (e1, atom, e2) -> string_of_exp e1 ^ space string_of_atom atom ^ string_of_exp e2 diff --git a/spectec/src/el/subst.ml b/spectec/src/el/subst.ml index 9641d112d8..c8ee0c9f0b 100644 --- a/spectec/src/el/subst.ml +++ b/spectec/src/el/subst.ml @@ -131,6 +131,7 @@ and subst_exp s e = | CmpE (e1, op, e2) -> CmpE (subst_exp s e1, op, subst_exp s e2) | EpsE -> EpsE | SeqE es -> SeqE (subst_list subst_exp s es) + | ListE es -> ListE (subst_list subst_exp s es) | IdxE (e1, e2) -> IdxE (subst_exp s e1, subst_exp s e2) | SliceE (e1, e2, e3) -> SliceE (subst_exp s e1, subst_exp s e2, subst_exp s e3) | UpdE (e1, p, e2) -> UpdE (subst_exp s e1, subst_path s p, subst_exp s e2) @@ -142,7 +143,7 @@ and subst_exp s e = | MemE (e1, e2) -> MemE (subst_exp s e1, subst_exp s e2) | LenE e1 -> LenE (subst_exp s e1) | SizeE id -> SizeE (subst_gramid s id) - | ParenE (e1, b) -> ParenE (subst_exp s e1, b) + | ParenE e1 -> ParenE (subst_exp s e1) | TupE es -> TupE (subst_list subst_exp s es) | InfixE (e1, atom, e2) -> InfixE (subst_exp s e1, atom, subst_exp s e2) | BrackE (l, e1, r) -> BrackE (l, subst_exp s e1, r) diff --git a/spectec/src/exe-watsup/main.ml b/spectec/src/exe-watsup/main.ml index ffeca7fdb9..98c19197d4 100644 --- a/spectec/src/exe-watsup/main.ml +++ b/spectec/src/exe-watsup/main.ml @@ -17,7 +17,6 @@ type pass = | Sub | Totalize | Unthe - | Wild | Sideconditions (* This list declares the intended order of passes. @@ -27,7 +26,7 @@ passers (--all-passes, some targets), we do _not_ want to use the order of flags on the command line. *) let _skip_passes = [ Sub; Unthe ] (* Not clear how to extend them to indexed types *) -let all_passes = [ Totalize; Wild; Sideconditions ] +let all_passes = [ Totalize; Sideconditions ] type file_kind = | Spec @@ -71,21 +70,18 @@ let pass_flag = function | Sub -> "sub" | Totalize -> "totalize" | Unthe -> "the-elimination" - | Wild -> "wildcards" | Sideconditions -> "sideconditions" let pass_desc = function | Sub -> "Synthesize explicit subtype coercions" | Totalize -> "Run function totalization" | Unthe -> "Eliminate the ! operator in relations" - | Wild -> "Eliminate wildcards and equivalent expressions" | Sideconditions -> "Infer side conditions" let run_pass : pass -> Il.Ast.script -> Il.Ast.script = function | Sub -> Middlend.Sub.transform | Totalize -> Middlend.Totalize.transform | Unthe -> Middlend.Unthe.transform - | Wild -> Middlend.Wild.transform | Sideconditions -> Middlend.Sideconditions.transform diff --git a/spectec/src/frontend/dim.ml b/spectec/src/frontend/dim.ml index b89509f2c5..8998f0cb48 100644 --- a/spectec/src/frontend/dim.ml +++ b/spectec/src/frontend/dim.ml @@ -145,7 +145,7 @@ and check_exp env ctx e = | UnE (_, e1) | DotE (e1, _) | LenE e1 - | ParenE (e1, _) + | ParenE e1 | BrackE (_, e1, _) | TypE (e1, _) | ArithE e1 -> check_exp env ctx e1 @@ -168,6 +168,7 @@ and check_exp env ctx e = check_path env ctx p; check_exp env ctx e2 | SeqE es + | ListE es | TupE es -> List.iter (check_exp env ctx) es | StrE efs -> iter_nl_list (fun (_, eI) -> check_exp env ctx eI) efs | CallE (_, args) -> List.iter (check_arg env ctx) args diff --git a/spectec/src/frontend/elab.ml b/spectec/src/frontend/elab.ml index faf458325d..a1e506a781 100644 --- a/spectec/src/frontend/elab.ml +++ b/spectec/src/frontend/elab.ml @@ -35,7 +35,7 @@ let wild_exp t' = Il.VarE ("_" $ t'.at) $$ t'.at % t' let unparen_exp e = match e.it with - | ParenE (e1, _) -> e1 + | ParenE e1 -> e1 | _ -> e let unseq_exp e = @@ -44,11 +44,6 @@ let unseq_exp e = | SeqE es -> es | _ -> [e] -let tup_typ ts at = - match ts with - | [t] -> t - | _ -> TupT ts $ at - let tup_typ' ts' at = match ts' with | [t'] -> t' @@ -102,6 +97,7 @@ type env = mutable rels : rel_typ env'; mutable defs : def_typ env'; mutable grams : gram_typ env'; + mutable atoms : atom env'; (* implicit single-atom type defs *) } let new_env () = @@ -125,6 +121,7 @@ let new_env () = rels = Map.empty; defs = Map.empty; grams = Map.empty; + atoms = Map.empty; } let local_env env = @@ -219,38 +216,20 @@ let ( let* ) r f = | Ok x -> f x | Fail traces -> Fail traces -let choice' p env f1 f2 = (* backtracking *) - let env1 = local_env env in - match f1 env1 with - | Ok x -> promote_env env1 env; Ok x - | Fail traces1 -> - let env2 = local_env env in - match f2 env2 with - | Ok x -> promote_env env2 env; Ok x - | Fail traces2 -> Fail (p traces1 @ traces2) -(* -let choice' p env f1 f2 = (* backtracking *) -Printf.printf "[choice] %x\n%!" (Obj.magic env); - let env1 = local_env env in -Printf.printf "[choice left] %x -> %x\n%!" (Obj.magic env) (Obj.magic env1); - match f1 env1 with - | Ok x -> Printf.printf "[choice left] %x <- %x\n[choice]\n%!" (Obj.magic env) (Obj.magic env1); promote_env env1 env; Ok x - | Fail traces1 -> -Printf.printf "[choice left] %x ! %x\n%!" (Obj.magic env) (Obj.magic env1); -Printf.printf "|||\n%!"; - let env2 = local_env env in -Printf.printf "[choice right] %x -> %x\n%!" (Obj.magic env) (Obj.magic env2); - match f2 env2 with - | Ok x -> Printf.printf "[choice right] %x <- %x\n[choice]\n%!" (Obj.magic env) (Obj.magic env2); promote_env env2 env; Ok x - | Fail traces2 -> Printf.printf "[choice right] %x ! %x\n[choice]\n%!" (Obj.magic env) (Obj.magic env2); Fail (p traces1 @ traces2) -*) - -let choice env f1 f2 = choice' Fun.id env f1 f2 -let choice_forget env f1 f2 = choice' (Fun.const []) env f1 f2 +let rec choice env = function + | [] -> Fail [] + | f::fs -> + let env' = local_env env in + match f env' with + | Ok x -> promote_env env' env; Ok x + | Fail traces1 -> + match choice env fs with + | Ok x -> Ok x + | Fail traces2 -> Fail (traces1 @ traces2) let nest at t r = match r with - | Ok _ | Fail [_] -> r + | Ok _ -> r | Fail traces -> Fail [Trace (at, "cannot parse expression as `" ^ string_of_typ ~short:true t ^ "`", traces)] @@ -279,12 +258,11 @@ let fail_infer at construct = let indent n = String.make (2*n) ' ' let rec msg_trace n = function - | Trace (_, _, [trace]) -> msg_trace n trace | Trace (at, msg, traces) -> - indent n ^ string_of_region at ^ ": " ^ msg_traces n msg traces + indent n ^ "- " ^ string_of_range at.left at.right ^ ": " ^ msg_traces n msg traces and msg_traces n msg = function - | [] -> Printf.printf "[msg] %s\n%!" msg;msg + | [] -> msg | traces -> msg ^ ", because\n" ^ String.concat "\n" (List.map (msg_trace (n + 1)) traces) let rec error_trace = function @@ -293,7 +271,7 @@ let rec error_trace = function let checkpoint = function | Ok x -> x - | Fail [trace] -> Printf.printf "[checkpoint]\n%!";error_trace trace + | Fail [trace] -> error_trace trace | Fail _ -> assert false (* we only checkpoint around nest *) let attempt f x = @@ -304,17 +282,19 @@ let attempt f x = let typ_string env t = let t' = Eval.reduce_typ (to_eval_env env) t in - if Eq.eq_typ t t' then - "`" ^ string_of_typ ~short:true t ^ "`" + let s = string_of_typ ~short:true t in + let s' = string_of_typ ~short:true t' in + if s = s' then + "`" ^ s ^ "`" else - "`" ^ string_of_typ ~short:true t ^ "` = `" ^ string_of_typ ~short:true t' ^ "`" + "`" ^ s ^ " = " ^ s' ^ "`" let msg_typ env phrase t = - phrase ^ " does not match expected type " ^ typ_string env t + phrase ^ " does not match type " ^ typ_string env t let msg_typ2 env phrase t1 t2 reason = phrase ^ "'s type " ^ typ_string env t1 ^ - " does not match expected type " ^ typ_string env t2 ^ reason + " does not match type " ^ typ_string env t2 ^ reason let error_typ env at phrase t = error at (msg_typ env phrase t) @@ -335,7 +315,7 @@ let fail_dir_typ env at phrase dir t expected = | Check -> fail_typ env at phrase t | Infer -> fail at (phrase ^ "'s type `" ^ string_of_typ ~short:true t ^ "`" ^ - " does not match expected type " ^ expected) + " does not match type " ^ expected) (* Type Accessors *) @@ -474,9 +454,6 @@ let as_list_typ_opt env t : typ option = let as_iter_notation_typ_opt env t : (typ * iter) option = match expand_iter_notation env t with IterT (t1, iter) -> Some (t1, iter) | _ -> None -let as_opt_notation_typ_opt env t : typ option = - match expand_iter_notation env t with IterT (t1, Opt) -> Some t1 | _ -> None - let as_tup_typ_opt env t : typ list option = match expand env t with TupT ts -> Some ts | _ -> None @@ -499,8 +476,6 @@ let as_tup_typ phrase env dir t at = as_x_typ as_tup_typ_opt phrase env dir t at "(_, ..., _)" let as_iter_notation_typ phrase env dir t at = as_x_typ as_iter_notation_typ_opt phrase env dir t at "(_)*" -let as_opt_notation_typ phrase env dir t at = - as_x_typ as_opt_notation_typ_opt phrase env dir t at "(_)?" let as_empty_typ phrase env dir t at = as_x_typ as_empty_typ_opt phrase env dir t at "()" @@ -582,7 +557,6 @@ let is_x_typ as_x_typ env t = let is_empty_typ = is_x_typ as_empty_typ let is_iter_typ = is_x_typ as_iter_typ let is_iter_notation_typ = is_x_typ as_iter_notation_typ -let is_opt_notation_typ = is_x_typ as_opt_notation_typ let is_notation_typ = is_x_typ as_notation_typ let is_variant_typ = is_x_typ as_variant_typ @@ -975,24 +949,6 @@ and elab_typ_notation env tid t : Il.mixop * Il.typ list * typ list = let mixop1, ts1', ts1 = elab_typ_notation env tid t1 in merge_mixop (merge_mixop [[elab_atom l tid]] mixop1) [[elab_atom r tid]], ts1', ts1 - | ParenT t1 -> - let mixop1, ts1', ts1 = elab_typ_notation env tid t1 in - let l = Atom.LParen $$ t.at % Atom.info tid.it in - let r = Atom.RParen $$ t.at % Atom.info tid.it in - merge_mixop (merge_mixop [[l]] mixop1) [[r]], ts1', ts1 - | IterT (t1, iter) -> - (match iter with - | List1 | ListN _ -> error t.at "illegal iterator in notation type" - | _ -> - let iter' = elab_iter env iter in - let mixop1, ts1', ts1 = elab_typ_notation env tid t1 in - let tit = IterT (tup_typ ts1 t1.at, iter) $ t.at in - let t' = Il.IterT (tup_typ' ts1' t1.at, iter') $ t.at in - let op = - Atom.(match iter with Opt -> Quest | _ -> Star) $$ t.at % Atom.info tid.it in - (if mixop1 = [[]; []] then mixop1 else [List.flatten mixop1] @ [[op]]), - [t'], [tit] - ) | _ -> [[]; []], [elab_typ env t], [t] @@ -1020,24 +976,19 @@ and infer_exp env e : (Il.exp * typ) attempt = and infer_exp' env e : (Il.exp' * typ') attempt = match e.it with | VarE (id, args) -> - if args <> [] then - (* Args may only occur due to syntactic overloading with types *) - error e.at "malformed expression"; - if id.it = "_" then - fail_infer e.at "wildcard" - else - let* t = - if bound env.vars id then - Ok (find "variable" env.vars id) - else - (* If the variable itself is not yet declared, use type hint if available. *) - let* t = choice_forget env - (fun env -> attempt (find "variable" env.gvars) (strip_var_suffix id)) - (fun _env -> fail_infer e.at "variable") - in - env.vars <- bind "variable" env.vars id t; - Ok t - in Ok (Il.VarE id, t.it) + (* Args may only occur due to syntactic overloading with types *) + if args <> [] then error e.at "malformed expression"; + if id.it = "_" then fail_infer e.at "wildcard" else + let* t = + if bound env.vars id then + Ok (find "variable" env.vars id) + else if bound env.gvars (strip_var_suffix id) then + (* If the variable itself is not yet declared, use type hint. *) + let t = find "variable" env.gvars (strip_var_suffix id) in + env.vars <- bind "variable" env.vars id t; + Ok t + else fail_infer e.at "variable" + in Ok (Il.VarE id, t.it) | AtomE _ -> fail_infer e.at "atom" | BoolE b -> @@ -1071,17 +1022,18 @@ and infer_exp' env e : (Il.exp' * typ') attempt = (match infer_cmpop env op with | `Poly op' -> let* e1', e2' = - choice env + choice env [ (fun env -> let* e2', t2 = infer_exp env e2 in let* e1' = elab_exp env e1 t2 in Ok (e1', e2') - ) + ); (fun env -> let* e1', t1 = infer_exp env e1 in let* e2' = elab_exp env e2 t1 in Ok (e1', e2') - ) + ); + ] in Ok (Il.CmpE (op', `BoolT, e1', e2'), BoolT) | `Over elab_cmpop' -> @@ -1152,7 +1104,7 @@ and infer_exp' env e : (Il.exp' * typ') attempt = | SizeE id -> let _ = find "grammar" env.grams id in Ok (Il.NumE (`Nat Z.zero), NumT `NatT) - | ParenE (e1, _) | ArithE e1 -> + | ParenE e1 | ArithE e1 -> infer_exp' env e1 | TupE es -> let* es', ts = infer_exp_list env es in @@ -1165,7 +1117,7 @@ and infer_exp' env e : (Il.exp' * typ') attempt = fail_infer e.at "empty sequence" | SeqE [] -> (* treat as empty tuple, not principal *) Ok (Il.TupE [], TupT []) - | SeqE es -> (* treat as homogeneous sequence, not principal *) + | SeqE es | ListE es -> (* treat as homogeneous sequence, not principal *) let* es', ts = infer_exp_list env es in let t = List.hd ts in if List.for_all (equiv_typ env t) (List.tl ts) then @@ -1203,20 +1155,29 @@ and elab_exp env e t : Il.exp attempt = nest e.at t ( if is_iter_typ env t then let* t1, iter = as_iter_typ "" env Check t e.at in - choice env - (* Need to try plain first, otherwise something ambiguous like - * the pattern _ : t* would become [_ : t] : t*, which isn't useful. *) - (fun env -> elab_exp_plain env e t) + choice env [ + (* Try to parse as expressions of iter type as singleton element first, + (* such that ambiguous patterns like `(x*) : t**` work as expected and + * yield `[x* : t*]`. Except when the expression is a wildcard or empty, + * in which case we never want to treat it as an element, because + * otherwise patterns like `_ : t*` or `eps : t**` would become + * `[_ : t] : t*` resp `[[]]`, which isn't useful. *) (fun env -> - let* e' = elab_exp_plain env e t1 in - let t' = elab_typ env t in - Ok (lift_exp' e' iter $$ e.at % t') - ) + match e.it with + | VarE ({it = "_"; _}, []) | EpsE | SeqE [] -> fail_silent + | _ -> + let* e' = elab_exp env e t1 in + let t' = elab_typ env t in + Ok (lift_exp' e' iter $$ e.at % t') + ); + (fun env -> elab_exp_plain env e t); + ] else if is_notation_typ env t then let* t1 = as_notation_typ "" env Check t e.at in - choice env - (fun env -> elab_exp_plain env e t) - (fun env -> elab_exp_notation env (expand_id env t) e t1 t) + choice env [ + (fun env -> elab_exp_plain env e t); + (fun env -> elab_exp_notation env (expand_id env t) e t1 t); + ] else elab_exp_plain env e t ) @@ -1240,24 +1201,25 @@ and elab_exp_plain' env e t : Il.exp' attempt = | VarE (id, _) when id.it = "_" -> Ok (Il.VarE id) | VarE (id, _) -> - choice env - (fun env -> - let* e', t' = infer_exp env e in - cast_exp' "expression" env e' t' t - ) - (fun env -> - if is_iter_typ env t && id.it <> "_" then - (* Never infer an iteration type for a variable *) - let* t1, iter = as_iter_typ "" env Check t e.at in - let* e' = elab_exp env e t1 in - Ok (lift_exp' e' iter) - else if not (bound env.gvars (strip_var_suffix id)) then - let _ = () in - env.vars <- bind "variable" env.vars id t; - Ok (Il.VarE id) - else - fail_silent (* suitable error was produced by infer_exp already *) - ) + choice env [ + (fun env -> + let* e', t' = infer_exp env e in + cast_exp' "expression" env e' t' t + ); + (fun env -> + if is_iter_typ env t && id.it <> "_" then + (* Never infer an iteration type for a variable *) + let* t1, iter = as_iter_typ "" env Check t e.at in + let* e' = elab_exp env e t1 in + Ok (lift_exp' e' iter) + else if not (bound env.vars id || bound env.gvars (strip_var_suffix id)) then + let _ = () in + env.vars <- bind "variable" env.vars id t; + Ok (Il.VarE id) + else + fail_silent (* suitable error was produced by infer_exp already *) + ); + ] | SliceE (e1, e2, e3) -> let* _t' = as_list_typ "expression" env Check t e1.at in let* e1' = elab_exp env e1 t in @@ -1297,18 +1259,18 @@ and elab_exp_plain' env e t : Il.exp' attempt = let* e1' = elab_exp env e1 t in let* e2' = elab_exp env e2 t in Ok (if is_iter_typ env t then Il.CatE (e1', e2') else Il.CompE (e1', e2')) - | ParenE (e1, `Sig) when is_iter_typ env t -> - (* Significant parentheses indicate a singleton *) - let* t1, _iter = as_iter_typ "expression" env Check t e.at in - let* e1' = elab_exp env e1 t1 in - cast_exp' "expression" env e1' t1 t - | ParenE (e1, _) | ArithE e1 -> + | ParenE e1 | ArithE e1 -> elab_exp_plain' env e1 t | TupE es -> let* ts = as_tup_typ "tuple" env Check t e.at in let* es' = elab_exp_list env es ts e.at in Ok (Il.TupE es') -(* TODO: remove *) + | ListE es -> + let* t1, iter = as_iter_typ "tuple" env Check t e.at in + if iter <> List then fail_typ env e.at "list" t else + let ts = List.init (List.length es) (fun _ -> t1) in + let* es' = elab_exp_list env es ts e.at in + Ok (Il.ListE es') | SeqE [] when is_empty_typ env t -> let* e', t' = infer_exp env e in cast_exp' "empty expression" env e' t' t @@ -1334,15 +1296,13 @@ and elab_exp_plain' env e t : Il.exp' attempt = else fail_typ env e.at "expression" t | IterE (e1, iter2) -> - (* An iteration expression must match the expected type directly, - * significant parentheses have to be used otherwise *) let* t1, iter = as_iter_typ "iteration" env Check t e.at in let iter2' = elab_iterexp env iter2 in let* e1' = elab_exp env e1 t1 in let e' = Il.IterE (e1', iter2') in match iter2, iter with | Opt, Opt -> Ok e' - | Opt, _ -> + | Opt, List -> Ok (Il.LiftE (e' $$ e.at % (Il.IterT (elab_typ env t1, Opt) $ e1.at))) | _, Opt -> fail_typ env e.at "iteration" t | _, _ -> Ok e' @@ -1398,7 +1358,6 @@ and elab_exp_iter' env es (t1, iter) t at : Il.exp' attempt = let* e' = elab_exp_variant env (expand_id env t1) (SeqE es $ at) cases t1 at in Ok (lift_exp' e' iter) - (* An empty sequence represents the None case for options *) | [], Opt -> Ok (Il.OptE None) | [e1], Opt -> @@ -1407,13 +1366,12 @@ and elab_exp_iter' env es (t1, iter) t at : Il.exp' attempt = | _::_::_, Opt -> fail_typ env at "expression" t - (* An empty sequence represents the Nil case for lists *) | [], List -> Ok (Il.ListE []) - (* All other elements are either splices or (by cast injection) elements *) | e1::es2, List -> let* e1' = elab_exp env e1 t in - let* e2' = elab_exp_iter env es2 (t1, iter) t at in + let at' = Source.over_region (after_region e1.at :: List.map Source.at es2) in + let* e2' = elab_exp_iter env es2 (t1, iter) t at' in Ok (cat_exp' e1' e2') | _, (List1 | ListN _) -> @@ -1423,7 +1381,8 @@ and elab_exp_notation env tid e nt t : Il.exp attempt = (* Convert notation into applications of mixin operators *) assert (valid_tid tid); let* es', _s = elab_exp_notation' env tid e nt in - let mixop, _, _ = elab_typ_notation env tid nt in + let mixop, ts', _ = elab_typ_notation env tid nt in + assert (List.length es' = List.length ts'); Ok (Il.CaseE (mixop, tup_exp_bind' es' e.at) $$ e.at % elab_typ env t) and elab_exp_notation' env tid e t : (Il.exp list * Subst.t) attempt = @@ -1438,7 +1397,7 @@ and elab_exp_notation' env tid e t : (Il.exp list * Subst.t) attempt = let _ = elab_atom atom tid in Ok ([], Subst.empty) | InfixE (e1, atom, e2), InfixT (_, atom', _) when Atom.sub atom' atom -> - let e21 = ParenE (SeqE [] $ e2.at, `Insig) $ e2.at in + let e21 = ParenE (SeqE [] $ e2.at) $ e2.at in elab_exp_notation' env tid (InfixE (e1, atom', SeqE [e21; e2] $ e2.at) $ e.at) t | InfixE (e1, atom, e2), InfixT (t1, atom', t2) -> @@ -1455,83 +1414,33 @@ and elab_exp_notation' env tid e t : (Il.exp list * Subst.t) attempt = | SeqE [], SeqT [] -> Ok ([], Subst.empty) - (* Iterations at the end of a sequence may be inlined *) - | _, SeqT [t1] when is_iter_typ env t1 -> - elab_exp_notation' env tid e t1 - (* Optional iterations may always be inlined, use backtracking *) - | SeqE (e1::es2), SeqT (t1::ts2) when is_opt_notation_typ env t1 -> - choice env - (fun env -> - let* e1' = cast_empty "omitted sequence tail" env t1 e.at (!!!env tid t1) in - let* es2', s2 = elab_exp_notation' env tid e (SeqT ts2 $ t.at) in - Ok (e1' :: es2', s2) - ) - (fun env -> - Debug.(log_in_at "el.elab_exp_notation" e.at - (fun _ -> fmt "%s : %s # backtrack" (el_exp e) (el_typ t)) - ); - let* es1', s1 = elab_exp_notation' env tid e1 t1 in - let* es2', s2 = - elab_exp_notation' env tid (SeqE es2 $ e.at) (Subst.subst_typ s1 (SeqT ts2 $ t.at)) in - Ok (es1' @ es2', Subst.union s2 s2) - ) + | _, SeqT (t1::ts2) when is_iter_typ env t1 -> + let* t11, iter = as_iter_typ "iteration" env Check t1 e.at in + elab_exp_notation_iter env tid (unseq_exp e) (t11, iter) t1 ts2 e.at | SeqE ({it = AtomE atom; at; _}::es2), SeqT ({it = AtomT atom'; _}::_) when Atom.sub atom' atom -> - let e21 = ParenE (SeqE [] $ at, `Insig) $ at in + let e21 = ParenE (SeqE [] $ at) $ at in elab_exp_notation' env tid (SeqE ((AtomE atom' $ at) :: e21 :: es2) $ e.at) t + (* Iterations may be inlined *) | SeqE (e1::es2), SeqT (t1::ts2) -> let* es1', s1 = elab_exp_notation' env tid (unparen_exp e1) t1 in - let* es2', s2 = - elab_exp_notation' env tid (SeqE es2 $ e.at) (Subst.subst_typ s1 (SeqT ts2 $ t.at)) in + let e2 = SeqE es2 $ Source.over_region (after_region e1.at :: List.map Source.at es2) in + let t2 = SeqT ts2 $ Source.over_region (after_region t1.at :: List.map Source.at ts2) in + let* es2', s2 = elab_exp_notation' env tid e2 (Subst.subst_typ s1 t2) in Ok (es1' @ es2', Subst.union s1 s2) (* Trailing elements can be omitted if they can be eps *) | SeqE [], SeqT (t1::ts2) -> let* e1' = cast_empty "omitted sequence tail" env t1 e.at (!!!env tid t1) in - let* es2', s2 = - elab_exp_notation' env tid (SeqE [] $ e.at) (SeqT ts2 $ t.at) in + let t2 = SeqT ts2 $ Source.over_region (after_region t1.at :: List.map Source.at ts2) in + let* es2', s2 = elab_exp_notation' env tid e t2 in Ok (e1' :: es2', s2) | SeqE (e1::_), SeqT [] -> - fail e1.at - "superfluous expression does not match expected empty notation type" + fail e1.at "expression is not empty" (* Since trailing elements can be omitted, a singleton may match a sequence *) | _, SeqT _ -> elab_exp_notation' env tid (SeqE [e] $ e.at) t - | SeqE [e1], IterT _ -> - let* e1' = elab_exp env e1 t in - Ok ([e1'], Subst.empty) - | (EpsE | SeqE _), IterT (t1, iter) -> - let* e' = elab_exp_notation_iter env tid (unseq_exp e) (t1, iter) t e.at in - Ok ([e'], Subst.empty) - | IterE (e1, iter1), IterT (t1, iter) -> - if iter = Opt && iter1 <> Opt then - fail_typ env e.at "iteration expression" t else - let iter1' = elab_iterexp env iter1 in - let* es1', _s1 = elab_exp_notation' env tid e1 t1 in - let t' iter' = !!!env tid (IterT (t1, iter') $ t.at) in - let e' iter' = Il.IterE (tup_exp' es1' e1.at, iter1') $$ e.at % t' iter' in - let* e'' = - match iter1, iter with - | Opt, Opt -> Ok (e' Opt) - | Opt, _ -> Ok (Il.LiftE (e' Opt) $$ e.at % !!!env tid t) - | _, Opt -> fail_typ env e.at "iteration expression" t - | _, _ -> Ok (e' List) - in Ok ([e''], Subst.empty) - (* Significant parentheses indicate a singleton *) - | ParenE (e1, `Sig), IterT (t1, iter) -> - let* es', _s = elab_exp_notation' env tid e1 t1 in - Ok ([lift_exp' (tup_exp' es' e.at) iter $$ e.at % elab_typ env t], Subst.empty) - (* Elimination forms are considered splices *) - | (IdxE _ | SliceE _ | UpdE _ | ExtE _ | DotE _ | CallE _), IterT _ -> - let* e' = elab_exp env e t in - Ok ([e'], Subst.empty) - (* All other expressions are considered splices *) - (* TODO(4, rossberg): can't they be splices, too? *) - | _, IterT (t1, iter) -> - let* es', _s = elab_exp_notation' env tid e t1 in - Ok ([lift_exp' (tup_exp' es' e.at) iter $$ e.at % !!!env tid t], Subst.empty) - - | ParenE (e1, _), _ + | ParenE e1, _ | ArithE e1, _ -> elab_exp_notation' env tid e1 t | _, ParenT t1 -> @@ -1544,42 +1453,55 @@ and elab_exp_notation' env tid e t : (Il.exp list * Subst.t) attempt = let* e' = elab_exp env e t in Ok ([e'], Subst.add_varid Subst.empty (Convert.varid_of_typ t) e) -and elab_exp_notation_iter env tid es (t1, iter) t at : Il.exp attempt = +and elab_exp_notation_iter env tid es (t1, iter) t ts at : (Il.exp list * Subst.t) attempt = assert (valid_tid tid); - let* e' = elab_exp_notation_iter' env tid es (t1, iter) t at in - let _, ts', _ = elab_typ_notation env tid t in - Ok (e' $$ at % tup_typ' ts' t.at) + let t' = elab_typ env t in + let* e', es', s = elab_exp_notation_iter' env tid es (t1, iter) t ts t' at in + Ok (e'::es', s) -and elab_exp_notation_iter' env tid es (t1, iter) t at : Il.exp' attempt = +and elab_exp_notation_iter' env tid es (t1, iter) t ts t' at : (Il.exp * Il.exp list * Subst.t) attempt = Debug.(log_at "el.elab_exp_notation_iter" at (fun _ -> fmt "%s : %s = (%s)%s" (seq el_exp es) (el_typ t) (el_typ t1) (el_iter iter)) - (function Ok e' -> fmt "%s" (il_exp (e' $$ at % (Il.TupT [] $ at))) | _ -> "fail") + (function Ok (e', es', _) -> fmt "%s" (seq il_exp (e'::es')) | _ -> "fail") ) @@ fun _ -> - assert (tid.it <> ""); + let tat' = Source.over_region (after_region t.at :: List.map Source.at ts) in match es, iter with - (* If the sequence actually starts with a non-nullary constructor, - * then assume this is a singleton iteration and fallback to variant *) - | {it = AtomE atom; _}::_, _ - when is_variant_typ env t1 && case_has_args env t1 atom -> - let* cases, _ = as_variant_typ "expression" env Check t1 at in - let* e' = elab_exp_variant env (expand_id env t1) (SeqE es $ at) cases t1 at in - Ok (lift_exp' e' iter) - - (* An empty sequence represents the None case for options *) | [], Opt -> - Ok (Il.OptE None) - (* An empty sequence represents the Nil case for lists *) + let* es', s = elab_exp_notation' env tid (SeqE [] $ at) (SeqT ts $ tat') in + Ok (Il.OptE None $$ at % t', es', s) + | e1::es2, Opt -> + choice env [ + (fun env -> + let* es', s = elab_exp_notation' env tid (SeqE (e1::es2) $ at) (SeqT ts $ tat') in + Ok (Il.OptE None $$ Source.before_region e1.at % t', es', s) + ); + (fun env -> + let* e1' = elab_exp env e1 t in + let at' = Source.over_region (after_region e1.at :: List.map Source.at es2) in + let* es2', s = elab_exp_notation' env tid (SeqE es2 $ at') (SeqT ts $ tat') in + Ok (e1', es2', s) + ); + ] + | [], List -> - Ok (Il.ListE []) - (* All other elements are either splices or (by cast injection) elements; - * nested expressions must be lifted into a tuple *) + let* es', s = elab_exp_notation' env tid (SeqE [] $ at) (SeqT ts $ tat') in + Ok (Il.ListE [] $$ at % t', es', s) | e1::es2, List -> - let* es1', _s1 = elab_exp_notation' env tid e1 t in - let* e2' = elab_exp_notation_iter env tid es2 (t1, iter) t at in - Ok (cat_exp' (tup_exp' es1' e1.at) e2') + choice env [ + (fun env -> + let* es', s = elab_exp_notation' env tid (SeqE (e1::es2) $ at) (SeqT ts $ tat') in + Ok (Il.ListE [] $$ at % t', es', s) + ); + (fun env -> + let* e1' = elab_exp env e1 t in + let at' = Source.over_region (after_region e1.at :: List.map Source.at es2) in + let* e2', es2', s = elab_exp_notation_iter' env tid es2 (t1, iter) t ts t' at' in + Ok (cat_exp' e1' e2' $$ Source.over_region [e1'.at; e2'.at] % t', es2', s) + ); + ] - | _, _ -> - fail_typ env at "expression" t + | _, (List1 | ListN _) -> + assert false and elab_exp_variant env tid e cases t at : Il.exp attempt = Debug.(log_at "el.elab_exp_variant" e.at @@ -1599,7 +1521,8 @@ and elab_exp_variant env tid e cases t at : Il.exp attempt = let* es', _s = elab_exp_notation' env tid e t1 in let t2 = expand env t $ at in let t2' = elab_typ env t2 in - let mixop, _, _ = elab_typ_notation env tid t1 in + let mixop, ts', _ = elab_typ_notation env tid t1 in + assert (List.length es' = List.length ts'); cast_exp "variant case" env (Il.CaseE (mixop, tup_exp_bind' es' at) $$ at % t2') t2 t @@ -1672,60 +1595,62 @@ and cast_exp' phrase env e' t1 t2 : Il.exp' attempt = | TupT [], SeqT [] -> Ok e'.it | ConT ((t11, _), _), ConT ((t21, _), _) -> - choice env - (fun env -> - let mixop1, ts1', ts1 = elab_typ_notation env (expand_id env t1) t11 in - let mixop2, _ts2', ts2 = elab_typ_notation env (expand_id env t2) t21 in - if mixop1 <> mixop2 then - fail_typ2 env e'.at phrase t1 t2 "" else - let e'' = Il.UncaseE (e', mixop1) $$ e'.at % tup_typ' ts1' e'.at in - let es' = List.mapi (fun i t1I' -> Il.ProjE (e'', i) $$ e''.at % t1I') ts1' in - let* es'' = map2_attempt (fun eI' (t1I, t2I) -> - cast_exp phrase env eI' t1I t2I) es' (List.combine ts1 ts2) in - Ok (Il.CaseE (mixop2, tup_exp_bind' es'' e'.at)) - ) - (fun env -> - Debug.(log_in_at "el.cast_exp" e'.at - (fun _ -> fmt "%s <: %s >> (%s) <: (%s) = (%s) # backtrack 1" (el_typ t1) (el_typ t2) - (el_typ (expand_def env t1 $ t1.at)) (el_typ (expand_def env t2 $ t2.at)) - (el_typ (expand_nondef env t2)) - ) + choice env [ + (fun env -> + let mixop1, ts1', ts1 = elab_typ_notation env (expand_id env t1) t11 in + let mixop2, _ts2', ts2 = elab_typ_notation env (expand_id env t2) t21 in + if mixop1 <> mixop2 then + fail_typ2 env e'.at phrase t1 t2 "" else + let e'' = Il.UncaseE (e', mixop1) $$ e'.at % tup_typ' ts1' e'.at in + let es' = List.mapi (fun i t1I' -> Il.ProjE (e'', i) $$ e''.at % t1I') ts1' in + let* es'' = map2_attempt (fun eI' (t1I, t2I) -> + cast_exp phrase env eI' t1I t2I) es' (List.combine ts1 ts2) in + Ok (Il.CaseE (mixop2, tup_exp_bind' es'' e'.at)) ); - let mixop, ts', ts = elab_typ_notation env (expand_id env t1) t11 in - let* t111, t111' = match ts, ts' with [t111], [t111'] -> Ok (t111, t111') | _ -> - fail_typ2 env e'.at phrase t1 t2 "" in - let e'' = Il.UncaseE (e', mixop) $$ e'.at % tup_typ' ts' e'.at in - cast_exp' phrase env (Il.ProjE (e'', 0) $$ e'.at % t111') t111 t2 - ) + (fun env -> + Debug.(log_in_at "el.cast_exp" e'.at + (fun _ -> fmt "%s <: %s >> (%s) <: (%s) = (%s) # backtrack 1" (el_typ t1) (el_typ t2) + (el_typ (expand_def env t1 $ t1.at)) (el_typ (expand_def env t2 $ t2.at)) + (el_typ (expand_nondef env t2)) + ) + ); + let mixop, ts', ts = elab_typ_notation env (expand_id env t1) t11 in + let* t111, t111' = match ts, ts' with [t111], [t111'] -> Ok (t111, t111') | _ -> + fail_typ2 env e'.at phrase t1 t2 "" in + let e'' = Il.UncaseE (e', mixop) $$ e'.at % tup_typ' ts' e'.at in + cast_exp' phrase env (Il.ProjE (e'', 0) $$ e'.at % t111') t111 t2 + ); + ] | ConT ((t11, _), _), t2' -> - choice env - (fun env -> - let* e'' = - match t2' with - | IterT (t21, iter) -> - let* e1' = cast_exp phrase env e' t1 t21 in - (match iter with - | Opt -> Ok (Il.OptE (Some e1')) - | List -> Ok (Il.ListE [e1']) - | _ -> assert false + choice env [ + (fun env -> + let* e'' = + match t2' with + | IterT (t21, iter) -> + let* e1' = cast_exp phrase env e' t1 t21 in + (match iter with + | Opt -> Ok (Il.OptE (Some e1')) + | List -> Ok (Il.ListE [e1']) + | _ -> assert false + ) + | _ -> fail_silent + in + Ok e'' + ); + (fun env -> + Debug.(log_in_at "el.cast_exp" e'.at + (fun _ -> fmt "%s <: %s >> (%s) <: (%s) = (%s) # backtrack 2" (el_typ t1) (el_typ t2) + (el_typ (expand_def env t1 $ t1.at)) (el_typ (expand_def env t2 $ t2.at)) + (el_typ (expand_nondef env t2)) ) - | _ -> fail_silent - in - Ok e'' - ) - (fun env -> - Debug.(log_in_at "el.cast_exp" e'.at - (fun _ -> fmt "%s <: %s >> (%s) <: (%s) = (%s) # backtrack 2" (el_typ t1) (el_typ t2) - (el_typ (expand_def env t1 $ t1.at)) (el_typ (expand_def env t2 $ t2.at)) - (el_typ (expand_nondef env t2)) - ) + ); + let mixop, ts', ts = elab_typ_notation env (expand_id env t1) t11 in + let* t111, t111' = match ts, ts' with [t111], [t111'] -> Ok (t111, t111') | _ -> + fail_typ2 env e'.at phrase t1 t2 "" in + let e'' = Il.UncaseE (e', mixop) $$ e'.at % tup_typ' ts' e'.at in + cast_exp' phrase env (Il.ProjE (e'', 0) $$ e'.at % t111') t111 t2 ); - let mixop, ts', ts = elab_typ_notation env (expand_id env t1) t11 in - let* t111, t111' = match ts, ts' with [t111], [t111'] -> Ok (t111, t111') | _ -> - fail_typ2 env e'.at phrase t1 t2 "" in - let e'' = Il.UncaseE (e', mixop) $$ e'.at % tup_typ' ts' e'.at in - cast_exp' phrase env (Il.ProjE (e'', 0) $$ e'.at % t111') t111 t2 - ) + ] | _, ConT ((t21, _), _) -> let mixop, _ts', ts = elab_typ_notation env (expand_id env t2) t21 in let* t211 = match ts with [t211] -> Ok t211 | _ -> @@ -1733,34 +1658,35 @@ and cast_exp' phrase env e' t1 t2 : Il.exp' attempt = let* e1' = cast_exp phrase env e' t1 t211 in Ok (Il.CaseE (mixop, tup_exp_bind' [e1'] e'.at)) | RangeT _, t2' -> - choice env - (fun env -> - let* e'' = - match t2' with - | IterT (t21, iter) -> - let* e1' = cast_exp phrase env e' t1 t21 in - (match iter with - | Opt -> Ok (Il.OptE (Some e1')) - | List -> Ok (Il.ListE [e1']) - | _ -> assert false + choice env [ + (fun env -> + let* e'' = + match t2' with + | IterT (t21, iter) -> + let* e1' = cast_exp phrase env e' t1 t21 in + (match iter with + | Opt -> Ok (Il.OptE (Some e1')) + | List -> Ok (Il.ListE [e1']) + | _ -> assert false + ) + | _ -> fail_silent + in + Ok e'' + ); + (fun env -> + Debug.(log_in_at "el.cast_exp" e'.at + (fun _ -> fmt "%s <: %s >> (%s) <: (%s) = (%s) # backtrack 3" (el_typ t1) (el_typ t2) + (el_typ (expand_def env t1 $ t1.at)) (el_typ (expand_def env t2 $ t2.at)) + (el_typ (expand_nondef env t2)) ) - | _ -> fail_silent - in - Ok e'' - ) - (fun env -> - Debug.(log_in_at "el.cast_exp" e'.at - (fun _ -> fmt "%s <: %s >> (%s) <: (%s) = (%s) # backtrack 3" (el_typ t1) (el_typ t2) - (el_typ (expand_def env t1 $ t1.at)) (el_typ (expand_def env t2 $ t2.at)) - (el_typ (expand_nondef env t2)) - ) + ); + let t11 = typ_rep env t1 in + let t11' = elab_typ env t11 in + let e'' = Il.UncaseE (e', [[]; []]) $$ e'.at % tup_typ' [t11'] e'.at in + let e''' = Il.ProjE (e'', 0) $$ e'.at % t11' in + cast_exp' phrase env e''' t11 t2 ); - let t11 = typ_rep env t1 in - let t11' = elab_typ env t11 in - let e'' = Il.UncaseE (e', [[]; []]) $$ e'.at % tup_typ' [t11'] e'.at in - let e''' = Il.ProjE (e'', 0) $$ e'.at % t11' in - cast_exp' phrase env e''' t11 t2 - ) + ] | _, RangeT _ -> let t21 = typ_rep env t2 in let* e'' = cast_exp phrase env e' t1 t21 in @@ -2125,20 +2051,60 @@ and elab_params env ps : Il.param list = List.concat_map (elab_param env) ps +(* To allow optional atoms such as `MUT?`, preprocess type + * definitions to insert implicit type definition + * `syntax MUT hint(show MUT) = MUT` and replace atom with type id. *) +and infer_typ_notation env is_con t : typ = + (match t.it with + | VarT _ | BoolT | NumT _ | TextT | ParenT _ | TupT _ | RangeT _ -> t.it + | AtomT _ -> is_con := true; t.it + | SeqT ts -> is_con := true; + SeqT (List.map (infer_typ_notation env is_con) ts) + | InfixT (t1, op, t2) -> is_con := true; + InfixT (infer_typ_notation env is_con t1, op, infer_typ_notation env is_con t2) + | BrackT (l, t1, r) -> is_con := true; + BrackT (l, infer_typ_notation env is_con t1, r) + | StrT tfs -> + StrT (Convert.map_nl_list (fun (a, (t, p), h) -> + a, (infer_typ_notation env is_con t, p), h) tfs) + | CaseT (d1, ts, tcs, d2) -> + CaseT (d1, ts, Convert.map_nl_list (fun (a, (t, p), h) -> + a, (infer_typ_notation env is_con t, p), h) tcs, d2) + | ConT ((t, p), h) -> + assert (not !is_con); (* ConT cannot nest *) + let t' = infer_typ_notation env is_con t in + if !is_con || p <> [] || h <> [] then + ConT ((t', p), h) + else + t'.it + | IterT ({it = AtomT atom; _}, iter) -> + let id = Atom.name atom $ atom.at in + if not (bound env.atoms id) then + ( + env.typs <- bind "syntax type" env.typs id ([], Transp); + env.atoms <- bind "atom" env.atoms id atom; + ); + IterT (VarT (id, []) $ atom.at, iter) + | IterT (t1, iter) -> IterT (infer_typ_notation env is_con t1, iter) + ) $ t.at + let infer_typ_definition _env t : kind = match t.it with | StrT _ | CaseT _ -> Opaque | ConT _ | RangeT _ -> Transp | _ -> Transp -let infer_typdef env d = +let infer_typdef env d : def = match d.it with | FamD (id, ps, _hints) -> let _ps' = elab_params (local_env env) ps in env.typs <- bind "syntax type" env.typs id (ps, Family []); if ps = [] then (* only types without parameters double as variables *) env.gvars <- bind "variable" env.gvars (strip_var_sub id) (VarT (id, []) $ id.at); - | TypD (id1, _id2, as_, t, _hints) -> + d + | TypD (id1, id2, as_, t, hints) -> + let is_con = ref false in + let t = infer_typ_notation env is_con t in if bound env.typs id1 then ( let _ps, k = find "syntax type" env.typs id1 in let extension = @@ -2154,11 +2120,13 @@ let infer_typdef env d = env.typs <- bind "syntax type" env.typs id1 (ps, k); if ps = [] then (* only types without parameters double as variables *) env.gvars <- bind "variable" env.gvars (strip_var_sub id1) (VarT (id1, []) $ id1.at); - ) + ); + TypD (id1, id2, as_, t, hints) $ d.at | VarD (id, t, _hints) -> (* This is to ensure that we get rebind errors in syntactic order. *) env.gvars <- bind "variable" env.gvars id t; - | _ -> () + d + | _ -> d let infer_gramdef env d = match d.it with @@ -2406,7 +2374,7 @@ let origins i (map : int Map.t ref) (set : Il.Free.Set.t) = let deps (map : int Map.t) (set : Il.Free.Set.t) : int array = Array.map (fun id -> - try Map.find id map with Not_found -> failwith ("recursifiy dep " ^ id) + try Map.find id map with Not_found -> failwith ("recursify dep " ^ id) ) (Array.of_seq (Il.Free.Set.to_seq set)) @@ -2460,9 +2428,16 @@ let recursify_defs ds' : Il.def list = ) sccs +let implicit_typdef id (at, atom) ds = + let hint = {hintid = "show" $ at; hintexp = AtomE atom $ at} in + let t = ConT ((AtomT (El.Iter.clone_atom atom) $ at, []), []) $ at in + let d = TypD (id $ at, "" $ at, [], t, [hint]) $ at in + d :: ds + let elab ds : Il.script * env = let env = new_env () in - List.iter (infer_typdef env) ds; + let ds = List.map (infer_typdef env) ds in + let ds = Map.fold implicit_typdef env.atoms ds in List.iter (infer_gramdef env) ds; let ds' = List.concat_map (elab_def env) ds in check_dots env; diff --git a/spectec/src/frontend/eval.ml b/spectec/src/frontend/eval.ml index 8fece707da..bef96f3d8d 100644 --- a/spectec/src/frontend/eval.ml +++ b/spectec/src/frontend/eval.ml @@ -207,6 +207,7 @@ and reduce_exp env e : exp = ) $ e.at | EpsE -> SeqE [] $ e.at | SeqE es -> SeqE (List.map (reduce_exp env) es) $ e.at + | ListE es -> SeqE (List.map (reduce_exp env) es) $ e.at | IdxE (e1, e2) -> let e1' = reduce_exp env e1 in let e2' = reduce_exp env e2 in @@ -295,7 +296,7 @@ and reduce_exp env e : exp = | SeqE es -> NumE (`DecOp, `Nat (Z.of_int (List.length es))) | _ -> LenE e1' ) $ e.at - | ParenE (e1, _) | ArithE e1 | TypE (e1, _) -> reduce_exp env e1 + | ParenE e1 | ArithE e1 | TypE (e1, _) -> reduce_exp env e1 | TupE es -> TupE (List.map (reduce_exp env) es) $ e.at | InfixE (e1, atom, e2) -> let e1' = reduce_exp env e1 in @@ -469,8 +470,8 @@ and match_exp env s e1 e2 : subst option = ) @@ fun _ -> match e1.it, (reduce_exp env (Subst.subst_exp s e2)).it with (* - | (ParenE (e11, _) | TypE (e11, _)), _ -> match_exp env s e11 e2 - | _, (ParenE (e21, _) | TypE (e21, _)) -> match_exp env s e1 e21 + | (ParenE e11 | TypE (e11, _)), _ -> match_exp env s e11 e2 + | _, (ParenE e21 | TypE (e21, _)) -> match_exp env s e1 e21 | _, VarE (id, []) when Subst.mem_varid s id -> match_exp env s e1 (Subst.subst_exp s e2) | VarE (id1, args1), VarE (id2, args2) when id1.it = id2.it -> diff --git a/spectec/src/frontend/parser.mly b/spectec/src/frontend/parser.mly index ec958ae24f..79b5df7425 100644 --- a/spectec/src/frontend/parser.mly +++ b/spectec/src/frontend/parser.mly @@ -59,32 +59,7 @@ let check_varid_bind id = error id.at "invalid identifer suffix in binding position" -(* Parentheses Role etc *) - -type prec = Op | Seq | Post | Prim - -let rec prec_of_exp = function (* as far as iteration is concerned *) - | VarE _ | BoolE _ | NumE _ | TextE _ | EpsE | StrE _ - | ParenE _ | TupE _ | BrackE _ | CvtE _ | CallE _ | HoleE _ -> Prim - | AtomE _ | IdxE _ | SliceE _ | UpdE _ | ExtE _ | DotE _ | IterE _ -> Post - | SeqE _ -> Seq - | UnE _ | BinE _ | CmpE _ | MemE _ | InfixE _ | LenE _ | SizeE _ - | CommaE _ | CatE _ | TypE _ | FuseE _ | UnparenE _ | LatexE _ -> Op - | ArithE e -> prec_of_exp e.it - -(* Extra parentheses can be inserted to disambiguate the role of elements of - * an iteration. For example, `( x* )` will be interpreted differently from `x*` - * in a place where an expression of some type `t*` is expected. In particular, - * we assume `x* : t*` in the latter case, but `x* : t` in the former - * (which makes sense in the case where `t` itself is an iteration type). - * To make this distinction ducing elaboration, we mark potential parentheses - * as "significant" (true) when they are not syntactically enforced, and instead - * are assumed to have been inserted to express iteration injection. - *) -let signify_pars prec = function - | ParenE (exp, `Insig) -> - ParenE (exp, if prec < prec_of_exp exp.it then `Sig else `Insig) - | exp' -> exp' +(* Classifications *) let is_post_exp e = match e.it with @@ -92,7 +67,7 @@ let is_post_exp e = | BoolE _ | NumE _ | EpsE | ParenE _ | TupE _ | BrackE _ - | IdxE _ | SliceE _ | ExtE _ + | ListE _ | IdxE _ | SliceE _ | ExtE _ | StrE _ | DotE _ | IterE _ | CvtE _ | CallE _ | HoleE _ -> true @@ -109,8 +84,8 @@ let rec is_typcase t = let rec is_typcon t = match t.it with | AtomT _ | InfixT _ | BrackT _ | SeqT _ -> true - | VarT _ | BoolT | NumT _ | TextT | TupT _ -> false - | ParenT t1 | IterT (t1, _) -> is_typcon t1 + | VarT _ | BoolT | NumT _ | TextT | TupT _ | ParenT _ -> false + | IterT (t1, _) -> is_typcon t1 | StrT _ | CaseT _ | ConT _ | RangeT _ -> assert false %} @@ -172,13 +147,10 @@ let rec is_typcon t = | COMMA {} | COMMA_NL {} -tup_list(X) : - | (* empty *) { [], `Sig } - | X { $1::[], `Insig } - | X comma tup_list(X) { $1::(fst $3), `Sig } - comma_list(X) : - | tup_list(X) { fst $1 } + | (* empty *) { [] } + | X { $1::[] } + | X comma comma_list(X) { $1::$3 } comma_nl_list(X) : | (* empty *) { [] } @@ -361,7 +333,7 @@ iter : | STAR { List } | UP arith_prim { match $2.it with - | ParenE ({it = CmpE ({it = VarE (id, []); _}, `LtOp, e); _}, `Insig) -> + | ParenE {it = CmpE ({it = VarE (id, []); _}, `LtOp, e); _} -> ListN (e, Some id) | _ -> ListN ($2, None) } @@ -386,11 +358,11 @@ typ_prim_ : typ_post : typ_post_ { $1 $ $sloc } typ_post_ : | typ_prim_ { $1 } - | LPAREN tup_list(typ) RPAREN + | LPAREN comma_list(typ) RPAREN { match $2 with - | [], _ -> ParenT (SeqT [] $ $sloc) - | [t], `Insig -> ParenT t - | ts, _ -> TupT ts } + | [] -> ParenT (SeqT [] $ $sloc) + | [t] -> ParenT t + | ts -> TupT ts } | typ_post iter { IterT ($1, $2) } typ : typ_post { $1 } @@ -449,11 +421,11 @@ nottyp_prim_ : { BrackT (Atom.LBrack $$ $loc($2), $3, Atom.RBrack $$ $loc($4)) } | TICK LBRACE nottyp RBRACE { BrackT (Atom.LBrace $$ $loc($2), $3, Atom.RBrace $$ $loc($4)) } - | LPAREN tup_list(typ) RPAREN + | LPAREN comma_list(typ) RPAREN { match $2 with - | [], _ -> ParenT (SeqT [] $ $sloc) - | [t], `Insig -> ParenT t - | ts, _ -> TupT ts } + | [] -> ParenT (SeqT [] $ $sloc) + | [t] -> ParenT t + | ts -> TupT ts } nottyp_post : nottyp_post_ { $1 $ $sloc } nottyp_post_ : @@ -542,11 +514,11 @@ exp_prim_ : | exp_hole_ { $1 } | EPS { EpsE } | LBRACE comma_nl_list(fieldexp) RBRACE { StrE $2 } - | LPAREN tup_list(exp_bin) RPAREN + | LPAREN comma_list(exp_bin) RPAREN { match $2 with - | [], signif -> ParenE (SeqE [] $ $sloc, signif) - | [e], `Insig -> ParenE (e, `Insig) - | es, _ -> TupE es } + | [] -> ParenE (SeqE [] $ $sloc) + | [e] -> ParenE e + | es -> TupE es } | TICK LPAREN exp RPAREN { BrackE (Atom.LParen $$ $loc($2), $3, Atom.RParen $$ $loc($4)) } | TICK LBRACK exp RBRACK @@ -559,7 +531,7 @@ exp_prim_ : exp_post : exp_post_ { $1 $ $sloc } exp_post_ : - | exp_prim_ { signify_pars Post $1 } + | exp_prim_ { $1 } | exp_atom LBRACK arith RBRACK { IdxE ($1, $3) } | exp_atom LBRACK arith COLON arith RBRACK { SliceE ($1, $3, $5) } | exp_atom LBRACK path EQ exp RBRACK { UpdE ($1, $3, $5) } @@ -574,18 +546,24 @@ exp_atom_ : | atomid_lparen exp RPAREN { SeqE [ AtomE (Atom.Atom $1 $$ $loc($1)) $ $loc($1); - ParenE ($2, `Insig) $ $loc($2) + ParenE $2 $ $loc($2) ] } +exp_list : exp_list_ { $1 $ $sloc } +exp_list_ : + | LBRACK exp_seq RBRACK { ListE (as_seq_exp $2) } + | exp_list iter { IterE ($1, $2) } + exp_seq : exp_seq_ { $1 $ $sloc } exp_seq_ : - | exp_atom_ { signify_pars Seq $1 } + | exp_atom_ { $1 } + | exp_list_ { $1 } | exp_seq exp_atom { SeqE (as_seq_exp $1 @ [$2]) } | exp_seq FUSE exp_atom { FuseE ($1, $3) } exp_un : exp_un_ { $1 $ $sloc } exp_un_ : - | exp_seq_ { signify_pars Op $1 } + | exp_seq_ { $1 } | bar exp bar { LenE $2 } | BARBAR gramid BARBAR { SizeE $2 } | unop exp_un { UnE ($1, $2) } @@ -621,7 +599,7 @@ arith_prim_ : | exp_var_ { $1 } | exp_call_ { $1 } | exp_hole_ { $1 } - | LPAREN arith RPAREN { ParenE ($2, `Insig) } + | LPAREN arith RPAREN { ParenE $2 } | LPAREN arith_bin STAR RPAREN { (* HACK: to allow "(s*)" as arithmetic expression. *) if not (is_post_exp $2) then @@ -732,11 +710,11 @@ sym_prim_ : | TEXTLIT { TextG $1 } | TICK NATLIT { NumG (`AtomOp, $2) } | EPS { EpsG } - | LPAREN tup_list(sym) RPAREN + | LPAREN comma_list(sym) RPAREN { match $2 with - | [], _ -> ParenG (SeqG [] $ $sloc) - | [g], `Insig -> ParenG g - | gs, _ -> TupG gs } + | [] -> ParenG (SeqG [] $ $sloc) + | [g] -> ParenG g + | gs -> TupG gs } | DOLLAR LPAREN arith RPAREN { ArithG $3 } | DOLLAR numtyp DOLLAR LPAREN arith RPAREN { ArithG (CvtE ($5, $2) $ $sloc) } diff --git a/spectec/src/middlend/dune b/spectec/src/middlend/dune index 75ebc70cc0..8585c04905 100644 --- a/spectec/src/middlend/dune +++ b/spectec/src/middlend/dune @@ -4,7 +4,6 @@ (modules sub totalize - wild unthe sideconditions ) diff --git a/spectec/src/middlend/wild.ml b/spectec/src/middlend/wild.ml deleted file mode 100644 index ef0f4b8320..0000000000 --- a/spectec/src/middlend/wild.ml +++ /dev/null @@ -1,255 +0,0 @@ -(* -This transformation removes various forms of wildcards from the syntax. - -In particular we currently detect - * `FOO?` where `FOO is a constructor of a single-constructor-variant - * `()?` - -Like many other transformations, this bridges the gap between the source -syntax, where expressions are really relations (can fail, can denote multiple -values) and the target syntax of theorem provers, where expressions must be -purely functional (given a value for all free variables, must denote exactly -one value). - -The overall structure of this module is similar to that of Middlend.Unthe. -*) - -open Util -open Source -open Il.Ast - -(* Errors *) - -let error at msg = Error.error at "wildcard elimination" msg - -(* Environment - -We need to know which variant types have exactly one constructor. -(We do not remember the name of the constructor, and assume the input to -be well-typed. -*) - -module S = Set.Make(String) -type env = { - mutable unit_variants : S.t; - mutable counter : int; (* to generate fresh names *) -} -let new_env () : env = { unit_variants = S.empty; counter = 0 } - -(* -The main predicate here: Which expressions are - - - universal (describes all values of the current type) and - - multi-valued (describes more than one value) - -So far, we only look for `FOO?` and `()?`, but this can be extended of cousre. -*) - -let rec is_universal env exp : bool = - match exp.it with - | TupE es -> List.for_all (is_universal env) es - | CaseE _ -> begin match exp.note.it with - | VarT (i, _) -> S.mem i.it env.unit_variants - | _ -> false - end - | _ -> false - -let is_universal_and_multi_value env exp : bool = - match exp.it with - | IterE (e, (Opt, [])) -> is_universal env e - | _ -> false - - -(* Fresh name generation *) - -let name i = "w" ^ string_of_int i (* NB: no clash avoidance yet *) - -let fresh_id env : id = - let i = env.counter in - env.counter <- env.counter + 1; - name i $ no_region - -(* If a bind and premise is generated under an iteration, wrap them accordingly *) - -let under_iterexp (iter, vs) binds : iterexp * bind list = - let new_vs = List.map (fun bind -> - match bind.it with - | ExpB (v, t) -> - (v, VarE v $$ v.at % (IterT (t, match iter with Opt -> Opt | _ -> List) $ v.at)) - | TypB _ | DefB _ | GramB _ -> error bind.at "unexpected type binding" - ) binds in - let binds' = List.map2 (fun bind (v, e) -> ExpB (v, e.note) $ bind.at) binds new_vs in - (iter, vs @ new_vs), binds' - - -(* Generic traversal helpers *) - -type 'a traversal = env -> 'a -> bind list * 'a -type ('a, 'b) traversal_k = env -> 'a -> ('a -> 'b) -> bind list * 'b - -let phrase (t : 'a traversal) : ('a, 'b) note_phrase traversal - = fun env x -> let binds, x' = t env x.it in binds, x' $$ x.at % x.note - -let t_list (t : 'a traversal) : ('a list, 'b) traversal_k - = fun n xs k -> - let bindss, xs' = List.split (List.map (t n) xs) in - List.concat bindss, k xs' - -let unary (t : 'a traversal) : ('a, 'b) traversal_k = - fun n x k -> - let binds, exp' = t n x in - binds, k exp' - -let binary (t1 : 'a traversal) (t2 : 'b traversal) : ('a * 'b, 'c) traversal_k = - fun n (x1, x2) k -> - let binds1, x1' = t1 n x1 in - let binds2, x2' = t2 n x2 in - binds1 @ binds2, k (x1', x2') - -let ternary (t1 : 'a traversal) (t2 : 'b traversal) (t3 : 'c traversal) : ('a * 'b * 'c, 'd) traversal_k = - fun n (x1, x2, x3) k -> - let binds1, x1' = t1 n x1 in - let binds2, x2' = t2 n x2 in - let binds3, x3' = t3 n x3 in - binds1 @ binds2 @ binds3, k (x1', x2', x3') - -(* Expr traversal *) - - -let rec t_exp env e : bind list * exp = - (* Descend first using t_exp2, and then see if we have to pull out the current expression *) - let binds, e' = t_exp2 env e in - if is_universal_and_multi_value env e' - then - let t = e.note in - let x = fresh_id env in - let xe = VarE x $$ no_region % t in - let bind = ExpB (x, t) $ no_region in - binds @ [bind], xe - else binds, e' - -(* Traversal helpers *) - -and t_exp2 env = phrase t_exp' env - -and t_e env x k = unary t_exp env x k -and t_ee env x k = binary t_exp t_exp env x k -and t_eee env x k = ternary t_exp t_exp t_exp env x k -and t_epe env x k = ternary t_exp t_path t_exp env x k - -and t_exp' env e : bind list * exp' = - match e with - | VarE _ | BoolE _ | NumE _ | TextE _ | OptE None -> [], e - - | UnE (uo, nto, exp) -> t_e env exp (fun exp' -> UnE (uo, nto, exp')) - | DotE (exp, a) -> t_e env exp (fun exp' -> DotE (exp', a)) - | LenE exp -> t_e env exp (fun exp' -> LenE exp') - | CallE (f, args) -> t_list t_arg env args (fun args' -> CallE (f, args')) - | ProjE (exp, i) -> t_e env exp (fun exp' -> ProjE (exp', i)) - | UncaseE (exp, mo) -> t_e env exp (fun exp' -> UncaseE (exp', mo)) - | OptE (Some exp) -> t_e env exp (fun exp' -> OptE (Some exp')) - | TheE exp -> t_e env exp (fun exp' -> TheE exp') - | LiftE exp -> t_e env exp (fun exp' -> LiftE exp') - | CaseE (mixop, exp) -> t_e env exp (fun exp' -> CaseE (mixop, exp')) - | CvtE (exp, a, b) -> t_e env exp (fun exp' -> CvtE (exp', a, b)) - | SubE (exp, a, b) -> t_e env exp (fun exp' -> SubE (exp', a, b)) - - | BinE (bo, nto, exp1, exp2) -> t_ee env (exp1, exp2) (fun (e1', e2') -> BinE (bo, nto, e1', e2')) - | CmpE (co, nto, exp1, exp2) -> t_ee env (exp1, exp2) (fun (e1', e2') -> CmpE (co, nto, e1', e2')) - | IdxE (exp1, exp2) -> t_ee env (exp1, exp2) (fun (e1', e2') -> IdxE (e1', e2')) - | CompE (exp1, exp2) -> t_ee env (exp1, exp2) (fun (e1', e2') -> CompE (e1', e2')) - | CatE (exp1, exp2) -> t_ee env (exp1, exp2) (fun (e1', e2') -> CatE (e1', e2')) - | MemE (exp1, exp2) -> t_ee env (exp1, exp2) (fun (e1', e2') -> MemE (e1', e2')) - - | SliceE (exp1, exp2, exp3) -> t_eee env (exp1, exp2, exp3) (fun (e1', e2', e3') -> SliceE (e1', e2', e3')) - - | UpdE (exp1, path, exp2) -> t_epe env (exp1, path, exp2) (fun (e1', p', e2') -> UpdE (e1', p', e2')) - | ExtE (exp1, path, exp2) -> t_epe env (exp1, path, exp2) (fun (e1', p', e2') -> ExtE (e1', p', e2')) - - | StrE fields -> t_list t_field env fields (fun fields' -> StrE fields') - - | TupE es -> t_list t_exp env es (fun es' -> TupE es') - | ListE es -> t_list t_exp env es (fun es' -> ListE es') - | IterE (e, iterexp) -> - let binds1, e' = t_exp env e in - let iterexp', binds1' = under_iterexp iterexp binds1 in - let binds2, iterexp'' = t_iterexp env iterexp' in - binds1' @ binds2, IterE (e', iterexp'') - -and t_field env ((a, e) : expfield) = - unary t_exp env e (fun e' -> (a, e')) - -and t_iterexp env iterexp = - binary t_iter t_iterbinds env iterexp Fun.id - -and t_iterbinds env binds = - t_list t_iterbind env binds Fun.id - -and t_iterbind env (id, e) = - unary t_exp env e (fun e' -> (id, e')) - -and t_iter env iter = match iter with - | ListN (e, id_opt) -> unary t_exp env e (fun e' -> ListN (e', id_opt)) - | _ -> [], iter - -and t_path env = phrase t_path' env - -and t_path' env path = match path with - | RootP -> [], path - | IdxP (path, e) -> binary t_path t_exp env (path, e) (fun (path', e') -> IdxP (path', e')) - | SliceP (path, e1, e2) -> ternary t_path t_exp t_exp env (path, e1, e2) (fun (path', e1', e2') -> SliceP (path', e1', e2')) - | DotP (path, a) -> unary t_path env path (fun path' -> DotP (path', a)) - -and t_arg env = phrase t_arg' env - -and t_arg' env arg = match arg with - | ExpA exp -> unary t_exp env exp (fun exp' -> ExpA exp') - | TypA _ -> [], arg - | DefA _ -> [], arg - | GramA _ -> [], arg - -let rec t_prem env : prem -> bind list * prem = phrase t_prem' env - -and t_prem' env prem : bind list * prem' = - match prem with - | RulePr (a, b, exp) -> - unary t_exp env exp (fun exp' -> RulePr (a, b, exp')) - | IfPr e -> unary t_exp env e (fun e' -> IfPr e') - | LetPr (e1, e2, ids) -> binary t_exp t_exp env (e1, e2) (fun (e1', e2') -> LetPr (e1', e2', ids)) - | ElsePr -> [], prem - | IterPr (prem, iterexp) -> - let binds1, prem' = t_prem env prem in - let iterexp', binds1' = under_iterexp iterexp binds1 in - let binds2, iterexp'' = t_iterexp env iterexp' in - binds1' @ binds2, IterPr (prem', iterexp'') - -let t_prems env k = t_list t_prem env k (fun x -> x) - -let t_rule' env = function - | RuleD (id, binds, mixop, exp, prems) -> - (* Reset counter for fresh variables *) - env.counter <- 0; - let extra_binds, (exp', prems') = binary t_exp t_prems env (exp, prems) (fun x -> x) in - RuleD (id, binds @ extra_binds, mixop, exp', prems') - -let t_rule env x = { x with it = t_rule' env x.it } - -let t_rules env = List.map (t_rule env) - -let rec t_def' env = function - | TypD (id, _, [{ it = InstD (_, _, { it = VariantT []; _ }); _ }]) as def -> - env.unit_variants <- S.add id.it env.unit_variants; - def - | RecD defs -> RecD (t_defs env defs) - | RelD (id, mixop, typ, rules) -> - RelD (id, mixop, typ, t_rules env rules) - | def -> def - -and t_def env x = { x with it = t_def' env x.it } - -and t_defs env = List.map (t_def env) - -let transform (defs : script) = - let env = new_env () in - t_defs env defs - diff --git a/spectec/src/middlend/wild.mli b/spectec/src/middlend/wild.mli deleted file mode 100644 index 542bbf8052..0000000000 --- a/spectec/src/middlend/wild.mli +++ /dev/null @@ -1 +0,0 @@ -val transform : Il.Ast.script -> Il.Ast.script diff --git a/spectec/src/util/source.ml b/spectec/src/util/source.ml index 9e8d18ab9b..70e67876ed 100644 --- a/spectec/src/util/source.ml +++ b/spectec/src/util/source.ml @@ -9,6 +9,8 @@ let no_region = {left = no_pos; right = no_pos} let pos_of_file file = {no_pos with file} let region_of_file file = {left = pos_of_file file; right = pos_of_file file} +let before_region r = {left = r.left; right = r.left} +let after_region r = {left = r.right; right = r.right} let over_region = function | [] -> raise (Invalid_argument "Source.over") | r::rs -> @@ -23,12 +25,15 @@ let string_of_pos pos = else string_of_int pos.line ^ "." ^ string_of_int (pos.column + 1) +let string_of_range left right = + string_of_pos left ^ + (if left = right then "" else "-" ^ string_of_pos right) + let string_of_region r = if r = region_of_file r.left.file then r.left.file else - r.left.file ^ ":" ^ string_of_pos r.left ^ - (if r.left = r.right then "" else "-" ^ string_of_pos r.right) + r.left.file ^ ":" ^ string_of_range r.left r.right (* Phrases *) diff --git a/spectec/src/util/source.mli b/spectec/src/util/source.mli index b79aca6e78..6076c1cb69 100644 --- a/spectec/src/util/source.mli +++ b/spectec/src/util/source.mli @@ -7,9 +7,12 @@ val no_pos : pos val no_region : region val region_of_file : string -> region +val before_region : region -> region +val after_region : region -> region val over_region : region list -> region val string_of_pos : pos -> string +val string_of_range : pos -> pos -> string val string_of_region : region -> string diff --git a/spectec/test-frontend/TEST.md b/spectec/test-frontend/TEST.md index 74d4882910..c9ddd488c0 100644 --- a/spectec/test-frontend/TEST.md +++ b/spectec/test-frontend/TEST.md @@ -15,6 +15,18 @@ watsup 0.4 generator == Parsing... == Elaboration... +;; 1-syntax.watsup +syntax NULL = + | NULL + +;; 1-syntax.watsup +syntax MUT = + | MUT + +;; 1-syntax.watsup +syntax FINAL = + | FINAL + ;; 0-aux.watsup syntax N = nat @@ -248,7 +260,7 @@ syntax fNmag{N : N}(N) = | SUBNORM{m : m, exp : exp}(m : m) -- if ((m < (2 ^ $M(N))) /\ (((2 : nat <:> int) - ((2 ^ ((($E(N) : nat <:> int) - (1 : nat <:> int)) : int <:> nat)) : nat <:> int)) = exp)) | INF - | `NAN(%)`{m : m}(m : m) + | NAN{m : m}(m : m) -- if ((1 <= m) /\ (m < (2 ^ $M(N)))) ;; 1-syntax.watsup @@ -377,16 +389,13 @@ syntax externidx = | TAG{tagidx : tagidx}(tagidx : tagidx) ;; 1-syntax.watsup -syntax nul = - | `NULL%?`(()?) +syntax nul = NULL? ;; 1-syntax.watsup -syntax nul1 = - | `NULL%?`(()?) +syntax nul1 = NULL? ;; 1-syntax.watsup -syntax nul2 = - | `NULL%?`(()?) +syntax nul2 = NULL? ;; 1-syntax.watsup syntax addrtype = @@ -429,12 +438,10 @@ syntax absheaptype = | BOT ;; 1-syntax.watsup -syntax mut = - | `MUT%?`(()?) +syntax mut = MUT? ;; 1-syntax.watsup -syntax fin = - | `FINAL%?`(()?) +syntax fin = FINAL? ;; 1-syntax.watsup rec { @@ -556,52 +563,52 @@ syntax Cnn = ;; 1-syntax.watsup def $ANYREF : reftype ;; 1-syntax.watsup - def $ANYREF = REF_reftype(`NULL%?`_nul(?(())), ANY_heaptype) + def $ANYREF = REF_reftype(?(NULL_NULL), ANY_heaptype) ;; 1-syntax.watsup def $EQREF : reftype ;; 1-syntax.watsup - def $EQREF = REF_reftype(`NULL%?`_nul(?(())), EQ_heaptype) + def $EQREF = REF_reftype(?(NULL_NULL), EQ_heaptype) ;; 1-syntax.watsup def $I31REF : reftype ;; 1-syntax.watsup - def $I31REF = REF_reftype(`NULL%?`_nul(?(())), I31_heaptype) + def $I31REF = REF_reftype(?(NULL_NULL), I31_heaptype) ;; 1-syntax.watsup def $STRUCTREF : reftype ;; 1-syntax.watsup - def $STRUCTREF = REF_reftype(`NULL%?`_nul(?(())), STRUCT_heaptype) + def $STRUCTREF = REF_reftype(?(NULL_NULL), STRUCT_heaptype) ;; 1-syntax.watsup def $ARRAYREF : reftype ;; 1-syntax.watsup - def $ARRAYREF = REF_reftype(`NULL%?`_nul(?(())), ARRAY_heaptype) + def $ARRAYREF = REF_reftype(?(NULL_NULL), ARRAY_heaptype) ;; 1-syntax.watsup def $FUNCREF : reftype ;; 1-syntax.watsup - def $FUNCREF = REF_reftype(`NULL%?`_nul(?(())), FUNC_heaptype) + def $FUNCREF = REF_reftype(?(NULL_NULL), FUNC_heaptype) ;; 1-syntax.watsup def $EXTERNREF : reftype ;; 1-syntax.watsup - def $EXTERNREF = REF_reftype(`NULL%?`_nul(?(())), EXTERN_heaptype) + def $EXTERNREF = REF_reftype(?(NULL_NULL), EXTERN_heaptype) ;; 1-syntax.watsup def $NULLREF : reftype ;; 1-syntax.watsup - def $NULLREF = REF_reftype(`NULL%?`_nul(?(())), NONE_heaptype) + def $NULLREF = REF_reftype(?(NULL_NULL), NONE_heaptype) ;; 1-syntax.watsup def $NULLFUNCREF : reftype ;; 1-syntax.watsup - def $NULLFUNCREF = REF_reftype(`NULL%?`_nul(?(())), NOFUNC_heaptype) + def $NULLFUNCREF = REF_reftype(?(NULL_NULL), NOFUNC_heaptype) ;; 1-syntax.watsup def $NULLEXTERNREF : reftype ;; 1-syntax.watsup - def $NULLEXTERNREF = REF_reftype(`NULL%?`_nul(?(())), NOEXTERN_heaptype) + def $NULLEXTERNREF = REF_reftype(?(NULL_NULL), NOEXTERN_heaptype) ;; 1-syntax.watsup syntax packtype = @@ -639,12 +646,10 @@ syntax Lnn = | I16 ;; 1-syntax.watsup -syntax mut1 = - | `MUT%?`(()?) +syntax mut1 = MUT? ;; 1-syntax.watsup -syntax mut2 = - | `MUT%?`(()?) +syntax mut2 = MUT? ;; 1-syntax.watsup syntax limits = @@ -1341,7 +1346,7 @@ syntax instr = | NOP | UNREACHABLE | DROP - | `SELECT()%?`{`valtype*?` : valtype*?}(valtype*{valtype <- `valtype*`}?{`valtype*` <- `valtype*?`} : valtype*?) + | SELECT{`valtype*?` : valtype*?}(valtype*{valtype <- `valtype*`}?{`valtype*` <- `valtype*?`} : valtype*?) | BLOCK{blocktype : blocktype, `instr*` : instr*}(blocktype : blocktype, instr*{instr <- `instr*`} : instr*) | LOOP{blocktype : blocktype, `instr*` : instr*}(blocktype : blocktype, instr*{instr <- `instr*`} : instr*) | `IF%%ELSE%`{blocktype : blocktype, `instr*` : instr*}(blocktype : blocktype, instr*{instr <- `instr*`} : instr*, instr*) @@ -1631,9 +1636,9 @@ def $minat(addrtype : addrtype, addrtype : addrtype) : addrtype ;; 2-syntax-aux.watsup def $diffrt(reftype : reftype, reftype : reftype) : reftype ;; 2-syntax-aux.watsup - def $diffrt{nul1 : nul1, ht_1 : heaptype, ht_2 : heaptype}(REF_reftype(nul1, ht_1), REF_reftype(`NULL%?`_nul(?(())), ht_2)) = REF_reftype(`NULL%?`_nul(?()), ht_1) + def $diffrt{nul1 : nul1, ht_1 : heaptype, ht_2 : heaptype}(REF_reftype(nul1, ht_1), REF_reftype(?(NULL_NULL), ht_2)) = REF_reftype(?(), ht_1) ;; 2-syntax-aux.watsup - def $diffrt{nul1 : nul1, ht_1 : heaptype, ht_2 : heaptype}(REF_reftype(nul1, ht_1), REF_reftype(`NULL%?`_nul(?()), ht_2)) = REF_reftype(nul1, ht_1) + def $diffrt{nul1 : nul1, ht_1 : heaptype, ht_2 : heaptype}(REF_reftype(nul1, ht_1), REF_reftype(?(), ht_2)) = REF_reftype(nul1, ht_1) ;; 2-syntax-aux.watsup rec { @@ -2243,9 +2248,9 @@ def $shift_labelidxs(labelidx*) : labelidx* ;; 2-syntax-aux.watsup:585.1-585.32 def $shift_labelidxs([]) = [] ;; 2-syntax-aux.watsup:586.1-586.66 - def $shift_labelidxs{`labelidx'*` : labelidx*}([`%`_uN(0)] ++ labelidx'*{labelidx' <- `labelidx'*`}) = $shift_labelidxs(labelidx'*{labelidx' <- `labelidx'*`}) + def $shift_labelidxs{`labelidx'*` : labelidx*}([`%`_labelidx(0)] ++ labelidx'*{labelidx' <- `labelidx'*`}) = $shift_labelidxs(labelidx'*{labelidx' <- `labelidx'*`}) ;; 2-syntax-aux.watsup:587.1-587.91 - def $shift_labelidxs{labelidx : labelidx, `labelidx'*` : labelidx*}([labelidx] ++ labelidx'*{labelidx' <- `labelidx'*`}) = [`%`_uN((((labelidx!`%`_labelidx.0 : nat <:> int) - (1 : nat <:> int)) : int <:> nat))] ++ $shift_labelidxs(labelidx'*{labelidx' <- `labelidx'*`}) + def $shift_labelidxs{labelidx : labelidx, `labelidx'*` : labelidx*}([labelidx] ++ labelidx'*{labelidx' <- `labelidx'*`}) = [`%`_labelidx((((labelidx!`%`_labelidx.0 : nat <:> int) - (1 : nat <:> int)) : int <:> nat))] ++ $shift_labelidxs(labelidx'*{labelidx' <- `labelidx'*`}) } ;; 2-syntax-aux.watsup @@ -2260,7 +2265,7 @@ def $free_instr(instr : instr) : free ;; 2-syntax-aux.watsup:444.1-444.27 def $free_instr(DROP_instr) = {TYPES [], FUNCS [], GLOBALS [], TABLES [], MEMS [], ELEMS [], DATAS [], LOCALS [], LABELS []} ;; 2-syntax-aux.watsup:445.1-445.86 - def $free_instr{`valtype*?` : valtype*?}(`SELECT()%?`_instr(valtype*{valtype <- `valtype*`}?{`valtype*` <- `valtype*?`})) = $free_opt($free_list($free_valtype(valtype)*{valtype <- `valtype*`})?{`valtype*` <- `valtype*?`}) + def $free_instr{`valtype*?` : valtype*?}(SELECT_instr(valtype*{valtype <- `valtype*`}?{`valtype*` <- `valtype*?`})) = $free_opt($free_list($free_valtype(valtype)*{valtype <- `valtype*`})?{`valtype*` <- `valtype*?`}) ;; 2-syntax-aux.watsup:447.1-447.92 def $free_instr{blocktype : blocktype, `instr*` : instr*}(BLOCK_instr(blocktype, instr*{instr <- `instr*`})) = $free_blocktype(blocktype) +++ $free_block(instr*{instr <- `instr*`}) ;; 2-syntax-aux.watsup:448.1-448.91 @@ -2661,7 +2666,7 @@ relation Heaptype_ok: `%|-%:OK`(context, heaptype) relation Reftype_ok: `%|-%:OK`(context, reftype) ;; 3-typing.watsup rule _{C : context, heaptype : heaptype}: - `%|-%:OK`(C, REF_reftype(`NULL%?`_nul(()?{}), heaptype)) + `%|-%:OK`(C, REF_reftype(NULL_NULL?{}, heaptype)) -- Heaptype_ok: `%|-%:OK`(C, heaptype) ;; 3-typing.watsup @@ -2731,7 +2736,7 @@ relation Storagetype_ok: `%|-%:OK`(context, storagetype) relation Fieldtype_ok: `%|-%:OK`(context, fieldtype) ;; 3-typing.watsup rule _{C : context, storagetype : storagetype}: - `%|-%:OK`(C, `%%`_fieldtype(`MUT%?`_mut(()?{}), storagetype)) + `%|-%:OK`(C, `%%`_fieldtype(MUT_MUT?{}, storagetype)) -- Storagetype_ok: `%|-%:OK`(C, storagetype) ;; 3-typing.watsup @@ -2875,12 +2880,12 @@ relation Heaptype_sub: `%|-%<:%`(context, heaptype, heaptype) relation Reftype_sub: `%|-%<:%`(context, reftype, reftype) ;; 3-typing.watsup rule nonnull{C : context, ht_1 : heaptype, ht_2 : heaptype}: - `%|-%<:%`(C, REF_reftype(`NULL%?`_nul(?()), ht_1), REF_reftype(`NULL%?`_nul(?()), ht_2)) + `%|-%<:%`(C, REF_reftype(?(), ht_1), REF_reftype(?(), ht_2)) -- Heaptype_sub: `%|-%<:%`(C, ht_1, ht_2) ;; 3-typing.watsup rule null{C : context, ht_1 : heaptype, ht_2 : heaptype}: - `%|-%<:%`(C, REF_reftype(`NULL%?`_nul(()?{}), ht_1), REF_reftype(`NULL%?`_nul(?(())), ht_2)) + `%|-%<:%`(C, REF_reftype(NULL_NULL?{}, ht_1), REF_reftype(?(NULL_NULL), ht_2)) -- Heaptype_sub: `%|-%<:%`(C, ht_1, ht_2) ;; 3-typing.watsup @@ -2926,12 +2931,12 @@ relation Storagetype_sub: `%|-%<:%`(context, storagetype, storagetype) relation Fieldtype_sub: `%|-%<:%`(context, fieldtype, fieldtype) ;; 3-typing.watsup rule const{C : context, zt_1 : storagetype, zt_2 : storagetype}: - `%|-%<:%`(C, `%%`_fieldtype(`MUT%?`_mut(?()), zt_1), `%%`_fieldtype(`MUT%?`_mut(?()), zt_2)) + `%|-%<:%`(C, `%%`_fieldtype(?(), zt_1), `%%`_fieldtype(?(), zt_2)) -- Storagetype_sub: `%|-%<:%`(C, zt_1, zt_2) ;; 3-typing.watsup rule var{C : context, zt_1 : storagetype, zt_2 : storagetype}: - `%|-%<:%`(C, `%%`_fieldtype(`MUT%?`_mut(?(())), zt_1), `%%`_fieldtype(`MUT%?`_mut(?(())), zt_2)) + `%|-%<:%`(C, `%%`_fieldtype(?(MUT_MUT), zt_1), `%%`_fieldtype(?(MUT_MUT), zt_2)) -- Storagetype_sub: `%|-%<:%`(C, zt_1, zt_2) -- Storagetype_sub: `%|-%<:%`(C, zt_2, zt_1) @@ -2971,10 +2976,10 @@ relation Comptype_sub: `%|-%<:%`(context, comptype, comptype) relation Subtype_ok: `%|-%:%`(context, subtype, oktypeidx) ;; 3-typing.watsup rule _{C : context, `x*` : idx*, comptype : comptype, x_0 : idx, `x'**` : idx**, `comptype'*` : comptype*}: - `%|-%:%`(C, SUB_subtype(`FINAL%?`_fin(()?{}), _IDX_typeuse(x)*{x <- `x*`}, comptype), OK_oktypeidx(x_0)) + `%|-%:%`(C, SUB_subtype(FINAL_FINAL?{}, _IDX_typeuse(x)*{x <- `x*`}, comptype), OK_oktypeidx(x_0)) -- if (|x*{x <- `x*`}| <= 1) -- (if (x!`%`_idx.0 < x_0!`%`_idx.0))*{x <- `x*`} - -- (if ($unrolldt(C.TYPES_context[x!`%`_idx.0]) = SUB_subtype(`FINAL%?`_fin(?()), _IDX_typeuse(x')*{x' <- `x'*`}, comptype')))*{comptype' <- `comptype'*`, x <- `x*`, `x'*` <- `x'**`} + -- (if ($unrolldt(C.TYPES_context[x!`%`_idx.0]) = SUB_subtype(?(), _IDX_typeuse(x')*{x' <- `x'*`}, comptype')))*{comptype' <- `comptype'*`, x <- `x*`, `x'*` <- `x'**`} -- Comptype_ok: `%|-%:OK`(C, comptype) -- (Comptype_sub: `%|-%<:%`(C, comptype, comptype'))*{comptype' <- `comptype'*`} @@ -3000,10 +3005,10 @@ def $unrollht(context : context, heaptype : heaptype) : subtype relation Subtype_ok2: `%|-%:%`(context, subtype, oktypeidxnat) ;; 3-typing.watsup rule _{C : context, `typeuse*` : typeuse*, compttype : comptype, x : idx, i : nat, `typeuse'**` : typeuse**, `comptype'*` : comptype*, comptype : comptype}: - `%|-%:%`(C, SUB_subtype(`FINAL%?`_fin(()?{}), typeuse*{typeuse <- `typeuse*`}, compttype), OK_oktypeidxnat(x, i)) + `%|-%:%`(C, SUB_subtype(FINAL_FINAL?{}, typeuse*{typeuse <- `typeuse*`}, compttype), OK_oktypeidxnat(x, i)) -- if (|typeuse*{typeuse <- `typeuse*`}| <= 1) -- (if $before(typeuse, x, i))*{typeuse <- `typeuse*`} - -- (if ($unrollht(C, (typeuse : typeuse <: heaptype)) = SUB_subtype(`FINAL%?`_fin(?()), typeuse'*{typeuse' <- `typeuse'*`}, comptype')))*{comptype' <- `comptype'*`, typeuse <- `typeuse*`, `typeuse'*` <- `typeuse'**`} + -- (if ($unrollht(C, (typeuse : typeuse <: heaptype)) = SUB_subtype(?(), typeuse'*{typeuse' <- `typeuse'*`}, comptype')))*{comptype' <- `comptype'*`, typeuse <- `typeuse*`, `typeuse'*` <- `typeuse'**`} -- Comptype_ok: `%|-%:OK`(C, comptype) -- (Comptype_sub: `%|-%<:%`(C, comptype, comptype'))*{comptype' <- `comptype'*`} @@ -3064,7 +3069,7 @@ relation Limits_ok: `%|-%:%`(context, limits, nat) relation Globaltype_ok: `%|-%:OK`(context, globaltype) ;; 3-typing.watsup rule _{C : context, t : valtype}: - `%|-%:OK`(C, `%%`_globaltype(`MUT%?`_mut(()?{}), t)) + `%|-%:OK`(C, `%%`_globaltype(MUT_MUT?{}, t)) -- Valtype_ok: `%|-%:OK`(C, t) ;; 3-typing.watsup @@ -3140,12 +3145,12 @@ relation Limits_sub: `%|-%<:%`(context, limits, limits) relation Globaltype_sub: `%|-%<:%`(context, globaltype, globaltype) ;; 3-typing.watsup rule const{C : context, valtype_1 : valtype, valtype_2 : valtype}: - `%|-%<:%`(C, `%%`_globaltype(`MUT%?`_mut(?()), valtype_1), `%%`_globaltype(`MUT%?`_mut(?()), valtype_2)) + `%|-%<:%`(C, `%%`_globaltype(?(), valtype_1), `%%`_globaltype(?(), valtype_2)) -- Valtype_sub: `%|-%<:%`(C, valtype_1, valtype_2) ;; 3-typing.watsup rule var{C : context, valtype_1 : valtype, valtype_2 : valtype}: - `%|-%<:%`(C, `%%`_globaltype(`MUT%?`_mut(?(())), valtype_1), `%%`_globaltype(`MUT%?`_mut(?(())), valtype_2)) + `%|-%<:%`(C, `%%`_globaltype(?(MUT_MUT), valtype_1), `%%`_globaltype(?(MUT_MUT), valtype_2)) -- Valtype_sub: `%|-%<:%`(C, valtype_1, valtype_2) -- Valtype_sub: `%|-%<:%`(C, valtype_2, valtype_1) @@ -3224,7 +3229,7 @@ relation Catch_ok: `%|-%:OK`(context, catch) rule catch_ref{C : context, x : idx, l : labelidx, `t*` : valtype*}: `%|-%:OK`(C, CATCH_REF_catch(x, l)) -- Expand: `%~~%`(C.TAGS_context[x!`%`_idx.0], FUNC_comptype(`%->%`_functype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([])))) - -- Resulttype_sub: `%|-%<:%`(C, t*{t <- `t*`} ++ [REF_valtype(`NULL%?`_nul(?()), EXN_heaptype)], C.LABELS_context[l!`%`_labelidx.0]!`%`_resulttype.0) + -- Resulttype_sub: `%|-%<:%`(C, t*{t <- `t*`} ++ [REF_valtype(?(), EXN_heaptype)], C.LABELS_context[l!`%`_labelidx.0]!`%`_resulttype.0) ;; 3-typing.watsup rule catch_all{C : context, l : labelidx}: @@ -3234,7 +3239,7 @@ relation Catch_ok: `%|-%:OK`(context, catch) ;; 3-typing.watsup rule catch_all_ref{C : context, l : labelidx}: `%|-%:OK`(C, CATCH_ALL_REF_catch(l)) - -- Resulttype_sub: `%|-%<:%`(C, [REF_valtype(`NULL%?`_nul(?()), EXN_heaptype)], C.LABELS_context[l!`%`_labelidx.0]!`%`_resulttype.0) + -- Resulttype_sub: `%|-%<:%`(C, [REF_valtype(?(), EXN_heaptype)], C.LABELS_context[l!`%`_labelidx.0]!`%`_resulttype.0) ;; 6-runtime-aux.watsup def $default_(valtype : valtype) : val? @@ -3245,9 +3250,9 @@ def $default_(valtype : valtype) : val? ;; 6-runtime-aux.watsup def $default_{Vnn : Vnn}((Vnn : Vnn <: valtype)) = ?(VCONST_val(Vnn, `%`_vec_(0))) ;; 6-runtime-aux.watsup - def $default_{ht : heaptype}(REF_valtype(`NULL%?`_nul(?(())), ht)) = ?(REF.NULL_val(ht)) + def $default_{ht : heaptype}(REF_valtype(?(NULL_NULL), ht)) = ?(REF.NULL_val(ht)) ;; 6-runtime-aux.watsup - def $default_{ht : heaptype}(REF_valtype(`NULL%?`_nul(?()), ht)) = ?() + def $default_{ht : heaptype}(REF_valtype(?(), ht)) = ?() ;; 3-typing.watsup relation Defaultable: `|-%DEFAULTABLE`(valtype) @@ -3277,12 +3282,12 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) ;; 3-typing.watsup:580.1-582.29 rule `select-expl`{C : context, t : valtype}: - `%|-%:%`(C, `SELECT()%?`_instr(?([t])), `%->_%%`_instrtype(`%`_resulttype([t t I32_valtype]), [], `%`_resulttype([t]))) + `%|-%:%`(C, SELECT_instr(?([t])), `%->_%%`_instrtype(`%`_resulttype([t t I32_valtype]), [], `%`_resulttype([t]))) -- Valtype_ok: `%|-%:OK`(C, t) ;; 3-typing.watsup:584.1-588.37 rule `select-impl`{C : context, t : valtype, t' : valtype, numtype : numtype, vectype : vectype}: - `%|-%:%`(C, `SELECT()%?`_instr(?()), `%->_%%`_instrtype(`%`_resulttype([t t I32_valtype]), [], `%`_resulttype([t]))) + `%|-%:%`(C, SELECT_instr(?()), `%->_%%`_instrtype(`%`_resulttype([t t I32_valtype]), [], `%`_resulttype([t]))) -- Valtype_ok: `%|-%:OK`(C, t) -- Valtype_sub: `%|-%<:%`(C, t, t') -- if ((t' = (numtype : numtype <: valtype)) \/ (t' = (vectype : vectype <: valtype))) @@ -3326,14 +3331,14 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) ;; 3-typing.watsup:638.1-641.31 rule br_on_null{C : context, l : labelidx, `t*` : valtype*, ht : heaptype}: - `%|-%:%`(C, BR_ON_NULL_instr(l), `%->_%%`_instrtype(`%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(`NULL%?`_nul(?(())), ht)]), [], `%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(`NULL%?`_nul(?()), ht)]))) + `%|-%:%`(C, BR_ON_NULL_instr(l), `%->_%%`_instrtype(`%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(?(NULL_NULL), ht)]), [], `%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(?(), ht)]))) -- if (C.LABELS_context[l!`%`_labelidx.0]!`%`_resulttype.0 = t*{t <- `t*`}) -- Heaptype_ok: `%|-%:OK`(C, ht) ;; 3-typing.watsup:643.1-645.34 rule br_on_non_null{C : context, l : labelidx, `t*` : valtype*, ht : heaptype}: - `%|-%:%`(C, BR_ON_NON_NULL_instr(l), `%->_%%`_instrtype(`%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(`NULL%?`_nul(?(())), ht)]), [], `%`_resulttype(t*{t <- `t*`}))) - -- if (C.LABELS_context[l!`%`_labelidx.0] = `%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(`NULL%?`_nul(?()), ht)])) + `%|-%:%`(C, BR_ON_NON_NULL_instr(l), `%->_%%`_instrtype(`%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(?(NULL_NULL), ht)]), [], `%`_resulttype(t*{t <- `t*`}))) + -- if (C.LABELS_context[l!`%`_labelidx.0] = `%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(?(), ht)])) ;; 3-typing.watsup:647.1-653.34 rule br_on_cast{C : context, l : labelidx, rt_1 : reftype, rt_2 : reftype, `t*` : valtype*, rt : reftype}: @@ -3360,35 +3365,35 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) ;; 3-typing.watsup:670.1-672.47 rule call_ref{C : context, x : idx, `t_1*` : valtype*, `t_2*` : valtype*}: - `%|-%:%`(C, CALL_REF_instr(_IDX_typeuse(x)), `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`} ++ [REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x))]), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) + `%|-%:%`(C, CALL_REF_instr(_IDX_typeuse(x)), `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`} ++ [REF_valtype(?(NULL_NULL), _IDX_heaptype(x))]), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], FUNC_comptype(`%->%`_functype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`})))) ;; 3-typing.watsup:674.1-678.47 rule call_indirect{C : context, x : idx, y : idx, `t_1*` : valtype*, at : addrtype, `t_2*` : valtype*, lim : limits, rt : reftype}: `%|-%:%`(C, CALL_INDIRECT_instr(x, _IDX_typeuse(y)), `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`} ++ [(at : addrtype <: valtype)]), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) -- if (C.TABLES_context[x!`%`_idx.0] = `%%%`_tabletype(at, lim, rt)) - -- Reftype_sub: `%|-%<:%`(C, rt, REF_reftype(`NULL%?`_nul(?(())), FUNC_heaptype)) + -- Reftype_sub: `%|-%<:%`(C, rt, REF_reftype(?(NULL_NULL), FUNC_heaptype)) -- Expand: `%~~%`(C.TYPES_context[y!`%`_idx.0], FUNC_comptype(`%->%`_functype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`})))) ;; 3-typing.watsup:680.1-683.42 rule return{C : context, `t_1*` : valtype*, `t*` : valtype*, `t_2*` : valtype*}: `%|-%:%`(C, RETURN_instr, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`} ++ t*{t <- `t*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) - -- if (C.RETURN_context = ?(`%`_list(t*{t <- `t*`}))) + -- if (C.RETURN_context = ?(`%`_resulttype(t*{t <- `t*`}))) -- Instrtype_ok: `%|-%:OK`(C, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) ;; 3-typing.watsup:686.1-691.42 rule return_call{C : context, x : idx, `t_3*` : valtype*, `t_1*` : valtype*, `t_4*` : valtype*, `t_2*` : valtype*, `t'_2*` : valtype*}: `%|-%:%`(C, RETURN_CALL_instr(x), `%->_%%`_instrtype(`%`_resulttype(t_3*{t_3 <- `t_3*`} ++ t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_4*{t_4 <- `t_4*`}))) -- Expand: `%~~%`(C.FUNCS_context[x!`%`_idx.0], FUNC_comptype(`%->%`_functype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`})))) - -- if (C.RETURN_context = ?(`%`_list(t'_2*{t'_2 <- `t'_2*`}))) + -- if (C.RETURN_context = ?(`%`_resulttype(t'_2*{t'_2 <- `t'_2*`}))) -- Resulttype_sub: `%|-%<:%`(C, t_2*{t_2 <- `t_2*`}, t'_2*{t'_2 <- `t'_2*`}) -- Instrtype_ok: `%|-%:OK`(C, `%->_%%`_instrtype(`%`_resulttype(t_3*{t_3 <- `t_3*`}), [], `%`_resulttype(t_4*{t_4 <- `t_4*`}))) ;; 3-typing.watsup:694.1-699.42 rule return_call_ref{C : context, x : idx, `t_3*` : valtype*, `t_1*` : valtype*, `t_4*` : valtype*, `t_2*` : valtype*, `t'_2*` : valtype*}: - `%|-%:%`(C, RETURN_CALL_REF_instr(_IDX_typeuse(x)), `%->_%%`_instrtype(`%`_resulttype(t_3*{t_3 <- `t_3*`} ++ t_1*{t_1 <- `t_1*`} ++ [REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x))]), [], `%`_resulttype(t_4*{t_4 <- `t_4*`}))) + `%|-%:%`(C, RETURN_CALL_REF_instr(_IDX_typeuse(x)), `%->_%%`_instrtype(`%`_resulttype(t_3*{t_3 <- `t_3*`} ++ t_1*{t_1 <- `t_1*`} ++ [REF_valtype(?(NULL_NULL), _IDX_heaptype(x))]), [], `%`_resulttype(t_4*{t_4 <- `t_4*`}))) -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], FUNC_comptype(`%->%`_functype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`})))) - -- if (C.RETURN_context = ?(`%`_list(t'_2*{t'_2 <- `t'_2*`}))) + -- if (C.RETURN_context = ?(`%`_resulttype(t'_2*{t'_2 <- `t'_2*`}))) -- Resulttype_sub: `%|-%<:%`(C, t_2*{t_2 <- `t_2*`}, t'_2*{t'_2 <- `t'_2*`}) -- Instrtype_ok: `%|-%:OK`(C, `%->_%%`_instrtype(`%`_resulttype(t_3*{t_3 <- `t_3*`}), [], `%`_resulttype(t_4*{t_4 <- `t_4*`}))) @@ -3396,9 +3401,9 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) rule return_call_indirect{C : context, x : idx, y : idx, `t_3*` : valtype*, `t_1*` : valtype*, at : addrtype, `t_4*` : valtype*, lim : limits, rt : reftype, `t_2*` : valtype*, `t'_2*` : valtype*}: `%|-%:%`(C, RETURN_CALL_INDIRECT_instr(x, _IDX_typeuse(y)), `%->_%%`_instrtype(`%`_resulttype(t_3*{t_3 <- `t_3*`} ++ t_1*{t_1 <- `t_1*`} ++ [(at : addrtype <: valtype)]), [], `%`_resulttype(t_4*{t_4 <- `t_4*`}))) -- if (C.TABLES_context[x!`%`_idx.0] = `%%%`_tabletype(at, lim, rt)) - -- Reftype_sub: `%|-%<:%`(C, rt, REF_reftype(`NULL%?`_nul(?(())), FUNC_heaptype)) + -- Reftype_sub: `%|-%<:%`(C, rt, REF_reftype(?(NULL_NULL), FUNC_heaptype)) -- Expand: `%~~%`(C.TYPES_context[y!`%`_idx.0], FUNC_comptype(`%->%`_functype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`})))) - -- if (C.RETURN_context = ?(`%`_list(t'_2*{t'_2 <- `t'_2*`}))) + -- if (C.RETURN_context = ?(`%`_resulttype(t'_2*{t'_2 <- `t'_2*`}))) -- Resulttype_sub: `%|-%<:%`(C, t_2*{t_2 <- `t_2*`}, t'_2*{t'_2 <- `t'_2*`}) -- Instrtype_ok: `%|-%:OK`(C, `%->_%%`_instrtype(`%`_resulttype(t_3*{t_3 <- `t_3*`}), [], `%`_resulttype(t_4*{t_4 <- `t_4*`}))) @@ -3410,7 +3415,7 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) ;; 3-typing.watsup:722.1-724.42 rule throw_ref{C : context, `t_1*` : valtype*, `t_2*` : valtype*}: - `%|-%:%`(C, THROW_REF_instr, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`} ++ [REF_valtype(`NULL%?`_nul(?(())), EXN_heaptype)]), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) + `%|-%:%`(C, THROW_REF_instr, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`} ++ [REF_valtype(?(NULL_NULL), EXN_heaptype)]), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) -- Instrtype_ok: `%|-%:OK`(C, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) ;; 3-typing.watsup:726.1-730.34 @@ -3446,32 +3451,32 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) ;; 3-typing.watsup:774.1-776.31 rule ref.null{C : context, ht : heaptype}: - `%|-%:%`(C, REF.NULL_instr(ht), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), ht)]))) + `%|-%:%`(C, REF.NULL_instr(ht), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([REF_valtype(?(NULL_NULL), ht)]))) -- Heaptype_ok: `%|-%:OK`(C, ht) ;; 3-typing.watsup:778.1-781.20 rule ref.func{C : context, x : idx, dt : deftype}: - `%|-%:%`(C, REF.FUNC_instr(x), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), (dt : deftype <: heaptype))]))) + `%|-%:%`(C, REF.FUNC_instr(x), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([REF_valtype(?(), (dt : deftype <: heaptype))]))) -- if (C.FUNCS_context[x!`%`_idx.0] = dt) -- if x <- C.REFS_context ;; 3-typing.watsup:783.1-784.34 rule ref.i31{C : context}: - `%|-%:%`(C, REF.I31_instr, `%->_%%`_instrtype(`%`_resulttype([I32_valtype]), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), I31_heaptype)]))) + `%|-%:%`(C, REF.I31_instr, `%->_%%`_instrtype(`%`_resulttype([I32_valtype]), [], `%`_resulttype([REF_valtype(?(), I31_heaptype)]))) ;; 3-typing.watsup:786.1-788.31 rule ref.is_null{C : context, ht : heaptype}: - `%|-%:%`(C, REF.IS_NULL_instr, `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), ht)]), [], `%`_resulttype([I32_valtype]))) + `%|-%:%`(C, REF.IS_NULL_instr, `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), ht)]), [], `%`_resulttype([I32_valtype]))) -- Heaptype_ok: `%|-%:OK`(C, ht) ;; 3-typing.watsup:790.1-792.31 rule ref.as_non_null{C : context, ht : heaptype}: - `%|-%:%`(C, REF.AS_NON_NULL_instr, `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), ht)]), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), ht)]))) + `%|-%:%`(C, REF.AS_NON_NULL_instr, `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), ht)]), [], `%`_resulttype([REF_valtype(?(), ht)]))) -- Heaptype_ok: `%|-%:OK`(C, ht) ;; 3-typing.watsup:794.1-795.51 rule ref.eq{C : context}: - `%|-%:%`(C, REF.EQ_instr, `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), EQ_heaptype) REF_valtype(`NULL%?`_nul(?(())), EQ_heaptype)]), [], `%`_resulttype([I32_valtype]))) + `%|-%:%`(C, REF.EQ_instr, `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), EQ_heaptype) REF_valtype(?(NULL_NULL), EQ_heaptype)]), [], `%`_resulttype([I32_valtype]))) ;; 3-typing.watsup:797.1-801.33 rule ref.test{C : context, rt : reftype, rt' : reftype}: @@ -3489,98 +3494,98 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) ;; 3-typing.watsup:812.1-813.42 rule i31.get{C : context, sx : sx}: - `%|-%:%`(C, I31.GET_instr(sx), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), I31_heaptype)]), [], `%`_resulttype([I32_valtype]))) + `%|-%:%`(C, I31.GET_instr(sx), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), I31_heaptype)]), [], `%`_resulttype([I32_valtype]))) ;; 3-typing.watsup:818.1-820.44 rule struct.new{C : context, x : idx, `zt*` : storagetype*, `mut*` : mut*}: - `%|-%:%`(C, STRUCT.NEW_instr(x), `%->_%%`_instrtype(`%`_resulttype($unpack(zt)*{zt <- `zt*`}), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), _IDX_heaptype(x))]))) + `%|-%:%`(C, STRUCT.NEW_instr(x), `%->_%%`_instrtype(`%`_resulttype($unpack(zt)*{zt <- `zt*`}), [], `%`_resulttype([REF_valtype(?(), _IDX_heaptype(x))]))) -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], STRUCT_comptype(`%`_structtype(`%%`_fieldtype(mut, zt)*{mut <- `mut*`, zt <- `zt*`}))) ;; 3-typing.watsup:822.1-825.48 rule struct.new_default{C : context, x : idx, `mut*` : mut*, `zt*` : storagetype*}: - `%|-%:%`(C, STRUCT.NEW_DEFAULT_instr(x), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), _IDX_heaptype(x))]))) + `%|-%:%`(C, STRUCT.NEW_DEFAULT_instr(x), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([REF_valtype(?(), _IDX_heaptype(x))]))) -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], STRUCT_comptype(`%`_structtype(`%%`_fieldtype(mut, zt)*{mut <- `mut*`, zt <- `zt*`}))) -- (Defaultable: `|-%DEFAULTABLE`($unpack(zt)))*{zt <- `zt*`} ;; 3-typing.watsup:827.1-831.39 rule struct.get{C : context, `sx?` : sx?, x : idx, i : u32, zt : storagetype, `yt*` : fieldtype*, mut : mut}: - `%|-%:%`(C, STRUCT.GET_instr(sx?{sx <- `sx?`}, x, i), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x))]), [], `%`_resulttype([$unpack(zt)]))) + `%|-%:%`(C, STRUCT.GET_instr(sx?{sx <- `sx?`}, x, i), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), _IDX_heaptype(x))]), [], `%`_resulttype([$unpack(zt)]))) -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], STRUCT_comptype(`%`_structtype(yt*{yt <- `yt*`}))) -- if (yt*{yt <- `yt*`}[i!`%`_u32.0] = `%%`_fieldtype(mut, zt)) -- if ((sx?{sx <- `sx?`} = ?()) <=> (zt = ($unpack(zt) : valtype <: storagetype))) ;; 3-typing.watsup:833.1-836.24 rule struct.set{C : context, x : idx, i : u32, zt : storagetype, `yt*` : fieldtype*}: - `%|-%:%`(C, STRUCT.SET_instr(x, i), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x)) $unpack(zt)]), [], `%`_resulttype([]))) + `%|-%:%`(C, STRUCT.SET_instr(x, i), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), _IDX_heaptype(x)) $unpack(zt)]), [], `%`_resulttype([]))) -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], STRUCT_comptype(`%`_structtype(yt*{yt <- `yt*`}))) - -- if (yt*{yt <- `yt*`}[i!`%`_u32.0] = `%%`_fieldtype(`MUT%?`_mut(?(())), zt)) + -- if (yt*{yt <- `yt*`}[i!`%`_u32.0] = `%%`_fieldtype(?(MUT_MUT), zt)) ;; 3-typing.watsup:841.1-843.42 rule array.new{C : context, x : idx, zt : storagetype, mut : mut}: - `%|-%:%`(C, ARRAY.NEW_instr(x), `%->_%%`_instrtype(`%`_resulttype([$unpack(zt) I32_valtype]), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), _IDX_heaptype(x))]))) + `%|-%:%`(C, ARRAY.NEW_instr(x), `%->_%%`_instrtype(`%`_resulttype([$unpack(zt) I32_valtype]), [], `%`_resulttype([REF_valtype(?(), _IDX_heaptype(x))]))) -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(mut, zt))) ;; 3-typing.watsup:845.1-848.45 rule array.new_default{C : context, x : idx, mut : mut, zt : storagetype}: - `%|-%:%`(C, ARRAY.NEW_DEFAULT_instr(x), `%->_%%`_instrtype(`%`_resulttype([I32_valtype]), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), _IDX_heaptype(x))]))) + `%|-%:%`(C, ARRAY.NEW_DEFAULT_instr(x), `%->_%%`_instrtype(`%`_resulttype([I32_valtype]), [], `%`_resulttype([REF_valtype(?(), _IDX_heaptype(x))]))) -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(mut, zt))) -- Defaultable: `|-%DEFAULTABLE`($unpack(zt)) ;; 3-typing.watsup:850.1-852.42 rule array.new_fixed{C : context, x : idx, n : n, zt : storagetype, mut : mut}: - `%|-%:%`(C, ARRAY.NEW_FIXED_instr(x, `%`_u32(n)), `%->_%%`_instrtype(`%`_resulttype($unpack(zt)^n{}), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), _IDX_heaptype(x))]))) + `%|-%:%`(C, ARRAY.NEW_FIXED_instr(x, `%`_u32(n)), `%->_%%`_instrtype(`%`_resulttype($unpack(zt)^n{}), [], `%`_resulttype([REF_valtype(?(), _IDX_heaptype(x))]))) -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(mut, zt))) ;; 3-typing.watsup:854.1-857.40 rule array.new_elem{C : context, x : idx, y : idx, mut : mut, rt : reftype}: - `%|-%:%`(C, ARRAY.NEW_ELEM_instr(x, y), `%->_%%`_instrtype(`%`_resulttype([I32_valtype I32_valtype]), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), _IDX_heaptype(x))]))) + `%|-%:%`(C, ARRAY.NEW_ELEM_instr(x, y), `%->_%%`_instrtype(`%`_resulttype([I32_valtype I32_valtype]), [], `%`_resulttype([REF_valtype(?(), _IDX_heaptype(x))]))) -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(mut, (rt : reftype <: storagetype)))) -- Reftype_sub: `%|-%<:%`(C, C.ELEMS_context[y!`%`_idx.0], rt) ;; 3-typing.watsup:859.1-863.24 rule array.new_data{C : context, x : idx, y : idx, mut : mut, zt : storagetype, numtype : numtype, vectype : vectype}: - `%|-%:%`(C, ARRAY.NEW_DATA_instr(x, y), `%->_%%`_instrtype(`%`_resulttype([I32_valtype I32_valtype]), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), _IDX_heaptype(x))]))) + `%|-%:%`(C, ARRAY.NEW_DATA_instr(x, y), `%->_%%`_instrtype(`%`_resulttype([I32_valtype I32_valtype]), [], `%`_resulttype([REF_valtype(?(), _IDX_heaptype(x))]))) -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(mut, zt))) -- if (($unpack(zt) = (numtype : numtype <: valtype)) \/ ($unpack(zt) = (vectype : vectype <: valtype))) -- if (C.DATAS_context[y!`%`_idx.0] = OK_datatype) ;; 3-typing.watsup:865.1-868.39 rule array.get{C : context, `sx?` : sx?, x : idx, zt : storagetype, mut : mut}: - `%|-%:%`(C, ARRAY.GET_instr(sx?{sx <- `sx?`}, x), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x)) I32_valtype]), [], `%`_resulttype([$unpack(zt)]))) + `%|-%:%`(C, ARRAY.GET_instr(sx?{sx <- `sx?`}, x), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), _IDX_heaptype(x)) I32_valtype]), [], `%`_resulttype([$unpack(zt)]))) -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(mut, zt))) -- if ((sx?{sx <- `sx?`} = ?()) <=> (zt = ($unpack(zt) : valtype <: storagetype))) ;; 3-typing.watsup:870.1-872.42 rule array.set{C : context, x : idx, zt : storagetype}: - `%|-%:%`(C, ARRAY.SET_instr(x), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x)) I32_valtype $unpack(zt)]), [], `%`_resulttype([]))) - -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(`MUT%?`_mut(?(())), zt))) + `%|-%:%`(C, ARRAY.SET_instr(x), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), _IDX_heaptype(x)) I32_valtype $unpack(zt)]), [], `%`_resulttype([]))) + -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(?(MUT_MUT), zt))) ;; 3-typing.watsup:874.1-875.43 rule array.len{C : context}: - `%|-%:%`(C, ARRAY.LEN_instr, `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), ARRAY_heaptype)]), [], `%`_resulttype([I32_valtype]))) + `%|-%:%`(C, ARRAY.LEN_instr, `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), ARRAY_heaptype)]), [], `%`_resulttype([I32_valtype]))) ;; 3-typing.watsup:877.1-879.42 rule array.fill{C : context, x : idx, zt : storagetype}: - `%|-%:%`(C, ARRAY.FILL_instr(x), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x)) I32_valtype $unpack(zt) I32_valtype]), [], `%`_resulttype([]))) - -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(`MUT%?`_mut(?(())), zt))) + `%|-%:%`(C, ARRAY.FILL_instr(x), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), _IDX_heaptype(x)) I32_valtype $unpack(zt) I32_valtype]), [], `%`_resulttype([]))) + -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(?(MUT_MUT), zt))) ;; 3-typing.watsup:881.1-885.40 rule array.copy{C : context, x_1 : idx, x_2 : idx, zt_1 : storagetype, mut : mut, zt_2 : storagetype}: - `%|-%:%`(C, ARRAY.COPY_instr(x_1, x_2), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x_1)) I32_valtype REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x_2)) I32_valtype I32_valtype]), [], `%`_resulttype([]))) - -- Expand: `%~~%`(C.TYPES_context[x_1!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(`MUT%?`_mut(?(())), zt_1))) + `%|-%:%`(C, ARRAY.COPY_instr(x_1, x_2), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), _IDX_heaptype(x_1)) I32_valtype REF_valtype(?(NULL_NULL), _IDX_heaptype(x_2)) I32_valtype I32_valtype]), [], `%`_resulttype([]))) + -- Expand: `%~~%`(C.TYPES_context[x_1!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(?(MUT_MUT), zt_1))) -- Expand: `%~~%`(C.TYPES_context[x_2!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(mut, zt_2))) -- Storagetype_sub: `%|-%<:%`(C, zt_2, zt_1) ;; 3-typing.watsup:887.1-890.44 rule array.init_elem{C : context, x : idx, y : idx, zt : storagetype}: - `%|-%:%`(C, ARRAY.INIT_ELEM_instr(x, y), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x)) I32_valtype I32_valtype I32_valtype]), [], `%`_resulttype([]))) - -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(`MUT%?`_mut(?(())), zt))) + `%|-%:%`(C, ARRAY.INIT_ELEM_instr(x, y), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), _IDX_heaptype(x)) I32_valtype I32_valtype I32_valtype]), [], `%`_resulttype([]))) + -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(?(MUT_MUT), zt))) -- Storagetype_sub: `%|-%<:%`(C, (C.ELEMS_context[y!`%`_idx.0] : reftype <: storagetype), zt) ;; 3-typing.watsup:892.1-896.24 rule array.init_data{C : context, x : idx, y : idx, zt : storagetype, numtype : numtype, vectype : vectype}: - `%|-%:%`(C, ARRAY.INIT_DATA_instr(x, y), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x)) I32_valtype I32_valtype I32_valtype]), [], `%`_resulttype([]))) - -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(`MUT%?`_mut(?(())), zt))) + `%|-%:%`(C, ARRAY.INIT_DATA_instr(x, y), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), _IDX_heaptype(x)) I32_valtype I32_valtype I32_valtype]), [], `%`_resulttype([]))) + -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(?(MUT_MUT), zt))) -- if (($unpack(zt) = (numtype : numtype <: valtype)) \/ ($unpack(zt) = (vectype : vectype <: valtype))) -- if (C.DATAS_context[y!`%`_idx.0] = OK_datatype) @@ -3708,7 +3713,7 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) ;; 3-typing.watsup:1003.1-1005.29 rule global.set{C : context, x : idx, t : valtype}: `%|-%:%`(C, GLOBAL.SET_instr(x), `%->_%%`_instrtype(`%`_resulttype([t]), [], `%`_resulttype([]))) - -- if (C.GLOBALS_context[x!`%`_idx.0] = `%%`_globaltype(`MUT%?`_mut(?(())), t)) + -- if (C.GLOBALS_context[x!`%`_idx.0] = `%%`_globaltype(?(MUT_MUT), t)) ;; 3-typing.watsup:1010.1-1012.32 rule table.get{C : context, x : idx, at : addrtype, rt : reftype, lim : limits}: @@ -3948,7 +3953,7 @@ relation Instr_const: `%|-%CONST`(context, instr) ;; 3-typing.watsup rule global.get{C : context, x : idx, t : valtype}: `%|-%CONST`(C, GLOBAL.GET_instr(x)) - -- if (C.GLOBALS_context[x!`%`_idx.0] = `%%`_globaltype(`MUT%?`_mut(?()), t)) + -- if (C.GLOBALS_context[x!`%`_idx.0] = `%%`_globaltype(?(), t)) ;; 3-typing.watsup rule binop{C : context, Inn : Inn, binop : binop_((Inn : Inn <: numtype))}: @@ -5692,38 +5697,38 @@ rec { relation Ref_type: `%|-%:%`(store, ref, reftype) ;; 7-runtime-typing.watsup:17.1-18.35 rule null{s : store, ht : heaptype}: - `%|-%:%`(s, REF.NULL_ref(ht), REF_reftype(`NULL%?`_nul(?(())), ht)) + `%|-%:%`(s, REF.NULL_ref(ht), REF_reftype(?(NULL_NULL), ht)) ;; 7-runtime-typing.watsup:20.1-21.37 rule i31{s : store, i : u31}: - `%|-%:%`(s, REF.I31_NUM_ref(i), REF_reftype(`NULL%?`_nul(?()), I31_heaptype)) + `%|-%:%`(s, REF.I31_NUM_ref(i), REF_reftype(?(), I31_heaptype)) ;; 7-runtime-typing.watsup:23.1-25.31 rule struct{s : store, a : addr, dt : deftype}: - `%|-%:%`(s, REF.STRUCT_ADDR_ref(a), REF_reftype(`NULL%?`_nul(?()), (dt : deftype <: heaptype))) + `%|-%:%`(s, REF.STRUCT_ADDR_ref(a), REF_reftype(?(), (dt : deftype <: heaptype))) -- if (s.STRUCTS_store[a].TYPE_structinst = dt) ;; 7-runtime-typing.watsup:27.1-29.30 rule array{s : store, a : addr, dt : deftype}: - `%|-%:%`(s, REF.ARRAY_ADDR_ref(a), REF_reftype(`NULL%?`_nul(?()), (dt : deftype <: heaptype))) + `%|-%:%`(s, REF.ARRAY_ADDR_ref(a), REF_reftype(?(), (dt : deftype <: heaptype))) -- if (s.ARRAYS_store[a].TYPE_arrayinst = dt) ;; 7-runtime-typing.watsup:31.1-33.29 rule func{s : store, a : addr, dt : deftype}: - `%|-%:%`(s, REF.FUNC_ADDR_ref(a), REF_reftype(`NULL%?`_nul(?()), (dt : deftype <: heaptype))) + `%|-%:%`(s, REF.FUNC_ADDR_ref(a), REF_reftype(?(), (dt : deftype <: heaptype))) -- if (s.FUNCS_store[a].TYPE_funcinst = dt) ;; 7-runtime-typing.watsup:35.1-36.38 rule exn{s : store, a : addr}: - `%|-%:%`(s, REF.EXN_ADDR_ref(a), REF_reftype(`NULL%?`_nul(?()), EXN_heaptype)) + `%|-%:%`(s, REF.EXN_ADDR_ref(a), REF_reftype(?(), EXN_heaptype)) ;; 7-runtime-typing.watsup:38.1-39.39 rule host{s : store, a : addr}: - `%|-%:%`(s, REF.HOST_ADDR_ref(a), REF_reftype(`NULL%?`_nul(?()), ANY_heaptype)) + `%|-%:%`(s, REF.HOST_ADDR_ref(a), REF_reftype(?(), ANY_heaptype)) ;; 7-runtime-typing.watsup:41.1-42.45 rule extern{s : store, addrref : addrref}: - `%|-%:%`(s, REF.EXTERN_ref(addrref), REF_reftype(`NULL%?`_nul(?()), EXTERN_heaptype)) + `%|-%:%`(s, REF.EXTERN_ref(addrref), REF_reftype(?(), EXTERN_heaptype)) ;; 7-runtime-typing.watsup:44.1-47.34 rule sub{s : store, ref : ref, rt : reftype, rt' : reftype}: @@ -5802,12 +5807,12 @@ relation Step_pure: `%~>%`(instr*, instr*) ;; 8-reduction.watsup rule `select-true`{val_1 : val, val_2 : val, c : num_(I32_numtype), `t*?` : valtype*?}: - `%~>%`([(val_1 : val <: instr) (val_2 : val <: instr) CONST_instr(I32_numtype, c) `SELECT()%?`_instr(t*{t <- `t*`}?{`t*` <- `t*?`})], [(val_1 : val <: instr)]) + `%~>%`([(val_1 : val <: instr) (val_2 : val <: instr) CONST_instr(I32_numtype, c) SELECT_instr(t*{t <- `t*`}?{`t*` <- `t*?`})], [(val_1 : val <: instr)]) -- if (c!`%`_num_.0 =/= 0) ;; 8-reduction.watsup rule `select-false`{val_1 : val, val_2 : val, c : num_(I32_numtype), `t*?` : valtype*?}: - `%~>%`([(val_1 : val <: instr) (val_2 : val <: instr) CONST_instr(I32_numtype, c) `SELECT()%?`_instr(t*{t <- `t*`}?{`t*` <- `t*?`})], [(val_2 : val <: instr)]) + `%~>%`([(val_1 : val <: instr) (val_2 : val <: instr) CONST_instr(I32_numtype, c) SELECT_instr(t*{t <- `t*`}?{`t*` <- `t*?`})], [(val_2 : val <: instr)]) -- if (c!`%`_num_.0 = 0) ;; 8-reduction.watsup @@ -5880,11 +5885,11 @@ relation Step_pure: `%~>%`(instr*, instr*) ;; 8-reduction.watsup rule call_indirect{x : idx, yy : typeuse}: - `%~>%`([CALL_INDIRECT_instr(x, yy)], [TABLE.GET_instr(x) REF.CAST_instr(REF_reftype(`NULL%?`_nul(?(())), (yy : typeuse <: heaptype))) CALL_REF_instr(yy)]) + `%~>%`([CALL_INDIRECT_instr(x, yy)], [TABLE.GET_instr(x) REF.CAST_instr(REF_reftype(?(NULL_NULL), (yy : typeuse <: heaptype))) CALL_REF_instr(yy)]) ;; 8-reduction.watsup rule return_call_indirect{x : idx, yy : typeuse}: - `%~>%`([RETURN_CALL_INDIRECT_instr(x, yy)], [TABLE.GET_instr(x) REF.CAST_instr(REF_reftype(`NULL%?`_nul(?(())), (yy : typeuse <: heaptype))) RETURN_CALL_REF_instr(yy)]) + `%~>%`([RETURN_CALL_INDIRECT_instr(x, yy)], [TABLE.GET_instr(x) REF.CAST_instr(REF_reftype(?(NULL_NULL), (yy : typeuse <: heaptype))) RETURN_CALL_REF_instr(yy)]) ;; 8-reduction.watsup rule `frame-vals`{n : n, f : frame, `val*` : val*}: @@ -7353,11 +7358,11 @@ grammar Bheaptype : heaptype ;; A-binary.watsup grammar Breftype : reftype ;; A-binary.watsup - prod{ht : heaptype} {0x63 ht:Bheaptype} => REF_reftype(`NULL%?`_nul(?(())), ht) + prod{ht : heaptype} {0x63 ht:Bheaptype} => REF_reftype(?(NULL_NULL), ht) ;; A-binary.watsup - prod{ht : heaptype} {0x64 ht:Bheaptype} => REF_reftype(`NULL%?`_nul(?()), ht) + prod{ht : heaptype} {0x64 ht:Bheaptype} => REF_reftype(?(), ht) ;; A-binary.watsup - prod{ht : heaptype} ht:Babsheaptype => REF_reftype(`NULL%?`_nul(?(())), ht) + prod{ht : heaptype} ht:Babsheaptype => REF_reftype(?(NULL_NULL), ht) ;; A-binary.watsup grammar Bvaltype : valtype @@ -7376,9 +7381,9 @@ grammar Bresulttype : resulttype ;; A-binary.watsup grammar Bmut : mut ;; A-binary.watsup - prod 0x00 => `MUT%?`_mut(?()) + prod 0x00 => ?() ;; A-binary.watsup - prod 0x01 => `MUT%?`_mut(?(())) + prod 0x01 => ?(MUT_MUT) ;; A-binary.watsup grammar Bpacktype : packtype @@ -7411,11 +7416,11 @@ grammar Bcomptype : comptype ;; A-binary.watsup grammar Bsubtype : subtype ;; A-binary.watsup - prod{`x*` : idx*, ct : comptype} {0x4F x*{x <- `x*`}:Blist(syntax typeidx, grammar Btypeidx) ct:Bcomptype} => SUB_subtype(`FINAL%?`_fin(?(())), _IDX_typeuse(x)*{x <- `x*`}, ct) + prod{`x*` : idx*, ct : comptype} {0x4F x*{x <- `x*`}:Blist(syntax typeidx, grammar Btypeidx) ct:Bcomptype} => SUB_subtype(?(FINAL_FINAL), _IDX_typeuse(x)*{x <- `x*`}, ct) ;; A-binary.watsup - prod{`x*` : idx*, ct : comptype} {0x50 x*{x <- `x*`}:Blist(syntax typeidx, grammar Btypeidx) ct:Bcomptype} => SUB_subtype(`FINAL%?`_fin(?()), _IDX_typeuse(x)*{x <- `x*`}, ct) + prod{`x*` : idx*, ct : comptype} {0x50 x*{x <- `x*`}:Blist(syntax typeidx, grammar Btypeidx) ct:Bcomptype} => SUB_subtype(?(), _IDX_typeuse(x)*{x <- `x*`}, ct) ;; A-binary.watsup - prod{ct : comptype} ct:Bcomptype => SUB_subtype(`FINAL%?`_fin(?(())), [], ct) + prod{ct : comptype} ct:Bcomptype => SUB_subtype(?(FINAL_FINAL), [], ct) ;; A-binary.watsup grammar Brectype : rectype @@ -7495,13 +7500,13 @@ syntax castop = (nul, nul) ;; A-binary.watsup grammar Bcastop : castop ;; A-binary.watsup - prod 0x00 => (`NULL%?`_nul(?()), `NULL%?`_nul(?())) + prod 0x00 => (?(), ?()) ;; A-binary.watsup - prod 0x01 => (`NULL%?`_nul(?(())), `NULL%?`_nul(?())) + prod 0x01 => (?(NULL_NULL), ?()) ;; A-binary.watsup - prod 0x02 => (`NULL%?`_nul(?()), `NULL%?`_nul(?(()))) + prod 0x02 => (?(), ?(NULL_NULL)) ;; A-binary.watsup - prod 0x03 => (`NULL%?`_nul(?(())), `NULL%?`_nul(?(()))) + prod 0x03 => (?(NULL_NULL), ?(NULL_NULL)) ;; A-binary.watsup syntax memidxop = (memidx, memarg) @@ -7614,13 +7619,13 @@ grammar Binstr : instr ;; A-binary.watsup:286.5-286.62 prod{x : idx, y : idx} {0xFB `%`_u32(19):Bu32 x:Btypeidx y:Belemidx} => ARRAY.INIT_ELEM_instr(x, y) ;; A-binary.watsup:290.5-290.51 - prod{ht : heaptype} {0xFB `%`_u32(20):Bu32 ht:Bheaptype} => REF.TEST_instr(REF_reftype(`NULL%?`_nul(?()), ht)) + prod{ht : heaptype} {0xFB `%`_u32(20):Bu32 ht:Bheaptype} => REF.TEST_instr(REF_reftype(?(), ht)) ;; A-binary.watsup:291.5-291.56 - prod{ht : heaptype} {0xFB `%`_u32(21):Bu32 ht:Bheaptype} => REF.TEST_instr(REF_reftype(`NULL%?`_nul(?(())), ht)) + prod{ht : heaptype} {0xFB `%`_u32(21):Bu32 ht:Bheaptype} => REF.TEST_instr(REF_reftype(?(NULL_NULL), ht)) ;; A-binary.watsup:292.5-292.51 - prod{ht : heaptype} {0xFB `%`_u32(22):Bu32 ht:Bheaptype} => REF.CAST_instr(REF_reftype(`NULL%?`_nul(?()), ht)) + prod{ht : heaptype} {0xFB `%`_u32(22):Bu32 ht:Bheaptype} => REF.CAST_instr(REF_reftype(?(), ht)) ;; A-binary.watsup:293.5-293.56 - prod{ht : heaptype} {0xFB `%`_u32(23):Bu32 ht:Bheaptype} => REF.CAST_instr(REF_reftype(`NULL%?`_nul(?(())), ht)) + prod{ht : heaptype} {0xFB `%`_u32(23):Bu32 ht:Bheaptype} => REF.CAST_instr(REF_reftype(?(NULL_NULL), ht)) ;; A-binary.watsup:294.5-295.94 prod{nul1 : nul1, nul2 : nul2, l : labelidx, ht_1 : heaptype, ht_2 : heaptype} {0xFB `%`_u32(24):Bu32 (nul1, nul2):Bcastop l:Blabelidx ht_1:Bheaptype ht_2:Bheaptype} => BR_ON_CAST_instr(l, REF_reftype(nul1, ht_1), REF_reftype(nul2, ht_2)) ;; A-binary.watsup:296.5-297.99 @@ -7638,9 +7643,9 @@ grammar Binstr : instr ;; A-binary.watsup:315.5-315.17 prod 0x1A => DROP_instr ;; A-binary.watsup:316.5-316.19 - prod 0x1B => `SELECT()%?`_instr(?()) + prod 0x1B => SELECT_instr(?()) ;; A-binary.watsup:317.5-317.41 - prod{ts : valtype} {0x1C [ts]:Blist(syntax valtype, grammar Bvaltype)} => `SELECT()%?`_instr(?([ts])) + prod{ts : valtype} {0x1C [ts]:Blist(syntax valtype, grammar Bvaltype)} => SELECT_instr(?([ts])) ;; A-binary.watsup:324.5-324.36 prod{x : idx} {0x20 x:Blocalidx} => LOCAL.GET_instr(x) ;; A-binary.watsup:325.5-325.36 @@ -8563,7 +8568,7 @@ grammar Bfuncsec : typeidx* grammar Btable : table ;; A-binary.watsup prod{tt : tabletype, ht : heaptype, at : addrtype, lim : limits} tt:Btabletype => TABLE_table(tt, [REF.NULL_instr(ht)]) - -- if (tt = `%%%`_tabletype(at, lim, REF_reftype(`NULL%?`_nul(()?{}), ht))) + -- if (tt = `%%%`_tabletype(at, lim, REF_reftype(NULL_NULL?{}, ht))) ;; A-binary.watsup prod{tt : tabletype, e : expr} {0x40 0x00 tt:Btabletype e:Bexpr} => TABLE_table(tt, e) @@ -8618,24 +8623,24 @@ grammar Bstartsec : start? ;; A-binary.watsup grammar Belemkind : reftype ;; A-binary.watsup - prod 0x00 => REF_reftype(`NULL%?`_nul(?(())), FUNC_heaptype) + prod 0x00 => REF_reftype(?(NULL_NULL), FUNC_heaptype) ;; A-binary.watsup grammar Belem : elem ;; A-binary.watsup - prod{e_o : expr, `y*` : idx*} {`%`_u32(0):Bu32 e_o:Bexpr y*{y <- `y*`}:Blist(syntax funcidx, grammar Bfuncidx)} => ELEM_elem(REF_reftype(`NULL%?`_nul(?()), FUNC_heaptype), [REF.FUNC_instr(y)]*{y <- `y*`}, ACTIVE_elemmode(`%`_tableidx(0), e_o)) + prod{e_o : expr, `y*` : idx*} {`%`_u32(0):Bu32 e_o:Bexpr y*{y <- `y*`}:Blist(syntax funcidx, grammar Bfuncidx)} => ELEM_elem(REF_reftype(?(), FUNC_heaptype), [REF.FUNC_instr(y)*{y <- `y*`}], ACTIVE_elemmode(`%`_tableidx(0), e_o)) ;; A-binary.watsup - prod{rt : reftype, `y*` : idx*} {`%`_u32(1):Bu32 rt:Belemkind y*{y <- `y*`}:Blist(syntax funcidx, grammar Bfuncidx)} => ELEM_elem(rt, [REF.FUNC_instr(y)]*{y <- `y*`}, PASSIVE_elemmode) + prod{rt : reftype, `y*` : idx*} {`%`_u32(1):Bu32 rt:Belemkind y*{y <- `y*`}:Blist(syntax funcidx, grammar Bfuncidx)} => ELEM_elem(rt, [REF.FUNC_instr(y)*{y <- `y*`}], PASSIVE_elemmode) ;; A-binary.watsup - prod{x : idx, e : expr, rt : reftype, `y*` : idx*} {`%`_u32(2):Bu32 x:Btableidx e:Bexpr rt:Belemkind y*{y <- `y*`}:Blist(syntax funcidx, grammar Bfuncidx)} => ELEM_elem(rt, [REF.FUNC_instr(y)]*{y <- `y*`}, ACTIVE_elemmode(x, e)) + prod{x : idx, e : expr, rt : reftype, `y*` : idx*} {`%`_u32(2):Bu32 x:Btableidx e:Bexpr rt:Belemkind y*{y <- `y*`}:Blist(syntax funcidx, grammar Bfuncidx)} => ELEM_elem(rt, [REF.FUNC_instr(y)*{y <- `y*`}], ACTIVE_elemmode(x, e)) ;; A-binary.watsup - prod{rt : reftype, `y*` : idx*} {`%`_u32(3):Bu32 rt:Belemkind y*{y <- `y*`}:Blist(syntax funcidx, grammar Bfuncidx)} => ELEM_elem(rt, [REF.FUNC_instr(y)]*{y <- `y*`}, DECLARE_elemmode) + prod{rt : reftype, `y*` : idx*} {`%`_u32(3):Bu32 rt:Belemkind y*{y <- `y*`}:Blist(syntax funcidx, grammar Bfuncidx)} => ELEM_elem(rt, [REF.FUNC_instr(y)*{y <- `y*`}], DECLARE_elemmode) ;; A-binary.watsup - prod{e_O : expr, `e*` : expr*} {`%`_u32(4):Bu32 e_O:Bexpr e*{e <- `e*`}:Blist(syntax expr, grammar Bexpr)} => ELEM_elem(REF_reftype(`NULL%?`_nul(?(())), FUNC_heaptype), e*{e <- `e*`}, ACTIVE_elemmode(`%`_tableidx(0), e_O)) + prod{e_O : expr, `e*` : expr*} {`%`_u32(4):Bu32 e_O:Bexpr e*{e <- `e*`}:Blist(syntax expr, grammar Bexpr)} => ELEM_elem(REF_reftype(?(NULL_NULL), FUNC_heaptype), e*{e <- `e*`}, ACTIVE_elemmode(`%`_tableidx(0), e_O)) ;; A-binary.watsup prod{rt : reftype, `e*` : expr*} {`%`_u32(5):Bu32 rt:Breftype e*{e <- `e*`}:Blist(syntax expr, grammar Bexpr)} => ELEM_elem(rt, e*{e <- `e*`}, PASSIVE_elemmode) ;; A-binary.watsup - prod{x : idx, e_O : expr, `e*` : expr*} {`%`_u32(6):Bu32 x:Btableidx e_O:Bexpr e*{e <- `e*`}:Blist(syntax expr, grammar Bexpr)} => ELEM_elem(REF_reftype(`NULL%?`_nul(?(())), FUNC_heaptype), e*{e <- `e*`}, ACTIVE_elemmode(x, e_O)) + prod{x : idx, e_O : expr, `e*` : expr*} {`%`_u32(6):Bu32 x:Btableidx e_O:Bexpr e*{e <- `e*`}:Blist(syntax expr, grammar Bexpr)} => ELEM_elem(REF_reftype(?(NULL_NULL), FUNC_heaptype), e*{e <- `e*`}, ACTIVE_elemmode(x, e_O)) ;; A-binary.watsup prod{rt : reftype, `e*` : expr*} {`%`_u32(7):Bu32 rt:Breftype e*{e <- `e*`}:Blist(syntax expr, grammar Bexpr)} => ELEM_elem(rt, e*{e <- `e*`}, DECLARE_elemmode) @@ -8686,7 +8691,7 @@ grammar Bdatasec : data* ;; A-binary.watsup grammar Bdatacnt : u32* ;; A-binary.watsup - prod{n : n} `%`_u32(n):Bu32 => [`%`_uN(n)] + prod{n : n} `%`_u32(n):Bu32 => [`%`_u32(n)] ;; A-binary.watsup syntax nopt = u32* @@ -8742,8 +8747,7 @@ syntax symsplit = | _LAST{A_2 : A}(A_2 : A) ;; C-conventions.watsup -syntax recorddots = - | `()` +syntax recorddots = () ;; C-conventions.watsup syntax record = diff --git a/spectec/test-latex/TEST.md b/spectec/test-latex/TEST.md index 39f086dc51..3b785e0ee7 100644 --- a/spectec/test-latex/TEST.md +++ b/spectec/test-latex/TEST.md @@ -8645,7 +8645,7 @@ $$ {{\mathrm{vcvtop}}}_{{{{\mathsf{i}}{N}}_1}{\mathsf{x}}{M_1}, {{{\mathsf{i}}{N}}_2}{\mathsf{x}}{M_2}}({\mathit{vcvtop}}, \epsilon, {\mathit{zero}}, v_1) & = & v & \quad \begin{array}[t]{@{}l@{}} \mbox{if}~ {c_1^\ast} = {{\mathrm{lanes}}}_{{{{\mathsf{i}}{N}}_1}{\mathsf{x}}{M_1}}(v_1) \\ -{\land}~ {{c^\ast}^\ast} = \Large\times~({{{\mathrm{lcvtop}}}_{{{{\mathsf{i}}{N}}_1}{\mathsf{x}}{M_1}, {{{\mathsf{i}}{N}}_2}{\mathsf{x}}{M_2}}({\mathit{vcvtop}}, c_1)^\ast} \oplus {0^{M_1}}) \\ +{\land}~ {{c^\ast}^\ast} = \Large\times~({{{\mathrm{lcvtop}}}_{{{{\mathsf{i}}{N}}_1}{\mathsf{x}}{M_1}, {{{\mathsf{i}}{N}}_2}{\mathsf{x}}{M_2}}({\mathit{vcvtop}}, c_1)^\ast} \oplus {{}[0]^{M_1}}) \\ {\land}~ v \in {{{{{\mathrm{lanes}}}_{{{{\mathsf{i}}{N}}_2}{\mathsf{x}}{M_2}}^{{-1}}}}{({c^\ast})}^\ast} \\ \end{array} \\ \end{array} diff --git a/spectec/test-middlend/TEST.md b/spectec/test-middlend/TEST.md index c6dbb6ccec..ea99305097 100644 --- a/spectec/test-middlend/TEST.md +++ b/spectec/test-middlend/TEST.md @@ -5,8858 +5,17 @@ $ (cd ../spec/wasm-3.0 && ../../src/exe-watsup/main.exe *.watsup -l --print-all- == Parsing... == Elaboration... -;; 0-aux.watsup -syntax N = nat - -;; 0-aux.watsup -syntax M = nat - -;; 0-aux.watsup -syntax K = nat - -;; 0-aux.watsup -syntax n = nat - -;; 0-aux.watsup -syntax m = nat - -;; 0-aux.watsup -def $min(nat : nat, nat : nat) : nat - ;; 0-aux.watsup - def $min{i : nat, j : nat}(i, j) = i - -- if (i <= j) - ;; 0-aux.watsup - def $min{i : nat, j : nat}(i, j) = j - -- otherwise - -;; 0-aux.watsup -rec { - -;; 0-aux.watsup:20.1-20.56 -def $sum(nat*) : nat - ;; 0-aux.watsup:21.1-21.18 - def $sum([]) = 0 - ;; 0-aux.watsup:22.1-22.35 - def $sum{n : n, `n'*` : n*}([n] ++ n'*{n' <- `n'*`}) = (n + $sum(n'*{n' <- `n'*`})) -} - -;; 0-aux.watsup -rec { - -;; 0-aux.watsup:24.1-24.57 -def $prod(nat*) : nat - ;; 0-aux.watsup:25.1-25.19 - def $prod([]) = 1 - ;; 0-aux.watsup:26.1-26.37 - def $prod{n : n, `n'*` : n*}([n] ++ n'*{n' <- `n'*`}) = (n * $prod(n'*{n' <- `n'*`})) -} - -;; 0-aux.watsup -def $opt_(syntax X, X*) : X? - ;; 0-aux.watsup - def $opt_{syntax X}(syntax X, []) = ?() - ;; 0-aux.watsup - def $opt_{syntax X, w : X}(syntax X, [w]) = ?(w) - -;; 0-aux.watsup -def $list_(syntax X, X?) : X* - ;; 0-aux.watsup - def $list_{syntax X}(syntax X, ?()) = [] - ;; 0-aux.watsup - def $list_{syntax X, w : X}(syntax X, ?(w)) = [w] - -;; 0-aux.watsup -rec { - -;; 0-aux.watsup:40.1-40.55 -def $concat_(syntax X, X**) : X* - ;; 0-aux.watsup:41.1-41.34 - def $concat_{syntax X}(syntax X, []) = [] - ;; 0-aux.watsup:42.1-42.64 - def $concat_{syntax X, `w*` : X*, `w'**` : X**}(syntax X, [w*{w <- `w*`}] ++ w'*{w' <- `w'*`}*{`w'*` <- `w'**`}) = w*{w <- `w*`} ++ $concat_(syntax X, w'*{w' <- `w'*`}*{`w'*` <- `w'**`}) -} - -;; 0-aux.watsup -rec { - -;; 0-aux.watsup:44.1-44.61 -def $concatn_(syntax X, X**, nat : nat) : X* - ;; 0-aux.watsup:45.1-45.38 - def $concatn_{syntax X, n : n}(syntax X, [], n) = [] - ;; 0-aux.watsup:46.1-46.73 - def $concatn_{syntax X, `w*` : X*, n : n, `w'**` : X**}(syntax X, [w^n{w <- `w*`}] ++ w'^n{w' <- `w'*`}*{`w'*` <- `w'**`}, n) = w^n{w <- `w*`} ++ $concatn_(syntax X, w'^n{w' <- `w'*`}*{`w'*` <- `w'**`}, n) -} - -;; 0-aux.watsup -rec { - -;; 0-aux.watsup:51.1-51.78 -def $disjoint_(syntax X, X*) : bool - ;; 0-aux.watsup:52.1-52.37 - def $disjoint_{syntax X}(syntax X, []) = true - ;; 0-aux.watsup:53.1-53.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'*`})) -} - -;; 0-aux.watsup -rec { - -;; 0-aux.watsup:56.1-56.38 -def $setminus1_(syntax X, X : X, X*) : X* - ;; 0-aux.watsup:60.1-60.38 - def $setminus1_{syntax X, w : X}(syntax X, w, []) = [w] - ;; 0-aux.watsup:61.1-61.78 - def $setminus1_{syntax X, w : X, w_1 : X, `w'*` : X*}(syntax X, w, [w_1] ++ w'*{w' <- `w'*`}) = [] - -- if (w = w_1) - ;; 0-aux.watsup:62.1-62.77 - def $setminus1_{syntax X, w : X, w_1 : X, `w'*` : X*}(syntax X, w, [w_1] ++ w'*{w' <- `w'*`}) = $setminus1_(syntax X, w, w'*{w' <- `w'*`}) - -- otherwise -} - -;; 0-aux.watsup -rec { - -;; 0-aux.watsup:55.1-55.56 -def $setminus_(syntax X, X*, X*) : X* - ;; 0-aux.watsup:58.1-58.40 - def $setminus_{syntax X, `w*` : X*}(syntax X, [], w*{w <- `w*`}) = [] - ;; 0-aux.watsup:59.1-59.90 - def $setminus_{syntax X, w_1 : X, `w'*` : X*, `w*` : X*}(syntax X, [w_1] ++ w'*{w' <- `w'*`}, w*{w <- `w*`}) = $setminus1_(syntax X, w_1, w*{w <- `w*`}) ++ $setminus_(syntax X, w'*{w' <- `w'*`}, w*{w <- `w*`}) -} - -;; 0-aux.watsup -rec { - -;; 0-aux.watsup:67.1-67.46 -def $setproduct2_(syntax X, X : X, X**) : X** - ;; 0-aux.watsup:73.1-73.44 - def $setproduct2_{syntax X, w_1 : X}(syntax X, w_1, []) = [] - ;; 0-aux.watsup:74.1-74.90 - def $setproduct2_{syntax X, w_1 : X, `w'*` : X*, `w**` : X**}(syntax X, w_1, [w'*{w' <- `w'*`}] ++ w*{w <- `w*`}*{`w*` <- `w**`}) = [[w_1] ++ w'*{w' <- `w'*`}] ++ $setproduct2_(syntax X, w_1, w*{w <- `w*`}*{`w*` <- `w**`}) -} - -;; 0-aux.watsup -rec { - -;; 0-aux.watsup:66.1-66.47 -def $setproduct1_(syntax X, X*, X**) : X** - ;; 0-aux.watsup:71.1-71.46 - def $setproduct1_{syntax X, `w**` : X**}(syntax X, [], w*{w <- `w*`}*{`w*` <- `w**`}) = [] - ;; 0-aux.watsup:72.1-72.107 - def $setproduct1_{syntax X, w_1 : X, `w'*` : X*, `w**` : X**}(syntax X, [w_1] ++ w'*{w' <- `w'*`}, w*{w <- `w*`}*{`w*` <- `w**`}) = $setproduct2_(syntax X, w_1, w*{w <- `w*`}*{`w*` <- `w**`}) ++ $setproduct1_(syntax X, w'*{w' <- `w'*`}, w*{w <- `w*`}*{`w*` <- `w**`}) -} - -;; 0-aux.watsup -rec { - -;; 0-aux.watsup:65.1-65.82 -def $setproduct_(syntax X, X**) : X** - ;; 0-aux.watsup:69.1-69.40 - def $setproduct_{syntax X}(syntax X, []) = [[]] - ;; 0-aux.watsup:70.1-70.90 - def $setproduct_{syntax X, `w_1*` : X*, `w**` : X**}(syntax X, [w_1*{w_1 <- `w_1*`}] ++ w*{w <- `w*`}*{`w*` <- `w**`}) = $setproduct1_(syntax X, w_1*{w_1 <- `w_1*`}, $setproduct_(syntax X, w*{w <- `w*`}*{`w*` <- `w**`})) -} - -;; 1-syntax.watsup -def $ND : bool - -;; 1-syntax.watsup -syntax bit = - | `%`{i : nat}(i : nat) - -- if ((i = 0) \/ (i = 1)) - -;; 1-syntax.watsup -syntax byte = - | `%`{i : nat}(i : nat) - -- if ((i >= 0) /\ (i <= 255)) - -;; 1-syntax.watsup -syntax uN{N : N}(N) = - | `%`{i : nat}(i : nat) - -- if ((i >= 0) /\ (i <= ((((2 ^ N) : nat <:> int) - (1 : nat <:> int)) : int <:> nat))) - -;; 1-syntax.watsup -syntax sN{N : N}(N) = - | `%`{i : int}(i : int) - -- if ((((i >= - ((2 ^ (((N : nat <:> int) - (1 : nat <:> int)) : int <:> nat)) : nat <:> int)) /\ (i <= - (1 : nat <:> int))) \/ (i = (0 : nat <:> int))) \/ ((i >= + (1 : nat <:> int)) /\ (i <= (((2 ^ (((N : nat <:> int) - (1 : nat <:> int)) : int <:> nat)) : nat <:> int) - (1 : nat <:> int))))) - -;; 1-syntax.watsup -syntax iN{N : N}(N) = uN(N) - -;; 1-syntax.watsup -syntax u8 = uN(8) - -;; 1-syntax.watsup -syntax u16 = uN(16) - -;; 1-syntax.watsup -syntax u31 = uN(31) - -;; 1-syntax.watsup -syntax u32 = uN(32) - -;; 1-syntax.watsup -syntax u64 = uN(64) - -;; 1-syntax.watsup -syntax u128 = uN(128) - -;; 1-syntax.watsup -syntax s33 = sN(33) - -;; 1-syntax.watsup -def $signif(N : N) : nat - ;; 1-syntax.watsup - def $signif(32) = 23 - ;; 1-syntax.watsup - def $signif(64) = 52 - -;; 1-syntax.watsup -def $expon(N : N) : nat - ;; 1-syntax.watsup - def $expon(32) = 8 - ;; 1-syntax.watsup - def $expon(64) = 11 - -;; 1-syntax.watsup -def $M(N : N) : nat - ;; 1-syntax.watsup - def $M{N : N}(N) = $signif(N) - -;; 1-syntax.watsup -def $E(N : N) : nat - ;; 1-syntax.watsup - def $E{N : N}(N) = $expon(N) - -;; 1-syntax.watsup -syntax exp = int - -;; 1-syntax.watsup -syntax fNmag{N : N}(N) = - | NORM{m : m, exp : exp}(m : m, exp : exp) - -- if ((m < (2 ^ $M(N))) /\ ((((2 : nat <:> int) - ((2 ^ ((($E(N) : nat <:> int) - (1 : nat <:> int)) : int <:> nat)) : nat <:> int)) <= exp) /\ (exp <= (((2 ^ ((($E(N) : nat <:> int) - (1 : nat <:> int)) : int <:> nat)) : nat <:> int) - (1 : nat <:> int))))) - | SUBNORM{m : m, exp : exp}(m : m) - -- if ((m < (2 ^ $M(N))) /\ (((2 : nat <:> int) - ((2 ^ ((($E(N) : nat <:> int) - (1 : nat <:> int)) : int <:> nat)) : nat <:> int)) = exp)) - | INF - | `NAN(%)`{m : m}(m : m) - -- if ((1 <= m) /\ (m < (2 ^ $M(N)))) - -;; 1-syntax.watsup -syntax fN{N : N}(N) = - | POS{fNmag : fNmag(N)}(fNmag : fNmag(N)) - | NEG{fNmag : fNmag(N)}(fNmag : fNmag(N)) - -;; 1-syntax.watsup -syntax f32 = fN(32) - -;; 1-syntax.watsup -syntax f64 = fN(64) - -;; 1-syntax.watsup -def $fzero(N : N) : fN(N) - ;; 1-syntax.watsup - def $fzero{N : N}(N) = POS_fN(SUBNORM_fNmag(0)) - -;; 1-syntax.watsup -def $fone(N : N) : fN(N) - ;; 1-syntax.watsup - def $fone{N : N}(N) = POS_fN(NORM_fNmag(1, (0 : nat <:> int))) - -;; 1-syntax.watsup -def $canon_(N : N) : nat - ;; 1-syntax.watsup - def $canon_{N : N}(N) = (2 ^ ((($signif(N) : nat <:> int) - (1 : nat <:> int)) : int <:> nat)) - -;; 1-syntax.watsup -syntax vN{N : N}(N) = iN(N) - -;; 1-syntax.watsup -syntax v128 = vN(128) - -;; 1-syntax.watsup -syntax list{syntax X}(syntax X) = - | `%`{`X*` : X*}(X*{X <- `X*`} : X*) - -- if (|X*{X <- `X*`}| < (2 ^ 32)) - -;; 1-syntax.watsup -syntax char = - | `%`{i : nat}(i : nat) - -- if (((i >= 0) /\ (i <= 55295)) \/ ((i >= 57344) /\ (i <= 1114111))) - -;; A-binary.watsup -def $cont(byte : byte) : nat - ;; A-binary.watsup - def $cont{b : byte}(b) = (((b!`%`_byte.0 : nat <:> int) - (128 : nat <:> int)) : int <:> nat) - -- if ((128 < b!`%`_byte.0) /\ (b!`%`_byte.0 < 192)) - -;; 1-syntax.watsup -rec { - -;; 1-syntax.watsup:97.1-97.25 -def $utf8(char*) : byte* - ;; A-binary.watsup:53.1-53.44 - def $utf8{`ch*` : char*}(ch*{ch <- `ch*`}) = $concat_(syntax byte, $utf8([ch])*{ch <- `ch*`}) - ;; A-binary.watsup:54.1-56.15 - def $utf8{ch : char, b : byte}([ch]) = [b] - -- if (ch!`%`_char.0 < 128) - -- if (`%`_byte(ch!`%`_char.0) = b) - ;; A-binary.watsup:57.1-59.46 - def $utf8{ch : char, b_1 : byte, b_2 : byte}([ch]) = [b_1 b_2] - -- if ((128 <= ch!`%`_char.0) /\ (ch!`%`_char.0 < 2048)) - -- if (ch!`%`_char.0 = (((2 ^ 6) * (((b_1!`%`_byte.0 : nat <:> int) - (192 : nat <:> int)) : int <:> nat)) + $cont(b_2))) - ;; A-binary.watsup:60.1-62.64 - def $utf8{ch : char, b_1 : byte, b_2 : byte, b_3 : byte}([ch]) = [b_1 b_2 b_3] - -- if (((2048 <= ch!`%`_char.0) /\ (ch!`%`_char.0 < 55296)) \/ ((57344 <= ch!`%`_char.0) /\ (ch!`%`_char.0 < 65536))) - -- if (ch!`%`_char.0 = ((((2 ^ 12) * (((b_1!`%`_byte.0 : nat <:> int) - (224 : nat <:> int)) : int <:> nat)) + ((2 ^ 6) * $cont(b_2))) + $cont(b_3))) - ;; A-binary.watsup:63.1-65.82 - def $utf8{ch : char, b_1 : byte, b_2 : byte, b_3 : byte, b_4 : byte}([ch]) = [b_1 b_2 b_3 b_4] - -- if ((65536 <= ch!`%`_char.0) /\ (ch!`%`_char.0 < 69632)) - -- if (ch!`%`_char.0 = (((((2 ^ 18) * (((b_1!`%`_byte.0 : nat <:> int) - (240 : nat <:> int)) : int <:> nat)) + ((2 ^ 12) * $cont(b_2))) + ((2 ^ 6) * $cont(b_3))) + $cont(b_4))) -} - -;; 1-syntax.watsup -syntax name = - | `%`{`char*` : char*}(char*{char <- `char*`} : char*) - -- if (|$utf8(char*{char <- `char*`})| < (2 ^ 32)) - -;; 1-syntax.watsup -syntax idx = u32 - -;; 1-syntax.watsup -syntax laneidx = u8 - -;; 1-syntax.watsup -syntax typeidx = idx - -;; 1-syntax.watsup -syntax funcidx = idx - -;; 1-syntax.watsup -syntax globalidx = idx - -;; 1-syntax.watsup -syntax tableidx = idx - -;; 1-syntax.watsup -syntax memidx = idx - -;; 1-syntax.watsup -syntax tagidx = idx - -;; 1-syntax.watsup -syntax elemidx = idx - -;; 1-syntax.watsup -syntax dataidx = idx - -;; 1-syntax.watsup -syntax labelidx = idx - -;; 1-syntax.watsup -syntax localidx = idx - -;; 1-syntax.watsup -syntax fieldidx = idx - -;; 1-syntax.watsup -syntax externidx = - | FUNC{funcidx : funcidx}(funcidx : funcidx) - | GLOBAL{globalidx : globalidx}(globalidx : globalidx) - | TABLE{tableidx : tableidx}(tableidx : tableidx) - | MEM{memidx : memidx}(memidx : memidx) - | TAG{tagidx : tagidx}(tagidx : tagidx) - -;; 1-syntax.watsup -syntax nul = - | `NULL%?`(()?) - -;; 1-syntax.watsup -syntax nul1 = - | `NULL%?`(()?) - -;; 1-syntax.watsup -syntax nul2 = - | `NULL%?`(()?) - -;; 1-syntax.watsup -syntax addrtype = - | I32 - | I64 - -;; 1-syntax.watsup -syntax numtype = - | I32 - | I64 - | F32 - | F64 - -;; 1-syntax.watsup -syntax vectype = - | V128 - -;; 1-syntax.watsup -syntax consttype = - | I32 - | I64 - | F32 - | F64 - | V128 - -;; 1-syntax.watsup -syntax absheaptype = - | ANY - | EQ - | I31 - | STRUCT - | ARRAY - | NONE - | FUNC - | NOFUNC - | EXN - | NOEXN - | EXTERN - | NOEXTERN - | BOT - -;; 1-syntax.watsup -syntax mut = - | `MUT%?`(()?) - -;; 1-syntax.watsup -syntax fin = - | `FINAL%?`(()?) - -;; 1-syntax.watsup -rec { - -;; 1-syntax.watsup:171.1-172.26 -syntax typeuse = - | _IDX{typeidx : typeidx}(typeidx : typeidx) - | DEF{rectype : rectype, n : n}(rectype : rectype, n : n) - | REC{n : n}(n : n) - -;; 1-syntax.watsup:177.1-178.26 -syntax heaptype = - | ANY - | EQ - | I31 - | STRUCT - | ARRAY - | NONE - | FUNC - | NOFUNC - | EXN - | NOEXN - | EXTERN - | NOEXTERN - | BOT - | _IDX{typeidx : typeidx}(typeidx : typeidx) - | REC{n : n}(n : n) - | DEF{rectype : rectype, n : n}(rectype : rectype, n : n) - -;; 1-syntax.watsup:185.1-186.14 -syntax valtype = - | I32 - | I64 - | F32 - | F64 - | V128 - | REF{nul : nul, heaptype : heaptype}(nul : nul, heaptype : heaptype) - | BOT - -;; 1-syntax.watsup:221.1-221.66 -syntax storagetype = - | BOT - | I32 - | I64 - | F32 - | F64 - | V128 - | REF{nul : nul, heaptype : heaptype}(nul : nul, heaptype : heaptype) - | I8 - | I16 - -;; 1-syntax.watsup:230.1-231.16 -syntax resulttype = list(syntax valtype) - -;; 1-syntax.watsup:243.1-243.60 -syntax fieldtype = - | `%%`{mut : mut, storagetype : storagetype}(mut : mut, storagetype : storagetype) - -;; 1-syntax.watsup:245.1-245.90 -syntax functype = - | `%->%`{resulttype : resulttype}(resulttype : resulttype, resulttype) - -;; 1-syntax.watsup:246.1-246.64 -syntax structtype = list(syntax fieldtype) - -;; 1-syntax.watsup:247.1-247.54 -syntax arraytype = fieldtype - -;; 1-syntax.watsup:249.1-252.18 -syntax comptype = - | STRUCT{structtype : structtype}(structtype : structtype) - | ARRAY{arraytype : arraytype}(arraytype : arraytype) - | FUNC{functype : functype}(functype : functype) - -;; 1-syntax.watsup:254.1-255.30 -syntax subtype = - | SUB{fin : fin, `typeuse*` : typeuse*, comptype : comptype}(fin : fin, typeuse*{typeuse <- `typeuse*`} : typeuse*, comptype : comptype) - -;; 1-syntax.watsup:257.1-258.22 -syntax rectype = - | REC{list : list(syntax subtype)}(list : list(syntax subtype)) -} - -;; 1-syntax.watsup -syntax deftype = - | DEF{rectype : rectype, n : n}(rectype : rectype, n : n) - -;; 1-syntax.watsup -syntax typevar = - | _IDX{typeidx : typeidx}(typeidx : typeidx) - | REC{nat : nat}(nat : nat) - -;; 1-syntax.watsup -syntax reftype = - | REF{nul : nul, heaptype : heaptype}(nul : nul, heaptype : heaptype) - -;; 1-syntax.watsup -syntax Inn = - | I32 - | I64 - -;; 1-syntax.watsup -syntax Fnn = - | F32 - | F64 - -;; 1-syntax.watsup -syntax Vnn = - | V128 - -;; 1-syntax.watsup -syntax Cnn = - | I32 - | I64 - | F32 - | F64 - | V128 - -;; 1-syntax.watsup -def $ANYREF : reftype - ;; 1-syntax.watsup - def $ANYREF = REF_reftype(`NULL%?`_nul(?(())), ANY_heaptype) - -;; 1-syntax.watsup -def $EQREF : reftype - ;; 1-syntax.watsup - def $EQREF = REF_reftype(`NULL%?`_nul(?(())), EQ_heaptype) - -;; 1-syntax.watsup -def $I31REF : reftype - ;; 1-syntax.watsup - def $I31REF = REF_reftype(`NULL%?`_nul(?(())), I31_heaptype) - -;; 1-syntax.watsup -def $STRUCTREF : reftype - ;; 1-syntax.watsup - def $STRUCTREF = REF_reftype(`NULL%?`_nul(?(())), STRUCT_heaptype) - -;; 1-syntax.watsup -def $ARRAYREF : reftype - ;; 1-syntax.watsup - def $ARRAYREF = REF_reftype(`NULL%?`_nul(?(())), ARRAY_heaptype) - -;; 1-syntax.watsup -def $FUNCREF : reftype - ;; 1-syntax.watsup - def $FUNCREF = REF_reftype(`NULL%?`_nul(?(())), FUNC_heaptype) - -;; 1-syntax.watsup -def $EXTERNREF : reftype - ;; 1-syntax.watsup - def $EXTERNREF = REF_reftype(`NULL%?`_nul(?(())), EXTERN_heaptype) - -;; 1-syntax.watsup -def $NULLREF : reftype - ;; 1-syntax.watsup - def $NULLREF = REF_reftype(`NULL%?`_nul(?(())), NONE_heaptype) - -;; 1-syntax.watsup -def $NULLFUNCREF : reftype - ;; 1-syntax.watsup - def $NULLFUNCREF = REF_reftype(`NULL%?`_nul(?(())), NOFUNC_heaptype) - -;; 1-syntax.watsup -def $NULLEXTERNREF : reftype - ;; 1-syntax.watsup - def $NULLEXTERNREF = REF_reftype(`NULL%?`_nul(?(())), NOEXTERN_heaptype) - -;; 1-syntax.watsup -syntax packtype = - | I8 - | I16 - -;; 1-syntax.watsup -syntax lanetype = - | I32 - | I64 - | F32 - | F64 - | I8 - | I16 - -;; 1-syntax.watsup -syntax Pnn = - | I8 - | I16 - -;; 1-syntax.watsup -syntax Jnn = - | I32 - | I64 - | I8 - | I16 - -;; 1-syntax.watsup -syntax Lnn = - | I32 - | I64 - | F32 - | F64 - | I8 - | I16 - -;; 1-syntax.watsup -syntax mut1 = - | `MUT%?`(()?) - -;; 1-syntax.watsup -syntax mut2 = - | `MUT%?`(()?) - -;; 1-syntax.watsup -syntax limits = - | `[%..%]`{u64 : u64}(u64 : u64, u64) - -;; 1-syntax.watsup -syntax globaltype = - | `%%`{mut : mut, valtype : valtype}(mut : mut, valtype : valtype) - -;; 1-syntax.watsup -syntax tabletype = - | `%%%`{addrtype : addrtype, limits : limits, reftype : reftype}(addrtype : addrtype, limits : limits, reftype : reftype) - -;; 1-syntax.watsup -syntax memtype = - | `%%PAGE`{addrtype : addrtype, limits : limits}(addrtype : addrtype, limits : limits) - -;; 1-syntax.watsup -syntax tagtype = deftype - -;; 1-syntax.watsup -syntax elemtype = reftype - -;; 1-syntax.watsup -syntax datatype = - | OK - -;; 1-syntax.watsup -syntax externtype = - | FUNC{typeuse : typeuse}(typeuse : typeuse) - | GLOBAL{globaltype : globaltype}(globaltype : globaltype) - | TABLE{tabletype : tabletype}(tabletype : tabletype) - | MEM{memtype : memtype}(memtype : memtype) - | TAG{typeuse : typeuse}(typeuse : typeuse) - -;; 1-syntax.watsup -syntax moduletype = - | `%->%`{`externtype*` : externtype*}(externtype*{externtype <- `externtype*`} : externtype*, externtype*) - -;; 1-syntax.watsup -def $size(numtype : numtype) : nat - ;; 1-syntax.watsup - def $size(I32_numtype) = 32 - ;; 1-syntax.watsup - def $size(I64_numtype) = 64 - ;; 1-syntax.watsup - def $size(F32_numtype) = 32 - ;; 1-syntax.watsup - def $size(F64_numtype) = 64 - -;; 1-syntax.watsup -def $vsize(vectype : vectype) : nat - ;; 1-syntax.watsup - def $vsize(V128_vectype) = 128 - -;; 1-syntax.watsup -def $psize(packtype : packtype) : nat - ;; 1-syntax.watsup - def $psize(I8_packtype) = 8 - ;; 1-syntax.watsup - def $psize(I16_packtype) = 16 - -;; 1-syntax.watsup -def $lsize(lanetype : lanetype) : nat - ;; 1-syntax.watsup - def $lsize{numtype : numtype}((numtype : numtype <: lanetype)) = $size(numtype) - ;; 1-syntax.watsup - def $lsize{packtype : packtype}((packtype : packtype <: lanetype)) = $psize(packtype) - -;; 1-syntax.watsup -def $zsize(storagetype : storagetype) : nat - ;; 1-syntax.watsup - def $zsize{numtype : numtype}((numtype : numtype <: storagetype)) = $size(numtype) - ;; 1-syntax.watsup - def $zsize{vectype : vectype}((vectype : vectype <: storagetype)) = $vsize(vectype) - ;; 1-syntax.watsup - def $zsize{packtype : packtype}((packtype : packtype <: storagetype)) = $psize(packtype) - -;; 1-syntax.watsup -def $sizenn(numtype : numtype) : nat - ;; 1-syntax.watsup - def $sizenn{nt : numtype}(nt) = $size(nt) - -;; 1-syntax.watsup -def $sizenn1(numtype : numtype) : nat - ;; 1-syntax.watsup - def $sizenn1{nt : numtype}(nt) = $size(nt) - -;; 1-syntax.watsup -def $sizenn2(numtype : numtype) : nat - ;; 1-syntax.watsup - def $sizenn2{nt : numtype}(nt) = $size(nt) - -;; 1-syntax.watsup -def $vsizenn(vectype : vectype) : nat - ;; 1-syntax.watsup - def $vsizenn{vt : vectype}(vt) = $vsize(vt) - -;; 1-syntax.watsup -def $psizenn(packtype : packtype) : nat - ;; 1-syntax.watsup - def $psizenn{pt : packtype}(pt) = $psize(pt) - -;; 1-syntax.watsup -def $lsizenn(lanetype : lanetype) : nat - ;; 1-syntax.watsup - def $lsizenn{lt : lanetype}(lt) = $lsize(lt) - -;; 1-syntax.watsup -def $lsizenn1(lanetype : lanetype) : nat - ;; 1-syntax.watsup - def $lsizenn1{lt : lanetype}(lt) = $lsize(lt) - -;; 1-syntax.watsup -def $lsizenn2(lanetype : lanetype) : nat - ;; 1-syntax.watsup - def $lsizenn2{lt : lanetype}(lt) = $lsize(lt) - -;; 1-syntax.watsup -def $lunpack(lanetype : lanetype) : numtype - ;; 1-syntax.watsup - def $lunpack{numtype : numtype}((numtype : numtype <: lanetype)) = numtype - ;; 1-syntax.watsup - def $lunpack{packtype : packtype}((packtype : packtype <: lanetype)) = I32_numtype - -;; 1-syntax.watsup -def $unpack(storagetype : storagetype) : valtype - ;; 1-syntax.watsup - def $unpack{valtype : valtype}((valtype : valtype <: storagetype)) = valtype - ;; 1-syntax.watsup - def $unpack{packtype : packtype}((packtype : packtype <: storagetype)) = I32_valtype - -;; 1-syntax.watsup -def $nunpack(storagetype : storagetype) : numtype - ;; 1-syntax.watsup - def $nunpack{numtype : numtype}((numtype : numtype <: storagetype)) = numtype - ;; 1-syntax.watsup - def $nunpack{packtype : packtype}((packtype : packtype <: storagetype)) = I32_numtype - -;; 1-syntax.watsup -def $vunpack(storagetype : storagetype) : vectype - ;; 1-syntax.watsup - def $vunpack{vectype : vectype}((vectype : vectype <: storagetype)) = vectype - -;; 1-syntax.watsup -def $cunpack(storagetype : storagetype) : consttype - ;; 1-syntax.watsup - def $cunpack{consttype : consttype}((consttype : consttype <: storagetype)) = consttype - ;; 1-syntax.watsup - def $cunpack{packtype : packtype}((packtype : packtype <: storagetype)) = I32_consttype - ;; 1-syntax.watsup - def $cunpack{lanetype : lanetype}((lanetype : lanetype <: storagetype)) = ($lunpack(lanetype) : numtype <: consttype) - -;; 1-syntax.watsup -syntax num_(numtype : numtype) - ;; 1-syntax.watsup - syntax num_{Inn : Inn}((Inn : Inn <: numtype)) = iN($sizenn((Inn : Inn <: numtype))) - - - ;; 1-syntax.watsup - syntax num_{Fnn : Fnn}((Fnn : Fnn <: numtype)) = fN($sizenn((Fnn : Fnn <: numtype))) - - -;; 1-syntax.watsup -syntax pack_{Pnn : Pnn}(Pnn) = iN($psizenn(Pnn)) - -;; 1-syntax.watsup -syntax lane_(lanetype : lanetype) - ;; 1-syntax.watsup - syntax lane_{numtype : numtype}((numtype : numtype <: lanetype)) = num_(numtype) - - - ;; 1-syntax.watsup - syntax lane_{packtype : packtype}((packtype : packtype <: lanetype)) = pack_(packtype) - - - ;; 1-syntax.watsup - syntax lane_{Jnn : Jnn}((Jnn : Jnn <: lanetype)) = iN($lsize((Jnn : Jnn <: lanetype))) - - -;; 1-syntax.watsup -syntax vec_{Vnn : Vnn}(Vnn) = vN($vsize(Vnn)) - -;; 1-syntax.watsup -syntax lit_(storagetype : storagetype) - ;; 1-syntax.watsup - syntax lit_{numtype : numtype}((numtype : numtype <: storagetype)) = num_(numtype) - - - ;; 1-syntax.watsup - syntax lit_{vectype : vectype}((vectype : vectype <: storagetype)) = vec_(vectype) - - - ;; 1-syntax.watsup - syntax lit_{packtype : packtype}((packtype : packtype <: storagetype)) = pack_(packtype) - - -;; 1-syntax.watsup -syntax sz = - | `%`{i : nat}(i : nat) - -- if ((((i = 8) \/ (i = 16)) \/ (i = 32)) \/ (i = 64)) - -;; 1-syntax.watsup -syntax sx = - | U - | S - -;; 1-syntax.watsup -syntax unop_(numtype : numtype) - ;; 1-syntax.watsup - syntax unop_{Inn : Inn}((Inn : Inn <: numtype)) = - | CLZ - | CTZ - | POPCNT - | EXTEND{sz : sz}(sz : sz) - -- if (sz!`%`_sz.0 < $sizenn((Inn : Inn <: numtype))) - - - ;; 1-syntax.watsup - syntax unop_{Fnn : Fnn}((Fnn : Fnn <: numtype)) = - | ABS - | NEG - | SQRT - | CEIL - | FLOOR - | TRUNC - | NEAREST - - -;; 1-syntax.watsup -syntax binop_(numtype : numtype) - ;; 1-syntax.watsup - syntax binop_{Inn : Inn}((Inn : Inn <: numtype)) = - | ADD - | SUB - | MUL - | DIV{sx : sx}(sx : sx) - | REM{sx : sx}(sx : sx) - | AND - | OR - | XOR - | SHL - | SHR{sx : sx}(sx : sx) - | ROTL - | ROTR - - - ;; 1-syntax.watsup - syntax binop_{Fnn : Fnn}((Fnn : Fnn <: numtype)) = - | ADD - | SUB - | MUL - | DIV - | MIN - | MAX - | COPYSIGN - - -;; 1-syntax.watsup -syntax testop_{Inn : Inn}((Inn : Inn <: numtype)) = - | EQZ - -;; 1-syntax.watsup -syntax relop_(numtype : numtype) - ;; 1-syntax.watsup - syntax relop_{Inn : Inn}((Inn : Inn <: numtype)) = - | EQ - | NE - | LT{sx : sx}(sx : sx) - | GT{sx : sx}(sx : sx) - | LE{sx : sx}(sx : sx) - | GE{sx : sx}(sx : sx) - - - ;; 1-syntax.watsup - syntax relop_{Fnn : Fnn}((Fnn : Fnn <: numtype)) = - | EQ - | NE - | LT - | GT - | LE - | GE - - -;; 1-syntax.watsup -syntax cvtop__(numtype_1 : numtype, numtype_2 : numtype) - ;; 1-syntax.watsup - syntax cvtop__{Inn_1 : Inn, Inn_2 : Inn}((Inn_1 : Inn <: numtype), (Inn_2 : Inn <: numtype)) = - | EXTEND{sx : sx}(sx : sx) - -- if ($sizenn1((Inn_1 : Inn <: numtype)) < $sizenn2((Inn_2 : Inn <: numtype))) - | WRAP - -- if ($sizenn1((Inn_1 : Inn <: numtype)) > $sizenn2((Inn_2 : Inn <: numtype))) - - - ;; 1-syntax.watsup - syntax cvtop__{Inn_1 : Inn, Fnn_2 : Fnn}((Inn_1 : Inn <: numtype), (Fnn_2 : Fnn <: numtype)) = - | CONVERT{sx : sx}(sx : sx) - | REINTERPRET - -- if ($sizenn1((Inn_1 : Inn <: numtype)) = $sizenn2((Fnn_2 : Fnn <: numtype))) - - - ;; 1-syntax.watsup - syntax cvtop__{Fnn_1 : Fnn, Inn_2 : Inn}((Fnn_1 : Fnn <: numtype), (Inn_2 : Inn <: numtype)) = - | TRUNC{sx : sx}(sx : sx) - | TRUNC_SAT{sx : sx}(sx : sx) - | REINTERPRET - -- if ($sizenn1((Fnn_1 : Fnn <: numtype)) = $sizenn2((Inn_2 : Inn <: numtype))) - - - ;; 1-syntax.watsup - syntax cvtop__{Fnn_1 : Fnn, Fnn_2 : Fnn}((Fnn_1 : Fnn <: numtype), (Fnn_2 : Fnn <: numtype)) = - | PROMOTE - -- if ($sizenn1((Fnn_1 : Fnn <: numtype)) < $sizenn2((Fnn_2 : Fnn <: numtype))) - | DEMOTE - -- if ($sizenn1((Fnn_1 : Fnn <: numtype)) > $sizenn2((Fnn_2 : Fnn <: numtype))) - - -;; 1-syntax.watsup -syntax dim = - | `%`{i : nat}(i : nat) - -- if (((((i = 1) \/ (i = 2)) \/ (i = 4)) \/ (i = 8)) \/ (i = 16)) - -;; 1-syntax.watsup -syntax shape = - | `%X%`{lanetype : lanetype, dim : dim}(lanetype : lanetype, dim : dim) - -- if (($lsize(lanetype) * dim!`%`_dim.0) = 128) - -;; 1-syntax.watsup -def $dim(shape : shape) : dim - ;; 1-syntax.watsup - def $dim{Lnn : Lnn, N : N}(`%X%`_shape(Lnn, `%`_dim(N))) = `%`_dim(N) - -;; 1-syntax.watsup -def $lanetype(shape : shape) : lanetype - ;; 1-syntax.watsup - def $lanetype{Lnn : Lnn, N : N}(`%X%`_shape(Lnn, `%`_dim(N))) = Lnn - -;; 1-syntax.watsup -def $unpackshape(shape : shape) : numtype - ;; 1-syntax.watsup - def $unpackshape{Lnn : Lnn, N : N}(`%X%`_shape(Lnn, `%`_dim(N))) = $lunpack(Lnn) - -;; 1-syntax.watsup -syntax ishape = - | `%`{shape : shape, Jnn : Jnn}(shape : shape) - -- if ($lanetype(shape) = (Jnn : Jnn <: lanetype)) - -;; 1-syntax.watsup -syntax bshape = - | `%`{shape : shape}(shape : shape) - -- if ($lanetype(shape) = I8_lanetype) - -;; 1-syntax.watsup -syntax half__(shape_1 : shape, shape_2 : shape) - ;; 1-syntax.watsup - syntax half__{Jnn_1 : Jnn, M_1 : M, Jnn_2 : Jnn, M_2 : M}(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2))) = - | LOW - | HIGH - -- if ((2 * $lsizenn1((Jnn_1 : Jnn <: lanetype))) = $lsizenn1((Jnn_2 : Jnn <: lanetype))) - - - ;; 1-syntax.watsup - syntax half__{Lnn_1 : Lnn, M_1 : M, Fnn_2 : Fnn, M_2 : M}(`%X%`_shape(Lnn_1, `%`_dim(M_1)), `%X%`_shape((Fnn_2 : Fnn <: lanetype), `%`_dim(M_2))) = - | LOW - -- if (((2 * $lsizenn1(Lnn_1)) = $sizenn1((Fnn_2 : Fnn <: numtype))) /\ ($sizenn1((Fnn_2 : Fnn <: numtype)) = 64)) - - -;; 1-syntax.watsup -syntax zero__{Fnn_1 : Fnn, M_1 : M, Lnn_2 : Lnn, M_2 : M}(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)), `%X%`_shape(Lnn_2, `%`_dim(M_2))) = - | ZERO - -- if (((2 * $lsizenn2(Lnn_2)) = $sizenn1((Fnn_1 : Fnn <: numtype))) /\ ($sizenn1((Fnn_1 : Fnn <: numtype)) = 64)) - -;; 1-syntax.watsup -syntax vvunop = - | NOT - -;; 1-syntax.watsup -syntax vvbinop = - | AND - | ANDNOT - | OR - | XOR - -;; 1-syntax.watsup -syntax vvternop = - | BITSELECT - -;; 1-syntax.watsup -syntax vvtestop = - | ANY_TRUE - -;; 1-syntax.watsup -syntax vunop_(shape : shape) - ;; 1-syntax.watsup - syntax vunop_{Jnn : Jnn, M : M}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))) = - | ABS - | NEG - | POPCNT - -- if ($lsizenn((Jnn : Jnn <: lanetype)) = 8) - - - ;; 1-syntax.watsup - syntax vunop_{Fnn : Fnn, M : M}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M))) = - | ABS - | NEG - | SQRT - | CEIL - | FLOOR - | TRUNC - | NEAREST - - -;; 1-syntax.watsup -syntax vbinop_(shape : shape) - ;; 1-syntax.watsup - syntax vbinop_{Jnn : Jnn, M : M}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))) = - | ADD - | SUB - | ADD_SAT{sx : sx}(sx : sx) - -- if ($lsizenn((Jnn : Jnn <: lanetype)) <= 16) - | SUB_SAT{sx : sx}(sx : sx) - -- if ($lsizenn((Jnn : Jnn <: lanetype)) <= 16) - | MUL - -- if ($lsizenn((Jnn : Jnn <: lanetype)) >= 16) - | `AVGRU` - -- if ($lsizenn((Jnn : Jnn <: lanetype)) <= 16) - | `Q15MULR_SATS` - -- if ($lsizenn((Jnn : Jnn <: lanetype)) = 16) - | `RELAXED_Q15MULRS` - -- if ($lsizenn((Jnn : Jnn <: lanetype)) = 16) - | MIN{sx : sx}(sx : sx) - -- if ($lsizenn((Jnn : Jnn <: lanetype)) <= 32) - | MAX{sx : sx}(sx : sx) - -- if ($lsizenn((Jnn : Jnn <: lanetype)) <= 32) - - - ;; 1-syntax.watsup - syntax vbinop_{Fnn : Fnn, M : M}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M))) = - | ADD - | SUB - | MUL - | DIV - | MIN - | MAX - | PMIN - | PMAX - | RELAXED_MIN - | RELAXED_MAX - - -;; 1-syntax.watsup -syntax vternop_(shape : shape) - ;; 1-syntax.watsup - syntax vternop_{Jnn : Jnn, M : M}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))) = - | RELAXED_LANESELECT - - - ;; 1-syntax.watsup - syntax vternop_{Fnn : Fnn, M : M}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M))) = - | RELAXED_MADD - | RELAXED_NMADD - - -;; 1-syntax.watsup -syntax vtestop_{Jnn : Jnn, M : M}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))) = - | ALL_TRUE - -;; 1-syntax.watsup -syntax vrelop_(shape : shape) - ;; 1-syntax.watsup - syntax vrelop_{Jnn : Jnn, M : M}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))) = - | EQ - | NE - | LT{sx : sx}(sx : sx) - -- if (($lsizenn((Jnn : Jnn <: lanetype)) =/= 64) \/ (sx = S_sx)) - | GT{sx : sx}(sx : sx) - -- if (($lsizenn((Jnn : Jnn <: lanetype)) =/= 64) \/ (sx = S_sx)) - | LE{sx : sx}(sx : sx) - -- if (($lsizenn((Jnn : Jnn <: lanetype)) =/= 64) \/ (sx = S_sx)) - | GE{sx : sx}(sx : sx) - -- if (($lsizenn((Jnn : Jnn <: lanetype)) =/= 64) \/ (sx = S_sx)) - - - ;; 1-syntax.watsup - syntax vrelop_{Fnn : Fnn, M : M}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M))) = - | EQ - | NE - | LT - | GT - | LE - | GE - - -;; 1-syntax.watsup -syntax vshiftop_{Jnn : Jnn, M : M}(`%`_ishape(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)))) = - | SHL - | SHR{sx : sx}(sx : sx) - -;; 1-syntax.watsup -syntax vswizzlop_{M : M}(`%`_bshape(`%X%`_shape(I8_lanetype, `%`_dim(M)))) = - | SWIZZLE - | RELAXED_SWIZZLE - -;; 1-syntax.watsup -syntax vextunop__{Jnn_1 : Jnn, M_1 : M, Jnn_2 : Jnn, M_2 : M}(`%`_ishape(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1))), `%`_ishape(`%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2)))) = - | EXTADD_PAIRWISE{sx : sx}(sx : sx) - -- if ((16 <= (2 * $lsizenn1((Jnn_1 : Jnn <: lanetype)))) /\ (((2 * $lsizenn1((Jnn_1 : Jnn <: lanetype))) = $lsizenn2((Jnn_2 : Jnn <: lanetype))) /\ ($lsizenn2((Jnn_2 : Jnn <: lanetype)) <= 32))) - -;; 1-syntax.watsup -syntax vextbinop__{Jnn_1 : Jnn, M_1 : M, Jnn_2 : Jnn, M_2 : M}(`%`_ishape(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1))), `%`_ishape(`%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2)))) = - | EXTMUL{sx : sx, half__ : half__(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2)))}(sx : sx, half__ : half__(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2)))) - -- if (((2 * $lsizenn1((Jnn_1 : Jnn <: lanetype))) = $lsizenn2((Jnn_2 : Jnn <: lanetype))) /\ ($lsizenn2((Jnn_2 : Jnn <: lanetype)) >= 16)) - | `DOTS` - -- if (((2 * $lsizenn1((Jnn_1 : Jnn <: lanetype))) = $lsizenn2((Jnn_2 : Jnn <: lanetype))) /\ ($lsizenn2((Jnn_2 : Jnn <: lanetype)) = 32)) - | `RELAXED_DOTS` - -- if (((2 * $lsizenn1((Jnn_1 : Jnn <: lanetype))) = $lsizenn2((Jnn_2 : Jnn <: lanetype))) /\ ($lsizenn2((Jnn_2 : Jnn <: lanetype)) = 16)) - -;; 1-syntax.watsup -syntax vextternop__{Jnn_1 : Jnn, M_1 : M, Jnn_2 : Jnn, M_2 : M}(`%`_ishape(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1))), `%`_ishape(`%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2)))) = - | `RELAXED_DOT_ADDS` - -- if (((4 * $lsizenn1((Jnn_1 : Jnn <: lanetype))) = $lsizenn2((Jnn_2 : Jnn <: lanetype))) /\ ($lsizenn2((Jnn_2 : Jnn <: lanetype)) = 32)) - -;; 1-syntax.watsup -syntax vcvtop__(shape_1 : shape, shape_2 : shape) - ;; 1-syntax.watsup - syntax vcvtop__{Jnn_1 : Jnn, M_1 : M, Jnn_2 : Jnn, M_2 : M}(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2))) = - | EXTEND{sx : sx}(sx : sx) - -- if ($lsizenn2((Jnn_2 : Jnn <: lanetype)) = (2 * $lsizenn1((Jnn_1 : Jnn <: lanetype)))) - - - ;; 1-syntax.watsup - syntax vcvtop__{Jnn_1 : Jnn, M_1 : M, Fnn_2 : Fnn, M_2 : M}(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Fnn_2 : Fnn <: lanetype), `%`_dim(M_2))) = - | CONVERT{sx : sx}(sx : sx) - -- if (($sizenn2((Fnn_2 : Fnn <: numtype)) >= $lsizenn1((Jnn_1 : Jnn <: lanetype))) /\ ($lsizenn1((Jnn_1 : Jnn <: lanetype)) = 32)) - - - ;; 1-syntax.watsup - syntax vcvtop__{Fnn_1 : Fnn, M_1 : M, Jnn_2 : Jnn, M_2 : M}(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2))) = - | TRUNC_SAT{sx : sx}(sx : sx) - -- if (($sizenn1((Fnn_1 : Fnn <: numtype)) >= $lsizenn2((Jnn_2 : Jnn <: lanetype))) /\ ($lsizenn2((Jnn_2 : Jnn <: lanetype)) = 32)) - | RELAXED_TRUNC{sx : sx}(sx : sx) - -- if (($sizenn1((Fnn_1 : Fnn <: numtype)) >= $lsizenn2((Jnn_2 : Jnn <: lanetype))) /\ ($lsizenn2((Jnn_2 : Jnn <: lanetype)) = 32)) - - - ;; 1-syntax.watsup - syntax vcvtop__{Fnn_1 : Fnn, M_1 : M, Fnn_2 : Fnn, M_2 : M}(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Fnn_2 : Fnn <: lanetype), `%`_dim(M_2))) = - | DEMOTE - -- if ($sizenn1((Fnn_1 : Fnn <: numtype)) > $sizenn2((Fnn_2 : Fnn <: numtype))) - | PROMOTE - -- if ($sizenn1((Fnn_1 : Fnn <: numtype)) < $sizenn2((Fnn_2 : Fnn <: numtype))) - - -;; 1-syntax.watsup -syntax memarg = -{ - ALIGN{u32 : u32} u32, - OFFSET{u32 : u32} u32 -} - -;; 1-syntax.watsup -syntax loadop_{Inn : Inn}((Inn : Inn <: numtype)) = - | `%%`{sz : sz, sx : sx}(sz : sz, sx : sx) - -- if (sz!`%`_sz.0 < $sizenn((Inn : Inn <: numtype))) - -;; 1-syntax.watsup -syntax storeop_{Inn : Inn}((Inn : Inn <: numtype)) = - | `%`{sz : sz}(sz : sz) - -- if (sz!`%`_sz.0 < $sizenn((Inn : Inn <: numtype))) - -;; 1-syntax.watsup -syntax vloadop_{vectype : vectype}(vectype) = - | `SHAPE%X%%`{sz : sz, M : M, sx : sx}(sz : sz, M : M, sx : sx) - -- if (((sz!`%`_sz.0 * M) : nat <:> rat) = (($vsize(vectype) : nat <:> rat) / (2 : nat <:> rat))) - | SPLAT{sz : sz}(sz : sz) - | ZERO{sz : sz}(sz : sz) - -- if (sz!`%`_sz.0 >= 32) - -;; 1-syntax.watsup -syntax blocktype = - | _RESULT{`valtype?` : valtype?}(valtype?{valtype <- `valtype?`} : valtype?) - | _IDX{funcidx : funcidx}(funcidx : funcidx) - -;; 5-runtime.watsup -syntax addr = nat - -;; 5-runtime.watsup -syntax arrayaddr = addr - -;; 5-runtime.watsup -syntax exnaddr = addr - -;; 5-runtime.watsup -syntax funcaddr = addr - -;; 5-runtime.watsup -syntax hostaddr = addr - -;; 5-runtime.watsup -syntax structaddr = addr - -;; 5-runtime.watsup -rec { - -;; 5-runtime.watsup:33.1-40.23 -syntax addrref = - | REF.I31_NUM{u31 : u31}(u31 : u31) - | REF.STRUCT_ADDR{structaddr : structaddr}(structaddr : structaddr) - | REF.ARRAY_ADDR{arrayaddr : arrayaddr}(arrayaddr : arrayaddr) - | REF.FUNC_ADDR{funcaddr : funcaddr}(funcaddr : funcaddr) - | REF.EXN_ADDR{exnaddr : exnaddr}(exnaddr : exnaddr) - | REF.HOST_ADDR{hostaddr : hostaddr}(hostaddr : hostaddr) - | REF.EXTERN{addrref : addrref}(addrref : addrref) -} - -;; 1-syntax.watsup -syntax catch = - | CATCH{tagidx : tagidx, labelidx : labelidx}(tagidx : tagidx, labelidx : labelidx) - | CATCH_REF{tagidx : tagidx, labelidx : labelidx}(tagidx : tagidx, labelidx : labelidx) - | CATCH_ALL{labelidx : labelidx}(labelidx : labelidx) - | CATCH_ALL_REF{labelidx : labelidx}(labelidx : labelidx) - -;; 5-runtime.watsup -syntax dataaddr = addr - -;; 5-runtime.watsup -syntax elemaddr = addr - -;; 5-runtime.watsup -syntax globaladdr = addr - -;; 5-runtime.watsup -syntax memaddr = addr - -;; 5-runtime.watsup -syntax tableaddr = addr - -;; 5-runtime.watsup -syntax tagaddr = addr - -;; 5-runtime.watsup -syntax externaddr = - | FUNC{funcaddr : funcaddr}(funcaddr : funcaddr) - | GLOBAL{globaladdr : globaladdr}(globaladdr : globaladdr) - | TABLE{tableaddr : tableaddr}(tableaddr : tableaddr) - | MEM{memaddr : memaddr}(memaddr : memaddr) - | TAG{tagaddr : tagaddr}(tagaddr : tagaddr) - -;; 5-runtime.watsup -syntax exportinst = -{ - NAME{name : name} name, - ADDR{externaddr : externaddr} externaddr -} - -;; 5-runtime.watsup -syntax moduleinst = -{ - TYPES{`deftype*` : deftype*} deftype*, - FUNCS{`funcaddr*` : funcaddr*} funcaddr*, - GLOBALS{`globaladdr*` : globaladdr*} globaladdr*, - TABLES{`tableaddr*` : tableaddr*} tableaddr*, - MEMS{`memaddr*` : memaddr*} memaddr*, - TAGS{`tagaddr*` : tagaddr*} tagaddr*, - ELEMS{`elemaddr*` : elemaddr*} elemaddr*, - DATAS{`dataaddr*` : dataaddr*} dataaddr*, - EXPORTS{`exportinst*` : exportinst*} exportinst* -} - -;; 5-runtime.watsup -syntax val = - | CONST{numtype : numtype, num_ : num_(numtype)}(numtype : numtype, num_ : num_(numtype)) - | VCONST{vectype : vectype, vec_ : vec_(vectype)}(vectype : vectype, vec_ : vec_(vectype)) - | REF.NULL{heaptype : heaptype}(heaptype : heaptype) - | REF.I31_NUM{u31 : u31}(u31 : u31) - | REF.STRUCT_ADDR{structaddr : structaddr}(structaddr : structaddr) - | REF.ARRAY_ADDR{arrayaddr : arrayaddr}(arrayaddr : arrayaddr) - | REF.FUNC_ADDR{funcaddr : funcaddr}(funcaddr : funcaddr) - | REF.EXN_ADDR{exnaddr : exnaddr}(exnaddr : exnaddr) - | REF.HOST_ADDR{hostaddr : hostaddr}(hostaddr : hostaddr) - | REF.EXTERN{addrref : addrref}(addrref : addrref) - -;; 5-runtime.watsup -syntax frame = -{ - LOCALS{`val?*` : val?*} val?*, - MODULE{moduleinst : moduleinst} moduleinst -} - -;; 5-runtime.watsup -rec { - -;; 5-runtime.watsup:156.1-162.9 -syntax instr = - | NOP - | UNREACHABLE - | DROP - | `SELECT()%?`{`valtype*?` : valtype*?}(valtype*{valtype <- `valtype*`}?{`valtype*` <- `valtype*?`} : valtype*?) - | BLOCK{blocktype : blocktype, `instr*` : instr*}(blocktype : blocktype, instr*{instr <- `instr*`} : instr*) - | LOOP{blocktype : blocktype, `instr*` : instr*}(blocktype : blocktype, instr*{instr <- `instr*`} : instr*) - | `IF%%ELSE%`{blocktype : blocktype, `instr*` : instr*}(blocktype : blocktype, instr*{instr <- `instr*`} : instr*, instr*) - | BR{labelidx : labelidx}(labelidx : labelidx) - | BR_IF{labelidx : labelidx}(labelidx : labelidx) - | BR_TABLE{`labelidx*` : labelidx*}(labelidx*{labelidx <- `labelidx*`} : labelidx*, labelidx) - | BR_ON_NULL{labelidx : labelidx}(labelidx : labelidx) - | BR_ON_NON_NULL{labelidx : labelidx}(labelidx : labelidx) - | BR_ON_CAST{labelidx : labelidx, reftype : reftype}(labelidx : labelidx, reftype : reftype, reftype) - | BR_ON_CAST_FAIL{labelidx : labelidx, reftype : reftype}(labelidx : labelidx, reftype : reftype, reftype) - | CALL{funcidx : funcidx}(funcidx : funcidx) - | CALL_REF{typeuse : typeuse}(typeuse : typeuse) - | CALL_INDIRECT{tableidx : tableidx, typeuse : typeuse}(tableidx : tableidx, typeuse : typeuse) - | RETURN - | RETURN_CALL{funcidx : funcidx}(funcidx : funcidx) - | RETURN_CALL_REF{typeuse : typeuse}(typeuse : typeuse) - | RETURN_CALL_INDIRECT{tableidx : tableidx, typeuse : typeuse}(tableidx : tableidx, typeuse : typeuse) - | THROW{tagidx : tagidx}(tagidx : tagidx) - | THROW_REF - | TRY_TABLE{blocktype : blocktype, list : list(syntax catch), `instr*` : instr*}(blocktype : blocktype, list : list(syntax catch), instr*{instr <- `instr*`} : instr*) - | CONST{numtype : numtype, num_ : num_(numtype)}(numtype : numtype, num_ : num_(numtype)) - | UNOP{numtype : numtype, unop_ : unop_(numtype)}(numtype : numtype, unop_ : unop_(numtype)) - | BINOP{numtype : numtype, binop_ : binop_(numtype)}(numtype : numtype, binop_ : binop_(numtype)) - | TESTOP{numtype : numtype, testop_ : testop_(numtype)}(numtype : numtype, testop_ : testop_(numtype)) - | RELOP{numtype : numtype, relop_ : relop_(numtype)}(numtype : numtype, relop_ : relop_(numtype)) - | CVTOP{numtype_1 : numtype, numtype_2 : numtype, cvtop__ : cvtop__(numtype_2, numtype_1)}(numtype_1 : numtype, numtype_2 : numtype, cvtop__ : cvtop__(numtype_2, numtype_1)) - | VCONST{vectype : vectype, vec_ : vec_(vectype)}(vectype : vectype, vec_ : vec_(vectype)) - | VVUNOP{vectype : vectype, vvunop : vvunop}(vectype : vectype, vvunop : vvunop) - | VVBINOP{vectype : vectype, vvbinop : vvbinop}(vectype : vectype, vvbinop : vvbinop) - | VVTERNOP{vectype : vectype, vvternop : vvternop}(vectype : vectype, vvternop : vvternop) - | VVTESTOP{vectype : vectype, vvtestop : vvtestop}(vectype : vectype, vvtestop : vvtestop) - | VUNOP{shape : shape, vunop_ : vunop_(shape)}(shape : shape, vunop_ : vunop_(shape)) - | VBINOP{shape : shape, vbinop_ : vbinop_(shape)}(shape : shape, vbinop_ : vbinop_(shape)) - | VTERNOP{shape : shape, vternop_ : vternop_(shape)}(shape : shape, vternop_ : vternop_(shape)) - | VTESTOP{shape : shape, vtestop_ : vtestop_(shape)}(shape : shape, vtestop_ : vtestop_(shape)) - | VRELOP{shape : shape, vrelop_ : vrelop_(shape)}(shape : shape, vrelop_ : vrelop_(shape)) - | VSHIFTOP{ishape : ishape, vshiftop_ : vshiftop_(ishape)}(ishape : ishape, vshiftop_ : vshiftop_(ishape)) - | VBITMASK{ishape : ishape}(ishape : ishape) - | VSWIZZLOP{bshape : bshape, vswizzlop_ : vswizzlop_(bshape)}(bshape : bshape, vswizzlop_ : vswizzlop_(bshape)) - | VSHUFFLE{bshape : bshape, `laneidx*` : laneidx*}(bshape : bshape, laneidx*{laneidx <- `laneidx*`} : laneidx*) - -- if (`%`_dim(|laneidx*{laneidx <- `laneidx*`}|) = $dim(bshape!`%`_bshape.0)) - | VEXTUNOP{ishape_1 : ishape, ishape_2 : ishape, vextunop__ : vextunop__(ishape_2, ishape_1)}(ishape_1 : ishape, ishape_2 : ishape, vextunop__ : vextunop__(ishape_2, ishape_1)) - | VEXTBINOP{ishape_1 : ishape, ishape_2 : ishape, vextbinop__ : vextbinop__(ishape_2, ishape_1)}(ishape_1 : ishape, ishape_2 : ishape, vextbinop__ : vextbinop__(ishape_2, ishape_1)) - | VEXTTERNOP{ishape_1 : ishape, ishape_2 : ishape, vextternop__ : vextternop__(ishape_2, ishape_1)}(ishape_1 : ishape, ishape_2 : ishape, vextternop__ : vextternop__(ishape_2, ishape_1)) - | VNARROW{ishape_1 : ishape, ishape_2 : ishape, sx : sx}(ishape_1 : ishape, ishape_2 : ishape, sx : sx) - -- if (($lsize($lanetype(ishape_2!`%`_ishape.0)) = (2 * $lsize($lanetype(ishape_1!`%`_ishape.0)))) /\ ((2 * $lsize($lanetype(ishape_1!`%`_ishape.0))) <= 32)) - | VCVTOP{shape_1 : shape, shape_2 : shape, vcvtop__ : vcvtop__(shape_2, shape_1), `half__?` : half__(shape_2, shape_1)?, `zero__?` : zero__(shape_2, shape_1)?}(shape_1 : shape, shape_2 : shape, vcvtop__ : vcvtop__(shape_2, shape_1), half__?{half__ <- `half__?`} : half__(shape_2, shape_1)?, zero__?{zero__ <- `zero__?`} : zero__(shape_2, shape_1)?) - | VSPLAT{shape : shape}(shape : shape) - | VEXTRACT_LANE{shape : shape, `sx?` : sx?, laneidx : laneidx, numtype : numtype}(shape : shape, sx?{sx <- `sx?`} : sx?, laneidx : laneidx) - -- if ((sx?{sx <- `sx?`} = ?()) <=> ($lanetype(shape) = (numtype : numtype <: lanetype))) - | VREPLACE_LANE{shape : shape, laneidx : laneidx}(shape : shape, laneidx : laneidx) - | REF.NULL{heaptype : heaptype}(heaptype : heaptype) - | REF.IS_NULL - | REF.AS_NON_NULL - | REF.EQ - | REF.TEST{reftype : reftype}(reftype : reftype) - | REF.CAST{reftype : reftype}(reftype : reftype) - | REF.FUNC{funcidx : funcidx}(funcidx : funcidx) - | REF.I31 - | I31.GET{sx : sx}(sx : sx) - | STRUCT.NEW{typeidx : typeidx}(typeidx : typeidx) - | STRUCT.NEW_DEFAULT{typeidx : typeidx}(typeidx : typeidx) - | STRUCT.GET{`sx?` : sx?, typeidx : typeidx, u32 : u32}(sx?{sx <- `sx?`} : sx?, typeidx : typeidx, u32 : u32) - | STRUCT.SET{typeidx : typeidx, u32 : u32}(typeidx : typeidx, u32 : u32) - | ARRAY.NEW{typeidx : typeidx}(typeidx : typeidx) - | ARRAY.NEW_DEFAULT{typeidx : typeidx}(typeidx : typeidx) - | ARRAY.NEW_FIXED{typeidx : typeidx, u32 : u32}(typeidx : typeidx, u32 : u32) - | ARRAY.NEW_DATA{typeidx : typeidx, dataidx : dataidx}(typeidx : typeidx, dataidx : dataidx) - | ARRAY.NEW_ELEM{typeidx : typeidx, elemidx : elemidx}(typeidx : typeidx, elemidx : elemidx) - | ARRAY.GET{`sx?` : sx?, typeidx : typeidx}(sx?{sx <- `sx?`} : sx?, typeidx : typeidx) - | ARRAY.SET{typeidx : typeidx}(typeidx : typeidx) - | ARRAY.LEN - | ARRAY.FILL{typeidx : typeidx}(typeidx : typeidx) - | ARRAY.COPY{typeidx : typeidx}(typeidx : typeidx, typeidx) - | ARRAY.INIT_DATA{typeidx : typeidx, dataidx : dataidx}(typeidx : typeidx, dataidx : dataidx) - | ARRAY.INIT_ELEM{typeidx : typeidx, elemidx : elemidx}(typeidx : typeidx, elemidx : elemidx) - | EXTERN.CONVERT_ANY - | ANY.CONVERT_EXTERN - | LOCAL.GET{localidx : localidx}(localidx : localidx) - | LOCAL.SET{localidx : localidx}(localidx : localidx) - | LOCAL.TEE{localidx : localidx}(localidx : localidx) - | GLOBAL.GET{globalidx : globalidx}(globalidx : globalidx) - | GLOBAL.SET{globalidx : globalidx}(globalidx : globalidx) - | TABLE.GET{tableidx : tableidx}(tableidx : tableidx) - | TABLE.SET{tableidx : tableidx}(tableidx : tableidx) - | TABLE.SIZE{tableidx : tableidx}(tableidx : tableidx) - | TABLE.GROW{tableidx : tableidx}(tableidx : tableidx) - | TABLE.FILL{tableidx : tableidx}(tableidx : tableidx) - | TABLE.COPY{tableidx : tableidx}(tableidx : tableidx, tableidx) - | TABLE.INIT{tableidx : tableidx, elemidx : elemidx}(tableidx : tableidx, elemidx : elemidx) - | ELEM.DROP{elemidx : elemidx}(elemidx : elemidx) - | LOAD{numtype : numtype, `loadop_?` : loadop_(numtype)?, memidx : memidx, memarg : memarg}(numtype : numtype, loadop_?{loadop_ <- `loadop_?`} : loadop_(numtype)?, memidx : memidx, memarg : memarg) - | STORE{numtype : numtype, `storeop_?` : storeop_(numtype)?, memidx : memidx, memarg : memarg}(numtype : numtype, storeop_?{storeop_ <- `storeop_?`} : storeop_(numtype)?, memidx : memidx, memarg : memarg) - | VLOAD{vectype : vectype, `vloadop_?` : vloadop_(vectype)?, memidx : memidx, memarg : memarg}(vectype : vectype, vloadop_?{vloadop_ <- `vloadop_?`} : vloadop_(vectype)?, memidx : memidx, memarg : memarg) - | VLOAD_LANE{vectype : vectype, sz : sz, memidx : memidx, memarg : memarg, laneidx : laneidx}(vectype : vectype, sz : sz, memidx : memidx, memarg : memarg, laneidx : laneidx) - | VSTORE{vectype : vectype, memidx : memidx, memarg : memarg}(vectype : vectype, memidx : memidx, memarg : memarg) - | VSTORE_LANE{vectype : vectype, sz : sz, memidx : memidx, memarg : memarg, laneidx : laneidx}(vectype : vectype, sz : sz, memidx : memidx, memarg : memarg, laneidx : laneidx) - | MEMORY.SIZE{memidx : memidx}(memidx : memidx) - | MEMORY.GROW{memidx : memidx}(memidx : memidx) - | MEMORY.FILL{memidx : memidx}(memidx : memidx) - | MEMORY.COPY{memidx : memidx}(memidx : memidx, memidx) - | MEMORY.INIT{memidx : memidx, dataidx : dataidx}(memidx : memidx, dataidx : dataidx) - | DATA.DROP{dataidx : dataidx}(dataidx : dataidx) - | REF.I31_NUM{u31 : u31}(u31 : u31) - | REF.STRUCT_ADDR{structaddr : structaddr}(structaddr : structaddr) - | REF.ARRAY_ADDR{arrayaddr : arrayaddr}(arrayaddr : arrayaddr) - | REF.FUNC_ADDR{funcaddr : funcaddr}(funcaddr : funcaddr) - | REF.EXN_ADDR{exnaddr : exnaddr}(exnaddr : exnaddr) - | REF.HOST_ADDR{hostaddr : hostaddr}(hostaddr : hostaddr) - | REF.EXTERN{addrref : addrref}(addrref : addrref) - | `LABEL_%{%}%`{n : n, `instr*` : instr*}(n : n, instr*{instr <- `instr*`} : instr*, instr*) - | `FRAME_%{%}%`{n : n, frame : frame, `instr*` : instr*}(n : n, frame : frame, instr*{instr <- `instr*`} : instr*) - | `HANDLER_%{%}%`{n : n, `catch*` : catch*, `instr*` : instr*}(n : n, catch*{catch <- `catch*`} : catch*, instr*{instr <- `instr*`} : instr*) - | TRAP -} - -;; 1-syntax.watsup -syntax expr = instr* - -;; 1-syntax.watsup -syntax elemmode = - | ACTIVE{tableidx : tableidx, expr : expr}(tableidx : tableidx, expr : expr) - | PASSIVE - | DECLARE - -;; 1-syntax.watsup -syntax datamode = - | ACTIVE{memidx : memidx, expr : expr}(memidx : memidx, expr : expr) - | PASSIVE - -;; 1-syntax.watsup -syntax type = - | TYPE{rectype : rectype}(rectype : rectype) - -;; 1-syntax.watsup -syntax local = - | LOCAL{valtype : valtype}(valtype : valtype) - -;; 1-syntax.watsup -syntax func = - | FUNC{typeidx : typeidx, `local*` : local*, expr : expr}(typeidx : typeidx, local*{local <- `local*`} : local*, expr : expr) - -;; 1-syntax.watsup -syntax global = - | GLOBAL{globaltype : globaltype, expr : expr}(globaltype : globaltype, expr : expr) - -;; 1-syntax.watsup -syntax table = - | TABLE{tabletype : tabletype, expr : expr}(tabletype : tabletype, expr : expr) - -;; 1-syntax.watsup -syntax mem = - | MEMORY{memtype : memtype}(memtype : memtype) - -;; 1-syntax.watsup -syntax tag = - | TAG{typeidx : typeidx}(typeidx : typeidx) - -;; 1-syntax.watsup -syntax elem = - | ELEM{reftype : reftype, `expr*` : expr*, elemmode : elemmode}(reftype : reftype, expr*{expr <- `expr*`} : expr*, elemmode : elemmode) - -;; 1-syntax.watsup -syntax data = - | DATA{`byte*` : byte*, datamode : datamode}(byte*{byte <- `byte*`} : byte*, datamode : datamode) - -;; 1-syntax.watsup -syntax start = - | START{funcidx : funcidx}(funcidx : funcidx) - -;; 1-syntax.watsup -syntax export = - | EXPORT{name : name, externidx : externidx}(name : name, externidx : externidx) - -;; 1-syntax.watsup -syntax import = - | IMPORT{name : name, externtype : externtype}(name : name, name, externtype : externtype) - -;; 1-syntax.watsup -syntax module = - | MODULE{`type*` : type*, `import*` : import*, `func*` : func*, `global*` : global*, `table*` : table*, `mem*` : mem*, `tag*` : tag*, `elem*` : elem*, `data*` : data*, `start?` : start?, `export*` : export*}(type*{type <- `type*`} : type*, import*{import <- `import*`} : import*, func*{func <- `func*`} : func*, global*{global <- `global*`} : global*, table*{table <- `table*`} : table*, mem*{mem <- `mem*`} : mem*, tag*{tag <- `tag*`} : tag*, elem*{elem <- `elem*`} : elem*, data*{data <- `data*`} : data*, start?{start <- `start?`} : start?, export*{export <- `export*`} : export*) - -;; 2-syntax-aux.watsup -rec { - -;; 2-syntax-aux.watsup:9.1-9.86 -def $funcsxx(externidx*) : typeidx* - ;; 2-syntax-aux.watsup:15.1-15.24 - def $funcsxx([]) = [] - ;; 2-syntax-aux.watsup:16.1-16.45 - def $funcsxx{x : idx, `xx*` : externidx*}([FUNC_externidx(x)] ++ xx*{xx <- `xx*`}) = [x] ++ $funcsxx(xx*{xx <- `xx*`}) - ;; 2-syntax-aux.watsup:17.1-17.58 - def $funcsxx{externidx : externidx, `xx*` : externidx*}([externidx] ++ xx*{xx <- `xx*`}) = $funcsxx(xx*{xx <- `xx*`}) - -- otherwise -} - -;; 2-syntax-aux.watsup -rec { - -;; 2-syntax-aux.watsup:10.1-10.88 -def $globalsxx(externidx*) : globalidx* - ;; 2-syntax-aux.watsup:19.1-19.26 - def $globalsxx([]) = [] - ;; 2-syntax-aux.watsup:20.1-20.51 - def $globalsxx{x : idx, `xx*` : externidx*}([GLOBAL_externidx(x)] ++ xx*{xx <- `xx*`}) = [x] ++ $globalsxx(xx*{xx <- `xx*`}) - ;; 2-syntax-aux.watsup:21.1-21.62 - def $globalsxx{externidx : externidx, `xx*` : externidx*}([externidx] ++ xx*{xx <- `xx*`}) = $globalsxx(xx*{xx <- `xx*`}) - -- otherwise -} - -;; 2-syntax-aux.watsup -rec { - -;; 2-syntax-aux.watsup:11.1-11.87 -def $tablesxx(externidx*) : tableidx* - ;; 2-syntax-aux.watsup:23.1-23.25 - def $tablesxx([]) = [] - ;; 2-syntax-aux.watsup:24.1-24.48 - def $tablesxx{x : idx, `xx*` : externidx*}([TABLE_externidx(x)] ++ xx*{xx <- `xx*`}) = [x] ++ $tablesxx(xx*{xx <- `xx*`}) - ;; 2-syntax-aux.watsup:25.1-25.60 - def $tablesxx{externidx : externidx, `xx*` : externidx*}([externidx] ++ xx*{xx <- `xx*`}) = $tablesxx(xx*{xx <- `xx*`}) - -- otherwise -} - -;; 2-syntax-aux.watsup -rec { - -;; 2-syntax-aux.watsup:12.1-12.85 -def $memsxx(externidx*) : memidx* - ;; 2-syntax-aux.watsup:27.1-27.23 - def $memsxx([]) = [] - ;; 2-syntax-aux.watsup:28.1-28.42 - def $memsxx{x : idx, `xx*` : externidx*}([MEM_externidx(x)] ++ xx*{xx <- `xx*`}) = [x] ++ $memsxx(xx*{xx <- `xx*`}) - ;; 2-syntax-aux.watsup:29.1-29.56 - def $memsxx{externidx : externidx, `xx*` : externidx*}([externidx] ++ xx*{xx <- `xx*`}) = $memsxx(xx*{xx <- `xx*`}) - -- otherwise -} - -;; 2-syntax-aux.watsup -rec { - -;; 2-syntax-aux.watsup:13.1-13.85 -def $tagsxx(externidx*) : tagidx* - ;; 2-syntax-aux.watsup:31.1-31.23 - def $tagsxx([]) = [] - ;; 2-syntax-aux.watsup:32.1-32.42 - def $tagsxx{x : idx, `xx*` : externidx*}([TAG_externidx(x)] ++ xx*{xx <- `xx*`}) = [x] ++ $tagsxx(xx*{xx <- `xx*`}) - ;; 2-syntax-aux.watsup:33.1-33.56 - def $tagsxx{externidx : externidx, `xx*` : externidx*}([externidx] ++ xx*{xx <- `xx*`}) = $tagsxx(xx*{xx <- `xx*`}) - -- otherwise -} - -;; 2-syntax-aux.watsup -def $IN(N : N) : Inn - ;; 2-syntax-aux.watsup - def $IN(32) = I32_Inn - ;; 2-syntax-aux.watsup - def $IN(64) = I64_Inn - -;; 2-syntax-aux.watsup -def $FN(N : N) : Fnn - ;; 2-syntax-aux.watsup - def $FN(32) = F32_Fnn - ;; 2-syntax-aux.watsup - def $FN(64) = F64_Fnn - -;; 2-syntax-aux.watsup -def $JN(N : N) : Jnn - ;; 2-syntax-aux.watsup - def $JN(8) = I8_Jnn - ;; 2-syntax-aux.watsup - def $JN(16) = I16_Jnn - ;; 2-syntax-aux.watsup - def $JN(32) = I32_Jnn - ;; 2-syntax-aux.watsup - def $JN(64) = I64_Jnn - -;; 2-syntax-aux.watsup -def $minat(addrtype : addrtype, addrtype : addrtype) : addrtype - ;; 2-syntax-aux.watsup - def $minat{at_1 : addrtype, at_2 : addrtype}(at_1, at_2) = at_1 - -- if ($size((at_1 : addrtype <: numtype)) <= $size((at_2 : addrtype <: numtype))) - ;; 2-syntax-aux.watsup - def $minat{at_1 : addrtype, at_2 : addrtype}(at_1, at_2) = at_2 - -- otherwise - -;; 2-syntax-aux.watsup -def $diffrt(reftype : reftype, reftype : reftype) : reftype - ;; 2-syntax-aux.watsup - def $diffrt{nul1 : nul1, ht_1 : heaptype, ht_2 : heaptype}(REF_reftype(nul1, ht_1), REF_reftype(`NULL%?`_nul(?(())), ht_2)) = REF_reftype(`NULL%?`_nul(?()), ht_1) - ;; 2-syntax-aux.watsup - def $diffrt{nul1 : nul1, ht_1 : heaptype, ht_2 : heaptype}(REF_reftype(nul1, ht_1), REF_reftype(`NULL%?`_nul(?()), ht_2)) = REF_reftype(nul1, ht_1) - -;; 2-syntax-aux.watsup -rec { - -;; 2-syntax-aux.watsup:75.1-75.88 -def $funcsxt(externtype*) : deftype* - ;; 2-syntax-aux.watsup:81.1-81.24 - def $funcsxt([]) = [] - ;; 2-syntax-aux.watsup:82.1-82.47 - def $funcsxt{dt : deftype, `xt*` : externtype*}([FUNC_externtype((dt : deftype <: typeuse))] ++ xt*{xt <- `xt*`}) = [dt] ++ $funcsxt(xt*{xt <- `xt*`}) - ;; 2-syntax-aux.watsup:83.1-83.59 - def $funcsxt{externtype : externtype, `xt*` : externtype*}([externtype] ++ xt*{xt <- `xt*`}) = $funcsxt(xt*{xt <- `xt*`}) - -- otherwise -} - -;; 2-syntax-aux.watsup -rec { - -;; 2-syntax-aux.watsup:76.1-76.90 -def $globalsxt(externtype*) : globaltype* - ;; 2-syntax-aux.watsup:85.1-85.26 - def $globalsxt([]) = [] - ;; 2-syntax-aux.watsup:86.1-86.53 - def $globalsxt{gt : globaltype, `xt*` : externtype*}([GLOBAL_externtype(gt)] ++ xt*{xt <- `xt*`}) = [gt] ++ $globalsxt(xt*{xt <- `xt*`}) - ;; 2-syntax-aux.watsup:87.1-87.63 - def $globalsxt{externtype : externtype, `xt*` : externtype*}([externtype] ++ xt*{xt <- `xt*`}) = $globalsxt(xt*{xt <- `xt*`}) - -- otherwise -} - -;; 2-syntax-aux.watsup -rec { - -;; 2-syntax-aux.watsup:77.1-77.89 -def $tablesxt(externtype*) : tabletype* - ;; 2-syntax-aux.watsup:89.1-89.25 - def $tablesxt([]) = [] - ;; 2-syntax-aux.watsup:90.1-90.50 - def $tablesxt{tt : tabletype, `xt*` : externtype*}([TABLE_externtype(tt)] ++ xt*{xt <- `xt*`}) = [tt] ++ $tablesxt(xt*{xt <- `xt*`}) - ;; 2-syntax-aux.watsup:91.1-91.61 - def $tablesxt{externtype : externtype, `xt*` : externtype*}([externtype] ++ xt*{xt <- `xt*`}) = $tablesxt(xt*{xt <- `xt*`}) - -- otherwise -} - -;; 2-syntax-aux.watsup -rec { - -;; 2-syntax-aux.watsup:78.1-78.87 -def $memsxt(externtype*) : memtype* - ;; 2-syntax-aux.watsup:93.1-93.23 - def $memsxt([]) = [] - ;; 2-syntax-aux.watsup:94.1-94.44 - def $memsxt{mt : memtype, `xt*` : externtype*}([MEM_externtype(mt)] ++ xt*{xt <- `xt*`}) = [mt] ++ $memsxt(xt*{xt <- `xt*`}) - ;; 2-syntax-aux.watsup:95.1-95.57 - def $memsxt{externtype : externtype, `xt*` : externtype*}([externtype] ++ xt*{xt <- `xt*`}) = $memsxt(xt*{xt <- `xt*`}) - -- otherwise -} - -;; 2-syntax-aux.watsup -rec { - -;; 2-syntax-aux.watsup:79.1-79.87 -def $tagsxt(externtype*) : tagtype* - ;; 2-syntax-aux.watsup:97.1-97.23 - def $tagsxt([]) = [] - ;; 2-syntax-aux.watsup:98.1-98.44 - def $tagsxt{jt : tagtype, `xt*` : externtype*}([TAG_externtype((jt : deftype <: typeuse))] ++ xt*{xt <- `xt*`}) = [jt] ++ $tagsxt(xt*{xt <- `xt*`}) - ;; 2-syntax-aux.watsup:99.1-99.57 - def $tagsxt{externtype : externtype, `xt*` : externtype*}([externtype] ++ xt*{xt <- `xt*`}) = $tagsxt(xt*{xt <- `xt*`}) - -- otherwise -} - -;; 2-syntax-aux.watsup -rec { - -;; 2-syntax-aux.watsup:104.1-104.112 -def $subst_typevar(typevar : typevar, typevar*, typeuse*) : typeuse - ;; 2-syntax-aux.watsup:133.1-133.38 - def $subst_typevar{tv : typevar}(tv, [], []) = (tv : typevar <: typeuse) - ;; 2-syntax-aux.watsup:134.1-134.95 - def $subst_typevar{tv : typevar, tv_1 : typevar, `tv'*` : typevar*, tu_1 : typeuse, `tu'*` : typeuse*}(tv, [tv_1] ++ tv'*{tv' <- `tv'*`}, [tu_1] ++ tu'*{tu' <- `tu'*`}) = tu_1 - -- if (tv = tv_1) - ;; 2-syntax-aux.watsup:135.1-135.92 - def $subst_typevar{tv : typevar, tv_1 : typevar, `tv'*` : typevar*, tu_1 : typeuse, `tu'*` : typeuse*}(tv, [tv_1] ++ tv'*{tv' <- `tv'*`}, [tu_1] ++ tu'*{tu' <- `tu'*`}) = $subst_typevar(tv, tv'*{tv' <- `tv'*`}, tu'*{tu' <- `tu'*`}) - -- otherwise -} - -;; 2-syntax-aux.watsup -def $subst_packtype(packtype : packtype, typevar*, typeuse*) : packtype - ;; 2-syntax-aux.watsup - def $subst_packtype{pt : packtype, `tv*` : typevar*, `tu*` : typeuse*}(pt, tv*{tv <- `tv*`}, tu*{tu <- `tu*`}) = pt - -;; 2-syntax-aux.watsup -def $subst_numtype(numtype : numtype, typevar*, typeuse*) : numtype - ;; 2-syntax-aux.watsup - def $subst_numtype{nt : numtype, `tv*` : typevar*, `tu*` : typeuse*}(nt, tv*{tv <- `tv*`}, tu*{tu <- `tu*`}) = nt - -;; 2-syntax-aux.watsup -def $subst_vectype(vectype : vectype, typevar*, typeuse*) : vectype - ;; 2-syntax-aux.watsup - def $subst_vectype{vt : vectype, `tv*` : typevar*, `tu*` : typeuse*}(vt, tv*{tv <- `tv*`}, tu*{tu <- `tu*`}) = vt - -;; 2-syntax-aux.watsup -rec { - -;; 2-syntax-aux.watsup:105.1-105.112 -def $subst_typeuse(typeuse : typeuse, typevar*, typeuse*) : typeuse - ;; 2-syntax-aux.watsup:137.1-137.66 - def $subst_typeuse{tv' : typevar, `tv*` : typevar*, `tu*` : typeuse*}((tv' : typevar <: typeuse), tv*{tv <- `tv*`}, tu*{tu <- `tu*`}) = $subst_typevar(tv', tv*{tv <- `tv*`}, tu*{tu <- `tu*`}) - ;; 2-syntax-aux.watsup:138.1-138.64 - def $subst_typeuse{dt : deftype, `tv*` : typevar*, `tu*` : typeuse*}((dt : deftype <: typeuse), tv*{tv <- `tv*`}, tu*{tu <- `tu*`}) = ($subst_deftype(dt, tv*{tv <- `tv*`}, tu*{tu <- `tu*`}) : deftype <: typeuse) - -;; 2-syntax-aux.watsup:110.1-110.112 -def $subst_heaptype(heaptype : heaptype, typevar*, typeuse*) : heaptype - ;; 2-syntax-aux.watsup:144.1-144.67 - def $subst_heaptype{tv' : typevar, `tv*` : typevar*, `tu*` : typeuse*}((tv' : typevar <: heaptype), tv*{tv <- `tv*`}, tu*{tu <- `tu*`}) = ($subst_typevar(tv', tv*{tv <- `tv*`}, tu*{tu <- `tu*`}) : typeuse <: heaptype) - ;; 2-syntax-aux.watsup:145.1-145.65 - def $subst_heaptype{dt : deftype, `tv*` : typevar*, `tu*` : typeuse*}((dt : deftype <: heaptype), tv*{tv <- `tv*`}, tu*{tu <- `tu*`}) = ($subst_deftype(dt, tv*{tv <- `tv*`}, tu*{tu <- `tu*`}) : deftype <: heaptype) - ;; 2-syntax-aux.watsup:146.1-146.53 - def $subst_heaptype{ht : heaptype, `tv*` : typevar*, `tu*` : typeuse*}(ht, tv*{tv <- `tv*`}, tu*{tu <- `tu*`}) = ht - -- otherwise - -;; 2-syntax-aux.watsup:111.1-111.112 -def $subst_reftype(reftype : reftype, typevar*, typeuse*) : reftype - ;; 2-syntax-aux.watsup:148.1-148.83 - def $subst_reftype{nul : nul, ht : heaptype, `tv*` : typevar*, `tu*` : typeuse*}(REF_reftype(nul, ht), tv*{tv <- `tv*`}, tu*{tu <- `tu*`}) = REF_reftype(nul, $subst_heaptype(ht, tv*{tv <- `tv*`}, tu*{tu <- `tu*`})) - -;; 2-syntax-aux.watsup:112.1-112.112 -def $subst_valtype(valtype : valtype, typevar*, typeuse*) : valtype - ;; 2-syntax-aux.watsup:150.1-150.64 - def $subst_valtype{nt : numtype, `tv*` : typevar*, `tu*` : typeuse*}((nt : numtype <: valtype), tv*{tv <- `tv*`}, tu*{tu <- `tu*`}) = ($subst_numtype(nt, tv*{tv <- `tv*`}, tu*{tu <- `tu*`}) : numtype <: valtype) - ;; 2-syntax-aux.watsup:151.1-151.64 - def $subst_valtype{vt : vectype, `tv*` : typevar*, `tu*` : typeuse*}((vt : vectype <: valtype), tv*{tv <- `tv*`}, tu*{tu <- `tu*`}) = ($subst_vectype(vt, tv*{tv <- `tv*`}, tu*{tu <- `tu*`}) : vectype <: valtype) - ;; 2-syntax-aux.watsup:152.1-152.64 - def $subst_valtype{rt : reftype, `tv*` : typevar*, `tu*` : typeuse*}((rt : reftype <: valtype), tv*{tv <- `tv*`}, tu*{tu <- `tu*`}) = ($subst_reftype(rt, tv*{tv <- `tv*`}, tu*{tu <- `tu*`}) : reftype <: valtype) - ;; 2-syntax-aux.watsup:153.1-153.40 - def $subst_valtype{`tv*` : typevar*, `tu*` : typeuse*}(BOT_valtype, tv*{tv <- `tv*`}, tu*{tu <- `tu*`}) = BOT_valtype - -;; 2-syntax-aux.watsup:115.1-115.112 -def $subst_storagetype(storagetype : storagetype, typevar*, typeuse*) : storagetype - ;; 2-syntax-aux.watsup:157.1-157.66 - def $subst_storagetype{t : valtype, `tv*` : typevar*, `tu*` : typeuse*}((t : valtype <: storagetype), tv*{tv <- `tv*`}, tu*{tu <- `tu*`}) = ($subst_valtype(t, tv*{tv <- `tv*`}, tu*{tu <- `tu*`}) : valtype <: storagetype) - ;; 2-syntax-aux.watsup:158.1-158.69 - def $subst_storagetype{pt : packtype, `tv*` : typevar*, `tu*` : typeuse*}((pt : packtype <: storagetype), tv*{tv <- `tv*`}, tu*{tu <- `tu*`}) = ($subst_packtype(pt, tv*{tv <- `tv*`}, tu*{tu <- `tu*`}) : packtype <: storagetype) - -;; 2-syntax-aux.watsup:116.1-116.112 -def $subst_fieldtype(fieldtype : fieldtype, typevar*, typeuse*) : fieldtype - ;; 2-syntax-aux.watsup:160.1-160.80 - def $subst_fieldtype{mut : mut, zt : storagetype, `tv*` : typevar*, `tu*` : typeuse*}(`%%`_fieldtype(mut, zt), tv*{tv <- `tv*`}, tu*{tu <- `tu*`}) = `%%`_fieldtype(mut, $subst_storagetype(zt, tv*{tv <- `tv*`}, tu*{tu <- `tu*`})) - -;; 2-syntax-aux.watsup:118.1-118.112 -def $subst_comptype(comptype : comptype, typevar*, typeuse*) : comptype - ;; 2-syntax-aux.watsup:162.1-162.85 - def $subst_comptype{`yt*` : fieldtype*, `tv*` : typevar*, `tu*` : typeuse*}(STRUCT_comptype(`%`_structtype(yt*{yt <- `yt*`})), tv*{tv <- `tv*`}, tu*{tu <- `tu*`}) = STRUCT_comptype(`%`_structtype($subst_fieldtype(yt, tv*{tv <- `tv*`}, tu*{tu <- `tu*`})*{yt <- `yt*`})) - ;; 2-syntax-aux.watsup:163.1-163.81 - def $subst_comptype{yt : fieldtype, `tv*` : typevar*, `tu*` : typeuse*}(ARRAY_comptype(yt), tv*{tv <- `tv*`}, tu*{tu <- `tu*`}) = ARRAY_comptype($subst_fieldtype(yt, tv*{tv <- `tv*`}, tu*{tu <- `tu*`})) - ;; 2-syntax-aux.watsup:164.1-164.78 - def $subst_comptype{ft : functype, `tv*` : typevar*, `tu*` : typeuse*}(FUNC_comptype(ft), tv*{tv <- `tv*`}, tu*{tu <- `tu*`}) = FUNC_comptype($subst_functype(ft, tv*{tv <- `tv*`}, tu*{tu <- `tu*`})) - -;; 2-syntax-aux.watsup:119.1-119.112 -def $subst_subtype(subtype : subtype, typevar*, typeuse*) : subtype - ;; 2-syntax-aux.watsup:166.1-167.71 - def $subst_subtype{fin : fin, `tu'*` : typeuse*, ct : comptype, `tv*` : typevar*, `tu*` : typeuse*}(SUB_subtype(fin, tu'*{tu' <- `tu'*`}, ct), tv*{tv <- `tv*`}, tu*{tu <- `tu*`}) = SUB_subtype(fin, $subst_typeuse(tu', tv*{tv <- `tv*`}, tu*{tu <- `tu*`})*{tu' <- `tu'*`}, $subst_comptype(ct, tv*{tv <- `tv*`}, tu*{tu <- `tu*`})) - -;; 2-syntax-aux.watsup:120.1-120.112 -def $subst_rectype(rectype : rectype, typevar*, typeuse*) : rectype - ;; 2-syntax-aux.watsup:169.1-169.76 - def $subst_rectype{`st*` : subtype*, `tv*` : typevar*, `tu*` : typeuse*}(REC_rectype(`%`_list(st*{st <- `st*`})), tv*{tv <- `tv*`}, tu*{tu <- `tu*`}) = REC_rectype(`%`_list($subst_subtype(st, tv*{tv <- `tv*`}, tu*{tu <- `tu*`})*{st <- `st*`})) - -;; 2-syntax-aux.watsup:121.1-121.112 -def $subst_deftype(deftype : deftype, typevar*, typeuse*) : deftype - ;; 2-syntax-aux.watsup:171.1-171.78 - def $subst_deftype{qt : rectype, i : n, `tv*` : typevar*, `tu*` : typeuse*}(DEF_deftype(qt, i), tv*{tv <- `tv*`}, tu*{tu <- `tu*`}) = DEF_deftype($subst_rectype(qt, tv*{tv <- `tv*`}, tu*{tu <- `tu*`}), i) - -;; 2-syntax-aux.watsup:124.1-124.112 -def $subst_functype(functype : functype, typevar*, typeuse*) : functype - ;; 2-syntax-aux.watsup:174.1-174.113 - def $subst_functype{`t_1*` : valtype*, `t_2*` : valtype*, `tv*` : typevar*, `tu*` : typeuse*}(`%->%`_functype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`})), tv*{tv <- `tv*`}, tu*{tu <- `tu*`}) = `%->%`_functype(`%`_resulttype($subst_valtype(t_1, tv*{tv <- `tv*`}, tu*{tu <- `tu*`})*{t_1 <- `t_1*`}), `%`_resulttype($subst_valtype(t_2, tv*{tv <- `tv*`}, tu*{tu <- `tu*`})*{t_2 <- `t_2*`})) -} - -;; 2-syntax-aux.watsup -def $subst_addrtype(addrtype : addrtype, typevar*, typeuse*) : addrtype - ;; 2-syntax-aux.watsup - def $subst_addrtype{at : addrtype, `tv*` : typevar*, `tu*` : typeuse*}(at, tv*{tv <- `tv*`}, tu*{tu <- `tu*`}) = at - -;; 2-syntax-aux.watsup -def $subst_globaltype(globaltype : globaltype, typevar*, typeuse*) : globaltype - ;; 2-syntax-aux.watsup - def $subst_globaltype{mut : mut, t : valtype, `tv*` : typevar*, `tu*` : typeuse*}(`%%`_globaltype(mut, t), tv*{tv <- `tv*`}, tu*{tu <- `tu*`}) = `%%`_globaltype(mut, $subst_valtype(t, tv*{tv <- `tv*`}, tu*{tu <- `tu*`})) - -;; 2-syntax-aux.watsup -def $subst_tabletype(tabletype : tabletype, typevar*, typeuse*) : tabletype - ;; 2-syntax-aux.watsup - def $subst_tabletype{at : addrtype, lim : limits, rt : reftype, `tv*` : typevar*, `tu*` : typeuse*}(`%%%`_tabletype(at, lim, rt), tv*{tv <- `tv*`}, tu*{tu <- `tu*`}) = `%%%`_tabletype(at, lim, $subst_reftype(rt, tv*{tv <- `tv*`}, tu*{tu <- `tu*`})) - -;; 2-syntax-aux.watsup -def $subst_memtype(memtype : memtype, typevar*, typeuse*) : memtype - ;; 2-syntax-aux.watsup - def $subst_memtype{at : addrtype, lim : limits, `tv*` : typevar*, `tu*` : typeuse*}(`%%PAGE`_memtype(at, lim), tv*{tv <- `tv*`}, tu*{tu <- `tu*`}) = `%%PAGE`_memtype(at, lim) - -;; 2-syntax-aux.watsup -def $subst_tagtype(tagtype : tagtype, typevar*, typeuse*) : tagtype - ;; 2-syntax-aux.watsup - def $subst_tagtype{dt : deftype, `tv*` : typevar*, `tu*` : typeuse*}(dt, tv*{tv <- `tv*`}, tu*{tu <- `tu*`}) = $subst_deftype(dt, tv*{tv <- `tv*`}, tu*{tu <- `tu*`}) - -;; 2-syntax-aux.watsup -def $subst_externtype(externtype : externtype, typevar*, typeuse*) : externtype - ;; 2-syntax-aux.watsup - def $subst_externtype{dt : deftype, `tv*` : typevar*, `tu*` : typeuse*}(FUNC_externtype((dt : deftype <: typeuse)), tv*{tv <- `tv*`}, tu*{tu <- `tu*`}) = FUNC_externtype(($subst_deftype(dt, tv*{tv <- `tv*`}, tu*{tu <- `tu*`}) : deftype <: typeuse)) - ;; 2-syntax-aux.watsup - def $subst_externtype{gt : globaltype, `tv*` : typevar*, `tu*` : typeuse*}(GLOBAL_externtype(gt), tv*{tv <- `tv*`}, tu*{tu <- `tu*`}) = GLOBAL_externtype($subst_globaltype(gt, tv*{tv <- `tv*`}, tu*{tu <- `tu*`})) - ;; 2-syntax-aux.watsup - def $subst_externtype{tt : tabletype, `tv*` : typevar*, `tu*` : typeuse*}(TABLE_externtype(tt), tv*{tv <- `tv*`}, tu*{tu <- `tu*`}) = TABLE_externtype($subst_tabletype(tt, tv*{tv <- `tv*`}, tu*{tu <- `tu*`})) - ;; 2-syntax-aux.watsup - def $subst_externtype{mt : memtype, `tv*` : typevar*, `tu*` : typeuse*}(MEM_externtype(mt), tv*{tv <- `tv*`}, tu*{tu <- `tu*`}) = MEM_externtype($subst_memtype(mt, tv*{tv <- `tv*`}, tu*{tu <- `tu*`})) - ;; 2-syntax-aux.watsup - def $subst_externtype{jt : tagtype, `tv*` : typevar*, `tu*` : typeuse*}(TAG_externtype((jt : deftype <: typeuse)), tv*{tv <- `tv*`}, tu*{tu <- `tu*`}) = TAG_externtype(($subst_tagtype(jt, tv*{tv <- `tv*`}, tu*{tu <- `tu*`}) : deftype <: typeuse)) - -;; 2-syntax-aux.watsup -def $subst_moduletype(moduletype : moduletype, typevar*, typeuse*) : moduletype - ;; 2-syntax-aux.watsup - def $subst_moduletype{`xt_1*` : externtype*, `xt_2*` : externtype*, `tv*` : typevar*, `tu*` : typeuse*}(`%->%`_moduletype(xt_1*{xt_1 <- `xt_1*`}, xt_2*{xt_2 <- `xt_2*`}), tv*{tv <- `tv*`}, tu*{tu <- `tu*`}) = `%->%`_moduletype($subst_externtype(xt_1, tv*{tv <- `tv*`}, tu*{tu <- `tu*`})*{xt_1 <- `xt_1*`}, $subst_externtype(xt_2, tv*{tv <- `tv*`}, tu*{tu <- `tu*`})*{xt_2 <- `xt_2*`}) - -;; 2-syntax-aux.watsup -def $subst_all_valtype(valtype : valtype, heaptype*) : valtype - ;; 2-syntax-aux.watsup - def $subst_all_valtype{t : valtype, `tu*` : typeuse*, n : n, `i*` : nat*}(t, (tu : typeuse <: heaptype)^n{tu <- `tu*`}) = $subst_valtype(t, _IDX_typevar(`%`_typeidx(i))^(i%`_functype(resulttype_1, resulttype_2)) = $free_resulttype(resulttype_1) +++ $free_resulttype(resulttype_2) - -;; 2-syntax-aux.watsup:330.1-330.36 -def $free_comptype(comptype : comptype) : free - ;; 2-syntax-aux.watsup:393.1-393.69 - def $free_comptype{structtype : structtype}(STRUCT_comptype(structtype)) = $free_structtype(structtype) - ;; 2-syntax-aux.watsup:394.1-394.65 - def $free_comptype{arraytype : arraytype}(ARRAY_comptype(arraytype)) = $free_arraytype(arraytype) - ;; 2-syntax-aux.watsup:395.1-395.61 - def $free_comptype{functype : functype}(FUNC_comptype(functype)) = $free_functype(functype) - -;; 2-syntax-aux.watsup:331.1-331.34 -def $free_subtype(subtype : subtype) : free - ;; 2-syntax-aux.watsup:397.1-398.66 - def $free_subtype{fin : fin, `typeuse*` : typeuse*, comptype : comptype}(SUB_subtype(fin, typeuse*{typeuse <- `typeuse*`}, comptype)) = $free_list($free_typeuse(typeuse)*{typeuse <- `typeuse*`}) +++ $free_comptype(comptype) - -;; 2-syntax-aux.watsup:332.1-332.34 -def $free_rectype(rectype : rectype) : free - ;; 2-syntax-aux.watsup:400.1-400.70 - def $free_rectype{`subtype*` : subtype*}(REC_rectype(`%`_list(subtype*{subtype <- `subtype*`}))) = $free_list($free_subtype(subtype)*{subtype <- `subtype*`}) - -;; 2-syntax-aux.watsup:360.1-360.34 -def $free_deftype(deftype : deftype) : free - ;; 2-syntax-aux.watsup:361.1-361.58 - def $free_deftype{rectype : rectype, n : n}(DEF_deftype(rectype, n)) = $free_rectype(rectype) -} - -;; 2-syntax-aux.watsup -def $free_globaltype(globaltype : globaltype) : free - ;; 2-syntax-aux.watsup - def $free_globaltype{mut : mut, valtype : valtype}(`%%`_globaltype(mut, valtype)) = $free_valtype(valtype) - -;; 2-syntax-aux.watsup -def $free_tabletype(tabletype : tabletype) : free - ;; 2-syntax-aux.watsup - def $free_tabletype{addrtype : addrtype, limits : limits, reftype : reftype}(`%%%`_tabletype(addrtype, limits, reftype)) = $free_addrtype((addrtype : addrtype <: numtype)) +++ $free_reftype(reftype) - -;; 2-syntax-aux.watsup -def $free_memtype(memtype : memtype) : free - ;; 2-syntax-aux.watsup - def $free_memtype{addrtype : addrtype, limits : limits}(`%%PAGE`_memtype(addrtype, limits)) = $free_addrtype((addrtype : addrtype <: numtype)) - -;; 2-syntax-aux.watsup -def $free_tagtype(tagtype : tagtype) : free - ;; 2-syntax-aux.watsup - def $free_tagtype{deftype : deftype}(deftype) = $free_deftype(deftype) - -;; 2-syntax-aux.watsup -def $free_elemtype(elemtype : elemtype) : free - ;; 2-syntax-aux.watsup - def $free_elemtype{reftype : reftype}(reftype) = $free_reftype(reftype) - -;; 2-syntax-aux.watsup -def $free_datatype(datatype : datatype) : free - ;; 2-syntax-aux.watsup - def $free_datatype(OK_datatype) = {TYPES [], FUNCS [], GLOBALS [], TABLES [], MEMS [], ELEMS [], DATAS [], LOCALS [], LABELS []} - -;; 2-syntax-aux.watsup -def $free_externtype(externtype : externtype) : free - ;; 2-syntax-aux.watsup - def $free_externtype{typeuse : typeuse}(FUNC_externtype(typeuse)) = $free_typeuse(typeuse) - ;; 2-syntax-aux.watsup - def $free_externtype{globaltype : globaltype}(GLOBAL_externtype(globaltype)) = $free_globaltype(globaltype) - ;; 2-syntax-aux.watsup - def $free_externtype{tabletype : tabletype}(TABLE_externtype(tabletype)) = $free_tabletype(tabletype) - ;; 2-syntax-aux.watsup - def $free_externtype{memtype : memtype}(MEM_externtype(memtype)) = $free_memtype(memtype) - ;; 2-syntax-aux.watsup - def $free_externtype{tagtype : tagtype}(TAG_externtype((tagtype : deftype <: typeuse))) = $free_tagtype(tagtype) - -;; 2-syntax-aux.watsup -def $free_moduletype(moduletype : moduletype) : free - ;; 2-syntax-aux.watsup - def $free_moduletype{`externtype_1*` : externtype*, `externtype_2*` : externtype*}(`%->%`_moduletype(externtype_1*{externtype_1 <- `externtype_1*`}, externtype_2*{externtype_2 <- `externtype_2*`})) = $free_list($free_externtype(externtype_1)*{externtype_1 <- `externtype_1*`}) +++ $free_list($free_externtype(externtype_2)*{externtype_2 <- `externtype_2*`}) - -;; 2-syntax-aux.watsup -def $free_shape(shape : shape) : free - ;; 2-syntax-aux.watsup - def $free_shape{lanetype : lanetype, dim : dim}(`%X%`_shape(lanetype, dim)) = $free_lanetype(lanetype) - -;; 2-syntax-aux.watsup -def $free_blocktype(blocktype : blocktype) : free - ;; 2-syntax-aux.watsup - def $free_blocktype{`valtype?` : valtype?}(_RESULT_blocktype(valtype?{valtype <- `valtype?`})) = $free_opt($free_valtype(valtype)?{valtype <- `valtype?`}) - ;; 2-syntax-aux.watsup - def $free_blocktype{funcidx : funcidx}(_IDX_blocktype(funcidx)) = $free_funcidx(funcidx) - -;; 2-syntax-aux.watsup -rec { - -;; 2-syntax-aux.watsup:584.1-584.44 -def $shift_labelidxs(labelidx*) : labelidx* - ;; 2-syntax-aux.watsup:585.1-585.32 - def $shift_labelidxs([]) = [] - ;; 2-syntax-aux.watsup:586.1-586.66 - def $shift_labelidxs{`labelidx'*` : labelidx*}([`%`_uN(0)] ++ labelidx'*{labelidx' <- `labelidx'*`}) = $shift_labelidxs(labelidx'*{labelidx' <- `labelidx'*`}) - ;; 2-syntax-aux.watsup:587.1-587.91 - def $shift_labelidxs{labelidx : labelidx, `labelidx'*` : labelidx*}([labelidx] ++ labelidx'*{labelidx' <- `labelidx'*`}) = [`%`_uN((((labelidx!`%`_labelidx.0 : nat <:> int) - (1 : nat <:> int)) : int <:> nat))] ++ $shift_labelidxs(labelidx'*{labelidx' <- `labelidx'*`}) -} - -;; 2-syntax-aux.watsup -rec { - -;; 2-syntax-aux.watsup:431.1-431.30 -def $free_instr(instr : instr) : free - ;; 2-syntax-aux.watsup:442.1-442.26 - def $free_instr(NOP_instr) = {TYPES [], FUNCS [], GLOBALS [], TABLES [], MEMS [], ELEMS [], DATAS [], LOCALS [], LABELS []} - ;; 2-syntax-aux.watsup:443.1-443.34 - def $free_instr(UNREACHABLE_instr) = {TYPES [], FUNCS [], GLOBALS [], TABLES [], MEMS [], ELEMS [], DATAS [], LOCALS [], LABELS []} - ;; 2-syntax-aux.watsup:444.1-444.27 - def $free_instr(DROP_instr) = {TYPES [], FUNCS [], GLOBALS [], TABLES [], MEMS [], ELEMS [], DATAS [], LOCALS [], LABELS []} - ;; 2-syntax-aux.watsup:445.1-445.86 - def $free_instr{`valtype*?` : valtype*?}(`SELECT()%?`_instr(valtype*{valtype <- `valtype*`}?{`valtype*` <- `valtype*?`})) = $free_opt($free_list($free_valtype(valtype)*{valtype <- `valtype*`})?{`valtype*` <- `valtype*?`}) - ;; 2-syntax-aux.watsup:447.1-447.92 - def $free_instr{blocktype : blocktype, `instr*` : instr*}(BLOCK_instr(blocktype, instr*{instr <- `instr*`})) = $free_blocktype(blocktype) +++ $free_block(instr*{instr <- `instr*`}) - ;; 2-syntax-aux.watsup:448.1-448.91 - def $free_instr{blocktype : blocktype, `instr*` : instr*}(LOOP_instr(blocktype, instr*{instr <- `instr*`})) = $free_blocktype(blocktype) +++ $free_block(instr*{instr <- `instr*`}) - ;; 2-syntax-aux.watsup:449.1-450.79 - def $free_instr{blocktype : blocktype, `instr_1*` : instr*, `instr_2*` : instr*}(`IF%%ELSE%`_instr(blocktype, instr_1*{instr_1 <- `instr_1*`}, instr_2*{instr_2 <- `instr_2*`})) = $free_blocktype(blocktype) +++ $free_block(instr_1*{instr_1 <- `instr_1*`}) +++ $free_block(instr_2*{instr_2 <- `instr_2*`}) - ;; 2-syntax-aux.watsup:452.1-452.56 - def $free_instr{labelidx : labelidx}(BR_instr(labelidx)) = $free_labelidx(labelidx) - ;; 2-syntax-aux.watsup:453.1-453.59 - def $free_instr{labelidx : labelidx}(BR_IF_instr(labelidx)) = $free_labelidx(labelidx) - ;; 2-syntax-aux.watsup:454.1-455.68 - def $free_instr{labelidx : labelidx, labelidx' : labelidx}(BR_TABLE_instr(labelidx*{}, labelidx')) = $free_list($free_labelidx(labelidx)*{}) +++ $free_labelidx(labelidx) - ;; 2-syntax-aux.watsup:456.1-456.64 - def $free_instr{labelidx : labelidx}(BR_ON_NULL_instr(labelidx)) = $free_labelidx(labelidx) - ;; 2-syntax-aux.watsup:457.1-457.68 - def $free_instr{labelidx : labelidx}(BR_ON_NON_NULL_instr(labelidx)) = $free_labelidx(labelidx) - ;; 2-syntax-aux.watsup:458.1-459.83 - def $free_instr{labelidx : labelidx, reftype_1 : reftype, reftype_2 : reftype}(BR_ON_CAST_instr(labelidx, reftype_1, reftype_2)) = $free_labelidx(labelidx) +++ $free_reftype(reftype_1) +++ $free_reftype(reftype_2) - ;; 2-syntax-aux.watsup:460.1-461.83 - def $free_instr{labelidx : labelidx, reftype_1 : reftype, reftype_2 : reftype}(BR_ON_CAST_FAIL_instr(labelidx, reftype_1, reftype_2)) = $free_labelidx(labelidx) +++ $free_reftype(reftype_1) +++ $free_reftype(reftype_2) - ;; 2-syntax-aux.watsup:463.1-463.55 - def $free_instr{funcidx : funcidx}(CALL_instr(funcidx)) = $free_funcidx(funcidx) - ;; 2-syntax-aux.watsup:464.1-464.59 - def $free_instr{typeuse : typeuse}(CALL_REF_instr(typeuse)) = $free_typeuse(typeuse) - ;; 2-syntax-aux.watsup:465.1-466.53 - def $free_instr{tableidx : tableidx, typeuse : typeuse}(CALL_INDIRECT_instr(tableidx, typeuse)) = $free_tableidx(tableidx) +++ $free_typeuse(typeuse) - ;; 2-syntax-aux.watsup:467.1-467.29 - def $free_instr(RETURN_instr) = {TYPES [], FUNCS [], GLOBALS [], TABLES [], MEMS [], ELEMS [], DATAS [], LOCALS [], LABELS []} - ;; 2-syntax-aux.watsup:468.1-468.62 - def $free_instr{funcidx : funcidx}(RETURN_CALL_instr(funcidx)) = $free_funcidx(funcidx) - ;; 2-syntax-aux.watsup:469.1-469.66 - def $free_instr{typeuse : typeuse}(RETURN_CALL_REF_instr(typeuse)) = $free_typeuse(typeuse) - ;; 2-syntax-aux.watsup:470.1-471.53 - def $free_instr{tableidx : tableidx, typeuse : typeuse}(RETURN_CALL_INDIRECT_instr(tableidx, typeuse)) = $free_tableidx(tableidx) +++ $free_typeuse(typeuse) - ;; 2-syntax-aux.watsup:473.1-473.63 - def $free_instr{numtype : numtype, numlit : num_(numtype)}(CONST_instr(numtype, numlit)) = $free_numtype(numtype) - ;; 2-syntax-aux.watsup:474.1-474.60 - def $free_instr{numtype : numtype, unop : unop_(numtype)}(UNOP_instr(numtype, unop)) = $free_numtype(numtype) - ;; 2-syntax-aux.watsup:475.1-475.62 - def $free_instr{numtype : numtype, binop : binop_(numtype)}(BINOP_instr(numtype, binop)) = $free_numtype(numtype) - ;; 2-syntax-aux.watsup:476.1-476.64 - def $free_instr{numtype : numtype, testop : testop_(numtype)}(TESTOP_instr(numtype, testop)) = $free_numtype(numtype) - ;; 2-syntax-aux.watsup:477.1-477.62 - def $free_instr{numtype : numtype, relop : relop_(numtype)}(RELOP_instr(numtype, relop)) = $free_numtype(numtype) - ;; 2-syntax-aux.watsup:478.1-479.55 - def $free_instr{numtype_1 : numtype, numtype_2 : numtype, cvtop : cvtop__(numtype_2, numtype_1)}(CVTOP_instr(numtype_1, numtype_2, cvtop)) = $free_numtype(numtype_1) +++ $free_numtype(numtype_2) - ;; 2-syntax-aux.watsup:481.1-481.64 - def $free_instr{vectype : vectype, veclit : vec_(vectype)}(VCONST_instr(vectype, veclit)) = $free_vectype(vectype) - ;; 2-syntax-aux.watsup:482.1-482.64 - def $free_instr{vectype : vectype, vvunop : vvunop}(VVUNOP_instr(vectype, vvunop)) = $free_vectype(vectype) - ;; 2-syntax-aux.watsup:483.1-483.66 - def $free_instr{vectype : vectype, vvbinop : vvbinop}(VVBINOP_instr(vectype, vvbinop)) = $free_vectype(vectype) - ;; 2-syntax-aux.watsup:484.1-484.68 - def $free_instr{vectype : vectype, vvternop : vvternop}(VVTERNOP_instr(vectype, vvternop)) = $free_vectype(vectype) - ;; 2-syntax-aux.watsup:485.1-485.68 - def $free_instr{vectype : vectype, vvtestop : vvtestop}(VVTESTOP_instr(vectype, vvtestop)) = $free_vectype(vectype) - ;; 2-syntax-aux.watsup:486.1-486.56 - def $free_instr{shape : shape, vunop : vunop_(shape)}(VUNOP_instr(shape, vunop)) = $free_shape(shape) - ;; 2-syntax-aux.watsup:487.1-487.58 - def $free_instr{shape : shape, vbinop : vbinop_(shape)}(VBINOP_instr(shape, vbinop)) = $free_shape(shape) - ;; 2-syntax-aux.watsup:488.1-488.60 - def $free_instr{shape : shape, vternop : vternop_(shape)}(VTERNOP_instr(shape, vternop)) = $free_shape(shape) - ;; 2-syntax-aux.watsup:489.1-489.60 - def $free_instr{shape : shape, vtestop : vtestop_(shape)}(VTESTOP_instr(shape, vtestop)) = $free_shape(shape) - ;; 2-syntax-aux.watsup:490.1-490.58 - def $free_instr{shape : shape, vrelop : vrelop_(shape)}(VRELOP_instr(shape, vrelop)) = $free_shape(shape) - ;; 2-syntax-aux.watsup:491.1-491.64 - def $free_instr{ishape : ishape, vshiftop : vshiftop_(ishape)}(VSHIFTOP_instr(ishape, vshiftop)) = $free_shape(ishape!`%`_ishape.0) - ;; 2-syntax-aux.watsup:492.1-492.55 - def $free_instr{ishape : ishape}(VBITMASK_instr(ishape)) = $free_shape(ishape!`%`_ishape.0) - ;; 2-syntax-aux.watsup:493.1-493.66 - def $free_instr{bshape : bshape, vswizzlop : vswizzlop_(bshape)}(VSWIZZLOP_instr(bshape, vswizzlop)) = $free_shape(bshape!`%`_bshape.0) - ;; 2-syntax-aux.watsup:494.1-494.64 - def $free_instr{bshape : bshape, `laneidx*` : laneidx*}(VSHUFFLE_instr(bshape, laneidx*{laneidx <- `laneidx*`})) = $free_shape(bshape!`%`_bshape.0) - ;; 2-syntax-aux.watsup:495.1-496.49 - def $free_instr{ishape_1 : ishape, ishape_2 : ishape, vextunop : vextunop__(ishape_2, ishape_1)}(VEXTUNOP_instr(ishape_1, ishape_2, vextunop)) = $free_shape(ishape_1!`%`_ishape.0) +++ $free_shape(ishape_2!`%`_ishape.0) - ;; 2-syntax-aux.watsup:497.1-498.49 - def $free_instr{ishape_1 : ishape, ishape_2 : ishape, vextbinop : vextbinop__(ishape_2, ishape_1)}(VEXTBINOP_instr(ishape_1, ishape_2, vextbinop)) = $free_shape(ishape_1!`%`_ishape.0) +++ $free_shape(ishape_2!`%`_ishape.0) - ;; 2-syntax-aux.watsup:499.1-500.49 - def $free_instr{ishape_1 : ishape, ishape_2 : ishape, sx : sx}(VNARROW_instr(ishape_1, ishape_2, sx)) = $free_shape(ishape_1!`%`_ishape.0) +++ $free_shape(ishape_2!`%`_ishape.0) - ;; 2-syntax-aux.watsup:501.1-502.47 - def $free_instr{shape_1 : shape, shape_2 : shape, vcvtop : vcvtop__(shape_2, shape_1), `half?` : half__(shape_2, shape_1)?, `zero?` : zero__(shape_2, shape_1)?}(VCVTOP_instr(shape_1, shape_2, vcvtop, half?{half <- `half?`}, zero?{zero <- `zero?`})) = $free_shape(shape_1) +++ $free_shape(shape_2) - ;; 2-syntax-aux.watsup:503.1-503.51 - def $free_instr{shape : shape}(VSPLAT_instr(shape)) = $free_shape(shape) - ;; 2-syntax-aux.watsup:504.1-504.70 - def $free_instr{shape : shape, `sx?` : sx?, laneidx : laneidx}(VEXTRACT_LANE_instr(shape, sx?{sx <- `sx?`}, laneidx)) = $free_shape(shape) - ;; 2-syntax-aux.watsup:505.1-505.66 - def $free_instr{shape : shape, laneidx : laneidx}(VREPLACE_LANE_instr(shape, laneidx)) = $free_shape(shape) - ;; 2-syntax-aux.watsup:507.1-507.62 - def $free_instr{heaptype : heaptype}(REF.NULL_instr(heaptype)) = $free_heaptype(heaptype) - ;; 2-syntax-aux.watsup:508.1-508.34 - def $free_instr(REF.IS_NULL_instr) = {TYPES [], FUNCS [], GLOBALS [], TABLES [], MEMS [], ELEMS [], DATAS [], LOCALS [], LABELS []} - ;; 2-syntax-aux.watsup:509.1-509.38 - def $free_instr(REF.AS_NON_NULL_instr) = {TYPES [], FUNCS [], GLOBALS [], TABLES [], MEMS [], ELEMS [], DATAS [], LOCALS [], LABELS []} - ;; 2-syntax-aux.watsup:510.1-510.29 - def $free_instr(REF.EQ_instr) = {TYPES [], FUNCS [], GLOBALS [], TABLES [], MEMS [], ELEMS [], DATAS [], LOCALS [], LABELS []} - ;; 2-syntax-aux.watsup:511.1-511.59 - def $free_instr{reftype : reftype}(REF.TEST_instr(reftype)) = $free_reftype(reftype) - ;; 2-syntax-aux.watsup:512.1-512.59 - def $free_instr{reftype : reftype}(REF.CAST_instr(reftype)) = $free_reftype(reftype) - ;; 2-syntax-aux.watsup:513.1-513.59 - def $free_instr{funcidx : funcidx}(REF.FUNC_instr(funcidx)) = $free_funcidx(funcidx) - ;; 2-syntax-aux.watsup:514.1-514.30 - def $free_instr(REF.I31_instr) = {TYPES [], FUNCS [], GLOBALS [], TABLES [], MEMS [], ELEMS [], DATAS [], LOCALS [], LABELS []} - ;; 2-syntax-aux.watsup:516.1-516.33 - def $free_instr{sx : sx}(I31.GET_instr(sx)) = {TYPES [], FUNCS [], GLOBALS [], TABLES [], MEMS [], ELEMS [], DATAS [], LOCALS [], LABELS []} - ;; 2-syntax-aux.watsup:518.1-518.41 - def $free_instr{typeidx : typeidx}(STRUCT.NEW_instr(typeidx)) = {TYPES [], FUNCS [], GLOBALS [], TABLES [], MEMS [], ELEMS [], DATAS [], LOCALS [], LABELS []} - ;; 2-syntax-aux.watsup:519.1-519.69 - def $free_instr{typeidx : typeidx}(STRUCT.NEW_DEFAULT_instr(typeidx)) = $free_typeidx(typeidx) - ;; 2-syntax-aux.watsup:520.1-520.69 - def $free_instr{`sx?` : sx?, typeidx : typeidx, u32 : u32}(STRUCT.GET_instr(sx?{sx <- `sx?`}, typeidx, u32)) = $free_typeidx(typeidx) - ;; 2-syntax-aux.watsup:521.1-521.65 - def $free_instr{typeidx : typeidx, u32 : u32}(STRUCT.SET_instr(typeidx, u32)) = $free_typeidx(typeidx) - ;; 2-syntax-aux.watsup:523.1-523.60 - def $free_instr{typeidx : typeidx}(ARRAY.NEW_instr(typeidx)) = $free_typeidx(typeidx) - ;; 2-syntax-aux.watsup:524.1-524.68 - def $free_instr{typeidx : typeidx}(ARRAY.NEW_DEFAULT_instr(typeidx)) = $free_typeidx(typeidx) - ;; 2-syntax-aux.watsup:525.1-525.70 - def $free_instr{typeidx : typeidx, u32 : u32}(ARRAY.NEW_FIXED_instr(typeidx, u32)) = $free_typeidx(typeidx) - ;; 2-syntax-aux.watsup:526.1-527.51 - def $free_instr{typeidx : typeidx, dataidx : dataidx}(ARRAY.NEW_DATA_instr(typeidx, dataidx)) = $free_typeidx(typeidx) +++ $free_dataidx(dataidx) - ;; 2-syntax-aux.watsup:528.1-529.51 - def $free_instr{typeidx : typeidx, elemidx : elemidx}(ARRAY.NEW_ELEM_instr(typeidx, elemidx)) = $free_typeidx(typeidx) +++ $free_elemidx(elemidx) - ;; 2-syntax-aux.watsup:530.1-530.64 - def $free_instr{`sx?` : sx?, typeidx : typeidx}(ARRAY.GET_instr(sx?{sx <- `sx?`}, typeidx)) = $free_typeidx(typeidx) - ;; 2-syntax-aux.watsup:531.1-531.60 - def $free_instr{typeidx : typeidx}(ARRAY.SET_instr(typeidx)) = $free_typeidx(typeidx) - ;; 2-syntax-aux.watsup:532.1-532.32 - def $free_instr(ARRAY.LEN_instr) = {TYPES [], FUNCS [], GLOBALS [], TABLES [], MEMS [], ELEMS [], DATAS [], LOCALS [], LABELS []} - ;; 2-syntax-aux.watsup:533.1-533.61 - def $free_instr{typeidx : typeidx}(ARRAY.FILL_instr(typeidx)) = $free_typeidx(typeidx) - ;; 2-syntax-aux.watsup:534.1-535.55 - def $free_instr{typeidx_1 : typeidx, typeidx_2 : typeidx}(ARRAY.COPY_instr(typeidx_1, typeidx_2)) = $free_typeidx(typeidx_1) +++ $free_typeidx(typeidx_2) - ;; 2-syntax-aux.watsup:536.1-537.51 - def $free_instr{typeidx : typeidx, dataidx : dataidx}(ARRAY.INIT_DATA_instr(typeidx, dataidx)) = $free_typeidx(typeidx) +++ $free_dataidx(dataidx) - ;; 2-syntax-aux.watsup:538.1-539.51 - def $free_instr{typeidx : typeidx, elemidx : elemidx}(ARRAY.INIT_ELEM_instr(typeidx, elemidx)) = $free_typeidx(typeidx) +++ $free_elemidx(elemidx) - ;; 2-syntax-aux.watsup:541.1-541.41 - def $free_instr(EXTERN.CONVERT_ANY_instr) = {TYPES [], FUNCS [], GLOBALS [], TABLES [], MEMS [], ELEMS [], DATAS [], LOCALS [], LABELS []} - ;; 2-syntax-aux.watsup:542.1-542.41 - def $free_instr(ANY.CONVERT_EXTERN_instr) = {TYPES [], FUNCS [], GLOBALS [], TABLES [], MEMS [], ELEMS [], DATAS [], LOCALS [], LABELS []} - ;; 2-syntax-aux.watsup:544.1-544.63 - def $free_instr{localidx : localidx}(LOCAL.GET_instr(localidx)) = $free_localidx(localidx) - ;; 2-syntax-aux.watsup:545.1-545.63 - def $free_instr{localidx : localidx}(LOCAL.SET_instr(localidx)) = $free_localidx(localidx) - ;; 2-syntax-aux.watsup:546.1-546.63 - def $free_instr{localidx : localidx}(LOCAL.TEE_instr(localidx)) = $free_localidx(localidx) - ;; 2-syntax-aux.watsup:548.1-548.67 - def $free_instr{globalidx : globalidx}(GLOBAL.GET_instr(globalidx)) = $free_globalidx(globalidx) - ;; 2-syntax-aux.watsup:549.1-549.67 - def $free_instr{globalidx : globalidx}(GLOBAL.SET_instr(globalidx)) = $free_globalidx(globalidx) - ;; 2-syntax-aux.watsup:551.1-551.63 - def $free_instr{tableidx : tableidx}(TABLE.GET_instr(tableidx)) = $free_tableidx(tableidx) - ;; 2-syntax-aux.watsup:552.1-552.63 - def $free_instr{tableidx : tableidx}(TABLE.SET_instr(tableidx)) = $free_tableidx(tableidx) - ;; 2-syntax-aux.watsup:553.1-553.64 - def $free_instr{tableidx : tableidx}(TABLE.SIZE_instr(tableidx)) = $free_tableidx(tableidx) - ;; 2-syntax-aux.watsup:554.1-554.64 - def $free_instr{tableidx : tableidx}(TABLE.GROW_instr(tableidx)) = $free_tableidx(tableidx) - ;; 2-syntax-aux.watsup:555.1-555.64 - def $free_instr{tableidx : tableidx}(TABLE.FILL_instr(tableidx)) = $free_tableidx(tableidx) - ;; 2-syntax-aux.watsup:556.1-557.59 - def $free_instr{tableidx_1 : tableidx, tableidx_2 : tableidx}(TABLE.COPY_instr(tableidx_1, tableidx_2)) = $free_tableidx(tableidx_1) +++ $free_tableidx(tableidx_2) - ;; 2-syntax-aux.watsup:558.1-559.53 - def $free_instr{tableidx : tableidx, elemidx : elemidx}(TABLE.INIT_instr(tableidx, elemidx)) = $free_tableidx(tableidx) +++ $free_elemidx(elemidx) - ;; 2-syntax-aux.watsup:560.1-560.60 - def $free_instr{elemidx : elemidx}(ELEM.DROP_instr(elemidx)) = $free_elemidx(elemidx) - ;; 2-syntax-aux.watsup:562.1-563.49 - def $free_instr{numtype : numtype, `loadop?` : loadop_(numtype)?, memidx : memidx, memarg : memarg}(LOAD_instr(numtype, loadop?{loadop <- `loadop?`}, memidx, memarg)) = $free_numtype(numtype) +++ $free_memidx(memidx) - ;; 2-syntax-aux.watsup:564.1-565.49 - def $free_instr{numtype : numtype, `storeop?` : storeop_(numtype)?, memidx : memidx, memarg : memarg}(STORE_instr(numtype, storeop?{storeop <- `storeop?`}, memidx, memarg)) = $free_numtype(numtype) +++ $free_memidx(memidx) - ;; 2-syntax-aux.watsup:566.1-567.49 - def $free_instr{vectype : vectype, `vloadop?` : vloadop_(vectype)?, memidx : memidx, memarg : memarg}(VLOAD_instr(vectype, vloadop?{vloadop <- `vloadop?`}, memidx, memarg)) = $free_vectype(vectype) +++ $free_memidx(memidx) - ;; 2-syntax-aux.watsup:568.1-569.49 - def $free_instr{vectype : vectype, sz : sz, memidx : memidx, memarg : memarg, laneidx : laneidx}(VLOAD_LANE_instr(vectype, sz, memidx, memarg, laneidx)) = $free_vectype(vectype) +++ $free_memidx(memidx) - ;; 2-syntax-aux.watsup:570.1-571.49 - def $free_instr{vectype : vectype, memidx : memidx, memarg : memarg}(VSTORE_instr(vectype, memidx, memarg)) = $free_vectype(vectype) +++ $free_memidx(memidx) - ;; 2-syntax-aux.watsup:572.1-573.49 - def $free_instr{vectype : vectype, sz : sz, memidx : memidx, memarg : memarg, laneidx : laneidx}(VSTORE_LANE_instr(vectype, sz, memidx, memarg, laneidx)) = $free_vectype(vectype) +++ $free_memidx(memidx) - ;; 2-syntax-aux.watsup:574.1-574.59 - def $free_instr{memidx : memidx}(MEMORY.SIZE_instr(memidx)) = $free_memidx(memidx) - ;; 2-syntax-aux.watsup:575.1-575.59 - def $free_instr{memidx : memidx}(MEMORY.GROW_instr(memidx)) = $free_memidx(memidx) - ;; 2-syntax-aux.watsup:576.1-576.59 - def $free_instr{memidx : memidx}(MEMORY.FILL_instr(memidx)) = $free_memidx(memidx) - ;; 2-syntax-aux.watsup:577.1-578.51 - def $free_instr{memidx_1 : memidx, memidx_2 : memidx}(MEMORY.COPY_instr(memidx_1, memidx_2)) = $free_memidx(memidx_1) +++ $free_memidx(memidx_2) - ;; 2-syntax-aux.watsup:579.1-580.49 - def $free_instr{memidx : memidx, dataidx : dataidx}(MEMORY.INIT_instr(memidx, dataidx)) = $free_memidx(memidx) +++ $free_dataidx(dataidx) - ;; 2-syntax-aux.watsup:581.1-581.60 - def $free_instr{dataidx : dataidx}(DATA.DROP_instr(dataidx)) = $free_dataidx(dataidx) - -;; 2-syntax-aux.watsup:432.1-432.31 -def $free_block(instr*) : free - ;; 2-syntax-aux.watsup:589.1-590.47 - def $free_block{`instr*` : instr*, free : free}(instr*{instr <- `instr*`}) = free[LABELS_free = $shift_labelidxs(free.LABELS_free)] - -- if (free = $free_list($free_instr(instr)*{instr <- `instr*`})) -} - -;; 2-syntax-aux.watsup -def $free_expr(expr : expr) : free - ;; 2-syntax-aux.watsup - def $free_expr{`instr*` : instr*}(instr*{instr <- `instr*`}) = $free_list($free_instr(instr)*{instr <- `instr*`}) - -;; 2-syntax-aux.watsup -def $free_type(type : type) : free - ;; 2-syntax-aux.watsup - def $free_type{rectype : rectype}(TYPE_type(rectype)) = $free_rectype(rectype) - -;; 2-syntax-aux.watsup -def $free_local(local : local) : free - ;; 2-syntax-aux.watsup - def $free_local{t : valtype}(LOCAL_local(t)) = $free_valtype(t) - -;; 2-syntax-aux.watsup -def $free_func(func : func) : free - ;; 2-syntax-aux.watsup - def $free_func{typeidx : typeidx, `local*` : local*, expr : expr}(FUNC_func(typeidx, local*{local <- `local*`}, expr)) = $free_typeidx(typeidx) +++ $free_list($free_local(local)*{local <- `local*`}) +++ $free_block(expr)[LOCALS_free = []] - -;; 2-syntax-aux.watsup -def $free_global(global : global) : free - ;; 2-syntax-aux.watsup - def $free_global{globaltype : globaltype, expr : expr}(GLOBAL_global(globaltype, expr)) = $free_globaltype(globaltype) +++ $free_expr(expr) - -;; 2-syntax-aux.watsup -def $free_table(table : table) : free - ;; 2-syntax-aux.watsup - def $free_table{tabletype : tabletype, expr : expr}(TABLE_table(tabletype, expr)) = $free_tabletype(tabletype) +++ $free_expr(expr) - -;; 2-syntax-aux.watsup -def $free_mem(mem : mem) : free - ;; 2-syntax-aux.watsup - def $free_mem{memtype : memtype}(MEMORY_mem(memtype)) = $free_memtype(memtype) - -;; 2-syntax-aux.watsup -def $free_tag(tag : tag) : free - ;; 2-syntax-aux.watsup - def $free_tag{typeidx : typeidx}(TAG_tag(typeidx)) = $free_typeidx(typeidx) - -;; 2-syntax-aux.watsup -def $free_elemmode(elemmode : elemmode) : free - ;; 2-syntax-aux.watsup - def $free_elemmode{tableidx : tableidx, expr : expr}(ACTIVE_elemmode(tableidx, expr)) = $free_tableidx(tableidx) +++ $free_expr(expr) - ;; 2-syntax-aux.watsup - def $free_elemmode(PASSIVE_elemmode) = {TYPES [], FUNCS [], GLOBALS [], TABLES [], MEMS [], ELEMS [], DATAS [], LOCALS [], LABELS []} - ;; 2-syntax-aux.watsup - def $free_elemmode(DECLARE_elemmode) = {TYPES [], FUNCS [], GLOBALS [], TABLES [], MEMS [], ELEMS [], DATAS [], LOCALS [], LABELS []} - -;; 2-syntax-aux.watsup -def $free_elem(elem : elem) : free - ;; 2-syntax-aux.watsup - def $free_elem{reftype : reftype, `expr*` : expr*, elemmode : elemmode}(ELEM_elem(reftype, expr*{expr <- `expr*`}, elemmode)) = $free_reftype(reftype) +++ $free_list($free_expr(expr)*{expr <- `expr*`}) +++ $free_elemmode(elemmode) - -;; 2-syntax-aux.watsup -def $free_datamode(datamode : datamode) : free - ;; 2-syntax-aux.watsup - def $free_datamode{memidx : memidx, expr : expr}(ACTIVE_datamode(memidx, expr)) = $free_memidx(memidx) +++ $free_expr(expr) - ;; 2-syntax-aux.watsup - def $free_datamode(PASSIVE_datamode) = {TYPES [], FUNCS [], GLOBALS [], TABLES [], MEMS [], ELEMS [], DATAS [], LOCALS [], LABELS []} - -;; 2-syntax-aux.watsup -def $free_data(data : data) : free - ;; 2-syntax-aux.watsup - def $free_data{`byte*` : byte*, datamode : datamode}(DATA_data(byte*{byte <- `byte*`}, datamode)) = $free_datamode(datamode) - -;; 2-syntax-aux.watsup -def $free_start(start : start) : free - ;; 2-syntax-aux.watsup - def $free_start{funcidx : funcidx}(START_start(funcidx)) = $free_funcidx(funcidx) - -;; 2-syntax-aux.watsup -def $free_export(export : export) : free - ;; 2-syntax-aux.watsup - def $free_export{name : name, externidx : externidx}(EXPORT_export(name, externidx)) = $free_externidx(externidx) - -;; 2-syntax-aux.watsup -def $free_import(import : import) : free - ;; 2-syntax-aux.watsup - def $free_import{name_1 : name, name_2 : name, externtype : externtype}(IMPORT_import(name_1, name_2, externtype)) = $free_externtype(externtype) - -;; 2-syntax-aux.watsup -def $free_module(module : module) : free - ;; 2-syntax-aux.watsup - def $free_module{`type*` : type*, `import*` : import*, `func*` : func*, `global*` : global*, `table*` : table*, `mem*` : mem*, `tag*` : tag*, `elem*` : elem*, `data*` : data*, `start?` : start?, `export*` : export*}(MODULE_module(type*{type <- `type*`}, import*{import <- `import*`}, func*{func <- `func*`}, global*{global <- `global*`}, table*{table <- `table*`}, mem*{mem <- `mem*`}, tag*{tag <- `tag*`}, elem*{elem <- `elem*`}, data*{data <- `data*`}, start?{start <- `start?`}, export*{export <- `export*`})) = $free_list($free_type(type)*{type <- `type*`}) +++ $free_list($free_import(import)*{import <- `import*`}) +++ $free_list($free_func(func)*{func <- `func*`}) +++ $free_list($free_global(global)*{global <- `global*`}) +++ $free_list($free_table(table)*{table <- `table*`}) +++ $free_list($free_mem(mem)*{mem <- `mem*`}) +++ $free_list($free_tag(tag)*{tag <- `tag*`}) +++ $free_list($free_elem(elem)*{elem <- `elem*`}) +++ $free_list($free_data(data)*{data <- `data*`}) +++ $free_opt($free_start(start)?{start <- `start?`}) +++ $free_list($free_export(export)*{export <- `export*`}) - -;; 2-syntax-aux.watsup -def $funcidx_module(module : module) : funcidx* - ;; 2-syntax-aux.watsup - def $funcidx_module{module : module}(module) = $free_module(module).FUNCS_free - -;; 2-syntax-aux.watsup -def $dataidx_funcs(func*) : dataidx* - ;; 2-syntax-aux.watsup - def $dataidx_funcs{`func*` : func*}(func*{func <- `func*`}) = $free_list($free_func(func)*{func <- `func*`}).DATAS_free - -;; 3-typing.watsup -syntax init = - | SET - | UNSET - -;; 3-typing.watsup -syntax localtype = - | `%%`{init : init, valtype : valtype}(init : init, valtype : valtype) - -;; 3-typing.watsup -syntax instrtype = - | `%->_%%`{resulttype : resulttype, `localidx*` : localidx*}(resulttype : resulttype, localidx*{localidx <- `localidx*`} : localidx*, resulttype) - -;; 3-typing.watsup -syntax context = -{ - TYPES{`deftype*` : deftype*} deftype*, - RECS{`subtype*` : subtype*} subtype*, - FUNCS{`deftype*` : deftype*} deftype*, - GLOBALS{`globaltype*` : globaltype*} globaltype*, - TABLES{`tabletype*` : tabletype*} tabletype*, - MEMS{`memtype*` : memtype*} memtype*, - TAGS{`tagtype*` : tagtype*} tagtype*, - ELEMS{`elemtype*` : elemtype*} elemtype*, - DATAS{`datatype*` : datatype*} datatype*, - LOCALS{`localtype*` : localtype*} localtype*, - LABELS{`resulttype*` : resulttype*} resulttype*, - RETURN{`resulttype?` : resulttype?} resulttype?, - REFS{`funcidx*` : funcidx*} funcidx* -} - -;; 3-typing.watsup -rec { - -;; 3-typing.watsup:44.1-44.86 -def $with_locals(context : context, localidx*, localtype*) : context - ;; 3-typing.watsup:46.1-46.34 - def $with_locals{C : context}(C, [], []) = C - ;; 3-typing.watsup:47.1-47.90 - def $with_locals{C : context, x_1 : idx, `x*` : idx*, lct_1 : localtype, `lct*` : localtype*}(C, [x_1] ++ x*{x <- `x*`}, [lct_1] ++ lct*{lct <- `lct*`}) = $with_locals(C[LOCALS_context[x_1!`%`_idx.0] = lct_1], x*{x <- `x*`}, lct*{lct <- `lct*`}) -} - -;; 3-typing.watsup -rec { - -;; 3-typing.watsup:55.1-55.94 -def $clos_deftypes(deftype*) : deftype* - ;; 3-typing.watsup:62.1-62.30 - def $clos_deftypes([]) = [] - ;; 3-typing.watsup:63.1-63.101 - def $clos_deftypes{`dt*` : deftype*, dt_n : deftype, `dt'*` : deftype*}(dt*{dt <- `dt*`} ++ [dt_n]) = dt'*{dt' <- `dt'*`} ++ [$subst_all_deftype(dt_n, (dt' : deftype <: heaptype)*{dt' <- `dt'*`})] - -- if (dt'*{dt' <- `dt'*`} = $clos_deftypes(dt*{dt <- `dt*`})) -} - -;; 3-typing.watsup -def $clos_valtype(context : context, valtype : valtype) : valtype - ;; 3-typing.watsup - def $clos_valtype{C : context, t : valtype, `dt*` : deftype*}(C, t) = $subst_all_valtype(t, (dt : deftype <: heaptype)*{dt <- `dt*`}) - -- if (dt*{dt <- `dt*`} = $clos_deftypes(C.TYPES_context)) - -;; 3-typing.watsup -def $clos_deftype(context : context, deftype : deftype) : deftype - ;; 3-typing.watsup - def $clos_deftype{C : context, dt : deftype, `dt'*` : deftype*}(C, dt) = $subst_all_deftype(dt, (dt' : deftype <: heaptype)*{dt' <- `dt'*`}) - -- if (dt'*{dt' <- `dt'*`} = $clos_deftypes(C.TYPES_context)) - -;; 3-typing.watsup -def $clos_moduletype(context : context, moduletype : moduletype) : moduletype - ;; 3-typing.watsup - def $clos_moduletype{C : context, mmt : moduletype, `dt*` : deftype*}(C, mmt) = $subst_all_moduletype(mmt, (dt : deftype <: heaptype)*{dt <- `dt*`}) - -- if (dt*{dt <- `dt*`} = $clos_deftypes(C.TYPES_context)) - -;; 3-typing.watsup -relation Numtype_ok: `%|-%:OK`(context, numtype) - ;; 3-typing.watsup - rule _{C : context, numtype : numtype}: - `%|-%:OK`(C, numtype) - -;; 3-typing.watsup -relation Vectype_ok: `%|-%:OK`(context, vectype) - ;; 3-typing.watsup - rule _{C : context, vectype : vectype}: - `%|-%:OK`(C, vectype) - -;; 3-typing.watsup -relation Heaptype_ok: `%|-%:OK`(context, heaptype) - ;; 3-typing.watsup - rule abs{C : context, absheaptype : absheaptype}: - `%|-%:OK`(C, (absheaptype : absheaptype <: heaptype)) - - ;; 3-typing.watsup - rule typeidx{C : context, typeidx : typeidx, dt : deftype}: - `%|-%:OK`(C, _IDX_heaptype(typeidx)) - -- if (C.TYPES_context[typeidx!`%`_typeidx.0] = dt) - - ;; 3-typing.watsup - rule rec{C : context, i : n, st : subtype}: - `%|-%:OK`(C, REC_heaptype(i)) - -- if (C.RECS_context[i] = st) - -;; 3-typing.watsup -relation Reftype_ok: `%|-%:OK`(context, reftype) - ;; 3-typing.watsup - rule _{C : context, heaptype : heaptype}: - `%|-%:OK`(C, REF_reftype(`NULL%?`_nul(()?{}), heaptype)) - -- Heaptype_ok: `%|-%:OK`(C, heaptype) - -;; 3-typing.watsup -relation Valtype_ok: `%|-%:OK`(context, valtype) - ;; 3-typing.watsup - rule num{C : context, numtype : numtype}: - `%|-%:OK`(C, (numtype : numtype <: valtype)) - -- Numtype_ok: `%|-%:OK`(C, numtype) - - ;; 3-typing.watsup - rule vec{C : context, vectype : vectype}: - `%|-%:OK`(C, (vectype : vectype <: valtype)) - -- Vectype_ok: `%|-%:OK`(C, vectype) - - ;; 3-typing.watsup - rule ref{C : context, reftype : reftype}: - `%|-%:OK`(C, (reftype : reftype <: valtype)) - -- Reftype_ok: `%|-%:OK`(C, reftype) - - ;; 3-typing.watsup - rule bot{C : context}: - `%|-%:OK`(C, BOT_valtype) - -;; 3-typing.watsup -relation Resulttype_ok: `%|-%:OK`(context, resulttype) - ;; 3-typing.watsup - rule _{C : context, `t*` : valtype*}: - `%|-%:OK`(C, `%`_resulttype(t*{t <- `t*`})) - -- (Valtype_ok: `%|-%:OK`(C, t))*{t <- `t*`} - -;; 3-typing.watsup -relation Instrtype_ok: `%|-%:OK`(context, instrtype) - ;; 3-typing.watsup - rule _{C : context, `t_1*` : valtype*, `x*` : idx*, `t_2*` : valtype*, `lct*` : localtype*}: - `%|-%:OK`(C, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), x*{x <- `x*`}, `%`_resulttype(t_2*{t_2 <- `t_2*`}))) - -- Resulttype_ok: `%|-%:OK`(C, `%`_resulttype(t_1*{t_1 <- `t_1*`})) - -- Resulttype_ok: `%|-%:OK`(C, `%`_resulttype(t_2*{t_2 <- `t_2*`})) - -- (if (C.LOCALS_context[x!`%`_idx.0] = lct))*{lct <- `lct*`, x <- `x*`} - -;; 3-typing.watsup -syntax oktypeidx = - | OK{typeidx : typeidx}(typeidx : typeidx) - -;; 3-typing.watsup -syntax oktypeidxnat = - | OK{typeidx : typeidx, nat : nat}(typeidx : typeidx, nat : nat) - -;; 3-typing.watsup -relation Packtype_ok: `%|-%:OK`(context, packtype) - ;; 3-typing.watsup - rule _{C : context, packtype : packtype}: - `%|-%:OK`(C, packtype) - -;; 3-typing.watsup -relation Storagetype_ok: `%|-%:OK`(context, storagetype) - ;; 3-typing.watsup - rule val{C : context, valtype : valtype}: - `%|-%:OK`(C, (valtype : valtype <: storagetype)) - -- Valtype_ok: `%|-%:OK`(C, valtype) - - ;; 3-typing.watsup - rule pack{C : context, packtype : packtype}: - `%|-%:OK`(C, (packtype : packtype <: storagetype)) - -- Packtype_ok: `%|-%:OK`(C, packtype) - -;; 3-typing.watsup -relation Fieldtype_ok: `%|-%:OK`(context, fieldtype) - ;; 3-typing.watsup - rule _{C : context, storagetype : storagetype}: - `%|-%:OK`(C, `%%`_fieldtype(`MUT%?`_mut(()?{}), storagetype)) - -- Storagetype_ok: `%|-%:OK`(C, storagetype) - -;; 3-typing.watsup -relation Functype_ok: `%|-%:OK`(context, functype) - ;; 3-typing.watsup - rule _{C : context, `t_1*` : valtype*, `t_2*` : valtype*}: - `%|-%:OK`(C, `%->%`_functype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`}))) - -- Resulttype_ok: `%|-%:OK`(C, `%`_resulttype(t_1*{t_1 <- `t_1*`})) - -- Resulttype_ok: `%|-%:OK`(C, `%`_resulttype(t_2*{t_2 <- `t_2*`})) - -;; 3-typing.watsup -relation Comptype_ok: `%|-%:OK`(context, comptype) - ;; 3-typing.watsup - rule struct{C : context, `fieldtype*` : fieldtype*}: - `%|-%:OK`(C, STRUCT_comptype(`%`_structtype(fieldtype*{fieldtype <- `fieldtype*`}))) - -- (Fieldtype_ok: `%|-%:OK`(C, fieldtype))*{fieldtype <- `fieldtype*`} - - ;; 3-typing.watsup - rule array{C : context, fieldtype : fieldtype}: - `%|-%:OK`(C, ARRAY_comptype(fieldtype)) - -- Fieldtype_ok: `%|-%:OK`(C, fieldtype) - - ;; 3-typing.watsup - rule func{C : context, functype : functype}: - `%|-%:OK`(C, FUNC_comptype(functype)) - -- Functype_ok: `%|-%:OK`(C, functype) - -;; 3-typing.watsup -relation Packtype_sub: `%|-%<:%`(context, packtype, packtype) - ;; 3-typing.watsup - rule _{C : context, packtype : packtype}: - `%|-%<:%`(C, packtype, packtype) - -;; 3-typing.watsup -relation Numtype_sub: `%|-%<:%`(context, numtype, numtype) - ;; 3-typing.watsup - rule _{C : context, numtype : numtype}: - `%|-%<:%`(C, numtype, numtype) - -;; 3-typing.watsup -rec { - -;; 3-typing.watsup:150.1-150.107 -relation Deftype_sub: `%|-%<:%`(context, deftype, deftype) - ;; 3-typing.watsup:474.1-476.66 - rule refl{C : context, deftype_1 : deftype, deftype_2 : deftype}: - `%|-%<:%`(C, deftype_1, deftype_2) - -- if ($clos_deftype(C, deftype_1) = $clos_deftype(C, deftype_2)) - - ;; 3-typing.watsup:478.1-481.49 - rule super{C : context, deftype_1 : deftype, deftype_2 : deftype, fin : fin, `typeuse*` : typeuse*, ct : comptype, i : nat}: - `%|-%<:%`(C, deftype_1, deftype_2) - -- if ($unrolldt(deftype_1) = SUB_subtype(fin, typeuse*{typeuse <- `typeuse*`}, ct)) - -- Heaptype_sub: `%|-%<:%`(C, (typeuse*{typeuse <- `typeuse*`}[i] : typeuse <: heaptype), (deftype_2 : deftype <: heaptype)) - -;; 3-typing.watsup:308.1-308.104 -relation Heaptype_sub: `%|-%<:%`(context, heaptype, heaptype) - ;; 3-typing.watsup:319.1-320.28 - rule refl{C : context, heaptype : heaptype}: - `%|-%<:%`(C, heaptype, heaptype) - - ;; 3-typing.watsup:322.1-326.48 - rule trans{C : context, heaptype_1 : heaptype, heaptype_2 : heaptype, heaptype' : heaptype}: - `%|-%<:%`(C, heaptype_1, heaptype_2) - -- Heaptype_ok: `%|-%:OK`(C, heaptype') - -- Heaptype_sub: `%|-%<:%`(C, heaptype_1, heaptype') - -- Heaptype_sub: `%|-%<:%`(C, heaptype', heaptype_2) - - ;; 3-typing.watsup:328.1-329.17 - rule `eq-any`{C : context}: - `%|-%<:%`(C, EQ_heaptype, ANY_heaptype) - - ;; 3-typing.watsup:331.1-332.17 - rule `i31-eq`{C : context}: - `%|-%<:%`(C, I31_heaptype, EQ_heaptype) - - ;; 3-typing.watsup:334.1-335.20 - rule `struct-eq`{C : context}: - `%|-%<:%`(C, STRUCT_heaptype, EQ_heaptype) - - ;; 3-typing.watsup:337.1-338.19 - rule `array-eq`{C : context}: - `%|-%<:%`(C, ARRAY_heaptype, EQ_heaptype) - - ;; 3-typing.watsup:340.1-342.42 - rule struct{C : context, deftype : deftype, `fieldtype*` : fieldtype*}: - `%|-%<:%`(C, (deftype : deftype <: heaptype), STRUCT_heaptype) - -- Expand: `%~~%`(deftype, STRUCT_comptype(`%`_structtype(fieldtype*{fieldtype <- `fieldtype*`}))) - - ;; 3-typing.watsup:344.1-346.40 - rule array{C : context, deftype : deftype, fieldtype : fieldtype}: - `%|-%<:%`(C, (deftype : deftype <: heaptype), ARRAY_heaptype) - -- Expand: `%~~%`(deftype, ARRAY_comptype(fieldtype)) - - ;; 3-typing.watsup:348.1-350.38 - rule func{C : context, deftype : deftype, functype : functype}: - `%|-%<:%`(C, (deftype : deftype <: heaptype), FUNC_heaptype) - -- Expand: `%~~%`(deftype, FUNC_comptype(functype)) - - ;; 3-typing.watsup:352.1-354.46 - rule def{C : context, deftype_1 : deftype, deftype_2 : deftype}: - `%|-%<:%`(C, (deftype_1 : deftype <: heaptype), (deftype_2 : deftype <: heaptype)) - -- Deftype_sub: `%|-%<:%`(C, deftype_1, deftype_2) - - ;; 3-typing.watsup:356.1-358.53 - rule `typeidx-l`{C : context, typeidx : typeidx, heaptype : heaptype}: - `%|-%<:%`(C, _IDX_heaptype(typeidx), heaptype) - -- Heaptype_sub: `%|-%<:%`(C, (C.TYPES_context[typeidx!`%`_typeidx.0] : deftype <: heaptype), heaptype) - - ;; 3-typing.watsup:360.1-362.53 - rule `typeidx-r`{C : context, heaptype : heaptype, typeidx : typeidx}: - `%|-%<:%`(C, heaptype, _IDX_heaptype(typeidx)) - -- Heaptype_sub: `%|-%<:%`(C, heaptype, (C.TYPES_context[typeidx!`%`_typeidx.0] : deftype <: heaptype)) - - ;; 3-typing.watsup:364.1-366.40 - rule rec{C : context, i : n, `typeuse*` : typeuse*, j : nat, fin : fin, ct : comptype}: - `%|-%<:%`(C, REC_heaptype(i), (typeuse*{typeuse <- `typeuse*`}[j] : typeuse <: heaptype)) - -- if (C.RECS_context[i] = SUB_subtype(fin, typeuse*{typeuse <- `typeuse*`}, ct)) - - ;; 3-typing.watsup:368.1-370.40 - rule none{C : context, heaptype : heaptype}: - `%|-%<:%`(C, NONE_heaptype, heaptype) - -- Heaptype_sub: `%|-%<:%`(C, heaptype, ANY_heaptype) - - ;; 3-typing.watsup:372.1-374.41 - rule nofunc{C : context, heaptype : heaptype}: - `%|-%<:%`(C, NOFUNC_heaptype, heaptype) - -- Heaptype_sub: `%|-%<:%`(C, heaptype, FUNC_heaptype) - - ;; 3-typing.watsup:376.1-378.43 - rule noextern{C : context, heaptype : heaptype}: - `%|-%<:%`(C, NOEXTERN_heaptype, heaptype) - -- Heaptype_sub: `%|-%<:%`(C, heaptype, EXTERN_heaptype) - - ;; 3-typing.watsup:380.1-381.23 - rule bot{C : context, heaptype : heaptype}: - `%|-%<:%`(C, BOT_heaptype, heaptype) -} - -;; 3-typing.watsup -relation Reftype_sub: `%|-%<:%`(context, reftype, reftype) - ;; 3-typing.watsup - rule nonnull{C : context, ht_1 : heaptype, ht_2 : heaptype}: - `%|-%<:%`(C, REF_reftype(`NULL%?`_nul(?()), ht_1), REF_reftype(`NULL%?`_nul(?()), ht_2)) - -- Heaptype_sub: `%|-%<:%`(C, ht_1, ht_2) - - ;; 3-typing.watsup - rule null{C : context, ht_1 : heaptype, ht_2 : heaptype}: - `%|-%<:%`(C, REF_reftype(`NULL%?`_nul(()?{}), ht_1), REF_reftype(`NULL%?`_nul(?(())), ht_2)) - -- Heaptype_sub: `%|-%<:%`(C, ht_1, ht_2) - -;; 3-typing.watsup -relation Vectype_sub: `%|-%<:%`(context, vectype, vectype) - ;; 3-typing.watsup - rule _{C : context, vectype : vectype}: - `%|-%<:%`(C, vectype, vectype) - -;; 3-typing.watsup -relation Valtype_sub: `%|-%<:%`(context, valtype, valtype) - ;; 3-typing.watsup - rule num{C : context, numtype_1 : numtype, numtype_2 : numtype}: - `%|-%<:%`(C, (numtype_1 : numtype <: valtype), (numtype_2 : numtype <: valtype)) - -- Numtype_sub: `%|-%<:%`(C, numtype_1, numtype_2) - - ;; 3-typing.watsup - rule vec{C : context, vectype_1 : vectype, vectype_2 : vectype}: - `%|-%<:%`(C, (vectype_1 : vectype <: valtype), (vectype_2 : vectype <: valtype)) - -- Vectype_sub: `%|-%<:%`(C, vectype_1, vectype_2) - - ;; 3-typing.watsup - rule ref{C : context, reftype_1 : reftype, reftype_2 : reftype}: - `%|-%<:%`(C, (reftype_1 : reftype <: valtype), (reftype_2 : reftype <: valtype)) - -- Reftype_sub: `%|-%<:%`(C, reftype_1, reftype_2) - - ;; 3-typing.watsup - rule bot{C : context, valtype : valtype}: - `%|-%<:%`(C, BOT_valtype, valtype) - -;; 3-typing.watsup -relation Storagetype_sub: `%|-%<:%`(context, storagetype, storagetype) - ;; 3-typing.watsup - rule val{C : context, valtype_1 : valtype, valtype_2 : valtype}: - `%|-%<:%`(C, (valtype_1 : valtype <: storagetype), (valtype_2 : valtype <: storagetype)) - -- Valtype_sub: `%|-%<:%`(C, valtype_1, valtype_2) - - ;; 3-typing.watsup - rule pack{C : context, packtype_1 : packtype, packtype_2 : packtype}: - `%|-%<:%`(C, (packtype_1 : packtype <: storagetype), (packtype_2 : packtype <: storagetype)) - -- Packtype_sub: `%|-%<:%`(C, packtype_1, packtype_2) - -;; 3-typing.watsup -relation Fieldtype_sub: `%|-%<:%`(context, fieldtype, fieldtype) - ;; 3-typing.watsup - rule const{C : context, zt_1 : storagetype, zt_2 : storagetype}: - `%|-%<:%`(C, `%%`_fieldtype(`MUT%?`_mut(?()), zt_1), `%%`_fieldtype(`MUT%?`_mut(?()), zt_2)) - -- Storagetype_sub: `%|-%<:%`(C, zt_1, zt_2) - - ;; 3-typing.watsup - rule var{C : context, zt_1 : storagetype, zt_2 : storagetype}: - `%|-%<:%`(C, `%%`_fieldtype(`MUT%?`_mut(?(())), zt_1), `%%`_fieldtype(`MUT%?`_mut(?(())), zt_2)) - -- Storagetype_sub: `%|-%<:%`(C, zt_1, zt_2) - -- Storagetype_sub: `%|-%<:%`(C, zt_2, zt_1) - -;; 3-typing.watsup -relation Resulttype_sub: `%|-%<:%`(context, valtype*, valtype*) - ;; 3-typing.watsup - rule _{C : context, `t_1*` : valtype*, `t_2*` : valtype*}: - `%|-%<:%`(C, t_1*{t_1 <- `t_1*`}, t_2*{t_2 <- `t_2*`}) - -- (Valtype_sub: `%|-%<:%`(C, t_1, t_2))*{t_1 <- `t_1*`, t_2 <- `t_2*`} - -;; 3-typing.watsup -relation Functype_sub: `%|-%<:%`(context, functype, functype) - ;; 3-typing.watsup - rule _{C : context, `t_11*` : valtype*, `t_12*` : valtype*, `t_21*` : valtype*, `t_22*` : valtype*}: - `%|-%<:%`(C, `%->%`_functype(`%`_resulttype(t_11*{t_11 <- `t_11*`}), `%`_resulttype(t_12*{t_12 <- `t_12*`})), `%->%`_functype(`%`_resulttype(t_21*{t_21 <- `t_21*`}), `%`_resulttype(t_22*{t_22 <- `t_22*`}))) - -- Resulttype_sub: `%|-%<:%`(C, t_21*{t_21 <- `t_21*`}, t_11*{t_11 <- `t_11*`}) - -- Resulttype_sub: `%|-%<:%`(C, t_12*{t_12 <- `t_12*`}, t_22*{t_22 <- `t_22*`}) - -;; 3-typing.watsup -relation Comptype_sub: `%|-%<:%`(context, comptype, comptype) - ;; 3-typing.watsup - rule struct{C : context, `yt_1*` : fieldtype*, yt'_1 : fieldtype, `yt_2*` : fieldtype*}: - `%|-%<:%`(C, STRUCT_comptype(`%`_structtype(yt_1*{yt_1 <- `yt_1*`} ++ [yt'_1])), STRUCT_comptype(`%`_structtype(yt_2*{yt_2 <- `yt_2*`}))) - -- (Fieldtype_sub: `%|-%<:%`(C, yt_1, yt_2))*{yt_1 <- `yt_1*`, yt_2 <- `yt_2*`} - - ;; 3-typing.watsup - rule array{C : context, yt_1 : fieldtype, yt_2 : fieldtype}: - `%|-%<:%`(C, ARRAY_comptype(yt_1), ARRAY_comptype(yt_2)) - -- Fieldtype_sub: `%|-%<:%`(C, yt_1, yt_2) - - ;; 3-typing.watsup - rule func{C : context, ft_1 : functype, ft_2 : functype}: - `%|-%<:%`(C, FUNC_comptype(ft_1), FUNC_comptype(ft_2)) - -- Functype_sub: `%|-%<:%`(C, ft_1, ft_2) - -;; 3-typing.watsup -relation Subtype_ok: `%|-%:%`(context, subtype, oktypeidx) - ;; 3-typing.watsup - rule _{C : context, `x*` : idx*, comptype : comptype, x_0 : idx, `x'**` : idx**, `comptype'*` : comptype*}: - `%|-%:%`(C, SUB_subtype(`FINAL%?`_fin(()?{}), _IDX_typeuse(x)*{x <- `x*`}, comptype), OK_oktypeidx(x_0)) - -- if (|x*{x <- `x*`}| <= 1) - -- (if (x!`%`_idx.0 < x_0!`%`_idx.0))*{x <- `x*`} - -- (if ($unrolldt(C.TYPES_context[x!`%`_idx.0]) = SUB_subtype(`FINAL%?`_fin(?()), _IDX_typeuse(x')*{x' <- `x'*`}, comptype')))*{comptype' <- `comptype'*`, x <- `x*`, `x'*` <- `x'**`} - -- Comptype_ok: `%|-%:OK`(C, comptype) - -- (Comptype_sub: `%|-%<:%`(C, comptype, comptype'))*{comptype' <- `comptype'*`} - -;; 3-typing.watsup -def $before(typeuse : typeuse, typeidx : typeidx, nat : nat) : bool - ;; 3-typing.watsup - def $before{deftype : deftype, x : idx, i : nat}((deftype : deftype <: typeuse), x, i) = true - ;; 3-typing.watsup - def $before{typeidx : typeidx, x : idx, i : nat}(_IDX_typeuse(typeidx), x, i) = (typeidx!`%`_typeidx.0 < x!`%`_idx.0) - ;; 3-typing.watsup - def $before{j : n, x : idx, i : nat}(REC_typeuse(j), x, i) = (j < i) - -;; 3-typing.watsup -def $unrollht(context : context, heaptype : heaptype) : subtype - ;; 3-typing.watsup - def $unrollht{C : context, deftype : deftype}(C, (deftype : deftype <: heaptype)) = $unrolldt(deftype) - ;; 3-typing.watsup - def $unrollht{C : context, typeidx : typeidx}(C, _IDX_heaptype(typeidx)) = $unrolldt(C.TYPES_context[typeidx!`%`_typeidx.0]) - ;; 3-typing.watsup - def $unrollht{C : context, i : n}(C, REC_heaptype(i)) = C.RECS_context[i] - -;; 3-typing.watsup -relation Subtype_ok2: `%|-%:%`(context, subtype, oktypeidxnat) - ;; 3-typing.watsup - rule _{C : context, `typeuse*` : typeuse*, compttype : comptype, x : idx, i : nat, `typeuse'**` : typeuse**, `comptype'*` : comptype*, comptype : comptype}: - `%|-%:%`(C, SUB_subtype(`FINAL%?`_fin(()?{}), typeuse*{typeuse <- `typeuse*`}, compttype), OK_oktypeidxnat(x, i)) - -- if (|typeuse*{typeuse <- `typeuse*`}| <= 1) - -- (if $before(typeuse, x, i))*{typeuse <- `typeuse*`} - -- (if ($unrollht(C, (typeuse : typeuse <: heaptype)) = SUB_subtype(`FINAL%?`_fin(?()), typeuse'*{typeuse' <- `typeuse'*`}, comptype')))*{comptype' <- `comptype'*`, typeuse <- `typeuse*`, `typeuse'*` <- `typeuse'**`} - -- Comptype_ok: `%|-%:OK`(C, comptype) - -- (Comptype_sub: `%|-%<:%`(C, comptype, comptype'))*{comptype' <- `comptype'*`} - -;; 3-typing.watsup -rec { - -;; 3-typing.watsup:145.1-145.105 -relation Rectype_ok2: `%|-%:%`(context, rectype, oktypeidxnat) - ;; 3-typing.watsup:223.1-224.24 - rule empty{C : context, x : idx, i : nat}: - `%|-%:%`(C, REC_rectype(`%`_list([])), OK_oktypeidxnat(x, i)) - - ;; 3-typing.watsup:226.1-229.55 - rule cons{C : context, subtype_1 : subtype, `subtype*` : subtype*, x : idx, i : nat}: - `%|-%:%`(C, REC_rectype(`%`_list([subtype_1] ++ subtype*{subtype <- `subtype*`})), OK_oktypeidxnat(x, i)) - -- Subtype_ok2: `%|-%:%`(C, subtype_1, OK_oktypeidxnat(x, i)) - -- Rectype_ok2: `%|-%:%`(C, REC_rectype(`%`_list(subtype*{subtype <- `subtype*`})), OK_oktypeidxnat(`%`_typeidx((x!`%`_idx.0 + 1)), (i + 1))) -} - -;; 3-typing.watsup -rec { - -;; 3-typing.watsup:143.1-143.102 -relation Rectype_ok: `%|-%:%`(context, rectype, oktypeidx) - ;; 3-typing.watsup:211.1-212.23 - rule empty{C : context, x : idx}: - `%|-%:%`(C, REC_rectype(`%`_list([])), OK_oktypeidx(x)) - - ;; 3-typing.watsup:214.1-217.48 - rule cons{C : context, subtype_1 : subtype, `subtype*` : subtype*, x : idx}: - `%|-%:%`(C, REC_rectype(`%`_list([subtype_1] ++ subtype*{subtype <- `subtype*`})), OK_oktypeidx(x)) - -- Subtype_ok: `%|-%:%`(C, subtype_1, OK_oktypeidx(x)) - -- Rectype_ok: `%|-%:%`(C, REC_rectype(`%`_list(subtype*{subtype <- `subtype*`})), OK_oktypeidx(`%`_typeidx((x!`%`_idx.0 + 1)))) - - ;; 3-typing.watsup:219.1-221.60 - rule rec2{C : context, `subtype*` : subtype*, x : idx}: - `%|-%:%`(C, REC_rectype(`%`_list(subtype*{subtype <- `subtype*`})), OK_oktypeidx(x)) - -- Rectype_ok2: `%|-%:%`({TYPES [], RECS subtype*{subtype <- `subtype*`}, FUNCS [], GLOBALS [], TABLES [], MEMS [], TAGS [], ELEMS [], DATAS [], LOCALS [], LABELS [], RETURN ?(), REFS []} +++ C, REC_rectype(`%`_list(subtype*{subtype <- `subtype*`})), OK_oktypeidxnat(x, 0)) -} - -;; 3-typing.watsup -relation Deftype_ok: `%|-%:OK`(context, deftype) - ;; 3-typing.watsup - rule _{C : context, rectype : rectype, i : n, x : idx, `subtype*` : subtype*, n : n}: - `%|-%:OK`(C, DEF_deftype(rectype, i)) - -- Rectype_ok: `%|-%:%`(C, rectype, OK_oktypeidx(x)) - -- if (rectype = REC_rectype(`%`_list(subtype^n{subtype <- `subtype*`}))) - -- if (i < n) - -;; 3-typing.watsup -relation Limits_ok: `%|-%:%`(context, limits, nat) - ;; 3-typing.watsup - rule _{C : context, n : n, m : m, k : nat}: - `%|-%:%`(C, `[%..%]`_limits(`%`_u64(n), `%`_u64(m)), k) - -- if ((n <= m) /\ (m <= k)) - -;; 3-typing.watsup -relation Globaltype_ok: `%|-%:OK`(context, globaltype) - ;; 3-typing.watsup - rule _{C : context, t : valtype}: - `%|-%:OK`(C, `%%`_globaltype(`MUT%?`_mut(()?{}), t)) - -- Valtype_ok: `%|-%:OK`(C, t) - -;; 3-typing.watsup -relation Tabletype_ok: `%|-%:OK`(context, tabletype) - ;; 3-typing.watsup - rule _{C : context, addrtype : addrtype, limits : limits, reftype : reftype}: - `%|-%:OK`(C, `%%%`_tabletype(addrtype, limits, reftype)) - -- Limits_ok: `%|-%:%`(C, limits, ((((2 ^ 32) : nat <:> int) - (1 : nat <:> int)) : int <:> nat)) - -- Reftype_ok: `%|-%:OK`(C, reftype) - -;; 3-typing.watsup -relation Memtype_ok: `%|-%:OK`(context, memtype) - ;; 3-typing.watsup - rule _{C : context, addrtype : addrtype, limits : limits}: - `%|-%:OK`(C, `%%PAGE`_memtype(addrtype, limits)) - -- Limits_ok: `%|-%:%`(C, limits, (2 ^ 16)) - -;; 3-typing.watsup -relation Tagtype_ok: `%|-%:OK`(context, tagtype) - ;; 3-typing.watsup - rule _{C : context, deftype : deftype, functype : functype}: - `%|-%:OK`(C, deftype) - -- Deftype_ok: `%|-%:OK`(C, deftype) - -- Expand: `%~~%`(deftype, FUNC_comptype(functype)) - -;; 3-typing.watsup -relation Externtype_ok: `%|-%:OK`(context, externtype) - ;; 3-typing.watsup - rule func{C : context, deftype : deftype, functype : functype}: - `%|-%:OK`(C, FUNC_externtype((deftype : deftype <: typeuse))) - -- Deftype_ok: `%|-%:OK`(C, deftype) - -- Expand: `%~~%`(deftype, FUNC_comptype(functype)) - - ;; 3-typing.watsup - rule global{C : context, globaltype : globaltype}: - `%|-%:OK`(C, GLOBAL_externtype(globaltype)) - -- Globaltype_ok: `%|-%:OK`(C, globaltype) - - ;; 3-typing.watsup - rule table{C : context, tabletype : tabletype}: - `%|-%:OK`(C, TABLE_externtype(tabletype)) - -- Tabletype_ok: `%|-%:OK`(C, tabletype) - - ;; 3-typing.watsup - rule mem{C : context, memtype : memtype}: - `%|-%:OK`(C, MEM_externtype(memtype)) - -- Memtype_ok: `%|-%:OK`(C, memtype) - - ;; 3-typing.watsup - rule tag{C : context, tagtype : tagtype}: - `%|-%:OK`(C, TAG_externtype((tagtype : deftype <: typeuse))) - -- Tagtype_ok: `%|-%:OK`(C, tagtype) - -;; 3-typing.watsup -relation Instrtype_sub: `%|-%<:%`(context, instrtype, instrtype) - ;; 3-typing.watsup - rule _{C : context, `t_11*` : valtype*, `x_1*` : idx*, `t_12*` : valtype*, `t_21*` : valtype*, `x_2*` : idx*, `t_22*` : valtype*, `x*` : idx*, `t*` : valtype*}: - `%|-%<:%`(C, `%->_%%`_instrtype(`%`_resulttype(t_11*{t_11 <- `t_11*`}), x_1*{x_1 <- `x_1*`}, `%`_resulttype(t_12*{t_12 <- `t_12*`})), `%->_%%`_instrtype(`%`_resulttype(t_21*{t_21 <- `t_21*`}), x_2*{x_2 <- `x_2*`}, `%`_resulttype(t_22*{t_22 <- `t_22*`}))) - -- Resulttype_sub: `%|-%<:%`(C, t_21*{t_21 <- `t_21*`}, t_11*{t_11 <- `t_11*`}) - -- Resulttype_sub: `%|-%<:%`(C, t_12*{t_12 <- `t_12*`}, t_22*{t_22 <- `t_22*`}) - -- if (x*{x <- `x*`} = $setminus_(syntax localidx, x_2*{x_2 <- `x_2*`}, x_1*{x_1 <- `x_1*`})) - -- (if (C.LOCALS_context[x!`%`_idx.0] = `%%`_localtype(SET_init, t)))*{t <- `t*`, x <- `x*`} - -;; 3-typing.watsup -relation Limits_sub: `%|-%<:%`(context, limits, limits) - ;; 3-typing.watsup - rule _{C : context, n_1 : n, m_1 : m, n_2 : n, m_2 : m}: - `%|-%<:%`(C, `[%..%]`_limits(`%`_u64(n_1), `%`_u64(m_1)), `[%..%]`_limits(`%`_u64(n_2), `%`_u64(m_2))) - -- if (n_1 >= n_2) - -- if (m_1 <= m_2) - -;; 3-typing.watsup -relation Globaltype_sub: `%|-%<:%`(context, globaltype, globaltype) - ;; 3-typing.watsup - rule const{C : context, valtype_1 : valtype, valtype_2 : valtype}: - `%|-%<:%`(C, `%%`_globaltype(`MUT%?`_mut(?()), valtype_1), `%%`_globaltype(`MUT%?`_mut(?()), valtype_2)) - -- Valtype_sub: `%|-%<:%`(C, valtype_1, valtype_2) - - ;; 3-typing.watsup - rule var{C : context, valtype_1 : valtype, valtype_2 : valtype}: - `%|-%<:%`(C, `%%`_globaltype(`MUT%?`_mut(?(())), valtype_1), `%%`_globaltype(`MUT%?`_mut(?(())), valtype_2)) - -- Valtype_sub: `%|-%<:%`(C, valtype_1, valtype_2) - -- Valtype_sub: `%|-%<:%`(C, valtype_2, valtype_1) - -;; 3-typing.watsup -relation Tabletype_sub: `%|-%<:%`(context, tabletype, tabletype) - ;; 3-typing.watsup - rule _{C : context, addrtype : addrtype, limits_1 : limits, reftype_1 : reftype, limits_2 : limits, reftype_2 : reftype}: - `%|-%<:%`(C, `%%%`_tabletype(addrtype, limits_1, reftype_1), `%%%`_tabletype(addrtype, limits_2, reftype_2)) - -- Limits_sub: `%|-%<:%`(C, limits_1, limits_2) - -- Reftype_sub: `%|-%<:%`(C, reftype_1, reftype_2) - -- Reftype_sub: `%|-%<:%`(C, reftype_2, reftype_1) - -;; 3-typing.watsup -relation Memtype_sub: `%|-%<:%`(context, memtype, memtype) - ;; 3-typing.watsup - rule _{C : context, addrtype : addrtype, limits_1 : limits, limits_2 : limits}: - `%|-%<:%`(C, `%%PAGE`_memtype(addrtype, limits_1), `%%PAGE`_memtype(addrtype, limits_2)) - -- Limits_sub: `%|-%<:%`(C, limits_1, limits_2) - -;; 3-typing.watsup -relation Tagtype_sub: `%|-%<:%`(context, tagtype, tagtype) - ;; 3-typing.watsup - rule _{C : context, deftype_1 : deftype, deftype_2 : deftype}: - `%|-%<:%`(C, deftype_1, deftype_2) - -- Deftype_sub: `%|-%<:%`(C, deftype_1, deftype_2) - -- Deftype_sub: `%|-%<:%`(C, deftype_2, deftype_1) - -;; 3-typing.watsup -relation Externtype_sub: `%|-%<:%`(context, externtype, externtype) - ;; 3-typing.watsup - rule func{C : context, deftype_1 : deftype, deftype_2 : deftype}: - `%|-%<:%`(C, FUNC_externtype((deftype_1 : deftype <: typeuse)), FUNC_externtype((deftype_2 : deftype <: typeuse))) - -- Deftype_sub: `%|-%<:%`(C, deftype_1, deftype_2) - - ;; 3-typing.watsup - rule global{C : context, globaltype_1 : globaltype, globaltype_2 : globaltype}: - `%|-%<:%`(C, GLOBAL_externtype(globaltype_1), GLOBAL_externtype(globaltype_2)) - -- Globaltype_sub: `%|-%<:%`(C, globaltype_1, globaltype_2) - - ;; 3-typing.watsup - rule table{C : context, tabletype_1 : tabletype, tabletype_2 : tabletype}: - `%|-%<:%`(C, TABLE_externtype(tabletype_1), TABLE_externtype(tabletype_2)) - -- Tabletype_sub: `%|-%<:%`(C, tabletype_1, tabletype_2) - - ;; 3-typing.watsup - rule mem{C : context, memtype_1 : memtype, memtype_2 : memtype}: - `%|-%<:%`(C, MEM_externtype(memtype_1), MEM_externtype(memtype_2)) - -- Memtype_sub: `%|-%<:%`(C, memtype_1, memtype_2) - - ;; 3-typing.watsup - rule tag{C : context, tagtype_1 : tagtype, tagtype_2 : tagtype}: - `%|-%<:%`(C, TAG_externtype((tagtype_1 : deftype <: typeuse)), TAG_externtype((tagtype_2 : deftype <: typeuse))) - -- Tagtype_sub: `%|-%<:%`(C, tagtype_1, tagtype_2) - -;; 3-typing.watsup -relation Blocktype_ok: `%|-%:%`(context, blocktype, instrtype) - ;; 3-typing.watsup - rule valtype{C : context, `valtype?` : valtype?}: - `%|-%:%`(C, _RESULT_blocktype(valtype?{valtype <- `valtype?`}), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype(lift(valtype?{valtype <- `valtype?`})))) - -- (Valtype_ok: `%|-%:OK`(C, valtype))?{valtype <- `valtype?`} - - ;; 3-typing.watsup - rule typeidx{C : context, typeidx : typeidx, `t_1*` : valtype*, `t_2*` : valtype*}: - `%|-%:%`(C, _IDX_blocktype(typeidx), `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) - -- Expand: `%~~%`(C.TYPES_context[typeidx!`%`_typeidx.0], FUNC_comptype(`%->%`_functype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`})))) - -;; 3-typing.watsup -relation Catch_ok: `%|-%:OK`(context, catch) - ;; 3-typing.watsup - rule catch{C : context, x : idx, l : labelidx, `t*` : valtype*}: - `%|-%:OK`(C, CATCH_catch(x, l)) - -- Expand: `%~~%`(C.TAGS_context[x!`%`_idx.0], FUNC_comptype(`%->%`_functype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([])))) - -- Resulttype_sub: `%|-%<:%`(C, t*{t <- `t*`}, C.LABELS_context[l!`%`_labelidx.0]!`%`_resulttype.0) - - ;; 3-typing.watsup - rule catch_ref{C : context, x : idx, l : labelidx, `t*` : valtype*}: - `%|-%:OK`(C, CATCH_REF_catch(x, l)) - -- Expand: `%~~%`(C.TAGS_context[x!`%`_idx.0], FUNC_comptype(`%->%`_functype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([])))) - -- Resulttype_sub: `%|-%<:%`(C, t*{t <- `t*`} ++ [REF_valtype(`NULL%?`_nul(?()), EXN_heaptype)], C.LABELS_context[l!`%`_labelidx.0]!`%`_resulttype.0) - - ;; 3-typing.watsup - rule catch_all{C : context, l : labelidx}: - `%|-%:OK`(C, CATCH_ALL_catch(l)) - -- Resulttype_sub: `%|-%<:%`(C, [], C.LABELS_context[l!`%`_labelidx.0]!`%`_resulttype.0) - - ;; 3-typing.watsup - rule catch_all_ref{C : context, l : labelidx}: - `%|-%:OK`(C, CATCH_ALL_REF_catch(l)) - -- Resulttype_sub: `%|-%<:%`(C, [REF_valtype(`NULL%?`_nul(?()), EXN_heaptype)], C.LABELS_context[l!`%`_labelidx.0]!`%`_resulttype.0) - -;; 6-runtime-aux.watsup -def $default_(valtype : valtype) : val? - ;; 6-runtime-aux.watsup - def $default_{Inn : Inn}((Inn : Inn <: valtype)) = ?(CONST_val((Inn : Inn <: numtype), `%`_num_(0))) - ;; 6-runtime-aux.watsup - def $default_{Fnn : Fnn}((Fnn : Fnn <: valtype)) = ?(CONST_val((Fnn : Fnn <: numtype), $fzero($size((Fnn : Fnn <: numtype))))) - ;; 6-runtime-aux.watsup - def $default_{Vnn : Vnn}((Vnn : Vnn <: valtype)) = ?(VCONST_val(Vnn, `%`_vec_(0))) - ;; 6-runtime-aux.watsup - def $default_{ht : heaptype}(REF_valtype(`NULL%?`_nul(?(())), ht)) = ?(REF.NULL_val(ht)) - ;; 6-runtime-aux.watsup - def $default_{ht : heaptype}(REF_valtype(`NULL%?`_nul(?()), ht)) = ?() - -;; 3-typing.watsup -relation Defaultable: `|-%DEFAULTABLE`(valtype) - ;; 6-runtime-aux.watsup - rule _{t : valtype}: - `|-%DEFAULTABLE`(t) - -- if ($default_(t) =/= ?()) - -;; 3-typing.watsup -rec { - -;; 3-typing.watsup:555.1-555.95 -relation Instr_ok: `%|-%:%`(context, instr, instrtype) - ;; 3-typing.watsup:568.1-569.24 - rule nop{C : context}: - `%|-%:%`(C, NOP_instr, `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([]))) - - ;; 3-typing.watsup:571.1-573.42 - rule unreachable{C : context, `t_1*` : valtype*, `t_2*` : valtype*}: - `%|-%:%`(C, UNREACHABLE_instr, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) - -- Instrtype_ok: `%|-%:OK`(C, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) - - ;; 3-typing.watsup:575.1-577.29 - rule drop{C : context, t : valtype}: - `%|-%:%`(C, DROP_instr, `%->_%%`_instrtype(`%`_resulttype([t]), [], `%`_resulttype([]))) - -- Valtype_ok: `%|-%:OK`(C, t) - - ;; 3-typing.watsup:580.1-582.29 - rule `select-expl`{C : context, t : valtype}: - `%|-%:%`(C, `SELECT()%?`_instr(?([t])), `%->_%%`_instrtype(`%`_resulttype([t t I32_valtype]), [], `%`_resulttype([t]))) - -- Valtype_ok: `%|-%:OK`(C, t) - - ;; 3-typing.watsup:584.1-588.37 - rule `select-impl`{C : context, t : valtype, t' : valtype, numtype : numtype, vectype : vectype}: - `%|-%:%`(C, `SELECT()%?`_instr(?()), `%->_%%`_instrtype(`%`_resulttype([t t I32_valtype]), [], `%`_resulttype([t]))) - -- Valtype_ok: `%|-%:OK`(C, t) - -- Valtype_sub: `%|-%<:%`(C, t, t') - -- if ((t' = (numtype : numtype <: valtype)) \/ (t' = (vectype : vectype <: valtype))) - - ;; 3-typing.watsup:604.1-607.67 - rule block{C : context, bt : blocktype, `instr*` : instr*, `t_1*` : valtype*, `t_2*` : valtype*, `x*` : idx*}: - `%|-%:%`(C, BLOCK_instr(bt, instr*{instr <- `instr*`}), `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) - -- Blocktype_ok: `%|-%:%`(C, bt, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) - -- Instrs_ok: `%|-%:%`({TYPES [], RECS [], FUNCS [], GLOBALS [], TABLES [], MEMS [], TAGS [], ELEMS [], DATAS [], LOCALS [], LABELS [`%`_resulttype(t_2*{t_2 <- `t_2*`})], RETURN ?(), REFS []} +++ C, instr*{instr <- `instr*`}, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), x*{x <- `x*`}, `%`_resulttype(t_2*{t_2 <- `t_2*`}))) - - ;; 3-typing.watsup:609.1-612.67 - rule loop{C : context, bt : blocktype, `instr*` : instr*, `t_1*` : valtype*, `t_2*` : valtype*, `x*` : idx*}: - `%|-%:%`(C, LOOP_instr(bt, instr*{instr <- `instr*`}), `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) - -- Blocktype_ok: `%|-%:%`(C, bt, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) - -- Instrs_ok: `%|-%:%`({TYPES [], RECS [], FUNCS [], GLOBALS [], TABLES [], MEMS [], TAGS [], ELEMS [], DATAS [], LOCALS [], LABELS [`%`_resulttype(t_1*{t_1 <- `t_1*`})], RETURN ?(), REFS []} +++ C, instr*{instr <- `instr*`}, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), x*{x <- `x*`}, `%`_resulttype(t_2*{t_2 <- `t_2*`}))) - - ;; 3-typing.watsup:614.1-618.71 - rule if{C : context, bt : blocktype, `instr_1*` : instr*, `instr_2*` : instr*, `t_1*` : valtype*, `t_2*` : valtype*, `x_1*` : idx*, `x_2*` : idx*}: - `%|-%:%`(C, `IF%%ELSE%`_instr(bt, instr_1*{instr_1 <- `instr_1*`}, instr_2*{instr_2 <- `instr_2*`}), `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`} ++ [I32_valtype]), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) - -- Blocktype_ok: `%|-%:%`(C, bt, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) - -- Instrs_ok: `%|-%:%`({TYPES [], RECS [], FUNCS [], GLOBALS [], TABLES [], MEMS [], TAGS [], ELEMS [], DATAS [], LOCALS [], LABELS [`%`_resulttype(t_2*{t_2 <- `t_2*`})], RETURN ?(), REFS []} +++ C, instr_1*{instr_1 <- `instr_1*`}, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), x_1*{x_1 <- `x_1*`}, `%`_resulttype(t_2*{t_2 <- `t_2*`}))) - -- Instrs_ok: `%|-%:%`({TYPES [], RECS [], FUNCS [], GLOBALS [], TABLES [], MEMS [], TAGS [], ELEMS [], DATAS [], LOCALS [], LABELS [`%`_resulttype(t_2*{t_2 <- `t_2*`})], RETURN ?(), REFS []} +++ C, instr_2*{instr_2 <- `instr_2*`}, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), x_2*{x_2 <- `x_2*`}, `%`_resulttype(t_2*{t_2 <- `t_2*`}))) - - ;; 3-typing.watsup:623.1-626.42 - rule br{C : context, l : labelidx, `t_1*` : valtype*, `t*` : valtype*, `t_2*` : valtype*}: - `%|-%:%`(C, BR_instr(l), `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`} ++ t*{t <- `t*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) - -- if (C.LABELS_context[l!`%`_labelidx.0]!`%`_resulttype.0 = t*{t <- `t*`}) - -- Instrtype_ok: `%|-%:OK`(C, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) - - ;; 3-typing.watsup:628.1-630.25 - rule br_if{C : context, l : labelidx, `t*` : valtype*}: - `%|-%:%`(C, BR_IF_instr(l), `%->_%%`_instrtype(`%`_resulttype(t*{t <- `t*`} ++ [I32_valtype]), [], `%`_resulttype(t*{t <- `t*`}))) - -- if (C.LABELS_context[l!`%`_labelidx.0]!`%`_resulttype.0 = t*{t <- `t*`}) - - ;; 3-typing.watsup:632.1-636.42 - rule br_table{C : context, `l*` : labelidx*, l' : labelidx, `t_1*` : valtype*, `t*` : valtype*, `t_2*` : valtype*}: - `%|-%:%`(C, BR_TABLE_instr(l*{l <- `l*`}, l'), `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`} ++ t*{t <- `t*`} ++ [I32_valtype]), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) - -- (Resulttype_sub: `%|-%<:%`(C, t*{t <- `t*`}, C.LABELS_context[l!`%`_labelidx.0]!`%`_resulttype.0))*{l <- `l*`} - -- Resulttype_sub: `%|-%<:%`(C, t*{t <- `t*`}, C.LABELS_context[l'!`%`_labelidx.0]!`%`_resulttype.0) - -- Instrtype_ok: `%|-%:OK`(C, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) - - ;; 3-typing.watsup:638.1-641.31 - rule br_on_null{C : context, l : labelidx, `t*` : valtype*, ht : heaptype}: - `%|-%:%`(C, BR_ON_NULL_instr(l), `%->_%%`_instrtype(`%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(`NULL%?`_nul(?(())), ht)]), [], `%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(`NULL%?`_nul(?()), ht)]))) - -- if (C.LABELS_context[l!`%`_labelidx.0]!`%`_resulttype.0 = t*{t <- `t*`}) - -- Heaptype_ok: `%|-%:OK`(C, ht) - - ;; 3-typing.watsup:643.1-645.34 - rule br_on_non_null{C : context, l : labelidx, `t*` : valtype*, ht : heaptype}: - `%|-%:%`(C, BR_ON_NON_NULL_instr(l), `%->_%%`_instrtype(`%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(`NULL%?`_nul(?(())), ht)]), [], `%`_resulttype(t*{t <- `t*`}))) - -- if (C.LABELS_context[l!`%`_labelidx.0] = `%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(`NULL%?`_nul(?()), ht)])) - - ;; 3-typing.watsup:647.1-653.34 - rule br_on_cast{C : context, l : labelidx, rt_1 : reftype, rt_2 : reftype, `t*` : valtype*, rt : reftype}: - `%|-%:%`(C, BR_ON_CAST_instr(l, rt_1, rt_2), `%->_%%`_instrtype(`%`_resulttype(t*{t <- `t*`} ++ [(rt_1 : reftype <: valtype)]), [], `%`_resulttype(t*{t <- `t*`} ++ [($diffrt(rt_1, rt_2) : reftype <: valtype)]))) - -- if (C.LABELS_context[l!`%`_labelidx.0] = `%`_resulttype(t*{t <- `t*`} ++ [(rt : reftype <: valtype)])) - -- Reftype_ok: `%|-%:OK`(C, rt_1) - -- Reftype_ok: `%|-%:OK`(C, rt_2) - -- Reftype_sub: `%|-%<:%`(C, rt_2, rt_1) - -- Reftype_sub: `%|-%<:%`(C, rt_2, rt) - - ;; 3-typing.watsup:655.1-661.49 - rule br_on_cast_fail{C : context, l : labelidx, rt_1 : reftype, rt_2 : reftype, `t*` : valtype*, rt : reftype}: - `%|-%:%`(C, BR_ON_CAST_FAIL_instr(l, rt_1, rt_2), `%->_%%`_instrtype(`%`_resulttype(t*{t <- `t*`} ++ [(rt_1 : reftype <: valtype)]), [], `%`_resulttype(t*{t <- `t*`} ++ [(rt_2 : reftype <: valtype)]))) - -- if (C.LABELS_context[l!`%`_labelidx.0] = `%`_resulttype(t*{t <- `t*`} ++ [(rt : reftype <: valtype)])) - -- Reftype_ok: `%|-%:OK`(C, rt_1) - -- Reftype_ok: `%|-%:OK`(C, rt_2) - -- Reftype_sub: `%|-%<:%`(C, rt_2, rt_1) - -- Reftype_sub: `%|-%<:%`(C, $diffrt(rt_1, rt_2), rt) - - ;; 3-typing.watsup:666.1-668.47 - rule call{C : context, x : idx, `t_1*` : valtype*, `t_2*` : valtype*}: - `%|-%:%`(C, CALL_instr(x), `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) - -- Expand: `%~~%`(C.FUNCS_context[x!`%`_idx.0], FUNC_comptype(`%->%`_functype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`})))) - - ;; 3-typing.watsup:670.1-672.47 - rule call_ref{C : context, x : idx, `t_1*` : valtype*, `t_2*` : valtype*}: - `%|-%:%`(C, CALL_REF_instr(_IDX_typeuse(x)), `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`} ++ [REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x))]), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) - -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], FUNC_comptype(`%->%`_functype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`})))) - - ;; 3-typing.watsup:674.1-678.47 - rule call_indirect{C : context, x : idx, y : idx, `t_1*` : valtype*, at : addrtype, `t_2*` : valtype*, lim : limits, rt : reftype}: - `%|-%:%`(C, CALL_INDIRECT_instr(x, _IDX_typeuse(y)), `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`} ++ [(at : addrtype <: valtype)]), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) - -- if (C.TABLES_context[x!`%`_idx.0] = `%%%`_tabletype(at, lim, rt)) - -- Reftype_sub: `%|-%<:%`(C, rt, REF_reftype(`NULL%?`_nul(?(())), FUNC_heaptype)) - -- Expand: `%~~%`(C.TYPES_context[y!`%`_idx.0], FUNC_comptype(`%->%`_functype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`})))) - - ;; 3-typing.watsup:680.1-683.42 - rule return{C : context, `t_1*` : valtype*, `t*` : valtype*, `t_2*` : valtype*}: - `%|-%:%`(C, RETURN_instr, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`} ++ t*{t <- `t*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) - -- if (C.RETURN_context = ?(`%`_list(t*{t <- `t*`}))) - -- Instrtype_ok: `%|-%:OK`(C, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) - - ;; 3-typing.watsup:686.1-691.42 - rule return_call{C : context, x : idx, `t_3*` : valtype*, `t_1*` : valtype*, `t_4*` : valtype*, `t_2*` : valtype*, `t'_2*` : valtype*}: - `%|-%:%`(C, RETURN_CALL_instr(x), `%->_%%`_instrtype(`%`_resulttype(t_3*{t_3 <- `t_3*`} ++ t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_4*{t_4 <- `t_4*`}))) - -- Expand: `%~~%`(C.FUNCS_context[x!`%`_idx.0], FUNC_comptype(`%->%`_functype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`})))) - -- if (C.RETURN_context = ?(`%`_list(t'_2*{t'_2 <- `t'_2*`}))) - -- Resulttype_sub: `%|-%<:%`(C, t_2*{t_2 <- `t_2*`}, t'_2*{t'_2 <- `t'_2*`}) - -- Instrtype_ok: `%|-%:OK`(C, `%->_%%`_instrtype(`%`_resulttype(t_3*{t_3 <- `t_3*`}), [], `%`_resulttype(t_4*{t_4 <- `t_4*`}))) - - ;; 3-typing.watsup:694.1-699.42 - rule return_call_ref{C : context, x : idx, `t_3*` : valtype*, `t_1*` : valtype*, `t_4*` : valtype*, `t_2*` : valtype*, `t'_2*` : valtype*}: - `%|-%:%`(C, RETURN_CALL_REF_instr(_IDX_typeuse(x)), `%->_%%`_instrtype(`%`_resulttype(t_3*{t_3 <- `t_3*`} ++ t_1*{t_1 <- `t_1*`} ++ [REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x))]), [], `%`_resulttype(t_4*{t_4 <- `t_4*`}))) - -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], FUNC_comptype(`%->%`_functype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`})))) - -- if (C.RETURN_context = ?(`%`_list(t'_2*{t'_2 <- `t'_2*`}))) - -- Resulttype_sub: `%|-%<:%`(C, t_2*{t_2 <- `t_2*`}, t'_2*{t'_2 <- `t'_2*`}) - -- Instrtype_ok: `%|-%:OK`(C, `%->_%%`_instrtype(`%`_resulttype(t_3*{t_3 <- `t_3*`}), [], `%`_resulttype(t_4*{t_4 <- `t_4*`}))) - - ;; 3-typing.watsup:702.1-710.42 - rule return_call_indirect{C : context, x : idx, y : idx, `t_3*` : valtype*, `t_1*` : valtype*, at : addrtype, `t_4*` : valtype*, lim : limits, rt : reftype, `t_2*` : valtype*, `t'_2*` : valtype*}: - `%|-%:%`(C, RETURN_CALL_INDIRECT_instr(x, _IDX_typeuse(y)), `%->_%%`_instrtype(`%`_resulttype(t_3*{t_3 <- `t_3*`} ++ t_1*{t_1 <- `t_1*`} ++ [(at : addrtype <: valtype)]), [], `%`_resulttype(t_4*{t_4 <- `t_4*`}))) - -- if (C.TABLES_context[x!`%`_idx.0] = `%%%`_tabletype(at, lim, rt)) - -- Reftype_sub: `%|-%<:%`(C, rt, REF_reftype(`NULL%?`_nul(?(())), FUNC_heaptype)) - -- Expand: `%~~%`(C.TYPES_context[y!`%`_idx.0], FUNC_comptype(`%->%`_functype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`})))) - -- if (C.RETURN_context = ?(`%`_list(t'_2*{t'_2 <- `t'_2*`}))) - -- Resulttype_sub: `%|-%<:%`(C, t_2*{t_2 <- `t_2*`}, t'_2*{t'_2 <- `t'_2*`}) - -- Instrtype_ok: `%|-%:OK`(C, `%->_%%`_instrtype(`%`_resulttype(t_3*{t_3 <- `t_3*`}), [], `%`_resulttype(t_4*{t_4 <- `t_4*`}))) - - ;; 3-typing.watsup:717.1-720.42 - rule throw{C : context, x : idx, `t_1*` : valtype*, `t*` : valtype*, `t_2*` : valtype*}: - `%|-%:%`(C, THROW_instr(x), `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`} ++ t*{t <- `t*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) - -- Expand: `%~~%`(C.TAGS_context[x!`%`_idx.0], FUNC_comptype(`%->%`_functype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([])))) - -- Instrtype_ok: `%|-%:OK`(C, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) - - ;; 3-typing.watsup:722.1-724.42 - rule throw_ref{C : context, `t_1*` : valtype*, `t_2*` : valtype*}: - `%|-%:%`(C, THROW_REF_instr, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`} ++ [REF_valtype(`NULL%?`_nul(?(())), EXN_heaptype)]), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) - -- Instrtype_ok: `%|-%:OK`(C, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) - - ;; 3-typing.watsup:726.1-730.34 - rule try_table{C : context, bt : blocktype, `catch*` : catch*, `instr*` : instr*, `t_1*` : valtype*, `t_2*` : valtype*, `x*` : idx*}: - `%|-%:%`(C, TRY_TABLE_instr(bt, `%`_list(catch*{catch <- `catch*`}), instr*{instr <- `instr*`}), `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) - -- Blocktype_ok: `%|-%:%`(C, bt, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) - -- Instrs_ok: `%|-%:%`({TYPES [], RECS [], FUNCS [], GLOBALS [], TABLES [], MEMS [], TAGS [], ELEMS [], DATAS [], LOCALS [], LABELS [`%`_resulttype(t_2*{t_2 <- `t_2*`})], RETURN ?(), REFS []} +++ C, instr*{instr <- `instr*`}, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), x*{x <- `x*`}, `%`_resulttype(t_2*{t_2 <- `t_2*`}))) - -- (Catch_ok: `%|-%:OK`(C, catch))*{catch <- `catch*`} - - ;; 3-typing.watsup:753.1-754.33 - rule const{C : context, nt : numtype, c_nt : num_(nt)}: - `%|-%:%`(C, CONST_instr(nt, c_nt), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([(nt : numtype <: valtype)]))) - - ;; 3-typing.watsup:756.1-757.34 - rule unop{C : context, nt : numtype, unop_nt : unop_(nt)}: - `%|-%:%`(C, UNOP_instr(nt, unop_nt), `%->_%%`_instrtype(`%`_resulttype([(nt : numtype <: valtype)]), [], `%`_resulttype([(nt : numtype <: valtype)]))) - - ;; 3-typing.watsup:759.1-760.39 - rule binop{C : context, nt : numtype, binop_nt : binop_(nt)}: - `%|-%:%`(C, BINOP_instr(nt, binop_nt), `%->_%%`_instrtype(`%`_resulttype([(nt : numtype <: valtype) (nt : numtype <: valtype)]), [], `%`_resulttype([(nt : numtype <: valtype)]))) - - ;; 3-typing.watsup:762.1-763.39 - rule testop{C : context, nt : numtype, testop_nt : testop_(nt)}: - `%|-%:%`(C, TESTOP_instr(nt, testop_nt), `%->_%%`_instrtype(`%`_resulttype([(nt : numtype <: valtype)]), [], `%`_resulttype([I32_valtype]))) - - ;; 3-typing.watsup:765.1-766.40 - rule relop{C : context, nt : numtype, relop_nt : relop_(nt)}: - `%|-%:%`(C, RELOP_instr(nt, relop_nt), `%->_%%`_instrtype(`%`_resulttype([(nt : numtype <: valtype) (nt : numtype <: valtype)]), [], `%`_resulttype([I32_valtype]))) - - ;; 3-typing.watsup:768.1-769.44 - rule cvtop{C : context, nt_1 : numtype, nt_2 : numtype, cvtop : cvtop__(nt_2, nt_1)}: - `%|-%:%`(C, CVTOP_instr(nt_1, nt_2, cvtop), `%->_%%`_instrtype(`%`_resulttype([(nt_2 : numtype <: valtype)]), [], `%`_resulttype([(nt_1 : numtype <: valtype)]))) - - ;; 3-typing.watsup:774.1-776.31 - rule ref.null{C : context, ht : heaptype}: - `%|-%:%`(C, REF.NULL_instr(ht), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), ht)]))) - -- Heaptype_ok: `%|-%:OK`(C, ht) - - ;; 3-typing.watsup:778.1-781.20 - rule ref.func{C : context, x : idx, dt : deftype}: - `%|-%:%`(C, REF.FUNC_instr(x), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), (dt : deftype <: heaptype))]))) - -- if (C.FUNCS_context[x!`%`_idx.0] = dt) - -- if x <- C.REFS_context - - ;; 3-typing.watsup:783.1-784.34 - rule ref.i31{C : context}: - `%|-%:%`(C, REF.I31_instr, `%->_%%`_instrtype(`%`_resulttype([I32_valtype]), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), I31_heaptype)]))) - - ;; 3-typing.watsup:786.1-788.31 - rule ref.is_null{C : context, ht : heaptype}: - `%|-%:%`(C, REF.IS_NULL_instr, `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), ht)]), [], `%`_resulttype([I32_valtype]))) - -- Heaptype_ok: `%|-%:OK`(C, ht) - - ;; 3-typing.watsup:790.1-792.31 - rule ref.as_non_null{C : context, ht : heaptype}: - `%|-%:%`(C, REF.AS_NON_NULL_instr, `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), ht)]), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), ht)]))) - -- Heaptype_ok: `%|-%:OK`(C, ht) - - ;; 3-typing.watsup:794.1-795.51 - rule ref.eq{C : context}: - `%|-%:%`(C, REF.EQ_instr, `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), EQ_heaptype) REF_valtype(`NULL%?`_nul(?(())), EQ_heaptype)]), [], `%`_resulttype([I32_valtype]))) - - ;; 3-typing.watsup:797.1-801.33 - rule ref.test{C : context, rt : reftype, rt' : reftype}: - `%|-%:%`(C, REF.TEST_instr(rt), `%->_%%`_instrtype(`%`_resulttype([(rt' : reftype <: valtype)]), [], `%`_resulttype([I32_valtype]))) - -- Reftype_ok: `%|-%:OK`(C, rt) - -- Reftype_ok: `%|-%:OK`(C, rt') - -- Reftype_sub: `%|-%<:%`(C, rt, rt') - - ;; 3-typing.watsup:803.1-807.33 - rule ref.cast{C : context, rt : reftype, rt' : reftype}: - `%|-%:%`(C, REF.CAST_instr(rt), `%->_%%`_instrtype(`%`_resulttype([(rt' : reftype <: valtype)]), [], `%`_resulttype([(rt : reftype <: valtype)]))) - -- Reftype_ok: `%|-%:OK`(C, rt) - -- Reftype_ok: `%|-%:OK`(C, rt') - -- Reftype_sub: `%|-%<:%`(C, rt, rt') - - ;; 3-typing.watsup:812.1-813.42 - rule i31.get{C : context, sx : sx}: - `%|-%:%`(C, I31.GET_instr(sx), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), I31_heaptype)]), [], `%`_resulttype([I32_valtype]))) - - ;; 3-typing.watsup:818.1-820.44 - rule struct.new{C : context, x : idx, `zt*` : storagetype*, `mut*` : mut*}: - `%|-%:%`(C, STRUCT.NEW_instr(x), `%->_%%`_instrtype(`%`_resulttype($unpack(zt)*{zt <- `zt*`}), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), _IDX_heaptype(x))]))) - -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], STRUCT_comptype(`%`_structtype(`%%`_fieldtype(mut, zt)*{mut <- `mut*`, zt <- `zt*`}))) - - ;; 3-typing.watsup:822.1-825.48 - rule struct.new_default{C : context, x : idx, `mut*` : mut*, `zt*` : storagetype*}: - `%|-%:%`(C, STRUCT.NEW_DEFAULT_instr(x), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), _IDX_heaptype(x))]))) - -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], STRUCT_comptype(`%`_structtype(`%%`_fieldtype(mut, zt)*{mut <- `mut*`, zt <- `zt*`}))) - -- (Defaultable: `|-%DEFAULTABLE`($unpack(zt)))*{zt <- `zt*`} - - ;; 3-typing.watsup:827.1-831.39 - rule struct.get{C : context, `sx?` : sx?, x : idx, i : u32, zt : storagetype, `yt*` : fieldtype*, mut : mut}: - `%|-%:%`(C, STRUCT.GET_instr(sx?{sx <- `sx?`}, x, i), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x))]), [], `%`_resulttype([$unpack(zt)]))) - -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], STRUCT_comptype(`%`_structtype(yt*{yt <- `yt*`}))) - -- if (yt*{yt <- `yt*`}[i!`%`_u32.0] = `%%`_fieldtype(mut, zt)) - -- if ((sx?{sx <- `sx?`} = ?()) <=> (zt = ($unpack(zt) : valtype <: storagetype))) - - ;; 3-typing.watsup:833.1-836.24 - rule struct.set{C : context, x : idx, i : u32, zt : storagetype, `yt*` : fieldtype*}: - `%|-%:%`(C, STRUCT.SET_instr(x, i), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x)) $unpack(zt)]), [], `%`_resulttype([]))) - -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], STRUCT_comptype(`%`_structtype(yt*{yt <- `yt*`}))) - -- if (yt*{yt <- `yt*`}[i!`%`_u32.0] = `%%`_fieldtype(`MUT%?`_mut(?(())), zt)) - - ;; 3-typing.watsup:841.1-843.42 - rule array.new{C : context, x : idx, zt : storagetype, mut : mut}: - `%|-%:%`(C, ARRAY.NEW_instr(x), `%->_%%`_instrtype(`%`_resulttype([$unpack(zt) I32_valtype]), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), _IDX_heaptype(x))]))) - -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(mut, zt))) - - ;; 3-typing.watsup:845.1-848.45 - rule array.new_default{C : context, x : idx, mut : mut, zt : storagetype}: - `%|-%:%`(C, ARRAY.NEW_DEFAULT_instr(x), `%->_%%`_instrtype(`%`_resulttype([I32_valtype]), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), _IDX_heaptype(x))]))) - -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(mut, zt))) - -- Defaultable: `|-%DEFAULTABLE`($unpack(zt)) - - ;; 3-typing.watsup:850.1-852.42 - rule array.new_fixed{C : context, x : idx, n : n, zt : storagetype, mut : mut}: - `%|-%:%`(C, ARRAY.NEW_FIXED_instr(x, `%`_u32(n)), `%->_%%`_instrtype(`%`_resulttype($unpack(zt)^n{}), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), _IDX_heaptype(x))]))) - -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(mut, zt))) - - ;; 3-typing.watsup:854.1-857.40 - rule array.new_elem{C : context, x : idx, y : idx, mut : mut, rt : reftype}: - `%|-%:%`(C, ARRAY.NEW_ELEM_instr(x, y), `%->_%%`_instrtype(`%`_resulttype([I32_valtype I32_valtype]), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), _IDX_heaptype(x))]))) - -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(mut, (rt : reftype <: storagetype)))) - -- Reftype_sub: `%|-%<:%`(C, C.ELEMS_context[y!`%`_idx.0], rt) - - ;; 3-typing.watsup:859.1-863.24 - rule array.new_data{C : context, x : idx, y : idx, mut : mut, zt : storagetype, numtype : numtype, vectype : vectype}: - `%|-%:%`(C, ARRAY.NEW_DATA_instr(x, y), `%->_%%`_instrtype(`%`_resulttype([I32_valtype I32_valtype]), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), _IDX_heaptype(x))]))) - -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(mut, zt))) - -- if (($unpack(zt) = (numtype : numtype <: valtype)) \/ ($unpack(zt) = (vectype : vectype <: valtype))) - -- if (C.DATAS_context[y!`%`_idx.0] = OK_datatype) - - ;; 3-typing.watsup:865.1-868.39 - rule array.get{C : context, `sx?` : sx?, x : idx, zt : storagetype, mut : mut}: - `%|-%:%`(C, ARRAY.GET_instr(sx?{sx <- `sx?`}, x), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x)) I32_valtype]), [], `%`_resulttype([$unpack(zt)]))) - -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(mut, zt))) - -- if ((sx?{sx <- `sx?`} = ?()) <=> (zt = ($unpack(zt) : valtype <: storagetype))) - - ;; 3-typing.watsup:870.1-872.42 - rule array.set{C : context, x : idx, zt : storagetype}: - `%|-%:%`(C, ARRAY.SET_instr(x), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x)) I32_valtype $unpack(zt)]), [], `%`_resulttype([]))) - -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(`MUT%?`_mut(?(())), zt))) - - ;; 3-typing.watsup:874.1-875.43 - rule array.len{C : context}: - `%|-%:%`(C, ARRAY.LEN_instr, `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), ARRAY_heaptype)]), [], `%`_resulttype([I32_valtype]))) - - ;; 3-typing.watsup:877.1-879.42 - rule array.fill{C : context, x : idx, zt : storagetype}: - `%|-%:%`(C, ARRAY.FILL_instr(x), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x)) I32_valtype $unpack(zt) I32_valtype]), [], `%`_resulttype([]))) - -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(`MUT%?`_mut(?(())), zt))) - - ;; 3-typing.watsup:881.1-885.40 - rule array.copy{C : context, x_1 : idx, x_2 : idx, zt_1 : storagetype, mut : mut, zt_2 : storagetype}: - `%|-%:%`(C, ARRAY.COPY_instr(x_1, x_2), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x_1)) I32_valtype REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x_2)) I32_valtype I32_valtype]), [], `%`_resulttype([]))) - -- Expand: `%~~%`(C.TYPES_context[x_1!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(`MUT%?`_mut(?(())), zt_1))) - -- Expand: `%~~%`(C.TYPES_context[x_2!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(mut, zt_2))) - -- Storagetype_sub: `%|-%<:%`(C, zt_2, zt_1) - - ;; 3-typing.watsup:887.1-890.44 - rule array.init_elem{C : context, x : idx, y : idx, zt : storagetype}: - `%|-%:%`(C, ARRAY.INIT_ELEM_instr(x, y), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x)) I32_valtype I32_valtype I32_valtype]), [], `%`_resulttype([]))) - -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(`MUT%?`_mut(?(())), zt))) - -- Storagetype_sub: `%|-%<:%`(C, (C.ELEMS_context[y!`%`_idx.0] : reftype <: storagetype), zt) - - ;; 3-typing.watsup:892.1-896.24 - rule array.init_data{C : context, x : idx, y : idx, zt : storagetype, numtype : numtype, vectype : vectype}: - `%|-%:%`(C, ARRAY.INIT_DATA_instr(x, y), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x)) I32_valtype I32_valtype I32_valtype]), [], `%`_resulttype([]))) - -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(`MUT%?`_mut(?(())), zt))) - -- if (($unpack(zt) = (numtype : numtype <: valtype)) \/ ($unpack(zt) = (vectype : vectype <: valtype))) - -- if (C.DATAS_context[y!`%`_idx.0] = OK_datatype) - - ;; 3-typing.watsup:901.1-903.20 - rule extern.convert_any{C : context, nul1 : nul1, nul2 : nul2}: - `%|-%:%`(C, EXTERN.CONVERT_ANY_instr, `%->_%%`_instrtype(`%`_resulttype([REF_valtype(nul1, ANY_heaptype)]), [], `%`_resulttype([REF_valtype(nul2, EXTERN_heaptype)]))) - -- if (nul1 = nul2) - - ;; 3-typing.watsup:905.1-907.20 - rule any.convert_extern{C : context, nul1 : nul1, nul2 : nul2}: - `%|-%:%`(C, ANY.CONVERT_EXTERN_instr, `%->_%%`_instrtype(`%`_resulttype([REF_valtype(nul1, EXTERN_heaptype)]), [], `%`_resulttype([REF_valtype(nul2, ANY_heaptype)]))) - -- if (nul1 = nul2) - - ;; 3-typing.watsup:912.1-913.35 - rule vconst{C : context, c : vec_(V128_Vnn)}: - `%|-%:%`(C, VCONST_instr(V128_vectype, c), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([V128_valtype]))) - - ;; 3-typing.watsup:915.1-916.41 - rule vvunop{C : context, vvunop : vvunop}: - `%|-%:%`(C, VVUNOP_instr(V128_vectype, vvunop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype]), [], `%`_resulttype([V128_valtype]))) - - ;; 3-typing.watsup:918.1-919.48 - rule vvbinop{C : context, vvbinop : vvbinop}: - `%|-%:%`(C, VVBINOP_instr(V128_vectype, vvbinop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) - - ;; 3-typing.watsup:921.1-922.55 - rule vvternop{C : context, vvternop : vvternop}: - `%|-%:%`(C, VVTERNOP_instr(V128_vectype, vvternop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) - - ;; 3-typing.watsup:924.1-925.44 - rule vvtestop{C : context, vvtestop : vvtestop}: - `%|-%:%`(C, VVTESTOP_instr(V128_vectype, vvtestop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype]), [], `%`_resulttype([I32_valtype]))) - - ;; 3-typing.watsup:927.1-928.37 - rule vunop{C : context, sh : shape, vunop : vunop_(sh)}: - `%|-%:%`(C, VUNOP_instr(sh, vunop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype]), [], `%`_resulttype([V128_valtype]))) - - ;; 3-typing.watsup:930.1-931.44 - rule vbinop{C : context, sh : shape, vbinop : vbinop_(sh)}: - `%|-%:%`(C, VBINOP_instr(sh, vbinop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) - - ;; 3-typing.watsup:933.1-934.51 - rule vternop{C : context, sh : shape, vternop : vternop_(sh)}: - `%|-%:%`(C, VTERNOP_instr(sh, vternop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) - - ;; 3-typing.watsup:936.1-937.40 - rule vtestop{C : context, sh : shape, vtestop : vtestop_(sh)}: - `%|-%:%`(C, VTESTOP_instr(sh, vtestop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype]), [], `%`_resulttype([I32_valtype]))) - - ;; 3-typing.watsup:939.1-940.44 - rule vrelop{C : context, sh : shape, vrelop : vrelop_(sh)}: - `%|-%:%`(C, VRELOP_instr(sh, vrelop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) - - ;; 3-typing.watsup:942.1-943.47 - rule vshiftop{C : context, sh : ishape, vshiftop : vshiftop_(sh)}: - `%|-%:%`(C, VSHIFTOP_instr(sh, vshiftop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype I32_valtype]), [], `%`_resulttype([V128_valtype]))) - - ;; 3-typing.watsup:945.1-946.33 - rule vbitmask{C : context, sh : ishape}: - `%|-%:%`(C, VBITMASK_instr(sh), `%->_%%`_instrtype(`%`_resulttype([V128_valtype]), [], `%`_resulttype([I32_valtype]))) - - ;; 3-typing.watsup:948.1-949.50 - rule vswizzlop{C : context, sh : bshape, vswizzlop : vswizzlop_(sh)}: - `%|-%:%`(C, VSWIZZLOP_instr(sh, vswizzlop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) - - ;; 3-typing.watsup:951.1-953.29 - rule vshuffle{C : context, sh : bshape, `i*` : laneidx*}: - `%|-%:%`(C, VSHUFFLE_instr(sh, i*{i <- `i*`}), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) - -- (if (i!`%`_laneidx.0 < (2 * $dim(sh!`%`_bshape.0)!`%`_dim.0)))*{i <- `i*`} - - ;; 3-typing.watsup:955.1-956.44 - rule vsplat{C : context, sh : shape}: - `%|-%:%`(C, VSPLAT_instr(sh), `%->_%%`_instrtype(`%`_resulttype([($unpackshape(sh) : numtype <: valtype)]), [], `%`_resulttype([V128_valtype]))) - - ;; 3-typing.watsup:958.1-960.21 - rule vextract_lane{C : context, sh : shape, `sx?` : sx?, i : laneidx}: - `%|-%:%`(C, VEXTRACT_LANE_instr(sh, sx?{sx <- `sx?`}, i), `%->_%%`_instrtype(`%`_resulttype([V128_valtype]), [], `%`_resulttype([($unpackshape(sh) : numtype <: valtype)]))) - -- if (i!`%`_laneidx.0 < $dim(sh)!`%`_dim.0) - - ;; 3-typing.watsup:962.1-964.21 - rule vreplace_lane{C : context, sh : shape, i : laneidx}: - `%|-%:%`(C, VREPLACE_LANE_instr(sh, i), `%->_%%`_instrtype(`%`_resulttype([V128_valtype ($unpackshape(sh) : numtype <: valtype)]), [], `%`_resulttype([V128_valtype]))) - -- if (i!`%`_laneidx.0 < $dim(sh)!`%`_dim.0) - - ;; 3-typing.watsup:966.1-967.50 - rule vextunop{C : context, sh_1 : ishape, sh_2 : ishape, vextunop : vextunop__(sh_2, sh_1)}: - `%|-%:%`(C, VEXTUNOP_instr(sh_1, sh_2, vextunop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype]), [], `%`_resulttype([V128_valtype]))) - - ;; 3-typing.watsup:969.1-970.57 - rule vextbinop{C : context, sh_1 : ishape, sh_2 : ishape, vextbinop : vextbinop__(sh_2, sh_1)}: - `%|-%:%`(C, VEXTBINOP_instr(sh_1, sh_2, vextbinop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) - - ;; 3-typing.watsup:972.1-973.64 - rule vextternop{C : context, sh_1 : ishape, sh_2 : ishape, vextternop : vextternop__(sh_2, sh_1)}: - `%|-%:%`(C, VEXTTERNOP_instr(sh_1, sh_2, vextternop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) - - ;; 3-typing.watsup:975.1-976.48 - rule vnarrow{C : context, sh_1 : ishape, sh_2 : ishape, sx : sx}: - `%|-%:%`(C, VNARROW_instr(sh_1, sh_2, sx), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) - - ;; 3-typing.watsup:978.1-979.58 - rule vcvtop{C : context, sh_1 : shape, sh_2 : shape, vcvtop : vcvtop__(sh_2, sh_1), `half?` : half__(sh_2, sh_1)?, `zero?` : zero__(sh_2, sh_1)?}: - `%|-%:%`(C, VCVTOP_instr(sh_1, sh_2, vcvtop, half?{half <- `half?`}, zero?{zero <- `zero?`}), `%->_%%`_instrtype(`%`_resulttype([V128_valtype]), [], `%`_resulttype([V128_valtype]))) - - ;; 3-typing.watsup:984.1-986.28 - rule local.get{C : context, x : idx, t : valtype}: - `%|-%:%`(C, LOCAL.GET_instr(x), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([t]))) - -- if (C.LOCALS_context[x!`%`_idx.0] = `%%`_localtype(SET_init, t)) - - ;; 3-typing.watsup:988.1-990.29 - rule local.set{C : context, x : idx, t : valtype, init : init}: - `%|-%:%`(C, LOCAL.SET_instr(x), `%->_%%`_instrtype(`%`_resulttype([t]), [x], `%`_resulttype([]))) - -- if (C.LOCALS_context[x!`%`_idx.0] = `%%`_localtype(init, t)) - - ;; 3-typing.watsup:992.1-994.29 - rule local.tee{C : context, x : idx, t : valtype, init : init}: - `%|-%:%`(C, LOCAL.TEE_instr(x), `%->_%%`_instrtype(`%`_resulttype([t]), [x], `%`_resulttype([t]))) - -- if (C.LOCALS_context[x!`%`_idx.0] = `%%`_localtype(init, t)) - - ;; 3-typing.watsup:999.1-1001.29 - rule global.get{C : context, x : idx, t : valtype, mut : mut}: - `%|-%:%`(C, GLOBAL.GET_instr(x), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([t]))) - -- if (C.GLOBALS_context[x!`%`_idx.0] = `%%`_globaltype(mut, t)) - - ;; 3-typing.watsup:1003.1-1005.29 - rule global.set{C : context, x : idx, t : valtype}: - `%|-%:%`(C, GLOBAL.SET_instr(x), `%->_%%`_instrtype(`%`_resulttype([t]), [], `%`_resulttype([]))) - -- if (C.GLOBALS_context[x!`%`_idx.0] = `%%`_globaltype(`MUT%?`_mut(?(())), t)) - - ;; 3-typing.watsup:1010.1-1012.32 - rule table.get{C : context, x : idx, at : addrtype, rt : reftype, lim : limits}: - `%|-%:%`(C, TABLE.GET_instr(x), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype)]), [], `%`_resulttype([(rt : reftype <: valtype)]))) - -- if (C.TABLES_context[x!`%`_idx.0] = `%%%`_tabletype(at, lim, rt)) - - ;; 3-typing.watsup:1014.1-1016.32 - rule table.set{C : context, x : idx, at : addrtype, rt : reftype, lim : limits}: - `%|-%:%`(C, TABLE.SET_instr(x), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype) (rt : reftype <: valtype)]), [], `%`_resulttype([]))) - -- if (C.TABLES_context[x!`%`_idx.0] = `%%%`_tabletype(at, lim, rt)) - - ;; 3-typing.watsup:1018.1-1020.32 - rule table.size{C : context, x : idx, at : addrtype, lim : limits, rt : reftype}: - `%|-%:%`(C, TABLE.SIZE_instr(x), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([(at : addrtype <: valtype)]))) - -- if (C.TABLES_context[x!`%`_idx.0] = `%%%`_tabletype(at, lim, rt)) - - ;; 3-typing.watsup:1022.1-1024.32 - rule table.grow{C : context, x : idx, rt : reftype, at : addrtype, lim : limits}: - `%|-%:%`(C, TABLE.GROW_instr(x), `%->_%%`_instrtype(`%`_resulttype([(rt : reftype <: valtype) (at : addrtype <: valtype)]), [], `%`_resulttype([(at : addrtype <: valtype)]))) - -- if (C.TABLES_context[x!`%`_idx.0] = `%%%`_tabletype(at, lim, rt)) - - ;; 3-typing.watsup:1026.1-1028.32 - rule table.fill{C : context, x : idx, at : addrtype, rt : reftype, lim : limits}: - `%|-%:%`(C, TABLE.FILL_instr(x), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype) (rt : reftype <: valtype) (at : addrtype <: valtype)]), [], `%`_resulttype([]))) - -- if (C.TABLES_context[x!`%`_idx.0] = `%%%`_tabletype(at, lim, rt)) - - ;; 3-typing.watsup:1030.1-1034.36 - rule table.copy{C : context, x_1 : idx, x_2 : idx, at_1 : addrtype, at_2 : addrtype, lim_1 : limits, rt_1 : reftype, lim_2 : limits, rt_2 : reftype}: - `%|-%:%`(C, TABLE.COPY_instr(x_1, x_2), `%->_%%`_instrtype(`%`_resulttype([(at_1 : addrtype <: valtype) (at_2 : addrtype <: valtype) ($minat(at_1, at_2) : addrtype <: valtype)]), [], `%`_resulttype([]))) - -- if (C.TABLES_context[x_1!`%`_idx.0] = `%%%`_tabletype(at_1, lim_1, rt_1)) - -- if (C.TABLES_context[x_2!`%`_idx.0] = `%%%`_tabletype(at_2, lim_2, rt_2)) - -- Reftype_sub: `%|-%<:%`(C, rt_2, rt_1) - - ;; 3-typing.watsup:1036.1-1040.36 - rule table.init{C : context, x : idx, y : idx, at : addrtype, lim : limits, rt_1 : reftype, rt_2 : reftype}: - `%|-%:%`(C, TABLE.INIT_instr(x, y), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype) I32_valtype I32_valtype]), [], `%`_resulttype([]))) - -- if (C.TABLES_context[x!`%`_idx.0] = `%%%`_tabletype(at, lim, rt_1)) - -- if (C.ELEMS_context[y!`%`_idx.0] = rt_2) - -- Reftype_sub: `%|-%<:%`(C, rt_2, rt_1) - - ;; 3-typing.watsup:1042.1-1044.24 - rule elem.drop{C : context, x : idx, rt : reftype}: - `%|-%:%`(C, ELEM.DROP_instr(x), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([]))) - -- if (C.ELEMS_context[x!`%`_idx.0] = rt) - - ;; 3-typing.watsup:1049.1-1051.32 - rule memory.size{C : context, x : idx, at : addrtype, lim : limits}: - `%|-%:%`(C, MEMORY.SIZE_instr(x), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([(at : addrtype <: valtype)]))) - -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - - ;; 3-typing.watsup:1053.1-1055.32 - rule memory.grow{C : context, x : idx, at : addrtype, lim : limits}: - `%|-%:%`(C, MEMORY.GROW_instr(x), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype)]), [], `%`_resulttype([(at : addrtype <: valtype)]))) - -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - - ;; 3-typing.watsup:1057.1-1059.32 - rule memory.fill{C : context, x : idx, at : addrtype, lim : limits}: - `%|-%:%`(C, MEMORY.FILL_instr(x), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype) I32_valtype (at : addrtype <: valtype)]), [], `%`_resulttype([]))) - -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - - ;; 3-typing.watsup:1061.1-1064.38 - rule memory.copy{C : context, x_1 : idx, x_2 : idx, at_1 : addrtype, at_2 : addrtype, lim_1 : limits, lim_2 : limits}: - `%|-%:%`(C, MEMORY.COPY_instr(x_1, x_2), `%->_%%`_instrtype(`%`_resulttype([(at_1 : addrtype <: valtype) (at_2 : addrtype <: valtype) ($minat(at_1, at_2) : addrtype <: valtype)]), [], `%`_resulttype([]))) - -- if (C.MEMS_context[x_1!`%`_idx.0] = `%%PAGE`_memtype(at_1, lim_1)) - -- if (C.MEMS_context[x_2!`%`_idx.0] = `%%PAGE`_memtype(at_2, lim_2)) - - ;; 3-typing.watsup:1066.1-1069.24 - rule memory.init{C : context, x : idx, y : idx, at : addrtype, lim : limits}: - `%|-%:%`(C, MEMORY.INIT_instr(x, y), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype) I32_valtype I32_valtype]), [], `%`_resulttype([]))) - -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (C.DATAS_context[y!`%`_idx.0] = OK_datatype) - - ;; 3-typing.watsup:1071.1-1073.24 - rule data.drop{C : context, x : idx}: - `%|-%:%`(C, DATA.DROP_instr(x), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([]))) - -- if (C.DATAS_context[x!`%`_idx.0] = OK_datatype) - - ;; 3-typing.watsup:1084.1-1087.43 - rule `load-val`{C : context, nt : numtype, x : idx, memarg : memarg, at : addrtype, lim : limits}: - `%|-%:%`(C, LOAD_instr(nt, ?(), x, memarg), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype)]), [], `%`_resulttype([(nt : numtype <: valtype)]))) - -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= (($size(nt) : nat <:> rat) / (8 : nat <:> rat))) - - ;; 3-typing.watsup:1089.1-1092.35 - rule `load-pack`{C : context, Inn : Inn, M : M, sx : sx, x : idx, memarg : memarg, at : addrtype, lim : limits}: - `%|-%:%`(C, LOAD_instr((Inn : Inn <: numtype), ?(`%%`_loadop_(`%`_sz(M), sx)), x, memarg), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype)]), [], `%`_resulttype([(Inn : Inn <: valtype)]))) - -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= ((M : nat <:> rat) / (8 : nat <:> rat))) - - ;; 3-typing.watsup:1103.1-1106.43 - rule `store-val`{C : context, nt : numtype, x : idx, memarg : memarg, at : addrtype, lim : limits}: - `%|-%:%`(C, STORE_instr(nt, ?(), x, memarg), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype) (nt : numtype <: valtype)]), [], `%`_resulttype([]))) - -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= (($size(nt) : nat <:> rat) / (8 : nat <:> rat))) - - ;; 3-typing.watsup:1108.1-1111.35 - rule `store-pack`{C : context, Inn : Inn, M : M, x : idx, memarg : memarg, at : addrtype, lim : limits}: - `%|-%:%`(C, STORE_instr((Inn : Inn <: numtype), ?(`%`_storeop_(`%`_sz(M))), x, memarg), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype) (Inn : Inn <: valtype)]), [], `%`_resulttype([]))) - -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= ((M : nat <:> rat) / (8 : nat <:> rat))) - - ;; 3-typing.watsup:1113.1-1116.46 - rule `vload-val`{C : context, x : idx, memarg : memarg, at : addrtype, lim : limits}: - `%|-%:%`(C, VLOAD_instr(V128_vectype, ?(), x, memarg), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype)]), [], `%`_resulttype([V128_valtype]))) - -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= (($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat))) - - ;; 3-typing.watsup:1118.1-1121.39 - rule `vload-pack`{C : context, M : M, N : N, sx : sx, x : idx, memarg : memarg, at : addrtype, lim : limits}: - `%|-%:%`(C, VLOAD_instr(V128_vectype, ?(`SHAPE%X%%`_vloadop_(`%`_sz(M), N, sx)), x, memarg), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype)]), [], `%`_resulttype([V128_valtype]))) - -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= (((M : nat <:> rat) / (8 : nat <:> rat)) * (N : nat <:> rat))) - - ;; 3-typing.watsup:1123.1-1126.35 - rule `vload-splat`{C : context, N : N, x : idx, memarg : memarg, at : addrtype, lim : limits}: - `%|-%:%`(C, VLOAD_instr(V128_vectype, ?(SPLAT_vloadop_(`%`_sz(N))), x, memarg), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype)]), [], `%`_resulttype([V128_valtype]))) - -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= ((N : nat <:> rat) / (8 : nat <:> rat))) - - ;; 3-typing.watsup:1128.1-1131.35 - rule `vload-zero`{C : context, N : N, x : idx, memarg : memarg, at : addrtype, lim : limits}: - `%|-%:%`(C, VLOAD_instr(V128_vectype, ?(ZERO_vloadop_(`%`_sz(N))), x, memarg), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype)]), [], `%`_resulttype([V128_valtype]))) - -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= ((N : nat <:> rat) / (8 : nat <:> rat))) - - ;; 3-typing.watsup:1133.1-1137.21 - rule vload_lane{C : context, N : N, x : idx, memarg : memarg, i : laneidx, at : addrtype, lim : limits}: - `%|-%:%`(C, VLOAD_LANE_instr(V128_vectype, `%`_sz(N), x, memarg, i), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype) V128_valtype]), [], `%`_resulttype([V128_valtype]))) - -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= ((N : nat <:> rat) / (8 : nat <:> rat))) - -- if ((i!`%`_laneidx.0 : nat <:> rat) < ((128 : nat <:> rat) / (N : nat <:> rat))) - - ;; 3-typing.watsup:1139.1-1142.46 - rule vstore{C : context, x : idx, memarg : memarg, at : addrtype, lim : limits}: - `%|-%:%`(C, VSTORE_instr(V128_vectype, x, memarg), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype) V128_valtype]), [], `%`_resulttype([]))) - -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= (($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat))) - - ;; 3-typing.watsup:1144.1-1148.21 - rule vstore_lane{C : context, N : N, x : idx, memarg : memarg, i : laneidx, at : addrtype, lim : limits}: - `%|-%:%`(C, VSTORE_LANE_instr(V128_vectype, `%`_sz(N), x, memarg, i), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype) V128_valtype]), [], `%`_resulttype([]))) - -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= ((N : nat <:> rat) / (8 : nat <:> rat))) - -- if ((i!`%`_laneidx.0 : nat <:> rat) < ((128 : nat <:> rat) / (N : nat <:> rat))) - -;; 3-typing.watsup:556.1-556.96 -relation Instrs_ok: `%|-%:%`(context, instr*, instrtype) - ;; 3-typing.watsup:1153.1-1154.24 - rule empty{C : context}: - `%|-%:%`(C, [], `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([]))) - - ;; 3-typing.watsup:1157.1-1161.82 - rule seq{C : context, instr_1 : instr, `instr_2*` : instr*, `t_1*` : valtype*, `x_1*` : idx*, `x_2*` : idx*, `t_3*` : valtype*, `t_2*` : valtype*, `init*` : init*, `t*` : valtype*}: - `%|-%:%`(C, [instr_1] ++ instr_2*{instr_2 <- `instr_2*`}, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), x_1*{x_1 <- `x_1*`} ++ x_2*{x_2 <- `x_2*`}, `%`_resulttype(t_3*{t_3 <- `t_3*`}))) - -- Instr_ok: `%|-%:%`(C, instr_1, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), x_1*{x_1 <- `x_1*`}, `%`_resulttype(t_2*{t_2 <- `t_2*`}))) - -- (if (C.LOCALS_context[x_1!`%`_idx.0] = `%%`_localtype(init, t)))*{init <- `init*`, t <- `t*`, x_1 <- `x_1*`} - -- Instrs_ok: `%|-%:%`($with_locals(C, x_1*{x_1 <- `x_1*`}, `%%`_localtype(SET_init, t)*{t <- `t*`}), instr_2*{instr_2 <- `instr_2*`}, `%->_%%`_instrtype(`%`_resulttype(t_2*{t_2 <- `t_2*`}), x_2*{x_2 <- `x_2*`}, `%`_resulttype(t_3*{t_3 <- `t_3*`}))) - - ;; 3-typing.watsup:1163.1-1167.33 - rule sub{C : context, `instr*` : instr*, it' : instrtype, it : instrtype}: - `%|-%:%`(C, instr*{instr <- `instr*`}, it') - -- Instrs_ok: `%|-%:%`(C, instr*{instr <- `instr*`}, it) - -- Instrtype_sub: `%|-%<:%`(C, it, it') - -- Instrtype_ok: `%|-%:OK`(C, it') - - ;; 3-typing.watsup:1170.1-1173.33 - rule frame{C : context, `instr*` : instr*, `t*` : valtype*, `t_1*` : valtype*, `x*` : idx*, `t_2*` : valtype*}: - `%|-%:%`(C, instr*{instr <- `instr*`}, `%->_%%`_instrtype(`%`_resulttype(t*{t <- `t*`} ++ t_1*{t_1 <- `t_1*`}), x*{x <- `x*`}, `%`_resulttype(t*{t <- `t*`} ++ t_2*{t_2 <- `t_2*`}))) - -- Instrs_ok: `%|-%:%`(C, instr*{instr <- `instr*`}, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), x*{x <- `x*`}, `%`_resulttype(t_2*{t_2 <- `t_2*`}))) - -- Resulttype_ok: `%|-%:OK`(C, `%`_resulttype(t*{t <- `t*`})) -} - -;; 3-typing.watsup -relation Expr_ok: `%|-%:%`(context, expr, resulttype) - ;; 3-typing.watsup - rule _{C : context, `instr*` : instr*, `t*` : valtype*}: - `%|-%:%`(C, instr*{instr <- `instr*`}, `%`_resulttype(t*{t <- `t*`})) - -- Instrs_ok: `%|-%:%`(C, instr*{instr <- `instr*`}, `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype(t*{t <- `t*`}))) - -;; 3-typing.watsup -relation Nondefaultable: `|-%NONDEFAULTABLE`(valtype) - ;; 6-runtime-aux.watsup - rule _{t : valtype}: - `|-%NONDEFAULTABLE`(t) - -- if ($default_(t) = ?()) - -;; 3-typing.watsup -relation Instr_const: `%|-%CONST`(context, instr) - ;; 3-typing.watsup - rule const{C : context, nt : numtype, c_nt : num_(nt)}: - `%|-%CONST`(C, CONST_instr(nt, c_nt)) - - ;; 3-typing.watsup - rule vconst{C : context, vt : vectype, c_vt : vec_(vt)}: - `%|-%CONST`(C, VCONST_instr(vt, c_vt)) - - ;; 3-typing.watsup - rule ref.null{C : context, ht : heaptype}: - `%|-%CONST`(C, REF.NULL_instr(ht)) - - ;; 3-typing.watsup - rule ref.i31{C : context}: - `%|-%CONST`(C, REF.I31_instr) - - ;; 3-typing.watsup - rule ref.func{C : context, x : idx}: - `%|-%CONST`(C, REF.FUNC_instr(x)) - - ;; 3-typing.watsup - rule struct.new{C : context, x : idx}: - `%|-%CONST`(C, STRUCT.NEW_instr(x)) - - ;; 3-typing.watsup - rule struct.new_default{C : context, x : idx}: - `%|-%CONST`(C, STRUCT.NEW_DEFAULT_instr(x)) - - ;; 3-typing.watsup - rule array.new{C : context, x : idx}: - `%|-%CONST`(C, ARRAY.NEW_instr(x)) - - ;; 3-typing.watsup - rule array.new_default{C : context, x : idx}: - `%|-%CONST`(C, ARRAY.NEW_DEFAULT_instr(x)) - - ;; 3-typing.watsup - rule array.new_fixed{C : context, x : idx, n : n}: - `%|-%CONST`(C, ARRAY.NEW_FIXED_instr(x, `%`_u32(n))) - - ;; 3-typing.watsup - rule any.convert_extern{C : context}: - `%|-%CONST`(C, ANY.CONVERT_EXTERN_instr) - - ;; 3-typing.watsup - rule extern.convert_any{C : context}: - `%|-%CONST`(C, EXTERN.CONVERT_ANY_instr) - - ;; 3-typing.watsup - rule global.get{C : context, x : idx, t : valtype}: - `%|-%CONST`(C, GLOBAL.GET_instr(x)) - -- if (C.GLOBALS_context[x!`%`_idx.0] = `%%`_globaltype(`MUT%?`_mut(?()), t)) - - ;; 3-typing.watsup - rule binop{C : context, Inn : Inn, binop : binop_((Inn : Inn <: numtype))}: - `%|-%CONST`(C, BINOP_instr((Inn : Inn <: numtype), binop)) - -- if Inn <- [I32_Inn I64_Inn] - -- if binop <- [ADD_binop_ SUB_binop_ MUL_binop_] - -;; 3-typing.watsup -relation Expr_const: `%|-%CONST`(context, expr) - ;; 3-typing.watsup - rule _{C : context, `instr*` : instr*}: - `%|-%CONST`(C, instr*{instr <- `instr*`}) - -- (Instr_const: `%|-%CONST`(C, instr))*{instr <- `instr*`} - -;; 3-typing.watsup -relation Expr_ok_const: `%|-%:%CONST`(context, expr, valtype) - ;; 3-typing.watsup - rule _{C : context, expr : expr, t : valtype}: - `%|-%:%CONST`(C, expr, t) - -- Expr_ok: `%|-%:%`(C, expr, `%`_resulttype([t])) - -- Expr_const: `%|-%CONST`(C, expr) - -;; 3-typing.watsup -relation Type_ok: `%|-%:%`(context, type, deftype*) - ;; 3-typing.watsup - rule _{C : context, rectype : rectype, `dt*` : deftype*, x : idx}: - `%|-%:%`(C, TYPE_type(rectype), dt*{dt <- `dt*`}) - -- if (x!`%`_idx.0 = |C.TYPES_context|) - -- if (dt*{dt <- `dt*`} = $rolldt(x, rectype)) - -- Rectype_ok: `%|-%:%`(C +++ {TYPES dt*{dt <- `dt*`}, RECS [], FUNCS [], GLOBALS [], TABLES [], MEMS [], TAGS [], ELEMS [], DATAS [], LOCALS [], LABELS [], RETURN ?(), REFS []}, rectype, OK_oktypeidx(x)) - -;; 3-typing.watsup -relation Local_ok: `%|-%:%`(context, local, localtype) - ;; 3-typing.watsup - rule set{C : context, t : valtype}: - `%|-%:%`(C, LOCAL_local(t), `%%`_localtype(SET_init, t)) - -- Defaultable: `|-%DEFAULTABLE`(t) - - ;; 3-typing.watsup - rule unset{C : context, t : valtype}: - `%|-%:%`(C, LOCAL_local(t), `%%`_localtype(UNSET_init, t)) - -- Nondefaultable: `|-%NONDEFAULTABLE`(t) - -;; 3-typing.watsup -relation Func_ok: `%|-%:%`(context, func, deftype) - ;; 3-typing.watsup - rule _{C : context, x : idx, `local*` : local*, expr : expr, `t_1*` : valtype*, `t_2*` : valtype*, `lct*` : localtype*}: - `%|-%:%`(C, FUNC_func(x, local*{local <- `local*`}, expr), C.TYPES_context[x!`%`_idx.0]) - -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], FUNC_comptype(`%->%`_functype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`})))) - -- (Local_ok: `%|-%:%`(C, local, lct))*{lct <- `lct*`, local <- `local*`} - -- Expr_ok: `%|-%:%`(C +++ {TYPES [], RECS [], FUNCS [], GLOBALS [], TABLES [], MEMS [], TAGS [], ELEMS [], DATAS [], LOCALS `%%`_localtype(SET_init, t_1)*{t_1 <- `t_1*`} ++ lct*{lct <- `lct*`}, LABELS [`%`_resulttype(t_2*{t_2 <- `t_2*`})], RETURN ?(`%`_resulttype(t_2*{t_2 <- `t_2*`})), REFS []}, expr, `%`_resulttype(t_2*{t_2 <- `t_2*`})) - -;; 3-typing.watsup -relation Global_ok: `%|-%:%`(context, global, globaltype) - ;; 3-typing.watsup - rule _{C : context, globaltype : globaltype, expr : expr, gt : globaltype, mut : mut, t : valtype}: - `%|-%:%`(C, GLOBAL_global(globaltype, expr), globaltype) - -- Globaltype_ok: `%|-%:OK`(C, gt) - -- if (globaltype = `%%`_globaltype(mut, t)) - -- Expr_ok_const: `%|-%:%CONST`(C, expr, t) - -;; 3-typing.watsup -relation Table_ok: `%|-%:%`(context, table, tabletype) - ;; 3-typing.watsup - rule _{C : context, tabletype : tabletype, expr : expr, tt : tabletype, at : addrtype, lim : limits, rt : reftype}: - `%|-%:%`(C, TABLE_table(tabletype, expr), tabletype) - -- Tabletype_ok: `%|-%:OK`(C, tt) - -- if (tabletype = `%%%`_tabletype(at, lim, rt)) - -- Expr_ok_const: `%|-%:%CONST`(C, expr, (rt : reftype <: valtype)) - -;; 3-typing.watsup -relation Mem_ok: `%|-%:%`(context, mem, memtype) - ;; 3-typing.watsup - rule _{C : context, memtype : memtype}: - `%|-%:%`(C, MEMORY_mem(memtype), memtype) - -- Memtype_ok: `%|-%:OK`(C, memtype) - -;; 3-typing.watsup -relation Tag_ok: `%|-%:%`(context, tag, tagtype) - ;; 3-typing.watsup - rule _{C : context, x : idx, functype : functype}: - `%|-%:%`(C, TAG_tag(x), C.TYPES_context[x!`%`_idx.0]) - -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], FUNC_comptype(functype)) - -;; 3-typing.watsup -relation Elemmode_ok: `%|-%:%`(context, elemmode, elemtype) - ;; 3-typing.watsup - rule active{C : context, x : idx, expr : expr, rt : reftype, at : addrtype, lim : limits, rt' : reftype}: - `%|-%:%`(C, ACTIVE_elemmode(x, expr), rt) - -- if (C.TABLES_context[x!`%`_idx.0] = `%%%`_tabletype(at, lim, rt')) - -- Reftype_sub: `%|-%<:%`(C, rt, rt') - -- Expr_ok_const: `%|-%:%CONST`(C, expr, I32_valtype) - - ;; 3-typing.watsup - rule passive{C : context, rt : reftype}: - `%|-%:%`(C, PASSIVE_elemmode, rt) - - ;; 3-typing.watsup - rule declare{C : context, rt : reftype}: - `%|-%:%`(C, DECLARE_elemmode, rt) - -;; 3-typing.watsup -relation Elem_ok: `%|-%:%`(context, elem, elemtype) - ;; 3-typing.watsup - rule _{C : context, elemtype : elemtype, `expr*` : expr*, elemmode : elemmode}: - `%|-%:%`(C, ELEM_elem(elemtype, expr*{expr <- `expr*`}, elemmode), elemtype) - -- Reftype_ok: `%|-%:OK`(C, elemtype) - -- (Expr_ok_const: `%|-%:%CONST`(C, expr, (elemtype : reftype <: valtype)))*{expr <- `expr*`} - -- Elemmode_ok: `%|-%:%`(C, elemmode, elemtype) - -;; 3-typing.watsup -relation Datamode_ok: `%|-%:%`(context, datamode, datatype) - ;; 3-typing.watsup - rule active{C : context, x : idx, expr : expr, mt : memtype}: - `%|-%:%`(C, ACTIVE_datamode(x, expr), OK_datatype) - -- if (C.MEMS_context[x!`%`_idx.0] = mt) - -- Expr_ok_const: `%|-%:%CONST`(C, expr, I32_valtype) - - ;; 3-typing.watsup - rule passive{C : context}: - `%|-%:%`(C, PASSIVE_datamode, OK_datatype) - -;; 3-typing.watsup -relation Data_ok: `%|-%:%`(context, data, datatype) - ;; 3-typing.watsup - rule _{C : context, `b*` : byte*, datamode : datamode}: - `%|-%:%`(C, DATA_data(b*{b <- `b*`}, datamode), OK_datatype) - -- Datamode_ok: `%|-%:%`(C, datamode, OK_datatype) - -;; 3-typing.watsup -relation Start_ok: `%|-%:OK`(context, start) - ;; 3-typing.watsup - rule _{C : context, x : idx}: - `%|-%:OK`(C, START_start(x)) - -- Expand: `%~~%`(C.FUNCS_context[x!`%`_idx.0], FUNC_comptype(`%->%`_functype(`%`_resulttype([]), `%`_resulttype([])))) - -;; 3-typing.watsup -relation Import_ok: `%|-%:%`(context, import, externtype) - ;; 3-typing.watsup - rule _{C : context, name_1 : name, name_2 : name, xt : externtype}: - `%|-%:%`(C, IMPORT_import(name_1, name_2, xt), xt) - -- Externtype_ok: `%|-%:OK`(C, xt) - -;; 3-typing.watsup -relation Externidx_ok: `%|-%:%`(context, externidx, externtype) - ;; 3-typing.watsup - rule func{C : context, x : idx, dt : deftype}: - `%|-%:%`(C, FUNC_externidx(x), FUNC_externtype((dt : deftype <: typeuse))) - -- if (C.FUNCS_context[x!`%`_idx.0] = dt) - - ;; 3-typing.watsup - rule global{C : context, x : idx, gt : globaltype}: - `%|-%:%`(C, GLOBAL_externidx(x), GLOBAL_externtype(gt)) - -- if (C.GLOBALS_context[x!`%`_idx.0] = gt) - - ;; 3-typing.watsup - rule table{C : context, x : idx, tt : tabletype}: - `%|-%:%`(C, TABLE_externidx(x), TABLE_externtype(tt)) - -- if (C.TABLES_context[x!`%`_idx.0] = tt) - - ;; 3-typing.watsup - rule mem{C : context, x : idx, mt : memtype}: - `%|-%:%`(C, MEM_externidx(x), MEM_externtype(mt)) - -- if (C.MEMS_context[x!`%`_idx.0] = mt) - - ;; 3-typing.watsup - rule tag{C : context, x : idx, jt : tagtype}: - `%|-%:%`(C, TAG_externidx(x), TAG_externtype((jt : deftype <: typeuse))) - -- if (C.TAGS_context[x!`%`_idx.0] = jt) - -;; 3-typing.watsup -relation Export_ok: `%|-%:%%`(context, export, name, externtype) - ;; 3-typing.watsup - rule _{C : context, name : name, externidx : externidx, xt : externtype}: - `%|-%:%%`(C, EXPORT_export(name, externidx), name, xt) - -- Externidx_ok: `%|-%:%`(C, externidx, xt) - -;; 3-typing.watsup -rec { - -;; 3-typing.watsup:1379.1-1379.100 -relation Globals_ok: `%|-%:%`(context, global*, globaltype*) - ;; 3-typing.watsup:1423.1-1424.17 - rule empty{C : context}: - `%|-%:%`(C, [], []) - - ;; 3-typing.watsup:1426.1-1429.54 - rule cons{C : context, global_1 : global, `global*` : global*, gt_1 : globaltype, `gt*` : globaltype*}: - `%|-%:%`(C, [global_1] ++ global*{global <- `global*`}, [gt_1] ++ gt*{gt <- `gt*`}) - -- Global_ok: `%|-%:%`(C, global_1, gt_1) - -- Globals_ok: `%|-%:%`(C +++ {TYPES [], RECS [], FUNCS [], GLOBALS [gt_1], TABLES [], MEMS [], TAGS [], ELEMS [], DATAS [], LOCALS [], LABELS [], RETURN ?(), REFS []}, global*{global <- `global*`}, gt*{gt <- `gt*`}) -} - -;; 3-typing.watsup -rec { - -;; 3-typing.watsup:1378.1-1378.98 -relation Types_ok: `%|-%:%`(context, type*, deftype*) - ;; 3-typing.watsup:1415.1-1416.17 - rule empty{C : context}: - `%|-%:%`(C, [], []) - - ;; 3-typing.watsup:1418.1-1421.49 - rule cons{C : context, type_1 : type, `type*` : type*, `dt_1*` : deftype*, `dt*` : deftype*}: - `%|-%:%`(C, [type_1] ++ type*{type <- `type*`}, dt_1*{dt_1 <- `dt_1*`} ++ dt*{dt <- `dt*`}) - -- Type_ok: `%|-%:%`(C, type_1, dt_1*{dt_1 <- `dt_1*`}) - -- Types_ok: `%|-%:%`(C +++ {TYPES dt_1*{dt_1 <- `dt_1*`}, RECS [], FUNCS [], GLOBALS [], TABLES [], MEMS [], TAGS [], ELEMS [], DATAS [], LOCALS [], LABELS [], RETURN ?(), REFS []}, type*{type <- `type*`}, dt*{dt <- `dt*`}) -} - -;; 3-typing.watsup -syntax nonfuncs = - | `%%%%%`{`global*` : global*, `table*` : table*, `mem*` : mem*, `elem*` : elem*, `data*` : data*}(global*{global <- `global*`} : global*, table*{table <- `table*`} : table*, mem*{mem <- `mem*`} : mem*, elem*{elem <- `elem*`} : elem*, data*{data <- `data*`} : data*) - -;; 3-typing.watsup -def $funcidx_nonfuncs(nonfuncs : nonfuncs) : funcidx* - ;; 3-typing.watsup - def $funcidx_nonfuncs{`global*` : global*, `table*` : table*, `mem*` : mem*, `elem*` : elem*, `data*` : data*}(`%%%%%`_nonfuncs(global*{global <- `global*`}, table*{table <- `table*`}, mem*{mem <- `mem*`}, elem*{elem <- `elem*`}, data*{data <- `data*`})) = $funcidx_module(MODULE_module([], [], [], global*{global <- `global*`}, table*{table <- `table*`}, mem*{mem <- `mem*`}, [], elem*{elem <- `elem*`}, data*{data <- `data*`}, ?(), [])) - -;; 3-typing.watsup -relation Module_ok: `|-%:%`(module, moduletype) - ;; 3-typing.watsup - rule _{`type*` : type*, `import*` : import*, `func*` : func*, `global*` : global*, `table*` : table*, `mem*` : mem*, `tag*` : tag*, `elem*` : elem*, `data*` : data*, `start?` : start?, `export*` : export*, C : context, `xt_I*` : externtype*, `xt_E*` : externtype*, `dt'*` : deftype*, C' : context, `gt*` : globaltype*, `tt*` : tabletype*, `mt*` : memtype*, `jt*` : tagtype*, `dt*` : deftype*, `rt*` : reftype*, `ok*` : datatype*, `nm*` : name*, `tt_I*` : tabletype*, `mt_I*` : memtype*, `jt_I*` : tagtype*, `dt_I*` : deftype*, `gt_I*` : globaltype*, `x*` : idx*}: - `|-%:%`(MODULE_module(type*{type <- `type*`}, import*{import <- `import*`}, func*{func <- `func*`}, global*{global <- `global*`}, table*{table <- `table*`}, mem*{mem <- `mem*`}, tag*{tag <- `tag*`}, elem*{elem <- `elem*`}, data*{data <- `data*`}, start?{start <- `start?`}, export*{export <- `export*`}), $clos_moduletype(C, `%->%`_moduletype(xt_I*{xt_I <- `xt_I*`}, xt_E*{xt_E <- `xt_E*`}))) - -- Types_ok: `%|-%:%`({TYPES [], RECS [], FUNCS [], GLOBALS [], TABLES [], MEMS [], TAGS [], ELEMS [], DATAS [], LOCALS [], LABELS [], RETURN ?(), REFS []}, type*{type <- `type*`}, dt'*{dt' <- `dt'*`}) - -- (Import_ok: `%|-%:%`({TYPES dt'*{dt' <- `dt'*`}, RECS [], FUNCS [], GLOBALS [], TABLES [], MEMS [], TAGS [], ELEMS [], DATAS [], LOCALS [], LABELS [], RETURN ?(), REFS []}, import, xt_I))*{import <- `import*`, xt_I <- `xt_I*`} - -- Globals_ok: `%|-%:%`(C', global*{global <- `global*`}, gt*{gt <- `gt*`}) - -- (Table_ok: `%|-%:%`(C', table, tt))*{table <- `table*`, tt <- `tt*`} - -- (Mem_ok: `%|-%:%`(C', mem, mt))*{mem <- `mem*`, mt <- `mt*`} - -- (Tag_ok: `%|-%:%`(C', tag, jt))*{jt <- `jt*`, tag <- `tag*`} - -- (Func_ok: `%|-%:%`(C, func, dt))*{dt <- `dt*`, func <- `func*`} - -- (Elem_ok: `%|-%:%`(C, elem, rt))*{elem <- `elem*`, rt <- `rt*`} - -- (Data_ok: `%|-%:%`(C, data, ok))*{data <- `data*`, ok <- `ok*`} - -- (Start_ok: `%|-%:OK`(C, start))?{start <- `start?`} - -- (Export_ok: `%|-%:%%`(C, export, nm, xt_E))*{export <- `export*`, nm <- `nm*`, xt_E <- `xt_E*`} - -- if $disjoint_(syntax name, nm*{nm <- `nm*`}) - -- if (C = C' +++ {TYPES [], RECS [], FUNCS [], GLOBALS gt*{gt <- `gt*`}, TABLES tt_I*{tt_I <- `tt_I*`} ++ tt*{tt <- `tt*`}, MEMS mt_I*{mt_I <- `mt_I*`} ++ mt*{mt <- `mt*`}, TAGS jt_I*{jt_I <- `jt_I*`} ++ jt*{jt <- `jt*`}, ELEMS rt*{rt <- `rt*`}, DATAS ok*{ok <- `ok*`}, LOCALS [], LABELS [], RETURN ?(), REFS []}) - -- if (C' = {TYPES dt'*{dt' <- `dt'*`}, RECS [], FUNCS dt_I*{dt_I <- `dt_I*`} ++ dt*{dt <- `dt*`}, GLOBALS gt_I*{gt_I <- `gt_I*`}, TABLES [], MEMS [], TAGS [], ELEMS [], DATAS [], LOCALS [], LABELS [], RETURN ?(), REFS x*{x <- `x*`}}) - -- if (x*{x <- `x*`} = $funcidx_nonfuncs(`%%%%%`_nonfuncs(global*{global <- `global*`}, table*{table <- `table*`}, mem*{mem <- `mem*`}, elem*{elem <- `elem*`}, data*{data <- `data*`}))) - -- if (dt_I*{dt_I <- `dt_I*`} = $funcsxt(xt_I*{xt_I <- `xt_I*`})) - -- if (gt_I*{gt_I <- `gt_I*`} = $globalsxt(xt_I*{xt_I <- `xt_I*`})) - -- if (tt_I*{tt_I <- `tt_I*`} = $tablesxt(xt_I*{xt_I <- `xt_I*`})) - -- if (mt_I*{mt_I <- `mt_I*`} = $memsxt(xt_I*{xt_I <- `xt_I*`})) - -- if (jt_I*{jt_I <- `jt_I*`} = $tagsxt(xt_I*{xt_I <- `xt_I*`})) - -;; 4-numerics.watsup -syntax relaxed2 = - | `%`{i : nat}(i : nat) - -- if ((i = 0) \/ (i = 1)) - -;; 4-numerics.watsup -syntax relaxed4 = - | `%`{i : nat}(i : nat) - -- if ((((i = 0) \/ (i = 1)) \/ (i = 2)) \/ (i = 3)) - -;; 4-numerics.watsup -def $relaxed2(relaxed2 : relaxed2, syntax X, X : X, X : X) : X - ;; 4-numerics.watsup - 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 $ND - ;; 4-numerics.watsup - def $relaxed2{i : relaxed2, syntax X, X_1 : X, X_2 : X}(i, syntax X, X_1, X_2) = [X_1 X_2][0] - -- otherwise - -;; 4-numerics.watsup -def $relaxed4(relaxed4 : relaxed4, syntax X, X : X, X : X, X : X, X : X) : X - ;; 4-numerics.watsup - 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 $ND - ;; 4-numerics.watsup - 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][0] - -- otherwise - -;; 4-numerics.watsup -def $R_fmadd : relaxed2 - -;; 4-numerics.watsup -def $R_fmin : relaxed4 - -;; 4-numerics.watsup -def $R_fmax : relaxed4 - -;; 4-numerics.watsup -def $R_idot : relaxed2 - -;; 4-numerics.watsup -def $R_iq15mulr : relaxed2 - -;; 4-numerics.watsup -def $R_trunc_u : relaxed4 - -;; 4-numerics.watsup -def $R_trunc_s : relaxed2 - -;; 4-numerics.watsup -def $R_swizzle : relaxed2 - -;; 4-numerics.watsup -def $R_laneselect : relaxed2 - -;; 4-numerics.watsup -def $s33_to_u32(s33 : s33) : u32 - -;; 4-numerics.watsup -def $ibits_(N : N, iN : iN(N)) : bit* - -;; 4-numerics.watsup -def $fbits_(N : N, fN : fN(N)) : bit* - -;; 4-numerics.watsup -def $ibytes_(N : N, iN : iN(N)) : byte* - -;; 4-numerics.watsup -def $fbytes_(N : N, fN : fN(N)) : byte* - -;; 4-numerics.watsup -def $nbytes_(numtype : numtype, num_ : num_(numtype)) : byte* - -;; 4-numerics.watsup -def $vbytes_(vectype : vectype, vec_ : vec_(vectype)) : byte* - -;; 4-numerics.watsup -def $zbytes_(storagetype : storagetype, lit_ : lit_(storagetype)) : byte* - -;; 4-numerics.watsup -def $cbytes_(Cnn : Cnn, lit_ : lit_((Cnn : Cnn <: storagetype))) : byte* - -;; 4-numerics.watsup -def $invibytes_(N : N, byte*) : iN(N) - ;; 4-numerics.watsup - def $invibytes_{N : N, `b*` : byte*, n : n}(N, b*{b <- `b*`}) = `%`_iN(n) - -- if ($ibytes_(N, `%`_iN(n)) = b*{b <- `b*`}) - -;; 4-numerics.watsup -def $invfbytes_(N : N, byte*) : fN(N) - ;; 4-numerics.watsup - def $invfbytes_{N : N, `b*` : byte*, p : fN(N)}(N, b*{b <- `b*`}) = p - -- if ($fbytes_(N, p) = b*{b <- `b*`}) - -;; 4-numerics.watsup -def $signed_(N : N, nat : nat) : int - ;; 4-numerics.watsup - def $signed_{N : N, i : nat}(N, i) = (i : nat <:> int) - -- if (i < (2 ^ (((N : nat <:> int) - (1 : nat <:> int)) : int <:> nat))) - ;; 4-numerics.watsup - def $signed_{N : N, i : nat}(N, i) = ((i : nat <:> int) - ((2 ^ N) : nat <:> int)) - -- if (((2 ^ (((N : nat <:> int) - (1 : nat <:> int)) : int <:> nat)) <= i) /\ (i < (2 ^ N))) - -;; 4-numerics.watsup -def $invsigned_(N : N, int : int) : nat - ;; 4-numerics.watsup - def $invsigned_{N : N, i : int, j : nat}(N, i) = j - -- if ($signed_(N, j) = i) - -;; 4-numerics.watsup -def $sx(storagetype : storagetype) : sx? - ;; 4-numerics.watsup - def $sx{consttype : consttype}((consttype : consttype <: storagetype)) = ?() - ;; 4-numerics.watsup - def $sx{packtype : packtype}((packtype : packtype <: storagetype)) = ?(S_sx) - -;; 4-numerics.watsup -def $zero(lanetype : lanetype) : lane_(lanetype) - ;; 4-numerics.watsup - def $zero{Jnn : Jnn}((Jnn : Jnn <: lanetype)) = `%`_lane_(0) - ;; 4-numerics.watsup - def $zero{Fnn : Fnn}((Fnn : Fnn <: lanetype)) = $fzero($size((Fnn : Fnn <: numtype))) - -;; 4-numerics.watsup -def $bool(bool : bool) : nat - ;; 4-numerics.watsup - def $bool(false) = 0 - ;; 4-numerics.watsup - def $bool(true) = 1 - -;; 4-numerics.watsup -def $int(rat : rat) : int - -;; 4-numerics.watsup -def $sat_u_(N : N, int : int) : nat - ;; 4-numerics.watsup - def $sat_u_{N : N, i : int}(N, i) = 0 - -- if (i < (0 : nat <:> int)) - ;; 4-numerics.watsup - def $sat_u_{N : N, i : int}(N, i) = ((((2 ^ N) : nat <:> int) - (1 : nat <:> int)) : int <:> nat) - -- if (i > (((2 ^ N) : nat <:> int) - (1 : nat <:> int))) - ;; 4-numerics.watsup - def $sat_u_{N : N, i : int}(N, i) = (i : int <:> nat) - -- otherwise - -;; 4-numerics.watsup -def $sat_s_(N : N, int : int) : int - ;; 4-numerics.watsup - def $sat_s_{N : N, i : int}(N, i) = - ((2 ^ (((N : nat <:> int) - (1 : nat <:> int)) : int <:> nat)) : nat <:> int) - -- if (i < - ((2 ^ (((N : nat <:> int) - (1 : nat <:> int)) : int <:> nat)) : nat <:> int)) - ;; 4-numerics.watsup - def $sat_s_{N : N, i : int}(N, i) = (((2 ^ (((N : nat <:> int) - (1 : nat <:> int)) : int <:> nat)) : nat <:> int) - (1 : nat <:> int)) - -- if (i > (((2 ^ (((N : nat <:> int) - (1 : nat <:> int)) : int <:> nat)) : nat <:> int) - (1 : nat <:> int))) - ;; 4-numerics.watsup - def $sat_s_{N : N, i : int}(N, i) = i - -- otherwise - -;; 4-numerics.watsup -def $ineg_(N : N, iN : iN(N)) : iN(N) - ;; 4-numerics.watsup - def $ineg_{N : N, i_1 : iN(N)}(N, i_1) = `%`_iN($invsigned_(N, - $signed_(N, i_1!`%`_iN.0))) - -;; 4-numerics.watsup -def $iabs_(N : N, iN : iN(N)) : iN(N) - ;; 4-numerics.watsup - def $iabs_{N : N, i_1 : iN(N)}(N, i_1) = i_1 - -- if ($signed_(N, i_1!`%`_iN.0) >= (0 : nat <:> int)) - ;; 4-numerics.watsup - def $iabs_{N : N, i_1 : iN(N)}(N, i_1) = $ineg_(N, i_1) - -- otherwise - -;; 4-numerics.watsup -def $iclz_(N : N, iN : iN(N)) : iN(N) - -;; 4-numerics.watsup -def $ictz_(N : N, iN : iN(N)) : iN(N) - -;; 4-numerics.watsup -def $ipopcnt_(N : N, iN : iN(N)) : iN(N) - -;; 4-numerics.watsup -def $iextend_(N : N, M : M, sx : sx, iN : iN(N)) : iN(N) - ;; 4-numerics.watsup - def $iextend_{N : N, M : M, i : iN(N)}(N, M, U_sx, i) = `%`_iN((i!`%`_iN.0 \ (2 ^ M))) - ;; 4-numerics.watsup - def $iextend_{N : N, M : M, i : iN(N)}(N, M, S_sx, i) = `%`_iN($invsigned_(N, $signed_(M, (i!`%`_iN.0 \ (2 ^ M))))) - -;; 4-numerics.watsup -def $iadd_(N : N, iN : iN(N), iN : iN(N)) : iN(N) - ;; 4-numerics.watsup - def $iadd_{N : N, i_1 : iN(N), i_2 : iN(N)}(N, i_1, i_2) = `%`_iN(((i_1!`%`_iN.0 + i_2!`%`_iN.0) \ (2 ^ N))) - -;; 4-numerics.watsup -def $isub_(N : N, iN : iN(N), iN : iN(N)) : iN(N) - ;; 4-numerics.watsup - def $isub_{N : N, i_1 : iN(N), i_2 : iN(N)}(N, i_1, i_2) = `%`_iN(((((((2 ^ N) + i_1!`%`_iN.0) : nat <:> int) - (i_2!`%`_iN.0 : nat <:> int)) \ ((2 ^ N) : nat <:> int)) : int <:> nat)) - -;; 4-numerics.watsup -def $imul_(N : N, iN : iN(N), iN : iN(N)) : iN(N) - ;; 4-numerics.watsup - def $imul_{N : N, i_1 : iN(N), i_2 : iN(N)}(N, i_1, i_2) = `%`_iN(((i_1!`%`_iN.0 * i_2!`%`_iN.0) \ (2 ^ N))) - -;; 4-numerics.watsup -def $idiv_(N : N, sx : sx, iN : iN(N), iN : iN(N)) : iN(N)? - -;; 4-numerics.watsup -def $irem_(N : N, sx : sx, iN : iN(N), iN : iN(N)) : iN(N)? - -;; 4-numerics.watsup -def $imin_(N : N, sx : sx, iN : iN(N), iN : iN(N)) : iN(N) - -;; 4-numerics.watsup -def $imax_(N : N, sx : sx, iN : iN(N), iN : iN(N)) : iN(N) - -;; 4-numerics.watsup -def $iadd_sat_(N : N, sx : sx, iN : iN(N), iN : iN(N)) : iN(N) - ;; 4-numerics.watsup - def $iadd_sat_{N : N, i_1 : iN(N), i_2 : iN(N)}(N, U_sx, i_1, i_2) = `%`_iN($sat_u_(N, ((i_1!`%`_iN.0 + i_2!`%`_iN.0) : nat <:> int))) - ;; 4-numerics.watsup - def $iadd_sat_{N : N, i_1 : iN(N), i_2 : iN(N)}(N, S_sx, i_1, i_2) = `%`_iN($invsigned_(N, $sat_s_(N, ($signed_(N, i_1!`%`_iN.0) + $signed_(N, i_2!`%`_iN.0))))) - -;; 4-numerics.watsup -def $isub_sat_(N : N, sx : sx, iN : iN(N), iN : iN(N)) : iN(N) - ;; 4-numerics.watsup - def $isub_sat_{N : N, i_1 : iN(N), i_2 : iN(N)}(N, U_sx, i_1, i_2) = `%`_iN($sat_u_(N, ((i_1!`%`_iN.0 : nat <:> int) - (i_2!`%`_iN.0 : nat <:> int)))) - ;; 4-numerics.watsup - def $isub_sat_{N : N, i_1 : iN(N), i_2 : iN(N)}(N, S_sx, i_1, i_2) = `%`_iN($invsigned_(N, $sat_s_(N, ($signed_(N, i_1!`%`_iN.0) - $signed_(N, i_2!`%`_iN.0))))) - -;; 4-numerics.watsup -def $iq15mulr_sat_(N : N, sx : sx, iN : iN(N), iN : iN(N)) : iN(N) - -;; 4-numerics.watsup -def $irelaxed_q15mulr_(N : N, sx : sx, iN : iN(N), iN : iN(N)) : iN(N)* - -;; 4-numerics.watsup -def $iavgr_(N : N, sx : sx, iN : iN(N), iN : iN(N)) : iN(N) - -;; 4-numerics.watsup -def $inot_(N : N, iN : iN(N)) : iN(N) - -;; 4-numerics.watsup -def $iand_(N : N, iN : iN(N), iN : iN(N)) : iN(N) - -;; 4-numerics.watsup -def $iandnot_(N : N, iN : iN(N), iN : iN(N)) : iN(N) - -;; 4-numerics.watsup -def $ior_(N : N, iN : iN(N), iN : iN(N)) : iN(N) - -;; 4-numerics.watsup -def $ixor_(N : N, iN : iN(N), iN : iN(N)) : iN(N) - -;; 4-numerics.watsup -def $ishl_(N : N, iN : iN(N), u32 : u32) : iN(N) - -;; 4-numerics.watsup -def $ishr_(N : N, sx : sx, iN : iN(N), u32 : u32) : iN(N) - -;; 4-numerics.watsup -def $irotl_(N : N, iN : iN(N), iN : iN(N)) : iN(N) - -;; 4-numerics.watsup -def $irotr_(N : N, iN : iN(N), iN : iN(N)) : iN(N) - -;; 4-numerics.watsup -def $ibitselect_(N : N, iN : iN(N), iN : iN(N), iN : iN(N)) : iN(N) - -;; 4-numerics.watsup -def $irelaxed_laneselect_(N : N, iN : iN(N), iN : iN(N), iN : iN(N)) : iN(N)* - -;; 4-numerics.watsup -def $ieqz_(N : N, iN : iN(N)) : u32 - ;; 4-numerics.watsup - def $ieqz_{N : N, i_1 : iN(N)}(N, i_1) = `%`_u32($bool((i_1!`%`_iN.0 = 0))) - -;; 4-numerics.watsup -def $inez_(N : N, iN : iN(N)) : u32 - ;; 4-numerics.watsup - def $inez_{N : N, i_1 : iN(N)}(N, i_1) = `%`_u32($bool((i_1!`%`_iN.0 =/= 0))) - -;; 4-numerics.watsup -def $ieq_(N : N, iN : iN(N), iN : iN(N)) : u32 - ;; 4-numerics.watsup - def $ieq_{N : N, i_1 : iN(N), i_2 : iN(N)}(N, i_1, i_2) = `%`_u32($bool((i_1 = i_2))) - -;; 4-numerics.watsup -def $ine_(N : N, iN : iN(N), iN : iN(N)) : u32 - ;; 4-numerics.watsup - def $ine_{N : N, i_1 : iN(N), i_2 : iN(N)}(N, i_1, i_2) = `%`_u32($bool((i_1 =/= i_2))) - -;; 4-numerics.watsup -def $ilt_(N : N, sx : sx, iN : iN(N), iN : iN(N)) : u32 - ;; 4-numerics.watsup - def $ilt_{N : N, i_1 : iN(N), i_2 : iN(N)}(N, U_sx, i_1, i_2) = `%`_u32($bool((i_1!`%`_iN.0 < i_2!`%`_iN.0))) - ;; 4-numerics.watsup - def $ilt_{N : N, i_1 : iN(N), i_2 : iN(N)}(N, S_sx, i_1, i_2) = `%`_u32($bool(($signed_(N, i_1!`%`_iN.0) < $signed_(N, i_2!`%`_iN.0)))) - -;; 4-numerics.watsup -def $igt_(N : N, sx : sx, iN : iN(N), iN : iN(N)) : u32 - ;; 4-numerics.watsup - def $igt_{N : N, i_1 : iN(N), i_2 : iN(N)}(N, U_sx, i_1, i_2) = `%`_u32($bool((i_1!`%`_iN.0 > i_2!`%`_iN.0))) - ;; 4-numerics.watsup - def $igt_{N : N, i_1 : iN(N), i_2 : iN(N)}(N, S_sx, i_1, i_2) = `%`_u32($bool(($signed_(N, i_1!`%`_iN.0) > $signed_(N, i_2!`%`_iN.0)))) - -;; 4-numerics.watsup -def $ile_(N : N, sx : sx, iN : iN(N), iN : iN(N)) : u32 - ;; 4-numerics.watsup - def $ile_{N : N, i_1 : iN(N), i_2 : iN(N)}(N, U_sx, i_1, i_2) = `%`_u32($bool((i_1!`%`_iN.0 <= i_2!`%`_iN.0))) - ;; 4-numerics.watsup - def $ile_{N : N, i_1 : iN(N), i_2 : iN(N)}(N, S_sx, i_1, i_2) = `%`_u32($bool(($signed_(N, i_1!`%`_iN.0) <= $signed_(N, i_2!`%`_iN.0)))) - -;; 4-numerics.watsup -def $ige_(N : N, sx : sx, iN : iN(N), iN : iN(N)) : u32 - ;; 4-numerics.watsup - def $ige_{N : N, i_1 : iN(N), i_2 : iN(N)}(N, U_sx, i_1, i_2) = `%`_u32($bool((i_1!`%`_iN.0 >= i_2!`%`_iN.0))) - ;; 4-numerics.watsup - def $ige_{N : N, i_1 : iN(N), i_2 : iN(N)}(N, S_sx, i_1, i_2) = `%`_u32($bool(($signed_(N, i_1!`%`_iN.0) >= $signed_(N, i_2!`%`_iN.0)))) - -;; 4-numerics.watsup -def $fabs_(N : N, fN : fN(N)) : fN(N)* - -;; 4-numerics.watsup -def $fneg_(N : N, fN : fN(N)) : fN(N)* - -;; 4-numerics.watsup -def $fsqrt_(N : N, fN : fN(N)) : fN(N)* - -;; 4-numerics.watsup -def $fceil_(N : N, fN : fN(N)) : fN(N)* - -;; 4-numerics.watsup -def $ffloor_(N : N, fN : fN(N)) : fN(N)* - -;; 4-numerics.watsup -def $ftrunc_(N : N, fN : fN(N)) : fN(N)* - -;; 4-numerics.watsup -def $fnearest_(N : N, fN : fN(N)) : fN(N)* - -;; 4-numerics.watsup -def $fadd_(N : N, fN : fN(N), fN : fN(N)) : fN(N)* - -;; 4-numerics.watsup -def $fsub_(N : N, fN : fN(N), fN : fN(N)) : fN(N)* - -;; 4-numerics.watsup -def $fmul_(N : N, fN : fN(N), fN : fN(N)) : fN(N)* - -;; 4-numerics.watsup -def $fdiv_(N : N, fN : fN(N), fN : fN(N)) : fN(N)* - -;; 4-numerics.watsup -def $fmin_(N : N, fN : fN(N), fN : fN(N)) : fN(N)* - -;; 4-numerics.watsup -def $fmax_(N : N, fN : fN(N), fN : fN(N)) : fN(N)* - -;; 4-numerics.watsup -def $fpmin_(N : N, fN : fN(N), fN : fN(N)) : fN(N)* - -;; 4-numerics.watsup -def $fpmax_(N : N, fN : fN(N), fN : fN(N)) : fN(N)* - -;; 4-numerics.watsup -def $frelaxed_min_(N : N, fN : fN(N), fN : fN(N)) : fN(N)* - -;; 4-numerics.watsup -def $frelaxed_max_(N : N, fN : fN(N), fN : fN(N)) : fN(N)* - -;; 4-numerics.watsup -def $fcopysign_(N : N, fN : fN(N), fN : fN(N)) : fN(N)* - -;; 4-numerics.watsup -def $feq_(N : N, fN : fN(N), fN : fN(N)) : u32 - -;; 4-numerics.watsup -def $fne_(N : N, fN : fN(N), fN : fN(N)) : u32 - -;; 4-numerics.watsup -def $flt_(N : N, fN : fN(N), fN : fN(N)) : u32 - -;; 4-numerics.watsup -def $fgt_(N : N, fN : fN(N), fN : fN(N)) : u32 - -;; 4-numerics.watsup -def $fle_(N : N, fN : fN(N), fN : fN(N)) : u32 - -;; 4-numerics.watsup -def $fge_(N : N, fN : fN(N), fN : fN(N)) : u32 - -;; 4-numerics.watsup -def $frelaxed_madd_(N : N, fN : fN(N), fN : fN(N), fN : fN(N)) : fN(N)* - -;; 4-numerics.watsup -def $frelaxed_nmadd_(N : N, fN : fN(N), fN : fN(N), fN : fN(N)) : fN(N)* - -;; 4-numerics.watsup -def $wrap__(M : M, N : N, iN : iN(M)) : iN(N) - -;; 4-numerics.watsup -def $extend__(M : M, N : N, sx : sx, iN : iN(M)) : iN(N) - -;; 4-numerics.watsup -def $trunc__(M : M, N : N, sx : sx, fN : fN(M)) : iN(N)? - -;; 4-numerics.watsup -def $trunc_sat__(M : M, N : N, sx : sx, fN : fN(M)) : iN(N)? - -;; 4-numerics.watsup -def $relaxed_trunc__(M : M, N : N, sx : sx, fN : fN(M)) : iN(N)? - -;; 4-numerics.watsup -def $demote__(M : M, N : N, fN : fN(M)) : fN(N)* - -;; 4-numerics.watsup -def $promote__(M : M, N : N, fN : fN(M)) : fN(N)* - -;; 4-numerics.watsup -def $convert__(M : M, N : N, sx : sx, iN : iN(M)) : fN(N) - -;; 4-numerics.watsup -def $narrow__(M : M, N : N, sx : sx, iN : iN(M)) : iN(N) - -;; 4-numerics.watsup -def $reinterpret__(numtype_1 : numtype, numtype_2 : numtype, num_ : num_(numtype_1)) : num_(numtype_2) - -;; 4-numerics.watsup -def $lpacknum_(lanetype : lanetype, num_ : num_($lunpack(lanetype))) : lane_(lanetype) - ;; 4-numerics.watsup - def $lpacknum_{numtype : numtype, c : num_($lunpack((numtype : numtype <: lanetype)))}((numtype : numtype <: lanetype), c) = c - ;; 4-numerics.watsup - def $lpacknum_{packtype : packtype, c : num_($lunpack((packtype : packtype <: lanetype)))}((packtype : packtype <: lanetype), c) = $wrap__($size($lunpack((packtype : packtype <: lanetype))), $psize(packtype), c) - -;; 4-numerics.watsup -def $lunpacknum_(lanetype : lanetype, lane_ : lane_(lanetype)) : num_($lunpack(lanetype)) - ;; 4-numerics.watsup - def $lunpacknum_{numtype : numtype, c : lane_((numtype : numtype <: lanetype))}((numtype : numtype <: lanetype), c) = c - ;; 4-numerics.watsup - def $lunpacknum_{packtype : packtype, c : lane_((packtype : packtype <: lanetype))}((packtype : packtype <: lanetype), c) = $extend__($psize(packtype), $size($lunpack((packtype : packtype <: lanetype))), U_sx, c) - -;; 4-numerics.watsup -def $cpacknum_(storagetype : storagetype, lit_ : lit_(($cunpack(storagetype) : consttype <: storagetype))) : lit_(storagetype) - ;; 4-numerics.watsup - def $cpacknum_{consttype : consttype, c : lit_(($cunpack((consttype : consttype <: storagetype)) : consttype <: storagetype))}((consttype : consttype <: storagetype), c) = c - ;; 4-numerics.watsup - def $cpacknum_{packtype : packtype, c : lit_(($cunpack((packtype : packtype <: storagetype)) : consttype <: storagetype))}((packtype : packtype <: storagetype), c) = $wrap__($size($lunpack((packtype : packtype <: lanetype))), $psize(packtype), c) - -;; 4-numerics.watsup -def $cunpacknum_(storagetype : storagetype, lit_ : lit_(storagetype)) : lit_(($cunpack(storagetype) : consttype <: storagetype)) - ;; 4-numerics.watsup - def $cunpacknum_{consttype : consttype, c : lit_((consttype : consttype <: storagetype))}((consttype : consttype <: storagetype), c) = c - ;; 4-numerics.watsup - def $cunpacknum_{packtype : packtype, c : lit_((packtype : packtype <: storagetype))}((packtype : packtype <: storagetype), c) = $extend__($psize(packtype), $size($lunpack((packtype : packtype <: lanetype))), U_sx, c) - -;; 4-numerics.watsup -def $unop_(numtype : numtype, unop_ : unop_(numtype), num_ : num_(numtype)) : num_(numtype)* - ;; 4-numerics.watsup - def $unop_{Inn : Inn, i : num_((Inn : Inn <: numtype))}((Inn : Inn <: numtype), CLZ_unop_, i) = [$iclz_($sizenn((Inn : Inn <: numtype)), i)] - ;; 4-numerics.watsup - def $unop_{Inn : Inn, i : num_((Inn : Inn <: numtype))}((Inn : Inn <: numtype), CTZ_unop_, i) = [$ictz_($sizenn((Inn : Inn <: numtype)), i)] - ;; 4-numerics.watsup - def $unop_{Inn : Inn, i : num_((Inn : Inn <: numtype))}((Inn : Inn <: numtype), POPCNT_unop_, i) = [$ipopcnt_($sizenn((Inn : Inn <: numtype)), i)] - ;; 4-numerics.watsup - def $unop_{Inn : Inn, M : M, i : num_((Inn : Inn <: numtype))}((Inn : Inn <: numtype), EXTEND_unop_(`%`_sz(M)), i) = [$iextend_($sizenn((Inn : Inn <: numtype)), M, S_sx, i)] - ;; 4-numerics.watsup - def $unop_{Fnn : Fnn, f : num_((Fnn : Fnn <: numtype))}((Fnn : Fnn <: numtype), ABS_unop_, f) = $fabs_($sizenn((Fnn : Fnn <: numtype)), f) - ;; 4-numerics.watsup - def $unop_{Fnn : Fnn, f : num_((Fnn : Fnn <: numtype))}((Fnn : Fnn <: numtype), NEG_unop_, f) = $fneg_($sizenn((Fnn : Fnn <: numtype)), f) - ;; 4-numerics.watsup - def $unop_{Fnn : Fnn, f : num_((Fnn : Fnn <: numtype))}((Fnn : Fnn <: numtype), SQRT_unop_, f) = $fsqrt_($sizenn((Fnn : Fnn <: numtype)), f) - ;; 4-numerics.watsup - def $unop_{Fnn : Fnn, f : num_((Fnn : Fnn <: numtype))}((Fnn : Fnn <: numtype), CEIL_unop_, f) = $fceil_($sizenn((Fnn : Fnn <: numtype)), f) - ;; 4-numerics.watsup - def $unop_{Fnn : Fnn, f : num_((Fnn : Fnn <: numtype))}((Fnn : Fnn <: numtype), FLOOR_unop_, f) = $ffloor_($sizenn((Fnn : Fnn <: numtype)), f) - ;; 4-numerics.watsup - def $unop_{Fnn : Fnn, f : num_((Fnn : Fnn <: numtype))}((Fnn : Fnn <: numtype), TRUNC_unop_, f) = $ftrunc_($sizenn((Fnn : Fnn <: numtype)), f) - ;; 4-numerics.watsup - def $unop_{Fnn : Fnn, f : num_((Fnn : Fnn <: numtype))}((Fnn : Fnn <: numtype), NEAREST_unop_, f) = $fnearest_($sizenn((Fnn : Fnn <: numtype)), f) - -;; 4-numerics.watsup -def $binop_(numtype : numtype, binop_ : binop_(numtype), num_ : num_(numtype), num_ : num_(numtype)) : num_(numtype)* - ;; 4-numerics.watsup - def $binop_{Inn : Inn, i_1 : num_((Inn : Inn <: numtype)), i_2 : num_((Inn : Inn <: numtype))}((Inn : Inn <: numtype), ADD_binop_, i_1, i_2) = [$iadd_($sizenn((Inn : Inn <: numtype)), i_1, i_2)] - ;; 4-numerics.watsup - def $binop_{Inn : Inn, i_1 : num_((Inn : Inn <: numtype)), i_2 : num_((Inn : Inn <: numtype))}((Inn : Inn <: numtype), SUB_binop_, i_1, i_2) = [$isub_($sizenn((Inn : Inn <: numtype)), i_1, i_2)] - ;; 4-numerics.watsup - def $binop_{Inn : Inn, i_1 : num_((Inn : Inn <: numtype)), i_2 : num_((Inn : Inn <: numtype))}((Inn : Inn <: numtype), MUL_binop_, i_1, i_2) = [$imul_($sizenn((Inn : Inn <: numtype)), i_1, i_2)] - ;; 4-numerics.watsup - def $binop_{Inn : Inn, sx : sx, i_1 : num_((Inn : Inn <: numtype)), i_2 : num_((Inn : Inn <: numtype))}((Inn : Inn <: numtype), DIV_binop_(sx), i_1, i_2) = $list_(syntax num_((Inn : Inn <: numtype)), $idiv_($sizenn((Inn : Inn <: numtype)), sx, i_1, i_2)) - ;; 4-numerics.watsup - def $binop_{Inn : Inn, sx : sx, i_1 : num_((Inn : Inn <: numtype)), i_2 : num_((Inn : Inn <: numtype))}((Inn : Inn <: numtype), REM_binop_(sx), i_1, i_2) = $list_(syntax num_((Inn : Inn <: numtype)), $irem_($sizenn((Inn : Inn <: numtype)), sx, i_1, i_2)) - ;; 4-numerics.watsup - def $binop_{Inn : Inn, i_1 : num_((Inn : Inn <: numtype)), i_2 : num_((Inn : Inn <: numtype))}((Inn : Inn <: numtype), AND_binop_, i_1, i_2) = [$iand_($sizenn((Inn : Inn <: numtype)), i_1, i_2)] - ;; 4-numerics.watsup - def $binop_{Inn : Inn, i_1 : num_((Inn : Inn <: numtype)), i_2 : num_((Inn : Inn <: numtype))}((Inn : Inn <: numtype), OR_binop_, i_1, i_2) = [$ior_($sizenn((Inn : Inn <: numtype)), i_1, i_2)] - ;; 4-numerics.watsup - def $binop_{Inn : Inn, i_1 : num_((Inn : Inn <: numtype)), i_2 : num_((Inn : Inn <: numtype))}((Inn : Inn <: numtype), XOR_binop_, i_1, i_2) = [$ixor_($sizenn((Inn : Inn <: numtype)), i_1, i_2)] - ;; 4-numerics.watsup - def $binop_{Inn : Inn, i_1 : num_((Inn : Inn <: numtype)), i_2 : num_((Inn : Inn <: numtype))}((Inn : Inn <: numtype), SHL_binop_, i_1, i_2) = [$ishl_($sizenn((Inn : Inn <: numtype)), i_1, `%`_u32(i_2!`%`_num_.0))] - ;; 4-numerics.watsup - def $binop_{Inn : Inn, sx : sx, i_1 : num_((Inn : Inn <: numtype)), i_2 : num_((Inn : Inn <: numtype))}((Inn : Inn <: numtype), SHR_binop_(sx), i_1, i_2) = [$ishr_($sizenn((Inn : Inn <: numtype)), sx, i_1, `%`_u32(i_2!`%`_num_.0))] - ;; 4-numerics.watsup - def $binop_{Inn : Inn, i_1 : num_((Inn : Inn <: numtype)), i_2 : num_((Inn : Inn <: numtype))}((Inn : Inn <: numtype), ROTL_binop_, i_1, i_2) = [$irotl_($sizenn((Inn : Inn <: numtype)), i_1, i_2)] - ;; 4-numerics.watsup - def $binop_{Inn : Inn, i_1 : num_((Inn : Inn <: numtype)), i_2 : num_((Inn : Inn <: numtype))}((Inn : Inn <: numtype), ROTR_binop_, i_1, i_2) = [$irotr_($sizenn((Inn : Inn <: numtype)), i_1, i_2)] - ;; 4-numerics.watsup - def $binop_{Fnn : Fnn, f_1 : num_((Fnn : Fnn <: numtype)), f_2 : num_((Fnn : Fnn <: numtype))}((Fnn : Fnn <: numtype), ADD_binop_, f_1, f_2) = $fadd_($sizenn((Fnn : Fnn <: numtype)), f_1, f_2) - ;; 4-numerics.watsup - def $binop_{Fnn : Fnn, f_1 : num_((Fnn : Fnn <: numtype)), f_2 : num_((Fnn : Fnn <: numtype))}((Fnn : Fnn <: numtype), SUB_binop_, f_1, f_2) = $fsub_($sizenn((Fnn : Fnn <: numtype)), f_1, f_2) - ;; 4-numerics.watsup - def $binop_{Fnn : Fnn, f_1 : num_((Fnn : Fnn <: numtype)), f_2 : num_((Fnn : Fnn <: numtype))}((Fnn : Fnn <: numtype), MUL_binop_, f_1, f_2) = $fmul_($sizenn((Fnn : Fnn <: numtype)), f_1, f_2) - ;; 4-numerics.watsup - def $binop_{Fnn : Fnn, f_1 : num_((Fnn : Fnn <: numtype)), f_2 : num_((Fnn : Fnn <: numtype))}((Fnn : Fnn <: numtype), DIV_binop_, f_1, f_2) = $fdiv_($sizenn((Fnn : Fnn <: numtype)), f_1, f_2) - ;; 4-numerics.watsup - def $binop_{Fnn : Fnn, f_1 : num_((Fnn : Fnn <: numtype)), f_2 : num_((Fnn : Fnn <: numtype))}((Fnn : Fnn <: numtype), MIN_binop_, f_1, f_2) = $fmin_($sizenn((Fnn : Fnn <: numtype)), f_1, f_2) - ;; 4-numerics.watsup - def $binop_{Fnn : Fnn, f_1 : num_((Fnn : Fnn <: numtype)), f_2 : num_((Fnn : Fnn <: numtype))}((Fnn : Fnn <: numtype), MAX_binop_, f_1, f_2) = $fmax_($sizenn((Fnn : Fnn <: numtype)), f_1, f_2) - ;; 4-numerics.watsup - def $binop_{Fnn : Fnn, f_1 : num_((Fnn : Fnn <: numtype)), f_2 : num_((Fnn : Fnn <: numtype))}((Fnn : Fnn <: numtype), COPYSIGN_binop_, f_1, f_2) = $fcopysign_($sizenn((Fnn : Fnn <: numtype)), f_1, f_2) - -;; 4-numerics.watsup -def $testop_(numtype : numtype, testop_ : testop_(numtype), num_ : num_(numtype)) : u32 - ;; 4-numerics.watsup - def $testop_{Inn : Inn, i : num_((Inn : Inn <: numtype))}((Inn : Inn <: numtype), EQZ_testop_, i) = $ieqz_($sizenn((Inn : Inn <: numtype)), i) - -;; 4-numerics.watsup -def $relop_(numtype : numtype, relop_ : relop_(numtype), num_ : num_(numtype), num_ : num_(numtype)) : u32 - ;; 4-numerics.watsup - def $relop_{Inn : Inn, i_1 : num_((Inn : Inn <: numtype)), i_2 : num_((Inn : Inn <: numtype))}((Inn : Inn <: numtype), EQ_relop_, i_1, i_2) = $ieq_($sizenn((Inn : Inn <: numtype)), i_1, i_2) - ;; 4-numerics.watsup - def $relop_{Inn : Inn, i_1 : num_((Inn : Inn <: numtype)), i_2 : num_((Inn : Inn <: numtype))}((Inn : Inn <: numtype), NE_relop_, i_1, i_2) = $ine_($sizenn((Inn : Inn <: numtype)), i_1, i_2) - ;; 4-numerics.watsup - def $relop_{Inn : Inn, sx : sx, i_1 : num_((Inn : Inn <: numtype)), i_2 : num_((Inn : Inn <: numtype))}((Inn : Inn <: numtype), LT_relop_(sx), i_1, i_2) = $ilt_($sizenn((Inn : Inn <: numtype)), sx, i_1, i_2) - ;; 4-numerics.watsup - def $relop_{Inn : Inn, sx : sx, i_1 : num_((Inn : Inn <: numtype)), i_2 : num_((Inn : Inn <: numtype))}((Inn : Inn <: numtype), GT_relop_(sx), i_1, i_2) = $igt_($sizenn((Inn : Inn <: numtype)), sx, i_1, i_2) - ;; 4-numerics.watsup - def $relop_{Inn : Inn, sx : sx, i_1 : num_((Inn : Inn <: numtype)), i_2 : num_((Inn : Inn <: numtype))}((Inn : Inn <: numtype), LE_relop_(sx), i_1, i_2) = $ile_($sizenn((Inn : Inn <: numtype)), sx, i_1, i_2) - ;; 4-numerics.watsup - def $relop_{Inn : Inn, sx : sx, i_1 : num_((Inn : Inn <: numtype)), i_2 : num_((Inn : Inn <: numtype))}((Inn : Inn <: numtype), GE_relop_(sx), i_1, i_2) = $ige_($sizenn((Inn : Inn <: numtype)), sx, i_1, i_2) - ;; 4-numerics.watsup - def $relop_{Fnn : Fnn, f_1 : num_((Fnn : Fnn <: numtype)), f_2 : num_((Fnn : Fnn <: numtype))}((Fnn : Fnn <: numtype), EQ_relop_, f_1, f_2) = $feq_($sizenn((Fnn : Fnn <: numtype)), f_1, f_2) - ;; 4-numerics.watsup - def $relop_{Fnn : Fnn, f_1 : num_((Fnn : Fnn <: numtype)), f_2 : num_((Fnn : Fnn <: numtype))}((Fnn : Fnn <: numtype), NE_relop_, f_1, f_2) = $fne_($sizenn((Fnn : Fnn <: numtype)), f_1, f_2) - ;; 4-numerics.watsup - def $relop_{Fnn : Fnn, f_1 : num_((Fnn : Fnn <: numtype)), f_2 : num_((Fnn : Fnn <: numtype))}((Fnn : Fnn <: numtype), LT_relop_, f_1, f_2) = $flt_($sizenn((Fnn : Fnn <: numtype)), f_1, f_2) - ;; 4-numerics.watsup - def $relop_{Fnn : Fnn, f_1 : num_((Fnn : Fnn <: numtype)), f_2 : num_((Fnn : Fnn <: numtype))}((Fnn : Fnn <: numtype), GT_relop_, f_1, f_2) = $fgt_($sizenn((Fnn : Fnn <: numtype)), f_1, f_2) - ;; 4-numerics.watsup - def $relop_{Fnn : Fnn, f_1 : num_((Fnn : Fnn <: numtype)), f_2 : num_((Fnn : Fnn <: numtype))}((Fnn : Fnn <: numtype), LE_relop_, f_1, f_2) = $fle_($sizenn((Fnn : Fnn <: numtype)), f_1, f_2) - ;; 4-numerics.watsup - def $relop_{Fnn : Fnn, f_1 : num_((Fnn : Fnn <: numtype)), f_2 : num_((Fnn : Fnn <: numtype))}((Fnn : Fnn <: numtype), GE_relop_, f_1, f_2) = $fge_($sizenn((Fnn : Fnn <: numtype)), f_1, f_2) - -;; 4-numerics.watsup -def $cvtop__(numtype_1 : numtype, numtype_2 : numtype, cvtop__ : cvtop__(numtype_1, numtype_2), num_ : num_(numtype_1)) : num_(numtype_2)* - ;; 4-numerics.watsup - def $cvtop__{Inn_1 : Inn, Inn_2 : Inn, sx : sx, i_1 : num_((Inn_1 : Inn <: numtype))}((Inn_1 : Inn <: numtype), (Inn_2 : Inn <: numtype), EXTEND_cvtop__(sx), i_1) = [$extend__($sizenn1((Inn_1 : Inn <: numtype)), $sizenn2((Inn_2 : Inn <: numtype)), sx, i_1)] - ;; 4-numerics.watsup - def $cvtop__{Inn_1 : Inn, Inn_2 : Inn, i_1 : num_((Inn_1 : Inn <: numtype))}((Inn_1 : Inn <: numtype), (Inn_2 : Inn <: numtype), WRAP_cvtop__, i_1) = [$wrap__($sizenn1((Inn_1 : Inn <: numtype)), $sizenn2((Inn_2 : Inn <: numtype)), i_1)] - ;; 4-numerics.watsup - def $cvtop__{Fnn_1 : Fnn, Inn_2 : Inn, sx : sx, f_1 : num_((Fnn_1 : Fnn <: numtype))}((Fnn_1 : Fnn <: numtype), (Inn_2 : Inn <: numtype), TRUNC_cvtop__(sx), f_1) = $list_(syntax num_((Inn_2 : Inn <: numtype)), $trunc__($sizenn1((Fnn_1 : Fnn <: numtype)), $sizenn2((Inn_2 : Inn <: numtype)), sx, f_1)) - ;; 4-numerics.watsup - def $cvtop__{Fnn_1 : Fnn, Inn_2 : Inn, sx : sx, f_1 : num_((Fnn_1 : Fnn <: numtype))}((Fnn_1 : Fnn <: numtype), (Inn_2 : Inn <: numtype), TRUNC_SAT_cvtop__(sx), f_1) = $list_(syntax num_((Inn_2 : Inn <: numtype)), $trunc_sat__($sizenn1((Fnn_1 : Fnn <: numtype)), $sizenn2((Inn_2 : Inn <: numtype)), sx, f_1)) - ;; 4-numerics.watsup - def $cvtop__{Inn_1 : Inn, Fnn_2 : Fnn, sx : sx, i_1 : num_((Inn_1 : Inn <: numtype))}((Inn_1 : Inn <: numtype), (Fnn_2 : Fnn <: numtype), CONVERT_cvtop__(sx), i_1) = [$convert__($sizenn1((Inn_1 : Inn <: numtype)), $sizenn2((Fnn_2 : Fnn <: numtype)), sx, i_1)] - ;; 4-numerics.watsup - def $cvtop__{Fnn_1 : Fnn, Fnn_2 : Fnn, f_1 : num_((Fnn_1 : Fnn <: numtype))}((Fnn_1 : Fnn <: numtype), (Fnn_2 : Fnn <: numtype), PROMOTE_cvtop__, f_1) = $promote__($sizenn1((Fnn_1 : Fnn <: numtype)), $sizenn2((Fnn_2 : Fnn <: numtype)), f_1) - ;; 4-numerics.watsup - def $cvtop__{Fnn_1 : Fnn, Fnn_2 : Fnn, f_1 : num_((Fnn_1 : Fnn <: numtype))}((Fnn_1 : Fnn <: numtype), (Fnn_2 : Fnn <: numtype), DEMOTE_cvtop__, f_1) = $demote__($sizenn1((Fnn_1 : Fnn <: numtype)), $sizenn2((Fnn_2 : Fnn <: numtype)), f_1) - ;; 4-numerics.watsup - def $cvtop__{Inn_1 : Inn, Fnn_2 : Fnn, i_1 : num_((Inn_1 : Inn <: numtype))}((Inn_1 : Inn <: numtype), (Fnn_2 : Fnn <: numtype), REINTERPRET_cvtop__, i_1) = [$reinterpret__((Inn_1 : Inn <: numtype), (Fnn_2 : Fnn <: numtype), i_1)] - -- if ($size((Inn_1 : Inn <: numtype)) = $size((Fnn_2 : Fnn <: numtype))) - ;; 4-numerics.watsup - def $cvtop__{Fnn_1 : Fnn, Inn_2 : Inn, f_1 : num_((Fnn_1 : Fnn <: numtype))}((Fnn_1 : Fnn <: numtype), (Inn_2 : Inn <: numtype), REINTERPRET_cvtop__, f_1) = [$reinterpret__((Fnn_1 : Fnn <: numtype), (Inn_2 : Inn <: numtype), f_1)] - -- if ($size((Fnn_1 : Fnn <: numtype)) = $size((Inn_2 : Inn <: numtype))) - -;; 4-numerics.watsup -def $lanes_(shape : shape, vec_ : vec_(V128_Vnn)) : lane_($lanetype(shape))* - -;; 4-numerics.watsup -def $invlanes_(shape : shape, lane_($lanetype(shape))*) : vec_(V128_Vnn) - ;; 4-numerics.watsup - def $invlanes_{sh : shape, `c*` : lane_($lanetype(sh))*, vc : vec_(V128_Vnn)}(sh, c*{c <- `c*`}) = vc - -- if (c*{c <- `c*`} = $lanes_(sh, vc)) - -;; 4-numerics.watsup -def $half__(shape_1 : shape, shape_2 : shape, half__ : half__(shape_1, shape_2), nat : nat, nat : nat) : nat - ;; 4-numerics.watsup - def $half__{Jnn_1 : Jnn, M_1 : M, Jnn_2 : Jnn, M_2 : M, i : nat, j : nat}(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2)), LOW_half__, i, j) = i - ;; 4-numerics.watsup - def $half__{Jnn_1 : Jnn, M_1 : M, Jnn_2 : Jnn, M_2 : M, i : nat, j : nat}(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2)), HIGH_half__, i, j) = j - ;; 4-numerics.watsup - def $half__{Lnn_1 : Lnn, M_1 : M, Fnn_2 : Fnn, M_2 : M, i : nat, j : nat}(`%X%`_shape(Lnn_1, `%`_dim(M_1)), `%X%`_shape((Fnn_2 : Fnn <: lanetype), `%`_dim(M_2)), LOW_half__, i, j) = i - -;; 4-numerics.watsup -def $iswizzle_lane_(N : N, iN(N)*, iN : iN(N)) : iN(N) - ;; 4-numerics.watsup - def $iswizzle_lane_{N : N, `c*` : iN(N)*, i : iN(N)}(N, c*{c <- `c*`}, i) = c*{c <- `c*`}[i!`%`_iN.0] - -- if (i!`%`_iN.0 < |c*{c <- `c*`}|) - ;; 4-numerics.watsup - def $iswizzle_lane_{N : N, `c*` : iN(N)*, i : iN(N)}(N, c*{c <- `c*`}, i) = `%`_iN(0) - -- otherwise - -;; 4-numerics.watsup -def $irelaxed_swizzle_lane_(N : N, iN(N)*, iN : iN(N)) : iN(N) - ;; 4-numerics.watsup - def $irelaxed_swizzle_lane_{N : N, `c*` : iN(N)*, i : iN(N)}(N, c*{c <- `c*`}, i) = c*{c <- `c*`}[i!`%`_iN.0] - -- if (i!`%`_iN.0 < |c*{c <- `c*`}|) - ;; 4-numerics.watsup - def $irelaxed_swizzle_lane_{N : N, `c*` : iN(N)*, i : iN(N)}(N, c*{c <- `c*`}, i) = `%`_iN(0) - -- if ($signed_(N, i!`%`_iN.0) < (0 : nat <:> int)) - ;; 4-numerics.watsup - def $irelaxed_swizzle_lane_{N : N, `c*` : iN(N)*, i : iN(N)}(N, c*{c <- `c*`}, i) = $relaxed2($R_swizzle, syntax iN(N), `%`_iN(0), c*{c <- `c*`}[(i!`%`_iN.0 \ |c*{c <- `c*`}|)]) - -- otherwise - -;; 4-numerics.watsup -def $ivunop_(shape : shape, def $f_(N : N, iN : iN(N)) : iN(N), vec_ : vec_(V128_Vnn)) : vec_(V128_Vnn)* - ;; 4-numerics.watsup - def $ivunop_{Jnn : Jnn, M : M, def $f_(N : N, iN : iN(N)) : iN(N), v_1 : vec_(V128_Vnn), `c*` : lane_($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))))*, `c_1*` : lane_($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))))*}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), def $f_, v_1) = [$invlanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), c*{c <- `c*`})] - -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), v_1)) - -- if (c*{c <- `c*`} = $f_($lsizenn((Jnn : Jnn <: lanetype)), c_1)*{c_1 <- `c_1*`}) - -;; 4-numerics.watsup -def $fvunop_(shape : shape, def $f_(N : N, fN : fN(N)) : fN(N)*, vec_ : vec_(V128_Vnn)) : vec_(V128_Vnn)* - ;; 4-numerics.watsup - def $fvunop_{Fnn : Fnn, M : M, def $f_(N : N, fN : fN(N)) : fN(N)*, v_1 : vec_(V128_Vnn), `c**` : lane_($lanetype(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M))))**, `c_1*` : lane_($lanetype(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M))))*}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), def $f_, v_1) = $invlanes_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), c*{c <- `c*`})*{`c*` <- `c**`} - -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), v_1)) - -- if (c*{c <- `c*`}*{`c*` <- `c**`} = $setproduct_(syntax lane_((Fnn : Fnn <: lanetype)), $f_($sizenn((Fnn : Fnn <: numtype)), c_1)*{c_1 <- `c_1*`})) - -;; 4-numerics.watsup -def $ivbinop_(shape : shape, def $f_(N : N, iN : iN(N), iN : iN(N)) : iN(N), vec_ : vec_(V128_Vnn), vec_ : vec_(V128_Vnn)) : vec_(V128_Vnn)* - ;; 4-numerics.watsup - def $ivbinop_{Jnn : Jnn, M : M, def $f_(N : N, iN : iN(N), iN : iN(N)) : iN(N), v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn), `c*` : lane_($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))))*, `c_1*` : lane_($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))))*, `c_2*` : lane_($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))))*}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), def $f_, v_1, v_2) = [$invlanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), 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 (c*{c <- `c*`} = $f_($lsizenn((Jnn : Jnn <: lanetype)), c_1, c_2)*{c_1 <- `c_1*`, c_2 <- `c_2*`}) - -;; 4-numerics.watsup -def $ivbinopsx_(shape : shape, def $f_(N : N, sx : sx, iN : iN(N), iN : iN(N)) : iN(N), sx : sx, vec_ : vec_(V128_Vnn), vec_ : vec_(V128_Vnn)) : vec_(V128_Vnn)* - ;; 4-numerics.watsup - def $ivbinopsx_{Jnn : Jnn, M : M, def $f_(N : N, sx : sx, iN : iN(N), iN : iN(N)) : iN(N), sx : sx, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn), `c*` : lane_($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))))*, `c_1*` : lane_($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))))*, `c_2*` : lane_($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))))*}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), def $f_, sx, v_1, v_2) = [$invlanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), 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 (c*{c <- `c*`} = $f_($lsizenn((Jnn : Jnn <: lanetype)), sx, c_1, c_2)*{c_1 <- `c_1*`, c_2 <- `c_2*`}) - -;; 4-numerics.watsup -def $ivbinopsxnd_(shape : shape, def $f_(N : N, sx : sx, iN : iN(N), iN : iN(N)) : iN(N)*, sx : sx, vec_ : vec_(V128_Vnn), vec_ : vec_(V128_Vnn)) : vec_(V128_Vnn)* - ;; 4-numerics.watsup - def $ivbinopsxnd_{Jnn : Jnn, M : M, def $f_(N : N, sx : sx, iN : iN(N), iN : iN(N)) : iN(N)*, sx : sx, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn), `c**` : lane_($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))))**, `c_1*` : lane_($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))))*, `c_2*` : lane_($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))))*}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), def $f_, sx, v_1, v_2) = $invlanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), c*{c <- `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 (c*{c <- `c*`}*{`c*` <- `c**`} = $setproduct_(syntax lane_((Jnn : Jnn <: lanetype)), $f_($lsizenn((Jnn : Jnn <: lanetype)), sx, c_1, c_2)*{c_1 <- `c_1*`, c_2 <- `c_2*`})) - -;; 4-numerics.watsup -def $fvbinop_(shape : shape, def $f_(N : N, fN : fN(N), fN : fN(N)) : fN(N)*, vec_ : vec_(V128_Vnn), vec_ : vec_(V128_Vnn)) : vec_(V128_Vnn)* - ;; 4-numerics.watsup - def $fvbinop_{Fnn : Fnn, M : M, def $f_(N : N, fN : fN(N), fN : fN(N)) : fN(N)*, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn), `c**` : lane_($lanetype(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M))))**, `c_1*` : lane_($lanetype(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M))))*, `c_2*` : lane_($lanetype(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M))))*}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), def $f_, v_1, v_2) = $invlanes_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), c*{c <- `c*`})*{`c*` <- `c**`} - -- 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)) - -- if (c*{c <- `c*`}*{`c*` <- `c**`} = $setproduct_(syntax lane_((Fnn : Fnn <: lanetype)), $f_($sizenn((Fnn : Fnn <: numtype)), c_1, c_2)*{c_1 <- `c_1*`, c_2 <- `c_2*`})) - -;; 4-numerics.watsup -def $ivternopnd_(shape : shape, def $f_(N : N, iN : iN(N), iN : iN(N), iN : iN(N)) : iN(N)*, vec_ : vec_(V128_Vnn), vec_ : vec_(V128_Vnn), vec_ : vec_(V128_Vnn)) : vec_(V128_Vnn)* - ;; 4-numerics.watsup - def $ivternopnd_{Jnn : Jnn, M : M, def $f_(N : N, iN : iN(N), iN : iN(N), iN : iN(N)) : iN(N)*, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn), v_3 : vec_(V128_Vnn), `c**` : lane_($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))))**, `c_1*` : lane_($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))))*, `c_2*` : lane_($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))))*, `c_3*` : lane_($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))))*}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), def $f_, v_1, v_2, v_3) = $invlanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), c*{c <- `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 (c_3*{c_3 <- `c_3*`} = $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), v_3)) - -- if (c*{c <- `c*`}*{`c*` <- `c**`} = $setproduct_(syntax lane_((Jnn : Jnn <: lanetype)), $f_($lsizenn((Jnn : Jnn <: lanetype)), c_1, c_2, c_3)*{c_1 <- `c_1*`, c_2 <- `c_2*`, c_3 <- `c_3*`})) - -;; 4-numerics.watsup -def $fvternop_(shape : shape, def $f_(N : N, fN : fN(N), fN : fN(N), fN : fN(N)) : fN(N)*, vec_ : vec_(V128_Vnn), vec_ : vec_(V128_Vnn), vec_ : vec_(V128_Vnn)) : vec_(V128_Vnn)* - ;; 4-numerics.watsup - def $fvternop_{Fnn : Fnn, M : M, def $f_(N : N, fN : fN(N), fN : fN(N), fN : fN(N)) : fN(N)*, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn), v_3 : vec_(V128_Vnn), `c**` : lane_($lanetype(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M))))**, `c_1*` : lane_($lanetype(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M))))*, `c_2*` : lane_($lanetype(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M))))*, `c_3*` : lane_($lanetype(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M))))*}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), def $f_, v_1, v_2, v_3) = $invlanes_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), c*{c <- `c*`})*{`c*` <- `c**`} - -- 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)) - -- if (c_3*{c_3 <- `c_3*`} = $lanes_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), v_3)) - -- if (c*{c <- `c*`}*{`c*` <- `c**`} = $setproduct_(syntax lane_((Fnn : Fnn <: lanetype)), $f_($sizenn((Fnn : Fnn <: numtype)), c_1, c_2, c_3)*{c_1 <- `c_1*`, c_2 <- `c_2*`, c_3 <- `c_3*`})) - -;; 4-numerics.watsup -def $ivtestop_(shape : shape, def $f_(N : N, iN : iN(N)) : u32, vec_ : vec_(V128_Vnn)) : u32 - ;; 4-numerics.watsup - def $ivtestop_{Jnn : Jnn, M : M, def $f_(N : N, iN : iN(N)) : u32, v_1 : vec_(V128_Vnn), `c*` : nat*, `c_1*` : lane_($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))))*}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), def $f_, v_1) = `%`_u32($prod(c*{c <- `c*`})) - -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), v_1)) - -- if (`%`_u32(c)*{c <- `c*`} = $f_($lsizenn((Jnn : Jnn <: lanetype)), c_1)*{c_1 <- `c_1*`}) - -;; 4-numerics.watsup -def $fvtestop_(shape : shape, def $f_(N : N, fN : fN(N)) : u32, vec_ : vec_(V128_Vnn)) : u32 - ;; 4-numerics.watsup - def $fvtestop_{Fnn : Fnn, M : M, def $f_(N : N, fN : fN(N)) : u32, v_1 : vec_(V128_Vnn), `c*` : nat*, `c_1*` : lane_($lanetype(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M))))*}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), def $f_, v_1) = `%`_u32($prod(c*{c <- `c*`})) - -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), v_1)) - -- if (`%`_u32(c)*{c <- `c*`} = $f_($sizenn((Fnn : Fnn <: numtype)), c_1)*{c_1 <- `c_1*`}) - -;; 4-numerics.watsup -def $ivrelop_(shape : shape, def $f_(N : N, iN : iN(N), iN : iN(N)) : u32, vec_ : vec_(V128_Vnn), vec_ : vec_(V128_Vnn)) : vec_(V128_Vnn) - ;; 4-numerics.watsup - def $ivrelop_{Jnn : Jnn, M : M, def $f_(N : N, iN : iN(N), iN : iN(N)) : u32, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn), `c*` : lane_($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))))*, `c_1*` : lane_($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))))*, `c_2*` : lane_($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))))*}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), def $f_, v_1, v_2) = $invlanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), 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 (c*{c <- `c*`} = $extend__(1, $lsizenn((Jnn : Jnn <: lanetype)), S_sx, `%`_iN($f_($lsizenn((Jnn : Jnn <: lanetype)), c_1, c_2)!`%`_u32.0))*{c_1 <- `c_1*`, c_2 <- `c_2*`}) - -;; 4-numerics.watsup -def $ivrelopsx_(shape : shape, def $f_(N : N, sx : sx, iN : iN(N), iN : iN(N)) : u32, sx : sx, vec_ : vec_(V128_Vnn), vec_ : vec_(V128_Vnn)) : vec_(V128_Vnn) - ;; 4-numerics.watsup - def $ivrelopsx_{Jnn : Jnn, M : M, def $f_(N : N, sx : sx, iN : iN(N), iN : iN(N)) : u32, sx : sx, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn), `c*` : lane_($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))))*, `c_1*` : lane_($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))))*, `c_2*` : lane_($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))))*}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), def $f_, sx, v_1, v_2) = $invlanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), 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 (c*{c <- `c*`} = $extend__(1, $lsizenn((Jnn : Jnn <: lanetype)), S_sx, `%`_iN($f_($lsizenn((Jnn : Jnn <: lanetype)), sx, c_1, c_2)!`%`_u32.0))*{c_1 <- `c_1*`, c_2 <- `c_2*`}) - -;; 4-numerics.watsup -def $fvrelop_(shape : shape, def $f_(N : N, fN : fN(N), fN : fN(N)) : u32, vec_ : vec_(V128_Vnn), vec_ : vec_(V128_Vnn)) : vec_(V128_Vnn) - ;; 4-numerics.watsup - def $fvrelop_{Fnn : Fnn, M : M, def $f_(N : N, fN : fN(N), fN : fN(N)) : u32, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn), Inn : Inn, `c*` : lane_($lanetype(`%X%`_shape((Inn : Inn <: lanetype), `%`_dim(M))))*, `c_1*` : lane_($lanetype(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M))))*, `c_2*` : lane_($lanetype(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M))))*}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), def $f_, v_1, v_2) = $invlanes_(`%X%`_shape((Inn : Inn <: lanetype), `%`_dim(M)), c*{c <- `c*`}) - -- 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)) - -- if (`%`_iN(c!`%`_lane_.0)*{c <- `c*`} = $extend__(1, $sizenn((Fnn : Fnn <: numtype)), S_sx, `%`_iN($f_($sizenn((Fnn : Fnn <: numtype)), c_1, c_2)!`%`_u32.0))*{c_1 <- `c_1*`, c_2 <- `c_2*`}) - -- if ($size((Inn : Inn <: numtype)) = $size((Fnn : Fnn <: numtype))) - -;; 4-numerics.watsup -def $ivshiftop_(shape : shape, def $f_(N : N, iN : iN(N), u32 : u32) : iN(N), vec_ : vec_(V128_Vnn), u32 : u32) : vec_(V128_Vnn) - ;; 4-numerics.watsup - def $ivshiftop_{Jnn : Jnn, M : M, def $f_(N : N, iN : iN(N), u32 : u32) : iN(N), v_1 : vec_(V128_Vnn), i : u32, `c*` : lane_($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))))*, `c_1*` : lane_($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))))*}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), def $f_, v_1, i) = $invlanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), c*{c <- `c*`}) - -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), v_1)) - -- if (c*{c <- `c*`} = $f_($lsizenn((Jnn : Jnn <: lanetype)), c_1, i)*{c_1 <- `c_1*`}) - -;; 4-numerics.watsup -def $ivshiftopsx_(shape : shape, def $f_(N : N, sx : sx, iN : iN(N), u32 : u32) : iN(N), sx : sx, vec_ : vec_(V128_Vnn), u32 : u32) : vec_(V128_Vnn) - ;; 4-numerics.watsup - def $ivshiftopsx_{Jnn : Jnn, M : M, def $f_(N : N, sx : sx, iN : iN(N), u32 : u32) : iN(N), sx : sx, v_1 : vec_(V128_Vnn), i : u32, `c*` : lane_($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))))*, `c_1*` : lane_($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))))*}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), def $f_, sx, v_1, i) = $invlanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), c*{c <- `c*`}) - -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), v_1)) - -- if (c*{c <- `c*`} = $f_($lsizenn((Jnn : Jnn <: lanetype)), sx, c_1, i)*{c_1 <- `c_1*`}) - -;; 4-numerics.watsup -def $ivbitmaskop_(shape : shape, vec_ : vec_(V128_Vnn)) : u32 - ;; 4-numerics.watsup - def $ivbitmaskop_{Jnn : Jnn, M : M, v_1 : vec_(V128_Vnn), c : u32, `c_1*` : lane_($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))))*}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), v_1) = c - -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), v_1)) - -- if ($ibits_(32, c) = `%`_bit($ilt_($lsize((Jnn : Jnn <: lanetype)), S_sx, c_1, `%`_iN(0))!`%`_u32.0)*{c_1 <- `c_1*`}) - -;; 4-numerics.watsup -def $ivswizzlop_(shape : shape, def $f_(N : N, iN(N)*, iN : iN(N)) : iN(N), vec_ : vec_(V128_Vnn), vec_ : vec_(V128_Vnn)) : vec_(V128_Vnn) - ;; 4-numerics.watsup - def $ivswizzlop_{Jnn : Jnn, M : M, def $f_(N : N, iN(N)*, iN : iN(N)) : iN(N), v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn), `c*` : lane_($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))))*, `c_1*` : lane_($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))))*, `c_2*` : lane_($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))))*}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), def $f_, v_1, v_2) = $invlanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), 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 (c*{c <- `c*`} = $f_($lsizenn((Jnn : Jnn <: lanetype)), c_1*{c_1 <- `c_1*`}, c_2)*{c_2 <- `c_2*`}) - -;; 4-numerics.watsup -def $ivshufflop_(shape : shape, laneidx*, vec_ : vec_(V128_Vnn), vec_ : vec_(V128_Vnn)) : vec_(V128_Vnn) - ;; 4-numerics.watsup - def $ivshufflop_{Jnn : Jnn, M : M, `i*` : laneidx*, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn), `c*` : lane_($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))))*, `c_1*` : lane_($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))))*, `c_2*` : lane_($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))))*}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), i*{i <- `i*`}, v_1, v_2) = $invlanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), 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 (c*{c <- `c*`} = c_1*{c_1 <- `c_1*`} ++ c_2*{c_2 <- `c_2*`}[i!`%`_laneidx.0]*{i <- `i*`}) - -;; 4-numerics.watsup -def $vvunop_(vectype : vectype, vvunop : vvunop, vec_ : vec_(vectype)) : vec_(vectype)* - ;; 4-numerics.watsup - def $vvunop_{Vnn : Vnn, v : vec_(Vnn)}(Vnn, NOT_vvunop, v) = [$inot_($vsizenn(Vnn), v)] - -;; 4-numerics.watsup -def $vvbinop_(vectype : vectype, vvbinop : vvbinop, vec_ : vec_(vectype), vec_ : vec_(vectype)) : vec_(vectype)* - ;; 4-numerics.watsup - def $vvbinop_{Vnn : Vnn, v_1 : vec_(Vnn), v_2 : vec_(Vnn)}(Vnn, AND_vvbinop, v_1, v_2) = [$iand_($vsizenn(Vnn), v_1, v_2)] - ;; 4-numerics.watsup - def $vvbinop_{Vnn : Vnn, v_1 : vec_(Vnn), v_2 : vec_(Vnn)}(Vnn, ANDNOT_vvbinop, v_1, v_2) = [$iandnot_($vsizenn(Vnn), v_1, v_2)] - ;; 4-numerics.watsup - def $vvbinop_{Vnn : Vnn, v_1 : vec_(Vnn), v_2 : vec_(Vnn)}(Vnn, OR_vvbinop, v_1, v_2) = [$ior_($vsizenn(Vnn), v_1, v_2)] - ;; 4-numerics.watsup - def $vvbinop_{Vnn : Vnn, v_1 : vec_(Vnn), v_2 : vec_(Vnn)}(Vnn, XOR_vvbinop, v_1, v_2) = [$ixor_($vsizenn(Vnn), v_1, v_2)] - -;; 4-numerics.watsup -def $vvternop_(vectype : vectype, vvternop : vvternop, vec_ : vec_(vectype), vec_ : vec_(vectype), vec_ : vec_(vectype)) : vec_(vectype)* - ;; 4-numerics.watsup - def $vvternop_{Vnn : Vnn, v_1 : vec_(Vnn), v_2 : vec_(Vnn), v_3 : vec_(Vnn)}(Vnn, BITSELECT_vvternop, v_1, v_2, v_3) = [$ibitselect_($vsizenn(Vnn), v_1, v_2, v_3)] - -;; 4-numerics.watsup -def $vunop_(shape : shape, vunop_ : vunop_(shape), vec_ : vec_(V128_Vnn)) : vec_(V128_Vnn)* - ;; 4-numerics.watsup - def $vunop_{Fnn : Fnn, M : M, v : vec_(V128_Vnn)}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), ABS_vunop_, v) = $fvunop_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), def $fabs_, v) - ;; 4-numerics.watsup - def $vunop_{Fnn : Fnn, M : M, v : vec_(V128_Vnn)}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), NEG_vunop_, v) = $fvunop_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), def $fneg_, v) - ;; 4-numerics.watsup - def $vunop_{Fnn : Fnn, M : M, v : vec_(V128_Vnn)}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), SQRT_vunop_, v) = $fvunop_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), def $fsqrt_, v) - ;; 4-numerics.watsup - def $vunop_{Fnn : Fnn, M : M, v : vec_(V128_Vnn)}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), CEIL_vunop_, v) = $fvunop_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), def $fceil_, v) - ;; 4-numerics.watsup - def $vunop_{Fnn : Fnn, M : M, v : vec_(V128_Vnn)}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), FLOOR_vunop_, v) = $fvunop_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), def $ffloor_, v) - ;; 4-numerics.watsup - def $vunop_{Fnn : Fnn, M : M, v : vec_(V128_Vnn)}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), TRUNC_vunop_, v) = $fvunop_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), def $ftrunc_, v) - ;; 4-numerics.watsup - def $vunop_{Fnn : Fnn, M : M, v : vec_(V128_Vnn)}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), NEAREST_vunop_, v) = $fvunop_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), def $fnearest_, v) - ;; 4-numerics.watsup - def $vunop_{Jnn : Jnn, M : M, v : vec_(V128_Vnn)}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), ABS_vunop_, v) = $ivunop_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), def $iabs_, v) - ;; 4-numerics.watsup - def $vunop_{Jnn : Jnn, M : M, v : vec_(V128_Vnn)}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), NEG_vunop_, v) = $ivunop_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), def $ineg_, v) - ;; 4-numerics.watsup - def $vunop_{Jnn : Jnn, M : M, v : vec_(V128_Vnn)}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), POPCNT_vunop_, v) = $ivunop_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), def $ipopcnt_, v) - -;; 4-numerics.watsup -def $vbinop_(shape : shape, vbinop_ : vbinop_(shape), vec_ : vec_(V128_Vnn), vec_ : vec_(V128_Vnn)) : vec_(V128_Vnn)* - ;; 4-numerics.watsup - def $vbinop_{Jnn : Jnn, M : M, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn)}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), ADD_vbinop_, v_1, v_2) = $ivbinop_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), def $iadd_, v_1, v_2) - ;; 4-numerics.watsup - def $vbinop_{Jnn : Jnn, M : M, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn)}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), SUB_vbinop_, v_1, v_2) = $ivbinop_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), def $isub_, v_1, v_2) - ;; 4-numerics.watsup - def $vbinop_{Jnn : Jnn, M : M, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn)}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), MUL_vbinop_, v_1, v_2) = $ivbinop_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), def $imul_, v_1, v_2) - ;; 4-numerics.watsup - def $vbinop_{Jnn : Jnn, M : M, sx : sx, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn)}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), ADD_SAT_vbinop_(sx), v_1, v_2) = $ivbinopsx_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), def $iadd_sat_, sx, v_1, v_2) - ;; 4-numerics.watsup - def $vbinop_{Jnn : Jnn, M : M, sx : sx, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn)}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), SUB_SAT_vbinop_(sx), v_1, v_2) = $ivbinopsx_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), def $isub_sat_, sx, v_1, v_2) - ;; 4-numerics.watsup - def $vbinop_{Jnn : Jnn, M : M, sx : sx, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn)}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), MIN_vbinop_(sx), v_1, v_2) = $ivbinopsx_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), def $imin_, sx, v_1, v_2) - ;; 4-numerics.watsup - def $vbinop_{Jnn : Jnn, M : M, sx : sx, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn)}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), MAX_vbinop_(sx), v_1, v_2) = $ivbinopsx_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), def $imax_, sx, v_1, v_2) - ;; 4-numerics.watsup - def $vbinop_{Jnn : Jnn, M : M, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn)}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), `AVGRU`_vbinop_, v_1, v_2) = $ivbinopsx_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), def $iavgr_, U_sx, v_1, v_2) - ;; 4-numerics.watsup - def $vbinop_{Jnn : Jnn, M : M, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn)}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), `Q15MULR_SATS`_vbinop_, v_1, v_2) = $ivbinopsx_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), def $iq15mulr_sat_, S_sx, v_1, v_2) - ;; 4-numerics.watsup - def $vbinop_{Jnn : Jnn, M : M, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn)}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), `RELAXED_Q15MULRS`_vbinop_, v_1, v_2) = $ivbinopsxnd_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), def $irelaxed_q15mulr_, S_sx, v_1, v_2) - ;; 4-numerics.watsup - def $vbinop_{Fnn : Fnn, M : M, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn)}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), ADD_vbinop_, v_1, v_2) = $fvbinop_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), def $fadd_, v_1, v_2) - ;; 4-numerics.watsup - def $vbinop_{Fnn : Fnn, M : M, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn)}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), SUB_vbinop_, v_1, v_2) = $fvbinop_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), def $fsub_, v_1, v_2) - ;; 4-numerics.watsup - def $vbinop_{Fnn : Fnn, M : M, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn)}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), MUL_vbinop_, v_1, v_2) = $fvbinop_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), def $fmul_, v_1, v_2) - ;; 4-numerics.watsup - def $vbinop_{Fnn : Fnn, M : M, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn)}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), DIV_vbinop_, v_1, v_2) = $fvbinop_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), def $fdiv_, v_1, v_2) - ;; 4-numerics.watsup - def $vbinop_{Fnn : Fnn, M : M, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn)}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), MIN_vbinop_, v_1, v_2) = $fvbinop_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), def $fmin_, v_1, v_2) - ;; 4-numerics.watsup - def $vbinop_{Fnn : Fnn, M : M, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn)}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), MAX_vbinop_, v_1, v_2) = $fvbinop_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), def $fmax_, v_1, v_2) - ;; 4-numerics.watsup - def $vbinop_{Fnn : Fnn, M : M, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn)}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), PMIN_vbinop_, v_1, v_2) = $fvbinop_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), def $fpmin_, v_1, v_2) - ;; 4-numerics.watsup - def $vbinop_{Fnn : Fnn, M : M, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn)}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), PMAX_vbinop_, v_1, v_2) = $fvbinop_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), def $fpmax_, v_1, v_2) - ;; 4-numerics.watsup - def $vbinop_{Fnn : Fnn, M : M, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn)}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), RELAXED_MIN_vbinop_, v_1, v_2) = $fvbinop_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), def $frelaxed_min_, v_1, v_2) - ;; 4-numerics.watsup - def $vbinop_{Fnn : Fnn, M : M, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn)}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), RELAXED_MAX_vbinop_, v_1, v_2) = $fvbinop_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), def $frelaxed_max_, v_1, v_2) - -;; 4-numerics.watsup -def $vternop_(shape : shape, vternop_ : vternop_(shape), vec_ : vec_(V128_Vnn), vec_ : vec_(V128_Vnn), vec_ : vec_(V128_Vnn)) : vec_(V128_Vnn)* - ;; 4-numerics.watsup - def $vternop_{Jnn : Jnn, M : M, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn), v_3 : vec_(V128_Vnn)}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), RELAXED_LANESELECT_vternop_, v_1, v_2, v_3) = $ivternopnd_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), def $irelaxed_laneselect_, v_1, v_2, v_3) - ;; 4-numerics.watsup - def $vternop_{Fnn : Fnn, M : M, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn), v_3 : vec_(V128_Vnn)}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), RELAXED_MADD_vternop_, v_1, v_2, v_3) = $fvternop_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), def $frelaxed_madd_, v_1, v_2, v_3) - ;; 4-numerics.watsup - def $vternop_{Fnn : Fnn, M : M, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn), v_3 : vec_(V128_Vnn)}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), RELAXED_NMADD_vternop_, v_1, v_2, v_3) = $fvternop_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), def $frelaxed_nmadd_, v_1, v_2, v_3) - -;; 4-numerics.watsup -def $vtestop_(shape : shape, vtestop_ : vtestop_(shape), vec_ : vec_(V128_Vnn)) : u32 - ;; 4-numerics.watsup - def $vtestop_{Jnn : Jnn, M : M, v : vec_(V128_Vnn)}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), ALL_TRUE_vtestop_, v) = $ivtestop_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), def $inez_, v) - -;; 4-numerics.watsup -def $vrelop_(shape : shape, vrelop_ : vrelop_(shape), vec_ : vec_(V128_Vnn), vec_ : vec_(V128_Vnn)) : vec_(V128_Vnn) - ;; 4-numerics.watsup - def $vrelop_{Jnn : Jnn, M : M, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn)}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), EQ_vrelop_, v_1, v_2) = $ivrelop_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), def $ieq_, v_1, v_2) - ;; 4-numerics.watsup - def $vrelop_{Jnn : Jnn, M : M, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn)}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), NE_vrelop_, v_1, v_2) = $ivrelop_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), def $ine_, v_1, v_2) - ;; 4-numerics.watsup - def $vrelop_{Jnn : Jnn, M : M, sx : sx, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn)}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), LT_vrelop_(sx), v_1, v_2) = $ivrelopsx_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), def $ilt_, sx, v_1, v_2) - ;; 4-numerics.watsup - def $vrelop_{Jnn : Jnn, M : M, sx : sx, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn)}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), GT_vrelop_(sx), v_1, v_2) = $ivrelopsx_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), def $igt_, sx, v_1, v_2) - ;; 4-numerics.watsup - def $vrelop_{Jnn : Jnn, M : M, sx : sx, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn)}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), LE_vrelop_(sx), v_1, v_2) = $ivrelopsx_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), def $ile_, sx, v_1, v_2) - ;; 4-numerics.watsup - def $vrelop_{Jnn : Jnn, M : M, sx : sx, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn)}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), GE_vrelop_(sx), v_1, v_2) = $ivrelopsx_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), def $ige_, sx, v_1, v_2) - ;; 4-numerics.watsup - def $vrelop_{Fnn : Fnn, M : M, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn)}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), EQ_vrelop_, v_1, v_2) = $fvrelop_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), def $feq_, v_1, v_2) - ;; 4-numerics.watsup - def $vrelop_{Fnn : Fnn, M : M, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn)}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), NE_vrelop_, v_1, v_2) = $fvrelop_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), def $fne_, v_1, v_2) - ;; 4-numerics.watsup - def $vrelop_{Fnn : Fnn, M : M, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn)}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), LT_vrelop_, v_1, v_2) = $fvrelop_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), def $flt_, v_1, v_2) - ;; 4-numerics.watsup - def $vrelop_{Fnn : Fnn, M : M, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn)}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), GT_vrelop_, v_1, v_2) = $fvrelop_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), def $fgt_, v_1, v_2) - ;; 4-numerics.watsup - def $vrelop_{Fnn : Fnn, M : M, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn)}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), LE_vrelop_, v_1, v_2) = $fvrelop_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), def $fle_, v_1, v_2) - ;; 4-numerics.watsup - def $vrelop_{Fnn : Fnn, M : M, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn)}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), GE_vrelop_, v_1, v_2) = $fvrelop_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), def $fge_, v_1, v_2) - -;; 4-numerics.watsup -def $lcvtop__(shape_1 : shape, shape_2 : shape, vcvtop__ : vcvtop__(shape_1, shape_2), lane_ : lane_($lanetype(shape_1))) : lane_($lanetype(shape_2))* - ;; 4-numerics.watsup - def $lcvtop__{Jnn_1 : Jnn, M_1 : M, Jnn_2 : Jnn, M_2 : M, sx : sx, c_1 : lane_($lanetype(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)))), c : lane_($lanetype(`%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2))))}(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2)), EXTEND_vcvtop__(sx), c_1) = [c] - -- if (c = $extend__($lsizenn1((Jnn_1 : Jnn <: lanetype)), $lsizenn2((Jnn_2 : Jnn <: lanetype)), sx, c_1)) - ;; 4-numerics.watsup - def $lcvtop__{Jnn_1 : Jnn, M_1 : M, Fnn_2 : Fnn, M_2 : M, sx : sx, c_1 : lane_($lanetype(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)))), c : lane_($lanetype(`%X%`_shape((Fnn_2 : Fnn <: lanetype), `%`_dim(M_2))))}(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Fnn_2 : Fnn <: lanetype), `%`_dim(M_2)), CONVERT_vcvtop__(sx), c_1) = [c] - -- if (c = $convert__($lsizenn1((Jnn_1 : Jnn <: lanetype)), $lsizenn2((Fnn_2 : Fnn <: lanetype)), sx, c_1)) - ;; 4-numerics.watsup - def $lcvtop__{Fnn_1 : Fnn, M_1 : M, Inn_2 : Inn, M_2 : M, sx : sx, c_1 : lane_($lanetype(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)))), `c?` : lane_((Inn_2 : Inn <: lanetype))?}(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Inn_2 : Inn <: lanetype), `%`_dim(M_2)), TRUNC_SAT_vcvtop__(sx), c_1) = $list_(syntax lane_((Inn_2 : Inn <: lanetype)), c?{c <- `c?`}) - -- if (c?{c <- `c?`} = $trunc_sat__($lsizenn1((Fnn_1 : Fnn <: lanetype)), $lsizenn2((Inn_2 : Inn <: lanetype)), sx, c_1)) - ;; 4-numerics.watsup - def $lcvtop__{Fnn_1 : Fnn, M_1 : M, Inn_2 : Inn, M_2 : M, sx : sx, c_1 : lane_($lanetype(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)))), `c?` : lane_((Inn_2 : Inn <: lanetype))?}(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Inn_2 : Inn <: lanetype), `%`_dim(M_2)), RELAXED_TRUNC_vcvtop__(sx), c_1) = $list_(syntax lane_((Inn_2 : Inn <: lanetype)), c?{c <- `c?`}) - -- if (c?{c <- `c?`} = $relaxed_trunc__($lsizenn1((Fnn_1 : Fnn <: lanetype)), $lsizenn2((Inn_2 : Inn <: lanetype)), sx, c_1)) - ;; 4-numerics.watsup - def $lcvtop__{Fnn_1 : Fnn, M_1 : M, Fnn_2 : Fnn, M_2 : M, c_1 : lane_($lanetype(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)))), `c*` : lane_($lanetype(`%X%`_shape((Fnn_2 : Fnn <: lanetype), `%`_dim(M_2))))*}(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Fnn_2 : Fnn <: lanetype), `%`_dim(M_2)), DEMOTE_vcvtop__, c_1) = c*{c <- `c*`} - -- if (c*{c <- `c*`} = $demote__($lsizenn1((Fnn_1 : Fnn <: lanetype)), $lsizenn2((Fnn_2 : Fnn <: lanetype)), c_1)) - ;; 4-numerics.watsup - def $lcvtop__{Fnn_1 : Fnn, M_1 : M, Fnn_2 : Fnn, M_2 : M, c_1 : lane_($lanetype(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)))), `c*` : lane_($lanetype(`%X%`_shape((Fnn_2 : Fnn <: lanetype), `%`_dim(M_2))))*}(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Fnn_2 : Fnn <: lanetype), `%`_dim(M_2)), PROMOTE_vcvtop__, c_1) = c*{c <- `c*`} - -- if (c*{c <- `c*`} = $promote__($lsizenn1((Fnn_1 : Fnn <: lanetype)), $lsizenn2((Fnn_2 : Fnn <: lanetype)), c_1)) - -;; 4-numerics.watsup -def $vcvtop__(shape_1 : shape, shape_2 : shape, vcvtop__ : vcvtop__(shape_1, shape_2), half__(shape_1, shape_2)?, zero__(shape_1, shape_2)?, vec_ : vec_(V128_Vnn)) : vec_(V128_Vnn) - ;; 4-numerics.watsup - def $vcvtop__{Lnn_1 : Lnn, M : M, Lnn_2 : Lnn, vcvtop : vcvtop__(`%X%`_shape(Lnn_1, `%`_dim(M)), `%X%`_shape(Lnn_2, `%`_dim(M))), v_1 : vec_(V128_Vnn), v : vec_(V128_Vnn), `c_1*` : lane_($lanetype(`%X%`_shape(Lnn_1, `%`_dim(M))))*, `c**` : lane_(Lnn_2)**}(`%X%`_shape(Lnn_1, `%`_dim(M)), `%X%`_shape(Lnn_2, `%`_dim(M)), vcvtop, ?(), ?(), v_1) = v - -- 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_(Lnn_2), $lcvtop__(`%X%`_shape(Lnn_1, `%`_dim(M)), `%X%`_shape(Lnn_2, `%`_dim(M)), vcvtop, c_1)*{c_1 <- `c_1*`})) - -- if v <- $invlanes_(`%X%`_shape(Lnn_2, `%`_dim(M)), c*{c <- `c*`})*{`c*` <- `c**`} - ;; 4-numerics.watsup - def $vcvtop__{Lnn_1 : Lnn, M_1 : M, Lnn_2 : Lnn, M_2 : M, vcvtop : vcvtop__(`%X%`_shape(Lnn_1, `%`_dim(M_1)), `%X%`_shape(Lnn_2, `%`_dim(M_2))), half : half__(`%X%`_shape(Lnn_1, `%`_dim(M_1)), `%X%`_shape(Lnn_2, `%`_dim(M_2))), v_1 : vec_(V128_Vnn), v : vec_(V128_Vnn), `c_1*` : lane_($lanetype(`%X%`_shape(Lnn_1, `%`_dim(M_1))))*, `c**` : lane_(Lnn_2)**}(`%X%`_shape(Lnn_1, `%`_dim(M_1)), `%X%`_shape(Lnn_2, `%`_dim(M_2)), vcvtop, ?(half), ?(), v_1) = v - -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape(Lnn_1, `%`_dim(M_1)), v_1)[$half__(`%X%`_shape(Lnn_1, `%`_dim(M_1)), `%X%`_shape(Lnn_2, `%`_dim(M_2)), half, 0, M_2) : M_2]) - -- if (c*{c <- `c*`}*{`c*` <- `c**`} = $setproduct_(syntax lane_(Lnn_2), $lcvtop__(`%X%`_shape(Lnn_1, `%`_dim(M_1)), `%X%`_shape(Lnn_2, `%`_dim(M_2)), vcvtop, c_1)*{c_1 <- `c_1*`})) - -- if v <- $invlanes_(`%X%`_shape(Lnn_2, `%`_dim(M_2)), c*{c <- `c*`})*{`c*` <- `c**`} - ;; 4-numerics.watsup - def $vcvtop__{Lnn_1 : Lnn, M_1 : M, Lnn_2 : Lnn, M_2 : M, vcvtop : vcvtop__(`%X%`_shape(Lnn_1, `%`_dim(M_1)), `%X%`_shape(Lnn_2, `%`_dim(M_2))), zero : zero__(`%X%`_shape(Lnn_1, `%`_dim(M_1)), `%X%`_shape(Lnn_2, `%`_dim(M_2))), v_1 : vec_(V128_Vnn), v : vec_(V128_Vnn), `c_1*` : lane_($lanetype(`%X%`_shape(Lnn_1, `%`_dim(M_1))))*, `c**` : lane_(Lnn_2)**}(`%X%`_shape(Lnn_1, `%`_dim(M_1)), `%X%`_shape(Lnn_2, `%`_dim(M_2)), vcvtop, ?(), ?(zero), v_1) = v - -- 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_(Lnn_2), $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 v <- $invlanes_(`%X%`_shape(Lnn_2, `%`_dim(M_2)), c*{c <- `c*`})*{`c*` <- `c**`} - -;; 4-numerics.watsup -def $vshiftop_(ishape : ishape, vshiftop_ : vshiftop_(ishape), vec_ : vec_(V128_Vnn), u32 : u32) : vec_(V128_Vnn) - ;; 4-numerics.watsup - def $vshiftop_{Jnn : Jnn, M : M, v : vec_(V128_Vnn), i : u32}(`%`_ishape(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))), SHL_vshiftop_, v, i) = $ivshiftop_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), def $ishl_, v, i) - ;; 4-numerics.watsup - def $vshiftop_{Jnn : Jnn, M : M, sx : sx, v : vec_(V128_Vnn), i : u32}(`%`_ishape(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))), SHR_vshiftop_(sx), v, i) = $ivshiftopsx_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), def $ishr_, sx, v, i) - -;; 4-numerics.watsup -def $vbitmaskop_(ishape : ishape, vec_ : vec_(V128_Vnn)) : u32 - ;; 4-numerics.watsup - def $vbitmaskop_{Jnn : Jnn, M : M, v : vec_(V128_Vnn)}(`%`_ishape(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))), v) = $ivbitmaskop_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), v) - -;; 4-numerics.watsup -def $vswizzlop_(bshape : bshape, vswizzlop_ : vswizzlop_(bshape), vec_ : vec_(V128_Vnn), vec_ : vec_(V128_Vnn)) : vec_(V128_Vnn) - ;; 4-numerics.watsup - def $vswizzlop_{M : M, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn)}(`%`_bshape(`%X%`_shape(I8_lanetype, `%`_dim(M))), SWIZZLE_vswizzlop_, v_1, v_2) = $ivswizzlop_(`%X%`_shape(I8_lanetype, `%`_dim(M)), def $iswizzle_lane_, v_1, v_2) - ;; 4-numerics.watsup - def $vswizzlop_{M : M, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn)}(`%`_bshape(`%X%`_shape(I8_lanetype, `%`_dim(M))), RELAXED_SWIZZLE_vswizzlop_, v_1, v_2) = $ivswizzlop_(`%X%`_shape(I8_lanetype, `%`_dim(M)), def $irelaxed_swizzle_lane_, v_1, v_2) - -;; 4-numerics.watsup -def $vshufflop_(bshape : bshape, laneidx*, vec_ : vec_(V128_Vnn), vec_ : vec_(V128_Vnn)) : vec_(V128_Vnn) - ;; 4-numerics.watsup - def $vshufflop_{M : M, `i*` : laneidx*, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn)}(`%`_bshape(`%X%`_shape(I8_lanetype, `%`_dim(M))), i*{i <- `i*`}, v_1, v_2) = $ivshufflop_(`%X%`_shape(I8_lanetype, `%`_dim(M)), i*{i <- `i*`}, v_1, v_2) - -;; 4-numerics.watsup -def $vnarrowop__(shape_1 : shape, shape_2 : shape, sx : sx, vec_ : vec_(V128_Vnn), vec_ : vec_(V128_Vnn)) : vec_(V128_Vnn) - ;; 4-numerics.watsup - def $vnarrowop__{Jnn_1 : Jnn, M_1 : M, Jnn_2 : Jnn, M_2 : M, sx : sx, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn), v : vec_(V128_Vnn), `c_1*` : lane_($lanetype(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1))))*, `c_2*` : lane_($lanetype(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1))))*, `c'_1*` : iN($lsize((Jnn_2 : Jnn <: lanetype)))*, `c'_2*` : iN($lsize((Jnn_2 : Jnn <: lanetype)))*}(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2)), sx, v_1, v_2) = v - -- 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 (c'_1*{c'_1 <- `c'_1*`} = $narrow__($lsize((Jnn_1 : Jnn <: lanetype)), $lsize((Jnn_2 : Jnn <: lanetype)), sx, c_1)*{c_1 <- `c_1*`}) - -- if (c'_2*{c'_2 <- `c'_2*`} = $narrow__($lsize((Jnn_1 : Jnn <: lanetype)), $lsize((Jnn_2 : Jnn <: lanetype)), sx, c_2)*{c_2 <- `c_2*`}) - -- if (v = $invlanes_(`%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2)), c'_1*{c'_1 <- `c'_1*`} ++ c'_2*{c'_2 <- `c'_2*`})) - -;; 4-numerics.watsup -def $ivadd_pairwise_(N : N, iN(N)*) : iN(N)* - ;; 4-numerics.watsup - def $ivadd_pairwise_{N : N, `i*` : iN(N)*, `j_1*` : iN(N)*, `j_2*` : iN(N)*}(N, i*{i <- `i*`}) = $iadd_(N, j_1, j_2)*{j_1 <- `j_1*`, j_2 <- `j_2*`} - -- if ($concat_(syntax N, [j_1!`%`_iN.0 j_2!`%`_iN.0]*{j_1 <- `j_1*`, j_2 <- `j_2*`}) = i!`%`_iN.0*{i <- `i*`}) - -;; 4-numerics.watsup -def $ivextunop__(shape_1 : shape, shape_2 : shape, def $f_(N : N, iN(N)*) : iN(N)*, sx : sx, vec_ : vec_(V128_Vnn)) : vec_(V128_Vnn) - ;; 4-numerics.watsup - def $ivextunop__{Jnn_1 : Jnn, M_1 : M, Jnn_2 : Jnn, M_2 : M, def $f_(N : N, iN(N)*) : iN(N)*, sx : sx, v_1 : vec_(V128_Vnn), `c*` : lane_($lanetype(`%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2))))*, `c_1*` : lane_($lanetype(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1))))*, `c'_1*` : iN($lsizenn2((Jnn_2 : Jnn <: lanetype)))*}(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2)), def $f_, sx, v_1) = $invlanes_(`%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2)), c*{c <- `c*`}) - -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), v_1)) - -- if (c'_1*{c'_1 <- `c'_1*`} = $extend__($lsizenn1((Jnn_1 : Jnn <: lanetype)), $lsizenn2((Jnn_2 : Jnn <: lanetype)), sx, c_1)*{c_1 <- `c_1*`}) - -- if (c*{c <- `c*`} = $f_($lsizenn2((Jnn_2 : Jnn <: lanetype)), c'_1*{c'_1 <- `c'_1*`})) - -;; 4-numerics.watsup -def $vextunop__(ishape_1 : ishape, ishape_2 : ishape, vextunop__ : vextunop__(ishape_1, ishape_2), vec_ : vec_(V128_Vnn)) : vec_(V128_Vnn) - ;; 4-numerics.watsup - def $vextunop__{Jnn_1 : Jnn, M_1 : M, Jnn_2 : Jnn, M_2 : M, sx : sx, v_1 : vec_(V128_Vnn)}(`%`_ishape(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1))), `%`_ishape(`%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2))), EXTADD_PAIRWISE_vextunop__(sx), v_1) = $ivextunop__(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2)), def $ivadd_pairwise_, sx, v_1) - -;; 4-numerics.watsup -def $ivdot_(N : N, iN(N)*, iN(N)*) : iN(N)* - ;; 4-numerics.watsup - def $ivdot_{N : N, `i_1*` : iN(N)*, `i_2*` : iN(N)*, `j_1*` : iN(N)*, `j_2*` : iN(N)*}(N, i_1*{i_1 <- `i_1*`}, i_2*{i_2 <- `i_2*`}) = $iadd_(N, j_1, j_2)*{j_1 <- `j_1*`, j_2 <- `j_2*`} - -- if ($concat_(syntax iN(N), [j_1 j_2]*{j_1 <- `j_1*`, j_2 <- `j_2*`}) = $imul_(N, i_1, i_2)*{i_1 <- `i_1*`, i_2 <- `i_2*`}) - -;; 4-numerics.watsup -def $ivdot_sat_(N : N, iN(N)*, iN(N)*) : iN(N)* - ;; 4-numerics.watsup - def $ivdot_sat_{N : N, `i_1*` : iN(N)*, `i_2*` : iN(N)*, `j_1*` : iN(N)*, `j_2*` : iN(N)*}(N, i_1*{i_1 <- `i_1*`}, i_2*{i_2 <- `i_2*`}) = $iadd_sat_(N, S_sx, j_1, j_2)*{j_1 <- `j_1*`, j_2 <- `j_2*`} - -- if ($concat_(syntax iN(N), [j_1 j_2]*{j_1 <- `j_1*`, j_2 <- `j_2*`}) = $imul_(N, i_1, i_2)*{i_1 <- `i_1*`, i_2 <- `i_2*`}) - -;; 4-numerics.watsup -def $ivextbinop__(shape_1 : shape, shape_2 : shape, def $f_(N : N, iN(N)*, iN(N)*) : iN(N)*, sx : sx, sx : sx, laneidx : laneidx, laneidx : laneidx, vec_ : vec_(V128_Vnn), vec_ : vec_(V128_Vnn)) : vec_(V128_Vnn) - ;; 4-numerics.watsup - def $ivextbinop__{Jnn_1 : Jnn, M_1 : M, Jnn_2 : Jnn, M_2 : M, def $f_(N : N, iN(N)*, iN(N)*) : iN(N)*, sx_1 : sx, sx_2 : sx, i : laneidx, k : laneidx, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn), `c*` : lane_($lanetype(`%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2))))*, `c_1*` : lane_($lanetype(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1))))*, `c_2*` : lane_($lanetype(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1))))*, `c'_1*` : iN($lsizenn2((Jnn_2 : Jnn <: lanetype)))*, `c'_2*` : iN($lsizenn2((Jnn_2 : Jnn <: lanetype)))*}(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2)), def $f_, sx_1, sx_2, i, k, v_1, v_2) = $invlanes_(`%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2)), c*{c <- `c*`}) - -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), v_1)[i!`%`_laneidx.0 : k!`%`_laneidx.0]) - -- if (c_2*{c_2 <- `c_2*`} = $lanes_(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), v_2)[i!`%`_laneidx.0 : k!`%`_laneidx.0]) - -- if (c'_1*{c'_1 <- `c'_1*`} = $extend__($lsizenn1((Jnn_1 : Jnn <: lanetype)), $lsizenn2((Jnn_2 : Jnn <: lanetype)), sx_1, c_1)*{c_1 <- `c_1*`}) - -- if (c'_2*{c'_2 <- `c'_2*`} = $extend__($lsizenn1((Jnn_1 : Jnn <: lanetype)), $lsizenn2((Jnn_2 : Jnn <: lanetype)), sx_2, 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*`})) - -;; 4-numerics.watsup -def $ivmul_(N : N, iN(N)*, iN(N)*) : iN(N)* - ;; 4-numerics.watsup - def $ivmul_{N : N, `i_1*` : iN(N)*, `i_2*` : iN(N)*}(N, i_1*{i_1 <- `i_1*`}, i_2*{i_2 <- `i_2*`}) = $imul_(N, i_1, i_2)*{i_1 <- `i_1*`, i_2 <- `i_2*`} - -;; 4-numerics.watsup -def $vextbinop__(ishape_1 : ishape, ishape_2 : ishape, vextbinop__ : vextbinop__(ishape_1, ishape_2), vec_ : vec_(V128_Vnn), vec_ : vec_(V128_Vnn)) : vec_(V128_Vnn) - ;; 4-numerics.watsup - def $vextbinop__{Jnn_1 : Jnn, M_1 : M, Jnn_2 : Jnn, M_2 : M, sx : sx, half : half__(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2))), v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn), i : laneidx}(`%`_ishape(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1))), `%`_ishape(`%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2))), EXTMUL_vextbinop__(sx, half), v_1, v_2) = $ivextbinop__(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2)), def $ivmul_, sx, sx, i, `%`_laneidx(M_2), v_1, v_2) - -- if (i!`%`_laneidx.0 = $half__(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2)), half, 0, M_2)) - ;; 4-numerics.watsup - def $vextbinop__{Jnn_1 : Jnn, M_1 : M, Jnn_2 : Jnn, M_2 : M, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn)}(`%`_ishape(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1))), `%`_ishape(`%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2))), `DOTS`_vextbinop__, v_1, v_2) = $ivextbinop__(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2)), def $ivdot_, S_sx, S_sx, `%`_laneidx(0), `%`_laneidx(M_1), v_1, v_2) - ;; 4-numerics.watsup - def $vextbinop__{Jnn_1 : Jnn, M_1 : M, Jnn_2 : Jnn, M_2 : M, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn)}(`%`_ishape(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1))), `%`_ishape(`%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2))), `RELAXED_DOTS`_vextbinop__, v_1, v_2) = $ivextbinop__(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2)), def $ivdot_sat_, S_sx, $relaxed2($R_idot, syntax sx, S_sx, U_sx), `%`_laneidx(0), `%`_laneidx(M_1), v_1, v_2) - -;; 4-numerics.watsup -def $vextternop__(ishape_1 : ishape, ishape_2 : ishape, vextternop__ : vextternop__(ishape_1, ishape_2), vec_ : vec_(V128_Vnn), vec_ : vec_(V128_Vnn), vec_ : vec_(V128_Vnn)) : vec_(V128_Vnn) - ;; 4-numerics.watsup - def $vextternop__{Jnn_1 : Jnn, M_1 : M, Jnn_2 : Jnn, M_2 : M, c_1 : vec_(V128_Vnn), c_2 : vec_(V128_Vnn), c_3 : vec_(V128_Vnn), c : vec_(V128_Vnn), Jnn : Jnn, M : M, c' : vec_(V128_Vnn), c'' : vec_(V128_Vnn)}(`%`_ishape(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1))), `%`_ishape(`%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2))), `RELAXED_DOT_ADDS`_vextternop__, c_1, c_2, c_3) = c - -- if ($lsizenn((Jnn : Jnn <: lanetype)) = (2 * $lsizenn1((Jnn_1 : Jnn <: lanetype)))) - -- 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))), `RELAXED_DOTS`_vextbinop__, 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))), EXTADD_PAIRWISE_vextunop__(S_sx), c')) - -- if c <- $vbinop_(`%X%`_shape((Jnn_2 : Jnn <: lanetype), `%`_dim(M_2)), ADD_vbinop_, c'', c_3) - -;; 5-runtime.watsup -syntax num = - | CONST{numtype : numtype, num_ : num_(numtype)}(numtype : numtype, num_ : num_(numtype)) - -;; 5-runtime.watsup -syntax vec = - | VCONST{vectype : vectype, vec_ : vec_(vectype)}(vectype : vectype, vec_ : vec_(vectype)) - -;; 5-runtime.watsup -syntax ref = - | REF.I31_NUM{u31 : u31}(u31 : u31) - | REF.STRUCT_ADDR{structaddr : structaddr}(structaddr : structaddr) - | REF.ARRAY_ADDR{arrayaddr : arrayaddr}(arrayaddr : arrayaddr) - | REF.FUNC_ADDR{funcaddr : funcaddr}(funcaddr : funcaddr) - | REF.EXN_ADDR{exnaddr : exnaddr}(exnaddr : exnaddr) - | REF.HOST_ADDR{hostaddr : hostaddr}(hostaddr : hostaddr) - | REF.EXTERN{addrref : addrref}(addrref : addrref) - | REF.NULL{heaptype : heaptype}(heaptype : heaptype) - -;; 5-runtime.watsup -syntax result = - | _VALS{`val*` : val*}(val*{val <- `val*`} : val*) - | `(REF.EXN_ADDR%)THROW_REF`{exnaddr : exnaddr}(exnaddr : exnaddr) - | TRAP - -;; 5-runtime.watsup -syntax hostfunc = - | `...` - -;; 5-runtime.watsup -syntax funccode = - | FUNC{typeidx : typeidx, `local*` : local*, expr : expr}(typeidx : typeidx, local*{local <- `local*`} : local*, expr : expr) - | `...` - -;; 5-runtime.watsup -syntax funcinst = -{ - TYPE{deftype : deftype} deftype, - MODULE{moduleinst : moduleinst} moduleinst, - CODE{funccode : funccode} funccode -} - -;; 5-runtime.watsup -syntax globalinst = -{ - TYPE{globaltype : globaltype} globaltype, - VALUE{val : val} val -} - -;; 5-runtime.watsup -syntax tableinst = -{ - TYPE{tabletype : tabletype} tabletype, - REFS{`ref*` : ref*} ref* -} - -;; 5-runtime.watsup -syntax meminst = -{ - TYPE{memtype : memtype} memtype, - BYTES{`byte*` : byte*} byte* -} - -;; 5-runtime.watsup -syntax taginst = -{ - TYPE{tagtype : tagtype} tagtype -} - -;; 5-runtime.watsup -syntax eleminst = -{ - TYPE{elemtype : elemtype} elemtype, - REFS{`ref*` : ref*} ref* -} - -;; 5-runtime.watsup -syntax datainst = -{ - BYTES{`byte*` : byte*} byte* -} - -;; 5-runtime.watsup -syntax packval = - | PACK{packtype : packtype, iN : iN($psizenn(packtype))}(packtype : packtype, iN : iN($psizenn(packtype))) - -;; 5-runtime.watsup -syntax fieldval = - | CONST{numtype : numtype, num_ : num_(numtype)}(numtype : numtype, num_ : num_(numtype)) - | VCONST{vectype : vectype, vec_ : vec_(vectype)}(vectype : vectype, vec_ : vec_(vectype)) - | REF.NULL{heaptype : heaptype}(heaptype : heaptype) - | REF.I31_NUM{u31 : u31}(u31 : u31) - | REF.STRUCT_ADDR{structaddr : structaddr}(structaddr : structaddr) - | REF.ARRAY_ADDR{arrayaddr : arrayaddr}(arrayaddr : arrayaddr) - | REF.FUNC_ADDR{funcaddr : funcaddr}(funcaddr : funcaddr) - | REF.EXN_ADDR{exnaddr : exnaddr}(exnaddr : exnaddr) - | REF.HOST_ADDR{hostaddr : hostaddr}(hostaddr : hostaddr) - | REF.EXTERN{addrref : addrref}(addrref : addrref) - | PACK{packtype : packtype, iN : iN($psizenn(packtype))}(packtype : packtype, iN : iN($psizenn(packtype))) - -;; 5-runtime.watsup -syntax structinst = -{ - TYPE{deftype : deftype} deftype, - FIELDS{`fieldval*` : fieldval*} fieldval* -} - -;; 5-runtime.watsup -syntax arrayinst = -{ - TYPE{deftype : deftype} deftype, - FIELDS{`fieldval*` : fieldval*} fieldval* -} - -;; 5-runtime.watsup -syntax exninst = -{ - TAG{tagaddr : tagaddr} tagaddr, - FIELDS{`val*` : val*} val* -} - -;; 5-runtime.watsup -syntax store = -{ - FUNCS{`funcinst*` : funcinst*} funcinst*, - GLOBALS{`globalinst*` : globalinst*} globalinst*, - TABLES{`tableinst*` : tableinst*} tableinst*, - MEMS{`meminst*` : meminst*} meminst*, - TAGS{`taginst*` : taginst*} taginst*, - ELEMS{`eleminst*` : eleminst*} eleminst*, - DATAS{`datainst*` : datainst*} datainst*, - STRUCTS{`structinst*` : structinst*} structinst*, - ARRAYS{`arrayinst*` : arrayinst*} arrayinst*, - EXNS{`exninst*` : exninst*} exninst* -} - -;; 5-runtime.watsup -syntax state = - | `%;%`{store : store, frame : frame}(store : store, frame : frame) - -;; 5-runtime.watsup -syntax config = - | `%;%`{state : state, `instr*` : instr*}(state : state, instr*{instr <- `instr*`} : instr*) - -;; 6-runtime-aux.watsup -def $inst_valtype(moduleinst : moduleinst, valtype : valtype) : valtype - ;; 6-runtime-aux.watsup - def $inst_valtype{moduleinst : moduleinst, t : valtype, `dt*` : deftype*}(moduleinst, t) = $subst_all_valtype(t, (dt : deftype <: heaptype)*{dt <- `dt*`}) - -- if (dt*{dt <- `dt*`} = moduleinst.TYPES_moduleinst) - -;; 6-runtime-aux.watsup -def $inst_reftype(moduleinst : moduleinst, reftype : reftype) : reftype - ;; 6-runtime-aux.watsup - def $inst_reftype{moduleinst : moduleinst, rt : reftype, `dt*` : deftype*}(moduleinst, rt) = $subst_all_reftype(rt, (dt : deftype <: heaptype)*{dt <- `dt*`}) - -- if (dt*{dt <- `dt*`} = moduleinst.TYPES_moduleinst) - -;; 6-runtime-aux.watsup -def $inst_globaltype(moduleinst : moduleinst, globaltype : globaltype) : globaltype - ;; 6-runtime-aux.watsup - def $inst_globaltype{moduleinst : moduleinst, gt : globaltype, `dt*` : deftype*}(moduleinst, gt) = $subst_all_globaltype(gt, (dt : deftype <: heaptype)*{dt <- `dt*`}) - -- if (dt*{dt <- `dt*`} = moduleinst.TYPES_moduleinst) - -;; 6-runtime-aux.watsup -def $inst_tabletype(moduleinst : moduleinst, tabletype : tabletype) : tabletype - ;; 6-runtime-aux.watsup - def $inst_tabletype{moduleinst : moduleinst, tt : tabletype, `dt*` : deftype*}(moduleinst, tt) = $subst_all_tabletype(tt, (dt : deftype <: heaptype)*{dt <- `dt*`}) - -- if (dt*{dt <- `dt*`} = moduleinst.TYPES_moduleinst) - -;; 6-runtime-aux.watsup -def $inst_memtype(moduleinst : moduleinst, memtype : memtype) : memtype - ;; 6-runtime-aux.watsup - def $inst_memtype{moduleinst : moduleinst, mt : memtype, `dt*` : deftype*}(moduleinst, mt) = $subst_all_memtype(mt, (dt : deftype <: heaptype)*{dt <- `dt*`}) - -- if (dt*{dt <- `dt*`} = moduleinst.TYPES_moduleinst) - -;; 6-runtime-aux.watsup -def $Ki : nat - ;; 6-runtime-aux.watsup - def $Ki = 1024 - -;; 6-runtime-aux.watsup -def $packfield_(storagetype : storagetype, val : val) : fieldval - ;; 6-runtime-aux.watsup - def $packfield_{valtype : valtype, val : val}((valtype : valtype <: storagetype), val) = (val : val <: fieldval) - ;; 6-runtime-aux.watsup - def $packfield_{packtype : packtype, i : num_(I32_numtype)}((packtype : packtype <: storagetype), CONST_val(I32_numtype, i)) = PACK_fieldval(packtype, $wrap__(32, $psize(packtype), i)) - -;; 6-runtime-aux.watsup -def $unpackfield_(storagetype : storagetype, sx?, fieldval : fieldval) : val - ;; 6-runtime-aux.watsup - def $unpackfield_{valtype : valtype, val : val}((valtype : valtype <: storagetype), ?(), (val : val <: fieldval)) = val - ;; 6-runtime-aux.watsup - def $unpackfield_{packtype : packtype, sx : sx, i : iN($psizenn(packtype))}((packtype : packtype <: storagetype), ?(sx), PACK_fieldval(packtype, i)) = CONST_val(I32_numtype, $extend__($psize(packtype), 32, sx, i)) - -;; 6-runtime-aux.watsup -rec { - -;; 6-runtime-aux.watsup:66.1-66.87 -def $funcsxa(externaddr*) : funcaddr* - ;; 6-runtime-aux.watsup:72.1-72.24 - def $funcsxa([]) = [] - ;; 6-runtime-aux.watsup:73.1-73.45 - def $funcsxa{a : addr, `xa*` : externaddr*}([FUNC_externaddr(a)] ++ xa*{xa <- `xa*`}) = [a] ++ $funcsxa(xa*{xa <- `xa*`}) - ;; 6-runtime-aux.watsup:74.1-74.59 - def $funcsxa{externaddr : externaddr, `xa*` : externaddr*}([externaddr] ++ xa*{xa <- `xa*`}) = $funcsxa(xa*{xa <- `xa*`}) - -- otherwise -} - -;; 6-runtime-aux.watsup -rec { - -;; 6-runtime-aux.watsup:67.1-67.89 -def $globalsxa(externaddr*) : globaladdr* - ;; 6-runtime-aux.watsup:76.1-76.26 - def $globalsxa([]) = [] - ;; 6-runtime-aux.watsup:77.1-77.51 - def $globalsxa{a : addr, `xa*` : externaddr*}([GLOBAL_externaddr(a)] ++ xa*{xa <- `xa*`}) = [a] ++ $globalsxa(xa*{xa <- `xa*`}) - ;; 6-runtime-aux.watsup:78.1-78.63 - def $globalsxa{externaddr : externaddr, `xa*` : externaddr*}([externaddr] ++ xa*{xa <- `xa*`}) = $globalsxa(xa*{xa <- `xa*`}) - -- otherwise -} - -;; 6-runtime-aux.watsup -rec { - -;; 6-runtime-aux.watsup:68.1-68.88 -def $tablesxa(externaddr*) : tableaddr* - ;; 6-runtime-aux.watsup:80.1-80.25 - def $tablesxa([]) = [] - ;; 6-runtime-aux.watsup:81.1-81.48 - def $tablesxa{a : addr, `xa*` : externaddr*}([TABLE_externaddr(a)] ++ xa*{xa <- `xa*`}) = [a] ++ $tablesxa(xa*{xa <- `xa*`}) - ;; 6-runtime-aux.watsup:82.1-82.61 - def $tablesxa{externaddr : externaddr, `xa*` : externaddr*}([externaddr] ++ xa*{xa <- `xa*`}) = $tablesxa(xa*{xa <- `xa*`}) - -- otherwise -} - -;; 6-runtime-aux.watsup -rec { - -;; 6-runtime-aux.watsup:69.1-69.86 -def $memsxa(externaddr*) : memaddr* - ;; 6-runtime-aux.watsup:84.1-84.23 - def $memsxa([]) = [] - ;; 6-runtime-aux.watsup:85.1-85.42 - def $memsxa{a : addr, `xa*` : externaddr*}([MEM_externaddr(a)] ++ xa*{xa <- `xa*`}) = [a] ++ $memsxa(xa*{xa <- `xa*`}) - ;; 6-runtime-aux.watsup:86.1-86.57 - def $memsxa{externaddr : externaddr, `xa*` : externaddr*}([externaddr] ++ xa*{xa <- `xa*`}) = $memsxa(xa*{xa <- `xa*`}) - -- otherwise -} - -;; 6-runtime-aux.watsup -rec { - -;; 6-runtime-aux.watsup:70.1-70.86 -def $tagsxa(externaddr*) : tagaddr* - ;; 6-runtime-aux.watsup:88.1-88.23 - def $tagsxa([]) = [] - ;; 6-runtime-aux.watsup:89.1-89.42 - def $tagsxa{a : addr, `xa*` : externaddr*}([TAG_externaddr(a)] ++ xa*{xa <- `xa*`}) = [a] ++ $tagsxa(xa*{xa <- `xa*`}) - ;; 6-runtime-aux.watsup:90.1-90.57 - def $tagsxa{externaddr : externaddr, `xa*` : externaddr*}([externaddr] ++ xa*{xa <- `xa*`}) = $tagsxa(xa*{xa <- `xa*`}) - -- otherwise -} - -;; 6-runtime-aux.watsup -def $store(state : state) : store - ;; 6-runtime-aux.watsup - def $store{s : store, f : frame}(`%;%`_state(s, f)) = s - -;; 6-runtime-aux.watsup -def $frame(state : state) : frame - ;; 6-runtime-aux.watsup - def $frame{s : store, f : frame}(`%;%`_state(s, f)) = f - -;; 6-runtime-aux.watsup -def $tagaddr(state : state) : tagaddr* - ;; 6-runtime-aux.watsup - def $tagaddr{s : store, f : frame}(`%;%`_state(s, f)) = f.MODULE_frame.TAGS_moduleinst - -;; 6-runtime-aux.watsup -def $moduleinst(state : state) : moduleinst - ;; 6-runtime-aux.watsup - def $moduleinst{s : store, f : frame}(`%;%`_state(s, f)) = f.MODULE_frame - -;; 6-runtime-aux.watsup -def $funcinst(state : state) : funcinst* - ;; 6-runtime-aux.watsup - def $funcinst{s : store, f : frame}(`%;%`_state(s, f)) = s.FUNCS_store - -;; 6-runtime-aux.watsup -def $globalinst(state : state) : globalinst* - ;; 6-runtime-aux.watsup - def $globalinst{s : store, f : frame}(`%;%`_state(s, f)) = s.GLOBALS_store - -;; 6-runtime-aux.watsup -def $tableinst(state : state) : tableinst* - ;; 6-runtime-aux.watsup - def $tableinst{s : store, f : frame}(`%;%`_state(s, f)) = s.TABLES_store - -;; 6-runtime-aux.watsup -def $meminst(state : state) : meminst* - ;; 6-runtime-aux.watsup - def $meminst{s : store, f : frame}(`%;%`_state(s, f)) = s.MEMS_store - -;; 6-runtime-aux.watsup -def $taginst(state : state) : taginst* - ;; 6-runtime-aux.watsup - def $taginst{s : store, f : frame}(`%;%`_state(s, f)) = s.TAGS_store - -;; 6-runtime-aux.watsup -def $eleminst(state : state) : eleminst* - ;; 6-runtime-aux.watsup - def $eleminst{s : store, f : frame}(`%;%`_state(s, f)) = s.ELEMS_store - -;; 6-runtime-aux.watsup -def $datainst(state : state) : datainst* - ;; 6-runtime-aux.watsup - def $datainst{s : store, f : frame}(`%;%`_state(s, f)) = s.DATAS_store - -;; 6-runtime-aux.watsup -def $structinst(state : state) : structinst* - ;; 6-runtime-aux.watsup - def $structinst{s : store, f : frame}(`%;%`_state(s, f)) = s.STRUCTS_store - -;; 6-runtime-aux.watsup -def $arrayinst(state : state) : arrayinst* - ;; 6-runtime-aux.watsup - def $arrayinst{s : store, f : frame}(`%;%`_state(s, f)) = s.ARRAYS_store - -;; 6-runtime-aux.watsup -def $exninst(state : state) : exninst* - ;; 6-runtime-aux.watsup - def $exninst{s : store, f : frame}(`%;%`_state(s, f)) = s.EXNS_store - -;; 6-runtime-aux.watsup -def $type(state : state, typeidx : typeidx) : deftype - ;; 6-runtime-aux.watsup - def $type{s : store, f : frame, x : idx}(`%;%`_state(s, f), x) = f.MODULE_frame.TYPES_moduleinst[x!`%`_idx.0] - -;; 6-runtime-aux.watsup -def $func(state : state, funcidx : funcidx) : funcinst - ;; 6-runtime-aux.watsup - def $func{s : store, f : frame, x : idx}(`%;%`_state(s, f), x) = s.FUNCS_store[f.MODULE_frame.FUNCS_moduleinst[x!`%`_idx.0]] - -;; 6-runtime-aux.watsup -def $global(state : state, globalidx : globalidx) : globalinst - ;; 6-runtime-aux.watsup - def $global{s : store, f : frame, x : idx}(`%;%`_state(s, f), x) = s.GLOBALS_store[f.MODULE_frame.GLOBALS_moduleinst[x!`%`_idx.0]] - -;; 6-runtime-aux.watsup -def $table(state : state, tableidx : tableidx) : tableinst - ;; 6-runtime-aux.watsup - def $table{s : store, f : frame, x : idx}(`%;%`_state(s, f), x) = s.TABLES_store[f.MODULE_frame.TABLES_moduleinst[x!`%`_idx.0]] - -;; 6-runtime-aux.watsup -def $mem(state : state, memidx : memidx) : meminst - ;; 6-runtime-aux.watsup - def $mem{s : store, f : frame, x : idx}(`%;%`_state(s, f), x) = s.MEMS_store[f.MODULE_frame.MEMS_moduleinst[x!`%`_idx.0]] - -;; 6-runtime-aux.watsup -def $tag(state : state, tagidx : tagidx) : taginst - ;; 6-runtime-aux.watsup - def $tag{s : store, f : frame, x : idx}(`%;%`_state(s, f), x) = s.TAGS_store[f.MODULE_frame.TAGS_moduleinst[x!`%`_idx.0]] - -;; 6-runtime-aux.watsup -def $elem(state : state, tableidx : tableidx) : eleminst - ;; 6-runtime-aux.watsup - def $elem{s : store, f : frame, x : idx}(`%;%`_state(s, f), x) = s.ELEMS_store[f.MODULE_frame.ELEMS_moduleinst[x!`%`_idx.0]] - -;; 6-runtime-aux.watsup -def $data(state : state, dataidx : dataidx) : datainst - ;; 6-runtime-aux.watsup - def $data{s : store, f : frame, x : idx}(`%;%`_state(s, f), x) = s.DATAS_store[f.MODULE_frame.DATAS_moduleinst[x!`%`_idx.0]] - -;; 6-runtime-aux.watsup -def $local(state : state, localidx : localidx) : val? - ;; 6-runtime-aux.watsup - def $local{s : store, f : frame, x : idx}(`%;%`_state(s, f), x) = f.LOCALS_frame[x!`%`_idx.0] - -;; 6-runtime-aux.watsup -def $with_local(state : state, localidx : localidx, val : val) : state - ;; 6-runtime-aux.watsup - def $with_local{s : store, f : frame, x : idx, v : val}(`%;%`_state(s, f), x, v) = `%;%`_state(s, f[LOCALS_frame[x!`%`_idx.0] = ?(v)]) - -;; 6-runtime-aux.watsup -def $with_global(state : state, globalidx : globalidx, val : val) : state - ;; 6-runtime-aux.watsup - def $with_global{s : store, f : frame, x : idx, v : val}(`%;%`_state(s, f), x, v) = `%;%`_state(s[GLOBALS_store[f.MODULE_frame.GLOBALS_moduleinst[x!`%`_idx.0]].VALUE_globalinst = v], f) - -;; 6-runtime-aux.watsup -def $with_table(state : state, tableidx : tableidx, nat : nat, ref : ref) : state - ;; 6-runtime-aux.watsup - def $with_table{s : store, f : frame, x : idx, i : nat, r : ref}(`%;%`_state(s, f), x, i, r) = `%;%`_state(s[TABLES_store[f.MODULE_frame.TABLES_moduleinst[x!`%`_idx.0]].REFS_tableinst[i] = r], f) - -;; 6-runtime-aux.watsup -def $with_tableinst(state : state, tableidx : tableidx, tableinst : tableinst) : state - ;; 6-runtime-aux.watsup - def $with_tableinst{s : store, f : frame, x : idx, ti : tableinst}(`%;%`_state(s, f), x, ti) = `%;%`_state(s[TABLES_store[f.MODULE_frame.TABLES_moduleinst[x!`%`_idx.0]] = ti], f) - -;; 6-runtime-aux.watsup -def $with_mem(state : state, memidx : memidx, nat : nat, nat : nat, byte*) : state - ;; 6-runtime-aux.watsup - def $with_mem{s : store, f : frame, x : idx, 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!`%`_idx.0]].BYTES_meminst[i : j] = b*{b <- `b*`}], f) - -;; 6-runtime-aux.watsup -def $with_meminst(state : state, memidx : memidx, meminst : meminst) : state - ;; 6-runtime-aux.watsup - def $with_meminst{s : store, f : frame, x : idx, mi : meminst}(`%;%`_state(s, f), x, mi) = `%;%`_state(s[MEMS_store[f.MODULE_frame.MEMS_moduleinst[x!`%`_idx.0]] = mi], f) - -;; 6-runtime-aux.watsup -def $with_elem(state : state, elemidx : elemidx, ref*) : state - ;; 6-runtime-aux.watsup - def $with_elem{s : store, f : frame, x : idx, `r*` : ref*}(`%;%`_state(s, f), x, r*{r <- `r*`}) = `%;%`_state(s[ELEMS_store[f.MODULE_frame.ELEMS_moduleinst[x!`%`_idx.0]].REFS_eleminst = r*{r <- `r*`}], f) - -;; 6-runtime-aux.watsup -def $with_data(state : state, dataidx : dataidx, byte*) : state - ;; 6-runtime-aux.watsup - def $with_data{s : store, f : frame, x : idx, `b*` : byte*}(`%;%`_state(s, f), x, b*{b <- `b*`}) = `%;%`_state(s[DATAS_store[f.MODULE_frame.DATAS_moduleinst[x!`%`_idx.0]].BYTES_datainst = b*{b <- `b*`}], f) - -;; 6-runtime-aux.watsup -def $with_struct(state : state, structaddr : structaddr, nat : nat, fieldval : fieldval) : state - ;; 6-runtime-aux.watsup - def $with_struct{s : store, f : frame, a : addr, i : nat, fv : fieldval}(`%;%`_state(s, f), a, i, fv) = `%;%`_state(s[STRUCTS_store[a].FIELDS_structinst[i] = fv], f) - -;; 6-runtime-aux.watsup -def $with_array(state : state, arrayaddr : arrayaddr, nat : nat, fieldval : fieldval) : state - ;; 6-runtime-aux.watsup - def $with_array{s : store, f : frame, a : addr, i : nat, fv : fieldval}(`%;%`_state(s, f), a, i, fv) = `%;%`_state(s[ARRAYS_store[a].FIELDS_arrayinst[i] = fv], f) - -;; 6-runtime-aux.watsup -def $add_structinst(state : state, structinst*) : state - ;; 6-runtime-aux.watsup - def $add_structinst{s : store, f : frame, `si*` : structinst*}(`%;%`_state(s, f), si*{si <- `si*`}) = `%;%`_state(s[STRUCTS_store =++ si*{si <- `si*`}], f) - -;; 6-runtime-aux.watsup -def $add_arrayinst(state : state, arrayinst*) : state - ;; 6-runtime-aux.watsup - def $add_arrayinst{s : store, f : frame, `ai*` : arrayinst*}(`%;%`_state(s, f), ai*{ai <- `ai*`}) = `%;%`_state(s[ARRAYS_store =++ ai*{ai <- `ai*`}], f) - -;; 6-runtime-aux.watsup -def $add_exninst(state : state, exninst*) : state - ;; 6-runtime-aux.watsup - def $add_exninst{s : store, f : frame, `exn*` : exninst*}(`%;%`_state(s, f), exn*{exn <- `exn*`}) = `%;%`_state(s[EXNS_store =++ exn*{exn <- `exn*`}], f) - -;; 6-runtime-aux.watsup -def $growtable(tableinst : tableinst, nat : nat, ref : ref) : tableinst - ;; 6-runtime-aux.watsup - def $growtable{tableinst : tableinst, n : n, r : ref, tableinst' : tableinst, at : addrtype, i : u64, j : u64, rt : reftype, `r'*` : ref*, i' : u64}(tableinst, n, r) = tableinst' - -- if (tableinst = {TYPE `%%%`_tabletype(at, `[%..%]`_limits(i, j), rt), REFS r'*{r' <- `r'*`}}) - -- if (tableinst' = {TYPE `%%%`_tabletype(at, `[%..%]`_limits(i', j), rt), REFS r'*{r' <- `r'*`} ++ r^n{}}) - -- if ((i'!`%`_u64.0 = (|r'*{r' <- `r'*`}| + n)) /\ ((|r'*{r' <- `r'*`}| + n) <= j!`%`_u64.0)) - -;; 6-runtime-aux.watsup -def $growmem(meminst : meminst, nat : nat) : meminst - ;; 6-runtime-aux.watsup - def $growmem{meminst : meminst, n : n, meminst' : meminst, at : addrtype, i : u64, j : u64, `b*` : byte*, i' : u64}(meminst, n) = meminst' - -- if (meminst = {TYPE `%%PAGE`_memtype(at, `[%..%]`_limits(i, j)), BYTES b*{b <- `b*`}}) - -- if (meminst' = {TYPE `%%PAGE`_memtype(at, `[%..%]`_limits(i', j)), BYTES b*{b <- `b*`} ++ `%`_byte(0)^(n * (64 * $Ki)){}}) - -- if (((i'!`%`_u64.0 : nat <:> rat) = (((|b*{b <- `b*`}| : nat <:> rat) / ((64 * $Ki) : nat <:> rat)) + (n : nat <:> rat))) /\ ((((|b*{b <- `b*`}| : nat <:> rat) / ((64 * $Ki) : nat <:> rat)) + (n : nat <:> rat)) <= (j!`%`_u64.0 : nat <:> rat))) - -;; 7-runtime-typing.watsup -relation Num_type: `%|-%:%`(store, num, numtype) - ;; 7-runtime-typing.watsup - rule _{s : store, nt : numtype, c : num_(nt)}: - `%|-%:%`(s, CONST_num(nt, c), nt) - -;; 7-runtime-typing.watsup -relation Vec_type: `%|-%:%`(store, vec, vectype) - ;; 7-runtime-typing.watsup - rule _{s : store, vt : vectype, c : vec_(vt)}: - `%|-%:%`(s, VCONST_vec(vt, c), vt) - -;; 7-runtime-typing.watsup -rec { - -;; 7-runtime-typing.watsup:7.1-7.42 -relation Ref_type: `%|-%:%`(store, ref, reftype) - ;; 7-runtime-typing.watsup:17.1-18.35 - rule null{s : store, ht : heaptype}: - `%|-%:%`(s, REF.NULL_ref(ht), REF_reftype(`NULL%?`_nul(?(())), ht)) - - ;; 7-runtime-typing.watsup:20.1-21.37 - rule i31{s : store, i : u31}: - `%|-%:%`(s, REF.I31_NUM_ref(i), REF_reftype(`NULL%?`_nul(?()), I31_heaptype)) - - ;; 7-runtime-typing.watsup:23.1-25.31 - rule struct{s : store, a : addr, dt : deftype}: - `%|-%:%`(s, REF.STRUCT_ADDR_ref(a), REF_reftype(`NULL%?`_nul(?()), (dt : deftype <: heaptype))) - -- if (s.STRUCTS_store[a].TYPE_structinst = dt) - - ;; 7-runtime-typing.watsup:27.1-29.30 - rule array{s : store, a : addr, dt : deftype}: - `%|-%:%`(s, REF.ARRAY_ADDR_ref(a), REF_reftype(`NULL%?`_nul(?()), (dt : deftype <: heaptype))) - -- if (s.ARRAYS_store[a].TYPE_arrayinst = dt) - - ;; 7-runtime-typing.watsup:31.1-33.29 - rule func{s : store, a : addr, dt : deftype}: - `%|-%:%`(s, REF.FUNC_ADDR_ref(a), REF_reftype(`NULL%?`_nul(?()), (dt : deftype <: heaptype))) - -- if (s.FUNCS_store[a].TYPE_funcinst = dt) - - ;; 7-runtime-typing.watsup:35.1-36.38 - rule exn{s : store, a : addr}: - `%|-%:%`(s, REF.EXN_ADDR_ref(a), REF_reftype(`NULL%?`_nul(?()), EXN_heaptype)) - - ;; 7-runtime-typing.watsup:38.1-39.39 - rule host{s : store, a : addr}: - `%|-%:%`(s, REF.HOST_ADDR_ref(a), REF_reftype(`NULL%?`_nul(?()), ANY_heaptype)) - - ;; 7-runtime-typing.watsup:41.1-42.45 - rule extern{s : store, addrref : addrref}: - `%|-%:%`(s, REF.EXTERN_ref(addrref), REF_reftype(`NULL%?`_nul(?()), EXTERN_heaptype)) - - ;; 7-runtime-typing.watsup:44.1-47.34 - rule sub{s : store, ref : ref, rt : reftype, rt' : reftype}: - `%|-%:%`(s, ref, rt) - -- Ref_type: `%|-%:%`(s, ref, rt') - -- Reftype_sub: `%|-%<:%`({TYPES [], RECS [], FUNCS [], GLOBALS [], TABLES [], MEMS [], TAGS [], ELEMS [], DATAS [], LOCALS [], LABELS [], RETURN ?(), REFS []}, rt', rt) -} - -;; 7-runtime-typing.watsup -relation Val_type: `%|-%:%`(store, val, valtype) - ;; 7-runtime-typing.watsup - rule num{s : store, num : num, nt : numtype}: - `%|-%:%`(s, (num : num <: val), (nt : numtype <: valtype)) - -- Num_type: `%|-%:%`(s, num, nt) - - ;; 7-runtime-typing.watsup - rule vec{s : store, vec : vec, vt : vectype}: - `%|-%:%`(s, (vec : vec <: val), (vt : vectype <: valtype)) - -- Vec_type: `%|-%:%`(s, vec, vt) - - ;; 7-runtime-typing.watsup - rule ref{s : store, ref : ref, rt : reftype}: - `%|-%:%`(s, (ref : ref <: val), (rt : reftype <: valtype)) - -- Ref_type: `%|-%:%`(s, ref, rt) - -;; 7-runtime-typing.watsup -rec { - -;; 7-runtime-typing.watsup:67.1-67.59 -relation Externaddr_type: `%|-%:%`(store, externaddr, externtype) - ;; 7-runtime-typing.watsup:69.1-71.30 - rule func{s : store, a : addr, funcinst : funcinst}: - `%|-%:%`(s, FUNC_externaddr(a), FUNC_externtype((funcinst.TYPE_funcinst : deftype <: typeuse))) - -- if (s.FUNCS_store[a] = funcinst) - - ;; 7-runtime-typing.watsup:73.1-75.34 - rule global{s : store, a : addr, globalinst : globalinst}: - `%|-%:%`(s, GLOBAL_externaddr(a), GLOBAL_externtype(globalinst.TYPE_globalinst)) - -- if (s.GLOBALS_store[a] = globalinst) - - ;; 7-runtime-typing.watsup:77.1-79.32 - rule table{s : store, a : addr, tableinst : tableinst}: - `%|-%:%`(s, TABLE_externaddr(a), TABLE_externtype(tableinst.TYPE_tableinst)) - -- if (s.TABLES_store[a] = tableinst) - - ;; 7-runtime-typing.watsup:81.1-83.28 - rule mem{s : store, a : addr, meminst : meminst}: - `%|-%:%`(s, MEM_externaddr(a), MEM_externtype(meminst.TYPE_meminst)) - -- if (s.MEMS_store[a] = meminst) - - ;; 7-runtime-typing.watsup:85.1-87.28 - rule tag{s : store, a : addr, taginst : taginst}: - `%|-%:%`(s, TAG_externaddr(a), TAG_externtype((taginst.TYPE_taginst : deftype <: typeuse))) - -- if (s.TAGS_store[a] = taginst) - - ;; 7-runtime-typing.watsup:89.1-92.37 - rule sub{s : store, externaddr : externaddr, xt : externtype, xt' : externtype}: - `%|-%:%`(s, externaddr, xt) - -- Externaddr_type: `%|-%:%`(s, externaddr, xt') - -- Externtype_sub: `%|-%<:%`({TYPES [], RECS [], FUNCS [], GLOBALS [], TABLES [], MEMS [], TAGS [], ELEMS [], DATAS [], LOCALS [], LABELS [], RETURN ?(), REFS []}, xt', xt) -} - -;; 8-reduction.watsup -relation Step_pure: `%~>%`(instr*, instr*) - ;; 8-reduction.watsup - rule unreachable: - `%~>%`([UNREACHABLE_instr], [TRAP_instr]) - - ;; 8-reduction.watsup - rule nop: - `%~>%`([NOP_instr], []) - - ;; 8-reduction.watsup - rule drop{val : val}: - `%~>%`([(val : val <: instr) DROP_instr], []) - - ;; 8-reduction.watsup - rule `select-true`{val_1 : val, val_2 : val, c : num_(I32_numtype), `t*?` : valtype*?}: - `%~>%`([(val_1 : val <: instr) (val_2 : val <: instr) CONST_instr(I32_numtype, c) `SELECT()%?`_instr(t*{t <- `t*`}?{`t*` <- `t*?`})], [(val_1 : val <: instr)]) - -- if (c!`%`_num_.0 =/= 0) - - ;; 8-reduction.watsup - rule `select-false`{val_1 : val, val_2 : val, c : num_(I32_numtype), `t*?` : valtype*?}: - `%~>%`([(val_1 : val <: instr) (val_2 : val <: instr) CONST_instr(I32_numtype, c) `SELECT()%?`_instr(t*{t <- `t*`}?{`t*` <- `t*?`})], [(val_2 : val <: instr)]) - -- if (c!`%`_num_.0 = 0) - - ;; 8-reduction.watsup - rule `if-true`{c : num_(I32_numtype), bt : blocktype, `instr_1*` : instr*, `instr_2*` : instr*}: - `%~>%`([CONST_instr(I32_numtype, c) `IF%%ELSE%`_instr(bt, instr_1*{instr_1 <- `instr_1*`}, instr_2*{instr_2 <- `instr_2*`})], [BLOCK_instr(bt, instr_1*{instr_1 <- `instr_1*`})]) - -- if (c!`%`_num_.0 =/= 0) - - ;; 8-reduction.watsup - rule `if-false`{c : num_(I32_numtype), bt : blocktype, `instr_1*` : instr*, `instr_2*` : instr*}: - `%~>%`([CONST_instr(I32_numtype, c) `IF%%ELSE%`_instr(bt, instr_1*{instr_1 <- `instr_1*`}, instr_2*{instr_2 <- `instr_2*`})], [BLOCK_instr(bt, instr_2*{instr_2 <- `instr_2*`})]) - -- if (c!`%`_num_.0 = 0) - - ;; 8-reduction.watsup - rule `label-vals`{n : n, `instr*` : instr*, `val*` : val*}: - `%~>%`([`LABEL_%{%}%`_instr(n, instr*{instr <- `instr*`}, (val : val <: instr)*{val <- `val*`})], (val : val <: instr)*{val <- `val*`}) - - ;; 8-reduction.watsup - rule `br-label-zero`{n : n, `instr'*` : instr*, `val'*` : val*, `val*` : val*, l : labelidx, `instr*` : instr*}: - `%~>%`([`LABEL_%{%}%`_instr(n, instr'*{instr' <- `instr'*`}, (val' : val <: instr)*{val' <- `val'*`} ++ (val : val <: instr)^n{val <- `val*`} ++ [BR_instr(l)] ++ instr*{instr <- `instr*`})], (val : val <: instr)^n{val <- `val*`} ++ instr'*{instr' <- `instr'*`}) - -- if (l!`%`_labelidx.0 = 0) - - ;; 8-reduction.watsup - rule `br-label-succ`{n : n, `instr'*` : instr*, `val*` : val*, l : labelidx, `instr*` : instr*}: - `%~>%`([`LABEL_%{%}%`_instr(n, instr'*{instr' <- `instr'*`}, (val : val <: instr)*{val <- `val*`} ++ [BR_instr(l)] ++ instr*{instr <- `instr*`})], (val : val <: instr)*{val <- `val*`} ++ [BR_instr(`%`_labelidx((((l!`%`_labelidx.0 : nat <:> int) - (1 : nat <:> int)) : int <:> nat)))]) - -- if (l!`%`_labelidx.0 > 0) - - ;; 8-reduction.watsup - rule `br-handler`{n : n, `catch*` : catch*, `val*` : val*, l : labelidx, `instr*` : instr*}: - `%~>%`([`HANDLER_%{%}%`_instr(n, catch*{catch <- `catch*`}, (val : val <: instr)*{val <- `val*`} ++ [BR_instr(l)] ++ instr*{instr <- `instr*`})], (val : val <: instr)*{val <- `val*`} ++ [BR_instr(l)]) - - ;; 8-reduction.watsup - rule `br_if-true`{c : num_(I32_numtype), l : labelidx}: - `%~>%`([CONST_instr(I32_numtype, c) BR_IF_instr(l)], [BR_instr(l)]) - -- if (c!`%`_num_.0 =/= 0) - - ;; 8-reduction.watsup - rule `br_if-false`{c : num_(I32_numtype), l : labelidx}: - `%~>%`([CONST_instr(I32_numtype, c) BR_IF_instr(l)], []) - -- if (c!`%`_num_.0 = 0) - - ;; 8-reduction.watsup - rule `br_table-lt`{i : num_(I32_numtype), `l*` : labelidx*, l' : labelidx}: - `%~>%`([CONST_instr(I32_numtype, i) BR_TABLE_instr(l*{l <- `l*`}, l')], [BR_instr(l*{l <- `l*`}[i!`%`_num_.0])]) - -- if (i!`%`_num_.0 < |l*{l <- `l*`}|) - - ;; 8-reduction.watsup - rule `br_table-ge`{i : num_(I32_numtype), `l*` : labelidx*, l' : labelidx}: - `%~>%`([CONST_instr(I32_numtype, i) BR_TABLE_instr(l*{l <- `l*`}, l')], [BR_instr(l')]) - -- if (i!`%`_num_.0 >= |l*{l <- `l*`}|) - - ;; 8-reduction.watsup - rule `br_on_null-null`{val : val, l : labelidx, ht : heaptype}: - `%~>%`([(val : val <: instr) BR_ON_NULL_instr(l)], [BR_instr(l)]) - -- if (val = REF.NULL_val(ht)) - - ;; 8-reduction.watsup - rule `br_on_null-addr`{val : val, l : labelidx}: - `%~>%`([(val : val <: instr) BR_ON_NULL_instr(l)], [(val : val <: instr)]) - -- otherwise - - ;; 8-reduction.watsup - rule `br_on_non_null-null`{val : val, l : labelidx, ht : heaptype}: - `%~>%`([(val : val <: instr) BR_ON_NON_NULL_instr(l)], []) - -- if (val = REF.NULL_val(ht)) - - ;; 8-reduction.watsup - rule `br_on_non_null-addr`{val : val, l : labelidx}: - `%~>%`([(val : val <: instr) BR_ON_NON_NULL_instr(l)], [(val : val <: instr) BR_instr(l)]) - -- otherwise - - ;; 8-reduction.watsup - rule call_indirect{x : idx, yy : typeuse}: - `%~>%`([CALL_INDIRECT_instr(x, yy)], [TABLE.GET_instr(x) REF.CAST_instr(REF_reftype(`NULL%?`_nul(?(())), (yy : typeuse <: heaptype))) CALL_REF_instr(yy)]) - - ;; 8-reduction.watsup - rule return_call_indirect{x : idx, yy : typeuse}: - `%~>%`([RETURN_CALL_INDIRECT_instr(x, yy)], [TABLE.GET_instr(x) REF.CAST_instr(REF_reftype(`NULL%?`_nul(?(())), (yy : typeuse <: heaptype))) RETURN_CALL_REF_instr(yy)]) - - ;; 8-reduction.watsup - rule `frame-vals`{n : n, f : frame, `val*` : val*}: - `%~>%`([`FRAME_%{%}%`_instr(n, f, (val : val <: instr)^n{val <- `val*`})], (val : val <: instr)^n{val <- `val*`}) - - ;; 8-reduction.watsup - rule `return-frame`{n : n, f : frame, `val'*` : val*, `val*` : val*, `instr*` : instr*}: - `%~>%`([`FRAME_%{%}%`_instr(n, f, (val' : val <: instr)*{val' <- `val'*`} ++ (val : val <: instr)^n{val <- `val*`} ++ [RETURN_instr] ++ instr*{instr <- `instr*`})], (val : val <: instr)^n{val <- `val*`}) - - ;; 8-reduction.watsup - rule `return-label`{n : n, `instr'*` : instr*, `val*` : val*, `instr*` : instr*}: - `%~>%`([`LABEL_%{%}%`_instr(n, instr'*{instr' <- `instr'*`}, (val : val <: instr)*{val <- `val*`} ++ [RETURN_instr] ++ instr*{instr <- `instr*`})], (val : val <: instr)*{val <- `val*`} ++ [RETURN_instr]) - - ;; 8-reduction.watsup - rule `return-handler`{n : n, `catch*` : catch*, `val*` : val*, `instr*` : instr*}: - `%~>%`([`HANDLER_%{%}%`_instr(n, catch*{catch <- `catch*`}, (val : val <: instr)*{val <- `val*`} ++ [RETURN_instr] ++ instr*{instr <- `instr*`})], (val : val <: instr)*{val <- `val*`} ++ [RETURN_instr]) - - ;; 8-reduction.watsup - rule `handler-vals`{n : n, `catch*` : catch*, `val*` : val*}: - `%~>%`([`HANDLER_%{%}%`_instr(n, catch*{catch <- `catch*`}, (val : val <: instr)*{val <- `val*`})], (val : val <: instr)*{val <- `val*`}) - - ;; 8-reduction.watsup - rule `trap-instrs`{`val*` : val*, `instr*` : instr*}: - `%~>%`((val : val <: instr)*{val <- `val*`} ++ [TRAP_instr] ++ instr*{instr <- `instr*`}, [TRAP_instr]) - -- if ((val*{val <- `val*`} =/= []) \/ (instr*{instr <- `instr*`} =/= [])) - - ;; 8-reduction.watsup - rule `trap-label`{n : n, `instr'*` : instr*}: - `%~>%`([`LABEL_%{%}%`_instr(n, instr'*{instr' <- `instr'*`}, [TRAP_instr])], [TRAP_instr]) - - ;; 8-reduction.watsup - rule `trap-frame`{n : n, f : frame}: - `%~>%`([`FRAME_%{%}%`_instr(n, f, [TRAP_instr])], [TRAP_instr]) - - ;; 8-reduction.watsup - rule `unop-val`{nt : numtype, c_1 : num_(nt), unop : unop_(nt), c : num_(nt)}: - `%~>%`([CONST_instr(nt, c_1) UNOP_instr(nt, unop)], [CONST_instr(nt, c)]) - -- if c <- $unop_(nt, unop, c_1) - - ;; 8-reduction.watsup - rule `unop-trap`{nt : numtype, c_1 : num_(nt), unop : unop_(nt)}: - `%~>%`([CONST_instr(nt, c_1) UNOP_instr(nt, unop)], [TRAP_instr]) - -- if ($unop_(nt, unop, c_1) = []) - - ;; 8-reduction.watsup - rule `binop-val`{nt : numtype, c_1 : num_(nt), c_2 : num_(nt), binop : binop_(nt), c : num_(nt)}: - `%~>%`([CONST_instr(nt, c_1) CONST_instr(nt, c_2) BINOP_instr(nt, binop)], [CONST_instr(nt, c)]) - -- if c <- $binop_(nt, binop, c_1, c_2) - - ;; 8-reduction.watsup - rule `binop-trap`{nt : numtype, c_1 : num_(nt), c_2 : num_(nt), binop : binop_(nt)}: - `%~>%`([CONST_instr(nt, c_1) CONST_instr(nt, c_2) BINOP_instr(nt, binop)], [TRAP_instr]) - -- if ($binop_(nt, binop, c_1, c_2) = []) - - ;; 8-reduction.watsup - rule testop{nt : numtype, c_1 : num_(nt), testop : testop_(nt), c : num_(I32_numtype)}: - `%~>%`([CONST_instr(nt, c_1) TESTOP_instr(nt, testop)], [CONST_instr(I32_numtype, c)]) - -- if (c = $testop_(nt, testop, c_1)) - - ;; 8-reduction.watsup - rule relop{nt : numtype, c_1 : num_(nt), c_2 : num_(nt), relop : relop_(nt), c : num_(I32_numtype)}: - `%~>%`([CONST_instr(nt, c_1) CONST_instr(nt, c_2) RELOP_instr(nt, relop)], [CONST_instr(I32_numtype, c)]) - -- if (c = $relop_(nt, relop, c_1, c_2)) - - ;; 8-reduction.watsup - rule `cvtop-val`{nt_1 : numtype, c_1 : num_(nt_1), nt_2 : numtype, cvtop : cvtop__(nt_1, nt_2), c : num_(nt_2)}: - `%~>%`([CONST_instr(nt_1, c_1) CVTOP_instr(nt_2, nt_1, cvtop)], [CONST_instr(nt_2, c)]) - -- if c <- $cvtop__(nt_1, nt_2, cvtop, c_1) - - ;; 8-reduction.watsup - rule `cvtop-trap`{nt_1 : numtype, c_1 : num_(nt_1), nt_2 : numtype, cvtop : cvtop__(nt_1, nt_2)}: - `%~>%`([CONST_instr(nt_1, c_1) CVTOP_instr(nt_2, nt_1, cvtop)], [TRAP_instr]) - -- if ($cvtop__(nt_1, nt_2, cvtop, c_1) = []) - - ;; 8-reduction.watsup - rule ref.i31{i : num_(I32_numtype)}: - `%~>%`([CONST_instr(I32_numtype, i) REF.I31_instr], [REF.I31_NUM_instr($wrap__(32, 31, i))]) - - ;; 8-reduction.watsup - rule `ref.is_null-true`{ref : ref, ht : heaptype}: - `%~>%`([(ref : ref <: instr) REF.IS_NULL_instr], [CONST_instr(I32_numtype, `%`_num_(1))]) - -- if (ref = REF.NULL_ref(ht)) - - ;; 8-reduction.watsup - rule `ref.is_null-false`{ref : ref}: - `%~>%`([(ref : ref <: instr) REF.IS_NULL_instr], [CONST_instr(I32_numtype, `%`_num_(0))]) - -- otherwise - - ;; 8-reduction.watsup - rule `ref.as_non_null-null`{ref : ref, ht : heaptype}: - `%~>%`([(ref : ref <: instr) REF.AS_NON_NULL_instr], [TRAP_instr]) - -- if (ref = REF.NULL_ref(ht)) - - ;; 8-reduction.watsup - rule `ref.as_non_null-addr`{ref : ref}: - `%~>%`([(ref : ref <: instr) REF.AS_NON_NULL_instr], [(ref : ref <: instr)]) - -- otherwise - - ;; 8-reduction.watsup - rule `ref.eq-null`{ref_1 : ref, ref_2 : ref, ht_1 : heaptype, ht_2 : heaptype}: - `%~>%`([(ref_1 : ref <: instr) (ref_2 : ref <: instr) REF.EQ_instr], [CONST_instr(I32_numtype, `%`_num_(1))]) - -- if ((ref_1 = REF.NULL_ref(ht_1)) /\ (ref_2 = REF.NULL_ref(ht_2))) - - ;; 8-reduction.watsup - rule `ref.eq-true`{ref_1 : ref, ref_2 : ref}: - `%~>%`([(ref_1 : ref <: instr) (ref_2 : ref <: instr) REF.EQ_instr], [CONST_instr(I32_numtype, `%`_num_(1))]) - -- otherwise - -- if (ref_1 = ref_2) - - ;; 8-reduction.watsup - rule `ref.eq-false`{ref_1 : ref, ref_2 : ref}: - `%~>%`([(ref_1 : ref <: instr) (ref_2 : ref <: instr) REF.EQ_instr], [CONST_instr(I32_numtype, `%`_num_(0))]) - -- otherwise - - ;; 8-reduction.watsup - rule `i31.get-null`{ht : heaptype, sx : sx}: - `%~>%`([REF.NULL_instr(ht) I31.GET_instr(sx)], [TRAP_instr]) - - ;; 8-reduction.watsup - rule `i31.get-num`{i : u31, sx : sx}: - `%~>%`([REF.I31_NUM_instr(i) I31.GET_instr(sx)], [CONST_instr(I32_numtype, $extend__(31, 32, sx, i))]) - - ;; 8-reduction.watsup - rule array.new{val : val, n : n, x : idx}: - `%~>%`([(val : val <: instr) CONST_instr(I32_numtype, `%`_num_(n)) ARRAY.NEW_instr(x)], (val : val <: instr)^n{} ++ [ARRAY.NEW_FIXED_instr(x, `%`_u32(n))]) - - ;; 8-reduction.watsup - rule `extern.convert_any-null`{ht : heaptype}: - `%~>%`([REF.NULL_instr(ht) EXTERN.CONVERT_ANY_instr], [REF.NULL_instr(EXTERN_heaptype)]) - - ;; 8-reduction.watsup - rule `extern.convert_any-addr`{addrref : addrref}: - `%~>%`([(addrref : addrref <: instr) EXTERN.CONVERT_ANY_instr], [REF.EXTERN_instr(addrref)]) - - ;; 8-reduction.watsup - rule `any.convert_extern-null`{ht : heaptype}: - `%~>%`([REF.NULL_instr(ht) ANY.CONVERT_EXTERN_instr], [REF.NULL_instr(ANY_heaptype)]) - - ;; 8-reduction.watsup - rule `any.convert_extern-addr`{addrref : addrref}: - `%~>%`([REF.EXTERN_instr(addrref) ANY.CONVERT_EXTERN_instr], [(addrref : addrref <: instr)]) - - ;; 8-reduction.watsup - rule vvunop{c_1 : vec_(V128_Vnn), vvunop : vvunop, c : vec_(V128_Vnn)}: - `%~>%`([VCONST_instr(V128_vectype, c_1) VVUNOP_instr(V128_vectype, vvunop)], [VCONST_instr(V128_vectype, c)]) - -- if c <- $vvunop_(V128_vectype, vvunop, c_1) - - ;; 8-reduction.watsup - rule vvbinop{c_1 : vec_(V128_Vnn), c_2 : vec_(V128_Vnn), vvbinop : vvbinop, c : vec_(V128_Vnn)}: - `%~>%`([VCONST_instr(V128_vectype, c_1) VCONST_instr(V128_vectype, c_2) VVBINOP_instr(V128_vectype, vvbinop)], [VCONST_instr(V128_vectype, c)]) - -- if c <- $vvbinop_(V128_vectype, vvbinop, c_1, c_2) - - ;; 8-reduction.watsup - rule vvternop{c_1 : vec_(V128_Vnn), c_2 : vec_(V128_Vnn), c_3 : vec_(V128_Vnn), vvternop : vvternop, c : vec_(V128_Vnn)}: - `%~>%`([VCONST_instr(V128_vectype, c_1) VCONST_instr(V128_vectype, c_2) VCONST_instr(V128_vectype, c_3) VVTERNOP_instr(V128_vectype, vvternop)], [VCONST_instr(V128_vectype, c)]) - -- if c <- $vvternop_(V128_vectype, vvternop, c_1, c_2, c_3) - - ;; 8-reduction.watsup - rule vvtestop{c_1 : vec_(V128_Vnn), c : num_(I32_numtype)}: - `%~>%`([VCONST_instr(V128_vectype, c_1) VVTESTOP_instr(V128_vectype, ANY_TRUE_vvtestop)], [CONST_instr(I32_numtype, c)]) - -- if (c = $ine_($vsize(V128_vectype), c_1, `%`_iN(0))) - - ;; 8-reduction.watsup - rule `vunop-val`{c_1 : vec_(V128_Vnn), sh : shape, vunop : vunop_(sh), c : vec_(V128_Vnn)}: - `%~>%`([VCONST_instr(V128_vectype, c_1) VUNOP_instr(sh, vunop)], [VCONST_instr(V128_vectype, c)]) - -- if c <- $vunop_(sh, vunop, c_1) - - ;; 8-reduction.watsup - rule `vunop-trap`{c_1 : vec_(V128_Vnn), sh : shape, vunop : vunop_(sh)}: - `%~>%`([VCONST_instr(V128_vectype, c_1) VUNOP_instr(sh, vunop)], [TRAP_instr]) - -- if ($vunop_(sh, vunop, c_1) = []) - - ;; 8-reduction.watsup - rule `vbinop-val`{c_1 : vec_(V128_Vnn), c_2 : vec_(V128_Vnn), sh : shape, vbinop : vbinop_(sh), c : vec_(V128_Vnn)}: - `%~>%`([VCONST_instr(V128_vectype, c_1) VCONST_instr(V128_vectype, c_2) VBINOP_instr(sh, vbinop)], [VCONST_instr(V128_vectype, c)]) - -- if c <- $vbinop_(sh, vbinop, c_1, c_2) - - ;; 8-reduction.watsup - rule `vbinop-trap`{c_1 : vec_(V128_Vnn), c_2 : vec_(V128_Vnn), sh : shape, vbinop : vbinop_(sh)}: - `%~>%`([VCONST_instr(V128_vectype, c_1) VCONST_instr(V128_vectype, c_2) VBINOP_instr(sh, vbinop)], [TRAP_instr]) - -- if ($vbinop_(sh, vbinop, c_1, c_2) = []) - - ;; 8-reduction.watsup - rule `vternop-val`{c_1 : vec_(V128_Vnn), c_2 : vec_(V128_Vnn), c_3 : vec_(V128_Vnn), sh : shape, vternop : vternop_(sh), c : vec_(V128_Vnn)}: - `%~>%`([VCONST_instr(V128_vectype, c_1) VCONST_instr(V128_vectype, c_2) VCONST_instr(V128_vectype, c_3) VTERNOP_instr(sh, vternop)], [VCONST_instr(V128_vectype, c)]) - -- if c <- $vternop_(sh, vternop, c_1, c_2, c_3) - - ;; 8-reduction.watsup - rule `vternop-trap`{c_1 : vec_(V128_Vnn), c_2 : vec_(V128_Vnn), c_3 : vec_(V128_Vnn), sh : shape, vternop : vternop_(sh)}: - `%~>%`([VCONST_instr(V128_vectype, c_1) VCONST_instr(V128_vectype, c_2) VCONST_instr(V128_vectype, c_3) VTERNOP_instr(sh, vternop)], [TRAP_instr]) - -- if ($vternop_(sh, vternop, c_1, c_2, c_3) = []) - - ;; 8-reduction.watsup - rule vtestop{c_1 : vec_(V128_Vnn), sh : shape, vtestop : vtestop_(sh), i : num_(I32_numtype)}: - `%~>%`([VCONST_instr(V128_vectype, c_1) VTESTOP_instr(sh, vtestop)], [CONST_instr(I32_numtype, i)]) - -- if (i = $vtestop_(sh, vtestop, c_1)) - - ;; 8-reduction.watsup - rule vrelop{c_1 : vec_(V128_Vnn), c_2 : vec_(V128_Vnn), sh : shape, vrelop : vrelop_(sh), c : vec_(V128_Vnn)}: - `%~>%`([VCONST_instr(V128_vectype, c_1) VCONST_instr(V128_vectype, c_2) VRELOP_instr(sh, vrelop)], [VCONST_instr(V128_vectype, c)]) - -- if (c = $vrelop_(sh, vrelop, c_1, c_2)) - - ;; 8-reduction.watsup - rule vshiftop{c_1 : vec_(V128_Vnn), i : num_(I32_numtype), sh : ishape, vshiftop : vshiftop_(sh), c : vec_(V128_Vnn)}: - `%~>%`([VCONST_instr(V128_vectype, c_1) CONST_instr(I32_numtype, i) VSHIFTOP_instr(sh, vshiftop)], [VCONST_instr(V128_vectype, c)]) - -- if (c = $vshiftop_(sh, vshiftop, c_1, i)) - - ;; 8-reduction.watsup - rule vbitmask{c_1 : vec_(V128_Vnn), sh : ishape, c : num_(I32_numtype)}: - `%~>%`([VCONST_instr(V128_vectype, c_1) VBITMASK_instr(sh)], [CONST_instr(I32_numtype, c)]) - -- if (c = $vbitmaskop_(sh, c_1)) - - ;; 8-reduction.watsup - rule vswizzlop{c_1 : vec_(V128_Vnn), c_2 : vec_(V128_Vnn), sh : bshape, swizzlop : vswizzlop_(sh), c : vec_(V128_Vnn)}: - `%~>%`([VCONST_instr(V128_vectype, c_1) VCONST_instr(V128_vectype, c_2) VSWIZZLOP_instr(sh, swizzlop)], [VCONST_instr(V128_vectype, c)]) - -- if (c = $vswizzlop_(sh, swizzlop, c_1, c_2)) - - ;; 8-reduction.watsup - rule vshuffle{c_1 : vec_(V128_Vnn), c_2 : vec_(V128_Vnn), sh : bshape, `i*` : laneidx*, c : vec_(V128_Vnn)}: - `%~>%`([VCONST_instr(V128_vectype, c_1) VCONST_instr(V128_vectype, c_2) VSHUFFLE_instr(sh, i*{i <- `i*`})], [VCONST_instr(V128_vectype, c)]) - -- if (c = $vshufflop_(sh, i*{i <- `i*`}, c_1, c_2)) - - ;; 8-reduction.watsup - rule vsplat{Lnn : Lnn, c_1 : num_($lunpack(Lnn)), M : M, c : vec_(V128_Vnn)}: - `%~>%`([CONST_instr($lunpack(Lnn), c_1) VSPLAT_instr(`%X%`_shape(Lnn, `%`_dim(M)))], [VCONST_instr(V128_vectype, c)]) - -- if (c = $invlanes_(`%X%`_shape(Lnn, `%`_dim(M)), $lpacknum_(Lnn, c_1)^M{})) - - ;; 8-reduction.watsup - rule `vextract_lane-num`{c_1 : vec_(V128_Vnn), nt : numtype, M : M, i : laneidx, c_2 : num_(nt)}: - `%~>%`([VCONST_instr(V128_vectype, c_1) VEXTRACT_LANE_instr(`%X%`_shape((nt : numtype <: lanetype), `%`_dim(M)), ?(), i)], [CONST_instr(nt, c_2)]) - -- if (c_2 = $lanes_(`%X%`_shape((nt : numtype <: lanetype), `%`_dim(M)), c_1)[i!`%`_laneidx.0]) - - ;; 8-reduction.watsup - rule `vextract_lane-pack`{c_1 : vec_(V128_Vnn), pt : packtype, M : M, sx : sx, i : laneidx, c_2 : num_(I32_numtype)}: - `%~>%`([VCONST_instr(V128_vectype, c_1) VEXTRACT_LANE_instr(`%X%`_shape((pt : packtype <: lanetype), `%`_dim(M)), ?(sx), i)], [CONST_instr(I32_numtype, c_2)]) - -- if (c_2 = $extend__($psize(pt), 32, sx, $lanes_(`%X%`_shape((pt : packtype <: lanetype), `%`_dim(M)), c_1)[i!`%`_laneidx.0])) - - ;; 8-reduction.watsup - rule vreplace_lane{c_1 : vec_(V128_Vnn), Lnn : Lnn, c_2 : num_($lunpack(Lnn)), M : M, i : laneidx, c : vec_(V128_Vnn)}: - `%~>%`([VCONST_instr(V128_vectype, c_1) CONST_instr($lunpack(Lnn), c_2) VREPLACE_LANE_instr(`%X%`_shape(Lnn, `%`_dim(M)), i)], [VCONST_instr(V128_vectype, c)]) - -- if (c = $invlanes_(`%X%`_shape(Lnn, `%`_dim(M)), $lanes_(`%X%`_shape(Lnn, `%`_dim(M)), c_1)[[i!`%`_laneidx.0] = $lpacknum_(Lnn, c_2)])) - - ;; 8-reduction.watsup - rule vextunop{c_1 : vec_(V128_Vnn), sh_2 : ishape, sh_1 : ishape, vextunop : vextunop__(sh_1, sh_2), c : vec_(V128_Vnn)}: - `%~>%`([VCONST_instr(V128_vectype, c_1) VEXTUNOP_instr(sh_2, sh_1, vextunop)], [VCONST_instr(V128_vectype, c)]) - -- if ($vextunop__(sh_1, sh_2, vextunop, c_1) = c) - - ;; 8-reduction.watsup - rule vextbinop{c_1 : vec_(V128_Vnn), c_2 : vec_(V128_Vnn), sh_2 : ishape, sh_1 : ishape, vextbinop : vextbinop__(sh_1, sh_2), c : vec_(V128_Vnn)}: - `%~>%`([VCONST_instr(V128_vectype, c_1) VCONST_instr(V128_vectype, c_2) VEXTBINOP_instr(sh_2, sh_1, vextbinop)], [VCONST_instr(V128_vectype, c)]) - -- if ($vextbinop__(sh_1, sh_2, vextbinop, c_1, c_2) = c) - - ;; 8-reduction.watsup - rule vextternop{c_1 : vec_(V128_Vnn), c_2 : vec_(V128_Vnn), c_3 : vec_(V128_Vnn), sh_2 : ishape, sh_1 : ishape, vextternop : vextternop__(sh_1, sh_2), c : vec_(V128_Vnn)}: - `%~>%`([VCONST_instr(V128_vectype, c_1) VCONST_instr(V128_vectype, c_2) VCONST_instr(V128_vectype, c_3) VEXTTERNOP_instr(sh_2, sh_1, vextternop)], [VCONST_instr(V128_vectype, c)]) - -- if ($vextternop__(sh_1, sh_2, vextternop, c_1, c_2, c_3) = c) - - ;; 8-reduction.watsup - rule vnarrow{c_1 : vec_(V128_Vnn), c_2 : vec_(V128_Vnn), sh_2 : ishape, sh_1 : ishape, sx : sx, c : vec_(V128_Vnn)}: - `%~>%`([VCONST_instr(V128_vectype, c_1) VCONST_instr(V128_vectype, c_2) VNARROW_instr(sh_2, sh_1, sx)], [VCONST_instr(V128_vectype, c)]) - -- if (c = $vnarrowop__(sh_1!`%`_ishape.0, sh_2!`%`_ishape.0, sx, c_1, c_2)) - - ;; 8-reduction.watsup - rule vcvtop{c_1 : vec_(V128_Vnn), sh_2 : shape, sh_1 : shape, vcvtop : vcvtop__(sh_1, sh_2), `half?` : half__(sh_1, sh_2)?, `zero?` : zero__(sh_1, sh_2)?, c : vec_(V128_Vnn)}: - `%~>%`([VCONST_instr(V128_vectype, c_1) VCVTOP_instr(sh_2, sh_1, vcvtop, half?{half <- `half?`}, zero?{zero <- `zero?`})], [VCONST_instr(V128_vectype, c)]) - -- if (c = $vcvtop__(sh_1, sh_2, vcvtop, half?{half <- `half?`}, zero?{zero <- `zero?`}, c_1)) - - ;; 8-reduction.watsup - rule local.tee{val : val, x : idx}: - `%~>%`([(val : val <: instr) LOCAL.TEE_instr(x)], [(val : val <: instr) (val : val <: instr) LOCAL.SET_instr(x)]) - -;; 8-reduction.watsup -def $blocktype_(state : state, blocktype : blocktype) : functype - ;; 8-reduction.watsup - def $blocktype_{z : state, x : idx, ft : functype}(z, _IDX_blocktype(x)) = ft - -- Expand: `%~~%`($type(z, x), FUNC_comptype(ft)) - ;; 8-reduction.watsup - def $blocktype_{z : state, `t?` : valtype?}(z, _RESULT_blocktype(t?{t <- `t?`})) = `%->%`_functype(`%`_resulttype([]), `%`_resulttype(lift(t?{t <- `t?`}))) - -;; 8-reduction.watsup -relation Step_read: `%~>%`(config, instr*) - ;; 8-reduction.watsup - rule block{z : state, `val*` : val*, m : m, bt : blocktype, `instr*` : instr*, n : n, `t_1*` : valtype*, `t_2*` : valtype*}: - `%~>%`(`%;%`_config(z, (val : val <: instr)^m{val <- `val*`} ++ [BLOCK_instr(bt, instr*{instr <- `instr*`})]), [`LABEL_%{%}%`_instr(n, [], (val : val <: instr)^m{val <- `val*`} ++ instr*{instr <- `instr*`})]) - -- if ($blocktype_(z, bt) = `%->%`_functype(`%`_resulttype(t_1^m{t_1 <- `t_1*`}), `%`_resulttype(t_2^n{t_2 <- `t_2*`}))) - - ;; 8-reduction.watsup - rule loop{z : state, `val*` : val*, m : m, bt : blocktype, `instr*` : instr*, `t_1*` : valtype*, `t_2*` : valtype*, n : n}: - `%~>%`(`%;%`_config(z, (val : val <: instr)^m{val <- `val*`} ++ [LOOP_instr(bt, instr*{instr <- `instr*`})]), [`LABEL_%{%}%`_instr(m, [LOOP_instr(bt, instr*{instr <- `instr*`})], (val : val <: instr)^m{val <- `val*`} ++ instr*{instr <- `instr*`})]) - -- if ($blocktype_(z, bt) = `%->%`_functype(`%`_resulttype(t_1^m{t_1 <- `t_1*`}), `%`_resulttype(t_2^n{t_2 <- `t_2*`}))) - - ;; 8-reduction.watsup - rule `br_on_cast-succeed`{s : store, f : frame, ref : ref, l : labelidx, rt_1 : reftype, rt_2 : reftype, rt : reftype}: - `%~>%`(`%;%`_config(`%;%`_state(s, f), [(ref : ref <: instr) BR_ON_CAST_instr(l, rt_1, rt_2)]), [(ref : ref <: instr) BR_instr(l)]) - -- Ref_type: `%|-%:%`(s, ref, rt) - -- Reftype_sub: `%|-%<:%`({TYPES [], RECS [], FUNCS [], GLOBALS [], TABLES [], MEMS [], TAGS [], ELEMS [], DATAS [], LOCALS [], LABELS [], RETURN ?(), REFS []}, rt, $inst_reftype(f.MODULE_frame, rt_2)) - - ;; 8-reduction.watsup - rule `br_on_cast-fail`{s : store, f : frame, ref : ref, l : labelidx, rt_1 : reftype, rt_2 : reftype}: - `%~>%`(`%;%`_config(`%;%`_state(s, f), [(ref : ref <: instr) BR_ON_CAST_instr(l, rt_1, rt_2)]), [(ref : ref <: instr)]) - -- otherwise - - ;; 8-reduction.watsup - rule `br_on_cast_fail-succeed`{s : store, f : frame, ref : ref, l : labelidx, rt_1 : reftype, rt_2 : reftype, rt : reftype}: - `%~>%`(`%;%`_config(`%;%`_state(s, f), [(ref : ref <: instr) BR_ON_CAST_FAIL_instr(l, rt_1, rt_2)]), [(ref : ref <: instr)]) - -- Ref_type: `%|-%:%`(s, ref, rt) - -- Reftype_sub: `%|-%<:%`({TYPES [], RECS [], FUNCS [], GLOBALS [], TABLES [], MEMS [], TAGS [], ELEMS [], DATAS [], LOCALS [], LABELS [], RETURN ?(), REFS []}, rt, $inst_reftype(f.MODULE_frame, rt_2)) - - ;; 8-reduction.watsup - rule `br_on_cast_fail-fail`{s : store, f : frame, ref : ref, l : labelidx, rt_1 : reftype, rt_2 : reftype}: - `%~>%`(`%;%`_config(`%;%`_state(s, f), [(ref : ref <: instr) BR_ON_CAST_FAIL_instr(l, rt_1, rt_2)]), [(ref : ref <: instr) BR_instr(l)]) - -- otherwise - - ;; 8-reduction.watsup - rule call{z : state, x : idx, a : addr}: - `%~>%`(`%;%`_config(z, [CALL_instr(x)]), [REF.FUNC_ADDR_instr(a) CALL_REF_instr(($funcinst(z)[a].TYPE_funcinst : deftype <: typeuse))]) - -- if ($moduleinst(z).FUNCS_moduleinst[x!`%`_idx.0] = a) - - ;; 8-reduction.watsup - rule `call_ref-null`{z : state, ht : heaptype, yy : typeuse}: - `%~>%`(`%;%`_config(z, [REF.NULL_instr(ht) CALL_REF_instr(yy)]), [TRAP_instr]) - - ;; 8-reduction.watsup - rule `call_ref-func`{z : state, `val*` : val*, n : n, a : addr, yy : typeuse, m : m, f : frame, `instr*` : instr*, fi : funcinst, `t_1*` : valtype*, `t_2*` : valtype*, x : idx, `t*` : valtype*}: - `%~>%`(`%;%`_config(z, (val : val <: instr)^n{val <- `val*`} ++ [REF.FUNC_ADDR_instr(a) CALL_REF_instr(yy)]), [`FRAME_%{%}%`_instr(m, f, [`LABEL_%{%}%`_instr(m, [], instr*{instr <- `instr*`})])]) - -- if ($funcinst(z)[a] = fi) - -- Expand: `%~~%`(fi.TYPE_funcinst, FUNC_comptype(`%->%`_functype(`%`_resulttype(t_1^n{t_1 <- `t_1*`}), `%`_resulttype(t_2^m{t_2 <- `t_2*`})))) - -- if (fi.CODE_funcinst = FUNC_funccode(x, LOCAL_local(t)*{t <- `t*`}, instr*{instr <- `instr*`})) - -- if (f = {LOCALS ?(val)^n{val <- `val*`} ++ $default_(t)*{t <- `t*`}, MODULE fi.MODULE_funcinst}) - - ;; 8-reduction.watsup - rule return_call{z : state, x : idx, a : addr}: - `%~>%`(`%;%`_config(z, [RETURN_CALL_instr(x)]), [REF.FUNC_ADDR_instr(a) RETURN_CALL_REF_instr(($funcinst(z)[a].TYPE_funcinst : deftype <: typeuse))]) - -- if ($moduleinst(z).FUNCS_moduleinst[x!`%`_idx.0] = a) - - ;; 8-reduction.watsup - rule `return_call_ref-label`{z : state, k : n, `instr'*` : instr*, `val*` : val*, yy : typeuse, `instr*` : instr*}: - `%~>%`(`%;%`_config(z, [`LABEL_%{%}%`_instr(k, instr'*{instr' <- `instr'*`}, (val : val <: instr)*{val <- `val*`} ++ [RETURN_CALL_REF_instr(yy)] ++ instr*{instr <- `instr*`})]), (val : val <: instr)*{val <- `val*`} ++ [RETURN_CALL_REF_instr(yy)]) - - ;; 8-reduction.watsup - rule `return_call_ref-handler`{z : state, k : n, `catch*` : catch*, `val*` : val*, yy : typeuse, `instr*` : instr*}: - `%~>%`(`%;%`_config(z, [`HANDLER_%{%}%`_instr(k, catch*{catch <- `catch*`}, (val : val <: instr)*{val <- `val*`} ++ [RETURN_CALL_REF_instr(yy)] ++ instr*{instr <- `instr*`})]), (val : val <: instr)*{val <- `val*`} ++ [RETURN_CALL_REF_instr(yy)]) - - ;; 8-reduction.watsup - rule `return_call_ref-frame-null`{z : state, k : n, f : frame, `val*` : val*, ht : heaptype, yy : typeuse, `instr*` : instr*}: - `%~>%`(`%;%`_config(z, [`FRAME_%{%}%`_instr(k, f, (val : val <: instr)*{val <- `val*`} ++ [REF.NULL_instr(ht)] ++ [RETURN_CALL_REF_instr(yy)] ++ instr*{instr <- `instr*`})]), [TRAP_instr]) - - ;; 8-reduction.watsup - rule `return_call_ref-frame-addr`{z : state, k : n, f : frame, `val'*` : val*, `val*` : val*, n : n, a : addr, yy : typeuse, `instr*` : instr*, `t_1*` : valtype*, `t_2*` : valtype*, m : m}: - `%~>%`(`%;%`_config(z, [`FRAME_%{%}%`_instr(k, f, (val' : val <: instr)*{val' <- `val'*`} ++ (val : val <: instr)^n{val <- `val*`} ++ [REF.FUNC_ADDR_instr(a)] ++ [RETURN_CALL_REF_instr(yy)] ++ instr*{instr <- `instr*`})]), (val : val <: instr)^n{val <- `val*`} ++ [REF.FUNC_ADDR_instr(a) CALL_REF_instr(yy)]) - -- Expand: `%~~%`($funcinst(z)[a].TYPE_funcinst, FUNC_comptype(`%->%`_functype(`%`_resulttype(t_1^n{t_1 <- `t_1*`}), `%`_resulttype(t_2^m{t_2 <- `t_2*`})))) - - ;; 8-reduction.watsup - rule `throw_ref-null`{z : state, ht : heaptype}: - `%~>%`(`%;%`_config(z, [REF.NULL_instr(ht) THROW_REF_instr]), [TRAP_instr]) - - ;; 8-reduction.watsup - rule `throw_ref-instrs`{z : state, `val*` : val*, a : addr, `instr*` : instr*}: - `%~>%`(`%;%`_config(z, (val : val <: instr)*{val <- `val*`} ++ [REF.EXN_ADDR_instr(a)] ++ [THROW_REF_instr] ++ instr*{instr <- `instr*`}), [REF.EXN_ADDR_instr(a) THROW_REF_instr]) - -- if ((val*{val <- `val*`} =/= []) \/ (instr*{instr <- `instr*`} =/= [])) - - ;; 8-reduction.watsup - rule `throw_ref-label`{z : state, n : n, `instr'*` : instr*, a : addr}: - `%~>%`(`%;%`_config(z, [`LABEL_%{%}%`_instr(n, instr'*{instr' <- `instr'*`}, [REF.EXN_ADDR_instr(a) THROW_REF_instr])]), [REF.EXN_ADDR_instr(a) THROW_REF_instr]) - - ;; 8-reduction.watsup - rule `throw_ref-frame`{z : state, n : n, f : frame, a : addr}: - `%~>%`(`%;%`_config(z, [`FRAME_%{%}%`_instr(n, f, [REF.EXN_ADDR_instr(a) THROW_REF_instr])]), [REF.EXN_ADDR_instr(a) THROW_REF_instr]) - - ;; 8-reduction.watsup - rule `throw_ref-handler-empty`{z : state, n : n, a : addr}: - `%~>%`(`%;%`_config(z, [`HANDLER_%{%}%`_instr(n, [], [REF.EXN_ADDR_instr(a) THROW_REF_instr])]), [REF.EXN_ADDR_instr(a) THROW_REF_instr]) - - ;; 8-reduction.watsup - rule `throw_ref-handler-catch`{z : state, n : n, x : idx, l : labelidx, `catch'*` : catch*, a : addr, `val*` : val*}: - `%~>%`(`%;%`_config(z, [`HANDLER_%{%}%`_instr(n, [CATCH_catch(x, l)] ++ catch'*{catch' <- `catch'*`}, [REF.EXN_ADDR_instr(a) THROW_REF_instr])]), (val : val <: instr)*{val <- `val*`} ++ [BR_instr(l)]) - -- if ($exninst(z)[a].TAG_exninst = $tagaddr(z)[x!`%`_idx.0]) - -- if (val*{val <- `val*`} = $exninst(z)[a].FIELDS_exninst) - - ;; 8-reduction.watsup - rule `throw_ref-handler-catch_ref`{z : state, n : n, x : idx, l : labelidx, `catch'*` : catch*, a : addr, `val*` : val*}: - `%~>%`(`%;%`_config(z, [`HANDLER_%{%}%`_instr(n, [CATCH_REF_catch(x, l)] ++ catch'*{catch' <- `catch'*`}, [REF.EXN_ADDR_instr(a) THROW_REF_instr])]), (val : val <: instr)*{val <- `val*`} ++ [REF.EXN_ADDR_instr(a) BR_instr(l)]) - -- if ($exninst(z)[a].TAG_exninst = $tagaddr(z)[x!`%`_idx.0]) - -- if (val*{val <- `val*`} = $exninst(z)[a].FIELDS_exninst) - - ;; 8-reduction.watsup - rule `throw_ref-handler-catch_all`{z : state, n : n, l : labelidx, `catch'*` : catch*, a : addr}: - `%~>%`(`%;%`_config(z, [`HANDLER_%{%}%`_instr(n, [CATCH_ALL_catch(l)] ++ catch'*{catch' <- `catch'*`}, [REF.EXN_ADDR_instr(a) THROW_REF_instr])]), [BR_instr(l)]) - - ;; 8-reduction.watsup - rule `throw_ref-handler-catch_all_ref`{z : state, n : n, l : labelidx, `catch'*` : catch*, a : addr}: - `%~>%`(`%;%`_config(z, [`HANDLER_%{%}%`_instr(n, [CATCH_ALL_REF_catch(l)] ++ catch'*{catch' <- `catch'*`}, [REF.EXN_ADDR_instr(a) THROW_REF_instr])]), [REF.EXN_ADDR_instr(a) BR_instr(l)]) - - ;; 8-reduction.watsup - rule `throw_ref-handler-next`{z : state, n : n, catch : catch, `catch'*` : catch*, a : addr}: - `%~>%`(`%;%`_config(z, [`HANDLER_%{%}%`_instr(n, [catch] ++ catch'*{catch' <- `catch'*`}, [REF.EXN_ADDR_instr(a) THROW_REF_instr])]), [`HANDLER_%{%}%`_instr(n, catch'*{catch' <- `catch'*`}, [REF.EXN_ADDR_instr(a) THROW_REF_instr])]) - -- otherwise - - ;; 8-reduction.watsup - rule try_table{z : state, `val*` : val*, m : m, bt : blocktype, `catch*` : catch*, `instr*` : instr*, n : n, `t_1*` : valtype*, `t_2*` : valtype*}: - `%~>%`(`%;%`_config(z, (val : val <: instr)^m{val <- `val*`} ++ [TRY_TABLE_instr(bt, `%`_list(catch*{catch <- `catch*`}), instr*{instr <- `instr*`})]), [`HANDLER_%{%}%`_instr(n, catch*{catch <- `catch*`}, [`LABEL_%{%}%`_instr(n, [], (val : val <: instr)^m{val <- `val*`} ++ instr*{instr <- `instr*`})])]) - -- if ($blocktype_(z, bt) = `%->%`_functype(`%`_resulttype(t_1^m{t_1 <- `t_1*`}), `%`_resulttype(t_2^n{t_2 <- `t_2*`}))) - - ;; 8-reduction.watsup - rule `ref.null-idx`{z : state, x : idx}: - `%~>%`(`%;%`_config(z, [REF.NULL_instr(_IDX_heaptype(x))]), [REF.NULL_instr(($type(z, x) : deftype <: heaptype))]) - - ;; 8-reduction.watsup - rule ref.func{z : state, x : idx}: - `%~>%`(`%;%`_config(z, [REF.FUNC_instr(x)]), [REF.FUNC_ADDR_instr($moduleinst(z).FUNCS_moduleinst[x!`%`_idx.0])]) - - ;; 8-reduction.watsup - rule `ref.test-true`{s : store, f : frame, ref : ref, rt : reftype, rt' : reftype}: - `%~>%`(`%;%`_config(`%;%`_state(s, f), [(ref : ref <: instr) REF.TEST_instr(rt)]), [CONST_instr(I32_numtype, `%`_num_(1))]) - -- Ref_type: `%|-%:%`(s, ref, rt') - -- Reftype_sub: `%|-%<:%`({TYPES [], RECS [], FUNCS [], GLOBALS [], TABLES [], MEMS [], TAGS [], ELEMS [], DATAS [], LOCALS [], LABELS [], RETURN ?(), REFS []}, rt', $inst_reftype(f.MODULE_frame, rt)) - - ;; 8-reduction.watsup - rule `ref.test-false`{s : store, f : frame, ref : ref, rt : reftype}: - `%~>%`(`%;%`_config(`%;%`_state(s, f), [(ref : ref <: instr) REF.TEST_instr(rt)]), [CONST_instr(I32_numtype, `%`_num_(0))]) - -- otherwise - - ;; 8-reduction.watsup - rule `ref.cast-succeed`{s : store, f : frame, ref : ref, rt : reftype, rt' : reftype}: - `%~>%`(`%;%`_config(`%;%`_state(s, f), [(ref : ref <: instr) REF.CAST_instr(rt)]), [(ref : ref <: instr)]) - -- Ref_type: `%|-%:%`(s, ref, rt') - -- Reftype_sub: `%|-%<:%`({TYPES [], RECS [], FUNCS [], GLOBALS [], TABLES [], MEMS [], TAGS [], ELEMS [], DATAS [], LOCALS [], LABELS [], RETURN ?(), REFS []}, rt', $inst_reftype(f.MODULE_frame, rt)) - - ;; 8-reduction.watsup - rule `ref.cast-fail`{s : store, f : frame, ref : ref, rt : reftype}: - `%~>%`(`%;%`_config(`%;%`_state(s, f), [(ref : ref <: instr) REF.CAST_instr(rt)]), [TRAP_instr]) - -- otherwise - - ;; 8-reduction.watsup - rule struct.new_default{z : state, x : idx, `val*` : val*, `mut*` : mut*, `zt*` : storagetype*}: - `%~>%`(`%;%`_config(z, [STRUCT.NEW_DEFAULT_instr(x)]), (val : val <: instr)*{val <- `val*`} ++ [STRUCT.NEW_instr(x)]) - -- Expand: `%~~%`($type(z, x), STRUCT_comptype(`%`_structtype(`%%`_fieldtype(mut, zt)*{mut <- `mut*`, zt <- `zt*`}))) - -- (if ($default_($unpack(zt)) = ?(val)))*{val <- `val*`, zt <- `zt*`} - - ;; 8-reduction.watsup - rule `struct.get-null`{z : state, ht : heaptype, `sx?` : sx?, x : idx, i : u32}: - `%~>%`(`%;%`_config(z, [REF.NULL_instr(ht) STRUCT.GET_instr(sx?{sx <- `sx?`}, x, i)]), [TRAP_instr]) - - ;; 8-reduction.watsup - rule `struct.get-struct`{z : state, a : addr, `sx?` : sx?, x : idx, i : u32, `zt*` : storagetype*, `mut*` : mut*}: - `%~>%`(`%;%`_config(z, [REF.STRUCT_ADDR_instr(a) STRUCT.GET_instr(sx?{sx <- `sx?`}, x, i)]), [($unpackfield_(zt*{zt <- `zt*`}[i!`%`_u32.0], sx?{sx <- `sx?`}, $structinst(z)[a].FIELDS_structinst[i!`%`_u32.0]) : val <: instr)]) - -- Expand: `%~~%`($type(z, x), STRUCT_comptype(`%`_structtype(`%%`_fieldtype(mut, zt)*{mut <- `mut*`, zt <- `zt*`}))) - - ;; 8-reduction.watsup - rule array.new_default{z : state, n : n, x : idx, val : val, mut : mut, zt : storagetype}: - `%~>%`(`%;%`_config(z, [CONST_instr(I32_numtype, `%`_num_(n)) ARRAY.NEW_DEFAULT_instr(x)]), (val : val <: instr)^n{} ++ [ARRAY.NEW_FIXED_instr(x, `%`_u32(n))]) - -- Expand: `%~~%`($type(z, x), ARRAY_comptype(`%%`_arraytype(mut, zt))) - -- if ($default_($unpack(zt)) = ?(val)) - - ;; 8-reduction.watsup - rule `array.new_elem-oob`{z : state, i : num_(I32_numtype), n : n, x : idx, y : idx}: - `%~>%`(`%;%`_config(z, [CONST_instr(I32_numtype, i) CONST_instr(I32_numtype, `%`_num_(n)) ARRAY.NEW_ELEM_instr(x, y)]), [TRAP_instr]) - -- if ((i!`%`_num_.0 + n) > |$elem(z, y).REFS_eleminst|) - - ;; 8-reduction.watsup - rule `array.new_elem-alloc`{z : state, i : num_(I32_numtype), n : n, x : idx, y : idx, `ref*` : ref*}: - `%~>%`(`%;%`_config(z, [CONST_instr(I32_numtype, i) CONST_instr(I32_numtype, `%`_num_(n)) ARRAY.NEW_ELEM_instr(x, y)]), (ref : ref <: instr)^n{ref <- `ref*`} ++ [ARRAY.NEW_FIXED_instr(x, `%`_u32(n))]) - -- if (ref^n{ref <- `ref*`} = $elem(z, y).REFS_eleminst[i!`%`_num_.0 : n]) - - ;; 8-reduction.watsup - rule `array.new_data-oob`{z : state, i : num_(I32_numtype), n : n, x : idx, y : idx, mut : mut, zt : storagetype}: - `%~>%`(`%;%`_config(z, [CONST_instr(I32_numtype, i) CONST_instr(I32_numtype, `%`_num_(n)) ARRAY.NEW_DATA_instr(x, y)]), [TRAP_instr]) - -- Expand: `%~~%`($type(z, x), ARRAY_comptype(`%%`_arraytype(mut, zt))) - -- if ((i!`%`_num_.0 + ((((n * $zsize(zt)) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$data(z, y).BYTES_datainst|) - - ;; 8-reduction.watsup - rule `array.new_data-num`{z : state, i : num_(I32_numtype), n : n, x : idx, y : idx, zt : storagetype, `c*` : lit_(zt)*, mut : mut}: - `%~>%`(`%;%`_config(z, [CONST_instr(I32_numtype, i) CONST_instr(I32_numtype, `%`_num_(n)) ARRAY.NEW_DATA_instr(x, y)]), $const($cunpack(zt), $cunpacknum_(zt, c))^n{c <- `c*`} ++ [ARRAY.NEW_FIXED_instr(x, `%`_u32(n))]) - -- Expand: `%~~%`($type(z, x), ARRAY_comptype(`%%`_arraytype(mut, zt))) - -- if ($concatn_(syntax byte, $zbytes_(zt, c)^n{c <- `c*`}, ((($zsize(zt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) = $data(z, y).BYTES_datainst[i!`%`_num_.0 : ((((n * $zsize(zt)) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) - - ;; 8-reduction.watsup - rule `array.get-null`{z : state, ht : heaptype, i : num_(I32_numtype), `sx?` : sx?, x : idx}: - `%~>%`(`%;%`_config(z, [REF.NULL_instr(ht) CONST_instr(I32_numtype, i) ARRAY.GET_instr(sx?{sx <- `sx?`}, x)]), [TRAP_instr]) - - ;; 8-reduction.watsup - rule `array.get-oob`{z : state, a : addr, i : num_(I32_numtype), `sx?` : sx?, x : idx}: - `%~>%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) ARRAY.GET_instr(sx?{sx <- `sx?`}, x)]), [TRAP_instr]) - -- if (i!`%`_num_.0 >= |$arrayinst(z)[a].FIELDS_arrayinst|) - - ;; 8-reduction.watsup - rule `array.get-array`{z : state, a : addr, i : num_(I32_numtype), `sx?` : sx?, x : idx, zt : storagetype, mut : mut}: - `%~>%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) ARRAY.GET_instr(sx?{sx <- `sx?`}, x)]), [($unpackfield_(zt, sx?{sx <- `sx?`}, $arrayinst(z)[a].FIELDS_arrayinst[i!`%`_num_.0]) : val <: instr)]) - -- Expand: `%~~%`($type(z, x), ARRAY_comptype(`%%`_arraytype(mut, zt))) - - ;; 8-reduction.watsup - rule `array.len-null`{z : state, ht : heaptype}: - `%~>%`(`%;%`_config(z, [REF.NULL_instr(ht) ARRAY.LEN_instr]), [TRAP_instr]) - - ;; 8-reduction.watsup - rule `array.len-array`{z : state, a : addr}: - `%~>%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a) ARRAY.LEN_instr]), [CONST_instr(I32_numtype, `%`_num_(|$arrayinst(z)[a].FIELDS_arrayinst|))]) - - ;; 8-reduction.watsup - rule `array.fill-null`{z : state, ht : heaptype, i : num_(I32_numtype), val : val, n : n, x : idx}: - `%~>%`(`%;%`_config(z, [REF.NULL_instr(ht) CONST_instr(I32_numtype, i) (val : val <: instr) CONST_instr(I32_numtype, `%`_num_(n)) ARRAY.FILL_instr(x)]), [TRAP_instr]) - - ;; 8-reduction.watsup - rule `array.fill-oob`{z : state, a : addr, i : num_(I32_numtype), val : val, n : n, x : idx}: - `%~>%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) (val : val <: instr) CONST_instr(I32_numtype, `%`_num_(n)) ARRAY.FILL_instr(x)]), [TRAP_instr]) - -- if ((i!`%`_num_.0 + n) > |$arrayinst(z)[a].FIELDS_arrayinst|) - - ;; 8-reduction.watsup - rule `array.fill-zero`{z : state, a : addr, i : num_(I32_numtype), val : val, n : n, x : idx}: - `%~>%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) (val : val <: instr) CONST_instr(I32_numtype, `%`_num_(n)) ARRAY.FILL_instr(x)]), []) - -- otherwise - -- if (n = 0) - - ;; 8-reduction.watsup - rule `array.fill-succ`{z : state, a : addr, i : num_(I32_numtype), val : val, n : n, x : idx}: - `%~>%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) (val : val <: instr) CONST_instr(I32_numtype, `%`_num_(n)) ARRAY.FILL_instr(x)]), [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) (val : val <: instr) ARRAY.SET_instr(x) REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, `%`_num_((i!`%`_num_.0 + 1))) (val : val <: instr) CONST_instr(I32_numtype, `%`_num_((((n : nat <:> int) - (1 : nat <:> int)) : int <:> nat))) ARRAY.FILL_instr(x)]) - -- otherwise - - ;; 8-reduction.watsup - rule `array.copy-null1`{z : state, ht_1 : heaptype, i_1 : num_(I32_numtype), ref : ref, i_2 : num_(I32_numtype), n : n, x_1 : idx, x_2 : idx}: - `%~>%`(`%;%`_config(z, [REF.NULL_instr(ht_1) CONST_instr(I32_numtype, i_1) (ref : ref <: instr) CONST_instr(I32_numtype, i_2) CONST_instr(I32_numtype, `%`_num_(n)) ARRAY.COPY_instr(x_1, x_2)]), [TRAP_instr]) - - ;; 8-reduction.watsup - rule `array.copy-null2`{z : state, ref : ref, i_1 : num_(I32_numtype), ht_2 : heaptype, i_2 : num_(I32_numtype), n : n, x_1 : idx, x_2 : idx}: - `%~>%`(`%;%`_config(z, [(ref : ref <: instr) CONST_instr(I32_numtype, i_1) REF.NULL_instr(ht_2) CONST_instr(I32_numtype, i_2) CONST_instr(I32_numtype, `%`_num_(n)) ARRAY.COPY_instr(x_1, x_2)]), [TRAP_instr]) - - ;; 8-reduction.watsup - rule `array.copy-oob1`{z : state, a_1 : addr, i_1 : num_(I32_numtype), a_2 : addr, i_2 : num_(I32_numtype), n : n, x_1 : idx, x_2 : idx}: - `%~>%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a_1) CONST_instr(I32_numtype, i_1) REF.ARRAY_ADDR_instr(a_2) CONST_instr(I32_numtype, i_2) CONST_instr(I32_numtype, `%`_num_(n)) ARRAY.COPY_instr(x_1, x_2)]), [TRAP_instr]) - -- if ((i_1!`%`_num_.0 + n) > |$arrayinst(z)[a_1].FIELDS_arrayinst|) - - ;; 8-reduction.watsup - rule `array.copy-oob2`{z : state, a_1 : addr, i_1 : num_(I32_numtype), a_2 : addr, i_2 : num_(I32_numtype), n : n, x_1 : idx, x_2 : idx}: - `%~>%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a_1) CONST_instr(I32_numtype, i_1) REF.ARRAY_ADDR_instr(a_2) CONST_instr(I32_numtype, i_2) CONST_instr(I32_numtype, `%`_num_(n)) ARRAY.COPY_instr(x_1, x_2)]), [TRAP_instr]) - -- if ((i_2!`%`_num_.0 + n) > |$arrayinst(z)[a_2].FIELDS_arrayinst|) - - ;; 8-reduction.watsup - rule `array.copy-zero`{z : state, a_1 : addr, i_1 : num_(I32_numtype), a_2 : addr, i_2 : num_(I32_numtype), n : n, x_1 : idx, x_2 : idx}: - `%~>%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a_1) CONST_instr(I32_numtype, i_1) REF.ARRAY_ADDR_instr(a_2) CONST_instr(I32_numtype, i_2) CONST_instr(I32_numtype, `%`_num_(n)) ARRAY.COPY_instr(x_1, x_2)]), []) - -- otherwise - -- if (n = 0) - - ;; 8-reduction.watsup - rule `array.copy-le`{z : state, a_1 : addr, i_1 : num_(I32_numtype), a_2 : addr, i_2 : num_(I32_numtype), n : n, x_1 : idx, x_2 : idx, `sx?` : sx?, mut : mut, zt_2 : storagetype}: - `%~>%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a_1) CONST_instr(I32_numtype, i_1) REF.ARRAY_ADDR_instr(a_2) CONST_instr(I32_numtype, i_2) CONST_instr(I32_numtype, `%`_num_(n)) ARRAY.COPY_instr(x_1, x_2)]), [REF.ARRAY_ADDR_instr(a_1) CONST_instr(I32_numtype, i_1) REF.ARRAY_ADDR_instr(a_2) CONST_instr(I32_numtype, i_2) ARRAY.GET_instr(sx?{sx <- `sx?`}, x_2) ARRAY.SET_instr(x_1) REF.ARRAY_ADDR_instr(a_1) CONST_instr(I32_numtype, `%`_num_((i_1!`%`_num_.0 + 1))) REF.ARRAY_ADDR_instr(a_2) CONST_instr(I32_numtype, `%`_num_((i_2!`%`_num_.0 + 1))) CONST_instr(I32_numtype, `%`_num_((((n : nat <:> int) - (1 : nat <:> int)) : int <:> nat))) ARRAY.COPY_instr(x_1, x_2)]) - -- otherwise - -- Expand: `%~~%`($type(z, x_2), ARRAY_comptype(`%%`_arraytype(mut, zt_2))) - -- if ((i_1!`%`_num_.0 <= i_2!`%`_num_.0) /\ (sx?{sx <- `sx?`} = $sx(zt_2))) - - ;; 8-reduction.watsup - rule `array.copy-gt`{z : state, a_1 : addr, i_1 : num_(I32_numtype), a_2 : addr, i_2 : num_(I32_numtype), n : n, x_1 : idx, x_2 : idx, `sx?` : sx?, mut : mut, zt_2 : storagetype}: - `%~>%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a_1) CONST_instr(I32_numtype, i_1) REF.ARRAY_ADDR_instr(a_2) CONST_instr(I32_numtype, i_2) CONST_instr(I32_numtype, `%`_num_(n)) ARRAY.COPY_instr(x_1, x_2)]), [REF.ARRAY_ADDR_instr(a_1) CONST_instr(I32_numtype, `%`_num_(((((i_1!`%`_num_.0 + n) : nat <:> int) - (1 : nat <:> int)) : int <:> nat))) REF.ARRAY_ADDR_instr(a_2) CONST_instr(I32_numtype, `%`_num_(((((i_2!`%`_num_.0 + n) : nat <:> int) - (1 : nat <:> int)) : int <:> nat))) ARRAY.GET_instr(sx?{sx <- `sx?`}, x_2) ARRAY.SET_instr(x_1) REF.ARRAY_ADDR_instr(a_1) CONST_instr(I32_numtype, i_1) REF.ARRAY_ADDR_instr(a_2) CONST_instr(I32_numtype, i_2) CONST_instr(I32_numtype, `%`_num_((((n : nat <:> int) - (1 : nat <:> int)) : int <:> nat))) ARRAY.COPY_instr(x_1, x_2)]) - -- otherwise - -- Expand: `%~~%`($type(z, x_2), ARRAY_comptype(`%%`_arraytype(mut, zt_2))) - -- if (sx?{sx <- `sx?`} = $sx(zt_2)) - - ;; 8-reduction.watsup - rule `array.init_elem-null`{z : state, ht : heaptype, i : num_(I32_numtype), j : num_(I32_numtype), n : n, x : idx, y : idx}: - `%~>%`(`%;%`_config(z, [REF.NULL_instr(ht) CONST_instr(I32_numtype, i) CONST_instr(I32_numtype, j) CONST_instr(I32_numtype, `%`_num_(n)) ARRAY.INIT_ELEM_instr(x, y)]), [TRAP_instr]) - - ;; 8-reduction.watsup - rule `array.init_elem-oob1`{z : state, a : addr, i : num_(I32_numtype), j : num_(I32_numtype), n : n, x : idx, y : idx}: - `%~>%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) CONST_instr(I32_numtype, j) CONST_instr(I32_numtype, `%`_num_(n)) ARRAY.INIT_ELEM_instr(x, y)]), [TRAP_instr]) - -- if ((i!`%`_num_.0 + n) > |$arrayinst(z)[a].FIELDS_arrayinst|) - - ;; 8-reduction.watsup - rule `array.init_elem-oob2`{z : state, a : addr, i : num_(I32_numtype), j : num_(I32_numtype), n : n, x : idx, y : idx}: - `%~>%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) CONST_instr(I32_numtype, j) CONST_instr(I32_numtype, `%`_num_(n)) ARRAY.INIT_ELEM_instr(x, y)]), [TRAP_instr]) - -- if ((j!`%`_num_.0 + n) > |$elem(z, y).REFS_eleminst|) - - ;; 8-reduction.watsup - rule `array.init_elem-zero`{z : state, a : addr, i : num_(I32_numtype), j : num_(I32_numtype), n : n, x : idx, y : idx}: - `%~>%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) CONST_instr(I32_numtype, j) CONST_instr(I32_numtype, `%`_num_(n)) ARRAY.INIT_ELEM_instr(x, y)]), []) - -- otherwise - -- if (n = 0) - - ;; 8-reduction.watsup - rule `array.init_elem-succ`{z : state, a : addr, i : num_(I32_numtype), j : num_(I32_numtype), n : n, x : idx, y : idx, ref : ref}: - `%~>%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) CONST_instr(I32_numtype, j) CONST_instr(I32_numtype, `%`_num_(n)) ARRAY.INIT_ELEM_instr(x, y)]), [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) (ref : ref <: instr) ARRAY.SET_instr(x) REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, `%`_num_((i!`%`_num_.0 + 1))) CONST_instr(I32_numtype, `%`_num_((j!`%`_num_.0 + 1))) CONST_instr(I32_numtype, `%`_num_((((n : nat <:> int) - (1 : nat <:> int)) : int <:> nat))) ARRAY.INIT_ELEM_instr(x, y)]) - -- otherwise - -- if (ref = $elem(z, y).REFS_eleminst[j!`%`_num_.0]) - - ;; 8-reduction.watsup - rule `array.init_data-null`{z : state, ht : heaptype, i : num_(I32_numtype), j : num_(I32_numtype), n : n, x : idx, y : idx}: - `%~>%`(`%;%`_config(z, [REF.NULL_instr(ht) CONST_instr(I32_numtype, i) CONST_instr(I32_numtype, j) CONST_instr(I32_numtype, `%`_num_(n)) ARRAY.INIT_DATA_instr(x, y)]), [TRAP_instr]) - - ;; 8-reduction.watsup - rule `array.init_data-oob1`{z : state, a : addr, i : num_(I32_numtype), j : num_(I32_numtype), n : n, x : idx, y : idx}: - `%~>%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) CONST_instr(I32_numtype, j) CONST_instr(I32_numtype, `%`_num_(n)) ARRAY.INIT_DATA_instr(x, y)]), [TRAP_instr]) - -- if ((i!`%`_num_.0 + n) > |$arrayinst(z)[a].FIELDS_arrayinst|) - - ;; 8-reduction.watsup - rule `array.init_data-oob2`{z : state, a : addr, i : num_(I32_numtype), j : num_(I32_numtype), n : n, x : idx, y : idx, mut : mut, zt : storagetype}: - `%~>%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) CONST_instr(I32_numtype, j) CONST_instr(I32_numtype, `%`_num_(n)) ARRAY.INIT_DATA_instr(x, y)]), [TRAP_instr]) - -- Expand: `%~~%`($type(z, x), ARRAY_comptype(`%%`_arraytype(mut, zt))) - -- if ((j!`%`_num_.0 + ((((n * $zsize(zt)) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$data(z, y).BYTES_datainst|) - - ;; 8-reduction.watsup - rule `array.init_data-zero`{z : state, a : addr, i : num_(I32_numtype), j : num_(I32_numtype), n : n, x : idx, y : idx}: - `%~>%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) CONST_instr(I32_numtype, j) CONST_instr(I32_numtype, `%`_num_(n)) ARRAY.INIT_DATA_instr(x, y)]), []) - -- otherwise - -- if (n = 0) - - ;; 8-reduction.watsup - rule `array.init_data-num`{z : state, a : addr, i : num_(I32_numtype), j : num_(I32_numtype), n : n, x : idx, y : idx, zt : storagetype, c : lit_(zt), mut : mut}: - `%~>%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) CONST_instr(I32_numtype, j) CONST_instr(I32_numtype, `%`_num_(n)) ARRAY.INIT_DATA_instr(x, y)]), [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) $const($cunpack(zt), $cunpacknum_(zt, c)) ARRAY.SET_instr(x) REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, `%`_num_((i!`%`_num_.0 + 1))) CONST_instr(I32_numtype, `%`_num_((j!`%`_num_.0 + ((($zsize(zt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)))) CONST_instr(I32_numtype, `%`_num_((((n : nat <:> int) - (1 : nat <:> int)) : int <:> nat))) ARRAY.INIT_DATA_instr(x, y)]) - -- otherwise - -- Expand: `%~~%`($type(z, x), ARRAY_comptype(`%%`_arraytype(mut, zt))) - -- if ($zbytes_(zt, c) = $data(z, y).BYTES_datainst[j!`%`_num_.0 : ((($zsize(zt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) - - ;; 8-reduction.watsup - rule local.get{z : state, x : idx, val : val}: - `%~>%`(`%;%`_config(z, [LOCAL.GET_instr(x)]), [(val : val <: instr)]) - -- if ($local(z, x) = ?(val)) - - ;; 8-reduction.watsup - rule global.get{z : state, x : idx, val : val}: - `%~>%`(`%;%`_config(z, [GLOBAL.GET_instr(x)]), [(val : val <: instr)]) - -- if ($global(z, x).VALUE_globalinst = val) - - ;; 8-reduction.watsup - rule `table.get-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), x : idx}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) TABLE.GET_instr(x)]), [TRAP_instr]) - -- if (i!`%`_num_.0 >= |$table(z, x).REFS_tableinst|) - - ;; 8-reduction.watsup - rule `table.get-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), x : idx}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) TABLE.GET_instr(x)]), [($table(z, x).REFS_tableinst[i!`%`_num_.0] : ref <: instr)]) - -- if (i!`%`_num_.0 < |$table(z, x).REFS_tableinst|) - - ;; 8-reduction.watsup - rule table.size{z : state, x : idx, at : addrtype, n : n, lim : limits, rt : reftype}: - `%~>%`(`%;%`_config(z, [TABLE.SIZE_instr(x)]), [CONST_instr((at : addrtype <: numtype), `%`_num_(n))]) - -- if (|$table(z, x).REFS_tableinst| = n) - -- if ($table(z, x).TYPE_tableinst = `%%%`_tabletype(at, lim, rt)) - - ;; 8-reduction.watsup - rule `table.fill-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), val : val, n : n, x : idx}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) (val : val <: instr) CONST_instr((at : addrtype <: numtype), `%`_num_(n)) TABLE.FILL_instr(x)]), [TRAP_instr]) - -- if ((i!`%`_num_.0 + n) > |$table(z, x).REFS_tableinst|) - - ;; 8-reduction.watsup - rule `table.fill-zero`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), val : val, n : n, x : idx}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) (val : val <: instr) CONST_instr((at : addrtype <: numtype), `%`_num_(n)) TABLE.FILL_instr(x)]), []) - -- otherwise - -- if (n = 0) - - ;; 8-reduction.watsup - rule `table.fill-succ`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), val : val, n : n, x : idx}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) (val : val <: instr) CONST_instr((at : addrtype <: numtype), `%`_num_(n)) TABLE.FILL_instr(x)]), [CONST_instr((at : addrtype <: numtype), i) (val : val <: instr) TABLE.SET_instr(x) CONST_instr((at : addrtype <: numtype), `%`_num_((i!`%`_num_.0 + 1))) (val : val <: instr) CONST_instr((at : addrtype <: numtype), `%`_num_((((n : nat <:> int) - (1 : nat <:> int)) : int <:> nat))) TABLE.FILL_instr(x)]) - -- otherwise - - ;; 8-reduction.watsup - rule `table.copy-oob`{z : state, at_1 : addrtype, i_1 : num_((at_1 : addrtype <: numtype)), at_2 : addrtype, i_2 : num_((at_2 : addrtype <: numtype)), at' : addrtype, n : n, x_1 : idx, x_2 : idx}: - `%~>%`(`%;%`_config(z, [CONST_instr((at_1 : addrtype <: numtype), i_1) CONST_instr((at_2 : addrtype <: numtype), i_2) CONST_instr((at' : addrtype <: numtype), `%`_num_(n)) TABLE.COPY_instr(x_1, x_2)]), [TRAP_instr]) - -- if (((i_1!`%`_num_.0 + n) > |$table(z, x_1).REFS_tableinst|) \/ ((i_2!`%`_num_.0 + n) > |$table(z, x_2).REFS_tableinst|)) - - ;; 8-reduction.watsup - rule `table.copy-zero`{z : state, at_1 : addrtype, i_1 : num_((at_1 : addrtype <: numtype)), at_2 : addrtype, i_2 : num_((at_2 : addrtype <: numtype)), at' : addrtype, n : n, x_1 : idx, x_2 : idx}: - `%~>%`(`%;%`_config(z, [CONST_instr((at_1 : addrtype <: numtype), i_1) CONST_instr((at_2 : addrtype <: numtype), i_2) CONST_instr((at' : addrtype <: numtype), `%`_num_(n)) TABLE.COPY_instr(x_1, x_2)]), []) - -- otherwise - -- if (n = 0) - - ;; 8-reduction.watsup - rule `table.copy-le`{z : state, at_1 : addrtype, i_1 : num_((at_1 : addrtype <: numtype)), at_2 : addrtype, i_2 : num_((at_2 : addrtype <: numtype)), at' : addrtype, n : n, x_1 : idx, x_2 : idx}: - `%~>%`(`%;%`_config(z, [CONST_instr((at_1 : addrtype <: numtype), i_1) CONST_instr((at_2 : addrtype <: numtype), i_2) CONST_instr((at' : addrtype <: numtype), `%`_num_(n)) TABLE.COPY_instr(x_1, x_2)]), [CONST_instr((at_1 : addrtype <: numtype), i_1) CONST_instr((at_2 : addrtype <: numtype), i_2) TABLE.GET_instr(x_2) TABLE.SET_instr(x_1) CONST_instr((at_1 : addrtype <: numtype), `%`_num_((i_1!`%`_num_.0 + 1))) CONST_instr((at_2 : addrtype <: numtype), `%`_num_((i_2!`%`_num_.0 + 1))) CONST_instr((at' : addrtype <: numtype), `%`_num_((((n : nat <:> int) - (1 : nat <:> int)) : int <:> nat))) TABLE.COPY_instr(x_1, x_2)]) - -- otherwise - -- if (i_1!`%`_num_.0 <= i_2!`%`_num_.0) - - ;; 8-reduction.watsup - rule `table.copy-gt`{z : state, at_1 : addrtype, i_1 : num_((at_1 : addrtype <: numtype)), at_2 : addrtype, i_2 : num_((at_2 : addrtype <: numtype)), at' : addrtype, n : n, x_1 : idx, x_2 : idx}: - `%~>%`(`%;%`_config(z, [CONST_instr((at_1 : addrtype <: numtype), i_1) CONST_instr((at_2 : addrtype <: numtype), i_2) CONST_instr((at' : addrtype <: numtype), `%`_num_(n)) TABLE.COPY_instr(x_1, x_2)]), [CONST_instr((at_1 : addrtype <: numtype), `%`_num_(((((i_1!`%`_num_.0 + n) : nat <:> int) - (1 : nat <:> int)) : int <:> nat))) CONST_instr((at_2 : addrtype <: numtype), `%`_num_(((((i_2!`%`_num_.0 + n) : nat <:> int) - (1 : nat <:> int)) : int <:> nat))) TABLE.GET_instr(x_2) TABLE.SET_instr(x_1) CONST_instr((at_1 : addrtype <: numtype), i_1) CONST_instr((at_2 : addrtype <: numtype), i_2) CONST_instr((at' : addrtype <: numtype), `%`_num_((((n : nat <:> int) - (1 : nat <:> int)) : int <:> nat))) TABLE.COPY_instr(x_1, x_2)]) - -- otherwise - - ;; 8-reduction.watsup - rule `table.init-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), j : num_(I32_numtype), n : n, x : idx, y : idx}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr(I32_numtype, j) CONST_instr(I32_numtype, `%`_num_(n)) TABLE.INIT_instr(x, y)]), [TRAP_instr]) - -- if (((i!`%`_num_.0 + n) > |$table(z, x).REFS_tableinst|) \/ ((j!`%`_num_.0 + n) > |$elem(z, y).REFS_eleminst|)) - - ;; 8-reduction.watsup - rule `table.init-zero`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), j : num_(I32_numtype), n : n, x : idx, y : idx}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr(I32_numtype, j) CONST_instr(I32_numtype, `%`_num_(n)) TABLE.INIT_instr(x, y)]), []) - -- otherwise - -- if (n = 0) - - ;; 8-reduction.watsup - rule `table.init-succ`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), j : num_(I32_numtype), n : n, x : idx, y : idx}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr(I32_numtype, j) CONST_instr(I32_numtype, `%`_num_(n)) TABLE.INIT_instr(x, y)]), [CONST_instr((at : addrtype <: numtype), i) ($elem(z, y).REFS_eleminst[j!`%`_num_.0] : ref <: instr) TABLE.SET_instr(x) CONST_instr((at : addrtype <: numtype), `%`_num_((i!`%`_num_.0 + 1))) CONST_instr(I32_numtype, `%`_num_((j!`%`_num_.0 + 1))) CONST_instr(I32_numtype, `%`_num_((((n : nat <:> int) - (1 : nat <:> int)) : int <:> nat))) TABLE.INIT_instr(x, y)]) - -- otherwise - - ;; 8-reduction.watsup - rule `load-num-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), nt : numtype, x : idx, ao : memarg}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) LOAD_instr(nt, ?(), x, ao)]), [TRAP_instr]) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + ((($size(nt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) - - ;; 8-reduction.watsup - rule `load-num-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), nt : numtype, x : idx, ao : memarg, c : num_(nt)}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) LOAD_instr(nt, ?(), x, ao)]), [CONST_instr(nt, c)]) - -- if ($nbytes_(nt, c) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) : ((($size(nt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) - - ;; 8-reduction.watsup - rule `load-pack-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), Inn : Inn, n : n, sx : sx, x : idx, ao : memarg}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) LOAD_instr((Inn : Inn <: numtype), ?(`%%`_loadop_(`%`_sz(n), sx)), x, ao)]), [TRAP_instr]) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + (((n : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) - - ;; 8-reduction.watsup - rule `load-pack-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), Inn : Inn, n : n, sx : sx, x : idx, ao : memarg, c : iN(n)}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) LOAD_instr((Inn : Inn <: numtype), ?(`%%`_loadop_(`%`_sz(n), sx)), x, ao)]), [CONST_instr((Inn : Inn <: numtype), $extend__(n, $size((Inn : Inn <: numtype)), sx, c))]) - -- if ($ibytes_(n, c) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) : (((n : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) - - ;; 8-reduction.watsup - rule `vload-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), x : idx, ao : memarg}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VLOAD_instr(V128_vectype, ?(), x, ao)]), [TRAP_instr]) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + ((($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) - - ;; 8-reduction.watsup - rule `vload-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), x : idx, ao : memarg, c : vec_(V128_Vnn)}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VLOAD_instr(V128_vectype, ?(), x, ao)]), [VCONST_instr(V128_vectype, c)]) - -- if ($vbytes_(V128_vectype, c) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) : ((($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) - - ;; 8-reduction.watsup - rule `vload-pack-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), M : M, K : K, sx : sx, x : idx, ao : memarg}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VLOAD_instr(V128_vectype, ?(`SHAPE%X%%`_vloadop_(`%`_sz(M), K, sx)), x, ao)]), [TRAP_instr]) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + ((((M * K) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) - - ;; 8-reduction.watsup - rule `vload-pack-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), M : M, K : K, sx : sx, x : idx, ao : memarg, c : vec_(V128_Vnn), `j*` : iN(M)*, `k*` : nat*, Jnn : Jnn}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VLOAD_instr(V128_vectype, ?(`SHAPE%X%%`_vloadop_(`%`_sz(M), K, sx)), x, ao)]), [VCONST_instr(V128_vectype, c)]) - -- (if ($ibytes_(M, j) = $mem(z, x).BYTES_meminst[((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + ((((k * M) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) : (((M : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]))^(k%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VLOAD_instr(V128_vectype, ?(SPLAT_vloadop_(`%`_sz(N))), x, ao)]), [TRAP_instr]) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) - - ;; 8-reduction.watsup - rule `vload-splat-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), N : N, x : idx, ao : memarg, c : vec_(V128_Vnn), j : iN(N), Jnn : Jnn, M : M}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VLOAD_instr(V128_vectype, ?(SPLAT_vloadop_(`%`_sz(N))), x, ao)]), [VCONST_instr(V128_vectype, c)]) - -- if ($ibytes_(N, j) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) : (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) - -- if (N = $lsize((Jnn : Jnn <: lanetype))) - -- if ((M : nat <:> rat) = ((128 : nat <:> rat) / (N : nat <:> rat))) - -- if (c = $invlanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), `%`_lane_(j!`%`_iN.0)^M{})) - - ;; 8-reduction.watsup - rule `vload-zero-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), N : N, x : idx, ao : memarg}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VLOAD_instr(V128_vectype, ?(ZERO_vloadop_(`%`_sz(N))), x, ao)]), [TRAP_instr]) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) - - ;; 8-reduction.watsup - rule `vload-zero-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), N : N, x : idx, ao : memarg, c : vec_(V128_Vnn), j : iN(N)}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VLOAD_instr(V128_vectype, ?(ZERO_vloadop_(`%`_sz(N))), x, ao)]), [VCONST_instr(V128_vectype, c)]) - -- if ($ibytes_(N, j) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) : (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) - -- if (c = $extend__(N, 128, U_sx, j)) - - ;; 8-reduction.watsup - rule `vload_lane-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c_1 : vec_(V128_Vnn), N : N, x : idx, ao : memarg, j : laneidx}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c_1) VLOAD_LANE_instr(V128_vectype, `%`_sz(N), x, ao, j)]), [TRAP_instr]) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) - - ;; 8-reduction.watsup - rule `vload_lane-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c_1 : vec_(V128_Vnn), N : N, x : idx, ao : memarg, j : laneidx, c : vec_(V128_Vnn), k : iN(N), Jnn : Jnn, M : M}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c_1) VLOAD_LANE_instr(V128_vectype, `%`_sz(N), x, ao, j)]), [VCONST_instr(V128_vectype, c)]) - -- if ($ibytes_(N, k) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) : (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) - -- if (N = $lsize((Jnn : Jnn <: lanetype))) - -- if ((M : nat <:> rat) = (($vsize(V128_vectype) : nat <:> rat) / (N : nat <:> rat))) - -- if (c = $invlanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), c_1)[[j!`%`_laneidx.0] = `%`_lane_(k!`%`_iN.0)])) - - ;; 8-reduction.watsup - rule memory.size{z : state, x : idx, at : addrtype, n : n, lim : limits}: - `%~>%`(`%;%`_config(z, [MEMORY.SIZE_instr(x)]), [CONST_instr((at : addrtype <: numtype), `%`_num_(n))]) - -- if ((n * (64 * $Ki)) = |$mem(z, x).BYTES_meminst|) - -- if ($mem(z, x).TYPE_meminst = `%%PAGE`_memtype(at, lim)) - - ;; 8-reduction.watsup - rule `memory.fill-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), val : val, n : n, x : idx}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) (val : val <: instr) CONST_instr((at : addrtype <: numtype), `%`_num_(n)) MEMORY.FILL_instr(x)]), [TRAP_instr]) - -- if ((i!`%`_num_.0 + n) > |$mem(z, x).BYTES_meminst|) - - ;; 8-reduction.watsup - rule `memory.fill-zero`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), val : val, n : n, x : idx}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) (val : val <: instr) CONST_instr((at : addrtype <: numtype), `%`_num_(n)) MEMORY.FILL_instr(x)]), []) - -- otherwise - -- if (n = 0) - - ;; 8-reduction.watsup - rule `memory.fill-succ`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), val : val, n : n, x : idx}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) (val : val <: instr) CONST_instr((at : addrtype <: numtype), `%`_num_(n)) MEMORY.FILL_instr(x)]), [CONST_instr((at : addrtype <: numtype), i) (val : val <: instr) STORE_instr(I32_numtype, ?(`%`_storeop_(`%`_sz(8))), x, $memarg0) CONST_instr((at : addrtype <: numtype), `%`_num_((i!`%`_num_.0 + 1))) (val : val <: instr) CONST_instr((at : addrtype <: numtype), `%`_num_((((n : nat <:> int) - (1 : nat <:> int)) : int <:> nat))) MEMORY.FILL_instr(x)]) - -- otherwise - - ;; 8-reduction.watsup - rule `memory.copy-oob`{z : state, at_1 : addrtype, i_1 : num_((at_1 : addrtype <: numtype)), at_2 : addrtype, i_2 : num_((at_2 : addrtype <: numtype)), at' : addrtype, n : n, x_1 : idx, x_2 : idx}: - `%~>%`(`%;%`_config(z, [CONST_instr((at_1 : addrtype <: numtype), i_1) CONST_instr((at_2 : addrtype <: numtype), i_2) CONST_instr((at' : addrtype <: numtype), `%`_num_(n)) MEMORY.COPY_instr(x_1, x_2)]), [TRAP_instr]) - -- if (((i_1!`%`_num_.0 + n) > |$mem(z, x_1).BYTES_meminst|) \/ ((i_2!`%`_num_.0 + n) > |$mem(z, x_2).BYTES_meminst|)) - - ;; 8-reduction.watsup - rule `memory.copy-zero`{z : state, at_1 : addrtype, i_1 : num_((at_1 : addrtype <: numtype)), at_2 : addrtype, i_2 : num_((at_2 : addrtype <: numtype)), at' : addrtype, n : n, x_1 : idx, x_2 : idx}: - `%~>%`(`%;%`_config(z, [CONST_instr((at_1 : addrtype <: numtype), i_1) CONST_instr((at_2 : addrtype <: numtype), i_2) CONST_instr((at' : addrtype <: numtype), `%`_num_(n)) MEMORY.COPY_instr(x_1, x_2)]), []) - -- otherwise - -- if (n = 0) - - ;; 8-reduction.watsup - rule `memory.copy-le`{z : state, at_1 : addrtype, i_1 : num_((at_1 : addrtype <: numtype)), at_2 : addrtype, i_2 : num_((at_2 : addrtype <: numtype)), at' : addrtype, n : n, x_1 : idx, x_2 : idx}: - `%~>%`(`%;%`_config(z, [CONST_instr((at_1 : addrtype <: numtype), i_1) CONST_instr((at_2 : addrtype <: numtype), i_2) CONST_instr((at' : addrtype <: numtype), `%`_num_(n)) MEMORY.COPY_instr(x_1, x_2)]), [CONST_instr((at_1 : addrtype <: numtype), i_1) CONST_instr((at_2 : addrtype <: numtype), i_2) LOAD_instr(I32_numtype, ?(`%%`_loadop_(`%`_sz(8), U_sx)), x_2, $memarg0) STORE_instr(I32_numtype, ?(`%`_storeop_(`%`_sz(8))), x_1, $memarg0) CONST_instr((at_1 : addrtype <: numtype), `%`_num_((i_1!`%`_num_.0 + 1))) CONST_instr((at_2 : addrtype <: numtype), `%`_num_((i_2!`%`_num_.0 + 1))) CONST_instr((at' : addrtype <: numtype), `%`_num_((((n : nat <:> int) - (1 : nat <:> int)) : int <:> nat))) MEMORY.COPY_instr(x_1, x_2)]) - -- otherwise - -- if (i_1!`%`_num_.0 <= i_2!`%`_num_.0) - - ;; 8-reduction.watsup - rule `memory.copy-gt`{z : state, at_1 : addrtype, i_1 : num_((at_1 : addrtype <: numtype)), at_2 : addrtype, i_2 : num_((at_2 : addrtype <: numtype)), at' : addrtype, n : n, x_1 : idx, x_2 : idx}: - `%~>%`(`%;%`_config(z, [CONST_instr((at_1 : addrtype <: numtype), i_1) CONST_instr((at_2 : addrtype <: numtype), i_2) CONST_instr((at' : addrtype <: numtype), `%`_num_(n)) MEMORY.COPY_instr(x_1, x_2)]), [CONST_instr((at_1 : addrtype <: numtype), `%`_num_(((((i_1!`%`_num_.0 + n) : nat <:> int) - (1 : nat <:> int)) : int <:> nat))) CONST_instr((at_2 : addrtype <: numtype), `%`_num_(((((i_2!`%`_num_.0 + n) : nat <:> int) - (1 : nat <:> int)) : int <:> nat))) LOAD_instr(I32_numtype, ?(`%%`_loadop_(`%`_sz(8), U_sx)), x_2, $memarg0) STORE_instr(I32_numtype, ?(`%`_storeop_(`%`_sz(8))), x_1, $memarg0) CONST_instr((at_1 : addrtype <: numtype), i_1) CONST_instr((at_2 : addrtype <: numtype), i_2) CONST_instr((at' : addrtype <: numtype), `%`_num_((((n : nat <:> int) - (1 : nat <:> int)) : int <:> nat))) MEMORY.COPY_instr(x_1, x_2)]) - -- otherwise - - ;; 8-reduction.watsup - rule `memory.init-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), j : num_(I32_numtype), n : n, x : idx, y : idx}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr(I32_numtype, j) CONST_instr(I32_numtype, `%`_num_(n)) MEMORY.INIT_instr(x, y)]), [TRAP_instr]) - -- if (((i!`%`_num_.0 + n) > |$mem(z, x).BYTES_meminst|) \/ ((j!`%`_num_.0 + n) > |$data(z, y).BYTES_datainst|)) - - ;; 8-reduction.watsup - rule `memory.init-zero`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), j : num_(I32_numtype), n : n, x : idx, y : idx}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr(I32_numtype, j) CONST_instr(I32_numtype, `%`_num_(n)) MEMORY.INIT_instr(x, y)]), []) - -- otherwise - -- if (n = 0) - - ;; 8-reduction.watsup - rule `memory.init-succ`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), j : num_(I32_numtype), n : n, x : idx, y : idx}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr(I32_numtype, j) CONST_instr(I32_numtype, `%`_num_(n)) MEMORY.INIT_instr(x, y)]), [CONST_instr((at : addrtype <: numtype), i) CONST_instr(I32_numtype, `%`_num_($data(z, y).BYTES_datainst[j!`%`_num_.0]!`%`_byte.0)) STORE_instr(I32_numtype, ?(`%`_storeop_(`%`_sz(8))), x, $memarg0) CONST_instr((at : addrtype <: numtype), `%`_num_((i!`%`_num_.0 + 1))) CONST_instr(I32_numtype, `%`_num_((j!`%`_num_.0 + 1))) CONST_instr(I32_numtype, `%`_num_((((n : nat <:> int) - (1 : nat <:> int)) : int <:> nat))) MEMORY.INIT_instr(x, y)]) - -- otherwise - -;; 8-reduction.watsup -rec { - -;; 8-reduction.watsup:5.1-5.88 -relation Step: `%~>%`(config, config) - ;; 8-reduction.watsup:13.1-15.34 - rule pure{z : state, `instr*` : instr*, `instr'*` : instr*}: - `%~>%`(`%;%`_config(z, instr*{instr <- `instr*`}), `%;%`_config(z, instr'*{instr' <- `instr'*`})) - -- Step_pure: `%~>%`(instr*{instr <- `instr*`}, instr'*{instr' <- `instr'*`}) - - ;; 8-reduction.watsup:17.1-19.37 - rule read{z : state, `instr*` : instr*, `instr'*` : instr*}: - `%~>%`(`%;%`_config(z, instr*{instr <- `instr*`}), `%;%`_config(z, instr'*{instr' <- `instr'*`})) - -- Step_read: `%~>%`(`%;%`_config(z, instr*{instr <- `instr*`}), instr'*{instr' <- `instr'*`}) - - ;; 8-reduction.watsup:32.1-35.41 - rule `ctxt-instrs`{z : state, `val*` : val*, `instr*` : instr*, `instr_1*` : instr*, z' : state, `instr'*` : instr*}: - `%~>%`(`%;%`_config(z, (val : val <: instr)*{val <- `val*`} ++ instr*{instr <- `instr*`} ++ instr_1*{instr_1 <- `instr_1*`}), `%;%`_config(z', (val : val <: instr)*{val <- `val*`} ++ instr'*{instr' <- `instr'*`} ++ instr_1*{instr_1 <- `instr_1*`})) - -- Step: `%~>%`(`%;%`_config(z, instr*{instr <- `instr*`}), `%;%`_config(z', instr'*{instr' <- `instr'*`})) - -- if ((val*{val <- `val*`} =/= []) \/ (instr_1*{instr_1 <- `instr_1*`} =/= [])) - - ;; 8-reduction.watsup:37.1-39.36 - rule `ctxt-label`{z : state, n : n, `instr_0*` : instr*, `instr*` : instr*, z' : state, `instr'*` : instr*}: - `%~>%`(`%;%`_config(z, [`LABEL_%{%}%`_instr(n, instr_0*{instr_0 <- `instr_0*`}, instr*{instr <- `instr*`})]), `%;%`_config(z', [`LABEL_%{%}%`_instr(n, instr_0*{instr_0 <- `instr_0*`}, instr'*{instr' <- `instr'*`})])) - -- Step: `%~>%`(`%;%`_config(z, instr*{instr <- `instr*`}), `%;%`_config(z', instr'*{instr' <- `instr'*`})) - - ;; 8-reduction.watsup:41.1-43.44 - rule `ctxt-frame`{s : store, f : frame, n : n, f' : frame, `instr*` : instr*, s' : store, `instr'*` : instr*}: - `%~>%`(`%;%`_config(`%;%`_state(s, f), [`FRAME_%{%}%`_instr(n, f', instr*{instr <- `instr*`})]), `%;%`_config(`%;%`_state(s', f), [`FRAME_%{%}%`_instr(n, f', instr'*{instr' <- `instr'*`})])) - -- Step: `%~>%`(`%;%`_config(`%;%`_state(s, f'), instr*{instr <- `instr*`}), `%;%`_config(`%;%`_state(s', f'), instr'*{instr' <- `instr'*`})) - - ;; 8-reduction.watsup:227.1-232.49 - rule throw{z : state, `val*` : val*, n : n, x : idx, exn : exninst, a : addr, `t*` : valtype*}: - `%~>%`(`%;%`_config(z, (val : val <: instr)^n{val <- `val*`} ++ [THROW_instr(x)]), `%;%`_config($add_exninst(z, [exn]), [REF.EXN_ADDR_instr(a) THROW_REF_instr])) - -- Expand: `%~~%`($tag(z, x).TYPE_taginst, FUNC_comptype(`%->%`_functype(`%`_resulttype(t^n{t <- `t*`}), `%`_resulttype([])))) - -- if (a = |$exninst(z)|) - -- if (exn = {TAG $tagaddr(z)[x!`%`_idx.0], FIELDS val^n{val <- `val*`}}) - - ;; 8-reduction.watsup:407.1-411.65 - rule struct.new{z : state, `val*` : val*, n : n, x : idx, si : structinst, a : addr, `mut*` : mut*, `zt*` : storagetype*}: - `%~>%`(`%;%`_config(z, (val : val <: instr)^n{val <- `val*`} ++ [STRUCT.NEW_instr(x)]), `%;%`_config($add_structinst(z, [si]), [REF.STRUCT_ADDR_instr(a)])) - -- Expand: `%~~%`($type(z, x), STRUCT_comptype(`%`_structtype(`%%`_fieldtype(mut, zt)^n{mut <- `mut*`, zt <- `zt*`}))) - -- if (a = |$structinst(z)|) - -- if (si = {TYPE $type(z, x), FIELDS $packfield_(zt, val)^n{val <- `val*`, zt <- `zt*`}}) - - ;; 8-reduction.watsup:427.1-428.53 - rule `struct.set-null`{z : state, ht : heaptype, val : val, x : idx, i : u32}: - `%~>%`(`%;%`_config(z, [REF.NULL_instr(ht) (val : val <: instr) STRUCT.SET_instr(x, i)]), `%;%`_config(z, [TRAP_instr])) - - ;; 8-reduction.watsup:430.1-432.45 - rule `struct.set-struct`{z : state, a : addr, val : val, x : idx, i : u32, `zt*` : storagetype*, `mut*` : mut*}: - `%~>%`(`%;%`_config(z, [REF.STRUCT_ADDR_instr(a) (val : val <: instr) STRUCT.SET_instr(x, i)]), `%;%`_config($with_struct(z, a, i!`%`_u32.0, $packfield_(zt*{zt <- `zt*`}[i!`%`_u32.0], val)), [])) - -- Expand: `%~~%`($type(z, x), STRUCT_comptype(`%`_structtype(`%%`_fieldtype(mut, zt)*{mut <- `mut*`, zt <- `zt*`}))) - - ;; 8-reduction.watsup:445.1-450.65 - rule array.new_fixed{z : state, `val*` : val*, n : n, x : idx, ai : arrayinst, a : addr, mut : mut, zt : storagetype}: - `%~>%`(`%;%`_config(z, (val : val <: instr)^n{val <- `val*`} ++ [ARRAY.NEW_FIXED_instr(x, `%`_u32(n))]), `%;%`_config($add_arrayinst(z, [ai]), [REF.ARRAY_ADDR_instr(a)])) - -- Expand: `%~~%`($type(z, x), ARRAY_comptype(`%%`_arraytype(mut, zt))) - -- if ((a = |$arrayinst(z)|) /\ (ai = {TYPE $type(z, x), FIELDS $packfield_(zt, val)^n{val <- `val*`}})) - - ;; 8-reduction.watsup:490.1-491.64 - rule `array.set-null`{z : state, ht : heaptype, i : num_(I32_numtype), val : val, x : idx}: - `%~>%`(`%;%`_config(z, [REF.NULL_instr(ht) CONST_instr(I32_numtype, i) (val : val <: instr) ARRAY.SET_instr(x)]), `%;%`_config(z, [TRAP_instr])) - - ;; 8-reduction.watsup:493.1-495.39 - rule `array.set-oob`{z : state, a : addr, i : num_(I32_numtype), val : val, x : idx}: - `%~>%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) (val : val <: instr) ARRAY.SET_instr(x)]), `%;%`_config(z, [TRAP_instr])) - -- if (i!`%`_num_.0 >= |$arrayinst(z)[a].FIELDS_arrayinst|) - - ;; 8-reduction.watsup:497.1-500.43 - rule `array.set-array`{z : state, a : addr, i : num_(I32_numtype), val : val, x : idx, zt : storagetype, mut : mut}: - `%~>%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) (val : val <: instr) ARRAY.SET_instr(x)]), `%;%`_config($with_array(z, a, i!`%`_num_.0, $packfield_(zt, val)), [])) - -- Expand: `%~~%`($type(z, x), ARRAY_comptype(`%%`_arraytype(mut, zt))) - - ;; 8-reduction.watsup:779.1-780.56 - rule local.set{z : state, val : val, x : idx}: - `%~>%`(`%;%`_config(z, [(val : val <: instr) LOCAL.SET_instr(x)]), `%;%`_config($with_local(z, x, val), [])) - - ;; 8-reduction.watsup:792.1-793.58 - rule global.set{z : state, val : val, x : idx}: - `%~>%`(`%;%`_config(z, [(val : val <: instr) GLOBAL.SET_instr(x)]), `%;%`_config($with_global(z, x, val), [])) - - ;; 8-reduction.watsup:806.1-808.33 - rule `table.set-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), ref : ref, x : idx}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) (ref : ref <: instr) TABLE.SET_instr(x)]), `%;%`_config(z, [TRAP_instr])) - -- if (i!`%`_num_.0 >= |$table(z, x).REFS_tableinst|) - - ;; 8-reduction.watsup:810.1-812.32 - rule `table.set-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), ref : ref, x : idx}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) (ref : ref <: instr) TABLE.SET_instr(x)]), `%;%`_config($with_table(z, x, i!`%`_num_.0, ref), [])) - -- if (i!`%`_num_.0 < |$table(z, x).REFS_tableinst|) - - ;; 8-reduction.watsup:821.1-824.46 - rule `table.grow-succeed`{z : state, ref : ref, at : addrtype, n : n, x : idx, ti : tableinst}: - `%~>%`(`%;%`_config(z, [(ref : ref <: instr) CONST_instr((at : addrtype <: numtype), `%`_num_(n)) TABLE.GROW_instr(x)]), `%;%`_config($with_tableinst(z, x, ti), [CONST_instr((at : addrtype <: numtype), `%`_num_(|$table(z, x).REFS_tableinst|))])) - -- if (ti = $growtable($table(z, x), n, ref)) - - ;; 8-reduction.watsup:826.1-827.86 - rule `table.grow-fail`{z : state, ref : ref, at : addrtype, n : n, x : idx}: - `%~>%`(`%;%`_config(z, [(ref : ref <: instr) CONST_instr((at : addrtype <: numtype), `%`_num_(n)) TABLE.GROW_instr(x)]), `%;%`_config(z, [CONST_instr((at : addrtype <: numtype), `%`_num_($invsigned_($size((at : addrtype <: numtype)), - (1 : nat <:> int))))])) - - ;; 8-reduction.watsup:887.1-888.51 - rule elem.drop{z : state, x : idx}: - `%~>%`(`%;%`_config(z, [ELEM.DROP_instr(x)]), `%;%`_config($with_elem(z, x, []), [])) - - ;; 8-reduction.watsup:971.1-974.60 - rule `store-num-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), nt : numtype, c : num_(nt), x : idx, ao : memarg}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr(nt, c) STORE_instr(nt, ?(), x, ao)]), `%;%`_config(z, [TRAP_instr])) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + ((($size(nt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) - - ;; 8-reduction.watsup:976.1-980.29 - rule `store-num-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), nt : numtype, c : num_(nt), x : idx, ao : memarg, `b*` : byte*}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr(nt, c) STORE_instr(nt, ?(), x, ao)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0), ((($size(nt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) - -- if (b*{b <- `b*`} = $nbytes_(nt, c)) - - ;; 8-reduction.watsup:982.1-985.52 - rule `store-pack-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), Inn : Inn, c : num_((Inn : Inn <: numtype)), n : n, x : idx, ao : memarg}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr((Inn : Inn <: numtype), c) STORE_instr((Inn : Inn <: numtype), ?(`%`_storeop_(`%`_sz(n))), x, ao)]), `%;%`_config(z, [TRAP_instr])) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + (((n : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) - - ;; 8-reduction.watsup:987.1-991.52 - rule `store-pack-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), Inn : Inn, c : num_((Inn : Inn <: numtype)), n : n, x : idx, ao : memarg, `b*` : byte*}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr((Inn : Inn <: numtype), c) STORE_instr((Inn : Inn <: numtype), ?(`%`_storeop_(`%`_sz(n))), x, ao)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0), (((n : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) - -- if (b*{b <- `b*`} = $ibytes_(n, $wrap__($size((Inn : Inn <: numtype)), n, c))) - - ;; 8-reduction.watsup:993.1-995.63 - rule `vstore-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c : vec_(V128_Vnn), x : idx, ao : memarg}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_instr(V128_vectype, x, ao)]), `%;%`_config(z, [TRAP_instr])) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + ((($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) - - ;; 8-reduction.watsup:997.1-999.31 - rule `vstore-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c : vec_(V128_Vnn), x : idx, ao : memarg, `b*` : byte*}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_instr(V128_vectype, x, ao)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0), ((($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) - -- if (b*{b <- `b*`} = $vbytes_(V128_vectype, c)) - - ;; 8-reduction.watsup:1002.1-1004.50 - rule `vstore_lane-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c : vec_(V128_Vnn), N : N, x : idx, ao : memarg, j : laneidx}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_LANE_instr(V128_vectype, `%`_sz(N), x, ao, j)]), `%;%`_config(z, [TRAP_instr])) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + N) > |$mem(z, x).BYTES_meminst|) - - ;; 8-reduction.watsup:1006.1-1010.49 - rule `vstore_lane-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c : vec_(V128_Vnn), N : N, x : idx, ao : memarg, j : laneidx, `b*` : byte*, Jnn : Jnn, M : M}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_LANE_instr(V128_vectype, `%`_sz(N), x, ao, j)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0), (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) - -- if (N = $lsize((Jnn : Jnn <: lanetype))) - -- if ((M : nat <:> rat) = ((128 : nat <:> rat) / (N : nat <:> rat))) - -- if (b*{b <- `b*`} = $ibytes_(N, `%`_iN($lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), c)[j!`%`_laneidx.0]!`%`_lane_.0))) - - ;; 8-reduction.watsup:1019.1-1022.37 - rule `memory.grow-succeed`{z : state, at : addrtype, n : n, x : idx, mi : meminst}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), `%`_num_(n)) MEMORY.GROW_instr(x)]), `%;%`_config($with_meminst(z, x, mi), [CONST_instr((at : addrtype <: numtype), `%`_num_((((|$mem(z, x).BYTES_meminst| : nat <:> rat) / ((64 * $Ki) : nat <:> rat)) : rat <:> nat)))])) - -- if (mi = $growmem($mem(z, x), n)) - - ;; 8-reduction.watsup:1024.1-1025.83 - rule `memory.grow-fail`{z : state, at : addrtype, n : n, x : idx}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), `%`_num_(n)) MEMORY.GROW_instr(x)]), `%;%`_config(z, [CONST_instr((at : addrtype <: numtype), `%`_num_($invsigned_($size((at : addrtype <: numtype)), - (1 : nat <:> int))))])) - - ;; 8-reduction.watsup:1085.1-1086.51 - rule data.drop{z : state, x : idx}: - `%~>%`(`%;%`_config(z, [DATA.DROP_instr(x)]), `%;%`_config($with_data(z, x, []), [])) -} - -;; 8-reduction.watsup -rec { - -;; 8-reduction.watsup:8.1-8.92 -relation Steps: `%~>*%`(config, config) - ;; 8-reduction.watsup:21.1-22.26 - rule refl{z : state, `instr*` : instr*}: - `%~>*%`(`%;%`_config(z, instr*{instr <- `instr*`}), `%;%`_config(z, instr*{instr <- `instr*`})) - - ;; 8-reduction.watsup:24.1-27.44 - rule trans{z : state, `instr*` : instr*, z'' : state, `instr''*` : instr*, z' : state, `instr'*` : instr*}: - `%~>*%`(`%;%`_config(z, instr*{instr <- `instr*`}), `%;%`_config(z'', instr''*{instr'' <- `instr''*`})) - -- Step: `%~>%`(`%;%`_config(z, instr*{instr <- `instr*`}), `%;%`_config(z', instr'*{instr' <- `instr'*`})) - -- Steps: `%~>*%`(`%;%`_config(z', instr'*{instr' <- `instr'*`}), `%;%`_config(z'', instr''*{instr'' <- `instr''*`})) -} - -;; 8-reduction.watsup -relation Eval_expr: `%;%~>*%;%`(state, expr, state, val*) - ;; 8-reduction.watsup - rule _{z : state, `instr*` : instr*, z' : state, `val*` : val*}: - `%;%~>*%;%`(z, instr*{instr <- `instr*`}, z', val*{val <- `val*`}) - -- Steps: `%~>*%`(`%;%`_config(z, instr*{instr <- `instr*`}), `%;%`_config(z', (val : val <: instr)*{val <- `val*`})) - -;; 9-module.watsup -rec { - -;; 9-module.watsup:7.1-7.63 -def $alloctypes(type*) : deftype* - ;; 9-module.watsup:8.1-8.27 - def $alloctypes([]) = [] - ;; 9-module.watsup:9.1-13.24 - def $alloctypes{`type'*` : type*, type : type, `deftype'*` : deftype*, `deftype*` : deftype*, rectype : rectype, x : idx}(type'*{type' <- `type'*`} ++ [type]) = deftype'*{deftype' <- `deftype'*`} ++ deftype*{deftype <- `deftype*`} - -- if (deftype'*{deftype' <- `deftype'*`} = $alloctypes(type'*{type' <- `type'*`})) - -- if (type = TYPE_type(rectype)) - -- if (deftype*{deftype <- `deftype*`} = $subst_all_deftypes($rolldt(x, rectype), (deftype' : deftype <: heaptype)*{deftype' <- `deftype'*`})) - -- if (x!`%`_idx.0 = |deftype'*{deftype' <- `deftype'*`}|) -} - -;; 9-module.watsup -def $allocfunc(store : store, deftype : deftype, funccode : funccode, moduleinst : moduleinst) : (store, funcaddr) - ;; 9-module.watsup - def $allocfunc{s : store, deftype : deftype, funccode : funccode, moduleinst : moduleinst, funcinst : funcinst}(s, deftype, funccode, moduleinst) = (s +++ {FUNCS [funcinst], GLOBALS [], TABLES [], MEMS [], TAGS [], ELEMS [], DATAS [], STRUCTS [], ARRAYS [], EXNS []}, |s.FUNCS_store|) - -- if (funcinst = {TYPE deftype, MODULE moduleinst, CODE funccode}) - -;; 9-module.watsup -rec { - -;; 9-module.watsup:20.1-20.113 -def $allocfuncs(store : store, deftype*, funccode*, moduleinst*) : (store, funcaddr*) - ;; 9-module.watsup:21.1-21.45 - def $allocfuncs{s : store}(s, [], [], []) = (s, []) - ;; 9-module.watsup:22.1-24.71 - def $allocfuncs{s : store, dt : deftype, `dt'*` : deftype*, funccode : funccode, `funccode'*` : funccode*, moduleinst : moduleinst, `moduleinst'*` : moduleinst*, s_2 : store, fa : funcaddr, `fa'*` : funcaddr*, s_1 : store}(s, [dt] ++ dt'*{dt' <- `dt'*`}, [funccode] ++ funccode'*{funccode' <- `funccode'*`}, [moduleinst] ++ moduleinst'*{moduleinst' <- `moduleinst'*`}) = (s_2, [fa] ++ fa'*{fa' <- `fa'*`}) - -- if ((s_1, fa) = $allocfunc(s, dt, funccode, moduleinst)) - -- if ((s_2, fa'*{fa' <- `fa'*`}) = $allocfuncs(s_1, dt'*{dt' <- `dt'*`}, funccode'*{funccode' <- `funccode'*`}, moduleinst'*{moduleinst' <- `moduleinst'*`})) -} - -;; 9-module.watsup -def $allocglobal(store : store, globaltype : globaltype, val : val) : (store, globaladdr) - ;; 9-module.watsup - def $allocglobal{s : store, globaltype : globaltype, val : val, globalinst : globalinst}(s, globaltype, val) = (s +++ {FUNCS [], GLOBALS [globalinst], TABLES [], MEMS [], TAGS [], ELEMS [], DATAS [], STRUCTS [], ARRAYS [], EXNS []}, |s.GLOBALS_store|) - -- if (globalinst = {TYPE globaltype, VALUE val}) - -;; 9-module.watsup -rec { - -;; 9-module.watsup:31.1-31.102 -def $allocglobals(store : store, globaltype*, val*) : (store, globaladdr*) - ;; 9-module.watsup:32.1-32.42 - def $allocglobals{s : store}(s, [], []) = (s, []) - ;; 9-module.watsup:33.1-35.62 - def $allocglobals{s : store, globaltype : globaltype, `globaltype'*` : globaltype*, val : val, `val'*` : val*, s_2 : store, ga : globaladdr, `ga'*` : globaladdr*, s_1 : store}(s, [globaltype] ++ globaltype'*{globaltype' <- `globaltype'*`}, [val] ++ val'*{val' <- `val'*`}) = (s_2, [ga] ++ ga'*{ga' <- `ga'*`}) - -- if ((s_1, ga) = $allocglobal(s, globaltype, val)) - -- if ((s_2, ga'*{ga' <- `ga'*`}) = $allocglobals(s_1, globaltype'*{globaltype' <- `globaltype'*`}, val'*{val' <- `val'*`})) -} - -;; 9-module.watsup -def $alloctable(store : store, tabletype : tabletype, ref : ref) : (store, tableaddr) - ;; 9-module.watsup - def $alloctable{s : store, at : addrtype, i : u64, j : u64, rt : reftype, ref : ref, tableinst : tableinst}(s, `%%%`_tabletype(at, `[%..%]`_limits(i, j), rt), ref) = (s +++ {FUNCS [], GLOBALS [], TABLES [tableinst], MEMS [], TAGS [], ELEMS [], DATAS [], STRUCTS [], ARRAYS [], EXNS []}, |s.TABLES_store|) - -- if (tableinst = {TYPE `%%%`_tabletype(at, `[%..%]`_limits(i, j), rt), REFS ref^i!`%`_u64.0{}}) - -;; 9-module.watsup -rec { - -;; 9-module.watsup:42.1-42.98 -def $alloctables(store : store, tabletype*, ref*) : (store, tableaddr*) - ;; 9-module.watsup:43.1-43.41 - def $alloctables{s : store}(s, [], []) = (s, []) - ;; 9-module.watsup:44.1-46.60 - def $alloctables{s : store, tabletype : tabletype, `tabletype'*` : tabletype*, ref : ref, `ref'*` : ref*, s_2 : store, ta : tableaddr, `ta'*` : tableaddr*, s_1 : store}(s, [tabletype] ++ tabletype'*{tabletype' <- `tabletype'*`}, [ref] ++ ref'*{ref' <- `ref'*`}) = (s_2, [ta] ++ ta'*{ta' <- `ta'*`}) - -- if ((s_1, ta) = $alloctable(s, tabletype, ref)) - -- if ((s_2, ta'*{ta' <- `ta'*`}) = $alloctables(s_1, tabletype'*{tabletype' <- `tabletype'*`}, ref'*{ref' <- `ref'*`})) -} - -;; 9-module.watsup -def $allocmem(store : store, memtype : memtype) : (store, memaddr) - ;; 9-module.watsup - def $allocmem{s : store, at : addrtype, i : u64, j : u64, meminst : meminst}(s, `%%PAGE`_memtype(at, `[%..%]`_limits(i, j))) = (s +++ {FUNCS [], GLOBALS [], TABLES [], MEMS [meminst], TAGS [], ELEMS [], DATAS [], STRUCTS [], ARRAYS [], EXNS []}, |s.MEMS_store|) - -- if (meminst = {TYPE `%%PAGE`_memtype(at, `[%..%]`_limits(i, j)), BYTES `%`_byte(0)^(i!`%`_u64.0 * (64 * $Ki)){}}) - -;; 9-module.watsup -rec { - -;; 9-module.watsup:53.1-53.82 -def $allocmems(store : store, memtype*) : (store, memaddr*) - ;; 9-module.watsup:54.1-54.34 - def $allocmems{s : store}(s, []) = (s, []) - ;; 9-module.watsup:55.1-57.49 - def $allocmems{s : store, memtype : memtype, `memtype'*` : memtype*, s_2 : store, ma : memaddr, `ma'*` : memaddr*, s_1 : store}(s, [memtype] ++ memtype'*{memtype' <- `memtype'*`}) = (s_2, [ma] ++ ma'*{ma' <- `ma'*`}) - -- if ((s_1, ma) = $allocmem(s, memtype)) - -- if ((s_2, ma'*{ma' <- `ma'*`}) = $allocmems(s_1, memtype'*{memtype' <- `memtype'*`})) -} - -;; 9-module.watsup -def $alloctag(store : store, tagtype : tagtype) : (store, tagaddr) - ;; 9-module.watsup - def $alloctag{s : store, tagtype : tagtype, taginst : taginst}(s, tagtype) = (s +++ {FUNCS [], GLOBALS [], TABLES [], MEMS [], TAGS [taginst], ELEMS [], DATAS [], STRUCTS [], ARRAYS [], EXNS []}, |s.TAGS_store|) - -- if (taginst = {TYPE tagtype}) - -;; 9-module.watsup -rec { - -;; 9-module.watsup:64.1-64.82 -def $alloctags(store : store, tagtype*) : (store, tagaddr*) - ;; 9-module.watsup:65.1-65.34 - def $alloctags{s : store}(s, []) = (s, []) - ;; 9-module.watsup:66.1-68.44 - def $alloctags{s : store, jt : tagtype, `jt'*` : tagtype*, s_2 : store, ja : tagaddr, `ja'*` : tagaddr*, s_1 : store}(s, [jt] ++ jt'*{jt' <- `jt'*`}) = (s_2, [ja] ++ ja'*{ja' <- `ja'*`}) - -- if ((s_1, ja) = $alloctag(s, jt)) - -- if ((s_2, ja'*{ja' <- `ja'*`}) = $alloctags(s_1, jt'*{jt' <- `jt'*`})) -} - -;; 9-module.watsup -def $allocelem(store : store, elemtype : elemtype, ref*) : (store, elemaddr) - ;; 9-module.watsup - def $allocelem{s : store, elemtype : elemtype, `ref*` : ref*, eleminst : eleminst}(s, elemtype, ref*{ref <- `ref*`}) = (s +++ {FUNCS [], GLOBALS [], TABLES [], MEMS [], TAGS [], ELEMS [eleminst], DATAS [], STRUCTS [], ARRAYS [], EXNS []}, |s.ELEMS_store|) - -- if (eleminst = {TYPE elemtype, REFS ref*{ref <- `ref*`}}) - -;; 9-module.watsup -rec { - -;; 9-module.watsup:75.1-75.97 -def $allocelems(store : store, elemtype*, ref**) : (store, elemaddr*) - ;; 9-module.watsup:76.1-76.40 - def $allocelems{s : store}(s, [], []) = (s, []) - ;; 9-module.watsup:77.1-79.55 - def $allocelems{s : store, rt : reftype, `rt'*` : reftype*, `ref*` : ref*, `ref'**` : ref**, s_2 : store, ea : elemaddr, `ea'*` : elemaddr*, s_1 : store}(s, [rt] ++ rt'*{rt' <- `rt'*`}, [ref*{ref <- `ref*`}] ++ ref'*{ref' <- `ref'*`}*{`ref'*` <- `ref'**`}) = (s_2, [ea] ++ ea'*{ea' <- `ea'*`}) - -- if ((s_1, ea) = $allocelem(s, rt, ref*{ref <- `ref*`})) - -- if ((s_2, ea'*{ea' <- `ea'*`}) = $allocelems(s_1, rt'*{rt' <- `rt'*`}, ref'*{ref' <- `ref'*`}*{`ref'*` <- `ref'**`})) -} - -;; 9-module.watsup -def $allocdata(store : store, datatype : datatype, byte*) : (store, dataaddr) - ;; 9-module.watsup - def $allocdata{s : store, `byte*` : byte*, datainst : datainst}(s, OK_datatype, byte*{byte <- `byte*`}) = (s +++ {FUNCS [], GLOBALS [], TABLES [], MEMS [], TAGS [], ELEMS [], DATAS [datainst], STRUCTS [], ARRAYS [], EXNS []}, |s.DATAS_store|) - -- if (datainst = {BYTES byte*{byte <- `byte*`}}) - -;; 9-module.watsup -rec { - -;; 9-module.watsup:86.1-86.98 -def $allocdatas(store : store, datatype*, byte**) : (store, dataaddr*) - ;; 9-module.watsup:87.1-87.40 - def $allocdatas{s : store}(s, [], []) = (s, []) - ;; 9-module.watsup:88.1-90.53 - def $allocdatas{s : store, ok : datatype, `ok'*` : datatype*, `b*` : byte*, `b'**` : byte**, s_2 : store, da : dataaddr, `da'*` : dataaddr*, s_1 : store}(s, [ok] ++ ok'*{ok' <- `ok'*`}, [b*{b <- `b*`}] ++ b'*{b' <- `b'*`}*{`b'*` <- `b'**`}) = (s_2, [da] ++ da'*{da' <- `da'*`}) - -- if ((s_1, da) = $allocdata(s, ok, b*{b <- `b*`})) - -- if ((s_2, da'*{da' <- `da'*`}) = $allocdatas(s_1, ok'*{ok' <- `ok'*`}, b'*{b' <- `b'*`}*{`b'*` <- `b'**`})) -} - -;; 9-module.watsup -def $allocexport(moduleinst : moduleinst, export : export) : exportinst - ;; 9-module.watsup - def $allocexport{moduleinst : moduleinst, name : name, x : idx}(moduleinst, EXPORT_export(name, FUNC_externidx(x))) = {NAME name, ADDR FUNC_externaddr(moduleinst.FUNCS_moduleinst[x!`%`_idx.0])} - ;; 9-module.watsup - def $allocexport{moduleinst : moduleinst, name : name, x : idx}(moduleinst, EXPORT_export(name, GLOBAL_externidx(x))) = {NAME name, ADDR GLOBAL_externaddr(moduleinst.GLOBALS_moduleinst[x!`%`_idx.0])} - ;; 9-module.watsup - def $allocexport{moduleinst : moduleinst, name : name, x : idx}(moduleinst, EXPORT_export(name, TABLE_externidx(x))) = {NAME name, ADDR TABLE_externaddr(moduleinst.TABLES_moduleinst[x!`%`_idx.0])} - ;; 9-module.watsup - def $allocexport{moduleinst : moduleinst, name : name, x : idx}(moduleinst, EXPORT_export(name, MEM_externidx(x))) = {NAME name, ADDR MEM_externaddr(moduleinst.MEMS_moduleinst[x!`%`_idx.0])} - ;; 9-module.watsup - def $allocexport{moduleinst : moduleinst, name : name, x : idx}(moduleinst, EXPORT_export(name, TAG_externidx(x))) = {NAME name, ADDR TAG_externaddr(moduleinst.TAGS_moduleinst[x!`%`_idx.0])} - -;; 9-module.watsup -def $allocexports(moduleinst : moduleinst, export*) : exportinst* - ;; 9-module.watsup - def $allocexports{moduleinst : moduleinst, `export*` : export*}(moduleinst, export*{export <- `export*`}) = $allocexport(moduleinst, export)*{export <- `export*`} - -;; 9-module.watsup -def $allocmodule(store : store, module : module, externaddr*, val*, ref*, ref**) : (store, moduleinst) - ;; 9-module.watsup - def $allocmodule{s : store, module : module, `externaddr*` : externaddr*, `val_G*` : val*, `ref_T*` : ref*, `ref_E**` : ref**, s_7 : store, moduleinst : moduleinst, `type*` : type*, `import*` : import*, `func*` : func*, `global*` : global*, `table*` : table*, `mem*` : mem*, `tag*` : tag*, `elem*` : elem*, `data*` : data*, `start?` : start?, `export*` : export*, `x*` : idx*, `local**` : local**, `expr_F*` : expr*, `globaltype*` : globaltype*, `expr_G*` : expr*, `tabletype*` : tabletype*, `expr_T*` : expr*, `memtype*` : memtype*, `y*` : idx*, `elemtype*` : elemtype*, `expr_E**` : expr**, `elemmode*` : elemmode*, `byte**` : byte**, `datamode*` : datamode*, `fa_I*` : funcaddr*, `ga_I*` : globaladdr*, `ta_I*` : tableaddr*, `ma_I*` : memaddr*, `aa_I*` : tagaddr*, `fa*` : nat*, `i_F*` : nat*, `ga*` : nat*, `i_G*` : nat*, `ta*` : nat*, `i_T*` : nat*, `aa*` : nat*, `i_A*` : nat*, `ma*` : nat*, `i_M*` : nat*, `ea*` : nat*, `i_E*` : nat*, `da*` : nat*, `i_D*` : nat*, `dt*` : deftype*, s_1 : store, s_2 : store, s_3 : store, s_4 : store, s_5 : store, s_6 : store, `xi*` : exportinst*}(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**`}) = (s_7, moduleinst) - -- if (module = MODULE_module(type*{type <- `type*`}, import*{import <- `import*`}, func*{func <- `func*`}, global*{global <- `global*`}, table*{table <- `table*`}, mem*{mem <- `mem*`}, tag*{tag <- `tag*`}, elem*{elem <- `elem*`}, data*{data <- `data*`}, start?{start <- `start?`}, export*{export <- `export*`})) - -- if (func*{func <- `func*`} = FUNC_func(x, local*{local <- `local*`}, expr_F)*{expr_F <- `expr_F*`, `local*` <- `local**`, x <- `x*`}) - -- if (global*{global <- `global*`} = GLOBAL_global(globaltype, expr_G)*{expr_G <- `expr_G*`, globaltype <- `globaltype*`}) - -- if (table*{table <- `table*`} = TABLE_table(tabletype, expr_T)*{expr_T <- `expr_T*`, tabletype <- `tabletype*`}) - -- if (mem*{mem <- `mem*`} = MEMORY_mem(memtype)*{memtype <- `memtype*`}) - -- if (tag*{tag <- `tag*`} = TAG_tag(y)*{y <- `y*`}) - -- if (elem*{elem <- `elem*`} = ELEM_elem(elemtype, expr_E*{expr_E <- `expr_E*`}, elemmode)*{elemmode <- `elemmode*`, elemtype <- `elemtype*`, `expr_E*` <- `expr_E**`}) - -- if (data*{data <- `data*`} = DATA_data(byte*{byte <- `byte*`}, datamode)*{`byte*` <- `byte**`, datamode <- `datamode*`}) - -- if (fa_I*{fa_I <- `fa_I*`} = $funcsxa(externaddr*{externaddr <- `externaddr*`})) - -- if (ga_I*{ga_I <- `ga_I*`} = $globalsxa(externaddr*{externaddr <- `externaddr*`})) - -- if (ta_I*{ta_I <- `ta_I*`} = $tablesxa(externaddr*{externaddr <- `externaddr*`})) - -- if (ma_I*{ma_I <- `ma_I*`} = $memsxa(externaddr*{externaddr <- `externaddr*`})) - -- if (aa_I*{aa_I <- `aa_I*`} = $tagsxa(externaddr*{externaddr <- `externaddr*`})) - -- if (fa*{fa <- `fa*`} = (|s.FUNCS_store| + i_F)^(i_F<|func*{func <- `func*`}|){i_F <- `i_F*`}) - -- if (ga*{ga <- `ga*`} = (|s.GLOBALS_store| + i_G)^(i_G<|global*{global <- `global*`}|){i_G <- `i_G*`}) - -- if (ta*{ta <- `ta*`} = (|s.TABLES_store| + i_T)^(i_T<|table*{table <- `table*`}|){i_T <- `i_T*`}) - -- if (aa*{aa <- `aa*`} = (|s.TAGS_store| + i_A)^(i_A<|tag*{tag <- `tag*`}|){i_A <- `i_A*`}) - -- if (ma*{ma <- `ma*`} = (|s.MEMS_store| + i_M)^(i_M<|mem*{mem <- `mem*`}|){i_M <- `i_M*`}) - -- if (ea*{ea <- `ea*`} = (|s.ELEMS_store| + i_E)^(i_E<|elem*{elem <- `elem*`}|){i_E <- `i_E*`}) - -- if (da*{da <- `da*`} = (|s.DATAS_store| + i_D)^(i_D<|data*{data <- `data*`}|){i_D <- `i_D*`}) - -- if (dt*{dt <- `dt*`} = $alloctypes(type*{type <- `type*`})) - -- if ((s_1, fa*{fa <- `fa*`}) = $allocfuncs(s, dt*{dt <- `dt*`}[x!`%`_idx.0]*{x <- `x*`}, FUNC_funccode(x, local*{local <- `local*`}, expr_F)*{expr_F <- `expr_F*`, `local*` <- `local**`, x <- `x*`}, moduleinst^|func*{func <- `func*`}|{})) - -- if ((s_2, ga*{ga <- `ga*`}) = $allocglobals(s_1, $subst_all_globaltype(globaltype, (dt : deftype <: heaptype)*{dt <- `dt*`})*{globaltype <- `globaltype*`}, val_G*{val_G <- `val_G*`})) - -- if ((s_3, ta*{ta <- `ta*`}) = $alloctables(s_2, $subst_all_tabletype(tabletype, (dt : deftype <: heaptype)*{dt <- `dt*`})*{tabletype <- `tabletype*`}, ref_T*{ref_T <- `ref_T*`})) - -- if ((s_4, ma*{ma <- `ma*`}) = $allocmems(s_3, $subst_all_memtype(memtype, (dt : deftype <: heaptype)*{dt <- `dt*`})*{memtype <- `memtype*`})) - -- if ((s_5, aa*{aa <- `aa*`}) = $alloctags(s_4, dt*{dt <- `dt*`}[y!`%`_idx.0]*{y <- `y*`})) - -- if ((s_6, ea*{ea <- `ea*`}) = $allocelems(s_5, $subst_all_reftype(elemtype, (dt : deftype <: heaptype)*{dt <- `dt*`})*{elemtype <- `elemtype*`}, ref_E*{ref_E <- `ref_E*`}*{`ref_E*` <- `ref_E**`})) - -- if ((s_7, da*{da <- `da*`}) = $allocdatas(s_6, OK_datatype^|data*{data <- `data*`}|{}, byte*{byte <- `byte*`}*{`byte*` <- `byte**`})) - -- if (xi*{xi <- `xi*`} = $allocexports({TYPES [], FUNCS fa_I*{fa_I <- `fa_I*`} ++ fa*{fa <- `fa*`}, GLOBALS ga_I*{ga_I <- `ga_I*`} ++ ga*{ga <- `ga*`}, TABLES ta_I*{ta_I <- `ta_I*`} ++ ta*{ta <- `ta*`}, MEMS ma_I*{ma_I <- `ma_I*`} ++ ma*{ma <- `ma*`}, TAGS aa_I*{aa_I <- `aa_I*`} ++ aa*{aa <- `aa*`}, ELEMS [], DATAS [], EXPORTS []}, export*{export <- `export*`})) - -- if (moduleinst = {TYPES dt*{dt <- `dt*`}, FUNCS fa_I*{fa_I <- `fa_I*`} ++ fa*{fa <- `fa*`}, GLOBALS ga_I*{ga_I <- `ga_I*`} ++ ga*{ga <- `ga*`}, TABLES ta_I*{ta_I <- `ta_I*`} ++ ta*{ta <- `ta*`}, MEMS ma_I*{ma_I <- `ma_I*`} ++ ma*{ma <- `ma*`}, TAGS aa_I*{aa_I <- `aa_I*`} ++ aa*{aa <- `aa*`}, ELEMS ea*{ea <- `ea*`}, DATAS da*{da <- `da*`}, EXPORTS xi*{xi <- `xi*`}}) - -;; 9-module.watsup -def $runelem_(elemidx : elemidx, elem : elem) : instr* - ;; 9-module.watsup - def $runelem_{x : idx, rt : reftype, `e*` : expr*, n : n}(x, ELEM_elem(rt, e^n{e <- `e*`}, PASSIVE_elemmode)) = [] - ;; 9-module.watsup - def $runelem_{x : idx, rt : reftype, `e*` : expr*, n : n}(x, ELEM_elem(rt, e^n{e <- `e*`}, DECLARE_elemmode)) = [ELEM.DROP_instr(x)] - ;; 9-module.watsup - def $runelem_{x : idx, rt : reftype, `e*` : expr*, n : n, y : idx, `instr*` : instr*}(x, ELEM_elem(rt, e^n{e <- `e*`}, ACTIVE_elemmode(y, instr*{instr <- `instr*`}))) = instr*{instr <- `instr*`} ++ [CONST_instr(I32_numtype, `%`_num_(0)) CONST_instr(I32_numtype, `%`_num_(n)) TABLE.INIT_instr(y, x) ELEM.DROP_instr(x)] - -;; 9-module.watsup -def $rundata_(dataidx : dataidx, data : data) : instr* - ;; 9-module.watsup - def $rundata_{x : idx, `b*` : byte*, n : n}(x, DATA_data(b^n{b <- `b*`}, PASSIVE_datamode)) = [] - ;; 9-module.watsup - def $rundata_{x : idx, `b*` : byte*, n : n, y : idx, `instr*` : instr*}(x, DATA_data(b^n{b <- `b*`}, ACTIVE_datamode(y, instr*{instr <- `instr*`}))) = instr*{instr <- `instr*`} ++ [CONST_instr(I32_numtype, `%`_num_(0)) CONST_instr(I32_numtype, `%`_num_(n)) MEMORY.INIT_instr(y, x) DATA.DROP_instr(x)] - -;; 9-module.watsup -rec { - -;; 9-module.watsup:170.1-170.94 -def $evalglobals(state : state, globaltype*, expr*) : (state, val*) - ;; 9-module.watsup:171.1-171.41 - def $evalglobals{z : state}(z, [], []) = (z, []) - ;; 9-module.watsup:172.1-177.81 - def $evalglobals{z : state, gt : globaltype, `gt'*` : globaltype*, expr : expr, `expr'*` : expr*, z' : state, val : val, `val'*` : val*, s : store, f : frame, s' : store, a : addr}(z, [gt] ++ gt'*{gt' <- `gt'*`}, [expr] ++ expr'*{expr' <- `expr'*`}) = (z', [val] ++ val'*{val' <- `val'*`}) - -- Eval_expr: `%;%~>*%;%`(z, expr, z, [val]) - -- if (z = `%;%`_state(s, f)) - -- if ((s', a) = $allocglobal(s, gt, val)) - -- if ((z', val'*{val' <- `val'*`}) = $evalglobals(`%;%`_state(s', f[MODULE_frame.GLOBALS_moduleinst =++ [a]]), gt'*{gt' <- `gt'*`}, expr'*{expr' <- `expr'*`})) -} - -;; 9-module.watsup -def $instantiate(store : store, module : module, externaddr*) : config - ;; 9-module.watsup - def $instantiate{s : store, module : module, `externaddr*` : externaddr*, s' : store, f : frame, `instr_E*` : instr*, `instr_D*` : instr*, `instr_S?` : instr?, `xt_I*` : externtype*, `xt_E*` : externtype*, `type*` : type*, `import*` : import*, `func*` : func*, `global*` : global*, `table*` : table*, `mem*` : mem*, `tag*` : tag*, `elem*` : elem*, `data*` : data*, `start?` : start?, `export*` : export*, `globaltype*` : globaltype*, `expr_G*` : expr*, `tabletype*` : tabletype*, `expr_T*` : expr*, `reftype*` : reftype*, `expr_E**` : expr**, `elemmode*` : elemmode*, `byte**` : byte**, `datamode*` : datamode*, `x?` : idx?, moduleinst_0 : moduleinst, `i_F*` : nat*, z : state, z' : state, `val_G*` : val*, `ref_T*` : ref*, `ref_E**` : ref**, moduleinst : moduleinst, `i_E*` : nat*, `i_D*` : nat*}(s, module, externaddr*{externaddr <- `externaddr*`}) = `%;%`_config(`%;%`_state(s', f), instr_E*{instr_E <- `instr_E*`} ++ instr_D*{instr_D <- `instr_D*`} ++ lift(instr_S?{instr_S <- `instr_S?`})) - -- Module_ok: `|-%:%`(module, `%->%`_moduletype(xt_I*{xt_I <- `xt_I*`}, xt_E*{xt_E <- `xt_E*`})) - -- (Externaddr_type: `%|-%:%`(s, externaddr, xt_I))*{externaddr <- `externaddr*`, xt_I <- `xt_I*`} - -- if (module = MODULE_module(type*{type <- `type*`}, import*{import <- `import*`}, func*{func <- `func*`}, global*{global <- `global*`}, table*{table <- `table*`}, mem*{mem <- `mem*`}, tag*{tag <- `tag*`}, elem*{elem <- `elem*`}, data*{data <- `data*`}, start?{start <- `start?`}, export*{export <- `export*`})) - -- if (global*{global <- `global*`} = GLOBAL_global(globaltype, expr_G)*{expr_G <- `expr_G*`, globaltype <- `globaltype*`}) - -- if (table*{table <- `table*`} = TABLE_table(tabletype, expr_T)*{expr_T <- `expr_T*`, tabletype <- `tabletype*`}) - -- if (elem*{elem <- `elem*`} = ELEM_elem(reftype, expr_E*{expr_E <- `expr_E*`}, elemmode)*{elemmode <- `elemmode*`, `expr_E*` <- `expr_E**`, reftype <- `reftype*`}) - -- if (data*{data <- `data*`} = DATA_data(byte*{byte <- `byte*`}, datamode)*{`byte*` <- `byte**`, datamode <- `datamode*`}) - -- if (start?{start <- `start?`} = START_start(x)?{x <- `x?`}) - -- if (moduleinst_0 = {TYPES $alloctypes(type*{type <- `type*`}), FUNCS $funcsxa(externaddr*{externaddr <- `externaddr*`}) ++ (|s.FUNCS_store| + i_F)^(i_F<|func*{func <- `func*`}|){i_F <- `i_F*`}, GLOBALS $globalsxa(externaddr*{externaddr <- `externaddr*`}), TABLES [], MEMS [], TAGS [], ELEMS [], DATAS [], 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*`})) - -- (Eval_expr: `%;%~>*%;%`(z', expr_T, z', [(ref_T : ref <: val)]))*{expr_T <- `expr_T*`, ref_T <- `ref_T*`} - -- (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 (f = {LOCALS [], MODULE moduleinst}) - -- 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_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 (instr_S?{instr_S <- `instr_S?`} = CALL_instr(x)?{x <- `x?`}) - -;; 9-module.watsup -def $invoke(store : store, funcaddr : funcaddr, val*) : config - ;; 9-module.watsup - def $invoke{s : store, funcaddr : funcaddr, `val*` : val*, f : frame, `t_1*` : valtype*, `t_2*` : valtype*}(s, funcaddr, val*{val <- `val*`}) = `%;%`_config(`%;%`_state(s, f), (val : val <: instr)*{val <- `val*`} ++ [REF.FUNC_ADDR_instr(funcaddr) CALL_REF_instr((s.FUNCS_store[funcaddr].TYPE_funcinst : deftype <: typeuse))]) - -- Expand: `%~~%`(s.FUNCS_store[funcaddr].TYPE_funcinst, FUNC_comptype(`%->%`_functype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`})))) - -- (Val_type: `%|-%:%`(s, val, t_1))*{t_1 <- `t_1*`, val <- `val*`} - -- if (f = {LOCALS [], MODULE {TYPES [], FUNCS [], GLOBALS [], TABLES [], MEMS [], TAGS [], ELEMS [], DATAS [], EXPORTS []}}) - -;; A-binary.watsup -grammar Bbyte : byte - ;; A-binary.watsup - prod{b : byte} b!`%`_byte.0:0x00 | ... | b!`%`_byte.0:0xFF => b - -;; A-binary.watsup -rec { - -;; A-binary.watsup:20.1-22.82 -grammar BuN(N : N) : uN(N) - ;; A-binary.watsup:21.5-21.83 - prod{n : n} `%`_byte(n):Bbyte => `%`_uN(n) - -- if ((n < (2 ^ 7)) /\ (n < (2 ^ N))) - ;; A-binary.watsup:22.5-22.82 - prod{n : n, m : m} {`%`_byte(n):Bbyte `%`_uN(m):BuN((((N : nat <:> int) - (7 : nat <:> int)) : int <:> nat))} => `%`_uN((((2 ^ 7) * m) + (((n : nat <:> int) - ((2 ^ 7) : nat <:> int)) : int <:> nat))) - -- if ((n >= (2 ^ 7)) /\ (N > 7)) -} - -;; A-binary.watsup -grammar Bu32 : u32 - ;; A-binary.watsup - prod{n : n} `%`_uN(n):BuN(32) => `%`_u32(n) - -;; A-binary.watsup -grammar Blist(syntax el, grammar BX : el) : el* - ;; A-binary.watsup - prod{n : n, `el*` : el*} {`%`_u32(n):Bu32 el:BX^n{el <- `el*`}} => el^n{el <- `el*`} - -;; A-binary.watsup -grammar BsN(N : N) : sN(N) - ;; A-binary.watsup - prod{n : n} `%`_byte(n):Bbyte => `%`_sN((n : nat <:> int)) - -- if ((n < (2 ^ 6)) /\ (n < (2 ^ (((N : nat <:> int) - (1 : nat <:> int)) : int <:> nat)))) - ;; A-binary.watsup - prod{n : n} `%`_byte(n):Bbyte => `%`_sN(((n : nat <:> int) - ((2 ^ 7) : nat <:> int))) - -- if ((((2 ^ 6) <= n) /\ (n < (2 ^ 7))) /\ ((n : nat <:> int) >= (((2 ^ 7) : nat <:> int) - ((2 ^ (((N : nat <:> int) - (1 : nat <:> int)) : int <:> nat)) : nat <:> int)))) - ;; A-binary.watsup - prod{n : n, i : uN((((N : nat <:> int) - (7 : nat <:> int)) : int <:> nat))} {`%`_byte(n):Bbyte i:BuN((((N : nat <:> int) - (7 : nat <:> int)) : int <:> nat))} => `%`_sN(((((2 ^ 7) * i!`%`_uN.0) + (((n : nat <:> int) - ((2 ^ 7) : nat <:> int)) : int <:> nat)) : nat <:> int)) - -- if ((n >= (2 ^ 7)) /\ (N > 7)) - -;; A-binary.watsup -grammar BiN(N : N) : iN(N) - ;; A-binary.watsup - prod{i : sN(N)} i:BsN(N) => `%`_iN($invsigned_(N, i!`%`_sN.0)) - -;; A-binary.watsup -grammar BfN(N : N) : fN(N) - ;; A-binary.watsup - prod{`b*` : byte*} b*{b <- `b*`}:Bbyte^(((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat){} => $invfbytes_(N, b*{b <- `b*`}) - -;; A-binary.watsup -grammar Bu64 : u64 - ;; A-binary.watsup - prod{n : n} `%`_uN(n):BuN(64) => `%`_u64(n) - -;; A-binary.watsup -grammar Bs33 : s33 - ;; A-binary.watsup - prod{i : sN(33)} i:BsN(33) => i - -;; A-binary.watsup -grammar Bf32 : f32 - ;; A-binary.watsup - prod{p : fN(32)} p:BfN(32) => p - -;; A-binary.watsup -grammar Bf64 : f64 - ;; A-binary.watsup - prod{p : fN(64)} p:BfN(64) => p - -;; A-binary.watsup -grammar Bname : name - ;; A-binary.watsup - prod{`b*` : byte*, name : name} b*{b <- `b*`}:Blist(syntax byte, grammar Bbyte) => name - -- if ($utf8(name!`%`_name.0) = b*{b <- `b*`}) - -;; A-binary.watsup -grammar Btypeidx : typeidx - ;; A-binary.watsup - prod{x : idx} x:Bu32 => x - -;; A-binary.watsup -grammar Bfuncidx : funcidx - ;; A-binary.watsup - prod{x : idx} x:Bu32 => x - -;; A-binary.watsup -grammar Bglobalidx : globalidx - ;; A-binary.watsup - prod{x : idx} x:Bu32 => x - -;; A-binary.watsup -grammar Btableidx : tableidx - ;; A-binary.watsup - prod{x : idx} x:Bu32 => x - -;; A-binary.watsup -grammar Bmemidx : memidx - ;; A-binary.watsup - prod{x : idx} x:Bu32 => x - -;; A-binary.watsup -grammar Btagidx : tagidx - ;; A-binary.watsup - prod{x : idx} x:Bu32 => x - -;; A-binary.watsup -grammar Belemidx : elemidx - ;; A-binary.watsup - prod{x : idx} x:Bu32 => x - -;; A-binary.watsup -grammar Bdataidx : dataidx - ;; A-binary.watsup - prod{x : idx} x:Bu32 => x - -;; A-binary.watsup -grammar Blocalidx : localidx - ;; A-binary.watsup - prod{x : idx} x:Bu32 => x - -;; A-binary.watsup -grammar Blabelidx : labelidx - ;; A-binary.watsup - prod{l : labelidx} l:Bu32 => l - -;; A-binary.watsup -grammar Bexternidx : externidx - ;; A-binary.watsup - prod{x : idx} {0x00 x:Bfuncidx} => FUNC_externidx(x) - ;; A-binary.watsup - prod{x : idx} {0x01 x:Btableidx} => TABLE_externidx(x) - ;; A-binary.watsup - prod{x : idx} {0x02 x:Bmemidx} => MEM_externidx(x) - ;; A-binary.watsup - prod{x : idx} {0x03 x:Bglobalidx} => GLOBAL_externidx(x) - ;; A-binary.watsup - prod{x : idx} {0x04 x:Btagidx} => TAG_externidx(x) - -;; A-binary.watsup -grammar Bnumtype : numtype - ;; A-binary.watsup - prod 0x7C => F64_numtype - ;; A-binary.watsup - prod 0x7D => F32_numtype - ;; A-binary.watsup - prod 0x7E => I64_numtype - ;; A-binary.watsup - prod 0x7F => I32_numtype - -;; A-binary.watsup -grammar Bvectype : vectype - ;; A-binary.watsup - prod 0x7B => V128_vectype - -;; A-binary.watsup -grammar Babsheaptype : heaptype - ;; A-binary.watsup - prod 0x69 => EXN_heaptype - ;; A-binary.watsup - prod 0x6A => ARRAY_heaptype - ;; A-binary.watsup - prod 0x6B => STRUCT_heaptype - ;; A-binary.watsup - prod 0x6C => I31_heaptype - ;; A-binary.watsup - prod 0x6D => EQ_heaptype - ;; A-binary.watsup - prod 0x6E => ANY_heaptype - ;; A-binary.watsup - prod 0x6F => EXTERN_heaptype - ;; A-binary.watsup - prod 0x70 => FUNC_heaptype - ;; A-binary.watsup - prod 0x71 => NONE_heaptype - ;; A-binary.watsup - prod 0x72 => NOEXTERN_heaptype - ;; A-binary.watsup - prod 0x73 => NOFUNC_heaptype - ;; A-binary.watsup - prod 0x74 => NOEXN_heaptype - -;; A-binary.watsup -grammar Bheaptype : heaptype - ;; A-binary.watsup - prod{ht : heaptype} ht:Babsheaptype => ht - ;; A-binary.watsup - prod{x33 : s33} x33:Bs33 => _IDX_heaptype($s33_to_u32(x33)) - -- if (x33!`%`_s33.0 >= (0 : nat <:> int)) - -;; A-binary.watsup -grammar Breftype : reftype - ;; A-binary.watsup - prod{ht : heaptype} {0x63 ht:Bheaptype} => REF_reftype(`NULL%?`_nul(?(())), ht) - ;; A-binary.watsup - prod{ht : heaptype} {0x64 ht:Bheaptype} => REF_reftype(`NULL%?`_nul(?()), ht) - ;; A-binary.watsup - prod{ht : heaptype} ht:Babsheaptype => REF_reftype(`NULL%?`_nul(?(())), ht) - -;; A-binary.watsup -grammar Bvaltype : valtype - ;; A-binary.watsup - prod{nt : numtype} nt:Bnumtype => (nt : numtype <: valtype) - ;; A-binary.watsup - prod{vt : vectype} vt:Bvectype => (vt : vectype <: valtype) - ;; A-binary.watsup - prod{rt : reftype} rt:Breftype => (rt : reftype <: valtype) - -;; A-binary.watsup -grammar Bresulttype : resulttype - ;; A-binary.watsup - prod{`t*` : valtype*} t*{t <- `t*`}:Blist(syntax valtype, grammar Bvaltype) => `%`_resulttype(t*{t <- `t*`}) - -;; A-binary.watsup -grammar Bmut : mut - ;; A-binary.watsup - prod 0x00 => `MUT%?`_mut(?()) - ;; A-binary.watsup - prod 0x01 => `MUT%?`_mut(?(())) - -;; A-binary.watsup -grammar Bpacktype : packtype - ;; A-binary.watsup - prod 0x77 => I16_packtype - ;; A-binary.watsup - prod 0x78 => I8_packtype - -;; A-binary.watsup -grammar Bstoragetype : storagetype - ;; A-binary.watsup - prod{t : valtype} t:Bvaltype => (t : valtype <: storagetype) - ;; A-binary.watsup - prod{pt : packtype} pt:Bpacktype => (pt : packtype <: storagetype) - -;; A-binary.watsup -grammar Bfieldtype : fieldtype - ;; A-binary.watsup - prod{zt : storagetype, mut : mut} {zt:Bstoragetype mut:Bmut} => `%%`_fieldtype(mut, zt) - -;; A-binary.watsup -grammar Bcomptype : comptype - ;; A-binary.watsup - prod{yt : fieldtype} {0x5E yt:Bfieldtype} => ARRAY_comptype(yt) - ;; A-binary.watsup - prod{`yt*` : fieldtype*} {0x5F yt*{yt <- `yt*`}:Blist(syntax fieldtype, grammar Bfieldtype)} => STRUCT_comptype(`%`_structtype(yt*{yt <- `yt*`})) - ;; A-binary.watsup - prod{`t_1*` : valtype*, `t_2*` : valtype*} {0x60 `%`_resulttype(t_1*{t_1 <- `t_1*`}):Bresulttype `%`_resulttype(t_2*{t_2 <- `t_2*`}):Bresulttype} => FUNC_comptype(`%->%`_functype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`}))) - -;; A-binary.watsup -grammar Bsubtype : subtype - ;; A-binary.watsup - prod{`x*` : idx*, ct : comptype} {0x4F x*{x <- `x*`}:Blist(syntax typeidx, grammar Btypeidx) ct:Bcomptype} => SUB_subtype(`FINAL%?`_fin(?(())), _IDX_typeuse(x)*{x <- `x*`}, ct) - ;; A-binary.watsup - prod{`x*` : idx*, ct : comptype} {0x50 x*{x <- `x*`}:Blist(syntax typeidx, grammar Btypeidx) ct:Bcomptype} => SUB_subtype(`FINAL%?`_fin(?()), _IDX_typeuse(x)*{x <- `x*`}, ct) - ;; A-binary.watsup - prod{ct : comptype} ct:Bcomptype => SUB_subtype(`FINAL%?`_fin(?(())), [], ct) - -;; A-binary.watsup -grammar Brectype : rectype - ;; A-binary.watsup - prod{`st*` : subtype*} {0x4E st*{st <- `st*`}:Blist(syntax subtype, grammar Bsubtype)} => REC_rectype(`%`_list(st*{st <- `st*`})) - ;; A-binary.watsup - prod{st : subtype} st:Bsubtype => REC_rectype(`%`_list([st])) - -;; A-binary.watsup -grammar Blimits : (addrtype, limits) - ;; A-binary.watsup - prod{n : n} {0x00 `%`_u64(n):Bu64} => (I32_addrtype, `[%..%]`_limits(`%`_u64(n), `%`_u64(((((2 ^ 64) : nat <:> int) - (1 : nat <:> int)) : int <:> nat)))) - ;; A-binary.watsup - prod{n : n, m : m} {0x01 `%`_u64(n):Bu64 `%`_u64(m):Bu64} => (I64_addrtype, `[%..%]`_limits(`%`_u64(n), `%`_u64(m))) - ;; A-binary.watsup - prod{n : n} {0x04 `%`_u64(n):Bu64} => (I32_addrtype, `[%..%]`_limits(`%`_u64(n), `%`_u64(((((2 ^ 64) : nat <:> int) - (1 : nat <:> int)) : int <:> nat)))) - ;; A-binary.watsup - prod{n : n, m : m} {0x05 `%`_u64(n):Bu64 `%`_u64(m):Bu64} => (I64_addrtype, `[%..%]`_limits(`%`_u64(n), `%`_u64(m))) - -;; A-binary.watsup -grammar Bglobaltype : globaltype - ;; A-binary.watsup - prod{t : valtype, mut : mut} {t:Bvaltype mut:Bmut} => `%%`_globaltype(mut, t) - -;; A-binary.watsup -grammar Btabletype : tabletype - ;; A-binary.watsup - prod{rt : reftype, at : addrtype, lim : limits} {rt:Breftype (at, lim):Blimits} => `%%%`_tabletype(at, lim, rt) - -;; A-binary.watsup -grammar Bmemtype : memtype - ;; A-binary.watsup - prod{at : addrtype, lim : limits} (at, lim):Blimits => `%%PAGE`_memtype(at, lim) - -;; A-binary.watsup -grammar Btagtype : typeidx - ;; A-binary.watsup - prod{x : idx} {0x00 x:Btypeidx} => x - -;; A-binary.watsup -grammar Bexterntype : externtype - ;; A-binary.watsup - prod{x : idx} {0x00 x:Btypeidx} => FUNC_externtype(_IDX_typeuse(x)) - ;; A-binary.watsup - prod{tt : tabletype} {0x01 tt:Btabletype} => TABLE_externtype(tt) - ;; A-binary.watsup - prod{mt : memtype} {0x02 mt:Bmemtype} => MEM_externtype(mt) - ;; A-binary.watsup - prod{gt : globaltype} {0x03 gt:Bglobaltype} => GLOBAL_externtype(gt) - ;; A-binary.watsup - prod{x : idx} {0x04 x:Btagtype} => TAG_externtype(_IDX_typeuse(x)) - -;; A-binary.watsup -grammar Bblocktype : blocktype - ;; A-binary.watsup - prod 0x40 => _RESULT_blocktype(?()) - ;; A-binary.watsup - prod{t : valtype} t:Bvaltype => _RESULT_blocktype(?(t)) - ;; A-binary.watsup - prod{i : s33} i:Bs33 => _IDX_blocktype(`%`_funcidx((i!`%`_s33.0 : int <:> nat))) - -- if (i!`%`_s33.0 >= (0 : nat <:> int)) - -;; A-binary.watsup -grammar Bcatch : catch - ;; A-binary.watsup - prod{x : idx, l : labelidx} {0x00 x:Btagidx l:Blabelidx} => CATCH_catch(x, l) - ;; A-binary.watsup - prod{x : idx, l : labelidx} {0x01 x:Btagidx l:Blabelidx} => CATCH_REF_catch(x, l) - ;; A-binary.watsup - prod{l : labelidx} {0x02 l:Blabelidx} => CATCH_ALL_catch(l) - ;; A-binary.watsup - prod{l : labelidx} {0x03 l:Blabelidx} => CATCH_ALL_REF_catch(l) - -;; A-binary.watsup -syntax castop = (nul, nul) - -;; A-binary.watsup -grammar Bcastop : castop - ;; A-binary.watsup - prod 0x00 => (`NULL%?`_nul(?()), `NULL%?`_nul(?())) - ;; A-binary.watsup - prod 0x01 => (`NULL%?`_nul(?(())), `NULL%?`_nul(?())) - ;; A-binary.watsup - prod 0x02 => (`NULL%?`_nul(?()), `NULL%?`_nul(?(()))) - ;; A-binary.watsup - prod 0x03 => (`NULL%?`_nul(?(())), `NULL%?`_nul(?(()))) - -;; A-binary.watsup -syntax memidxop = (memidx, memarg) - -;; A-binary.watsup -grammar Bmemarg : memidxop - ;; A-binary.watsup - prod{n : n, m : m} {`%`_u32(n):Bu32 `%`_u32(m):Bu32} => (`%`_memidx(0), {ALIGN `%`_u32(n), OFFSET `%`_u32(m)}) - -- if (n < (2 ^ 6)) - ;; A-binary.watsup - prod{n : n, x : idx, m : m} {`%`_u32(n):Bu32 x:Bmemidx `%`_u32(m):Bu32} => (x, {ALIGN `%`_u32((((n : nat <:> int) - ((2 ^ 6) : nat <:> int)) : int <:> nat)), OFFSET `%`_u32(m)}) - -- if (((2 ^ 6) <= n) /\ (n < (2 ^ 7))) - -;; A-binary.watsup -grammar Blaneidx : laneidx - ;; A-binary.watsup - prod{l : labelidx} `%`_byte(l!`%`_labelidx.0):Bbyte => `%`_laneidx(l!`%`_labelidx.0) - -;; A-binary.watsup -rec { - -;; A-binary.watsup:994.1-1008.73 -grammar Binstr : instr - ;; A-binary.watsup:216.5-216.24 - prod 0x00 => UNREACHABLE_instr - ;; A-binary.watsup:217.5-217.16 - prod 0x01 => NOP_instr - ;; A-binary.watsup:218.5-218.57 - prod{bt : blocktype, `in*` : instr*} {0x02 bt:Bblocktype in:Binstr*{in <- `in*`} 0x0B} => BLOCK_instr(bt, in*{in <- `in*`}) - ;; A-binary.watsup:219.5-219.56 - prod{bt : blocktype, `in*` : instr*} {0x03 bt:Bblocktype in:Binstr*{in <- `in*`} 0x0B} => LOOP_instr(bt, in*{in <- `in*`}) - ;; A-binary.watsup:220.5-220.63 - prod{bt : blocktype, `in*` : instr*} {0x04 bt:Bblocktype in:Binstr*{in <- `in*`} 0x0B} => `IF%%ELSE%`_instr(bt, in*{in <- `in*`}, []) - ;; A-binary.watsup:221.5-222.55 - prod{bt : blocktype, `in_1*` : instr*, `in_2*` : instr*} {0x04 bt:Bblocktype in_1:Binstr*{in_1 <- `in_1*`} 0x05 in_2:Binstr*{in_2 <- `in_2*`} 0x0B} => `IF%%ELSE%`_instr(bt, in_1*{in_1 <- `in_1*`}, in_2*{in_2 <- `in_2*`}) - ;; A-binary.watsup:223.5-223.30 - prod{x : idx} {0x08 x:Btagidx} => THROW_instr(x) - ;; A-binary.watsup:224.5-224.22 - prod 0x0A => THROW_REF_instr - ;; A-binary.watsup:225.5-225.29 - prod{l : labelidx} {0x0C l:Blabelidx} => BR_instr(l) - ;; A-binary.watsup:226.5-226.32 - prod{l : labelidx} {0x0D l:Blabelidx} => BR_IF_instr(l) - ;; A-binary.watsup:227.5-227.62 - prod{`l*` : labelidx*, l_n : labelidx} {0x0E l*{l <- `l*`}:Blist(syntax labelidx, grammar Blabelidx) l_n:Blabelidx} => BR_TABLE_instr(l*{l <- `l*`}, l_n) - ;; A-binary.watsup:228.5-228.19 - prod 0x0F => RETURN_instr - ;; A-binary.watsup:229.5-229.30 - prod{x : idx} {0x10 x:Bfuncidx} => CALL_instr(x) - ;; A-binary.watsup:230.5-230.60 - prod{y : idx, x : idx} {0x11 y:Btypeidx x:Btableidx} => CALL_INDIRECT_instr(x, _IDX_typeuse(y)) - ;; A-binary.watsup:231.5-231.37 - prod{x : idx} {0x12 x:Bfuncidx} => RETURN_CALL_instr(x) - ;; A-binary.watsup:232.5-232.67 - prod{y : idx, x : idx} {0x13 y:Btypeidx x:Btableidx} => RETURN_CALL_INDIRECT_instr(x, _IDX_typeuse(y)) - ;; A-binary.watsup:233.5-233.81 - prod{bt : blocktype, `c*` : catch*, `in*` : instr*} {0x1F bt:Bblocktype c*{c <- `c*`}:Blist(syntax catch, grammar Bcatch) in:Binstr*{in <- `in*`} 0x0B} => TRY_TABLE_instr(bt, `%`_list(c*{c <- `c*`}), in*{in <- `in*`}) - ;; A-binary.watsup:254.5-254.37 - prod{ht : heaptype} {0xD0 ht:Bheaptype} => REF.NULL_instr(ht) - ;; A-binary.watsup:255.5-255.24 - prod 0xD1 => REF.IS_NULL_instr - ;; A-binary.watsup:256.5-256.34 - prod{x : idx} {0xD2 x:Bfuncidx} => REF.FUNC_instr(x) - ;; A-binary.watsup:257.5-257.19 - prod 0xD3 => REF.EQ_instr - ;; A-binary.watsup:258.5-258.28 - prod 0xD4 => REF.AS_NON_NULL_instr - ;; A-binary.watsup:259.5-259.37 - prod{l : labelidx} {0xD5 l:Blabelidx} => BR_ON_NULL_instr(l) - ;; A-binary.watsup:260.5-260.41 - prod{l : labelidx} {0xD6 l:Blabelidx} => BR_ON_NON_NULL_instr(l) - ;; A-binary.watsup:264.5-264.43 - prod{x : idx} {0xFB `%`_u32(0):Bu32 x:Btypeidx} => STRUCT.NEW_instr(x) - ;; A-binary.watsup:265.5-265.51 - prod{x : idx} {0xFB `%`_u32(1):Bu32 x:Btypeidx} => STRUCT.NEW_DEFAULT_instr(x) - ;; A-binary.watsup:266.5-266.52 - prod{x : idx, i : u32} {0xFB `%`_u32(2):Bu32 x:Btypeidx i:Bu32} => STRUCT.GET_instr(?(), x, i) - ;; A-binary.watsup:267.5-267.54 - prod{x : idx, i : u32} {0xFB `%`_u32(3):Bu32 x:Btypeidx i:Bu32} => STRUCT.GET_instr(?(S_sx), x, i) - ;; A-binary.watsup:268.5-268.54 - prod{x : idx, i : u32} {0xFB `%`_u32(4):Bu32 x:Btypeidx i:Bu32} => STRUCT.GET_instr(?(U_sx), x, i) - ;; A-binary.watsup:269.5-269.52 - prod{x : idx, i : u32} {0xFB `%`_u32(5):Bu32 x:Btypeidx i:Bu32} => STRUCT.SET_instr(x, i) - ;; A-binary.watsup:273.5-273.42 - prod{x : idx} {0xFB `%`_u32(6):Bu32 x:Btypeidx} => ARRAY.NEW_instr(x) - ;; A-binary.watsup:274.5-274.50 - prod{x : idx} {0xFB `%`_u32(7):Bu32 x:Btypeidx} => ARRAY.NEW_DEFAULT_instr(x) - ;; A-binary.watsup:275.5-275.57 - prod{x : idx, n : n} {0xFB `%`_u32(8):Bu32 x:Btypeidx `%`_u32(n):Bu32} => ARRAY.NEW_FIXED_instr(x, `%`_u32(n)) - ;; A-binary.watsup:276.5-276.60 - prod{x : idx, y : idx} {0xFB `%`_u32(9):Bu32 x:Btypeidx y:Bdataidx} => ARRAY.NEW_DATA_instr(x, y) - ;; A-binary.watsup:277.5-277.61 - prod{x : idx, y : idx} {0xFB `%`_u32(10):Bu32 x:Btypeidx y:Belemidx} => ARRAY.NEW_ELEM_instr(x, y) - ;; A-binary.watsup:278.5-278.43 - prod{x : idx} {0xFB `%`_u32(11):Bu32 x:Btypeidx} => ARRAY.GET_instr(?(), x) - ;; A-binary.watsup:279.5-279.45 - prod{x : idx} {0xFB `%`_u32(12):Bu32 x:Btypeidx} => ARRAY.GET_instr(?(S_sx), x) - ;; A-binary.watsup:280.5-280.45 - prod{x : idx} {0xFB `%`_u32(13):Bu32 x:Btypeidx} => ARRAY.GET_instr(?(U_sx), x) - ;; A-binary.watsup:281.5-281.43 - prod{x : idx} {0xFB `%`_u32(14):Bu32 x:Btypeidx} => ARRAY.SET_instr(x) - ;; A-binary.watsup:282.5-282.30 - prod {0xFB `%`_u32(15):Bu32} => ARRAY.LEN_instr - ;; A-binary.watsup:283.5-283.44 - prod{x : idx} {0xFB `%`_u32(16):Bu32 x:Btypeidx} => ARRAY.FILL_instr(x) - ;; A-binary.watsup:284.5-284.65 - prod{x_1 : idx, x_2 : idx} {0xFB `%`_u32(17):Bu32 x_1:Btypeidx x_2:Btypeidx} => ARRAY.COPY_instr(x_1, x_2) - ;; A-binary.watsup:285.5-285.62 - prod{x : idx, y : idx} {0xFB `%`_u32(18):Bu32 x:Btypeidx y:Bdataidx} => ARRAY.INIT_DATA_instr(x, y) - ;; A-binary.watsup:286.5-286.62 - prod{x : idx, y : idx} {0xFB `%`_u32(19):Bu32 x:Btypeidx y:Belemidx} => ARRAY.INIT_ELEM_instr(x, y) - ;; A-binary.watsup:290.5-290.51 - prod{ht : heaptype} {0xFB `%`_u32(20):Bu32 ht:Bheaptype} => REF.TEST_instr(REF_reftype(`NULL%?`_nul(?()), ht)) - ;; A-binary.watsup:291.5-291.56 - prod{ht : heaptype} {0xFB `%`_u32(21):Bu32 ht:Bheaptype} => REF.TEST_instr(REF_reftype(`NULL%?`_nul(?(())), ht)) - ;; A-binary.watsup:292.5-292.51 - prod{ht : heaptype} {0xFB `%`_u32(22):Bu32 ht:Bheaptype} => REF.CAST_instr(REF_reftype(`NULL%?`_nul(?()), ht)) - ;; A-binary.watsup:293.5-293.56 - prod{ht : heaptype} {0xFB `%`_u32(23):Bu32 ht:Bheaptype} => REF.CAST_instr(REF_reftype(`NULL%?`_nul(?(())), ht)) - ;; A-binary.watsup:294.5-295.94 - prod{nul1 : nul1, nul2 : nul2, l : labelidx, ht_1 : heaptype, ht_2 : heaptype} {0xFB `%`_u32(24):Bu32 (nul1, nul2):Bcastop l:Blabelidx ht_1:Bheaptype ht_2:Bheaptype} => BR_ON_CAST_instr(l, REF_reftype(nul1, ht_1), REF_reftype(nul2, ht_2)) - ;; A-binary.watsup:296.5-297.99 - prod{nul1 : nul1, nul2 : nul2, l : labelidx, ht_1 : heaptype, ht_2 : heaptype} {0xFB `%`_u32(25):Bu32 (nul1, nul2):Bcastop l:Blabelidx ht_1:Bheaptype ht_2:Bheaptype} => BR_ON_CAST_FAIL_instr(l, REF_reftype(nul1, ht_1), REF_reftype(nul2, ht_2)) - ;; A-binary.watsup:301.5-301.39 - prod {0xFB `%`_u32(26):Bu32} => ANY.CONVERT_EXTERN_instr - ;; A-binary.watsup:302.5-302.39 - prod {0xFB `%`_u32(27):Bu32} => EXTERN.CONVERT_ANY_instr - ;; A-binary.watsup:306.5-306.28 - prod {0xFB `%`_u32(28):Bu32} => REF.I31_instr - ;; A-binary.watsup:307.5-307.30 - prod {0xFB `%`_u32(29):Bu32} => I31.GET_instr(S_sx) - ;; A-binary.watsup:308.5-308.30 - prod {0xFB `%`_u32(30):Bu32} => I31.GET_instr(U_sx) - ;; A-binary.watsup:315.5-315.17 - prod 0x1A => DROP_instr - ;; A-binary.watsup:316.5-316.19 - prod 0x1B => `SELECT()%?`_instr(?()) - ;; A-binary.watsup:317.5-317.41 - prod{ts : valtype} {0x1C [ts]:Blist(syntax valtype, grammar Bvaltype)} => `SELECT()%?`_instr(?([ts])) - ;; A-binary.watsup:324.5-324.36 - prod{x : idx} {0x20 x:Blocalidx} => LOCAL.GET_instr(x) - ;; A-binary.watsup:325.5-325.36 - prod{x : idx} {0x21 x:Blocalidx} => LOCAL.SET_instr(x) - ;; A-binary.watsup:326.5-326.36 - prod{x : idx} {0x22 x:Blocalidx} => LOCAL.TEE_instr(x) - ;; A-binary.watsup:330.5-330.38 - prod{x : idx} {0x23 x:Bglobalidx} => GLOBAL.GET_instr(x) - ;; A-binary.watsup:331.5-331.38 - prod{x : idx} {0x24 x:Bglobalidx} => GLOBAL.SET_instr(x) - ;; A-binary.watsup:338.5-338.36 - prod{x : idx} {0x25 x:Btableidx} => TABLE.GET_instr(x) - ;; A-binary.watsup:339.5-339.36 - prod{x : idx} {0x26 x:Btableidx} => TABLE.SET_instr(x) - ;; A-binary.watsup:340.5-340.58 - prod{y : idx, x : idx} {0xFC `%`_u32(12):Bu32 y:Belemidx x:Btableidx} => TABLE.INIT_instr(x, y) - ;; A-binary.watsup:341.5-341.43 - prod{x : idx} {0xFC `%`_u32(13):Bu32 x:Belemidx} => ELEM.DROP_instr(x) - ;; A-binary.watsup:342.5-342.67 - prod{x_1 : idx, x_2 : idx} {0xFC `%`_u32(14):Bu32 x_1:Btableidx x_2:Btableidx} => TABLE.COPY_instr(x_1, x_2) - ;; A-binary.watsup:343.5-343.45 - prod{x : idx} {0xFC `%`_u32(15):Bu32 x:Btableidx} => TABLE.GROW_instr(x) - ;; A-binary.watsup:344.5-344.45 - prod{x : idx} {0xFC `%`_u32(16):Bu32 x:Btableidx} => TABLE.SIZE_instr(x) - ;; A-binary.watsup:345.5-345.45 - prod{x : idx} {0xFC `%`_u32(17):Bu32 x:Btableidx} => TABLE.FILL_instr(x) - ;; A-binary.watsup:358.5-358.41 - prod{x : idx, ao : memarg} {0x28 (x, ao):Bmemarg} => LOAD_instr(I32_numtype, ?(), x, ao) - ;; A-binary.watsup:359.5-359.41 - prod{x : idx, ao : memarg} {0x29 (x, ao):Bmemarg} => LOAD_instr(I64_numtype, ?(), x, ao) - ;; A-binary.watsup:360.5-360.41 - prod{x : idx, ao : memarg} {0x2A (x, ao):Bmemarg} => LOAD_instr(F32_numtype, ?(), x, ao) - ;; A-binary.watsup:361.5-361.41 - prod{x : idx, ao : memarg} {0x2B (x, ao):Bmemarg} => LOAD_instr(F64_numtype, ?(), x, ao) - ;; A-binary.watsup:362.5-362.48 - prod{x : idx, ao : memarg} {0x2C (x, ao):Bmemarg} => LOAD_instr(I32_numtype, ?(`%%`_loadop_(`%`_sz(8), S_sx)), x, ao) - ;; A-binary.watsup:363.5-363.48 - prod{x : idx, ao : memarg} {0x2D (x, ao):Bmemarg} => LOAD_instr(I32_numtype, ?(`%%`_loadop_(`%`_sz(8), U_sx)), x, ao) - ;; A-binary.watsup:364.5-364.49 - prod{x : idx, ao : memarg} {0x2E (x, ao):Bmemarg} => LOAD_instr(I32_numtype, ?(`%%`_loadop_(`%`_sz(16), S_sx)), x, ao) - ;; A-binary.watsup:365.5-365.49 - prod{x : idx, ao : memarg} {0x2F (x, ao):Bmemarg} => LOAD_instr(I32_numtype, ?(`%%`_loadop_(`%`_sz(16), U_sx)), x, ao) - ;; A-binary.watsup:366.5-366.48 - prod{x : idx, ao : memarg} {0x30 (x, ao):Bmemarg} => LOAD_instr(I64_numtype, ?(`%%`_loadop_(`%`_sz(8), S_sx)), x, ao) - ;; A-binary.watsup:367.5-367.48 - prod{x : idx, ao : memarg} {0x31 (x, ao):Bmemarg} => LOAD_instr(I64_numtype, ?(`%%`_loadop_(`%`_sz(8), U_sx)), x, ao) - ;; A-binary.watsup:368.5-368.49 - prod{x : idx, ao : memarg} {0x32 (x, ao):Bmemarg} => LOAD_instr(I64_numtype, ?(`%%`_loadop_(`%`_sz(16), S_sx)), x, ao) - ;; A-binary.watsup:369.5-369.49 - prod{x : idx, ao : memarg} {0x33 (x, ao):Bmemarg} => LOAD_instr(I64_numtype, ?(`%%`_loadop_(`%`_sz(16), U_sx)), x, ao) - ;; A-binary.watsup:370.5-370.49 - prod{x : idx, ao : memarg} {0x34 (x, ao):Bmemarg} => LOAD_instr(I64_numtype, ?(`%%`_loadop_(`%`_sz(32), S_sx)), x, ao) - ;; A-binary.watsup:371.5-371.49 - prod{x : idx, ao : memarg} {0x35 (x, ao):Bmemarg} => LOAD_instr(I64_numtype, ?(`%%`_loadop_(`%`_sz(32), U_sx)), x, ao) - ;; A-binary.watsup:372.5-372.42 - prod{x : idx, ao : memarg} {0x36 (x, ao):Bmemarg} => STORE_instr(I32_numtype, ?(), x, ao) - ;; A-binary.watsup:373.5-373.42 - prod{x : idx, ao : memarg} {0x37 (x, ao):Bmemarg} => STORE_instr(I64_numtype, ?(), x, ao) - ;; A-binary.watsup:374.5-374.42 - prod{x : idx, ao : memarg} {0x38 (x, ao):Bmemarg} => STORE_instr(F32_numtype, ?(), x, ao) - ;; A-binary.watsup:375.5-375.42 - prod{x : idx, ao : memarg} {0x39 (x, ao):Bmemarg} => STORE_instr(F64_numtype, ?(), x, ao) - ;; A-binary.watsup:376.5-376.45 - prod{x : idx, ao : memarg} {0x3A (x, ao):Bmemarg} => STORE_instr(I32_numtype, ?(`%`_storeop_(`%`_sz(8))), x, ao) - ;; A-binary.watsup:377.5-377.46 - prod{x : idx, ao : memarg} {0x3B (x, ao):Bmemarg} => STORE_instr(I32_numtype, ?(`%`_storeop_(`%`_sz(16))), x, ao) - ;; A-binary.watsup:378.5-378.45 - prod{x : idx, ao : memarg} {0x3C (x, ao):Bmemarg} => STORE_instr(I64_numtype, ?(`%`_storeop_(`%`_sz(8))), x, ao) - ;; A-binary.watsup:379.5-379.46 - prod{x : idx, ao : memarg} {0x3D (x, ao):Bmemarg} => STORE_instr(I64_numtype, ?(`%`_storeop_(`%`_sz(16))), x, ao) - ;; A-binary.watsup:380.5-380.46 - prod{x : idx, ao : memarg} {0x3E (x, ao):Bmemarg} => STORE_instr(I64_numtype, ?(`%`_storeop_(`%`_sz(32))), x, ao) - ;; A-binary.watsup:381.5-381.36 - prod{x : idx} {0x3F x:Bmemidx} => MEMORY.SIZE_instr(x) - ;; A-binary.watsup:382.5-382.36 - prod{x : idx} {0x40 x:Bmemidx} => MEMORY.GROW_instr(x) - ;; A-binary.watsup:383.5-383.56 - prod{y : idx, x : idx} {0xFC `%`_u32(8):Bu32 y:Bdataidx x:Bmemidx} => MEMORY.INIT_instr(x, y) - ;; A-binary.watsup:384.5-384.42 - prod{x : idx} {0xFC `%`_u32(9):Bu32 x:Bdataidx} => DATA.DROP_instr(x) - ;; A-binary.watsup:385.5-385.64 - prod{x_1 : idx, x_2 : idx} {0xFC `%`_u32(10):Bu32 x_1:Bmemidx x_2:Bmemidx} => MEMORY.COPY_instr(x_1, x_2) - ;; A-binary.watsup:386.5-386.44 - prod{x : idx} {0xFC `%`_u32(11):Bu32 x:Bmemidx} => MEMORY.FILL_instr(x) - ;; A-binary.watsup:394.5-394.31 - prod{n : n} {0x41 `%`_u32(n):Bu32} => CONST_instr(I32_numtype, `%`_num_(n)) - ;; A-binary.watsup:395.5-395.31 - prod{n : n} {0x42 `%`_u64(n):Bu64} => CONST_instr(I64_numtype, `%`_num_(n)) - ;; A-binary.watsup:396.5-396.31 - prod{p : f32} {0x43 p:Bf32} => CONST_instr(F32_numtype, p) - ;; A-binary.watsup:397.5-397.31 - prod{p : f64} {0x44 p:Bf64} => CONST_instr(F64_numtype, p) - ;; A-binary.watsup:401.5-401.27 - prod 0x45 => TESTOP_instr(I32_numtype, EQZ_testop_) - ;; A-binary.watsup:405.5-405.25 - prod 0x46 => RELOP_instr(I32_numtype, EQ_relop_) - ;; A-binary.watsup:406.5-406.25 - prod 0x47 => RELOP_instr(I32_numtype, NE_relop_) - ;; A-binary.watsup:407.5-407.29 - prod 0x48 => RELOP_instr(I32_numtype, LT_relop_(S_sx)) - ;; A-binary.watsup:408.5-408.29 - prod 0x49 => RELOP_instr(I32_numtype, LT_relop_(U_sx)) - ;; A-binary.watsup:409.5-409.29 - prod 0x4A => RELOP_instr(I32_numtype, GT_relop_(S_sx)) - ;; A-binary.watsup:410.5-410.29 - prod 0x4B => RELOP_instr(I32_numtype, GT_relop_(U_sx)) - ;; A-binary.watsup:411.5-411.29 - prod 0x4C => RELOP_instr(I32_numtype, LE_relop_(S_sx)) - ;; A-binary.watsup:412.5-412.29 - prod 0x4D => RELOP_instr(I32_numtype, LE_relop_(U_sx)) - ;; A-binary.watsup:413.5-413.29 - prod 0x4E => RELOP_instr(I32_numtype, GE_relop_(S_sx)) - ;; A-binary.watsup:414.5-414.29 - prod 0x4F => RELOP_instr(I32_numtype, GE_relop_(U_sx)) - ;; A-binary.watsup:418.5-418.27 - prod 0x50 => TESTOP_instr(I64_numtype, EQZ_testop_) - ;; A-binary.watsup:422.5-422.25 - prod 0x51 => RELOP_instr(I64_numtype, EQ_relop_) - ;; A-binary.watsup:423.5-423.25 - prod 0x52 => RELOP_instr(I64_numtype, NE_relop_) - ;; A-binary.watsup:424.5-424.29 - prod 0x53 => RELOP_instr(I64_numtype, LT_relop_(S_sx)) - ;; A-binary.watsup:425.5-425.29 - prod 0x54 => RELOP_instr(I64_numtype, LT_relop_(U_sx)) - ;; A-binary.watsup:426.5-426.29 - prod 0x55 => RELOP_instr(I64_numtype, GT_relop_(S_sx)) - ;; A-binary.watsup:427.5-427.29 - prod 0x56 => RELOP_instr(I64_numtype, GT_relop_(U_sx)) - ;; A-binary.watsup:428.5-428.29 - prod 0x57 => RELOP_instr(I64_numtype, LE_relop_(S_sx)) - ;; A-binary.watsup:429.5-429.29 - prod 0x58 => RELOP_instr(I64_numtype, LE_relop_(U_sx)) - ;; A-binary.watsup:430.5-430.29 - prod 0x59 => RELOP_instr(I64_numtype, GE_relop_(S_sx)) - ;; A-binary.watsup:431.5-431.29 - prod 0x5A => RELOP_instr(I64_numtype, GE_relop_(U_sx)) - ;; A-binary.watsup:435.5-435.25 - prod 0x5B => RELOP_instr(F32_numtype, EQ_relop_) - ;; A-binary.watsup:436.5-436.25 - prod 0x5C => RELOP_instr(F32_numtype, NE_relop_) - ;; A-binary.watsup:437.5-437.25 - prod 0x5D => RELOP_instr(F32_numtype, LT_relop_) - ;; A-binary.watsup:438.5-438.25 - prod 0x5E => RELOP_instr(F32_numtype, GT_relop_) - ;; A-binary.watsup:439.5-439.25 - prod 0x5F => RELOP_instr(F32_numtype, LE_relop_) - ;; A-binary.watsup:440.5-440.25 - prod 0x60 => RELOP_instr(F32_numtype, GE_relop_) - ;; A-binary.watsup:444.5-444.25 - prod 0x61 => RELOP_instr(F64_numtype, EQ_relop_) - ;; A-binary.watsup:445.5-445.25 - prod 0x62 => RELOP_instr(F64_numtype, NE_relop_) - ;; A-binary.watsup:446.5-446.25 - prod 0x63 => RELOP_instr(F64_numtype, LT_relop_) - ;; A-binary.watsup:447.5-447.25 - prod 0x64 => RELOP_instr(F64_numtype, GT_relop_) - ;; A-binary.watsup:448.5-448.25 - prod 0x65 => RELOP_instr(F64_numtype, LE_relop_) - ;; A-binary.watsup:449.5-449.25 - prod 0x66 => RELOP_instr(F64_numtype, GE_relop_) - ;; A-binary.watsup:453.5-453.25 - prod 0x67 => UNOP_instr(I32_numtype, CLZ_unop_) - ;; A-binary.watsup:454.5-454.25 - prod 0x68 => UNOP_instr(I32_numtype, CTZ_unop_) - ;; A-binary.watsup:455.5-455.28 - prod 0x69 => UNOP_instr(I32_numtype, POPCNT_unop_) - ;; A-binary.watsup:459.5-459.26 - prod 0x6A => BINOP_instr(I32_numtype, ADD_binop_) - ;; A-binary.watsup:460.5-460.26 - prod 0x6B => BINOP_instr(I32_numtype, SUB_binop_) - ;; A-binary.watsup:461.5-461.26 - prod 0x6C => BINOP_instr(I32_numtype, MUL_binop_) - ;; A-binary.watsup:462.5-462.30 - prod 0x6D => BINOP_instr(I32_numtype, DIV_binop_(S_sx)) - ;; A-binary.watsup:463.5-463.30 - prod 0x6E => BINOP_instr(I32_numtype, DIV_binop_(U_sx)) - ;; A-binary.watsup:464.5-464.30 - prod 0x6F => BINOP_instr(I32_numtype, REM_binop_(S_sx)) - ;; A-binary.watsup:465.5-465.30 - prod 0x70 => BINOP_instr(I32_numtype, REM_binop_(U_sx)) - ;; A-binary.watsup:466.5-466.26 - prod 0x71 => BINOP_instr(I32_numtype, AND_binop_) - ;; A-binary.watsup:467.5-467.25 - prod 0x72 => BINOP_instr(I32_numtype, OR_binop_) - ;; A-binary.watsup:468.5-468.26 - prod 0x73 => BINOP_instr(I32_numtype, XOR_binop_) - ;; A-binary.watsup:469.5-469.26 - prod 0x74 => BINOP_instr(I32_numtype, SHL_binop_) - ;; A-binary.watsup:470.5-470.30 - prod 0x75 => BINOP_instr(I32_numtype, SHR_binop_(S_sx)) - ;; A-binary.watsup:471.5-471.30 - prod 0x76 => BINOP_instr(I32_numtype, SHR_binop_(U_sx)) - ;; A-binary.watsup:472.5-472.27 - prod 0x77 => BINOP_instr(I32_numtype, ROTL_binop_) - ;; A-binary.watsup:473.5-473.27 - prod 0x78 => BINOP_instr(I32_numtype, ROTR_binop_) - ;; A-binary.watsup:477.5-477.25 - prod 0x79 => UNOP_instr(I64_numtype, CLZ_unop_) - ;; A-binary.watsup:478.5-478.25 - prod 0x7A => UNOP_instr(I64_numtype, CTZ_unop_) - ;; A-binary.watsup:479.5-479.28 - prod 0x7B => UNOP_instr(I64_numtype, POPCNT_unop_) - ;; A-binary.watsup:483.5-483.33 - prod 0xC0 => UNOP_instr(I32_numtype, EXTEND_unop_(`%`_sz(8))) - ;; A-binary.watsup:484.5-484.34 - prod 0xC1 => UNOP_instr(I32_numtype, EXTEND_unop_(`%`_sz(16))) - ;; A-binary.watsup:488.5-488.33 - prod 0xC2 => UNOP_instr(I64_numtype, EXTEND_unop_(`%`_sz(8))) - ;; A-binary.watsup:489.5-489.34 - prod 0xC3 => UNOP_instr(I64_numtype, EXTEND_unop_(`%`_sz(16))) - ;; A-binary.watsup:490.5-490.34 - prod 0xC4 => UNOP_instr(I64_numtype, EXTEND_unop_(`%`_sz(32))) - ;; A-binary.watsup:494.5-494.26 - prod 0x7C => BINOP_instr(I64_numtype, ADD_binop_) - ;; A-binary.watsup:495.5-495.26 - prod 0x7D => BINOP_instr(I64_numtype, SUB_binop_) - ;; A-binary.watsup:496.5-496.26 - prod 0x7E => BINOP_instr(I64_numtype, MUL_binop_) - ;; A-binary.watsup:497.5-497.30 - prod 0x7F => BINOP_instr(I64_numtype, DIV_binop_(S_sx)) - ;; A-binary.watsup:498.5-498.30 - prod 0x80 => BINOP_instr(I64_numtype, DIV_binop_(U_sx)) - ;; A-binary.watsup:499.5-499.30 - prod 0x81 => BINOP_instr(I64_numtype, REM_binop_(S_sx)) - ;; A-binary.watsup:500.5-500.30 - prod 0x82 => BINOP_instr(I64_numtype, REM_binop_(U_sx)) - ;; A-binary.watsup:501.5-501.26 - prod 0x83 => BINOP_instr(I64_numtype, AND_binop_) - ;; A-binary.watsup:502.5-502.25 - prod 0x84 => BINOP_instr(I64_numtype, OR_binop_) - ;; A-binary.watsup:503.5-503.26 - prod 0x85 => BINOP_instr(I64_numtype, XOR_binop_) - ;; A-binary.watsup:504.5-504.26 - prod 0x86 => BINOP_instr(I64_numtype, SHL_binop_) - ;; A-binary.watsup:505.5-505.30 - prod 0x87 => BINOP_instr(I64_numtype, SHR_binop_(S_sx)) - ;; A-binary.watsup:506.5-506.30 - prod 0x88 => BINOP_instr(I64_numtype, SHR_binop_(U_sx)) - ;; A-binary.watsup:507.5-507.27 - prod 0x89 => BINOP_instr(I64_numtype, ROTL_binop_) - ;; A-binary.watsup:508.5-508.27 - prod 0x8A => BINOP_instr(I64_numtype, ROTR_binop_) - ;; A-binary.watsup:512.5-512.25 - prod 0x8B => UNOP_instr(F32_numtype, ABS_unop_) - ;; A-binary.watsup:513.5-513.25 - prod 0x8C => UNOP_instr(F32_numtype, NEG_unop_) - ;; A-binary.watsup:514.5-514.26 - prod 0x8D => UNOP_instr(F32_numtype, CEIL_unop_) - ;; A-binary.watsup:515.5-515.27 - prod 0x8E => UNOP_instr(F32_numtype, FLOOR_unop_) - ;; A-binary.watsup:516.5-516.27 - prod 0x8F => UNOP_instr(F32_numtype, TRUNC_unop_) - ;; A-binary.watsup:517.5-517.29 - prod 0x90 => UNOP_instr(F32_numtype, NEAREST_unop_) - ;; A-binary.watsup:518.5-518.26 - prod 0x91 => UNOP_instr(F32_numtype, SQRT_unop_) - ;; A-binary.watsup:522.5-522.26 - prod 0x92 => BINOP_instr(F32_numtype, ADD_binop_) - ;; A-binary.watsup:523.5-523.26 - prod 0x93 => BINOP_instr(F32_numtype, SUB_binop_) - ;; A-binary.watsup:524.5-524.26 - prod 0x94 => BINOP_instr(F32_numtype, MUL_binop_) - ;; A-binary.watsup:525.5-525.26 - prod 0x95 => BINOP_instr(F32_numtype, DIV_binop_) - ;; A-binary.watsup:526.5-526.26 - prod 0x96 => BINOP_instr(F32_numtype, MIN_binop_) - ;; A-binary.watsup:527.5-527.26 - prod 0x97 => BINOP_instr(F32_numtype, MAX_binop_) - ;; A-binary.watsup:528.5-528.31 - prod 0x98 => BINOP_instr(F32_numtype, COPYSIGN_binop_) - ;; A-binary.watsup:532.5-532.25 - prod 0x99 => UNOP_instr(F64_numtype, ABS_unop_) - ;; A-binary.watsup:533.5-533.25 - prod 0x9A => UNOP_instr(F64_numtype, NEG_unop_) - ;; A-binary.watsup:534.5-534.26 - prod 0x9B => UNOP_instr(F64_numtype, CEIL_unop_) - ;; A-binary.watsup:535.5-535.27 - prod 0x9C => UNOP_instr(F64_numtype, FLOOR_unop_) - ;; A-binary.watsup:536.5-536.27 - prod 0x9D => UNOP_instr(F64_numtype, TRUNC_unop_) - ;; A-binary.watsup:537.5-537.29 - prod 0x9E => UNOP_instr(F64_numtype, NEAREST_unop_) - ;; A-binary.watsup:538.5-538.26 - prod 0x9F => UNOP_instr(F64_numtype, SQRT_unop_) - ;; A-binary.watsup:542.5-542.26 - prod 0xA0 => BINOP_instr(F64_numtype, ADD_binop_) - ;; A-binary.watsup:543.5-543.26 - prod 0xA1 => BINOP_instr(F64_numtype, SUB_binop_) - ;; A-binary.watsup:544.5-544.26 - prod 0xA2 => BINOP_instr(F64_numtype, MUL_binop_) - ;; A-binary.watsup:545.5-545.26 - prod 0xA3 => BINOP_instr(F64_numtype, DIV_binop_) - ;; A-binary.watsup:546.5-546.26 - prod 0xA4 => BINOP_instr(F64_numtype, MIN_binop_) - ;; A-binary.watsup:547.5-547.26 - prod 0xA5 => BINOP_instr(F64_numtype, MAX_binop_) - ;; A-binary.watsup:548.5-548.31 - prod 0xA6 => BINOP_instr(F64_numtype, COPYSIGN_binop_) - ;; A-binary.watsup:553.5-553.31 - prod 0xA7 => CVTOP_instr(I32_numtype, I64_numtype, WRAP_cvtop__) - ;; A-binary.watsup:554.5-554.36 - prod 0xA8 => CVTOP_instr(I32_numtype, F32_numtype, TRUNC_cvtop__(S_sx)) - ;; A-binary.watsup:555.5-555.36 - prod 0xA9 => CVTOP_instr(I32_numtype, F32_numtype, TRUNC_cvtop__(U_sx)) - ;; A-binary.watsup:556.5-556.36 - prod 0xAA => CVTOP_instr(I32_numtype, F64_numtype, TRUNC_cvtop__(S_sx)) - ;; A-binary.watsup:557.5-557.36 - prod 0xAB => CVTOP_instr(I32_numtype, F64_numtype, TRUNC_cvtop__(U_sx)) - ;; A-binary.watsup:558.5-558.37 - prod 0xAC => CVTOP_instr(I64_numtype, I32_numtype, EXTEND_cvtop__(S_sx)) - ;; A-binary.watsup:559.5-559.37 - prod 0xAD => CVTOP_instr(I64_numtype, I32_numtype, EXTEND_cvtop__(U_sx)) - ;; A-binary.watsup:560.5-560.36 - prod 0xAE => CVTOP_instr(I64_numtype, F32_numtype, TRUNC_cvtop__(S_sx)) - ;; A-binary.watsup:561.5-561.36 - prod 0xAF => CVTOP_instr(I64_numtype, F32_numtype, TRUNC_cvtop__(U_sx)) - ;; A-binary.watsup:562.5-562.36 - prod 0xB0 => CVTOP_instr(I64_numtype, F64_numtype, TRUNC_cvtop__(S_sx)) - ;; A-binary.watsup:563.5-563.36 - prod 0xB1 => CVTOP_instr(I64_numtype, F64_numtype, TRUNC_cvtop__(U_sx)) - ;; A-binary.watsup:564.5-564.38 - prod 0xB2 => CVTOP_instr(F32_numtype, I32_numtype, CONVERT_cvtop__(S_sx)) - ;; A-binary.watsup:565.5-565.38 - prod 0xB3 => CVTOP_instr(F32_numtype, I32_numtype, CONVERT_cvtop__(U_sx)) - ;; A-binary.watsup:566.5-566.38 - prod 0xB4 => CVTOP_instr(F32_numtype, I64_numtype, CONVERT_cvtop__(S_sx)) - ;; A-binary.watsup:567.5-567.38 - prod 0xB5 => CVTOP_instr(F32_numtype, I64_numtype, CONVERT_cvtop__(U_sx)) - ;; A-binary.watsup:568.5-568.33 - prod 0xB6 => CVTOP_instr(F32_numtype, F64_numtype, DEMOTE_cvtop__) - ;; A-binary.watsup:569.5-569.38 - prod 0xB7 => CVTOP_instr(F64_numtype, I32_numtype, CONVERT_cvtop__(S_sx)) - ;; A-binary.watsup:570.5-570.38 - prod 0xB8 => CVTOP_instr(F64_numtype, I32_numtype, CONVERT_cvtop__(U_sx)) - ;; A-binary.watsup:571.5-571.38 - prod 0xB9 => CVTOP_instr(F64_numtype, I64_numtype, CONVERT_cvtop__(S_sx)) - ;; A-binary.watsup:572.5-572.38 - prod 0xBA => CVTOP_instr(F64_numtype, I64_numtype, CONVERT_cvtop__(U_sx)) - ;; A-binary.watsup:573.5-573.34 - prod 0xBB => CVTOP_instr(F32_numtype, F64_numtype, PROMOTE_cvtop__) - ;; A-binary.watsup:574.5-574.38 - prod 0xBC => CVTOP_instr(I32_numtype, F32_numtype, REINTERPRET_cvtop__) - ;; A-binary.watsup:575.5-575.38 - prod 0xBD => CVTOP_instr(I64_numtype, F64_numtype, REINTERPRET_cvtop__) - ;; A-binary.watsup:576.5-576.38 - prod 0xBE => CVTOP_instr(F32_numtype, I32_numtype, REINTERPRET_cvtop__) - ;; A-binary.watsup:577.5-577.38 - prod 0xBF => CVTOP_instr(F64_numtype, I64_numtype, REINTERPRET_cvtop__) - ;; A-binary.watsup:581.5-581.47 - prod {0xFC `%`_u32(0):Bu32} => CVTOP_instr(I32_numtype, F32_numtype, TRUNC_SAT_cvtop__(S_sx)) - ;; A-binary.watsup:582.5-582.47 - prod {0xFC `%`_u32(1):Bu32} => CVTOP_instr(I32_numtype, F32_numtype, TRUNC_SAT_cvtop__(U_sx)) - ;; A-binary.watsup:583.5-583.47 - prod {0xFC `%`_u32(2):Bu32} => CVTOP_instr(I32_numtype, F64_numtype, TRUNC_SAT_cvtop__(S_sx)) - ;; A-binary.watsup:584.5-584.47 - prod {0xFC `%`_u32(3):Bu32} => CVTOP_instr(I32_numtype, F64_numtype, TRUNC_SAT_cvtop__(U_sx)) - ;; A-binary.watsup:585.5-585.47 - prod {0xFC `%`_u32(4):Bu32} => CVTOP_instr(I64_numtype, F32_numtype, TRUNC_SAT_cvtop__(S_sx)) - ;; A-binary.watsup:586.5-586.47 - prod {0xFC `%`_u32(5):Bu32} => CVTOP_instr(I64_numtype, F32_numtype, TRUNC_SAT_cvtop__(U_sx)) - ;; A-binary.watsup:587.5-587.47 - prod {0xFC `%`_u32(6):Bu32} => CVTOP_instr(I64_numtype, F64_numtype, TRUNC_SAT_cvtop__(S_sx)) - ;; A-binary.watsup:588.5-588.47 - prod {0xFC `%`_u32(7):Bu32} => CVTOP_instr(I64_numtype, F64_numtype, TRUNC_SAT_cvtop__(U_sx)) - ;; A-binary.watsup:598.5-598.50 - prod{x : idx, ao : memarg} {0xFD `%`_u32(0):Bu32 (x, ao):Bmemarg} => VLOAD_instr(V128_vectype, ?(), x, ao) - ;; A-binary.watsup:599.5-599.68 - prod{x : idx, ao : memarg} {0xFD `%`_u32(1):Bu32 (x, ao):Bmemarg} => VLOAD_instr(V128_vectype, ?(`SHAPE%X%%`_vloadop_(`%`_sz(8), 8, S_sx)), x, ao) - ;; A-binary.watsup:600.5-600.68 - prod{x : idx, ao : memarg} {0xFD `%`_u32(2):Bu32 (x, ao):Bmemarg} => VLOAD_instr(V128_vectype, ?(`SHAPE%X%%`_vloadop_(`%`_sz(8), 8, U_sx)), x, ao) - ;; A-binary.watsup:601.5-601.69 - prod{x : idx, ao : memarg} {0xFD `%`_u32(3):Bu32 (x, ao):Bmemarg} => VLOAD_instr(V128_vectype, ?(`SHAPE%X%%`_vloadop_(`%`_sz(16), 4, S_sx)), x, ao) - ;; A-binary.watsup:602.5-602.69 - prod{x : idx, ao : memarg} {0xFD `%`_u32(4):Bu32 (x, ao):Bmemarg} => VLOAD_instr(V128_vectype, ?(`SHAPE%X%%`_vloadop_(`%`_sz(16), 4, U_sx)), x, ao) - ;; A-binary.watsup:603.5-603.69 - prod{x : idx, ao : memarg} {0xFD `%`_u32(5):Bu32 (x, ao):Bmemarg} => VLOAD_instr(V128_vectype, ?(`SHAPE%X%%`_vloadop_(`%`_sz(32), 2, S_sx)), x, ao) - ;; A-binary.watsup:604.5-604.69 - prod{x : idx, ao : memarg} {0xFD `%`_u32(6):Bu32 (x, ao):Bmemarg} => VLOAD_instr(V128_vectype, ?(`SHAPE%X%%`_vloadop_(`%`_sz(32), 2, U_sx)), x, ao) - ;; A-binary.watsup:605.5-605.61 - prod{x : idx, ao : memarg} {0xFD `%`_u32(7):Bu32 (x, ao):Bmemarg} => VLOAD_instr(V128_vectype, ?(SPLAT_vloadop_(`%`_sz(8))), x, ao) - ;; A-binary.watsup:606.5-606.62 - prod{x : idx, ao : memarg} {0xFD `%`_u32(8):Bu32 (x, ao):Bmemarg} => VLOAD_instr(V128_vectype, ?(SPLAT_vloadop_(`%`_sz(16))), x, ao) - ;; A-binary.watsup:607.5-607.62 - prod{x : idx, ao : memarg} {0xFD `%`_u32(9):Bu32 (x, ao):Bmemarg} => VLOAD_instr(V128_vectype, ?(SPLAT_vloadop_(`%`_sz(32))), x, ao) - ;; A-binary.watsup:608.5-608.63 - prod{x : idx, ao : memarg} {0xFD `%`_u32(10):Bu32 (x, ao):Bmemarg} => VLOAD_instr(V128_vectype, ?(SPLAT_vloadop_(`%`_sz(64))), x, ao) - ;; A-binary.watsup:609.5-609.52 - prod{x : idx, ao : memarg} {0xFD `%`_u32(11):Bu32 (x, ao):Bmemarg} => VSTORE_instr(V128_vectype, x, ao) - ;; A-binary.watsup:610.5-610.72 - prod{x : idx, ao : memarg, l : labelidx} {0xFD `%`_u32(84):Bu32 (x, ao):Bmemarg `%`_laneidx(l!`%`_labelidx.0):Blaneidx} => VLOAD_LANE_instr(V128_vectype, `%`_sz(8), x, ao, `%`_laneidx(l!`%`_labelidx.0)) - ;; A-binary.watsup:611.5-611.73 - prod{x : idx, ao : memarg, l : labelidx} {0xFD `%`_u32(85):Bu32 (x, ao):Bmemarg `%`_laneidx(l!`%`_labelidx.0):Blaneidx} => VLOAD_LANE_instr(V128_vectype, `%`_sz(16), x, ao, `%`_laneidx(l!`%`_labelidx.0)) - ;; A-binary.watsup:612.5-612.73 - prod{x : idx, ao : memarg, l : labelidx} {0xFD `%`_u32(86):Bu32 (x, ao):Bmemarg `%`_laneidx(l!`%`_labelidx.0):Blaneidx} => VLOAD_LANE_instr(V128_vectype, `%`_sz(32), x, ao, `%`_laneidx(l!`%`_labelidx.0)) - ;; A-binary.watsup:613.5-613.73 - prod{x : idx, ao : memarg, l : labelidx} {0xFD `%`_u32(87):Bu32 (x, ao):Bmemarg `%`_laneidx(l!`%`_labelidx.0):Blaneidx} => VLOAD_LANE_instr(V128_vectype, `%`_sz(64), x, ao, `%`_laneidx(l!`%`_labelidx.0)) - ;; A-binary.watsup:614.5-614.73 - prod{x : idx, ao : memarg, l : labelidx} {0xFD `%`_u32(88):Bu32 (x, ao):Bmemarg `%`_laneidx(l!`%`_labelidx.0):Blaneidx} => VSTORE_LANE_instr(V128_vectype, `%`_sz(8), x, ao, `%`_laneidx(l!`%`_labelidx.0)) - ;; A-binary.watsup:615.5-615.74 - prod{x : idx, ao : memarg, l : labelidx} {0xFD `%`_u32(89):Bu32 (x, ao):Bmemarg `%`_laneidx(l!`%`_labelidx.0):Blaneidx} => VSTORE_LANE_instr(V128_vectype, `%`_sz(16), x, ao, `%`_laneidx(l!`%`_labelidx.0)) - ;; A-binary.watsup:616.5-616.74 - prod{x : idx, ao : memarg, l : labelidx} {0xFD `%`_u32(90):Bu32 (x, ao):Bmemarg `%`_laneidx(l!`%`_labelidx.0):Blaneidx} => VSTORE_LANE_instr(V128_vectype, `%`_sz(32), x, ao, `%`_laneidx(l!`%`_labelidx.0)) - ;; A-binary.watsup:617.5-617.74 - prod{x : idx, ao : memarg, l : labelidx} {0xFD `%`_u32(91):Bu32 (x, ao):Bmemarg `%`_laneidx(l!`%`_labelidx.0):Blaneidx} => VSTORE_LANE_instr(V128_vectype, `%`_sz(64), x, ao, `%`_laneidx(l!`%`_labelidx.0)) - ;; A-binary.watsup:618.5-618.62 - prod{x : idx, ao : memarg} {0xFD `%`_u32(92):Bu32 (x, ao):Bmemarg} => VLOAD_instr(V128_vectype, ?(ZERO_vloadop_(`%`_sz(32))), x, ao) - ;; A-binary.watsup:619.5-619.62 - prod{x : idx, ao : memarg} {0xFD `%`_u32(93):Bu32 (x, ao):Bmemarg} => VLOAD_instr(V128_vectype, ?(ZERO_vloadop_(`%`_sz(64))), x, ao) - ;; A-binary.watsup:623.5-623.71 - prod{`b*` : byte*} {0xFD `%`_u32(12):Bu32 b:Bbyte^16{b <- `b*`}} => VCONST_instr(V128_vectype, $invibytes_(128, b^16{b <- `b*`})) - ;; A-binary.watsup:627.5-627.61 - prod{`l*` : labelidx*} {0xFD `%`_u32(13):Bu32 `%`_laneidx(l!`%`_labelidx.0):Blaneidx^16{l <- `l*`}} => VSHUFFLE_instr(`%`_bshape(`%X%`_shape(I8_lanetype, `%`_dim(16))), `%`_laneidx(l!`%`_labelidx.0)^16{l <- `l*`}) - ;; A-binary.watsup:628.5-628.49 - prod {0xFD `%`_u32(14):Bu32} => VSWIZZLOP_instr(`%`_bshape(`%X%`_shape(I8_lanetype, `%`_dim(16))), SWIZZLE_vswizzlop_) - ;; A-binary.watsup:629.5-629.58 - prod {0xFD `%`_u32(256):Bu32} => VSWIZZLOP_instr(`%`_bshape(`%X%`_shape(I8_lanetype, `%`_dim(16))), RELAXED_SWIZZLE_vswizzlop_) - ;; A-binary.watsup:633.5-633.38 - prod {0xFD `%`_u32(15):Bu32} => VSPLAT_instr(`%X%`_shape(I8_lanetype, `%`_dim(16))) - ;; A-binary.watsup:634.5-634.38 - prod {0xFD `%`_u32(16):Bu32} => VSPLAT_instr(`%X%`_shape(I16_lanetype, `%`_dim(8))) - ;; A-binary.watsup:635.5-635.38 - prod {0xFD `%`_u32(17):Bu32} => VSPLAT_instr(`%X%`_shape(I32_lanetype, `%`_dim(4))) - ;; A-binary.watsup:636.5-636.38 - prod {0xFD `%`_u32(18):Bu32} => VSPLAT_instr(`%X%`_shape(I64_lanetype, `%`_dim(2))) - ;; A-binary.watsup:637.5-637.38 - prod {0xFD `%`_u32(19):Bu32} => VSPLAT_instr(`%X%`_shape(F32_lanetype, `%`_dim(4))) - ;; A-binary.watsup:638.5-638.38 - prod {0xFD `%`_u32(20):Bu32} => VSPLAT_instr(`%X%`_shape(F64_lanetype, `%`_dim(2))) - ;; A-binary.watsup:642.5-642.60 - prod{l : labelidx} {0xFD `%`_u32(21):Bu32 `%`_laneidx(l!`%`_labelidx.0):Blaneidx} => VEXTRACT_LANE_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), ?(S_sx), `%`_laneidx(l!`%`_labelidx.0)) - ;; A-binary.watsup:643.5-643.60 - prod{l : labelidx} {0xFD `%`_u32(22):Bu32 `%`_laneidx(l!`%`_labelidx.0):Blaneidx} => VEXTRACT_LANE_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), ?(U_sx), `%`_laneidx(l!`%`_labelidx.0)) - ;; A-binary.watsup:644.5-644.58 - prod{l : labelidx} {0xFD `%`_u32(23):Bu32 `%`_laneidx(l!`%`_labelidx.0):Blaneidx} => VREPLACE_LANE_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), `%`_laneidx(l!`%`_labelidx.0)) - ;; A-binary.watsup:645.5-645.60 - prod{l : labelidx} {0xFD `%`_u32(24):Bu32 `%`_laneidx(l!`%`_labelidx.0):Blaneidx} => VEXTRACT_LANE_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), ?(S_sx), `%`_laneidx(l!`%`_labelidx.0)) - ;; A-binary.watsup:646.5-646.60 - prod{l : labelidx} {0xFD `%`_u32(25):Bu32 `%`_laneidx(l!`%`_labelidx.0):Blaneidx} => VEXTRACT_LANE_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), ?(U_sx), `%`_laneidx(l!`%`_labelidx.0)) - ;; A-binary.watsup:647.5-647.58 - prod{l : labelidx} {0xFD `%`_u32(26):Bu32 `%`_laneidx(l!`%`_labelidx.0):Blaneidx} => VREPLACE_LANE_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), `%`_laneidx(l!`%`_labelidx.0)) - ;; A-binary.watsup:648.5-648.58 - prod{l : labelidx} {0xFD `%`_u32(27):Bu32 `%`_laneidx(l!`%`_labelidx.0):Blaneidx} => VEXTRACT_LANE_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), ?(), `%`_laneidx(l!`%`_labelidx.0)) - ;; A-binary.watsup:649.5-649.58 - prod{l : labelidx} {0xFD `%`_u32(28):Bu32 `%`_laneidx(l!`%`_labelidx.0):Blaneidx} => VREPLACE_LANE_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), `%`_laneidx(l!`%`_labelidx.0)) - ;; A-binary.watsup:650.5-650.58 - prod{l : labelidx} {0xFD `%`_u32(29):Bu32 `%`_laneidx(l!`%`_labelidx.0):Blaneidx} => VEXTRACT_LANE_instr(`%X%`_shape(I64_lanetype, `%`_dim(2)), ?(), `%`_laneidx(l!`%`_labelidx.0)) - ;; A-binary.watsup:651.5-651.58 - prod{l : labelidx} {0xFD `%`_u32(30):Bu32 `%`_laneidx(l!`%`_labelidx.0):Blaneidx} => VREPLACE_LANE_instr(`%X%`_shape(I64_lanetype, `%`_dim(2)), `%`_laneidx(l!`%`_labelidx.0)) - ;; A-binary.watsup:652.5-652.58 - prod{l : labelidx} {0xFD `%`_u32(31):Bu32 `%`_laneidx(l!`%`_labelidx.0):Blaneidx} => VEXTRACT_LANE_instr(`%X%`_shape(F32_lanetype, `%`_dim(4)), ?(), `%`_laneidx(l!`%`_labelidx.0)) - ;; A-binary.watsup:653.5-653.58 - prod{l : labelidx} {0xFD `%`_u32(32):Bu32 `%`_laneidx(l!`%`_labelidx.0):Blaneidx} => VREPLACE_LANE_instr(`%X%`_shape(F32_lanetype, `%`_dim(4)), `%`_laneidx(l!`%`_labelidx.0)) - ;; A-binary.watsup:654.5-654.58 - prod{l : labelidx} {0xFD `%`_u32(33):Bu32 `%`_laneidx(l!`%`_labelidx.0):Blaneidx} => VEXTRACT_LANE_instr(`%X%`_shape(F64_lanetype, `%`_dim(2)), ?(), `%`_laneidx(l!`%`_labelidx.0)) - ;; A-binary.watsup:655.5-655.58 - prod{l : labelidx} {0xFD `%`_u32(34):Bu32 `%`_laneidx(l!`%`_labelidx.0):Blaneidx} => VREPLACE_LANE_instr(`%X%`_shape(F64_lanetype, `%`_dim(2)), `%`_laneidx(l!`%`_labelidx.0)) - ;; A-binary.watsup:659.5-659.41 - prod {0xFD `%`_u32(35):Bu32} => VRELOP_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), EQ_vrelop_) - ;; A-binary.watsup:660.5-660.41 - prod {0xFD `%`_u32(36):Bu32} => VRELOP_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), NE_vrelop_) - ;; A-binary.watsup:661.5-661.45 - prod {0xFD `%`_u32(37):Bu32} => VRELOP_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), LT_vrelop_(S_sx)) - ;; A-binary.watsup:662.5-662.45 - prod {0xFD `%`_u32(38):Bu32} => VRELOP_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), LT_vrelop_(U_sx)) - ;; A-binary.watsup:663.5-663.45 - prod {0xFD `%`_u32(39):Bu32} => VRELOP_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), GT_vrelop_(S_sx)) - ;; A-binary.watsup:664.5-664.45 - prod {0xFD `%`_u32(40):Bu32} => VRELOP_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), GT_vrelop_(U_sx)) - ;; A-binary.watsup:665.5-665.45 - prod {0xFD `%`_u32(41):Bu32} => VRELOP_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), LE_vrelop_(S_sx)) - ;; A-binary.watsup:666.5-666.45 - prod {0xFD `%`_u32(42):Bu32} => VRELOP_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), LE_vrelop_(U_sx)) - ;; A-binary.watsup:667.5-667.45 - prod {0xFD `%`_u32(43):Bu32} => VRELOP_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), GE_vrelop_(S_sx)) - ;; A-binary.watsup:668.5-668.45 - prod {0xFD `%`_u32(44):Bu32} => VRELOP_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), GE_vrelop_(U_sx)) - ;; A-binary.watsup:672.5-672.41 - prod {0xFD `%`_u32(45):Bu32} => VRELOP_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), EQ_vrelop_) - ;; A-binary.watsup:673.5-673.41 - prod {0xFD `%`_u32(46):Bu32} => VRELOP_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), NE_vrelop_) - ;; A-binary.watsup:674.5-674.45 - prod {0xFD `%`_u32(47):Bu32} => VRELOP_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), LT_vrelop_(S_sx)) - ;; A-binary.watsup:675.5-675.45 - prod {0xFD `%`_u32(48):Bu32} => VRELOP_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), LT_vrelop_(U_sx)) - ;; A-binary.watsup:676.5-676.45 - prod {0xFD `%`_u32(49):Bu32} => VRELOP_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), GT_vrelop_(S_sx)) - ;; A-binary.watsup:677.5-677.45 - prod {0xFD `%`_u32(50):Bu32} => VRELOP_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), GT_vrelop_(U_sx)) - ;; A-binary.watsup:678.5-678.45 - prod {0xFD `%`_u32(51):Bu32} => VRELOP_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), LE_vrelop_(S_sx)) - ;; A-binary.watsup:679.5-679.45 - prod {0xFD `%`_u32(52):Bu32} => VRELOP_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), LE_vrelop_(U_sx)) - ;; A-binary.watsup:680.5-680.45 - prod {0xFD `%`_u32(53):Bu32} => VRELOP_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), GE_vrelop_(S_sx)) - ;; A-binary.watsup:681.5-681.45 - prod {0xFD `%`_u32(54):Bu32} => VRELOP_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), GE_vrelop_(U_sx)) - ;; A-binary.watsup:685.5-685.41 - prod {0xFD `%`_u32(55):Bu32} => VRELOP_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), EQ_vrelop_) - ;; A-binary.watsup:686.5-686.41 - prod {0xFD `%`_u32(56):Bu32} => VRELOP_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), NE_vrelop_) - ;; A-binary.watsup:687.5-687.45 - prod {0xFD `%`_u32(57):Bu32} => VRELOP_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), LT_vrelop_(S_sx)) - ;; A-binary.watsup:688.5-688.45 - prod {0xFD `%`_u32(58):Bu32} => VRELOP_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), LT_vrelop_(U_sx)) - ;; A-binary.watsup:689.5-689.45 - prod {0xFD `%`_u32(59):Bu32} => VRELOP_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), GT_vrelop_(S_sx)) - ;; A-binary.watsup:690.5-690.45 - prod {0xFD `%`_u32(60):Bu32} => VRELOP_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), GT_vrelop_(U_sx)) - ;; A-binary.watsup:691.5-691.45 - prod {0xFD `%`_u32(61):Bu32} => VRELOP_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), LE_vrelop_(S_sx)) - ;; A-binary.watsup:692.5-692.45 - prod {0xFD `%`_u32(62):Bu32} => VRELOP_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), LE_vrelop_(U_sx)) - ;; A-binary.watsup:693.5-693.45 - prod {0xFD `%`_u32(63):Bu32} => VRELOP_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), GE_vrelop_(S_sx)) - ;; A-binary.watsup:694.5-694.45 - prod {0xFD `%`_u32(64):Bu32} => VRELOP_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), GE_vrelop_(U_sx)) - ;; A-binary.watsup:698.5-698.41 - prod {0xFD `%`_u32(65):Bu32} => VRELOP_instr(`%X%`_shape(F32_lanetype, `%`_dim(4)), EQ_vrelop_) - ;; A-binary.watsup:699.5-699.41 - prod {0xFD `%`_u32(66):Bu32} => VRELOP_instr(`%X%`_shape(F32_lanetype, `%`_dim(4)), NE_vrelop_) - ;; A-binary.watsup:700.5-700.41 - prod {0xFD `%`_u32(67):Bu32} => VRELOP_instr(`%X%`_shape(F32_lanetype, `%`_dim(4)), LT_vrelop_) - ;; A-binary.watsup:701.5-701.41 - prod {0xFD `%`_u32(68):Bu32} => VRELOP_instr(`%X%`_shape(F32_lanetype, `%`_dim(4)), GT_vrelop_) - ;; A-binary.watsup:702.5-702.41 - prod {0xFD `%`_u32(69):Bu32} => VRELOP_instr(`%X%`_shape(F32_lanetype, `%`_dim(4)), LE_vrelop_) - ;; A-binary.watsup:703.5-703.41 - prod {0xFD `%`_u32(70):Bu32} => VRELOP_instr(`%X%`_shape(F32_lanetype, `%`_dim(4)), GE_vrelop_) - ;; A-binary.watsup:707.5-707.41 - prod {0xFD `%`_u32(71):Bu32} => VRELOP_instr(`%X%`_shape(F64_lanetype, `%`_dim(2)), EQ_vrelop_) - ;; A-binary.watsup:708.5-708.41 - prod {0xFD `%`_u32(72):Bu32} => VRELOP_instr(`%X%`_shape(F64_lanetype, `%`_dim(2)), NE_vrelop_) - ;; A-binary.watsup:709.5-709.41 - prod {0xFD `%`_u32(73):Bu32} => VRELOP_instr(`%X%`_shape(F64_lanetype, `%`_dim(2)), LT_vrelop_) - ;; A-binary.watsup:710.5-710.41 - prod {0xFD `%`_u32(74):Bu32} => VRELOP_instr(`%X%`_shape(F64_lanetype, `%`_dim(2)), GT_vrelop_) - ;; A-binary.watsup:711.5-711.41 - prod {0xFD `%`_u32(75):Bu32} => VRELOP_instr(`%X%`_shape(F64_lanetype, `%`_dim(2)), LE_vrelop_) - ;; A-binary.watsup:712.5-712.41 - prod {0xFD `%`_u32(76):Bu32} => VRELOP_instr(`%X%`_shape(F64_lanetype, `%`_dim(2)), GE_vrelop_) - ;; A-binary.watsup:716.5-716.36 - prod {0xFD `%`_u32(77):Bu32} => VVUNOP_instr(V128_vectype, NOT_vvunop) - ;; A-binary.watsup:720.5-720.37 - prod {0xFD `%`_u32(78):Bu32} => VVBINOP_instr(V128_vectype, AND_vvbinop) - ;; A-binary.watsup:721.5-721.40 - prod {0xFD `%`_u32(79):Bu32} => VVBINOP_instr(V128_vectype, ANDNOT_vvbinop) - ;; A-binary.watsup:722.5-722.36 - prod {0xFD `%`_u32(80):Bu32} => VVBINOP_instr(V128_vectype, OR_vvbinop) - ;; A-binary.watsup:723.5-723.37 - prod {0xFD `%`_u32(81):Bu32} => VVBINOP_instr(V128_vectype, XOR_vvbinop) - ;; A-binary.watsup:727.5-727.44 - prod {0xFD `%`_u32(82):Bu32} => VVTERNOP_instr(V128_vectype, BITSELECT_vvternop) - ;; A-binary.watsup:731.5-731.43 - prod {0xFD `%`_u32(83):Bu32} => VVTESTOP_instr(V128_vectype, ANY_TRUE_vvtestop) - ;; A-binary.watsup:735.5-735.41 - prod {0xFD `%`_u32(96):Bu32} => VUNOP_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), ABS_vunop_) - ;; A-binary.watsup:736.5-736.41 - prod {0xFD `%`_u32(97):Bu32} => VUNOP_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), NEG_vunop_) - ;; A-binary.watsup:737.5-737.44 - prod {0xFD `%`_u32(98):Bu32} => VUNOP_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), POPCNT_vunop_) - ;; A-binary.watsup:741.5-741.48 - prod {0xFD `%`_u32(99):Bu32} => VTESTOP_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), ALL_TRUE_vtestop_) - ;; A-binary.watsup:745.5-745.41 - prod {0xFD `%`_u32(100):Bu32} => VBITMASK_instr(`%`_ishape(`%X%`_shape(I8_lanetype, `%`_dim(16)))) - ;; A-binary.watsup:749.5-749.53 - prod {0xFD `%`_u32(101):Bu32} => VNARROW_instr(`%`_ishape(`%X%`_shape(I8_lanetype, `%`_dim(16))), `%`_ishape(`%X%`_shape(I16_lanetype, `%`_dim(8))), S_sx) - ;; A-binary.watsup:750.5-750.53 - prod {0xFD `%`_u32(102):Bu32} => VNARROW_instr(`%`_ishape(`%X%`_shape(I8_lanetype, `%`_dim(16))), `%`_ishape(`%X%`_shape(I16_lanetype, `%`_dim(8))), U_sx) - ;; A-binary.watsup:754.5-754.45 - prod {0xFD `%`_u32(107):Bu32} => VSHIFTOP_instr(`%`_ishape(`%X%`_shape(I8_lanetype, `%`_dim(16))), SHL_vshiftop_) - ;; A-binary.watsup:755.5-755.49 - prod {0xFD `%`_u32(108):Bu32} => VSHIFTOP_instr(`%`_ishape(`%X%`_shape(I8_lanetype, `%`_dim(16))), SHR_vshiftop_(S_sx)) - ;; A-binary.watsup:756.5-756.49 - prod {0xFD `%`_u32(109):Bu32} => VSHIFTOP_instr(`%`_ishape(`%X%`_shape(I8_lanetype, `%`_dim(16))), SHR_vshiftop_(U_sx)) - ;; A-binary.watsup:760.5-760.43 - prod {0xFD `%`_u32(110):Bu32} => VBINOP_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), ADD_vbinop_) - ;; A-binary.watsup:761.5-761.51 - prod {0xFD `%`_u32(111):Bu32} => VBINOP_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), ADD_SAT_vbinop_(S_sx)) - ;; A-binary.watsup:762.5-762.51 - prod {0xFD `%`_u32(112):Bu32} => VBINOP_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), ADD_SAT_vbinop_(U_sx)) - ;; A-binary.watsup:763.5-763.43 - prod {0xFD `%`_u32(113):Bu32} => VBINOP_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), SUB_vbinop_) - ;; A-binary.watsup:764.5-764.51 - prod {0xFD `%`_u32(114):Bu32} => VBINOP_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), SUB_SAT_vbinop_(S_sx)) - ;; A-binary.watsup:765.5-765.51 - prod {0xFD `%`_u32(115):Bu32} => VBINOP_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), SUB_SAT_vbinop_(U_sx)) - ;; A-binary.watsup:766.5-766.47 - prod {0xFD `%`_u32(118):Bu32} => VBINOP_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), MIN_vbinop_(S_sx)) - ;; A-binary.watsup:767.5-767.47 - prod {0xFD `%`_u32(119):Bu32} => VBINOP_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), MIN_vbinop_(U_sx)) - ;; A-binary.watsup:768.5-768.47 - prod {0xFD `%`_u32(120):Bu32} => VBINOP_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), MAX_vbinop_(S_sx)) - ;; A-binary.watsup:769.5-769.47 - prod {0xFD `%`_u32(121):Bu32} => VBINOP_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), MAX_vbinop_(U_sx)) - ;; A-binary.watsup:770.5-770.48 - prod {0xFD `%`_u32(123):Bu32} => VBINOP_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), `AVGRU`_vbinop_) - ;; A-binary.watsup:774.5-774.72 - prod {0xFD `%`_u32(124):Bu32} => VEXTUNOP_instr(`%`_ishape(`%X%`_shape(I16_lanetype, `%`_dim(8))), `%`_ishape(`%X%`_shape(I8_lanetype, `%`_dim(16))), EXTADD_PAIRWISE_vextunop__(S_sx)) - ;; A-binary.watsup:775.5-775.72 - prod {0xFD `%`_u32(125):Bu32} => VEXTUNOP_instr(`%`_ishape(`%X%`_shape(I16_lanetype, `%`_dim(8))), `%`_ishape(`%X%`_shape(I8_lanetype, `%`_dim(16))), EXTADD_PAIRWISE_vextunop__(U_sx)) - ;; A-binary.watsup:779.5-779.42 - prod {0xFD `%`_u32(128):Bu32} => VUNOP_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), ABS_vunop_) - ;; A-binary.watsup:780.5-780.42 - prod {0xFD `%`_u32(129):Bu32} => VUNOP_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), NEG_vunop_) - ;; A-binary.watsup:784.5-784.55 - prod {0xFD `%`_u32(130):Bu32} => VBINOP_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), `Q15MULR_SATS`_vbinop_) - ;; A-binary.watsup:785.5-785.59 - prod {0xFD `%`_u32(273):Bu32} => VBINOP_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), `RELAXED_Q15MULRS`_vbinop_) - ;; A-binary.watsup:789.5-789.49 - prod {0xFD `%`_u32(131):Bu32} => VTESTOP_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), ALL_TRUE_vtestop_) - ;; A-binary.watsup:793.5-793.41 - prod {0xFD `%`_u32(132):Bu32} => VBITMASK_instr(`%`_ishape(`%X%`_shape(I16_lanetype, `%`_dim(8)))) - ;; A-binary.watsup:797.5-797.53 - prod {0xFD `%`_u32(133):Bu32} => VNARROW_instr(`%`_ishape(`%X%`_shape(I16_lanetype, `%`_dim(8))), `%`_ishape(`%X%`_shape(I32_lanetype, `%`_dim(4))), S_sx) - ;; A-binary.watsup:798.5-798.53 - prod {0xFD `%`_u32(134):Bu32} => VNARROW_instr(`%`_ishape(`%X%`_shape(I16_lanetype, `%`_dim(8))), `%`_ishape(`%X%`_shape(I32_lanetype, `%`_dim(4))), U_sx) - ;; A-binary.watsup:802.5-802.65 - prod {0xFD `%`_u32(135):Bu32} => VCVTOP_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), `%X%`_shape(I8_lanetype, `%`_dim(16)), EXTEND_vcvtop__(S_sx), ?(LOW_half__), ?()) - ;; A-binary.watsup:803.5-803.66 - prod {0xFD `%`_u32(136):Bu32} => VCVTOP_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), `%X%`_shape(I8_lanetype, `%`_dim(16)), EXTEND_vcvtop__(S_sx), ?(HIGH_half__), ?()) - ;; A-binary.watsup:804.5-804.65 - prod {0xFD `%`_u32(137):Bu32} => VCVTOP_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), `%X%`_shape(I8_lanetype, `%`_dim(16)), EXTEND_vcvtop__(U_sx), ?(LOW_half__), ?()) - ;; A-binary.watsup:805.5-805.66 - prod {0xFD `%`_u32(138):Bu32} => VCVTOP_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), `%X%`_shape(I8_lanetype, `%`_dim(16)), EXTEND_vcvtop__(U_sx), ?(HIGH_half__), ?()) - ;; A-binary.watsup:809.5-809.45 - prod {0xFD `%`_u32(139):Bu32} => VSHIFTOP_instr(`%`_ishape(`%X%`_shape(I16_lanetype, `%`_dim(8))), SHL_vshiftop_) - ;; A-binary.watsup:810.5-810.49 - prod {0xFD `%`_u32(140):Bu32} => VSHIFTOP_instr(`%`_ishape(`%X%`_shape(I16_lanetype, `%`_dim(8))), SHR_vshiftop_(S_sx)) - ;; A-binary.watsup:811.5-811.49 - prod {0xFD `%`_u32(141):Bu32} => VSHIFTOP_instr(`%`_ishape(`%X%`_shape(I16_lanetype, `%`_dim(8))), SHR_vshiftop_(U_sx)) - ;; A-binary.watsup:815.5-815.43 - prod {0xFD `%`_u32(142):Bu32} => VBINOP_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), ADD_vbinop_) - ;; A-binary.watsup:816.5-816.51 - prod {0xFD `%`_u32(143):Bu32} => VBINOP_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), ADD_SAT_vbinop_(S_sx)) - ;; A-binary.watsup:817.5-817.51 - prod {0xFD `%`_u32(144):Bu32} => VBINOP_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), ADD_SAT_vbinop_(U_sx)) - ;; A-binary.watsup:818.5-818.43 - prod {0xFD `%`_u32(145):Bu32} => VBINOP_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), SUB_vbinop_) - ;; A-binary.watsup:819.5-819.51 - prod {0xFD `%`_u32(146):Bu32} => VBINOP_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), SUB_SAT_vbinop_(S_sx)) - ;; A-binary.watsup:820.5-820.51 - prod {0xFD `%`_u32(147):Bu32} => VBINOP_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), SUB_SAT_vbinop_(U_sx)) - ;; A-binary.watsup:821.5-821.43 - prod {0xFD `%`_u32(149):Bu32} => VBINOP_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), MUL_vbinop_) - ;; A-binary.watsup:822.5-822.47 - prod {0xFD `%`_u32(150):Bu32} => VBINOP_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), MIN_vbinop_(S_sx)) - ;; A-binary.watsup:823.5-823.47 - prod {0xFD `%`_u32(151):Bu32} => VBINOP_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), MIN_vbinop_(U_sx)) - ;; A-binary.watsup:824.5-824.47 - prod {0xFD `%`_u32(152):Bu32} => VBINOP_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), MAX_vbinop_(S_sx)) - ;; A-binary.watsup:825.5-825.47 - prod {0xFD `%`_u32(153):Bu32} => VBINOP_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), MAX_vbinop_(U_sx)) - ;; A-binary.watsup:826.5-826.48 - prod {0xFD `%`_u32(155):Bu32} => VBINOP_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), `AVGRU`_vbinop_) - ;; A-binary.watsup:830.5-830.68 - prod {0xFD `%`_u32(156):Bu32} => VEXTBINOP_instr(`%`_ishape(`%X%`_shape(I16_lanetype, `%`_dim(8))), `%`_ishape(`%X%`_shape(I8_lanetype, `%`_dim(16))), EXTMUL_vextbinop__(S_sx, LOW_half__)) - ;; A-binary.watsup:831.5-831.69 - prod {0xFD `%`_u32(157):Bu32} => VEXTBINOP_instr(`%`_ishape(`%X%`_shape(I16_lanetype, `%`_dim(8))), `%`_ishape(`%X%`_shape(I8_lanetype, `%`_dim(16))), EXTMUL_vextbinop__(S_sx, HIGH_half__)) - ;; A-binary.watsup:832.5-832.68 - prod {0xFD `%`_u32(158):Bu32} => VEXTBINOP_instr(`%`_ishape(`%X%`_shape(I16_lanetype, `%`_dim(8))), `%`_ishape(`%X%`_shape(I8_lanetype, `%`_dim(16))), EXTMUL_vextbinop__(U_sx, LOW_half__)) - ;; A-binary.watsup:833.5-833.69 - prod {0xFD `%`_u32(159):Bu32} => VEXTBINOP_instr(`%`_ishape(`%X%`_shape(I16_lanetype, `%`_dim(8))), `%`_ishape(`%X%`_shape(I8_lanetype, `%`_dim(16))), EXTMUL_vextbinop__(U_sx, HIGH_half__)) - ;; A-binary.watsup:834.5-834.69 - prod {0xFD `%`_u32(274):Bu32} => VEXTBINOP_instr(`%`_ishape(`%X%`_shape(I16_lanetype, `%`_dim(8))), `%`_ishape(`%X%`_shape(I8_lanetype, `%`_dim(16))), `RELAXED_DOTS`_vextbinop__) - ;; A-binary.watsup:838.5-838.72 - prod {0xFD `%`_u32(126):Bu32} => VEXTUNOP_instr(`%`_ishape(`%X%`_shape(I32_lanetype, `%`_dim(4))), `%`_ishape(`%X%`_shape(I16_lanetype, `%`_dim(8))), EXTADD_PAIRWISE_vextunop__(S_sx)) - ;; A-binary.watsup:839.5-839.72 - prod {0xFD `%`_u32(127):Bu32} => VEXTUNOP_instr(`%`_ishape(`%X%`_shape(I32_lanetype, `%`_dim(4))), `%`_ishape(`%X%`_shape(I16_lanetype, `%`_dim(8))), EXTADD_PAIRWISE_vextunop__(U_sx)) - ;; A-binary.watsup:843.5-843.42 - prod {0xFD `%`_u32(160):Bu32} => VUNOP_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), ABS_vunop_) - ;; A-binary.watsup:844.5-844.42 - prod {0xFD `%`_u32(161):Bu32} => VUNOP_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), NEG_vunop_) - ;; A-binary.watsup:848.5-848.49 - prod {0xFD `%`_u32(163):Bu32} => VTESTOP_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), ALL_TRUE_vtestop_) - ;; A-binary.watsup:852.5-852.41 - prod {0xFD `%`_u32(164):Bu32} => VBITMASK_instr(`%`_ishape(`%X%`_shape(I32_lanetype, `%`_dim(4)))) - ;; A-binary.watsup:856.5-856.65 - prod {0xFD `%`_u32(167):Bu32} => VCVTOP_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), `%X%`_shape(I16_lanetype, `%`_dim(8)), EXTEND_vcvtop__(S_sx), ?(LOW_half__), ?()) - ;; A-binary.watsup:857.5-857.66 - prod {0xFD `%`_u32(168):Bu32} => VCVTOP_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), `%X%`_shape(I16_lanetype, `%`_dim(8)), EXTEND_vcvtop__(S_sx), ?(HIGH_half__), ?()) - ;; A-binary.watsup:858.5-858.65 - prod {0xFD `%`_u32(169):Bu32} => VCVTOP_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), `%X%`_shape(I16_lanetype, `%`_dim(8)), EXTEND_vcvtop__(U_sx), ?(LOW_half__), ?()) - ;; A-binary.watsup:859.5-859.66 - prod {0xFD `%`_u32(170):Bu32} => VCVTOP_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), `%X%`_shape(I16_lanetype, `%`_dim(8)), EXTEND_vcvtop__(U_sx), ?(HIGH_half__), ?()) - ;; A-binary.watsup:863.5-863.45 - prod {0xFD `%`_u32(171):Bu32} => VSHIFTOP_instr(`%`_ishape(`%X%`_shape(I32_lanetype, `%`_dim(4))), SHL_vshiftop_) - ;; A-binary.watsup:864.5-864.49 - prod {0xFD `%`_u32(172):Bu32} => VSHIFTOP_instr(`%`_ishape(`%X%`_shape(I32_lanetype, `%`_dim(4))), SHR_vshiftop_(S_sx)) - ;; A-binary.watsup:865.5-865.49 - prod {0xFD `%`_u32(173):Bu32} => VSHIFTOP_instr(`%`_ishape(`%X%`_shape(I32_lanetype, `%`_dim(4))), SHR_vshiftop_(U_sx)) - ;; A-binary.watsup:869.5-869.43 - prod {0xFD `%`_u32(174):Bu32} => VBINOP_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), ADD_vbinop_) - ;; A-binary.watsup:870.5-870.43 - prod {0xFD `%`_u32(177):Bu32} => VBINOP_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), SUB_vbinop_) - ;; A-binary.watsup:871.5-871.43 - prod {0xFD `%`_u32(181):Bu32} => VBINOP_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), MUL_vbinop_) - ;; A-binary.watsup:872.5-872.47 - prod {0xFD `%`_u32(182):Bu32} => VBINOP_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), MIN_vbinop_(S_sx)) - ;; A-binary.watsup:873.5-873.47 - prod {0xFD `%`_u32(183):Bu32} => VBINOP_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), MIN_vbinop_(U_sx)) - ;; A-binary.watsup:874.5-874.47 - prod {0xFD `%`_u32(184):Bu32} => VBINOP_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), MAX_vbinop_(S_sx)) - ;; A-binary.watsup:875.5-875.47 - prod {0xFD `%`_u32(185):Bu32} => VBINOP_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), MAX_vbinop_(U_sx)) - ;; A-binary.watsup:879.5-879.61 - prod {0xFD `%`_u32(186):Bu32} => VEXTBINOP_instr(`%`_ishape(`%X%`_shape(I32_lanetype, `%`_dim(4))), `%`_ishape(`%X%`_shape(I16_lanetype, `%`_dim(8))), `DOTS`_vextbinop__) - ;; A-binary.watsup:880.5-880.68 - prod {0xFD `%`_u32(188):Bu32} => VEXTBINOP_instr(`%`_ishape(`%X%`_shape(I32_lanetype, `%`_dim(4))), `%`_ishape(`%X%`_shape(I16_lanetype, `%`_dim(8))), EXTMUL_vextbinop__(S_sx, LOW_half__)) - ;; A-binary.watsup:881.5-881.69 - prod {0xFD `%`_u32(189):Bu32} => VEXTBINOP_instr(`%`_ishape(`%X%`_shape(I32_lanetype, `%`_dim(4))), `%`_ishape(`%X%`_shape(I16_lanetype, `%`_dim(8))), EXTMUL_vextbinop__(S_sx, HIGH_half__)) - ;; A-binary.watsup:882.5-882.68 - prod {0xFD `%`_u32(190):Bu32} => VEXTBINOP_instr(`%`_ishape(`%X%`_shape(I32_lanetype, `%`_dim(4))), `%`_ishape(`%X%`_shape(I16_lanetype, `%`_dim(8))), EXTMUL_vextbinop__(U_sx, LOW_half__)) - ;; A-binary.watsup:883.5-883.69 - prod {0xFD `%`_u32(191):Bu32} => VEXTBINOP_instr(`%`_ishape(`%X%`_shape(I32_lanetype, `%`_dim(4))), `%`_ishape(`%X%`_shape(I16_lanetype, `%`_dim(8))), EXTMUL_vextbinop__(U_sx, HIGH_half__)) - ;; A-binary.watsup:887.5-887.74 - prod {0xFD `%`_u32(275):Bu32} => VEXTTERNOP_instr(`%`_ishape(`%X%`_shape(I32_lanetype, `%`_dim(4))), `%`_ishape(`%X%`_shape(I16_lanetype, `%`_dim(8))), `RELAXED_DOT_ADDS`_vextternop__) - ;; A-binary.watsup:891.5-891.42 - prod {0xFD `%`_u32(192):Bu32} => VUNOP_instr(`%X%`_shape(I64_lanetype, `%`_dim(2)), ABS_vunop_) - ;; A-binary.watsup:892.5-892.42 - prod {0xFD `%`_u32(193):Bu32} => VUNOP_instr(`%X%`_shape(I64_lanetype, `%`_dim(2)), NEG_vunop_) - ;; A-binary.watsup:896.5-896.49 - prod {0xFD `%`_u32(195):Bu32} => VTESTOP_instr(`%X%`_shape(I64_lanetype, `%`_dim(2)), ALL_TRUE_vtestop_) - ;; A-binary.watsup:900.5-900.41 - prod {0xFD `%`_u32(196):Bu32} => VBITMASK_instr(`%`_ishape(`%X%`_shape(I64_lanetype, `%`_dim(2)))) - ;; A-binary.watsup:904.5-904.65 - prod {0xFD `%`_u32(199):Bu32} => VCVTOP_instr(`%X%`_shape(I64_lanetype, `%`_dim(2)), `%X%`_shape(I32_lanetype, `%`_dim(4)), EXTEND_vcvtop__(S_sx), ?(LOW_half__), ?()) - ;; A-binary.watsup:905.5-905.66 - prod {0xFD `%`_u32(200):Bu32} => VCVTOP_instr(`%X%`_shape(I64_lanetype, `%`_dim(2)), `%X%`_shape(I32_lanetype, `%`_dim(4)), EXTEND_vcvtop__(S_sx), ?(HIGH_half__), ?()) - ;; A-binary.watsup:906.5-906.65 - prod {0xFD `%`_u32(201):Bu32} => VCVTOP_instr(`%X%`_shape(I64_lanetype, `%`_dim(2)), `%X%`_shape(I32_lanetype, `%`_dim(4)), EXTEND_vcvtop__(U_sx), ?(LOW_half__), ?()) - ;; A-binary.watsup:907.5-907.66 - prod {0xFD `%`_u32(202):Bu32} => VCVTOP_instr(`%X%`_shape(I64_lanetype, `%`_dim(2)), `%X%`_shape(I32_lanetype, `%`_dim(4)), EXTEND_vcvtop__(U_sx), ?(HIGH_half__), ?()) - ;; A-binary.watsup:911.5-911.45 - prod {0xFD `%`_u32(203):Bu32} => VSHIFTOP_instr(`%`_ishape(`%X%`_shape(I64_lanetype, `%`_dim(2))), SHL_vshiftop_) - ;; A-binary.watsup:912.5-912.49 - prod {0xFD `%`_u32(204):Bu32} => VSHIFTOP_instr(`%`_ishape(`%X%`_shape(I64_lanetype, `%`_dim(2))), SHR_vshiftop_(S_sx)) - ;; A-binary.watsup:913.5-913.49 - prod {0xFD `%`_u32(205):Bu32} => VSHIFTOP_instr(`%`_ishape(`%X%`_shape(I64_lanetype, `%`_dim(2))), SHR_vshiftop_(U_sx)) - ;; A-binary.watsup:917.5-917.43 - prod {0xFD `%`_u32(206):Bu32} => VBINOP_instr(`%X%`_shape(I64_lanetype, `%`_dim(2)), ADD_vbinop_) - ;; A-binary.watsup:918.5-918.43 - prod {0xFD `%`_u32(209):Bu32} => VBINOP_instr(`%X%`_shape(I64_lanetype, `%`_dim(2)), SUB_vbinop_) - ;; A-binary.watsup:919.5-919.43 - prod {0xFD `%`_u32(213):Bu32} => VBINOP_instr(`%X%`_shape(I64_lanetype, `%`_dim(2)), MUL_vbinop_) - ;; A-binary.watsup:923.5-923.42 - prod {0xFD `%`_u32(214):Bu32} => VRELOP_instr(`%X%`_shape(I64_lanetype, `%`_dim(2)), EQ_vrelop_) - ;; A-binary.watsup:924.5-924.42 - prod {0xFD `%`_u32(215):Bu32} => VRELOP_instr(`%X%`_shape(I64_lanetype, `%`_dim(2)), NE_vrelop_) - ;; A-binary.watsup:925.5-925.46 - prod {0xFD `%`_u32(216):Bu32} => VRELOP_instr(`%X%`_shape(I64_lanetype, `%`_dim(2)), LT_vrelop_(S_sx)) - ;; A-binary.watsup:926.5-926.46 - prod {0xFD `%`_u32(217):Bu32} => VRELOP_instr(`%X%`_shape(I64_lanetype, `%`_dim(2)), GT_vrelop_(S_sx)) - ;; A-binary.watsup:927.5-927.46 - prod {0xFD `%`_u32(218):Bu32} => VRELOP_instr(`%X%`_shape(I64_lanetype, `%`_dim(2)), LE_vrelop_(S_sx)) - ;; A-binary.watsup:928.5-928.46 - prod {0xFD `%`_u32(219):Bu32} => VRELOP_instr(`%X%`_shape(I64_lanetype, `%`_dim(2)), GE_vrelop_(S_sx)) - ;; A-binary.watsup:932.5-932.68 - prod {0xFD `%`_u32(220):Bu32} => VEXTBINOP_instr(`%`_ishape(`%X%`_shape(I64_lanetype, `%`_dim(2))), `%`_ishape(`%X%`_shape(I32_lanetype, `%`_dim(4))), EXTMUL_vextbinop__(S_sx, LOW_half__)) - ;; A-binary.watsup:933.5-933.69 - prod {0xFD `%`_u32(221):Bu32} => VEXTBINOP_instr(`%`_ishape(`%X%`_shape(I64_lanetype, `%`_dim(2))), `%`_ishape(`%X%`_shape(I32_lanetype, `%`_dim(4))), EXTMUL_vextbinop__(S_sx, HIGH_half__)) - ;; A-binary.watsup:934.5-934.68 - prod {0xFD `%`_u32(222):Bu32} => VEXTBINOP_instr(`%`_ishape(`%X%`_shape(I64_lanetype, `%`_dim(2))), `%`_ishape(`%X%`_shape(I32_lanetype, `%`_dim(4))), EXTMUL_vextbinop__(U_sx, LOW_half__)) - ;; A-binary.watsup:935.5-935.69 - prod {0xFD `%`_u32(223):Bu32} => VEXTBINOP_instr(`%`_ishape(`%X%`_shape(I64_lanetype, `%`_dim(2))), `%`_ishape(`%X%`_shape(I32_lanetype, `%`_dim(4))), EXTMUL_vextbinop__(U_sx, HIGH_half__)) - ;; A-binary.watsup:939.5-939.43 - prod {0xFD `%`_u32(103):Bu32} => VUNOP_instr(`%X%`_shape(F32_lanetype, `%`_dim(4)), CEIL_vunop_) - ;; A-binary.watsup:940.5-940.44 - prod {0xFD `%`_u32(104):Bu32} => VUNOP_instr(`%X%`_shape(F32_lanetype, `%`_dim(4)), FLOOR_vunop_) - ;; A-binary.watsup:941.5-941.44 - prod {0xFD `%`_u32(105):Bu32} => VUNOP_instr(`%X%`_shape(F32_lanetype, `%`_dim(4)), TRUNC_vunop_) - ;; A-binary.watsup:942.5-942.46 - prod {0xFD `%`_u32(106):Bu32} => VUNOP_instr(`%X%`_shape(F32_lanetype, `%`_dim(4)), NEAREST_vunop_) - ;; A-binary.watsup:943.5-943.42 - prod {0xFD `%`_u32(224):Bu32} => VUNOP_instr(`%X%`_shape(F32_lanetype, `%`_dim(4)), ABS_vunop_) - ;; A-binary.watsup:944.5-944.42 - prod {0xFD `%`_u32(225):Bu32} => VUNOP_instr(`%X%`_shape(F32_lanetype, `%`_dim(4)), NEG_vunop_) - ;; A-binary.watsup:945.5-945.43 - prod {0xFD `%`_u32(227):Bu32} => VUNOP_instr(`%X%`_shape(F32_lanetype, `%`_dim(4)), SQRT_vunop_) - ;; A-binary.watsup:949.5-949.43 - prod {0xFD `%`_u32(228):Bu32} => VBINOP_instr(`%X%`_shape(F32_lanetype, `%`_dim(4)), ADD_vbinop_) - ;; A-binary.watsup:950.5-950.43 - prod {0xFD `%`_u32(229):Bu32} => VBINOP_instr(`%X%`_shape(F32_lanetype, `%`_dim(4)), SUB_vbinop_) - ;; A-binary.watsup:951.5-951.43 - prod {0xFD `%`_u32(230):Bu32} => VBINOP_instr(`%X%`_shape(F32_lanetype, `%`_dim(4)), MUL_vbinop_) - ;; A-binary.watsup:952.5-952.43 - prod {0xFD `%`_u32(231):Bu32} => VBINOP_instr(`%X%`_shape(F32_lanetype, `%`_dim(4)), DIV_vbinop_) - ;; A-binary.watsup:953.5-953.43 - prod {0xFD `%`_u32(232):Bu32} => VBINOP_instr(`%X%`_shape(F32_lanetype, `%`_dim(4)), MIN_vbinop_) - ;; A-binary.watsup:954.5-954.43 - prod {0xFD `%`_u32(233):Bu32} => VBINOP_instr(`%X%`_shape(F32_lanetype, `%`_dim(4)), MAX_vbinop_) - ;; A-binary.watsup:955.5-955.44 - prod {0xFD `%`_u32(234):Bu32} => VBINOP_instr(`%X%`_shape(F32_lanetype, `%`_dim(4)), PMIN_vbinop_) - ;; A-binary.watsup:956.5-956.44 - prod {0xFD `%`_u32(235):Bu32} => VBINOP_instr(`%X%`_shape(F32_lanetype, `%`_dim(4)), PMAX_vbinop_) - ;; A-binary.watsup:957.5-957.51 - prod {0xFD `%`_u32(269):Bu32} => VBINOP_instr(`%X%`_shape(F32_lanetype, `%`_dim(4)), RELAXED_MIN_vbinop_) - ;; A-binary.watsup:958.5-958.51 - prod {0xFD `%`_u32(270):Bu32} => VBINOP_instr(`%X%`_shape(F32_lanetype, `%`_dim(4)), RELAXED_MAX_vbinop_) - ;; A-binary.watsup:962.5-962.53 - prod {0xFD `%`_u32(261):Bu32} => VTERNOP_instr(`%X%`_shape(F32_lanetype, `%`_dim(4)), RELAXED_MADD_vternop_) - ;; A-binary.watsup:963.5-963.54 - prod {0xFD `%`_u32(262):Bu32} => VTERNOP_instr(`%X%`_shape(F32_lanetype, `%`_dim(4)), RELAXED_NMADD_vternop_) - ;; A-binary.watsup:967.5-967.43 - prod {0xFD `%`_u32(116):Bu32} => VUNOP_instr(`%X%`_shape(F64_lanetype, `%`_dim(2)), CEIL_vunop_) - ;; A-binary.watsup:968.5-968.44 - prod {0xFD `%`_u32(117):Bu32} => VUNOP_instr(`%X%`_shape(F64_lanetype, `%`_dim(2)), FLOOR_vunop_) - ;; A-binary.watsup:969.5-969.44 - prod {0xFD `%`_u32(122):Bu32} => VUNOP_instr(`%X%`_shape(F64_lanetype, `%`_dim(2)), TRUNC_vunop_) - ;; A-binary.watsup:970.5-970.46 - prod {0xFD `%`_u32(148):Bu32} => VUNOP_instr(`%X%`_shape(F64_lanetype, `%`_dim(2)), NEAREST_vunop_) - ;; A-binary.watsup:971.5-971.42 - prod {0xFD `%`_u32(236):Bu32} => VUNOP_instr(`%X%`_shape(F64_lanetype, `%`_dim(2)), ABS_vunop_) - ;; A-binary.watsup:972.5-972.42 - prod {0xFD `%`_u32(237):Bu32} => VUNOP_instr(`%X%`_shape(F64_lanetype, `%`_dim(2)), NEG_vunop_) - ;; A-binary.watsup:973.5-973.43 - prod {0xFD `%`_u32(239):Bu32} => VUNOP_instr(`%X%`_shape(F64_lanetype, `%`_dim(2)), SQRT_vunop_) - ;; A-binary.watsup:977.5-977.43 - prod {0xFD `%`_u32(240):Bu32} => VBINOP_instr(`%X%`_shape(F64_lanetype, `%`_dim(2)), ADD_vbinop_) - ;; A-binary.watsup:978.5-978.43 - prod {0xFD `%`_u32(241):Bu32} => VBINOP_instr(`%X%`_shape(F64_lanetype, `%`_dim(2)), SUB_vbinop_) - ;; A-binary.watsup:979.5-979.43 - prod {0xFD `%`_u32(242):Bu32} => VBINOP_instr(`%X%`_shape(F64_lanetype, `%`_dim(2)), MUL_vbinop_) - ;; A-binary.watsup:980.5-980.43 - prod {0xFD `%`_u32(243):Bu32} => VBINOP_instr(`%X%`_shape(F64_lanetype, `%`_dim(2)), DIV_vbinop_) - ;; A-binary.watsup:981.5-981.43 - prod {0xFD `%`_u32(244):Bu32} => VBINOP_instr(`%X%`_shape(F64_lanetype, `%`_dim(2)), MIN_vbinop_) - ;; A-binary.watsup:982.5-982.43 - prod {0xFD `%`_u32(245):Bu32} => VBINOP_instr(`%X%`_shape(F64_lanetype, `%`_dim(2)), MAX_vbinop_) - ;; A-binary.watsup:983.5-983.44 - prod {0xFD `%`_u32(246):Bu32} => VBINOP_instr(`%X%`_shape(F64_lanetype, `%`_dim(2)), PMIN_vbinop_) - ;; A-binary.watsup:984.5-984.44 - prod {0xFD `%`_u32(247):Bu32} => VBINOP_instr(`%X%`_shape(F64_lanetype, `%`_dim(2)), PMAX_vbinop_) - ;; A-binary.watsup:985.5-985.51 - prod {0xFD `%`_u32(271):Bu32} => VBINOP_instr(`%X%`_shape(F64_lanetype, `%`_dim(2)), RELAXED_MIN_vbinop_) - ;; A-binary.watsup:986.5-986.51 - prod {0xFD `%`_u32(272):Bu32} => VBINOP_instr(`%X%`_shape(F64_lanetype, `%`_dim(2)), RELAXED_MAX_vbinop_) - ;; A-binary.watsup:990.5-990.53 - prod {0xFD `%`_u32(263):Bu32} => VTERNOP_instr(`%X%`_shape(F64_lanetype, `%`_dim(2)), RELAXED_MADD_vternop_) - ;; A-binary.watsup:991.5-991.54 - prod {0xFD `%`_u32(264):Bu32} => VTERNOP_instr(`%X%`_shape(F64_lanetype, `%`_dim(2)), RELAXED_NMADD_vternop_) - ;; A-binary.watsup:995.5-995.61 - prod {0xFD `%`_u32(94):Bu32} => VCVTOP_instr(`%X%`_shape(F32_lanetype, `%`_dim(4)), `%X%`_shape(F64_lanetype, `%`_dim(2)), DEMOTE_vcvtop__, ?(), ?(ZERO_zero__)) - ;; A-binary.watsup:996.5-996.61 - prod {0xFD `%`_u32(95):Bu32} => VCVTOP_instr(`%X%`_shape(F64_lanetype, `%`_dim(2)), `%X%`_shape(F32_lanetype, `%`_dim(4)), PROMOTE_vcvtop__, ?(LOW_half__), ?()) - ;; A-binary.watsup:997.5-997.64 - prod {0xFD `%`_u32(248):Bu32} => VCVTOP_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), `%X%`_shape(F32_lanetype, `%`_dim(4)), TRUNC_SAT_vcvtop__(S_sx), ?(), ?()) - ;; A-binary.watsup:998.5-998.64 - prod {0xFD `%`_u32(249):Bu32} => VCVTOP_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), `%X%`_shape(F32_lanetype, `%`_dim(4)), TRUNC_SAT_vcvtop__(U_sx), ?(), ?()) - ;; A-binary.watsup:999.5-999.62 - prod {0xFD `%`_u32(250):Bu32} => VCVTOP_instr(`%X%`_shape(F32_lanetype, `%`_dim(4)), `%X%`_shape(I32_lanetype, `%`_dim(4)), CONVERT_vcvtop__(S_sx), ?(), ?()) - ;; A-binary.watsup:1000.5-1000.62 - prod {0xFD `%`_u32(251):Bu32} => VCVTOP_instr(`%X%`_shape(F32_lanetype, `%`_dim(4)), `%X%`_shape(I32_lanetype, `%`_dim(4)), CONVERT_vcvtop__(U_sx), ?(), ?()) - ;; A-binary.watsup:1001.5-1001.69 - prod {0xFD `%`_u32(252):Bu32} => VCVTOP_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), `%X%`_shape(F64_lanetype, `%`_dim(2)), TRUNC_SAT_vcvtop__(S_sx), ?(), ?(ZERO_zero__)) - ;; A-binary.watsup:1002.5-1002.69 - prod {0xFD `%`_u32(253):Bu32} => VCVTOP_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), `%X%`_shape(F64_lanetype, `%`_dim(2)), TRUNC_SAT_vcvtop__(U_sx), ?(), ?(ZERO_zero__)) - ;; A-binary.watsup:1003.5-1003.66 - prod {0xFD `%`_u32(254):Bu32} => VCVTOP_instr(`%X%`_shape(F64_lanetype, `%`_dim(2)), `%X%`_shape(I32_lanetype, `%`_dim(4)), CONVERT_vcvtop__(S_sx), ?(LOW_half__), ?()) - ;; A-binary.watsup:1004.5-1004.66 - prod {0xFD `%`_u32(255):Bu32} => VCVTOP_instr(`%X%`_shape(F64_lanetype, `%`_dim(2)), `%X%`_shape(I32_lanetype, `%`_dim(4)), CONVERT_vcvtop__(U_sx), ?(LOW_half__), ?()) - ;; A-binary.watsup:1005.5-1005.68 - prod {0xFD `%`_u32(257):Bu32} => VCVTOP_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), `%X%`_shape(F32_lanetype, `%`_dim(4)), RELAXED_TRUNC_vcvtop__(S_sx), ?(), ?()) - ;; A-binary.watsup:1006.5-1006.68 - prod {0xFD `%`_u32(258):Bu32} => VCVTOP_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), `%X%`_shape(F32_lanetype, `%`_dim(4)), RELAXED_TRUNC_vcvtop__(U_sx), ?(), ?()) - ;; A-binary.watsup:1007.5-1007.73 - prod {0xFD `%`_u32(259):Bu32} => VCVTOP_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), `%X%`_shape(F64_lanetype, `%`_dim(2)), RELAXED_TRUNC_vcvtop__(S_sx), ?(), ?(ZERO_zero__)) - ;; A-binary.watsup:1008.5-1008.73 - prod {0xFD `%`_u32(260):Bu32} => VCVTOP_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), `%X%`_shape(F64_lanetype, `%`_dim(2)), RELAXED_TRUNC_vcvtop__(U_sx), ?(), ?(ZERO_zero__)) -} - -;; A-binary.watsup -grammar Bexpr : expr - ;; A-binary.watsup - prod{`in*` : instr*} {in:Binstr*{in <- `in*`} 0x0B} => in*{in <- `in*`} - -;; A-binary.watsup -grammar Bsection_(N : N, syntax en, grammar BX : en*) : en* - ;; A-binary.watsup - prod{len : nat, `en*` : en*} {`%`_byte(N):Bbyte `%`_u32(len):Bu32 en*{en <- `en*`}:BX} => en*{en <- `en*`} - -- if (len = 0) - ;; A-binary.watsup - prod eps => [] - -;; A-binary.watsup -grammar Bcustom : ()* - ;; A-binary.watsup - prod {Bname Bbyte*{}} => [()] - -;; A-binary.watsup -grammar Bcustomsec : () - ;; A-binary.watsup - prod Bsection_(0, syntax (), grammar Bcustom) => () - -;; A-binary.watsup -grammar Btype : type - ;; A-binary.watsup - prod{qt : rectype} qt:Brectype => TYPE_type(qt) - -;; A-binary.watsup -grammar Btypesec : type* - ;; A-binary.watsup - prod{`ty*` : type*} ty*{ty <- `ty*`}:Bsection_(1, syntax type, grammar Blist(syntax type, grammar Btype)) => ty*{ty <- `ty*`} - -;; A-binary.watsup -grammar Bimport : import - ;; A-binary.watsup - prod{nm_1 : name, nm_2 : name, xt : externtype} {nm_1:Bname nm_2:Bname xt:Bexterntype} => IMPORT_import(nm_1, nm_2, xt) - -;; A-binary.watsup -grammar Bimportsec : import* - ;; A-binary.watsup - prod{`im*` : import*} im*{im <- `im*`}:Bsection_(2, syntax import, grammar Blist(syntax import, grammar Bimport)) => im*{im <- `im*`} - -;; A-binary.watsup -grammar Bfuncsec : typeidx* - ;; A-binary.watsup - prod{`x*` : idx*} x*{x <- `x*`}:Bsection_(3, syntax typeidx, grammar Blist(syntax typeidx, grammar Btypeidx)) => x*{x <- `x*`} - -;; A-binary.watsup -grammar Btable : table - ;; A-binary.watsup - prod{tt : tabletype, ht : heaptype, at : addrtype, lim : limits} tt:Btabletype => TABLE_table(tt, [REF.NULL_instr(ht)]) - -- if (tt = `%%%`_tabletype(at, lim, REF_reftype(`NULL%?`_nul(()?{}), ht))) - ;; A-binary.watsup - prod{tt : tabletype, e : expr} {0x40 0x00 tt:Btabletype e:Bexpr} => TABLE_table(tt, e) - -;; A-binary.watsup -grammar Btablesec : table* - ;; A-binary.watsup - prod{`tab*` : table*} tab*{tab <- `tab*`}:Bsection_(4, syntax table, grammar Blist(syntax table, grammar Btable)) => tab*{tab <- `tab*`} - -;; A-binary.watsup -grammar Bmem : mem - ;; A-binary.watsup - prod{mt : memtype} mt:Bmemtype => MEMORY_mem(mt) - -;; A-binary.watsup -grammar Bmemsec : mem* - ;; A-binary.watsup - prod{`mem*` : mem*} mem*{mem <- `mem*`}:Bsection_(5, syntax mem, grammar Blist(syntax mem, grammar Bmem)) => mem*{mem <- `mem*`} - -;; A-binary.watsup -grammar Bglobal : global - ;; A-binary.watsup - prod{gt : globaltype, e : expr} {gt:Bglobaltype e:Bexpr} => GLOBAL_global(gt, e) - -;; A-binary.watsup -grammar Bglobalsec : global* - ;; A-binary.watsup - prod{`glob*` : global*} glob*{glob <- `glob*`}:Bsection_(6, syntax global, grammar Blist(syntax global, grammar Bglobal)) => glob*{glob <- `glob*`} - -;; A-binary.watsup -grammar Bexport : export - ;; A-binary.watsup - prod{nm : name, xx : externidx} {nm:Bname xx:Bexternidx} => EXPORT_export(nm, xx) - -;; A-binary.watsup -grammar Bexportsec : export* - ;; A-binary.watsup - prod{`ex*` : export*} ex*{ex <- `ex*`}:Bsection_(7, syntax export, grammar Blist(syntax export, grammar Bexport)) => ex*{ex <- `ex*`} - -;; A-binary.watsup -grammar Bstart : start* - ;; A-binary.watsup - prod{x : idx} x:Bfuncidx => [START_start(x)] - -;; A-binary.watsup -syntax startopt = start* - -;; A-binary.watsup -grammar Bstartsec : start? - ;; A-binary.watsup - prod{startopt : startopt} startopt:Bsection_(8, syntax start, grammar Bstart) => $opt_(syntax start, startopt) - -;; A-binary.watsup -grammar Belemkind : reftype - ;; A-binary.watsup - prod 0x00 => REF_reftype(`NULL%?`_nul(?(())), FUNC_heaptype) - -;; A-binary.watsup -grammar Belem : elem - ;; A-binary.watsup - prod{e_o : expr, `y*` : idx*} {`%`_u32(0):Bu32 e_o:Bexpr y*{y <- `y*`}:Blist(syntax funcidx, grammar Bfuncidx)} => ELEM_elem(REF_reftype(`NULL%?`_nul(?()), FUNC_heaptype), [REF.FUNC_instr(y)]*{y <- `y*`}, ACTIVE_elemmode(`%`_tableidx(0), e_o)) - ;; A-binary.watsup - prod{rt : reftype, `y*` : idx*} {`%`_u32(1):Bu32 rt:Belemkind y*{y <- `y*`}:Blist(syntax funcidx, grammar Bfuncidx)} => ELEM_elem(rt, [REF.FUNC_instr(y)]*{y <- `y*`}, PASSIVE_elemmode) - ;; A-binary.watsup - prod{x : idx, e : expr, rt : reftype, `y*` : idx*} {`%`_u32(2):Bu32 x:Btableidx e:Bexpr rt:Belemkind y*{y <- `y*`}:Blist(syntax funcidx, grammar Bfuncidx)} => ELEM_elem(rt, [REF.FUNC_instr(y)]*{y <- `y*`}, ACTIVE_elemmode(x, e)) - ;; A-binary.watsup - prod{rt : reftype, `y*` : idx*} {`%`_u32(3):Bu32 rt:Belemkind y*{y <- `y*`}:Blist(syntax funcidx, grammar Bfuncidx)} => ELEM_elem(rt, [REF.FUNC_instr(y)]*{y <- `y*`}, DECLARE_elemmode) - ;; A-binary.watsup - prod{e_O : expr, `e*` : expr*} {`%`_u32(4):Bu32 e_O:Bexpr e*{e <- `e*`}:Blist(syntax expr, grammar Bexpr)} => ELEM_elem(REF_reftype(`NULL%?`_nul(?(())), FUNC_heaptype), e*{e <- `e*`}, ACTIVE_elemmode(`%`_tableidx(0), e_O)) - ;; A-binary.watsup - prod{rt : reftype, `e*` : expr*} {`%`_u32(5):Bu32 rt:Breftype e*{e <- `e*`}:Blist(syntax expr, grammar Bexpr)} => ELEM_elem(rt, e*{e <- `e*`}, PASSIVE_elemmode) - ;; A-binary.watsup - prod{x : idx, e_O : expr, `e*` : expr*} {`%`_u32(6):Bu32 x:Btableidx e_O:Bexpr e*{e <- `e*`}:Blist(syntax expr, grammar Bexpr)} => ELEM_elem(REF_reftype(`NULL%?`_nul(?(())), FUNC_heaptype), e*{e <- `e*`}, ACTIVE_elemmode(x, e_O)) - ;; A-binary.watsup - prod{rt : reftype, `e*` : expr*} {`%`_u32(7):Bu32 rt:Breftype e*{e <- `e*`}:Blist(syntax expr, grammar Bexpr)} => ELEM_elem(rt, e*{e <- `e*`}, DECLARE_elemmode) - -;; A-binary.watsup -grammar Belemsec : elem* - ;; A-binary.watsup - prod{`elem*` : elem*} elem*{elem <- `elem*`}:Bsection_(9, syntax elem, grammar Blist(syntax elem, grammar Belem)) => elem*{elem <- `elem*`} - -;; A-binary.watsup -syntax code = (local*, expr) - -;; A-binary.watsup -grammar Blocals : local* - ;; A-binary.watsup - prod{n : n, t : valtype} {`%`_u32(n):Bu32 t:Bvaltype} => LOCAL_local(t)^n{} - -;; A-binary.watsup -grammar Bfunc : code - ;; A-binary.watsup - prod{`loc**` : local**, e : expr} {loc*{loc <- `loc*`}*{`loc*` <- `loc**`}:Blist(syntax local*, grammar Blocals) e:Bexpr} => ($concat_(syntax local, loc*{loc <- `loc*`}*{`loc*` <- `loc**`}), e) - -- if (|$concat_(syntax local, loc*{loc <- `loc*`}*{`loc*` <- `loc**`})| < (2 ^ 32)) - -;; A-binary.watsup -grammar Bcode : code - ;; A-binary.watsup - prod{len : nat, code : code} {`%`_u32(len):Bu32 code:Bfunc} => code - -- if (len = 0) - -;; A-binary.watsup -grammar Bcodesec : code* - ;; A-binary.watsup - prod{`code*` : code*} code*{code <- `code*`}:Bsection_(10, syntax code, grammar Blist(syntax code, grammar Bcode)) => code*{code <- `code*`} - -;; A-binary.watsup -grammar Bdata : data - ;; A-binary.watsup - prod{e : expr, `b*` : byte*} {`%`_u32(0):Bu32 e:Bexpr b*{b <- `b*`}:Blist(syntax byte, grammar Bbyte)} => DATA_data(b*{b <- `b*`}, ACTIVE_datamode(`%`_memidx(0), e)) - ;; A-binary.watsup - prod{`b*` : byte*} {`%`_u32(1):Bu32 b*{b <- `b*`}:Blist(syntax byte, grammar Bbyte)} => DATA_data(b*{b <- `b*`}, PASSIVE_datamode) - ;; A-binary.watsup - prod{x : idx, e : expr, `b*` : byte*} {`%`_u32(2):Bu32 x:Bmemidx e:Bexpr b*{b <- `b*`}:Blist(syntax byte, grammar Bbyte)} => DATA_data(b*{b <- `b*`}, ACTIVE_datamode(x, e)) - -;; A-binary.watsup -grammar Bdatasec : data* - ;; A-binary.watsup - prod{`data*` : data*} data*{data <- `data*`}:Bsection_(11, syntax data, grammar Blist(syntax data, grammar Bdata)) => data*{data <- `data*`} - -;; A-binary.watsup -grammar Bdatacnt : u32* - ;; A-binary.watsup - prod{n : n} `%`_u32(n):Bu32 => [`%`_uN(n)] - -;; A-binary.watsup -syntax nopt = u32* - -;; A-binary.watsup -grammar Bdatacntsec : u32? - ;; A-binary.watsup - prod{nopt : nopt} nopt:Bsection_(12, syntax u32, grammar Bdatacnt) => $opt_(syntax u32, nopt) - -;; A-binary.watsup -grammar Btag : tag - ;; A-binary.watsup - prod{x : idx} x:Btypeidx => TAG_tag(x) - -;; A-binary.watsup -grammar Btagsec : tag* - ;; A-binary.watsup - prod{`tag*` : tag*} tag*{tag <- `tag*`}:Bsection_(13, syntax tag, grammar Blist(syntax tag, grammar Btag)) => tag*{tag <- `tag*`} - -;; A-binary.watsup -grammar Bmagic : () - ;; A-binary.watsup - prod {0x00 0x61 0x73 0x6D} => () - -;; A-binary.watsup -grammar Bversion : () - ;; A-binary.watsup - prod {0x01 0x00 0x00 0x00} => () - -;; A-binary.watsup -grammar Bmodule : module - ;; A-binary.watsup - prod{`type*` : type*, `import*` : import*, `typeidx*` : typeidx*, `table*` : table*, `mem*` : mem*, `tag*` : tag*, `global*` : global*, `export*` : export*, `start?` : start?, `elem*` : elem*, `n?` : n?, `local**` : local**, `expr*` : expr*, `data*` : data*, `func*` : func*} {Bmagic Bversion Bcustomsec*{} type*{type <- `type*`}:Btypesec Bcustomsec*{} import*{import <- `import*`}:Bimportsec Bcustomsec*{} typeidx*{typeidx <- `typeidx*`}:Bfuncsec Bcustomsec*{} table*{table <- `table*`}:Btablesec Bcustomsec*{} mem*{mem <- `mem*`}:Bmemsec Bcustomsec*{} tag*{tag <- `tag*`}:Btagsec Bcustomsec*{} global*{global <- `global*`}:Bglobalsec Bcustomsec*{} export*{export <- `export*`}:Bexportsec Bcustomsec*{} start?{start <- `start?`}:Bstartsec Bcustomsec*{} elem*{elem <- `elem*`}:Belemsec Bcustomsec*{} `%`_u32(n)?{n <- `n?`}:Bdatacntsec Bcustomsec*{} (local*{local <- `local*`}, expr)*{expr <- `expr*`, `local*` <- `local**`}:Bcodesec Bcustomsec*{} data*{data <- `data*`}:Bdatasec Bcustomsec*{}} => MODULE_module(type*{type <- `type*`}, import*{import <- `import*`}, func*{func <- `func*`}, global*{global <- `global*`}, table*{table <- `table*`}, mem*{mem <- `mem*`}, tag*{tag <- `tag*`}, elem*{elem <- `elem*`}, data*{data <- `data*`}, start?{start <- `start?`}, export*{export <- `export*`}) - -- (if (n = |data*{data <- `data*`}|))?{n <- `n?`} - -- if ((n?{n <- `n?`} =/= ?()) \/ ($dataidx_funcs(func*{func <- `func*`}) = [])) - -- (if (func = FUNC_func(typeidx, local*{local <- `local*`}, expr)))*{expr <- `expr*`, func <- `func*`, `local*` <- `local**`, typeidx <- `typeidx*`} - -;; C-conventions.watsup -syntax A = nat - -;; C-conventions.watsup -syntax B = nat - -;; C-conventions.watsup -syntax sym = - | _FIRST{A_1 : A}(A_1 : A) - | _DOTS - | _LAST{A_n : A}(A_n : A) - -;; C-conventions.watsup -syntax symsplit = - | _FIRST{A_1 : A}(A_1 : A) - | _LAST{A_2 : A}(A_2 : A) - -;; C-conventions.watsup -syntax recorddots = - | `()` - -;; C-conventions.watsup -syntax record = -{ - FIELD_1{A_1 : A} A, - FIELD_2{A_2 : A} A, - `...`{recorddots : recorddots} recorddots -} - -;; C-conventions.watsup -syntax pth = - | PTHSYNTAX - -;; C-conventions.watsup -syntax T = nat - -;; C-conventions.watsup -relation NotationTypingPremise: `%`(nat) - -;; C-conventions.watsup -relation NotationTypingPremisedots: `...` - -;; C-conventions.watsup -relation NotationTypingScheme: `%`(nat) - ;; C-conventions.watsup - rule _{conclusion : nat, premise_1 : nat, premise_2 : nat, premise_n : nat}: - `%`(conclusion) - -- NotationTypingPremise: `%`(premise_1) - -- NotationTypingPremise: `%`(premise_2) - -- NotationTypingPremisedots: `...` - -- NotationTypingPremise: `%`(premise_n) - -;; C-conventions.watsup -rec { - -;; C-conventions.watsup:38.1-38.82 -relation NotationTypingInstrScheme: `%|-%:%`(context, instr*, functype) - ;; C-conventions.watsup:40.1-41.38 - rule i32.add{C : context}: - `%|-%:%`(C, [BINOP_instr(I32_numtype, ADD_binop_)], `%->%`_functype(`%`_resulttype([I32_valtype I32_valtype]), `%`_resulttype([I32_valtype]))) - - ;; C-conventions.watsup:43.1-45.29 - rule global.get{C : context, x : idx, t : valtype, mut : mut}: - `%|-%:%`(C, [GLOBAL.GET_instr(x)], `%->%`_functype(`%`_resulttype([]), `%`_resulttype([t]))) - -- if (C.GLOBALS_context[x!`%`_idx.0] = `%%`_globaltype(mut, t)) - - ;; C-conventions.watsup:47.1-50.78 - rule block{C : context, blocktype : blocktype, `instr*` : instr*, `t_1*` : valtype*, `t_2*` : valtype*}: - `%|-%:%`(C, [BLOCK_instr(blocktype, instr*{instr <- `instr*`})], `%->%`_functype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`}))) - -- Blocktype_ok: `%|-%:%`(C, blocktype, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) - -- NotationTypingInstrScheme: `%|-%:%`({TYPES [], RECS [], FUNCS [], GLOBALS [], TABLES [], MEMS [], TAGS [], ELEMS [], DATAS [], LOCALS [], LABELS [`%`_resulttype(t_2*{t_2 <- `t_2*`})], RETURN ?(), REFS []} +++ C, instr*{instr <- `instr*`}, `%->%`_functype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`}))) -} - -;; C-conventions.watsup -relation NotationReduct: `~>%`(instr*) - ;; C-conventions.watsup - rule 2{q_1 : num_(F64_numtype), q_4 : num_(F64_numtype), q_3 : num_(F64_numtype)}: - `~>%`([CONST_instr(F64_numtype, q_1) CONST_instr(F64_numtype, q_4) CONST_instr(F64_numtype, q_3) BINOP_instr(F64_numtype, ADD_binop_) BINOP_instr(F64_numtype, MUL_binop_)]) - - ;; C-conventions.watsup - rule 3{q_1 : num_(F64_numtype), q_5 : num_(F64_numtype)}: - `~>%`([CONST_instr(F64_numtype, q_1) CONST_instr(F64_numtype, q_5) BINOP_instr(F64_numtype, MUL_binop_)]) - - ;; C-conventions.watsup - rule 4{q_6 : num_(F64_numtype)}: - `~>%`([CONST_instr(F64_numtype, q_6)]) - -;; C-conventions.watsup -def $instrdots : instr* - -;; C-conventions.watsup -syntax label = - | `LABEL_%{%}`{n : n, `instr*` : instr*}(n : n, instr*{instr <- `instr*`} : instr*) - -;; C-conventions.watsup -syntax callframe = - | `FRAME_%{%}`{n : n, frame : frame}(n : n, frame : frame) - -;; C-conventions.watsup -def $allocX(syntax X, syntax Y, store : store, X : X, Y : Y) : (store, addr) - -;; C-conventions.watsup -rec { - -;; C-conventions.watsup:80.1-80.117 -def $allocXs(syntax X, syntax Y, store : store, X*, Y*) : (store, addr*) - ;; C-conventions.watsup:81.1-81.57 - def $allocXs{syntax X, syntax Y, s : store}(syntax X, syntax Y, s, [], []) = (s, []) - ;; C-conventions.watsup:82.1-84.65 - def $allocXs{syntax X, syntax Y, s : store, X : X, `X'*` : X*, Y : Y, `Y'*` : Y*, s_2 : store, a : addr, `a'*` : addr*, s_1 : store}(syntax X, syntax Y, s, [X] ++ X'*{X' <- `X'*`}, [Y] ++ Y'*{Y' <- `Y'*`}) = (s_2, [a] ++ a'*{a' <- `a'*`}) - -- if ((s_1, a) = $allocX(syntax X, syntax Y, s, X, Y)) - -- if ((s_2, a'*{a' <- `a'*`}) = $allocXs(syntax X, syntax Y, s_1, X'*{X' <- `X'*`}, Y'*{Y' <- `Y'*`})) -} - -;; C-conventions.watsup -grammar Btypewriter : () - ;; C-conventions.watsup - prod 0x00 => () - -;; C-conventions.watsup -syntax symdots = - | `%`{i : nat}(i : nat) - -- if (i = 0) - -;; C-conventions.watsup -def $var(syntax X) : nat - ;; C-conventions.watsup - def $var{syntax X}(syntax X) = 0 - -;; C-conventions.watsup -grammar Bvar(syntax X) : () - ;; C-conventions.watsup - prod 0x00 => () +;; 1-syntax.watsup +syntax NULL = + | NULL -;; C-conventions.watsup -grammar Bsym : A - ;; C-conventions.watsup - prod Bvar(syntax B) => $var(syntax A) - ;; C-conventions.watsup - prod (Bvar(syntax symdots) | Bvar(syntax B)) => $var(syntax A) +;; 1-syntax.watsup +syntax MUT = + | MUT -== IL Validation... -== Running pass totalize... +;; 1-syntax.watsup +syntax FINAL = + | FINAL ;; 0-aux.watsup syntax N = nat @@ -9091,7 +250,7 @@ syntax fNmag{N : N}(N) = | SUBNORM{m : m, exp : exp}(m : m) -- if ((m < (2 ^ $M(N))) /\ (((2 : nat <:> int) - ((2 ^ ((($E(N) : nat <:> int) - (1 : nat <:> int)) : int <:> nat)) : nat <:> int)) = exp)) | INF - | `NAN(%)`{m : m}(m : m) + | NAN{m : m}(m : m) -- if ((1 <= m) /\ (m < (2 ^ $M(N)))) ;; 1-syntax.watsup @@ -9220,16 +379,13 @@ syntax externidx = | TAG{tagidx : tagidx}(tagidx : tagidx) ;; 1-syntax.watsup -syntax nul = - | `NULL%?`(()?) +syntax nul = NULL? ;; 1-syntax.watsup -syntax nul1 = - | `NULL%?`(()?) +syntax nul1 = NULL? ;; 1-syntax.watsup -syntax nul2 = - | `NULL%?`(()?) +syntax nul2 = NULL? ;; 1-syntax.watsup syntax addrtype = @@ -9272,12 +428,10 @@ syntax absheaptype = | BOT ;; 1-syntax.watsup -syntax mut = - | `MUT%?`(()?) +syntax mut = MUT? ;; 1-syntax.watsup -syntax fin = - | `FINAL%?`(()?) +syntax fin = FINAL? ;; 1-syntax.watsup rec { @@ -9399,52 +553,52 @@ syntax Cnn = ;; 1-syntax.watsup def $ANYREF : reftype ;; 1-syntax.watsup - def $ANYREF = REF_reftype(`NULL%?`_nul(?(())), ANY_heaptype) + def $ANYREF = REF_reftype(?(NULL_NULL), ANY_heaptype) ;; 1-syntax.watsup def $EQREF : reftype ;; 1-syntax.watsup - def $EQREF = REF_reftype(`NULL%?`_nul(?(())), EQ_heaptype) + def $EQREF = REF_reftype(?(NULL_NULL), EQ_heaptype) ;; 1-syntax.watsup def $I31REF : reftype ;; 1-syntax.watsup - def $I31REF = REF_reftype(`NULL%?`_nul(?(())), I31_heaptype) + def $I31REF = REF_reftype(?(NULL_NULL), I31_heaptype) ;; 1-syntax.watsup def $STRUCTREF : reftype ;; 1-syntax.watsup - def $STRUCTREF = REF_reftype(`NULL%?`_nul(?(())), STRUCT_heaptype) + def $STRUCTREF = REF_reftype(?(NULL_NULL), STRUCT_heaptype) ;; 1-syntax.watsup def $ARRAYREF : reftype ;; 1-syntax.watsup - def $ARRAYREF = REF_reftype(`NULL%?`_nul(?(())), ARRAY_heaptype) + def $ARRAYREF = REF_reftype(?(NULL_NULL), ARRAY_heaptype) ;; 1-syntax.watsup def $FUNCREF : reftype ;; 1-syntax.watsup - def $FUNCREF = REF_reftype(`NULL%?`_nul(?(())), FUNC_heaptype) + def $FUNCREF = REF_reftype(?(NULL_NULL), FUNC_heaptype) ;; 1-syntax.watsup def $EXTERNREF : reftype ;; 1-syntax.watsup - def $EXTERNREF = REF_reftype(`NULL%?`_nul(?(())), EXTERN_heaptype) + def $EXTERNREF = REF_reftype(?(NULL_NULL), EXTERN_heaptype) ;; 1-syntax.watsup def $NULLREF : reftype ;; 1-syntax.watsup - def $NULLREF = REF_reftype(`NULL%?`_nul(?(())), NONE_heaptype) + def $NULLREF = REF_reftype(?(NULL_NULL), NONE_heaptype) ;; 1-syntax.watsup def $NULLFUNCREF : reftype ;; 1-syntax.watsup - def $NULLFUNCREF = REF_reftype(`NULL%?`_nul(?(())), NOFUNC_heaptype) + def $NULLFUNCREF = REF_reftype(?(NULL_NULL), NOFUNC_heaptype) ;; 1-syntax.watsup def $NULLEXTERNREF : reftype ;; 1-syntax.watsup - def $NULLEXTERNREF = REF_reftype(`NULL%?`_nul(?(())), NOEXTERN_heaptype) + def $NULLEXTERNREF = REF_reftype(?(NULL_NULL), NOEXTERN_heaptype) ;; 1-syntax.watsup syntax packtype = @@ -9482,12 +636,10 @@ syntax Lnn = | I16 ;; 1-syntax.watsup -syntax mut1 = - | `MUT%?`(()?) +syntax mut1 = MUT? ;; 1-syntax.watsup -syntax mut2 = - | `MUT%?`(()?) +syntax mut2 = MUT? ;; 1-syntax.watsup syntax limits = @@ -9621,28 +773,25 @@ def $unpack(storagetype : storagetype) : valtype def $unpack{packtype : packtype}((packtype : packtype <: storagetype)) = I32_valtype ;; 1-syntax.watsup -def $nunpack(storagetype : storagetype) : numtype? +def $nunpack(storagetype : storagetype) : numtype ;; 1-syntax.watsup - def $nunpack{numtype : numtype}((numtype : numtype <: storagetype)) = ?(numtype) + def $nunpack{numtype : numtype}((numtype : numtype <: storagetype)) = numtype ;; 1-syntax.watsup - def $nunpack{packtype : packtype}((packtype : packtype <: storagetype)) = ?(I32_numtype) - def $nunpack{x0 : storagetype}(x0) = ?() + def $nunpack{packtype : packtype}((packtype : packtype <: storagetype)) = I32_numtype ;; 1-syntax.watsup -def $vunpack(storagetype : storagetype) : vectype? +def $vunpack(storagetype : storagetype) : vectype ;; 1-syntax.watsup - def $vunpack{vectype : vectype}((vectype : vectype <: storagetype)) = ?(vectype) - def $vunpack{x0 : storagetype}(x0) = ?() + def $vunpack{vectype : vectype}((vectype : vectype <: storagetype)) = vectype ;; 1-syntax.watsup -def $cunpack(storagetype : storagetype) : consttype? +def $cunpack(storagetype : storagetype) : consttype ;; 1-syntax.watsup - def $cunpack{consttype : consttype}((consttype : consttype <: storagetype)) = ?(consttype) + def $cunpack{consttype : consttype}((consttype : consttype <: storagetype)) = consttype ;; 1-syntax.watsup - def $cunpack{packtype : packtype}((packtype : packtype <: storagetype)) = ?(I32_consttype) + def $cunpack{packtype : packtype}((packtype : packtype <: storagetype)) = I32_consttype ;; 1-syntax.watsup - def $cunpack{lanetype : lanetype}((lanetype : lanetype <: storagetype)) = ?(($lunpack(lanetype) : numtype <: consttype)) - def $cunpack{x0 : storagetype}(x0) = ?() + def $cunpack{lanetype : lanetype}((lanetype : lanetype <: storagetype)) = ($lunpack(lanetype) : numtype <: consttype) ;; 1-syntax.watsup syntax num_(numtype : numtype) @@ -10187,7 +1336,7 @@ syntax instr = | NOP | UNREACHABLE | DROP - | `SELECT()%?`{`valtype*?` : valtype*?}(valtype*{valtype <- `valtype*`}?{`valtype*` <- `valtype*?`} : valtype*?) + | SELECT{`valtype*?` : valtype*?}(valtype*{valtype <- `valtype*`}?{`valtype*` <- `valtype*?`} : valtype*?) | BLOCK{blocktype : blocktype, `instr*` : instr*}(blocktype : blocktype, instr*{instr <- `instr*`} : instr*) | LOOP{blocktype : blocktype, `instr*` : instr*}(blocktype : blocktype, instr*{instr <- `instr*`} : instr*) | `IF%%ELSE%`{blocktype : blocktype, `instr*` : instr*}(blocktype : blocktype, instr*{instr <- `instr*`} : instr*, instr*) @@ -10477,9 +1626,9 @@ def $minat(addrtype : addrtype, addrtype : addrtype) : addrtype ;; 2-syntax-aux.watsup def $diffrt(reftype : reftype, reftype : reftype) : reftype ;; 2-syntax-aux.watsup - def $diffrt{nul1 : nul1, ht_1 : heaptype, ht_2 : heaptype}(REF_reftype(nul1, ht_1), REF_reftype(`NULL%?`_nul(?(())), ht_2)) = REF_reftype(`NULL%?`_nul(?()), ht_1) + def $diffrt{nul1 : nul1, ht_1 : heaptype, ht_2 : heaptype}(REF_reftype(nul1, ht_1), REF_reftype(?(NULL_NULL), ht_2)) = REF_reftype(?(), ht_1) ;; 2-syntax-aux.watsup - def $diffrt{nul1 : nul1, ht_1 : heaptype, ht_2 : heaptype}(REF_reftype(nul1, ht_1), REF_reftype(`NULL%?`_nul(?()), ht_2)) = REF_reftype(nul1, ht_1) + def $diffrt{nul1 : nul1, ht_1 : heaptype, ht_2 : heaptype}(REF_reftype(nul1, ht_1), REF_reftype(?(), ht_2)) = REF_reftype(nul1, ht_1) ;; 2-syntax-aux.watsup rec { @@ -11089,9 +2238,9 @@ def $shift_labelidxs(labelidx*) : labelidx* ;; 2-syntax-aux.watsup:585.1-585.32 def $shift_labelidxs([]) = [] ;; 2-syntax-aux.watsup:586.1-586.66 - def $shift_labelidxs{`labelidx'*` : labelidx*}([`%`_uN(0)] ++ labelidx'*{labelidx' <- `labelidx'*`}) = $shift_labelidxs(labelidx'*{labelidx' <- `labelidx'*`}) + def $shift_labelidxs{`labelidx'*` : labelidx*}([`%`_labelidx(0)] ++ labelidx'*{labelidx' <- `labelidx'*`}) = $shift_labelidxs(labelidx'*{labelidx' <- `labelidx'*`}) ;; 2-syntax-aux.watsup:587.1-587.91 - def $shift_labelidxs{labelidx : labelidx, `labelidx'*` : labelidx*}([labelidx] ++ labelidx'*{labelidx' <- `labelidx'*`}) = [`%`_uN((((labelidx!`%`_labelidx.0 : nat <:> int) - (1 : nat <:> int)) : int <:> nat))] ++ $shift_labelidxs(labelidx'*{labelidx' <- `labelidx'*`}) + def $shift_labelidxs{labelidx : labelidx, `labelidx'*` : labelidx*}([labelidx] ++ labelidx'*{labelidx' <- `labelidx'*`}) = [`%`_labelidx((((labelidx!`%`_labelidx.0 : nat <:> int) - (1 : nat <:> int)) : int <:> nat))] ++ $shift_labelidxs(labelidx'*{labelidx' <- `labelidx'*`}) } ;; 2-syntax-aux.watsup @@ -11106,7 +2255,7 @@ def $free_instr(instr : instr) : free ;; 2-syntax-aux.watsup:444.1-444.27 def $free_instr(DROP_instr) = {TYPES [], FUNCS [], GLOBALS [], TABLES [], MEMS [], ELEMS [], DATAS [], LOCALS [], LABELS []} ;; 2-syntax-aux.watsup:445.1-445.86 - def $free_instr{`valtype*?` : valtype*?}(`SELECT()%?`_instr(valtype*{valtype <- `valtype*`}?{`valtype*` <- `valtype*?`})) = $free_opt($free_list($free_valtype(valtype)*{valtype <- `valtype*`})?{`valtype*` <- `valtype*?`}) + def $free_instr{`valtype*?` : valtype*?}(SELECT_instr(valtype*{valtype <- `valtype*`}?{`valtype*` <- `valtype*?`})) = $free_opt($free_list($free_valtype(valtype)*{valtype <- `valtype*`})?{`valtype*` <- `valtype*?`}) ;; 2-syntax-aux.watsup:447.1-447.92 def $free_instr{blocktype : blocktype, `instr*` : instr*}(BLOCK_instr(blocktype, instr*{instr <- `instr*`})) = $free_blocktype(blocktype) +++ $free_block(instr*{instr <- `instr*`}) ;; 2-syntax-aux.watsup:448.1-448.91 @@ -11507,7 +2656,7 @@ relation Heaptype_ok: `%|-%:OK`(context, heaptype) relation Reftype_ok: `%|-%:OK`(context, reftype) ;; 3-typing.watsup rule _{C : context, heaptype : heaptype}: - `%|-%:OK`(C, REF_reftype(`NULL%?`_nul(()?{}), heaptype)) + `%|-%:OK`(C, REF_reftype(NULL_NULL?{}, heaptype)) -- Heaptype_ok: `%|-%:OK`(C, heaptype) ;; 3-typing.watsup @@ -11577,7 +2726,7 @@ relation Storagetype_ok: `%|-%:OK`(context, storagetype) relation Fieldtype_ok: `%|-%:OK`(context, fieldtype) ;; 3-typing.watsup rule _{C : context, storagetype : storagetype}: - `%|-%:OK`(C, `%%`_fieldtype(`MUT%?`_mut(()?{}), storagetype)) + `%|-%:OK`(C, `%%`_fieldtype(MUT_MUT?{}, storagetype)) -- Storagetype_ok: `%|-%:OK`(C, storagetype) ;; 3-typing.watsup @@ -11721,12 +2870,12 @@ relation Heaptype_sub: `%|-%<:%`(context, heaptype, heaptype) relation Reftype_sub: `%|-%<:%`(context, reftype, reftype) ;; 3-typing.watsup rule nonnull{C : context, ht_1 : heaptype, ht_2 : heaptype}: - `%|-%<:%`(C, REF_reftype(`NULL%?`_nul(?()), ht_1), REF_reftype(`NULL%?`_nul(?()), ht_2)) + `%|-%<:%`(C, REF_reftype(?(), ht_1), REF_reftype(?(), ht_2)) -- Heaptype_sub: `%|-%<:%`(C, ht_1, ht_2) ;; 3-typing.watsup rule null{C : context, ht_1 : heaptype, ht_2 : heaptype}: - `%|-%<:%`(C, REF_reftype(`NULL%?`_nul(()?{}), ht_1), REF_reftype(`NULL%?`_nul(?(())), ht_2)) + `%|-%<:%`(C, REF_reftype(NULL_NULL?{}, ht_1), REF_reftype(?(NULL_NULL), ht_2)) -- Heaptype_sub: `%|-%<:%`(C, ht_1, ht_2) ;; 3-typing.watsup @@ -11772,12 +2921,12 @@ relation Storagetype_sub: `%|-%<:%`(context, storagetype, storagetype) relation Fieldtype_sub: `%|-%<:%`(context, fieldtype, fieldtype) ;; 3-typing.watsup rule const{C : context, zt_1 : storagetype, zt_2 : storagetype}: - `%|-%<:%`(C, `%%`_fieldtype(`MUT%?`_mut(?()), zt_1), `%%`_fieldtype(`MUT%?`_mut(?()), zt_2)) + `%|-%<:%`(C, `%%`_fieldtype(?(), zt_1), `%%`_fieldtype(?(), zt_2)) -- Storagetype_sub: `%|-%<:%`(C, zt_1, zt_2) ;; 3-typing.watsup rule var{C : context, zt_1 : storagetype, zt_2 : storagetype}: - `%|-%<:%`(C, `%%`_fieldtype(`MUT%?`_mut(?(())), zt_1), `%%`_fieldtype(`MUT%?`_mut(?(())), zt_2)) + `%|-%<:%`(C, `%%`_fieldtype(?(MUT_MUT), zt_1), `%%`_fieldtype(?(MUT_MUT), zt_2)) -- Storagetype_sub: `%|-%<:%`(C, zt_1, zt_2) -- Storagetype_sub: `%|-%<:%`(C, zt_2, zt_1) @@ -11817,10 +2966,10 @@ relation Comptype_sub: `%|-%<:%`(context, comptype, comptype) relation Subtype_ok: `%|-%:%`(context, subtype, oktypeidx) ;; 3-typing.watsup rule _{C : context, `x*` : idx*, comptype : comptype, x_0 : idx, `x'**` : idx**, `comptype'*` : comptype*}: - `%|-%:%`(C, SUB_subtype(`FINAL%?`_fin(()?{}), _IDX_typeuse(x)*{x <- `x*`}, comptype), OK_oktypeidx(x_0)) + `%|-%:%`(C, SUB_subtype(FINAL_FINAL?{}, _IDX_typeuse(x)*{x <- `x*`}, comptype), OK_oktypeidx(x_0)) -- if (|x*{x <- `x*`}| <= 1) -- (if (x!`%`_idx.0 < x_0!`%`_idx.0))*{x <- `x*`} - -- (if ($unrolldt(C.TYPES_context[x!`%`_idx.0]) = SUB_subtype(`FINAL%?`_fin(?()), _IDX_typeuse(x')*{x' <- `x'*`}, comptype')))*{comptype' <- `comptype'*`, x <- `x*`, `x'*` <- `x'**`} + -- (if ($unrolldt(C.TYPES_context[x!`%`_idx.0]) = SUB_subtype(?(), _IDX_typeuse(x')*{x' <- `x'*`}, comptype')))*{comptype' <- `comptype'*`, x <- `x*`, `x'*` <- `x'**`} -- Comptype_ok: `%|-%:OK`(C, comptype) -- (Comptype_sub: `%|-%<:%`(C, comptype, comptype'))*{comptype' <- `comptype'*`} @@ -11846,10 +2995,10 @@ def $unrollht(context : context, heaptype : heaptype) : subtype relation Subtype_ok2: `%|-%:%`(context, subtype, oktypeidxnat) ;; 3-typing.watsup rule _{C : context, `typeuse*` : typeuse*, compttype : comptype, x : idx, i : nat, `typeuse'**` : typeuse**, `comptype'*` : comptype*, comptype : comptype}: - `%|-%:%`(C, SUB_subtype(`FINAL%?`_fin(()?{}), typeuse*{typeuse <- `typeuse*`}, compttype), OK_oktypeidxnat(x, i)) + `%|-%:%`(C, SUB_subtype(FINAL_FINAL?{}, typeuse*{typeuse <- `typeuse*`}, compttype), OK_oktypeidxnat(x, i)) -- if (|typeuse*{typeuse <- `typeuse*`}| <= 1) -- (if $before(typeuse, x, i))*{typeuse <- `typeuse*`} - -- (if ($unrollht(C, (typeuse : typeuse <: heaptype)) = SUB_subtype(`FINAL%?`_fin(?()), typeuse'*{typeuse' <- `typeuse'*`}, comptype')))*{comptype' <- `comptype'*`, typeuse <- `typeuse*`, `typeuse'*` <- `typeuse'**`} + -- (if ($unrollht(C, (typeuse : typeuse <: heaptype)) = SUB_subtype(?(), typeuse'*{typeuse' <- `typeuse'*`}, comptype')))*{comptype' <- `comptype'*`, typeuse <- `typeuse*`, `typeuse'*` <- `typeuse'**`} -- Comptype_ok: `%|-%:OK`(C, comptype) -- (Comptype_sub: `%|-%<:%`(C, comptype, comptype'))*{comptype' <- `comptype'*`} @@ -11910,7 +3059,7 @@ relation Limits_ok: `%|-%:%`(context, limits, nat) relation Globaltype_ok: `%|-%:OK`(context, globaltype) ;; 3-typing.watsup rule _{C : context, t : valtype}: - `%|-%:OK`(C, `%%`_globaltype(`MUT%?`_mut(()?{}), t)) + `%|-%:OK`(C, `%%`_globaltype(MUT_MUT?{}, t)) -- Valtype_ok: `%|-%:OK`(C, t) ;; 3-typing.watsup @@ -11986,12 +3135,12 @@ relation Limits_sub: `%|-%<:%`(context, limits, limits) relation Globaltype_sub: `%|-%<:%`(context, globaltype, globaltype) ;; 3-typing.watsup rule const{C : context, valtype_1 : valtype, valtype_2 : valtype}: - `%|-%<:%`(C, `%%`_globaltype(`MUT%?`_mut(?()), valtype_1), `%%`_globaltype(`MUT%?`_mut(?()), valtype_2)) + `%|-%<:%`(C, `%%`_globaltype(?(), valtype_1), `%%`_globaltype(?(), valtype_2)) -- Valtype_sub: `%|-%<:%`(C, valtype_1, valtype_2) ;; 3-typing.watsup rule var{C : context, valtype_1 : valtype, valtype_2 : valtype}: - `%|-%<:%`(C, `%%`_globaltype(`MUT%?`_mut(?(())), valtype_1), `%%`_globaltype(`MUT%?`_mut(?(())), valtype_2)) + `%|-%<:%`(C, `%%`_globaltype(?(MUT_MUT), valtype_1), `%%`_globaltype(?(MUT_MUT), valtype_2)) -- Valtype_sub: `%|-%<:%`(C, valtype_1, valtype_2) -- Valtype_sub: `%|-%<:%`(C, valtype_2, valtype_1) @@ -12070,7 +3219,7 @@ relation Catch_ok: `%|-%:OK`(context, catch) rule catch_ref{C : context, x : idx, l : labelidx, `t*` : valtype*}: `%|-%:OK`(C, CATCH_REF_catch(x, l)) -- Expand: `%~~%`(C.TAGS_context[x!`%`_idx.0], FUNC_comptype(`%->%`_functype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([])))) - -- Resulttype_sub: `%|-%<:%`(C, t*{t <- `t*`} ++ [REF_valtype(`NULL%?`_nul(?()), EXN_heaptype)], C.LABELS_context[l!`%`_labelidx.0]!`%`_resulttype.0) + -- Resulttype_sub: `%|-%<:%`(C, t*{t <- `t*`} ++ [REF_valtype(?(), EXN_heaptype)], C.LABELS_context[l!`%`_labelidx.0]!`%`_resulttype.0) ;; 3-typing.watsup rule catch_all{C : context, l : labelidx}: @@ -12080,7 +3229,7 @@ relation Catch_ok: `%|-%:OK`(context, catch) ;; 3-typing.watsup rule catch_all_ref{C : context, l : labelidx}: `%|-%:OK`(C, CATCH_ALL_REF_catch(l)) - -- Resulttype_sub: `%|-%<:%`(C, [REF_valtype(`NULL%?`_nul(?()), EXN_heaptype)], C.LABELS_context[l!`%`_labelidx.0]!`%`_resulttype.0) + -- Resulttype_sub: `%|-%<:%`(C, [REF_valtype(?(), EXN_heaptype)], C.LABELS_context[l!`%`_labelidx.0]!`%`_resulttype.0) ;; 6-runtime-aux.watsup def $default_(valtype : valtype) : val? @@ -12091,9 +3240,9 @@ def $default_(valtype : valtype) : val? ;; 6-runtime-aux.watsup def $default_{Vnn : Vnn}((Vnn : Vnn <: valtype)) = ?(VCONST_val(Vnn, `%`_vec_(0))) ;; 6-runtime-aux.watsup - def $default_{ht : heaptype}(REF_valtype(`NULL%?`_nul(?(())), ht)) = ?(REF.NULL_val(ht)) + def $default_{ht : heaptype}(REF_valtype(?(NULL_NULL), ht)) = ?(REF.NULL_val(ht)) ;; 6-runtime-aux.watsup - def $default_{ht : heaptype}(REF_valtype(`NULL%?`_nul(?()), ht)) = ?() + def $default_{ht : heaptype}(REF_valtype(?(), ht)) = ?() ;; 3-typing.watsup relation Defaultable: `|-%DEFAULTABLE`(valtype) @@ -12123,12 +3272,12 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) ;; 3-typing.watsup:580.1-582.29 rule `select-expl`{C : context, t : valtype}: - `%|-%:%`(C, `SELECT()%?`_instr(?([t])), `%->_%%`_instrtype(`%`_resulttype([t t I32_valtype]), [], `%`_resulttype([t]))) + `%|-%:%`(C, SELECT_instr(?([t])), `%->_%%`_instrtype(`%`_resulttype([t t I32_valtype]), [], `%`_resulttype([t]))) -- Valtype_ok: `%|-%:OK`(C, t) ;; 3-typing.watsup:584.1-588.37 rule `select-impl`{C : context, t : valtype, t' : valtype, numtype : numtype, vectype : vectype}: - `%|-%:%`(C, `SELECT()%?`_instr(?()), `%->_%%`_instrtype(`%`_resulttype([t t I32_valtype]), [], `%`_resulttype([t]))) + `%|-%:%`(C, SELECT_instr(?()), `%->_%%`_instrtype(`%`_resulttype([t t I32_valtype]), [], `%`_resulttype([t]))) -- Valtype_ok: `%|-%:OK`(C, t) -- Valtype_sub: `%|-%<:%`(C, t, t') -- if ((t' = (numtype : numtype <: valtype)) \/ (t' = (vectype : vectype <: valtype))) @@ -12172,14 +3321,14 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) ;; 3-typing.watsup:638.1-641.31 rule br_on_null{C : context, l : labelidx, `t*` : valtype*, ht : heaptype}: - `%|-%:%`(C, BR_ON_NULL_instr(l), `%->_%%`_instrtype(`%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(`NULL%?`_nul(?(())), ht)]), [], `%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(`NULL%?`_nul(?()), ht)]))) + `%|-%:%`(C, BR_ON_NULL_instr(l), `%->_%%`_instrtype(`%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(?(NULL_NULL), ht)]), [], `%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(?(), ht)]))) -- if (C.LABELS_context[l!`%`_labelidx.0]!`%`_resulttype.0 = t*{t <- `t*`}) -- Heaptype_ok: `%|-%:OK`(C, ht) ;; 3-typing.watsup:643.1-645.34 rule br_on_non_null{C : context, l : labelidx, `t*` : valtype*, ht : heaptype}: - `%|-%:%`(C, BR_ON_NON_NULL_instr(l), `%->_%%`_instrtype(`%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(`NULL%?`_nul(?(())), ht)]), [], `%`_resulttype(t*{t <- `t*`}))) - -- if (C.LABELS_context[l!`%`_labelidx.0] = `%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(`NULL%?`_nul(?()), ht)])) + `%|-%:%`(C, BR_ON_NON_NULL_instr(l), `%->_%%`_instrtype(`%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(?(NULL_NULL), ht)]), [], `%`_resulttype(t*{t <- `t*`}))) + -- if (C.LABELS_context[l!`%`_labelidx.0] = `%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(?(), ht)])) ;; 3-typing.watsup:647.1-653.34 rule br_on_cast{C : context, l : labelidx, rt_1 : reftype, rt_2 : reftype, `t*` : valtype*, rt : reftype}: @@ -12206,35 +3355,35 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) ;; 3-typing.watsup:670.1-672.47 rule call_ref{C : context, x : idx, `t_1*` : valtype*, `t_2*` : valtype*}: - `%|-%:%`(C, CALL_REF_instr(_IDX_typeuse(x)), `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`} ++ [REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x))]), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) + `%|-%:%`(C, CALL_REF_instr(_IDX_typeuse(x)), `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`} ++ [REF_valtype(?(NULL_NULL), _IDX_heaptype(x))]), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], FUNC_comptype(`%->%`_functype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`})))) ;; 3-typing.watsup:674.1-678.47 rule call_indirect{C : context, x : idx, y : idx, `t_1*` : valtype*, at : addrtype, `t_2*` : valtype*, lim : limits, rt : reftype}: `%|-%:%`(C, CALL_INDIRECT_instr(x, _IDX_typeuse(y)), `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`} ++ [(at : addrtype <: valtype)]), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) -- if (C.TABLES_context[x!`%`_idx.0] = `%%%`_tabletype(at, lim, rt)) - -- Reftype_sub: `%|-%<:%`(C, rt, REF_reftype(`NULL%?`_nul(?(())), FUNC_heaptype)) + -- Reftype_sub: `%|-%<:%`(C, rt, REF_reftype(?(NULL_NULL), FUNC_heaptype)) -- Expand: `%~~%`(C.TYPES_context[y!`%`_idx.0], FUNC_comptype(`%->%`_functype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`})))) ;; 3-typing.watsup:680.1-683.42 rule return{C : context, `t_1*` : valtype*, `t*` : valtype*, `t_2*` : valtype*}: `%|-%:%`(C, RETURN_instr, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`} ++ t*{t <- `t*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) - -- if (C.RETURN_context = ?(`%`_list(t*{t <- `t*`}))) + -- if (C.RETURN_context = ?(`%`_resulttype(t*{t <- `t*`}))) -- Instrtype_ok: `%|-%:OK`(C, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) ;; 3-typing.watsup:686.1-691.42 rule return_call{C : context, x : idx, `t_3*` : valtype*, `t_1*` : valtype*, `t_4*` : valtype*, `t_2*` : valtype*, `t'_2*` : valtype*}: `%|-%:%`(C, RETURN_CALL_instr(x), `%->_%%`_instrtype(`%`_resulttype(t_3*{t_3 <- `t_3*`} ++ t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_4*{t_4 <- `t_4*`}))) -- Expand: `%~~%`(C.FUNCS_context[x!`%`_idx.0], FUNC_comptype(`%->%`_functype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`})))) - -- if (C.RETURN_context = ?(`%`_list(t'_2*{t'_2 <- `t'_2*`}))) + -- if (C.RETURN_context = ?(`%`_resulttype(t'_2*{t'_2 <- `t'_2*`}))) -- Resulttype_sub: `%|-%<:%`(C, t_2*{t_2 <- `t_2*`}, t'_2*{t'_2 <- `t'_2*`}) -- Instrtype_ok: `%|-%:OK`(C, `%->_%%`_instrtype(`%`_resulttype(t_3*{t_3 <- `t_3*`}), [], `%`_resulttype(t_4*{t_4 <- `t_4*`}))) ;; 3-typing.watsup:694.1-699.42 rule return_call_ref{C : context, x : idx, `t_3*` : valtype*, `t_1*` : valtype*, `t_4*` : valtype*, `t_2*` : valtype*, `t'_2*` : valtype*}: - `%|-%:%`(C, RETURN_CALL_REF_instr(_IDX_typeuse(x)), `%->_%%`_instrtype(`%`_resulttype(t_3*{t_3 <- `t_3*`} ++ t_1*{t_1 <- `t_1*`} ++ [REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x))]), [], `%`_resulttype(t_4*{t_4 <- `t_4*`}))) + `%|-%:%`(C, RETURN_CALL_REF_instr(_IDX_typeuse(x)), `%->_%%`_instrtype(`%`_resulttype(t_3*{t_3 <- `t_3*`} ++ t_1*{t_1 <- `t_1*`} ++ [REF_valtype(?(NULL_NULL), _IDX_heaptype(x))]), [], `%`_resulttype(t_4*{t_4 <- `t_4*`}))) -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], FUNC_comptype(`%->%`_functype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`})))) - -- if (C.RETURN_context = ?(`%`_list(t'_2*{t'_2 <- `t'_2*`}))) + -- if (C.RETURN_context = ?(`%`_resulttype(t'_2*{t'_2 <- `t'_2*`}))) -- Resulttype_sub: `%|-%<:%`(C, t_2*{t_2 <- `t_2*`}, t'_2*{t'_2 <- `t'_2*`}) -- Instrtype_ok: `%|-%:OK`(C, `%->_%%`_instrtype(`%`_resulttype(t_3*{t_3 <- `t_3*`}), [], `%`_resulttype(t_4*{t_4 <- `t_4*`}))) @@ -12242,9 +3391,9 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) rule return_call_indirect{C : context, x : idx, y : idx, `t_3*` : valtype*, `t_1*` : valtype*, at : addrtype, `t_4*` : valtype*, lim : limits, rt : reftype, `t_2*` : valtype*, `t'_2*` : valtype*}: `%|-%:%`(C, RETURN_CALL_INDIRECT_instr(x, _IDX_typeuse(y)), `%->_%%`_instrtype(`%`_resulttype(t_3*{t_3 <- `t_3*`} ++ t_1*{t_1 <- `t_1*`} ++ [(at : addrtype <: valtype)]), [], `%`_resulttype(t_4*{t_4 <- `t_4*`}))) -- if (C.TABLES_context[x!`%`_idx.0] = `%%%`_tabletype(at, lim, rt)) - -- Reftype_sub: `%|-%<:%`(C, rt, REF_reftype(`NULL%?`_nul(?(())), FUNC_heaptype)) + -- Reftype_sub: `%|-%<:%`(C, rt, REF_reftype(?(NULL_NULL), FUNC_heaptype)) -- Expand: `%~~%`(C.TYPES_context[y!`%`_idx.0], FUNC_comptype(`%->%`_functype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`})))) - -- if (C.RETURN_context = ?(`%`_list(t'_2*{t'_2 <- `t'_2*`}))) + -- if (C.RETURN_context = ?(`%`_resulttype(t'_2*{t'_2 <- `t'_2*`}))) -- Resulttype_sub: `%|-%<:%`(C, t_2*{t_2 <- `t_2*`}, t'_2*{t'_2 <- `t'_2*`}) -- Instrtype_ok: `%|-%:OK`(C, `%->_%%`_instrtype(`%`_resulttype(t_3*{t_3 <- `t_3*`}), [], `%`_resulttype(t_4*{t_4 <- `t_4*`}))) @@ -12256,7 +3405,7 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) ;; 3-typing.watsup:722.1-724.42 rule throw_ref{C : context, `t_1*` : valtype*, `t_2*` : valtype*}: - `%|-%:%`(C, THROW_REF_instr, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`} ++ [REF_valtype(`NULL%?`_nul(?(())), EXN_heaptype)]), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) + `%|-%:%`(C, THROW_REF_instr, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`} ++ [REF_valtype(?(NULL_NULL), EXN_heaptype)]), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) -- Instrtype_ok: `%|-%:OK`(C, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) ;; 3-typing.watsup:726.1-730.34 @@ -12292,32 +3441,32 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) ;; 3-typing.watsup:774.1-776.31 rule ref.null{C : context, ht : heaptype}: - `%|-%:%`(C, REF.NULL_instr(ht), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), ht)]))) + `%|-%:%`(C, REF.NULL_instr(ht), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([REF_valtype(?(NULL_NULL), ht)]))) -- Heaptype_ok: `%|-%:OK`(C, ht) ;; 3-typing.watsup:778.1-781.20 rule ref.func{C : context, x : idx, dt : deftype}: - `%|-%:%`(C, REF.FUNC_instr(x), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), (dt : deftype <: heaptype))]))) + `%|-%:%`(C, REF.FUNC_instr(x), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([REF_valtype(?(), (dt : deftype <: heaptype))]))) -- if (C.FUNCS_context[x!`%`_idx.0] = dt) -- if x <- C.REFS_context ;; 3-typing.watsup:783.1-784.34 rule ref.i31{C : context}: - `%|-%:%`(C, REF.I31_instr, `%->_%%`_instrtype(`%`_resulttype([I32_valtype]), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), I31_heaptype)]))) + `%|-%:%`(C, REF.I31_instr, `%->_%%`_instrtype(`%`_resulttype([I32_valtype]), [], `%`_resulttype([REF_valtype(?(), I31_heaptype)]))) ;; 3-typing.watsup:786.1-788.31 rule ref.is_null{C : context, ht : heaptype}: - `%|-%:%`(C, REF.IS_NULL_instr, `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), ht)]), [], `%`_resulttype([I32_valtype]))) + `%|-%:%`(C, REF.IS_NULL_instr, `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), ht)]), [], `%`_resulttype([I32_valtype]))) -- Heaptype_ok: `%|-%:OK`(C, ht) ;; 3-typing.watsup:790.1-792.31 rule ref.as_non_null{C : context, ht : heaptype}: - `%|-%:%`(C, REF.AS_NON_NULL_instr, `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), ht)]), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), ht)]))) + `%|-%:%`(C, REF.AS_NON_NULL_instr, `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), ht)]), [], `%`_resulttype([REF_valtype(?(), ht)]))) -- Heaptype_ok: `%|-%:OK`(C, ht) ;; 3-typing.watsup:794.1-795.51 rule ref.eq{C : context}: - `%|-%:%`(C, REF.EQ_instr, `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), EQ_heaptype) REF_valtype(`NULL%?`_nul(?(())), EQ_heaptype)]), [], `%`_resulttype([I32_valtype]))) + `%|-%:%`(C, REF.EQ_instr, `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), EQ_heaptype) REF_valtype(?(NULL_NULL), EQ_heaptype)]), [], `%`_resulttype([I32_valtype]))) ;; 3-typing.watsup:797.1-801.33 rule ref.test{C : context, rt : reftype, rt' : reftype}: @@ -12335,98 +3484,98 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) ;; 3-typing.watsup:812.1-813.42 rule i31.get{C : context, sx : sx}: - `%|-%:%`(C, I31.GET_instr(sx), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), I31_heaptype)]), [], `%`_resulttype([I32_valtype]))) + `%|-%:%`(C, I31.GET_instr(sx), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), I31_heaptype)]), [], `%`_resulttype([I32_valtype]))) ;; 3-typing.watsup:818.1-820.44 rule struct.new{C : context, x : idx, `zt*` : storagetype*, `mut*` : mut*}: - `%|-%:%`(C, STRUCT.NEW_instr(x), `%->_%%`_instrtype(`%`_resulttype($unpack(zt)*{zt <- `zt*`}), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), _IDX_heaptype(x))]))) + `%|-%:%`(C, STRUCT.NEW_instr(x), `%->_%%`_instrtype(`%`_resulttype($unpack(zt)*{zt <- `zt*`}), [], `%`_resulttype([REF_valtype(?(), _IDX_heaptype(x))]))) -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], STRUCT_comptype(`%`_structtype(`%%`_fieldtype(mut, zt)*{mut <- `mut*`, zt <- `zt*`}))) ;; 3-typing.watsup:822.1-825.48 rule struct.new_default{C : context, x : idx, `mut*` : mut*, `zt*` : storagetype*}: - `%|-%:%`(C, STRUCT.NEW_DEFAULT_instr(x), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), _IDX_heaptype(x))]))) + `%|-%:%`(C, STRUCT.NEW_DEFAULT_instr(x), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([REF_valtype(?(), _IDX_heaptype(x))]))) -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], STRUCT_comptype(`%`_structtype(`%%`_fieldtype(mut, zt)*{mut <- `mut*`, zt <- `zt*`}))) -- (Defaultable: `|-%DEFAULTABLE`($unpack(zt)))*{zt <- `zt*`} ;; 3-typing.watsup:827.1-831.39 rule struct.get{C : context, `sx?` : sx?, x : idx, i : u32, zt : storagetype, `yt*` : fieldtype*, mut : mut}: - `%|-%:%`(C, STRUCT.GET_instr(sx?{sx <- `sx?`}, x, i), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x))]), [], `%`_resulttype([$unpack(zt)]))) + `%|-%:%`(C, STRUCT.GET_instr(sx?{sx <- `sx?`}, x, i), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), _IDX_heaptype(x))]), [], `%`_resulttype([$unpack(zt)]))) -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], STRUCT_comptype(`%`_structtype(yt*{yt <- `yt*`}))) -- if (yt*{yt <- `yt*`}[i!`%`_u32.0] = `%%`_fieldtype(mut, zt)) -- if ((sx?{sx <- `sx?`} = ?()) <=> (zt = ($unpack(zt) : valtype <: storagetype))) ;; 3-typing.watsup:833.1-836.24 rule struct.set{C : context, x : idx, i : u32, zt : storagetype, `yt*` : fieldtype*}: - `%|-%:%`(C, STRUCT.SET_instr(x, i), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x)) $unpack(zt)]), [], `%`_resulttype([]))) + `%|-%:%`(C, STRUCT.SET_instr(x, i), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), _IDX_heaptype(x)) $unpack(zt)]), [], `%`_resulttype([]))) -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], STRUCT_comptype(`%`_structtype(yt*{yt <- `yt*`}))) - -- if (yt*{yt <- `yt*`}[i!`%`_u32.0] = `%%`_fieldtype(`MUT%?`_mut(?(())), zt)) + -- if (yt*{yt <- `yt*`}[i!`%`_u32.0] = `%%`_fieldtype(?(MUT_MUT), zt)) ;; 3-typing.watsup:841.1-843.42 rule array.new{C : context, x : idx, zt : storagetype, mut : mut}: - `%|-%:%`(C, ARRAY.NEW_instr(x), `%->_%%`_instrtype(`%`_resulttype([$unpack(zt) I32_valtype]), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), _IDX_heaptype(x))]))) + `%|-%:%`(C, ARRAY.NEW_instr(x), `%->_%%`_instrtype(`%`_resulttype([$unpack(zt) I32_valtype]), [], `%`_resulttype([REF_valtype(?(), _IDX_heaptype(x))]))) -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(mut, zt))) ;; 3-typing.watsup:845.1-848.45 rule array.new_default{C : context, x : idx, mut : mut, zt : storagetype}: - `%|-%:%`(C, ARRAY.NEW_DEFAULT_instr(x), `%->_%%`_instrtype(`%`_resulttype([I32_valtype]), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), _IDX_heaptype(x))]))) + `%|-%:%`(C, ARRAY.NEW_DEFAULT_instr(x), `%->_%%`_instrtype(`%`_resulttype([I32_valtype]), [], `%`_resulttype([REF_valtype(?(), _IDX_heaptype(x))]))) -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(mut, zt))) -- Defaultable: `|-%DEFAULTABLE`($unpack(zt)) ;; 3-typing.watsup:850.1-852.42 rule array.new_fixed{C : context, x : idx, n : n, zt : storagetype, mut : mut}: - `%|-%:%`(C, ARRAY.NEW_FIXED_instr(x, `%`_u32(n)), `%->_%%`_instrtype(`%`_resulttype($unpack(zt)^n{}), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), _IDX_heaptype(x))]))) + `%|-%:%`(C, ARRAY.NEW_FIXED_instr(x, `%`_u32(n)), `%->_%%`_instrtype(`%`_resulttype($unpack(zt)^n{}), [], `%`_resulttype([REF_valtype(?(), _IDX_heaptype(x))]))) -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(mut, zt))) ;; 3-typing.watsup:854.1-857.40 rule array.new_elem{C : context, x : idx, y : idx, mut : mut, rt : reftype}: - `%|-%:%`(C, ARRAY.NEW_ELEM_instr(x, y), `%->_%%`_instrtype(`%`_resulttype([I32_valtype I32_valtype]), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), _IDX_heaptype(x))]))) + `%|-%:%`(C, ARRAY.NEW_ELEM_instr(x, y), `%->_%%`_instrtype(`%`_resulttype([I32_valtype I32_valtype]), [], `%`_resulttype([REF_valtype(?(), _IDX_heaptype(x))]))) -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(mut, (rt : reftype <: storagetype)))) -- Reftype_sub: `%|-%<:%`(C, C.ELEMS_context[y!`%`_idx.0], rt) ;; 3-typing.watsup:859.1-863.24 rule array.new_data{C : context, x : idx, y : idx, mut : mut, zt : storagetype, numtype : numtype, vectype : vectype}: - `%|-%:%`(C, ARRAY.NEW_DATA_instr(x, y), `%->_%%`_instrtype(`%`_resulttype([I32_valtype I32_valtype]), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), _IDX_heaptype(x))]))) + `%|-%:%`(C, ARRAY.NEW_DATA_instr(x, y), `%->_%%`_instrtype(`%`_resulttype([I32_valtype I32_valtype]), [], `%`_resulttype([REF_valtype(?(), _IDX_heaptype(x))]))) -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(mut, zt))) -- if (($unpack(zt) = (numtype : numtype <: valtype)) \/ ($unpack(zt) = (vectype : vectype <: valtype))) -- if (C.DATAS_context[y!`%`_idx.0] = OK_datatype) ;; 3-typing.watsup:865.1-868.39 rule array.get{C : context, `sx?` : sx?, x : idx, zt : storagetype, mut : mut}: - `%|-%:%`(C, ARRAY.GET_instr(sx?{sx <- `sx?`}, x), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x)) I32_valtype]), [], `%`_resulttype([$unpack(zt)]))) + `%|-%:%`(C, ARRAY.GET_instr(sx?{sx <- `sx?`}, x), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), _IDX_heaptype(x)) I32_valtype]), [], `%`_resulttype([$unpack(zt)]))) -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(mut, zt))) -- if ((sx?{sx <- `sx?`} = ?()) <=> (zt = ($unpack(zt) : valtype <: storagetype))) ;; 3-typing.watsup:870.1-872.42 rule array.set{C : context, x : idx, zt : storagetype}: - `%|-%:%`(C, ARRAY.SET_instr(x), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x)) I32_valtype $unpack(zt)]), [], `%`_resulttype([]))) - -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(`MUT%?`_mut(?(())), zt))) + `%|-%:%`(C, ARRAY.SET_instr(x), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), _IDX_heaptype(x)) I32_valtype $unpack(zt)]), [], `%`_resulttype([]))) + -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(?(MUT_MUT), zt))) ;; 3-typing.watsup:874.1-875.43 rule array.len{C : context}: - `%|-%:%`(C, ARRAY.LEN_instr, `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), ARRAY_heaptype)]), [], `%`_resulttype([I32_valtype]))) + `%|-%:%`(C, ARRAY.LEN_instr, `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), ARRAY_heaptype)]), [], `%`_resulttype([I32_valtype]))) ;; 3-typing.watsup:877.1-879.42 rule array.fill{C : context, x : idx, zt : storagetype}: - `%|-%:%`(C, ARRAY.FILL_instr(x), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x)) I32_valtype $unpack(zt) I32_valtype]), [], `%`_resulttype([]))) - -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(`MUT%?`_mut(?(())), zt))) + `%|-%:%`(C, ARRAY.FILL_instr(x), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), _IDX_heaptype(x)) I32_valtype $unpack(zt) I32_valtype]), [], `%`_resulttype([]))) + -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(?(MUT_MUT), zt))) ;; 3-typing.watsup:881.1-885.40 rule array.copy{C : context, x_1 : idx, x_2 : idx, zt_1 : storagetype, mut : mut, zt_2 : storagetype}: - `%|-%:%`(C, ARRAY.COPY_instr(x_1, x_2), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x_1)) I32_valtype REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x_2)) I32_valtype I32_valtype]), [], `%`_resulttype([]))) - -- Expand: `%~~%`(C.TYPES_context[x_1!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(`MUT%?`_mut(?(())), zt_1))) + `%|-%:%`(C, ARRAY.COPY_instr(x_1, x_2), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), _IDX_heaptype(x_1)) I32_valtype REF_valtype(?(NULL_NULL), _IDX_heaptype(x_2)) I32_valtype I32_valtype]), [], `%`_resulttype([]))) + -- Expand: `%~~%`(C.TYPES_context[x_1!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(?(MUT_MUT), zt_1))) -- Expand: `%~~%`(C.TYPES_context[x_2!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(mut, zt_2))) -- Storagetype_sub: `%|-%<:%`(C, zt_2, zt_1) ;; 3-typing.watsup:887.1-890.44 rule array.init_elem{C : context, x : idx, y : idx, zt : storagetype}: - `%|-%:%`(C, ARRAY.INIT_ELEM_instr(x, y), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x)) I32_valtype I32_valtype I32_valtype]), [], `%`_resulttype([]))) - -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(`MUT%?`_mut(?(())), zt))) + `%|-%:%`(C, ARRAY.INIT_ELEM_instr(x, y), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), _IDX_heaptype(x)) I32_valtype I32_valtype I32_valtype]), [], `%`_resulttype([]))) + -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(?(MUT_MUT), zt))) -- Storagetype_sub: `%|-%<:%`(C, (C.ELEMS_context[y!`%`_idx.0] : reftype <: storagetype), zt) ;; 3-typing.watsup:892.1-896.24 rule array.init_data{C : context, x : idx, y : idx, zt : storagetype, numtype : numtype, vectype : vectype}: - `%|-%:%`(C, ARRAY.INIT_DATA_instr(x, y), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x)) I32_valtype I32_valtype I32_valtype]), [], `%`_resulttype([]))) - -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(`MUT%?`_mut(?(())), zt))) + `%|-%:%`(C, ARRAY.INIT_DATA_instr(x, y), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), _IDX_heaptype(x)) I32_valtype I32_valtype I32_valtype]), [], `%`_resulttype([]))) + -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(?(MUT_MUT), zt))) -- if (($unpack(zt) = (numtype : numtype <: valtype)) \/ ($unpack(zt) = (vectype : vectype <: valtype))) -- if (C.DATAS_context[y!`%`_idx.0] = OK_datatype) @@ -12554,7 +3703,7 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) ;; 3-typing.watsup:1003.1-1005.29 rule global.set{C : context, x : idx, t : valtype}: `%|-%:%`(C, GLOBAL.SET_instr(x), `%->_%%`_instrtype(`%`_resulttype([t]), [], `%`_resulttype([]))) - -- if (C.GLOBALS_context[x!`%`_idx.0] = `%%`_globaltype(`MUT%?`_mut(?(())), t)) + -- if (C.GLOBALS_context[x!`%`_idx.0] = `%%`_globaltype(?(MUT_MUT), t)) ;; 3-typing.watsup:1010.1-1012.32 rule table.get{C : context, x : idx, at : addrtype, rt : reftype, lim : limits}: @@ -12794,7 +3943,7 @@ relation Instr_const: `%|-%CONST`(context, instr) ;; 3-typing.watsup rule global.get{C : context, x : idx, t : valtype}: `%|-%CONST`(C, GLOBAL.GET_instr(x)) - -- if (C.GLOBALS_context[x!`%`_idx.0] = `%%`_globaltype(`MUT%?`_mut(?()), t)) + -- if (C.GLOBALS_context[x!`%`_idx.0] = `%%`_globaltype(?(), t)) ;; 3-typing.watsup rule binop{C : context, Inn : Inn, binop : binop_((Inn : Inn <: numtype))}: @@ -13480,14 +4629,14 @@ def $lunpacknum_(lanetype : lanetype, lane_ : lane_(lanetype)) : num_($lunpack(l def $lunpacknum_{packtype : packtype, c : lane_((packtype : packtype <: lanetype))}((packtype : packtype <: lanetype), c) = $extend__($psize(packtype), $size($lunpack((packtype : packtype <: lanetype))), U_sx, c) ;; 4-numerics.watsup -def $cpacknum_(storagetype : storagetype, lit_ : lit_((!($cunpack(storagetype)) : consttype <: storagetype))) : lit_(storagetype) +def $cpacknum_(storagetype : storagetype, lit_ : lit_(($cunpack(storagetype) : consttype <: storagetype))) : lit_(storagetype) ;; 4-numerics.watsup - def $cpacknum_{consttype : consttype, c : lit_((!($cunpack((consttype : consttype <: storagetype))) : consttype <: storagetype))}((consttype : consttype <: storagetype), c) = c + def $cpacknum_{consttype : consttype, c : lit_(($cunpack((consttype : consttype <: storagetype)) : consttype <: storagetype))}((consttype : consttype <: storagetype), c) = c ;; 4-numerics.watsup - def $cpacknum_{packtype : packtype, c : lit_((!($cunpack((packtype : packtype <: storagetype))) : consttype <: storagetype))}((packtype : packtype <: storagetype), c) = $wrap__($size($lunpack((packtype : packtype <: lanetype))), $psize(packtype), c) + def $cpacknum_{packtype : packtype, c : lit_(($cunpack((packtype : packtype <: storagetype)) : consttype <: storagetype))}((packtype : packtype <: storagetype), c) = $wrap__($size($lunpack((packtype : packtype <: lanetype))), $psize(packtype), c) ;; 4-numerics.watsup -def $cunpacknum_(storagetype : storagetype, lit_ : lit_(storagetype)) : lit_((!($cunpack(storagetype)) : consttype <: storagetype)) +def $cunpacknum_(storagetype : storagetype, lit_ : lit_(storagetype)) : lit_(($cunpack(storagetype) : consttype <: storagetype)) ;; 4-numerics.watsup def $cunpacknum_{consttype : consttype, c : lit_((consttype : consttype <: storagetype))}((consttype : consttype <: storagetype), c) = c ;; 4-numerics.watsup @@ -14504,22 +5653,20 @@ def $add_exninst(state : state, exninst*) : state def $add_exninst{s : store, f : frame, `exn*` : exninst*}(`%;%`_state(s, f), exn*{exn <- `exn*`}) = `%;%`_state(s[EXNS_store =++ exn*{exn <- `exn*`}], f) ;; 6-runtime-aux.watsup -def $growtable(tableinst : tableinst, nat : nat, ref : ref) : tableinst? +def $growtable(tableinst : tableinst, nat : nat, ref : ref) : tableinst ;; 6-runtime-aux.watsup - def $growtable{tableinst : tableinst, n : n, r : ref, tableinst' : tableinst, at : addrtype, i : u64, j : u64, rt : reftype, `r'*` : ref*, i' : u64}(tableinst, n, r) = ?(tableinst') + def $growtable{tableinst : tableinst, n : n, r : ref, tableinst' : tableinst, at : addrtype, i : u64, j : u64, rt : reftype, `r'*` : ref*, i' : u64}(tableinst, n, r) = tableinst' -- if (tableinst = {TYPE `%%%`_tabletype(at, `[%..%]`_limits(i, j), rt), REFS r'*{r' <- `r'*`}}) -- if (tableinst' = {TYPE `%%%`_tabletype(at, `[%..%]`_limits(i', j), rt), REFS r'*{r' <- `r'*`} ++ r^n{}}) -- if ((i'!`%`_u64.0 = (|r'*{r' <- `r'*`}| + n)) /\ ((|r'*{r' <- `r'*`}| + n) <= j!`%`_u64.0)) - def $growtable{x0 : tableinst, x1 : nat, x2 : ref}(x0, x1, x2) = ?() ;; 6-runtime-aux.watsup -def $growmem(meminst : meminst, nat : nat) : meminst? +def $growmem(meminst : meminst, nat : nat) : meminst ;; 6-runtime-aux.watsup - def $growmem{meminst : meminst, n : n, meminst' : meminst, at : addrtype, i : u64, j : u64, `b*` : byte*, i' : u64}(meminst, n) = ?(meminst') + def $growmem{meminst : meminst, n : n, meminst' : meminst, at : addrtype, i : u64, j : u64, `b*` : byte*, i' : u64}(meminst, n) = meminst' -- if (meminst = {TYPE `%%PAGE`_memtype(at, `[%..%]`_limits(i, j)), BYTES b*{b <- `b*`}}) -- if (meminst' = {TYPE `%%PAGE`_memtype(at, `[%..%]`_limits(i', j)), BYTES b*{b <- `b*`} ++ `%`_byte(0)^(n * (64 * $Ki)){}}) -- if (((i'!`%`_u64.0 : nat <:> rat) = (((|b*{b <- `b*`}| : nat <:> rat) / ((64 * $Ki) : nat <:> rat)) + (n : nat <:> rat))) /\ ((((|b*{b <- `b*`}| : nat <:> rat) / ((64 * $Ki) : nat <:> rat)) + (n : nat <:> rat)) <= (j!`%`_u64.0 : nat <:> rat))) - def $growmem{x0 : meminst, x1 : nat}(x0, x1) = ?() ;; 7-runtime-typing.watsup relation Num_type: `%|-%:%`(store, num, numtype) @@ -14540,38 +5687,38 @@ rec { relation Ref_type: `%|-%:%`(store, ref, reftype) ;; 7-runtime-typing.watsup:17.1-18.35 rule null{s : store, ht : heaptype}: - `%|-%:%`(s, REF.NULL_ref(ht), REF_reftype(`NULL%?`_nul(?(())), ht)) + `%|-%:%`(s, REF.NULL_ref(ht), REF_reftype(?(NULL_NULL), ht)) ;; 7-runtime-typing.watsup:20.1-21.37 rule i31{s : store, i : u31}: - `%|-%:%`(s, REF.I31_NUM_ref(i), REF_reftype(`NULL%?`_nul(?()), I31_heaptype)) + `%|-%:%`(s, REF.I31_NUM_ref(i), REF_reftype(?(), I31_heaptype)) ;; 7-runtime-typing.watsup:23.1-25.31 rule struct{s : store, a : addr, dt : deftype}: - `%|-%:%`(s, REF.STRUCT_ADDR_ref(a), REF_reftype(`NULL%?`_nul(?()), (dt : deftype <: heaptype))) + `%|-%:%`(s, REF.STRUCT_ADDR_ref(a), REF_reftype(?(), (dt : deftype <: heaptype))) -- if (s.STRUCTS_store[a].TYPE_structinst = dt) ;; 7-runtime-typing.watsup:27.1-29.30 rule array{s : store, a : addr, dt : deftype}: - `%|-%:%`(s, REF.ARRAY_ADDR_ref(a), REF_reftype(`NULL%?`_nul(?()), (dt : deftype <: heaptype))) + `%|-%:%`(s, REF.ARRAY_ADDR_ref(a), REF_reftype(?(), (dt : deftype <: heaptype))) -- if (s.ARRAYS_store[a].TYPE_arrayinst = dt) ;; 7-runtime-typing.watsup:31.1-33.29 rule func{s : store, a : addr, dt : deftype}: - `%|-%:%`(s, REF.FUNC_ADDR_ref(a), REF_reftype(`NULL%?`_nul(?()), (dt : deftype <: heaptype))) + `%|-%:%`(s, REF.FUNC_ADDR_ref(a), REF_reftype(?(), (dt : deftype <: heaptype))) -- if (s.FUNCS_store[a].TYPE_funcinst = dt) ;; 7-runtime-typing.watsup:35.1-36.38 rule exn{s : store, a : addr}: - `%|-%:%`(s, REF.EXN_ADDR_ref(a), REF_reftype(`NULL%?`_nul(?()), EXN_heaptype)) + `%|-%:%`(s, REF.EXN_ADDR_ref(a), REF_reftype(?(), EXN_heaptype)) ;; 7-runtime-typing.watsup:38.1-39.39 rule host{s : store, a : addr}: - `%|-%:%`(s, REF.HOST_ADDR_ref(a), REF_reftype(`NULL%?`_nul(?()), ANY_heaptype)) + `%|-%:%`(s, REF.HOST_ADDR_ref(a), REF_reftype(?(), ANY_heaptype)) ;; 7-runtime-typing.watsup:41.1-42.45 rule extern{s : store, addrref : addrref}: - `%|-%:%`(s, REF.EXTERN_ref(addrref), REF_reftype(`NULL%?`_nul(?()), EXTERN_heaptype)) + `%|-%:%`(s, REF.EXTERN_ref(addrref), REF_reftype(?(), EXTERN_heaptype)) ;; 7-runtime-typing.watsup:44.1-47.34 rule sub{s : store, ref : ref, rt : reftype, rt' : reftype}: @@ -14650,12 +5797,12 @@ relation Step_pure: `%~>%`(instr*, instr*) ;; 8-reduction.watsup rule `select-true`{val_1 : val, val_2 : val, c : num_(I32_numtype), `t*?` : valtype*?}: - `%~>%`([(val_1 : val <: instr) (val_2 : val <: instr) CONST_instr(I32_numtype, c) `SELECT()%?`_instr(t*{t <- `t*`}?{`t*` <- `t*?`})], [(val_1 : val <: instr)]) + `%~>%`([(val_1 : val <: instr) (val_2 : val <: instr) CONST_instr(I32_numtype, c) SELECT_instr(t*{t <- `t*`}?{`t*` <- `t*?`})], [(val_1 : val <: instr)]) -- if (c!`%`_num_.0 =/= 0) ;; 8-reduction.watsup rule `select-false`{val_1 : val, val_2 : val, c : num_(I32_numtype), `t*?` : valtype*?}: - `%~>%`([(val_1 : val <: instr) (val_2 : val <: instr) CONST_instr(I32_numtype, c) `SELECT()%?`_instr(t*{t <- `t*`}?{`t*` <- `t*?`})], [(val_2 : val <: instr)]) + `%~>%`([(val_1 : val <: instr) (val_2 : val <: instr) CONST_instr(I32_numtype, c) SELECT_instr(t*{t <- `t*`}?{`t*` <- `t*?`})], [(val_2 : val <: instr)]) -- if (c!`%`_num_.0 = 0) ;; 8-reduction.watsup @@ -14728,11 +5875,11 @@ relation Step_pure: `%~>%`(instr*, instr*) ;; 8-reduction.watsup rule call_indirect{x : idx, yy : typeuse}: - `%~>%`([CALL_INDIRECT_instr(x, yy)], [TABLE.GET_instr(x) REF.CAST_instr(REF_reftype(`NULL%?`_nul(?(())), (yy : typeuse <: heaptype))) CALL_REF_instr(yy)]) + `%~>%`([CALL_INDIRECT_instr(x, yy)], [TABLE.GET_instr(x) REF.CAST_instr(REF_reftype(?(NULL_NULL), (yy : typeuse <: heaptype))) CALL_REF_instr(yy)]) ;; 8-reduction.watsup rule return_call_indirect{x : idx, yy : typeuse}: - `%~>%`([RETURN_CALL_INDIRECT_instr(x, yy)], [TABLE.GET_instr(x) REF.CAST_instr(REF_reftype(`NULL%?`_nul(?(())), (yy : typeuse <: heaptype))) RETURN_CALL_REF_instr(yy)]) + `%~>%`([RETURN_CALL_INDIRECT_instr(x, yy)], [TABLE.GET_instr(x) REF.CAST_instr(REF_reftype(?(NULL_NULL), (yy : typeuse <: heaptype))) RETURN_CALL_REF_instr(yy)]) ;; 8-reduction.watsup rule `frame-vals`{n : n, f : frame, `val*` : val*}: @@ -15205,7 +6352,7 @@ relation Step_read: `%~>%`(config, instr*) ;; 8-reduction.watsup rule `array.new_data-num`{z : state, i : num_(I32_numtype), n : n, x : idx, y : idx, zt : storagetype, `c*` : lit_(zt)*, mut : mut}: - `%~>%`(`%;%`_config(z, [CONST_instr(I32_numtype, i) CONST_instr(I32_numtype, `%`_num_(n)) ARRAY.NEW_DATA_instr(x, y)]), $const(!($cunpack(zt)), $cunpacknum_(zt, c))^n{c <- `c*`} ++ [ARRAY.NEW_FIXED_instr(x, `%`_u32(n))]) + `%~>%`(`%;%`_config(z, [CONST_instr(I32_numtype, i) CONST_instr(I32_numtype, `%`_num_(n)) ARRAY.NEW_DATA_instr(x, y)]), $const($cunpack(zt), $cunpacknum_(zt, c))^n{c <- `c*`} ++ [ARRAY.NEW_FIXED_instr(x, `%`_u32(n))]) -- Expand: `%~~%`($type(z, x), ARRAY_comptype(`%%`_arraytype(mut, zt))) -- if ($concatn_(syntax byte, $zbytes_(zt, c)^n{c <- `c*`}, ((($zsize(zt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) = $data(z, y).BYTES_datainst[i!`%`_num_.0 : ((((n * $zsize(zt)) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) @@ -15338,7 +6485,7 @@ relation Step_read: `%~>%`(config, instr*) ;; 8-reduction.watsup rule `array.init_data-num`{z : state, a : addr, i : num_(I32_numtype), j : num_(I32_numtype), n : n, x : idx, y : idx, zt : storagetype, c : lit_(zt), mut : mut}: - `%~>%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) CONST_instr(I32_numtype, j) CONST_instr(I32_numtype, `%`_num_(n)) ARRAY.INIT_DATA_instr(x, y)]), [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) $const(!($cunpack(zt)), $cunpacknum_(zt, c)) ARRAY.SET_instr(x) REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, `%`_num_((i!`%`_num_.0 + 1))) CONST_instr(I32_numtype, `%`_num_((j!`%`_num_.0 + ((($zsize(zt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)))) CONST_instr(I32_numtype, `%`_num_((((n : nat <:> int) - (1 : nat <:> int)) : int <:> nat))) ARRAY.INIT_DATA_instr(x, y)]) + `%~>%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) CONST_instr(I32_numtype, j) CONST_instr(I32_numtype, `%`_num_(n)) ARRAY.INIT_DATA_instr(x, y)]), [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) $const($cunpack(zt), $cunpacknum_(zt, c)) ARRAY.SET_instr(x) REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, `%`_num_((i!`%`_num_.0 + 1))) CONST_instr(I32_numtype, `%`_num_((j!`%`_num_.0 + ((($zsize(zt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)))) CONST_instr(I32_numtype, `%`_num_((((n : nat <:> int) - (1 : nat <:> int)) : int <:> nat))) ARRAY.INIT_DATA_instr(x, y)]) -- otherwise -- Expand: `%~~%`($type(z, x), ARRAY_comptype(`%%`_arraytype(mut, zt))) -- if ($zbytes_(zt, c) = $data(z, y).BYTES_datainst[j!`%`_num_.0 : ((($zsize(zt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) @@ -15656,7 +6803,7 @@ relation Step: `%~>%`(config, config) ;; 8-reduction.watsup:821.1-824.46 rule `table.grow-succeed`{z : state, ref : ref, at : addrtype, n : n, x : idx, ti : tableinst}: `%~>%`(`%;%`_config(z, [(ref : ref <: instr) CONST_instr((at : addrtype <: numtype), `%`_num_(n)) TABLE.GROW_instr(x)]), `%;%`_config($with_tableinst(z, x, ti), [CONST_instr((at : addrtype <: numtype), `%`_num_(|$table(z, x).REFS_tableinst|))])) - -- if (ti = !($growtable($table(z, x), n, ref))) + -- if (ti = $growtable($table(z, x), n, ref)) ;; 8-reduction.watsup:826.1-827.86 rule `table.grow-fail`{z : state, ref : ref, at : addrtype, n : n, x : idx}: @@ -15711,7 +6858,7 @@ relation Step: `%~>%`(config, config) ;; 8-reduction.watsup:1019.1-1022.37 rule `memory.grow-succeed`{z : state, at : addrtype, n : n, x : idx, mi : meminst}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), `%`_num_(n)) MEMORY.GROW_instr(x)]), `%;%`_config($with_meminst(z, x, mi), [CONST_instr((at : addrtype <: numtype), `%`_num_((((|$mem(z, x).BYTES_meminst| : nat <:> rat) / ((64 * $Ki) : nat <:> rat)) : rat <:> nat)))])) - -- if (mi = !($growmem($mem(z, x), n))) + -- if (mi = $growmem($mem(z, x), n)) ;; 8-reduction.watsup:1024.1-1025.83 rule `memory.grow-fail`{z : state, at : addrtype, n : n, x : idx}: @@ -16201,11 +7348,11 @@ grammar Bheaptype : heaptype ;; A-binary.watsup grammar Breftype : reftype ;; A-binary.watsup - prod{ht : heaptype} {0x63 ht:Bheaptype} => REF_reftype(`NULL%?`_nul(?(())), ht) + prod{ht : heaptype} {0x63 ht:Bheaptype} => REF_reftype(?(NULL_NULL), ht) ;; A-binary.watsup - prod{ht : heaptype} {0x64 ht:Bheaptype} => REF_reftype(`NULL%?`_nul(?()), ht) + prod{ht : heaptype} {0x64 ht:Bheaptype} => REF_reftype(?(), ht) ;; A-binary.watsup - prod{ht : heaptype} ht:Babsheaptype => REF_reftype(`NULL%?`_nul(?(())), ht) + prod{ht : heaptype} ht:Babsheaptype => REF_reftype(?(NULL_NULL), ht) ;; A-binary.watsup grammar Bvaltype : valtype @@ -16224,9 +7371,9 @@ grammar Bresulttype : resulttype ;; A-binary.watsup grammar Bmut : mut ;; A-binary.watsup - prod 0x00 => `MUT%?`_mut(?()) + prod 0x00 => ?() ;; A-binary.watsup - prod 0x01 => `MUT%?`_mut(?(())) + prod 0x01 => ?(MUT_MUT) ;; A-binary.watsup grammar Bpacktype : packtype @@ -16259,11 +7406,11 @@ grammar Bcomptype : comptype ;; A-binary.watsup grammar Bsubtype : subtype ;; A-binary.watsup - prod{`x*` : idx*, ct : comptype} {0x4F x*{x <- `x*`}:Blist(syntax typeidx, grammar Btypeidx) ct:Bcomptype} => SUB_subtype(`FINAL%?`_fin(?(())), _IDX_typeuse(x)*{x <- `x*`}, ct) + prod{`x*` : idx*, ct : comptype} {0x4F x*{x <- `x*`}:Blist(syntax typeidx, grammar Btypeidx) ct:Bcomptype} => SUB_subtype(?(FINAL_FINAL), _IDX_typeuse(x)*{x <- `x*`}, ct) ;; A-binary.watsup - prod{`x*` : idx*, ct : comptype} {0x50 x*{x <- `x*`}:Blist(syntax typeidx, grammar Btypeidx) ct:Bcomptype} => SUB_subtype(`FINAL%?`_fin(?()), _IDX_typeuse(x)*{x <- `x*`}, ct) + prod{`x*` : idx*, ct : comptype} {0x50 x*{x <- `x*`}:Blist(syntax typeidx, grammar Btypeidx) ct:Bcomptype} => SUB_subtype(?(), _IDX_typeuse(x)*{x <- `x*`}, ct) ;; A-binary.watsup - prod{ct : comptype} ct:Bcomptype => SUB_subtype(`FINAL%?`_fin(?(())), [], ct) + prod{ct : comptype} ct:Bcomptype => SUB_subtype(?(FINAL_FINAL), [], ct) ;; A-binary.watsup grammar Brectype : rectype @@ -16343,13 +7490,13 @@ syntax castop = (nul, nul) ;; A-binary.watsup grammar Bcastop : castop ;; A-binary.watsup - prod 0x00 => (`NULL%?`_nul(?()), `NULL%?`_nul(?())) + prod 0x00 => (?(), ?()) ;; A-binary.watsup - prod 0x01 => (`NULL%?`_nul(?(())), `NULL%?`_nul(?())) + prod 0x01 => (?(NULL_NULL), ?()) ;; A-binary.watsup - prod 0x02 => (`NULL%?`_nul(?()), `NULL%?`_nul(?(()))) + prod 0x02 => (?(), ?(NULL_NULL)) ;; A-binary.watsup - prod 0x03 => (`NULL%?`_nul(?(())), `NULL%?`_nul(?(()))) + prod 0x03 => (?(NULL_NULL), ?(NULL_NULL)) ;; A-binary.watsup syntax memidxop = (memidx, memarg) @@ -16462,13 +7609,13 @@ grammar Binstr : instr ;; A-binary.watsup:286.5-286.62 prod{x : idx, y : idx} {0xFB `%`_u32(19):Bu32 x:Btypeidx y:Belemidx} => ARRAY.INIT_ELEM_instr(x, y) ;; A-binary.watsup:290.5-290.51 - prod{ht : heaptype} {0xFB `%`_u32(20):Bu32 ht:Bheaptype} => REF.TEST_instr(REF_reftype(`NULL%?`_nul(?()), ht)) + prod{ht : heaptype} {0xFB `%`_u32(20):Bu32 ht:Bheaptype} => REF.TEST_instr(REF_reftype(?(), ht)) ;; A-binary.watsup:291.5-291.56 - prod{ht : heaptype} {0xFB `%`_u32(21):Bu32 ht:Bheaptype} => REF.TEST_instr(REF_reftype(`NULL%?`_nul(?(())), ht)) + prod{ht : heaptype} {0xFB `%`_u32(21):Bu32 ht:Bheaptype} => REF.TEST_instr(REF_reftype(?(NULL_NULL), ht)) ;; A-binary.watsup:292.5-292.51 - prod{ht : heaptype} {0xFB `%`_u32(22):Bu32 ht:Bheaptype} => REF.CAST_instr(REF_reftype(`NULL%?`_nul(?()), ht)) + prod{ht : heaptype} {0xFB `%`_u32(22):Bu32 ht:Bheaptype} => REF.CAST_instr(REF_reftype(?(), ht)) ;; A-binary.watsup:293.5-293.56 - prod{ht : heaptype} {0xFB `%`_u32(23):Bu32 ht:Bheaptype} => REF.CAST_instr(REF_reftype(`NULL%?`_nul(?(())), ht)) + prod{ht : heaptype} {0xFB `%`_u32(23):Bu32 ht:Bheaptype} => REF.CAST_instr(REF_reftype(?(NULL_NULL), ht)) ;; A-binary.watsup:294.5-295.94 prod{nul1 : nul1, nul2 : nul2, l : labelidx, ht_1 : heaptype, ht_2 : heaptype} {0xFB `%`_u32(24):Bu32 (nul1, nul2):Bcastop l:Blabelidx ht_1:Bheaptype ht_2:Bheaptype} => BR_ON_CAST_instr(l, REF_reftype(nul1, ht_1), REF_reftype(nul2, ht_2)) ;; A-binary.watsup:296.5-297.99 @@ -16486,9 +7633,9 @@ grammar Binstr : instr ;; A-binary.watsup:315.5-315.17 prod 0x1A => DROP_instr ;; A-binary.watsup:316.5-316.19 - prod 0x1B => `SELECT()%?`_instr(?()) + prod 0x1B => SELECT_instr(?()) ;; A-binary.watsup:317.5-317.41 - prod{ts : valtype} {0x1C [ts]:Blist(syntax valtype, grammar Bvaltype)} => `SELECT()%?`_instr(?([ts])) + prod{ts : valtype} {0x1C [ts]:Blist(syntax valtype, grammar Bvaltype)} => SELECT_instr(?([ts])) ;; A-binary.watsup:324.5-324.36 prod{x : idx} {0x20 x:Blocalidx} => LOCAL.GET_instr(x) ;; A-binary.watsup:325.5-325.36 @@ -17411,7 +8558,7 @@ grammar Bfuncsec : typeidx* grammar Btable : table ;; A-binary.watsup prod{tt : tabletype, ht : heaptype, at : addrtype, lim : limits} tt:Btabletype => TABLE_table(tt, [REF.NULL_instr(ht)]) - -- if (tt = `%%%`_tabletype(at, lim, REF_reftype(`NULL%?`_nul(()?{}), ht))) + -- if (tt = `%%%`_tabletype(at, lim, REF_reftype(NULL_NULL?{}, ht))) ;; A-binary.watsup prod{tt : tabletype, e : expr} {0x40 0x00 tt:Btabletype e:Bexpr} => TABLE_table(tt, e) @@ -17466,24 +8613,24 @@ grammar Bstartsec : start? ;; A-binary.watsup grammar Belemkind : reftype ;; A-binary.watsup - prod 0x00 => REF_reftype(`NULL%?`_nul(?(())), FUNC_heaptype) + prod 0x00 => REF_reftype(?(NULL_NULL), FUNC_heaptype) ;; A-binary.watsup grammar Belem : elem ;; A-binary.watsup - prod{e_o : expr, `y*` : idx*} {`%`_u32(0):Bu32 e_o:Bexpr y*{y <- `y*`}:Blist(syntax funcidx, grammar Bfuncidx)} => ELEM_elem(REF_reftype(`NULL%?`_nul(?()), FUNC_heaptype), [REF.FUNC_instr(y)]*{y <- `y*`}, ACTIVE_elemmode(`%`_tableidx(0), e_o)) + prod{e_o : expr, `y*` : idx*} {`%`_u32(0):Bu32 e_o:Bexpr y*{y <- `y*`}:Blist(syntax funcidx, grammar Bfuncidx)} => ELEM_elem(REF_reftype(?(), FUNC_heaptype), [REF.FUNC_instr(y)*{y <- `y*`}], ACTIVE_elemmode(`%`_tableidx(0), e_o)) ;; A-binary.watsup - prod{rt : reftype, `y*` : idx*} {`%`_u32(1):Bu32 rt:Belemkind y*{y <- `y*`}:Blist(syntax funcidx, grammar Bfuncidx)} => ELEM_elem(rt, [REF.FUNC_instr(y)]*{y <- `y*`}, PASSIVE_elemmode) + prod{rt : reftype, `y*` : idx*} {`%`_u32(1):Bu32 rt:Belemkind y*{y <- `y*`}:Blist(syntax funcidx, grammar Bfuncidx)} => ELEM_elem(rt, [REF.FUNC_instr(y)*{y <- `y*`}], PASSIVE_elemmode) ;; A-binary.watsup - prod{x : idx, e : expr, rt : reftype, `y*` : idx*} {`%`_u32(2):Bu32 x:Btableidx e:Bexpr rt:Belemkind y*{y <- `y*`}:Blist(syntax funcidx, grammar Bfuncidx)} => ELEM_elem(rt, [REF.FUNC_instr(y)]*{y <- `y*`}, ACTIVE_elemmode(x, e)) + prod{x : idx, e : expr, rt : reftype, `y*` : idx*} {`%`_u32(2):Bu32 x:Btableidx e:Bexpr rt:Belemkind y*{y <- `y*`}:Blist(syntax funcidx, grammar Bfuncidx)} => ELEM_elem(rt, [REF.FUNC_instr(y)*{y <- `y*`}], ACTIVE_elemmode(x, e)) ;; A-binary.watsup - prod{rt : reftype, `y*` : idx*} {`%`_u32(3):Bu32 rt:Belemkind y*{y <- `y*`}:Blist(syntax funcidx, grammar Bfuncidx)} => ELEM_elem(rt, [REF.FUNC_instr(y)]*{y <- `y*`}, DECLARE_elemmode) + prod{rt : reftype, `y*` : idx*} {`%`_u32(3):Bu32 rt:Belemkind y*{y <- `y*`}:Blist(syntax funcidx, grammar Bfuncidx)} => ELEM_elem(rt, [REF.FUNC_instr(y)*{y <- `y*`}], DECLARE_elemmode) ;; A-binary.watsup - prod{e_O : expr, `e*` : expr*} {`%`_u32(4):Bu32 e_O:Bexpr e*{e <- `e*`}:Blist(syntax expr, grammar Bexpr)} => ELEM_elem(REF_reftype(`NULL%?`_nul(?(())), FUNC_heaptype), e*{e <- `e*`}, ACTIVE_elemmode(`%`_tableidx(0), e_O)) + prod{e_O : expr, `e*` : expr*} {`%`_u32(4):Bu32 e_O:Bexpr e*{e <- `e*`}:Blist(syntax expr, grammar Bexpr)} => ELEM_elem(REF_reftype(?(NULL_NULL), FUNC_heaptype), e*{e <- `e*`}, ACTIVE_elemmode(`%`_tableidx(0), e_O)) ;; A-binary.watsup prod{rt : reftype, `e*` : expr*} {`%`_u32(5):Bu32 rt:Breftype e*{e <- `e*`}:Blist(syntax expr, grammar Bexpr)} => ELEM_elem(rt, e*{e <- `e*`}, PASSIVE_elemmode) ;; A-binary.watsup - prod{x : idx, e_O : expr, `e*` : expr*} {`%`_u32(6):Bu32 x:Btableidx e_O:Bexpr e*{e <- `e*`}:Blist(syntax expr, grammar Bexpr)} => ELEM_elem(REF_reftype(`NULL%?`_nul(?(())), FUNC_heaptype), e*{e <- `e*`}, ACTIVE_elemmode(x, e_O)) + prod{x : idx, e_O : expr, `e*` : expr*} {`%`_u32(6):Bu32 x:Btableidx e_O:Bexpr e*{e <- `e*`}:Blist(syntax expr, grammar Bexpr)} => ELEM_elem(REF_reftype(?(NULL_NULL), FUNC_heaptype), e*{e <- `e*`}, ACTIVE_elemmode(x, e_O)) ;; A-binary.watsup prod{rt : reftype, `e*` : expr*} {`%`_u32(7):Bu32 rt:Breftype e*{e <- `e*`}:Blist(syntax expr, grammar Bexpr)} => ELEM_elem(rt, e*{e <- `e*`}, DECLARE_elemmode) @@ -17534,7 +8681,7 @@ grammar Bdatasec : data* ;; A-binary.watsup grammar Bdatacnt : u32* ;; A-binary.watsup - prod{n : n} `%`_u32(n):Bu32 => [`%`_uN(n)] + prod{n : n} `%`_u32(n):Bu32 => [`%`_u32(n)] ;; A-binary.watsup syntax nopt = u32* @@ -17590,8 +8737,7 @@ syntax symsplit = | _LAST{A_2 : A}(A_2 : A) ;; C-conventions.watsup -syntax recorddots = - | `()` +syntax recorddots = () ;; C-conventions.watsup syntax record = @@ -17713,8 +8859,20 @@ grammar Bsym : A ;; C-conventions.watsup prod (Bvar(syntax symdots) | Bvar(syntax B)) => $var(syntax A) -== IL Validation after pass totalize... -== Running pass wildcards... +== IL Validation... +== Running pass totalize... + +;; 1-syntax.watsup +syntax NULL = + | NULL + +;; 1-syntax.watsup +syntax MUT = + | MUT + +;; 1-syntax.watsup +syntax FINAL = + | FINAL ;; 0-aux.watsup syntax N = nat @@ -17949,7 +9107,7 @@ syntax fNmag{N : N}(N) = | SUBNORM{m : m, exp : exp}(m : m) -- if ((m < (2 ^ $M(N))) /\ (((2 : nat <:> int) - ((2 ^ ((($E(N) : nat <:> int) - (1 : nat <:> int)) : int <:> nat)) : nat <:> int)) = exp)) | INF - | `NAN(%)`{m : m}(m : m) + | NAN{m : m}(m : m) -- if ((1 <= m) /\ (m < (2 ^ $M(N)))) ;; 1-syntax.watsup @@ -18078,16 +9236,13 @@ syntax externidx = | TAG{tagidx : tagidx}(tagidx : tagidx) ;; 1-syntax.watsup -syntax nul = - | `NULL%?`(()?) +syntax nul = NULL? ;; 1-syntax.watsup -syntax nul1 = - | `NULL%?`(()?) +syntax nul1 = NULL? ;; 1-syntax.watsup -syntax nul2 = - | `NULL%?`(()?) +syntax nul2 = NULL? ;; 1-syntax.watsup syntax addrtype = @@ -18130,12 +9285,10 @@ syntax absheaptype = | BOT ;; 1-syntax.watsup -syntax mut = - | `MUT%?`(()?) +syntax mut = MUT? ;; 1-syntax.watsup -syntax fin = - | `FINAL%?`(()?) +syntax fin = FINAL? ;; 1-syntax.watsup rec { @@ -18257,52 +9410,52 @@ syntax Cnn = ;; 1-syntax.watsup def $ANYREF : reftype ;; 1-syntax.watsup - def $ANYREF = REF_reftype(`NULL%?`_nul(?(())), ANY_heaptype) + def $ANYREF = REF_reftype(?(NULL_NULL), ANY_heaptype) ;; 1-syntax.watsup def $EQREF : reftype ;; 1-syntax.watsup - def $EQREF = REF_reftype(`NULL%?`_nul(?(())), EQ_heaptype) + def $EQREF = REF_reftype(?(NULL_NULL), EQ_heaptype) ;; 1-syntax.watsup def $I31REF : reftype ;; 1-syntax.watsup - def $I31REF = REF_reftype(`NULL%?`_nul(?(())), I31_heaptype) + def $I31REF = REF_reftype(?(NULL_NULL), I31_heaptype) ;; 1-syntax.watsup def $STRUCTREF : reftype ;; 1-syntax.watsup - def $STRUCTREF = REF_reftype(`NULL%?`_nul(?(())), STRUCT_heaptype) + def $STRUCTREF = REF_reftype(?(NULL_NULL), STRUCT_heaptype) ;; 1-syntax.watsup def $ARRAYREF : reftype ;; 1-syntax.watsup - def $ARRAYREF = REF_reftype(`NULL%?`_nul(?(())), ARRAY_heaptype) + def $ARRAYREF = REF_reftype(?(NULL_NULL), ARRAY_heaptype) ;; 1-syntax.watsup def $FUNCREF : reftype ;; 1-syntax.watsup - def $FUNCREF = REF_reftype(`NULL%?`_nul(?(())), FUNC_heaptype) + def $FUNCREF = REF_reftype(?(NULL_NULL), FUNC_heaptype) ;; 1-syntax.watsup def $EXTERNREF : reftype ;; 1-syntax.watsup - def $EXTERNREF = REF_reftype(`NULL%?`_nul(?(())), EXTERN_heaptype) + def $EXTERNREF = REF_reftype(?(NULL_NULL), EXTERN_heaptype) ;; 1-syntax.watsup def $NULLREF : reftype ;; 1-syntax.watsup - def $NULLREF = REF_reftype(`NULL%?`_nul(?(())), NONE_heaptype) + def $NULLREF = REF_reftype(?(NULL_NULL), NONE_heaptype) ;; 1-syntax.watsup def $NULLFUNCREF : reftype ;; 1-syntax.watsup - def $NULLFUNCREF = REF_reftype(`NULL%?`_nul(?(())), NOFUNC_heaptype) + def $NULLFUNCREF = REF_reftype(?(NULL_NULL), NOFUNC_heaptype) ;; 1-syntax.watsup def $NULLEXTERNREF : reftype ;; 1-syntax.watsup - def $NULLEXTERNREF = REF_reftype(`NULL%?`_nul(?(())), NOEXTERN_heaptype) + def $NULLEXTERNREF = REF_reftype(?(NULL_NULL), NOEXTERN_heaptype) ;; 1-syntax.watsup syntax packtype = @@ -18340,12 +9493,10 @@ syntax Lnn = | I16 ;; 1-syntax.watsup -syntax mut1 = - | `MUT%?`(()?) +syntax mut1 = MUT? ;; 1-syntax.watsup -syntax mut2 = - | `MUT%?`(()?) +syntax mut2 = MUT? ;; 1-syntax.watsup syntax limits = @@ -19045,7 +10196,7 @@ syntax instr = | NOP | UNREACHABLE | DROP - | `SELECT()%?`{`valtype*?` : valtype*?}(valtype*{valtype <- `valtype*`}?{`valtype*` <- `valtype*?`} : valtype*?) + | SELECT{`valtype*?` : valtype*?}(valtype*{valtype <- `valtype*`}?{`valtype*` <- `valtype*?`} : valtype*?) | BLOCK{blocktype : blocktype, `instr*` : instr*}(blocktype : blocktype, instr*{instr <- `instr*`} : instr*) | LOOP{blocktype : blocktype, `instr*` : instr*}(blocktype : blocktype, instr*{instr <- `instr*`} : instr*) | `IF%%ELSE%`{blocktype : blocktype, `instr*` : instr*}(blocktype : blocktype, instr*{instr <- `instr*`} : instr*, instr*) @@ -19335,9 +10486,9 @@ def $minat(addrtype : addrtype, addrtype : addrtype) : addrtype ;; 2-syntax-aux.watsup def $diffrt(reftype : reftype, reftype : reftype) : reftype ;; 2-syntax-aux.watsup - def $diffrt{nul1 : nul1, ht_1 : heaptype, ht_2 : heaptype}(REF_reftype(nul1, ht_1), REF_reftype(`NULL%?`_nul(?(())), ht_2)) = REF_reftype(`NULL%?`_nul(?()), ht_1) + def $diffrt{nul1 : nul1, ht_1 : heaptype, ht_2 : heaptype}(REF_reftype(nul1, ht_1), REF_reftype(?(NULL_NULL), ht_2)) = REF_reftype(?(), ht_1) ;; 2-syntax-aux.watsup - def $diffrt{nul1 : nul1, ht_1 : heaptype, ht_2 : heaptype}(REF_reftype(nul1, ht_1), REF_reftype(`NULL%?`_nul(?()), ht_2)) = REF_reftype(nul1, ht_1) + def $diffrt{nul1 : nul1, ht_1 : heaptype, ht_2 : heaptype}(REF_reftype(nul1, ht_1), REF_reftype(?(), ht_2)) = REF_reftype(nul1, ht_1) ;; 2-syntax-aux.watsup rec { @@ -19947,9 +11098,9 @@ def $shift_labelidxs(labelidx*) : labelidx* ;; 2-syntax-aux.watsup:585.1-585.32 def $shift_labelidxs([]) = [] ;; 2-syntax-aux.watsup:586.1-586.66 - def $shift_labelidxs{`labelidx'*` : labelidx*}([`%`_uN(0)] ++ labelidx'*{labelidx' <- `labelidx'*`}) = $shift_labelidxs(labelidx'*{labelidx' <- `labelidx'*`}) + def $shift_labelidxs{`labelidx'*` : labelidx*}([`%`_labelidx(0)] ++ labelidx'*{labelidx' <- `labelidx'*`}) = $shift_labelidxs(labelidx'*{labelidx' <- `labelidx'*`}) ;; 2-syntax-aux.watsup:587.1-587.91 - def $shift_labelidxs{labelidx : labelidx, `labelidx'*` : labelidx*}([labelidx] ++ labelidx'*{labelidx' <- `labelidx'*`}) = [`%`_uN((((labelidx!`%`_labelidx.0 : nat <:> int) - (1 : nat <:> int)) : int <:> nat))] ++ $shift_labelidxs(labelidx'*{labelidx' <- `labelidx'*`}) + def $shift_labelidxs{labelidx : labelidx, `labelidx'*` : labelidx*}([labelidx] ++ labelidx'*{labelidx' <- `labelidx'*`}) = [`%`_labelidx((((labelidx!`%`_labelidx.0 : nat <:> int) - (1 : nat <:> int)) : int <:> nat))] ++ $shift_labelidxs(labelidx'*{labelidx' <- `labelidx'*`}) } ;; 2-syntax-aux.watsup @@ -19964,7 +11115,7 @@ def $free_instr(instr : instr) : free ;; 2-syntax-aux.watsup:444.1-444.27 def $free_instr(DROP_instr) = {TYPES [], FUNCS [], GLOBALS [], TABLES [], MEMS [], ELEMS [], DATAS [], LOCALS [], LABELS []} ;; 2-syntax-aux.watsup:445.1-445.86 - def $free_instr{`valtype*?` : valtype*?}(`SELECT()%?`_instr(valtype*{valtype <- `valtype*`}?{`valtype*` <- `valtype*?`})) = $free_opt($free_list($free_valtype(valtype)*{valtype <- `valtype*`})?{`valtype*` <- `valtype*?`}) + def $free_instr{`valtype*?` : valtype*?}(SELECT_instr(valtype*{valtype <- `valtype*`}?{`valtype*` <- `valtype*?`})) = $free_opt($free_list($free_valtype(valtype)*{valtype <- `valtype*`})?{`valtype*` <- `valtype*?`}) ;; 2-syntax-aux.watsup:447.1-447.92 def $free_instr{blocktype : blocktype, `instr*` : instr*}(BLOCK_instr(blocktype, instr*{instr <- `instr*`})) = $free_blocktype(blocktype) +++ $free_block(instr*{instr <- `instr*`}) ;; 2-syntax-aux.watsup:448.1-448.91 @@ -20364,8 +11515,8 @@ relation Heaptype_ok: `%|-%:OK`(context, heaptype) ;; 3-typing.watsup relation Reftype_ok: `%|-%:OK`(context, reftype) ;; 3-typing.watsup - rule _{C : context, heaptype : heaptype, w0 : ()?}: - `%|-%:OK`(C, REF_reftype(`NULL%?`_nul(w0), heaptype)) + rule _{C : context, heaptype : heaptype}: + `%|-%:OK`(C, REF_reftype(NULL_NULL?{}, heaptype)) -- Heaptype_ok: `%|-%:OK`(C, heaptype) ;; 3-typing.watsup @@ -20434,8 +11585,8 @@ relation Storagetype_ok: `%|-%:OK`(context, storagetype) ;; 3-typing.watsup relation Fieldtype_ok: `%|-%:OK`(context, fieldtype) ;; 3-typing.watsup - rule _{C : context, storagetype : storagetype, w0 : ()?}: - `%|-%:OK`(C, `%%`_fieldtype(`MUT%?`_mut(w0), storagetype)) + rule _{C : context, storagetype : storagetype}: + `%|-%:OK`(C, `%%`_fieldtype(MUT_MUT?{}, storagetype)) -- Storagetype_ok: `%|-%:OK`(C, storagetype) ;; 3-typing.watsup @@ -20579,12 +11730,12 @@ relation Heaptype_sub: `%|-%<:%`(context, heaptype, heaptype) relation Reftype_sub: `%|-%<:%`(context, reftype, reftype) ;; 3-typing.watsup rule nonnull{C : context, ht_1 : heaptype, ht_2 : heaptype}: - `%|-%<:%`(C, REF_reftype(`NULL%?`_nul(?()), ht_1), REF_reftype(`NULL%?`_nul(?()), ht_2)) + `%|-%<:%`(C, REF_reftype(?(), ht_1), REF_reftype(?(), ht_2)) -- Heaptype_sub: `%|-%<:%`(C, ht_1, ht_2) ;; 3-typing.watsup - rule null{C : context, ht_1 : heaptype, ht_2 : heaptype, w0 : ()?}: - `%|-%<:%`(C, REF_reftype(`NULL%?`_nul(w0), ht_1), REF_reftype(`NULL%?`_nul(?(())), ht_2)) + rule null{C : context, ht_1 : heaptype, ht_2 : heaptype}: + `%|-%<:%`(C, REF_reftype(NULL_NULL?{}, ht_1), REF_reftype(?(NULL_NULL), ht_2)) -- Heaptype_sub: `%|-%<:%`(C, ht_1, ht_2) ;; 3-typing.watsup @@ -20630,12 +11781,12 @@ relation Storagetype_sub: `%|-%<:%`(context, storagetype, storagetype) relation Fieldtype_sub: `%|-%<:%`(context, fieldtype, fieldtype) ;; 3-typing.watsup rule const{C : context, zt_1 : storagetype, zt_2 : storagetype}: - `%|-%<:%`(C, `%%`_fieldtype(`MUT%?`_mut(?()), zt_1), `%%`_fieldtype(`MUT%?`_mut(?()), zt_2)) + `%|-%<:%`(C, `%%`_fieldtype(?(), zt_1), `%%`_fieldtype(?(), zt_2)) -- Storagetype_sub: `%|-%<:%`(C, zt_1, zt_2) ;; 3-typing.watsup rule var{C : context, zt_1 : storagetype, zt_2 : storagetype}: - `%|-%<:%`(C, `%%`_fieldtype(`MUT%?`_mut(?(())), zt_1), `%%`_fieldtype(`MUT%?`_mut(?(())), zt_2)) + `%|-%<:%`(C, `%%`_fieldtype(?(MUT_MUT), zt_1), `%%`_fieldtype(?(MUT_MUT), zt_2)) -- Storagetype_sub: `%|-%<:%`(C, zt_1, zt_2) -- Storagetype_sub: `%|-%<:%`(C, zt_2, zt_1) @@ -20674,11 +11825,11 @@ relation Comptype_sub: `%|-%<:%`(context, comptype, comptype) ;; 3-typing.watsup relation Subtype_ok: `%|-%:%`(context, subtype, oktypeidx) ;; 3-typing.watsup - rule _{C : context, `x*` : idx*, comptype : comptype, x_0 : idx, `x'**` : idx**, `comptype'*` : comptype*, w0 : ()?}: - `%|-%:%`(C, SUB_subtype(`FINAL%?`_fin(w0), _IDX_typeuse(x)*{x <- `x*`}, comptype), OK_oktypeidx(x_0)) + rule _{C : context, `x*` : idx*, comptype : comptype, x_0 : idx, `x'**` : idx**, `comptype'*` : comptype*}: + `%|-%:%`(C, SUB_subtype(FINAL_FINAL?{}, _IDX_typeuse(x)*{x <- `x*`}, comptype), OK_oktypeidx(x_0)) -- if (|x*{x <- `x*`}| <= 1) -- (if (x!`%`_idx.0 < x_0!`%`_idx.0))*{x <- `x*`} - -- (if ($unrolldt(C.TYPES_context[x!`%`_idx.0]) = SUB_subtype(`FINAL%?`_fin(?()), _IDX_typeuse(x')*{x' <- `x'*`}, comptype')))*{comptype' <- `comptype'*`, x <- `x*`, `x'*` <- `x'**`} + -- (if ($unrolldt(C.TYPES_context[x!`%`_idx.0]) = SUB_subtype(?(), _IDX_typeuse(x')*{x' <- `x'*`}, comptype')))*{comptype' <- `comptype'*`, x <- `x*`, `x'*` <- `x'**`} -- Comptype_ok: `%|-%:OK`(C, comptype) -- (Comptype_sub: `%|-%<:%`(C, comptype, comptype'))*{comptype' <- `comptype'*`} @@ -20703,11 +11854,11 @@ def $unrollht(context : context, heaptype : heaptype) : subtype ;; 3-typing.watsup relation Subtype_ok2: `%|-%:%`(context, subtype, oktypeidxnat) ;; 3-typing.watsup - rule _{C : context, `typeuse*` : typeuse*, compttype : comptype, x : idx, i : nat, `typeuse'**` : typeuse**, `comptype'*` : comptype*, comptype : comptype, w0 : ()?}: - `%|-%:%`(C, SUB_subtype(`FINAL%?`_fin(w0), typeuse*{typeuse <- `typeuse*`}, compttype), OK_oktypeidxnat(x, i)) + rule _{C : context, `typeuse*` : typeuse*, compttype : comptype, x : idx, i : nat, `typeuse'**` : typeuse**, `comptype'*` : comptype*, comptype : comptype}: + `%|-%:%`(C, SUB_subtype(FINAL_FINAL?{}, typeuse*{typeuse <- `typeuse*`}, compttype), OK_oktypeidxnat(x, i)) -- if (|typeuse*{typeuse <- `typeuse*`}| <= 1) -- (if $before(typeuse, x, i))*{typeuse <- `typeuse*`} - -- (if ($unrollht(C, (typeuse : typeuse <: heaptype)) = SUB_subtype(`FINAL%?`_fin(?()), typeuse'*{typeuse' <- `typeuse'*`}, comptype')))*{comptype' <- `comptype'*`, typeuse <- `typeuse*`, `typeuse'*` <- `typeuse'**`} + -- (if ($unrollht(C, (typeuse : typeuse <: heaptype)) = SUB_subtype(?(), typeuse'*{typeuse' <- `typeuse'*`}, comptype')))*{comptype' <- `comptype'*`, typeuse <- `typeuse*`, `typeuse'*` <- `typeuse'**`} -- Comptype_ok: `%|-%:OK`(C, comptype) -- (Comptype_sub: `%|-%<:%`(C, comptype, comptype'))*{comptype' <- `comptype'*`} @@ -20767,8 +11918,8 @@ relation Limits_ok: `%|-%:%`(context, limits, nat) ;; 3-typing.watsup relation Globaltype_ok: `%|-%:OK`(context, globaltype) ;; 3-typing.watsup - rule _{C : context, t : valtype, w0 : ()?}: - `%|-%:OK`(C, `%%`_globaltype(`MUT%?`_mut(w0), t)) + rule _{C : context, t : valtype}: + `%|-%:OK`(C, `%%`_globaltype(MUT_MUT?{}, t)) -- Valtype_ok: `%|-%:OK`(C, t) ;; 3-typing.watsup @@ -20844,12 +11995,12 @@ relation Limits_sub: `%|-%<:%`(context, limits, limits) relation Globaltype_sub: `%|-%<:%`(context, globaltype, globaltype) ;; 3-typing.watsup rule const{C : context, valtype_1 : valtype, valtype_2 : valtype}: - `%|-%<:%`(C, `%%`_globaltype(`MUT%?`_mut(?()), valtype_1), `%%`_globaltype(`MUT%?`_mut(?()), valtype_2)) + `%|-%<:%`(C, `%%`_globaltype(?(), valtype_1), `%%`_globaltype(?(), valtype_2)) -- Valtype_sub: `%|-%<:%`(C, valtype_1, valtype_2) ;; 3-typing.watsup rule var{C : context, valtype_1 : valtype, valtype_2 : valtype}: - `%|-%<:%`(C, `%%`_globaltype(`MUT%?`_mut(?(())), valtype_1), `%%`_globaltype(`MUT%?`_mut(?(())), valtype_2)) + `%|-%<:%`(C, `%%`_globaltype(?(MUT_MUT), valtype_1), `%%`_globaltype(?(MUT_MUT), valtype_2)) -- Valtype_sub: `%|-%<:%`(C, valtype_1, valtype_2) -- Valtype_sub: `%|-%<:%`(C, valtype_2, valtype_1) @@ -20928,7 +12079,7 @@ relation Catch_ok: `%|-%:OK`(context, catch) rule catch_ref{C : context, x : idx, l : labelidx, `t*` : valtype*}: `%|-%:OK`(C, CATCH_REF_catch(x, l)) -- Expand: `%~~%`(C.TAGS_context[x!`%`_idx.0], FUNC_comptype(`%->%`_functype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([])))) - -- Resulttype_sub: `%|-%<:%`(C, t*{t <- `t*`} ++ [REF_valtype(`NULL%?`_nul(?()), EXN_heaptype)], C.LABELS_context[l!`%`_labelidx.0]!`%`_resulttype.0) + -- Resulttype_sub: `%|-%<:%`(C, t*{t <- `t*`} ++ [REF_valtype(?(), EXN_heaptype)], C.LABELS_context[l!`%`_labelidx.0]!`%`_resulttype.0) ;; 3-typing.watsup rule catch_all{C : context, l : labelidx}: @@ -20938,7 +12089,7 @@ relation Catch_ok: `%|-%:OK`(context, catch) ;; 3-typing.watsup rule catch_all_ref{C : context, l : labelidx}: `%|-%:OK`(C, CATCH_ALL_REF_catch(l)) - -- Resulttype_sub: `%|-%<:%`(C, [REF_valtype(`NULL%?`_nul(?()), EXN_heaptype)], C.LABELS_context[l!`%`_labelidx.0]!`%`_resulttype.0) + -- Resulttype_sub: `%|-%<:%`(C, [REF_valtype(?(), EXN_heaptype)], C.LABELS_context[l!`%`_labelidx.0]!`%`_resulttype.0) ;; 6-runtime-aux.watsup def $default_(valtype : valtype) : val? @@ -20949,9 +12100,9 @@ def $default_(valtype : valtype) : val? ;; 6-runtime-aux.watsup def $default_{Vnn : Vnn}((Vnn : Vnn <: valtype)) = ?(VCONST_val(Vnn, `%`_vec_(0))) ;; 6-runtime-aux.watsup - def $default_{ht : heaptype}(REF_valtype(`NULL%?`_nul(?(())), ht)) = ?(REF.NULL_val(ht)) + def $default_{ht : heaptype}(REF_valtype(?(NULL_NULL), ht)) = ?(REF.NULL_val(ht)) ;; 6-runtime-aux.watsup - def $default_{ht : heaptype}(REF_valtype(`NULL%?`_nul(?()), ht)) = ?() + def $default_{ht : heaptype}(REF_valtype(?(), ht)) = ?() ;; 3-typing.watsup relation Defaultable: `|-%DEFAULTABLE`(valtype) @@ -20981,12 +12132,12 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) ;; 3-typing.watsup:580.1-582.29 rule `select-expl`{C : context, t : valtype}: - `%|-%:%`(C, `SELECT()%?`_instr(?([t])), `%->_%%`_instrtype(`%`_resulttype([t t I32_valtype]), [], `%`_resulttype([t]))) + `%|-%:%`(C, SELECT_instr(?([t])), `%->_%%`_instrtype(`%`_resulttype([t t I32_valtype]), [], `%`_resulttype([t]))) -- Valtype_ok: `%|-%:OK`(C, t) ;; 3-typing.watsup:584.1-588.37 rule `select-impl`{C : context, t : valtype, t' : valtype, numtype : numtype, vectype : vectype}: - `%|-%:%`(C, `SELECT()%?`_instr(?()), `%->_%%`_instrtype(`%`_resulttype([t t I32_valtype]), [], `%`_resulttype([t]))) + `%|-%:%`(C, SELECT_instr(?()), `%->_%%`_instrtype(`%`_resulttype([t t I32_valtype]), [], `%`_resulttype([t]))) -- Valtype_ok: `%|-%:OK`(C, t) -- Valtype_sub: `%|-%<:%`(C, t, t') -- if ((t' = (numtype : numtype <: valtype)) \/ (t' = (vectype : vectype <: valtype))) @@ -21030,14 +12181,14 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) ;; 3-typing.watsup:638.1-641.31 rule br_on_null{C : context, l : labelidx, `t*` : valtype*, ht : heaptype}: - `%|-%:%`(C, BR_ON_NULL_instr(l), `%->_%%`_instrtype(`%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(`NULL%?`_nul(?(())), ht)]), [], `%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(`NULL%?`_nul(?()), ht)]))) + `%|-%:%`(C, BR_ON_NULL_instr(l), `%->_%%`_instrtype(`%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(?(NULL_NULL), ht)]), [], `%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(?(), ht)]))) -- if (C.LABELS_context[l!`%`_labelidx.0]!`%`_resulttype.0 = t*{t <- `t*`}) -- Heaptype_ok: `%|-%:OK`(C, ht) ;; 3-typing.watsup:643.1-645.34 rule br_on_non_null{C : context, l : labelidx, `t*` : valtype*, ht : heaptype}: - `%|-%:%`(C, BR_ON_NON_NULL_instr(l), `%->_%%`_instrtype(`%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(`NULL%?`_nul(?(())), ht)]), [], `%`_resulttype(t*{t <- `t*`}))) - -- if (C.LABELS_context[l!`%`_labelidx.0] = `%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(`NULL%?`_nul(?()), ht)])) + `%|-%:%`(C, BR_ON_NON_NULL_instr(l), `%->_%%`_instrtype(`%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(?(NULL_NULL), ht)]), [], `%`_resulttype(t*{t <- `t*`}))) + -- if (C.LABELS_context[l!`%`_labelidx.0] = `%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(?(), ht)])) ;; 3-typing.watsup:647.1-653.34 rule br_on_cast{C : context, l : labelidx, rt_1 : reftype, rt_2 : reftype, `t*` : valtype*, rt : reftype}: @@ -21064,35 +12215,35 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) ;; 3-typing.watsup:670.1-672.47 rule call_ref{C : context, x : idx, `t_1*` : valtype*, `t_2*` : valtype*}: - `%|-%:%`(C, CALL_REF_instr(_IDX_typeuse(x)), `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`} ++ [REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x))]), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) + `%|-%:%`(C, CALL_REF_instr(_IDX_typeuse(x)), `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`} ++ [REF_valtype(?(NULL_NULL), _IDX_heaptype(x))]), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], FUNC_comptype(`%->%`_functype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`})))) ;; 3-typing.watsup:674.1-678.47 rule call_indirect{C : context, x : idx, y : idx, `t_1*` : valtype*, at : addrtype, `t_2*` : valtype*, lim : limits, rt : reftype}: `%|-%:%`(C, CALL_INDIRECT_instr(x, _IDX_typeuse(y)), `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`} ++ [(at : addrtype <: valtype)]), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) -- if (C.TABLES_context[x!`%`_idx.0] = `%%%`_tabletype(at, lim, rt)) - -- Reftype_sub: `%|-%<:%`(C, rt, REF_reftype(`NULL%?`_nul(?(())), FUNC_heaptype)) + -- Reftype_sub: `%|-%<:%`(C, rt, REF_reftype(?(NULL_NULL), FUNC_heaptype)) -- Expand: `%~~%`(C.TYPES_context[y!`%`_idx.0], FUNC_comptype(`%->%`_functype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`})))) ;; 3-typing.watsup:680.1-683.42 rule return{C : context, `t_1*` : valtype*, `t*` : valtype*, `t_2*` : valtype*}: `%|-%:%`(C, RETURN_instr, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`} ++ t*{t <- `t*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) - -- if (C.RETURN_context = ?(`%`_list(t*{t <- `t*`}))) + -- if (C.RETURN_context = ?(`%`_resulttype(t*{t <- `t*`}))) -- Instrtype_ok: `%|-%:OK`(C, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) ;; 3-typing.watsup:686.1-691.42 rule return_call{C : context, x : idx, `t_3*` : valtype*, `t_1*` : valtype*, `t_4*` : valtype*, `t_2*` : valtype*, `t'_2*` : valtype*}: `%|-%:%`(C, RETURN_CALL_instr(x), `%->_%%`_instrtype(`%`_resulttype(t_3*{t_3 <- `t_3*`} ++ t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_4*{t_4 <- `t_4*`}))) -- Expand: `%~~%`(C.FUNCS_context[x!`%`_idx.0], FUNC_comptype(`%->%`_functype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`})))) - -- if (C.RETURN_context = ?(`%`_list(t'_2*{t'_2 <- `t'_2*`}))) + -- if (C.RETURN_context = ?(`%`_resulttype(t'_2*{t'_2 <- `t'_2*`}))) -- Resulttype_sub: `%|-%<:%`(C, t_2*{t_2 <- `t_2*`}, t'_2*{t'_2 <- `t'_2*`}) -- Instrtype_ok: `%|-%:OK`(C, `%->_%%`_instrtype(`%`_resulttype(t_3*{t_3 <- `t_3*`}), [], `%`_resulttype(t_4*{t_4 <- `t_4*`}))) ;; 3-typing.watsup:694.1-699.42 rule return_call_ref{C : context, x : idx, `t_3*` : valtype*, `t_1*` : valtype*, `t_4*` : valtype*, `t_2*` : valtype*, `t'_2*` : valtype*}: - `%|-%:%`(C, RETURN_CALL_REF_instr(_IDX_typeuse(x)), `%->_%%`_instrtype(`%`_resulttype(t_3*{t_3 <- `t_3*`} ++ t_1*{t_1 <- `t_1*`} ++ [REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x))]), [], `%`_resulttype(t_4*{t_4 <- `t_4*`}))) + `%|-%:%`(C, RETURN_CALL_REF_instr(_IDX_typeuse(x)), `%->_%%`_instrtype(`%`_resulttype(t_3*{t_3 <- `t_3*`} ++ t_1*{t_1 <- `t_1*`} ++ [REF_valtype(?(NULL_NULL), _IDX_heaptype(x))]), [], `%`_resulttype(t_4*{t_4 <- `t_4*`}))) -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], FUNC_comptype(`%->%`_functype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`})))) - -- if (C.RETURN_context = ?(`%`_list(t'_2*{t'_2 <- `t'_2*`}))) + -- if (C.RETURN_context = ?(`%`_resulttype(t'_2*{t'_2 <- `t'_2*`}))) -- Resulttype_sub: `%|-%<:%`(C, t_2*{t_2 <- `t_2*`}, t'_2*{t'_2 <- `t'_2*`}) -- Instrtype_ok: `%|-%:OK`(C, `%->_%%`_instrtype(`%`_resulttype(t_3*{t_3 <- `t_3*`}), [], `%`_resulttype(t_4*{t_4 <- `t_4*`}))) @@ -21100,9 +12251,9 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) rule return_call_indirect{C : context, x : idx, y : idx, `t_3*` : valtype*, `t_1*` : valtype*, at : addrtype, `t_4*` : valtype*, lim : limits, rt : reftype, `t_2*` : valtype*, `t'_2*` : valtype*}: `%|-%:%`(C, RETURN_CALL_INDIRECT_instr(x, _IDX_typeuse(y)), `%->_%%`_instrtype(`%`_resulttype(t_3*{t_3 <- `t_3*`} ++ t_1*{t_1 <- `t_1*`} ++ [(at : addrtype <: valtype)]), [], `%`_resulttype(t_4*{t_4 <- `t_4*`}))) -- if (C.TABLES_context[x!`%`_idx.0] = `%%%`_tabletype(at, lim, rt)) - -- Reftype_sub: `%|-%<:%`(C, rt, REF_reftype(`NULL%?`_nul(?(())), FUNC_heaptype)) + -- Reftype_sub: `%|-%<:%`(C, rt, REF_reftype(?(NULL_NULL), FUNC_heaptype)) -- Expand: `%~~%`(C.TYPES_context[y!`%`_idx.0], FUNC_comptype(`%->%`_functype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`})))) - -- if (C.RETURN_context = ?(`%`_list(t'_2*{t'_2 <- `t'_2*`}))) + -- if (C.RETURN_context = ?(`%`_resulttype(t'_2*{t'_2 <- `t'_2*`}))) -- Resulttype_sub: `%|-%<:%`(C, t_2*{t_2 <- `t_2*`}, t'_2*{t'_2 <- `t'_2*`}) -- Instrtype_ok: `%|-%:OK`(C, `%->_%%`_instrtype(`%`_resulttype(t_3*{t_3 <- `t_3*`}), [], `%`_resulttype(t_4*{t_4 <- `t_4*`}))) @@ -21114,7 +12265,7 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) ;; 3-typing.watsup:722.1-724.42 rule throw_ref{C : context, `t_1*` : valtype*, `t_2*` : valtype*}: - `%|-%:%`(C, THROW_REF_instr, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`} ++ [REF_valtype(`NULL%?`_nul(?(())), EXN_heaptype)]), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) + `%|-%:%`(C, THROW_REF_instr, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`} ++ [REF_valtype(?(NULL_NULL), EXN_heaptype)]), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) -- Instrtype_ok: `%|-%:OK`(C, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) ;; 3-typing.watsup:726.1-730.34 @@ -21150,32 +12301,32 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) ;; 3-typing.watsup:774.1-776.31 rule ref.null{C : context, ht : heaptype}: - `%|-%:%`(C, REF.NULL_instr(ht), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), ht)]))) + `%|-%:%`(C, REF.NULL_instr(ht), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([REF_valtype(?(NULL_NULL), ht)]))) -- Heaptype_ok: `%|-%:OK`(C, ht) ;; 3-typing.watsup:778.1-781.20 rule ref.func{C : context, x : idx, dt : deftype}: - `%|-%:%`(C, REF.FUNC_instr(x), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), (dt : deftype <: heaptype))]))) + `%|-%:%`(C, REF.FUNC_instr(x), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([REF_valtype(?(), (dt : deftype <: heaptype))]))) -- if (C.FUNCS_context[x!`%`_idx.0] = dt) -- if x <- C.REFS_context ;; 3-typing.watsup:783.1-784.34 rule ref.i31{C : context}: - `%|-%:%`(C, REF.I31_instr, `%->_%%`_instrtype(`%`_resulttype([I32_valtype]), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), I31_heaptype)]))) + `%|-%:%`(C, REF.I31_instr, `%->_%%`_instrtype(`%`_resulttype([I32_valtype]), [], `%`_resulttype([REF_valtype(?(), I31_heaptype)]))) ;; 3-typing.watsup:786.1-788.31 rule ref.is_null{C : context, ht : heaptype}: - `%|-%:%`(C, REF.IS_NULL_instr, `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), ht)]), [], `%`_resulttype([I32_valtype]))) + `%|-%:%`(C, REF.IS_NULL_instr, `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), ht)]), [], `%`_resulttype([I32_valtype]))) -- Heaptype_ok: `%|-%:OK`(C, ht) ;; 3-typing.watsup:790.1-792.31 rule ref.as_non_null{C : context, ht : heaptype}: - `%|-%:%`(C, REF.AS_NON_NULL_instr, `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), ht)]), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), ht)]))) + `%|-%:%`(C, REF.AS_NON_NULL_instr, `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), ht)]), [], `%`_resulttype([REF_valtype(?(), ht)]))) -- Heaptype_ok: `%|-%:OK`(C, ht) ;; 3-typing.watsup:794.1-795.51 rule ref.eq{C : context}: - `%|-%:%`(C, REF.EQ_instr, `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), EQ_heaptype) REF_valtype(`NULL%?`_nul(?(())), EQ_heaptype)]), [], `%`_resulttype([I32_valtype]))) + `%|-%:%`(C, REF.EQ_instr, `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), EQ_heaptype) REF_valtype(?(NULL_NULL), EQ_heaptype)]), [], `%`_resulttype([I32_valtype]))) ;; 3-typing.watsup:797.1-801.33 rule ref.test{C : context, rt : reftype, rt' : reftype}: @@ -21193,98 +12344,98 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) ;; 3-typing.watsup:812.1-813.42 rule i31.get{C : context, sx : sx}: - `%|-%:%`(C, I31.GET_instr(sx), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), I31_heaptype)]), [], `%`_resulttype([I32_valtype]))) + `%|-%:%`(C, I31.GET_instr(sx), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), I31_heaptype)]), [], `%`_resulttype([I32_valtype]))) ;; 3-typing.watsup:818.1-820.44 rule struct.new{C : context, x : idx, `zt*` : storagetype*, `mut*` : mut*}: - `%|-%:%`(C, STRUCT.NEW_instr(x), `%->_%%`_instrtype(`%`_resulttype($unpack(zt)*{zt <- `zt*`}), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), _IDX_heaptype(x))]))) + `%|-%:%`(C, STRUCT.NEW_instr(x), `%->_%%`_instrtype(`%`_resulttype($unpack(zt)*{zt <- `zt*`}), [], `%`_resulttype([REF_valtype(?(), _IDX_heaptype(x))]))) -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], STRUCT_comptype(`%`_structtype(`%%`_fieldtype(mut, zt)*{mut <- `mut*`, zt <- `zt*`}))) ;; 3-typing.watsup:822.1-825.48 rule struct.new_default{C : context, x : idx, `mut*` : mut*, `zt*` : storagetype*}: - `%|-%:%`(C, STRUCT.NEW_DEFAULT_instr(x), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), _IDX_heaptype(x))]))) + `%|-%:%`(C, STRUCT.NEW_DEFAULT_instr(x), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([REF_valtype(?(), _IDX_heaptype(x))]))) -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], STRUCT_comptype(`%`_structtype(`%%`_fieldtype(mut, zt)*{mut <- `mut*`, zt <- `zt*`}))) -- (Defaultable: `|-%DEFAULTABLE`($unpack(zt)))*{zt <- `zt*`} ;; 3-typing.watsup:827.1-831.39 rule struct.get{C : context, `sx?` : sx?, x : idx, i : u32, zt : storagetype, `yt*` : fieldtype*, mut : mut}: - `%|-%:%`(C, STRUCT.GET_instr(sx?{sx <- `sx?`}, x, i), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x))]), [], `%`_resulttype([$unpack(zt)]))) + `%|-%:%`(C, STRUCT.GET_instr(sx?{sx <- `sx?`}, x, i), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), _IDX_heaptype(x))]), [], `%`_resulttype([$unpack(zt)]))) -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], STRUCT_comptype(`%`_structtype(yt*{yt <- `yt*`}))) -- if (yt*{yt <- `yt*`}[i!`%`_u32.0] = `%%`_fieldtype(mut, zt)) -- if ((sx?{sx <- `sx?`} = ?()) <=> (zt = ($unpack(zt) : valtype <: storagetype))) ;; 3-typing.watsup:833.1-836.24 rule struct.set{C : context, x : idx, i : u32, zt : storagetype, `yt*` : fieldtype*}: - `%|-%:%`(C, STRUCT.SET_instr(x, i), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x)) $unpack(zt)]), [], `%`_resulttype([]))) + `%|-%:%`(C, STRUCT.SET_instr(x, i), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), _IDX_heaptype(x)) $unpack(zt)]), [], `%`_resulttype([]))) -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], STRUCT_comptype(`%`_structtype(yt*{yt <- `yt*`}))) - -- if (yt*{yt <- `yt*`}[i!`%`_u32.0] = `%%`_fieldtype(`MUT%?`_mut(?(())), zt)) + -- if (yt*{yt <- `yt*`}[i!`%`_u32.0] = `%%`_fieldtype(?(MUT_MUT), zt)) ;; 3-typing.watsup:841.1-843.42 rule array.new{C : context, x : idx, zt : storagetype, mut : mut}: - `%|-%:%`(C, ARRAY.NEW_instr(x), `%->_%%`_instrtype(`%`_resulttype([$unpack(zt) I32_valtype]), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), _IDX_heaptype(x))]))) + `%|-%:%`(C, ARRAY.NEW_instr(x), `%->_%%`_instrtype(`%`_resulttype([$unpack(zt) I32_valtype]), [], `%`_resulttype([REF_valtype(?(), _IDX_heaptype(x))]))) -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(mut, zt))) ;; 3-typing.watsup:845.1-848.45 rule array.new_default{C : context, x : idx, mut : mut, zt : storagetype}: - `%|-%:%`(C, ARRAY.NEW_DEFAULT_instr(x), `%->_%%`_instrtype(`%`_resulttype([I32_valtype]), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), _IDX_heaptype(x))]))) + `%|-%:%`(C, ARRAY.NEW_DEFAULT_instr(x), `%->_%%`_instrtype(`%`_resulttype([I32_valtype]), [], `%`_resulttype([REF_valtype(?(), _IDX_heaptype(x))]))) -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(mut, zt))) -- Defaultable: `|-%DEFAULTABLE`($unpack(zt)) ;; 3-typing.watsup:850.1-852.42 rule array.new_fixed{C : context, x : idx, n : n, zt : storagetype, mut : mut}: - `%|-%:%`(C, ARRAY.NEW_FIXED_instr(x, `%`_u32(n)), `%->_%%`_instrtype(`%`_resulttype($unpack(zt)^n{}), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), _IDX_heaptype(x))]))) + `%|-%:%`(C, ARRAY.NEW_FIXED_instr(x, `%`_u32(n)), `%->_%%`_instrtype(`%`_resulttype($unpack(zt)^n{}), [], `%`_resulttype([REF_valtype(?(), _IDX_heaptype(x))]))) -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(mut, zt))) ;; 3-typing.watsup:854.1-857.40 rule array.new_elem{C : context, x : idx, y : idx, mut : mut, rt : reftype}: - `%|-%:%`(C, ARRAY.NEW_ELEM_instr(x, y), `%->_%%`_instrtype(`%`_resulttype([I32_valtype I32_valtype]), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), _IDX_heaptype(x))]))) + `%|-%:%`(C, ARRAY.NEW_ELEM_instr(x, y), `%->_%%`_instrtype(`%`_resulttype([I32_valtype I32_valtype]), [], `%`_resulttype([REF_valtype(?(), _IDX_heaptype(x))]))) -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(mut, (rt : reftype <: storagetype)))) -- Reftype_sub: `%|-%<:%`(C, C.ELEMS_context[y!`%`_idx.0], rt) ;; 3-typing.watsup:859.1-863.24 rule array.new_data{C : context, x : idx, y : idx, mut : mut, zt : storagetype, numtype : numtype, vectype : vectype}: - `%|-%:%`(C, ARRAY.NEW_DATA_instr(x, y), `%->_%%`_instrtype(`%`_resulttype([I32_valtype I32_valtype]), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), _IDX_heaptype(x))]))) + `%|-%:%`(C, ARRAY.NEW_DATA_instr(x, y), `%->_%%`_instrtype(`%`_resulttype([I32_valtype I32_valtype]), [], `%`_resulttype([REF_valtype(?(), _IDX_heaptype(x))]))) -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(mut, zt))) -- if (($unpack(zt) = (numtype : numtype <: valtype)) \/ ($unpack(zt) = (vectype : vectype <: valtype))) -- if (C.DATAS_context[y!`%`_idx.0] = OK_datatype) ;; 3-typing.watsup:865.1-868.39 rule array.get{C : context, `sx?` : sx?, x : idx, zt : storagetype, mut : mut}: - `%|-%:%`(C, ARRAY.GET_instr(sx?{sx <- `sx?`}, x), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x)) I32_valtype]), [], `%`_resulttype([$unpack(zt)]))) + `%|-%:%`(C, ARRAY.GET_instr(sx?{sx <- `sx?`}, x), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), _IDX_heaptype(x)) I32_valtype]), [], `%`_resulttype([$unpack(zt)]))) -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(mut, zt))) -- if ((sx?{sx <- `sx?`} = ?()) <=> (zt = ($unpack(zt) : valtype <: storagetype))) ;; 3-typing.watsup:870.1-872.42 rule array.set{C : context, x : idx, zt : storagetype}: - `%|-%:%`(C, ARRAY.SET_instr(x), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x)) I32_valtype $unpack(zt)]), [], `%`_resulttype([]))) - -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(`MUT%?`_mut(?(())), zt))) + `%|-%:%`(C, ARRAY.SET_instr(x), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), _IDX_heaptype(x)) I32_valtype $unpack(zt)]), [], `%`_resulttype([]))) + -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(?(MUT_MUT), zt))) ;; 3-typing.watsup:874.1-875.43 rule array.len{C : context}: - `%|-%:%`(C, ARRAY.LEN_instr, `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), ARRAY_heaptype)]), [], `%`_resulttype([I32_valtype]))) + `%|-%:%`(C, ARRAY.LEN_instr, `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), ARRAY_heaptype)]), [], `%`_resulttype([I32_valtype]))) ;; 3-typing.watsup:877.1-879.42 rule array.fill{C : context, x : idx, zt : storagetype}: - `%|-%:%`(C, ARRAY.FILL_instr(x), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x)) I32_valtype $unpack(zt) I32_valtype]), [], `%`_resulttype([]))) - -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(`MUT%?`_mut(?(())), zt))) + `%|-%:%`(C, ARRAY.FILL_instr(x), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), _IDX_heaptype(x)) I32_valtype $unpack(zt) I32_valtype]), [], `%`_resulttype([]))) + -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(?(MUT_MUT), zt))) ;; 3-typing.watsup:881.1-885.40 rule array.copy{C : context, x_1 : idx, x_2 : idx, zt_1 : storagetype, mut : mut, zt_2 : storagetype}: - `%|-%:%`(C, ARRAY.COPY_instr(x_1, x_2), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x_1)) I32_valtype REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x_2)) I32_valtype I32_valtype]), [], `%`_resulttype([]))) - -- Expand: `%~~%`(C.TYPES_context[x_1!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(`MUT%?`_mut(?(())), zt_1))) + `%|-%:%`(C, ARRAY.COPY_instr(x_1, x_2), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), _IDX_heaptype(x_1)) I32_valtype REF_valtype(?(NULL_NULL), _IDX_heaptype(x_2)) I32_valtype I32_valtype]), [], `%`_resulttype([]))) + -- Expand: `%~~%`(C.TYPES_context[x_1!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(?(MUT_MUT), zt_1))) -- Expand: `%~~%`(C.TYPES_context[x_2!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(mut, zt_2))) -- Storagetype_sub: `%|-%<:%`(C, zt_2, zt_1) ;; 3-typing.watsup:887.1-890.44 rule array.init_elem{C : context, x : idx, y : idx, zt : storagetype}: - `%|-%:%`(C, ARRAY.INIT_ELEM_instr(x, y), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x)) I32_valtype I32_valtype I32_valtype]), [], `%`_resulttype([]))) - -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(`MUT%?`_mut(?(())), zt))) + `%|-%:%`(C, ARRAY.INIT_ELEM_instr(x, y), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), _IDX_heaptype(x)) I32_valtype I32_valtype I32_valtype]), [], `%`_resulttype([]))) + -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(?(MUT_MUT), zt))) -- Storagetype_sub: `%|-%<:%`(C, (C.ELEMS_context[y!`%`_idx.0] : reftype <: storagetype), zt) ;; 3-typing.watsup:892.1-896.24 rule array.init_data{C : context, x : idx, y : idx, zt : storagetype, numtype : numtype, vectype : vectype}: - `%|-%:%`(C, ARRAY.INIT_DATA_instr(x, y), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x)) I32_valtype I32_valtype I32_valtype]), [], `%`_resulttype([]))) - -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(`MUT%?`_mut(?(())), zt))) + `%|-%:%`(C, ARRAY.INIT_DATA_instr(x, y), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), _IDX_heaptype(x)) I32_valtype I32_valtype I32_valtype]), [], `%`_resulttype([]))) + -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(?(MUT_MUT), zt))) -- if (($unpack(zt) = (numtype : numtype <: valtype)) \/ ($unpack(zt) = (vectype : vectype <: valtype))) -- if (C.DATAS_context[y!`%`_idx.0] = OK_datatype) @@ -21412,7 +12563,7 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) ;; 3-typing.watsup:1003.1-1005.29 rule global.set{C : context, x : idx, t : valtype}: `%|-%:%`(C, GLOBAL.SET_instr(x), `%->_%%`_instrtype(`%`_resulttype([t]), [], `%`_resulttype([]))) - -- if (C.GLOBALS_context[x!`%`_idx.0] = `%%`_globaltype(`MUT%?`_mut(?(())), t)) + -- if (C.GLOBALS_context[x!`%`_idx.0] = `%%`_globaltype(?(MUT_MUT), t)) ;; 3-typing.watsup:1010.1-1012.32 rule table.get{C : context, x : idx, at : addrtype, rt : reftype, lim : limits}: @@ -21652,7 +12803,7 @@ relation Instr_const: `%|-%CONST`(context, instr) ;; 3-typing.watsup rule global.get{C : context, x : idx, t : valtype}: `%|-%CONST`(C, GLOBAL.GET_instr(x)) - -- if (C.GLOBALS_context[x!`%`_idx.0] = `%%`_globaltype(`MUT%?`_mut(?()), t)) + -- if (C.GLOBALS_context[x!`%`_idx.0] = `%%`_globaltype(?(), t)) ;; 3-typing.watsup rule binop{C : context, Inn : Inn, binop : binop_((Inn : Inn <: numtype))}: @@ -23398,38 +14549,38 @@ rec { relation Ref_type: `%|-%:%`(store, ref, reftype) ;; 7-runtime-typing.watsup:17.1-18.35 rule null{s : store, ht : heaptype}: - `%|-%:%`(s, REF.NULL_ref(ht), REF_reftype(`NULL%?`_nul(?(())), ht)) + `%|-%:%`(s, REF.NULL_ref(ht), REF_reftype(?(NULL_NULL), ht)) ;; 7-runtime-typing.watsup:20.1-21.37 rule i31{s : store, i : u31}: - `%|-%:%`(s, REF.I31_NUM_ref(i), REF_reftype(`NULL%?`_nul(?()), I31_heaptype)) + `%|-%:%`(s, REF.I31_NUM_ref(i), REF_reftype(?(), I31_heaptype)) ;; 7-runtime-typing.watsup:23.1-25.31 rule struct{s : store, a : addr, dt : deftype}: - `%|-%:%`(s, REF.STRUCT_ADDR_ref(a), REF_reftype(`NULL%?`_nul(?()), (dt : deftype <: heaptype))) + `%|-%:%`(s, REF.STRUCT_ADDR_ref(a), REF_reftype(?(), (dt : deftype <: heaptype))) -- if (s.STRUCTS_store[a].TYPE_structinst = dt) ;; 7-runtime-typing.watsup:27.1-29.30 rule array{s : store, a : addr, dt : deftype}: - `%|-%:%`(s, REF.ARRAY_ADDR_ref(a), REF_reftype(`NULL%?`_nul(?()), (dt : deftype <: heaptype))) + `%|-%:%`(s, REF.ARRAY_ADDR_ref(a), REF_reftype(?(), (dt : deftype <: heaptype))) -- if (s.ARRAYS_store[a].TYPE_arrayinst = dt) ;; 7-runtime-typing.watsup:31.1-33.29 rule func{s : store, a : addr, dt : deftype}: - `%|-%:%`(s, REF.FUNC_ADDR_ref(a), REF_reftype(`NULL%?`_nul(?()), (dt : deftype <: heaptype))) + `%|-%:%`(s, REF.FUNC_ADDR_ref(a), REF_reftype(?(), (dt : deftype <: heaptype))) -- if (s.FUNCS_store[a].TYPE_funcinst = dt) ;; 7-runtime-typing.watsup:35.1-36.38 rule exn{s : store, a : addr}: - `%|-%:%`(s, REF.EXN_ADDR_ref(a), REF_reftype(`NULL%?`_nul(?()), EXN_heaptype)) + `%|-%:%`(s, REF.EXN_ADDR_ref(a), REF_reftype(?(), EXN_heaptype)) ;; 7-runtime-typing.watsup:38.1-39.39 rule host{s : store, a : addr}: - `%|-%:%`(s, REF.HOST_ADDR_ref(a), REF_reftype(`NULL%?`_nul(?()), ANY_heaptype)) + `%|-%:%`(s, REF.HOST_ADDR_ref(a), REF_reftype(?(), ANY_heaptype)) ;; 7-runtime-typing.watsup:41.1-42.45 rule extern{s : store, addrref : addrref}: - `%|-%:%`(s, REF.EXTERN_ref(addrref), REF_reftype(`NULL%?`_nul(?()), EXTERN_heaptype)) + `%|-%:%`(s, REF.EXTERN_ref(addrref), REF_reftype(?(), EXTERN_heaptype)) ;; 7-runtime-typing.watsup:44.1-47.34 rule sub{s : store, ref : ref, rt : reftype, rt' : reftype}: @@ -23508,12 +14659,12 @@ relation Step_pure: `%~>%`(instr*, instr*) ;; 8-reduction.watsup rule `select-true`{val_1 : val, val_2 : val, c : num_(I32_numtype), `t*?` : valtype*?}: - `%~>%`([(val_1 : val <: instr) (val_2 : val <: instr) CONST_instr(I32_numtype, c) `SELECT()%?`_instr(t*{t <- `t*`}?{`t*` <- `t*?`})], [(val_1 : val <: instr)]) + `%~>%`([(val_1 : val <: instr) (val_2 : val <: instr) CONST_instr(I32_numtype, c) SELECT_instr(t*{t <- `t*`}?{`t*` <- `t*?`})], [(val_1 : val <: instr)]) -- if (c!`%`_num_.0 =/= 0) ;; 8-reduction.watsup rule `select-false`{val_1 : val, val_2 : val, c : num_(I32_numtype), `t*?` : valtype*?}: - `%~>%`([(val_1 : val <: instr) (val_2 : val <: instr) CONST_instr(I32_numtype, c) `SELECT()%?`_instr(t*{t <- `t*`}?{`t*` <- `t*?`})], [(val_2 : val <: instr)]) + `%~>%`([(val_1 : val <: instr) (val_2 : val <: instr) CONST_instr(I32_numtype, c) SELECT_instr(t*{t <- `t*`}?{`t*` <- `t*?`})], [(val_2 : val <: instr)]) -- if (c!`%`_num_.0 = 0) ;; 8-reduction.watsup @@ -23586,11 +14737,11 @@ relation Step_pure: `%~>%`(instr*, instr*) ;; 8-reduction.watsup rule call_indirect{x : idx, yy : typeuse}: - `%~>%`([CALL_INDIRECT_instr(x, yy)], [TABLE.GET_instr(x) REF.CAST_instr(REF_reftype(`NULL%?`_nul(?(())), (yy : typeuse <: heaptype))) CALL_REF_instr(yy)]) + `%~>%`([CALL_INDIRECT_instr(x, yy)], [TABLE.GET_instr(x) REF.CAST_instr(REF_reftype(?(NULL_NULL), (yy : typeuse <: heaptype))) CALL_REF_instr(yy)]) ;; 8-reduction.watsup rule return_call_indirect{x : idx, yy : typeuse}: - `%~>%`([RETURN_CALL_INDIRECT_instr(x, yy)], [TABLE.GET_instr(x) REF.CAST_instr(REF_reftype(`NULL%?`_nul(?(())), (yy : typeuse <: heaptype))) RETURN_CALL_REF_instr(yy)]) + `%~>%`([RETURN_CALL_INDIRECT_instr(x, yy)], [TABLE.GET_instr(x) REF.CAST_instr(REF_reftype(?(NULL_NULL), (yy : typeuse <: heaptype))) RETURN_CALL_REF_instr(yy)]) ;; 8-reduction.watsup rule `frame-vals`{n : n, f : frame, `val*` : val*}: @@ -25059,11 +16210,11 @@ grammar Bheaptype : heaptype ;; A-binary.watsup grammar Breftype : reftype ;; A-binary.watsup - prod{ht : heaptype} {0x63 ht:Bheaptype} => REF_reftype(`NULL%?`_nul(?(())), ht) + prod{ht : heaptype} {0x63 ht:Bheaptype} => REF_reftype(?(NULL_NULL), ht) ;; A-binary.watsup - prod{ht : heaptype} {0x64 ht:Bheaptype} => REF_reftype(`NULL%?`_nul(?()), ht) + prod{ht : heaptype} {0x64 ht:Bheaptype} => REF_reftype(?(), ht) ;; A-binary.watsup - prod{ht : heaptype} ht:Babsheaptype => REF_reftype(`NULL%?`_nul(?(())), ht) + prod{ht : heaptype} ht:Babsheaptype => REF_reftype(?(NULL_NULL), ht) ;; A-binary.watsup grammar Bvaltype : valtype @@ -25082,9 +16233,9 @@ grammar Bresulttype : resulttype ;; A-binary.watsup grammar Bmut : mut ;; A-binary.watsup - prod 0x00 => `MUT%?`_mut(?()) + prod 0x00 => ?() ;; A-binary.watsup - prod 0x01 => `MUT%?`_mut(?(())) + prod 0x01 => ?(MUT_MUT) ;; A-binary.watsup grammar Bpacktype : packtype @@ -25117,11 +16268,11 @@ grammar Bcomptype : comptype ;; A-binary.watsup grammar Bsubtype : subtype ;; A-binary.watsup - prod{`x*` : idx*, ct : comptype} {0x4F x*{x <- `x*`}:Blist(syntax typeidx, grammar Btypeidx) ct:Bcomptype} => SUB_subtype(`FINAL%?`_fin(?(())), _IDX_typeuse(x)*{x <- `x*`}, ct) + prod{`x*` : idx*, ct : comptype} {0x4F x*{x <- `x*`}:Blist(syntax typeidx, grammar Btypeidx) ct:Bcomptype} => SUB_subtype(?(FINAL_FINAL), _IDX_typeuse(x)*{x <- `x*`}, ct) ;; A-binary.watsup - prod{`x*` : idx*, ct : comptype} {0x50 x*{x <- `x*`}:Blist(syntax typeidx, grammar Btypeidx) ct:Bcomptype} => SUB_subtype(`FINAL%?`_fin(?()), _IDX_typeuse(x)*{x <- `x*`}, ct) + prod{`x*` : idx*, ct : comptype} {0x50 x*{x <- `x*`}:Blist(syntax typeidx, grammar Btypeidx) ct:Bcomptype} => SUB_subtype(?(), _IDX_typeuse(x)*{x <- `x*`}, ct) ;; A-binary.watsup - prod{ct : comptype} ct:Bcomptype => SUB_subtype(`FINAL%?`_fin(?(())), [], ct) + prod{ct : comptype} ct:Bcomptype => SUB_subtype(?(FINAL_FINAL), [], ct) ;; A-binary.watsup grammar Brectype : rectype @@ -25201,13 +16352,13 @@ syntax castop = (nul, nul) ;; A-binary.watsup grammar Bcastop : castop ;; A-binary.watsup - prod 0x00 => (`NULL%?`_nul(?()), `NULL%?`_nul(?())) + prod 0x00 => (?(), ?()) ;; A-binary.watsup - prod 0x01 => (`NULL%?`_nul(?(())), `NULL%?`_nul(?())) + prod 0x01 => (?(NULL_NULL), ?()) ;; A-binary.watsup - prod 0x02 => (`NULL%?`_nul(?()), `NULL%?`_nul(?(()))) + prod 0x02 => (?(), ?(NULL_NULL)) ;; A-binary.watsup - prod 0x03 => (`NULL%?`_nul(?(())), `NULL%?`_nul(?(()))) + prod 0x03 => (?(NULL_NULL), ?(NULL_NULL)) ;; A-binary.watsup syntax memidxop = (memidx, memarg) @@ -25320,13 +16471,13 @@ grammar Binstr : instr ;; A-binary.watsup:286.5-286.62 prod{x : idx, y : idx} {0xFB `%`_u32(19):Bu32 x:Btypeidx y:Belemidx} => ARRAY.INIT_ELEM_instr(x, y) ;; A-binary.watsup:290.5-290.51 - prod{ht : heaptype} {0xFB `%`_u32(20):Bu32 ht:Bheaptype} => REF.TEST_instr(REF_reftype(`NULL%?`_nul(?()), ht)) + prod{ht : heaptype} {0xFB `%`_u32(20):Bu32 ht:Bheaptype} => REF.TEST_instr(REF_reftype(?(), ht)) ;; A-binary.watsup:291.5-291.56 - prod{ht : heaptype} {0xFB `%`_u32(21):Bu32 ht:Bheaptype} => REF.TEST_instr(REF_reftype(`NULL%?`_nul(?(())), ht)) + prod{ht : heaptype} {0xFB `%`_u32(21):Bu32 ht:Bheaptype} => REF.TEST_instr(REF_reftype(?(NULL_NULL), ht)) ;; A-binary.watsup:292.5-292.51 - prod{ht : heaptype} {0xFB `%`_u32(22):Bu32 ht:Bheaptype} => REF.CAST_instr(REF_reftype(`NULL%?`_nul(?()), ht)) + prod{ht : heaptype} {0xFB `%`_u32(22):Bu32 ht:Bheaptype} => REF.CAST_instr(REF_reftype(?(), ht)) ;; A-binary.watsup:293.5-293.56 - prod{ht : heaptype} {0xFB `%`_u32(23):Bu32 ht:Bheaptype} => REF.CAST_instr(REF_reftype(`NULL%?`_nul(?(())), ht)) + prod{ht : heaptype} {0xFB `%`_u32(23):Bu32 ht:Bheaptype} => REF.CAST_instr(REF_reftype(?(NULL_NULL), ht)) ;; A-binary.watsup:294.5-295.94 prod{nul1 : nul1, nul2 : nul2, l : labelidx, ht_1 : heaptype, ht_2 : heaptype} {0xFB `%`_u32(24):Bu32 (nul1, nul2):Bcastop l:Blabelidx ht_1:Bheaptype ht_2:Bheaptype} => BR_ON_CAST_instr(l, REF_reftype(nul1, ht_1), REF_reftype(nul2, ht_2)) ;; A-binary.watsup:296.5-297.99 @@ -25344,9 +16495,9 @@ grammar Binstr : instr ;; A-binary.watsup:315.5-315.17 prod 0x1A => DROP_instr ;; A-binary.watsup:316.5-316.19 - prod 0x1B => `SELECT()%?`_instr(?()) + prod 0x1B => SELECT_instr(?()) ;; A-binary.watsup:317.5-317.41 - prod{ts : valtype} {0x1C [ts]:Blist(syntax valtype, grammar Bvaltype)} => `SELECT()%?`_instr(?([ts])) + prod{ts : valtype} {0x1C [ts]:Blist(syntax valtype, grammar Bvaltype)} => SELECT_instr(?([ts])) ;; A-binary.watsup:324.5-324.36 prod{x : idx} {0x20 x:Blocalidx} => LOCAL.GET_instr(x) ;; A-binary.watsup:325.5-325.36 @@ -26269,7 +17420,7 @@ grammar Bfuncsec : typeidx* grammar Btable : table ;; A-binary.watsup prod{tt : tabletype, ht : heaptype, at : addrtype, lim : limits} tt:Btabletype => TABLE_table(tt, [REF.NULL_instr(ht)]) - -- if (tt = `%%%`_tabletype(at, lim, REF_reftype(`NULL%?`_nul(()?{}), ht))) + -- if (tt = `%%%`_tabletype(at, lim, REF_reftype(NULL_NULL?{}, ht))) ;; A-binary.watsup prod{tt : tabletype, e : expr} {0x40 0x00 tt:Btabletype e:Bexpr} => TABLE_table(tt, e) @@ -26324,24 +17475,24 @@ grammar Bstartsec : start? ;; A-binary.watsup grammar Belemkind : reftype ;; A-binary.watsup - prod 0x00 => REF_reftype(`NULL%?`_nul(?(())), FUNC_heaptype) + prod 0x00 => REF_reftype(?(NULL_NULL), FUNC_heaptype) ;; A-binary.watsup grammar Belem : elem ;; A-binary.watsup - prod{e_o : expr, `y*` : idx*} {`%`_u32(0):Bu32 e_o:Bexpr y*{y <- `y*`}:Blist(syntax funcidx, grammar Bfuncidx)} => ELEM_elem(REF_reftype(`NULL%?`_nul(?()), FUNC_heaptype), [REF.FUNC_instr(y)]*{y <- `y*`}, ACTIVE_elemmode(`%`_tableidx(0), e_o)) + prod{e_o : expr, `y*` : idx*} {`%`_u32(0):Bu32 e_o:Bexpr y*{y <- `y*`}:Blist(syntax funcidx, grammar Bfuncidx)} => ELEM_elem(REF_reftype(?(), FUNC_heaptype), [REF.FUNC_instr(y)*{y <- `y*`}], ACTIVE_elemmode(`%`_tableidx(0), e_o)) ;; A-binary.watsup - prod{rt : reftype, `y*` : idx*} {`%`_u32(1):Bu32 rt:Belemkind y*{y <- `y*`}:Blist(syntax funcidx, grammar Bfuncidx)} => ELEM_elem(rt, [REF.FUNC_instr(y)]*{y <- `y*`}, PASSIVE_elemmode) + prod{rt : reftype, `y*` : idx*} {`%`_u32(1):Bu32 rt:Belemkind y*{y <- `y*`}:Blist(syntax funcidx, grammar Bfuncidx)} => ELEM_elem(rt, [REF.FUNC_instr(y)*{y <- `y*`}], PASSIVE_elemmode) ;; A-binary.watsup - prod{x : idx, e : expr, rt : reftype, `y*` : idx*} {`%`_u32(2):Bu32 x:Btableidx e:Bexpr rt:Belemkind y*{y <- `y*`}:Blist(syntax funcidx, grammar Bfuncidx)} => ELEM_elem(rt, [REF.FUNC_instr(y)]*{y <- `y*`}, ACTIVE_elemmode(x, e)) + prod{x : idx, e : expr, rt : reftype, `y*` : idx*} {`%`_u32(2):Bu32 x:Btableidx e:Bexpr rt:Belemkind y*{y <- `y*`}:Blist(syntax funcidx, grammar Bfuncidx)} => ELEM_elem(rt, [REF.FUNC_instr(y)*{y <- `y*`}], ACTIVE_elemmode(x, e)) ;; A-binary.watsup - prod{rt : reftype, `y*` : idx*} {`%`_u32(3):Bu32 rt:Belemkind y*{y <- `y*`}:Blist(syntax funcidx, grammar Bfuncidx)} => ELEM_elem(rt, [REF.FUNC_instr(y)]*{y <- `y*`}, DECLARE_elemmode) + prod{rt : reftype, `y*` : idx*} {`%`_u32(3):Bu32 rt:Belemkind y*{y <- `y*`}:Blist(syntax funcidx, grammar Bfuncidx)} => ELEM_elem(rt, [REF.FUNC_instr(y)*{y <- `y*`}], DECLARE_elemmode) ;; A-binary.watsup - prod{e_O : expr, `e*` : expr*} {`%`_u32(4):Bu32 e_O:Bexpr e*{e <- `e*`}:Blist(syntax expr, grammar Bexpr)} => ELEM_elem(REF_reftype(`NULL%?`_nul(?(())), FUNC_heaptype), e*{e <- `e*`}, ACTIVE_elemmode(`%`_tableidx(0), e_O)) + prod{e_O : expr, `e*` : expr*} {`%`_u32(4):Bu32 e_O:Bexpr e*{e <- `e*`}:Blist(syntax expr, grammar Bexpr)} => ELEM_elem(REF_reftype(?(NULL_NULL), FUNC_heaptype), e*{e <- `e*`}, ACTIVE_elemmode(`%`_tableidx(0), e_O)) ;; A-binary.watsup prod{rt : reftype, `e*` : expr*} {`%`_u32(5):Bu32 rt:Breftype e*{e <- `e*`}:Blist(syntax expr, grammar Bexpr)} => ELEM_elem(rt, e*{e <- `e*`}, PASSIVE_elemmode) ;; A-binary.watsup - prod{x : idx, e_O : expr, `e*` : expr*} {`%`_u32(6):Bu32 x:Btableidx e_O:Bexpr e*{e <- `e*`}:Blist(syntax expr, grammar Bexpr)} => ELEM_elem(REF_reftype(`NULL%?`_nul(?(())), FUNC_heaptype), e*{e <- `e*`}, ACTIVE_elemmode(x, e_O)) + prod{x : idx, e_O : expr, `e*` : expr*} {`%`_u32(6):Bu32 x:Btableidx e_O:Bexpr e*{e <- `e*`}:Blist(syntax expr, grammar Bexpr)} => ELEM_elem(REF_reftype(?(NULL_NULL), FUNC_heaptype), e*{e <- `e*`}, ACTIVE_elemmode(x, e_O)) ;; A-binary.watsup prod{rt : reftype, `e*` : expr*} {`%`_u32(7):Bu32 rt:Breftype e*{e <- `e*`}:Blist(syntax expr, grammar Bexpr)} => ELEM_elem(rt, e*{e <- `e*`}, DECLARE_elemmode) @@ -26392,7 +17543,7 @@ grammar Bdatasec : data* ;; A-binary.watsup grammar Bdatacnt : u32* ;; A-binary.watsup - prod{n : n} `%`_u32(n):Bu32 => [`%`_uN(n)] + prod{n : n} `%`_u32(n):Bu32 => [`%`_u32(n)] ;; A-binary.watsup syntax nopt = u32* @@ -26448,8 +17599,7 @@ syntax symsplit = | _LAST{A_2 : A}(A_2 : A) ;; C-conventions.watsup -syntax recorddots = - | `()` +syntax recorddots = () ;; C-conventions.watsup syntax record = @@ -26571,9 +17721,21 @@ grammar Bsym : A ;; C-conventions.watsup prod (Bvar(syntax symdots) | Bvar(syntax B)) => $var(syntax A) -== IL Validation after pass wildcards... +== IL Validation after pass totalize... == Running pass sideconditions... +;; 1-syntax.watsup +syntax NULL = + | NULL + +;; 1-syntax.watsup +syntax MUT = + | MUT + +;; 1-syntax.watsup +syntax FINAL = + | FINAL + ;; 0-aux.watsup syntax N = nat @@ -26807,7 +17969,7 @@ syntax fNmag{N : N}(N) = | SUBNORM{m : m, exp : exp}(m : m) -- if ((m < (2 ^ $M(N))) /\ (((2 : nat <:> int) - ((2 ^ ((($E(N) : nat <:> int) - (1 : nat <:> int)) : int <:> nat)) : nat <:> int)) = exp)) | INF - | `NAN(%)`{m : m}(m : m) + | NAN{m : m}(m : m) -- if ((1 <= m) /\ (m < (2 ^ $M(N)))) ;; 1-syntax.watsup @@ -26936,16 +18098,13 @@ syntax externidx = | TAG{tagidx : tagidx}(tagidx : tagidx) ;; 1-syntax.watsup -syntax nul = - | `NULL%?`(()?) +syntax nul = NULL? ;; 1-syntax.watsup -syntax nul1 = - | `NULL%?`(()?) +syntax nul1 = NULL? ;; 1-syntax.watsup -syntax nul2 = - | `NULL%?`(()?) +syntax nul2 = NULL? ;; 1-syntax.watsup syntax addrtype = @@ -26988,12 +18147,10 @@ syntax absheaptype = | BOT ;; 1-syntax.watsup -syntax mut = - | `MUT%?`(()?) +syntax mut = MUT? ;; 1-syntax.watsup -syntax fin = - | `FINAL%?`(()?) +syntax fin = FINAL? ;; 1-syntax.watsup rec { @@ -27115,52 +18272,52 @@ syntax Cnn = ;; 1-syntax.watsup def $ANYREF : reftype ;; 1-syntax.watsup - def $ANYREF = REF_reftype(`NULL%?`_nul(?(())), ANY_heaptype) + def $ANYREF = REF_reftype(?(NULL_NULL), ANY_heaptype) ;; 1-syntax.watsup def $EQREF : reftype ;; 1-syntax.watsup - def $EQREF = REF_reftype(`NULL%?`_nul(?(())), EQ_heaptype) + def $EQREF = REF_reftype(?(NULL_NULL), EQ_heaptype) ;; 1-syntax.watsup def $I31REF : reftype ;; 1-syntax.watsup - def $I31REF = REF_reftype(`NULL%?`_nul(?(())), I31_heaptype) + def $I31REF = REF_reftype(?(NULL_NULL), I31_heaptype) ;; 1-syntax.watsup def $STRUCTREF : reftype ;; 1-syntax.watsup - def $STRUCTREF = REF_reftype(`NULL%?`_nul(?(())), STRUCT_heaptype) + def $STRUCTREF = REF_reftype(?(NULL_NULL), STRUCT_heaptype) ;; 1-syntax.watsup def $ARRAYREF : reftype ;; 1-syntax.watsup - def $ARRAYREF = REF_reftype(`NULL%?`_nul(?(())), ARRAY_heaptype) + def $ARRAYREF = REF_reftype(?(NULL_NULL), ARRAY_heaptype) ;; 1-syntax.watsup def $FUNCREF : reftype ;; 1-syntax.watsup - def $FUNCREF = REF_reftype(`NULL%?`_nul(?(())), FUNC_heaptype) + def $FUNCREF = REF_reftype(?(NULL_NULL), FUNC_heaptype) ;; 1-syntax.watsup def $EXTERNREF : reftype ;; 1-syntax.watsup - def $EXTERNREF = REF_reftype(`NULL%?`_nul(?(())), EXTERN_heaptype) + def $EXTERNREF = REF_reftype(?(NULL_NULL), EXTERN_heaptype) ;; 1-syntax.watsup def $NULLREF : reftype ;; 1-syntax.watsup - def $NULLREF = REF_reftype(`NULL%?`_nul(?(())), NONE_heaptype) + def $NULLREF = REF_reftype(?(NULL_NULL), NONE_heaptype) ;; 1-syntax.watsup def $NULLFUNCREF : reftype ;; 1-syntax.watsup - def $NULLFUNCREF = REF_reftype(`NULL%?`_nul(?(())), NOFUNC_heaptype) + def $NULLFUNCREF = REF_reftype(?(NULL_NULL), NOFUNC_heaptype) ;; 1-syntax.watsup def $NULLEXTERNREF : reftype ;; 1-syntax.watsup - def $NULLEXTERNREF = REF_reftype(`NULL%?`_nul(?(())), NOEXTERN_heaptype) + def $NULLEXTERNREF = REF_reftype(?(NULL_NULL), NOEXTERN_heaptype) ;; 1-syntax.watsup syntax packtype = @@ -27198,12 +18355,10 @@ syntax Lnn = | I16 ;; 1-syntax.watsup -syntax mut1 = - | `MUT%?`(()?) +syntax mut1 = MUT? ;; 1-syntax.watsup -syntax mut2 = - | `MUT%?`(()?) +syntax mut2 = MUT? ;; 1-syntax.watsup syntax limits = @@ -27903,7 +19058,7 @@ syntax instr = | NOP | UNREACHABLE | DROP - | `SELECT()%?`{`valtype*?` : valtype*?}(valtype*{valtype <- `valtype*`}?{`valtype*` <- `valtype*?`} : valtype*?) + | SELECT{`valtype*?` : valtype*?}(valtype*{valtype <- `valtype*`}?{`valtype*` <- `valtype*?`} : valtype*?) | BLOCK{blocktype : blocktype, `instr*` : instr*}(blocktype : blocktype, instr*{instr <- `instr*`} : instr*) | LOOP{blocktype : blocktype, `instr*` : instr*}(blocktype : blocktype, instr*{instr <- `instr*`} : instr*) | `IF%%ELSE%`{blocktype : blocktype, `instr*` : instr*}(blocktype : blocktype, instr*{instr <- `instr*`} : instr*, instr*) @@ -28193,9 +19348,9 @@ def $minat(addrtype : addrtype, addrtype : addrtype) : addrtype ;; 2-syntax-aux.watsup def $diffrt(reftype : reftype, reftype : reftype) : reftype ;; 2-syntax-aux.watsup - def $diffrt{nul1 : nul1, ht_1 : heaptype, ht_2 : heaptype}(REF_reftype(nul1, ht_1), REF_reftype(`NULL%?`_nul(?(())), ht_2)) = REF_reftype(`NULL%?`_nul(?()), ht_1) + def $diffrt{nul1 : nul1, ht_1 : heaptype, ht_2 : heaptype}(REF_reftype(nul1, ht_1), REF_reftype(?(NULL_NULL), ht_2)) = REF_reftype(?(), ht_1) ;; 2-syntax-aux.watsup - def $diffrt{nul1 : nul1, ht_1 : heaptype, ht_2 : heaptype}(REF_reftype(nul1, ht_1), REF_reftype(`NULL%?`_nul(?()), ht_2)) = REF_reftype(nul1, ht_1) + def $diffrt{nul1 : nul1, ht_1 : heaptype, ht_2 : heaptype}(REF_reftype(nul1, ht_1), REF_reftype(?(), ht_2)) = REF_reftype(nul1, ht_1) ;; 2-syntax-aux.watsup rec { @@ -28805,9 +19960,9 @@ def $shift_labelidxs(labelidx*) : labelidx* ;; 2-syntax-aux.watsup:585.1-585.32 def $shift_labelidxs([]) = [] ;; 2-syntax-aux.watsup:586.1-586.66 - def $shift_labelidxs{`labelidx'*` : labelidx*}([`%`_uN(0)] ++ labelidx'*{labelidx' <- `labelidx'*`}) = $shift_labelidxs(labelidx'*{labelidx' <- `labelidx'*`}) + def $shift_labelidxs{`labelidx'*` : labelidx*}([`%`_labelidx(0)] ++ labelidx'*{labelidx' <- `labelidx'*`}) = $shift_labelidxs(labelidx'*{labelidx' <- `labelidx'*`}) ;; 2-syntax-aux.watsup:587.1-587.91 - def $shift_labelidxs{labelidx : labelidx, `labelidx'*` : labelidx*}([labelidx] ++ labelidx'*{labelidx' <- `labelidx'*`}) = [`%`_uN((((labelidx!`%`_labelidx.0 : nat <:> int) - (1 : nat <:> int)) : int <:> nat))] ++ $shift_labelidxs(labelidx'*{labelidx' <- `labelidx'*`}) + def $shift_labelidxs{labelidx : labelidx, `labelidx'*` : labelidx*}([labelidx] ++ labelidx'*{labelidx' <- `labelidx'*`}) = [`%`_labelidx((((labelidx!`%`_labelidx.0 : nat <:> int) - (1 : nat <:> int)) : int <:> nat))] ++ $shift_labelidxs(labelidx'*{labelidx' <- `labelidx'*`}) } ;; 2-syntax-aux.watsup @@ -28822,7 +19977,7 @@ def $free_instr(instr : instr) : free ;; 2-syntax-aux.watsup:444.1-444.27 def $free_instr(DROP_instr) = {TYPES [], FUNCS [], GLOBALS [], TABLES [], MEMS [], ELEMS [], DATAS [], LOCALS [], LABELS []} ;; 2-syntax-aux.watsup:445.1-445.86 - def $free_instr{`valtype*?` : valtype*?}(`SELECT()%?`_instr(valtype*{valtype <- `valtype*`}?{`valtype*` <- `valtype*?`})) = $free_opt($free_list($free_valtype(valtype)*{valtype <- `valtype*`})?{`valtype*` <- `valtype*?`}) + def $free_instr{`valtype*?` : valtype*?}(SELECT_instr(valtype*{valtype <- `valtype*`}?{`valtype*` <- `valtype*?`})) = $free_opt($free_list($free_valtype(valtype)*{valtype <- `valtype*`})?{`valtype*` <- `valtype*?`}) ;; 2-syntax-aux.watsup:447.1-447.92 def $free_instr{blocktype : blocktype, `instr*` : instr*}(BLOCK_instr(blocktype, instr*{instr <- `instr*`})) = $free_blocktype(blocktype) +++ $free_block(instr*{instr <- `instr*`}) ;; 2-syntax-aux.watsup:448.1-448.91 @@ -29224,8 +20379,8 @@ relation Heaptype_ok: `%|-%:OK`(context, heaptype) ;; 3-typing.watsup relation Reftype_ok: `%|-%:OK`(context, reftype) ;; 3-typing.watsup - rule _{C : context, heaptype : heaptype, w0 : ()?}: - `%|-%:OK`(C, REF_reftype(`NULL%?`_nul(w0), heaptype)) + rule _{C : context, heaptype : heaptype}: + `%|-%:OK`(C, REF_reftype(NULL_NULL?{}, heaptype)) -- Heaptype_ok: `%|-%:OK`(C, heaptype) ;; 3-typing.watsup @@ -29296,8 +20451,8 @@ relation Storagetype_ok: `%|-%:OK`(context, storagetype) ;; 3-typing.watsup relation Fieldtype_ok: `%|-%:OK`(context, fieldtype) ;; 3-typing.watsup - rule _{C : context, storagetype : storagetype, w0 : ()?}: - `%|-%:OK`(C, `%%`_fieldtype(`MUT%?`_mut(w0), storagetype)) + rule _{C : context, storagetype : storagetype}: + `%|-%:OK`(C, `%%`_fieldtype(MUT_MUT?{}, storagetype)) -- Storagetype_ok: `%|-%:OK`(C, storagetype) ;; 3-typing.watsup @@ -29446,12 +20601,12 @@ relation Heaptype_sub: `%|-%<:%`(context, heaptype, heaptype) relation Reftype_sub: `%|-%<:%`(context, reftype, reftype) ;; 3-typing.watsup rule nonnull{C : context, ht_1 : heaptype, ht_2 : heaptype}: - `%|-%<:%`(C, REF_reftype(`NULL%?`_nul(?()), ht_1), REF_reftype(`NULL%?`_nul(?()), ht_2)) + `%|-%<:%`(C, REF_reftype(?(), ht_1), REF_reftype(?(), ht_2)) -- Heaptype_sub: `%|-%<:%`(C, ht_1, ht_2) ;; 3-typing.watsup - rule null{C : context, ht_1 : heaptype, ht_2 : heaptype, w0 : ()?}: - `%|-%<:%`(C, REF_reftype(`NULL%?`_nul(w0), ht_1), REF_reftype(`NULL%?`_nul(?(())), ht_2)) + rule null{C : context, ht_1 : heaptype, ht_2 : heaptype}: + `%|-%<:%`(C, REF_reftype(NULL_NULL?{}, ht_1), REF_reftype(?(NULL_NULL), ht_2)) -- Heaptype_sub: `%|-%<:%`(C, ht_1, ht_2) ;; 3-typing.watsup @@ -29497,12 +20652,12 @@ relation Storagetype_sub: `%|-%<:%`(context, storagetype, storagetype) relation Fieldtype_sub: `%|-%<:%`(context, fieldtype, fieldtype) ;; 3-typing.watsup rule const{C : context, zt_1 : storagetype, zt_2 : storagetype}: - `%|-%<:%`(C, `%%`_fieldtype(`MUT%?`_mut(?()), zt_1), `%%`_fieldtype(`MUT%?`_mut(?()), zt_2)) + `%|-%<:%`(C, `%%`_fieldtype(?(), zt_1), `%%`_fieldtype(?(), zt_2)) -- Storagetype_sub: `%|-%<:%`(C, zt_1, zt_2) ;; 3-typing.watsup rule var{C : context, zt_1 : storagetype, zt_2 : storagetype}: - `%|-%<:%`(C, `%%`_fieldtype(`MUT%?`_mut(?(())), zt_1), `%%`_fieldtype(`MUT%?`_mut(?(())), zt_2)) + `%|-%<:%`(C, `%%`_fieldtype(?(MUT_MUT), zt_1), `%%`_fieldtype(?(MUT_MUT), zt_2)) -- Storagetype_sub: `%|-%<:%`(C, zt_1, zt_2) -- Storagetype_sub: `%|-%<:%`(C, zt_2, zt_1) @@ -29543,14 +20698,14 @@ relation Comptype_sub: `%|-%<:%`(context, comptype, comptype) ;; 3-typing.watsup relation Subtype_ok: `%|-%:%`(context, subtype, oktypeidx) ;; 3-typing.watsup - rule _{C : context, `x*` : idx*, comptype : comptype, x_0 : idx, `x'**` : idx**, `comptype'*` : comptype*, w0 : ()?}: - `%|-%:%`(C, SUB_subtype(`FINAL%?`_fin(w0), _IDX_typeuse(x)*{x <- `x*`}, comptype), OK_oktypeidx(x_0)) + rule _{C : context, `x*` : idx*, comptype : comptype, x_0 : idx, `x'**` : idx**, `comptype'*` : comptype*}: + `%|-%:%`(C, SUB_subtype(FINAL_FINAL?{}, _IDX_typeuse(x)*{x <- `x*`}, comptype), OK_oktypeidx(x_0)) -- if (|x*{x <- `x*`}| <= 1) -- (if (x!`%`_idx.0 < x_0!`%`_idx.0))*{x <- `x*`} -- if (|`comptype'*`| = |`x*`|) -- if (|`comptype'*`| = |`x'**`|) -- (if (x!`%`_idx.0 < |C.TYPES_context|))*{x <- `x*`} - -- (if ($unrolldt(C.TYPES_context[x!`%`_idx.0]) = SUB_subtype(`FINAL%?`_fin(?()), _IDX_typeuse(x')*{x' <- `x'*`}, comptype')))*{comptype' <- `comptype'*`, x <- `x*`, `x'*` <- `x'**`} + -- (if ($unrolldt(C.TYPES_context[x!`%`_idx.0]) = SUB_subtype(?(), _IDX_typeuse(x')*{x' <- `x'*`}, comptype')))*{comptype' <- `comptype'*`, x <- `x*`, `x'*` <- `x'**`} -- Comptype_ok: `%|-%:OK`(C, comptype) -- (Comptype_sub: `%|-%<:%`(C, comptype, comptype'))*{comptype' <- `comptype'*`} @@ -29575,13 +20730,13 @@ def $unrollht(context : context, heaptype : heaptype) : subtype ;; 3-typing.watsup relation Subtype_ok2: `%|-%:%`(context, subtype, oktypeidxnat) ;; 3-typing.watsup - rule _{C : context, `typeuse*` : typeuse*, compttype : comptype, x : idx, i : nat, `typeuse'**` : typeuse**, `comptype'*` : comptype*, comptype : comptype, w0 : ()?}: - `%|-%:%`(C, SUB_subtype(`FINAL%?`_fin(w0), typeuse*{typeuse <- `typeuse*`}, compttype), OK_oktypeidxnat(x, i)) + rule _{C : context, `typeuse*` : typeuse*, compttype : comptype, x : idx, i : nat, `typeuse'**` : typeuse**, `comptype'*` : comptype*, comptype : comptype}: + `%|-%:%`(C, SUB_subtype(FINAL_FINAL?{}, typeuse*{typeuse <- `typeuse*`}, compttype), OK_oktypeidxnat(x, i)) -- if (|typeuse*{typeuse <- `typeuse*`}| <= 1) -- (if $before(typeuse, x, i))*{typeuse <- `typeuse*`} -- if (|`comptype'*`| = |`typeuse*`|) -- if (|`comptype'*`| = |`typeuse'**`|) - -- (if ($unrollht(C, (typeuse : typeuse <: heaptype)) = SUB_subtype(`FINAL%?`_fin(?()), typeuse'*{typeuse' <- `typeuse'*`}, comptype')))*{comptype' <- `comptype'*`, typeuse <- `typeuse*`, `typeuse'*` <- `typeuse'**`} + -- (if ($unrollht(C, (typeuse : typeuse <: heaptype)) = SUB_subtype(?(), typeuse'*{typeuse' <- `typeuse'*`}, comptype')))*{comptype' <- `comptype'*`, typeuse <- `typeuse*`, `typeuse'*` <- `typeuse'**`} -- Comptype_ok: `%|-%:OK`(C, comptype) -- (Comptype_sub: `%|-%<:%`(C, comptype, comptype'))*{comptype' <- `comptype'*`} @@ -29641,8 +20796,8 @@ relation Limits_ok: `%|-%:%`(context, limits, nat) ;; 3-typing.watsup relation Globaltype_ok: `%|-%:OK`(context, globaltype) ;; 3-typing.watsup - rule _{C : context, t : valtype, w0 : ()?}: - `%|-%:OK`(C, `%%`_globaltype(`MUT%?`_mut(w0), t)) + rule _{C : context, t : valtype}: + `%|-%:OK`(C, `%%`_globaltype(MUT_MUT?{}, t)) -- Valtype_ok: `%|-%:OK`(C, t) ;; 3-typing.watsup @@ -29720,12 +20875,12 @@ relation Limits_sub: `%|-%<:%`(context, limits, limits) relation Globaltype_sub: `%|-%<:%`(context, globaltype, globaltype) ;; 3-typing.watsup rule const{C : context, valtype_1 : valtype, valtype_2 : valtype}: - `%|-%<:%`(C, `%%`_globaltype(`MUT%?`_mut(?()), valtype_1), `%%`_globaltype(`MUT%?`_mut(?()), valtype_2)) + `%|-%<:%`(C, `%%`_globaltype(?(), valtype_1), `%%`_globaltype(?(), valtype_2)) -- Valtype_sub: `%|-%<:%`(C, valtype_1, valtype_2) ;; 3-typing.watsup rule var{C : context, valtype_1 : valtype, valtype_2 : valtype}: - `%|-%<:%`(C, `%%`_globaltype(`MUT%?`_mut(?(())), valtype_1), `%%`_globaltype(`MUT%?`_mut(?(())), valtype_2)) + `%|-%<:%`(C, `%%`_globaltype(?(MUT_MUT), valtype_1), `%%`_globaltype(?(MUT_MUT), valtype_2)) -- Valtype_sub: `%|-%<:%`(C, valtype_1, valtype_2) -- Valtype_sub: `%|-%<:%`(C, valtype_2, valtype_1) @@ -29809,7 +20964,7 @@ relation Catch_ok: `%|-%:OK`(context, catch) -- if (x!`%`_idx.0 < |C.TAGS_context|) -- Expand: `%~~%`(C.TAGS_context[x!`%`_idx.0], FUNC_comptype(`%->%`_functype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([])))) -- if (l!`%`_labelidx.0 < |C.LABELS_context|) - -- Resulttype_sub: `%|-%<:%`(C, t*{t <- `t*`} ++ [REF_valtype(`NULL%?`_nul(?()), EXN_heaptype)], C.LABELS_context[l!`%`_labelidx.0]!`%`_resulttype.0) + -- Resulttype_sub: `%|-%<:%`(C, t*{t <- `t*`} ++ [REF_valtype(?(), EXN_heaptype)], C.LABELS_context[l!`%`_labelidx.0]!`%`_resulttype.0) ;; 3-typing.watsup rule catch_all{C : context, l : labelidx}: @@ -29821,7 +20976,7 @@ relation Catch_ok: `%|-%:OK`(context, catch) rule catch_all_ref{C : context, l : labelidx}: `%|-%:OK`(C, CATCH_ALL_REF_catch(l)) -- if (l!`%`_labelidx.0 < |C.LABELS_context|) - -- Resulttype_sub: `%|-%<:%`(C, [REF_valtype(`NULL%?`_nul(?()), EXN_heaptype)], C.LABELS_context[l!`%`_labelidx.0]!`%`_resulttype.0) + -- Resulttype_sub: `%|-%<:%`(C, [REF_valtype(?(), EXN_heaptype)], C.LABELS_context[l!`%`_labelidx.0]!`%`_resulttype.0) ;; 6-runtime-aux.watsup def $default_(valtype : valtype) : val? @@ -29832,9 +20987,9 @@ def $default_(valtype : valtype) : val? ;; 6-runtime-aux.watsup def $default_{Vnn : Vnn}((Vnn : Vnn <: valtype)) = ?(VCONST_val(Vnn, `%`_vec_(0))) ;; 6-runtime-aux.watsup - def $default_{ht : heaptype}(REF_valtype(`NULL%?`_nul(?(())), ht)) = ?(REF.NULL_val(ht)) + def $default_{ht : heaptype}(REF_valtype(?(NULL_NULL), ht)) = ?(REF.NULL_val(ht)) ;; 6-runtime-aux.watsup - def $default_{ht : heaptype}(REF_valtype(`NULL%?`_nul(?()), ht)) = ?() + def $default_{ht : heaptype}(REF_valtype(?(), ht)) = ?() ;; 3-typing.watsup relation Defaultable: `|-%DEFAULTABLE`(valtype) @@ -29864,12 +21019,12 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) ;; 3-typing.watsup:580.1-582.29 rule `select-expl`{C : context, t : valtype}: - `%|-%:%`(C, `SELECT()%?`_instr(?([t])), `%->_%%`_instrtype(`%`_resulttype([t t I32_valtype]), [], `%`_resulttype([t]))) + `%|-%:%`(C, SELECT_instr(?([t])), `%->_%%`_instrtype(`%`_resulttype([t t I32_valtype]), [], `%`_resulttype([t]))) -- Valtype_ok: `%|-%:OK`(C, t) ;; 3-typing.watsup:584.1-588.37 rule `select-impl`{C : context, t : valtype, t' : valtype, numtype : numtype, vectype : vectype}: - `%|-%:%`(C, `SELECT()%?`_instr(?()), `%->_%%`_instrtype(`%`_resulttype([t t I32_valtype]), [], `%`_resulttype([t]))) + `%|-%:%`(C, SELECT_instr(?()), `%->_%%`_instrtype(`%`_resulttype([t t I32_valtype]), [], `%`_resulttype([t]))) -- Valtype_ok: `%|-%:OK`(C, t) -- Valtype_sub: `%|-%<:%`(C, t, t') -- if ((t' = (numtype : numtype <: valtype)) \/ (t' = (vectype : vectype <: valtype))) @@ -29917,16 +21072,16 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) ;; 3-typing.watsup:638.1-641.31 rule br_on_null{C : context, l : labelidx, `t*` : valtype*, ht : heaptype}: - `%|-%:%`(C, BR_ON_NULL_instr(l), `%->_%%`_instrtype(`%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(`NULL%?`_nul(?(())), ht)]), [], `%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(`NULL%?`_nul(?()), ht)]))) + `%|-%:%`(C, BR_ON_NULL_instr(l), `%->_%%`_instrtype(`%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(?(NULL_NULL), ht)]), [], `%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(?(), ht)]))) -- if (l!`%`_labelidx.0 < |C.LABELS_context|) -- if (C.LABELS_context[l!`%`_labelidx.0]!`%`_resulttype.0 = t*{t <- `t*`}) -- Heaptype_ok: `%|-%:OK`(C, ht) ;; 3-typing.watsup:643.1-645.34 rule br_on_non_null{C : context, l : labelidx, `t*` : valtype*, ht : heaptype}: - `%|-%:%`(C, BR_ON_NON_NULL_instr(l), `%->_%%`_instrtype(`%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(`NULL%?`_nul(?(())), ht)]), [], `%`_resulttype(t*{t <- `t*`}))) + `%|-%:%`(C, BR_ON_NON_NULL_instr(l), `%->_%%`_instrtype(`%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(?(NULL_NULL), ht)]), [], `%`_resulttype(t*{t <- `t*`}))) -- if (l!`%`_labelidx.0 < |C.LABELS_context|) - -- if (C.LABELS_context[l!`%`_labelidx.0] = `%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(`NULL%?`_nul(?()), ht)])) + -- if (C.LABELS_context[l!`%`_labelidx.0] = `%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(?(), ht)])) ;; 3-typing.watsup:647.1-653.34 rule br_on_cast{C : context, l : labelidx, rt_1 : reftype, rt_2 : reftype, `t*` : valtype*, rt : reftype}: @@ -29956,7 +21111,7 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) ;; 3-typing.watsup:670.1-672.47 rule call_ref{C : context, x : idx, `t_1*` : valtype*, `t_2*` : valtype*}: - `%|-%:%`(C, CALL_REF_instr(_IDX_typeuse(x)), `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`} ++ [REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x))]), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) + `%|-%:%`(C, CALL_REF_instr(_IDX_typeuse(x)), `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`} ++ [REF_valtype(?(NULL_NULL), _IDX_heaptype(x))]), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) -- if (x!`%`_idx.0 < |C.TYPES_context|) -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], FUNC_comptype(`%->%`_functype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`})))) @@ -29965,14 +21120,14 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) `%|-%:%`(C, CALL_INDIRECT_instr(x, _IDX_typeuse(y)), `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`} ++ [(at : addrtype <: valtype)]), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) -- if (x!`%`_idx.0 < |C.TABLES_context|) -- if (C.TABLES_context[x!`%`_idx.0] = `%%%`_tabletype(at, lim, rt)) - -- Reftype_sub: `%|-%<:%`(C, rt, REF_reftype(`NULL%?`_nul(?(())), FUNC_heaptype)) + -- Reftype_sub: `%|-%<:%`(C, rt, REF_reftype(?(NULL_NULL), FUNC_heaptype)) -- if (y!`%`_idx.0 < |C.TYPES_context|) -- Expand: `%~~%`(C.TYPES_context[y!`%`_idx.0], FUNC_comptype(`%->%`_functype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`})))) ;; 3-typing.watsup:680.1-683.42 rule return{C : context, `t_1*` : valtype*, `t*` : valtype*, `t_2*` : valtype*}: `%|-%:%`(C, RETURN_instr, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`} ++ t*{t <- `t*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) - -- if (C.RETURN_context = ?(`%`_list(t*{t <- `t*`}))) + -- if (C.RETURN_context = ?(`%`_resulttype(t*{t <- `t*`}))) -- Instrtype_ok: `%|-%:OK`(C, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) ;; 3-typing.watsup:686.1-691.42 @@ -29980,16 +21135,16 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) `%|-%:%`(C, RETURN_CALL_instr(x), `%->_%%`_instrtype(`%`_resulttype(t_3*{t_3 <- `t_3*`} ++ t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_4*{t_4 <- `t_4*`}))) -- if (x!`%`_idx.0 < |C.FUNCS_context|) -- Expand: `%~~%`(C.FUNCS_context[x!`%`_idx.0], FUNC_comptype(`%->%`_functype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`})))) - -- if (C.RETURN_context = ?(`%`_list(t'_2*{t'_2 <- `t'_2*`}))) + -- if (C.RETURN_context = ?(`%`_resulttype(t'_2*{t'_2 <- `t'_2*`}))) -- Resulttype_sub: `%|-%<:%`(C, t_2*{t_2 <- `t_2*`}, t'_2*{t'_2 <- `t'_2*`}) -- Instrtype_ok: `%|-%:OK`(C, `%->_%%`_instrtype(`%`_resulttype(t_3*{t_3 <- `t_3*`}), [], `%`_resulttype(t_4*{t_4 <- `t_4*`}))) ;; 3-typing.watsup:694.1-699.42 rule return_call_ref{C : context, x : idx, `t_3*` : valtype*, `t_1*` : valtype*, `t_4*` : valtype*, `t_2*` : valtype*, `t'_2*` : valtype*}: - `%|-%:%`(C, RETURN_CALL_REF_instr(_IDX_typeuse(x)), `%->_%%`_instrtype(`%`_resulttype(t_3*{t_3 <- `t_3*`} ++ t_1*{t_1 <- `t_1*`} ++ [REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x))]), [], `%`_resulttype(t_4*{t_4 <- `t_4*`}))) + `%|-%:%`(C, RETURN_CALL_REF_instr(_IDX_typeuse(x)), `%->_%%`_instrtype(`%`_resulttype(t_3*{t_3 <- `t_3*`} ++ t_1*{t_1 <- `t_1*`} ++ [REF_valtype(?(NULL_NULL), _IDX_heaptype(x))]), [], `%`_resulttype(t_4*{t_4 <- `t_4*`}))) -- if (x!`%`_idx.0 < |C.TYPES_context|) -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], FUNC_comptype(`%->%`_functype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`})))) - -- if (C.RETURN_context = ?(`%`_list(t'_2*{t'_2 <- `t'_2*`}))) + -- if (C.RETURN_context = ?(`%`_resulttype(t'_2*{t'_2 <- `t'_2*`}))) -- Resulttype_sub: `%|-%<:%`(C, t_2*{t_2 <- `t_2*`}, t'_2*{t'_2 <- `t'_2*`}) -- Instrtype_ok: `%|-%:OK`(C, `%->_%%`_instrtype(`%`_resulttype(t_3*{t_3 <- `t_3*`}), [], `%`_resulttype(t_4*{t_4 <- `t_4*`}))) @@ -29998,10 +21153,10 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) `%|-%:%`(C, RETURN_CALL_INDIRECT_instr(x, _IDX_typeuse(y)), `%->_%%`_instrtype(`%`_resulttype(t_3*{t_3 <- `t_3*`} ++ t_1*{t_1 <- `t_1*`} ++ [(at : addrtype <: valtype)]), [], `%`_resulttype(t_4*{t_4 <- `t_4*`}))) -- if (x!`%`_idx.0 < |C.TABLES_context|) -- if (C.TABLES_context[x!`%`_idx.0] = `%%%`_tabletype(at, lim, rt)) - -- Reftype_sub: `%|-%<:%`(C, rt, REF_reftype(`NULL%?`_nul(?(())), FUNC_heaptype)) + -- Reftype_sub: `%|-%<:%`(C, rt, REF_reftype(?(NULL_NULL), FUNC_heaptype)) -- if (y!`%`_idx.0 < |C.TYPES_context|) -- Expand: `%~~%`(C.TYPES_context[y!`%`_idx.0], FUNC_comptype(`%->%`_functype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`})))) - -- if (C.RETURN_context = ?(`%`_list(t'_2*{t'_2 <- `t'_2*`}))) + -- if (C.RETURN_context = ?(`%`_resulttype(t'_2*{t'_2 <- `t'_2*`}))) -- Resulttype_sub: `%|-%<:%`(C, t_2*{t_2 <- `t_2*`}, t'_2*{t'_2 <- `t'_2*`}) -- Instrtype_ok: `%|-%:OK`(C, `%->_%%`_instrtype(`%`_resulttype(t_3*{t_3 <- `t_3*`}), [], `%`_resulttype(t_4*{t_4 <- `t_4*`}))) @@ -30014,7 +21169,7 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) ;; 3-typing.watsup:722.1-724.42 rule throw_ref{C : context, `t_1*` : valtype*, `t_2*` : valtype*}: - `%|-%:%`(C, THROW_REF_instr, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`} ++ [REF_valtype(`NULL%?`_nul(?(())), EXN_heaptype)]), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) + `%|-%:%`(C, THROW_REF_instr, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`} ++ [REF_valtype(?(NULL_NULL), EXN_heaptype)]), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) -- Instrtype_ok: `%|-%:OK`(C, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) ;; 3-typing.watsup:726.1-730.34 @@ -30050,12 +21205,12 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) ;; 3-typing.watsup:774.1-776.31 rule ref.null{C : context, ht : heaptype}: - `%|-%:%`(C, REF.NULL_instr(ht), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), ht)]))) + `%|-%:%`(C, REF.NULL_instr(ht), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([REF_valtype(?(NULL_NULL), ht)]))) -- Heaptype_ok: `%|-%:OK`(C, ht) ;; 3-typing.watsup:778.1-781.20 rule ref.func{C : context, x : idx, dt : deftype}: - `%|-%:%`(C, REF.FUNC_instr(x), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), (dt : deftype <: heaptype))]))) + `%|-%:%`(C, REF.FUNC_instr(x), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([REF_valtype(?(), (dt : deftype <: heaptype))]))) -- if (x!`%`_idx.0 < |C.FUNCS_context|) -- if (C.FUNCS_context[x!`%`_idx.0] = dt) -- if (|C.REFS_context| > 0) @@ -30063,21 +21218,21 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) ;; 3-typing.watsup:783.1-784.34 rule ref.i31{C : context}: - `%|-%:%`(C, REF.I31_instr, `%->_%%`_instrtype(`%`_resulttype([I32_valtype]), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), I31_heaptype)]))) + `%|-%:%`(C, REF.I31_instr, `%->_%%`_instrtype(`%`_resulttype([I32_valtype]), [], `%`_resulttype([REF_valtype(?(), I31_heaptype)]))) ;; 3-typing.watsup:786.1-788.31 rule ref.is_null{C : context, ht : heaptype}: - `%|-%:%`(C, REF.IS_NULL_instr, `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), ht)]), [], `%`_resulttype([I32_valtype]))) + `%|-%:%`(C, REF.IS_NULL_instr, `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), ht)]), [], `%`_resulttype([I32_valtype]))) -- Heaptype_ok: `%|-%:OK`(C, ht) ;; 3-typing.watsup:790.1-792.31 rule ref.as_non_null{C : context, ht : heaptype}: - `%|-%:%`(C, REF.AS_NON_NULL_instr, `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), ht)]), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), ht)]))) + `%|-%:%`(C, REF.AS_NON_NULL_instr, `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), ht)]), [], `%`_resulttype([REF_valtype(?(), ht)]))) -- Heaptype_ok: `%|-%:OK`(C, ht) ;; 3-typing.watsup:794.1-795.51 rule ref.eq{C : context}: - `%|-%:%`(C, REF.EQ_instr, `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), EQ_heaptype) REF_valtype(`NULL%?`_nul(?(())), EQ_heaptype)]), [], `%`_resulttype([I32_valtype]))) + `%|-%:%`(C, REF.EQ_instr, `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), EQ_heaptype) REF_valtype(?(NULL_NULL), EQ_heaptype)]), [], `%`_resulttype([I32_valtype]))) ;; 3-typing.watsup:797.1-801.33 rule ref.test{C : context, rt : reftype, rt' : reftype}: @@ -30095,24 +21250,24 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) ;; 3-typing.watsup:812.1-813.42 rule i31.get{C : context, sx : sx}: - `%|-%:%`(C, I31.GET_instr(sx), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), I31_heaptype)]), [], `%`_resulttype([I32_valtype]))) + `%|-%:%`(C, I31.GET_instr(sx), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), I31_heaptype)]), [], `%`_resulttype([I32_valtype]))) ;; 3-typing.watsup:818.1-820.44 rule struct.new{C : context, x : idx, `zt*` : storagetype*, `mut*` : mut*}: - `%|-%:%`(C, STRUCT.NEW_instr(x), `%->_%%`_instrtype(`%`_resulttype($unpack(zt)*{zt <- `zt*`}), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), _IDX_heaptype(x))]))) + `%|-%:%`(C, STRUCT.NEW_instr(x), `%->_%%`_instrtype(`%`_resulttype($unpack(zt)*{zt <- `zt*`}), [], `%`_resulttype([REF_valtype(?(), _IDX_heaptype(x))]))) -- if (x!`%`_idx.0 < |C.TYPES_context|) -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], STRUCT_comptype(`%`_structtype(`%%`_fieldtype(mut, zt)*{mut <- `mut*`, zt <- `zt*`}))) ;; 3-typing.watsup:822.1-825.48 rule struct.new_default{C : context, x : idx, `mut*` : mut*, `zt*` : storagetype*}: - `%|-%:%`(C, STRUCT.NEW_DEFAULT_instr(x), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), _IDX_heaptype(x))]))) + `%|-%:%`(C, STRUCT.NEW_DEFAULT_instr(x), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([REF_valtype(?(), _IDX_heaptype(x))]))) -- if (x!`%`_idx.0 < |C.TYPES_context|) -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], STRUCT_comptype(`%`_structtype(`%%`_fieldtype(mut, zt)*{mut <- `mut*`, zt <- `zt*`}))) -- (Defaultable: `|-%DEFAULTABLE`($unpack(zt)))*{zt <- `zt*`} ;; 3-typing.watsup:827.1-831.39 rule struct.get{C : context, `sx?` : sx?, x : idx, i : u32, zt : storagetype, `yt*` : fieldtype*, mut : mut}: - `%|-%:%`(C, STRUCT.GET_instr(sx?{sx <- `sx?`}, x, i), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x))]), [], `%`_resulttype([$unpack(zt)]))) + `%|-%:%`(C, STRUCT.GET_instr(sx?{sx <- `sx?`}, x, i), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), _IDX_heaptype(x))]), [], `%`_resulttype([$unpack(zt)]))) -- if (x!`%`_idx.0 < |C.TYPES_context|) -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], STRUCT_comptype(`%`_structtype(yt*{yt <- `yt*`}))) -- if (i!`%`_u32.0 < |yt*{yt <- `yt*`}|) @@ -30121,34 +21276,34 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) ;; 3-typing.watsup:833.1-836.24 rule struct.set{C : context, x : idx, i : u32, zt : storagetype, `yt*` : fieldtype*}: - `%|-%:%`(C, STRUCT.SET_instr(x, i), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x)) $unpack(zt)]), [], `%`_resulttype([]))) + `%|-%:%`(C, STRUCT.SET_instr(x, i), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), _IDX_heaptype(x)) $unpack(zt)]), [], `%`_resulttype([]))) -- if (x!`%`_idx.0 < |C.TYPES_context|) -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], STRUCT_comptype(`%`_structtype(yt*{yt <- `yt*`}))) -- if (i!`%`_u32.0 < |yt*{yt <- `yt*`}|) - -- if (yt*{yt <- `yt*`}[i!`%`_u32.0] = `%%`_fieldtype(`MUT%?`_mut(?(())), zt)) + -- if (yt*{yt <- `yt*`}[i!`%`_u32.0] = `%%`_fieldtype(?(MUT_MUT), zt)) ;; 3-typing.watsup:841.1-843.42 rule array.new{C : context, x : idx, zt : storagetype, mut : mut}: - `%|-%:%`(C, ARRAY.NEW_instr(x), `%->_%%`_instrtype(`%`_resulttype([$unpack(zt) I32_valtype]), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), _IDX_heaptype(x))]))) + `%|-%:%`(C, ARRAY.NEW_instr(x), `%->_%%`_instrtype(`%`_resulttype([$unpack(zt) I32_valtype]), [], `%`_resulttype([REF_valtype(?(), _IDX_heaptype(x))]))) -- if (x!`%`_idx.0 < |C.TYPES_context|) -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(mut, zt))) ;; 3-typing.watsup:845.1-848.45 rule array.new_default{C : context, x : idx, mut : mut, zt : storagetype}: - `%|-%:%`(C, ARRAY.NEW_DEFAULT_instr(x), `%->_%%`_instrtype(`%`_resulttype([I32_valtype]), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), _IDX_heaptype(x))]))) + `%|-%:%`(C, ARRAY.NEW_DEFAULT_instr(x), `%->_%%`_instrtype(`%`_resulttype([I32_valtype]), [], `%`_resulttype([REF_valtype(?(), _IDX_heaptype(x))]))) -- if (x!`%`_idx.0 < |C.TYPES_context|) -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(mut, zt))) -- Defaultable: `|-%DEFAULTABLE`($unpack(zt)) ;; 3-typing.watsup:850.1-852.42 rule array.new_fixed{C : context, x : idx, n : n, zt : storagetype, mut : mut}: - `%|-%:%`(C, ARRAY.NEW_FIXED_instr(x, `%`_u32(n)), `%->_%%`_instrtype(`%`_resulttype($unpack(zt)^n{}), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), _IDX_heaptype(x))]))) + `%|-%:%`(C, ARRAY.NEW_FIXED_instr(x, `%`_u32(n)), `%->_%%`_instrtype(`%`_resulttype($unpack(zt)^n{}), [], `%`_resulttype([REF_valtype(?(), _IDX_heaptype(x))]))) -- if (x!`%`_idx.0 < |C.TYPES_context|) -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(mut, zt))) ;; 3-typing.watsup:854.1-857.40 rule array.new_elem{C : context, x : idx, y : idx, mut : mut, rt : reftype}: - `%|-%:%`(C, ARRAY.NEW_ELEM_instr(x, y), `%->_%%`_instrtype(`%`_resulttype([I32_valtype I32_valtype]), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), _IDX_heaptype(x))]))) + `%|-%:%`(C, ARRAY.NEW_ELEM_instr(x, y), `%->_%%`_instrtype(`%`_resulttype([I32_valtype I32_valtype]), [], `%`_resulttype([REF_valtype(?(), _IDX_heaptype(x))]))) -- if (x!`%`_idx.0 < |C.TYPES_context|) -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(mut, (rt : reftype <: storagetype)))) -- if (y!`%`_idx.0 < |C.ELEMS_context|) @@ -30156,7 +21311,7 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) ;; 3-typing.watsup:859.1-863.24 rule array.new_data{C : context, x : idx, y : idx, mut : mut, zt : storagetype, numtype : numtype, vectype : vectype}: - `%|-%:%`(C, ARRAY.NEW_DATA_instr(x, y), `%->_%%`_instrtype(`%`_resulttype([I32_valtype I32_valtype]), [], `%`_resulttype([REF_valtype(`NULL%?`_nul(?()), _IDX_heaptype(x))]))) + `%|-%:%`(C, ARRAY.NEW_DATA_instr(x, y), `%->_%%`_instrtype(`%`_resulttype([I32_valtype I32_valtype]), [], `%`_resulttype([REF_valtype(?(), _IDX_heaptype(x))]))) -- if (x!`%`_idx.0 < |C.TYPES_context|) -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(mut, zt))) -- if (($unpack(zt) = (numtype : numtype <: valtype)) \/ ($unpack(zt) = (vectype : vectype <: valtype))) @@ -30165,49 +21320,49 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) ;; 3-typing.watsup:865.1-868.39 rule array.get{C : context, `sx?` : sx?, x : idx, zt : storagetype, mut : mut}: - `%|-%:%`(C, ARRAY.GET_instr(sx?{sx <- `sx?`}, x), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x)) I32_valtype]), [], `%`_resulttype([$unpack(zt)]))) + `%|-%:%`(C, ARRAY.GET_instr(sx?{sx <- `sx?`}, x), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), _IDX_heaptype(x)) I32_valtype]), [], `%`_resulttype([$unpack(zt)]))) -- if (x!`%`_idx.0 < |C.TYPES_context|) -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(mut, zt))) -- if ((sx?{sx <- `sx?`} = ?()) <=> (zt = ($unpack(zt) : valtype <: storagetype))) ;; 3-typing.watsup:870.1-872.42 rule array.set{C : context, x : idx, zt : storagetype}: - `%|-%:%`(C, ARRAY.SET_instr(x), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x)) I32_valtype $unpack(zt)]), [], `%`_resulttype([]))) + `%|-%:%`(C, ARRAY.SET_instr(x), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), _IDX_heaptype(x)) I32_valtype $unpack(zt)]), [], `%`_resulttype([]))) -- if (x!`%`_idx.0 < |C.TYPES_context|) - -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(`MUT%?`_mut(?(())), zt))) + -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(?(MUT_MUT), zt))) ;; 3-typing.watsup:874.1-875.43 rule array.len{C : context}: - `%|-%:%`(C, ARRAY.LEN_instr, `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), ARRAY_heaptype)]), [], `%`_resulttype([I32_valtype]))) + `%|-%:%`(C, ARRAY.LEN_instr, `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), ARRAY_heaptype)]), [], `%`_resulttype([I32_valtype]))) ;; 3-typing.watsup:877.1-879.42 rule array.fill{C : context, x : idx, zt : storagetype}: - `%|-%:%`(C, ARRAY.FILL_instr(x), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x)) I32_valtype $unpack(zt) I32_valtype]), [], `%`_resulttype([]))) + `%|-%:%`(C, ARRAY.FILL_instr(x), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), _IDX_heaptype(x)) I32_valtype $unpack(zt) I32_valtype]), [], `%`_resulttype([]))) -- if (x!`%`_idx.0 < |C.TYPES_context|) - -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(`MUT%?`_mut(?(())), zt))) + -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(?(MUT_MUT), zt))) ;; 3-typing.watsup:881.1-885.40 rule array.copy{C : context, x_1 : idx, x_2 : idx, zt_1 : storagetype, mut : mut, zt_2 : storagetype}: - `%|-%:%`(C, ARRAY.COPY_instr(x_1, x_2), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x_1)) I32_valtype REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x_2)) I32_valtype I32_valtype]), [], `%`_resulttype([]))) + `%|-%:%`(C, ARRAY.COPY_instr(x_1, x_2), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), _IDX_heaptype(x_1)) I32_valtype REF_valtype(?(NULL_NULL), _IDX_heaptype(x_2)) I32_valtype I32_valtype]), [], `%`_resulttype([]))) -- if (x_1!`%`_idx.0 < |C.TYPES_context|) - -- Expand: `%~~%`(C.TYPES_context[x_1!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(`MUT%?`_mut(?(())), zt_1))) + -- Expand: `%~~%`(C.TYPES_context[x_1!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(?(MUT_MUT), zt_1))) -- if (x_2!`%`_idx.0 < |C.TYPES_context|) -- Expand: `%~~%`(C.TYPES_context[x_2!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(mut, zt_2))) -- Storagetype_sub: `%|-%<:%`(C, zt_2, zt_1) ;; 3-typing.watsup:887.1-890.44 rule array.init_elem{C : context, x : idx, y : idx, zt : storagetype}: - `%|-%:%`(C, ARRAY.INIT_ELEM_instr(x, y), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x)) I32_valtype I32_valtype I32_valtype]), [], `%`_resulttype([]))) + `%|-%:%`(C, ARRAY.INIT_ELEM_instr(x, y), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), _IDX_heaptype(x)) I32_valtype I32_valtype I32_valtype]), [], `%`_resulttype([]))) -- if (x!`%`_idx.0 < |C.TYPES_context|) - -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(`MUT%?`_mut(?(())), zt))) + -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(?(MUT_MUT), zt))) -- if (y!`%`_idx.0 < |C.ELEMS_context|) -- Storagetype_sub: `%|-%<:%`(C, (C.ELEMS_context[y!`%`_idx.0] : reftype <: storagetype), zt) ;; 3-typing.watsup:892.1-896.24 rule array.init_data{C : context, x : idx, y : idx, zt : storagetype, numtype : numtype, vectype : vectype}: - `%|-%:%`(C, ARRAY.INIT_DATA_instr(x, y), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(`NULL%?`_nul(?(())), _IDX_heaptype(x)) I32_valtype I32_valtype I32_valtype]), [], `%`_resulttype([]))) + `%|-%:%`(C, ARRAY.INIT_DATA_instr(x, y), `%->_%%`_instrtype(`%`_resulttype([REF_valtype(?(NULL_NULL), _IDX_heaptype(x)) I32_valtype I32_valtype I32_valtype]), [], `%`_resulttype([]))) -- if (x!`%`_idx.0 < |C.TYPES_context|) - -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(`MUT%?`_mut(?(())), zt))) + -- Expand: `%~~%`(C.TYPES_context[x!`%`_idx.0], ARRAY_comptype(`%%`_arraytype(?(MUT_MUT), zt))) -- if (($unpack(zt) = (numtype : numtype <: valtype)) \/ ($unpack(zt) = (vectype : vectype <: valtype))) -- if (y!`%`_idx.0 < |C.DATAS_context|) -- if (C.DATAS_context[y!`%`_idx.0] = OK_datatype) @@ -30341,7 +21496,7 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) rule global.set{C : context, x : idx, t : valtype}: `%|-%:%`(C, GLOBAL.SET_instr(x), `%->_%%`_instrtype(`%`_resulttype([t]), [], `%`_resulttype([]))) -- if (x!`%`_idx.0 < |C.GLOBALS_context|) - -- if (C.GLOBALS_context[x!`%`_idx.0] = `%%`_globaltype(`MUT%?`_mut(?(())), t)) + -- if (C.GLOBALS_context[x!`%`_idx.0] = `%%`_globaltype(?(MUT_MUT), t)) ;; 3-typing.watsup:1010.1-1012.32 rule table.get{C : context, x : idx, at : addrtype, rt : reftype, lim : limits}: @@ -30614,7 +21769,7 @@ relation Instr_const: `%|-%CONST`(context, instr) rule global.get{C : context, x : idx, t : valtype}: `%|-%CONST`(C, GLOBAL.GET_instr(x)) -- if (x!`%`_idx.0 < |C.GLOBALS_context|) - -- if (C.GLOBALS_context[x!`%`_idx.0] = `%%`_globaltype(`MUT%?`_mut(?()), t)) + -- if (C.GLOBALS_context[x!`%`_idx.0] = `%%`_globaltype(?(), t)) ;; 3-typing.watsup rule binop{C : context, Inn : Inn, binop : binop_((Inn : Inn <: numtype))}: @@ -32380,41 +23535,41 @@ rec { relation Ref_type: `%|-%:%`(store, ref, reftype) ;; 7-runtime-typing.watsup:17.1-18.35 rule null{s : store, ht : heaptype}: - `%|-%:%`(s, REF.NULL_ref(ht), REF_reftype(`NULL%?`_nul(?(())), ht)) + `%|-%:%`(s, REF.NULL_ref(ht), REF_reftype(?(NULL_NULL), ht)) ;; 7-runtime-typing.watsup:20.1-21.37 rule i31{s : store, i : u31}: - `%|-%:%`(s, REF.I31_NUM_ref(i), REF_reftype(`NULL%?`_nul(?()), I31_heaptype)) + `%|-%:%`(s, REF.I31_NUM_ref(i), REF_reftype(?(), I31_heaptype)) ;; 7-runtime-typing.watsup:23.1-25.31 rule struct{s : store, a : addr, dt : deftype}: - `%|-%:%`(s, REF.STRUCT_ADDR_ref(a), REF_reftype(`NULL%?`_nul(?()), (dt : deftype <: heaptype))) + `%|-%:%`(s, REF.STRUCT_ADDR_ref(a), REF_reftype(?(), (dt : deftype <: heaptype))) -- if (a < |s.STRUCTS_store|) -- if (s.STRUCTS_store[a].TYPE_structinst = dt) ;; 7-runtime-typing.watsup:27.1-29.30 rule array{s : store, a : addr, dt : deftype}: - `%|-%:%`(s, REF.ARRAY_ADDR_ref(a), REF_reftype(`NULL%?`_nul(?()), (dt : deftype <: heaptype))) + `%|-%:%`(s, REF.ARRAY_ADDR_ref(a), REF_reftype(?(), (dt : deftype <: heaptype))) -- if (a < |s.ARRAYS_store|) -- if (s.ARRAYS_store[a].TYPE_arrayinst = dt) ;; 7-runtime-typing.watsup:31.1-33.29 rule func{s : store, a : addr, dt : deftype}: - `%|-%:%`(s, REF.FUNC_ADDR_ref(a), REF_reftype(`NULL%?`_nul(?()), (dt : deftype <: heaptype))) + `%|-%:%`(s, REF.FUNC_ADDR_ref(a), REF_reftype(?(), (dt : deftype <: heaptype))) -- if (a < |s.FUNCS_store|) -- if (s.FUNCS_store[a].TYPE_funcinst = dt) ;; 7-runtime-typing.watsup:35.1-36.38 rule exn{s : store, a : addr}: - `%|-%:%`(s, REF.EXN_ADDR_ref(a), REF_reftype(`NULL%?`_nul(?()), EXN_heaptype)) + `%|-%:%`(s, REF.EXN_ADDR_ref(a), REF_reftype(?(), EXN_heaptype)) ;; 7-runtime-typing.watsup:38.1-39.39 rule host{s : store, a : addr}: - `%|-%:%`(s, REF.HOST_ADDR_ref(a), REF_reftype(`NULL%?`_nul(?()), ANY_heaptype)) + `%|-%:%`(s, REF.HOST_ADDR_ref(a), REF_reftype(?(), ANY_heaptype)) ;; 7-runtime-typing.watsup:41.1-42.45 rule extern{s : store, addrref : addrref}: - `%|-%:%`(s, REF.EXTERN_ref(addrref), REF_reftype(`NULL%?`_nul(?()), EXTERN_heaptype)) + `%|-%:%`(s, REF.EXTERN_ref(addrref), REF_reftype(?(), EXTERN_heaptype)) ;; 7-runtime-typing.watsup:44.1-47.34 rule sub{s : store, ref : ref, rt : reftype, rt' : reftype}: @@ -32498,12 +23653,12 @@ relation Step_pure: `%~>%`(instr*, instr*) ;; 8-reduction.watsup rule `select-true`{val_1 : val, val_2 : val, c : num_(I32_numtype), `t*?` : valtype*?}: - `%~>%`([(val_1 : val <: instr) (val_2 : val <: instr) CONST_instr(I32_numtype, c) `SELECT()%?`_instr(t*{t <- `t*`}?{`t*` <- `t*?`})], [(val_1 : val <: instr)]) + `%~>%`([(val_1 : val <: instr) (val_2 : val <: instr) CONST_instr(I32_numtype, c) SELECT_instr(t*{t <- `t*`}?{`t*` <- `t*?`})], [(val_1 : val <: instr)]) -- if (c!`%`_num_.0 =/= 0) ;; 8-reduction.watsup rule `select-false`{val_1 : val, val_2 : val, c : num_(I32_numtype), `t*?` : valtype*?}: - `%~>%`([(val_1 : val <: instr) (val_2 : val <: instr) CONST_instr(I32_numtype, c) `SELECT()%?`_instr(t*{t <- `t*`}?{`t*` <- `t*?`})], [(val_2 : val <: instr)]) + `%~>%`([(val_1 : val <: instr) (val_2 : val <: instr) CONST_instr(I32_numtype, c) SELECT_instr(t*{t <- `t*`}?{`t*` <- `t*?`})], [(val_2 : val <: instr)]) -- if (c!`%`_num_.0 = 0) ;; 8-reduction.watsup @@ -32576,11 +23731,11 @@ relation Step_pure: `%~>%`(instr*, instr*) ;; 8-reduction.watsup rule call_indirect{x : idx, yy : typeuse}: - `%~>%`([CALL_INDIRECT_instr(x, yy)], [TABLE.GET_instr(x) REF.CAST_instr(REF_reftype(`NULL%?`_nul(?(())), (yy : typeuse <: heaptype))) CALL_REF_instr(yy)]) + `%~>%`([CALL_INDIRECT_instr(x, yy)], [TABLE.GET_instr(x) REF.CAST_instr(REF_reftype(?(NULL_NULL), (yy : typeuse <: heaptype))) CALL_REF_instr(yy)]) ;; 8-reduction.watsup rule return_call_indirect{x : idx, yy : typeuse}: - `%~>%`([RETURN_CALL_INDIRECT_instr(x, yy)], [TABLE.GET_instr(x) REF.CAST_instr(REF_reftype(`NULL%?`_nul(?(())), (yy : typeuse <: heaptype))) RETURN_CALL_REF_instr(yy)]) + `%~>%`([RETURN_CALL_INDIRECT_instr(x, yy)], [TABLE.GET_instr(x) REF.CAST_instr(REF_reftype(?(NULL_NULL), (yy : typeuse <: heaptype))) RETURN_CALL_REF_instr(yy)]) ;; 8-reduction.watsup rule `frame-vals`{n : n, f : frame, `val*` : val*}: @@ -34095,11 +25250,11 @@ grammar Bheaptype : heaptype ;; A-binary.watsup grammar Breftype : reftype ;; A-binary.watsup - prod{ht : heaptype} {0x63 ht:Bheaptype} => REF_reftype(`NULL%?`_nul(?(())), ht) + prod{ht : heaptype} {0x63 ht:Bheaptype} => REF_reftype(?(NULL_NULL), ht) ;; A-binary.watsup - prod{ht : heaptype} {0x64 ht:Bheaptype} => REF_reftype(`NULL%?`_nul(?()), ht) + prod{ht : heaptype} {0x64 ht:Bheaptype} => REF_reftype(?(), ht) ;; A-binary.watsup - prod{ht : heaptype} ht:Babsheaptype => REF_reftype(`NULL%?`_nul(?(())), ht) + prod{ht : heaptype} ht:Babsheaptype => REF_reftype(?(NULL_NULL), ht) ;; A-binary.watsup grammar Bvaltype : valtype @@ -34118,9 +25273,9 @@ grammar Bresulttype : resulttype ;; A-binary.watsup grammar Bmut : mut ;; A-binary.watsup - prod 0x00 => `MUT%?`_mut(?()) + prod 0x00 => ?() ;; A-binary.watsup - prod 0x01 => `MUT%?`_mut(?(())) + prod 0x01 => ?(MUT_MUT) ;; A-binary.watsup grammar Bpacktype : packtype @@ -34153,11 +25308,11 @@ grammar Bcomptype : comptype ;; A-binary.watsup grammar Bsubtype : subtype ;; A-binary.watsup - prod{`x*` : idx*, ct : comptype} {0x4F x*{x <- `x*`}:Blist(syntax typeidx, grammar Btypeidx) ct:Bcomptype} => SUB_subtype(`FINAL%?`_fin(?(())), _IDX_typeuse(x)*{x <- `x*`}, ct) + prod{`x*` : idx*, ct : comptype} {0x4F x*{x <- `x*`}:Blist(syntax typeidx, grammar Btypeidx) ct:Bcomptype} => SUB_subtype(?(FINAL_FINAL), _IDX_typeuse(x)*{x <- `x*`}, ct) ;; A-binary.watsup - prod{`x*` : idx*, ct : comptype} {0x50 x*{x <- `x*`}:Blist(syntax typeidx, grammar Btypeidx) ct:Bcomptype} => SUB_subtype(`FINAL%?`_fin(?()), _IDX_typeuse(x)*{x <- `x*`}, ct) + prod{`x*` : idx*, ct : comptype} {0x50 x*{x <- `x*`}:Blist(syntax typeidx, grammar Btypeidx) ct:Bcomptype} => SUB_subtype(?(), _IDX_typeuse(x)*{x <- `x*`}, ct) ;; A-binary.watsup - prod{ct : comptype} ct:Bcomptype => SUB_subtype(`FINAL%?`_fin(?(())), [], ct) + prod{ct : comptype} ct:Bcomptype => SUB_subtype(?(FINAL_FINAL), [], ct) ;; A-binary.watsup grammar Brectype : rectype @@ -34237,13 +25392,13 @@ syntax castop = (nul, nul) ;; A-binary.watsup grammar Bcastop : castop ;; A-binary.watsup - prod 0x00 => (`NULL%?`_nul(?()), `NULL%?`_nul(?())) + prod 0x00 => (?(), ?()) ;; A-binary.watsup - prod 0x01 => (`NULL%?`_nul(?(())), `NULL%?`_nul(?())) + prod 0x01 => (?(NULL_NULL), ?()) ;; A-binary.watsup - prod 0x02 => (`NULL%?`_nul(?()), `NULL%?`_nul(?(()))) + prod 0x02 => (?(), ?(NULL_NULL)) ;; A-binary.watsup - prod 0x03 => (`NULL%?`_nul(?(())), `NULL%?`_nul(?(()))) + prod 0x03 => (?(NULL_NULL), ?(NULL_NULL)) ;; A-binary.watsup syntax memidxop = (memidx, memarg) @@ -34356,13 +25511,13 @@ grammar Binstr : instr ;; A-binary.watsup:286.5-286.62 prod{x : idx, y : idx} {0xFB `%`_u32(19):Bu32 x:Btypeidx y:Belemidx} => ARRAY.INIT_ELEM_instr(x, y) ;; A-binary.watsup:290.5-290.51 - prod{ht : heaptype} {0xFB `%`_u32(20):Bu32 ht:Bheaptype} => REF.TEST_instr(REF_reftype(`NULL%?`_nul(?()), ht)) + prod{ht : heaptype} {0xFB `%`_u32(20):Bu32 ht:Bheaptype} => REF.TEST_instr(REF_reftype(?(), ht)) ;; A-binary.watsup:291.5-291.56 - prod{ht : heaptype} {0xFB `%`_u32(21):Bu32 ht:Bheaptype} => REF.TEST_instr(REF_reftype(`NULL%?`_nul(?(())), ht)) + prod{ht : heaptype} {0xFB `%`_u32(21):Bu32 ht:Bheaptype} => REF.TEST_instr(REF_reftype(?(NULL_NULL), ht)) ;; A-binary.watsup:292.5-292.51 - prod{ht : heaptype} {0xFB `%`_u32(22):Bu32 ht:Bheaptype} => REF.CAST_instr(REF_reftype(`NULL%?`_nul(?()), ht)) + prod{ht : heaptype} {0xFB `%`_u32(22):Bu32 ht:Bheaptype} => REF.CAST_instr(REF_reftype(?(), ht)) ;; A-binary.watsup:293.5-293.56 - prod{ht : heaptype} {0xFB `%`_u32(23):Bu32 ht:Bheaptype} => REF.CAST_instr(REF_reftype(`NULL%?`_nul(?(())), ht)) + prod{ht : heaptype} {0xFB `%`_u32(23):Bu32 ht:Bheaptype} => REF.CAST_instr(REF_reftype(?(NULL_NULL), ht)) ;; A-binary.watsup:294.5-295.94 prod{nul1 : nul1, nul2 : nul2, l : labelidx, ht_1 : heaptype, ht_2 : heaptype} {0xFB `%`_u32(24):Bu32 (nul1, nul2):Bcastop l:Blabelidx ht_1:Bheaptype ht_2:Bheaptype} => BR_ON_CAST_instr(l, REF_reftype(nul1, ht_1), REF_reftype(nul2, ht_2)) ;; A-binary.watsup:296.5-297.99 @@ -34380,9 +25535,9 @@ grammar Binstr : instr ;; A-binary.watsup:315.5-315.17 prod 0x1A => DROP_instr ;; A-binary.watsup:316.5-316.19 - prod 0x1B => `SELECT()%?`_instr(?()) + prod 0x1B => SELECT_instr(?()) ;; A-binary.watsup:317.5-317.41 - prod{ts : valtype} {0x1C [ts]:Blist(syntax valtype, grammar Bvaltype)} => `SELECT()%?`_instr(?([ts])) + prod{ts : valtype} {0x1C [ts]:Blist(syntax valtype, grammar Bvaltype)} => SELECT_instr(?([ts])) ;; A-binary.watsup:324.5-324.36 prod{x : idx} {0x20 x:Blocalidx} => LOCAL.GET_instr(x) ;; A-binary.watsup:325.5-325.36 @@ -35305,7 +26460,7 @@ grammar Bfuncsec : typeidx* grammar Btable : table ;; A-binary.watsup prod{tt : tabletype, ht : heaptype, at : addrtype, lim : limits} tt:Btabletype => TABLE_table(tt, [REF.NULL_instr(ht)]) - -- if (tt = `%%%`_tabletype(at, lim, REF_reftype(`NULL%?`_nul(()?{}), ht))) + -- if (tt = `%%%`_tabletype(at, lim, REF_reftype(NULL_NULL?{}, ht))) ;; A-binary.watsup prod{tt : tabletype, e : expr} {0x40 0x00 tt:Btabletype e:Bexpr} => TABLE_table(tt, e) @@ -35360,24 +26515,24 @@ grammar Bstartsec : start? ;; A-binary.watsup grammar Belemkind : reftype ;; A-binary.watsup - prod 0x00 => REF_reftype(`NULL%?`_nul(?(())), FUNC_heaptype) + prod 0x00 => REF_reftype(?(NULL_NULL), FUNC_heaptype) ;; A-binary.watsup grammar Belem : elem ;; A-binary.watsup - prod{e_o : expr, `y*` : idx*} {`%`_u32(0):Bu32 e_o:Bexpr y*{y <- `y*`}:Blist(syntax funcidx, grammar Bfuncidx)} => ELEM_elem(REF_reftype(`NULL%?`_nul(?()), FUNC_heaptype), [REF.FUNC_instr(y)]*{y <- `y*`}, ACTIVE_elemmode(`%`_tableidx(0), e_o)) + prod{e_o : expr, `y*` : idx*} {`%`_u32(0):Bu32 e_o:Bexpr y*{y <- `y*`}:Blist(syntax funcidx, grammar Bfuncidx)} => ELEM_elem(REF_reftype(?(), FUNC_heaptype), [REF.FUNC_instr(y)*{y <- `y*`}], ACTIVE_elemmode(`%`_tableidx(0), e_o)) ;; A-binary.watsup - prod{rt : reftype, `y*` : idx*} {`%`_u32(1):Bu32 rt:Belemkind y*{y <- `y*`}:Blist(syntax funcidx, grammar Bfuncidx)} => ELEM_elem(rt, [REF.FUNC_instr(y)]*{y <- `y*`}, PASSIVE_elemmode) + prod{rt : reftype, `y*` : idx*} {`%`_u32(1):Bu32 rt:Belemkind y*{y <- `y*`}:Blist(syntax funcidx, grammar Bfuncidx)} => ELEM_elem(rt, [REF.FUNC_instr(y)*{y <- `y*`}], PASSIVE_elemmode) ;; A-binary.watsup - prod{x : idx, e : expr, rt : reftype, `y*` : idx*} {`%`_u32(2):Bu32 x:Btableidx e:Bexpr rt:Belemkind y*{y <- `y*`}:Blist(syntax funcidx, grammar Bfuncidx)} => ELEM_elem(rt, [REF.FUNC_instr(y)]*{y <- `y*`}, ACTIVE_elemmode(x, e)) + prod{x : idx, e : expr, rt : reftype, `y*` : idx*} {`%`_u32(2):Bu32 x:Btableidx e:Bexpr rt:Belemkind y*{y <- `y*`}:Blist(syntax funcidx, grammar Bfuncidx)} => ELEM_elem(rt, [REF.FUNC_instr(y)*{y <- `y*`}], ACTIVE_elemmode(x, e)) ;; A-binary.watsup - prod{rt : reftype, `y*` : idx*} {`%`_u32(3):Bu32 rt:Belemkind y*{y <- `y*`}:Blist(syntax funcidx, grammar Bfuncidx)} => ELEM_elem(rt, [REF.FUNC_instr(y)]*{y <- `y*`}, DECLARE_elemmode) + prod{rt : reftype, `y*` : idx*} {`%`_u32(3):Bu32 rt:Belemkind y*{y <- `y*`}:Blist(syntax funcidx, grammar Bfuncidx)} => ELEM_elem(rt, [REF.FUNC_instr(y)*{y <- `y*`}], DECLARE_elemmode) ;; A-binary.watsup - prod{e_O : expr, `e*` : expr*} {`%`_u32(4):Bu32 e_O:Bexpr e*{e <- `e*`}:Blist(syntax expr, grammar Bexpr)} => ELEM_elem(REF_reftype(`NULL%?`_nul(?(())), FUNC_heaptype), e*{e <- `e*`}, ACTIVE_elemmode(`%`_tableidx(0), e_O)) + prod{e_O : expr, `e*` : expr*} {`%`_u32(4):Bu32 e_O:Bexpr e*{e <- `e*`}:Blist(syntax expr, grammar Bexpr)} => ELEM_elem(REF_reftype(?(NULL_NULL), FUNC_heaptype), e*{e <- `e*`}, ACTIVE_elemmode(`%`_tableidx(0), e_O)) ;; A-binary.watsup prod{rt : reftype, `e*` : expr*} {`%`_u32(5):Bu32 rt:Breftype e*{e <- `e*`}:Blist(syntax expr, grammar Bexpr)} => ELEM_elem(rt, e*{e <- `e*`}, PASSIVE_elemmode) ;; A-binary.watsup - prod{x : idx, e_O : expr, `e*` : expr*} {`%`_u32(6):Bu32 x:Btableidx e_O:Bexpr e*{e <- `e*`}:Blist(syntax expr, grammar Bexpr)} => ELEM_elem(REF_reftype(`NULL%?`_nul(?(())), FUNC_heaptype), e*{e <- `e*`}, ACTIVE_elemmode(x, e_O)) + prod{x : idx, e_O : expr, `e*` : expr*} {`%`_u32(6):Bu32 x:Btableidx e_O:Bexpr e*{e <- `e*`}:Blist(syntax expr, grammar Bexpr)} => ELEM_elem(REF_reftype(?(NULL_NULL), FUNC_heaptype), e*{e <- `e*`}, ACTIVE_elemmode(x, e_O)) ;; A-binary.watsup prod{rt : reftype, `e*` : expr*} {`%`_u32(7):Bu32 rt:Breftype e*{e <- `e*`}:Blist(syntax expr, grammar Bexpr)} => ELEM_elem(rt, e*{e <- `e*`}, DECLARE_elemmode) @@ -35428,7 +26583,7 @@ grammar Bdatasec : data* ;; A-binary.watsup grammar Bdatacnt : u32* ;; A-binary.watsup - prod{n : n} `%`_u32(n):Bu32 => [`%`_uN(n)] + prod{n : n} `%`_u32(n):Bu32 => [`%`_u32(n)] ;; A-binary.watsup syntax nopt = u32* @@ -35484,8 +26639,7 @@ syntax symsplit = | _LAST{A_2 : A}(A_2 : A) ;; C-conventions.watsup -syntax recorddots = - | `()` +syntax recorddots = () ;; C-conventions.watsup syntax record = @@ -35642,19 +26796,6 @@ relation TestNestedIter: `%|-%`(nat***, nat**) -- (if (|n*{n <- `n*`}| = m))*{m <- `m*`, `n*` <- `n**`}+{`m*` <- `m**`, `n**` <- `n***`} == IL Validation after pass totalize... -== Running pass wildcards... - -;; test.watsup -relation HasSize: `%|-%`(nat, nat) - -;; test.watsup -relation TestNestedIter: `%|-%`(nat***, nat**) - ;; test.watsup - rule _{`n***` : nat***, `m**` : nat**}: - `%|-%`(n*{n <- `n*`}*{`n*` <- `n**`}+{`n**` <- `n***`}, m*{m <- `m*`}+{`m*` <- `m**`}) - -- (if (|n*{n <- `n*`}| = m))*{m <- `m*`, `n*` <- `n**`}+{`m*` <- `m**`, `n**` <- `n***`} - -== IL Validation after pass wildcards... == Running pass sideconditions... ;; test.watsup diff --git a/spectec/test-prose/TEST.md b/spectec/test-prose/TEST.md index 60b45a2f14..6fa1e68d54 100644 --- a/spectec/test-prose/TEST.md +++ b/spectec/test-prose/TEST.md @@ -34,7 +34,7 @@ The function type :math:`{t_1^\ast}~\rightarrow~{t_2^?}` is valid. -The global type :math:`((\mathsf{mut}~{()^?}~{}^?), t)` is valid. +The global type :math:`({\mathsf{mut}^?}, t)` is valid. @@ -252,9 +252,7 @@ The instruction :math:`(\mathsf{block}~{t^?}~{{\mathit{instr}}^\ast})` is valid The instruction :math:`(\mathsf{loop}~{t^?}~{{\mathit{instr}}^\ast})` is valid with the function type :math:`\epsilon~\rightarrow~{t^?}` if: - * Let :math:`{C'}` be the same context as :math:`C`, but with the result type sequence :math:`\epsilon` prepended to the field :math:`\mathsf{labels}`. - - * Under the context :math:`{C'}`, the instruction sequence :math:`{{\mathit{instr}}^\ast}` is valid with the function type :math:`\epsilon~\rightarrow~\epsilon`. + * The instruction sequence :math:`{{\mathit{instr}}^\ast}` is valid with the function type :math:`\epsilon~\rightarrow~\epsilon`. @@ -648,7 +646,7 @@ The expression :math:`{{\mathit{instr}}^\ast}` is valid with the result type :ma * The global type :math:`C{.}\mathsf{globals}{}[x]` exists. - * The global type :math:`C{.}\mathsf{globals}{}[x]` is equal to :math:`(t)`. + * The global type :math:`C{.}\mathsf{globals}{}[x]` is equal to :math:`(\epsilon, t)`. @@ -663,7 +661,7 @@ The expression :math:`{{\mathit{instr}}^\ast}` is valid with the result type :ma * The global type :math:`C{.}\mathsf{globals}{}[x]` exists. - * The global type :math:`C{.}\mathsf{globals}{}[x]` is equal to :math:`(t)`. + * The global type :math:`C{.}\mathsf{globals}{}[x]` is equal to :math:`(\epsilon, t)`. @@ -2912,7 +2910,7 @@ Functype_ok - the function type t_1* -> t_2? is valid. Globaltype_ok -- the global type ((MUT ()? ?), t) is valid. +- the global type (MUT?, t) is valid. Tabletype_ok - the table type limits is valid if: @@ -3026,8 +3024,7 @@ Instr_ok/block Instr_ok/loop - the instruction (LOOP t? instr*) is valid with the function type [] -> t? if: - - the context C' is the context C with .LABELS prepended by [?()]. - - Under the context C', the instruction sequence instr* is valid with the function type [] -> []. + - the instruction sequence instr* is valid with the function type [] -> []. Instr_ok/if - the instruction (IF t? instr_1* ELSE instr_2*) is valid with the function type [I32] -> t? if: @@ -3114,7 +3111,7 @@ Instr_ok/global.get Instr_ok/global.set - the instruction (GLOBAL.SET x) is valid with the function type [t] -> [] if: - the global type C.GLOBALS[x] exists. - - C.GLOBALS[x] is (MUT, t). + - C.GLOBALS[x] is (?(MUT), t). Instr_ok/memory.size - the instruction MEMORY.SIZE is valid with the function type [] -> [I32] if: @@ -3228,7 +3225,7 @@ Instr_const - Or: - instr_u1 is (GLOBAL.GET x). - the global type C.GLOBALS[x] exists. - - C.GLOBALS[x] is (, t). + - C.GLOBALS[x] is (?(), t). Instr_const/const - the instruction (t.CONST c) is constant. @@ -3236,7 +3233,7 @@ Instr_const/const Instr_const/global.get - the instruction (GLOBAL.GET x) is constant if: - the global type C.GLOBALS[x] exists. - - C.GLOBALS[x] is (, t). + - C.GLOBALS[x] is (?(), t). Expr_const - the expression instr* is constant if: @@ -4329,7 +4326,7 @@ The function type :math:`{t_1^\ast}~\rightarrow~{t_2^\ast}` is valid. -The global type :math:`((\mathsf{mut}~{()^?}~{}^?), t)` is valid. +The global type :math:`({\mathsf{mut}^?}, t)` is valid. @@ -4606,7 +4603,7 @@ The instruction :math:`\mathsf{drop}` is valid with the function type :math:`t~\ -The instruction :math:`{t_{\mathit{u{\kern-0.1em\scriptstyle 1}}}^?}~{}^?` is valid with the function type :math:`t~t~\mathsf{i{\scriptstyle 32}}~\rightarrow~t` if: +The instruction :math:`(\mathsf{select}~{t_{\mathit{u{\kern-0.1em\scriptstyle 1}}}^?})` is valid with the function type :math:`t~t~\mathsf{i{\scriptstyle 32}}~\rightarrow~t` if: * Either: @@ -5240,12 +5237,12 @@ The instruction :math:`(\mathsf{vstore\_lane}~\mathsf{v{\scriptstyle 128}}~n~{\m -The instruction :math:`t~{}^?` is valid with the function type :math:`t~t~\mathsf{i{\scriptstyle 32}}~\rightarrow~t`. +The instruction :math:`(\mathsf{select}~t)` is valid with the function type :math:`t~t~\mathsf{i{\scriptstyle 32}}~\rightarrow~t`. -The instruction :math:`\epsilon~{}^?` is valid with the function type :math:`t~t~\mathsf{i{\scriptstyle 32}}~\rightarrow~t` if: +The instruction :math:`(\mathsf{select}~\epsilon)` is valid with the function type :math:`t~t~\mathsf{i{\scriptstyle 32}}~\rightarrow~t` if: * The value type :math:`t` matches the value type :math:`{t'}`. @@ -5465,7 +5462,7 @@ The expression :math:`{{\mathit{instr}}^\ast}` is valid with the value type sequ * The global type :math:`C{.}\mathsf{globals}{}[x]` exists. - * The global type :math:`C{.}\mathsf{globals}{}[x]` is equal to :math:`(t)`. + * The global type :math:`C{.}\mathsf{globals}{}[x]` is equal to :math:`(\epsilon, t)`. @@ -5495,7 +5492,7 @@ The expression :math:`{{\mathit{instr}}^\ast}` is valid with the value type sequ * The global type :math:`C{.}\mathsf{globals}{}[x]` exists. - * The global type :math:`C{.}\mathsf{globals}{}[x]` is equal to :math:`(t)`. + * The global type :math:`C{.}\mathsf{globals}{}[x]` is equal to :math:`(\epsilon, t)`. @@ -10006,7 +10003,7 @@ Functype_ok - the function type t_1* -> t_2* is valid. Globaltype_ok -- the global type ((MUT ()? ?), t) is valid. +- the global type (MUT?, t) is valid. Tabletype_ok - the table type (limits, reftype) is valid if: @@ -10151,7 +10148,7 @@ Instr_ok/drop - the instruction DROP is valid with the function type [t] -> []. Instr_ok/select -- the instruction (SELECT() t_u1? ?) is valid with the function type [t, t, I32] -> [t] if: +- the instruction (SELECT t_u1?) is valid with the function type [t, t, I32] -> [t] if: - Either: - the value type sequence t_u1? is ?([t]). - Or: @@ -10337,7 +10334,7 @@ Instr_ok/global.get Instr_ok/global.set - the instruction (GLOBAL.SET x) is valid with the function type [t] -> [] if: - the global type C.GLOBALS[x] exists. - - C.GLOBALS[x] is (MUT, t). + - C.GLOBALS[x] is (?(MUT), t). Instr_ok/table.get - the instruction (TABLE.GET x) is valid with the function type [I32] -> [rt] if: @@ -10480,10 +10477,10 @@ Instr_ok/vstore_lane - laneidx is less than (128 / n). Instr_ok/select-expl -- the instruction (SELECT() ?([t]) ?) is valid with the function type [t, t, I32] -> [t]. +- the instruction (SELECT ?([t])) is valid with the function type [t, t, I32] -> [t]. Instr_ok/select-impl -- the instruction (SELECT() ?() ?) is valid with the function type [t, t, I32] -> [t] if: +- the instruction (SELECT ?()) is valid with the function type [t, t, I32] -> [t] if: - the value type t matches the value type t'. - t' is numtype or t' is vectype. @@ -10596,7 +10593,7 @@ Instr_const - Or: - in_u1 is (GLOBAL.GET x). - the global type C.GLOBALS[x] exists. - - C.GLOBALS[x] is (, t). + - C.GLOBALS[x] is (?(), t). Instr_const/const - the instruction (nt.CONST c) is constant. @@ -10613,7 +10610,7 @@ Instr_const/ref.func Instr_const/global.get - the instruction (GLOBAL.GET x) is constant if: - the global type C.GLOBALS[x] exists. - - C.GLOBALS[x] is (, t). + - C.GLOBALS[x] is (?(), t). Expr_const - the expression instr* is constant if: @@ -12843,7 +12840,7 @@ The heap type :math:`(\mathsf{rec}~i)` is valid if: -The reference type :math:`(\mathsf{ref}~(\mathsf{null}~{()^?}~{}^?)~{\mathit{heaptype}})` is valid if: +The reference type :math:`(\mathsf{ref}~{\mathsf{null}^?}~{\mathit{heaptype}})` is valid if: * The heap type :math:`{\mathit{heaptype}}` is valid. @@ -12975,7 +12972,7 @@ The storage type :math:`{\mathit{packtype}}` is valid if: -The field type :math:`((\mathsf{mut}~{()^?}~{}^?), {\mathit{storagetype}})` is valid if: +The field type :math:`({\mathsf{mut}^?}, {\mathit{storagetype}})` is valid if: * The storage type :math:`{\mathit{storagetype}}` is valid. @@ -13349,27 +13346,27 @@ The heap type :math:`\mathsf{bot}` matches the heap type :math:`{\mathit{heaptyp -The reference type :math:`(\mathsf{ref}~(\mathsf{null}~{{\mathit{u{\kern-0.1em\scriptstyle 1}}}^?}~{}^?)~{\mathit{ht}}_1)` matches the reference type :math:`(\mathsf{ref}~(\mathsf{null}~{{\mathit{u{\kern-0.1em\scriptstyle 2}}}^?}~{}^?)~{\mathit{ht}}_2)` if: +The reference type :math:`(\mathsf{ref}~{{\mathsf{null}^?}}_{\mathit{u{\kern-0.1em\scriptstyle 1}}}~{\mathit{ht}}_1)` matches the reference type :math:`(\mathsf{ref}~{{\mathsf{null}^?}}_{\mathit{u{\kern-0.1em\scriptstyle 2}}}~{\mathit{ht}}_2)` if: * The heap type :math:`{\mathit{ht}}_1` matches the heap type :math:`{\mathit{ht}}_2`. * Either: - * :math:`{{\mathit{u{\kern-0.1em\scriptstyle 1}}}^?}` is absent. + * :math:`{{\mathsf{null}^?}}_{\mathit{u{\kern-0.1em\scriptstyle 1}}}` is absent. - * :math:`{{\mathit{u{\kern-0.1em\scriptstyle 2}}}^?}` is absent. + * :math:`{{\mathsf{null}^?}}_{\mathit{u{\kern-0.1em\scriptstyle 2}}}` is absent. * Or: - * :math:`{{\mathit{u{\kern-0.1em\scriptstyle 1}}}^?}` is equal to :math:`{()^?}`. + * :math:`{{\mathsf{null}^?}}_{\mathit{u{\kern-0.1em\scriptstyle 1}}}` is equal to :math:`{\mathsf{null}^?}`. - * :math:`{{\mathit{u{\kern-0.1em\scriptstyle 2}}}^?}` is equal to :math:`()`. + * :math:`{{\mathsf{null}^?}}_{\mathit{u{\kern-0.1em\scriptstyle 2}}}` is equal to :math:`\mathsf{null}`. -The reference type :math:`(\mathsf{ref}~{\mathit{ht}}_1)` matches the reference type :math:`(\mathsf{ref}~{\mathit{ht}}_2)` if: +The reference type :math:`(\mathsf{ref}~\epsilon~{\mathit{ht}}_1)` matches the reference type :math:`(\mathsf{ref}~\epsilon~{\mathit{ht}}_2)` if: * The heap type :math:`{\mathit{ht}}_1` matches the heap type :math:`{\mathit{ht}}_2`. @@ -13377,7 +13374,7 @@ The reference type :math:`(\mathsf{ref}~{\mathit{ht}}_1)` matches the reference -The reference type :math:`(\mathsf{ref}~(\mathsf{null}~{()^?}~{}^?)~{\mathit{ht}}_1)` matches the reference type :math:`(\mathsf{ref}~\mathsf{null}~{\mathit{ht}}_2)` if: +The reference type :math:`(\mathsf{ref}~{\mathsf{null}^?}~{\mathit{ht}}_1)` matches the reference type :math:`(\mathsf{ref}~\mathsf{null}~{\mathit{ht}}_2)` if: * The heap type :math:`{\mathit{ht}}_1` matches the heap type :math:`{\mathit{ht}}_2`. @@ -13491,29 +13488,29 @@ The storage type :math:`{\mathit{packtype}}_1` matches the storage type :math:`{ -The field type :math:`((\mathsf{mut}~{{\mathit{u{\kern-0.1em\scriptstyle 1}}}^?}~{}^?), {\mathit{zt}}_1)` matches the field type :math:`((\mathsf{mut}~{{\mathit{u{\kern-0.1em\scriptstyle 2}}}^?}~{}^?), {\mathit{zt}}_2)` if: +The field type :math:`({{\mathsf{mut}^?}}_{\mathit{u{\kern-0.1em\scriptstyle 1}}}, {\mathit{zt}}_1)` matches the field type :math:`({{\mathsf{mut}^?}}_{\mathit{u{\kern-0.1em\scriptstyle 2}}}, {\mathit{zt}}_2)` if: * The storage type :math:`{\mathit{zt}}_1` matches the storage type :math:`{\mathit{zt}}_2`. * Either: - * :math:`{{\mathit{u{\kern-0.1em\scriptstyle 1}}}^?}` is absent. + * :math:`{{\mathsf{mut}^?}}_{\mathit{u{\kern-0.1em\scriptstyle 1}}}` is absent. - * :math:`{{\mathit{u{\kern-0.1em\scriptstyle 2}}}^?}` is absent. + * :math:`{{\mathsf{mut}^?}}_{\mathit{u{\kern-0.1em\scriptstyle 2}}}` is absent. * Or: - * :math:`{{\mathit{u{\kern-0.1em\scriptstyle 1}}}^?}` is equal to :math:`()`. + * :math:`{{\mathsf{mut}^?}}_{\mathit{u{\kern-0.1em\scriptstyle 1}}}` is equal to :math:`\mathsf{mut}`. - * :math:`{{\mathit{u{\kern-0.1em\scriptstyle 2}}}^?}` is equal to :math:`()`. + * :math:`{{\mathsf{mut}^?}}_{\mathit{u{\kern-0.1em\scriptstyle 2}}}` is equal to :math:`\mathsf{mut}`. * The storage type :math:`{\mathit{zt}}_2` matches the storage type :math:`{\mathit{zt}}_1`. -The field type :math:`({\mathit{zt}}_1)` matches the field type :math:`({\mathit{zt}}_2)` if: +The field type :math:`(\epsilon, {\mathit{zt}}_1)` matches the field type :math:`(\epsilon, {\mathit{zt}}_2)` if: * The storage type :math:`{\mathit{zt}}_1` matches the storage type :math:`{\mathit{zt}}_2`. @@ -13614,7 +13611,7 @@ The composite type :math:`(\mathsf{func}~{\mathit{ft}}_1)` matches the composite -The sub type :math:`(\mathsf{sub}~(\mathsf{final}~{()^?}~{}^?)~{x^\ast}~{\mathit{comptype}})` is valid with :math:`({\mathsf{ok}}{x_0})` if: +The sub type :math:`(\mathsf{sub}~{\mathsf{final}^?}~{x^\ast}~{\mathit{comptype}})` is valid with :math:`({\mathsf{ok}}{x_0})` if: * :math:`{|{x^\ast}|}` is less than or equal to :math:`1`. @@ -13633,7 +13630,7 @@ The sub type :math:`(\mathsf{sub}~(\mathsf{final}~{()^?}~{}^?)~{x^\ast}~{\mathit * For all :math:`{\mathit{comptype}'}` in :math:`{{\mathit{comptype}'}^\ast}` and :math:`x` in :math:`{x^\ast}` and :math:`{\mathit{x'*}}` in :math:`{{\mathit{x'*}}^\ast}`: - * The sub type :math:`{\mathrm{unroll}}(C{.}\mathsf{types}{}[x])` is equal to :math:`(\mathsf{sub}~{{x'}^\ast}~{\mathit{comptype}'})`. + * The sub type :math:`{\mathrm{unroll}}(C{.}\mathsf{types}{}[x])` is equal to :math:`(\mathsf{sub}~\epsilon~{{x'}^\ast}~{\mathit{comptype}'})`. * The composite type :math:`{\mathit{comptype}}` is valid. @@ -13644,7 +13641,7 @@ The sub type :math:`(\mathsf{sub}~(\mathsf{final}~{()^?}~{}^?)~{x^\ast}~{\mathit -The sub type :math:`(\mathsf{sub}~(\mathsf{final}~{()^?}~{}^?)~{{\mathit{typeuse}}^\ast}~{\mathit{compttype}})` is valid with :math:`({\mathsf{ok}}{(x, i)})` if: +The sub type :math:`(\mathsf{sub}~{\mathsf{final}^?}~{{\mathit{typeuse}}^\ast}~{\mathit{compttype}})` is valid with :math:`({\mathsf{ok}}{(x, i)})` if: * :math:`{|{{\mathit{typeuse}}^\ast}|}` is less than or equal to :math:`1`. @@ -13659,7 +13656,7 @@ The sub type :math:`(\mathsf{sub}~(\mathsf{final}~{()^?}~{}^?)~{{\mathit{typeuse * For all :math:`{\mathit{comptype}'}` in :math:`{{\mathit{comptype}'}^\ast}` and :math:`{\mathit{typeuse}}` in :math:`{{\mathit{typeuse}}^\ast}` and :math:`{\mathit{typeuse'*}}` in :math:`{{\mathit{typeuse'*}}^\ast}`: - * The sub type :math:`{{\mathrm{unroll}}}_{C}({\mathit{typeuse}})` is equal to :math:`(\mathsf{sub}~{{\mathit{typeuse}'}^\ast}~{\mathit{comptype}'})`. + * The sub type :math:`{{\mathrm{unroll}}}_{C}({\mathit{typeuse}})` is equal to :math:`(\mathsf{sub}~\epsilon~{{\mathit{typeuse}'}^\ast}~{\mathit{comptype}'})`. * The composite type :math:`{\mathit{comptype}}` is valid. @@ -13775,7 +13772,7 @@ The limits :math:`({}[~n~..~m~])` is valid with :math:`k` if: -The global type :math:`((\mathsf{mut}~{()^?}~{}^?), t)` is valid if: +The global type :math:`({\mathsf{mut}^?}, t)` is valid if: * The value type :math:`t` is valid. @@ -13920,29 +13917,29 @@ The limits :math:`({}[~n_1~..~m_1~])` matches the limits :math:`({}[~n_2~..~m_2~ -The global type :math:`((\mathsf{mut}~{{\mathit{u{\kern-0.1em\scriptstyle 1}}}^?}~{}^?), {\mathit{valtype}}_1)` matches the global type :math:`((\mathsf{mut}~{{\mathit{u{\kern-0.1em\scriptstyle 2}}}^?}~{}^?), {\mathit{valtype}}_2)` if: +The global type :math:`({{\mathsf{mut}^?}}_{\mathit{u{\kern-0.1em\scriptstyle 1}}}, {\mathit{valtype}}_1)` matches the global type :math:`({{\mathsf{mut}^?}}_{\mathit{u{\kern-0.1em\scriptstyle 2}}}, {\mathit{valtype}}_2)` if: * The value type :math:`{\mathit{valtype}}_1` matches the value type :math:`{\mathit{valtype}}_2`. * Either: - * :math:`{{\mathit{u{\kern-0.1em\scriptstyle 1}}}^?}` is absent. + * :math:`{{\mathsf{mut}^?}}_{\mathit{u{\kern-0.1em\scriptstyle 1}}}` is absent. - * :math:`{{\mathit{u{\kern-0.1em\scriptstyle 2}}}^?}` is absent. + * :math:`{{\mathsf{mut}^?}}_{\mathit{u{\kern-0.1em\scriptstyle 2}}}` is absent. * Or: - * :math:`{{\mathit{u{\kern-0.1em\scriptstyle 1}}}^?}` is equal to :math:`()`. + * :math:`{{\mathsf{mut}^?}}_{\mathit{u{\kern-0.1em\scriptstyle 1}}}` is equal to :math:`\mathsf{mut}`. - * :math:`{{\mathit{u{\kern-0.1em\scriptstyle 2}}}^?}` is equal to :math:`()`. + * :math:`{{\mathsf{mut}^?}}_{\mathit{u{\kern-0.1em\scriptstyle 2}}}` is equal to :math:`\mathsf{mut}`. * The value type :math:`{\mathit{valtype}}_2` matches the value type :math:`{\mathit{valtype}}_1`. -The global type :math:`({\mathit{valtype}}_1)` matches the global type :math:`({\mathit{valtype}}_2)` if: +The global type :math:`(\epsilon, {\mathit{valtype}}_1)` matches the global type :math:`(\epsilon, {\mathit{valtype}}_2)` if: * The value type :math:`{\mathit{valtype}}_1` matches the value type :math:`{\mathit{valtype}}_2`. @@ -14146,7 +14143,7 @@ The catch clause :math:`{\mathit{catch}}_{\mathit{u{\kern-0.1em\scriptstyle 1}}} * The :ref:`expansion ` of the tag type :math:`C{.}\mathsf{tags}{}[x]` is the composite type :math:`(\mathsf{func}~{t^\ast}~\rightarrow~\epsilon)`. - * The value type sequence :math:`{t^\ast}~(\mathsf{ref}~\mathsf{exn})` matches the result type :math:`C{.}\mathsf{labels}{}[l]`. + * The value type sequence :math:`{t^\ast}~(\mathsf{ref}~\epsilon~\mathsf{exn})` matches the result type :math:`C{.}\mathsf{labels}{}[l]`. * Or: * The catch clause :math:`{\mathit{catch}}_{\mathit{u{\kern-0.1em\scriptstyle 1}}}` is equal to :math:`(\mathsf{catch\_all}~l)`. @@ -14156,7 +14153,7 @@ The catch clause :math:`{\mathit{catch}}_{\mathit{u{\kern-0.1em\scriptstyle 1}}} * The catch clause :math:`{\mathit{catch}}_{\mathit{u{\kern-0.1em\scriptstyle 1}}}` is equal to :math:`(\mathsf{catch\_all\_ref}~l)`. - * The value type sequence :math:`(\mathsf{ref}~\mathsf{exn})` matches the result type :math:`C{.}\mathsf{labels}{}[l]`. + * The value type sequence :math:`(\mathsf{ref}~\epsilon~\mathsf{exn})` matches the result type :math:`C{.}\mathsf{labels}{}[l]`. @@ -14184,7 +14181,7 @@ The catch clause :math:`(\mathsf{catch\_ref}~x~l)` is valid if: * The result type :math:`C{.}\mathsf{labels}{}[l]` exists. - * The value type sequence :math:`{t^\ast}~(\mathsf{ref}~\mathsf{exn})` matches the result type :math:`C{.}\mathsf{labels}{}[l]`. + * The value type sequence :math:`{t^\ast}~(\mathsf{ref}~\epsilon~\mathsf{exn})` matches the result type :math:`C{.}\mathsf{labels}{}[l]`. @@ -14204,7 +14201,7 @@ The catch clause :math:`(\mathsf{catch\_all\_ref}~l)` is valid if: * The result type :math:`C{.}\mathsf{labels}{}[l]` exists. - * The value type sequence :math:`(\mathsf{ref}~\mathsf{exn})` matches the result type :math:`C{.}\mathsf{labels}{}[l]`. + * The value type sequence :math:`(\mathsf{ref}~\epsilon~\mathsf{exn})` matches the result type :math:`C{.}\mathsf{labels}{}[l]`. @@ -14238,7 +14235,7 @@ The instruction :math:`\mathsf{drop}` is valid with the instruction type :math:` -The instruction :math:`{t_{\mathit{u{\kern-0.1em\scriptstyle 1}}}^?}~{}^?` is valid with the instruction type :math:`t~t~\mathsf{i{\scriptstyle 32}}~\rightarrow~t` if: +The instruction :math:`(\mathsf{select}~{t_{\mathit{u{\kern-0.1em\scriptstyle 1}}}^?})` is valid with the instruction type :math:`t~t~\mathsf{i{\scriptstyle 32}}~\rightarrow~t` if: * The value type :math:`t` is valid. @@ -14338,7 +14335,7 @@ The instruction :math:`(\mathsf{br\_table}~{l^\ast}~{l'})` is valid with the ins -The instruction :math:`(\mathsf{br\_on\_null}~l)` is valid with the instruction type :math:`{t^\ast}~(\mathsf{ref}~\mathsf{null}~{\mathit{ht}})~\rightarrow~{t^\ast}~(\mathsf{ref}~{\mathit{ht}})` if: +The instruction :math:`(\mathsf{br\_on\_null}~l)` is valid with the instruction type :math:`{t^\ast}~(\mathsf{ref}~\mathsf{null}~{\mathit{ht}})~\rightarrow~{t^\ast}~(\mathsf{ref}~\epsilon~{\mathit{ht}})` if: * The result type :math:`C{.}\mathsf{labels}{}[l]` exists. @@ -14355,7 +14352,7 @@ The instruction :math:`(\mathsf{br\_on\_non\_null}~l)` is valid with the instruc * The result type :math:`C{.}\mathsf{labels}{}[l]` exists. - * The result type :math:`C{.}\mathsf{labels}{}[l]` is equal to :math:`{t^\ast}~(\mathsf{ref}~{\mathit{ht}})`. + * The result type :math:`C{.}\mathsf{labels}{}[l]` is equal to :math:`{t^\ast}~(\mathsf{ref}~\epsilon~{\mathit{ht}})`. @@ -14572,7 +14569,7 @@ The instruction :math:`(\mathsf{ref{.}null}~{\mathit{ht}})` is valid with the in -The instruction :math:`(\mathsf{ref{.}func}~x)` is valid with the instruction type :math:`\epsilon~\rightarrow~(\mathsf{ref}~{\mathit{dt}})` if: +The instruction :math:`(\mathsf{ref{.}func}~x)` is valid with the instruction type :math:`\epsilon~\rightarrow~(\mathsf{ref}~\epsilon~{\mathit{dt}})` if: * The defined type :math:`C{.}\mathsf{funcs}{}[x]` exists. @@ -14586,7 +14583,7 @@ The instruction :math:`(\mathsf{ref{.}func}~x)` is valid with the instruction ty -The instruction :math:`\mathsf{ref{.}i{\scriptstyle 31}}` is valid with the instruction type :math:`\mathsf{i{\scriptstyle 32}}~\rightarrow~(\mathsf{ref}~\mathsf{i{\scriptstyle 31}})`. +The instruction :math:`\mathsf{ref{.}i{\scriptstyle 31}}` is valid with the instruction type :math:`\mathsf{i{\scriptstyle 32}}~\rightarrow~(\mathsf{ref}~\epsilon~\mathsf{i{\scriptstyle 31}})`. @@ -14599,7 +14596,7 @@ The instruction :math:`\mathsf{ref{.}is\_null}` is valid with the instruction ty -The instruction :math:`\mathsf{ref{.}as\_non\_null}` is valid with the instruction type :math:`(\mathsf{ref}~\mathsf{null}~{\mathit{ht}})~\rightarrow~(\mathsf{ref}~{\mathit{ht}})` if: +The instruction :math:`\mathsf{ref{.}as\_non\_null}` is valid with the instruction type :math:`(\mathsf{ref}~\mathsf{null}~{\mathit{ht}})~\rightarrow~(\mathsf{ref}~\epsilon~{\mathit{ht}})` if: * The heap type :math:`{\mathit{ht}}` is valid. @@ -14641,7 +14638,7 @@ The instruction :math:`({\mathsf{i{\scriptstyle 31}{.}get}}{\mathsf{\_}}{{\mathi -The instruction :math:`(\mathsf{struct{.}new}~x)` is valid with the instruction type :math:`{t^\ast}~\rightarrow~(\mathsf{ref}~x)` if: +The instruction :math:`(\mathsf{struct{.}new}~x)` is valid with the instruction type :math:`{t^\ast}~\rightarrow~(\mathsf{ref}~\epsilon~x)` if: * The defined type :math:`C{.}\mathsf{types}{}[x]` exists. @@ -14653,7 +14650,7 @@ The instruction :math:`(\mathsf{struct{.}new}~x)` is valid with the instruction -The instruction :math:`(\mathsf{struct{.}new\_default}~x)` is valid with the instruction type :math:`\epsilon~\rightarrow~(\mathsf{ref}~x)` if: +The instruction :math:`(\mathsf{struct{.}new\_default}~x)` is valid with the instruction type :math:`\epsilon~\rightarrow~(\mathsf{ref}~\epsilon~x)` if: * The defined type :math:`C{.}\mathsf{types}{}[x]` exists. @@ -14701,7 +14698,7 @@ The instruction :math:`(\mathsf{struct{.}set}~x~i)` is valid with the instructio -The instruction :math:`(\mathsf{array{.}new}~x)` is valid with the instruction type :math:`t~\mathsf{i{\scriptstyle 32}}~\rightarrow~(\mathsf{ref}~x)` if: +The instruction :math:`(\mathsf{array{.}new}~x)` is valid with the instruction type :math:`t~\mathsf{i{\scriptstyle 32}}~\rightarrow~(\mathsf{ref}~\epsilon~x)` if: * The defined type :math:`C{.}\mathsf{types}{}[x]` exists. @@ -14713,7 +14710,7 @@ The instruction :math:`(\mathsf{array{.}new}~x)` is valid with the instruction t -The instruction :math:`(\mathsf{array{.}new\_default}~x)` is valid with the instruction type :math:`\mathsf{i{\scriptstyle 32}}~\rightarrow~(\mathsf{ref}~x)` if: +The instruction :math:`(\mathsf{array{.}new\_default}~x)` is valid with the instruction type :math:`\mathsf{i{\scriptstyle 32}}~\rightarrow~(\mathsf{ref}~\epsilon~x)` if: * The defined type :math:`C{.}\mathsf{types}{}[x]` exists. @@ -14725,7 +14722,7 @@ The instruction :math:`(\mathsf{array{.}new\_default}~x)` is valid with the inst -The instruction :math:`(\mathsf{array{.}new\_fixed}~x~n)` is valid with the instruction type :math:`{t^{n}}~\rightarrow~(\mathsf{ref}~x)` if: +The instruction :math:`(\mathsf{array{.}new\_fixed}~x~n)` is valid with the instruction type :math:`{t^{n}}~\rightarrow~(\mathsf{ref}~\epsilon~x)` if: * The defined type :math:`C{.}\mathsf{types}{}[x]` exists. @@ -14737,7 +14734,7 @@ The instruction :math:`(\mathsf{array{.}new\_fixed}~x~n)` is valid with the inst -The instruction :math:`(\mathsf{array{.}new\_elem}~x~y)` is valid with the instruction type :math:`\mathsf{i{\scriptstyle 32}}~\mathsf{i{\scriptstyle 32}}~\rightarrow~(\mathsf{ref}~x)` if: +The instruction :math:`(\mathsf{array{.}new\_elem}~x~y)` is valid with the instruction type :math:`\mathsf{i{\scriptstyle 32}}~\mathsf{i{\scriptstyle 32}}~\rightarrow~(\mathsf{ref}~\epsilon~x)` if: * The defined type :math:`C{.}\mathsf{types}{}[x]` exists. @@ -14751,7 +14748,7 @@ The instruction :math:`(\mathsf{array{.}new\_elem}~x~y)` is valid with the instr -The instruction :math:`(\mathsf{array{.}new\_data}~x~y)` is valid with the instruction type :math:`\mathsf{i{\scriptstyle 32}}~\mathsf{i{\scriptstyle 32}}~\rightarrow~(\mathsf{ref}~x)` if: +The instruction :math:`(\mathsf{array{.}new\_data}~x~y)` is valid with the instruction type :math:`\mathsf{i{\scriptstyle 32}}~\mathsf{i{\scriptstyle 32}}~\rightarrow~(\mathsf{ref}~\epsilon~x)` if: * The defined type :math:`C{.}\mathsf{types}{}[x]` exists. @@ -15346,7 +15343,7 @@ The instruction :math:`({\mathsf{v{\scriptstyle 128}}{.}\mathsf{store}}{N}{\math -The instruction :math:`t~{}^?` is valid with the instruction type :math:`t~t~\mathsf{i{\scriptstyle 32}}~\rightarrow~t` if: +The instruction :math:`(\mathsf{select}~t)` is valid with the instruction type :math:`t~t~\mathsf{i{\scriptstyle 32}}~\rightarrow~t` if: * The value type :math:`t` is valid. @@ -15354,7 +15351,7 @@ The instruction :math:`t~{}^?` is valid with the instruction type :math:`t~t~\ma -The instruction :math:`\epsilon~{}^?` is valid with the instruction type :math:`t~t~\mathsf{i{\scriptstyle 32}}~\rightarrow~t` if: +The instruction :math:`(\mathsf{select}~\epsilon)` is valid with the instruction type :math:`t~t~\mathsf{i{\scriptstyle 32}}~\rightarrow~t` if: * The value type :math:`t` is valid. @@ -15619,7 +15616,7 @@ The expression :math:`{{\mathit{instr}}^\ast}` is valid with the value type sequ * The global type :math:`C{.}\mathsf{globals}{}[x]` exists. - * The global type :math:`C{.}\mathsf{globals}{}[x]` is equal to :math:`(t)`. + * The global type :math:`C{.}\mathsf{globals}{}[x]` is equal to :math:`(\epsilon, t)`. * Or: * The instruction :math:`{\mathit{instr}}_{\mathit{u{\kern-0.1em\scriptstyle 1}}}` is equal to :math:`({\mathsf{i}}{N} {.} {\mathit{binop}})`. @@ -15696,7 +15693,7 @@ The expression :math:`{{\mathit{instr}}^\ast}` is valid with the value type sequ * The global type :math:`C{.}\mathsf{globals}{}[x]` exists. - * The global type :math:`C{.}\mathsf{globals}{}[x]` is equal to :math:`(t)`. + * The global type :math:`C{.}\mathsf{globals}{}[x]` is equal to :math:`(\epsilon, t)`. @@ -16511,7 +16508,7 @@ The instruction sequence :math:`(\mathsf{block}~{\mathit{blocktype}}~{{\mathit{i 1. Execute the instruction :math:`(\mathsf{table{.}get}~x)`. -#. Execute the instruction :math:`(\mathsf{ref{.}cast}~(\mathsf{ref}~(\mathsf{null}~()~{}^?)~y))`. +#. Execute the instruction :math:`(\mathsf{ref{.}cast}~(\mathsf{ref}~\mathsf{null}~y))`. #. Execute the instruction :math:`(\mathsf{call\_ref}~y)`. @@ -16522,7 +16519,7 @@ The instruction sequence :math:`(\mathsf{block}~{\mathit{blocktype}}~{{\mathit{i 1. Execute the instruction :math:`(\mathsf{table{.}get}~x)`. -#. Execute the instruction :math:`(\mathsf{ref{.}cast}~(\mathsf{ref}~(\mathsf{null}~()~{}^?)~y))`. +#. Execute the instruction :math:`(\mathsf{ref{.}cast}~(\mathsf{ref}~\mathsf{null}~y))`. #. Execute the instruction :math:`(\mathsf{return\_call\_ref}~y)`. @@ -19410,70 +19407,70 @@ The instruction sequence :math:`(\mathsf{block}~{\mathit{blocktype}}~{{\mathit{i ....................... -1. Return :math:`(\mathsf{ref}~(\mathsf{null}~()~{}^?)~\mathsf{any})`. +1. Return :math:`(\mathsf{ref}~\mathsf{null}~\mathsf{any})`. :math:`\mathsf{eqref}` ...................... -1. Return :math:`(\mathsf{ref}~(\mathsf{null}~()~{}^?)~\mathsf{eq})`. +1. Return :math:`(\mathsf{ref}~\mathsf{null}~\mathsf{eq})`. :math:`\mathsf{i{\scriptstyle 31}ref}` ...................................... -1. Return :math:`(\mathsf{ref}~(\mathsf{null}~()~{}^?)~\mathsf{i{\scriptstyle 31}})`. +1. Return :math:`(\mathsf{ref}~\mathsf{null}~\mathsf{i{\scriptstyle 31}})`. :math:`\mathsf{structref}` .......................... -1. Return :math:`(\mathsf{ref}~(\mathsf{null}~()~{}^?)~\mathsf{struct})`. +1. Return :math:`(\mathsf{ref}~\mathsf{null}~\mathsf{struct})`. :math:`\mathsf{arrayref}` ......................... -1. Return :math:`(\mathsf{ref}~(\mathsf{null}~()~{}^?)~\mathsf{array})`. +1. Return :math:`(\mathsf{ref}~\mathsf{null}~\mathsf{array})`. :math:`\mathsf{funcref}` ........................ -1. Return :math:`(\mathsf{ref}~(\mathsf{null}~()~{}^?)~\mathsf{func})`. +1. Return :math:`(\mathsf{ref}~\mathsf{null}~\mathsf{func})`. :math:`\mathsf{externref}` .......................... -1. Return :math:`(\mathsf{ref}~(\mathsf{null}~()~{}^?)~\mathsf{extern})`. +1. Return :math:`(\mathsf{ref}~\mathsf{null}~\mathsf{extern})`. :math:`\mathsf{nullref}` ........................ -1. Return :math:`(\mathsf{ref}~(\mathsf{null}~()~{}^?)~\mathsf{none})`. +1. Return :math:`(\mathsf{ref}~\mathsf{null}~\mathsf{none})`. :math:`\mathsf{nullfuncref}` ............................ -1. Return :math:`(\mathsf{ref}~(\mathsf{null}~()~{}^?)~\mathsf{nofunc})`. +1. Return :math:`(\mathsf{ref}~\mathsf{null}~\mathsf{nofunc})`. :math:`\mathsf{nullexternref}` .............................. -1. Return :math:`(\mathsf{ref}~(\mathsf{null}~()~{}^?)~\mathsf{noextern})`. +1. Return :math:`(\mathsf{ref}~\mathsf{null}~\mathsf{noextern})`. :math:`{|{\mathit{nt}}_{\mathit{u{\kern-0.1em\scriptstyle 1}}}|}` @@ -19870,15 +19867,15 @@ The instruction sequence :math:`(\mathsf{block}~{\mathit{blocktype}}~{{\mathit{i #. Return :math:`{\mathit{at}}_2`. -:math:`(\mathsf{ref}~{\mathsf{null}}{{{}_{1}^?}}~{\mathit{ht}}_1) \setminus (\mathsf{ref}~(\mathsf{null}~{{\mathit{u{\kern-0.1em\scriptstyle 1}}}^?}~{}^?)~{\mathit{ht}}_2)` -............................................................................................................................................................................ +:math:`(\mathsf{ref}~{\mathsf{null}}{{{}_{1}^?}}~{\mathit{ht}}_1) \setminus (\mathsf{ref}~{{\mathsf{null}^?}}_{\mathit{u{\kern-0.1em\scriptstyle 1}}}~{\mathit{ht}}_2)` +....................................................................................................................................................................... -1. If :math:`{{\mathit{u{\kern-0.1em\scriptstyle 1}}}^?}` is :math:`()`, then: +1. If :math:`{{\mathsf{null}^?}}_{\mathit{u{\kern-0.1em\scriptstyle 1}}}` is :math:`\mathsf{null}`, then: - a. Return :math:`(\mathsf{ref}~(\mathsf{null}~\epsilon~{}^?)~{\mathit{ht}}_1)`. + a. Return :math:`(\mathsf{ref}~\epsilon~{\mathit{ht}}_1)`. -#. Assert: Due to validation, :math:`{{\mathit{u{\kern-0.1em\scriptstyle 1}}}^?}` is not defined. +#. Assert: Due to validation, :math:`{{\mathsf{null}^?}}_{\mathit{u{\kern-0.1em\scriptstyle 1}}}` is not defined. #. Return :math:`(\mathsf{ref}~{\mathsf{null}}{{{}_{1}^?}}~{\mathit{ht}}_1)`. @@ -20908,7 +20905,7 @@ The instruction sequence :math:`(\mathsf{block}~{\mathit{blocktype}}~{{\mathit{i #. If :math:`{\mathit{instr}}_{\mathit{u{\kern-0.1em\scriptstyle 1}}}` is of the case :math:`\mathsf{select}`, then: - a. Let :math:`{({{\mathit{valtype}}^\ast})^?}~{}^?` be :math:`{\mathit{instr}}_{\mathit{u{\kern-0.1em\scriptstyle 1}}}`. + a. Let :math:`(\mathsf{select}~{({{\mathit{valtype}}^\ast})^?})` be :math:`{\mathit{instr}}_{\mathit{u{\kern-0.1em\scriptstyle 1}}}`. #. Return :math:`{\mathrm{free}}_{\mathit{opt}}({{\mathrm{free}}_{\mathit{list}}({{\mathrm{free}}_{\mathit{valtype}}({\mathit{valtype}})^\ast})^?})`. @@ -21755,11 +21752,11 @@ The instruction sequence :math:`(\mathsf{block}~{\mathit{blocktype}}~{{\mathit{i #. Let :math:`(\mathsf{ref}~{{\mathsf{null}^?}}_0~{\mathit{ht}})` be :math:`t_{\mathit{u{\kern-0.1em\scriptstyle 1}}}`. -#. If :math:`{{\mathsf{null}^?}}_0` is :math:`(\mathsf{null}~()~{}^?)`, then: +#. If :math:`{{\mathsf{null}^?}}_0` is :math:`\mathsf{null}`, then: a. Return :math:`(\mathsf{ref{.}null}~{\mathit{ht}})`. -#. Assert: Due to validation, :math:`{{\mathsf{null}^?}}_0` is :math:`(\mathsf{null}~\epsilon~{}^?)`. +#. Assert: Due to validation, :math:`{{\mathsf{null}^?}}_0` is not defined. #. Return :math:`\epsilon`. @@ -24573,7 +24570,7 @@ Heaptype_ok/rec - C.RECS[i] is st. Reftype_ok -- the reference type (REF (NULL ()? ?) heaptype) is valid if: +- the reference type (REF NULL? heaptype) is valid if: - the heap type heaptype is valid. Valtype_ok @@ -24641,7 +24638,7 @@ Storagetype_ok/pack - packtype is valid. Fieldtype_ok -- the field type ((MUT ()? ?), storagetype) is valid if: +- the field type (MUT?, storagetype) is valid if: - the storage type storagetype is valid. Functype_ok @@ -24840,21 +24837,21 @@ Heaptype_sub/bot - the heap type BOT matches heaptype. Reftype_sub -- the reference type (REF (NULL _u1? ?) ht_1) matches the reference type (REF (NULL _u2? ?) ht_2) if: +- the reference type (REF nul_u1 ht_1) matches the reference type (REF nul_u2 ht_2) if: - the heap type ht_1 matches the heap type ht_2. - Either: - - _u1? is ?(). - - _u2? is ?(). + - nul_u1 is ?(). + - nul_u2 is ?(). - Or: - - _u1? is ()?. - - _u2? is ?(()). + - nul_u1 is NULL?. + - nul_u2 is ?(NULL). Reftype_sub/nonnull -- the reference type (REF ht_1) matches the reference type (REF ht_2) if: +- the reference type (REF ?() ht_1) matches the reference type (REF ?() ht_2) if: - the heap type ht_1 matches the heap type ht_2. Reftype_sub/null -- the reference type (REF (NULL ()? ?) ht_1) matches the reference type (REF NULL ht_2) if: +- the reference type (REF NULL? ht_1) matches the reference type (REF ?(NULL) ht_2) if: - the heap type ht_1 matches the heap type ht_2. Vectype_sub @@ -24913,22 +24910,22 @@ Storagetype_sub/pack - packtype_1 matches packtype_2. Fieldtype_sub -- the field type ((MUT _u1? ?), zt_1) matches the field type ((MUT _u2? ?), zt_2) if: +- the field type (mut_u1, zt_1) matches the field type (mut_u2, zt_2) if: - the storage type zt_1 matches the storage type zt_2. - Either: - - _u1? is ?(). - - _u2? is ?(). + - mut_u1 is ?(). + - mut_u2 is ?(). - Or: - - _u1? is ?(()). - - _u2? is ?(()). + - mut_u1 is ?(MUT). + - mut_u2 is ?(MUT). - zt_2 matches zt_1. Fieldtype_sub/const -- the field type (, zt_1) matches the field type (, zt_2) if: +- the field type (?(), zt_1) matches the field type (?(), zt_2) if: - the storage type zt_1 matches the storage type zt_2. Fieldtype_sub/var -- the field type (MUT, zt_1) matches the field type (MUT, zt_2) if: +- the field type (?(MUT), zt_1) matches the field type (?(MUT), zt_2) if: - the storage type zt_1 matches the storage type zt_2. - zt_2 matches zt_1. @@ -24975,7 +24972,7 @@ Comptype_sub/func - the function type ft_1 matches the function type ft_2. Subtype_ok -- the sub type (SUB (FINAL ()? ?) (_IDX x)* comptype) is valid with (OK x_0) if: +- the sub type (SUB FINAL? (_IDX x)* comptype) is valid with (OK x_0) if: - |x*| is less than or equal to 1. - For all x in x*: - the index x is less than x_0. @@ -24984,20 +24981,20 @@ Subtype_ok - For all x in x*: - the defined type C.TYPES[x] exists. - For all comptype' in comptype'* and x in x* and x'* in x'**: - - the sub type $unrolldt(C.TYPES[x]) is (SUB (_IDX x')* comptype'). + - the sub type $unrolldt(C.TYPES[x]) is (SUB ?() (_IDX x')* comptype'). - the composite type comptype is valid. - For all comptype' in comptype'*: - comptype matches the composite type comptype'. Subtype_ok2 -- the sub type (SUB (FINAL ()? ?) typeuse* compttype) is valid with (OK x i) if: +- the sub type (SUB FINAL? typeuse* compttype) is valid with (OK x i) if: - |typeuse*| is less than or equal to 1. - For all typeuse in typeuse*: - $before(typeuse, x, i) is true. - |typeuse*| is |comptype'*|. - |typeuse'**| is |comptype'*|. - For all comptype' in comptype'* and typeuse in typeuse* and typeuse'* in typeuse'**: - - the sub type $unrollht(C, typeuse) is (SUB typeuse'* comptype'). + - the sub type $unrollht(C, typeuse) is (SUB ?() typeuse'* comptype'). - the composite type comptype is valid. - For all comptype' in comptype'*: - comptype matches the composite type comptype'. @@ -25057,7 +25054,7 @@ Limits_ok - m is less than or equal to k. Globaltype_ok -- the global type ((MUT ()? ?), t) is valid if: +- the global type (MUT?, t) is valid if: - the value type t is valid. Tabletype_ok @@ -25131,22 +25128,22 @@ Limits_sub - m_1 is less than or equal to m_2. Globaltype_sub -- the global type ((MUT _u1? ?), valtype_1) matches the global type ((MUT _u2? ?), valtype_2) if: +- the global type (mut_u1, valtype_1) matches the global type (mut_u2, valtype_2) if: - the value type valtype_1 matches the value type valtype_2. - Either: - - _u1? is ?(). - - _u2? is ?(). + - mut_u1 is ?(). + - mut_u2 is ?(). - Or: - - _u1? is ?(()). - - _u2? is ?(()). + - mut_u1 is ?(MUT). + - mut_u2 is ?(MUT). - valtype_2 matches valtype_1. Globaltype_sub/const -- the global type (, valtype_1) matches the global type (, valtype_2) if: +- the global type (?(), valtype_1) matches the global type (?(), valtype_2) if: - the value type valtype_1 matches the value type valtype_2. Globaltype_sub/var -- the global type (MUT, valtype_1) matches the global type (MUT, valtype_2) if: +- the global type (?(MUT), valtype_1) matches the global type (?(MUT), valtype_2) if: - the value type valtype_1 matches the value type valtype_2. - valtype_2 matches valtype_1. @@ -25245,13 +25242,13 @@ Catch_ok - catch_u1 is (CATCH_REF x l). - C.TAGS[x] exists. - The :ref:`expansion ` of C.TAGS[x] is (FUNC t* -> []). - - the value type sequence t* :: [(REF EXN)] matches C.LABELS[l]. + - the value type sequence t* :: [(REF ?() EXN)] matches C.LABELS[l]. - Or: - catch_u1 is (CATCH_ALL l). - the value type sequence [] matches C.LABELS[l]. - Or: - catch_u1 is (CATCH_ALL_REF l). - - the value type sequence [(REF EXN)] matches C.LABELS[l]. + - the value type sequence [(REF ?() EXN)] matches C.LABELS[l]. Catch_ok/catch - the catch clause (CATCH x l) is valid if: @@ -25265,7 +25262,7 @@ Catch_ok/catch_ref - the tag type C.TAGS[x] exists. - The :ref:`expansion ` of C.TAGS[x] is the composite type (FUNC t* -> []). - the result type C.LABELS[l] exists. - - the value type sequence t* :: [(REF EXN)] matches C.LABELS[l]. + - the value type sequence t* :: [(REF ?() EXN)] matches C.LABELS[l]. Catch_ok/catch_all - the catch clause (CATCH_ALL l) is valid if: @@ -25275,7 +25272,7 @@ Catch_ok/catch_all Catch_ok/catch_all_ref - the catch clause (CATCH_ALL_REF l) is valid if: - the result type C.LABELS[l] exists. - - the value type sequence [(REF EXN)] matches C.LABELS[l]. + - the value type sequence [(REF ?() EXN)] matches C.LABELS[l]. Defaultable - the value type t is defaultable if: @@ -25293,7 +25290,7 @@ Instr_ok/drop - the value type t is valid. Instr_ok/select -- the instruction (SELECT() t_u1? ?) is valid with the instruction type [t, t, I32] -> [t] if: +- the instruction (SELECT t_u1?) is valid with the instruction type [t, t, I32] -> [t] if: - the value type t is valid. - Either: - the value type sequence t_u1? is ?([t]). @@ -25343,15 +25340,15 @@ Instr_ok/br_table - the instruction type t_1* -> t_2* is valid. Instr_ok/br_on_null -- the instruction (BR_ON_NULL l) is valid with the instruction type t* :: [(REF NULL ht)] -> t* :: [(REF ht)] if: +- the instruction (BR_ON_NULL l) is valid with the instruction type t* :: [(REF ?(NULL) ht)] -> t* :: [(REF ?() ht)] if: - the result type C.LABELS[l] exists. - C.LABELS[l] is t*. - the heap type ht is valid. Instr_ok/br_on_non_null -- the instruction (BR_ON_NON_NULL l) is valid with the instruction type t* :: [(REF NULL ht)] -> t* if: +- the instruction (BR_ON_NON_NULL l) is valid with the instruction type t* :: [(REF ?(NULL) ht)] -> t* if: - the result type C.LABELS[l] exists. - - C.LABELS[l] is t* :: [(REF ht)]. + - C.LABELS[l] is t* :: [(REF ?() ht)]. Instr_ok/br_on_cast - the instruction (BR_ON_CAST l rt_1 rt_2) is valid with the instruction type t* :: [rt_1] -> t* :: [t'] if: @@ -25378,7 +25375,7 @@ Instr_ok/call - The :ref:`expansion ` of C.FUNCS[x] is the composite type (FUNC t_1* -> t_2*). Instr_ok/call_ref -- the instruction (CALL_REF (_IDX x)) is valid with the instruction type t_1* :: [(REF NULL (_IDX x))] -> t_2* if: +- the instruction (CALL_REF (_IDX x)) is valid with the instruction type t_1* :: [(REF ?(NULL) (_IDX x))] -> t_2* if: - the defined type C.TYPES[x] exists. - The :ref:`expansion ` of C.TYPES[x] is the composite type (FUNC t_1* -> t_2*). @@ -25386,7 +25383,7 @@ Instr_ok/call_indirect - the instruction (CALL_INDIRECT x (_IDX y)) is valid with the instruction type t_1* :: [at] -> t_2* if: - the table type C.TABLES[x] exists. - C.TABLES[x] is (at, lim, rt). - - the reference type rt matches the reference type (REF NULL FUNC). + - the reference type rt matches the reference type (REF ?(NULL) FUNC). - the defined type C.TYPES[y] exists. - The :ref:`expansion ` of C.TYPES[y] is the composite type (FUNC t_1* -> t_2*). @@ -25404,7 +25401,7 @@ Instr_ok/return_call - the instruction type t_3* -> t_4* is valid. Instr_ok/return_call_ref -- the instruction (RETURN_CALL_REF (_IDX x)) is valid with the instruction type t_3* :: t_1* :: [(REF NULL (_IDX x))] -> t_4* if: +- the instruction (RETURN_CALL_REF (_IDX x)) is valid with the instruction type t_3* :: t_1* :: [(REF ?(NULL) (_IDX x))] -> t_4* if: - the defined type C.TYPES[x] exists. - The :ref:`expansion ` of C.TYPES[x] is the composite type (FUNC t_1* -> t_2*). - the result type C.RETURN is ?(t'_2*). @@ -25415,7 +25412,7 @@ Instr_ok/return_call_indirect - the instruction (RETURN_CALL_INDIRECT x (_IDX y)) is valid with the instruction type t_3* :: t_1* :: [at] -> t_4* if: - the table type C.TABLES[x] exists. - C.TABLES[x] is (at, lim, rt). - - the reference type rt matches the reference type (REF NULL FUNC). + - the reference type rt matches the reference type (REF ?(NULL) FUNC). - the defined type C.TYPES[y] exists. - The :ref:`expansion ` of C.TYPES[y] is the composite type (FUNC t_1* -> t_2*). - the result type C.RETURN is ?(t'_2*). @@ -25429,7 +25426,7 @@ Instr_ok/throw - the instruction type t_1* -> t_2* is valid. Instr_ok/throw_ref -- the instruction THROW_REF is valid with the instruction type t_1* :: [(REF NULL EXN)] -> t_2* if: +- the instruction THROW_REF is valid with the instruction type t_1* :: [(REF ?(NULL) EXN)] -> t_2* if: - the instruction type t_1* -> t_2* is valid. Instr_ok/try_table @@ -25459,29 +25456,29 @@ Instr_ok/cvtop - the instruction (CVTOP nt_1 nt_2 cvtop) is valid with the instruction type [nt_2] -> [nt_1]. Instr_ok/ref.null -- the instruction (REF.NULL ht) is valid with the instruction type [] -> [(REF NULL ht)] if: +- the instruction (REF.NULL ht) is valid with the instruction type [] -> [(REF ?(NULL) ht)] if: - the heap type ht is valid. Instr_ok/ref.func -- the instruction (REF.FUNC x) is valid with the instruction type [] -> [(REF dt)] if: +- the instruction (REF.FUNC x) is valid with the instruction type [] -> [(REF ?() dt)] if: - the defined type C.FUNCS[x] exists. - C.FUNCS[x] is dt. - the index C.REFS[0] exists. - x is contained in C.REFS. Instr_ok/ref.i31 -- the instruction REF.I31 is valid with the instruction type [I32] -> [(REF I31)]. +- the instruction REF.I31 is valid with the instruction type [I32] -> [(REF ?() I31)]. Instr_ok/ref.is_null -- the instruction REF.IS_NULL is valid with the instruction type [(REF NULL ht)] -> [I32] if: +- the instruction REF.IS_NULL is valid with the instruction type [(REF ?(NULL) ht)] -> [I32] if: - the heap type ht is valid. Instr_ok/ref.as_non_null -- the instruction REF.AS_NON_NULL is valid with the instruction type [(REF NULL ht)] -> [(REF ht)] if: +- the instruction REF.AS_NON_NULL is valid with the instruction type [(REF ?(NULL) ht)] -> [(REF ?() ht)] if: - the heap type ht is valid. Instr_ok/ref.eq -- the instruction REF.EQ is valid with the instruction type [(REF NULL EQ), (REF NULL EQ)] -> [I32]. +- the instruction REF.EQ is valid with the instruction type [(REF ?(NULL) EQ), (REF ?(NULL) EQ)] -> [I32]. Instr_ok/ref.test - the instruction (REF.TEST rt) is valid with the instruction type [rt'] -> [I32] if: @@ -25496,23 +25493,23 @@ Instr_ok/ref.cast - rt matches rt'. Instr_ok/i31.get -- the instruction (I31.GET sx) is valid with the instruction type [(REF NULL I31)] -> [I32]. +- the instruction (I31.GET sx) is valid with the instruction type [(REF ?(NULL) I31)] -> [I32]. Instr_ok/struct.new -- the instruction (STRUCT.NEW x) is valid with the instruction type t* -> [(REF (_IDX x))] if: +- the instruction (STRUCT.NEW x) is valid with the instruction type t* -> [(REF ?() (_IDX x))] if: - the defined type C.TYPES[x] exists. - The :ref:`expansion ` of C.TYPES[x] is the composite type (STRUCT (mut, zt)*). - Let t* be the value type sequence $unpack(zt)*. Instr_ok/struct.new_default -- the instruction (STRUCT.NEW_DEFAULT x) is valid with the instruction type [] -> [(REF (_IDX x))] if: +- the instruction (STRUCT.NEW_DEFAULT x) is valid with the instruction type [] -> [(REF ?() (_IDX x))] if: - the defined type C.TYPES[x] exists. - The :ref:`expansion ` of C.TYPES[x] is the composite type (STRUCT (mut, zt)*). - For all zt in zt*: - A :ref:`default value ` for value type the value type $unpack(zt) is defined. Instr_ok/struct.get -- the instruction (STRUCT.GET sx? x i) is valid with the instruction type [(REF NULL (_IDX x))] -> [t] if: +- the instruction (STRUCT.GET sx? x i) is valid with the instruction type [(REF ?(NULL) (_IDX x))] -> [t] if: - the defined type C.TYPES[x] exists. - The :ref:`expansion ` of C.TYPES[x] is the composite type (STRUCT yt*). - |yt*| is greater than i. @@ -25521,40 +25518,40 @@ Instr_ok/struct.get - Let t be the value type $unpack(zt). Instr_ok/struct.set -- the instruction (STRUCT.SET x i) is valid with the instruction type [(REF NULL (_IDX x)), t] -> [] if: +- the instruction (STRUCT.SET x i) is valid with the instruction type [(REF ?(NULL) (_IDX x)), t] -> [] if: - the defined type C.TYPES[x] exists. - The :ref:`expansion ` of C.TYPES[x] is the composite type (STRUCT yt*). - |yt*| is greater than i. - - the field type yt*[i] is (MUT, zt). + - the field type yt*[i] is (?(MUT), zt). - Let t be the value type $unpack(zt). Instr_ok/array.new -- the instruction (ARRAY.NEW x) is valid with the instruction type [t, I32] -> [(REF (_IDX x))] if: +- the instruction (ARRAY.NEW x) is valid with the instruction type [t, I32] -> [(REF ?() (_IDX x))] if: - the defined type C.TYPES[x] exists. - The :ref:`expansion ` of C.TYPES[x] is the composite type (ARRAY (mut, zt)). - Let t be the value type $unpack(zt). Instr_ok/array.new_default -- the instruction (ARRAY.NEW_DEFAULT x) is valid with the instruction type [I32] -> [(REF (_IDX x))] if: +- the instruction (ARRAY.NEW_DEFAULT x) is valid with the instruction type [I32] -> [(REF ?() (_IDX x))] if: - the defined type C.TYPES[x] exists. - The :ref:`expansion ` of C.TYPES[x] is the composite type (ARRAY (mut, zt)). - A :ref:`default value ` for value type the value type $unpack(zt) is defined. Instr_ok/array.new_fixed -- the instruction (ARRAY.NEW_FIXED x n) is valid with the instruction type t^n -> [(REF (_IDX x))] if: +- the instruction (ARRAY.NEW_FIXED x n) is valid with the instruction type t^n -> [(REF ?() (_IDX x))] if: - the defined type C.TYPES[x] exists. - The :ref:`expansion ` of C.TYPES[x] is the composite type (ARRAY (mut, zt)). - Let t be the value type $unpack(zt). Instr_ok/array.new_elem -- the instruction (ARRAY.NEW_ELEM x y) is valid with the instruction type [I32, I32] -> [(REF (_IDX x))] if: +- the instruction (ARRAY.NEW_ELEM x y) is valid with the instruction type [I32, I32] -> [(REF ?() (_IDX x))] if: - the defined type C.TYPES[x] exists. - The :ref:`expansion ` of C.TYPES[x] is the composite type (ARRAY (mut, rt)). - the element type C.ELEMS[y] exists. - C.ELEMS[y] matches the reference type rt. Instr_ok/array.new_data -- the instruction (ARRAY.NEW_DATA x y) is valid with the instruction type [I32, I32] -> [(REF (_IDX x))] if: +- the instruction (ARRAY.NEW_DATA x y) is valid with the instruction type [I32, I32] -> [(REF ?() (_IDX x))] if: - the defined type C.TYPES[x] exists. - The :ref:`expansion ` of C.TYPES[x] is the composite type (ARRAY (mut, zt)). - $unpack(zt) is numtype or the value type $unpack(zt) is vectype. @@ -25562,46 +25559,46 @@ Instr_ok/array.new_data - C.DATAS[y] is OK. Instr_ok/array.get -- the instruction (ARRAY.GET sx? x) is valid with the instruction type [(REF NULL (_IDX x)), I32] -> [t] if: +- the instruction (ARRAY.GET sx? x) is valid with the instruction type [(REF ?(NULL) (_IDX x)), I32] -> [t] if: - the defined type C.TYPES[x] exists. - The :ref:`expansion ` of C.TYPES[x] is the composite type (ARRAY (mut, zt)). - the signedness sx? is ?() if and only if the storage type zt is $unpack(zt). - Let t be the value type $unpack(zt). Instr_ok/array.set -- the instruction (ARRAY.SET x) is valid with the instruction type [(REF NULL (_IDX x)), I32, t] -> [] if: +- the instruction (ARRAY.SET x) is valid with the instruction type [(REF ?(NULL) (_IDX x)), I32, t] -> [] if: - the defined type C.TYPES[x] exists. - - The :ref:`expansion ` of C.TYPES[x] is the composite type (ARRAY (MUT, zt)). + - The :ref:`expansion ` of C.TYPES[x] is the composite type (ARRAY (?(MUT), zt)). - Let t be the value type $unpack(zt). Instr_ok/array.len -- the instruction ARRAY.LEN is valid with the instruction type [(REF NULL ARRAY)] -> [I32]. +- the instruction ARRAY.LEN is valid with the instruction type [(REF ?(NULL) ARRAY)] -> [I32]. Instr_ok/array.fill -- the instruction (ARRAY.FILL x) is valid with the instruction type [(REF NULL (_IDX x)), I32, t, I32] -> [] if: +- the instruction (ARRAY.FILL x) is valid with the instruction type [(REF ?(NULL) (_IDX x)), I32, t, I32] -> [] if: - the defined type C.TYPES[x] exists. - - The :ref:`expansion ` of C.TYPES[x] is the composite type (ARRAY (MUT, zt)). + - The :ref:`expansion ` of C.TYPES[x] is the composite type (ARRAY (?(MUT), zt)). - Let t be the value type $unpack(zt). Instr_ok/array.copy -- the instruction (ARRAY.COPY x_1 x_2) is valid with the instruction type [(REF NULL (_IDX x_1)), I32, (REF NULL (_IDX x_2)), I32, I32] -> [] if: +- the instruction (ARRAY.COPY x_1 x_2) is valid with the instruction type [(REF ?(NULL) (_IDX x_1)), I32, (REF ?(NULL) (_IDX x_2)), I32, I32] -> [] if: - the defined type C.TYPES[x_1] exists. - - The :ref:`expansion ` of C.TYPES[x_1] is the composite type (ARRAY (MUT, zt_1)). + - The :ref:`expansion ` of C.TYPES[x_1] is the composite type (ARRAY (?(MUT), zt_1)). - the defined type C.TYPES[x_2] exists. - The :ref:`expansion ` of C.TYPES[x_2] is the composite type (ARRAY (mut, zt_2)). - the storage type zt_2 matches the storage type zt_1. Instr_ok/array.init_elem -- the instruction (ARRAY.INIT_ELEM x y) is valid with the instruction type [(REF NULL (_IDX x)), I32, I32, I32] -> [] if: +- the instruction (ARRAY.INIT_ELEM x y) is valid with the instruction type [(REF ?(NULL) (_IDX x)), I32, I32, I32] -> [] if: - the defined type C.TYPES[x] exists. - - The :ref:`expansion ` of C.TYPES[x] is the composite type (ARRAY (MUT, zt)). + - The :ref:`expansion ` of C.TYPES[x] is the composite type (ARRAY (?(MUT), zt)). - the element type C.ELEMS[y] exists. - C.ELEMS[y] matches the storage type zt. Instr_ok/array.init_data -- the instruction (ARRAY.INIT_DATA x y) is valid with the instruction type [(REF NULL (_IDX x)), I32, I32, I32] -> [] if: +- the instruction (ARRAY.INIT_DATA x y) is valid with the instruction type [(REF ?(NULL) (_IDX x)), I32, I32, I32] -> [] if: - the defined type C.TYPES[x] exists. - - The :ref:`expansion ` of C.TYPES[x] is the composite type (ARRAY (MUT, zt)). + - The :ref:`expansion ` of C.TYPES[x] is the composite type (ARRAY (?(MUT), zt)). - $unpack(zt) is numtype or the value type $unpack(zt) is vectype. - the data type C.DATAS[y] exists. - C.DATAS[y] is OK. @@ -25710,7 +25707,7 @@ Instr_ok/global.get Instr_ok/global.set - the instruction (GLOBAL.SET x) is valid with the instruction type [t] -> [] if: - the global type C.GLOBALS[x] exists. - - C.GLOBALS[x] is (MUT, t). + - C.GLOBALS[x] is (?(MUT), t). Instr_ok/table.get - the instruction (TABLE.GET x) is valid with the instruction type [at] -> [rt] if: @@ -25862,11 +25859,11 @@ Instr_ok/vstore_lane - i is less than (128 / N). Instr_ok/select-expl -- the instruction (SELECT() ?([t]) ?) is valid with the instruction type [t, t, I32] -> [t] if: +- the instruction (SELECT ?([t])) is valid with the instruction type [t, t, I32] -> [t] if: - the value type t is valid. Instr_ok/select-impl -- the instruction (SELECT() ?() ?) is valid with the instruction type [t, t, I32] -> [t] if: +- the instruction (SELECT ?()) is valid with the instruction type [t, t, I32] -> [t] if: - the value type t is valid. - t matches the value type t'. - t' is numtype or t' is vectype. @@ -26005,7 +26002,7 @@ Instr_const - Or: - instr_u1 is (GLOBAL.GET x). - the global type C.GLOBALS[x] exists. - - C.GLOBALS[x] is (, t). + - C.GLOBALS[x] is (?(), t). - Or: - instr_u1 is (BINOP Inn binop). - Inn is contained in [I32, I64]. @@ -26050,7 +26047,7 @@ Instr_const/extern.convert_any Instr_const/global.get - the instruction (GLOBAL.GET x) is constant if: - the global type C.GLOBALS[x] exists. - - C.GLOBALS[x] is (, t). + - C.GLOBALS[x] is (?(), t). Instr_const/binop - the instruction (BINOP Inn binop) is constant if: @@ -26457,12 +26454,12 @@ Step_pure/br_on_non_null l Step_pure/call_indirect x yy 1. Execute the instruction (TABLE.GET x). -2. Execute the instruction (REF.CAST (REF (NULL ?(()) ?) yy)). +2. Execute the instruction (REF.CAST (REF ?(NULL) yy)). 3. Execute the instruction (CALL_REF yy). Step_pure/return_call_indirect x yy 1. Execute the instruction (TABLE.GET x). -2. Execute the instruction (REF.CAST (REF (NULL ?(()) ?) yy)). +2. Execute the instruction (REF.CAST (REF ?(NULL) yy)). 3. Execute the instruction (RETURN_CALL_REF yy). Step_pure/frame @@ -27844,34 +27841,34 @@ cont b 3. Return (b - 128). ANYREF -1. Return (REF (NULL ?(()) ?) ANY). +1. Return (REF ?(NULL) ANY). EQREF -1. Return (REF (NULL ?(()) ?) EQ). +1. Return (REF ?(NULL) EQ). I31REF -1. Return (REF (NULL ?(()) ?) I31). +1. Return (REF ?(NULL) I31). STRUCTREF -1. Return (REF (NULL ?(()) ?) STRUCT). +1. Return (REF ?(NULL) STRUCT). ARRAYREF -1. Return (REF (NULL ?(()) ?) ARRAY). +1. Return (REF ?(NULL) ARRAY). FUNCREF -1. Return (REF (NULL ?(()) ?) FUNC). +1. Return (REF ?(NULL) FUNC). EXTERNREF -1. Return (REF (NULL ?(()) ?) EXTERN). +1. Return (REF ?(NULL) EXTERN). NULLREF -1. Return (REF (NULL ?(()) ?) NONE). +1. Return (REF ?(NULL) NONE). NULLFUNCREF -1. Return (REF (NULL ?(()) ?) NOFUNC). +1. Return (REF ?(NULL) NOFUNC). NULLEXTERNREF -1. Return (REF (NULL ?(()) ?) NOEXTERN). +1. Return (REF ?(NULL) NOEXTERN). size nt_u1 1. If (nt_u1 = I32), then: @@ -28055,10 +28052,10 @@ minat at_1 at_2 a. Return at_1. 2. Return at_2. -diffrt (REF nul1 ht_1) (REF (NULL _u1? ?) ht_2) -1. If (_u1? = ?(())), then: - a. Return (REF (NULL ?() ?) ht_1). -2. Assert: Due to validation, _u1? is not defined. +diffrt (REF nul1 ht_1) (REF nul_u1 ht_2) +1. If (nul_u1 = ?(NULL)), then: + a. Return (REF ?() ht_1). +2. Assert: Due to validation, nul_u1 is not defined. 3. Return (REF nul1 ht_1). funcsxt xt_u1* @@ -28529,7 +28526,7 @@ free_instr instr_u1 3. If (instr_u1 = DROP), then: a. Return { TYPES: []; FUNCS: []; GLOBALS: []; TABLES: []; MEMS: []; ELEMS: []; DATAS: []; LOCALS: []; LABELS: []; }. 4. If instr_u1 is of the case SELECT, then: - a. Let (SELECT() valtype*? ?) be instr_u1. + a. Let (SELECT valtype*?) be instr_u1. b. Return $free_opt($free_list($free_valtype(valtype)*)?). 5. If instr_u1 is of the case BLOCK, then: a. Let (BLOCK blocktype instr*) be instr_u1. @@ -28939,9 +28936,9 @@ default_ t_u1 b. Return ?((Vnn.CONST 0)). 4. Assert: Due to validation, t_u1 is of the case REF. 5. Let (REF nul_0 ht) be t_u1. -6. If (nul_0 = (NULL ?(()) ?)), then: +6. If (nul_0 = ?(NULL)), then: a. Return ?((REF.NULL ht)). -7. Assert: Due to validation, (nul_0 = (NULL ?() ?)). +7. Assert: Due to validation, nul_0 is not defined. 8. Return ?(). funcidx_nonfuncs (global*, table*, mem*, elem*, data*) From e0ab63552afe719fda7d630724ef21757fa3eb16 Mon Sep 17 00:00:00 2001 From: Andreas Rossberg Date: Wed, 11 Dec 2024 15:13:02 +0100 Subject: [PATCH 09/10] Remove TODO --- spectec/src/frontend/elab.ml | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/spectec/src/frontend/elab.ml b/spectec/src/frontend/elab.ml index a1e506a781..a0c848b748 100644 --- a/spectec/src/frontend/elab.ml +++ b/spectec/src/frontend/elab.ml @@ -540,14 +540,6 @@ and as_variant_typ phrase env dir t at : (typcase list * dots) attempt = | VarT (id, args) -> as_variant_typid' phrase env id args at | _ -> fail_dir_typ env at phrase dir t "| ..." -let case_has_args env t op : bool = - let cases, _ = checkpoint (as_variant_typ "" env Check t op.at) in - let t, _prems = find_case_sub cases op op.at t in - match t.it with - | SeqT ({it = AtomT _; _}::_) -> true - | _ -> false - | exception Error _ -> false - let is_x_typ as_x_typ env t = match as_x_typ "" env Check t no_region with @@ -1266,7 +1258,7 @@ and elab_exp_plain' env e t : Il.exp' attempt = let* es' = elab_exp_list env es ts e.at in Ok (Il.TupE es') | ListE es -> - let* t1, iter = as_iter_typ "tuple" env Check t e.at in + let* t1, iter = as_iter_typ "list" env Check t e.at in if iter <> List then fail_typ env e.at "list" t else let ts = List.init (List.length es) (fun _ -> t1) in let* es' = elab_exp_list env es ts e.at in @@ -1349,15 +1341,6 @@ and elab_exp_iter' env es (t1, iter) t at : Il.exp' attempt = (function Ok e' -> fmt "%s" (il_exp (e' $$ at % elab_typ env t)) | _ -> "fail") ) @@ fun _ -> match es, iter with - (* If the sequence actually starts with a non-nullary constructor, - * then assume this is a singleton iteration and fallback to variant *) - (* TODO: use backtracking *) - | {it = AtomE atom; _}::_, _ - when is_variant_typ env t1 && case_has_args env t1 atom -> - let* cases, _dots = as_variant_typ "" env Check t1 at in - let* e' = elab_exp_variant env (expand_id env t1) (SeqE es $ at) cases t1 at in - Ok (lift_exp' e' iter) - | [], Opt -> Ok (Il.OptE None) | [e1], Opt -> From 4ae3ac309e6c19fd24ea80da0126245eaa0a0fe1 Mon Sep 17 00:00:00 2001 From: Andreas Rossberg Date: Mon, 23 Dec 2024 12:45:14 +0100 Subject: [PATCH 10/10] Enable cast from opt to list --- spectec/spec/wasm-3.0/0-aux.watsup | 5 - spectec/spec/wasm-3.0/4-numerics.watsup | 12 +- spectec/spec/wasm-3.0/5-runtime.watsup | 1 + spectec/spec/wasm-3.0/6-runtime-aux.watsup | 1 - spectec/spec/wasm-3.0/8-reduction.watsup | 1 - spectec/src/frontend/elab.ml | 61 +++- spectec/src/util/debug_log.ml | 2 +- spectec/test-frontend/TEST.md | 123 ++++--- spectec/test-latex/TEST.md | 7 - spectec/test-middlend/TEST.md | 369 ++++++++++----------- spectec/test-prose/TEST.md | 31 +- spectec/test-splice/TEST.md | 2 - 12 files changed, 291 insertions(+), 324 deletions(-) diff --git a/spectec/spec/wasm-3.0/0-aux.watsup b/spectec/spec/wasm-3.0/0-aux.watsup index cdd471e4fa..55d64a516b 100644 --- a/spectec/spec/wasm-3.0/0-aux.watsup +++ b/spectec/spec/wasm-3.0/0-aux.watsup @@ -32,11 +32,6 @@ def $opt_(syntax X, X*) : X? hint(show %2) def $opt_(syntax X, eps) = eps def $opt_(syntax X, w) = w -;; TODO(3, rossberg): this function should not be needed -def $list_(syntax X, X?) : X* hint(show %2) -def $list_(syntax X, eps) = eps -def $list_(syntax X, w) = w - def $concat_(syntax X, (X*)*) : X* hint(show (++) %2) def $concat_(syntax X, eps) = eps def $concat_(syntax X, (w*) (w'*)*) = w* ++ $concat_(X, (w'*)*) diff --git a/spectec/spec/wasm-3.0/4-numerics.watsup b/spectec/spec/wasm-3.0/4-numerics.watsup index 4ae1dc1ca0..d0d1c7dbbf 100644 --- a/spectec/spec/wasm-3.0/4-numerics.watsup +++ b/spectec/spec/wasm-3.0/4-numerics.watsup @@ -324,8 +324,8 @@ def $unop_(Fnn, NEAREST, f) = $fnearest_($sizenn(Fnn), f) def $binop_(Inn, ADD, i_1, i_2) = $iadd_($sizenn(Inn), i_1, i_2) def $binop_(Inn, SUB, i_1, i_2) = $isub_($sizenn(Inn), i_1, i_2) def $binop_(Inn, MUL, i_1, i_2) = $imul_($sizenn(Inn), i_1, i_2) -def $binop_(Inn, DIV sx, i_1, i_2) = $list_(num_(Inn), $idiv_($sizenn(Inn), sx, i_1, i_2)) -def $binop_(Inn, REM sx, i_1, i_2) = $list_(num_(Inn), $irem_($sizenn(Inn), sx, i_1, i_2)) +def $binop_(Inn, DIV sx, i_1, i_2) = $idiv_($sizenn(Inn), sx, i_1, i_2) +def $binop_(Inn, REM sx, i_1, i_2) = $irem_($sizenn(Inn), sx, i_1, i_2) def $binop_(Inn, AND, i_1, i_2) = $iand_($sizenn(Inn), i_1, i_2) def $binop_(Inn, OR, i_1, i_2) = $ior_($sizenn(Inn), i_1, i_2) def $binop_(Inn, XOR, i_1, i_2) = $ixor_($sizenn(Inn), i_1, i_2) @@ -363,9 +363,9 @@ def $cvtop__(Inn_1, Inn_2, EXTEND sx, i_1) = def $cvtop__(Inn_1, Inn_2, WRAP, i_1) = $wrap__($sizenn1(Inn_1), $sizenn2(Inn_2), i_1) def $cvtop__(Fnn_1, Inn_2, TRUNC sx, f_1) = - $list_(num_(Inn_2), $trunc__($sizenn1(Fnn_1), $sizenn2(Inn_2), sx, f_1)) + $trunc__($sizenn1(Fnn_1), $sizenn2(Inn_2), sx, f_1) def $cvtop__(Fnn_1, Inn_2, TRUNC_SAT sx, f_1) = - $list_(num_(Inn_2), $trunc_sat__($sizenn1(Fnn_1), $sizenn2(Inn_2), sx, f_1)) + $trunc_sat__($sizenn1(Fnn_1), $sizenn2(Inn_2), sx, f_1) def $cvtop__(Inn_1, Fnn_2, CONVERT sx, i_1) = $convert__($sizenn1(Inn_1), $sizenn2(Fnn_2), sx, i_1) def $cvtop__(Fnn_1, Fnn_2, PROMOTE, f_1) = @@ -655,9 +655,9 @@ def $lcvtop__(Jnn_1 X M_1, Jnn_2 X M_2, EXTEND sx, c_1) = c -- if c = $extend__($lsizenn1(Jnn_1), $lsizenn2(Jnn_2), sx, c_1) def $lcvtop__(Jnn_1 X M_1, Fnn_2 X M_2, CONVERT sx, c_1) = c -- if c = $convert__($lsizenn1(Jnn_1), $lsizenn2(Fnn_2), sx, c_1) -def $lcvtop__(Fnn_1 X M_1, Inn_2 X M_2, TRUNC_SAT sx, c_1) = $list_(lane_(Inn_2), c?) +def $lcvtop__(Fnn_1 X M_1, Inn_2 X M_2, TRUNC_SAT sx, c_1) = c? -- if c? = $trunc_sat__($lsizenn1(Fnn_1), $lsizenn2(Inn_2), sx, c_1) -def $lcvtop__(Fnn_1 X M_1, Inn_2 X M_2, RELAXED_TRUNC sx, c_1) = $list_(lane_(Inn_2), c?) +def $lcvtop__(Fnn_1 X M_1, Inn_2 X M_2, RELAXED_TRUNC sx, c_1) = c? -- if c? = $relaxed_trunc__($lsizenn1(Fnn_1), $lsizenn2(Inn_2), sx, c_1) def $lcvtop__(Fnn_1 X M_1, Fnn_2 X M_2, DEMOTE, c_1) = c* -- if c* = $demote__($lsizenn1(Fnn_1), $lsizenn2(Fnn_2), c_1) diff --git a/spectec/spec/wasm-3.0/5-runtime.watsup b/spectec/spec/wasm-3.0/5-runtime.watsup index 145798a44d..a3ce6f9076 100644 --- a/spectec/spec/wasm-3.0/5-runtime.watsup +++ b/spectec/spec/wasm-3.0/5-runtime.watsup @@ -122,6 +122,7 @@ var hi : taginst var ei : eleminst var di : datainst var xi : exportinst +var exn : exninst var si : structinst var ai : arrayinst diff --git a/spectec/spec/wasm-3.0/6-runtime-aux.watsup b/spectec/spec/wasm-3.0/6-runtime-aux.watsup index 48a6102733..e7874216f3 100644 --- a/spectec/spec/wasm-3.0/6-runtime-aux.watsup +++ b/spectec/spec/wasm-3.0/6-runtime-aux.watsup @@ -180,7 +180,6 @@ def $add_exninst(state, exninst*) : state hint(show %[.EXNS =++ %]) hi def $add_structinst((s; f), si*) = s[.STRUCTS =++ si*]; f def $add_arrayinst((s; f), ai*) = s[.ARRAYS =++ ai*]; f -;; TODO: variable name for exninst? (ei and xi are both taken) def $add_exninst((s; f), exn*) = s[.EXNS =++ exn*]; f diff --git a/spectec/spec/wasm-3.0/8-reduction.watsup b/spectec/spec/wasm-3.0/8-reduction.watsup index 119fb00821..dfc06ae7b7 100644 --- a/spectec/spec/wasm-3.0/8-reduction.watsup +++ b/spectec/spec/wasm-3.0/8-reduction.watsup @@ -225,7 +225,6 @@ rule Step_pure/return-handler: ;; Exceptions rule Step/throw: - ;; TODO(2, rossberg): Appropriate variable name for exception instance `exn` z; val^n (THROW x) ~> $add_exninst(z, exn); (REF.EXN_ADDR a) THROW_REF -- Expand: $tag(z, x).TYPE ~~ FUNC (t^n -> eps) -- if a = |$exninst(z)| diff --git a/spectec/src/frontend/elab.ml b/spectec/src/frontend/elab.ml index a0c848b748..7dab638ee2 100644 --- a/spectec/src/frontend/elab.ml +++ b/spectec/src/frontend/elab.ml @@ -267,7 +267,7 @@ and msg_traces n msg = function let rec error_trace = function | Trace (_, _, [trace]) -> error_trace trace - | Trace (at, msg, traces) -> error at (msg_traces 0 msg traces) + | Trace (at, msg, traces) -> error at (msg_traces 0 msg (Lib.List.nub (=) traces)) let checkpoint = function | Ok x -> x @@ -1537,30 +1537,32 @@ and elab_path' env p t : (Il.path' * typ) attempt = and cast_empty phrase env t at t' : Il.exp attempt = - Debug.(log_at "el.cast_empty" at + Debug.(log_at "el.elab_exp_cast_empty" at (fun _ -> fmt "%s >> (%s)" (el_typ t) (el_typ (expand env t $ t.at))) (function Ok r -> fmt "%s" (il_exp r) | _ -> "fail") ) @@ fun _ -> - match expand env t with - | IterT (_, Opt) -> Ok (Il.OptE None $$ at % t') - | IterT (_, List) -> Ok (Il.ListE [] $$ at % t') - | VarT _ when is_iter_notation_typ env t -> - (match expand_iter_notation env t with - | IterT (_, iter) as t1 -> - let mixop, ts', _ts = elab_typ_notation env (expand_id env t) (t1 $ t.at) in - assert (List.length ts' = 1); - let e1' = if iter = Opt then Il.OptE None else Il.ListE [] in - Ok (Il.CaseE (mixop, tup_exp_bind' [e1' $$ at % List.hd ts'] at) $$ at % t') + nest at t ( + match expand env t with + | IterT (_, Opt) -> Ok (Il.OptE None $$ at % t') + | IterT (_, List) -> Ok (Il.ListE [] $$ at % t') + | VarT _ when is_iter_notation_typ env t -> + (match expand_iter_notation env t with + | IterT (_, iter) as t1 -> + let mixop, ts', _ts = elab_typ_notation env (expand_id env t) (t1 $ t.at) in + assert (List.length ts' = 1); + let e1' = if iter = Opt then Il.OptE None else Il.ListE [] in + Ok (Il.CaseE (mixop, tup_exp_bind' [e1' $$ at % List.hd ts'] at) $$ at % t') + | _ -> fail_typ env at phrase t + ) | _ -> fail_typ env at phrase t - ) - | _ -> fail_typ env at phrase t + ) and cast_exp phrase env e' t1 t2 : Il.exp attempt = - let* e'' = cast_exp' phrase env e' t1 t2 in + let* e'' = nest e'.at t2 (cast_exp' phrase env e' t1 t2) in Ok (e'' $$ e'.at % elab_typ env (expand_nondef env t2)) and cast_exp' phrase env e' t1 t2 : Il.exp' attempt = - Debug.(log_at "el.cast_exp" e'.at + Debug.(log_at "el.elab_exp_cast" e'.at (fun _ -> fmt "%s <: %s >> (%s) <: (%s) = (%s)" (el_typ t1) (el_typ t2) (el_typ (expand_def env t1 $ t1.at)) (el_typ (expand_def env t2 $ t2.at)) (el_typ (expand_nondef env t2)) @@ -1677,6 +1679,33 @@ and cast_exp' phrase env e' t1 t2 : Il.exp' attempt = | _, IterT (t21, Opt) -> let* e'' = cast_exp phrase env e' t1 t21 in Ok (Il.OptE (Some e'')) +(* TODO(3, rossberg): enable; violates invariant that all iterexps are initially empty + | IterT (t11, List), IterT (t21, List) -> + choice env [ + (fun env -> + let id = x $ e'.at in + let t11' = elab_typ env t11 in + let* e'' = cast_exp phrase env (Il.VarE id $$ e'.at % t11') t11 t21 in + Ok (Il.IterE (e'', (List, [x, e']))) + ); + (fun env -> + let* e'' = cast_exp phrase env e' t1 t21 in + Ok (Il.ListE [e'']) + ); + ] +*) + | IterT (t11, Opt), IterT (t21, List) -> + choice env [ + (fun env -> + let t11' = elab_typ env t11 in + let e'' = Il.LiftE e' $$ e'.at % (Il.IterT (t11', Il.List) $ e'.at) in + cast_exp' phrase env e'' (IterT (t11, List) $ e'.at) t2 + ); + (fun env -> + let* e'' = cast_exp phrase env e' t1 t21 in + Ok (Il.ListE [e'']) + ); + ] | _, IterT (t21, (List | List1)) -> let* e'' = cast_exp phrase env e' t1 t21 in Ok (Il.ListE [e'']) diff --git a/spectec/src/util/debug_log.ml b/spectec/src/util/debug_log.ml index f8e5976606..10d4c83599 100644 --- a/spectec/src/util/debug_log.ml +++ b/spectec/src/util/debug_log.ml @@ -9,7 +9,7 @@ let log_exn _exn = Printf.eprintf "\n%s\n%!" (Printexc.get_backtrace ()) let log_at (type a) label at (arg_f : unit -> string) (res_f : a -> string) (f : unit -> a) : a = - if not (label = "" || List.mem label active) then f () else + if not (label = "" || List.exists (fun s -> String.starts_with ~prefix: s label) active) then f () else let ats = if at = Source.no_region then "" else " " ^ Source.string_of_region at in let arg = arg_f () in Printf.eprintf "[%s%s] %s\n%!" label ats arg; diff --git a/spectec/test-frontend/TEST.md b/spectec/test-frontend/TEST.md index c9ddd488c0..0b0a778fe7 100644 --- a/spectec/test-frontend/TEST.md +++ b/spectec/test-frontend/TEST.md @@ -80,57 +80,50 @@ def $opt_(syntax X, X*) : X? ;; 0-aux.watsup def $opt_{syntax X, w : X}(syntax X, [w]) = ?(w) -;; 0-aux.watsup -def $list_(syntax X, X?) : X* - ;; 0-aux.watsup - def $list_{syntax X}(syntax X, ?()) = [] - ;; 0-aux.watsup - def $list_{syntax X, w : X}(syntax X, ?(w)) = [w] - ;; 0-aux.watsup rec { -;; 0-aux.watsup:40.1-40.55 +;; 0-aux.watsup:35.1-35.55 def $concat_(syntax X, X**) : X* - ;; 0-aux.watsup:41.1-41.34 + ;; 0-aux.watsup:36.1-36.34 def $concat_{syntax X}(syntax X, []) = [] - ;; 0-aux.watsup:42.1-42.64 + ;; 0-aux.watsup:37.1-37.64 def $concat_{syntax X, `w*` : X*, `w'**` : X**}(syntax X, [w*{w <- `w*`}] ++ w'*{w' <- `w'*`}*{`w'*` <- `w'**`}) = w*{w <- `w*`} ++ $concat_(syntax X, w'*{w' <- `w'*`}*{`w'*` <- `w'**`}) } ;; 0-aux.watsup rec { -;; 0-aux.watsup:44.1-44.61 +;; 0-aux.watsup:39.1-39.61 def $concatn_(syntax X, X**, nat : nat) : X* - ;; 0-aux.watsup:45.1-45.38 + ;; 0-aux.watsup:40.1-40.38 def $concatn_{syntax X, n : n}(syntax X, [], n) = [] - ;; 0-aux.watsup:46.1-46.73 + ;; 0-aux.watsup:41.1-41.73 def $concatn_{syntax X, `w*` : X*, n : n, `w'**` : X**}(syntax X, [w^n{w <- `w*`}] ++ w'^n{w' <- `w'*`}*{`w'*` <- `w'**`}, n) = w^n{w <- `w*`} ++ $concatn_(syntax X, w'^n{w' <- `w'*`}*{`w'*` <- `w'**`}, n) } ;; 0-aux.watsup rec { -;; 0-aux.watsup:51.1-51.78 +;; 0-aux.watsup:46.1-46.78 def $disjoint_(syntax X, X*) : bool - ;; 0-aux.watsup:52.1-52.37 + ;; 0-aux.watsup:47.1-47.37 def $disjoint_{syntax X}(syntax X, []) = true - ;; 0-aux.watsup:53.1-53.68 + ;; 0-aux.watsup:48.1-48.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'*`})) } ;; 0-aux.watsup rec { -;; 0-aux.watsup:56.1-56.38 +;; 0-aux.watsup:51.1-51.38 def $setminus1_(syntax X, X : X, X*) : X* - ;; 0-aux.watsup:60.1-60.38 + ;; 0-aux.watsup:55.1-55.38 def $setminus1_{syntax X, w : X}(syntax X, w, []) = [w] - ;; 0-aux.watsup:61.1-61.78 + ;; 0-aux.watsup:56.1-56.78 def $setminus1_{syntax X, w : X, w_1 : X, `w'*` : X*}(syntax X, w, [w_1] ++ w'*{w' <- `w'*`}) = [] -- if (w = w_1) - ;; 0-aux.watsup:62.1-62.77 + ;; 0-aux.watsup:57.1-57.77 def $setminus1_{syntax X, w : X, w_1 : X, `w'*` : X*}(syntax X, w, [w_1] ++ w'*{w' <- `w'*`}) = $setminus1_(syntax X, w, w'*{w' <- `w'*`}) -- otherwise } @@ -138,44 +131,44 @@ def $setminus1_(syntax X, X : X, X*) : X* ;; 0-aux.watsup rec { -;; 0-aux.watsup:55.1-55.56 +;; 0-aux.watsup:50.1-50.56 def $setminus_(syntax X, X*, X*) : X* - ;; 0-aux.watsup:58.1-58.40 + ;; 0-aux.watsup:53.1-53.40 def $setminus_{syntax X, `w*` : X*}(syntax X, [], w*{w <- `w*`}) = [] - ;; 0-aux.watsup:59.1-59.90 + ;; 0-aux.watsup:54.1-54.90 def $setminus_{syntax X, w_1 : X, `w'*` : X*, `w*` : X*}(syntax X, [w_1] ++ w'*{w' <- `w'*`}, w*{w <- `w*`}) = $setminus1_(syntax X, w_1, w*{w <- `w*`}) ++ $setminus_(syntax X, w'*{w' <- `w'*`}, w*{w <- `w*`}) } ;; 0-aux.watsup rec { -;; 0-aux.watsup:67.1-67.46 +;; 0-aux.watsup:62.1-62.46 def $setproduct2_(syntax X, X : X, X**) : X** - ;; 0-aux.watsup:73.1-73.44 + ;; 0-aux.watsup:68.1-68.44 def $setproduct2_{syntax X, w_1 : X}(syntax X, w_1, []) = [] - ;; 0-aux.watsup:74.1-74.90 + ;; 0-aux.watsup:69.1-69.90 def $setproduct2_{syntax X, w_1 : X, `w'*` : X*, `w**` : X**}(syntax X, w_1, [w'*{w' <- `w'*`}] ++ w*{w <- `w*`}*{`w*` <- `w**`}) = [[w_1] ++ w'*{w' <- `w'*`}] ++ $setproduct2_(syntax X, w_1, w*{w <- `w*`}*{`w*` <- `w**`}) } ;; 0-aux.watsup rec { -;; 0-aux.watsup:66.1-66.47 +;; 0-aux.watsup:61.1-61.47 def $setproduct1_(syntax X, X*, X**) : X** - ;; 0-aux.watsup:71.1-71.46 + ;; 0-aux.watsup:66.1-66.46 def $setproduct1_{syntax X, `w**` : X**}(syntax X, [], w*{w <- `w*`}*{`w*` <- `w**`}) = [] - ;; 0-aux.watsup:72.1-72.107 + ;; 0-aux.watsup:67.1-67.107 def $setproduct1_{syntax X, w_1 : X, `w'*` : X*, `w**` : X**}(syntax X, [w_1] ++ w'*{w' <- `w'*`}, w*{w <- `w*`}*{`w*` <- `w**`}) = $setproduct2_(syntax X, w_1, w*{w <- `w*`}*{`w*` <- `w**`}) ++ $setproduct1_(syntax X, w'*{w' <- `w'*`}, w*{w <- `w*`}*{`w*` <- `w**`}) } ;; 0-aux.watsup rec { -;; 0-aux.watsup:65.1-65.82 +;; 0-aux.watsup:60.1-60.82 def $setproduct_(syntax X, X**) : X** - ;; 0-aux.watsup:69.1-69.40 + ;; 0-aux.watsup:64.1-64.40 def $setproduct_{syntax X}(syntax X, []) = [[]] - ;; 0-aux.watsup:70.1-70.90 + ;; 0-aux.watsup:65.1-65.90 def $setproduct_{syntax X, `w_1*` : X*, `w**` : X**}(syntax X, [w_1*{w_1 <- `w_1*`}] ++ w*{w <- `w*`}*{`w*` <- `w**`}) = $setproduct1_(syntax X, w_1*{w_1 <- `w_1*`}, $setproduct_(syntax X, w*{w <- `w*`}*{`w*` <- `w**`})) } @@ -1341,7 +1334,7 @@ syntax frame = ;; 5-runtime.watsup rec { -;; 5-runtime.watsup:156.1-162.9 +;; 5-runtime.watsup:157.1-163.9 syntax instr = | NOP | UNREACHABLE @@ -4686,9 +4679,9 @@ def $binop_(numtype : numtype, binop_ : binop_(numtype), num_ : num_(numtype), n ;; 4-numerics.watsup def $binop_{Inn : Inn, i_1 : num_((Inn : Inn <: numtype)), i_2 : num_((Inn : Inn <: numtype))}((Inn : Inn <: numtype), MUL_binop_, i_1, i_2) = [$imul_($sizenn((Inn : Inn <: numtype)), i_1, i_2)] ;; 4-numerics.watsup - def $binop_{Inn : Inn, sx : sx, i_1 : num_((Inn : Inn <: numtype)), i_2 : num_((Inn : Inn <: numtype))}((Inn : Inn <: numtype), DIV_binop_(sx), i_1, i_2) = $list_(syntax num_((Inn : Inn <: numtype)), $idiv_($sizenn((Inn : Inn <: numtype)), sx, i_1, i_2)) + def $binop_{Inn : Inn, sx : sx, i_1 : num_((Inn : Inn <: numtype)), i_2 : num_((Inn : Inn <: numtype))}((Inn : Inn <: numtype), DIV_binop_(sx), i_1, i_2) = lift($idiv_($sizenn((Inn : Inn <: numtype)), sx, i_1, i_2)) ;; 4-numerics.watsup - def $binop_{Inn : Inn, sx : sx, i_1 : num_((Inn : Inn <: numtype)), i_2 : num_((Inn : Inn <: numtype))}((Inn : Inn <: numtype), REM_binop_(sx), i_1, i_2) = $list_(syntax num_((Inn : Inn <: numtype)), $irem_($sizenn((Inn : Inn <: numtype)), sx, i_1, i_2)) + def $binop_{Inn : Inn, sx : sx, i_1 : num_((Inn : Inn <: numtype)), i_2 : num_((Inn : Inn <: numtype))}((Inn : Inn <: numtype), REM_binop_(sx), i_1, i_2) = lift($irem_($sizenn((Inn : Inn <: numtype)), sx, i_1, i_2)) ;; 4-numerics.watsup def $binop_{Inn : Inn, i_1 : num_((Inn : Inn <: numtype)), i_2 : num_((Inn : Inn <: numtype))}((Inn : Inn <: numtype), AND_binop_, i_1, i_2) = [$iand_($sizenn((Inn : Inn <: numtype)), i_1, i_2)] ;; 4-numerics.watsup @@ -4757,9 +4750,9 @@ def $cvtop__(numtype_1 : numtype, numtype_2 : numtype, cvtop__ : cvtop__(numtype ;; 4-numerics.watsup def $cvtop__{Inn_1 : Inn, Inn_2 : Inn, i_1 : num_((Inn_1 : Inn <: numtype))}((Inn_1 : Inn <: numtype), (Inn_2 : Inn <: numtype), WRAP_cvtop__, i_1) = [$wrap__($sizenn1((Inn_1 : Inn <: numtype)), $sizenn2((Inn_2 : Inn <: numtype)), i_1)] ;; 4-numerics.watsup - def $cvtop__{Fnn_1 : Fnn, Inn_2 : Inn, sx : sx, f_1 : num_((Fnn_1 : Fnn <: numtype))}((Fnn_1 : Fnn <: numtype), (Inn_2 : Inn <: numtype), TRUNC_cvtop__(sx), f_1) = $list_(syntax num_((Inn_2 : Inn <: numtype)), $trunc__($sizenn1((Fnn_1 : Fnn <: numtype)), $sizenn2((Inn_2 : Inn <: numtype)), sx, f_1)) + def $cvtop__{Fnn_1 : Fnn, Inn_2 : Inn, sx : sx, f_1 : num_((Fnn_1 : Fnn <: numtype))}((Fnn_1 : Fnn <: numtype), (Inn_2 : Inn <: numtype), TRUNC_cvtop__(sx), f_1) = lift($trunc__($sizenn1((Fnn_1 : Fnn <: numtype)), $sizenn2((Inn_2 : Inn <: numtype)), sx, f_1)) ;; 4-numerics.watsup - def $cvtop__{Fnn_1 : Fnn, Inn_2 : Inn, sx : sx, f_1 : num_((Fnn_1 : Fnn <: numtype))}((Fnn_1 : Fnn <: numtype), (Inn_2 : Inn <: numtype), TRUNC_SAT_cvtop__(sx), f_1) = $list_(syntax num_((Inn_2 : Inn <: numtype)), $trunc_sat__($sizenn1((Fnn_1 : Fnn <: numtype)), $sizenn2((Inn_2 : Inn <: numtype)), sx, f_1)) + def $cvtop__{Fnn_1 : Fnn, Inn_2 : Inn, sx : sx, f_1 : num_((Fnn_1 : Fnn <: numtype))}((Fnn_1 : Fnn <: numtype), (Inn_2 : Inn <: numtype), TRUNC_SAT_cvtop__(sx), f_1) = lift($trunc_sat__($sizenn1((Fnn_1 : Fnn <: numtype)), $sizenn2((Inn_2 : Inn <: numtype)), sx, f_1)) ;; 4-numerics.watsup def $cvtop__{Inn_1 : Inn, Fnn_2 : Fnn, sx : sx, i_1 : num_((Inn_1 : Inn <: numtype))}((Inn_1 : Inn <: numtype), (Fnn_2 : Fnn <: numtype), CONVERT_cvtop__(sx), i_1) = [$convert__($sizenn1((Inn_1 : Inn <: numtype)), $sizenn2((Fnn_2 : Fnn <: numtype)), sx, i_1)] ;; 4-numerics.watsup @@ -5089,10 +5082,10 @@ def $lcvtop__(shape_1 : shape, shape_2 : shape, vcvtop__ : vcvtop__(shape_1, sha def $lcvtop__{Jnn_1 : Jnn, M_1 : M, Fnn_2 : Fnn, M_2 : M, sx : sx, c_1 : lane_($lanetype(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)))), c : lane_($lanetype(`%X%`_shape((Fnn_2 : Fnn <: lanetype), `%`_dim(M_2))))}(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Fnn_2 : Fnn <: lanetype), `%`_dim(M_2)), CONVERT_vcvtop__(sx), c_1) = [c] -- if (c = $convert__($lsizenn1((Jnn_1 : Jnn <: lanetype)), $lsizenn2((Fnn_2 : Fnn <: lanetype)), sx, c_1)) ;; 4-numerics.watsup - def $lcvtop__{Fnn_1 : Fnn, M_1 : M, Inn_2 : Inn, M_2 : M, sx : sx, c_1 : lane_($lanetype(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)))), `c?` : lane_((Inn_2 : Inn <: lanetype))?}(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Inn_2 : Inn <: lanetype), `%`_dim(M_2)), TRUNC_SAT_vcvtop__(sx), c_1) = $list_(syntax lane_((Inn_2 : Inn <: lanetype)), c?{c <- `c?`}) + def $lcvtop__{Fnn_1 : Fnn, M_1 : M, Inn_2 : Inn, M_2 : M, sx : sx, c_1 : lane_($lanetype(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)))), `c?` : lane_($lanetype(`%X%`_shape((Inn_2 : Inn <: lanetype), `%`_dim(M_2))))?}(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Inn_2 : Inn <: lanetype), `%`_dim(M_2)), TRUNC_SAT_vcvtop__(sx), c_1) = lift(c?{c <- `c?`}) -- if (c?{c <- `c?`} = $trunc_sat__($lsizenn1((Fnn_1 : Fnn <: lanetype)), $lsizenn2((Inn_2 : Inn <: lanetype)), sx, c_1)) ;; 4-numerics.watsup - def $lcvtop__{Fnn_1 : Fnn, M_1 : M, Inn_2 : Inn, M_2 : M, sx : sx, c_1 : lane_($lanetype(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)))), `c?` : lane_((Inn_2 : Inn <: lanetype))?}(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Inn_2 : Inn <: lanetype), `%`_dim(M_2)), RELAXED_TRUNC_vcvtop__(sx), c_1) = $list_(syntax lane_((Inn_2 : Inn <: lanetype)), c?{c <- `c?`}) + def $lcvtop__{Fnn_1 : Fnn, M_1 : M, Inn_2 : Inn, M_2 : M, sx : sx, c_1 : lane_($lanetype(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)))), `c?` : lane_($lanetype(`%X%`_shape((Inn_2 : Inn <: lanetype), `%`_dim(M_2))))?}(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Inn_2 : Inn <: lanetype), `%`_dim(M_2)), RELAXED_TRUNC_vcvtop__(sx), c_1) = lift(c?{c <- `c?`}) -- if (c?{c <- `c?`} = $relaxed_trunc__($lsizenn1((Fnn_1 : Fnn <: lanetype)), $lsizenn2((Inn_2 : Inn <: lanetype)), sx, c_1)) ;; 4-numerics.watsup def $lcvtop__{Fnn_1 : Fnn, M_1 : M, Fnn_2 : Fnn, M_2 : M, c_1 : lane_($lanetype(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)))), `c*` : lane_($lanetype(`%X%`_shape((Fnn_2 : Fnn <: lanetype), `%`_dim(M_2))))*}(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Fnn_2 : Fnn <: lanetype), `%`_dim(M_2)), DEMOTE_vcvtop__, c_1) = c*{c <- `c*`} @@ -6749,132 +6742,132 @@ relation Step: `%~>%`(config, config) `%~>%`(`%;%`_config(`%;%`_state(s, f), [`FRAME_%{%}%`_instr(n, f', instr*{instr <- `instr*`})]), `%;%`_config(`%;%`_state(s', f), [`FRAME_%{%}%`_instr(n, f', instr'*{instr' <- `instr'*`})])) -- Step: `%~>%`(`%;%`_config(`%;%`_state(s, f'), instr*{instr <- `instr*`}), `%;%`_config(`%;%`_state(s', f'), instr'*{instr' <- `instr'*`})) - ;; 8-reduction.watsup:227.1-232.49 + ;; 8-reduction.watsup:227.1-231.49 rule throw{z : state, `val*` : val*, n : n, x : idx, exn : exninst, a : addr, `t*` : valtype*}: `%~>%`(`%;%`_config(z, (val : val <: instr)^n{val <- `val*`} ++ [THROW_instr(x)]), `%;%`_config($add_exninst(z, [exn]), [REF.EXN_ADDR_instr(a) THROW_REF_instr])) -- Expand: `%~~%`($tag(z, x).TYPE_taginst, FUNC_comptype(`%->%`_functype(`%`_resulttype(t^n{t <- `t*`}), `%`_resulttype([])))) -- if (a = |$exninst(z)|) -- if (exn = {TAG $tagaddr(z)[x!`%`_idx.0], FIELDS val^n{val <- `val*`}}) - ;; 8-reduction.watsup:407.1-411.65 + ;; 8-reduction.watsup:406.1-410.65 rule struct.new{z : state, `val*` : val*, n : n, x : idx, si : structinst, a : addr, `mut*` : mut*, `zt*` : storagetype*}: `%~>%`(`%;%`_config(z, (val : val <: instr)^n{val <- `val*`} ++ [STRUCT.NEW_instr(x)]), `%;%`_config($add_structinst(z, [si]), [REF.STRUCT_ADDR_instr(a)])) -- Expand: `%~~%`($type(z, x), STRUCT_comptype(`%`_structtype(`%%`_fieldtype(mut, zt)^n{mut <- `mut*`, zt <- `zt*`}))) -- if (a = |$structinst(z)|) -- if (si = {TYPE $type(z, x), FIELDS $packfield_(zt, val)^n{val <- `val*`, zt <- `zt*`}}) - ;; 8-reduction.watsup:427.1-428.53 + ;; 8-reduction.watsup:426.1-427.53 rule `struct.set-null`{z : state, ht : heaptype, val : val, x : idx, i : u32}: `%~>%`(`%;%`_config(z, [REF.NULL_instr(ht) (val : val <: instr) STRUCT.SET_instr(x, i)]), `%;%`_config(z, [TRAP_instr])) - ;; 8-reduction.watsup:430.1-432.45 + ;; 8-reduction.watsup:429.1-431.45 rule `struct.set-struct`{z : state, a : addr, val : val, x : idx, i : u32, `zt*` : storagetype*, `mut*` : mut*}: `%~>%`(`%;%`_config(z, [REF.STRUCT_ADDR_instr(a) (val : val <: instr) STRUCT.SET_instr(x, i)]), `%;%`_config($with_struct(z, a, i!`%`_u32.0, $packfield_(zt*{zt <- `zt*`}[i!`%`_u32.0], val)), [])) -- Expand: `%~~%`($type(z, x), STRUCT_comptype(`%`_structtype(`%%`_fieldtype(mut, zt)*{mut <- `mut*`, zt <- `zt*`}))) - ;; 8-reduction.watsup:445.1-450.65 + ;; 8-reduction.watsup:444.1-449.65 rule array.new_fixed{z : state, `val*` : val*, n : n, x : idx, ai : arrayinst, a : addr, mut : mut, zt : storagetype}: `%~>%`(`%;%`_config(z, (val : val <: instr)^n{val <- `val*`} ++ [ARRAY.NEW_FIXED_instr(x, `%`_u32(n))]), `%;%`_config($add_arrayinst(z, [ai]), [REF.ARRAY_ADDR_instr(a)])) -- Expand: `%~~%`($type(z, x), ARRAY_comptype(`%%`_arraytype(mut, zt))) -- if ((a = |$arrayinst(z)|) /\ (ai = {TYPE $type(z, x), FIELDS $packfield_(zt, val)^n{val <- `val*`}})) - ;; 8-reduction.watsup:490.1-491.64 + ;; 8-reduction.watsup:489.1-490.64 rule `array.set-null`{z : state, ht : heaptype, i : num_(I32_numtype), val : val, x : idx}: `%~>%`(`%;%`_config(z, [REF.NULL_instr(ht) CONST_instr(I32_numtype, i) (val : val <: instr) ARRAY.SET_instr(x)]), `%;%`_config(z, [TRAP_instr])) - ;; 8-reduction.watsup:493.1-495.39 + ;; 8-reduction.watsup:492.1-494.39 rule `array.set-oob`{z : state, a : addr, i : num_(I32_numtype), val : val, x : idx}: `%~>%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) (val : val <: instr) ARRAY.SET_instr(x)]), `%;%`_config(z, [TRAP_instr])) -- if (i!`%`_num_.0 >= |$arrayinst(z)[a].FIELDS_arrayinst|) - ;; 8-reduction.watsup:497.1-500.43 + ;; 8-reduction.watsup:496.1-499.43 rule `array.set-array`{z : state, a : addr, i : num_(I32_numtype), val : val, x : idx, zt : storagetype, mut : mut}: `%~>%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) (val : val <: instr) ARRAY.SET_instr(x)]), `%;%`_config($with_array(z, a, i!`%`_num_.0, $packfield_(zt, val)), [])) -- Expand: `%~~%`($type(z, x), ARRAY_comptype(`%%`_arraytype(mut, zt))) - ;; 8-reduction.watsup:779.1-780.56 + ;; 8-reduction.watsup:778.1-779.56 rule local.set{z : state, val : val, x : idx}: `%~>%`(`%;%`_config(z, [(val : val <: instr) LOCAL.SET_instr(x)]), `%;%`_config($with_local(z, x, val), [])) - ;; 8-reduction.watsup:792.1-793.58 + ;; 8-reduction.watsup:791.1-792.58 rule global.set{z : state, val : val, x : idx}: `%~>%`(`%;%`_config(z, [(val : val <: instr) GLOBAL.SET_instr(x)]), `%;%`_config($with_global(z, x, val), [])) - ;; 8-reduction.watsup:806.1-808.33 + ;; 8-reduction.watsup:805.1-807.33 rule `table.set-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), ref : ref, x : idx}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) (ref : ref <: instr) TABLE.SET_instr(x)]), `%;%`_config(z, [TRAP_instr])) -- if (i!`%`_num_.0 >= |$table(z, x).REFS_tableinst|) - ;; 8-reduction.watsup:810.1-812.32 + ;; 8-reduction.watsup:809.1-811.32 rule `table.set-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), ref : ref, x : idx}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) (ref : ref <: instr) TABLE.SET_instr(x)]), `%;%`_config($with_table(z, x, i!`%`_num_.0, ref), [])) -- if (i!`%`_num_.0 < |$table(z, x).REFS_tableinst|) - ;; 8-reduction.watsup:821.1-824.46 + ;; 8-reduction.watsup:820.1-823.46 rule `table.grow-succeed`{z : state, ref : ref, at : addrtype, n : n, x : idx, ti : tableinst}: `%~>%`(`%;%`_config(z, [(ref : ref <: instr) CONST_instr((at : addrtype <: numtype), `%`_num_(n)) TABLE.GROW_instr(x)]), `%;%`_config($with_tableinst(z, x, ti), [CONST_instr((at : addrtype <: numtype), `%`_num_(|$table(z, x).REFS_tableinst|))])) -- if (ti = $growtable($table(z, x), n, ref)) - ;; 8-reduction.watsup:826.1-827.86 + ;; 8-reduction.watsup:825.1-826.86 rule `table.grow-fail`{z : state, ref : ref, at : addrtype, n : n, x : idx}: `%~>%`(`%;%`_config(z, [(ref : ref <: instr) CONST_instr((at : addrtype <: numtype), `%`_num_(n)) TABLE.GROW_instr(x)]), `%;%`_config(z, [CONST_instr((at : addrtype <: numtype), `%`_num_($invsigned_($size((at : addrtype <: numtype)), - (1 : nat <:> int))))])) - ;; 8-reduction.watsup:887.1-888.51 + ;; 8-reduction.watsup:886.1-887.51 rule elem.drop{z : state, x : idx}: `%~>%`(`%;%`_config(z, [ELEM.DROP_instr(x)]), `%;%`_config($with_elem(z, x, []), [])) - ;; 8-reduction.watsup:971.1-974.60 + ;; 8-reduction.watsup:970.1-973.60 rule `store-num-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), nt : numtype, c : num_(nt), x : idx, ao : memarg}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr(nt, c) STORE_instr(nt, ?(), x, ao)]), `%;%`_config(z, [TRAP_instr])) -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + ((($size(nt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) - ;; 8-reduction.watsup:976.1-980.29 + ;; 8-reduction.watsup:975.1-979.29 rule `store-num-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), nt : numtype, c : num_(nt), x : idx, ao : memarg, `b*` : byte*}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr(nt, c) STORE_instr(nt, ?(), x, ao)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0), ((($size(nt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) -- if (b*{b <- `b*`} = $nbytes_(nt, c)) - ;; 8-reduction.watsup:982.1-985.52 + ;; 8-reduction.watsup:981.1-984.52 rule `store-pack-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), Inn : Inn, c : num_((Inn : Inn <: numtype)), n : n, x : idx, ao : memarg}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr((Inn : Inn <: numtype), c) STORE_instr((Inn : Inn <: numtype), ?(`%`_storeop_(`%`_sz(n))), x, ao)]), `%;%`_config(z, [TRAP_instr])) -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + (((n : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) - ;; 8-reduction.watsup:987.1-991.52 + ;; 8-reduction.watsup:986.1-990.52 rule `store-pack-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), Inn : Inn, c : num_((Inn : Inn <: numtype)), n : n, x : idx, ao : memarg, `b*` : byte*}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr((Inn : Inn <: numtype), c) STORE_instr((Inn : Inn <: numtype), ?(`%`_storeop_(`%`_sz(n))), x, ao)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0), (((n : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) -- if (b*{b <- `b*`} = $ibytes_(n, $wrap__($size((Inn : Inn <: numtype)), n, c))) - ;; 8-reduction.watsup:993.1-995.63 + ;; 8-reduction.watsup:992.1-994.63 rule `vstore-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c : vec_(V128_Vnn), x : idx, ao : memarg}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_instr(V128_vectype, x, ao)]), `%;%`_config(z, [TRAP_instr])) -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + ((($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) - ;; 8-reduction.watsup:997.1-999.31 + ;; 8-reduction.watsup:996.1-998.31 rule `vstore-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c : vec_(V128_Vnn), x : idx, ao : memarg, `b*` : byte*}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_instr(V128_vectype, x, ao)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0), ((($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) -- if (b*{b <- `b*`} = $vbytes_(V128_vectype, c)) - ;; 8-reduction.watsup:1002.1-1004.50 + ;; 8-reduction.watsup:1001.1-1003.50 rule `vstore_lane-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c : vec_(V128_Vnn), N : N, x : idx, ao : memarg, j : laneidx}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_LANE_instr(V128_vectype, `%`_sz(N), x, ao, j)]), `%;%`_config(z, [TRAP_instr])) -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + N) > |$mem(z, x).BYTES_meminst|) - ;; 8-reduction.watsup:1006.1-1010.49 + ;; 8-reduction.watsup:1005.1-1009.49 rule `vstore_lane-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c : vec_(V128_Vnn), N : N, x : idx, ao : memarg, j : laneidx, `b*` : byte*, Jnn : Jnn, M : M}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_LANE_instr(V128_vectype, `%`_sz(N), x, ao, j)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0), (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) -- if (N = $lsize((Jnn : Jnn <: lanetype))) -- if ((M : nat <:> rat) = ((128 : nat <:> rat) / (N : nat <:> rat))) -- if (b*{b <- `b*`} = $ibytes_(N, `%`_iN($lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), c)[j!`%`_laneidx.0]!`%`_lane_.0))) - ;; 8-reduction.watsup:1019.1-1022.37 + ;; 8-reduction.watsup:1018.1-1021.37 rule `memory.grow-succeed`{z : state, at : addrtype, n : n, x : idx, mi : meminst}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), `%`_num_(n)) MEMORY.GROW_instr(x)]), `%;%`_config($with_meminst(z, x, mi), [CONST_instr((at : addrtype <: numtype), `%`_num_((((|$mem(z, x).BYTES_meminst| : nat <:> rat) / ((64 * $Ki) : nat <:> rat)) : rat <:> nat)))])) -- if (mi = $growmem($mem(z, x), n)) - ;; 8-reduction.watsup:1024.1-1025.83 + ;; 8-reduction.watsup:1023.1-1024.83 rule `memory.grow-fail`{z : state, at : addrtype, n : n, x : idx}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), `%`_num_(n)) MEMORY.GROW_instr(x)]), `%;%`_config(z, [CONST_instr((at : addrtype <: numtype), `%`_num_($invsigned_($size((at : addrtype <: numtype)), - (1 : nat <:> int))))])) - ;; 8-reduction.watsup:1085.1-1086.51 + ;; 8-reduction.watsup:1084.1-1085.51 rule data.drop{z : state, x : idx}: `%~>%`(`%;%`_config(z, [DATA.DROP_instr(x)]), `%;%`_config($with_data(z, x, []), [])) } diff --git a/spectec/test-latex/TEST.md b/spectec/test-latex/TEST.md index 3b785e0ee7..6e9fd4a390 100644 --- a/spectec/test-latex/TEST.md +++ b/spectec/test-latex/TEST.md @@ -2419,13 +2419,6 @@ w & = & w \\ \end{array} $$ -$$ -\begin{array}[t]{@{}lcl@{}l@{}} -\epsilon & = & \epsilon \\ -w & = & w \\ -\end{array} -$$ - $$ \begin{array}[t]{@{}lcl@{}l@{}} {\bigoplus}\, \epsilon & = & \epsilon \\ diff --git a/spectec/test-middlend/TEST.md b/spectec/test-middlend/TEST.md index ea99305097..a37c19b3d6 100644 --- a/spectec/test-middlend/TEST.md +++ b/spectec/test-middlend/TEST.md @@ -70,57 +70,50 @@ def $opt_(syntax X, X*) : X? ;; 0-aux.watsup def $opt_{syntax X, w : X}(syntax X, [w]) = ?(w) -;; 0-aux.watsup -def $list_(syntax X, X?) : X* - ;; 0-aux.watsup - def $list_{syntax X}(syntax X, ?()) = [] - ;; 0-aux.watsup - def $list_{syntax X, w : X}(syntax X, ?(w)) = [w] - ;; 0-aux.watsup rec { -;; 0-aux.watsup:40.1-40.55 +;; 0-aux.watsup:35.1-35.55 def $concat_(syntax X, X**) : X* - ;; 0-aux.watsup:41.1-41.34 + ;; 0-aux.watsup:36.1-36.34 def $concat_{syntax X}(syntax X, []) = [] - ;; 0-aux.watsup:42.1-42.64 + ;; 0-aux.watsup:37.1-37.64 def $concat_{syntax X, `w*` : X*, `w'**` : X**}(syntax X, [w*{w <- `w*`}] ++ w'*{w' <- `w'*`}*{`w'*` <- `w'**`}) = w*{w <- `w*`} ++ $concat_(syntax X, w'*{w' <- `w'*`}*{`w'*` <- `w'**`}) } ;; 0-aux.watsup rec { -;; 0-aux.watsup:44.1-44.61 +;; 0-aux.watsup:39.1-39.61 def $concatn_(syntax X, X**, nat : nat) : X* - ;; 0-aux.watsup:45.1-45.38 + ;; 0-aux.watsup:40.1-40.38 def $concatn_{syntax X, n : n}(syntax X, [], n) = [] - ;; 0-aux.watsup:46.1-46.73 + ;; 0-aux.watsup:41.1-41.73 def $concatn_{syntax X, `w*` : X*, n : n, `w'**` : X**}(syntax X, [w^n{w <- `w*`}] ++ w'^n{w' <- `w'*`}*{`w'*` <- `w'**`}, n) = w^n{w <- `w*`} ++ $concatn_(syntax X, w'^n{w' <- `w'*`}*{`w'*` <- `w'**`}, n) } ;; 0-aux.watsup rec { -;; 0-aux.watsup:51.1-51.78 +;; 0-aux.watsup:46.1-46.78 def $disjoint_(syntax X, X*) : bool - ;; 0-aux.watsup:52.1-52.37 + ;; 0-aux.watsup:47.1-47.37 def $disjoint_{syntax X}(syntax X, []) = true - ;; 0-aux.watsup:53.1-53.68 + ;; 0-aux.watsup:48.1-48.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'*`})) } ;; 0-aux.watsup rec { -;; 0-aux.watsup:56.1-56.38 +;; 0-aux.watsup:51.1-51.38 def $setminus1_(syntax X, X : X, X*) : X* - ;; 0-aux.watsup:60.1-60.38 + ;; 0-aux.watsup:55.1-55.38 def $setminus1_{syntax X, w : X}(syntax X, w, []) = [w] - ;; 0-aux.watsup:61.1-61.78 + ;; 0-aux.watsup:56.1-56.78 def $setminus1_{syntax X, w : X, w_1 : X, `w'*` : X*}(syntax X, w, [w_1] ++ w'*{w' <- `w'*`}) = [] -- if (w = w_1) - ;; 0-aux.watsup:62.1-62.77 + ;; 0-aux.watsup:57.1-57.77 def $setminus1_{syntax X, w : X, w_1 : X, `w'*` : X*}(syntax X, w, [w_1] ++ w'*{w' <- `w'*`}) = $setminus1_(syntax X, w, w'*{w' <- `w'*`}) -- otherwise } @@ -128,44 +121,44 @@ def $setminus1_(syntax X, X : X, X*) : X* ;; 0-aux.watsup rec { -;; 0-aux.watsup:55.1-55.56 +;; 0-aux.watsup:50.1-50.56 def $setminus_(syntax X, X*, X*) : X* - ;; 0-aux.watsup:58.1-58.40 + ;; 0-aux.watsup:53.1-53.40 def $setminus_{syntax X, `w*` : X*}(syntax X, [], w*{w <- `w*`}) = [] - ;; 0-aux.watsup:59.1-59.90 + ;; 0-aux.watsup:54.1-54.90 def $setminus_{syntax X, w_1 : X, `w'*` : X*, `w*` : X*}(syntax X, [w_1] ++ w'*{w' <- `w'*`}, w*{w <- `w*`}) = $setminus1_(syntax X, w_1, w*{w <- `w*`}) ++ $setminus_(syntax X, w'*{w' <- `w'*`}, w*{w <- `w*`}) } ;; 0-aux.watsup rec { -;; 0-aux.watsup:67.1-67.46 +;; 0-aux.watsup:62.1-62.46 def $setproduct2_(syntax X, X : X, X**) : X** - ;; 0-aux.watsup:73.1-73.44 + ;; 0-aux.watsup:68.1-68.44 def $setproduct2_{syntax X, w_1 : X}(syntax X, w_1, []) = [] - ;; 0-aux.watsup:74.1-74.90 + ;; 0-aux.watsup:69.1-69.90 def $setproduct2_{syntax X, w_1 : X, `w'*` : X*, `w**` : X**}(syntax X, w_1, [w'*{w' <- `w'*`}] ++ w*{w <- `w*`}*{`w*` <- `w**`}) = [[w_1] ++ w'*{w' <- `w'*`}] ++ $setproduct2_(syntax X, w_1, w*{w <- `w*`}*{`w*` <- `w**`}) } ;; 0-aux.watsup rec { -;; 0-aux.watsup:66.1-66.47 +;; 0-aux.watsup:61.1-61.47 def $setproduct1_(syntax X, X*, X**) : X** - ;; 0-aux.watsup:71.1-71.46 + ;; 0-aux.watsup:66.1-66.46 def $setproduct1_{syntax X, `w**` : X**}(syntax X, [], w*{w <- `w*`}*{`w*` <- `w**`}) = [] - ;; 0-aux.watsup:72.1-72.107 + ;; 0-aux.watsup:67.1-67.107 def $setproduct1_{syntax X, w_1 : X, `w'*` : X*, `w**` : X**}(syntax X, [w_1] ++ w'*{w' <- `w'*`}, w*{w <- `w*`}*{`w*` <- `w**`}) = $setproduct2_(syntax X, w_1, w*{w <- `w*`}*{`w*` <- `w**`}) ++ $setproduct1_(syntax X, w'*{w' <- `w'*`}, w*{w <- `w*`}*{`w*` <- `w**`}) } ;; 0-aux.watsup rec { -;; 0-aux.watsup:65.1-65.82 +;; 0-aux.watsup:60.1-60.82 def $setproduct_(syntax X, X**) : X** - ;; 0-aux.watsup:69.1-69.40 + ;; 0-aux.watsup:64.1-64.40 def $setproduct_{syntax X}(syntax X, []) = [[]] - ;; 0-aux.watsup:70.1-70.90 + ;; 0-aux.watsup:65.1-65.90 def $setproduct_{syntax X, `w_1*` : X*, `w**` : X**}(syntax X, [w_1*{w_1 <- `w_1*`}] ++ w*{w <- `w*`}*{`w*` <- `w**`}) = $setproduct1_(syntax X, w_1*{w_1 <- `w_1*`}, $setproduct_(syntax X, w*{w <- `w*`}*{`w*` <- `w**`})) } @@ -1331,7 +1324,7 @@ syntax frame = ;; 5-runtime.watsup rec { -;; 5-runtime.watsup:156.1-162.9 +;; 5-runtime.watsup:157.1-163.9 syntax instr = | NOP | UNREACHABLE @@ -4676,9 +4669,9 @@ def $binop_(numtype : numtype, binop_ : binop_(numtype), num_ : num_(numtype), n ;; 4-numerics.watsup def $binop_{Inn : Inn, i_1 : num_((Inn : Inn <: numtype)), i_2 : num_((Inn : Inn <: numtype))}((Inn : Inn <: numtype), MUL_binop_, i_1, i_2) = [$imul_($sizenn((Inn : Inn <: numtype)), i_1, i_2)] ;; 4-numerics.watsup - def $binop_{Inn : Inn, sx : sx, i_1 : num_((Inn : Inn <: numtype)), i_2 : num_((Inn : Inn <: numtype))}((Inn : Inn <: numtype), DIV_binop_(sx), i_1, i_2) = $list_(syntax num_((Inn : Inn <: numtype)), $idiv_($sizenn((Inn : Inn <: numtype)), sx, i_1, i_2)) + def $binop_{Inn : Inn, sx : sx, i_1 : num_((Inn : Inn <: numtype)), i_2 : num_((Inn : Inn <: numtype))}((Inn : Inn <: numtype), DIV_binop_(sx), i_1, i_2) = lift($idiv_($sizenn((Inn : Inn <: numtype)), sx, i_1, i_2)) ;; 4-numerics.watsup - def $binop_{Inn : Inn, sx : sx, i_1 : num_((Inn : Inn <: numtype)), i_2 : num_((Inn : Inn <: numtype))}((Inn : Inn <: numtype), REM_binop_(sx), i_1, i_2) = $list_(syntax num_((Inn : Inn <: numtype)), $irem_($sizenn((Inn : Inn <: numtype)), sx, i_1, i_2)) + def $binop_{Inn : Inn, sx : sx, i_1 : num_((Inn : Inn <: numtype)), i_2 : num_((Inn : Inn <: numtype))}((Inn : Inn <: numtype), REM_binop_(sx), i_1, i_2) = lift($irem_($sizenn((Inn : Inn <: numtype)), sx, i_1, i_2)) ;; 4-numerics.watsup def $binop_{Inn : Inn, i_1 : num_((Inn : Inn <: numtype)), i_2 : num_((Inn : Inn <: numtype))}((Inn : Inn <: numtype), AND_binop_, i_1, i_2) = [$iand_($sizenn((Inn : Inn <: numtype)), i_1, i_2)] ;; 4-numerics.watsup @@ -4747,9 +4740,9 @@ def $cvtop__(numtype_1 : numtype, numtype_2 : numtype, cvtop__ : cvtop__(numtype ;; 4-numerics.watsup def $cvtop__{Inn_1 : Inn, Inn_2 : Inn, i_1 : num_((Inn_1 : Inn <: numtype))}((Inn_1 : Inn <: numtype), (Inn_2 : Inn <: numtype), WRAP_cvtop__, i_1) = [$wrap__($sizenn1((Inn_1 : Inn <: numtype)), $sizenn2((Inn_2 : Inn <: numtype)), i_1)] ;; 4-numerics.watsup - def $cvtop__{Fnn_1 : Fnn, Inn_2 : Inn, sx : sx, f_1 : num_((Fnn_1 : Fnn <: numtype))}((Fnn_1 : Fnn <: numtype), (Inn_2 : Inn <: numtype), TRUNC_cvtop__(sx), f_1) = $list_(syntax num_((Inn_2 : Inn <: numtype)), $trunc__($sizenn1((Fnn_1 : Fnn <: numtype)), $sizenn2((Inn_2 : Inn <: numtype)), sx, f_1)) + def $cvtop__{Fnn_1 : Fnn, Inn_2 : Inn, sx : sx, f_1 : num_((Fnn_1 : Fnn <: numtype))}((Fnn_1 : Fnn <: numtype), (Inn_2 : Inn <: numtype), TRUNC_cvtop__(sx), f_1) = lift($trunc__($sizenn1((Fnn_1 : Fnn <: numtype)), $sizenn2((Inn_2 : Inn <: numtype)), sx, f_1)) ;; 4-numerics.watsup - def $cvtop__{Fnn_1 : Fnn, Inn_2 : Inn, sx : sx, f_1 : num_((Fnn_1 : Fnn <: numtype))}((Fnn_1 : Fnn <: numtype), (Inn_2 : Inn <: numtype), TRUNC_SAT_cvtop__(sx), f_1) = $list_(syntax num_((Inn_2 : Inn <: numtype)), $trunc_sat__($sizenn1((Fnn_1 : Fnn <: numtype)), $sizenn2((Inn_2 : Inn <: numtype)), sx, f_1)) + def $cvtop__{Fnn_1 : Fnn, Inn_2 : Inn, sx : sx, f_1 : num_((Fnn_1 : Fnn <: numtype))}((Fnn_1 : Fnn <: numtype), (Inn_2 : Inn <: numtype), TRUNC_SAT_cvtop__(sx), f_1) = lift($trunc_sat__($sizenn1((Fnn_1 : Fnn <: numtype)), $sizenn2((Inn_2 : Inn <: numtype)), sx, f_1)) ;; 4-numerics.watsup def $cvtop__{Inn_1 : Inn, Fnn_2 : Fnn, sx : sx, i_1 : num_((Inn_1 : Inn <: numtype))}((Inn_1 : Inn <: numtype), (Fnn_2 : Fnn <: numtype), CONVERT_cvtop__(sx), i_1) = [$convert__($sizenn1((Inn_1 : Inn <: numtype)), $sizenn2((Fnn_2 : Fnn <: numtype)), sx, i_1)] ;; 4-numerics.watsup @@ -5079,10 +5072,10 @@ def $lcvtop__(shape_1 : shape, shape_2 : shape, vcvtop__ : vcvtop__(shape_1, sha def $lcvtop__{Jnn_1 : Jnn, M_1 : M, Fnn_2 : Fnn, M_2 : M, sx : sx, c_1 : lane_($lanetype(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)))), c : lane_($lanetype(`%X%`_shape((Fnn_2 : Fnn <: lanetype), `%`_dim(M_2))))}(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Fnn_2 : Fnn <: lanetype), `%`_dim(M_2)), CONVERT_vcvtop__(sx), c_1) = [c] -- if (c = $convert__($lsizenn1((Jnn_1 : Jnn <: lanetype)), $lsizenn2((Fnn_2 : Fnn <: lanetype)), sx, c_1)) ;; 4-numerics.watsup - def $lcvtop__{Fnn_1 : Fnn, M_1 : M, Inn_2 : Inn, M_2 : M, sx : sx, c_1 : lane_($lanetype(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)))), `c?` : lane_((Inn_2 : Inn <: lanetype))?}(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Inn_2 : Inn <: lanetype), `%`_dim(M_2)), TRUNC_SAT_vcvtop__(sx), c_1) = $list_(syntax lane_((Inn_2 : Inn <: lanetype)), c?{c <- `c?`}) + def $lcvtop__{Fnn_1 : Fnn, M_1 : M, Inn_2 : Inn, M_2 : M, sx : sx, c_1 : lane_($lanetype(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)))), `c?` : lane_($lanetype(`%X%`_shape((Inn_2 : Inn <: lanetype), `%`_dim(M_2))))?}(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Inn_2 : Inn <: lanetype), `%`_dim(M_2)), TRUNC_SAT_vcvtop__(sx), c_1) = lift(c?{c <- `c?`}) -- if (c?{c <- `c?`} = $trunc_sat__($lsizenn1((Fnn_1 : Fnn <: lanetype)), $lsizenn2((Inn_2 : Inn <: lanetype)), sx, c_1)) ;; 4-numerics.watsup - def $lcvtop__{Fnn_1 : Fnn, M_1 : M, Inn_2 : Inn, M_2 : M, sx : sx, c_1 : lane_($lanetype(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)))), `c?` : lane_((Inn_2 : Inn <: lanetype))?}(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Inn_2 : Inn <: lanetype), `%`_dim(M_2)), RELAXED_TRUNC_vcvtop__(sx), c_1) = $list_(syntax lane_((Inn_2 : Inn <: lanetype)), c?{c <- `c?`}) + def $lcvtop__{Fnn_1 : Fnn, M_1 : M, Inn_2 : Inn, M_2 : M, sx : sx, c_1 : lane_($lanetype(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)))), `c?` : lane_($lanetype(`%X%`_shape((Inn_2 : Inn <: lanetype), `%`_dim(M_2))))?}(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Inn_2 : Inn <: lanetype), `%`_dim(M_2)), RELAXED_TRUNC_vcvtop__(sx), c_1) = lift(c?{c <- `c?`}) -- if (c?{c <- `c?`} = $relaxed_trunc__($lsizenn1((Fnn_1 : Fnn <: lanetype)), $lsizenn2((Inn_2 : Inn <: lanetype)), sx, c_1)) ;; 4-numerics.watsup def $lcvtop__{Fnn_1 : Fnn, M_1 : M, Fnn_2 : Fnn, M_2 : M, c_1 : lane_($lanetype(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)))), `c*` : lane_($lanetype(`%X%`_shape((Fnn_2 : Fnn <: lanetype), `%`_dim(M_2))))*}(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Fnn_2 : Fnn <: lanetype), `%`_dim(M_2)), DEMOTE_vcvtop__, c_1) = c*{c <- `c*`} @@ -6739,132 +6732,132 @@ relation Step: `%~>%`(config, config) `%~>%`(`%;%`_config(`%;%`_state(s, f), [`FRAME_%{%}%`_instr(n, f', instr*{instr <- `instr*`})]), `%;%`_config(`%;%`_state(s', f), [`FRAME_%{%}%`_instr(n, f', instr'*{instr' <- `instr'*`})])) -- Step: `%~>%`(`%;%`_config(`%;%`_state(s, f'), instr*{instr <- `instr*`}), `%;%`_config(`%;%`_state(s', f'), instr'*{instr' <- `instr'*`})) - ;; 8-reduction.watsup:227.1-232.49 + ;; 8-reduction.watsup:227.1-231.49 rule throw{z : state, `val*` : val*, n : n, x : idx, exn : exninst, a : addr, `t*` : valtype*}: `%~>%`(`%;%`_config(z, (val : val <: instr)^n{val <- `val*`} ++ [THROW_instr(x)]), `%;%`_config($add_exninst(z, [exn]), [REF.EXN_ADDR_instr(a) THROW_REF_instr])) -- Expand: `%~~%`($tag(z, x).TYPE_taginst, FUNC_comptype(`%->%`_functype(`%`_resulttype(t^n{t <- `t*`}), `%`_resulttype([])))) -- if (a = |$exninst(z)|) -- if (exn = {TAG $tagaddr(z)[x!`%`_idx.0], FIELDS val^n{val <- `val*`}}) - ;; 8-reduction.watsup:407.1-411.65 + ;; 8-reduction.watsup:406.1-410.65 rule struct.new{z : state, `val*` : val*, n : n, x : idx, si : structinst, a : addr, `mut*` : mut*, `zt*` : storagetype*}: `%~>%`(`%;%`_config(z, (val : val <: instr)^n{val <- `val*`} ++ [STRUCT.NEW_instr(x)]), `%;%`_config($add_structinst(z, [si]), [REF.STRUCT_ADDR_instr(a)])) -- Expand: `%~~%`($type(z, x), STRUCT_comptype(`%`_structtype(`%%`_fieldtype(mut, zt)^n{mut <- `mut*`, zt <- `zt*`}))) -- if (a = |$structinst(z)|) -- if (si = {TYPE $type(z, x), FIELDS $packfield_(zt, val)^n{val <- `val*`, zt <- `zt*`}}) - ;; 8-reduction.watsup:427.1-428.53 + ;; 8-reduction.watsup:426.1-427.53 rule `struct.set-null`{z : state, ht : heaptype, val : val, x : idx, i : u32}: `%~>%`(`%;%`_config(z, [REF.NULL_instr(ht) (val : val <: instr) STRUCT.SET_instr(x, i)]), `%;%`_config(z, [TRAP_instr])) - ;; 8-reduction.watsup:430.1-432.45 + ;; 8-reduction.watsup:429.1-431.45 rule `struct.set-struct`{z : state, a : addr, val : val, x : idx, i : u32, `zt*` : storagetype*, `mut*` : mut*}: `%~>%`(`%;%`_config(z, [REF.STRUCT_ADDR_instr(a) (val : val <: instr) STRUCT.SET_instr(x, i)]), `%;%`_config($with_struct(z, a, i!`%`_u32.0, $packfield_(zt*{zt <- `zt*`}[i!`%`_u32.0], val)), [])) -- Expand: `%~~%`($type(z, x), STRUCT_comptype(`%`_structtype(`%%`_fieldtype(mut, zt)*{mut <- `mut*`, zt <- `zt*`}))) - ;; 8-reduction.watsup:445.1-450.65 + ;; 8-reduction.watsup:444.1-449.65 rule array.new_fixed{z : state, `val*` : val*, n : n, x : idx, ai : arrayinst, a : addr, mut : mut, zt : storagetype}: `%~>%`(`%;%`_config(z, (val : val <: instr)^n{val <- `val*`} ++ [ARRAY.NEW_FIXED_instr(x, `%`_u32(n))]), `%;%`_config($add_arrayinst(z, [ai]), [REF.ARRAY_ADDR_instr(a)])) -- Expand: `%~~%`($type(z, x), ARRAY_comptype(`%%`_arraytype(mut, zt))) -- if ((a = |$arrayinst(z)|) /\ (ai = {TYPE $type(z, x), FIELDS $packfield_(zt, val)^n{val <- `val*`}})) - ;; 8-reduction.watsup:490.1-491.64 + ;; 8-reduction.watsup:489.1-490.64 rule `array.set-null`{z : state, ht : heaptype, i : num_(I32_numtype), val : val, x : idx}: `%~>%`(`%;%`_config(z, [REF.NULL_instr(ht) CONST_instr(I32_numtype, i) (val : val <: instr) ARRAY.SET_instr(x)]), `%;%`_config(z, [TRAP_instr])) - ;; 8-reduction.watsup:493.1-495.39 + ;; 8-reduction.watsup:492.1-494.39 rule `array.set-oob`{z : state, a : addr, i : num_(I32_numtype), val : val, x : idx}: `%~>%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) (val : val <: instr) ARRAY.SET_instr(x)]), `%;%`_config(z, [TRAP_instr])) -- if (i!`%`_num_.0 >= |$arrayinst(z)[a].FIELDS_arrayinst|) - ;; 8-reduction.watsup:497.1-500.43 + ;; 8-reduction.watsup:496.1-499.43 rule `array.set-array`{z : state, a : addr, i : num_(I32_numtype), val : val, x : idx, zt : storagetype, mut : mut}: `%~>%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) (val : val <: instr) ARRAY.SET_instr(x)]), `%;%`_config($with_array(z, a, i!`%`_num_.0, $packfield_(zt, val)), [])) -- Expand: `%~~%`($type(z, x), ARRAY_comptype(`%%`_arraytype(mut, zt))) - ;; 8-reduction.watsup:779.1-780.56 + ;; 8-reduction.watsup:778.1-779.56 rule local.set{z : state, val : val, x : idx}: `%~>%`(`%;%`_config(z, [(val : val <: instr) LOCAL.SET_instr(x)]), `%;%`_config($with_local(z, x, val), [])) - ;; 8-reduction.watsup:792.1-793.58 + ;; 8-reduction.watsup:791.1-792.58 rule global.set{z : state, val : val, x : idx}: `%~>%`(`%;%`_config(z, [(val : val <: instr) GLOBAL.SET_instr(x)]), `%;%`_config($with_global(z, x, val), [])) - ;; 8-reduction.watsup:806.1-808.33 + ;; 8-reduction.watsup:805.1-807.33 rule `table.set-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), ref : ref, x : idx}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) (ref : ref <: instr) TABLE.SET_instr(x)]), `%;%`_config(z, [TRAP_instr])) -- if (i!`%`_num_.0 >= |$table(z, x).REFS_tableinst|) - ;; 8-reduction.watsup:810.1-812.32 + ;; 8-reduction.watsup:809.1-811.32 rule `table.set-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), ref : ref, x : idx}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) (ref : ref <: instr) TABLE.SET_instr(x)]), `%;%`_config($with_table(z, x, i!`%`_num_.0, ref), [])) -- if (i!`%`_num_.0 < |$table(z, x).REFS_tableinst|) - ;; 8-reduction.watsup:821.1-824.46 + ;; 8-reduction.watsup:820.1-823.46 rule `table.grow-succeed`{z : state, ref : ref, at : addrtype, n : n, x : idx, ti : tableinst}: `%~>%`(`%;%`_config(z, [(ref : ref <: instr) CONST_instr((at : addrtype <: numtype), `%`_num_(n)) TABLE.GROW_instr(x)]), `%;%`_config($with_tableinst(z, x, ti), [CONST_instr((at : addrtype <: numtype), `%`_num_(|$table(z, x).REFS_tableinst|))])) -- if (ti = $growtable($table(z, x), n, ref)) - ;; 8-reduction.watsup:826.1-827.86 + ;; 8-reduction.watsup:825.1-826.86 rule `table.grow-fail`{z : state, ref : ref, at : addrtype, n : n, x : idx}: `%~>%`(`%;%`_config(z, [(ref : ref <: instr) CONST_instr((at : addrtype <: numtype), `%`_num_(n)) TABLE.GROW_instr(x)]), `%;%`_config(z, [CONST_instr((at : addrtype <: numtype), `%`_num_($invsigned_($size((at : addrtype <: numtype)), - (1 : nat <:> int))))])) - ;; 8-reduction.watsup:887.1-888.51 + ;; 8-reduction.watsup:886.1-887.51 rule elem.drop{z : state, x : idx}: `%~>%`(`%;%`_config(z, [ELEM.DROP_instr(x)]), `%;%`_config($with_elem(z, x, []), [])) - ;; 8-reduction.watsup:971.1-974.60 + ;; 8-reduction.watsup:970.1-973.60 rule `store-num-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), nt : numtype, c : num_(nt), x : idx, ao : memarg}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr(nt, c) STORE_instr(nt, ?(), x, ao)]), `%;%`_config(z, [TRAP_instr])) -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + ((($size(nt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) - ;; 8-reduction.watsup:976.1-980.29 + ;; 8-reduction.watsup:975.1-979.29 rule `store-num-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), nt : numtype, c : num_(nt), x : idx, ao : memarg, `b*` : byte*}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr(nt, c) STORE_instr(nt, ?(), x, ao)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0), ((($size(nt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) -- if (b*{b <- `b*`} = $nbytes_(nt, c)) - ;; 8-reduction.watsup:982.1-985.52 + ;; 8-reduction.watsup:981.1-984.52 rule `store-pack-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), Inn : Inn, c : num_((Inn : Inn <: numtype)), n : n, x : idx, ao : memarg}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr((Inn : Inn <: numtype), c) STORE_instr((Inn : Inn <: numtype), ?(`%`_storeop_(`%`_sz(n))), x, ao)]), `%;%`_config(z, [TRAP_instr])) -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + (((n : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) - ;; 8-reduction.watsup:987.1-991.52 + ;; 8-reduction.watsup:986.1-990.52 rule `store-pack-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), Inn : Inn, c : num_((Inn : Inn <: numtype)), n : n, x : idx, ao : memarg, `b*` : byte*}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr((Inn : Inn <: numtype), c) STORE_instr((Inn : Inn <: numtype), ?(`%`_storeop_(`%`_sz(n))), x, ao)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0), (((n : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) -- if (b*{b <- `b*`} = $ibytes_(n, $wrap__($size((Inn : Inn <: numtype)), n, c))) - ;; 8-reduction.watsup:993.1-995.63 + ;; 8-reduction.watsup:992.1-994.63 rule `vstore-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c : vec_(V128_Vnn), x : idx, ao : memarg}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_instr(V128_vectype, x, ao)]), `%;%`_config(z, [TRAP_instr])) -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + ((($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) - ;; 8-reduction.watsup:997.1-999.31 + ;; 8-reduction.watsup:996.1-998.31 rule `vstore-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c : vec_(V128_Vnn), x : idx, ao : memarg, `b*` : byte*}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_instr(V128_vectype, x, ao)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0), ((($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) -- if (b*{b <- `b*`} = $vbytes_(V128_vectype, c)) - ;; 8-reduction.watsup:1002.1-1004.50 + ;; 8-reduction.watsup:1001.1-1003.50 rule `vstore_lane-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c : vec_(V128_Vnn), N : N, x : idx, ao : memarg, j : laneidx}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_LANE_instr(V128_vectype, `%`_sz(N), x, ao, j)]), `%;%`_config(z, [TRAP_instr])) -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + N) > |$mem(z, x).BYTES_meminst|) - ;; 8-reduction.watsup:1006.1-1010.49 + ;; 8-reduction.watsup:1005.1-1009.49 rule `vstore_lane-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c : vec_(V128_Vnn), N : N, x : idx, ao : memarg, j : laneidx, `b*` : byte*, Jnn : Jnn, M : M}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_LANE_instr(V128_vectype, `%`_sz(N), x, ao, j)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0), (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) -- if (N = $lsize((Jnn : Jnn <: lanetype))) -- if ((M : nat <:> rat) = ((128 : nat <:> rat) / (N : nat <:> rat))) -- if (b*{b <- `b*`} = $ibytes_(N, `%`_iN($lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), c)[j!`%`_laneidx.0]!`%`_lane_.0))) - ;; 8-reduction.watsup:1019.1-1022.37 + ;; 8-reduction.watsup:1018.1-1021.37 rule `memory.grow-succeed`{z : state, at : addrtype, n : n, x : idx, mi : meminst}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), `%`_num_(n)) MEMORY.GROW_instr(x)]), `%;%`_config($with_meminst(z, x, mi), [CONST_instr((at : addrtype <: numtype), `%`_num_((((|$mem(z, x).BYTES_meminst| : nat <:> rat) / ((64 * $Ki) : nat <:> rat)) : rat <:> nat)))])) -- if (mi = $growmem($mem(z, x), n)) - ;; 8-reduction.watsup:1024.1-1025.83 + ;; 8-reduction.watsup:1023.1-1024.83 rule `memory.grow-fail`{z : state, at : addrtype, n : n, x : idx}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), `%`_num_(n)) MEMORY.GROW_instr(x)]), `%;%`_config(z, [CONST_instr((at : addrtype <: numtype), `%`_num_($invsigned_($size((at : addrtype <: numtype)), - (1 : nat <:> int))))])) - ;; 8-reduction.watsup:1085.1-1086.51 + ;; 8-reduction.watsup:1084.1-1085.51 rule data.drop{z : state, x : idx}: `%~>%`(`%;%`_config(z, [DATA.DROP_instr(x)]), `%;%`_config($with_data(z, x, []), [])) } @@ -8927,57 +8920,50 @@ def $opt_(syntax X, X*) : X? ;; 0-aux.watsup def $opt_{syntax X, w : X}(syntax X, [w]) = ?(w) -;; 0-aux.watsup -def $list_(syntax X, X?) : X* - ;; 0-aux.watsup - def $list_{syntax X}(syntax X, ?()) = [] - ;; 0-aux.watsup - def $list_{syntax X, w : X}(syntax X, ?(w)) = [w] - ;; 0-aux.watsup rec { -;; 0-aux.watsup:40.1-40.55 +;; 0-aux.watsup:35.1-35.55 def $concat_(syntax X, X**) : X* - ;; 0-aux.watsup:41.1-41.34 + ;; 0-aux.watsup:36.1-36.34 def $concat_{syntax X}(syntax X, []) = [] - ;; 0-aux.watsup:42.1-42.64 + ;; 0-aux.watsup:37.1-37.64 def $concat_{syntax X, `w*` : X*, `w'**` : X**}(syntax X, [w*{w <- `w*`}] ++ w'*{w' <- `w'*`}*{`w'*` <- `w'**`}) = w*{w <- `w*`} ++ $concat_(syntax X, w'*{w' <- `w'*`}*{`w'*` <- `w'**`}) } ;; 0-aux.watsup rec { -;; 0-aux.watsup:44.1-44.61 +;; 0-aux.watsup:39.1-39.61 def $concatn_(syntax X, X**, nat : nat) : X* - ;; 0-aux.watsup:45.1-45.38 + ;; 0-aux.watsup:40.1-40.38 def $concatn_{syntax X, n : n}(syntax X, [], n) = [] - ;; 0-aux.watsup:46.1-46.73 + ;; 0-aux.watsup:41.1-41.73 def $concatn_{syntax X, `w*` : X*, n : n, `w'**` : X**}(syntax X, [w^n{w <- `w*`}] ++ w'^n{w' <- `w'*`}*{`w'*` <- `w'**`}, n) = w^n{w <- `w*`} ++ $concatn_(syntax X, w'^n{w' <- `w'*`}*{`w'*` <- `w'**`}, n) } ;; 0-aux.watsup rec { -;; 0-aux.watsup:51.1-51.78 +;; 0-aux.watsup:46.1-46.78 def $disjoint_(syntax X, X*) : bool - ;; 0-aux.watsup:52.1-52.37 + ;; 0-aux.watsup:47.1-47.37 def $disjoint_{syntax X}(syntax X, []) = true - ;; 0-aux.watsup:53.1-53.68 + ;; 0-aux.watsup:48.1-48.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'*`})) } ;; 0-aux.watsup rec { -;; 0-aux.watsup:56.1-56.38 +;; 0-aux.watsup:51.1-51.38 def $setminus1_(syntax X, X : X, X*) : X* - ;; 0-aux.watsup:60.1-60.38 + ;; 0-aux.watsup:55.1-55.38 def $setminus1_{syntax X, w : X}(syntax X, w, []) = [w] - ;; 0-aux.watsup:61.1-61.78 + ;; 0-aux.watsup:56.1-56.78 def $setminus1_{syntax X, w : X, w_1 : X, `w'*` : X*}(syntax X, w, [w_1] ++ w'*{w' <- `w'*`}) = [] -- if (w = w_1) - ;; 0-aux.watsup:62.1-62.77 + ;; 0-aux.watsup:57.1-57.77 def $setminus1_{syntax X, w : X, w_1 : X, `w'*` : X*}(syntax X, w, [w_1] ++ w'*{w' <- `w'*`}) = $setminus1_(syntax X, w, w'*{w' <- `w'*`}) -- otherwise } @@ -8985,44 +8971,44 @@ def $setminus1_(syntax X, X : X, X*) : X* ;; 0-aux.watsup rec { -;; 0-aux.watsup:55.1-55.56 +;; 0-aux.watsup:50.1-50.56 def $setminus_(syntax X, X*, X*) : X* - ;; 0-aux.watsup:58.1-58.40 + ;; 0-aux.watsup:53.1-53.40 def $setminus_{syntax X, `w*` : X*}(syntax X, [], w*{w <- `w*`}) = [] - ;; 0-aux.watsup:59.1-59.90 + ;; 0-aux.watsup:54.1-54.90 def $setminus_{syntax X, w_1 : X, `w'*` : X*, `w*` : X*}(syntax X, [w_1] ++ w'*{w' <- `w'*`}, w*{w <- `w*`}) = $setminus1_(syntax X, w_1, w*{w <- `w*`}) ++ $setminus_(syntax X, w'*{w' <- `w'*`}, w*{w <- `w*`}) } ;; 0-aux.watsup rec { -;; 0-aux.watsup:67.1-67.46 +;; 0-aux.watsup:62.1-62.46 def $setproduct2_(syntax X, X : X, X**) : X** - ;; 0-aux.watsup:73.1-73.44 + ;; 0-aux.watsup:68.1-68.44 def $setproduct2_{syntax X, w_1 : X}(syntax X, w_1, []) = [] - ;; 0-aux.watsup:74.1-74.90 + ;; 0-aux.watsup:69.1-69.90 def $setproduct2_{syntax X, w_1 : X, `w'*` : X*, `w**` : X**}(syntax X, w_1, [w'*{w' <- `w'*`}] ++ w*{w <- `w*`}*{`w*` <- `w**`}) = [[w_1] ++ w'*{w' <- `w'*`}] ++ $setproduct2_(syntax X, w_1, w*{w <- `w*`}*{`w*` <- `w**`}) } ;; 0-aux.watsup rec { -;; 0-aux.watsup:66.1-66.47 +;; 0-aux.watsup:61.1-61.47 def $setproduct1_(syntax X, X*, X**) : X** - ;; 0-aux.watsup:71.1-71.46 + ;; 0-aux.watsup:66.1-66.46 def $setproduct1_{syntax X, `w**` : X**}(syntax X, [], w*{w <- `w*`}*{`w*` <- `w**`}) = [] - ;; 0-aux.watsup:72.1-72.107 + ;; 0-aux.watsup:67.1-67.107 def $setproduct1_{syntax X, w_1 : X, `w'*` : X*, `w**` : X**}(syntax X, [w_1] ++ w'*{w' <- `w'*`}, w*{w <- `w*`}*{`w*` <- `w**`}) = $setproduct2_(syntax X, w_1, w*{w <- `w*`}*{`w*` <- `w**`}) ++ $setproduct1_(syntax X, w'*{w' <- `w'*`}, w*{w <- `w*`}*{`w*` <- `w**`}) } ;; 0-aux.watsup rec { -;; 0-aux.watsup:65.1-65.82 +;; 0-aux.watsup:60.1-60.82 def $setproduct_(syntax X, X**) : X** - ;; 0-aux.watsup:69.1-69.40 + ;; 0-aux.watsup:64.1-64.40 def $setproduct_{syntax X}(syntax X, []) = [[]] - ;; 0-aux.watsup:70.1-70.90 + ;; 0-aux.watsup:65.1-65.90 def $setproduct_{syntax X, `w_1*` : X*, `w**` : X**}(syntax X, [w_1*{w_1 <- `w_1*`}] ++ w*{w <- `w*`}*{`w*` <- `w**`}) = $setproduct1_(syntax X, w_1*{w_1 <- `w_1*`}, $setproduct_(syntax X, w*{w <- `w*`}*{`w*` <- `w**`})) } @@ -10191,7 +10177,7 @@ syntax frame = ;; 5-runtime.watsup rec { -;; 5-runtime.watsup:156.1-162.9 +;; 5-runtime.watsup:157.1-163.9 syntax instr = | NOP | UNREACHABLE @@ -13536,9 +13522,9 @@ def $binop_(numtype : numtype, binop_ : binop_(numtype), num_ : num_(numtype), n ;; 4-numerics.watsup def $binop_{Inn : Inn, i_1 : num_((Inn : Inn <: numtype)), i_2 : num_((Inn : Inn <: numtype))}((Inn : Inn <: numtype), MUL_binop_, i_1, i_2) = [$imul_($sizenn((Inn : Inn <: numtype)), i_1, i_2)] ;; 4-numerics.watsup - def $binop_{Inn : Inn, sx : sx, i_1 : num_((Inn : Inn <: numtype)), i_2 : num_((Inn : Inn <: numtype))}((Inn : Inn <: numtype), DIV_binop_(sx), i_1, i_2) = $list_(syntax num_((Inn : Inn <: numtype)), $idiv_($sizenn((Inn : Inn <: numtype)), sx, i_1, i_2)) + def $binop_{Inn : Inn, sx : sx, i_1 : num_((Inn : Inn <: numtype)), i_2 : num_((Inn : Inn <: numtype))}((Inn : Inn <: numtype), DIV_binop_(sx), i_1, i_2) = lift($idiv_($sizenn((Inn : Inn <: numtype)), sx, i_1, i_2)) ;; 4-numerics.watsup - def $binop_{Inn : Inn, sx : sx, i_1 : num_((Inn : Inn <: numtype)), i_2 : num_((Inn : Inn <: numtype))}((Inn : Inn <: numtype), REM_binop_(sx), i_1, i_2) = $list_(syntax num_((Inn : Inn <: numtype)), $irem_($sizenn((Inn : Inn <: numtype)), sx, i_1, i_2)) + def $binop_{Inn : Inn, sx : sx, i_1 : num_((Inn : Inn <: numtype)), i_2 : num_((Inn : Inn <: numtype))}((Inn : Inn <: numtype), REM_binop_(sx), i_1, i_2) = lift($irem_($sizenn((Inn : Inn <: numtype)), sx, i_1, i_2)) ;; 4-numerics.watsup def $binop_{Inn : Inn, i_1 : num_((Inn : Inn <: numtype)), i_2 : num_((Inn : Inn <: numtype))}((Inn : Inn <: numtype), AND_binop_, i_1, i_2) = [$iand_($sizenn((Inn : Inn <: numtype)), i_1, i_2)] ;; 4-numerics.watsup @@ -13607,9 +13593,9 @@ def $cvtop__(numtype_1 : numtype, numtype_2 : numtype, cvtop__ : cvtop__(numtype ;; 4-numerics.watsup def $cvtop__{Inn_1 : Inn, Inn_2 : Inn, i_1 : num_((Inn_1 : Inn <: numtype))}((Inn_1 : Inn <: numtype), (Inn_2 : Inn <: numtype), WRAP_cvtop__, i_1) = [$wrap__($sizenn1((Inn_1 : Inn <: numtype)), $sizenn2((Inn_2 : Inn <: numtype)), i_1)] ;; 4-numerics.watsup - def $cvtop__{Fnn_1 : Fnn, Inn_2 : Inn, sx : sx, f_1 : num_((Fnn_1 : Fnn <: numtype))}((Fnn_1 : Fnn <: numtype), (Inn_2 : Inn <: numtype), TRUNC_cvtop__(sx), f_1) = $list_(syntax num_((Inn_2 : Inn <: numtype)), $trunc__($sizenn1((Fnn_1 : Fnn <: numtype)), $sizenn2((Inn_2 : Inn <: numtype)), sx, f_1)) + def $cvtop__{Fnn_1 : Fnn, Inn_2 : Inn, sx : sx, f_1 : num_((Fnn_1 : Fnn <: numtype))}((Fnn_1 : Fnn <: numtype), (Inn_2 : Inn <: numtype), TRUNC_cvtop__(sx), f_1) = lift($trunc__($sizenn1((Fnn_1 : Fnn <: numtype)), $sizenn2((Inn_2 : Inn <: numtype)), sx, f_1)) ;; 4-numerics.watsup - def $cvtop__{Fnn_1 : Fnn, Inn_2 : Inn, sx : sx, f_1 : num_((Fnn_1 : Fnn <: numtype))}((Fnn_1 : Fnn <: numtype), (Inn_2 : Inn <: numtype), TRUNC_SAT_cvtop__(sx), f_1) = $list_(syntax num_((Inn_2 : Inn <: numtype)), $trunc_sat__($sizenn1((Fnn_1 : Fnn <: numtype)), $sizenn2((Inn_2 : Inn <: numtype)), sx, f_1)) + def $cvtop__{Fnn_1 : Fnn, Inn_2 : Inn, sx : sx, f_1 : num_((Fnn_1 : Fnn <: numtype))}((Fnn_1 : Fnn <: numtype), (Inn_2 : Inn <: numtype), TRUNC_SAT_cvtop__(sx), f_1) = lift($trunc_sat__($sizenn1((Fnn_1 : Fnn <: numtype)), $sizenn2((Inn_2 : Inn <: numtype)), sx, f_1)) ;; 4-numerics.watsup def $cvtop__{Inn_1 : Inn, Fnn_2 : Fnn, sx : sx, i_1 : num_((Inn_1 : Inn <: numtype))}((Inn_1 : Inn <: numtype), (Fnn_2 : Fnn <: numtype), CONVERT_cvtop__(sx), i_1) = [$convert__($sizenn1((Inn_1 : Inn <: numtype)), $sizenn2((Fnn_2 : Fnn <: numtype)), sx, i_1)] ;; 4-numerics.watsup @@ -13939,10 +13925,10 @@ def $lcvtop__(shape_1 : shape, shape_2 : shape, vcvtop__ : vcvtop__(shape_1, sha def $lcvtop__{Jnn_1 : Jnn, M_1 : M, Fnn_2 : Fnn, M_2 : M, sx : sx, c_1 : lane_($lanetype(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)))), c : lane_($lanetype(`%X%`_shape((Fnn_2 : Fnn <: lanetype), `%`_dim(M_2))))}(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Fnn_2 : Fnn <: lanetype), `%`_dim(M_2)), CONVERT_vcvtop__(sx), c_1) = [c] -- if (c = $convert__($lsizenn1((Jnn_1 : Jnn <: lanetype)), $lsizenn2((Fnn_2 : Fnn <: lanetype)), sx, c_1)) ;; 4-numerics.watsup - def $lcvtop__{Fnn_1 : Fnn, M_1 : M, Inn_2 : Inn, M_2 : M, sx : sx, c_1 : lane_($lanetype(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)))), `c?` : lane_((Inn_2 : Inn <: lanetype))?}(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Inn_2 : Inn <: lanetype), `%`_dim(M_2)), TRUNC_SAT_vcvtop__(sx), c_1) = $list_(syntax lane_((Inn_2 : Inn <: lanetype)), c?{c <- `c?`}) + def $lcvtop__{Fnn_1 : Fnn, M_1 : M, Inn_2 : Inn, M_2 : M, sx : sx, c_1 : lane_($lanetype(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)))), `c?` : lane_($lanetype(`%X%`_shape((Inn_2 : Inn <: lanetype), `%`_dim(M_2))))?}(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Inn_2 : Inn <: lanetype), `%`_dim(M_2)), TRUNC_SAT_vcvtop__(sx), c_1) = lift(c?{c <- `c?`}) -- if (c?{c <- `c?`} = $trunc_sat__($lsizenn1((Fnn_1 : Fnn <: lanetype)), $lsizenn2((Inn_2 : Inn <: lanetype)), sx, c_1)) ;; 4-numerics.watsup - def $lcvtop__{Fnn_1 : Fnn, M_1 : M, Inn_2 : Inn, M_2 : M, sx : sx, c_1 : lane_($lanetype(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)))), `c?` : lane_((Inn_2 : Inn <: lanetype))?}(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Inn_2 : Inn <: lanetype), `%`_dim(M_2)), RELAXED_TRUNC_vcvtop__(sx), c_1) = $list_(syntax lane_((Inn_2 : Inn <: lanetype)), c?{c <- `c?`}) + def $lcvtop__{Fnn_1 : Fnn, M_1 : M, Inn_2 : Inn, M_2 : M, sx : sx, c_1 : lane_($lanetype(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)))), `c?` : lane_($lanetype(`%X%`_shape((Inn_2 : Inn <: lanetype), `%`_dim(M_2))))?}(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Inn_2 : Inn <: lanetype), `%`_dim(M_2)), RELAXED_TRUNC_vcvtop__(sx), c_1) = lift(c?{c <- `c?`}) -- if (c?{c <- `c?`} = $relaxed_trunc__($lsizenn1((Fnn_1 : Fnn <: lanetype)), $lsizenn2((Inn_2 : Inn <: lanetype)), sx, c_1)) ;; 4-numerics.watsup def $lcvtop__{Fnn_1 : Fnn, M_1 : M, Fnn_2 : Fnn, M_2 : M, c_1 : lane_($lanetype(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)))), `c*` : lane_($lanetype(`%X%`_shape((Fnn_2 : Fnn <: lanetype), `%`_dim(M_2))))*}(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Fnn_2 : Fnn <: lanetype), `%`_dim(M_2)), DEMOTE_vcvtop__, c_1) = c*{c <- `c*`} @@ -15601,132 +15587,132 @@ relation Step: `%~>%`(config, config) `%~>%`(`%;%`_config(`%;%`_state(s, f), [`FRAME_%{%}%`_instr(n, f', instr*{instr <- `instr*`})]), `%;%`_config(`%;%`_state(s', f), [`FRAME_%{%}%`_instr(n, f', instr'*{instr' <- `instr'*`})])) -- Step: `%~>%`(`%;%`_config(`%;%`_state(s, f'), instr*{instr <- `instr*`}), `%;%`_config(`%;%`_state(s', f'), instr'*{instr' <- `instr'*`})) - ;; 8-reduction.watsup:227.1-232.49 + ;; 8-reduction.watsup:227.1-231.49 rule throw{z : state, `val*` : val*, n : n, x : idx, exn : exninst, a : addr, `t*` : valtype*}: `%~>%`(`%;%`_config(z, (val : val <: instr)^n{val <- `val*`} ++ [THROW_instr(x)]), `%;%`_config($add_exninst(z, [exn]), [REF.EXN_ADDR_instr(a) THROW_REF_instr])) -- Expand: `%~~%`($tag(z, x).TYPE_taginst, FUNC_comptype(`%->%`_functype(`%`_resulttype(t^n{t <- `t*`}), `%`_resulttype([])))) -- if (a = |$exninst(z)|) -- if (exn = {TAG $tagaddr(z)[x!`%`_idx.0], FIELDS val^n{val <- `val*`}}) - ;; 8-reduction.watsup:407.1-411.65 + ;; 8-reduction.watsup:406.1-410.65 rule struct.new{z : state, `val*` : val*, n : n, x : idx, si : structinst, a : addr, `mut*` : mut*, `zt*` : storagetype*}: `%~>%`(`%;%`_config(z, (val : val <: instr)^n{val <- `val*`} ++ [STRUCT.NEW_instr(x)]), `%;%`_config($add_structinst(z, [si]), [REF.STRUCT_ADDR_instr(a)])) -- Expand: `%~~%`($type(z, x), STRUCT_comptype(`%`_structtype(`%%`_fieldtype(mut, zt)^n{mut <- `mut*`, zt <- `zt*`}))) -- if (a = |$structinst(z)|) -- if (si = {TYPE $type(z, x), FIELDS $packfield_(zt, val)^n{val <- `val*`, zt <- `zt*`}}) - ;; 8-reduction.watsup:427.1-428.53 + ;; 8-reduction.watsup:426.1-427.53 rule `struct.set-null`{z : state, ht : heaptype, val : val, x : idx, i : u32}: `%~>%`(`%;%`_config(z, [REF.NULL_instr(ht) (val : val <: instr) STRUCT.SET_instr(x, i)]), `%;%`_config(z, [TRAP_instr])) - ;; 8-reduction.watsup:430.1-432.45 + ;; 8-reduction.watsup:429.1-431.45 rule `struct.set-struct`{z : state, a : addr, val : val, x : idx, i : u32, `zt*` : storagetype*, `mut*` : mut*}: `%~>%`(`%;%`_config(z, [REF.STRUCT_ADDR_instr(a) (val : val <: instr) STRUCT.SET_instr(x, i)]), `%;%`_config($with_struct(z, a, i!`%`_u32.0, $packfield_(zt*{zt <- `zt*`}[i!`%`_u32.0], val)), [])) -- Expand: `%~~%`($type(z, x), STRUCT_comptype(`%`_structtype(`%%`_fieldtype(mut, zt)*{mut <- `mut*`, zt <- `zt*`}))) - ;; 8-reduction.watsup:445.1-450.65 + ;; 8-reduction.watsup:444.1-449.65 rule array.new_fixed{z : state, `val*` : val*, n : n, x : idx, ai : arrayinst, a : addr, mut : mut, zt : storagetype}: `%~>%`(`%;%`_config(z, (val : val <: instr)^n{val <- `val*`} ++ [ARRAY.NEW_FIXED_instr(x, `%`_u32(n))]), `%;%`_config($add_arrayinst(z, [ai]), [REF.ARRAY_ADDR_instr(a)])) -- Expand: `%~~%`($type(z, x), ARRAY_comptype(`%%`_arraytype(mut, zt))) -- if ((a = |$arrayinst(z)|) /\ (ai = {TYPE $type(z, x), FIELDS $packfield_(zt, val)^n{val <- `val*`}})) - ;; 8-reduction.watsup:490.1-491.64 + ;; 8-reduction.watsup:489.1-490.64 rule `array.set-null`{z : state, ht : heaptype, i : num_(I32_numtype), val : val, x : idx}: `%~>%`(`%;%`_config(z, [REF.NULL_instr(ht) CONST_instr(I32_numtype, i) (val : val <: instr) ARRAY.SET_instr(x)]), `%;%`_config(z, [TRAP_instr])) - ;; 8-reduction.watsup:493.1-495.39 + ;; 8-reduction.watsup:492.1-494.39 rule `array.set-oob`{z : state, a : addr, i : num_(I32_numtype), val : val, x : idx}: `%~>%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) (val : val <: instr) ARRAY.SET_instr(x)]), `%;%`_config(z, [TRAP_instr])) -- if (i!`%`_num_.0 >= |$arrayinst(z)[a].FIELDS_arrayinst|) - ;; 8-reduction.watsup:497.1-500.43 + ;; 8-reduction.watsup:496.1-499.43 rule `array.set-array`{z : state, a : addr, i : num_(I32_numtype), val : val, x : idx, zt : storagetype, mut : mut}: `%~>%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) (val : val <: instr) ARRAY.SET_instr(x)]), `%;%`_config($with_array(z, a, i!`%`_num_.0, $packfield_(zt, val)), [])) -- Expand: `%~~%`($type(z, x), ARRAY_comptype(`%%`_arraytype(mut, zt))) - ;; 8-reduction.watsup:779.1-780.56 + ;; 8-reduction.watsup:778.1-779.56 rule local.set{z : state, val : val, x : idx}: `%~>%`(`%;%`_config(z, [(val : val <: instr) LOCAL.SET_instr(x)]), `%;%`_config($with_local(z, x, val), [])) - ;; 8-reduction.watsup:792.1-793.58 + ;; 8-reduction.watsup:791.1-792.58 rule global.set{z : state, val : val, x : idx}: `%~>%`(`%;%`_config(z, [(val : val <: instr) GLOBAL.SET_instr(x)]), `%;%`_config($with_global(z, x, val), [])) - ;; 8-reduction.watsup:806.1-808.33 + ;; 8-reduction.watsup:805.1-807.33 rule `table.set-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), ref : ref, x : idx}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) (ref : ref <: instr) TABLE.SET_instr(x)]), `%;%`_config(z, [TRAP_instr])) -- if (i!`%`_num_.0 >= |$table(z, x).REFS_tableinst|) - ;; 8-reduction.watsup:810.1-812.32 + ;; 8-reduction.watsup:809.1-811.32 rule `table.set-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), ref : ref, x : idx}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) (ref : ref <: instr) TABLE.SET_instr(x)]), `%;%`_config($with_table(z, x, i!`%`_num_.0, ref), [])) -- if (i!`%`_num_.0 < |$table(z, x).REFS_tableinst|) - ;; 8-reduction.watsup:821.1-824.46 + ;; 8-reduction.watsup:820.1-823.46 rule `table.grow-succeed`{z : state, ref : ref, at : addrtype, n : n, x : idx, ti : tableinst}: `%~>%`(`%;%`_config(z, [(ref : ref <: instr) CONST_instr((at : addrtype <: numtype), `%`_num_(n)) TABLE.GROW_instr(x)]), `%;%`_config($with_tableinst(z, x, ti), [CONST_instr((at : addrtype <: numtype), `%`_num_(|$table(z, x).REFS_tableinst|))])) -- if (ti = !($growtable($table(z, x), n, ref))) - ;; 8-reduction.watsup:826.1-827.86 + ;; 8-reduction.watsup:825.1-826.86 rule `table.grow-fail`{z : state, ref : ref, at : addrtype, n : n, x : idx}: `%~>%`(`%;%`_config(z, [(ref : ref <: instr) CONST_instr((at : addrtype <: numtype), `%`_num_(n)) TABLE.GROW_instr(x)]), `%;%`_config(z, [CONST_instr((at : addrtype <: numtype), `%`_num_($invsigned_($size((at : addrtype <: numtype)), - (1 : nat <:> int))))])) - ;; 8-reduction.watsup:887.1-888.51 + ;; 8-reduction.watsup:886.1-887.51 rule elem.drop{z : state, x : idx}: `%~>%`(`%;%`_config(z, [ELEM.DROP_instr(x)]), `%;%`_config($with_elem(z, x, []), [])) - ;; 8-reduction.watsup:971.1-974.60 + ;; 8-reduction.watsup:970.1-973.60 rule `store-num-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), nt : numtype, c : num_(nt), x : idx, ao : memarg}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr(nt, c) STORE_instr(nt, ?(), x, ao)]), `%;%`_config(z, [TRAP_instr])) -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + ((($size(nt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) - ;; 8-reduction.watsup:976.1-980.29 + ;; 8-reduction.watsup:975.1-979.29 rule `store-num-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), nt : numtype, c : num_(nt), x : idx, ao : memarg, `b*` : byte*}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr(nt, c) STORE_instr(nt, ?(), x, ao)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0), ((($size(nt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) -- if (b*{b <- `b*`} = $nbytes_(nt, c)) - ;; 8-reduction.watsup:982.1-985.52 + ;; 8-reduction.watsup:981.1-984.52 rule `store-pack-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), Inn : Inn, c : num_((Inn : Inn <: numtype)), n : n, x : idx, ao : memarg}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr((Inn : Inn <: numtype), c) STORE_instr((Inn : Inn <: numtype), ?(`%`_storeop_(`%`_sz(n))), x, ao)]), `%;%`_config(z, [TRAP_instr])) -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + (((n : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) - ;; 8-reduction.watsup:987.1-991.52 + ;; 8-reduction.watsup:986.1-990.52 rule `store-pack-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), Inn : Inn, c : num_((Inn : Inn <: numtype)), n : n, x : idx, ao : memarg, `b*` : byte*}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr((Inn : Inn <: numtype), c) STORE_instr((Inn : Inn <: numtype), ?(`%`_storeop_(`%`_sz(n))), x, ao)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0), (((n : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) -- if (b*{b <- `b*`} = $ibytes_(n, $wrap__($size((Inn : Inn <: numtype)), n, c))) - ;; 8-reduction.watsup:993.1-995.63 + ;; 8-reduction.watsup:992.1-994.63 rule `vstore-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c : vec_(V128_Vnn), x : idx, ao : memarg}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_instr(V128_vectype, x, ao)]), `%;%`_config(z, [TRAP_instr])) -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + ((($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) - ;; 8-reduction.watsup:997.1-999.31 + ;; 8-reduction.watsup:996.1-998.31 rule `vstore-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c : vec_(V128_Vnn), x : idx, ao : memarg, `b*` : byte*}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_instr(V128_vectype, x, ao)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0), ((($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) -- if (b*{b <- `b*`} = $vbytes_(V128_vectype, c)) - ;; 8-reduction.watsup:1002.1-1004.50 + ;; 8-reduction.watsup:1001.1-1003.50 rule `vstore_lane-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c : vec_(V128_Vnn), N : N, x : idx, ao : memarg, j : laneidx}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_LANE_instr(V128_vectype, `%`_sz(N), x, ao, j)]), `%;%`_config(z, [TRAP_instr])) -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + N) > |$mem(z, x).BYTES_meminst|) - ;; 8-reduction.watsup:1006.1-1010.49 + ;; 8-reduction.watsup:1005.1-1009.49 rule `vstore_lane-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c : vec_(V128_Vnn), N : N, x : idx, ao : memarg, j : laneidx, `b*` : byte*, Jnn : Jnn, M : M}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_LANE_instr(V128_vectype, `%`_sz(N), x, ao, j)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0), (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) -- if (N = $lsize((Jnn : Jnn <: lanetype))) -- if ((M : nat <:> rat) = ((128 : nat <:> rat) / (N : nat <:> rat))) -- if (b*{b <- `b*`} = $ibytes_(N, `%`_iN($lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), c)[j!`%`_laneidx.0]!`%`_lane_.0))) - ;; 8-reduction.watsup:1019.1-1022.37 + ;; 8-reduction.watsup:1018.1-1021.37 rule `memory.grow-succeed`{z : state, at : addrtype, n : n, x : idx, mi : meminst}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), `%`_num_(n)) MEMORY.GROW_instr(x)]), `%;%`_config($with_meminst(z, x, mi), [CONST_instr((at : addrtype <: numtype), `%`_num_((((|$mem(z, x).BYTES_meminst| : nat <:> rat) / ((64 * $Ki) : nat <:> rat)) : rat <:> nat)))])) -- if (mi = !($growmem($mem(z, x), n))) - ;; 8-reduction.watsup:1024.1-1025.83 + ;; 8-reduction.watsup:1023.1-1024.83 rule `memory.grow-fail`{z : state, at : addrtype, n : n, x : idx}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), `%`_num_(n)) MEMORY.GROW_instr(x)]), `%;%`_config(z, [CONST_instr((at : addrtype <: numtype), `%`_num_($invsigned_($size((at : addrtype <: numtype)), - (1 : nat <:> int))))])) - ;; 8-reduction.watsup:1085.1-1086.51 + ;; 8-reduction.watsup:1084.1-1085.51 rule data.drop{z : state, x : idx}: `%~>%`(`%;%`_config(z, [DATA.DROP_instr(x)]), `%;%`_config($with_data(z, x, []), [])) } @@ -17789,57 +17775,50 @@ def $opt_(syntax X, X*) : X? ;; 0-aux.watsup def $opt_{syntax X, w : X}(syntax X, [w]) = ?(w) -;; 0-aux.watsup -def $list_(syntax X, X?) : X* - ;; 0-aux.watsup - def $list_{syntax X}(syntax X, ?()) = [] - ;; 0-aux.watsup - def $list_{syntax X, w : X}(syntax X, ?(w)) = [w] - ;; 0-aux.watsup rec { -;; 0-aux.watsup:40.1-40.55 +;; 0-aux.watsup:35.1-35.55 def $concat_(syntax X, X**) : X* - ;; 0-aux.watsup:41.1-41.34 + ;; 0-aux.watsup:36.1-36.34 def $concat_{syntax X}(syntax X, []) = [] - ;; 0-aux.watsup:42.1-42.64 + ;; 0-aux.watsup:37.1-37.64 def $concat_{syntax X, `w*` : X*, `w'**` : X**}(syntax X, [w*{w <- `w*`}] ++ w'*{w' <- `w'*`}*{`w'*` <- `w'**`}) = w*{w <- `w*`} ++ $concat_(syntax X, w'*{w' <- `w'*`}*{`w'*` <- `w'**`}) } ;; 0-aux.watsup rec { -;; 0-aux.watsup:44.1-44.61 +;; 0-aux.watsup:39.1-39.61 def $concatn_(syntax X, X**, nat : nat) : X* - ;; 0-aux.watsup:45.1-45.38 + ;; 0-aux.watsup:40.1-40.38 def $concatn_{syntax X, n : n}(syntax X, [], n) = [] - ;; 0-aux.watsup:46.1-46.73 + ;; 0-aux.watsup:41.1-41.73 def $concatn_{syntax X, `w*` : X*, n : n, `w'**` : X**}(syntax X, [w^n{w <- `w*`}] ++ w'^n{w' <- `w'*`}*{`w'*` <- `w'**`}, n) = w^n{w <- `w*`} ++ $concatn_(syntax X, w'^n{w' <- `w'*`}*{`w'*` <- `w'**`}, n) } ;; 0-aux.watsup rec { -;; 0-aux.watsup:51.1-51.78 +;; 0-aux.watsup:46.1-46.78 def $disjoint_(syntax X, X*) : bool - ;; 0-aux.watsup:52.1-52.37 + ;; 0-aux.watsup:47.1-47.37 def $disjoint_{syntax X}(syntax X, []) = true - ;; 0-aux.watsup:53.1-53.68 + ;; 0-aux.watsup:48.1-48.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'*`})) } ;; 0-aux.watsup rec { -;; 0-aux.watsup:56.1-56.38 +;; 0-aux.watsup:51.1-51.38 def $setminus1_(syntax X, X : X, X*) : X* - ;; 0-aux.watsup:60.1-60.38 + ;; 0-aux.watsup:55.1-55.38 def $setminus1_{syntax X, w : X}(syntax X, w, []) = [w] - ;; 0-aux.watsup:61.1-61.78 + ;; 0-aux.watsup:56.1-56.78 def $setminus1_{syntax X, w : X, w_1 : X, `w'*` : X*}(syntax X, w, [w_1] ++ w'*{w' <- `w'*`}) = [] -- if (w = w_1) - ;; 0-aux.watsup:62.1-62.77 + ;; 0-aux.watsup:57.1-57.77 def $setminus1_{syntax X, w : X, w_1 : X, `w'*` : X*}(syntax X, w, [w_1] ++ w'*{w' <- `w'*`}) = $setminus1_(syntax X, w, w'*{w' <- `w'*`}) -- otherwise } @@ -17847,44 +17826,44 @@ def $setminus1_(syntax X, X : X, X*) : X* ;; 0-aux.watsup rec { -;; 0-aux.watsup:55.1-55.56 +;; 0-aux.watsup:50.1-50.56 def $setminus_(syntax X, X*, X*) : X* - ;; 0-aux.watsup:58.1-58.40 + ;; 0-aux.watsup:53.1-53.40 def $setminus_{syntax X, `w*` : X*}(syntax X, [], w*{w <- `w*`}) = [] - ;; 0-aux.watsup:59.1-59.90 + ;; 0-aux.watsup:54.1-54.90 def $setminus_{syntax X, w_1 : X, `w'*` : X*, `w*` : X*}(syntax X, [w_1] ++ w'*{w' <- `w'*`}, w*{w <- `w*`}) = $setminus1_(syntax X, w_1, w*{w <- `w*`}) ++ $setminus_(syntax X, w'*{w' <- `w'*`}, w*{w <- `w*`}) } ;; 0-aux.watsup rec { -;; 0-aux.watsup:67.1-67.46 +;; 0-aux.watsup:62.1-62.46 def $setproduct2_(syntax X, X : X, X**) : X** - ;; 0-aux.watsup:73.1-73.44 + ;; 0-aux.watsup:68.1-68.44 def $setproduct2_{syntax X, w_1 : X}(syntax X, w_1, []) = [] - ;; 0-aux.watsup:74.1-74.90 + ;; 0-aux.watsup:69.1-69.90 def $setproduct2_{syntax X, w_1 : X, `w'*` : X*, `w**` : X**}(syntax X, w_1, [w'*{w' <- `w'*`}] ++ w*{w <- `w*`}*{`w*` <- `w**`}) = [[w_1] ++ w'*{w' <- `w'*`}] ++ $setproduct2_(syntax X, w_1, w*{w <- `w*`}*{`w*` <- `w**`}) } ;; 0-aux.watsup rec { -;; 0-aux.watsup:66.1-66.47 +;; 0-aux.watsup:61.1-61.47 def $setproduct1_(syntax X, X*, X**) : X** - ;; 0-aux.watsup:71.1-71.46 + ;; 0-aux.watsup:66.1-66.46 def $setproduct1_{syntax X, `w**` : X**}(syntax X, [], w*{w <- `w*`}*{`w*` <- `w**`}) = [] - ;; 0-aux.watsup:72.1-72.107 + ;; 0-aux.watsup:67.1-67.107 def $setproduct1_{syntax X, w_1 : X, `w'*` : X*, `w**` : X**}(syntax X, [w_1] ++ w'*{w' <- `w'*`}, w*{w <- `w*`}*{`w*` <- `w**`}) = $setproduct2_(syntax X, w_1, w*{w <- `w*`}*{`w*` <- `w**`}) ++ $setproduct1_(syntax X, w'*{w' <- `w'*`}, w*{w <- `w*`}*{`w*` <- `w**`}) } ;; 0-aux.watsup rec { -;; 0-aux.watsup:65.1-65.82 +;; 0-aux.watsup:60.1-60.82 def $setproduct_(syntax X, X**) : X** - ;; 0-aux.watsup:69.1-69.40 + ;; 0-aux.watsup:64.1-64.40 def $setproduct_{syntax X}(syntax X, []) = [[]] - ;; 0-aux.watsup:70.1-70.90 + ;; 0-aux.watsup:65.1-65.90 def $setproduct_{syntax X, `w_1*` : X*, `w**` : X**}(syntax X, [w_1*{w_1 <- `w_1*`}] ++ w*{w <- `w*`}*{`w*` <- `w**`}) = $setproduct1_(syntax X, w_1*{w_1 <- `w_1*`}, $setproduct_(syntax X, w*{w <- `w*`}*{`w*` <- `w**`})) } @@ -19053,7 +19032,7 @@ syntax frame = ;; 5-runtime.watsup rec { -;; 5-runtime.watsup:156.1-162.9 +;; 5-runtime.watsup:157.1-163.9 syntax instr = | NOP | UNREACHABLE @@ -22522,9 +22501,9 @@ def $binop_(numtype : numtype, binop_ : binop_(numtype), num_ : num_(numtype), n ;; 4-numerics.watsup def $binop_{Inn : Inn, i_1 : num_((Inn : Inn <: numtype)), i_2 : num_((Inn : Inn <: numtype))}((Inn : Inn <: numtype), MUL_binop_, i_1, i_2) = [$imul_($sizenn((Inn : Inn <: numtype)), i_1, i_2)] ;; 4-numerics.watsup - def $binop_{Inn : Inn, sx : sx, i_1 : num_((Inn : Inn <: numtype)), i_2 : num_((Inn : Inn <: numtype))}((Inn : Inn <: numtype), DIV_binop_(sx), i_1, i_2) = $list_(syntax num_((Inn : Inn <: numtype)), $idiv_($sizenn((Inn : Inn <: numtype)), sx, i_1, i_2)) + def $binop_{Inn : Inn, sx : sx, i_1 : num_((Inn : Inn <: numtype)), i_2 : num_((Inn : Inn <: numtype))}((Inn : Inn <: numtype), DIV_binop_(sx), i_1, i_2) = lift($idiv_($sizenn((Inn : Inn <: numtype)), sx, i_1, i_2)) ;; 4-numerics.watsup - def $binop_{Inn : Inn, sx : sx, i_1 : num_((Inn : Inn <: numtype)), i_2 : num_((Inn : Inn <: numtype))}((Inn : Inn <: numtype), REM_binop_(sx), i_1, i_2) = $list_(syntax num_((Inn : Inn <: numtype)), $irem_($sizenn((Inn : Inn <: numtype)), sx, i_1, i_2)) + def $binop_{Inn : Inn, sx : sx, i_1 : num_((Inn : Inn <: numtype)), i_2 : num_((Inn : Inn <: numtype))}((Inn : Inn <: numtype), REM_binop_(sx), i_1, i_2) = lift($irem_($sizenn((Inn : Inn <: numtype)), sx, i_1, i_2)) ;; 4-numerics.watsup def $binop_{Inn : Inn, i_1 : num_((Inn : Inn <: numtype)), i_2 : num_((Inn : Inn <: numtype))}((Inn : Inn <: numtype), AND_binop_, i_1, i_2) = [$iand_($sizenn((Inn : Inn <: numtype)), i_1, i_2)] ;; 4-numerics.watsup @@ -22593,9 +22572,9 @@ def $cvtop__(numtype_1 : numtype, numtype_2 : numtype, cvtop__ : cvtop__(numtype ;; 4-numerics.watsup def $cvtop__{Inn_1 : Inn, Inn_2 : Inn, i_1 : num_((Inn_1 : Inn <: numtype))}((Inn_1 : Inn <: numtype), (Inn_2 : Inn <: numtype), WRAP_cvtop__, i_1) = [$wrap__($sizenn1((Inn_1 : Inn <: numtype)), $sizenn2((Inn_2 : Inn <: numtype)), i_1)] ;; 4-numerics.watsup - def $cvtop__{Fnn_1 : Fnn, Inn_2 : Inn, sx : sx, f_1 : num_((Fnn_1 : Fnn <: numtype))}((Fnn_1 : Fnn <: numtype), (Inn_2 : Inn <: numtype), TRUNC_cvtop__(sx), f_1) = $list_(syntax num_((Inn_2 : Inn <: numtype)), $trunc__($sizenn1((Fnn_1 : Fnn <: numtype)), $sizenn2((Inn_2 : Inn <: numtype)), sx, f_1)) + def $cvtop__{Fnn_1 : Fnn, Inn_2 : Inn, sx : sx, f_1 : num_((Fnn_1 : Fnn <: numtype))}((Fnn_1 : Fnn <: numtype), (Inn_2 : Inn <: numtype), TRUNC_cvtop__(sx), f_1) = lift($trunc__($sizenn1((Fnn_1 : Fnn <: numtype)), $sizenn2((Inn_2 : Inn <: numtype)), sx, f_1)) ;; 4-numerics.watsup - def $cvtop__{Fnn_1 : Fnn, Inn_2 : Inn, sx : sx, f_1 : num_((Fnn_1 : Fnn <: numtype))}((Fnn_1 : Fnn <: numtype), (Inn_2 : Inn <: numtype), TRUNC_SAT_cvtop__(sx), f_1) = $list_(syntax num_((Inn_2 : Inn <: numtype)), $trunc_sat__($sizenn1((Fnn_1 : Fnn <: numtype)), $sizenn2((Inn_2 : Inn <: numtype)), sx, f_1)) + def $cvtop__{Fnn_1 : Fnn, Inn_2 : Inn, sx : sx, f_1 : num_((Fnn_1 : Fnn <: numtype))}((Fnn_1 : Fnn <: numtype), (Inn_2 : Inn <: numtype), TRUNC_SAT_cvtop__(sx), f_1) = lift($trunc_sat__($sizenn1((Fnn_1 : Fnn <: numtype)), $sizenn2((Inn_2 : Inn <: numtype)), sx, f_1)) ;; 4-numerics.watsup def $cvtop__{Inn_1 : Inn, Fnn_2 : Fnn, sx : sx, i_1 : num_((Inn_1 : Inn <: numtype))}((Inn_1 : Inn <: numtype), (Fnn_2 : Fnn <: numtype), CONVERT_cvtop__(sx), i_1) = [$convert__($sizenn1((Inn_1 : Inn <: numtype)), $sizenn2((Fnn_2 : Fnn <: numtype)), sx, i_1)] ;; 4-numerics.watsup @@ -22925,10 +22904,10 @@ def $lcvtop__(shape_1 : shape, shape_2 : shape, vcvtop__ : vcvtop__(shape_1, sha def $lcvtop__{Jnn_1 : Jnn, M_1 : M, Fnn_2 : Fnn, M_2 : M, sx : sx, c_1 : lane_($lanetype(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)))), c : lane_($lanetype(`%X%`_shape((Fnn_2 : Fnn <: lanetype), `%`_dim(M_2))))}(`%X%`_shape((Jnn_1 : Jnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Fnn_2 : Fnn <: lanetype), `%`_dim(M_2)), CONVERT_vcvtop__(sx), c_1) = [c] -- if (c = $convert__($lsizenn1((Jnn_1 : Jnn <: lanetype)), $lsizenn2((Fnn_2 : Fnn <: lanetype)), sx, c_1)) ;; 4-numerics.watsup - def $lcvtop__{Fnn_1 : Fnn, M_1 : M, Inn_2 : Inn, M_2 : M, sx : sx, c_1 : lane_($lanetype(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)))), `c?` : lane_((Inn_2 : Inn <: lanetype))?}(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Inn_2 : Inn <: lanetype), `%`_dim(M_2)), TRUNC_SAT_vcvtop__(sx), c_1) = $list_(syntax lane_((Inn_2 : Inn <: lanetype)), c?{c <- `c?`}) + def $lcvtop__{Fnn_1 : Fnn, M_1 : M, Inn_2 : Inn, M_2 : M, sx : sx, c_1 : lane_($lanetype(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)))), `c?` : lane_($lanetype(`%X%`_shape((Inn_2 : Inn <: lanetype), `%`_dim(M_2))))?}(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Inn_2 : Inn <: lanetype), `%`_dim(M_2)), TRUNC_SAT_vcvtop__(sx), c_1) = lift(c?{c <- `c?`}) -- if (c?{c <- `c?`} = $trunc_sat__($lsizenn1((Fnn_1 : Fnn <: lanetype)), $lsizenn2((Inn_2 : Inn <: lanetype)), sx, c_1)) ;; 4-numerics.watsup - def $lcvtop__{Fnn_1 : Fnn, M_1 : M, Inn_2 : Inn, M_2 : M, sx : sx, c_1 : lane_($lanetype(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)))), `c?` : lane_((Inn_2 : Inn <: lanetype))?}(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Inn_2 : Inn <: lanetype), `%`_dim(M_2)), RELAXED_TRUNC_vcvtop__(sx), c_1) = $list_(syntax lane_((Inn_2 : Inn <: lanetype)), c?{c <- `c?`}) + def $lcvtop__{Fnn_1 : Fnn, M_1 : M, Inn_2 : Inn, M_2 : M, sx : sx, c_1 : lane_($lanetype(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)))), `c?` : lane_($lanetype(`%X%`_shape((Inn_2 : Inn <: lanetype), `%`_dim(M_2))))?}(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Inn_2 : Inn <: lanetype), `%`_dim(M_2)), RELAXED_TRUNC_vcvtop__(sx), c_1) = lift(c?{c <- `c?`}) -- if (c?{c <- `c?`} = $relaxed_trunc__($lsizenn1((Fnn_1 : Fnn <: lanetype)), $lsizenn2((Inn_2 : Inn <: lanetype)), sx, c_1)) ;; 4-numerics.watsup def $lcvtop__{Fnn_1 : Fnn, M_1 : M, Fnn_2 : Fnn, M_2 : M, c_1 : lane_($lanetype(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)))), `c*` : lane_($lanetype(`%X%`_shape((Fnn_2 : Fnn <: lanetype), `%`_dim(M_2))))*}(`%X%`_shape((Fnn_1 : Fnn <: lanetype), `%`_dim(M_1)), `%X%`_shape((Fnn_2 : Fnn <: lanetype), `%`_dim(M_2)), DEMOTE_vcvtop__, c_1) = c*{c <- `c*`} @@ -24635,7 +24614,7 @@ relation Step: `%~>%`(config, config) `%~>%`(`%;%`_config(`%;%`_state(s, f), [`FRAME_%{%}%`_instr(n, f', instr*{instr <- `instr*`})]), `%;%`_config(`%;%`_state(s', f), [`FRAME_%{%}%`_instr(n, f', instr'*{instr' <- `instr'*`})])) -- Step: `%~>%`(`%;%`_config(`%;%`_state(s, f'), instr*{instr <- `instr*`}), `%;%`_config(`%;%`_state(s', f'), instr'*{instr' <- `instr'*`})) - ;; 8-reduction.watsup:227.1-232.49 + ;; 8-reduction.watsup:227.1-231.49 rule throw{z : state, `val*` : val*, n : n, x : idx, exn : exninst, a : addr, `t*` : valtype*}: `%~>%`(`%;%`_config(z, (val : val <: instr)^n{val <- `val*`} ++ [THROW_instr(x)]), `%;%`_config($add_exninst(z, [exn]), [REF.EXN_ADDR_instr(a) THROW_REF_instr])) -- Expand: `%~~%`($tag(z, x).TYPE_taginst, FUNC_comptype(`%->%`_functype(`%`_resulttype(t^n{t <- `t*`}), `%`_resulttype([])))) @@ -24643,112 +24622,112 @@ relation Step: `%~>%`(config, config) -- if (x!`%`_idx.0 < |$tagaddr(z)|) -- if (exn = {TAG $tagaddr(z)[x!`%`_idx.0], FIELDS val^n{val <- `val*`}}) - ;; 8-reduction.watsup:407.1-411.65 + ;; 8-reduction.watsup:406.1-410.65 rule struct.new{z : state, `val*` : val*, n : n, x : idx, si : structinst, a : addr, `mut*` : mut*, `zt*` : storagetype*}: `%~>%`(`%;%`_config(z, (val : val <: instr)^n{val <- `val*`} ++ [STRUCT.NEW_instr(x)]), `%;%`_config($add_structinst(z, [si]), [REF.STRUCT_ADDR_instr(a)])) -- Expand: `%~~%`($type(z, x), STRUCT_comptype(`%`_structtype(`%%`_fieldtype(mut, zt)^n{mut <- `mut*`, zt <- `zt*`}))) -- if (a = |$structinst(z)|) -- if (si = {TYPE $type(z, x), FIELDS $packfield_(zt, val)^n{val <- `val*`, zt <- `zt*`}}) - ;; 8-reduction.watsup:427.1-428.53 + ;; 8-reduction.watsup:426.1-427.53 rule `struct.set-null`{z : state, ht : heaptype, val : val, x : idx, i : u32}: `%~>%`(`%;%`_config(z, [REF.NULL_instr(ht) (val : val <: instr) STRUCT.SET_instr(x, i)]), `%;%`_config(z, [TRAP_instr])) - ;; 8-reduction.watsup:430.1-432.45 + ;; 8-reduction.watsup:429.1-431.45 rule `struct.set-struct`{z : state, a : addr, val : val, x : idx, i : u32, `zt*` : storagetype*, `mut*` : mut*}: `%~>%`(`%;%`_config(z, [REF.STRUCT_ADDR_instr(a) (val : val <: instr) STRUCT.SET_instr(x, i)]), `%;%`_config($with_struct(z, a, i!`%`_u32.0, $packfield_(zt*{zt <- `zt*`}[i!`%`_u32.0], val)), [])) -- if (i!`%`_u32.0 < |zt*{zt <- `zt*`}|) -- Expand: `%~~%`($type(z, x), STRUCT_comptype(`%`_structtype(`%%`_fieldtype(mut, zt)*{mut <- `mut*`, zt <- `zt*`}))) - ;; 8-reduction.watsup:445.1-450.65 + ;; 8-reduction.watsup:444.1-449.65 rule array.new_fixed{z : state, `val*` : val*, n : n, x : idx, ai : arrayinst, a : addr, mut : mut, zt : storagetype}: `%~>%`(`%;%`_config(z, (val : val <: instr)^n{val <- `val*`} ++ [ARRAY.NEW_FIXED_instr(x, `%`_u32(n))]), `%;%`_config($add_arrayinst(z, [ai]), [REF.ARRAY_ADDR_instr(a)])) -- Expand: `%~~%`($type(z, x), ARRAY_comptype(`%%`_arraytype(mut, zt))) -- if ((a = |$arrayinst(z)|) /\ (ai = {TYPE $type(z, x), FIELDS $packfield_(zt, val)^n{val <- `val*`}})) - ;; 8-reduction.watsup:490.1-491.64 + ;; 8-reduction.watsup:489.1-490.64 rule `array.set-null`{z : state, ht : heaptype, i : num_(I32_numtype), val : val, x : idx}: `%~>%`(`%;%`_config(z, [REF.NULL_instr(ht) CONST_instr(I32_numtype, i) (val : val <: instr) ARRAY.SET_instr(x)]), `%;%`_config(z, [TRAP_instr])) - ;; 8-reduction.watsup:493.1-495.39 + ;; 8-reduction.watsup:492.1-494.39 rule `array.set-oob`{z : state, a : addr, i : num_(I32_numtype), val : val, x : idx}: `%~>%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) (val : val <: instr) ARRAY.SET_instr(x)]), `%;%`_config(z, [TRAP_instr])) -- if (a < |$arrayinst(z)|) -- if (i!`%`_num_.0 >= |$arrayinst(z)[a].FIELDS_arrayinst|) - ;; 8-reduction.watsup:497.1-500.43 + ;; 8-reduction.watsup:496.1-499.43 rule `array.set-array`{z : state, a : addr, i : num_(I32_numtype), val : val, x : idx, zt : storagetype, mut : mut}: `%~>%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) (val : val <: instr) ARRAY.SET_instr(x)]), `%;%`_config($with_array(z, a, i!`%`_num_.0, $packfield_(zt, val)), [])) -- Expand: `%~~%`($type(z, x), ARRAY_comptype(`%%`_arraytype(mut, zt))) - ;; 8-reduction.watsup:779.1-780.56 + ;; 8-reduction.watsup:778.1-779.56 rule local.set{z : state, val : val, x : idx}: `%~>%`(`%;%`_config(z, [(val : val <: instr) LOCAL.SET_instr(x)]), `%;%`_config($with_local(z, x, val), [])) - ;; 8-reduction.watsup:792.1-793.58 + ;; 8-reduction.watsup:791.1-792.58 rule global.set{z : state, val : val, x : idx}: `%~>%`(`%;%`_config(z, [(val : val <: instr) GLOBAL.SET_instr(x)]), `%;%`_config($with_global(z, x, val), [])) - ;; 8-reduction.watsup:806.1-808.33 + ;; 8-reduction.watsup:805.1-807.33 rule `table.set-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), ref : ref, x : idx}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) (ref : ref <: instr) TABLE.SET_instr(x)]), `%;%`_config(z, [TRAP_instr])) -- if (i!`%`_num_.0 >= |$table(z, x).REFS_tableinst|) - ;; 8-reduction.watsup:810.1-812.32 + ;; 8-reduction.watsup:809.1-811.32 rule `table.set-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), ref : ref, x : idx}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) (ref : ref <: instr) TABLE.SET_instr(x)]), `%;%`_config($with_table(z, x, i!`%`_num_.0, ref), [])) -- if (i!`%`_num_.0 < |$table(z, x).REFS_tableinst|) - ;; 8-reduction.watsup:821.1-824.46 + ;; 8-reduction.watsup:820.1-823.46 rule `table.grow-succeed`{z : state, ref : ref, at : addrtype, n : n, x : idx, ti : tableinst}: `%~>%`(`%;%`_config(z, [(ref : ref <: instr) CONST_instr((at : addrtype <: numtype), `%`_num_(n)) TABLE.GROW_instr(x)]), `%;%`_config($with_tableinst(z, x, ti), [CONST_instr((at : addrtype <: numtype), `%`_num_(|$table(z, x).REFS_tableinst|))])) -- if ($growtable($table(z, x), n, ref) =/= ?()) -- if (ti = !($growtable($table(z, x), n, ref))) - ;; 8-reduction.watsup:826.1-827.86 + ;; 8-reduction.watsup:825.1-826.86 rule `table.grow-fail`{z : state, ref : ref, at : addrtype, n : n, x : idx}: `%~>%`(`%;%`_config(z, [(ref : ref <: instr) CONST_instr((at : addrtype <: numtype), `%`_num_(n)) TABLE.GROW_instr(x)]), `%;%`_config(z, [CONST_instr((at : addrtype <: numtype), `%`_num_($invsigned_($size((at : addrtype <: numtype)), - (1 : nat <:> int))))])) - ;; 8-reduction.watsup:887.1-888.51 + ;; 8-reduction.watsup:886.1-887.51 rule elem.drop{z : state, x : idx}: `%~>%`(`%;%`_config(z, [ELEM.DROP_instr(x)]), `%;%`_config($with_elem(z, x, []), [])) - ;; 8-reduction.watsup:971.1-974.60 + ;; 8-reduction.watsup:970.1-973.60 rule `store-num-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), nt : numtype, c : num_(nt), x : idx, ao : memarg}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr(nt, c) STORE_instr(nt, ?(), x, ao)]), `%;%`_config(z, [TRAP_instr])) -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + ((($size(nt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) - ;; 8-reduction.watsup:976.1-980.29 + ;; 8-reduction.watsup:975.1-979.29 rule `store-num-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), nt : numtype, c : num_(nt), x : idx, ao : memarg, `b*` : byte*}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr(nt, c) STORE_instr(nt, ?(), x, ao)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0), ((($size(nt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) -- if (b*{b <- `b*`} = $nbytes_(nt, c)) - ;; 8-reduction.watsup:982.1-985.52 + ;; 8-reduction.watsup:981.1-984.52 rule `store-pack-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), Inn : Inn, c : num_((Inn : Inn <: numtype)), n : n, x : idx, ao : memarg}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr((Inn : Inn <: numtype), c) STORE_instr((Inn : Inn <: numtype), ?(`%`_storeop_(`%`_sz(n))), x, ao)]), `%;%`_config(z, [TRAP_instr])) -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + (((n : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) - ;; 8-reduction.watsup:987.1-991.52 + ;; 8-reduction.watsup:986.1-990.52 rule `store-pack-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), Inn : Inn, c : num_((Inn : Inn <: numtype)), n : n, x : idx, ao : memarg, `b*` : byte*}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr((Inn : Inn <: numtype), c) STORE_instr((Inn : Inn <: numtype), ?(`%`_storeop_(`%`_sz(n))), x, ao)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0), (((n : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) -- if (b*{b <- `b*`} = $ibytes_(n, $wrap__($size((Inn : Inn <: numtype)), n, c))) - ;; 8-reduction.watsup:993.1-995.63 + ;; 8-reduction.watsup:992.1-994.63 rule `vstore-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c : vec_(V128_Vnn), x : idx, ao : memarg}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_instr(V128_vectype, x, ao)]), `%;%`_config(z, [TRAP_instr])) -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + ((($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) - ;; 8-reduction.watsup:997.1-999.31 + ;; 8-reduction.watsup:996.1-998.31 rule `vstore-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c : vec_(V128_Vnn), x : idx, ao : memarg, `b*` : byte*}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_instr(V128_vectype, x, ao)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0), ((($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) -- if (b*{b <- `b*`} = $vbytes_(V128_vectype, c)) - ;; 8-reduction.watsup:1002.1-1004.50 + ;; 8-reduction.watsup:1001.1-1003.50 rule `vstore_lane-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c : vec_(V128_Vnn), N : N, x : idx, ao : memarg, j : laneidx}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_LANE_instr(V128_vectype, `%`_sz(N), x, ao, j)]), `%;%`_config(z, [TRAP_instr])) -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + N) > |$mem(z, x).BYTES_meminst|) - ;; 8-reduction.watsup:1006.1-1010.49 + ;; 8-reduction.watsup:1005.1-1009.49 rule `vstore_lane-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c : vec_(V128_Vnn), N : N, x : idx, ao : memarg, j : laneidx, `b*` : byte*, Jnn : Jnn, M : M}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_LANE_instr(V128_vectype, `%`_sz(N), x, ao, j)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0), (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) -- if (N = $lsize((Jnn : Jnn <: lanetype))) @@ -24756,17 +24735,17 @@ relation Step: `%~>%`(config, config) -- if (j!`%`_laneidx.0 < |$lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), c)|) -- if (b*{b <- `b*`} = $ibytes_(N, `%`_iN($lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), c)[j!`%`_laneidx.0]!`%`_lane_.0))) - ;; 8-reduction.watsup:1019.1-1022.37 + ;; 8-reduction.watsup:1018.1-1021.37 rule `memory.grow-succeed`{z : state, at : addrtype, n : n, x : idx, mi : meminst}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), `%`_num_(n)) MEMORY.GROW_instr(x)]), `%;%`_config($with_meminst(z, x, mi), [CONST_instr((at : addrtype <: numtype), `%`_num_((((|$mem(z, x).BYTES_meminst| : nat <:> rat) / ((64 * $Ki) : nat <:> rat)) : rat <:> nat)))])) -- if ($growmem($mem(z, x), n) =/= ?()) -- if (mi = !($growmem($mem(z, x), n))) - ;; 8-reduction.watsup:1024.1-1025.83 + ;; 8-reduction.watsup:1023.1-1024.83 rule `memory.grow-fail`{z : state, at : addrtype, n : n, x : idx}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), `%`_num_(n)) MEMORY.GROW_instr(x)]), `%;%`_config(z, [CONST_instr((at : addrtype <: numtype), `%`_num_($invsigned_($size((at : addrtype <: numtype)), - (1 : nat <:> int))))])) - ;; 8-reduction.watsup:1085.1-1086.51 + ;; 8-reduction.watsup:1084.1-1085.51 rule data.drop{z : state, x : idx}: `%~>%`(`%;%`_config(z, [DATA.DROP_instr(x)]), `%;%`_config($with_data(z, x, []), [])) } diff --git a/spectec/test-prose/TEST.md b/spectec/test-prose/TEST.md index 6fa1e68d54..3e53183347 100644 --- a/spectec/test-prose/TEST.md +++ b/spectec/test-prose/TEST.md @@ -19210,19 +19210,6 @@ The instruction sequence :math:`(\mathsf{block}~{\mathit{blocktype}}~{{\mathit{i #. Return :math:`w`. -:math:`{X_{\mathit{u{\kern-0.1em\scriptstyle 1}}}^?}` -..................................................... - - -1. If :math:`{X_{\mathit{u{\kern-0.1em\scriptstyle 1}}}^?}` is not defined, then: - - a. Return :math:`\epsilon`. - -#. Let :math:`w` be :math:`{X_{\mathit{u{\kern-0.1em\scriptstyle 1}}}^?}`. - -#. Return :math:`w`. - - :math:`{\bigoplus}\, {X_{\mathit{u{\kern-0.1em\scriptstyle 1}}}^\ast}` ...................................................................... @@ -27752,12 +27739,6 @@ opt_ X X_u1* 3. Let [w] be X_u1*. 4. Return ?(w). -list_ X X_u1? -1. If X_u1? is not defined, then: - a. Return []. -2. Let ?(w) be X_u1?. -3. Return [w]. - concat_ X X_u1* 1. If (X_u1* = []), then: a. Return []. @@ -29149,10 +29130,10 @@ binop_ nt_u1 binop_u1 i_u1 i_u2 1) Return [$imul_($sizenn(Inn), i_1, i_2)]. g. If binop_u1 is of the case DIV, then: 1) Let (DIV sx) be binop_u1. - 2) Return $list_(num_((Inn : Inn <: numtype)), $idiv_($sizenn(Inn), sx, i_1, i_2)). + 2) Return $idiv_($sizenn(Inn), sx, i_1, i_2). h. If binop_u1 is of the case REM, then: 1) Let (REM sx) be binop_u1. - 2) Return $list_(num_((Inn : Inn <: numtype)), $irem_($sizenn(Inn), sx, i_1, i_2)). + 2) Return $irem_($sizenn(Inn), sx, i_1, i_2). i. If (binop_u1 = AND), then: 1) Return [$iand_($sizenn(Inn), i_1, i_2)]. j. If (binop_u1 = OR), then: @@ -29247,11 +29228,11 @@ cvtop__ nt_u1 nt_u3 cvtop_u1 i_u1 2) If cvtop_u1 is of the case TRUNC, then: a) Let (TRUNC sx) be cvtop_u1. b) Let f_1 be i_u1. - c) Return $list_(num_((Inn_2 : Inn <: numtype)), $trunc__($sizenn1(Fnn_1), $sizenn2(Inn_2), sx, f_1)). + c) Return $trunc__($sizenn1(Fnn_1), $sizenn2(Inn_2), sx, f_1). 3) If cvtop_u1 is of the case TRUNC_SAT, then: a) Let (TRUNC_SAT sx) be cvtop_u1. b) Let f_1 be i_u1. - c) Return $list_(num_((Inn_2 : Inn <: numtype)), $trunc_sat__($sizenn1(Fnn_1), $sizenn2(Inn_2), sx, f_1)). + c) Return $trunc_sat__($sizenn1(Fnn_1), $sizenn2(Inn_2), sx, f_1). 3. If the type of nt_u1 is Inn, then: a. Let Inn_1 be nt_u1. b. If the type of nt_u3 is Fnn, then: @@ -29579,11 +29560,11 @@ lcvtop__ lt_u3 X M_1 lt_u1 X M_2 vcvtop_u1 c_1 b. If vcvtop_u1 is of the case TRUNC_SAT, then: 1) Let (TRUNC_SAT sx) be vcvtop_u1. 2) Let c? be $trunc_sat__($lsizenn1(Fnn_1), $lsizenn2(Inn_2), sx, c_1). - 3) Return $list_(lane_((Inn_2 : Inn <: lanetype)), c?). + 3) Return c?. c. If vcvtop_u1 is of the case RELAXED_TRUNC, then: 1) Let (RELAXED_TRUNC sx) be vcvtop_u1. 2) Let c? be $relaxed_trunc__($lsizenn1(Fnn_1), $lsizenn2(Inn_2), sx, c_1). - 3) Return $list_(lane_((Inn_2 : Inn <: lanetype)), c?). + 3) Return c?. 5. Assert: Due to validation, the type of lt_u1 is Fnn. 6. Let Fnn_2 be lt_u1. 7. If (vcvtop_u1 = DEMOTE), then: diff --git a/spectec/test-splice/TEST.md b/spectec/test-splice/TEST.md index b17226c573..bc67e855ea 100644 --- a/spectec/test-splice/TEST.md +++ b/spectec/test-splice/TEST.md @@ -1446,7 +1446,6 @@ warning: definition `ixor_` was never spliced warning: definition `lanes_` was never spliced warning: definition `lanetype` was never spliced warning: definition `lcvtop__` was never spliced -warning: definition `list_` was never spliced warning: definition `local` was never spliced warning: definition `lpacknum_` was never spliced warning: definition `lsize` was never spliced @@ -2182,7 +2181,6 @@ warning: definition prose `ivtestop_` was never spliced warning: definition prose `ivunop_` was never spliced warning: definition prose `lanetype` was never spliced warning: definition prose `lcvtop__` was never spliced -warning: definition prose `list_` was never spliced warning: definition prose `local` was never spliced warning: definition prose `lpacknum_` was never spliced warning: definition prose `lsize` was never spliced