Skip to content

Commit 8eb6d33

Browse files
committed
---
yaml --- r: 5273 b: refs/heads/master c: 9a69ee7 h: refs/heads/master i: 5271: 3950f0b v: v3
1 parent a77e003 commit 8eb6d33

File tree

2 files changed

+22
-31
lines changed

2 files changed

+22
-31
lines changed

[refs]

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 6cd24173d4e1ad230bc0325901f38f4b336c1652
2+
refs/heads/master: 9a69ee79e0cc90a5d30d10d1d501cfd97cc97cf0

trunk/src/comp/middle/trans_objects.rs

+21-30
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ fn trans_obj(cx: @local_ctxt, sp: span, ob: ast::_obj, ctor_id: ast::node_id,
8888
// typarams, and fields.
8989
let llbox_ty: TypeRef = T_ptr(T_empty_struct());
9090

91-
if std::vec::len::<ast::ty_param>(ty_params) == 0u &&
92-
std::vec::len::<ty::arg>(arg_tys) == 0u {
91+
if vec::len(ty_params) == 0u &&
92+
vec::len(arg_tys) == 0u {
9393
// If the object we're translating has no fields or type parameters,
9494
// there's not much to do.
9595

@@ -124,7 +124,7 @@ fn trans_obj(cx: @local_ctxt, sp: span, ob: ast::_obj, ctor_id: ast::node_id,
124124
let body_tydesc =
125125
GEP_tup_like(bcx, body_ty, body, [0, abi::obj_body_elt_tydesc]);
126126
bcx = body_tydesc.bcx;
127-
let ti = none::<@tydesc_info>;
127+
let ti = none;
128128

129129
let r =
130130
GEP_tup_like(bcx, body_ty, body, [0, abi::obj_body_elt_typarams]);
@@ -229,7 +229,7 @@ fn trans_anon_obj(bcx: @block_ctxt, sp: span, anon_obj: ast::anon_obj,
229229
// methods, not inner ones.
230230
let wrapper_obj: ast::_obj =
231231
{fields:
232-
std::vec::map(ast_util::obj_field_from_anon_obj_field,
232+
vec::map(ast_util::obj_field_from_anon_obj_field,
233233
additional_fields),
234234
methods: anon_obj.methods};
235235

@@ -287,7 +287,7 @@ fn trans_anon_obj(bcx: @block_ctxt, sp: span, anon_obj: ast::anon_obj,
287287
// typarams, fields, and a pointer to our inner_obj.
288288
let llbox_ty: TypeRef = T_ptr(T_empty_struct());
289289

290-
if std::vec::len::<ast::anon_obj_field>(additional_fields) == 0u &&
290+
if vec::len(additional_fields) == 0u &&
291291
anon_obj.inner_obj == none {
292292

293293
// If the object we're translating has no fields and no inner_obj,
@@ -317,7 +317,7 @@ fn trans_anon_obj(bcx: @block_ctxt, sp: span, anon_obj: ast::anon_obj,
317317
let body_tydesc =
318318
GEP_tup_like(bcx, body_ty, body, [0, abi::obj_body_elt_tydesc]);
319319
bcx = body_tydesc.bcx;
320-
let ti = none::<@tydesc_info>;
320+
let ti = none;
321321
let body_td = get_tydesc(bcx, body_ty, true, tps_normal, ti).result;
322322
lazily_emit_tydesc_glue(bcx, abi::tydesc_field_drop_glue, ti);
323323
lazily_emit_tydesc_glue(bcx, abi::tydesc_field_free_glue, ti);
@@ -447,8 +447,7 @@ fn create_vtbl(cx: @local_ctxt, sp: span, outer_obj_ty: ty::t, ob: ast::_obj,
447447

448448
// Sort and process all the methods.
449449
let meths =
450-
std::sort::merge_sort::<@ast::method>(bind ast_mthd_lteq(_, _),
451-
ob.methods);
450+
std::sort::merge_sort(bind ast_mthd_lteq(_, _), ob.methods);
452451

453452
for m: @ast::method in meths {
454453
llmethods +=
@@ -483,16 +482,15 @@ fn create_vtbl(cx: @local_ctxt, sp: span, outer_obj_ty: ty::t, ob: ast::_obj,
483482
// Filter out any methods that we don't need forwarding slots for
484483
// because they're being overridden.
485484
let f = bind filtering_fn(cx, _, ob.methods);
486-
meths = std::vec::filter_map::<vtbl_mthd, vtbl_mthd>(f, meths);
485+
meths = vec::filter_map(f, meths);
487486

488487
// And now add the additional ones, both overriding ones and entirely
489488
// new ones. These will just be normal methods.
490489
for m: @ast::method in ob.methods { meths += [normal_mthd(m)]; }
491490

492491
// Sort all the methods and process them.
493492
meths =
494-
std::sort::merge_sort::<vtbl_mthd>(bind vtbl_mthd_lteq(_, _),
495-
meths);
493+
std::sort::merge_sort(bind vtbl_mthd_lteq(_, _), meths);
496494

497495
// To create forwarding methods, we'll need a "backwarding" vtbl. See
498496
// create_backwarding_vtbl and process_bkwding_method for details.
@@ -599,9 +597,7 @@ fn process_bkwding_mthd(cx: @local_ctxt, sp: span, m: @ty::method,
599597
mangle_internal_name_by_path_and_seq(mcx.ccx, mcx.path, fn_name);
600598

601599
// Get the backwarding function's type and declare it.
602-
let llbackwarding_fn_ty: TypeRef =
603-
type_of_fn_full(cx.ccx, sp, m.proto, true, m.inputs, m.output,
604-
std::vec::len::<ast::ty_param>(ty_params));
600+
let llbackwarding_fn_ty: TypeRef = type_of_meth(cx.ccx, sp, m, ty_params);
605601
let llbackwarding_fn: ValueRef =
606602
decl_internal_fastcall_fn(cx.ccx.llmod, s, llbackwarding_fn_ty);
607603

@@ -661,12 +657,7 @@ fn process_bkwding_mthd(cx: @local_ctxt, sp: span, m: @ty::method,
661657
GEP(bcx, llouter_obj_vtbl, [C_int(0), C_int(ix as int)]);
662658

663659
// Set up the outer method to be called.
664-
let outer_mthd_ty = ty::method_ty_to_fn_ty(cx.ccx.tcx, *m);
665-
let llouter_mthd_ty =
666-
type_of_fn_full(bcx_ccx(bcx), sp,
667-
ty::ty_fn_proto(bcx_tcx(bcx), outer_mthd_ty), true,
668-
m.inputs, m.output,
669-
std::vec::len::<ast::ty_param>(ty_params));
660+
let llouter_mthd_ty = type_of_meth(bcx_ccx(bcx), sp, m, ty_params);
670661
llouter_mthd =
671662
PointerCast(bcx, llouter_mthd, T_ptr(T_ptr(llouter_mthd_ty)));
672663
llouter_mthd = Load(bcx, llouter_mthd);
@@ -723,9 +714,7 @@ fn process_fwding_mthd(cx: @local_ctxt, sp: span, m: @ty::method,
723714
mangle_internal_name_by_path_and_seq(mcx.ccx, mcx.path, fn_name);
724715

725716
// Get the forwarding function's type and declare it.
726-
let llforwarding_fn_ty: TypeRef =
727-
type_of_fn_full(cx.ccx, sp, m.proto, true, m.inputs, m.output,
728-
std::vec::len::<ast::ty_param>(ty_params));
717+
let llforwarding_fn_ty = type_of_meth(cx.ccx, sp, m, ty_params);
729718
let llforwarding_fn: ValueRef =
730719
decl_internal_fastcall_fn(cx.ccx.llmod, s, llforwarding_fn_ty);
731720

@@ -819,12 +808,7 @@ fn process_fwding_mthd(cx: @local_ctxt, sp: span, m: @ty::method,
819808
GEP(bcx, llinner_obj_vtbl, [C_int(0), C_int(ix as int)]);
820809

821810
// Set up the original method to be called.
822-
let orig_mthd_ty = ty::method_ty_to_fn_ty(cx.ccx.tcx, *m);
823-
let llorig_mthd_ty =
824-
type_of_fn_full(bcx_ccx(bcx), sp,
825-
ty::ty_fn_proto(bcx_tcx(bcx), orig_mthd_ty), true,
826-
m.inputs, m.output,
827-
std::vec::len::<ast::ty_param>(ty_params));
811+
let llorig_mthd_ty = type_of_meth(bcx_ccx(bcx), sp, m, ty_params);
828812
llorig_mthd = PointerCast(bcx, llorig_mthd, T_ptr(T_ptr(llorig_mthd_ty)));
829813
llorig_mthd = Load(bcx, llorig_mthd);
830814

@@ -899,7 +883,7 @@ fn process_normal_mthd(cx: @local_ctxt, m: @ast::method, self_ty: ty::t,
899883
ty::ty_fn(proto, inputs, output, _, _) {
900884
llfnty =
901885
type_of_fn_full(cx.ccx, m.span, proto, true, inputs, output,
902-
std::vec::len::<ast::ty_param>(ty_params));
886+
vec::len(ty_params));
903887
}
904888
}
905889
let mcx: @local_ctxt =
@@ -946,6 +930,13 @@ fn populate_self_stack(bcx: @block_ctxt, self_stack: ValueRef,
946930

947931
ret self_stack;
948932
}
933+
934+
fn type_of_meth(ccx: @crate_ctxt, sp: span, m: @ty::method,
935+
tps: [ast::ty_param]) -> TypeRef {
936+
type_of_fn_full(ccx, sp, m.proto, true, m.inputs, m.output,
937+
vec::len(tps))
938+
}
939+
949940
//
950941
// Local Variables:
951942
// mode: rust

0 commit comments

Comments
 (0)