Fix Merge Fallout

This commit is contained in:
James Miller 2013-06-14 17:38:17 +12:00 committed by James Miller
parent cc908b772c
commit f2a7fc69da
6 changed files with 120 additions and 120 deletions

View File

@ -219,109 +219,109 @@ pub fn compile_rest(sess: Session,
crate = time(time_passes, ~"intrinsic injection", ||
front::intrinsic_inject::inject_intrinsic(sess, crate));
crate = time(time_passes, ~"extra injection", ||
front::std_inject::maybe_inject_libstd_ref(sess, crate));
crate = time(time_passes, ~"extra injection", ||
front::std_inject::maybe_inject_libstd_ref(sess, crate));
let ast_map = time(time_passes, ~"ast indexing", ||
syntax::ast_map::map_crate(sess.diagnostic(), crate));
let ast_map = time(time_passes, ~"ast indexing", ||
syntax::ast_map::map_crate(sess.diagnostic(), crate));
time(time_passes, ~"external crate/lib resolution", ||
creader::read_crates(sess.diagnostic(), crate, sess.cstore,
sess.filesearch,
session::sess_os_to_meta_os(sess.targ_cfg.os),
sess.opts.is_static,
token::get_ident_interner()));
time(time_passes, ~"external crate/lib resolution", ||
creader::read_crates(sess.diagnostic(), crate, sess.cstore,
sess.filesearch,
session::sess_os_to_meta_os(sess.targ_cfg.os),
sess.opts.is_static,
token::get_ident_interner()));
let lang_items = time(time_passes, ~"language item collection", ||
middle::lang_items::collect_language_items(crate, sess));
let lang_items = time(time_passes, ~"language item collection", ||
middle::lang_items::collect_language_items(crate, sess));
let middle::resolve::CrateMap {
def_map: def_map,
exp_map2: exp_map2,
trait_map: trait_map
} =
time(time_passes, ~"resolution", ||
middle::resolve::resolve_crate(sess, lang_items, crate));
let middle::resolve::CrateMap {
def_map: def_map,
exp_map2: exp_map2,
trait_map: trait_map
} =
time(time_passes, ~"resolution", ||
middle::resolve::resolve_crate(sess, lang_items, crate));
time(time_passes, ~"looking for entry point",
|| middle::entry::find_entry_point(sess, crate, ast_map));
time(time_passes, ~"looking for entry point",
|| middle::entry::find_entry_point(sess, crate, ast_map));
let freevars = time(time_passes, ~"freevar finding", ||
freevars::annotate_freevars(def_map, crate));
let freevars = time(time_passes, ~"freevar finding", ||
freevars::annotate_freevars(def_map, crate));
let region_map = time(time_passes, ~"region resolution", ||
middle::region::resolve_crate(sess, def_map, crate));
let region_map = time(time_passes, ~"region resolution", ||
middle::region::resolve_crate(sess, def_map, crate));
let rp_set = time(time_passes, ~"region parameterization inference", ||
middle::region::determine_rp_in_crate(sess, ast_map, def_map, crate));
let rp_set = time(time_passes, ~"region parameterization inference", ||
middle::region::determine_rp_in_crate(sess, ast_map, def_map, crate));
let ty_cx = ty::mk_ctxt(sess, def_map, ast_map, freevars,
region_map, rp_set, lang_items);
let ty_cx = ty::mk_ctxt(sess, def_map, ast_map, freevars,
region_map, rp_set, lang_items);
// passes are timed inside typeck
let (method_map, vtable_map) = typeck::check_crate(
ty_cx, trait_map, crate);
// passes are timed inside typeck
let (method_map, vtable_map) = typeck::check_crate(
ty_cx, trait_map, crate);
// These next two const passes can probably be merged
time(time_passes, ~"const marking", ||
middle::const_eval::process_crate(crate, ty_cx));
// These next two const passes can probably be merged
time(time_passes, ~"const marking", ||
middle::const_eval::process_crate(crate, ty_cx));
time(time_passes, ~"const checking", ||
middle::check_const::check_crate(sess, crate, ast_map, def_map,
method_map, ty_cx));
time(time_passes, ~"const checking", ||
middle::check_const::check_crate(sess, crate, ast_map, def_map,
method_map, ty_cx));
if phases.to == cu_typeck { return (Some(crate), Some(ty_cx)); }
if phases.to == cu_typeck { return (Some(crate), Some(ty_cx)); }
time(time_passes, ~"privacy checking", ||
middle::privacy::check_crate(ty_cx, &method_map, crate));
time(time_passes, ~"privacy checking", ||
middle::privacy::check_crate(ty_cx, &method_map, crate));
time(time_passes, ~"effect checking", ||
middle::effect::check_crate(ty_cx, method_map, crate));
time(time_passes, ~"effect checking", ||
middle::effect::check_crate(ty_cx, method_map, crate));
time(time_passes, ~"loop checking", ||
middle::check_loop::check_crate(ty_cx, crate));
time(time_passes, ~"loop checking", ||
middle::check_loop::check_crate(ty_cx, crate));
let middle::moves::MoveMaps {moves_map, moved_variables_set,
capture_map} =
time(time_passes, ~"compute moves", ||
middle::moves::compute_moves(ty_cx, method_map, crate));
let middle::moves::MoveMaps {moves_map, moved_variables_set,
capture_map} =
time(time_passes, ~"compute moves", ||
middle::moves::compute_moves(ty_cx, method_map, crate));
time(time_passes, ~"match checking", ||
middle::check_match::check_crate(ty_cx, method_map,
moves_map, crate));
time(time_passes, ~"match checking", ||
middle::check_match::check_crate(ty_cx, method_map,
moves_map, crate));
time(time_passes, ~"liveness checking", ||
middle::liveness::check_crate(ty_cx, method_map,
capture_map, crate));
let (root_map, write_guard_map) =
time(time_passes, ~"borrow checking", ||
middle::borrowck::check_crate(ty_cx, method_map,
moves_map, moved_variables_set,
time(time_passes, ~"liveness checking", ||
middle::liveness::check_crate(ty_cx, method_map,
capture_map, crate));
time(time_passes, ~"kind checking", ||
kind::check_crate(ty_cx, method_map, crate));
let (root_map, write_guard_map) =
time(time_passes, ~"borrow checking", ||
middle::borrowck::check_crate(ty_cx, method_map,
moves_map, moved_variables_set,
capture_map, crate));
time(time_passes, ~"lint checking", ||
lint::check_crate(ty_cx, crate));
time(time_passes, ~"kind checking", ||
kind::check_crate(ty_cx, method_map, crate));
if phases.to == cu_no_trans { return (Some(crate), Some(ty_cx)); }
time(time_passes, ~"lint checking", ||
lint::check_crate(ty_cx, crate));
let maps = astencode::Maps {
root_map: root_map,
method_map: method_map,
vtable_map: vtable_map,
write_guard_map: write_guard_map,
moves_map: moves_map,
capture_map: capture_map
};
if phases.to == cu_no_trans { return (Some(crate), Some(ty_cx)); }
let outputs = outputs.get_ref();
time(time_passes, ~"translation", ||
trans::base::trans_crate(sess, crate, ty_cx,
&outputs.obj_filename,
exp_map2, maps))
let maps = astencode::Maps {
root_map: root_map,
method_map: method_map,
vtable_map: vtable_map,
write_guard_map: write_guard_map,
moves_map: moves_map,
capture_map: capture_map
};
let outputs = outputs.get_ref();
time(time_passes, ~"translation", ||
trans::base::trans_crate(sess, crate, ty_cx,
&outputs.obj_filename,
exp_map2, maps))
};
let outputs = outputs.get_ref();

View File

@ -3114,20 +3114,10 @@ pub fn trans_crate(sess: session::Session,
io::println(fmt!("%-7u %s", v, k));
}
}
return (llmod, link_meta);
let llcx = ccx.llcx;
let link_meta = ccx.link_meta;
let llmod = ccx.llmod;
return (llcx, llmod, link_meta);
}
fn task_local_llcx_key(_v: @ContextRef) {}
pub fn task_llcx() -> ContextRef {
let opt = unsafe { local_data::local_data_get(task_local_llcx_key) };
*opt.expect("task-local LLVMContextRef wasn't ever set!")
}
unsafe fn set_task_llcx(c: ContextRef) {
local_data::local_data_set(task_local_llcx_key, @c);
}
unsafe fn unset_task_llcx() {
local_data::local_data_pop(task_local_llcx_key);
}

