Skip to content

Commit

Permalink
auto merge of #13244 : cmr/rust/tbaa, r=alexcrichton
Browse files Browse the repository at this point in the history
  • Loading branch information
bors committed Apr 3, 2014
2 parents 7bda3df + 46790a7 commit 6f1c06d
Show file tree
Hide file tree
Showing 44 changed files with 49 additions and 1,113 deletions.
35 changes: 0 additions & 35 deletions src/librustc/back/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,44 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

pub static rc_base_field_refcnt: uint = 0u;

pub static task_field_refcnt: uint = 0u;

pub static task_field_stk: uint = 2u;

pub static task_field_runtime_sp: uint = 3u;

pub static task_field_rust_sp: uint = 4u;

pub static task_field_gc_alloc_chain: uint = 5u;

pub static task_field_dom: uint = 6u;

pub static n_visible_task_fields: uint = 7u;

pub static dom_field_interrupt_flag: uint = 1u;

pub static frame_glue_fns_field_mark: uint = 0u;

pub static frame_glue_fns_field_drop: uint = 1u;

pub static frame_glue_fns_field_reloc: uint = 2u;

pub static box_field_refcnt: uint = 0u;
pub static box_field_tydesc: uint = 1u;
pub static box_field_prev: uint = 2u;
pub static box_field_next: uint = 3u;
pub static box_field_body: uint = 4u;

pub static general_code_alignment: uint = 16u;

pub static tydesc_field_size: uint = 0u;
pub static tydesc_field_align: uint = 1u;
pub static tydesc_field_drop_glue: uint = 2u;
pub static tydesc_field_visit_glue: uint = 3u;
pub static tydesc_field_name_offset: uint = 4u;
pub static n_tydesc_fields: uint = 5u;

// The two halves of a closure: code and environment.
pub static fn_field_code: uint = 0u;
Expand All @@ -64,5 +31,3 @@ pub static vec_elt_elems: uint = 2u;

pub static slice_elt_base: uint = 0u;
pub static slice_elt_len: uint = 1u;

pub static abi_version: uint = 1u;
23 changes: 0 additions & 23 deletions src/librustc/back/archive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,29 +87,6 @@ impl<'a> Archive<'a> {
Archive { sess: sess, dst: dst }
}

/// Read a file in the archive
pub fn read(&self, file: &str) -> Vec<u8> {
// Apparently if "ar p" is used on windows, it generates a corrupt file
// which has bad headers and LLVM will immediately choke on it
if cfg!(windows) {
let loc = TempDir::new("rsar").unwrap();
let archive = os::make_absolute(&self.dst);
run_ar(self.sess, "x", Some(loc.path()), [&archive,
&Path::new(file)]);
let result: Vec<u8> =
fs::File::open(&loc.path().join(file)).read_to_end()
.unwrap()
.move_iter()
.collect();
result
} else {
run_ar(self.sess,
"p",
None,
[&self.dst, &Path::new(file)]).output.move_iter().collect()
}
}

