Skip to content

Commit 6f1c06d

Browse files
committed
auto merge of #13244 : cmr/rust/tbaa, r=alexcrichton
2 parents 7bda3df + 46790a7 commit 6f1c06d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+49
-1113
lines changed

src/librustc/back/abi.rs

-35
Original file line numberDiff line numberDiff line change
@@ -8,44 +8,11 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
pub static rc_base_field_refcnt: uint = 0u;
12-
13-
pub static task_field_refcnt: uint = 0u;
14-
15-
pub static task_field_stk: uint = 2u;
16-
17-
pub static task_field_runtime_sp: uint = 3u;
18-
19-
pub static task_field_rust_sp: uint = 4u;
20-
21-
pub static task_field_gc_alloc_chain: uint = 5u;
22-
23-
pub static task_field_dom: uint = 6u;
24-
25-
pub static n_visible_task_fields: uint = 7u;
26-
27-
pub static dom_field_interrupt_flag: uint = 1u;
28-
29-
pub static frame_glue_fns_field_mark: uint = 0u;
30-
31-
pub static frame_glue_fns_field_drop: uint = 1u;
32-
33-
pub static frame_glue_fns_field_reloc: uint = 2u;
34-
3511
pub static box_field_refcnt: uint = 0u;
3612
pub static box_field_tydesc: uint = 1u;
37-
pub static box_field_prev: uint = 2u;
38-
pub static box_field_next: uint = 3u;
3913
pub static box_field_body: uint = 4u;
4014

41-
pub static general_code_alignment: uint = 16u;
42-
43-
pub static tydesc_field_size: uint = 0u;
44-
pub static tydesc_field_align: uint = 1u;
45-
pub static tydesc_field_drop_glue: uint = 2u;
4615
pub static tydesc_field_visit_glue: uint = 3u;
47-
pub static tydesc_field_name_offset: uint = 4u;
48-
pub static n_tydesc_fields: uint = 5u;
4916

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

6532
pub static slice_elt_base: uint = 0u;
6633
pub static slice_elt_len: uint = 1u;
67-
68-
pub static abi_version: uint = 1u;

src/librustc/back/archive.rs

-23
Original file line numberDiff line numberDiff line change
@@ -87,29 +87,6 @@ impl<'a> Archive<'a> {
8787
Archive { sess: sess, dst: dst }
8888
}
8989

