Skip to content

Commit 289681e

Browse files
committed
---
yaml --- r: 146429 b: refs/heads/try2 c: 6184e84 h: refs/heads/master i: 146427: 0fc1cee v: v3
1 parent 925735a commit 289681e

Some content is hidden

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

47 files changed

+216
-918
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 379bda9e527809fcf149383ac52c4afd1328c649
8+
refs/heads/try2: 6184e844fbf42f980dfc3ab0d1b7f983251963a2
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/librustc/lib/llvm.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ pub static False: Bool = 0 as Bool;
2929

3030
// Consts for the LLVM CallConv type, pre-cast to uint.
3131

32-
#[deriving(Eq)]
3332
pub enum CallConv {
3433
CCallConv = 0,
3534
FastCallConv = 8,

branches/try2/src/librustc/metadata/tydecode.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -526,17 +526,10 @@ fn parse_sig(st: &mut PState, conv: conv_did) -> ty::FnSig {
526526
inputs.push(parse_ty(st, |x,y| conv(x,y)));
527527
}
528528
st.pos += 1u; // eat the ']'
529-
let variadic = if peek(st) == 'A' {
530-
st.pos += 1; // eat the 'A'
531-
true
532-
} else { false };
533529
let ret_ty = parse_ty(st, conv);
534-
ty::FnSig {
535-
bound_lifetime_names: opt_vec::Empty, // FIXME(#4846)
536-
inputs: inputs,
537-
output: ret_ty,
538-
variadic: variadic
539-
}
530+
ty::FnSig {bound_lifetime_names: opt_vec::Empty, // FIXME(#4846)
531+
inputs: inputs,
532+
output: ret_ty}
540533
}
541534

542535
// Rust metadata parsing

branches/try2/src/librustc/metadata/tyencode.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -371,9 +371,6 @@ fn enc_fn_sig(w: @mut MemWriter, cx: @ctxt, fsig: &ty::FnSig) {
371371
enc_ty(w, cx, *ty);
372372
}
373373
mywrite!(w, "]");
374-
if fsig.variadic {
375-
mywrite!(w, "A");
376-
}
377374
enc_ty(w, cx, fsig.output);
378375
}
379376

branches/try2/src/librustc/middle/trans/callee.rs

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -750,12 +750,8 @@ pub fn trans_call_inner(in_cx: @mut Block,
750750
let mut llargs = ~[];
751751
bcx = trans_args(bcx, args, callee_ty,
752752
autoref_arg, &mut llargs);
753-
let arg_tys = match args {
754-
ArgExprs(a) => a.iter().map(|x| expr_ty(bcx, *x)).collect(),
755-
ArgVals(_) => fail!("expected arg exprs.")
756-
};
757753
bcx = foreign::trans_native_call(bcx, callee_ty,
758-
llfn, opt_llretslot.unwrap(), llargs, arg_tys);
754+
llfn, opt_llretslot.unwrap(), llargs);
759755
}
760756