/// Adds all of the contents of a native library to this archive. This will
/// search in the relevant locations for a library named `name`.
pub fn add_native_library(&mut self, name: &str) -> io::IoResult<()> {
Expand Down
10 changes: 0 additions & 10 deletions src/librustc/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -687,16 +687,6 @@ pub fn mangle_exported_name(ccx: &CrateContext, path: PathElems,
exported_name(path, hash, ccx.link_meta.crateid.version_or_default())
}

pub fn mangle_internal_name_by_type_only(ccx: &CrateContext,
t: ty::t,
name: &str) -> ~str {
let s = ppaux::ty_to_short_str(ccx.tcx(), t);
let path = [PathName(token::intern(name)),
PathName(token::intern(s))];
let hash = get_symbol_hash(ccx, t);
mangle(ast_map::Values(path.iter()), Some(hash.as_slice()), None)
}

pub fn mangle_internal_name_by_type_and_seq(ccx: &CrateContext,
t: ty::t,
name: &str) -> ~str {
Expand Down
37 changes: 1 addition & 36 deletions src/librustc/lib/llvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#![allow(non_uppercase_pattern_statics)]
#![allow(non_camel_case_types)]
#![allow(dead_code)]

use std::c_str::ToCStr;
use std::cell::RefCell;
Expand Down Expand Up @@ -1911,42 +1912,6 @@ pub fn mk_target_data(string_rep: &str) -> TargetData {
}
}

/* Memory-managed interface to pass managers. */

pub struct pass_manager_res {
pub pm: PassManagerRef,
}

impl Drop for pass_manager_res {
fn drop(&mut self) {
unsafe {
llvm::LLVMDisposePassManager(self.pm);
}
}
}

pub fn pass_manager_res(pm: PassManagerRef) -> pass_manager_res {
pass_manager_res {
pm: pm
}
}

pub struct PassManager {
pub llpm: PassManagerRef,
dtor: @pass_manager_res
}

pub fn mk_pass_manager() -> PassManager {
unsafe {
let llpm = llvm::LLVMCreatePassManager();

PassManager {
llpm: llpm,
dtor: @pass_manager_res(llpm)
}
}
}

/* Memory-managed interface to object files. */

pub struct ObjectFile {
Expand Down
9 changes: 0 additions & 9 deletions src/librustc/metadata/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ pub static tag_crate_dep: uint = 0x19;
pub static tag_crate_hash: uint = 0x1a;
pub static tag_crate_crateid: uint = 0x1b;

pub static tag_parent_item: uint = 0x1c;

pub static tag_crate_dep_crateid: uint = 0x1d;
pub static tag_crate_dep_hash: uint = 0x1e;

Expand All @@ -94,10 +92,8 @@ pub static tag_path_len: uint = 0x25;
pub static tag_path_elem_mod: uint = 0x26;
pub static tag_path_elem_name: uint = 0x27;
pub static tag_item_field: uint = 0x28;
pub static tag_struct_mut: uint = 0x29;

pub static tag_item_variances: uint = 0x2a;
pub static tag_mod_impl_trait: uint = 0x2b;
/*
trait items contain tag_item_trait_method elements,
impl items contain tag_item_impl_method elements, and classes
Expand All @@ -108,7 +104,6 @@ pub static tag_mod_impl_trait: uint = 0x2b;
*/
pub static tag_item_impl_method: uint = 0x2c;
pub static tag_item_trait_method_explicit_self: uint = 0x2d;
pub static tag_item_trait_method_self_ty_region: uint = 0x2e;


// Reexports are found within module tags. Each reexport contains def_ids
Expand Down Expand Up @@ -173,12 +168,8 @@ pub static tag_lang_items_item_id: uint = 0x4a;
pub static tag_lang_items_item_node_id: uint = 0x4b;

pub static tag_item_unnamed_field: uint = 0x4c;
pub static tag_items_data_item_struct_ctor: uint = 0x4d;
pub static tag_items_data_item_visibility: uint = 0x4e;

pub static tag_link_args: uint = 0x4f;
pub static tag_link_args_arg: uint = 0x50;

pub static tag_item_method_tps: uint = 0x51;
pub static tag_item_method_fty: uint = 0x52;

Expand Down
21 changes: 0 additions & 21 deletions src/librustc/metadata/csearch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,6 @@ pub fn get_symbol(cstore: &cstore::CStore, def: ast::DefId) -> ~str {
return decoder::get_symbol(cdata, def.node);
}

pub fn get_type_param_count(cstore: &cstore::CStore, def: ast::DefId)
-> uint {
let cdata = cstore.get_crate_data(def.krate).data();
return decoder::get_type_param_count(cdata, def.node);
}

/// Iterates over all the language items in the given crate.
pub fn each_lang_item(cstore: &cstore::CStore,
cnum: ast::CrateNum,
Expand Down Expand Up @@ -244,21 +238,6 @@ pub fn get_impl_vtables(tcx: &ty::ctxt,
decoder::get_impl_vtables(cdata, def.node, tcx)
}

pub fn get_impl_method(cstore: &cstore::CStore,
def: ast::DefId,
mname: ast::Ident)
-> Option<ast::DefId> {
let cdata = cstore.get_crate_data(def.krate);
decoder::get_impl_method(cstore.intr.clone(), cdata, def.node, mname)
}

pub fn get_item_visibility(cstore: &cstore::CStore,
def_id: ast::DefId)
-> ast::Visibility {
let cdata = cstore.get_crate_data(def_id.krate);
decoder::get_item_visibility(cdata, def_id.node)
}

pub fn get_native_libraries(cstore: &cstore::CStore,
crate_num: ast::CrateNum)
-> Vec<(cstore::NativeLibaryKind, ~str)> {
Expand Down
10 changes: 0 additions & 10 deletions src/librustc/metadata/cstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ use std::rc::Rc;
use collections::HashMap;
use syntax::ast;
use syntax::parse::token::IdentInterner;
use syntax::crateid::CrateId;

// A map from external crate numbers (as decoded from some crate file) to
// local crate numbers (as generated during this session). Each external
Expand Down Expand Up @@ -98,19 +97,10 @@ impl CStore {
decoder::get_crate_hash(cdata.data())
}

pub fn get_crate_id(&self, cnum: ast::CrateNum) -> CrateId {
let cdata = self.get_crate_data(cnum);
decoder::get_crate_id(cdata.data())
}

pub fn set_crate_data(&self, cnum: ast::CrateNum, data: @crate_metadata) {
self.metas.borrow_mut().insert(cnum, data);
}

pub fn have_crate_data(&self, cnum: ast::CrateNum) -> bool {
self.metas.borrow().contains_key(&cnum)
}

pub fn iter_crate_data(&self, i: |ast::CrateNum, @crate_metadata|) {
for (&k, &v) in self.metas.borrow().iter() {
i(k, v);
Expand Down
40 changes: 1 addition & 39 deletions src/librustc/metadata/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,13 +279,6 @@ fn item_region_param_defs(item_doc: ebml::Doc, cdata: Cmd)
Rc::new(v)
}

fn item_ty_param_count(item: ebml::Doc) -> uint {
let mut n = 0u;
reader::tagged_docs(item, tag_items_data_item_ty_param_bounds,
|_p| { n += 1u; true } );
n
}

fn enum_variant_ids(item: ebml::Doc, cdata: Cmd) -> Vec<ast::DefId> {
let mut ids: Vec<ast::DefId> = Vec::new();
let v = tag_items_data_item_variant;
Expand Down Expand Up @@ -420,10 +413,6 @@ pub fn get_type(cdata: Cmd, id: ast::NodeId, tcx: &ty::ctxt)
}
}

pub fn get_type_param_count(data: &[u8], id: ast::NodeId) -> uint {
item_ty_param_count(lookup_item(id, data))
}

pub fn get_impl_trait(cdata: Cmd,
id: ast::NodeId,
tcx: &ty::ctxt) -> Option<@ty::TraitRef>
Expand All @@ -449,20 +438,6 @@ pub fn get_impl_vtables(cdata: Cmd,
}


pub fn get_impl_method(intr: Rc<IdentInterner>, cdata: Cmd, id: ast::NodeId,
name: ast::Ident) -> Option<ast::DefId> {
let items = reader::get_doc(reader::Doc(cdata.data()), tag_items);
let mut found = None;
reader::tagged_docs(find_item(id, items), tag_item_impl_method, |mid| {
let m_did = reader::with_doc_data(mid, parse_def_id);
if item_name(&*intr, find_item(m_did.node, items)) == name {
found = Some(translate_def_id(cdata, m_did));
}
true
});
found
}

pub fn get_symbol(data: &[u8], id: ast::NodeId) -> ~str {
return item_symbol(lookup_item(id, data));
}
Expand All @@ -475,14 +450,6 @@ pub enum DefLike {
DlField
}

pub fn def_like_to_def(def_like: DefLike) -> ast::Def {
match def_like {
DlDef(def) => return def,
DlImpl(..) => fail!("found impl in def_like_to_def"),
DlField => fail!("found field in def_like_to_def")
}
}

/// Iterates over the language items in the given crate.
pub fn each_lang_item(cdata: Cmd, f: |ast::NodeId, uint| -> bool) -> bool {
let root = reader::Doc(cdata.data());
Expand Down Expand Up @@ -1030,11 +997,6 @@ pub fn get_struct_fields(intr: Rc<IdentInterner>, cdata: Cmd, id: ast::NodeId)
result
}

pub fn get_item_visibility(cdata: Cmd, id: ast::NodeId)
-> ast::Visibility {
item_visibility(lookup_item(id, cdata.data()))
}

fn get_meta_items(md: ebml::Doc) -> Vec<@ast::MetaItem> {
let mut items: Vec<@ast::MetaItem> = Vec::new();
reader::tagged_docs(md, tag_meta_item_word, |meta_item_doc| {
Expand Down Expand Up @@ -1103,7 +1065,7 @@ fn list_crate_attributes(md: ebml::Doc, hash: &Svh,
}

pub fn get_crate_attributes(data: &[u8]) -> Vec<ast::Attribute> {
return get_attributes(reader::Doc(data));
get_attributes(reader::Doc(data))
}

#[deriving(Clone)]
Expand Down
6 changes: 0 additions & 6 deletions src/librustc/metadata/filesearch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,6 @@ impl<'a> FileSearch<'a> {
make_target_lib_path(self.sysroot, self.target_triple)
}

pub fn get_target_lib_file_path(&self, file: &Path) -> Path {
let mut p = self.get_target_lib_path();
p.push(file);
p
}

pub fn search(&self, pick: pick) {
self.for_each_lib_search_path(|lib_search_path| {
debug!("searching {}", lib_search_path.display());
Expand Down
14 changes: 0 additions & 14 deletions src/librustc/middle/astencode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,6 @@ pub fn encode_inlined_item(ecx: &e::EncodeContext,
ebml_w.writer.tell());
}

pub fn encode_exported_macro(ebml_w: &mut Encoder, i: &ast::Item) {
match i.node {
ast::ItemMac(..) => encode_ast(ebml_w, ast::IIItem(@i.clone())),
_ => fail!("expected a macro")
}
}

pub fn decode_inlined_item(cdata: @cstore::crate_metadata,
tcx: &ty::ctxt,
maps: &Maps,
Expand Down Expand Up @@ -173,13 +166,6 @@ pub fn decode_inlined_item(cdata: @cstore::crate_metadata,
}
}

pub fn decode_exported_macro(par_doc: ebml::Doc) -> @ast::Item {
match decode_ast(par_doc) {
ast::IIItem(item) => item,
_ => fail!("expected item")
}
}

// ______________________________________________________________________
// Enumerating the IDs which appear in an AST

Expand Down
Loading

0 comments on commit 6f1c06d

Please sign in to comment.