File tree 2 files changed +14
-10
lines changed 2 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -516,15 +516,17 @@ let the_shape_of ~return_values ~pure info x =
516
516
Shape. Function { arity; pure; res = Top " unk" }
517
517
with _ -> Top " other" )
518
518
| Expr (Apply { f; args; _ } ) -> (
519
- match loop info f (Var.Set. add f acc) with
519
+ let shape = loop info f (Var.Set. add f acc) in
520
+ let rec loop n' shape =
521
+ match shape with
520
522
| Shape. Function { arity = n ; pure; res } ->
521
- let diff = n - List. length args in
522
- if diff > 0
523
- then Shape. Function { arity = diff ; pure; res }
524
- else if diff = 0
525
- then res
526
- else Shape. Top " apply "
527
- | Shape. Block _ | Shape. Top _ -> Shape. Top " apply2 " )
523
+ if n = n' then res
524
+ else if n' < n
525
+ then Shape. Function { arity = n - n' ; pure; res }
526
+ else loop (n' - n) res
527
+ | Shape. Block _ | Shape. Top _ -> Shape. Top " apply2 "
528
+ in
529
+ loop ( List. length args) shape )
528
530
| _ -> Shape. Top " other" ))
529
531
(Top " init" )
530
532
(fun u v -> merge u v)
Original file line number Diff line number Diff line change @@ -149,10 +149,12 @@ module State = struct
149
149
| Some (Top _ | Function _ ) -> ()
150
150
| Some (Block l ) -> assign target (List. nth l offset)
151
151
152
- let get x = Code.Var.Hashtbl. find_opt t.table x
153
-
154
152
let mem x = BitSet. mem t.cache (Code.Var. idx x)
155
153
154
+ let get x = if mem x then Code.Var.Hashtbl. find_opt t.table x
155
+ else None
156
+
157
+
156
158
let is_pure_fun x =
157
159
match Code.Var.Hashtbl. find_opt t.table x with
158
160
| None -> false
You can’t perform that action at this time.
0 commit comments