Skip to content

Commit 7faeaf2

Browse files
committed
---
yaml --- r: 166439 b: refs/heads/batch c: 3772ce5 h: refs/heads/master i: 166437: e5d3fef 166435: 53c3083 166431: fb814bd v: v3
1 parent 49b3c8e commit 7faeaf2

File tree

35 files changed

+800
-313
lines changed

35 files changed

+800
-313
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
2929
refs/heads/issue-18208-method-dispatch-2: 9e1eae4fb9b6527315b4441cf8a0f5ca911d1671
3030
refs/heads/automation-fail: 1bf06495443584539b958873e04cc2f864ab10e4
3131
refs/heads/issue-18208-method-dispatch-3-quick-reject: 2009f85b9f99dedcec4404418eda9ddba90258a2
32-
refs/heads/batch: ffd0f5a111438e37dbc25dc442989645be483c34
32+
refs/heads/batch: 3772ce55e0bba39c9c019d757f76ece7f00cbaee
3333
refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970

branches/batch/mk/cfg/x86_64-unknown-dragonfly.mk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ CFG_LIB_NAME_x86_64-unknown-dragonfly=lib$(1).so
77
CFG_STATIC_LIB_NAME_x86_64-unknown-dragonfly=lib$(1).a
88
CFG_LIB_GLOB_x86_64-unknown-dragonfly=lib$(1)-*.so
99
CFG_LIB_DSYM_GLOB_x86_64-unknown-dragonfly=$(1)-*.dylib.dSYM
10-
CFG_JEMALLOC_CFLAGS_x86_64-unknown-dragonfly := -I/usr/include -I/usr/local/include $(CFLAGS)
11-
CFG_GCCISH_CFLAGS_x86_64-unknown-dragonfly := -Wall -Werror -g -fPIC -I/usr/include -I/usr/local/include $(CFLAGS)
12-
CFG_GCCISH_LINK_FLAGS_x86_64-unknown-dragonfly := -shared -fPIC -g -pthread -lrt
10+
CFG_JEMALLOC_CFLAGS_x86_64-unknown-dragonfly := -m64 -I/usr/include -I/usr/local/include $(CFLAGS)
11+
CFG_GCCISH_CFLAGS_x86_64-unknown-dragonfly := -Wall -Werror -g -fPIC -m64 -I/usr/include -I/usr/local/include $(CFLAGS)
12+
CFG_GCCISH_LINK_FLAGS_x86_64-unknown-dragonfly := -shared -fPIC -g -pthread -lrt -m64
1313
CFG_GCCISH_DEF_FLAG_x86_64-unknown-dragonfly := -Wl,--export-dynamic,--dynamic-list=
1414
CFG_GCCISH_PRE_LIB_FLAGS_x86_64-unknown-dragonfly := -Wl,-whole-archive
1515
CFG_GCCISH_POST_LIB_FLAGS_x86_64-unknown-dragonfly := -Wl,-no-whole-archive

branches/batch/src/doc/reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ names, and invoked through a consistent syntax: `name!(...)`. Examples include:
640640
* `stringify!` : pretty-print the Rust expression given as an argument
641641
* `include!` : include the Rust expression in the given file
642642
* `include_str!` : include the contents of the given file as a string
643-
* `include_bin!` : include the contents of the given file as a binary blob
643+
* `include_bytes!` : include the contents of the given file as a binary blob
644644
* `error!`, `warn!`, `info!`, `debug!` : provide diagnostic information.
645645

646646
All of the above extensions are expressions with values.

branches/batch/src/etc/snapshot.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def scrub(b):
3737
"macos": ["bin/rustc"],
3838
"winnt": ["bin/rustc.exe"],
3939
"freebsd": ["bin/rustc"],
40+
"dragonfly": ["bin/rustc"],
4041
}
4142

4243
winnt_runtime_deps_32 = ["libgcc_s_dw2-1.dll",
@@ -86,6 +87,8 @@ def get_kernel(triple):
8687
return "macos"
8788
if os_name == "freebsd":
8889
return "freebsd"
90+
if os_name == "dragonfly":
91+
return "dragonfly"
8992
return "linux"
9093

9194
def get_cpu(triple):

branches/batch/src/libcore/macros.rs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,6 @@ macro_rules! assert {
6161
);
6262
}
6363

64-
/// Runtime assertion, only without `--cfg ndebug`
65-
#[macro_export]
66-
macro_rules! debug_assert {
67-
($(a:tt)*) => ({
68-
if cfg!(not(ndebug)) {
69-
assert!($($a)*);
70-
}
71-
})
72-
}
73-
7464
/// Runtime assertion for equality, for details see std::macros
7565
#[macro_export]
7666
macro_rules! assert_eq {
@@ -93,7 +83,7 @@ macro_rules! debug_assert_eq {
9383
})
9484
}
9585

