Skip to content

Commit a0855a8

Browse files
committed
trans -- stop tracking vtables precisely, instead recompute as needed.
1 parent a7978a4 commit a0855a8

20 files changed

+615
-544
lines changed

src/librustc/lint/builtin.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1469,17 +1469,17 @@ impl LintPass for Stability {
14691469
def_id
14701470
}
14711471
typeck::MethodParam(typeck::MethodParam {
1472-
trait_id: trait_id,
1472+
trait_ref: ref trait_ref,
14731473
method_num: index,
14741474
..
1475-
})
1476-
| typeck::MethodObject(typeck::MethodObject {
1477-
trait_id: trait_id,
1475+
}) |
1476+
typeck::MethodObject(typeck::MethodObject {
1477+
trait_ref: ref trait_ref,
14781478
method_num: index,
14791479
..
14801480
}) => {
14811481
match ty::trait_item(cx.tcx,
1482-
trait_id,
1482+
trait_ref.def_id,
14831483
index) {
14841484
ty::MethodTraitItem(method) => {
14851485
method.def_id

src/librustc/metadata/common.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,10 @@ pub enum astencode_tag { // Reserves 0x40 -- 0x5f
140140
tag_table_unboxed_closures = 0x54,
141141
tag_table_upvar_borrow_map = 0x55,
142142
tag_table_capture_modes = 0x56,
143+
tag_table_object_cast_map = 0x57,
143144
}
144145
static first_astencode_tag: uint = tag_ast as uint;
145-
static last_astencode_tag: uint = tag_table_capture_modes as uint;
146+
static last_astencode_tag: uint = tag_table_object_cast_map as uint;
146147
impl astencode_tag {
147148
pub fn from_uint(value : uint) -> Option<astencode_tag> {
148149
let is_a_tag = first_astencode_tag <= value && value <= last_astencode_tag;

src/librustc/metadata/encoder.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ use metadata::cstore;
2020
use metadata::decoder;
2121
use metadata::tyencode;
2222
use middle::ty::{lookup_item_type};
23-
use middle::astencode;
2423
use middle::ty;
25-
use middle::typeck;
2624
use middle::stability;
2725
use middle;
2826
use util::nodemap::{NodeMap, NodeSet};
@@ -130,14 +128,6 @@ fn encode_trait_ref(rbml_w: &mut Encoder,
130128
rbml_w.end_tag();
131129
}
132130

133-
fn encode_impl_vtables(rbml_w: &mut Encoder,
134-
ecx: &EncodeContext,
135-
vtables: &typeck::vtable_res) {
136-
rbml_w.start_tag(tag_item_impl_vtables);
137-
astencode::encode_vtable_res(ecx, rbml_w, vtables);
138-
rbml_w.end_tag();
139-
}
140-
141131
// Item info table encoding
142132
fn encode_family(rbml_w: &mut Encoder, c: char) {
143133
rbml_w.start_tag(tag_items_data_item_family);
@@ -196,6 +186,18 @@ pub fn write_type(ecx: &EncodeContext,
196186
tyencode::enc_ty(rbml_w.writer, ty_str_ctxt, typ);
197187
}
198188

189+
pub fn write_trait_ref(ecx: &EncodeContext,
190+
rbml_w: &mut Encoder,
191+
trait_ref: &ty::TraitRef) {
192+
let ty_str_ctxt = &tyencode::ctxt {
193+
diag: ecx.diag,
194+
ds: def_to_string,
195+
tcx: ecx.tcx,
196+
abbrevs: &ecx.type_abbrevs
197+
};
198+
tyencode::enc_trait_ref(rbml_w.writer, ty_str_ctxt, trait_ref);
199+
}
200+
199201
pub fn write_region(ecx: &EncodeContext,
200202
rbml_w: &mut Encoder,
201203
r: ty::Region) {
@@ -404,7 +406,7 @@ fn encode_reexported_static_base_methods(ecx: &EncodeContext,
404406
let impl_items = ecx.tcx.impl_items.borrow();
405407
match ecx.tcx.inherent_impls.borrow().find(&exp.def_id) {
406408
Some(implementations) => {
407-
for base_impl_did in implementations.borrow().iter() {
409+
for base_impl_did in implementations.iter() {
408410
for &method_did in impl_items.get(base_impl_did).iter() {
409411
let impl_item = ty::impl_or_trait_item(
410412
ecx.tcx,
@@ -957,7 +959,7 @@ fn encode_inherent_implementations(ecx: &EncodeContext,
957959
match ecx.tcx.inherent_impls.borrow().find(&def_id) {
958960
None => {}
959961
Some(implementations) => {
960-
for &impl_def_id in implementations.borrow().iter() {
962+
for &impl_def_id in implementations.iter() {
961963
rbml_w.start_tag(tag_items_data_item_inherent_impl);
962964
encode_def_id(rbml_w, impl_def_id);
963965
rbml_w.end_tag();
@@ -1214,8 +1216,6 @@ fn encode_info_for_item(ecx: &EncodeContext,
12141216
let trait_ref = ty::node_id_to_trait_ref(
12151217
tcx, ast_trait_ref.ref_id);
12161218
encode_trait_ref(rbml_w, ecx, &*trait_ref, tag_item_trait_ref);
1217-
let impl_vtables = ty::lookup_impl_vtables(tcx, def_id);
1218-
encode_impl_vtables(rbml_w, ecx, &impl_vtables);
12191219
}
12201220
encode_path(rbml_w, path.clone());
12211221
encode_stability(rbml_w, stab);

0 commit comments

Comments
 (0)