Skip to content

Commit c2cabea

Browse files
committed
---
yaml --- r: 1507 b: refs/heads/master c: 629eba1 h: refs/heads/master i: 1505: b94f6e7 1503: ae98ef0 v: v3
1 parent dd41b7b commit c2cabea

File tree

2 files changed

+7
-15
lines changed

2 files changed

+7
-15
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: b4a85c7b583b75eade31d698ad9862f5f98e8857
2+
refs/heads/master: 629eba1d066ba4295baf4bfed41cae240c527af5

trunk/src/comp/middle/trans.rs

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,7 @@ type glue_fns = rec(ValueRef activate_glue,
6060
ValueRef bzero_glue,
6161
ValueRef vec_grow_glue);
6262

63-
type tag_info = rec(
64-
type_handle th,
65-
mutable @hashmap[ast.def_id,ValueRef] lldiscrims
66-
);
63+
type tag_info = rec(type_handle th);
6764

6865
state type crate_ctxt = rec(session.session sess,
6966
ModuleRef llmod,
@@ -78,6 +75,7 @@ state type crate_ctxt = rec(session.session sess,
7875
hashmap[ast.def_id,
7976
@ast.native_item] native_items,
8077
hashmap[@ty.t, @tag_info] tags,
78+
hashmap[ast.def_id, ValueRef] discrims,
8179
hashmap[ast.def_id, ValueRef] fn_pairs,
8280
hashmap[ast.def_id, ValueRef] consts,
8381
hashmap[ast.def_id,()] obj_methods,
@@ -2962,9 +2960,7 @@ fn trans_path(@block_ctxt cx, &ast.path p, &option.t[ast.def] dopt,
29622960
} else {
29632961
// Nullary variant.
29642962
auto tag_ty = node_ann_type(cx.fcx.ccx, ann);
2965-
auto info = cx.fcx.ccx.tags.get(tag_ty);
2966-
check (info.lldiscrims.contains_key(vid));
2967-
auto lldiscrim_gv = info.lldiscrims.get(vid);
2963+
auto lldiscrim_gv = cx.fcx.ccx.discrims.get(vid);
29682964
auto lldiscrim = cx.build.Load(lldiscrim_gv);
29692965

29702966
auto alloc_result = alloc_ty(cx, tag_ty);
@@ -4866,10 +4862,7 @@ fn collect_item(&@crate_ctxt cx, @ast.item i) -> @crate_ctxt {
48664862
auto vi = new_def_hash[uint]();
48674863
auto navi = new_def_hash[uint]();
48684864

4869-
auto info = @rec(
4870-
th=mk_type_handle(),
4871-
mutable lldiscrims=@new_def_hash[ValueRef]()
4872-
);
4865+
auto info = @rec(th=mk_type_handle());
48734866

48744867
cx.tags.insert(mk_plain_tag(tag_id), info);
48754868
cx.items.insert(tag_id, i);
@@ -4980,8 +4973,6 @@ fn resolve_tag_types(@crate_ctxt cx, @ast.crate crate) {
49804973
fn trans_constant(&@crate_ctxt cx, @ast.item it) -> @crate_ctxt {
49814974
alt (it.node) {
49824975
case (ast.item_tag(_, ?variants, _, ?tag_id)) {
4983-
auto info = cx.tags.get(mk_plain_tag(tag_id));
4984-
49854976
auto i = 0u;
49864977
auto n_variants = _vec.len[ast.variant](variants);
49874978
while (i < n_variants) {
@@ -5000,7 +4991,7 @@ fn trans_constant(&@crate_ctxt cx, @ast.item it) -> @crate_ctxt {
50004991
llvm.LLVMSetLinkage(discrim_gvar, lib.llvm.LLVMPrivateLinkage
50014992
as llvm.Linkage);
50024993

5003-
info.lldiscrims.insert(variant.id, discrim_gvar);
4994+
cx.discrims.insert(variant.id, discrim_gvar);
50044995

50054996
i += 1u;
50064997
}
@@ -5445,6 +5436,7 @@ fn trans_crate(session.session sess, @ast.crate crate, str output,
54455436
items = new_def_hash[@ast.item](),
54465437
native_items = new_def_hash[@ast.native_item](),
54475438
tags = tags,
5439+
discrims = new_def_hash[ValueRef](),
54485440
fn_pairs = new_def_hash[ValueRef](),
54495441
consts = new_def_hash[ValueRef](),
54505442
obj_methods = new_def_hash[()](),

0 commit comments

Comments
 (0)