Skip to content

Commit a3c51e7

Browse files
committed
---
yaml --- r: 166433 b: refs/heads/batch c: 3f66223 h: refs/heads/master i: 166431: fb814bd v: v3
1 parent 871e8e5 commit a3c51e7

File tree

17 files changed

+435
-161
lines changed

17 files changed

+435
-161
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: f1e37f98930c69718f8e07168ac6e4feaff03ffe
32+
refs/heads/batch: 3f66223ca650a9bdfb3b564e85639ebfe03677c8
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/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/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/base.rs

Lines changed: 2 additions & 26 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>,

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

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -137,26 +137,6 @@ fn tuplify_box_ty<'tcx>(tcx: &ty::ctxt<'tcx>, t: Ty<'tcx>) -> Ty<'tcx> {
137137
ty::mk_tup(tcx, vec!(ty::mk_uint(), ty::mk_nil_ptr(tcx), ptr, ptr, t))
138138
}
139139

140-
fn allocate_cbox<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
141-
store: ty::TraitStore,
142-
cdata_ty: Ty<'tcx>)
143-
-> Result<'blk, 'tcx> {
144-
let _icx = push_ctxt("closure::allocate_cbox");
145-
let tcx = bcx.tcx();
146-
147-
// Allocate and initialize the box:
148-
let cbox_ty = tuplify_box_ty(tcx, cdata_ty);
149-
match store {
150-
ty::UniqTraitStore => {
151-
malloc_raw_dyn_proc(bcx, cbox_ty)
152-
}
153-
ty::RegionTraitStore(..) => {
154-
let llbox = alloc_ty(bcx, cbox_ty, "__closure");
155-
Result::new(bcx, llbox)
156-
}
157-
}
158-
}
159-
160140
pub struct ClosureResult<'blk, 'tcx: 'blk> {
161141
llbox: ValueRef, // llvalue of ptr to closure
162142
cdata_ty: Ty<'tcx>, // type of the closure data
@@ -168,8 +148,7 @@ pub struct ClosureResult<'blk, 'tcx: 'blk> {
168148
// heap allocated closure that copies the upvars into environment.
169149
// Otherwise, it is stack allocated and copies pointers to the upvars.
170150
pub fn store_environment<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
171-
bound_values: Vec<EnvValue<'tcx>> ,
172-
store: ty::TraitStore)
151+
bound_values: Vec<EnvValue<'tcx>>)
173152
-> ClosureResult<'blk, 'tcx> {
174153
let _icx = push_ctxt("closure::store_environment");
175154
let ccx = bcx.ccx();
@@ -193,7 +172,7 @@ pub fn store_environment<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
193172
}
194173

195174
// allocate closure in the heap
196-
let Result {bcx, val: llbox} = allocate_cbox(bcx, store, cdata_ty);
175+
let llbox = alloc_ty(bcx, cbox_ty, "__closure");
197176

198177
let llbox = PointerCast(bcx, llbox, llboxptr_ty);
199178
debug!("tuplify_box_ty = {}", ty_to_string(tcx, cbox_ty));
@@ -227,8 +206,7 @@ pub fn store_environment<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
227206
// collects the upvars and packages them up for store_environment.
228207
fn build_closure<'blk, 'tcx>(bcx0: Block<'blk, 'tcx>,
229208
freevar_mode: ast::CaptureClause,
230-
freevars: &Vec<ty::Freevar>,
231-
store: ty::TraitStore)
209+
freevars: &Vec<ty::Freevar>)
232210
-> ClosureResult<'blk, 'tcx> {
233211
let _icx = push_ctxt("closure::build_closure");
234212

@@ -242,7 +220,7 @@ fn build_closure<'blk, 'tcx>(bcx0: Block<'blk, 'tcx>,
242220
env_vals.push(EnvValue {action: freevar_mode, datum: datum});
243221
}
244222

245-
store_environment(bcx, env_vals, store)
223+
store_environment(bcx, env_vals)
246224
}
247225

248226
// Given an enclosing block context, a new function context, a closure type,
@@ -456,7 +434,7 @@ pub fn trans_expr_fn<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
456434
llbox,
457435
cdata_ty,
458436
bcx
459-
} = build_closure(bcx, freevar_mode, &freevars, store);
437+
} = build_closure(bcx, freevar_mode, &freevars);
460438

461439
trans_closure(ccx,
462440
decl,

branches/batch/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)