Skip to content

Commit 46459b5

Browse files
committed
---
yaml --- r: 11863 b: refs/heads/master c: 83c9f58 h: refs/heads/master i: 11861: bd85f79 11859: 5dc24dd 11855: a450f60 v: v3
1 parent d6a2afc commit 46459b5

File tree

11 files changed

+167
-165
lines changed

11 files changed

+167
-165
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 4511f936b1b4766962d01a80f6887eecb30e89f9
2+
refs/heads/master: 83c9f585342d6974c5f1847f18ab2b6322b1ea42
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf

trunk/src/rustc/back/upcall.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import driver::session;
33
import middle::trans::base;
44
import middle::trans::common::{T_fn, T_i1, T_i8, T_i32,
5-
T_int, T_nil, T_dict,
5+
T_int, T_nil,
66
T_opaque_vec, T_ptr,
77
T_size_t, T_void};
88
import lib::llvm::{type_names, ModuleRef, ValueRef, TypeRef};
@@ -19,7 +19,6 @@ type upcalls =
1919
create_shared_type_desc: ValueRef,
2020
free_shared_type_desc: ValueRef,
2121
get_type_desc: ValueRef,
22-
intern_dict: ValueRef,
2322
vec_grow: ValueRef,
2423
vec_push: ValueRef,
2524
cmp_type: ValueRef,
@@ -81,8 +80,6 @@ fn declare_upcalls(targ_cfg: @session::config,
8180
size_t, size_t,
8281
T_ptr(T_ptr(tydesc_type)), int_t],
8382
T_ptr(tydesc_type)),
84-
intern_dict:
85-
d("intern_dict", [size_t, T_ptr(T_dict())], T_ptr(T_dict())),
8683
vec_grow:
8784
dv("vec_grow", [T_ptr(T_ptr(opaque_vec_t)), int_t]),
8885
vec_push:

