@@ -102,7 +102,7 @@ let func_ref inst x i at =
102102 | _ -> Crash. error at (" type mismatch for element " ^ Int32. to_string i)
103103
104104let func_type_of = function
105- | Func. AstFunc (t , inst , f ) -> t
105+ | Func. AstFunc (t , _inst , _f ) -> t
106106 | Func. HostFunc (t , _ ) -> t
107107
108108let block_type inst bt =
@@ -166,7 +166,7 @@ let rec step (c : config) : config =
166166 vs', [Label (n2, [] , (args, List. map plain es')) @@ e.at]
167167
168168 | Loop (bt , es' ), vs ->
169- let FuncType (ts1, ts2 ) = block_type frame.inst bt in
169+ let FuncType (ts1, _ts2 ) = block_type frame.inst bt in
170170 let n1 = Lib.List32. length ts1 in
171171 let args, vs' = take n1 vs e.at, drop n1 vs e.at in
172172 vs', [Label (n1, [e' @@ e.at], (args, List. map plain es')) @@ e.at]
@@ -205,7 +205,7 @@ let rec step (c : config) : config =
205205 else
206206 vs, [Invoke func @@ e.at]
207207
208- | Drop , v :: vs' ->
208+ | Drop , _v :: vs' ->
209209 vs', []
210210
211211 | Select _ , Num (I32 i ) :: v2 :: v1 :: vs' ->
@@ -361,7 +361,7 @@ let rec step (c : config) : config =
361361 vs', []
362362 with exn -> vs', [Trapping (memory_error e.at exn ) @@ e.at]);
363363
364- | VecLoadLane ({offset; ty; pack; _} , j ), Vec (V128 v ) :: Num (I32 i ) :: vs' ->
364+ | VecLoadLane ({offset; ty = _ ; pack; _} , j ), Vec (V128 v ) :: Num (I32 i ) :: vs' ->
365365 let mem = memory frame.inst (0l @@ e.at) in
366366 let addr = I64_convert. extend_i32_u i in
367367 (try
@@ -382,7 +382,7 @@ let rec step (c : config) : config =
382382 in Vec (V128 v) :: vs', []
383383 with exn -> vs', [Trapping (memory_error e.at exn ) @@ e.at])
384384
385- | VecStoreLane ({offset; ty; pack; _} , j ), Vec (V128 v ) :: Num (I32 i ) :: vs' ->
385+ | VecStoreLane ({offset; ty = _ ; pack; _} , j ), Vec (V128 v ) :: Num (I32 i ) :: vs' ->
386386 let mem = memory frame.inst (0l @@ e.at) in
387387 let addr = I64_convert. extend_i32_u i in
388388 (try
@@ -592,62 +592,62 @@ let rec step (c : config) : config =
592592 | Refer r , vs ->
593593 Ref r :: vs, []
594594
595- | Trapping msg , vs ->
595+ | Trapping _msg , _vs ->
596596 assert false
597597
598- | Returning vs ' , vs ->
598+ | Returning _vs ' , _vs ->
599599 Crash. error e.at " undefined frame"
600600
601- | Breaking (k , vs ' ), vs ->
601+ | Breaking (_k , _vs ' ), _vs ->
602602 Crash. error e.at " undefined label"
603603
604- | Label (n , es0 , (vs' , [] )), vs ->
604+ | Label (_n , _es0 , (vs' , [] )), vs ->
605605 vs' @ vs, []
606606
607- | Label (n , es0 , (vs ' , {it = Trapping msg ; at} :: es ' )), vs ->
607+ | Label (_n , _es0 , (_vs ' , {it = Trapping msg ; at} :: _es ' )), vs ->
608608 vs, [Trapping msg @@ at]
609609
610- | Label (n , es0 , (vs ' , {it = Returning vs0 ; at} :: es ' )), vs ->
610+ | Label (_n , _es0 , (_vs ' , {it = Returning vs0 ; at} :: _es ' )), vs ->
611611 vs, [Returning vs0 @@ at]
612612
613- | Label (n , es0 , (vs ' , {it = Breaking (0l , vs0 ); at} :: es ' )), vs ->
613+ | Label (n , es0 , (_vs ' , {it = Breaking (0l , vs0 ); at = _ } :: _es ' )), vs ->
614614 take n vs0 e.at @ vs, List. map plain es0
615615
616- | Label (n , es0 , (vs ' , {it = Breaking (k , vs0 ); at} :: es ' )), vs ->
616+ | Label (_n , _es0 , (_vs ' , {it = Breaking (k , vs0 ); at} :: _es ' )), vs ->
617617 vs, [Breaking (Int32. sub k 1l , vs0) @@ at]
618618
619619 | Label (n , es0 , code' ), vs ->
620620 let c' = step {c with code = code'} in
621621 vs, [Label (n, es0, c'.code) @@ e.at]
622622
623- | Frame (n , frame ' , (vs' , [] )), vs ->
623+ | Frame (_n , _frame ' , (vs' , [] )), vs ->
624624 vs' @ vs, []
625625
626- | Frame (n , frame ' , (vs ' , {it = Trapping msg ; at} :: es ' )), vs ->
626+ | Frame (_n , _frame ' , (_vs ' , {it = Trapping msg ; at} :: _es ' )), vs ->
627627 vs, [Trapping msg @@ at]
628628
629- | Frame (n , frame ' , (vs ' , {it = Returning vs0 ; at} :: es ' )), vs ->
629+ | Frame (n , _frame ' , (_vs ' , {it = Returning vs0 ; at = _ } :: _es ' )), vs ->
630630 take n vs0 e.at @ vs, []
631631
632632 | Frame (n , frame' , code' ), vs ->
633633 let c' = step {frame = frame'; code = code'; budget = c.budget - 1 } in
634634 vs, [Frame (n, c'.frame, c'.code) @@ e.at]
635635
636- | Invoke func , vs when c.budget = 0 ->
636+ | Invoke _func , _vs when c.budget = 0 ->
637637 Exhaustion. error e.at " call stack exhausted"
638638
639639 | Invoke func , vs ->
640640 let FuncType (ins, out) = func_type_of func in
641641 let n1, n2 = Lib.List32. length ins, Lib.List32. length out in
642642 let args, vs' = take n1 vs e.at, drop n1 vs e.at in
643643 (match func with
644- | Func. AstFunc (t , inst' , f ) ->
644+ | Func. AstFunc (_t , inst' , f ) ->
645645 let locals' = List. rev args @ List. map default_value f.it.locals in
646646 let frame' = {inst = ! inst'; locals = List. map ref locals'} in
647647 let instr' = [Label (n2, [] , ([] , List. map plain f.it.body)) @@ f.at] in
648648 vs', [Frame (n2, frame', ([] , instr')) @@ e.at]
649649
650- | Func. HostFunc (t , f ) ->
650+ | Func. HostFunc (_t , f ) ->
651651 try List. rev (f (List. rev args)) @ vs', []
652652 with Crash (_ , msg ) -> Crash. error e.at msg
653653 )
@@ -659,18 +659,18 @@ let rec eval (c : config) : value stack =
659659 | vs , [] ->
660660 vs
661661
662- | vs , {it = Trapping msg ; at} :: _ ->
662+ | _vs , {it = Trapping msg ; at} :: _ ->
663663 Trap. error at msg
664664
665- | vs , es ->
665+ | _vs , _es ->
666666 eval (step c)
667667
668668
669669(* Functions & Constants *)
670670
671671let invoke (func : func_inst ) (vs : value list ) : value list =
672672 let at = match func with Func. AstFunc (_ , _ , f ) -> f.at | _ -> no_region in
673- let FuncType (ins, out ) = Func. type_of func in
673+ let FuncType (ins, _out ) = Func. type_of func in
674674 if List. length vs <> List. length ins then
675675 Crash. error at " wrong number of arguments" ;
676676 if not (List. for_all2 (fun v -> (= ) (type_of_value v)) vs ins) then
@@ -683,20 +683,20 @@ let eval_const (inst : module_inst) (const : const) : value =
683683 let c = config inst [] (List. map plain const.it) in
684684 match eval c with
685685 | [v] -> v
686- | vs -> Crash. error const.at " wrong number of results on stack"
686+ | _vs -> Crash. error const.at " wrong number of results on stack"
687687
688688
689689(* Modules *)
690690
691691let create_func (inst : module_inst ) (f : func ) : func_inst =
692692 Func. alloc (type_ inst f.it.ftype) (ref inst) f
693693
694- let create_table (inst : module_inst ) (tab : table ) : table_inst =
694+ let create_table (_inst : module_inst ) (tab : table ) : table_inst =
695695 let {ttype} = tab.it in
696696 let TableType (_lim, t) = ttype in
697697 Table. alloc ttype (NullRef t)
698698
699- let create_memory (inst : module_inst ) (mem : memory ) : memory_inst =
699+ let create_memory (_inst : module_inst ) (mem : memory ) : memory_inst =
700700 let {mtype} = mem.it in
701701 Memory. alloc mtype
702702
@@ -716,10 +716,10 @@ let create_export (inst : module_inst) (ex : export) : export_inst =
716716 in (name, ext)
717717
718718let create_elem (inst : module_inst ) (seg : elem_segment ) : elem_inst =
719- let {etype; einit; _} = seg.it in
719+ let {etype = _ ; einit; _} = seg.it in
720720 Elem. alloc (List. map (fun c -> as_ref (eval_const inst c)) einit)
721721
722- let create_data (inst : module_inst ) (seg : data_segment ) : data_inst =
722+ let create_data (_inst : module_inst ) (seg : data_segment ) : data_inst =
723723 let {dinit; _} = seg.it in
724724 Data. alloc dinit
725725
0 commit comments