Skip to content

Commit b49bdad

Browse files
committed
rustc: Box raw types. Shaves about 5 seconds off compilation.
1 parent df90f57 commit b49bdad

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

src/comp/middle/ty.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ const uint idx_bot = 20u;
352352

353353
const uint idx_first_others = 21u;
354354

355-
type type_store = interner::interner[raw_t];
355+
type type_store = interner::interner[@raw_t];
356356

357357
type ty_param_substs_opt_and_ty = tup(option::t[ty::t[]], ty::t);
358358

@@ -403,7 +403,7 @@ fn mk_ctxt(session::session s, resolve::def_map dm,
403403
let node_type_table ntt =
404404
@smallintmap::mk[ty::ty_param_substs_opt_and_ty]();
405405
auto tcache = new_def_hash[ty::ty_param_count_and_ty]();
406-
auto ts = @interner::mk[raw_t](hash_raw_ty, eq_raw_ty);
406+
auto ts = @interner::mk[@raw_t](hash_raw_ty, eq_raw_ty);
407407
auto cx =
408408
rec(ts=ts,
409409
sess=s,
@@ -428,14 +428,14 @@ fn mk_ctxt(session::session s, resolve::def_map dm,
428428

429429

430430
// Type constructors
431-
fn mk_raw_ty(&ctxt cx, &sty st, &option::t[str] in_cname) -> raw_t {
431+
fn mk_raw_ty(&ctxt cx, &sty st, &option::t[str] in_cname) -> @raw_t {
432432
auto cname = none;
433433
auto h = hash_type_info(st, cname);
434434
let bool has_params = false;
435435
let bool has_vars = false;
436436
fn derive_flags_t(&ctxt cx, &mutable bool has_params,
437437
&mutable bool has_vars, &t tt) {
438-
auto rt = interner::get[raw_t](*cx.ts, tt);
438+
auto rt = interner::get[@raw_t](*cx.ts, tt);
439439
has_params = has_params || rt.has_params;
440440
has_vars = has_vars || rt.has_vars;
441441
}
@@ -511,20 +511,20 @@ fn mk_raw_ty(&ctxt cx, &sty st, &option::t[str] in_cname) -> raw_t {
511511
derive_flags_t(cx, has_params, has_vars, tt);
512512
}
513513
}
514-
ret rec(struct=st,
515-
cname=cname,
516-
hash=h,
517-
has_params=has_params,
518-
has_vars=has_vars);
514+
ret @rec(struct=st,
515+
cname=cname,
516+
hash=h,
517+
has_params=has_params,
518+
has_vars=has_vars);
519519
}
520520

521521
fn intern(&ctxt cx, &sty st, &option::t[str] cname) {
522-
interner::intern[raw_t](*cx.ts, mk_raw_ty(cx, st, cname));
522+
interner::intern(*cx.ts, mk_raw_ty(cx, st, cname));
523523
}
524524

525525
fn gen_ty_full(&ctxt cx, &sty st, &option::t[str] cname) -> t {
526526
auto raw_type = mk_raw_ty(cx, st, cname);
527-
ret interner::intern[raw_t](*cx.ts, raw_type);
527+
ret interner::intern(*cx.ts, raw_type);
528528
}
529529

530530

@@ -635,13 +635,13 @@ fn mk_native(&ctxt cx, &def_id did) -> t { ret gen_ty(cx, ty_native(did)); }
635635

636636
// Returns the one-level-deep type structure of the given type.
637637
fn struct(&ctxt cx, &t typ) -> sty {
638-
ret interner::get[raw_t](*cx.ts, typ).struct;
638+
ret interner::get(*cx.ts, typ).struct;
639639
}
640640

641641

642642
// Returns the canonical name of the given type.
643643
fn cname(&ctxt cx, &t typ) -> option::t[str] {
644-
ret interner::get[raw_t](*cx.ts, typ).cname;
644+
ret interner::get(*cx.ts, typ).cname;
645645
}
646646

647647

@@ -1434,7 +1434,7 @@ fn hash_type_info(&sty st, &option::t[str] cname_opt) -> uint {
14341434
ret h;
14351435
}
14361436

1437-
fn hash_raw_ty(&raw_t rt) -> uint { ret rt.hash; }
1437+
fn hash_raw_ty(&@raw_t rt) -> uint { ret rt.hash; }
14381438

14391439
fn hash_ty(&t typ) -> uint { ret typ; }
14401440

@@ -1728,7 +1728,7 @@ fn equal_type_structures(&sty a, &sty b) -> bool {
17281728
// module.
17291729
//
17301730
// FIXME: Use structural comparison, but this loops forever and segfaults.
1731-
fn eq_raw_ty(&raw_t a, &raw_t b) -> bool {
1731+
fn eq_raw_ty(&@raw_t a, &@raw_t b) -> bool {
17321732
// Check hashes (fast path).
17331733

17341734
if (a.hash != b.hash) { ret false; }
@@ -1830,11 +1830,11 @@ fn count_ty_params(&ctxt cx, t ty) -> uint {
18301830
}
18311831

18321832
fn type_contains_vars(&ctxt cx, &t typ) -> bool {
1833-
ret interner::get[raw_t](*cx.ts, typ).has_vars;
1833+
ret interner::get(*cx.ts, typ).has_vars;
18341834
}
18351835

18361836
fn type_contains_params(&ctxt cx, &t typ) -> bool {
1837-
ret interner::get[raw_t](*cx.ts, typ).has_params;
1837+
ret interner::get(*cx.ts, typ).has_params;
18381838
}
18391839

18401840

0 commit comments

Comments
 (0)