Skip to content

Commit 088c94a

Browse files
committed
trans -- stop tracking vtables precisely, instead recompute as needed.
1 parent 6349a61 commit 088c94a

21 files changed

+723
-544
lines changed

src/librustc/lint/builtin.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1470,17 +1470,17 @@ impl LintPass for Stability {
14701470
def_id
14711471
}
14721472
typeck::MethodParam(typeck::MethodParam {
1473-
trait_id: trait_id,
1473+
trait_ref: ref trait_ref,
14741474
method_num: index,
14751475
..
1476-
})
1477-
| typeck::MethodObject(typeck::MethodObject {
1478-
trait_id: trait_id,
1476+
}) |
1477+
typeck::MethodObject(typeck::MethodObject {
1478+
trait_ref: ref trait_ref,
14791479
method_num: index,
14801480
..
14811481
}) => {
14821482
match ty::trait_item(cx.tcx,
1483-
trait_id,
1483+
trait_ref.def_id,
14841484
index) {
14851485
ty::MethodTraitItem(method) => {
14861486
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};
@@ -125,14 +123,6 @@ fn encode_trait_ref(rbml_w: &mut Encoder,
125123
rbml_w.end_tag();
126124
}
127125

128-
fn encode_impl_vtables(rbml_w: &mut Encoder,
129-
ecx: &EncodeContext,
130-
vtables: &typeck::vtable_res) {
131-
rbml_w.start_tag(tag_item_impl_vtables);
132-
astencode::encode_vtable_res(ecx, rbml_w, vtables);
133-
rbml_w.end_tag();
134-
}
135-
136126
// Item info table encoding
137127
fn encode_family(rbml_w: &mut Encoder, c: char) {
138128
rbml_w.start_tag(tag_items_data_item_family);
@@ -191,6 +181,18 @@ pub fn write_type(ecx: &EncodeContext,
191181
tyencode::enc_ty(rbml_w.writer, ty_str_ctxt, typ);
192182
}
193183

184+
pub fn write_trait_ref(ecx: &EncodeContext,
185+
rbml_w: &mut Encoder,
186+
trait_ref: &ty::TraitRef) {
187+
let ty_str_ctxt = &tyencode::ctxt {
188+
diag: ecx.diag,
189+
ds: def_to_string,
190+
tcx: ecx.tcx,
191+
abbrevs: &ecx.type_abbrevs
192+
};
193+
tyencode::enc_trait_ref(rbml_w.writer, ty_str_ctxt, trait_ref);
194+
}
195+
194196
pub fn write_region(ecx: &EncodeContext,
195197
rbml_w: &mut Encoder,
196198
r: ty::Region) {
@@ -399,7 +401,7 @@ fn encode_reexported_static_base_methods(ecx: &EncodeContext,
399401
let impl_items = ecx.tcx.impl_items.borrow();
400402
match ecx.tcx.inherent_impls.borrow().find(&exp.def_id) {
401403
Some(implementations) => {
402-
for base_impl_did in implementations.borrow().iter() {
404+
for base_impl_did in implementations.iter() {
403405
for &method_did in impl_items.get(base_impl_did).iter() {
404406
let impl_item = ty::impl_or_trait_item(
405407
ecx.tcx,
@@ -946,7 +948,7 @@ fn encode_inherent_implementations(ecx: &EncodeContext,
946948
match ecx.tcx.inherent_impls.borrow().find(&def_id) {
947949
None => {}
948950
Some(implementations) => {
949-
for &impl_def_id in implementations.borrow().iter() {
951+
for &impl_def_id in implementations.iter() {
950952
rbml_w.start_tag(tag_items_data_item_inherent_impl);
951953
encode_def_id(rbml_w, impl_def_id);
952954
rbml_w.end_tag();
@@ -1203,8 +1205,6 @@ fn encode_info_for_item(ecx: &EncodeContext,
12031205
let trait_ref = ty::node_id_to_trait_ref(
12041206
tcx, ast_trait_ref.ref_id);
12051207
encode_trait_ref(rbml_w, ecx, &*trait_ref, tag_item_trait_ref);
1206-
let impl_vtables = ty::lookup_impl_vtables(tcx, def_id);
1207-
encode_impl_vtables(rbml_w, ecx, &impl_vtables);
12081208
}
12091209
encode_path(rbml_w, path.clone());
12101210
encode_stability(rbml_w, stab);

0 commit comments

Comments
 (0)