trunk/src/rustc/driver/driver.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ fn compile_upto(sess: session, cfg: ast::crate_cfg,
144144
time(time_passes, "region resolution",
145145
bind middle::region::resolve_crate(sess, def_map, crate));
146146
let ty_cx = ty::mk_ctxt(sess, def_map, ast_map, freevars, region_map);
147-
let (method_map, dict_map) =
147+
let (method_map, vtable_map) =
148148
time(time_passes, "typechecking",
149149
bind typeck::check_crate(ty_cx, impl_map, crate));
150150
time(time_passes, "const checking",
@@ -181,7 +181,7 @@ fn compile_upto(sess: session, cfg: ast::crate_cfg,
181181

182182
let maps = {mutbl_map: mutbl_map, copy_map: copy_map,
183183
last_uses: last_uses, impl_map: impl_map,
184-
method_map: method_map, dict_map: dict_map};
184+
method_map: method_map, vtable_map: vtable_map};
185185

186186
let (llmod, link_meta) =
187187
time(time_passes, "translation",

trunk/src/rustc/metadata/astencode.rs

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import std::smallintmap::map;
1717
import middle::trans::common::maps;
1818
import middle::{ty, typeck, last_use, ast_map};
1919
import middle::typeck::method_origin;
20-
import middle::typeck::dict_res;
21-
import middle::typeck::dict_origin;
20+
import middle::typeck::vtable_res;
21+
import middle::typeck::vtable_origin;
2222
import driver::session::session;
2323
import middle::freevars::freevar_entry;
2424
import c = common;
@@ -506,40 +506,40 @@ impl of tr for last_use::is_last_use {
506506
}
507507

508508
// ______________________________________________________________________
509-
// Encoding and decoding dict_res
509+
// Encoding and decoding vtable_res
510510

511-
fn encode_dict_res(ecx: @e::encode_ctxt,
511+
fn encode_vtable_res(ecx: @e::encode_ctxt,
512512
ebml_w: ebml::writer,
513-
dr: typeck::dict_res) {
513+
dr: typeck::vtable_res) {
514514
// can't autogenerate this code because automatic serialization of
515515
// ty::t doesn't work, and there is no way (atm) to have
516516
// hand-written serialization routines combine with auto-generated
517517
// ones. perhaps we should fix this.
518-
ebml_w.emit_from_vec(*dr) {|dict_origin|
519-
encode_dict_origin(ecx, ebml_w, dict_origin)
518+
ebml_w.emit_from_vec(*dr) {|vtable_origin|
519+
encode_vtable_origin(ecx, ebml_w, vtable_origin)
520520
}
521521
}
522522

523-
fn encode_dict_origin(ecx: @e::encode_ctxt,
523+
fn encode_vtable_origin(ecx: @e::encode_ctxt,
524524
ebml_w: ebml::writer,
525-
dict_origin: typeck::dict_origin) {
526-
ebml_w.emit_enum("dict_origin") {||
527-
alt dict_origin {
528-
typeck::dict_static(def_id, tys, dict_res) {
529-
ebml_w.emit_enum_variant("dict_static", 0u, 3u) {||
525+
vtable_origin: typeck::vtable_origin) {
526+
ebml_w.emit_enum("vtable_origin") {||
527+
alt vtable_origin {
528+
typeck::vtable_static(def_id, tys, vtable_res) {
529+
ebml_w.emit_enum_variant("vtable_static", 0u, 3u) {||
530530
ebml_w.emit_enum_variant_arg(0u) {||
531531
ebml_w.emit_def_id(def_id)
532532
}
533533
ebml_w.emit_enum_variant_arg(1u) {||
534534
ebml_w.emit_tys(ecx, tys);
535535
}
536536
ebml_w.emit_enum_variant_arg(2u) {||
537-
encode_dict_res(ecx, ebml_w, dict_res);
537+
encode_vtable_res(ecx, ebml_w, vtable_res);
538538
}
539539
}
540540
}
541-
typeck::dict_param(pn, bn) {
542-
ebml_w.emit_enum_variant("dict_param", 1u, 2u) {||
541+
typeck::vtable_param(pn, bn) {
542+
ebml_w.emit_enum_variant("vtable_param", 1u, 2u) {||
543543
ebml_w.emit_enum_variant_arg(0u) {||
544544
ebml_w.emit_uint(pn);
545545
}
@@ -548,8 +548,8 @@ fn encode_dict_origin(ecx: @e::encode_ctxt,
548548
}
549549
}
550550
}
551-
typeck::dict_iface(def_id, tys) {
552-
ebml_w.emit_enum_variant("dict_iface", 1u, 3u) {||
551+
typeck::vtable_iface(def_id, tys) {
552+
ebml_w.emit_enum_variant("vtable_iface", 1u, 3u) {||
553553
ebml_w.emit_enum_variant_arg(0u) {||
554554
ebml_w.emit_def_id(def_id)
555555
}
@@ -564,29 +564,30 @@ fn encode_dict_origin(ecx: @e::encode_ctxt,
564564
}
565565

566566
impl helpers for ebml::ebml_deserializer {
567-
fn read_dict_res(xcx: extended_decode_ctxt) -> typeck::dict_res {
568-
@self.read_to_vec {|| self.read_dict_origin(xcx) }
567+
fn read_vtable_res(xcx: extended_decode_ctxt) -> typeck::vtable_res {
568+
@self.read_to_vec {|| self.read_vtable_origin(xcx) }
569569
}
570570

571-
fn read_dict_origin(xcx: extended_decode_ctxt) -> typeck::dict_origin {
572-
self.read_enum("dict_origin") {||
571+
fn read_vtable_origin(xcx: extended_decode_ctxt)
572+
-> typeck::vtable_origin {
573+
self.read_enum("vtable_origin") {||
573574
self.read_enum_variant {|i|
574575
alt check i {
575576
0u {
576-
typeck::dict_static(
577+
typeck::vtable_static(
577578
self.read_enum_variant_arg(0u) {||
578579
self.read_def_id(xcx)
579580
},
580581
self.read_enum_variant_arg(1u) {||
581582
self.read_tys(xcx)
582583
},
583584
self.read_enum_variant_arg(2u) {||
584-
self.read_dict_res(xcx)
585+
self.read_vtable_res(xcx)
585586
}
586587
)
587588
}
588589
1u {
589-
typeck::dict_param(
590+
typeck::vtable_param(
590591
self.read_enum_variant_arg(0u) {||
591592
self.read_uint()
592593
},
@@ -596,7 +597,7 @@ impl helpers for ebml::ebml_deserializer {
596597
)
597598
}
598599
2u {
599-
typeck::dict_iface(
600+
typeck::vtable_iface(
600601
self.read_enum_variant_arg(0u) {||
601602
self.read_def_id(xcx)
602603
},
@@ -786,11 +787,11 @@ fn encode_side_tables_for_id(ecx: @e::encode_ctxt,
786787
}
787788
}
788789

789-
option::may(ccx.maps.dict_map.find(id)) {|dr|
790-
ebml_w.tag(c::tag_table_dict_map) {||
790+
option::may(ccx.maps.vtable_map.find(id)) {|dr|
791+
ebml_w.tag(c::tag_table_vtable_map) {||
791792
ebml_w.id(id);
792793
ebml_w.tag(c::tag_table_val) {||
793-
encode_dict_res(ecx, ebml_w, dr);
794+
encode_vtable_res(ecx, ebml_w, dr);
794795
}
795796
}
796797
}
@@ -883,9 +884,9 @@ fn decode_side_tables(xcx: extended_decode_ctxt,
883884
} else if tag == (c::tag_table_method_map as uint) {
884885
dcx.maps.method_map.insert(id,
885886
val_dsr.read_method_origin(xcx));
886-
} else if tag == (c::tag_table_dict_map as uint) {
887-
dcx.maps.dict_map.insert(id,
888-
val_dsr.read_dict_res(xcx));
887+
} else if tag == (c::tag_table_vtable_map as uint) {
888+
dcx.maps.vtable_map.insert(id,
889+
val_dsr.read_vtable_res(xcx));
889890
} else {
890891
xcx.dcx.tcx.sess.bug(
891892
#fmt["unknown tag found in side tables: %x", tag]);

trunk/src/rustc/metadata/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ enum astencode_tag { // Reserves 0x50 -- 0x6f
9898
tag_table_copy,
9999
tag_table_last_use,
100100
tag_table_method_map,
101-
tag_table_dict_map
101+
tag_table_vtable_map
102102
}
103103

104104
// djb's cdb hashes.

trunk/src/rustc/middle/trans/base.rs

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ fn make_generic_glue_inner(ccx: @crate_ctxt, t: ty::t,
757757
}
758758

759759
fcx.lltyparams = vec::map(vec::from_mut(lltydescs), {|d|
760-
{desc: d, dicts: none}
760+
{desc: d, vtables: none}
761761
});
762762

763763
let bcx = top_scope_block(fcx, none);
@@ -2051,7 +2051,7 @@ type generic_info = {item_type: ty::t,
20512051
static_tis: [option<@tydesc_info>],
20522052
tydescs: [ValueRef],
20532053
param_bounds: @[ty::param_bounds],
2054-
origins: option<typeck::dict_res>};
2054+
origins: option<typeck::vtable_res>};
20552055

20562056
enum generic_callee {
20572057
generic_full(generic_info),
@@ -2107,17 +2107,17 @@ fn trans_external_path(cx: block, did: ast::def_id,
21072107
}
21082108

21092109
fn monomorphic_fn(ccx: @crate_ctxt, fn_id: ast::def_id, substs: [ty::t],
2110-
dicts: option<typeck::dict_res>)
2110+
vtables: option<typeck::vtable_res>)
21112111
-> option<{llfn: ValueRef, fty: ty::t}> {
21122112
let substs = vec::map(substs, {|t|
21132113
alt ty::get(t).struct {
21142114
ty::ty_box(mt) { ty::mk_opaque_box(ccx.tcx) }
21152115
_ { t }
21162116
}
21172117
});
2118-
let hash_id = @{def: fn_id, substs: substs, dicts: alt dicts {
2119-
some(os) { some_dicts(vec::map(*os, impl::vtable_id)) }
2120-
none { no_dicts }
2118+
let hash_id = @{def: fn_id, substs: substs, vtables: alt vtables {
2119+
some(os) { some_vts(vec::map(*os, impl::vtable_id)) }
2120+
none { no_vts }
21212121
}};
21222122
alt ccx.monomorphized.find(hash_id) {
21232123
some(val) { ret some(val); }
@@ -2148,7 +2148,7 @@ fn monomorphic_fn(ccx: @crate_ctxt, fn_id: ast::def_id, substs: [ty::t],
21482148
let lldecl = decl_cdecl_fn(ccx.llmod, s, llfty);
21492149
ccx.monomorphized.insert(hash_id, {llfn: lldecl, fty: mono_ty});
21502150

2151-
let psubsts = some({tys: substs, dicts: dicts, bounds: tpt.bounds});
2151+
let psubsts = some({tys: substs, vtables: vtables, bounds: tpt.bounds});
21522152
alt check map_node {
21532153
ast_map::node_item(i@@{node: ast::item_fn(decl, _, body), _}, _) {
21542154
set_inline_hint_if_appr(i.attrs, lldecl);
@@ -2229,7 +2229,7 @@ fn maybe_instantiate_inline(ccx: @crate_ctxt, fn_id: ast::def_id)
22292229
}
22302230

22312231
fn lval_static_fn(bcx: block, fn_id: ast::def_id, id: ast::node_id,
2232-
substs: option<([ty::t], typeck::dict_res)>)
2232+
substs: option<([ty::t], typeck::vtable_res)>)
22332233
-> lval_maybe_callee {
22342234
let ccx = bcx.ccx();
22352235
let tcx = ccx.tcx;
@@ -2249,16 +2249,17 @@ fn lval_static_fn(bcx: block, fn_id: ast::def_id, id: ast::node_id,
22492249
fn_id.crate == ast::local_crate &&
22502250
!vec::any(tys, {|t| ty::type_has_params(t)}) {
22512251
let mono = alt substs {
2252-
some((stys, dicts)) {
2252+
some((stys, vtables)) {
22532253
if (stys.len() + tys.len()) > 0u {
2254-
monomorphic_fn(ccx, fn_id, stys + tys, some(dicts))
2254+
monomorphic_fn(ccx, fn_id, stys + tys, some(vtables))
22552255
} else { none }
22562256
}
22572257
none {
2258-
alt ccx.maps.dict_map.find(id) {
2259-
some(dicts) {
2260-
let rdicts = impl::resolve_vtables_in_fn_ctxt(bcx.fcx, dicts);
2261-
monomorphic_fn(ccx, fn_id, tys, some(rdicts))
2258+
alt ccx.maps.vtable_map.find(id) {
2259+
some(vtables) {
2260+
let rvtables = impl::resolve_vtables_in_fn_ctxt(
2261+
bcx.fcx, vtables);
2262+
monomorphic_fn(ccx, fn_id, tys, some(rvtables))
22622263
}
22632264
none { monomorphic_fn(ccx, fn_id, tys, none) }
22642265
}
@@ -2308,7 +2309,7 @@ fn lval_static_fn(bcx: block, fn_id: ast::def_id, id: ast::node_id,
23082309
static_tis: tis,
23092310
tydescs: tydescs,
23102311
param_bounds: tpt.bounds,
2311-
origins: ccx.maps.dict_map.find(id)});
2312+
origins: ccx.maps.vtable_map.find(id)});
23122313
}
23132314
ret {bcx: bcx, val: val, kind: owned, env: null_env, generic: gen};
23142315
}
@@ -2925,9 +2926,11 @@ fn invoke_(bcx: block, llfn: ValueRef, llargs: [ValueRef],
29252926
// cleanups to run
29262927
if bcx.unreachable { ret bcx; }
29272928
let normal_bcx = sub_block(bcx, "normal return");
2928-
/*std::io::println("fn: " + lib::llvm::type_to_str(bcx.ccx().tn, val_ty(llfn)));
2929+
/*std::io::println("fn: " + lib::llvm::type_to_str(bcx.ccx().tn,
2930+
val_ty(llfn)));
29292931
for a in llargs {
2930-
std::io::println(" a: " + lib::llvm::type_to_str(bcx.ccx().tn, val_ty(a)));
2932+
std::io::println(" a: " + lib::llvm::type_to_str(bcx.ccx().tn,
2933+
val_ty(a)));
29312934
}*/
29322935
invoker(bcx, llfn, llargs, normal_bcx.llbb, get_landing_pad(bcx));
29332936
ret normal_bcx;
@@ -4001,22 +4004,22 @@ fn create_llargs_for_fn_args(cx: fn_ctxt,
40014004
}
40024005
for bounds in tps_bounds {
40034006
let lltydesc = llvm::LLVMGetParam(cx.llfn, arg_n as c_uint);
4004-
let dicts = none;
4007+
let vtables = none;
40054008
arg_n += 1u;
40064009
for bound in *bounds {
40074010
alt bound {
40084011
ty::bound_iface(_) {
4009-
let dict = llvm::LLVMGetParam(cx.llfn, arg_n as c_uint);
4012+
let vtable = llvm::LLVMGetParam(cx.llfn, arg_n as c_uint);
40104013
arg_n += 1u;
4011-
dicts = some(alt dicts {
4012-
none { [dict] }
4013-
some(ds) { ds + [dict] }
4014+
vtables = some(alt vtables {
4015+
none { [vtable] }
4016+
some(ds) { ds + [vtable] }
40144017
});
40154018
}
40164019
_ {}
40174020
}
40184021
}
4019-
cx.lltyparams += [{desc: lltydesc, dicts: dicts}];
4022+
cx.lltyparams += [{desc: lltydesc, vtables: vtables}];
40204023
}
40214024

40224025
// Populate the llargs field of the function context with the ValueRefs

0 commit comments

Comments
 (0)