Skip to content

Commit

Permalink
WIP on gabor/parentheticals: 29110d3 interpret ICCallerPrim as non-…
Browse files Browse the repository at this point in the history
…informative
  • Loading branch information
ggreif committed Jul 19, 2024
2 parents 29110d3 + dea2866 commit 0d8b82b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/codegen/compile.ml
Original file line number Diff line number Diff line change
Expand Up @@ -10623,13 +10623,13 @@ and compile_prim_invocation (env : E.t) ae p es at =

code1 ^^
Type.(match as_obj par.note.Note.typ with
| Object, [] -> compile_unboxed_zero (* a dummy closure *)
| (*Object, []*)_ -> compile_unboxed_zero (* a dummy closure *)
| _ -> compile_exp_vanilla env ae par) ^^ (* parenthetical *)
compile_exp_as env ae (StackRep.of_arity n_args) e2 ^^ (* the args *)
G.i (Call (nr (mk_fi ()))) ^^
FakeMultiVal.load env (Lib.List.make return_arity I32Type)
| _, Type.Local ->
let (set_clos, get_clos) = new_local env "clos" in
let (set_clos, get_clos) = new_local env "closX" in

StackRep.of_arity return_arity,
code1 ^^ StackRep.adjust env fun_sr SR.Vanilla ^^
Expand Down
17 changes: 9 additions & 8 deletions src/ir_passes/await.ml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ let letcont k scope =
match k with
| ContVar k' -> scope k' (* letcont eta-contraction *)
| MetaCont (typ0, cont) ->
let v = fresh_var "v" typ0 in
let v = fresh_var "vW" typ0 in
let e = cont v in
let k' = fresh_cont typ0 (typ e) in
blockE [funcD k' v e] (* at this point, I'm really worried about variable capture *)
Expand Down Expand Up @@ -218,19 +218,20 @@ and binary context k binE e1 e2 =
assert false

and nary context k naryE es =
let rec nary_aux vs es =
match es with
let rec nary_aux vs = function
| [] -> k -@- naryE (List.rev vs)
| [e1] when eff e1 = T.Triv ->
(* TBR: optimization - no need to name the last trivial argument *)
k -@- naryE (List.rev (t_exp context e1 :: vs))
| e1 :: es ->
match eff e1 with
| T.Triv ->
let v1 = fresh_var "v" (typ e1) in
match eff e1, e1.it with
| T.Triv, VarE _ (*FIXME: when immut*)->
nary_aux (e1 :: vs) es
| T.Triv, _ ->
let v1 = fresh_var "vX" (typ e1) in
letE v1 (t_exp context e1)
(nary_aux (varE v1 :: vs) es)
| T.Await ->
| T.Await, _ ->
c_exp context e1
(meta (typ e1) (fun v1 -> nary_aux (varE v1 :: vs) es))
in
Expand Down Expand Up @@ -333,7 +334,7 @@ and c_exp' context exp k =
| T.Triv ->
varE k -*- (t_exp context exp1)
| T.Await ->
let error = fresh_var "v" T.catch in
let error = fresh_var "vY" T.catch in
let cases' =
List.map
(fun {it = {pat;exp}; at; note} ->
Expand Down
3 changes: 3 additions & 0 deletions test/run-drun/4611.mo
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@ actor {
assert mrec.bool; // check no aliasing between bool and mrec.bool
let summary = debug_show { rec; mrec };
Prim.debugPrint summary;
// check that all executions work the same way
Prim.debugPrint (debug_show { bool; aool = (bool := false) });
Prim.debugPrint (debug_show { bool; cool = (bool := true) });
}

0 comments on commit 0d8b82b

Please sign in to comment.