Skip to content

Commit 674ceeb

Browse files
committed
---
yaml --- r: 97277 b: refs/heads/dist-snap c: 8f26d0b h: refs/heads/master i: 97275: a9bb881 v: v3
1 parent 31c4642 commit 674ceeb

File tree

15 files changed

+130
-251
lines changed

15 files changed

+130
-251
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: c274a6888410ce3e357e014568b43310ed787d36
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: 2897549d513ad6fa83a4eaee468e691a84d32055
9+
refs/heads/dist-snap: 8f26d0b9b8725fa74dc36fcf4abf45dc1ca8c56a
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/driver/driver.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,7 @@ extern mod this = "rustdoc";
1919
#[cfg(rustc)]
2020
extern mod this = "rustc";
2121

22+
#[cfg(rustdoc_ng)]
23+
extern mod this = "rustdoc_ng";
24+
2225
fn main() { this::main() }

branches/dist-snap/src/etc/emacs/rust-mode.el

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,7 @@
5454
;; We don't want to indent out to the open bracket if the
5555
;; open bracket ends the line
5656
(when (not (looking-at "[[:blank:]]*\\(?://.*\\)?$"))
57-
(when (looking-at "[[:space:]]")
58-
(forward-word 1)
59-
(backward-word 1))
57+
(when (looking-at "[[:space:]]") (forward-to-word 1))
6058
(current-column))))
6159

6260
(defun rust-mode-indent-line ()

branches/dist-snap/src/libnative/io/net.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,14 +205,19 @@ pub fn init() {
205205
}
206206

207207
unsafe {
208-
use std::unstable::mutex::{Once, ONCE_INIT};
209-
static mut INIT: Once = ONCE_INIT;
210-
INIT.doit(|| {
208+
use std::unstable::mutex::{Mutex, MUTEX_INIT};
209+
static mut LOCK: Mutex = MUTEX_INIT;
210+
static mut INITIALIZED: bool = false;
211+
if INITIALIZED { return }
212+
LOCK.lock();
213+
if !INITIALIZED {
211214
let mut data: WSADATA = intrinsics::init();
212215
let ret = WSAStartup(0x202, // version 2.2
213216
&mut data);
214217
assert_eq!(ret, 0);
215-
});
218+
INITIALIZED = true;
219+
}
220+
LOCK.unlock();
216221
}
217222
}
218223

branches/dist-snap/src/librustc/back/link.rs

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ use std::run;
3434
use std::str;
3535
use std::io;
3636
use std::io::fs;
37-
use extra::hex::ToHex;
3837
use extra::tempfile::TempDir;
3938
use syntax::abi;
4039
use syntax::ast;
@@ -310,8 +309,9 @@ pub mod write {
310309
}
311310

