diff --git a/document/core/text/instructions.rst b/document/core/text/instructions.rst index 619761e4db..01d998d260 100644 --- a/document/core/text/instructions.rst +++ b/document/core/text/instructions.rst @@ -929,6 +929,10 @@ Vector constant instructions have a mandatory :ref:`shape ` de \text{f32x4.abs} &\Rightarrow& \F32X4.\VABS\\ &&|& \text{f32x4.neg} &\Rightarrow& \F32X4.\VNEG\\ &&|& \text{f32x4.sqrt} &\Rightarrow& \F32X4.\VSQRT\\ &&|& + \text{f32x4.ceil} &\Rightarrow& \F32X4.\VCEIL\\ &&|& + \text{f32x4.floor} &\Rightarrow& \F32X4.\VFLOOR\\ &&|& + \text{f32x4.trunc} &\Rightarrow& \F32X4.\VTRUNC\\ &&|& + \text{f32x4.nearest} &\Rightarrow& \F32X4.\VNEAREST\\ &&|& \text{f32x4.add} &\Rightarrow& \F32X4.\VADD\\ &&|& \text{f32x4.sub} &\Rightarrow& \F32X4.\VSUB\\ &&|& \text{f32x4.mul} &\Rightarrow& \F32X4.\VMUL\\ &&|& @@ -945,6 +949,10 @@ Vector constant instructions have a mandatory :ref:`shape ` de \text{f64x2.abs} &\Rightarrow& \F64X2.\VABS\\ &&|& \text{f64x2.neg} &\Rightarrow& \F64X2.\VNEG\\ &&|& \text{f64x2.sqrt} &\Rightarrow& \F64X2.\VSQRT\\ &&|& + \text{f64x2.ceil} &\Rightarrow& \F64X2.\VCEIL\\ &&|& + \text{f64x2.floor} &\Rightarrow& \F64X2.\VFLOOR\\ &&|& + \text{f64x2.trunc} &\Rightarrow& \F64X2.\VTRUNC\\ &&|& + \text{f64x2.nearest} &\Rightarrow& \F64X2.\VNEAREST\\ &&|& \text{f64x2.add} &\Rightarrow& \F64X2.\VADD\\ &&|& \text{f64x2.sub} &\Rightarrow& \F64X2.\VSUB\\ &&|& \text{f64x2.mul} &\Rightarrow& \F64X2.\VMUL\\ &&|& diff --git a/interpreter/text/parser.mly b/interpreter/text/parser.mly index 218a4c5c2b..2e795513be 100644 --- a/interpreter/text/parser.mly +++ b/interpreter/text/parser.mly @@ -24,10 +24,9 @@ let positions_to_region position1 position2 = right = position_to_pos position2 } -let at () = - positions_to_region (Parsing.symbol_start_pos ()) (Parsing.symbol_end_pos ()) -let ati i = - positions_to_region (Parsing.rhs_start_pos i) (Parsing.rhs_end_pos i) +let at (l, r) = positions_to_region l r + +let (@@) x loc = x @@ at loc (* Literals *) @@ -35,36 +34,38 @@ let ati i = let num f s = try f s with Failure _ -> error s.at "constant out of range" -let vec f shape ss at = - try f shape ss at with - | Failure _ -> error at "constant out of range" - | Invalid_argument _ -> error at "wrong number of lane literals" +let vec f shape ss loc = + try f shape ss (at loc) with + | Failure _ -> error (at loc) "constant out of range" + | Invalid_argument _ -> error (at loc) "wrong number of lane literals" -let vec_lane_nan shape l at = +let vec_lane_nan shape l at' = let open Value in + let open Source in match shape with - | V128.F32x4 () -> NanPat (F32 l @@ at) - | V128.F64x2 () -> NanPat (F64 l @@ at) - | _ -> error at "invalid vector constant" + | V128.F32x4 () -> NanPat (F32 l @@ at') + | V128.F64x2 () -> NanPat (F64 l @@ at') + | _ -> error at' "invalid vector constant" -let vec_lane_lit shape l at = +let vec_lane_lit shape l at' = let open Value in + let open Source in match shape with - | V128.I8x16 () -> NumPat (I32 (I8.of_string l) @@ at) - | V128.I16x8 () -> NumPat (I32 (I16.of_string l) @@ at) - | V128.I32x4 () -> NumPat (I32 (I32.of_string l) @@ at) - | V128.I64x2 () -> NumPat (I64 (I64.of_string l) @@ at) - | V128.F32x4 () -> NumPat (F32 (F32.of_string l) @@ at) - | V128.F64x2 () -> NumPat (F64 (F64.of_string l) @@ at) + | V128.I8x16 () -> NumPat (I32 (I8.of_string l) @@ at') + | V128.I16x8 () -> NumPat (I32 (I16.of_string l) @@ at') + | V128.I32x4 () -> NumPat (I32 (I32.of_string l) @@ at') + | V128.I64x2 () -> NumPat (I64 (I64.of_string l) @@ at') + | V128.F32x4 () -> NumPat (F32 (F32.of_string l) @@ at') + | V128.F64x2 () -> NumPat (F64 (F64.of_string l) @@ at') let vec_lane_index s at = match int_of_string s with | n when 0 <= n && n < 256 -> n | _ | exception Failure _ -> error at "malformed lane index" -let shuffle_lit ss at = +let shuffle_lit ss loc = if not (List.length ss = 16) then - error at "invalid lane length"; + error (at loc) "invalid lane length"; List.map (fun s -> vec_lane_index s.it s.at) ss let nanop f nan = @@ -75,17 +76,17 @@ let nanop f nan = | F64 _ -> F64 nan.it @@ nan.at | I32 _ | I64 _ -> error nan.at "NaN pattern with non-float type" -let nat s at = +let nat s loc = try let n = int_of_string s in if n >= 0 then n else raise (Failure "") - with Failure _ -> error at "integer constant out of range" + with Failure _ -> error (at loc) "integer constant out of range" -let nat32 s at = - try I32.of_string_u s with Failure _ -> error at "i32 constant out of range" +let nat32 s loc = + try I32.of_string_u s with Failure _ -> error (at loc) "i32 constant out of range" -let name s at = - try Utf8.decode s with Utf8.Utf8 -> error at "malformed UTF-8 encoding" +let name s loc = + try Utf8.decode s with Utf8.Utf8 -> error (at loc) "malformed UTF-8 encoding" (* Symbolic variables *) @@ -221,7 +222,7 @@ let anon_label (c : context) at = bind "label" c.labels 1l at let anon_fields (c : context) x n at = bind "field" (Lib.List32.nth c.types.fields x) n at -let find_type_index (c : context) dt at = +let find_type_index (c : context) dt loc = let st = SubT (Final, [], dt) in match Lib.List.index_where (function @@ -229,27 +230,27 @@ let find_type_index (c : context) dt at = | _ -> false ) c.types.ctx with - | Some i -> Int32.of_int i @@ at + | Some i -> Int32.of_int i @@ loc | None -> - let i = anon_type c at in - define_type c (RecT [st] @@ at); + let i = anon_type c (at loc) in + define_type c (RecT [st] @@ loc); define_def_type c (DefT (RecT [st], 0l)); - i @@ at + i @@ loc let inline_func_type (c : context) ft at = let dt = DefFuncT ft in find_type_index c dt at -let inline_func_type_explicit (c : context) x ft at = +let inline_func_type_explicit (c : context) x ft (loc : (Lexing.position * Lexing.position)) = if ft = FuncT ([], []) then (* Deferring ensures that type lookup is only triggered when symbolic identifiers are used, and not for desugared functions *) defer_locals c (fun () -> let FuncT (ts1, _ts2) = func_type c x in - bind "local" c.locals (Lib.List32.length ts1) at + bind "local" c.locals (Lib.List32.length ts1) (at loc) ) else if ft <> func_type c x then - error at "inline function type does not match explicit type"; + error (at loc) "inline function type does not match explicit type"; x let inline_tag_type (c : context) (TagT ht) at = @@ -326,7 +327,7 @@ let inline_tag_type (c : context) (TagT ht) at = /* Auxiliaries */ name : - | STRING { name $1 (at ()) } + | STRING { name $1 $sloc } string_list : | /* empty */ { "" } @@ -384,7 +385,7 @@ global_type : cont_type : | type_use cont_type_params - { let at1 = ati 1 in + { let at1 = $loc($1) in fun c -> match $2 c with | FuncT ([], []) -> ContT (VarHT (StatX ($1 c).it)) @@ -393,7 +394,7 @@ cont_type : ContT (VarHT (StatX x.it)) } | cont_type_params /* TODO: the inline type is broken for now */ - { let at = at () in fun c -> ContT (VarHT (StatX (inline_func_type c ($1 c) at).it)) } + { let at = $sloc in fun c -> ContT (VarHT (StatX (inline_func_type c ($1 c) at).it)) } | var /* Sugar */ { fun c -> ContT (VarHT (StatX ($1 c type_).it)) } @@ -425,9 +426,9 @@ field_type_list : struct_field_list : | /* empty */ { fun c x -> [] } | LPAR FIELD field_type_list RPAR struct_field_list - { let at3 = ati 3 in + { let at3 = $loc($3) in fun c x -> let fts = $3 c in - ignore (anon_fields c x (Lib.List32.length fts) at3); fts @ $5 c x } + ignore (anon_fields c x (Lib.List32.length fts) (at at3)); fts @ $5 c x } | LPAR FIELD bind_var field_type RPAR struct_field_list { fun c x -> ignore (bind_field c x $3); $4 c :: $6 c x } @@ -457,7 +458,7 @@ tag_type : | type_use { fun c -> TagT (VarHT (StatX ($1 c).it)) } | func_type - { let at1 = at () in fun c -> TagT (VarHT (StatX (inline_func_type c ($1 c) at1).it)) } + { let at1 = $sloc in fun c -> TagT (VarHT (StatX (inline_func_type c ($1 c) at1).it)) } str_type : | LPAR STRUCT struct_type RPAR { fun c x -> DefStructT ($3 c x) } @@ -481,8 +482,8 @@ memory_type : | limits { fun c -> MemoryT $1 } limits : - | NAT { {min = nat32 $1 (ati 1); max = None} } - | NAT NAT { {min = nat32 $1 (ati 1); max = Some (nat32 $2 (ati 2))} } + | NAT { {min = nat32 $1 $loc($1); max = None} } + | NAT NAT { {min = nat32 $1 $loc($1); max = Some (nat32 $2 $loc($2))} } type_use : | LPAR TYPE var RPAR { fun c -> $3 c type_ } @@ -491,40 +492,40 @@ type_use : /* Immediates */ nat32 : - | NAT { nat32 $1 (at ()) } + | NAT { nat32 $1 $sloc } num : - | NAT { $1 @@ at () } - | INT { $1 @@ at () } - | FLOAT { $1 @@ at () } + | NAT { $1 @@ $sloc } + | INT { $1 @@ $sloc } + | FLOAT { $1 @@ $sloc } var : - | NAT { let at = at () in fun c lookup -> nat32 $1 at @@ at } - | VAR { let at = at () in fun c lookup -> lookup c ($1 @@ at) @@ at } + | NAT { let loc = $sloc in fun c lookup -> nat32 $1 loc @@ loc } + | VAR { let loc = $sloc in fun c lookup -> lookup c ($1 @@ loc) @@ loc } var_list : | /* empty */ { fun c lookup -> [] } | var var_list { fun c lookup -> $1 c lookup :: $2 c lookup } bind_var_opt : - | /* empty */ { let at = at () in fun c anon bind -> anon c at } + | /* empty */ { let loc = $sloc in fun c anon bind -> anon c (at loc) } | bind_var { fun c anon bind -> bind c $1 } /* Sugar */ bind_var : - | VAR { $1 @@ at () } + | VAR { $1 @@ $sloc } labeling_opt : | /* empty */ - { let at = at () in + { let loc = $sloc in fun c xs -> List.iter (fun x -> error x.at "mismatching label") xs; - let c' = enter_block c at in ignore (anon_label c' at); c' } + let c' = enter_block c (at loc) in ignore (anon_label c' (at loc)); c' } | bind_var - { let at = at () in + { let loc = $sloc in fun c xs -> List.iter (fun x -> if x.it <> $1.it then error x.at "mismatching label") xs; - let c' = enter_block c at in ignore (bind_label c' $1); c' } + let c' = enter_block c (at loc) in ignore (bind_label c' $1); c' } labeling_end_opt : | /* empty */ { [] } @@ -532,14 +533,14 @@ labeling_end_opt : offset_opt : | /* empty */ { 0l } - | OFFSET_EQ_NAT { nat32 $1 (at ()) } + | OFFSET_EQ_NAT { nat32 $1 $sloc } align_opt : | /* empty */ { None } | ALIGN_EQ_NAT - { let n = nat $1 (at ()) in + { let n = nat $1 $sloc in if not (Lib.Int.is_power_of_two n) then - error (at ()) "alignment must be a power of two"; + error (at $sloc) "alignment must be a power of two"; Some (Lib.Int.log2 n) } @@ -553,8 +554,8 @@ instr_list : | resume_instr_instr { fun c -> let e, es = $1 c in e :: es } instr1 : - | plain_instr { let at = at () in fun c -> [$1 c @@ at] } - | block_instr { let at = at () in fun c -> [$1 c @@ at] } + | plain_instr { let at = $sloc in fun c -> [$1 c @@ at] } + | block_instr { let at = $sloc in fun c -> [$1 c @@ at] } | expr { $1 } /* Sugar */ plain_instr : @@ -591,24 +592,24 @@ plain_instr : | TABLE_FILL var { fun c -> table_fill ($2 c table) } | TABLE_COPY var var { fun c -> table_copy ($2 c table) ($3 c table) } | TABLE_INIT var var { fun c -> table_init ($2 c table) ($3 c elem) } - | TABLE_GET { let at = at () in fun c -> table_get (0l @@ at) } /* Sugar */ - | TABLE_SET { let at = at () in fun c -> table_set (0l @@ at) } /* Sugar */ - | TABLE_SIZE { let at = at () in fun c -> table_size (0l @@ at) } /* Sugar */ - | TABLE_GROW { let at = at () in fun c -> table_grow (0l @@ at) } /* Sugar */ - | TABLE_FILL { let at = at () in fun c -> table_fill (0l @@ at) } /* Sugar */ + | TABLE_GET { let at = $sloc in fun c -> table_get (0l @@ at) } /* Sugar */ + | TABLE_SET { let at = $sloc in fun c -> table_set (0l @@ at) } /* Sugar */ + | TABLE_SIZE { let at = $sloc in fun c -> table_size (0l @@ at) } /* Sugar */ + | TABLE_GROW { let at = $sloc in fun c -> table_grow (0l @@ at) } /* Sugar */ + | TABLE_FILL { let at = $sloc in fun c -> table_fill (0l @@ at) } /* Sugar */ | TABLE_COPY /* Sugar */ - { let at = at () in fun c -> table_copy (0l @@ at) (0l @@ at) } + { let at = $sloc in fun c -> table_copy (0l @@ at) (0l @@ at) } | TABLE_INIT var /* Sugar */ - { let at = at () in fun c -> table_init (0l @@ at) ($2 c elem) } + { let at = $sloc in fun c -> table_init (0l @@ at) ($2 c elem) } | ELEM_DROP var { fun c -> elem_drop ($2 c elem) } | LOAD offset_opt align_opt { fun c -> $1 $3 $2 } | STORE offset_opt align_opt { fun c -> $1 $3 $2 } | VEC_LOAD offset_opt align_opt { fun c -> $1 $3 $2 } | VEC_STORE offset_opt align_opt { fun c -> $1 $3 $2 } | VEC_LOAD_LANE offset_opt align_opt NAT - { let at = at () in fun c -> $1 $3 $2 (vec_lane_index $4 at) } + { let at = at $sloc in fun c -> $1 $3 $2 (vec_lane_index $4 at) } | VEC_STORE_LANE offset_opt align_opt NAT - { let at = at () in fun c -> $1 $3 $2 (vec_lane_index $4 at) } + { let at = at $sloc in fun c -> $1 $3 $2 (vec_lane_index $4 at) } | MEMORY_SIZE { fun c -> memory_size } | MEMORY_GROW { fun c -> memory_grow } | MEMORY_FILL { fun c -> memory_fill } @@ -645,22 +646,22 @@ plain_instr : | UNARY { fun c -> $1 } | BINARY { fun c -> $1 } | CONVERT { fun c -> $1 } - | VEC_CONST VEC_SHAPE list(num) { let at = at () in fun c -> fst (vec $1 $2 $3 at) } + | VEC_CONST VEC_SHAPE list(num) { let at = $sloc in fun c -> fst (vec $1 $2 $3 at) } | VEC_UNARY { fun c -> $1 } | VEC_BINARY { fun c -> $1 } | VEC_TERNARY { fun c -> $1 } | VEC_TEST { fun c -> $1 } | VEC_SHIFT { fun c -> $1 } | VEC_BITMASK { fun c -> $1 } - | VEC_SHUFFLE list(num) { let at = at () in fun c -> i8x16_shuffle (shuffle_lit $2 at) } + | VEC_SHUFFLE list(num) { let at = $sloc in fun c -> i8x16_shuffle (shuffle_lit $2 at) } | VEC_SPLAT { fun c -> $1 } - | VEC_EXTRACT NAT { let at = at () in fun c -> $1 (vec_lane_index $2 at) } - | VEC_REPLACE NAT { let at = at () in fun c -> $1 (vec_lane_index $2 at) } + | VEC_EXTRACT NAT { let at = at $sloc in fun c -> $1 (vec_lane_index $2 at) } + | VEC_REPLACE NAT { let at = at $sloc in fun c -> $1 (vec_lane_index $2 at) } select_instr_instr_list : | SELECT select_instr_results_instr_list - { let at1 = ati 1 in + { let at1 = $loc($1) in fun c -> let b, ts, es = $2 c in (select (if b then (Some ts) else None) @@ at1) :: es } @@ -673,31 +674,31 @@ select_instr_results_instr_list : call_instr_instr_list : | CALL_INDIRECT var call_instr_type_instr_list - { let at1 = ati 1 in + { let loc1 = $loc($1) in fun c -> let x, es = $3 c in - (call_indirect ($2 c table) x @@ at1) :: es } + (call_indirect ($2 c table) x @@ loc1) :: es } | CALL_INDIRECT call_instr_type_instr_list /* Sugar */ - { let at1 = ati 1 in + { let loc1 = $loc($1) in fun c -> let x, es = $2 c in - (call_indirect (0l @@ at1) x @@ at1) :: es } + (call_indirect (0l @@ loc1) x @@ loc1) :: es } | RETURN_CALL_INDIRECT var call_instr_type_instr_list - { let at1 = ati 1 in + { let loc1 = $loc($1) in fun c -> let x, es = $3 c in - (return_call_indirect ($2 c table) x @@ at1) :: es } + (return_call_indirect ($2 c table) x @@ loc1) :: es } | RETURN_CALL_INDIRECT call_instr_type_instr_list /* Sugar */ - { let at1 = ati 1 in + { let loc1 = $loc($1) in fun c -> let x, es = $2 c in - (return_call_indirect (0l @@ at1) x @@ at1) :: es } + (return_call_indirect (0l @@ loc1) x @@ loc1) :: es } call_instr_type_instr_list : | type_use call_instr_params_instr_list - { let at1 = ati 1 in + { let loc1 = $loc($1) in fun c -> match $2 c with | FuncT ([], []), es -> $1 c, es - | ft, es -> inline_func_type_explicit c ($1 c) ft at1, es } + | ft, es -> inline_func_type_explicit c ($1 c) ft loc1, es } | call_instr_params_instr_list - { let at = at () in + { let at = $sloc in fun c -> let ft, es = $1 c in inline_func_type c ft at, es } call_instr_params_instr_list : @@ -754,16 +755,16 @@ catch_all : resume_instr_instr : | RESUME var resume_instr_handler_instr - { let at1 = ati 1 in + { let loc1 = $loc($1) in fun c -> let x = $2 c type_ in - let hs, es = $3 c in resume x hs @@ at1, es } + let hs, es = $3 c in resume x hs @@ loc1, es } | RESUME_THROW var var resume_instr_handler_instr - { let at1 = ati 1 in + { let loc1 = $loc($1) in fun c -> let x = $2 c type_ in let tag = $3 c tag in - let hs, es = $4 c in resume_throw x tag hs @@ at1, es } + let hs, es = $4 c in resume_throw x tag hs @@ loc1, es } resume_instr_handler_instr : | LPAR TAG var var RPAR resume_instr_handler_instr @@ -792,18 +793,18 @@ block_instr : block : | type_use block_param_body - { let at1 = ati 1 in + { let loc1 = $loc($1) in fun c -> let ft, es = $2 c in - let x = inline_func_type_explicit c ($1 c) ft at1 in + let x = inline_func_type_explicit c ($1 c) ft loc1 in VarBlockType x, es } | block_param_body /* Sugar */ - { let at = at () in + { let loc = $sloc in fun c -> let ft, es = $1 c in let bt = match ft with | FuncT ([], []) -> ValBlockType None | FuncT ([], [t]) -> ValBlockType (Some t) - | ft -> VarBlockType (inline_func_type c ft at) + | ft -> VarBlockType (inline_func_type c ft loc) in bt, es } block_param_body : @@ -820,7 +821,7 @@ block_result_body : expr : /* Sugar */ | LPAR expr1 RPAR - { let at = at () in fun c -> let es, e' = $2 c in es @ [e' @@ at] } + { let at = $sloc in fun c -> let es, e' = $2 c in es @ [e' @@ at] } expr1 : /* Sugar */ | plain_instr expr_list { fun c -> $2 c, $1 c } @@ -829,13 +830,13 @@ expr1 : /* Sugar */ | CALL_INDIRECT var call_expr_type { fun c -> let x, es = $3 c in es, call_indirect ($2 c table) x } | CALL_INDIRECT call_expr_type /* Sugar */ - { let at1 = ati 1 in - fun c -> let x, es = $2 c in es, call_indirect (0l @@ at1) x } + { let loc1 = $loc($1) in + fun c -> let x, es = $2 c in es, call_indirect (0l @@ loc1) x } | RETURN_CALL_INDIRECT var call_expr_type { fun c -> let x, es = $3 c in es, return_call_indirect ($2 c table) x } | RETURN_CALL_INDIRECT call_expr_type /* Sugar */ - { let at1 = ati 1 in - fun c -> let x, es = $2 c in es, return_call_indirect (0l @@ at1) x } + { let loc1 = $loc($1) in + fun c -> let x, es = $2 c in es, return_call_indirect (0l @@ loc1) x } | RESUME var resume_expr_handler { fun c -> let x = $2 c type_ in @@ -866,14 +867,14 @@ select_expr_results : call_expr_type : | type_use call_expr_params - { let at1 = ati 1 in + { let loc1 = $loc($1) in fun c -> match $2 c with | FuncT ([], []), es -> $1 c, es - | ft, es -> inline_func_type_explicit c ($1 c) ft at1, es } + | ft, es -> inline_func_type_explicit c ($1 c) ft loc1, es } | call_expr_params - { let at1 = ati 1 in - fun c -> let ft, es = $1 c in inline_func_type c ft at1, es } + { let loc1 = $loc($1) in + fun c -> let ft, es = $1 c in inline_func_type c ft loc1, es } call_expr_params : | LPAR PARAM val_type_list RPAR call_expr_params @@ -896,19 +897,19 @@ resume_expr_handler : if_block : | type_use if_block_param_body - { let at = at () in - fun c c' -> let ft, es = $2 c c' in - let x = inline_func_type_explicit c ($1 c) ft at in - VarBlockType x, es } + { let at = $sloc in + fun c c' -> + VarBlockType (inline_func_type_explicit c ($1 c) (fst ($2 c c')) at), + snd ($2 c c') } | if_block_param_body /* Sugar */ - { let at = at () in - fun c c' -> let ft, es = $1 c c' in + { let at = $sloc in + fun c c' -> let bt = - match ft with + match fst ($1 c c') with | FuncT ([], []) -> ValBlockType None | FuncT ([], [t]) -> ValBlockType (Some t) | ft -> VarBlockType (inline_func_type c ft at) - in bt, es } + in bt, snd ($1 c c') } if_block_param_body : | if_block_result_body { $1 } @@ -933,13 +934,12 @@ if_ : try_block : | type_use try_block_param_body - { let at = at () in - fun c c' -> - let body = $2 c in + { let at = $sloc in + fun c c' -> let body = $2 c in let bt = VarBlockType (inline_func_type_explicit c' ($1 c') (fst body) at) in snd body bt c c' } | try_block_param_body /* Sugar */ - { let at = at () in + { let at = $sloc in fun c c' -> let body = $1 c in let bt = @@ -973,17 +973,17 @@ expr_list : | expr expr_list { fun c -> $1 c @ $2 c } const_expr : - | instr_list { let at = at () in fun c -> $1 c @@ at } + | instr_list { let at = $sloc in fun c -> $1 c @@ at } const_expr1 : - | instr1 instr_list { let at = at () in fun c -> ($1 c @ $2 c) @@ at } + | instr1 instr_list { let at = $sloc in fun c -> ($1 c @ $2 c) @@ at } /* Functions */ func : | LPAR FUNC bind_var_opt func_fields RPAR - { let at = at () in + { let at = $sloc in fun c -> let x = $3 c anon_func bind_func @@ at in fun () -> $4 c x at } func_fields : @@ -1028,10 +1028,10 @@ func_fields_import_result : /* Sugar */ func_fields_body : | func_result_body { $1 } | LPAR PARAM val_type_list RPAR func_fields_body - { let at3 = ati 3 in + { let loc3 = $loc($3) in (fun c -> let FuncT (ts1, ts2) = fst $5 c in FuncT (snd $3 c @ ts1, ts2)), - (fun c -> anon_locals c (fst $3) at3; snd $5 c) } + (fun c -> anon_locals c (fst $3) (at loc3); snd $5 c) } | LPAR PARAM bind_var val_type RPAR func_fields_body /* Sugar */ { (fun c -> let FuncT (ts1, ts2) = fst $6 c in FuncT ($4 c :: ts1, ts2)), @@ -1046,19 +1046,19 @@ func_result_body : func_body : | instr_list - { let at = at () in - fun c -> ignore (anon_label c at); - {ftype = -1l @@ at; locals = []; body = $1 c} } + { let loc = $sloc in + fun c -> ignore (anon_label c (at loc)); + {ftype = -1l @@ loc; locals = []; body = $1 c} } | LPAR LOCAL local_type_list RPAR func_body - { let at3 = ati 3 in - fun c -> anon_locals c (fst $3) at3; let f = $5 c in + { let loc3 = $loc($3) in + fun c -> anon_locals c (fst $3) (at loc3); let f = $5 c in {f with locals = snd $3 c @ f.Ast.locals} } | LPAR LOCAL bind_var local_type RPAR func_body /* Sugar */ { fun c -> ignore (bind_local c $3); let f = $6 c in {f with locals = $4 c :: f.Ast.locals} } local_type : - | val_type { let at = at () in fun c -> {ltype = $1 c} @@ at } + | val_type { let at = $sloc in fun c -> {ltype = $1 c} @@ at } local_type_list : | /* empty */ { 0l, fun c -> [] } @@ -1075,14 +1075,14 @@ memory_use : offset : | LPAR OFFSET const_expr RPAR { $3 } - | expr { let at = at () in fun c -> $1 c @@ at } /* Sugar */ + | expr { let at = $sloc in fun c -> $1 c @@ at } /* Sugar */ elem_kind : | FUNC { (NoNull, FuncHT) } elem_expr : | LPAR ITEM const_expr RPAR { $3 } - | expr { let at = at () in fun c -> $1 c @@ at } /* Sugar */ + | expr { let at = $sloc in fun c -> $1 c @@ at } /* Sugar */ elem_expr_list : | /* empty */ { fun c -> [] } @@ -1090,7 +1090,7 @@ elem_expr_list : elem_var_list : | var_list - { let f = function {at; _} as x -> [ref_func x @@ at] @@ at in + { let f = function {at = at'; _} as x -> Source.([ref_func x @@ at'] @@ at') in fun c -> List.map f ($1 c func) } elem_list : @@ -1102,29 +1102,29 @@ elem_list : elem : | LPAR ELEM bind_var_opt elem_list RPAR - { let at = at () in + { let at = $sloc in fun c -> ignore ($3 c anon_elem bind_elem); fun () -> let etype, einit = $4 c in { etype; einit; emode = Passive @@ at } @@ at } | LPAR ELEM bind_var_opt table_use offset elem_list RPAR - { let at = at () in + { let at = $sloc in fun c -> ignore ($3 c anon_elem bind_elem); fun () -> let etype, einit = $6 c in { etype; einit; emode = Active {index = $4 c table; offset = $5 c} @@ at } @@ at } | LPAR ELEM bind_var_opt DECLARE elem_list RPAR - { let at = at () in + { let at = $sloc in fun c -> ignore ($3 c anon_elem bind_elem); fun () -> let etype, einit = $5 c in { etype; einit; emode = Declarative @@ at } @@ at } | LPAR ELEM bind_var_opt offset elem_list RPAR /* Sugar */ - { let at = at () in + { let at = $sloc in fun c -> ignore ($3 c anon_elem bind_elem); fun () -> let etype, einit = $5 c in { etype; einit; emode = Active {index = 0l @@ at; offset = $4 c} @@ at } @@ at } | LPAR ELEM bind_var_opt offset elem_var_list RPAR /* Sugar */ - { let at = at () in + { let at = $sloc in fun c -> ignore ($3 c anon_elem bind_elem); fun () -> { etype = (NoNull, FuncHT); einit = $5 c; @@ -1132,7 +1132,7 @@ elem : table : | LPAR TABLE bind_var_opt table_fields RPAR - { let at = at () in + { let at = $sloc in fun c -> let x = $3 c anon_table bind_table @@ at in fun () -> $4 c x at } @@ -1175,23 +1175,23 @@ table_fields : data : | LPAR DATA bind_var_opt string_list RPAR - { let at = at () in + { let at = $sloc in fun c -> ignore ($3 c anon_data bind_data); fun () -> {dinit = $4; dmode = Passive @@ at} @@ at } | LPAR DATA bind_var_opt memory_use offset string_list RPAR - { let at = at () in + { let at = $sloc in fun c -> ignore ($3 c anon_data bind_data); fun () -> {dinit = $6; dmode = Active {index = $4 c memory; offset = $5 c} @@ at} @@ at } | LPAR DATA bind_var_opt offset string_list RPAR /* Sugar */ - { let at = at () in + { let at = $sloc in fun c -> ignore ($3 c anon_data bind_data); fun () -> {dinit = $5; dmode = Active {index = 0l @@ at; offset = $4 c} @@ at} @@ at } memory : | LPAR MEMORY bind_var_opt memory_fields RPAR - { let at = at () in + { let at = $sloc in fun c -> let x = $3 c anon_memory bind_memory @@ at in fun () -> $4 c x at } @@ -1216,7 +1216,7 @@ memory_fields : global : | LPAR GLOBAL bind_var_opt global_fields RPAR - { let at = at () in + { let at = $sloc in fun c -> let x = $3 c anon_global bind_global @@ at in fun () -> $4 c x at } @@ -1234,7 +1234,7 @@ global_fields : tag : | LPAR TAG bind_var_opt tag_fields RPAR - { let at = at () in + { let at = $sloc in fun c -> let x = $3 c anon_tag bind_tag @@ at in fun () -> $4 c x at } @@ -1257,7 +1257,7 @@ import_desc : { fun c -> ignore ($3 c anon_func bind_func); fun () -> FuncImport ($4 c) } | LPAR FUNC bind_var_opt func_type RPAR /* Sugar */ - { let at4 = ati 4 in + { let at4 = $loc($4) in fun c -> ignore ($3 c anon_func bind_func); fun () -> FuncImport (inline_func_type c ($4 c) at4) } | LPAR TABLE bind_var_opt table_type RPAR @@ -1270,13 +1270,13 @@ import_desc : { fun c -> ignore ($3 c anon_global bind_global); fun () -> GlobalImport ($4 c) } | LPAR TAG bind_var_opt tag_type RPAR - { let at4 = ati 4 in + { let at4 = $loc($4) in fun c -> ignore ($3 c anon_tag bind_tag); fun () -> TagImport (inline_tag_type c ($4 c) at4) } import : | LPAR IMPORT name name import_desc RPAR - { let at = at () and at5 = ati 5 in + { let at = $sloc and at5 = $loc($5) in fun c -> let df = $5 c in fun () -> {module_name = $3; item_name = $4; idesc = df () @@ at5} @@ at } @@ -1292,20 +1292,20 @@ export_desc : export : | LPAR EXPORT name export_desc RPAR - { let at = at () and at4 = ati 4 in + { let at = $sloc and at4 = $loc($4) in fun c -> {name = $3; edesc = $4 c @@ at4} @@ at } inline_export : | LPAR EXPORT name RPAR - { let at = at () in fun d c -> {name = $3; edesc = d @@ at} @@ at } + { let at = $sloc in fun d c -> {name = $3; edesc = d @@ at} @@ at } /* Modules */ type_def : | LPAR TYPE sub_type RPAR - { let at = at () in - fun c -> let x = anon_type c at in fun () -> $3 c x } + { let loc = $sloc in + fun c -> let x = anon_type c (at loc) in fun () -> $3 c x } | LPAR TYPE bind_var sub_type RPAR /* Sugar */ { fun c -> let x = bind_type c $3 in fun () -> $4 c x } @@ -1329,12 +1329,12 @@ rec_type : type_ : | rec_type - { let at = at () in + { let at = $sloc in fun c -> let tf = $1 c in fun () -> define_type c (tf () @@ at) } start : | LPAR START var RPAR - { let at = at () in fun c -> {sfunc = $3 c func} @@ at } + { let at = $sloc in fun c -> {sfunc = $3 c func} @@ at } module_fields : | /* empty */ @@ -1415,107 +1415,107 @@ module_fields1 : {m with exports = $1 c :: m.exports} } module_var : - | VAR { $1 @@ at () } /* Sugar */ + | VAR { $1 @@ $sloc } /* Sugar */ module_ : | LPAR MODULE option(module_var) module_fields RPAR - { $3, Textual ($4 (empty_context ()) () () @@ at ()) @@ at () } + { $3, Textual ($4 (empty_context ()) () () @@ $sloc) @@ $sloc } inline_module : /* Sugar */ - | module_fields { Textual ($1 (empty_context ()) () () @@ at ()) @@ at () } + | module_fields { Textual ($1 (empty_context ()) () () @@ $sloc) @@ $sloc } inline_module1 : /* Sugar */ - | module_fields1 { Textual ($1 (empty_context ()) () () @@ at ()) @@ at () } + | module_fields1 { Textual ($1 (empty_context ()) () () @@ $sloc) @@ $sloc } /* Scripts */ script_var : - | VAR { $1 @@ at () } /* Sugar */ + | VAR { $1 @@ $sloc } /* Sugar */ script_module : | module_ { $1 } | LPAR MODULE option(module_var) BIN string_list RPAR - { $3, Encoded ("binary:" ^ string_of_pos (at()).left, $5) @@ at() } + { $3, Encoded ("binary:" ^ string_of_pos (at $sloc).left, $5) @@ $sloc } | LPAR MODULE option(module_var) QUOTE string_list RPAR - { $3, Quoted ("quote:" ^ string_of_pos (at()).left, $5) @@ at() } + { $3, Quoted ("quote:" ^ string_of_pos (at $sloc).left, $5) @@ $sloc } action : | LPAR INVOKE option(module_var) name list(literal) RPAR - { Invoke ($3, $4, $5) @@ at () } + { Invoke ($3, $4, $5) @@ $sloc } | LPAR GET option(module_var) name RPAR - { Get ($3, $4) @@ at() } + { Get ($3, $4) @@ $sloc } assertion : | LPAR ASSERT_MALFORMED script_module STRING RPAR - { AssertMalformed (snd $3, $4) @@ at () } + { AssertMalformed (snd $3, $4) @@ $sloc } | LPAR ASSERT_INVALID script_module STRING RPAR - { AssertInvalid (snd $3, $4) @@ at () } + { AssertInvalid (snd $3, $4) @@ $sloc } | LPAR ASSERT_UNLINKABLE script_module STRING RPAR - { AssertUnlinkable (snd $3, $4) @@ at () } + { AssertUnlinkable (snd $3, $4) @@ $sloc } | LPAR ASSERT_TRAP script_module STRING RPAR - { AssertUninstantiable (snd $3, $4) @@ at () } - | LPAR ASSERT_RETURN action list(result) RPAR { AssertReturn ($3, $4) @@ at () } - | LPAR ASSERT_TRAP action STRING RPAR { AssertTrap ($3, $4) @@ at () } - | LPAR ASSERT_EXCEPTION action STRING RPAR { AssertException ($3, $4) @@ at () } - | LPAR ASSERT_SUSPENSION action STRING RPAR { AssertSuspension ($3, $4) @@ at () } - | LPAR ASSERT_EXHAUSTION action STRING RPAR { AssertExhaustion ($3, $4) @@ at () } + { AssertUninstantiable (snd $3, $4) @@ $sloc } + | LPAR ASSERT_RETURN action list(result) RPAR { AssertReturn ($3, $4) @@ $sloc } + | LPAR ASSERT_TRAP action STRING RPAR { AssertTrap ($3, $4) @@ $sloc } + | LPAR ASSERT_EXCEPTION action STRING RPAR { AssertException ($3, $4) @@ $sloc } + | LPAR ASSERT_SUSPENSION action STRING RPAR { AssertSuspension ($3, $4) @@ $sloc } + | LPAR ASSERT_EXHAUSTION action STRING RPAR { AssertExhaustion ($3, $4) @@ $sloc } cmd : - | action { Action $1 @@ at () } - | assertion { Assertion $1 @@ at () } - | script_module { Module (fst $1, snd $1) @@ at () } - | LPAR REGISTER name option(module_var) RPAR { Register ($3, $4) @@ at () } - | meta { Meta $1 @@ at () } + | action { Action $1 @@ $sloc } + | assertion { Assertion $1 @@ $sloc } + | script_module { Module (fst $1, snd $1) @@ $sloc } + | LPAR REGISTER name option(module_var) RPAR { Register ($3, $4) @@ $sloc } + | meta { Meta $1 @@ $sloc } meta : - | LPAR SCRIPT option(script_var) list(cmd) RPAR { Script ($3, $4) @@ at () } - | LPAR INPUT option(script_var) STRING RPAR { Input ($3, $4) @@ at () } - | LPAR OUTPUT option(script_var) STRING RPAR { Output ($3, Some $4) @@ at () } - | LPAR OUTPUT option(script_var) RPAR { Output ($3, None) @@ at () } + | LPAR SCRIPT option(script_var) list(cmd) RPAR { Script ($3, $4) @@ $sloc } + | LPAR INPUT option(script_var) STRING RPAR { Input ($3, $4) @@ $sloc } + | LPAR OUTPUT option(script_var) STRING RPAR { Output ($3, Some $4) @@ $sloc } + | LPAR OUTPUT option(script_var) RPAR { Output ($3, None) @@ $sloc } literal_num : | LPAR CONST num RPAR { snd (num $2 $3) } literal_vec : - | LPAR VEC_CONST VEC_SHAPE list(num) RPAR { snd (vec $2 $3 $4 (at ())) } + | LPAR VEC_CONST VEC_SHAPE list(num) RPAR { snd (vec $2 $3 $4 $sloc) } literal_ref : | LPAR REF_NULL heap_type RPAR { Value.NullRef ($3 (empty_context ())) } - | LPAR REF_HOST NAT RPAR { Script.HostRef (nat32 $3 (ati 3)) } - | LPAR REF_EXTERN NAT RPAR { Extern.ExternRef (Script.HostRef (nat32 $3 (ati 3))) } + | LPAR REF_HOST NAT RPAR { Script.HostRef (nat32 $3 $loc($3)) } + | LPAR REF_EXTERN NAT RPAR { Extern.ExternRef (Script.HostRef (nat32 $3 $loc($3))) } literal : - | literal_num { Value.Num $1 @@ at () } - | literal_vec { Value.Vec $1 @@ at () } - | literal_ref { Value.Ref $1 @@ at () } + | literal_num { Value.Num $1 @@ $sloc } + | literal_vec { Value.Vec $1 @@ $sloc } + | literal_ref { Value.Ref $1 @@ $sloc } numpat : | num { fun sh -> vec_lane_lit sh $1.it $1.at } - | NAN { fun sh -> vec_lane_nan sh $1 (ati 3) } + | NAN { fun sh -> vec_lane_nan sh $1 (at $sloc) } result : - | literal_num { NumResult (NumPat ($1 @@ at())) @@ at () } - | LPAR CONST NAN RPAR { NumResult (NanPat (nanop $2 ($3 @@ ati 3))) @@ at () } - | literal_ref { RefResult (RefPat ($1 @@ at ())) @@ at () } - | LPAR REF RPAR { RefResult (RefTypePat AnyHT) @@ at () } - | LPAR REF_EQ RPAR { RefResult (RefTypePat EqHT) @@ at () } - | LPAR REF_I31 RPAR { RefResult (RefTypePat I31HT) @@ at () } - | LPAR REF_STRUCT RPAR { RefResult (RefTypePat StructHT) @@ at () } - | LPAR REF_ARRAY RPAR { RefResult (RefTypePat ArrayHT) @@ at () } - | LPAR REF_FUNC RPAR { RefResult (RefTypePat FuncHT) @@ at () } - | LPAR REF_EXTERN RPAR { RefResult (RefTypePat ExternHT) @@ at () } - | LPAR REF_NULL RPAR { RefResult NullPat @@ at () } + | literal_num { NumResult (NumPat ($1 @@ $sloc)) @@ $sloc } + | LPAR CONST NAN RPAR { NumResult (NanPat (nanop $2 ($3 @@ $loc($3)))) @@ $sloc } + | literal_ref { RefResult (RefPat ($1 @@ $sloc)) @@ $sloc } + | LPAR REF RPAR { RefResult (RefTypePat AnyHT) @@ $sloc } + | LPAR REF_EQ RPAR { RefResult (RefTypePat EqHT) @@ $sloc } + | LPAR REF_I31 RPAR { RefResult (RefTypePat I31HT) @@ $sloc } + | LPAR REF_STRUCT RPAR { RefResult (RefTypePat StructHT) @@ $sloc } + | LPAR REF_ARRAY RPAR { RefResult (RefTypePat ArrayHT) @@ $sloc } + | LPAR REF_FUNC RPAR { RefResult (RefTypePat FuncHT) @@ $sloc } + | LPAR REF_EXTERN RPAR { RefResult (RefTypePat ExternHT) @@ $sloc } + | LPAR REF_NULL RPAR { RefResult NullPat @@ $sloc } | LPAR VEC_CONST VEC_SHAPE list(numpat) RPAR { if V128.num_lanes $3 <> List.length $4 then - error (at ()) "wrong number of lane literals"; + error (at $sloc) "wrong number of lane literals"; VecResult (VecPat - (Value.V128 ($3, List.map (fun lit -> lit $3) $4))) @@ at () } + (Value.V128 ($3, List.map (fun lit -> lit $3) $4))) @@ $sloc } script : | list(cmd) EOF { $1 } - | inline_module1 EOF { [Module (None, $1) @@ at ()] } /* Sugar */ + | inline_module1 EOF { [Module (None, $1) @@ $sloc] } /* Sugar */ script1 : | cmd { [$1] } diff --git a/test/core/float_literals.wast b/test/core/float_literals.wast index 3b3ed76bb6..9f6fa55ad3 100644 --- a/test/core/float_literals.wast +++ b/test/core/float_literals.wast @@ -25,6 +25,10 @@ (func (export "f32.max_finite") (result i32) (i32.reinterpret_f32 (f32.const 0x1.fffffep+127))) (func (export "f32.max_subnormal") (result i32) (i32.reinterpret_f32 (f32.const 0x1.fffffcp-127))) (func (export "f32.trailing_dot") (result i32) (i32.reinterpret_f32 (f32.const 0x1.p10))) + (func (export "f32.misc_int") (result i32) (i32.reinterpret_f32 (f32.const 0x12345))) + (func (export "f32.large_int") (result i32) (i32.reinterpret_f32 (f32.const 0x1_0000_0000_0000_0000_0000))) + (func (export "f32.min_int32") (result i32) (i32.reinterpret_f32 (f32.const -0x8000_0000))) + (func (export "f32.min_int64") (result i32) (i32.reinterpret_f32 (f32.const -0x8000_0000_0000_0000))) ;; f32 in decimal format (func (export "f32_dec.zero") (result i32) (i32.reinterpret_f32 (f32.const 0.0e0))) @@ -36,6 +40,10 @@ (func (export "f32_dec.max_subnormal") (result i32) (i32.reinterpret_f32 (f32.const 1.1754942e-38))) (func (export "f32_dec.max_finite") (result i32) (i32.reinterpret_f32 (f32.const 3.4028234e+38))) (func (export "f32_dec.trailing_dot") (result i32) (i32.reinterpret_f32 (f32.const 1.e10))) + (func (export "f32_dec.misc_int") (result i32) (i32.reinterpret_f32 (f32.const 12345))) + (func (export "f32_dec.large_int") (result i32) (i32.reinterpret_f32 (f32.const 100_000_000_000_000_000_000))) + (func (export "f32_dec.min_int32") (result i32) (i32.reinterpret_f32 (f32.const -2147483648))) + (func (export "f32_dec.min_int64") (result i32) (i32.reinterpret_f32 (f32.const -9223372036854775808))) ;; https://twitter.com/Archivd/status/994637336506912768 (func (export "f32_dec.root_beer_float") (result i32) (i32.reinterpret_f32 (f32.const 1.000000119))) @@ -64,6 +72,10 @@ (func (export "f64.max_subnormal") (result i64) (i64.reinterpret_f64 (f64.const 0x0.fffffffffffffp-1022))) (func (export "f64.max_finite") (result i64) (i64.reinterpret_f64 (f64.const 0x1.fffffffffffffp+1023))) (func (export "f64.trailing_dot") (result i64) (i64.reinterpret_f64 (f64.const 0x1.p100))) + (func (export "f64.misc_int") (result i64) (i64.reinterpret_f64 (f64.const 0x12345))) + (func (export "f64.large_int") (result i64) (i64.reinterpret_f64 (f64.const 0x1_0000_0000_0000_0000_0000))) + (func (export "f64.min_int32") (result i64) (i64.reinterpret_f64 (f64.const -0x8000_0000))) + (func (export "f64.min_int64") (result i64) (i64.reinterpret_f64 (f64.const -0x8000_0000_0000_0000))) ;; f64 numbers in decimal format (func (export "f64_dec.zero") (result i64) (i64.reinterpret_f64 (f64.const 0.0e0))) @@ -75,6 +87,10 @@ (func (export "f64_dec.max_subnormal") (result i64) (i64.reinterpret_f64 (f64.const 2.2250738585072011e-308))) (func (export "f64_dec.max_finite") (result i64) (i64.reinterpret_f64 (f64.const 1.7976931348623157e+308))) (func (export "f64_dec.trailing_dot") (result i64) (i64.reinterpret_f64 (f64.const 1.e100))) + (func (export "f64_dec.misc_int") (result i64) (i64.reinterpret_f64 (f64.const 12345))) + (func (export "f64_dec.large_int") (result i64) (i64.reinterpret_f64 (f64.const 100_000_000_000_000_000_000))) + (func (export "f64_dec.min_int32") (result i64) (i64.reinterpret_f64 (f64.const -2147483648))) + (func (export "f64_dec.min_int64") (result i64) (i64.reinterpret_f64 (f64.const -9223372036854775808))) ;; https://twitter.com/Archivd/status/994637336506912768 (func (export "f64_dec.root_beer_float") (result i64) (i64.reinterpret_f64 (f64.const 1.000000119))) @@ -123,6 +139,10 @@ (assert_return (invoke "f32.max_subnormal") (i32.const 0x7fffff)) (assert_return (invoke "f32.max_finite") (i32.const 0x7f7fffff)) (assert_return (invoke "f32.trailing_dot") (i32.const 0x44800000)) +(assert_return (invoke "f32.misc_int") (i32.const 0x4791a280)) +(assert_return (invoke "f32.large_int") (i32.const 0x67800000)) +(assert_return (invoke "f32.min_int32") (i32.const 0xcf000000)) +(assert_return (invoke "f32.min_int64") (i32.const 0xdf000000)) (assert_return (invoke "f32_dec.zero") (i32.const 0)) (assert_return (invoke "f32_dec.positive_zero") (i32.const 0)) (assert_return (invoke "f32_dec.negative_zero") (i32.const 0x80000000)) @@ -133,6 +153,10 @@ (assert_return (invoke "f32_dec.max_finite") (i32.const 0x7f7fffff)) (assert_return (invoke "f32_dec.trailing_dot") (i32.const 0x501502f9)) (assert_return (invoke "f32_dec.root_beer_float") (i32.const 0x3f800001)) +(assert_return (invoke "f32_dec.misc_int") (i32.const 0x4640e400)) +(assert_return (invoke "f32_dec.large_int") (i32.const 0x60ad78ec)) +(assert_return (invoke "f32_dec.min_int32") (i32.const 0xcf000000)) +(assert_return (invoke "f32_dec.min_int64") (i32.const 0xdf000000)) (assert_return (invoke "f64.nan") (i64.const 0x7ff8000000000000)) (assert_return (invoke "f64.positive_nan") (i64.const 0x7ff8000000000000)) @@ -155,6 +179,10 @@ (assert_return (invoke "f64.max_subnormal") (i64.const 0xfffffffffffff)) (assert_return (invoke "f64.max_finite") (i64.const 0x7fefffffffffffff)) (assert_return (invoke "f64.trailing_dot") (i64.const 0x4630000000000000)) +(assert_return (invoke "f64.misc_int") (i64.const 0x40f2345000000000)) +(assert_return (invoke "f64.large_int") (i64.const 0x44f0000000000000)) +(assert_return (invoke "f64.min_int32") (i64.const 0xc1e0000000000000)) +(assert_return (invoke "f64.min_int64") (i64.const 0xc3e0000000000000)) (assert_return (invoke "f64_dec.zero") (i64.const 0)) (assert_return (invoke "f64_dec.positive_zero") (i64.const 0)) (assert_return (invoke "f64_dec.negative_zero") (i64.const 0x8000000000000000)) @@ -165,6 +193,10 @@ (assert_return (invoke "f64_dec.max_finite") (i64.const 0x7fefffffffffffff)) (assert_return (invoke "f64_dec.trailing_dot") (i64.const 0x54b249ad2594c37d)) (assert_return (invoke "f64_dec.root_beer_float") (i64.const 0x3ff000001ff19e24)) +(assert_return (invoke "f64_dec.misc_int") (i64.const 0x40c81c8000000000)) +(assert_return (invoke "f64_dec.large_int") (i64.const 0x4415af1d78b58c40)) +(assert_return (invoke "f64_dec.min_int32") (i64.const 0xc1e0000000000000)) +(assert_return (invoke "f64_dec.min_int64") (i64.const 0xc3e0000000000000)) (assert_return (invoke "f32-dec-sep1") (f32.const 1000000)) (assert_return (invoke "f32-dec-sep2") (f32.const 1000))