Skip to content

Commit ddec6b5

Browse files
committed
rustc: Use a set-based approach to unification; remove ty_bound_param and ty_local.
Sorry, big perf regression; will fix soon.
1 parent 721c5bb commit ddec6b5

File tree

10 files changed

+1106
-1185
lines changed

10 files changed

+1106
-1185
lines changed

src/comp/driver/rustc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ fn pretty_print_input(session::session sess, eval::env env, str input,
125125
pp_mode ppm) {
126126
auto def = tup(ast::local_crate, 0);
127127
auto p = front::parser::new_parser(sess, env, def, input, 0u, 0u);
128-
auto crate = front::parser::parse_crate_from_source_file(p);
128+
auto crate = parse_input(sess, p, input);
129129

130130
auto mode;
131131
alt (ppm) {

src/comp/middle/metadata.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -230,17 +230,6 @@ mod Encode {
230230
}
231231
case (ty::ty_type) {w.write_char('Y');}
232232
case (ty::ty_task) {w.write_char('a');}
233-
234-
// These two don't appear in crate metadata, but are here because
235-
// `hash_ty()` uses this function.
236-
case (ty::ty_bound_param(?id)) {
237-
w.write_char('o');
238-
w.write_str(common::uistr(id));
239-
}
240-
case (ty::ty_local(?def)) {
241-
w.write_char('L');
242-
w.write_str(cx.ds(def));
243-
}
244233
}
245234
}
246235

src/comp/middle/trans.rs

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -904,10 +904,6 @@ fn type_of_inner(&@crate_ctxt cx, &span sp, &ty::t t) -> TypeRef {
904904
case (ty::ty_param(_)) {
905905
llty = T_i8();
906906
}
907-
case (ty::ty_bound_param(_)) {
908-
cx.tcx.sess.span_err(sp,
909-
"trans::type_of called on ty_bound_param");
910-
}
911907
case (ty::ty_type) { llty = T_ptr(T_tydesc(cx.tn)); }
912908
}
913909

@@ -1299,7 +1295,6 @@ fn static_size_of_tag(&@crate_ctxt cx, &span sp, &ty::t t) -> uint {
12991295
auto tup_ty = simplify_type(cx, ty::mk_imm_tup(cx.tcx, variant.args));
13001296

13011297
// Perform any type parameter substitutions.
1302-
tup_ty = ty::bind_params_in_type(cx.tcx, tup_ty);
13031298
tup_ty = ty::substitute_type_params(cx.tcx, subtys, tup_ty);
13041299

13051300
// Here we possibly do a recursive call.
@@ -1373,10 +1368,8 @@ fn dynamic_size_of(&@block_ctxt cx, ty::t t) -> result {
13731368
let vec[ty::t] raw_tys = variant.args;
13741369
let vec[ty::t] tys = [];
13751370
for (ty::t raw_ty in raw_tys) {
1376-
auto t = ty::bind_params_in_type(cx.fcx.lcx.ccx.tcx,
1377-
raw_ty);
1378-
t = ty::substitute_type_params(cx.fcx.lcx.ccx.tcx, tps,
1379-
t);
1371+
auto t = ty::substitute_type_params(cx.fcx.lcx.ccx.tcx,
1372+
tps, raw_ty);
13801373
tys += [t];
13811374
}
13821375

@@ -1553,9 +1546,8 @@ fn GEP_tag(@block_ctxt cx,
15531546
auto i = 0;
15541547
let vec[ty::t] true_arg_tys = [];
15551548
for (ty::t aty in arg_tys) {
1556-
auto arg_ty = ty::bind_params_in_type(cx.fcx.lcx.ccx.tcx, aty);
1557-
arg_ty = ty::substitute_type_params(cx.fcx.lcx.ccx.tcx, ty_substs,
1558-
arg_ty);
1549+
auto arg_ty = ty::substitute_type_params(cx.fcx.lcx.ccx.tcx,
1550+
ty_substs, aty);
15591551
true_arg_tys += [arg_ty];
15601552
if (i == ix) {
15611553
elem_ty = arg_ty;
@@ -2745,10 +2737,8 @@ fn iter_structural_ty_full(&@block_ctxt cx,
27452737
auto llfldp_b = rslt.val;
27462738
variant_cx = rslt.bcx;
27472739

2748-
auto ty_subst = ty::bind_params_in_type(
2749-
cx.fcx.lcx.ccx.tcx, a.ty);
2750-
ty_subst = ty::substitute_type_params(
2751-
cx.fcx.lcx.ccx.tcx, tps, ty_subst);
2740+
auto ty_subst = ty::substitute_type_params(
2741+
cx.fcx.lcx.ccx.tcx, tps, a.ty);
27522742

27532743
auto llfld_a =
27542744
load_if_immediate(variant_cx,
@@ -5308,6 +5298,7 @@ fn trans_call(&@block_ctxt cx, &@ast::expr f,
53085298
}
53095299

53105300
auto ret_ty = ty::ann_to_type(cx.fcx.lcx.ccx.tcx, ann);
5301+
53115302
auto args_res = trans_args(f_res.res.bcx,
53125303
llenv, f_res.llobj,
53135304
f_res.generic,
@@ -7552,6 +7543,7 @@ fn decl_native_fn_and_pair(&@crate_ctxt ccx,
75527543

75537544
// Declare the wrapper.
75547545
auto t = node_ann_type(ccx, ann);
7546+
75557547
auto wrapper_type = native_fn_wrapper_type(ccx, sp, num_ty_param, t);
75567548
let str s = mangle_internal_name_by_path(ccx, path);
75577549
let ValueRef wrapper_fn = decl_internal_fastcall_fn(ccx.llmod, s,

0 commit comments

Comments
 (0)