Skip to content

Commit bb229f0

Browse files
committed
---
yaml --- r: 102392 b: refs/heads/master c: 37b3a60 h: refs/heads/master v: v3
1 parent d71ff35 commit bb229f0

35 files changed

+190
-467
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 68903f2cdfbdcca81335914eb3c0dba4a3d8c61f
2+
refs/heads/master: 37b3a60b78be10f01aa57d2096d96f5ab9f07656
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 6e7f170fedd3c526a643c0b2d13863acd982be02
55
refs/heads/try: a97642026c18a624ff6ea01075dd9550f8ed07ff

trunk/.travis.yml

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,28 @@ language: c
55

66
# Before we start doing anything, install a stock LLVM
77
install:
8-
- sudo apt-get install llvm-3.3 llvm-3.3-dev clang-3.3 lldb-3.3
8+
- sudo sh -c "echo 'deb http://llvm.org/apt/precise/ llvm-toolchain-precise-3.4 main' >> /etc/apt/sources.list"
9+
- sudo sh -c "echo 'deb http://llvm.org/apt/precise/ llvm-toolchain-precise main' >> /etc/apt/sources.list"
10+
- sudo sh -c "echo 'deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu precise main' >> /etc/apt/sources.list"
11+
- wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -
12+
- sudo apt-get update -qq
13+
- sudo apt-get install -qq --force-yes -y llvm-$LLVM_VERSION
14+
llvm-${LLVM_VERSION}-dev clang-$LLVM_VERSION lldb-$LLVM_VERSION
915

10-
# All of the llvm tools are suffixed with "-3.3" which we don't want, so symlink
11-
# them all into a local directory and just use that
16+
17+
# All of the llvm tools are suffixed with "-$VERS" which we don't want, so
18+
# symlink them all into a local directory and just use that
1219
#
1320
# FIXME: this shouldn't update the src/llvm sub-repo, that takes about a minute
1421
# it's gotta download so much stuff.
1522
before_script:
1623
- mkdir -p local-llvm/bin
17-
- ln -nsf /usr/bin/llvm-config-3.3 local-llvm/bin/llvm-config
18-
- ln -nsf /usr/bin/llvm-mc-3.3 local-llvm/bin/llvm-mc
19-
- ln -nsf /usr/bin/llvm-as-3.3 local-llvm/bin/llvm-as
20-
- ln -nsf /usr/bin/llvm-dis-3.3 local-llvm/bin/llvm-dis
21-
- ln -nsf /usr/bin/llc-3.3 local-llvm/bin/llc
22-
- ln -nsf /usr/include/llvm-3.3 local-llvm/include
24+
- ln -nsf /usr/bin/llvm-config-$LLVM_VERSION local-llvm/bin/llvm-config
25+
- ln -nsf /usr/bin/llvm-mc-$LLVM_VERSION local-llvm/bin/llvm-mc
26+
- ln -nsf /usr/bin/llvm-as-$LLVM_VERSION local-llvm/bin/llvm-as
27+
- ln -nsf /usr/bin/llvm-dis-$LLVM_VERSION local-llvm/bin/llvm-dis
28+
- ln -nsf /usr/bin/llc-$LLVM_VERSION local-llvm/bin/llc
29+
- ln -nsf /usr/include/llvm-$LLVM_VERSION local-llvm/include
2330
- ./configure --disable-optimize-tests --llvm-root=`pwd`/local-llvm --enable-fast-make --enable-clang
2431

2532
# Tidy everything up first, then build a few things, and then run a few tests.
@@ -29,14 +36,28 @@ before_script:
2936
# As a result of https://github.com/travis-ci/travis-ci/issues/1066, we run
3037
# everything in one large command instead of multiple commands.
3138
script: |
39+
if [[ $TRAVIS_PULL_REQUEST != 'false' ]]; then
40+
if [[ $LLVM_VERSION != '3.4' ]]; then exit 0; fi
41+
fi &&
3242
make tidy &&
3343
make -j4 rustc-stage1 &&
3444
make check-stage1-std check-stage1-rpass check-stage1-cfail check-stage1-rfail
3545
3646
env:
37-
- NO_BENCH=1
47+
global:
48+
- NO_BENCH=1
49+
matrix:
50+
- LLVM_VERSION=3.3
51+
- LLVM_VERSION=3.4
3852

3953
# We track this ourselves, and in theory we don't have to update the LLVM repo
4054
# (but sadly we do right now anyway).
4155
git:
4256
submodules: false
57+
58+
notifications:
59+
email: false
60+
61+
branches:
62+
only:
63+
- master

