From 0cf128e98be41aae55d58d0b5edc65c1cf26b416 Mon Sep 17 00:00:00 2001 From: Andreas Rossberg Date: Fri, 8 Mar 2019 20:27:51 +0100 Subject: [PATCH] [interpreter] Refactor element type in passive segments (#71) * Refactor type in passive segments * Make tests more specific --- interpreter/binary/decode.ml | 39 +++++++++---------- interpreter/binary/encode.ml | 28 +++++++------- interpreter/exec/eval.ml | 68 +++++++++++++++++---------------- interpreter/runtime/instance.ml | 8 ++-- interpreter/syntax/ast.ml | 20 +++++----- interpreter/text/arrange.ml | 10 ++--- interpreter/text/parser.mly | 22 +++++------ interpreter/valid/valid.ml | 36 ++++++++--------- test/core/binary.wast | 10 ++++- test/core/bulk.wast | 8 ++-- test/core/table_init.wast | 8 ++-- 11 files changed, 130 insertions(+), 127 deletions(-) diff --git a/interpreter/binary/decode.ml b/interpreter/binary/decode.ml index 00b13d5442..0686703613 100644 --- a/interpreter/binary/decode.ml +++ b/interpreter/binary/decode.ml @@ -5,12 +5,12 @@ type stream = name : string; bytes : string; pos : int ref; - has_data_count : bool ref; + need_data_count : bool ref; } exception EOS -let stream name bs = {name; bytes = bs; pos = ref 0; has_data_count = ref false} +let stream name bs = {name; bytes = bs; pos = ref 0; need_data_count = ref false} let len s = String.length s.bytes let pos s = !(s.pos) @@ -202,18 +202,15 @@ let memop s = let offset = vu32 s in Int32.to_int align, offset -let check_data_count s = - require !(s.has_data_count) s (pos s - 1) "data count section required" - let misc_instr s = let pos = pos s in match op s with | 0x08 -> - check_data_count s; let x = at var s in zero_flag s; + s.need_data_count := true; memory_init x - | 0x09 -> check_data_count s; data_drop (at var s) + | 0x09 -> s.need_data_count := true; data_drop (at var s) | 0x0a -> zero_flag s; zero_flag s; memory_copy | 0x0b -> zero_flag s; memory_fill | 0x0c -> @@ -625,8 +622,8 @@ let segment active passive s = let init = active s in Active {index; offset; init} | 1l -> - let init = passive s in - Passive init + let etype, data = passive s in + Passive {etype; data} | 2l -> let index = at var s in let offset = const s in @@ -634,7 +631,8 @@ let segment active passive s = Active {index; offset; init} | _ -> error s (pos s - 1) "invalid segment kind" -let active_elem s = Func (at var s) +let active_elem s = + Func (at var s) let passive_elem s = match u8 s with @@ -646,7 +644,7 @@ let passive_elem s = | _ -> error s (pos s - 1) "invalid elem" let active_elem_segment s = - FuncRefType, vec (at active_elem) s + vec (at active_elem) s let passive_elem_segment s = let etype = elem_type s in @@ -663,7 +661,7 @@ let elem_section s = (* Data section *) let memory_segment s = - segment string string s + segment string (fun s -> (), string s) s let data_section s = section `DataSection (vec (at memory_segment)) [] s @@ -671,11 +669,11 @@ let data_section s = (* DataCount section *) +let data_count s = + Some (vu32 s) + let data_count_section s = - let contents s = - s.has_data_count := true; - opt vu32 true s - in section `DataCountSection contents None s + section `DataCountSection data_count None s (* Custom section *) @@ -722,18 +720,19 @@ let module_ s = iterate custom_section s; let func_bodies = code_section s in iterate custom_section s; - let data = data_section s in + let datas = data_section s in iterate custom_section s; require (pos s = len s) s (len s) "junk after last section"; require (List.length func_types = List.length func_bodies) s (len s) "function and code section have inconsistent lengths"; - require - (data_count = None || data_count = Some (Int32.of_int (List.length data))) + require (data_count = None || data_count = Some (Lib.List32.length datas)) s (len s) "data count and data section have inconsistent lengths"; + require (not !(s.need_data_count) || data_count <> None) + s (len s) "data count section required"; let funcs = List.map2 Source.(fun t f -> {f.it with ftype = t} @@ f.at) func_types func_bodies - in {types; tables; memories; globals; funcs; imports; exports; elems; data; start} + in {types; tables; memories; globals; funcs; imports; exports; elems; datas; start} let decode name bs = at module_ (stream name bs) diff --git a/interpreter/binary/encode.ml b/interpreter/binary/encode.ml index c983ca81c8..87abace93d 100644 --- a/interpreter/binary/encode.ml +++ b/interpreter/binary/encode.ml @@ -485,10 +485,9 @@ let encode m = else begin u8 0x02; var index end; - const offset; - active init - | Passive init -> - u8 0x01; passive init + const offset; active init + | Passive {etype; data} -> + u8 0x01; passive etype data let active_elem el = match el.it with @@ -501,8 +500,8 @@ let encode m = | Func x -> u8 0xd2; var x; end_ () let table_segment seg = - let active (_,init) = vec active_elem init in - let passive (etype,init) = elem_type etype; vec passive_elem init in + let active init = vec active_elem init in + let passive etype data = elem_type etype; vec passive_elem data in segment active passive seg let elem_section elems = @@ -510,15 +509,14 @@ let encode m = (* Data section *) let memory_segment seg = - segment string string seg + segment string (fun _ s -> string s) seg - let data_section data = - section 11 (vec memory_segment) data (data <> []) + let data_section datas = + section 11 (vec memory_segment) datas (datas <> []) - (* DataCount section *) - - let data_count_section data = - section 12 len (List.length data) (data <> []) + (* Data count section *) + let data_count_section datas = + section 12 len (List.length datas) true (* Module *) @@ -534,8 +532,8 @@ let encode m = export_section m.it.exports; start_section m.it.start; elem_section m.it.elems; - data_count_section m.it.data; + data_count_section m.it.datas; code_section m.it.funcs; - data_section m.it.data + data_section m.it.datas end in E.module_ m; to_string s diff --git a/interpreter/exec/eval.ml b/interpreter/exec/eval.ml index 13220ae57b..fb6f134b4e 100644 --- a/interpreter/exec/eval.ml +++ b/interpreter/exec/eval.ml @@ -82,11 +82,11 @@ let func (inst : module_inst) x = lookup "function" inst.funcs x let table (inst : module_inst) x = lookup "table" inst.tables x let memory (inst : module_inst) x = lookup "memory" inst.memories x let global (inst : module_inst) x = lookup "global" inst.globals x -let elems (inst : module_inst) x = lookup "elems" inst.elems x -let data (inst : module_inst) x = lookup "data" inst.data x +let elem (inst : module_inst) x = lookup "element segment" inst.elems x +let data (inst : module_inst) x = lookup "data segment" inst.datas x let local (frame : frame) x = lookup "local" frame.locals x -let elem inst x i at = +let any_elem inst x i at = match Table.load (table inst x) i with | Table.Uninitialized -> Trap.error at ("uninitialized element " ^ Int32.to_string i) @@ -95,7 +95,7 @@ let elem inst x i at = Trap.error at ("undefined element " ^ Int32.to_string i) let func_elem inst x i at = - match elem inst x i at with + match any_elem inst x i at with | FuncElem f -> f | _ -> Crash.error at ("type mismatch for element " ^ Int32.to_string i) @@ -263,13 +263,8 @@ let rec step (c : config) : config = let src = I64_convert.extend_i32_u s in (try Memory.init mem bs dst src n; vs', [] with exn -> vs', [Trapping (memory_error e.at exn) @@ e.at]) - | None -> vs', [Trapping "data segment dropped" @@ e.at]) - - | DataDrop x, vs -> - let seg = data frame.inst x in - (match !seg with - | Some _ -> seg := None; vs, [] - | None -> vs, [Trapping "data segment dropped" @@ e.at]) + | None -> vs', [Trapping "data segment dropped" @@ e.at] + ) | MemoryCopy, I32 n :: I32 s :: I32 d :: vs' -> let mem = memory frame.inst (0l @@ e.at) in @@ -286,23 +281,32 @@ let rec step (c : config) : config = | TableInit x, I32 n :: I32 s :: I32 d :: vs' -> let tab = table frame.inst (0l @@ e.at) in - (match !(elems frame.inst x) with + (match !(elem frame.inst x) with | Some es -> (try Table.init tab es d s n; vs', [] with exn -> vs', [Trapping (table_error e.at exn) @@ e.at]) - | None -> vs', [Trapping "elements segment dropped" @@ e.at]) - - | ElemDrop x, vs -> - let seg = elems frame.inst x in - (match !seg with - | Some _ -> seg := None; vs, [] - | None -> vs, [Trapping "elements segment dropped" @@ e.at]) + | None -> vs', [Trapping "element segment dropped" @@ e.at] + ) | TableCopy, I32 n :: I32 s :: I32 d :: vs' -> let tab = table frame.inst (0l @@ e.at) in (try Table.copy tab d s n; vs', [] with exn -> vs', [Trapping (table_error e.at exn) @@ e.at]) + | DataDrop x, vs -> + let seg = data frame.inst x in + (match !seg with + | Some _ -> seg := None; vs, [] + | None -> vs, [Trapping "data segment dropped" @@ e.at] + ) + + | ElemDrop x, vs -> + let seg = elem frame.inst x in + (match !seg with + | Some _ -> seg := None; vs, [] + | None -> vs, [Trapping "element segment dropped" @@ e.at] + ) + | _ -> let s1 = string_of_values (List.rev vs) in let s2 = string_of_value_types (List.map type_of (List.rev vs)) in @@ -435,22 +439,22 @@ let create_export (inst : module_inst) (ex : export) : export_inst = | GlobalExport x -> ExternGlobal (global inst x) in name, ext -let elems_list inst init = +let elem_list inst init = let to_elem el = match el.it with | Null -> Table.Uninitialized | Func x -> FuncElem (func inst x) in List.map to_elem init -let create_elems (inst : module_inst) (seg : table_segment) : elems_inst = +let create_elem (inst : module_inst) (seg : table_segment) : elem_inst = match seg.it with | Active _ -> ref None - | Passive (_,init) -> ref (Some (elems_list inst init)) + | Passive {data; _} -> ref (Some (elem_list inst data)) let create_data (inst : module_inst) (seg : memory_segment) : data_inst = match seg.it with | Active _ -> ref None - | Passive init -> ref (Some init) + | Passive {data; _} -> ref (Some data) let init_func (inst : module_inst) (func : func_inst) = @@ -460,14 +464,14 @@ let init_func (inst : module_inst) (func : func_inst) = let init_table (inst : module_inst) (seg : table_segment) = match seg.it with - | Active {index; offset = const; init = (_,init)} -> + | Active {index; offset = const; init} -> let tab = table inst index in let offset = i32 (eval_const inst const) const.at in - let elems = elems_list inst init in + let elems = elem_list inst init in let len = Int32.of_int (List.length elems) in (try Table.init tab elems offset 0l len with Table.Bounds -> Link.error seg.at "elements segment does not fit table") - | Passive init -> () + | Passive _ -> () let init_memory (inst : module_inst) (seg : memory_segment) = match seg.it with @@ -478,7 +482,7 @@ let init_memory (inst : module_inst) (seg : memory_segment) = let len = Int32.of_int (String.length init) in (try Memory.init mem init offset 0L len with Memory.Bounds -> Link.error seg.at "data segment does not fit memory") - | Passive init -> () + | Passive _ -> () let add_import (m : module_) (ext : extern) (im : import) (inst : module_inst) @@ -494,7 +498,7 @@ let add_import (m : module_) (ext : extern) (im : import) (inst : module_inst) let init (m : module_) (exts : extern list) : module_inst = let { imports; tables; memories; globals; funcs; types; - exports; elems; data; start + exports; elems; datas; start } = m.it in if List.length exts <> List.length imports then @@ -509,18 +513,18 @@ let init (m : module_) (exts : extern list) : module_inst = funcs = inst0.funcs @ fs; tables = inst0.tables @ List.map (create_table inst0) tables; memories = inst0.memories @ List.map (create_memory inst0) memories; - globals = inst0.globals @ List.map (create_global inst0) globals + globals = inst0.globals @ List.map (create_global inst0) globals; } in let inst = { inst1 with exports = List.map (create_export inst1) exports; - elems = List.map (create_elems inst1) elems; - data = List.map (create_data inst1) data + elems = List.map (create_elem inst1) elems; + datas = List.map (create_data inst1) datas; } in List.iter (init_func inst) fs; List.iter (init_table inst) elems; - List.iter (init_memory inst) data; + List.iter (init_memory inst) datas; Lib.Option.app (fun x -> ignore (invoke (func inst x) [])) start; inst diff --git a/interpreter/runtime/instance.ml b/interpreter/runtime/instance.ml index eb821d2ee0..de0e814189 100644 --- a/interpreter/runtime/instance.ml +++ b/interpreter/runtime/instance.ml @@ -8,8 +8,8 @@ type module_inst = memories : memory_inst list; globals : global_inst list; exports : export_inst list; - elems : elems_inst list; - data : data_inst list; + elems : elem_inst list; + datas : data_inst list; } and func_inst = module_inst ref Func.t @@ -17,7 +17,7 @@ and table_inst = Table.t and memory_inst = Memory.t and global_inst = Global.t and export_inst = Ast.name * extern -and elems_inst = Table.elem list option ref +and elem_inst = Table.elem list option ref and data_inst = string option ref and extern = @@ -33,7 +33,7 @@ type Table.elem += FuncElem of func_inst let empty_module_inst = { types = []; funcs = []; tables = []; memories = []; globals = []; - exports = []; elems = []; data = [] } + exports = []; elems = []; datas = [] } let extern_type_of = function | ExternFunc func -> ExternFuncType (Func.type_of func) diff --git a/interpreter/syntax/ast.ml b/interpreter/syntax/ast.ml index d33ed8a41b..3bcbc3a53b 100644 --- a/interpreter/syntax/ast.ml +++ b/interpreter/syntax/ast.ml @@ -98,12 +98,12 @@ and instr' = | Binary of binop (* binary numeric operator *) | Convert of cvtop (* conversion *) | MemoryInit of var (* initialize memory from segment *) - | DataDrop of var (* drop passive data segment *) | MemoryCopy (* copy memory regions *) | MemoryFill (* fill memory region with value *) | TableInit of var (* initialize table from segment *) - | ElemDrop of var (* drop passive element segment *) | TableCopy (* copy elements between table regions *) + | DataDrop of var (* drop passive data segment *) + | ElemDrop of var (* drop passive element segment *) (* Globals & Functions *) @@ -140,18 +140,18 @@ and memory' = mtype : memory_type; } -type 'data segment = 'data segment' Source.phrase -and 'data segment' = +type ('data, 'ty) segment = ('data, 'ty) segment' Source.phrase +and ('data, 'ty) segment' = | Active of {index : var; offset : const; init : 'data} - | Passive of 'data + | Passive of {etype : 'ty; data : 'data} type elem = elem' Source.phrase and elem' = | Null | Func of var -type table_segment = (elem_type * (elem list)) segment -type memory_segment = string segment +type table_segment = (elem list, elem_type) segment +type memory_segment = (string, unit) segment (* Modules *) @@ -197,7 +197,7 @@ and module_' = funcs : func list; start : var option; elems : table_segment list; - data : memory_segment list; + datas : memory_segment list; imports : import list; exports : export list; } @@ -213,8 +213,8 @@ let empty_module = memories = []; funcs = []; start = None; - elems = []; - data = []; + elems = []; + datas = []; imports = []; exports = []; } diff --git a/interpreter/text/arrange.ml b/interpreter/text/arrange.ml index da39e9fba0..42014540d2 100644 --- a/interpreter/text/arrange.ml +++ b/interpreter/text/arrange.ml @@ -300,7 +300,7 @@ let segment head active passive seg = match seg.it with | Active {index; offset; init} -> Node (head, atom var index :: Node ("offset", const offset) :: active init) - | Passive init -> Node (head ^ " passive", passive init) + | Passive {etype; data} -> Node (head ^ " passive", passive etype data) let active_elem el = match el.it with @@ -313,12 +313,12 @@ let passive_elem el = | Func x -> Node ("ref.func", [atom var x]) let elems seg = - let active (_,init) = list active_elem init in - let passive (etype,init) = atom elem_type etype :: list passive_elem init in + let active init = list active_elem init in + let passive etype init = atom elem_type etype :: list passive_elem init in segment "elem" active passive seg let data seg = - segment "data" break_bytes break_bytes seg + segment "data" break_bytes (fun _ bs -> break_bytes bs) seg (* Modules *) @@ -389,7 +389,7 @@ let module_with_var_opt x_opt m = list export m.it.exports @ opt start m.it.start @ list elems m.it.elems @ - list data m.it.data + list data m.it.datas ) let binary_module_with_var_opt x_opt bs = diff --git a/interpreter/text/parser.mly b/interpreter/text/parser.mly index f8871a2ea3..ffb90b2808 100644 --- a/interpreter/text/parser.mly +++ b/interpreter/text/parser.mly @@ -587,25 +587,21 @@ elem : | LPAR ELEM bind_var_opt PASSIVE elem_type passive_elemref_list RPAR { let at = at () in fun c -> ignore ($3 c anon_elem bind_elem); - fun () -> Passive ($5, ($6 c)) @@ at } + fun () -> Passive {etype = $5; data = $6 c} @@ at } | LPAR ELEM bind_var var offset active_elemref_list RPAR { let at = at () in fun c -> ignore (bind_elem c $3); fun () -> - let init = FuncRefType, ($6 c func) in - Active {index = $4 c table; offset = $5 c; init} @@ at } + Active {index = $4 c table; offset = $5 c; init = $6 c func} @@ at } | LPAR ELEM var offset active_elemref_list RPAR { let at = at () in fun c -> ignore (anon_elem c); fun () -> - let init = FuncRefType, $5 c func in - Active {index = $3 c table; offset = $4 c; init} @@ at } + Active {index = $3 c table; offset = $4 c; init = $5 c func} @@ at } | LPAR ELEM offset active_elemref_list RPAR /* Sugar */ { let at = at () in fun c -> ignore (anon_elem c); - fun () -> - let init = FuncRefType, $4 c func in - Active {index = 0l @@ at; offset = $3 c; init} @@ at } + fun () -> Active {index = 0l @@ at; offset = $3 c; init = $4 c func} @@ at } table : | LPAR TABLE bind_var_opt table_fields RPAR @@ -627,8 +623,8 @@ table_fields : | elem_type LPAR ELEM active_elemref_list RPAR /* Sugar */ { fun c x at -> let offset = [i32_const (0l @@ at) @@ at] @@ at in - let init' = $4 c func in let size = Int32.of_int (List.length init') in - let init = FuncRefType, init' in + let init = $4 c func in + let size = Lib.List32.length init in [{ttype = TableType ({min = size; max = Some size}, $1)} @@ at], [Active {index = x; offset; init} @@ at], [], [] } @@ -637,7 +633,7 @@ data : | LPAR DATA bind_var_opt PASSIVE string_list RPAR { let at = at () in fun c -> ignore ($3 c anon_data bind_data); - fun () -> Passive $5 @@ at } + fun () -> Passive {etype = (); data = $5} @@ at } | LPAR DATA bind_var var offset string_list RPAR { let at = at () in fun c -> ignore (bind_data c $3); @@ -782,7 +778,7 @@ module_fields1 : fun () -> let mems, data, ims, exs = mmf () in let m = mf () in if mems <> [] && m.imports <> [] then error (List.hd m.imports).at "import after memory definition"; - { m with memories = mems @ m.memories; data = data @ m.data; + { m with memories = mems @ m.memories; datas = data @ m.datas; imports = ims @ m.imports; exports = exs @ m.exports } } | func module_fields { fun c -> let ff = $1 c in let mf = $2 c in @@ -798,7 +794,7 @@ module_fields1 : | data module_fields { fun c -> let df = $1 c in let mf = $2 c in fun () -> let data = df () in let m = mf () in - {m with data = data :: m.data} } + {m with datas = data :: m.datas} } | start module_fields { fun c -> let mf = $2 c in fun () -> let m = mf () in let x = $1 c in diff --git a/interpreter/valid/valid.ml b/interpreter/valid/valid.ml index 955e2ce113..451aeeecb9 100644 --- a/interpreter/valid/valid.ml +++ b/interpreter/valid/valid.ml @@ -21,7 +21,7 @@ type context = tables : table_type list; memories : memory_type list; globals : global_type list; - data : segment_type list; + datas : segment_type list; elems : segment_type list; locals : value_type list; results : value_type list; @@ -30,7 +30,7 @@ type context = let empty_context = { types = []; funcs = []; tables = []; memories = []; - globals = []; data = []; elems = []; + globals = []; datas = []; elems = []; locals = []; results = []; labels = [] } let lookup category list x = @@ -42,7 +42,7 @@ let func (c : context) x = lookup "function" c.funcs x let table (c : context) x = lookup "table" c.tables x let memory (c : context) x = lookup "memory" c.memories x let global (c : context) x = lookup "global" c.globals x -let data (c : context) x = lookup "data segment" c.data x +let data (c : context) x = lookup "data segment" c.datas x let elem (c : context) x = lookup "elem segment" c.elems x let local (c : context) x = lookup "local" c.locals x let label (c : context) x = lookup "label" c.labels x @@ -298,11 +298,6 @@ let rec check_instr (c : context) (e : instr) (s : infer_stack_type) : op_type = ignore (data c x); [I32Type; I32Type; I32Type] --> [] - | DataDrop x -> - ignore (memory c (0l @@ e.at)); - ignore (data c x); - [] --> [] - | MemoryCopy -> ignore (memory c (0l @@ e.at)); [I32Type; I32Type; I32Type] --> [] @@ -316,14 +311,19 @@ let rec check_instr (c : context) (e : instr) (s : infer_stack_type) : op_type = ignore (elem c x); [I32Type; I32Type; I32Type] --> [] - | ElemDrop x -> + | TableCopy -> ignore (table c (0l @@ e.at)); - ignore (elem c x); + [I32Type; I32Type; I32Type] --> [] + + | DataDrop x -> + ignore (memory c (0l @@ e.at)); + ignore (data c x); [] --> [] - | TableCopy -> + | ElemDrop x -> ignore (table c (0l @@ e.at)); - [I32Type; I32Type; I32Type] --> [] + ignore (elem c x); + [] --> [] and check_seq (c : context) (es : instr list) : infer_stack_type = match es with @@ -431,12 +431,12 @@ let check_elemref (c : context) (el : elem) = let check_elem (c : context) (seg : table_segment) = match seg.it with - | Active {index; offset; init = (_,init)} -> + | Active {index; offset; init} -> ignore (table c index); check_const c offset I32Type; List.iter (check_elemref c) init - | Passive (etype,init) -> - List.iter (check_elemref c) init + | Passive {etype; data} -> + List.iter (check_elemref c) data let check_data (c : context) (seg : memory_segment) = match seg.it with @@ -489,7 +489,7 @@ let check_export (c : context) (set : NameSet.t) (ex : export) : NameSet.t = let check_module (m : module_) = let - { types; imports; tables; memories; globals; funcs; start; elems; data; + { types; imports; tables; memories; globals; funcs; start; elems; datas; exports } = m.it in let c0 = @@ -502,7 +502,7 @@ let check_module (m : module_) = tables = c0.tables @ List.map (fun tab -> tab.it.ttype) tables; memories = c0.memories @ List.map (fun mem -> mem.it.mtype) memories; elems = List.map (fun elem -> SegmentType) elems; - data = List.map (fun data -> SegmentType) data; + datas = List.map (fun data -> SegmentType) datas; } in let c = @@ -513,7 +513,7 @@ let check_module (m : module_) = List.iter (check_table c1) tables; List.iter (check_memory c1) memories; List.iter (check_elem c1) elems; - List.iter (check_data c1) data; + List.iter (check_data c1) datas; List.iter (check_func c) funcs; check_start c start; ignore (List.fold_left (check_export c) NameSet.empty exports); diff --git a/test/core/binary.wast b/test/core/binary.wast index 711bfbc64b..3a98f9f0ad 100644 --- a/test/core/binary.wast +++ b/test/core/binary.wast @@ -678,7 +678,10 @@ "\41\00" "\41\00" "\fc\08\00\00" ;; memory.init - "\0b") ;; end + "\0b" + + "\0b\03\01\01\00" ;; Data section + ) ;; end "data count section required") ;; data.drop requires a datacount section @@ -694,7 +697,10 @@ ;; function 0 "\05\00" "\fc\09\00" ;; data.drop - "\0b") ;; end + "\0b" + + "\0b\03\01\01\00" ;; Data section + ) ;; end "data count section required") ;; passive element segment containing opcode other than ref.func or ref.null diff --git a/test/core/bulk.wast b/test/core/bulk.wast index fd4194c289..bb71f493d6 100644 --- a/test/core/bulk.wast +++ b/test/core/bulk.wast @@ -241,10 +241,10 @@ (invoke "init_passive") (invoke "drop_passive") -(assert_trap (invoke "drop_passive") "elements segment dropped") -(assert_trap (invoke "init_passive") "elements segment dropped") -(assert_trap (invoke "drop_active") "elements segment dropped") -(assert_trap (invoke "init_active") "elements segment dropped") +(assert_trap (invoke "drop_passive") "element segment dropped") +(assert_trap (invoke "init_passive") "element segment dropped") +(assert_trap (invoke "drop_active") "element segment dropped") +(assert_trap (invoke "init_active") "element segment dropped") ;; table.copy diff --git a/test/core/table_init.wast b/test/core/table_init.wast index 6f98b25473..11012a317a 100644 --- a/test/core/table_init.wast +++ b/test/core/table_init.wast @@ -231,7 +231,7 @@ (func (export "test") (elem.drop 2) )) -(assert_trap (invoke "test") "elements segment dropped") +(assert_trap (invoke "test") "element segment dropped") (module (table 30 30 funcref) @@ -252,7 +252,7 @@ (func (export "test") (table.init 2 (i32.const 12) (i32.const 1) (i32.const 1)) )) -(assert_trap (invoke "test") "elements segment dropped") +(assert_trap (invoke "test") "element segment dropped") (module (table 30 30 funcref) @@ -294,7 +294,7 @@ (func (export "test") (elem.drop 1) (elem.drop 1))) -(assert_trap (invoke "test") "elements segment dropped") +(assert_trap (invoke "test") "element segment dropped") (module (table 30 30 funcref) @@ -315,7 +315,7 @@ (func (export "test") (elem.drop 1) (table.init 1 (i32.const 12) (i32.const 1) (i32.const 1)))) -(assert_trap (invoke "test") "elements segment dropped") +(assert_trap (invoke "test") "element segment dropped") (module (table 30 30 funcref)