96-
/// Runtime assertion, disableable at compile time
86+
/// Runtime assertion, disableable at compile time with `--cfg ndebug`
9787
#[macro_export]
9888
macro_rules! debug_assert {
9989
($($arg:tt)*) => (if cfg!(not(ndebug)) { assert!($($arg)*); })

branches/batch/src/liblibc/lib.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,6 +1095,7 @@ pub mod types {
10951095
pub type sighandler_t = size_t;
10961096
}
10971097
pub mod bsd44 {
1098+
use types::common::c95::{c_void};
10981099
use types::os::arch::c95::{c_char, c_int, c_uint};
10991100

11001101
pub type socklen_t = u32;
@@ -1167,6 +1168,17 @@ pub mod types {
11671168
pub sun_family: sa_family_t,
11681169
pub sun_path: [c_char, ..104]
11691170
}
1171+
#[repr(C)]
1172+
#[deriving(Copy)] pub struct ifaddrs {
1173+
pub ifa_next: *mut ifaddrs,
1174+
pub ifa_name: *mut c_char,
1175+
pub ifa_flags: c_uint,
1176+
pub ifa_addr: *mut sockaddr,
1177+
pub ifa_netmask: *mut sockaddr,
1178+
pub ifa_dstaddr: *mut sockaddr,
1179+
pub ifa_data: *mut c_void
1180+
}
1181+
11701182
}
11711183
}
11721184

branches/batch/src/librustc_back/rpath.rs

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -215,22 +215,7 @@ mod test {
215215
}
216216

