@@ -9,16 +9,15 @@ open Instance
99(* Errors *)
1010
1111module Link = Error. Make ()
12- module Exception = Error. Make ()
1312module Trap = Error. Make ()
1413module Crash = Error. Make ()
1514module Exhaustion = Error. Make ()
1615
1716exception Link = Link. Error
18- exception Exception = Exception. Error
1917exception Trap = Trap. Error
2018exception Crash = Crash. Error (* failure that cannot happen in valid code *)
2119exception Exhaustion = Exhaustion. Error
20+ exception Exception of region * Exn. t
2221
2322let table_error at = function
2423 | Table. Bounds -> " out of bounds table access"
@@ -1146,8 +1145,7 @@ let rec eval (c : config) : value stack =
11461145 Trap. error at msg
11471146
11481147 | vs , {it = Throwing (a , args ); at} :: _ ->
1149- let msg = " uncaught exception with args (" ^ string_of_values args ^ " )" in
1150- Exception. error at msg
1148+ raise (Exception (at, Exn. Exn (a, args)))
11511149
11521150 | vs , es ->
11531151 eval (step c)
@@ -1183,7 +1181,7 @@ let init_type (inst : moduleinst) (type_ : type_) : moduleinst =
11831181 let x = Lib.List32. length inst.types in
11841182 {inst with types = inst.types @ roll_deftypes x rt}
11851183
1186- let init_import (inst : moduleinst ) (ex : extern ) (im : import ) : moduleinst =
1184+ let init_import (inst : moduleinst ) (ex : externinst ) (im : import ) : moduleinst =
11871185 let Import (module_name, item_name, xt) = im.it in
11881186 let xt = subst_externtype (subst_of inst) xt in
11891187 let xt' = externtype_of inst.types ex in
@@ -1305,7 +1303,7 @@ let init_list f xs (inst : moduleinst) : moduleinst =
13051303let init_list2 f xs ys (inst : moduleinst ) : moduleinst =
13061304 List. fold_left2 f inst xs ys
13071305
1308- let init (m : module_ ) (exts : extern list ) : moduleinst =
1306+ let init (m : module_ ) (exts : externinst list ) : moduleinst =
13091307 if List. length exts <> List. length m.it.imports then
13101308 Link. error m.at " wrong number of imports provided for initialisation" ;
13111309 let inst =
0 commit comments