312311
unsafe fn configure_llvm(sess: Session) {
313-
use std::unstable::mutex::{Once, ONCE_INIT};
314-
static mut INIT: Once = ONCE_INIT;
312+
use std::unstable::mutex::{MUTEX_INIT, Mutex};
313+
static mut LOCK: Mutex = MUTEX_INIT;
314+
static mut CONFIGURED: bool = false;
315315

316316
// Copy what clan does by turning on loop vectorization at O2 and
317317
// slp vectorization at O3
@@ -340,7 +340,8 @@ pub mod write {
340340
add(*arg);
341341
}
342342

343-
INIT.doit(|| {
343+
LOCK.lock();
344+
if !CONFIGURED {
344345
llvm::LLVMInitializePasses();
345346

346347
// Only initialize the platforms supported by Rust here, because
@@ -367,7 +368,9 @@ pub mod write {
367368

368369
llvm::LLVMRustSetLLVMOptions(llvm_args.len() as c_int,
369370
llvm_args.as_ptr());
370-
});
371+
CONFIGURED = true;
372+
}
373+
LOCK.unlock();
371374
}
372375

373376
unsafe fn populate_llvm_passes(fpm: lib::llvm::PassManagerRef,
@@ -491,10 +494,8 @@ pub fn build_link_meta(sess: Session,
491494
}
492495
}
493496

494-
fn truncated_hash_result(symbol_hasher: &mut Sha256) -> ~str {
495-
let output = symbol_hasher.result_bytes();
496-
// 64 bits should be enough to avoid collisions.
497-
output.slice_to(8).to_hex()
497+
pub fn truncated_hash_result(symbol_hasher: &mut Sha256) -> ~str {
498+
symbol_hasher.result_str()
498499
}
499500

500501

@@ -882,11 +883,8 @@ fn link_rlib(sess: Session,
882883
match trans {
883884
Some(trans) => {
884885
// Instead of putting the metadata in an object file section, rlibs
885-
// contain the metadata in a separate file. We use a temp directory
886-
// here so concurrent builds in the same directory don't try to use
887-
// the same filename for metadata (stomping over one another)
888-
let tmpdir = TempDir::new("rustc").expect("needs a temp dir");
889-
let metadata = tmpdir.path().join(METADATA_FILENAME);
886+
// contain the metadata in a separate file.
887+
let metadata = obj_filename.with_filename(METADATA_FILENAME);
890888
fs::File::create(&metadata).write(trans.metadata);
891889
a.add_file(&metadata, false);
892890
fs::unlink(&metadata);

branches/dist-snap/src/librustc/lib/llvm.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1459,16 +1459,15 @@ pub mod llvm {
14591459
BufferName: *c_char)
14601460
-> MemoryBufferRef;
14611461

1462-
pub fn LLVMIsMultithreaded() -> Bool;
1463-
pub fn LLVMStartMultithreaded() -> Bool;
1464-
14651462
/** Returns a string describing the last error caused by an LLVMRust*
14661463
call. */
14671464
pub fn LLVMRustGetLastError() -> *c_char;
14681465

14691466
/// Print the pass timings since static dtors aren't picking them up.
14701467
pub fn LLVMRustPrintPassTimings();
14711468

1469+
pub fn LLVMRustStartMultithreading() -> bool;
1470+
14721471
pub fn LLVMStructCreateNamed(C: ContextRef, Name: *c_char) -> TypeRef;
14731472

14741473
pub fn LLVMStructSetBody(StructTy: TypeRef,

branches/dist-snap/src/librustc/metadata/encoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1140,7 +1140,7 @@ fn encode_info_for_item(ecx: &EncodeContext,
11401140
let impl_vtables = ty::lookup_impl_vtables(tcx, def_id);
11411141
encode_impl_vtables(ebml_w, ecx, &impl_vtables);
11421142
}
1143-
let elt = ast_map::impl_pretty_name(opt_trait, ty, item.ident);
1143+
let elt = ast_map::impl_pretty_name(opt_trait, ty);
11441144
encode_path(ecx, ebml_w, path, elt);
11451145
ebml_w.end_tag();
11461146

branches/dist-snap/src/librustc/middle/trans/base.rs

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3189,21 +3189,8 @@ pub fn trans_crate(sess: session::Session,
31893189
analysis: &CrateAnalysis,
31903190
output: &Path) -> CrateTranslation {
31913191
// Before we touch LLVM, make sure that multithreading is enabled.
3192-
unsafe {
3193-
use std::unstable::mutex::{Once, ONCE_INIT};
3194-
static mut INIT: Once = ONCE_INIT;
3195-
static mut POISONED: bool = false;
3196-
INIT.doit(|| {
3197-
if llvm::LLVMStartMultithreaded() != 1 {
3198-
// use an extra bool to make sure that all future usage of LLVM
3199-
// cannot proceed despite the Once not running more than once.
3200-
POISONED = true;
3201-
}
3202-
});
3203-
3204-
if POISONED {
3205-
sess.bug("couldn't enable multi-threaded LLVM");
3206-
}
3192+
if unsafe { !llvm::LLVMRustStartMultithreading() } {
3193+
sess.bug("couldn't enable multi-threaded LLVM");
32073194
}
32083195

32093196
let mut symbol_hasher = Sha256::new();

branches/dist-snap/src/librustdoc/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ fn rust_input(cratefile: &str, matches: &getopts::Matches) -> Output {
242242
}
243243

244244
// Load all plugins/passes into a PluginManager
245-
let path = matches.opt_str("plugin-path").unwrap_or(~"/tmp/rustdoc/plugins");
245+
let path = matches.opt_str("plugin-path").unwrap_or(~"/tmp/rustdoc_ng/plugins");
246246
let mut pm = plugins::PluginManager::new(Path::new(path));
247247
for pass in passes.iter() {
248248
let plugin = match PASSES.iter().position(|&(p, _, _)| p == *pass) {

branches/dist-snap/src/libstd/path/posix.rs

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1404,45 +1404,4 @@ mod bench {
14041404
posix_home_path.ends_with_path(&Path::new("jome"));
14051405
});
14061406
}
1407-
1408-
#[bench]
1409-
fn is_ancestor_of_path_with_10_dirs(bh: &mut BenchHarness) {
1410-
let path = Path::new("/home/1/2/3/4/5/6/7/8/9");
1411-
let mut sub = path.clone();
1412-
sub.pop();
1413-
bh.iter(|| {
1414-
path.is_ancestor_of(&sub);
1415-
});
1416-
}
1417-
1418-
#[bench]
1419-
fn path_relative_from_forward(bh: &mut BenchHarness) {
1420-
let path = Path::new("/a/b/c");
1421-
let mut other = path.clone();
1422-
other.pop();
1423-
bh.iter(|| {
1424-
path.path_relative_from(&other);
1425-
});
1426-
}
1427-
1428-
#[bench]
1429-
fn path_relative_from_same_level(bh: &mut BenchHarness) {
1430-
let path = Path::new("/a/b/c");
1431-
let mut other = path.clone();
1432-
other.pop();
1433-
other.push("d");
1434-
bh.iter(|| {
1435-
path.path_relative_from(&other);
1436-
});
1437-
}
1438-
1439-
#[bench]
1440-
fn path_relative_from_backward(bh: &mut BenchHarness) {
1441-
let path = Path::new("/a/b");
1442-
let mut other = path.clone();
1443-
other.push("c");
1444-
bh.iter(|| {
1445-
path.path_relative_from(&other);
1446-
});
1447-
}
14481407
}

branches/dist-snap/src/libstd/rt/local_ptr.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,20 +160,30 @@ pub mod native {
160160
use option::{Option, Some, None};
161161
use ptr;
162162
use tls = rt::thread_local_storage;
163+
use unstable::mutex::{Mutex, MUTEX_INIT};
163164

165+
static mut LOCK: Mutex = MUTEX_INIT;
166+
static mut INITIALIZED: bool = false;
164167
static mut RT_TLS_KEY: tls::Key = -1;
165168

166169
/// Initialize the TLS key. Other ops will fail if this isn't executed
167170
/// first.
168171
pub fn init() {
169172
unsafe {
170-
tls::create(&mut RT_TLS_KEY);
173+
LOCK.lock();
174+
if !INITIALIZED {
175+
tls::create(&mut RT_TLS_KEY);
176+
INITIALIZED = true;
177+
}
178+
LOCK.unlock();
171179
}
172180
}
173181

174182
pub unsafe fn cleanup() {
175-
rtassert!(RT_TLS_KEY != -1);
183+
rtassert!(INITIALIZED);
176184
tls::destroy(RT_TLS_KEY);
185+
LOCK.destroy();
186+
INITIALIZED = false;
177187
}
178188

179189
/// Give a pointer to thread-local storage.

0 commit comments

Comments
 (0)