217217
#[test]
218-
#[cfg(target_os = "freebsd")]
219-
fn test_rpath_relative() {
220-
let config = &mut RPathConfig {
221-
used_crates: Vec::new(),
222-
has_rpath: true,
223-
is_like_osx: false,
224-
out_filename: Path::new("bin/rustc"),
225-
get_install_prefix_lib_path: || panic!(),
226-
realpath: |p| Ok(p.clone())
227-
};
228-
let res = get_rpath_relative_to_output(config, &Path::new("lib/libstd.so"));
229-
assert_eq!(res, "$ORIGIN/../lib");
230-
}
231-
232-
#[test]
233-
#[cfg(target_os = "dragonfly")]
218+
#[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
234219
fn test_rpath_relative() {
235220
let config = &mut RPathConfig {
236221
used_crates: Vec::new(),

branches/batch/src/librustc_back/target/dragonfly_base.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,18 @@ pub fn opts() -> TargetOptions {
1717
dynamic_linking: true,
1818
executables: true,
1919
morestack: true,
20+
linker_is_gnu: true,
2021
has_rpath: true,
2122
pre_link_args: vec!(
2223
"-L/usr/local/lib".to_string(),
23-
"-L/usr/local/lib/gcc47".to_string(),
24-
"-L/usr/local/lib/gcc44".to_string(),
24+
"-L/usr/lib/gcc47".to_string(),
25+
// GNU-style linkers will use this to omit linking to libraries
26+
// which don't actually fulfill any relocations, but only for
27+
// libraries which follow this flag. Thus, use it before
28+
// specifying libraries to link to.
29+
"-Wl,--as-needed".to_string(),
2530
),
26-
31+
position_independent_executables: true,
2732
.. Default::default()
2833
}
2934
}

branches/batch/src/librustc_back/target/x86_64_unknown_dragonfly.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,18 @@
1111
use target::Target;
1212

1313
pub fn target() -> Target {
14+
let mut base = super::dragonfly_base::opts();
15+
base.pre_link_args.push("-m64".to_string());
16+
1417
Target {
15-
data_layout: "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_string(),
18+
data_layout: "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\
19+
f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-\
20+
s0:64:64-f80:128:128-n8:16:32:64-S128".to_string(),
1621
llvm_target: "x86_64-unknown-dragonfly".to_string(),
1722
target_endian: "little".to_string(),
18-
target_word_size: "32".to_string(),
23+
target_word_size: "64".to_string(),
1924
arch: "x86_64".to_string(),
2025
target_os: "dragonfly".to_string(),
21-
options: super::dragonfly_base::opts()
26+
options: base,
2227
}
2328
}

branches/batch/src/librustc_trans/trans/_match.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1554,7 +1554,8 @@ pub fn store_for_loop_binding<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
15541554
-> Block<'blk, 'tcx> {
15551555
let _icx = push_ctxt("match::store_for_loop_binding");
15561556

1557-
if simple_identifier(&*pat).is_some() {
1557+
if simple_identifier(&*pat).is_some() &&
1558+
bcx.sess().opts.debuginfo != FullDebugInfo {
15581559
// Generate nicer LLVM for the common case of a `for` loop pattern
15591560
// like `for x in blahblah { ... }`.
15601561
let binding_type = node_id_type(bcx, pat.id);

branches/batch/src/librustc_trans/trans/adt.rs

Lines changed: 61 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,62 @@ fn represent_type_uncached<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
256256
assert!((cases.len() - 1) as i64 >= 0);
257257
let bounds = IntBounds { ulo: 0, uhi: (cases.len() - 1) as u64,
258258
slo: 0, shi: (cases.len() - 1) as i64 };
259-
let ity = range_to_inttype(cx, hint, &bounds);
259+
let min_ity = range_to_inttype(cx, hint, &bounds);
260+
261+
// Create the set of structs that represent each variant
262+
// Use the minimum integer type we figured out above
263+
let fields : Vec<_> = cases.iter().map(|c| {
264+
let mut ftys = vec!(ty_of_inttype(min_ity));
265+
ftys.push_all(c.tys.as_slice());
266+
if dtor { ftys.push(ty::mk_bool()); }
267+
mk_struct(cx, ftys.as_slice(), false, t)
268+
}).collect();
269+
270+
271+
// Check to see if we should use a different type for the
272+
// discriminant. If the overall alignment of the type is
273+
// the same as the first field in each variant, we can safely use
274+
// an alignment-sized type.
275+
// We increase the size of the discriminant to avoid LLVM copying
276+
// padding when it doesn't need to. This normally causes unaligned
277+
// load/stores and excessive memcpy/memset operations. By using a
278+
// bigger integer size, LLVM can be sure about it's contents and
279+
// won't be so conservative.
280+
// This check is needed to avoid increasing the size of types when
281+
// the alignment of the first field is smaller than the overall
282+
// alignment of the type.
283+
let (_, align) = union_size_and_align(fields.as_slice());
284+
let mut use_align = true;
285+
for st in fields.iter() {
286+
// Get the first non-zero-sized field
287+
let field = st.fields.iter().skip(1).filter(|ty| {
288+
let t = type_of::sizing_type_of(cx, **ty);
289+
machine::llsize_of_real(cx, t) != 0 ||
290+
// This case is only relevant for zero-sized types with large alignment
291+
machine::llalign_of_min(cx, t) != 1
292+
}).next();
293+
294+
if let Some(field) = field {
295+
let field_align = type_of::align_of(cx, *field);
296+
if field_align != align {
297+
use_align = false;
298+
break;
299+
}
300+
}
301+
}
302+
let ity = if use_align {
303+
// Use the overall alignment
304+
match align {
305+
1 => attr::UnsignedInt(ast::TyU8),
306+
2 => attr::UnsignedInt(ast::TyU16),
307+
4 => attr::UnsignedInt(ast::TyU32),
308+
8 if machine::llalign_of_min(cx, Type::i64(cx)) == 8 =>
309+
attr::UnsignedInt(ast::TyU64),
310+
_ => min_ity // use min_ity as a fallback
311+
}
312+
} else {
313+
min_ity
314+
};
260315

261316
let fields : Vec<_> = cases.iter().map(|c| {
262317
let mut ftys = vec!(ty_of_inttype(ity));
@@ -570,7 +625,7 @@ fn generic_type_of<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
570625
let discr_ty = ll_inttype(cx, ity);
571626
let discr_size = machine::llsize_of_alloc(cx, discr_ty);
572627
let align_units = (size + align_s - 1) / align_s - 1;
573-
let pad_ty = match align_s {
628+
let fill_ty = match align_s {
574629
1 => Type::array(&Type::i8(cx), align_units),
575630
2 => Type::array(&Type::i16(cx), align_units),
576631
4 => Type::array(&Type::i32(cx), align_units),
@@ -580,11 +635,11 @@ fn generic_type_of<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
580635
align_units),
581636
_ => panic!("unsupported enum alignment: {}", align)
582637
};
583-
assert_eq!(machine::llalign_of_min(cx, pad_ty), align);
638+
assert_eq!(machine::llalign_of_min(cx, fill_ty), align);
584639
assert_eq!(align_s % discr_size, 0);
585-
let fields = vec!(discr_ty,
586-
Type::array(&discr_ty, align_s / discr_size - 1),
587-
pad_ty);
640+
let fields = [discr_ty,
641+
Type::array(&discr_ty, align_s / discr_size - 1),
642+
fill_ty];
588643
match name {
589644
None => Type::struct_(cx, fields[], false),
590645
Some(name) => {

branches/batch/src/librustc_trans/trans/base.rs

Lines changed: 4 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ use trans::cleanup::CleanupMethods;
5555
use trans::cleanup;
5656
use trans::closure;
5757
use trans::common::{Block, C_bool, C_bytes_in_context, C_i32, C_integral};
58-
use trans::common::{C_null, C_struct_in_context, C_u64, C_u8, C_uint, C_undef};
58+
use trans::common::{C_null, C_struct_in_context, C_u64, C_u8, C_undef};
5959
use trans::common::{CrateContext, ExternMap, FunctionContext};
6060
use trans::common::{NodeInfo, Result};
6161
use trans::common::{node_id_type, return_type_is_void};
@@ -73,7 +73,7 @@ use trans::glue;
7373
use trans::inline;
7474
use trans::intrinsic;
7575
use trans::machine;
76-
use trans::machine::{llsize_of, llsize_of_real, llalign_of_min};
76+
use trans::machine::{llsize_of, llsize_of_real};
7777
use trans::meth;
7878
use trans::monomorphize;
7979
use trans::tvec;
@@ -394,30 +394,6 @@ pub fn malloc_raw_dyn<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
394394
Result::new(r.bcx, PointerCast(r.bcx, r.val, llty_ptr))
395395
}
396396

397-
pub fn malloc_raw_dyn_proc<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, t: Ty<'tcx>)
398-
-> Result<'blk, 'tcx> {
399-
let _icx = push_ctxt("malloc_raw_dyn_proc");
400-
let ccx = bcx.ccx();
401-
402-
// Grab the TypeRef type of ptr_ty.
403-
let ptr_ty = ty::mk_uniq(bcx.tcx(), t);
404-
let ptr_llty = type_of(ccx, ptr_ty);
405-
406-
let llty = type_of(bcx.ccx(), t);
407-
let size = llsize_of(bcx.ccx(), llty);
408-
let llalign = C_uint(ccx, llalign_of_min(bcx.ccx(), llty));
409-
410-
// Allocate space and store the destructor pointer:
411-
let Result {bcx, val: llbox} = malloc_raw_dyn(bcx, ptr_llty, t, size, llalign);
412-
let dtor_ptr = GEPi(bcx, llbox, &[0u, abi::BOX_FIELD_DROP_GLUE]);
413-
let drop_glue_field_ty = type_of(ccx, ty::mk_nil_ptr(bcx.tcx()));
414-
let drop_glue = PointerCast(bcx, glue::get_drop_glue(ccx, ty::mk_uniq(bcx.tcx(), t)),
415-
drop_glue_field_ty);
416-
Store(bcx, drop_glue, dtor_ptr);
417-
418-
Result::new(bcx, llbox)
419-
}
420-
421397
// Type descriptor and type glue stuff
422398

423399
pub fn get_tydesc<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
@@ -983,23 +959,14 @@ pub fn invoke<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
983959
llfn: ValueRef,
984960
llargs: &[ValueRef],
985961
fn_ty: Ty<'tcx>,
986-
call_info: Option<NodeInfo>,
987-
// FIXME(15064) is_lang_item is a horrible hack, please remove it
988-
// at the soonest opportunity.
989-
is_lang_item: bool)
962+
call_info: Option<NodeInfo>)
990963
-> (ValueRef, Block<'blk, 'tcx>) {
991964
let _icx = push_ctxt("invoke_");
992965
if bcx.unreachable.get() {
993966
return (C_null(Type::i8(bcx.ccx())), bcx);
994967
}
995968

996-
// FIXME(15064) Lang item methods may (in the reflect case) not have proper
997-
// types, so doing an attribute lookup will fail.
998-
let attributes = if is_lang_item {
999-
llvm::AttrBuilder::new()
1000-
} else {
1001-
get_fn_llvm_attributes(bcx.ccx(), fn_ty)
1002-
};
969+
let attributes = get_fn_llvm_attributes(bcx.ccx(), fn_ty);
1003970

1004971
match bcx.opt_node_id {
1005972
None => {

branches/batch/src/librustc_trans/trans/callee.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -778,8 +778,7 @@ pub fn trans_call_inner<'a, 'blk, 'tcx, F>(bcx: Block<'blk, 'tcx>,
778778
llfn,
779779
llargs[],
780780
callee_ty,
781-
call_info,
782-
dest.is_none());
781+
call_info);
783782
bcx = b;
784783
llresult = llret;
785784

0 commit comments

Comments
 (0)