@@ -92,17 +92,12 @@ fn type_of_explicit_args(cx: &@crate_ctxt, sp: &span, inputs: &ty::arg[]) ->
92
92
TypeRef [ ] {
93
93
let atys: TypeRef [ ] = ~[ ] ;
94
94
for arg: ty:: arg in inputs {
95
- if ty:: type_has_dynamic_size ( cx. tcx , arg. ty ) {
96
- assert ( arg. mode != ty:: mo_val) ;
97
- atys += ~[ T_typaram_ptr ( cx. tn ) ] ;
98
- } else {
99
- let t: TypeRef ;
100
- alt arg. mode {
101
- ty:: mo_alias ( _) { t = T_ptr ( type_of_inner ( cx, sp, arg. ty ) ) ; }
102
- _ { t = type_of_inner ( cx, sp, arg. ty ) ; }
103
- }
104
- atys += ~[ t] ;
105
- }
95
+ let t: TypeRef = type_of_inner ( cx, sp, arg. ty ) ;
96
+ t = alt arg. mode {
97
+ ty:: mo_alias ( _) { T_ptr ( t) }
98
+ _ { t }
99
+ } ;
100
+ atys += ~[ t] ;
106
101
}
107
102
ret atys;
108
103
}
@@ -120,9 +115,7 @@ fn type_of_fn_full(cx: &@crate_ctxt, sp: &span, proto: ast::proto,
120
115
let atys: TypeRef [ ] = ~[ ] ;
121
116
122
117
// Arg 0: Output pointer.
123
- if ty:: type_has_dynamic_size ( cx. tcx , output) {
124
- atys += ~[ T_typaram_ptr ( cx. tn ) ] ;
125
- } else { atys += ~[ T_ptr ( type_of_inner ( cx, sp, output) ) ] ; }
118
+ atys += ~[ T_ptr ( type_of_inner ( cx, sp, output) ) ] ;
126
119
127
120
// Arg 1: task pointer.
128
121
atys += ~[ T_taskptr ( * cx) ] ;
@@ -252,7 +245,7 @@ fn type_of_inner(cx: &@crate_ctxt, sp: &span, t: &ty::t) -> TypeRef {
252
245
ty:: ty_var ( _) {
253
246
cx. tcx . sess . span_fatal ( sp, "trans::type_of called on ty_var" ) ;
254
247
}
255
- ty:: ty_param ( _, _) { llty = T_i8 ( ) ; }
248
+ ty:: ty_param ( _, _) { llty = T_typaram ( cx . tn ) ; }
256
249
ty:: ty_type. { llty = T_ptr ( cx. tydesc_type ) ; }
257
250
}
258
251
assert ( llty as int != 0 ) ;
@@ -274,23 +267,6 @@ fn type_of_tag(cx: &@crate_ctxt, sp: &span, did: &ast::def_id, t: &ty::t) ->
274
267
}
275
268
}
276
269
277
-
278
- fn type_of_arg ( cx : @local_ctxt , sp : & span , arg : & ty:: arg ) -> TypeRef {
279
- alt ty:: struct ( cx. ccx . tcx , arg. ty ) {
280
- ty:: ty_param ( _, _) {
281
- if arg. mode != ty:: mo_val { ret T_typaram_ptr ( cx. ccx . tn ) ; }
282
- }
283
- _ {
284
- // fall through
285
- }
286
- }
287
- let typ;
288
- if arg. mode != ty:: mo_val {
289
- typ = T_ptr ( type_of_inner ( cx. ccx , sp, arg. ty ) ) ;
290
- } else { typ = type_of_inner ( cx. ccx , sp, arg. ty ) ; }
291
- ret typ;
292
- }
293
-
294
270
fn type_of_ty_param_kinds_and_ty ( lcx : @local_ctxt , sp : & span ,
295
271
tpt : & ty:: ty_param_kinds_and_ty ) -> TypeRef {
296
272
alt ty:: struct ( lcx. ccx . tcx , tpt. ty ) {
@@ -4492,13 +4468,10 @@ fn trans_bind_thunk(cx: &@local_ctxt, sp: &span, incoming_fty: &ty::t,
4492
4468
let outgoing_args = ty:: ty_fn_args ( cx. ccx . tcx , outgoing_fty) ;
4493
4469
4494
4470
// The 'llretptr' that will arrive in the thunk we're creating also needs
4495
- // to be the correct size. Cast it to the size of f's return type, if
4496
- // necessary.
4471
+ // to be the correct type. Cast it to f's return type, if necessary.
4497
4472
let llretptr = fcx. llretptr ;
4498
- if ty:: type_has_dynamic_size ( cx. ccx . tcx , outgoing_ret_ty) {
4499
- llretptr = bcx. build . PointerCast ( llretptr, T_typaram_ptr ( cx. ccx . tn ) ) ;
4500
- } else if ty:: type_contains_params ( cx. ccx . tcx , outgoing_ret_ty) {
4501
- let llretty = type_of ( cx. ccx , sp, outgoing_ret_ty) ;
4473
+ if ty:: type_contains_params ( cx. ccx . tcx , outgoing_ret_ty) {
4474
+ let llretty = type_of_inner ( cx. ccx , sp, outgoing_ret_ty) ;
4502
4475
llretptr = bcx. build . PointerCast ( llretptr, T_ptr ( llretty) ) ;
4503
4476
}
4504
4477
@@ -4765,27 +4738,20 @@ fn trans_args(cx: &@block_ctxt, llenv: ValueRef, llobj: &option::t[ValueRef],
4765
4738
}
4766
4739
_ { }
4767
4740
}
4768
- if ty:: type_has_dynamic_size ( bcx_tcx ( cx) , retty) {
4769
- llargs +=
4770
- ~[ bcx. build . PointerCast ( llretslot,
4771
- T_typaram_ptr ( bcx_ccx ( cx) . tn ) ) ] ;
4772
- } else if ( ty:: type_contains_params ( bcx_tcx ( cx) , retty) ) {
4741
+ if ( ty:: type_contains_params ( bcx_tcx ( cx) , retty) ) {
4773
4742
// It's possible that the callee has some generic-ness somewhere in
4774
4743
// its return value -- say a method signature within an obj or a fn
4775
4744
// type deep in a structure -- which the caller has a concrete view
4776
4745
// of. If so, cast the caller's view of the restlot to the callee's
4777
4746
// view, for the sake of making a type-compatible call.
4778
-
4779
- llargs +=
4780
- ~[ cx. build . PointerCast ( llretslot,
4781
- T_ptr ( type_of ( bcx_ccx ( bcx) , bcx. sp ,
4782
- retty) ) ) ] ;
4747
+ let llretty = T_ptr ( type_of_inner ( bcx_ccx ( bcx) , bcx. sp , retty) ) ;
4748
+ llargs += ~[ cx. build . PointerCast ( llretslot, llretty) ] ;
4783
4749
} else { llargs += ~[ llretslot] ; }
4784
- // Arg 1: task pointer.
4785
4750
4751
+ // Arg 1: task pointer.
4786
4752
llargs += ~[ bcx. fcx . lltaskptr ] ;
4787
- // Arg 2: Env (closure-bindings / self-obj)
4788
4753
4754
+ // Arg 2: Env (closure-bindings / self-obj)
4789
4755
alt llobj {
4790
4756
some( ob) {
4791
4757
// Every object is always found in memory,
@@ -4796,18 +4762,18 @@ fn trans_args(cx: &@block_ctxt, llenv: ValueRef, llobj: &option::t[ValueRef],
4796
4762
}
4797
4763
_ { llargs += ~[ llenv] ; }
4798
4764
}
4799
- // Args >3: ty_params ...
4800
4765
4766
+ // Args >3: ty_params ...
4801
4767
llargs += lltydescs;
4802
- // ... then possibly an lliterbody argument.
4803
4768
4769
+ // ... then possibly an lliterbody argument.
4804
4770
alt lliterbody { none. { } some( lli) { llargs += ~[ lli] ; } }
4771
+
4805
4772
// ... then explicit args.
4806
4773
4807
4774
// First we figure out the caller's view of the types of the arguments.
4808
4775
// This will be needed if this is a generic call, because the callee has
4809
4776
// to cast her view of the arguments to the caller's view.
4810
-
4811
4777
let arg_tys = type_of_explicit_args ( bcx_ccx ( cx) , cx. sp , args) ;
4812
4778
let i = 0 u;
4813
4779
for e: @ast:: expr in es {
@@ -6605,11 +6571,12 @@ fn process_fwding_mthd(cx: @local_ctxt, sp: &span, m: @ty::method,
6605
6571
let llself_obj = bcx. build . Load ( llself_obj_ptr) ;
6606
6572
6607
6573
// The 'llretptr' that will arrive in the forwarding function we're
6608
- // creating also needs to be the correct size . Cast it to the size of the
6609
- // method's return type, if necessary.
6574
+ // creating also needs to be the correct type . Cast it to the method's
6575
+ // return type, if necessary.
6610
6576
let llretptr = fcx. llretptr ;
6611
- if ty:: type_has_dynamic_size ( cx. ccx . tcx , m. output ) {
6612
- llretptr = bcx. build . PointerCast ( llretptr, T_typaram_ptr ( cx. ccx . tn ) ) ;
6577
+ if ty:: type_contains_params ( cx. ccx . tcx , m. output ) {
6578
+ let llretty = type_of_inner ( cx. ccx , sp, m. output ) ;
6579
+ llretptr = bcx. build . PointerCast ( llretptr, T_ptr ( llretty) ) ;
6613
6580
}
6614
6581
6615
6582
// Now, we have to get the the inner_obj's vtbl out of the self_obj. This
0 commit comments