Fix Merge Fallout
This commit is contained in:
parent
cc908b772c
commit
f2a7fc69da
@ -219,109 +219,109 @@ pub fn compile_rest(sess: Session,
|
|||||||
crate = time(time_passes, ~"intrinsic injection", ||
|
crate = time(time_passes, ~"intrinsic injection", ||
|
||||||
front::intrinsic_inject::inject_intrinsic(sess, crate));
|
front::intrinsic_inject::inject_intrinsic(sess, crate));
|
||||||
|
|
||||||
crate = time(time_passes, ~"extra injection", ||
|
crate = time(time_passes, ~"extra injection", ||
|
||||||
front::std_inject::maybe_inject_libstd_ref(sess, crate));
|
front::std_inject::maybe_inject_libstd_ref(sess, crate));
|
||||||
|
|
||||||
let ast_map = time(time_passes, ~"ast indexing", ||
|
let ast_map = time(time_passes, ~"ast indexing", ||
|
||||||
syntax::ast_map::map_crate(sess.diagnostic(), crate));
|
syntax::ast_map::map_crate(sess.diagnostic(), crate));
|
||||||
|
|
||||||
time(time_passes, ~"external crate/lib resolution", ||
|
time(time_passes, ~"external crate/lib resolution", ||
|
||||||
creader::read_crates(sess.diagnostic(), crate, sess.cstore,
|
creader::read_crates(sess.diagnostic(), crate, sess.cstore,
|
||||||
sess.filesearch,
|
sess.filesearch,
|
||||||
session::sess_os_to_meta_os(sess.targ_cfg.os),
|
session::sess_os_to_meta_os(sess.targ_cfg.os),
|
||||||
sess.opts.is_static,
|
sess.opts.is_static,
|
||||||
token::get_ident_interner()));
|
token::get_ident_interner()));
|
||||||
|
|
||||||
let lang_items = time(time_passes, ~"language item collection", ||
|
let lang_items = time(time_passes, ~"language item collection", ||
|
||||||
middle::lang_items::collect_language_items(crate, sess));
|
middle::lang_items::collect_language_items(crate, sess));
|
||||||
|
|
||||||
let middle::resolve::CrateMap {
|
let middle::resolve::CrateMap {
|
||||||
def_map: def_map,
|
def_map: def_map,
|
||||||
exp_map2: exp_map2,
|
exp_map2: exp_map2,
|
||||||
trait_map: trait_map
|
trait_map: trait_map
|
||||||
} =
|
} =
|
||||||
time(time_passes, ~"resolution", ||
|
time(time_passes, ~"resolution", ||
|
||||||
middle::resolve::resolve_crate(sess, lang_items, crate));
|
middle::resolve::resolve_crate(sess, lang_items, crate));
|
||||||
|
|
||||||
time(time_passes, ~"looking for entry point",
|
time(time_passes, ~"looking for entry point",
|
||||||
|| middle::entry::find_entry_point(sess, crate, ast_map));
|
|| middle::entry::find_entry_point(sess, crate, ast_map));
|
||||||
|
|
||||||
let freevars = time(time_passes, ~"freevar finding", ||
|
let freevars = time(time_passes, ~"freevar finding", ||
|
||||||
freevars::annotate_freevars(def_map, crate));
|
freevars::annotate_freevars(def_map, crate));
|
||||||
|
|
||||||
let region_map = time(time_passes, ~"region resolution", ||
|
let region_map = time(time_passes, ~"region resolution", ||
|
||||||
middle::region::resolve_crate(sess, def_map, crate));
|
middle::region::resolve_crate(sess, def_map, crate));
|
||||||
|
|
||||||
let rp_set = time(time_passes, ~"region parameterization inference", ||
|
let rp_set = time(time_passes, ~"region parameterization inference", ||
|
||||||
middle::region::determine_rp_in_crate(sess, ast_map, def_map, crate));
|
middle::region::determine_rp_in_crate(sess, ast_map, def_map, crate));
|
||||||
|
|
||||||
let ty_cx = ty::mk_ctxt(sess, def_map, ast_map, freevars,
|
let ty_cx = ty::mk_ctxt(sess, def_map, ast_map, freevars,
|
||||||
region_map, rp_set, lang_items);
|
region_map, rp_set, lang_items);
|
||||||
|
|
||||||
// passes are timed inside typeck
|
// passes are timed inside typeck
|
||||||
let (method_map, vtable_map) = typeck::check_crate(
|
let (method_map, vtable_map) = typeck::check_crate(
|
||||||
ty_cx, trait_map, crate);
|
ty_cx, trait_map, crate);
|
||||||
|
|
||||||
// These next two const passes can probably be merged
|
// These next two const passes can probably be merged
|
||||||
time(time_passes, ~"const marking", ||
|
time(time_passes, ~"const marking", ||
|
||||||
middle::const_eval::process_crate(crate, ty_cx));
|
middle::const_eval::process_crate(crate, ty_cx));
|
||||||
|
|
||||||
time(time_passes, ~"const checking", ||
|
time(time_passes, ~"const checking", ||
|
||||||
middle::check_const::check_crate(sess, crate, ast_map, def_map,
|
middle::check_const::check_crate(sess, crate, ast_map, def_map,
|
||||||
method_map, ty_cx));
|
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", ||
|
time(time_passes, ~"privacy checking", ||
|
||||||
middle::privacy::check_crate(ty_cx, &method_map, crate));
|
middle::privacy::check_crate(ty_cx, &method_map, crate));
|
||||||
|
|
||||||
time(time_passes, ~"effect checking", ||
|
time(time_passes, ~"effect checking", ||
|
||||||
middle::effect::check_crate(ty_cx, method_map, crate));
|
middle::effect::check_crate(ty_cx, method_map, crate));
|
||||||
|
|
||||||
time(time_passes, ~"loop checking", ||
|
time(time_passes, ~"loop checking", ||
|
||||||
middle::check_loop::check_crate(ty_cx, crate));
|
middle::check_loop::check_crate(ty_cx, crate));
|
||||||
|
|
||||||
let middle::moves::MoveMaps {moves_map, moved_variables_set,
|
let middle::moves::MoveMaps {moves_map, moved_variables_set,
|
||||||
capture_map} =
|
capture_map} =
|
||||||
time(time_passes, ~"compute moves", ||
|
time(time_passes, ~"compute moves", ||
|
||||||
middle::moves::compute_moves(ty_cx, method_map, crate));
|
middle::moves::compute_moves(ty_cx, method_map, crate));
|
||||||
|
|
||||||
time(time_passes, ~"match checking", ||
|
time(time_passes, ~"match checking", ||
|
||||||
middle::check_match::check_crate(ty_cx, method_map,
|
middle::check_match::check_crate(ty_cx, method_map,
|
||||||
moves_map, crate));
|
moves_map, crate));
|
||||||
|
|
||||||
time(time_passes, ~"liveness checking", ||
|
time(time_passes, ~"liveness checking", ||
|
||||||
middle::liveness::check_crate(ty_cx, method_map,
|
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,
|
|
||||||
capture_map, crate));
|
capture_map, crate));
|
||||||
|
|
||||||
time(time_passes, ~"kind checking", ||
|
let (root_map, write_guard_map) =
|
||||||
kind::check_crate(ty_cx, method_map, crate));
|
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", ||
|
time(time_passes, ~"kind checking", ||
|
||||||
lint::check_crate(ty_cx, crate));
|
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 {
|
if phases.to == cu_no_trans { return (Some(crate), Some(ty_cx)); }
|
||||||
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();
|
let maps = astencode::Maps {
|
||||||
time(time_passes, ~"translation", ||
|
root_map: root_map,
|
||||||
trans::base::trans_crate(sess, crate, ty_cx,
|
method_map: method_map,
|
||||||
&outputs.obj_filename,
|
vtable_map: vtable_map,
|
||||||
exp_map2, maps))
|
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();
|
let outputs = outputs.get_ref();
|
||||||
|
@ -3114,20 +3114,10 @@ pub fn trans_crate(sess: session::Session,
|
|||||||
io::println(fmt!("%-7u %s", v, k));
|
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);
|
|
||||||
}
|
|
||||||
|
@ -18,7 +18,7 @@ use lib::llvm::{llvm, TypeRef, Integer, Pointer, Float, Double};
|
|||||||
use lib::llvm::{Struct, Array, Attribute};
|
use lib::llvm::{Struct, Array, Attribute};
|
||||||
use lib::llvm::{StructRetAttribute};
|
use lib::llvm::{StructRetAttribute};
|
||||||
use lib::llvm::True;
|
use lib::llvm::True;
|
||||||
use middle::trans::base::task_llcx;
|
use middle::trans::context::task_llcx;
|
||||||
use middle::trans::common::*;
|
use middle::trans::common::*;
|
||||||
use middle::trans::cabi::*;
|
use middle::trans::cabi::*;
|
||||||
|
|
||||||
|
@ -89,6 +89,8 @@ pub struct CrateContext {
|
|||||||
// Cache of external const values
|
// Cache of external const values
|
||||||
extern_const_values: HashMap<ast::def_id, ValueRef>,
|
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>,
|
module_data: HashMap<~str, ValueRef>,
|
||||||
lltypes: HashMap<ty::t, TypeRef>,
|
lltypes: HashMap<ty::t, TypeRef>,
|
||||||
llsizingtypes: HashMap<ty::t, TypeRef>,
|
llsizingtypes: HashMap<ty::t, TypeRef>,
|
||||||
@ -178,6 +180,7 @@ impl CrateContext {
|
|||||||
const_globals: HashMap::new(),
|
const_globals: HashMap::new(),
|
||||||
const_values: HashMap::new(),
|
const_values: HashMap::new(),
|
||||||
extern_const_values: HashMap::new(),
|
extern_const_values: HashMap::new(),
|
||||||
|
impl_method_cache: HashMap::new(),
|
||||||
module_data: HashMap::new(),
|
module_data: HashMap::new(),
|
||||||
lltypes: HashMap::new(),
|
lltypes: HashMap::new(),
|
||||||
llsizingtypes: HashMap::new(),
|
llsizingtypes: HashMap::new(),
|
||||||
@ -244,4 +247,3 @@ unsafe fn set_task_llcx(c: ContextRef) {
|
|||||||
unsafe fn unset_task_llcx() {
|
unsafe fn unset_task_llcx() {
|
||||||
local_data::local_data_pop(task_local_llcx_key);
|
local_data::local_data_pop(task_local_llcx_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ use core::prelude::*;
|
|||||||
use driver::session;
|
use driver::session;
|
||||||
use lib::llvm::ValueRef;
|
use lib::llvm::ValueRef;
|
||||||
use lib::llvm::llvm;
|
use lib::llvm::llvm;
|
||||||
use middle::trans::base::task_llcx;
|
use middle::trans::context::task_llcx;
|
||||||
use middle::trans::common::*;
|
use middle::trans::common::*;
|
||||||
use middle::trans::machine;
|
use middle::trans::machine;
|
||||||
use middle::trans::type_of;
|
use middle::trans::type_of;
|
||||||
|
@ -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,
|
pub fn method_with_name_or_default(ccx: @mut CrateContext,
|
||||||
impl_id: ast::def_id,
|
impl_id: ast::def_id,
|
||||||
name: ast::ident) -> ast::def_id {
|
name: ast::ident) -> ast::def_id {
|
||||||
*do ccx.impl_method_cache.find_or_insert_with((impl_id, name)) |_| {
|
let imp = ccx.impl_method_cache.find_copy(&(impl_id, name));
|
||||||
if impl_id.crate == ast::local_crate {
|
match imp {
|
||||||
match ccx.tcx.items.get_copy(&impl_id.node) {
|
Some(m) => m,
|
||||||
ast_map::node_item(@ast::item {
|
None => {
|
||||||
node: ast::item_impl(_, _, _, ref ms), _
|
let imp = if impl_id.crate == ast::local_crate {
|
||||||
}, _) => {
|
match ccx.tcx.items.get_copy(&impl_id.node) {
|
||||||
let did = method_from_methods(*ms, name);
|
ast_map::node_item(@ast::item {
|
||||||
if did.is_some() {
|
node: ast::item_impl(_, _, _, ref ms), _
|
||||||
did.get()
|
}, _) => {
|
||||||
} else {
|
let did = method_from_methods(*ms, name);
|
||||||
// Look for a default method
|
if did.is_some() {
|
||||||
let pmm = ccx.tcx.provided_methods;
|
did.get()
|
||||||
match pmm.find(&impl_id) {
|
} else {
|
||||||
Some(pmis) => {
|
// Look for a default method
|
||||||
for pmis.each |pmi| {
|
let pmm = ccx.tcx.provided_methods;
|
||||||
if pmi.method_info.ident == name {
|
match pmm.find(&impl_id) {
|
||||||
debug!("pmi.method_info.did = %?", pmi.method_info.did);
|
Some(pmis) => {
|
||||||
return pmi.method_info.did;
|
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user