Skip to content

Commit ce2e318

Browse files
committed
---
yaml --- r: 753 b: refs/heads/master c: f1e2c37 h: refs/heads/master i: 751: 7e4213b v: v3
1 parent 56192e6 commit ce2e318

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 5f2459145cb90d7d52cfde1d4ed7719dde1dfdc0
2+
refs/heads/master: f1e2c379cb2bde895e8ed99494651fa577268575

trunk/src/boot/me/semant.ml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,8 @@ type ctxt =
186186

187187
(* Dynamically changes while walking. See path_managing_visitor. *)
188188
ctxt_curr_path: Ast.name_component Stack.t;
189+
190+
ctxt_rty_cache: (Ast.ty,Il.referent_ty) Hashtbl.t;
189191
}
190192
;;
191193

@@ -275,6 +277,7 @@ let new_ctxt sess abi crate =
275277
ctxt_main_name = crate.Ast.crate_main;
276278

277279
ctxt_curr_path = Stack.create ();
280+
ctxt_rty_cache = Hashtbl.create 1024;
278281
}
279282
;;
280283

@@ -2222,7 +2225,7 @@ and referent_type
22222225
let discriminant = word in
22232226
Il.StructTy [| discriminant; union |]
22242227
in
2225-
2228+
let calculate _ =
22262229
match t with
22272230
Ast.TY_any -> Il.StructTy [| word; ptr |]
22282231
| Ast.TY_nil -> Il.NilTy
@@ -2284,6 +2287,9 @@ and referent_type
22842287

22852288
| Ast.TY_named _ -> bug () "named type in referent_type"
22862289
| Ast.TY_constrained (t, _) -> recur t
2290+
in
2291+
htab_search_or_add cx.ctxt_rty_cache t calculate
2292+
22872293

22882294
and slot_referent_type (cx:ctxt) (sl:Ast.slot) : Il.referent_ty =
22892295
let s t = Il.ScalarTy t in

0 commit comments

Comments
 (0)