Skip to content

Commit 28c6084

Browse files
committed
---
yaml --- r: 4037 b: refs/heads/master c: df90f57 h: refs/heads/master i: 4035: e74fdf1 v: v3
1 parent e0ee751 commit 28c6084

File tree

3 files changed

+10
-30
lines changed

3 files changed

+10
-30
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: c32f525f73b90dc30a6d6ff943cc716e43e84d73
2+
refs/heads/master: df90f57a5f76059394abd8328d30003b844cb497

trunk/src/comp/back/link.rs

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -399,38 +399,18 @@ fn truncated_sha1_result(sha1 sha) -> str {
399399
ret str::substr(sha.result_str(), 0u, 16u);
400400
}
401401

402-
403-
// This calculates STH for a symbol, as defined above
404-
fn symbol_hash(ty::ctxt tcx, sha1 sha, &ty::t t,
405-
&link_meta link_meta) -> str {
406-
// NB: do *not* use abbrevs here as we want the symbol names
407-
// to be independent of one another in the crate.
408-
402+
fn hash_link_meta(sha1 sha, &link_meta link_meta) -> str {
409403
sha.reset();
410404
sha.input_str(link_meta.name);
411405
sha.input_str("-");
412-
// FIXME: This wants to be link_meta.meta_hash
413-
sha.input_str(link_meta.name);
406+
sha.input_str(link_meta.vers);
414407
sha.input_str("-");
415-
sha.input_str(encoder::encoded_ty(tcx, t));
416-
auto hash = truncated_sha1_result(sha);
417-
// Prefix with _ so that it never blends into adjacent digits
418-
419-
ret "_" + hash;
408+
sha.input_str(link_meta.extras_hash);
409+
ret truncated_sha1_result(sha);
420410
}
421411

422412
fn get_symbol_hash(&@crate_ctxt ccx, &ty::t t) -> str {
423-
auto hash = "";
424-
alt (ccx.type_sha1s.find(t)) {
425-
case (some(?h)) { hash = h; }
426-
case (none) {
427-
hash =
428-
symbol_hash(ccx.tcx, ccx.sha, t,
429-
ccx.link_meta);
430-
ccx.type_sha1s.insert(t, hash);
431-
}
432-
}
433-
ret hash;
413+
ret #fmt("_%s_%u", ccx.link_meta_hash, t);
434414
}
435415

436416
fn mangle(&str[] ss) -> str {

trunk/src/comp/middle/trans.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ type crate_ctxt =
136136
hashmap[ast::node_id, str] item_symbols,
137137
mutable option::t[ValueRef] main_fn,
138138
link::link_meta link_meta,
139+
str link_meta_hash,
139140

140141
// TODO: hashmap[tup(tag_id,subtys), @tag_info]
141142
hashmap[ty::t, uint] tag_sizes,
@@ -150,7 +151,6 @@ type crate_ctxt =
150151
@glue_fns glues,
151152
namegen names,
152153
std::sha1::sha1 sha,
153-
hashmap[ty::t, str] type_sha1s,
154154
hashmap[ty::t, str] type_short_names,
155155
ty::ctxt tcx,
156156
stats stats,
@@ -8601,9 +8601,9 @@ fn trans_crate(&session::session sess, &@ast::crate crate, &ty::ctxt tcx,
86018601
auto tag_sizes = map::mk_hashmap[ty::t, uint](hasher, eqer);
86028602
auto tydescs = map::mk_hashmap[ty::t, @tydesc_info](hasher, eqer);
86038603
auto lltypes = map::mk_hashmap[ty::t, TypeRef](hasher, eqer);
8604-
auto sha1s = map::mk_hashmap[ty::t, str](hasher, eqer);
86058604
auto short_names = map::mk_hashmap[ty::t, str](hasher, eqer);
86068605
auto sha = std::sha1::mk_sha1();
8606+
auto link_meta = link::build_link_meta(sess, *crate, output, sha);
86078607
auto ccx =
86088608
@rec(sess=sess,
86098609
llmod=llmod,
@@ -8615,7 +8615,8 @@ fn trans_crate(&session::session sess, &@ast::crate crate, &ty::ctxt tcx,
86158615
ast_map=amap,
86168616
item_symbols=new_int_hash[str](),
86178617
mutable main_fn=none[ValueRef],
8618-
link_meta=link::build_link_meta(sess, *crate, output, sha),
8618+
link_meta=link_meta,
8619+
link_meta_hash=link::hash_link_meta(sha, link_meta),
86198620
tag_sizes=tag_sizes,
86208621
discrims=new_int_hash[ValueRef](),
86218622
discrim_symbols=new_int_hash[str](),
@@ -8628,7 +8629,6 @@ fn trans_crate(&session::session sess, &@ast::crate crate, &ty::ctxt tcx,
86288629
glues=glues,
86298630
names=namegen(0),
86308631
sha=sha,
8631-
type_sha1s=sha1s,
86328632
type_short_names=short_names,
86338633
tcx=tcx,
86348634
stats=rec(mutable n_static_tydescs=0u,

0 commit comments

Comments
 (0)