Skip to content

Commit da328b1

Browse files
committed
Kick ty_var and ty_local entries out of the type store. Pre-compute presence of var, local, param and bound_params in types.
1 parent 3f77e7d commit da328b1

File tree

2 files changed

+183
-72
lines changed

2 files changed

+183
-72
lines changed

src/comp/middle/trans.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ type local_ctxt = rec(vec[str] path,
120120
vec[ast.ty_param] obj_typarams,
121121
vec[ast.obj_field] obj_fields,
122122
@crate_ctxt ccx);
123-
123+
124124

125125
type self_vt = rec(ValueRef v, ty.t t);
126126

@@ -1565,7 +1565,7 @@ fn get_tydesc(&@block_ctxt cx, ty.t t) -> result {
15651565
// Does it contain a type param? If so, generate a derived tydesc.
15661566
let uint n_params = ty.count_ty_params(cx.fcx.lcx.ccx.tcx, t);
15671567

1568-
if (ty.count_ty_params(cx.fcx.lcx.ccx.tcx, t) > 0u) {
1568+
if (n_params > 0u) {
15691569
auto tys = linearize_ty_params(cx, t);
15701570

15711571
check (n_params == _vec.len[uint](tys._0));
@@ -4312,7 +4312,8 @@ fn trans_bind_thunk(@local_ctxt cx,
43124312

43134313
if (out_arg.mode == ast.val) {
43144314
val = bcx.build.Load(val);
4315-
} else if (ty.count_ty_params(cx.ccx.tcx, out_arg.ty) > 0u) {
4315+
} else if (ty.type_contains_params(cx.ccx.tcx,
4316+
out_arg.ty)) {
43164317
check (out_arg.mode == ast.alias);
43174318
val = bcx.build.PointerCast(val, llout_arg_ty);
43184319
}
@@ -4325,7 +4326,7 @@ fn trans_bind_thunk(@local_ctxt cx,
43254326
case (none[@ast.expr]) {
43264327
let ValueRef passed_arg = llvm.LLVMGetParam(llthunk, a);
43274328

4328-
if (ty.count_ty_params(cx.ccx.tcx, out_arg.ty) > 0u) {
4329+
if (ty.type_contains_params(cx.ccx.tcx, out_arg.ty)) {
43294330
check (out_arg.mode == ast.alias);
43304331
passed_arg = bcx.build.PointerCast(passed_arg,
43314332
llout_arg_ty);
@@ -4593,7 +4594,7 @@ fn trans_arg_expr(@block_ctxt cx,
45934594
bcx = re.bcx;
45944595
}
45954596

4596-
if (ty.count_ty_params(cx.fcx.lcx.ccx.tcx, arg.ty) > 0u) {
4597+
if (ty.type_contains_params(cx.fcx.lcx.ccx.tcx, arg.ty)) {
45974598
auto lldestty = lldestty0;
45984599
if (arg.mode == ast.val) {
45994600
// FIXME: we'd prefer to use &&, but rustboot doesn't like it
@@ -4655,7 +4656,7 @@ fn trans_args(@block_ctxt cx,
46554656
if (ty.type_has_dynamic_size(cx.fcx.lcx.ccx.tcx, retty)) {
46564657
llargs += vec(bcx.build.PointerCast
46574658
(llretslot, T_typaram_ptr(cx.fcx.lcx.ccx.tn)));
4658-
} else if (ty.count_ty_params(cx.fcx.lcx.ccx.tcx, retty) != 0u) {
4659+
} else if (ty.type_contains_params(cx.fcx.lcx.ccx.tcx, retty)) {
46594660
// It's possible that the callee has some generic-ness somewhere in
46604661
// its return value -- say a method signature within an obj or a fn
46614662
// type deep in a structure -- which the caller has a concrete view

0 commit comments

Comments
 (0)