Skip to content

Commit bf058f2

Browse files
committed
---
yaml --- r: 274383 b: refs/heads/stable c: b16fbe7 h: refs/heads/master i: 274381: 7728bee 274379: 2bd23f3 274375: d531825 274367: df9dc34
1 parent d2063b2 commit bf058f2

Some content is hidden

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

50 files changed

+1360
-601
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: c0221c8897db309a79990367476177b1230bb264
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: afd42d21442db92492799f65e22e024e1e2b1011
32+
refs/heads/stable: b16fbe79ac29fc5ce604c89736352ca2765c7d78
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

branches/stable/configure

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -334,14 +334,6 @@ enable_if_not_disabled() {
334334
fi
335335
}
336336

337-
to_llvm_triple() {
338-
case $1 in
339-
i686-w64-mingw32) echo i686-pc-windows-gnu ;;
340-
x86_64-w64-mingw32) echo x86_64-pc-windows-gnu ;;
341-
*) echo $1 ;;
342-
esac
343-
}
344-
345337
to_gnu_triple() {
346338
case $1 in
347339
i686-pc-windows-gnu) echo i686-w64-mingw32 ;;
@@ -646,12 +638,6 @@ valopt_nosave host "${CFG_BUILD}" "GNUs ./configure syntax LLVM host triples"
646638
valopt_nosave target "${CFG_HOST}" "GNUs ./configure syntax LLVM target triples"
647639
valopt_nosave mandir "${CFG_PREFIX}/share/man" "install man pages in PATH"
648640

649-
# Temporarily support old triples until buildbots get updated
650-
CFG_BUILD=$(to_llvm_triple $CFG_BUILD)
651-
putvar CFG_BUILD # Yes, this creates a duplicate entry, but the last one wins.
652-
CFG_HOST=$(to_llvm_triple $CFG_HOST)
653-
CFG_TARGET=$(to_llvm_triple $CFG_TARGET)
654-
655641
# On Windows this determines root of the subtree for target libraries.
656642
# Host runtime libs always go to 'bin'.
657643
valopt libdir "${CFG_PREFIX}/lib" "install libraries"

