Skip to content

Commit 08dcb93

Browse files
committed
rustc: Remove all traces of the unification cache
1 parent d360c48 commit 08dcb93

File tree

1 file changed

+0
-60
lines changed

1 file changed

+0
-60
lines changed

src/comp/middle/typeck.rs

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,10 @@ import middle::tstate::ann::ts_ann;
5252
type ty_table = hashmap[ast::def_id, ty::t];
5353
type fn_purity_table = hashmap[ast::def_id, ast::purity];
5454

55-
type unify_cache_entry = tup(ty::t,ty::t,vec[mutable ty::t]);
56-
type unify_cache = hashmap[unify_cache_entry,ty::unify::result];
57-
5855
type obj_info = rec(vec[ast::obj_field] obj_fields, ast::def_id this_obj);
5956

6057
type crate_ctxt = rec(mutable vec[obj_info] obj_infos,
6158
@fn_purity_table fn_purity_table,
62-
unify_cache unify_cache,
63-
mutable uint cache_hits,
64-
mutable uint cache_misses,
6559
ty::ctxt tcx);
6660

6761
type fn_ctxt = rec(ty::t ret_ty,
@@ -820,22 +814,9 @@ mod collect {
820814
mod unify {
821815
fn simple(&@fn_ctxt fcx, &ty::t expected, &ty::t actual)
822816
-> ty::unify::result {
823-
/*auto cache_key = tup(expected, actual, param_substs);
824-
alt (fcx.ccx.unify_cache.find(cache_key)) {
825-
case (some(?r)) {
826-
fcx.ccx.cache_hits += 1u;
827-
ret r;
828-
}
829-
case (none) {
830-
fcx.ccx.cache_misses += 1u;
831-
}
832-
}*/
833-
834817
auto result = ty::unify::unify(expected, actual, fcx.var_bindings,
835818
fcx.ccx.tcx);
836819

837-
//fcx.ccx.unify_cache.insert(cache_key, result);
838-
839820
// FIXME: Shouldn't be necessary, but is until we remove pushdown.
840821
alt (result) {
841822
case (ures_ok(?typ)) {
@@ -2856,37 +2837,6 @@ fn check_item(@crate_ctxt ccx, &@ast::item it) {
28562837
}
28572838
}
28582839

2859-
// Utilities for the unification cache
2860-
2861-
fn hash_unify_cache_entry(&unify_cache_entry uce) -> uint {
2862-
auto h = ty::hash_ty(uce._0);
2863-
h += h << 5u + ty::hash_ty(uce._1);
2864-
2865-
auto i = 0u;
2866-
auto tys_len = vec::len(uce._2);
2867-
while (i < tys_len) {
2868-
h += h << 5u + ty::hash_ty(uce._2.(i));
2869-
i += 1u;
2870-
}
2871-
2872-
ret h;
2873-
}
2874-
2875-
fn eq_unify_cache_entry(&unify_cache_entry a, &unify_cache_entry b) -> bool {
2876-
if (!ty::eq_ty(a._0, b._0) || !ty::eq_ty(a._1, b._1)) { ret false; }
2877-
2878-
auto i = 0u;
2879-
auto tys_len = vec::len(a._2);
2880-
if (vec::len(b._2) != tys_len) { ret false; }
2881-
2882-
while (i < tys_len) {
2883-
if (!ty::eq_ty(a._2.(i), b._2.(i))) { ret false; }
2884-
i += 1u;
2885-
}
2886-
2887-
ret true;
2888-
}
2889-
28902840
fn mk_fn_purity_table(&@ast::crate crate) -> @fn_purity_table {
28912841
auto res = @new_def_hash[ast::purity]();
28922842

@@ -2914,26 +2864,16 @@ fn check_crate(&ty::ctxt tcx, &@ast::crate crate) {
29142864

29152865
let vec[obj_info] obj_infos = [];
29162866

2917-
auto hasher = hash_unify_cache_entry;
2918-
auto eqer = eq_unify_cache_entry;
2919-
auto unify_cache =
2920-
map::mk_hashmap[unify_cache_entry,ty::unify::result](hasher, eqer);
29212867
auto fpt = mk_fn_purity_table(crate); // use a variation on collect
29222868

29232869
auto ccx = @rec(mutable obj_infos=obj_infos,
29242870
fn_purity_table=fpt,
2925-
unify_cache=unify_cache,
2926-
mutable cache_hits=0u,
2927-
mutable cache_misses=0u,
29282871
tcx=tcx);
29292872

29302873
auto visit = rec(visit_item_pre = bind check_item(ccx, _)
29312874
with walk::default_visitor());
29322875

29332876
walk::walk_crate(visit, *crate);
2934-
2935-
log #fmt("cache hit rate: %u/%u", ccx.cache_hits,
2936-
ccx.cache_hits + ccx.cache_misses);
29372877
}
29382878

29392879
//

0 commit comments

Comments
 (0)