Conversation
| let run_action act : Value.t list = | ||
| match act.it with | ||
| | Invoke (x_opt, name, vs) -> | ||
| | (Invoke (x_opt, name, vs): Wasm.Script.action') -> |
There was a problem hiding this comment.
The complaint about the module recursion must be because this refers back to module Wasm. Just drop the prefix.
| type 'ctxt t = 'ctxt cont | ||
| and 'ctxt cont = int32 * 'ctxt (* TODO: represent type properly *) |
There was a problem hiding this comment.
Nit: these don't need to be recursive, just put cont first.
|
|
||
| let alloc (GlobalT (_mut, t) as ty) v = | ||
| assert Free.((val_type t).types = Set.empty); | ||
| if not (Match.match_val_type [] (type_of_value v) t) then raise Type; |
There was a problem hiding this comment.
This was causing allocation of globals with defined continuation types to fail because type_of_value rerurns the top cont type for continuation values.
| type 'a stack = 'a list | ||
|
|
||
| type frame = | ||
| { | ||
| inst : module_inst; | ||
| locals : value option ref list; | ||
| } | ||
|
|
||
| type code = value stack * admin_instr list | ||
|
|
||
| and admin_instr = admin_instr' phrase | ||
| and admin_instr' = | ||
| | Plain of instr' | ||
| | Refer of ref_ | ||
| | Invoke of func_inst | ||
| | Breaking of int32 * value stack | ||
| | Returning of value stack | ||
| | ReturningInvoke of value stack * func_inst | ||
| | Throwing of Tag.t * value stack | ||
| | Trapping of string | ||
| | Label of int * instr list * code | ||
| | Frame of int * frame * code | ||
| | Handler of int * catch list * code | ||
| | Prompt of handle_table * code | ||
| | Suspending of tag_inst * value stack * (int32 * ref_) option * ctxt | ||
|
|
||
| and ctxt = code -> code | ||
| and handle_table = (tag_inst * idx) list * tag_inst list |
There was a problem hiding this comment.
Is there a reason you want to expose all this? If you need type ctxt in the interface to define cont below, it suffices to export it abstractly (justtype ctxt), and then all the other types don't need to be here.
There was a problem hiding this comment.
No reason, this is just copied out of the .ml file and I didn't know it could be shortened. Will give it a shot.
This is a WIP because the interpreter does not quite handle
ref.contpatterns inassert_returncommands yet. I've bumbled my way through fixing this, but the current error is this:I thought I'd stop here and ask @rossberg for some advice :)