trunk/src/libgetopts/lib.rs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -455,25 +455,6 @@ pub fn optmulti(short_name: &str, long_name: &str, desc: &str, hint: &str) -> Op
455455
}
456456
}
457457

458-
/// Create a generic option group, stating all parameters explicitly
459-
pub fn opt(short_name: &str,
460-
long_name: &str,
461-
desc: &str,
462-
hint: &str,
463-
hasarg: HasArg,
464-
occur: Occur) -> OptGroup {
465-
let len = short_name.len();
466-
assert!(len == 1 || len == 0);
467-
OptGroup {
468-
short_name: short_name.to_owned(),
469-
long_name: long_name.to_owned(),
470-
hint: hint.to_owned(),
471-
desc: desc.to_owned(),
472-
hasarg: hasarg,
473-
occur: occur
474-
}
475-
}
476-
477458
impl Fail_ {
478459
/// Convert a `Fail_` enum into an error string.
479460
pub fn to_err_msg(self) -> ~str {

trunk/src/libstd/rt/bookkeeping.rs renamed to trunk/src/libnative/bookkeeping.rs

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,16 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
//! Task bookkeeping
11+
//! 1:1 Task bookkeeping
1212
//!
13-
//! This module keeps track of the number of running tasks so that entry points
14-
//! with libnative know when it's possible to exit the program (once all tasks
15-
//! have exited).
13+
//! This module keeps track of the number of running 1:1 tasks so that entry
14+
//! points with libnative know when it's possible to exit the program (once all
15+
//! tasks have exited).
1616
//!
17-
//! The green counterpart for this is bookkeeping on sched pools, and it's up to
18-
//! each respective runtime to make sure that they call increment() and
19-
//! decrement() manually.
17+
//! The green counterpart for this is bookkeeping on sched pools.
2018
21-
#[experimental]; // this is a massive code smell
22-
#[doc(hidden)];
23-
24-
use sync::atomics;
25-
use unstable::mutex::{StaticNativeMutex, NATIVE_MUTEX_INIT};
19+
use std::sync::atomics;
20+
use std::unstable::mutex::{StaticNativeMutex, NATIVE_MUTEX_INIT};
2621

2722
static mut TASK_COUNT: atomics::AtomicUint = atomics::INIT_ATOMIC_UINT;
2823
static mut TASK_LOCK: StaticNativeMutex = NATIVE_MUTEX_INIT;
@@ -44,9 +39,12 @@ pub fn decrement() {
4439
/// the entry points of native programs
4540
pub fn wait_for_other_tasks() {
4641
unsafe {
47-
let mut guard = TASK_LOCK.lock();
48-
while TASK_COUNT.load(atomics::SeqCst) > 0 {
49-
guard.wait();
42+
{
43+
let mut guard = TASK_LOCK.lock();
44+
while TASK_COUNT.load(atomics::SeqCst) > 0 {
45+
guard.wait();
46+
}
5047
}
48+
TASK_LOCK.destroy();
5149
}
5250
}

trunk/src/libnative/io/file_unix.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ use std::libc;
1919
use std::mem;
2020
use std::rt::rtio;
2121
use std::vec;
22-
use std::vec_ng::Vec;
2322

2423
use io::{IoResult, retry, keep_going};
2524

@@ -342,7 +341,7 @@ pub fn mkdir(p: &CString, mode: io::FilePermission) -> IoResult<()> {
342341

343342
pub fn readdir(p: &CString) -> IoResult<~[Path]> {
344343
use std::libc::{dirent_t};
345-
use std::libc::{opendir, readdir_r, closedir};
344+
use std::libc::{opendir, readdir, closedir};
346345

347346
fn prune(root: &CString, dirs: ~[Path]) -> ~[Path] {
348347
let root = unsafe { CString::new(root.with_ref(|p| p), false) };
@@ -354,28 +353,23 @@ pub fn readdir(p: &CString) -> IoResult<~[Path]> {
354353
}
355354

356355
extern {
357-
fn rust_dirent_t_size() -> libc::c_int;
358-
fn rust_list_dir_val(ptr: *mut dirent_t) -> *libc::c_char;
356+
fn rust_list_dir_val(ptr: *dirent_t) -> *libc::c_char;
359357
}
360358

361-
let size = unsafe { rust_dirent_t_size() };
362-
let mut buf = Vec::<u8>::with_capacity(size as uint);
363-
let ptr = buf.as_mut_slice().as_mut_ptr() as *mut dirent_t;
364-
365359
debug!("os::list_dir -- BEFORE OPENDIR");
366360

367361
let dir_ptr = p.with_ref(|buf| unsafe { opendir(buf) });
368362

369363
if dir_ptr as uint != 0 {
370364
let mut paths = ~[];
371365
debug!("os::list_dir -- opendir() SUCCESS");
372-
let mut entry_ptr = 0 as *mut dirent_t;
373-
while unsafe { readdir_r(dir_ptr, ptr, &mut entry_ptr) == 0 } {
374-
if entry_ptr.is_null() { break }
366+
let mut entry_ptr = unsafe { readdir(dir_ptr) };
367+
while entry_ptr as uint != 0 {
375368
let cstr = unsafe {
376369
CString::new(rust_list_dir_val(entry_ptr), false)
377370
};
378371
paths.push(Path::new(cstr));
372+
entry_ptr = unsafe { readdir(dir_ptr) };
379373
}
380374
assert_eq!(unsafe { closedir(dir_ptr) }, 0);
381375
Ok(prune(p, paths))

trunk/src/libnative/io/timer_helper.rs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
//! time.
2222
2323
use std::cast;
24-
use std::rt::bookkeeping;
2524
use std::rt;
2625
use std::unstable::mutex::{StaticNativeMutex, NATIVE_MUTEX_INIT};
2726

27+
use bookkeeping;
2828
use io::timer::{Req, Shutdown};
2929
use task;
3030

@@ -36,8 +36,6 @@ use task;
3636
static mut HELPER_CHAN: *mut Chan<Req> = 0 as *mut Chan<Req>;
3737
static mut HELPER_SIGNAL: imp::signal = 0 as imp::signal;
3838

39-
static mut TIMER_HELPER_EXIT: StaticNativeMutex = NATIVE_MUTEX_INIT;
40-
4139
pub fn boot(helper: fn(imp::signal, Port<Req>)) {
4240
static mut LOCK: StaticNativeMutex = NATIVE_MUTEX_INIT;
4341
static mut INITIALIZED: bool = false;
@@ -55,7 +53,6 @@ pub fn boot(helper: fn(imp::signal, Port<Req>)) {
5553
task::spawn(proc() {
5654
bookkeeping::decrement();
5755
helper(receive, msgp);
58-
TIMER_HELPER_EXIT.lock().signal()
5956
});
6057

6158
rt::at_exit(proc() { shutdown() });
@@ -73,15 +70,17 @@ pub fn send(req: Req) {
7370
}
7471

7572
fn shutdown() {
76-
// Request a shutdown, and then wait for the task to exit
77-
unsafe {
78-
let mut guard = TIMER_HELPER_EXIT.lock();
79-
send(Shutdown);
80-
guard.wait();
81-
drop(guard);
82-
TIMER_HELPER_EXIT.destroy();
83-
}
73+
// We want to wait for the entire helper task to exit, and in doing so it
74+
// will attempt to decrement the global task count. When the helper was
75+
// created, it decremented the count so it wouldn't count towards preventing
76+
// the program to exit, so here we pair that manual decrement with a manual
77+
// increment. We will then wait for the helper thread to exit by calling
78+
// wait_for_other_tasks.
79+
bookkeeping::increment();
8480

81+
// Request a shutdown, and then wait for the task to exit
82+
send(Shutdown);
83+
bookkeeping::wait_for_other_tasks();
8584

8685
// Clean up after ther helper thread
8786
unsafe {

trunk/src/libnative/io/timer_other.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -218,15 +218,8 @@ impl Timer {
218218
}
219219

220220
pub fn sleep(ms: u64) {
221-
let mut to_sleep = libc::timespec {
222-
tv_sec: (ms / 1000) as libc::time_t,
223-
tv_nsec: ((ms % 1000) * 1000000) as libc::c_long,
224-
};
225-
while unsafe { libc::nanosleep(&to_sleep, &mut to_sleep) } != 0 {
226-
if os::errno() as int != libc::EINTR as int {
227-
fail!("failed to sleep, but not because of EINTR?");
228-
}
229-
}
221+
// FIXME: this can fail because of EINTR, what do do?
222+
let _ = unsafe { libc::usleep((ms * 1000) as libc::c_uint) };
230223
}
231224

232225
fn inner(&mut self) -> ~Inner {

trunk/src/libnative/io/timer_timerfd.rs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
//! why).
2424
//!
2525
//! As with timer_other, timers just using sleep() do not use the timerfd at
26-
//! all. They remove the timerfd from the worker thread and then invoke
27-
//! nanosleep() to block the calling thread.
26+
//! all. They remove the timerfd from the worker thread and then invoke usleep()
27+
//! to block the calling thread.
2828
//!
2929
//! As with timer_other, all units in this file are in units of millseconds.
3030
@@ -183,15 +183,8 @@ impl Timer {
183183
}
184184

185185
pub fn sleep(ms: u64) {
186-
let mut to_sleep = libc::timespec {
187-
tv_sec: (ms / 1000) as libc::time_t,
188-
tv_nsec: ((ms % 1000) * 1000000) as libc::c_long,
189-
};
190-
while unsafe { libc::nanosleep(&to_sleep, &mut to_sleep) } != 0 {
191-
if os::errno() as int != libc::EINTR as int {
192-
fail!("failed to sleep, but not because of EINTR?");
193-
}
194-
}
186+
// FIXME: this can fail because of EINTR, what do do?
187+
let _ = unsafe { libc::usleep((ms * 1000) as libc::c_uint) };
195188
}
196189

197190
fn remove(&mut self) {

trunk/src/libnative/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
use std::os;
5959
use std::rt;
6060

61+
mod bookkeeping;
6162
pub mod io;
6263
pub mod task;
6364

@@ -104,5 +105,6 @@ pub fn start(argc: int, argv: **u8, main: proc()) -> int {
104105
/// number of arguments.
105106
pub fn run(main: proc()) -> int {
106107
main();
108+
bookkeeping::wait_for_other_tasks();
107109
os::get_exit_status()
108110
}

trunk/src/libnative/task.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@
1616
1717
use std::any::Any;
1818
use std::cast;
19-
use std::rt::bookkeeping;
2019
use std::rt::env;
2120
use std::rt::local::Local;
2221
use std::rt::rtio;
23-
use std::rt::stack;
2422
use std::rt::task::{Task, BlockedTask, SendMessage};
2523
use std::rt::thread::Thread;
2624
use std::rt;
2725
use std::task::TaskOpts;
2826
use std::unstable::mutex::NativeMutex;
27+
use std::rt::stack;
2928

3029
use io;
3130
use task;
31+
use bookkeeping;
3232

3333
/// Creates a new Task which is ready to execute as a 1:1 task.
3434
pub fn new(stack_bounds: (uint, uint)) -> ~Task {

trunk/src/librustc/back/link.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use back::archive::{Archive, METADATA_FILENAME};
1212
use back::rpath;
1313
use back::svh::Svh;
1414
use driver::driver::{CrateTranslation, OutputFilenames};
15-
use driver::session::{NoDebugInfo, Session};
15+
use driver::session::Session;
1616
use driver::session;
1717
use lib::llvm::llvm;
1818
use lib::llvm::ModuleRef;
@@ -92,7 +92,7 @@ pub mod write {
9292
use back::link::{OutputTypeExe, OutputTypeLlvmAssembly};
9393
use back::link::{OutputTypeObject};
9494
use driver::driver::{CrateTranslation, OutputFilenames};
95-
use driver::session::{NoDebugInfo, Session};
95+
use driver::session::Session;
9696
use driver::session;
9797
use lib::llvm::llvm;
9898
use lib::llvm::{ModuleRef, TargetMachineRef, PassManagerRef};
@@ -148,7 +148,7 @@ pub mod write {
148148

149149
// FIXME: #11906: Omitting frame pointers breaks retrieving the value of a parameter.
150150
// FIXME: #11954: mac64 unwinding may not work with fp elim
151-
let no_fp_elim = (sess.opts.debuginfo != NoDebugInfo) ||
151+
let no_fp_elim = sess.opts.debuginfo ||
152152
(sess.targ_cfg.os == abi::OsMacos &&
153153
sess.targ_cfg.arch == abi::X86_64);
154154

@@ -1052,7 +1052,7 @@ fn link_natively(sess: Session, dylib: bool, obj_filename: &Path,
10521052

10531053
// On OSX, debuggers need this utility to get run to do some munging of
10541054
// the symbols
1055-
if sess.targ_cfg.os == abi::OsMacos && (sess.opts.debuginfo != NoDebugInfo) {
1055+
if sess.targ_cfg.os == abi::OsMacos && sess.opts.debuginfo {
10561056
// FIXME (#9639): This needs to handle non-utf8 paths
10571057
match Process::status("dsymutil",
10581058
[out_filename.as_str().unwrap().to_owned()]) {

0 commit comments

Comments
 (0)