@@ -52,16 +52,10 @@ import middle::tstate::ann::ts_ann;
52
52
type ty_table = hashmap [ ast:: def_id, ty:: t] ;
53
53
type fn_purity_table = hashmap [ ast:: def_id, ast:: purity] ;
54
54
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
-
58
55
type obj_info = rec ( vec[ ast:: obj_field ] obj_fields , ast:: def_id this_obj ) ;
59
56
60
57
type crate_ctxt = rec ( mutable vec[ obj_info] obj_infos ,
61
58
@fn_purity_table fn_purity_table ,
62
- unify_cache unify_cache,
63
- mutable uint cache_hits ,
64
- mutable uint cache_misses ,
65
59
ty:: ctxt tcx) ;
66
60
67
61
type fn_ctxt = rec ( ty:: t ret_ty ,
@@ -820,22 +814,9 @@ mod collect {
820
814
mod unify {
821
815
fn simple( & @fn_ctxt fcx , & ty:: t expected , & ty:: t actual )
822
816
-> 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
-
834
817
auto result = ty:: unify:: unify ( expected , actual , fcx. var_bindings ,
835
818
fcx . ccx. tcx) ;
836
819
837
- //fcx.ccx.unify_cache.insert(cache_key, result);
838
-
839
820
// FIXME: Shouldn't be necessary, but is until we remove pushdown.
840
821
alt ( result) {
841
822
case ( ures_ok ( ?typ ) ) {
@@ -2856,37 +2837,6 @@ fn check_item(@crate_ctxt ccx, &@ast::item it) {
2856
2837
}
2857
2838
}
2858
2839
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 << 5 u + ty:: hash_ty( uce. _1) ;
2864
-
2865
- auto i = 0 u;
2866
- auto tys_len = vec:: len( uce. _2) ;
2867
- while ( i < tys_len) {
2868
- h += h << 5 u + ty:: hash_ty( uce. _2. ( i) ) ;
2869
- i += 1 u;
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 = 0 u;
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 += 1 u;
2885
- }
2886
-
2887
- ret true ;
2888
- }
2889
-
2890
2840
fn mk_fn_purity_table( & @ast:: crate crate ) -> @fn_purity_table {
2891
2841
auto res = @new_def_hash[ ast:: purity] ( ) ;
2892
2842
@@ -2914,26 +2864,16 @@ fn check_crate(&ty::ctxt tcx, &@ast::crate crate) {
2914
2864
2915
2865
let vec[ obj_info] obj_infos = [ ] ;
2916
2866
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) ;
2921
2867
auto fpt = mk_fn_purity_table( crate ) ; // use a variation on collect
2922
2868
2923
2869
auto ccx = @rec( mutable obj_infos=obj_infos,
2924
2870
fn_purity_table=fpt,
2925
- unify_cache=unify_cache,
2926
- mutable cache_hits=0 u,
2927
- mutable cache_misses=0 u,
2928
2871
tcx=tcx) ;
2929
2872
2930
2873
auto visit = rec( visit_item_pre = bind check_item( ccx, _)
2931
2874
with walk:: default_visitor( ) ) ;
2932
2875
2933
2876
walk:: walk_crate( visit, * crate ) ;
2934
-
2935
- log #fmt( "cache hit rate: %u/%u" , ccx. cache_hits,
2936
- ccx. cache_hits + ccx. cache_misses) ;
2937
2877
}
2938
2878
2939
2879
//
0 commit comments