Skip to content

Commit 5f2d3e0

Browse files
committed
---
yaml --- r: 166440 b: refs/heads/batch c: 0eafc32 h: refs/heads/master v: v3
1 parent 7faeaf2 commit 5f2d3e0

File tree

35 files changed

+308
-726
lines changed

35 files changed

+308
-726
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: 3772ce55e0bba39c9c019d757f76ece7f00cbaee
32+
refs/heads/batch: 0eafc3228be26f7aee95b094398a667436c4a605
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 := -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
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
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/guide.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1604,10 +1604,6 @@ let a = [1i, 2i, 3i]; // a: [int, ..3]
16041604
let mut m = [1i, 2i, 3i]; // mut m: [int, ..3]
16051605
```
16061606

1607-
You can create an array with a given number of elements, all initialized to the
1608-
same value, with `[val, ..N]` syntax. The compiler ensures that arrays are
1609-
always initialized.
1610-
16111607
There's a shorthand for initializing each element of an array to the same
16121608
value. In this example, each element of `a` will be initialized to `0i`:
16131609

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_bytes!` : include the contents of the given file as a binary blob
643+
* `include_bin!` : 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: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ def scrub(b):
3737
"macos": ["bin/rustc"],
3838
"winnt": ["bin/rustc.exe"],
3939
"freebsd": ["bin/rustc"],
40-
"dragonfly": ["bin/rustc"],
4140
}
4241

4342
winnt_runtime_deps_32 = ["libgcc_s_dw2-1.dll",
@@ -87,8 +86,6 @@ def get_kernel(triple):
8786
return "macos"
8887
if os_name == "freebsd":
8988
return "freebsd"
90-
if os_name == "dragonfly":
91-
return "dragonfly"
9289
return "linux"
9390

9491
def get_cpu(triple):

branches/batch/src/libcore/clone.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pub trait Clone {
3636
/// but can be overridden to reuse the resources of `a` to avoid unnecessary
3737
/// allocations.
3838
#[inline(always)]
39-
#[unstable = "this function is rarely used"]
39+
#[unstable = "this function rarely unused"]
4040
fn clone_from(&mut self, source: &Self) {
4141
*self = source.clone()
4242
}

branches/batch/src/libcore/macros.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,16 @@ 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+
6474
/// Runtime assertion for equality, for details see std::macros
6575
#[macro_export]
6676
macro_rules! assert_eq {
@@ -83,7 +93,7 @@ macro_rules! debug_assert_eq {
8393
})
8494
}
8595

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

branches/batch/src/liblibc/lib.rs

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

11011100
pub type socklen_t = u32;
@@ -1168,17 +1167,6 @@ pub mod types {
11681167
pub sun_family: sa_family_t,
11691168
pub sun_path: [c_char, ..104]
11701169
}
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-
11821170
}
11831171
}
11841172

branches/batch/src/librustc_back/rpath.rs

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

217217
#[test]
218-
#[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
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")]
219234
fn test_rpath_relative() {
220235
let config = &mut RPathConfig {
221236
used_crates: Vec::new(),

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

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,13 @@ pub fn opts() -> TargetOptions {
1717
dynamic_linking: true,
1818
executables: true,
1919
morestack: true,
20-
linker_is_gnu: true,
2120
has_rpath: true,
2221
pre_link_args: vec!(
2322
"-L/usr/local/lib".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(),
23+
"-L/usr/local/lib/gcc47".to_string(),
24+
"-L/usr/local/lib/gcc44".to_string(),
3025
),
31-
position_independent_executables: true,
26+
3227
.. Default::default()
3328
}
3429
}

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

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,13 @@
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-
1714
Target {
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(),
15+
data_layout: "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_string(),
2116
llvm_target: "x86_64-unknown-dragonfly".to_string(),
2217
target_endian: "little".to_string(),
23-
target_word_size: "64".to_string(),
18+
target_word_size: "32".to_string(),
2419
arch: "x86_64".to_string(),
2520
target_os: "dragonfly".to_string(),
26-
options: base,
21+
options: super::dragonfly_base::opts()
2722
}
2823
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,8 +1554,7 @@ 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() &&
1558-
bcx.sess().opts.debuginfo != FullDebugInfo {
1557+
if simple_identifier(&*pat).is_some() {
15591558
// Generate nicer LLVM for the common case of a `for` loop pattern
15601559
// like `for x in blahblah { ... }`.
15611560
let binding_type = node_id_type(bcx, pat.id);

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

Lines changed: 37 additions & 4 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_undef};
58+
use trans::common::{C_null, C_struct_in_context, C_u64, C_u8, C_uint, 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};
76+
use trans::machine::{llsize_of, llsize_of_real, llalign_of_min};
7777
use trans::meth;
7878
use trans::monomorphize;
7979
use trans::tvec;
@@ -394,6 +394,30 @@ 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+
397421
// Type descriptor and type glue stuff
398422

399423
pub fn get_tydesc<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
@@ -959,14 +983,23 @@ pub fn invoke<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
959983
llfn: ValueRef,
960984
llargs: &[ValueRef],
961985
fn_ty: Ty<'tcx>,
962-
call_info: Option<NodeInfo>)
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)
963990
-> (ValueRef, Block<'blk, 'tcx>) {
964991
let _icx = push_ctxt("invoke_");
965992
if bcx.unreachable.get() {
966993
return (C_null(Type::i8(bcx.ccx())), bcx);
967994
}
968995

969-
let attributes = get_fn_llvm_attributes(bcx.ccx(), fn_ty);
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+
};
9701003

9711004
match bcx.opt_node_id {
9721005
None => {

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

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

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

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,26 @@ 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+
140160
pub struct ClosureResult<'blk, 'tcx: 'blk> {
141161
llbox: ValueRef, // llvalue of ptr to closure
142162
cdata_ty: Ty<'tcx>, // type of the closure data
@@ -148,7 +168,8 @@ pub struct ClosureResult<'blk, 'tcx: 'blk> {
148168
// heap allocated closure that copies the upvars into environment.
149169
// Otherwise, it is stack allocated and copies pointers to the upvars.
150170
pub fn store_environment<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
151-
bound_values: Vec<EnvValue<'tcx>>)
171+
bound_values: Vec<EnvValue<'tcx>> ,
172+
store: ty::TraitStore)
152173
-> ClosureResult<'blk, 'tcx> {
153174
let _icx = push_ctxt("closure::store_environment");
154175
let ccx = bcx.ccx();
@@ -172,7 +193,7 @@ pub fn store_environment<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
172193
}
173194

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

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

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

223-
store_environment(bcx, env_vals)
245+
store_environment(bcx, env_vals, store)
224246
}
225247

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

439461
trans_closure(ccx,
440462
decl,

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,6 @@ 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-
290289
let lliterator = load_ty(bcx, iterator_datum.val, iterator_datum.ty);
291290

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

369-
debuginfo::create_for_loop_var_metadata(body_bcx_in, pat);
370-
371368
// Codegen the body.
372369
body_bcx_out = trans_block(body_bcx_out, body, expr::Ignore);
373370
body_bcx_out =

0 commit comments

Comments
 (0)