90-
/// Read a file in the archive
91-
pub fn read(&self, file: &str) -> Vec<u8> {
92-
// Apparently if "ar p" is used on windows, it generates a corrupt file
93-
// which has bad headers and LLVM will immediately choke on it
94-
if cfg!(windows) {
95-
let loc = TempDir::new("rsar").unwrap();
96-
let archive = os::make_absolute(&self.dst);
97-
run_ar(self.sess, "x", Some(loc.path()), [&archive,
98-
&Path::new(file)]);
99-
let result: Vec<u8> =
100-
fs::File::open(&loc.path().join(file)).read_to_end()
101-
.unwrap()
102-
.move_iter()
103-
.collect();
104-
result
105-
} else {
106-
run_ar(self.sess,
107-
"p",
108-
None,
109-
[&self.dst, &Path::new(file)]).output.move_iter().collect()
110-
}
111-
}
112-
11390
/// Adds all of the contents of a native library to this archive. This will
11491
/// search in the relevant locations for a library named `name`.
11592
pub fn add_native_library(&mut self, name: &str) -> io::IoResult<()> {

src/librustc/back/link.rs

-10
Original file line numberDiff line numberDiff line change
@@ -687,16 +687,6 @@ pub fn mangle_exported_name(ccx: &CrateContext, path: PathElems,
687687
exported_name(path, hash, ccx.link_meta.crateid.version_or_default())
688688
}
689689

690-
pub fn mangle_internal_name_by_type_only(ccx: &CrateContext,
691-
t: ty::t,
692-
name: &str) -> ~str {
693-
let s = ppaux::ty_to_short_str(ccx.tcx(), t);
694-
let path = [PathName(token::intern(name)),
695-
PathName(token::intern(s))];
696-
let hash = get_symbol_hash(ccx, t);
697-
mangle(ast_map::Values(path.iter()), Some(hash.as_slice()), None)
698-
}
699-
700690
pub fn mangle_internal_name_by_type_and_seq(ccx: &CrateContext,
701691
t: ty::t,
702692
name: &str) -> ~str {

src/librustc/lib/llvm.rs

+1-36
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
#![allow(non_uppercase_pattern_statics)]
1212
#![allow(non_camel_case_types)]
13+
#![allow(dead_code)]
1314

1415
use std::c_str::ToCStr;
1516
use std::cell::RefCell;
@@ -1911,42 +1912,6 @@ pub fn mk_target_data(string_rep: &str) -> TargetData {
19111912
}
19121913
}
19131914

1914-
/* Memory-managed interface to pass managers. */
1915-
1916-
pub struct pass_manager_res {
1917-
pub pm: PassManagerRef,
1918-
}
1919-
1920-
impl Drop for pass_manager_res {
1921-
fn drop(&mut self) {
1922-
unsafe {
1923-
llvm::LLVMDisposePassManager(self.pm);
1924-
}
1925-
}
1926-
}
1927-
1928-
pub fn pass_manager_res(pm: PassManagerRef) -> pass_manager_res {
1929-
pass_manager_res {
1930-
pm: pm
1931-
}
1932-
}
1933-
1934-
pub struct PassManager {
1935-
pub llpm: PassManagerRef,
1936-
dtor: @pass_manager_res
1937-
}
1938-
1939-
pub fn mk_pass_manager() -> PassManager {
1940-
unsafe {
1941-
let llpm = llvm::LLVMCreatePassManager();
1942-
1943-
PassManager {
1944-
llpm: llpm,
1945-
dtor: @pass_manager_res(llpm)
1946-
}
1947-
}
1948-
}
1949-
19501915
/* Memory-managed interface to object files. */
19511916

19521917
pub struct ObjectFile {

src/librustc/metadata/common.rs

-9
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,6 @@ pub static tag_crate_dep: uint = 0x19;
7373
pub static tag_crate_hash: uint = 0x1a;
7474
pub static tag_crate_crateid: uint = 0x1b;
7575

76-
pub static tag_parent_item: uint = 0x1c;
77-
7876
pub static tag_crate_dep_crateid: uint = 0x1d;
7977
pub static tag_crate_dep_hash: uint = 0x1e;
8078

@@ -94,10 +92,8 @@ pub static tag_path_len: uint = 0x25;
9492
pub static tag_path_elem_mod: uint = 0x26;
9593
pub static tag_path_elem_name: uint = 0x27;
9694
pub static tag_item_field: uint = 0x28;
97-
pub static tag_struct_mut: uint = 0x29;
9895

9996
pub static tag_item_variances: uint = 0x2a;
100-
pub static tag_mod_impl_trait: uint = 0x2b;
10197
/*
10298
trait items contain tag_item_trait_method elements,
10399
impl items contain tag_item_impl_method elements, and classes
@@ -108,7 +104,6 @@ pub static tag_mod_impl_trait: uint = 0x2b;
108104
*/
109105
pub static tag_item_impl_method: uint = 0x2c;
110106
pub static tag_item_trait_method_explicit_self: uint = 0x2d;
111-
pub static tag_item_trait_method_self_ty_region: uint = 0x2e;
112107

113108

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

175170
pub static tag_item_unnamed_field: uint = 0x4c;
176-
pub static tag_items_data_item_struct_ctor: uint = 0x4d;
177171
pub static tag_items_data_item_visibility: uint = 0x4e;
178172

179-
pub static tag_link_args: uint = 0x4f;
180-
pub static tag_link_args_arg: uint = 0x50;
181-
182173
pub static tag_item_method_tps: uint = 0x51;
183174
pub static tag_item_method_fty: uint = 0x52;
184175

src/librustc/metadata/csearch.rs

-21
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,6 @@ pub fn get_symbol(cstore: &cstore::CStore, def: ast::DefId) -> ~str {
3737
return decoder::get_symbol(cdata, def.node);
3838
}
3939

40-
pub fn get_type_param_count(cstore: &cstore::CStore, def: ast::DefId)
41-
-> uint {
42-
let cdata = cstore.get_crate_data(def.krate).data();
43-
return decoder::get_type_param_count(cdata, def.node);
44-
}
45-
4640
/// Iterates over all the language items in the given crate.
4741
pub fn each_lang_item(cstore: &cstore::CStore,
4842
cnum: ast::CrateNum,
@@ -244,21 +238,6 @@ pub fn get_impl_vtables(tcx: &ty::ctxt,
244238
decoder::get_impl_vtables(cdata, def.node, tcx)
245239
}
246240

247-
pub fn get_impl_method(cstore: &cstore::CStore,
248-
def: ast::DefId,
249-
mname: ast::Ident)
250-
-> Option<ast::DefId> {
251-
let cdata = cstore.get_crate_data(def.krate);
252-
decoder::get_impl_method(cstore.intr.clone(), cdata, def.node, mname)
253-
}
254-
255-
pub fn get_item_visibility(cstore: &cstore::CStore,
256-
def_id: ast::DefId)
257-
-> ast::Visibility {
258-
let cdata = cstore.get_crate_data(def_id.krate);
259-
decoder::get_item_visibility(cdata, def_id.node)
260-
}
261-
262241
pub fn get_native_libraries(cstore: &cstore::CStore,
263242
crate_num: ast::CrateNum)
264243
-> Vec<(cstore::NativeLibaryKind, ~str)> {

src/librustc/metadata/cstore.rs

-10
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ use std::rc::Rc;
2323
use collections::HashMap;
2424
use syntax::ast;
2525
use syntax::parse::token::IdentInterner;
26-
use syntax::crateid::CrateId;
2726

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

101-
pub fn get_crate_id(&self, cnum: ast::CrateNum) -> CrateId {
102-
let cdata = self.get_crate_data(cnum);
103-
decoder::get_crate_id(cdata.data())
104-
}
105-
106100
pub fn set_crate_data(&self, cnum: ast::CrateNum, data: @crate_metadata) {
107101
self.metas.borrow_mut().insert(cnum, data);
108102
}
109103

110-
pub fn have_crate_data(&self, cnum: ast::CrateNum) -> bool {
111-
self.metas.borrow().contains_key(&cnum)
112-
}
113-
114104
pub fn iter_crate_data(&self, i: |ast::CrateNum, @crate_metadata|) {
115105
for (&k, &v) in self.metas.borrow().iter() {
116106
i(k, v);

src/librustc/metadata/decoder.rs

+1-39
Original file line numberDiff line numberDiff line change
@@ -279,13 +279,6 @@ fn item_region_param_defs(item_doc: ebml::Doc, cdata: Cmd)
279279
Rc::new(v)
280280
}
281281

282-
fn item_ty_param_count(item: ebml::Doc) -> uint {
283-
let mut n = 0u;
284-
reader::tagged_docs(item, tag_items_data_item_ty_param_bounds,
285-
|_p| { n += 1u; true } );
286-
n
287-
}
288-
289282
fn enum_variant_ids(item: ebml::Doc, cdata: Cmd) -> Vec<ast::DefId> {
290283
let mut ids: Vec<ast::DefId> = Vec::new();
291284
let v = tag_items_data_item_variant;
@@ -420,10 +413,6 @@ pub fn get_type(cdata: Cmd, id: ast::NodeId, tcx: &ty::ctxt)
420413
}
421414
}
422415

423-
pub fn get_type_param_count(data: &[u8], id: ast::NodeId) -> uint {
424-
item_ty_param_count(lookup_item(id, data))
425-
}
426-
427416
pub fn get_impl_trait(cdata: Cmd,
428417
id: ast::NodeId,
429418
tcx: &ty::ctxt) -> Option<@ty::TraitRef>
@@ -449,20 +438,6 @@ pub fn get_impl_vtables(cdata: Cmd,
449438
}
450439

451440

452-
pub fn get_impl_method(intr: Rc<IdentInterner>, cdata: Cmd, id: ast::NodeId,
453-
name: ast::Ident) -> Option<ast::DefId> {
454-
let items = reader::get_doc(reader::Doc(cdata.data()), tag_items);
455-
let mut found = None;
456-
reader::tagged_docs(find_item(id, items), tag_item_impl_method, |mid| {
457-
let m_did = reader::with_doc_data(mid, parse_def_id);
458-
if item_name(&*intr, find_item(m_did.node, items)) == name {
459-
found = Some(translate_def_id(cdata, m_did));
460-
}
461-
true
462-
});
463-
found
464-
}
465-
466441
pub fn get_symbol(data: &[u8], id: ast::NodeId) -> ~str {
467442
return item_symbol(lookup_item(id, data));
468443
}
@@ -475,14 +450,6 @@ pub enum DefLike {
475450
DlField
476451
}
477452

478-
pub fn def_like_to_def(def_like: DefLike) -> ast::Def {
479-
match def_like {
480-
DlDef(def) => return def,
481-
DlImpl(..) => fail!("found impl in def_like_to_def"),
482-
DlField => fail!("found field in def_like_to_def")
483-
}
484-
}
485-
486453
/// Iterates over the language items in the given crate.
487454
pub fn each_lang_item(cdata: Cmd, f: |ast::NodeId, uint| -> bool) -> bool {
488455
let root = reader::Doc(cdata.data());
@@ -1030,11 +997,6 @@ pub fn get_struct_fields(intr: Rc<IdentInterner>, cdata: Cmd, id: ast::NodeId)
1030997
result
1031998
}
1032999

1033-
pub fn get_item_visibility(cdata: Cmd, id: ast::NodeId)
1034-
-> ast::Visibility {
1035-
item_visibility(lookup_item(id, cdata.data()))
1036-
}
1037-
10381000
fn get_meta_items(md: ebml::Doc) -> Vec<@ast::MetaItem> {
10391001
let mut items: Vec<@ast::MetaItem> = Vec::new();
10401002
reader::tagged_docs(md, tag_meta_item_word, |meta_item_doc| {
@@ -1103,7 +1065,7 @@ fn list_crate_attributes(md: ebml::Doc, hash: &Svh,
11031065
}
11041066

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

11091071
#[deriving(Clone)]

src/librustc/metadata/filesearch.rs

-6
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,6 @@ impl<'a> FileSearch<'a> {
8484
make_target_lib_path(self.sysroot, self.target_triple)
8585
}
8686

87-
pub fn get_target_lib_file_path(&self, file: &Path) -> Path {
88-
let mut p = self.get_target_lib_path();
89-
p.push(file);
90-
p
91-
}
92-
9387
pub fn search(&self, pick: pick) {
9488
self.for_each_lib_search_path(|lib_search_path| {
9589
debug!("searching {}", lib_search_path.display());

src/librustc/middle/astencode.rs

-14
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,6 @@ pub fn encode_inlined_item(ecx: &e::EncodeContext,
111111
ebml_w.writer.tell());
112112
}
113113

114-
pub fn encode_exported_macro(ebml_w: &mut Encoder, i: &ast::Item) {
115-
match i.node {
116-
ast::ItemMac(..) => encode_ast(ebml_w, ast::IIItem(@i.clone())),
117-
_ => fail!("expected a macro")
118-
}
119-
}
120-
121114
pub fn decode_inlined_item(cdata: @cstore::crate_metadata,
122115
tcx: &ty::ctxt,
123116
maps: &Maps,
@@ -173,13 +166,6 @@ pub fn decode_inlined_item(cdata: @cstore::crate_metadata,
173166
}
174167
}
175168

176-
pub fn decode_exported_macro(par_doc: ebml::Doc) -> @ast::Item {
177-
match decode_ast(par_doc) {
178-
ast::IIItem(item) => item,
179-
_ => fail!("expected item")
180-
}
181-
}
182-
183169
// ______________________________________________________________________
184170
// Enumerating the IDs which appear in an AST
185171

0 commit comments

Comments
 (0)