Skip to content

Commit 5ef8cdb

Browse files
committed
auto merge of #8866 : brson/rust/rvstdrun, r=alexcrichton
...ing, r=brson" This reverts commit b8d1fa3, reversing changes made to f22b4b1. Conflicts: mk/rt.mk src/libuv This caused a big performance regression on the windows bots and possibly some unexpected segfaults in pretty-printing tests.
2 parents 698873e + 3c5a43e commit 5ef8cdb

27 files changed

+1126
-1158
lines changed

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
branch = master
55
[submodule "src/libuv"]
66
path = src/libuv
7-
url = https://github.com/alexcrichton/libuv.git
7+
url = https://github.com/brson/libuv.git
88
branch = master

mk/rt.mk

Lines changed: 10 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -168,58 +168,36 @@ LIBUV_DEPS := $$(wildcard \
168168
$$(S)src/libuv/*/*/*/*)
169169
endif
170170

171-
LIBUV_GYP := $$(S)src/libuv/build/gyp
172-
LIBUV_MAKEFILE_$(1)_$(2) := $$(CFG_BUILD_DIR)rt/$(1)/stage$(2)/libuv/Makefile
173-
LIBUV_NO_LOAD = run-benchmarks.target.mk run-tests.target.mk \
174-
uv_dtrace_header.target.mk uv_dtrace_provider.target.mk
175-
176-
ifeq ($(OSTYPE_$(1)), linux-androideabi)
177-
$$(LIBUV_MAKEFILE_$(1)_$(2)): $$(LIBUV_GYP)
178-
(cd $(S)src/libuv/ && \
179-
$$(CFG_PYTHON) ./gyp_uv -f make -Dtarget_arch=$$(LIBUV_ARCH_$(1)) -D ninja -DOS=android \
180-
-Goutput_dir=$$(@D) --generator-output $$(@D))
181-
else
182-
$$(LIBUV_MAKEFILE_$(1)_$(2)): $$(LIBUV_GYP)
183-
(cd $(S)src/libuv/ && \
184-
$$(CFG_PYTHON) ./gyp_uv -f make -Dtarget_arch=$$(LIBUV_ARCH_$(1)) -D ninja \
185-
-Goutput_dir=$$(@D) --generator-output $$(@D))
186-
endif
187-
188171
# XXX: Shouldn't need platform-specific conditions here
189172
ifdef CFG_WINDOWSY_$(1)
190173
$$(LIBUV_LIB_$(1)_$(2)): $$(LIBUV_DEPS)
191-
$$(Q)rm -f $$(S)src/libuv/libuv.a
192-
$$(Q)$$(MAKE) -C $$(S)src/libuv -f Makefile.mingw \
193-
CFLAGS="$$(CFG_GCCISH_CFLAGS) $$(LIBUV_FLAGS_$$(HOST_$(1))) $$(SNAP_DEFINES)" \
194-
AR="$$(AR_$(1))" \
174+
$$(Q)$$(MAKE) -C $$(S)src/libuv/ \
175+
builddir_name="$$(CFG_BUILD_DIR)/rt/$(1)/stage$(2)/libuv" \
176+
OS=mingw \
195177
V=$$(VERBOSE)
196-
$$(Q)cp $$(S)src/libuv/libuv.a $$@
197178
else ifeq ($(OSTYPE_$(1)), linux-androideabi)
198-
$$(LIBUV_LIB_$(1)_$(2)): $$(LIBUV_DEPS) $$(LIBUV_MAKEFILE_$(1)_$(2))
199-
$$(Q)$$(MAKE) -C $$(@D) \
179+
$$(LIBUV_LIB_$(1)_$(2)): $$(LIBUV_DEPS)
180+
$$(Q)$$(MAKE) -C $$(S)src/libuv/ \
200181
CFLAGS="$$(CFG_GCCISH_CFLAGS) $$(LIBUV_FLAGS_$$(HOST_$(1))) $$(SNAP_DEFINES)" \
201182
LDFLAGS="$$(CFG_GCCISH_LINK_FLAGS) $$(LIBUV_FLAGS_$$(HOST_$(1)))" \
202183
CC="$$(CC_$(1))" \
203184
CXX="$$(CXX_$(1))" \
204185
LINK="$$(CXX_$(1))" \
205186
AR="$$(AR_$(1))" \
206-
host=android OS=linux \
207187
PLATFORM=android \
208-
builddir="." \
209188
BUILDTYPE=Release \
210-
NO_LOAD="$$(LIBUV_NO_LOAD)" \
189+
builddir_name="$$(CFG_BUILD_DIR)/rt/$(1)/stage$(2)/libuv" \
190+
host=android OS=linux \
211191
V=$$(VERBOSE)
212192
else
213-
$$(LIBUV_LIB_$(1)_$(2)): $$(LIBUV_DEPS) $$(LIBUV_MAKEFILE_$(1)_$(2))
214-
$$(Q)$$(MAKE) -C $$(@D) \
193+
$$(LIBUV_LIB_$(1)_$(2)): $$(LIBUV_DEPS)
194+
$$(Q)$$(MAKE) -C $$(S)src/libuv/ \
215195
CFLAGS="$$(CFG_GCCISH_CFLAGS) $$(LIBUV_FLAGS_$$(HOST_$(1))) $$(SNAP_DEFINES)" \
216196
LDFLAGS="$$(CFG_GCCISH_LINK_FLAGS) $$(LIBUV_FLAGS_$$(HOST_$(1)))" \
217197
CC="$$(CC_$(1))" \
218198
CXX="$$(CXX_$(1))" \
219199
AR="$$(AR_$(1))" \
220-
builddir="." \
221-
BUILDTYPE=Release \
222-
NO_LOAD="$$(LIBUV_NO_LOAD)" \
200+
builddir_name="$$(CFG_BUILD_DIR)/rt/$(1)/stage$(2)/libuv" \
223201
V=$$(VERBOSE)
224202
endif
225203

@@ -283,7 +261,3 @@ endef
283261
$(foreach stage,$(STAGES), \
284262
$(foreach target,$(CFG_TARGET_TRIPLES), \
285263
$(eval $(call DEF_RUNTIME_TARGETS,$(target),$(stage)))))
286-
287-
$(LIBUV_GYP):
288-
mkdir -p $(S)src/libuv/build
289-
git clone https://git.chromium.org/external/gyp.git $(S)src/libuv/build/gyp

src/compiletest/procsrv.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ pub fn run(lib_path: &str,
5454
in_fd: None,
5555
out_fd: None,
5656
err_fd: None
57-
}).unwrap();
57+
});
5858

5959
for input in input.iter() {
60-
proc.input().write(input.as_bytes());
60+
proc.input().write_str(*input);
6161
}
6262
let output = proc.finish_with_output();
6363

src/compiletest/runtest.rs

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,41 @@ use procsrv;
2020
use util;
2121
use util::logv;
2222

23+
use std::cell::Cell;
2324
use std::io;
2425
use std::os;
2526
use std::str;
27+
use std::task::{spawn_sched, SingleThreaded};
2628
use std::vec;
29+
use std::unstable::running_on_valgrind;
2730

2831
use extra::test::MetricMap;
2932

3033
pub fn run(config: config, testfile: ~str) {
31-
let mut _mm = MetricMap::new();
32-
run_metrics(config, testfile, &mut _mm);
34+
let config = Cell::new(config);
35+
let testfile = Cell::new(testfile);
36+
// FIXME #6436: Creating another thread to run the test because this
37+
// is going to call waitpid. The new scheduler has some strange
38+
// interaction between the blocking tasks and 'friend' schedulers
39+
// that destroys parallelism if we let normal schedulers block.
40+
// It should be possible to remove this spawn once std::run is
41+
// rewritten to be non-blocking.
42+
//
43+
// We do _not_ create another thread if we're running on V because
44+
// it serializes all threads anyways.
45+
if running_on_valgrind() {
46+
let config = config.take();
47+
let testfile = testfile.take();
48+
let mut _mm = MetricMap::new();
49+
run_metrics(config, testfile, &mut _mm);
50+
} else {
51+
do spawn_sched(SingleThreaded) {
52+
let config = config.take();
53+
let testfile = testfile.take();
54+
let mut _mm = MetricMap::new();
55+
run_metrics(config, testfile, &mut _mm);
56+
}
57+
}
3358
}
3459

3560
pub fn run_metrics(config: config, testfile: ~str, mm: &mut MetricMap) {

src/librustdoc/markdown_writer.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,14 @@ fn pandoc_writer(
104104
];
105105
106106
do generic_writer |markdown| {
107+
use std::io::WriterUtil;
108+
107109
debug!("pandoc cmd: %s", pandoc_cmd);
108110
debug!("pandoc args: %s", pandoc_args.connect(" "));
109111

110-
let proc = run::Process::new(pandoc_cmd, pandoc_args,
111-
run::ProcessOptions::new());
112-
let mut proc = proc.unwrap();
112+
let mut proc = run::Process::new(pandoc_cmd, pandoc_args, run::ProcessOptions::new());
113113

114-
proc.input().write(markdown.as_bytes());
114+
proc.input().write_str(markdown);
115115
let output = proc.finish_with_output();
116116

117117
debug!("pandoc result: %i", output.status);

src/librustpkg/source_control.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ pub fn git_clone_general(source: &str, target: &Path, v: &Version) -> bool {
8989

9090
fn process_output_in_cwd(prog: &str, args: &[~str], cwd: &Path) -> ProcessOutput {
9191
let mut prog = Process::new(prog, args, ProcessOptions{ dir: Some(cwd)
92-
,..ProcessOptions::new()}).unwrap();
92+
,..ProcessOptions::new()});
9393
prog.finish_with_output()
9494
}
9595

src/librustpkg/tests.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,13 @@ fn mk_temp_workspace(short_name: &Path, version: &Version) -> Path {
112112

113113
fn run_git(args: &[~str], env: Option<~[(~str, ~str)]>, cwd: &Path, err_msg: &str) {
114114
let cwd = (*cwd).clone();
115-
let prog = run::Process::new("git", args, run::ProcessOptions {
115+
let mut prog = run::Process::new("git", args, run::ProcessOptions {
116116
env: env,
117117
dir: Some(&cwd),
118118
in_fd: None,
119119
out_fd: None,
120120
err_fd: None
121121
});
122-
let mut prog = prog.unwrap();
123122
let rslt = prog.finish_with_output();
124123
if rslt.status != 0 {
125124
fail!("%s [git returned %?, output = %s, error = %s]", err_msg,
@@ -227,7 +226,7 @@ fn command_line_test_with_env(args: &[~str], cwd: &Path, env: Option<~[(~str, ~s
227226
in_fd: None,
228227
out_fd: None,
229228
err_fd: None
230-
}).unwrap();
229+
});
231230
let output = prog.finish_with_output();
232231
debug!("Output from command %s with args %? was %s {%s}[%?]",
233232
cmd, args, str::from_bytes(output.output),
@@ -1028,17 +1027,16 @@ fn test_extern_mod() {
10281027
test_sysroot().to_str(),
10291028
exec_file.to_str());
10301029
1031-
let prog = run::Process::new(rustc.to_str(), [main_file.to_str(),
1032-
~"--sysroot", test_sysroot().to_str(),
1033-
~"-o", exec_file.to_str()],
1034-
run::ProcessOptions {
1030+
let mut prog = run::Process::new(rustc.to_str(), [main_file.to_str(),
1031+
~"--sysroot", test_sysroot().to_str(),
1032+
~"-o", exec_file.to_str()],
1033+
run::ProcessOptions {
10351034
env: env,
10361035
dir: Some(&dir),
10371036
in_fd: None,
10381037
out_fd: None,
10391038
err_fd: None
10401039
});
1041-
let mut prog = prog.unwrap();
10421040
let outp = prog.finish_with_output();
10431041
if outp.status != 0 {
10441042
fail!("output was %s, error was %s",

src/libstd/rt/io/file.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ pub struct FileStream {
7171
last_nread: int,
7272
}
7373

74+
impl FileStream {
75+
}
76+
7477
impl Reader for FileStream {
7578
fn read(&mut self, buf: &mut [u8]) -> Option<uint> {
7679
match self.fd.read(buf) {

src/libstd/rt/io/mod.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,9 +268,6 @@ pub use self::extensions::WriterByteConversions;
268268
/// Synchronous, non-blocking file I/O.
269269
pub mod file;
270270

271-
/// Synchronous, in-memory I/O.
272-
pub mod pipe;
273-
274271
/// Synchronous, non-blocking network I/O.
275272
pub mod net {
276273
pub mod tcp;

src/libstd/rt/io/net/tcp.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use rt::io::{io_error, read_error, EndOfFile};
1616
use rt::rtio::{IoFactory, IoFactoryObject,
1717
RtioSocket, RtioTcpListener,
1818
RtioTcpListenerObject, RtioTcpStream,
19-
RtioTcpStreamObject, RtioStream};
19+
RtioTcpStreamObject};
2020
use rt::local::Local;
2121

2222
pub struct TcpStream(~RtioTcpStreamObject);
@@ -69,7 +69,7 @@ impl TcpStream {
6969

7070
impl Reader for TcpStream {
7171
fn read(&mut self, buf: &mut [u8]) -> Option<uint> {
72-
match (***self).read(buf) {
72+
match (**self).read(buf) {
7373
Ok(read) => Some(read),
7474
Err(ioerr) => {
7575
// EOF is indicated by returning None
@@ -86,7 +86,7 @@ impl Reader for TcpStream {
8686

8787
impl Writer for TcpStream {
8888
fn write(&mut self, buf: &[u8]) {
89-
match (***self).write(buf) {
89+
match (**self).write(buf) {
9090
Ok(_) => (),
9191
Err(ioerr) => io_error::cond.raise(ioerr),
9292
}
@@ -166,7 +166,7 @@ mod test {
166166
do run_in_newsched_task {
167167
let mut called = false;
168168
do io_error::cond.trap(|e| {
169-
assert_eq!(e.kind, ConnectionRefused);
169+
assert!(e.kind == ConnectionRefused);
170170
called = true;
171171
}).inside {
172172
let addr = SocketAddr { ip: Ipv4Addr(0, 0, 0, 0), port: 1 };

src/libstd/rt/io/pipe.rs

Lines changed: 0 additions & 77 deletions
This file was deleted.

0 commit comments

Comments
 (0)