File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change 1
1
---
2
- refs/heads/master: 5f2459145cb90d7d52cfde1d4ed7719dde1dfdc0
2
+ refs/heads/master: f1e2c379cb2bde895e8ed99494651fa577268575
Original file line number Diff line number Diff line change @@ -186,6 +186,8 @@ type ctxt =
186
186
187
187
(* Dynamically changes while walking. See path_managing_visitor. *)
188
188
ctxt_curr_path : Ast .name_component Stack .t ;
189
+
190
+ ctxt_rty_cache : (Ast .ty ,Il .referent_ty ) Hashtbl .t ;
189
191
}
190
192
;;
191
193
@@ -275,6 +277,7 @@ let new_ctxt sess abi crate =
275
277
ctxt_main_name = crate.Ast. crate_main;
276
278
277
279
ctxt_curr_path = Stack. create () ;
280
+ ctxt_rty_cache = Hashtbl. create 1024 ;
278
281
}
279
282
;;
280
283
@@ -2222,7 +2225,7 @@ and referent_type
2222
2225
let discriminant = word in
2223
2226
Il. StructTy [| discriminant; union |]
2224
2227
in
2225
-
2228
+ let calculate _ =
2226
2229
match t with
2227
2230
Ast. TY_any -> Il. StructTy [| word; ptr |]
2228
2231
| Ast. TY_nil -> Il. NilTy
@@ -2284,6 +2287,9 @@ and referent_type
2284
2287
2285
2288
| Ast. TY_named _ -> bug () " named type in referent_type"
2286
2289
| Ast. TY_constrained (t , _ ) -> recur t
2290
+ in
2291
+ htab_search_or_add cx.ctxt_rty_cache t calculate
2292
+
2287
2293
2288
2294
and slot_referent_type (cx :ctxt ) (sl :Ast.slot ) : Il.referent_ty =
2289
2295
let s t = Il. ScalarTy t in
You can’t perform that action at this time.
0 commit comments