branches/stable/mk/tests.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,6 +1039,8 @@ $(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok: \
10391039
export INCLUDE := $$(CFG_MSVC_INCLUDE_PATH_$$(HOST_$(3)))
10401040
$(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok: \
10411041
export LIB := $$(CFG_MSVC_LIB_PATH_$$(HOST_$(3)))
1042+
$(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok: \
1043+
export MSVC_LIB := "$$(CFG_MSVC_LIB_$$(HOST_$(3)))"
10421044
$(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok: \
10431045
$(S)src/test/run-make/%/Makefile \
10441046
$$(CSREQ$(1)_T_$(2)_H_$(3))

branches/stable/src/libcore/intrinsics.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,15 @@ extern "rust-intrinsic" {
552552
pub fn discriminant_value<T>(v: &T) -> u64;
553553

554554
/// Rust's "try catch" construct which invokes the function pointer `f` with
555-
/// the data pointer `data`, returning the exception payload if an exception
556-
/// is thrown (aka the thread panics).
555+
/// the data pointer `data`.
556+
///
557+
/// The third pointer is a target-specific data pointer which is filled in
558+
/// with the specifics of the exception that occurred. For examples on Unix
559+
/// platforms this is a `*mut *mut T` which is filled in by the compiler and
560+
/// on MSVC it's `*mut [usize; 2]`. For more information see the compiler's
561+
/// source as well as std's catch implementation.
562+
#[cfg(not(stage0))]
563+
pub fn try(f: fn(*mut u8), data: *mut u8, local_ptr: *mut u8) -> i32;
564+
#[cfg(stage0)]
557565
pub fn try(f: fn(*mut u8), data: *mut u8) -> *mut u8;
558566
}

branches/stable/src/librustc_back/target/x86_64_pc_windows_msvc.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ use target::Target;
1313
pub fn target() -> Target {
1414
let mut base = super::windows_msvc_base::opts();
1515
base.cpu = "x86-64".to_string();
16-
base.custom_unwind_resume = true;
1716

1817
Target {
1918
llvm_target: "x86_64-pc-windows-msvc".to_string(),

branches/stable/src/librustc_llvm/archive_ro.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,14 @@ impl Drop for ArchiveRO {
7979
}
8080

8181
impl<'a> Iterator for Iter<'a> {
82-
type Item = Child<'a>;
82+
type Item = Result<Child<'a>, String>;
8383

84-
fn next(&mut self) -> Option<Child<'a>> {
84+
fn next(&mut self) -> Option<Result<Child<'a>, String>> {
8585
let ptr = unsafe { ::LLVMRustArchiveIteratorNext(self.ptr) };
8686
if ptr.is_null() {
87-
None
87+
::last_error().map(Err)
8888
} else {
89-
Some(Child { ptr: ptr, _data: marker::PhantomData })
89+
Some(Ok(Child { ptr: ptr, _data: marker::PhantomData }))
9090
}
9191
}
9292
}

branches/stable/src/librustc_llvm/lib.rs

Lines changed: 93 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ pub use self::DiagnosticSeverity::*;
5656
pub use self::Linkage::*;
5757
pub use self::DLLStorageClassTypes::*;
5858

59-
use std::ffi::CString;
59+
use std::ffi::{CString, CStr};
6060
use std::cell::RefCell;
6161
use std::slice;
6262
use libc::{c_uint, c_ushort, uint64_t, c_int, size_t, c_char};
@@ -544,6 +544,9 @@ pub type SMDiagnosticRef = *mut SMDiagnostic_opaque;
544544
#[allow(missing_copy_implementations)]
545545
pub enum RustArchiveMember_opaque {}
546546
pub type RustArchiveMemberRef = *mut RustArchiveMember_opaque;
547+
#[allow(missing_copy_implementations)]
548+
pub enum OperandBundleDef_opaque {}
549+
pub type OperandBundleDefRef = *mut OperandBundleDef_opaque;
547550

548551
pub type DiagnosticHandler = unsafe extern "C" fn(DiagnosticInfoRef, *mut c_void);
549552
pub type InlineAsmDiagHandler = unsafe extern "C" fn(SMDiagnosticRef, *const c_void, c_uint);
@@ -1149,14 +1152,15 @@ extern {
11491152
Addr: ValueRef,
11501153
NumDests: c_uint)
11511154
-> ValueRef;
1152-
pub fn LLVMBuildInvoke(B: BuilderRef,
1153-
Fn: ValueRef,
1154-
Args: *const ValueRef,
1155-
NumArgs: c_uint,
1156-
Then: BasicBlockRef,
1157-
Catch: BasicBlockRef,
1158-
Name: *const c_char)
1159-
-> ValueRef;
1155+
pub fn LLVMRustBuildInvoke(B: BuilderRef,
1156+
Fn: ValueRef,
1157+
Args: *const ValueRef,
1158+
NumArgs: c_uint,
1159+
Then: BasicBlockRef,
1160+
Catch: BasicBlockRef,
1161+
Bundle: OperandBundleDefRef,
1162+
Name: *const c_char)
1163+
-> ValueRef;
11601164
pub fn LLVMRustBuildLandingPad(B: BuilderRef,
11611165
Ty: TypeRef,
11621166
PersFn: ValueRef,
@@ -1167,6 +1171,31 @@ extern {
11671171
pub fn LLVMBuildResume(B: BuilderRef, Exn: ValueRef) -> ValueRef;
11681172
pub fn LLVMBuildUnreachable(B: BuilderRef) -> ValueRef;
11691173

1174+
pub fn LLVMRustBuildCleanupPad(B: BuilderRef,
1175+
ParentPad: ValueRef,
1176+
ArgCnt: c_uint,
1177+
Args: *const ValueRef,
1178+
Name: *const c_char) -> ValueRef;
1179+
pub fn LLVMRustBuildCleanupRet(B: BuilderRef,
1180+
CleanupPad: ValueRef,
1181+
UnwindBB: BasicBlockRef) -> ValueRef;
1182+
pub fn LLVMRustBuildCatchPad(B: BuilderRef,
1183+
ParentPad: ValueRef,
1184+
ArgCnt: c_uint,
1185+
Args: *const ValueRef,
1186+
Name: *const c_char) -> ValueRef;
1187+
pub fn LLVMRustBuildCatchRet(B: BuilderRef,
1188+
Pad: ValueRef,
1189+
BB: BasicBlockRef) -> ValueRef;
1190+
pub fn LLVMRustBuildCatchSwitch(Builder: BuilderRef,
1191+
ParentPad: ValueRef,
1192+
BB: BasicBlockRef,
1193+
NumHandlers: c_uint,
1194+
Name: *const c_char) -> ValueRef;
1195+
pub fn LLVMRustAddHandler(CatchSwitch: ValueRef,
1196+
Handler: BasicBlockRef);
1197+
pub fn LLVMRustSetPersonalityFn(B: BuilderRef, Pers: ValueRef);
1198+
11701199
/* Add a case to the switch instruction */
11711200
pub fn LLVMAddCase(Switch: ValueRef,
11721201
OnVal: ValueRef,
@@ -1476,12 +1505,13 @@ extern {
14761505
/* Miscellaneous instructions */
14771506
pub fn LLVMBuildPhi(B: BuilderRef, Ty: TypeRef, Name: *const c_char)
14781507
-> ValueRef;
1479-
pub fn LLVMBuildCall(B: BuilderRef,
1480-
Fn: ValueRef,
1481-
Args: *const ValueRef,
1482-
NumArgs: c_uint,
1483-
Name: *const c_char)
1484-
-> ValueRef;
1508+
pub fn LLVMRustBuildCall(B: BuilderRef,
1509+
Fn: ValueRef,
1510+
Args: *const ValueRef,
1511+
NumArgs: c_uint,
1512+
Bundle: OperandBundleDefRef,
1513+
Name: *const c_char)
1514+
-> ValueRef;
14851515
pub fn LLVMBuildSelect(B: BuilderRef,
14861516
If: ValueRef,
14871517
Then: ValueRef,
@@ -2126,6 +2156,12 @@ extern {
21262156
pub fn LLVMRustSetDataLayoutFromTargetMachine(M: ModuleRef,
21272157
TM: TargetMachineRef);
21282158
pub fn LLVMRustGetModuleDataLayout(M: ModuleRef) -> TargetDataRef;
2159+
2160+
pub fn LLVMRustBuildOperandBundleDef(Name: *const c_char,
2161+
Inputs: *const ValueRef,
2162+
NumInputs: c_uint)
2163+
-> OperandBundleDefRef;
2164+
pub fn LLVMRustFreeOperandBundleDef(Bundle: OperandBundleDefRef);
21292165
}
21302166

21312167
#[cfg(have_component_x86)]
@@ -2404,6 +2440,48 @@ pub fn initialize_available_targets() {
24042440
init_pnacl();
24052441
}
24062442

2443+
pub fn last_error() -> Option<String> {
2444+
unsafe {
2445+
let cstr = LLVMRustGetLastError();
2446+
if cstr.is_null() {
2447+
None
2448+
} else {
2449+
let err = CStr::from_ptr(cstr).to_bytes();
2450+
let err = String::from_utf8_lossy(err).to_string();
2451+
libc::free(cstr as *mut _);
2452+
Some(err)
2453+
}
2454+
}
2455+
}
2456+
2457+
pub struct OperandBundleDef {
2458+
inner: OperandBundleDefRef,
2459+
}
2460+
2461+
impl OperandBundleDef {
2462+
pub fn new(name: &str, vals: &[ValueRef]) -> OperandBundleDef {
2463+
let name = CString::new(name).unwrap();
2464+
let def = unsafe {
2465+
LLVMRustBuildOperandBundleDef(name.as_ptr(),
2466+
vals.as_ptr(),
2467+
vals.len() as c_uint)
2468+
};
2469+
OperandBundleDef { inner: def }
2470+
}
2471+
2472+
pub fn raw(&self) -> OperandBundleDefRef {
2473+
self.inner
2474+
}
2475+
}
2476+
2477+
impl Drop for OperandBundleDef {
2478+
fn drop(&mut self) {
2479+
unsafe {
2480+
LLVMRustFreeOperandBundleDef(self.inner);
2481+
}
2482+
}
2483+
}
2484+
24072485
// The module containing the native LLVM dependencies, generated by the build system
24082486
// Note that this must come after the rustllvm extern declaration so that
24092487
// parts of LLVM that rustllvm depends on aren't thrown away by the linker.

branches/stable/src/librustc_metadata/loader.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ pub fn note_crate_name(err: &mut DiagnosticBuilder, name: &str) {
729729
impl ArchiveMetadata {
730730
fn new(ar: ArchiveRO) -> Option<ArchiveMetadata> {
731731
let data = {
732-
let section = ar.iter().find(|sect| {
732+
let section = ar.iter().filter_map(|s| s.ok()).find(|sect| {
733733
sect.name() == Some(METADATA_FILENAME)
734734
});
735735
match section {

branches/stable/src/librustc_trans/back/archive.rs

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ impl<'a> ArchiveBuilder<'a> {
124124
}
125125
let archive = self.src_archive.as_ref().unwrap().as_ref().unwrap();
126126
let ret = archive.iter()
127+
.filter_map(|child| child.ok())
127128
.filter(is_relevant_child)
128129
.filter_map(|child| child.name())
129130
.filter(|name| !self.removals.iter().any(|x| x == name))
@@ -332,9 +333,15 @@ impl<'a> ArchiveBuilder<'a> {
332333
// We skip any files explicitly desired for skipping, and we also skip
333334
// all SYMDEF files as these are just magical placeholders which get
334335
// re-created when we make a new archive anyway.
335-
for file in archive.iter().filter(is_relevant_child) {
336+
for file in archive.iter() {
337+
let file = try!(file.map_err(string_to_io_error));
338+
if !is_relevant_child(&file) {
339+
continue
340+
}
336341
let filename = file.name().unwrap();
337-
if skip(filename) { continue }
342+
if skip(filename) {
343+
continue
344+
}
338345
let filename = Path::new(filename).file_name().unwrap()
339346
.to_str().unwrap();
340347

@@ -448,6 +455,7 @@ impl<'a> ArchiveBuilder<'a> {
448455
unsafe {
449456
if let Some(archive) = self.src_archive() {
450457
for child in archive.iter() {
458+
let child = try!(child.map_err(string_to_io_error));
451459
let child_name = match child.name() {
452460
Some(s) => s,
453461
None => continue,
@@ -475,10 +483,25 @@ impl<'a> ArchiveBuilder<'a> {
475483
strings.push(name);
476484
}
477485
Addition::Archive { archive, archive_name: _, mut skip } => {
478-
for child in archive.iter().filter(is_relevant_child) {
486+
for child in archive.iter() {
487+
let child = try!(child.map_err(string_to_io_error));
488+
if !is_relevant_child(&child) {
489+
continue
490+
}
479491
let child_name = child.name().unwrap();
480-
if skip(child_name) { continue }
481-
492+
if skip(child_name) {
493+
continue
494+
}
495+
496+
// It appears that LLVM's archive writer is a little
497+
// buggy if the name we pass down isn't just the
498+
// filename component, so chop that off here and
499+
// pass it in.
500+
//
501+
// See LLVM bug 25877 for more info.
502+
let child_name = Path::new(child_name)
503+
.file_name().unwrap()
504+
.to_str().unwrap();
482505
let name = try!(CString::new(child_name));
483506
let m = llvm::LLVMRustArchiveMemberNew(ptr::null(),
484507
name.as_ptr(),
@@ -517,3 +540,7 @@ impl<'a> ArchiveBuilder<'a> {
517540
}
518541
}
519542
}
543+
544+
fn string_to_io_error(s: String) -> io::Error {
545+
io::Error::new(io::ErrorKind::Other, format!("bad archive: {}", s))
546+
}

branches/stable/src/librustc_trans/back/lto.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ pub fn run(sess: &session::Session, llmod: ModuleRef,
5252
link::each_linked_rlib(sess, &mut |_, path| {
5353
let archive = ArchiveRO::open(&path).expect("wanted an rlib");
5454
let bytecodes = archive.iter().filter_map(|child| {
55-
child.name().map(|name| (name, child))
55+
child.ok().and_then(|c| c.name().map(|name| (name, c)))
5656
}).filter(|&(name, _)| name.ends_with("bytecode.deflate"));
5757
for (name, data) in bytecodes {
5858
let bc_encoded = data.data();

branches/stable/src/librustc_trans/back/write.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,16 @@ use std::collections::HashMap;
2727
use std::ffi::{CStr, CString};
2828
use std::fs;
2929
use std::path::{Path, PathBuf};
30-
use std::ptr;
3130
use std::str;
3231
use std::sync::{Arc, Mutex};
3332
use std::sync::mpsc::channel;
3433
use std::thread;
35-
use libc::{self, c_uint, c_int, c_void};
34+
use libc::{c_uint, c_int, c_void};
3635

3736
pub fn llvm_err(handler: &errors::Handler, msg: String) -> ! {
38-
unsafe {
39-
let cstr = llvm::LLVMRustGetLastError();
40-
if cstr == ptr::null() {
41-
panic!(handler.fatal(&msg[..]));
42-
} else {
43-
let err = CStr::from_ptr(cstr).to_bytes();
44-
let err = String::from_utf8_lossy(err).to_string();
45-
libc::free(cstr as *mut _);
46-
panic!(handler.fatal(&format!("{}: {}", &msg[..], &err[..])));
47-
}
37+
match llvm::last_error() {
38+
Some(err) => panic!(handler.fatal(&format!("{}: {}", msg, err))),
39+
None => panic!(handler.fatal(&msg)),
4840
}
4941
}
5042

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1271,7 +1271,8 @@ fn compile_submatch_continue<'a, 'p, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
12711271
};
12721272
}
12731273
Variant(_, ref repr, _, _) => {
1274-
let (the_kind, val_opt) = adt::trans_switch(bcx, &**repr, val.val);
1274+
let (the_kind, val_opt) = adt::trans_switch(bcx, &repr,
1275+
val.val, true);
12751276
kind = the_kind;
12761277
if let Some(tval) = val_opt { test_val = tval; }
12771278
}

0 commit comments

Comments
 (0)