View File

@ -18,7 +18,7 @@ use lib::llvm::{llvm, TypeRef, Integer, Pointer, Float, Double};
use lib::llvm::{Struct, Array, Attribute};
use lib::llvm::{StructRetAttribute};
use lib::llvm::True;
use middle::trans::base::task_llcx;
use middle::trans::context::task_llcx;
use middle::trans::common::*;
use middle::trans::cabi::*;

View File

@ -89,6 +89,8 @@ pub struct CrateContext {
// Cache of external const values
extern_const_values: HashMap<ast::def_id, ValueRef>,
impl_method_cache: HashMap<(ast::def_id, ast::ident), ast::def_id>,
module_data: HashMap<~str, ValueRef>,
lltypes: HashMap<ty::t, TypeRef>,
llsizingtypes: HashMap<ty::t, TypeRef>,
@ -178,6 +180,7 @@ impl CrateContext {
const_globals: HashMap::new(),
const_values: HashMap::new(),
extern_const_values: HashMap::new(),
impl_method_cache: HashMap::new(),
module_data: HashMap::new(),
lltypes: HashMap::new(),
llsizingtypes: HashMap::new(),
@ -244,4 +247,3 @@ unsafe fn set_task_llcx(c: ContextRef) {
unsafe fn unset_task_llcx() {
local_data::local_data_pop(task_local_llcx_key);
}

View File

@ -13,7 +13,7 @@ use core::prelude::*;
use driver::session;
use lib::llvm::ValueRef;
use lib::llvm::llvm;
use middle::trans::base::task_llcx;
use middle::trans::context::task_llcx;
use middle::trans::common::*;
use middle::trans::machine;
use middle::trans::type_of;

View File

@ -381,36 +381,44 @@ pub fn method_from_methods(ms: &[@ast::method], name: ast::ident)
pub fn method_with_name_or_default(ccx: @mut CrateContext,
impl_id: ast::def_id,
name: ast::ident) -> ast::def_id {
*do ccx.impl_method_cache.find_or_insert_with((impl_id, name)) |_| {
if impl_id.crate == ast::local_crate {
match ccx.tcx.items.get_copy(&impl_id.node) {
ast_map::node_item(@ast::item {
node: ast::item_impl(_, _, _, ref ms), _
}, _) => {
let did = method_from_methods(*ms, name);
if did.is_some() {
did.get()
} else {
// Look for a default method
let pmm = ccx.tcx.provided_methods;
match pmm.find(&impl_id) {
Some(pmis) => {
for pmis.each |pmi| {
if pmi.method_info.ident == name {
debug!("pmi.method_info.did = %?", pmi.method_info.did);
return pmi.method_info.did;
let imp = ccx.impl_method_cache.find_copy(&(impl_id, name));
match imp {
Some(m) => m,
None => {
let imp = if impl_id.crate == ast::local_crate {
match ccx.tcx.items.get_copy(&impl_id.node) {
ast_map::node_item(@ast::item {
node: ast::item_impl(_, _, _, ref ms), _
}, _) => {
let did = method_from_methods(*ms, name);
if did.is_some() {
did.get()
} else {
// Look for a default method
let pmm = ccx.tcx.provided_methods;
match pmm.find(&impl_id) {
Some(pmis) => {
for pmis.each |pmi| {
if pmi.method_info.ident == name {
debug!("pmi.method_info.did = %?", pmi.method_info.did);
return pmi.method_info.did;
}
}
fail!()
}
fail!()
None => fail!()
}
None => fail!()
}
}
_ => fail!("method_with_name")
}
_ => fail!("method_with_name")
}
} else {
csearch::get_impl_method(ccx.sess.cstore, impl_id, name)
} else {
csearch::get_impl_method(ccx.sess.cstore, impl_id, name)
};
ccx.impl_method_cache.insert((impl_id, name), imp);
imp
}
}
}