761757
// If the caller doesn't care about the result of this fn call,
@@ -793,7 +789,6 @@ pub fn trans_args(cx: @mut Block,
793789
let _icx = push_ctxt("trans_args");
794790
let mut temp_cleanups = ~[];
795791
let arg_tys = ty::ty_fn_args(fn_ty);
796-
let variadic = ty::fn_is_variadic(fn_ty);
797792

798793
let mut bcx = cx;
799794

@@ -802,17 +797,10 @@ pub fn trans_args(cx: @mut Block,
802797
// to cast her view of the arguments to the caller's view.
803798
match args {
804799
ArgExprs(arg_exprs) => {
805-
let num_formal_args = arg_tys.len();
806800
for (i, arg_expr) in arg_exprs.iter().enumerate() {
807-
let arg_ty = if i >= num_formal_args {
808-
assert!(variadic);
809-
expr_ty_adjusted(cx, *arg_expr)
810-
} else {
811-
arg_tys[i]
812-
};
813801
let arg_val = unpack_result!(bcx, {
814802
trans_arg_expr(bcx,
815-
arg_ty,
803+
arg_tys[i],
816804
ty::ByCopy,
817805
*arg_expr,
818806
&mut temp_cleanups,

branches/try2/src/librustc/middle/trans/foreign.rs

Lines changed: 10 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ pub fn register_foreign_item_fn(ccx: @mut CrateContext,
120120
let cc = match llvm_calling_convention(ccx, abis) {
121121
Some(cc) => cc,
122122
None => {
123-
ccx.sess.span_fatal(foreign_item.span,
123+
// FIXME(#8357) We really ought to report a span here
124+
ccx.sess.fatal(
124125
format!("ABI `{}` has no suitable ABI \
125126
for target architecture \
126127
in module {}",
@@ -134,12 +135,6 @@ pub fn register_foreign_item_fn(ccx: @mut CrateContext,
134135
let lname = link_name(ccx, foreign_item);
135136
let tys = foreign_types_for_id(ccx, foreign_item.id);
136137

137-
// Make sure the calling convention is right for variadic functions
138-
// (should've been caught if not in typeck)
139-
if tys.fn_sig.variadic {
140-
assert!(cc == lib::llvm::CCallConv);
141-
}
142-
143138
// Create the LLVM value for the C extern fn
144139
let llfn_ty = lltype_for_fn_from_foreign_types(&tys);
145140
let llfn = base::get_extern_fn(&mut ccx.externs, ccx.llmod,
@@ -153,8 +148,7 @@ pub fn trans_native_call(bcx: @mut Block,
153148
callee_ty: ty::t,
154149
llfn: ValueRef,
155150
llretptr: ValueRef,
156-
llargs_rust: &[ValueRef],
157-
passed_arg_tys: ~[ty::t]) -> @mut Block {
151+
llargs_rust: &[ValueRef]) -> @mut Block {
158152
/*!
159153
* Prepares a call to a native function. This requires adapting
160154
* from the Rust argument passing rules to the native rules.
@@ -166,10 +160,6 @@ pub fn trans_native_call(bcx: @mut Block,
166160
* - `llretptr`: where to store the return value of the function
167161
* - `llargs_rust`: a list of the argument values, prepared
168162
* as they would be if calling a Rust function
169-
* - `passed_arg_tys`: Rust type for the arguments. Normally we
170-
* can derive these from callee_ty but in the case of variadic
171-
* functions passed_arg_tys will include the Rust type of all
172-
* the arguments including the ones not specified in the fn's signature.
173163
*/
174164

175165
let ccx = bcx.ccx();
@@ -186,7 +176,7 @@ pub fn trans_native_call(bcx: @mut Block,
186176
ty::ty_bare_fn(ref fn_ty) => (fn_ty.abis, fn_ty.sig.clone()),
187177
_ => ccx.sess.bug("trans_native_call called on non-function type")
188178
};
189-
let llsig = foreign_signature(ccx, &fn_sig, passed_arg_tys);
179+
let llsig = foreign_signature(ccx, &fn_sig);
190180
let ret_def = !ty::type_is_voidish(bcx.tcx(), fn_sig.output);
191181
let fn_type = cabi::compute_abi_info(ccx,
192182
llsig.llarg_tys,
@@ -218,7 +208,7 @@ pub fn trans_native_call(bcx: @mut Block,
218208
let mut llarg_rust = llarg_rust;
219209

220210
// Does Rust pass this argument by pointer?
221-
let rust_indirect = type_of::arg_is_indirect(ccx, passed_arg_tys[i]);
211+
let rust_indirect = type_of::arg_is_indirect(ccx, fn_sig.inputs[i]);
222212

223213
debug!("argument {}, llarg_rust={}, rust_indirect={}, arg_ty={}",
224214
i,
@@ -229,7 +219,7 @@ pub fn trans_native_call(bcx: @mut Block,
229219
// Ensure that we always have the Rust value indirectly,
230220
// because it makes bitcasting easier.
231221
if !rust_indirect {
232-
let scratch = base::alloca(bcx, type_of::type_of(ccx, passed_arg_tys[i]), "__arg");
222+
let scratch = base::alloca(bcx, type_of::type_of(ccx, fn_sig.inputs[i]), "__arg");
233223
Store(bcx, llarg_rust, scratch);
234224
llarg_rust = scratch;
235225
}
@@ -341,20 +331,6 @@ pub fn trans_foreign_mod(ccx: @mut CrateContext,
341331
foreign_mod: &ast::foreign_mod) {
342332
let _icx = push_ctxt("foreign::trans_foreign_mod");
343333
for &foreign_item in foreign_mod.items.iter() {
344-
match foreign_item.node {
345-
ast::foreign_item_fn(*) => {
346-
let (abis, mut path) = match ccx.tcx.items.get_copy(&foreign_item.id) {
347-
ast_map::node_foreign_item(_, abis, _, path) => (abis, (*path).clone()),
348-
_ => fail!("Unable to find foreign item in tcx.items table.")
349-
};
350-
if !(abis.is_rust() || abis.is_intrinsic()) {
351-
path.push(ast_map::path_name(foreign_item.ident));
352-
register_foreign_item_fn(ccx, abis, &path, foreign_item);
353-
}
354-
}
355-
_ => ()
356-
}
357-
358334
let lname = link_name(ccx, foreign_item);
359335
ccx.item_symbols.insert(foreign_item.id, lname.to_owned());
360336
}
@@ -725,7 +701,7 @@ pub fn link_name(ccx: &CrateContext, i: @ast::foreign_item) -> @str {
725701
}
726702
}
727703

728-
fn foreign_signature(ccx: &mut CrateContext, fn_sig: &ty::FnSig, arg_tys: &[ty::t])
704+
fn foreign_signature(ccx: &mut CrateContext, fn_sig: &ty::FnSig)
729705
-> LlvmSignature {
730706
/*!
731707
* The ForeignSignature is the LLVM types of the arguments/return type
@@ -735,7 +711,7 @@ fn foreign_signature(ccx: &mut CrateContext, fn_sig: &ty::FnSig, arg_tys: &[ty::
735711
* values by pointer like we do.
736712
*/
737713

738-
let llarg_tys = arg_tys.map(|&arg| type_of(ccx, arg));
714+
let llarg_tys = fn_sig.inputs.map(|&arg| type_of(ccx, arg));
739715
let llret_ty = type_of::type_of(ccx, fn_sig.output);
740716
LlvmSignature {
741717
llarg_tys: llarg_tys,
@@ -755,7 +731,7 @@ fn foreign_types_for_fn_ty(ccx: &mut CrateContext,
755731
ty::ty_bare_fn(ref fn_ty) => fn_ty.sig.clone(),
756732
_ => ccx.sess.bug("foreign_types_for_fn_ty called on non-function type")
757733
};
758-
let llsig = foreign_signature(ccx, &fn_sig, fn_sig.inputs);
734+
let llsig = foreign_signature(ccx, &fn_sig);
759735
let ret_def = !ty::type_is_voidish(ccx.tcx, fn_sig.output);
760736
let fn_ty = cabi::compute_abi_info(ccx,
761737
llsig.llarg_tys,
@@ -814,11 +790,7 @@ fn lltype_for_fn_from_foreign_types(tys: &ForeignTypes) -> Type {
814790
llargument_tys.push(llarg_ty);
815791
}
816792

817-
if tys.fn_sig.variadic {
818-
Type::variadic_func(llargument_tys, &llreturn_ty)
819-
} else {
820-
Type::func(llargument_tys, &llreturn_ty)
821-
}
793+
Type::func(llargument_tys, &llreturn_ty)
822794
}
823795

824796
pub fn lltype_for_foreign_fn(ccx: &mut CrateContext, ty: ty::t) -> Type {

branches/try2/src/librustc/middle/trans/intrinsic.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -285,11 +285,6 @@ pub fn trans_intrinsic(ccx: @mut CrateContext,
285285
let td = PointerCast(bcx, static_ti.tydesc, userland_tydesc_ty);
286286
Ret(bcx, td);
287287
}
288-
"type_id" => {
289-
let hash = ty::hash_crate_independent(ccx.tcx, substs.tys[0],
290-
ccx.link_meta.extras_hash);
291-
Ret(bcx, C_i64(hash as i64))
292-
}
293288
"init" => {
294289
let tp_ty = substs.tys[0];
295290
let lltp_ty = type_of::type_of(ccx, tp_ty);

branches/try2/src/librustc/middle/trans/reflect.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,6 @@ impl Reflector {
375375
self.visit("fn_input", extra);
376376
}
377377
let extra = ~[self.c_uint(retval),
378-
self.c_bool(sig.variadic),
379378
self.c_tydesc(sig.output)];
380379
self.visit("fn_output", extra);
381380
}

branches/try2/src/librustc/middle/trans/type_.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,6 @@ impl Type {
154154
args.len() as c_uint, False))
155155
}
156156

157-
pub fn variadic_func(args: &[Type], ret: &Type) -> Type {
158-
let vec : &[TypeRef] = unsafe { cast::transmute(args) };
159-
ty!(llvm::LLVMFunctionType(ret.to_ref(), vec::raw::to_ptr(vec),
160-
args.len() as c_uint, True))
161-
}
162-
163157
pub fn func_pair(cx: &CrateContext, fn_ty: &Type) -> Type {
164158
Type::struct_([fn_ty.ptr_to(), Type::opaque_cbox_ptr(cx)], false)
165159
}

0 commit comments

Comments
 (0)