Skip to content

Commit 5204563

Browse files
committed
---
yaml --- r: 2162 b: refs/heads/master c: 6651826 h: refs/heads/master v: v3
1 parent 713ff8a commit 5204563

File tree

3 files changed

+26
-17
lines changed

3 files changed

+26
-17
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 5475c0009ca594e86ddb4c122a88e63261299e8f
2+
refs/heads/master: 6651826677842083c59725903a856eb39d8e5051

trunk/src/comp/middle/trans.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ state type crate_ctxt = rec(session.session sess,
110110
hashmap[ast.def_id,()] obj_methods,
111111
hashmap[@ty.t, @tydesc_info] tydescs,
112112
hashmap[str, ValueRef] module_data,
113+
hashmap[@ty.t, TypeRef] lltypes,
113114
@glue_fns glues,
114115
namegen names,
115116
vec[str] path,
@@ -676,6 +677,11 @@ fn type_of_native_fn(@crate_ctxt cx, ast.native_abi abi,
676677
}
677678

678679
fn type_of_inner(@crate_ctxt cx, @ty.t t) -> TypeRef {
680+
// Check the cache.
681+
if (cx.lltypes.contains_key(t)) {
682+
ret cx.lltypes.get(t);
683+
}
684+
679685
let TypeRef llty = 0 as TypeRef;
680686

681687
alt (t.struct) {
@@ -779,6 +785,7 @@ fn type_of_inner(@crate_ctxt cx, @ty.t t) -> TypeRef {
779785

780786
check (llty as int != 0);
781787
llvm.LLVMAddTypeName(cx.llmod, _str.buf(ty.ty_to_str(t)), llty);
788+
cx.lltypes.insert(t, llty);
782789
ret llty;
783790
}
784791

@@ -7476,6 +7483,7 @@ fn trans_crate(session.session sess, @ast.crate crate,
74767483
auto eqer = ty.eq_ty;
74777484
auto tag_sizes = map.mk_hashmap[@ty.t,uint](hasher, eqer);
74787485
auto tydescs = map.mk_hashmap[@ty.t,@tydesc_info](hasher, eqer);
7486+
auto lltypes = map.mk_hashmap[@ty.t,TypeRef](hasher, eqer);
74797487
let vec[ast.ty_param] obj_typarams = vec();
74807488
let vec[ast.obj_field] obj_fields = vec();
74817489

@@ -7500,6 +7508,7 @@ fn trans_crate(session.session sess, @ast.crate crate,
75007508
obj_methods = new_def_hash[()](),
75017509
tydescs = tydescs,
75027510
module_data = new_str_hash[ValueRef](),
7511+
lltypes = lltypes,
75037512
glues = glues,
75047513
names = namegen(0),
75057514
path = pth,

trunk/src/comp/rustc.rc

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,22 @@
33

44
use std;
55

6+
mod middle {
7+
mod trans;
8+
mod ty;
9+
mod fold;
10+
mod metadata;
11+
mod resolve;
12+
mod capture;
13+
mod typeck;
14+
mod typestate_check;
15+
}
16+
17+
mod pretty {
18+
mod pprust;
19+
mod pp;
20+
}
21+
622
mod front {
723
mod ast;
824
mod creader;
@@ -14,17 +30,6 @@ mod front {
1430
mod eval;
1531
}
1632

17-
mod middle {
18-
mod fold;
19-
mod metadata;
20-
mod resolve;
21-
mod capture;
22-
mod trans;
23-
mod ty;
24-
mod typeck;
25-
mod typestate_check;
26-
}
27-
2833
mod back {
2934
mod abi;
3035
mod x86;
@@ -35,11 +40,6 @@ mod driver {
3540
mod session;
3641
}
3742

38-
mod pretty {
39-
mod pp;
40-
mod pprust;
41-
}
42-
4343
mod util {
4444
mod common;
4545
mod typestate_ann;

0 commit comments

Comments
 (0)