Skip to content

Commit 0e7c685

Browse files
committed
---
yaml --- r: 166491 b: refs/heads/snap-stage3 c: c06edba h: refs/heads/master i: 166489: 88702c9 166487: 4ca4492 v: v3
1 parent 5dd3773 commit 0e7c685

File tree

31 files changed

+802
-248
lines changed

31 files changed

+802
-248
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 18842f89f084c52588fe7cffe07f87bf6e90796a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: fe9f1beae241821f91cd5801c37d42737a434f5c
4+
refs/heads/snap-stage3: c06edbad34f2f8f2fa5138e855a442db1c6324d1
55
refs/heads/try: f5d619caf9f32458680fae55526b99582ca682dd
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

branches/snap-stage3/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/snap-stage3/mk/rt.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ $$(JEMALLOC_LOCAL_$(1)): $$(JEMALLOC_DEPS) $$(MKFILE_DEPS)
180180
AR="$$(AR_$(1))" \
181181
RANLIB="$$(AR_$(1)) s" \
182182
CPPFLAGS="-I $(S)src/rt/" \
183-
EXTRA_CFLAGS="-g1"
183+
EXTRA_CFLAGS="-g1 -ffunction-sections -fdata-sections"
184184
$$(Q)$$(MAKE) -C "$$(JEMALLOC_BUILD_DIR_$(1))" build_lib_static
185185

186186
ifeq ($$(CFG_DISABLE_JEMALLOC),)

branches/snap-stage3/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/snap-stage3/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/snap-stage3/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/snap-stage3/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/snap-stage3/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/snap-stage3/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/snap-stage3/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/snap-stage3/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/snap-stage3/src/librustc_trans/trans/controlflow.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ pub fn trans_for<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
286286
debug!("iterator type is {}, datum type is {}",
287287
ppaux::ty_to_string(bcx.tcx(), iterator_type),
288288
ppaux::ty_to_string(bcx.tcx(), iterator_datum.ty));
289+
289290
let lliterator = load_ty(bcx, iterator_datum.val, iterator_datum.ty);
290291

291292
// Create our basic blocks and set up our loop cleanups.
@@ -365,6 +366,8 @@ pub fn trans_for<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
365366
llpayload,
366367
binding_cleanup_scope_id);
367368

369+
debuginfo::create_for_loop_var_metadata(body_bcx_in, pat);
370+
368371
// Codegen the body.
369372
body_bcx_out = trans_block(body_bcx_out, body, expr::Ignore);
370373
body_bcx_out =

0 commit comments

Comments
 (0)