-
Notifications
You must be signed in to change notification settings - Fork 19
[WIP][test] Add more tests for cont.new #147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| (* | ||
| open Types | ||
| open Value | ||
| *) | ||
|
|
||
| type 'ctxt t = 'ctxt cont | ||
| and 'ctxt cont = int32 * 'ctxt (* TODO: represent type properly *) | ||
|
Comment on lines
+6
to
+7
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: these don't need to be recursive, just put |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| (* open Types *) | ||
| (* open Value *) | ||
|
|
||
| type 'ctxt t = 'ctxt cont | ||
| and 'ctxt cont = int32 * 'ctxt (* TODO: represent type properly *) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,6 @@ exception NotMutable | |
|
|
||
| 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; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why remove this check?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was causing allocation of globals with defined continuation types to fail because type_of_value rerurns the top cont type for continuation values. |
||
| {ty; content = v} | ||
|
|
||
| let type_of glob = | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| open Script | ||
| open Source | ||
| open Eval | ||
|
|
||
|
|
||
| (* Errors & Tracing *) | ||
|
|
@@ -344,7 +345,7 @@ let rec run_definition def : Ast.module_ * Custom.section list = | |
|
|
||
| let run_action act : Value.t list = | ||
| match act.it with | ||
| | Invoke (x_opt, name, vs) -> | ||
| | (Invoke (x_opt, name, vs): Wasm.Script.action') -> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The complaint about the module recursion must be because this refers back to module Wasm. Just drop the prefix. |
||
| trace ("Invoking function \"" ^ Types.string_of_name name ^ "\"..."); | ||
| let inst = lookup_instance x_opt act.at in | ||
| (match Instance.export inst name with | ||
|
|
@@ -412,10 +413,11 @@ let assert_ref_pat r p = | |
| | RefTypePat Types.EqHT, (I31.I31Ref _ | Aggr.StructRef _ | Aggr.ArrayRef _) | ||
| | RefTypePat Types.I31HT, I31.I31Ref _ | ||
| | RefTypePat Types.StructHT, Aggr.StructRef _ | ||
| | RefTypePat Types.ArrayHT, Aggr.ArrayRef _ -> true | ||
| | RefTypePat Types.ArrayHT, Aggr.ArrayRef _ | ||
| | RefTypePat Types.FuncHT, Instance.FuncRef _ | ||
| | RefTypePat Types.ContHT, Eval.ContRef _ | ||
| | RefTypePat Types.ExnHT, Exn.ExnRef _ | ||
| | RefTypePat Types.ExternHT, _ -> true | ||
| | RefTypePat Types.ExternHT, _ | ||
| | NullPat, Value.NullRef _ -> true | ||
| | _ -> false | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 (just
type ctxt), and then all the other types don't need to be here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.