@@ -2070,7 +2070,6 @@ enum callee_env {
2070
2070
null_env,
2071
2071
is_closure,
2072
2072
self_env( ValueRef , ty:: t ) ,
2073
- dict_env( ValueRef , ValueRef ) ,
2074
2073
}
2075
2074
type lval_maybe_callee = { bcx : block ,
2076
2075
val: ValueRef ,
@@ -2117,8 +2116,8 @@ fn monomorphic_fn(ccx: @crate_ctxt, fn_id: ast::def_id, substs: [ty::t],
2117
2116
}
2118
2117
} ) ;
2119
2118
let hash_id = @{ def: fn_id, substs: substs, dicts: alt dicts {
2120
- some( os) { vec:: map ( * os, { |o| impl:: dict_id ( ccx . tcx , o ) } ) }
2121
- none { [ ] }
2119
+ some( os) { some_dicts ( vec:: map ( * os, impl:: vtable_id ) ) }
2120
+ none { no_dicts }
2122
2121
} } ;
2123
2122
alt ccx. monomorphized . find ( hash_id) {
2124
2123
some ( val) { ret some ( val) ; }
@@ -2258,10 +2257,8 @@ fn lval_static_fn(bcx: block, fn_id: ast::def_id, id: ast::node_id,
2258
2257
none {
2259
2258
alt ccx. maps . dict_map . find ( id) {
2260
2259
some ( dicts) {
2261
- alt impl:: resolve_dicts_in_fn_ctxt ( bcx. fcx , dicts) {
2262
- some ( dicts) { monomorphic_fn ( ccx, fn_id, tys, some ( dicts) ) }
2263
- none { none }
2264
- }
2260
+ let rdicts = impl:: resolve_vtables_in_fn_ctxt ( bcx. fcx , dicts) ;
2261
+ monomorphic_fn ( ccx, fn_id, tys, some ( rdicts) )
2265
2262
}
2266
2263
none { monomorphic_fn( ccx, fn_id, tys, none) }
2267
2264
}
@@ -2567,7 +2564,7 @@ fn trans_lval(cx: block, e: @ast::expr) -> lval_result {
2567
2564
2568
2565
fn lval_maybe_callee_to_lval ( c : lval_maybe_callee , ty : ty:: t ) -> lval_result {
2569
2566
let must_bind = alt c. generic { generic_full ( _) { true } _ { false } } ||
2570
- alt c. env { self_env ( _, _) | dict_env ( _ , _ ) { true } _ { false } } ;
2567
+ alt c. env { self_env ( _, _) { true } _ { false } } ;
2571
2568
if must_bind {
2572
2569
let n_args = ty:: ty_fn_args ( ty) . len ( ) ;
2573
2570
let args = vec:: from_elem ( n_args, none) ;
@@ -2779,28 +2776,7 @@ fn trans_args(cx: block, llenv: ValueRef,
2779
2776
2780
2777
let retty = ty:: ty_fn_ret ( fn_ty) , full_retty = retty;
2781
2778
alt gen {
2782
- generic_full ( g) {
2783
- lazily_emit_all_generic_info_tydesc_glues ( ccx, g) ;
2784
- let i = 0 u, n_orig = 0 u;
2785
- for param in * g. param_bounds {
2786
- lltydescs += [ g. tydescs [ i] ] ;
2787
- for bound in * param {
2788
- alt bound {
2789
- ty : : bound_iface ( _) {
2790
- let res = impl:: get_dict (
2791
- bcx, option:: get ( g. origins ) [ n_orig] ) ;
2792
- lltydescs += [ res. val ] ;
2793
- bcx = res. bcx ;
2794
- n_orig += 1 u;
2795
- }
2796
- _ { }
2797
- }
2798
- }
2799
- i += 1 u;
2800
- }
2801
- args = ty:: ty_fn_args ( g. item_type ) ;
2802
- retty = ty:: ty_fn_ret ( g. item_type ) ;
2803
- }
2779
+ generic_full ( g) { fail; }
2804
2780
generic_mono ( t) {
2805
2781
args = ty:: ty_fn_args ( t) ;
2806
2782
retty = ty:: ty_fn_ret ( t) ;
@@ -2884,17 +2860,12 @@ fn trans_call_inner(in_cx: block, fn_expr_ty: ty::t,
2884
2860
let bcx = f_res. bcx , ccx = cx. ccx ( ) ;
2885
2861
2886
2862
let faddr = f_res. val ;
2887
- let llenv, dict_param = none;
2888
- alt f_res. env {
2863
+ let llenv = alt f_res. env {
2889
2864
null_env {
2890
- llenv = llvm:: LLVMGetUndef ( T_opaque_box_ptr ( ccx) ) ;
2865
+ llvm : : LLVMGetUndef ( T_opaque_box_ptr ( ccx) )
2891
2866
}
2892
2867
self_env( e, _) {
2893
- llenv = PointerCast ( bcx, e, T_opaque_box_ptr ( ccx) ) ;
2894
- }
2895
- dict_env ( dict, e) {
2896
- llenv = PointerCast ( bcx, e, T_opaque_box_ptr ( ccx) ) ;
2897
- dict_param = some ( dict) ;
2868
+ PointerCast ( bcx, e, T_opaque_box_ptr ( ccx) )
2898
2869
}
2899
2870
is_closure {
2900
2871
// It's a closure. Have to fetch the elements
@@ -2905,16 +2876,15 @@ fn trans_call_inner(in_cx: block, fn_expr_ty: ty::t,
2905
2876
faddr = GEPi ( bcx, pair, [ 0 , abi:: fn_field_code] ) ;
2906
2877
faddr = Load ( bcx, faddr) ;
2907
2878
let llclosure = GEPi ( bcx, pair, [ 0 , abi:: fn_field_box] ) ;
2908
- llenv = Load ( bcx, llclosure) ;
2879
+ Load ( bcx, llclosure)
2909
2880
}
2910
- }
2881
+ } ;
2911
2882
2912
2883
let ret_ty = node_id_type ( bcx, id) ;
2913
2884
let args_res =
2914
2885
trans_args ( bcx, llenv, f_res. generic , args, fn_expr_ty, dest) ;
2915
2886
bcx = args_res. bcx ;
2916
2887
let llargs = args_res. args ;
2917
- option:: may ( dict_param) { |dict| llargs = [ dict] + llargs}
2918
2888
let llretslot = args_res. retslot ;
2919
2889
2920
2890
/* If the block is terminated,
@@ -2955,6 +2925,10 @@ fn invoke_(bcx: block, llfn: ValueRef, llargs: [ValueRef],
2955
2925
// cleanups to run
2956
2926
if bcx. unreachable { ret bcx; }
2957
2927
let normal_bcx = sub_block ( bcx, "normal return" ) ;
2928
+ /*std::io::println("fn: " + lib::llvm::type_to_str(bcx.ccx().tn, val_ty(llfn)));
2929
+ for a in llargs {
2930
+ std::io::println(" a: " + lib::llvm::type_to_str(bcx.ccx().tn, val_ty(a)));
2931
+ }*/
2958
2932
invoker ( bcx, llfn, llargs, normal_bcx. llbb , get_landing_pad ( bcx) ) ;
2959
2933
ret normal_bcx;
2960
2934
}
@@ -4791,16 +4765,6 @@ fn trans_constant(ccx: @crate_ctxt, it: @ast::item) {
4791
4765
i += 1 ;
4792
4766
}
4793
4767
}
4794
- ast:: item_impl ( tps, some ( @{ node: ast:: ty_path ( _, id) , _} ) , _, ms) {
4795
- let i_did = ast_util:: def_id_of_def ( ccx. tcx . def_map . get ( id) ) ;
4796
- impl :: trans_impl_vtable ( ccx , item_path ( ccx , it ) , i_did , ms , tps , it ) ;
4797
- }
4798
- ast:: item_iface ( _, _) {
4799
- if !vec:: any ( * ty:: iface_methods ( ccx. tcx , local_def ( it. id ) ) , { |m|
4800
- ty:: type_has_vars ( ty:: mk_fn ( ccx. tcx , m. fty ) ) } ) {
4801
- impl :: trans_iface_vtable ( ccx , item_path ( ccx , it ) , it ) ;
4802
- }
4803
- }
4804
4768
_ { }
4805
4769
}
4806
4770
}
@@ -5032,9 +4996,9 @@ fn trans_crate(sess: session::session, crate: @ast::crate, tcx: ty::ctxt,
5032
4996
discrims: ast_util:: new_def_id_hash :: < ValueRef > ( ) ,
5033
4997
discrim_symbols: int_hash :: < str > ( ) ,
5034
4998
tydescs: ty:: new_ty_hash ( ) ,
5035
- dicts: map:: hashmap ( hash_dict_id, { |a, b| a == b} ) ,
5036
4999
external: util:: common:: new_def_hash ( ) ,
5037
5000
monomorphized: map:: hashmap ( hash_mono_id, { |a, b| a == b} ) ,
5001
+ vtables: map:: hashmap ( hash_mono_id, { |a, b| a == b} ) ,
5038
5002
module_data: str_hash :: < ValueRef > ( ) ,
5039
5003
lltypes: ty:: new_ty_hash ( ) ,
5040
5004
names: new_namegen ( ) ,
0 commit comments