rustc: Break metadata's dependency on link

This commit is contained in:
Brian Anderson 2012-05-14 18:29:01 -07:00
parent f08fe56479
commit 0f49928c2d
5 changed files with 13 additions and 13 deletions

View File

@ -286,10 +286,8 @@ mod write {
*
*/
type link_meta = {name: str, vers: str, extras_hash: str};
fn build_link_meta(sess: session, c: ast::crate, output: str,
sha: sha1) -> link_meta {
sha: sha1) -> encoder::link_meta {
type provided_metas =
{name: option<str>,
@ -412,8 +410,8 @@ fn truncated_sha1_result(sha: sha1) -> str unsafe {
// This calculates STH for a symbol, as defined above
fn symbol_hash(tcx: ty::ctxt, sha: sha1, t: ty::t, link_meta: link_meta) ->
str {
fn symbol_hash(tcx: ty::ctxt, sha: sha1, t: ty::t,
link_meta: encoder::link_meta) -> str {
// NB: do *not* use abbrevs here as we want the symbol names
// to be independent of one another in the crate.
@ -526,7 +524,7 @@ fn mangle_internal_name_by_seq(ccx: @crate_ctxt, flav: str) -> str {
fn link_binary(sess: session,
obj_filename: str,
out_filename: str,
lm: link_meta) {
lm: encoder::link_meta) {
// Converts a library file name into a cc -l argument
fn unlib(config: @session::config, filename: str) -> str unsafe {
let rmlib = fn@(filename: str) -> str {

View File

@ -15,8 +15,6 @@ mod front {
}
mod back {
import link = back_::link;
export link;
}
mod driver {

View File

@ -21,6 +21,7 @@ import middle::resolve;
import syntax::ast;
import driver::session::session;
export link_meta;
export encode_parms;
export encode_metadata;
export encoded_ty;
@ -33,6 +34,9 @@ export encode_ctxt;
export write_type;
export encode_def_id;
// FIXME: This probably belongs somewhere else
type link_meta = {name: str, vers: str, extras_hash: str};
type abbrev_map = map::hashmap<ty::t, tyencode::ty_abbrev>;
type encode_inlined_item = fn@(ecx: @encode_ctxt,
@ -47,7 +51,7 @@ type encode_parms = {
impl_map: resolve::impl_map,
item_symbols: hashmap<ast::node_id, str>,
discrim_symbols: hashmap<ast::node_id, str>,
link_meta: back::link::link_meta,
link_meta: link_meta,
cstore: cstore::cstore,
encode_inlined_item: encode_inlined_item
};
@ -59,7 +63,7 @@ enum encode_ctxt = {
impl_map: resolve::impl_map,
item_symbols: hashmap<ast::node_id, str>,
discrim_symbols: hashmap<ast::node_id, str>,
link_meta: back::link::link_meta,
link_meta: link_meta,
cstore: cstore::cstore,
encode_inlined_item: encode_inlined_item,
type_abbrevs: abbrev_map

View File

@ -4950,7 +4950,7 @@ fn create_module_map(ccx: @crate_ctxt) -> ValueRef {
}
fn decl_crate_map(sess: session::session, mapmeta: link::link_meta,
fn decl_crate_map(sess: session::session, mapmeta: encoder::link_meta,
llmod: ModuleRef) -> ValueRef {
let targ_cfg = sess.targ_cfg;
let int_type = T_int(targ_cfg);
@ -5043,7 +5043,7 @@ fn write_abi_version(ccx: @crate_ctxt) {
fn trans_crate(sess: session::session, crate: @ast::crate, tcx: ty::ctxt,
output: str, emap: resolve::exp_map,
maps: astencode::maps)
-> (ModuleRef, link::link_meta) {
-> (ModuleRef, encoder::link_meta) {
let sha = std::sha1::sha1();
let link_meta = link::build_link_meta(sess, *crate, output, sha);
let reachable = reachable::find_reachable(crate.node.module, emap, tcx,

View File

@ -77,7 +77,7 @@ type crate_ctxt = {
reachable: reachable::map,
item_symbols: hashmap<ast::node_id, str>,
mut main_fn: option<ValueRef>,
link_meta: link::link_meta,
link_meta: encoder::link_meta,
enum_sizes: hashmap<ty::t, uint>,
discrims: hashmap<ast::def_id, ValueRef>,
discrim_symbols: hashmap<ast::node_id, str>,