Skip to content

Commit b541110

Browse files
committed
---
yaml --- r: 54115 b: refs/heads/dist-snap c: 30d4124 h: refs/heads/master i: 54113: 3a9027c 54111: 0b2784a v: v3
1 parent a1f21d0 commit b541110

39 files changed

+1942
-1344
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
99
refs/heads/incoming: 44d4d6de762f3f9aae1fedcf454c66b79b3ad58d
10-
refs/heads/dist-snap: 6d4499ce4d948bf7b7b385b40e5b3536507ad3e8
10+
refs/heads/dist-snap: 30d4124a374489de1776eb1b8076ca533041fa18
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/Makefile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ $(foreach target,$(CFG_TARGET_TRIPLES),\
238238

239239
CORELIB_CRATE := $(S)src/libcore/core.rc
240240
CORELIB_INPUTS := $(wildcard $(addprefix $(S)src/libcore/, \
241-
core.rc *.rs */*.rs))
241+
core.rc *.rs */*.rs */*/*rs))
242242

243243
######################################################################
244244
# Standard library variables

branches/dist-snap/configure

Lines changed: 2 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -136,17 +136,9 @@ validate_opt () {
136136
isArgValid=1
137137
fi
138138
done
139-
if [ "$arg" = "--help" ]
139+
if test $isArgValid -eq 0
140140
then
141-
echo ""
142-
echo "No more help available for Configure options,"
143-
echo "check the Uncyclo or join our IRC channel"
144-
break
145-
else
146-
if test $isArgValid -eq 0
147-
then
148-
err "Option '$arg' is not recognized"
149-
fi
141+
err "Option '$arg' is not recognized"
150142
fi
151143
done
152144
}
@@ -274,42 +266,13 @@ case $CFG_OSTYPE in
274266
MINGW32*)
275267
CFG_OSTYPE=pc-mingw32
276268
;;
277-
# Thad's Cygwin identifers below
278-
279-
# Vista 32 bit
280-
CYGWIN_NT-6.0)
281-
CFG_OSTYPE=pc-mingw32
282-
CFG_CPUTYPE=i686
283-
;;
284-
285-
# Vista 64 bit
286-
CYGWIN_NT-6.0-WOW64)
287-
CFG_OSTYPE=w64-mingw32
288-
CFG_CPUTYPE=x86_64
289-
;;
290-
291-
# Win 7 32 bit
292-
CYGWIN_NT-6.1)
293-
CFG_OSTYPE=pc-mingw32
294-
CFG_CPUTYPE=i686
295-
;;
296269

297-
# Win 7 64 bit
298-
CYGWIN_NT-6.1-WOW64)
299-
CFG_OSTYPE=w64-mingw32
300-
CFG_CPUTYPE=x86_64
301-
;;
302-
303-
# We do not detect other OS such as XP/2003 using 64 bit using uname.
304-
# If we want to in the future, we will need to use Cygwin - Chuck's csih helper in /usr/lib/csih/winProductName.exe or alternative.
305270
*)
306271
err "unknown OS type: $CFG_OSTYPE"
307272
;;
308273
esac
309274

310275

311-
if [ -z "$CFG_CPUTYPE" ]
312-
then
313276
case $CFG_CPUTYPE in
314277

315278
i386 | i486 | i686 | i786 | x86)
@@ -327,7 +290,6 @@ case $CFG_CPUTYPE in
327290
*)
328291
err "unknown CPU type: $CFG_CPUTYPE"
329292
esac
330-
fi
331293

332294
# Detect 64 bit linux systems with 32 bit userland and force 32 bit compilation
333295
if [ $CFG_OSTYPE = unknown-linux-gnu -a $CFG_CPUTYPE = x86_64 ]

branches/dist-snap/mk/tests.mk

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,21 +244,29 @@ $(foreach host,$(CFG_HOST_TRIPLES), \
244244

245245
define TEST_RUNNER
246246

247+
# If NO_REBUILD is set then break the dependencies on std so we can
248+
# test crates without rebuilding core and std first
249+
ifeq ($(NO_REBUILD),)
250+
STDTESTDEP_$(1)_$(2)_$(3) = $$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_STDLIB_$(2))
251+
else
252+
STDTESTDEP_$(1)_$(2)_$(3) =
253+
endif
254+
247255
$(3)/test/coretest.stage$(1)-$(2)$$(X_$(2)): \
248256
$$(CORELIB_CRATE) $$(CORELIB_INPUTS) \
249-
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_STDLIB_$(2))
257+
$$(STDTESTDEP_$(1)_$(2)_$(3))
250258
@$$(call E, compile_and_link: $$@)
251259
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
252260

253261
$(3)/test/stdtest.stage$(1)-$(2)$$(X_$(2)): \
254262
$$(STDLIB_CRATE) $$(STDLIB_INPUTS) \
255-
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_STDLIB_$(2))
263+
$$(STDTESTDEP_$(1)_$(2)_$(3))
256264
@$$(call E, compile_and_link: $$@)
257265
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
258266

259267
$(3)/test/syntaxtest.stage$(1)-$(2)$$(X_$(2)): \
260268
$$(LIBSYNTAX_CRATE) $$(LIBSYNTAX_INPUTS) \
261-
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_STDLIB_$(2))
269+
$$(STDTESTDEP_$(1)_$(2)_$(3))
262270
@$$(call E, compile_and_link: $$@)
263271
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
264272

branches/dist-snap/src/compiletest/common.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ pub struct config {
6363
// Run tests using the JIT
6464
jit: bool,
6565

66+
// Run tests using the new runtime
67+
newrt: bool,
68+
6669
// Explain what's going on
6770
verbose: bool
6871

branches/dist-snap/src/compiletest/compiletest.rc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ pub fn parse_config(args: ~[~str]) -> config {
6161
getopts::optopt(~"runtool"), getopts::optopt(~"rustcflags"),
6262
getopts::optflag(~"verbose"),
6363
getopts::optopt(~"logfile"),
64-
getopts::optflag(~"jit")];
64+
getopts::optflag(~"jit"),
65+
getopts::optflag(~"newrt")];
6566

6667
fail_unless!(!args.is_empty());
6768
let args_ = vec::tail(args);
@@ -95,6 +96,7 @@ pub fn parse_config(args: ~[~str]) -> config {
9596
runtool: getopts::opt_maybe_str(matches, ~"runtool"),
9697
rustcflags: getopts::opt_maybe_str(matches, ~"rustcflags"),
9798
jit: getopts::opt_present(matches, ~"jit"),
99+
newrt: getopts::opt_present(matches, ~"newrt"),
98100
verbose: getopts::opt_present(matches, ~"verbose")
99101
}
100102
}
@@ -114,6 +116,7 @@ pub fn log_config(config: config) {
114116
logv(c, fmt!("runtool: %s", opt_str(config.runtool)));
115117
logv(c, fmt!("rustcflags: %s", opt_str(config.rustcflags)));
116118
logv(c, fmt!("jit: %b", config.jit));
119+
logv(c, fmt!("newrt: %b", config.newrt));
117120
logv(c, fmt!("verbose: %b", config.verbose));
118121
logv(c, fmt!("\n"));
119122
}

branches/dist-snap/src/compiletest/runtest.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,9 +484,17 @@ fn compile_test_(config: config, props: TestProps,
484484

485485
fn exec_compiled_test(config: config, props: TestProps,
486486
testfile: &Path) -> ProcRes {
487+
488+
// If testing the new runtime then set the RUST_NEWRT env var
489+
let env = if config.newrt {
490+
props.exec_env + ~[(~"RUST_NEWRT", ~"1")]
491+
} else {
492+
props.exec_env
493+
};
494+
487495
compose_and_run(config, testfile,
488496
make_run_args(config, props, testfile),
489-
props.exec_env,
497+
env,
490498
config.run_lib_path, None)
491499
}
492500

branches/dist-snap/src/libcore/rt/context.rs

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

11+
use option::*;
1112
use super::stack::StackSegment;
1213
use libc::c_void;
1314
use cast::{transmute, transmute_mut_unsafe,
@@ -16,17 +17,30 @@ use cast::{transmute, transmute_mut_unsafe,
1617
// XXX: Registers is boxed so that it is 16-byte aligned, for storing
1718
// SSE regs. It would be marginally better not to do this. In C++ we
1819
// use an attribute on a struct.
19-
pub struct Context(~Registers);
20+
// XXX: It would be nice to define regs as `~Option<Registers>` since
21+
// the registers are sometimes empty, but the discriminant would
22+
// then misalign the regs again.
23+
pub struct Context {
24+
/// The context entry point, saved here for later destruction
25+
start: Option<~~fn()>,
26+
/// Hold the registers while the task or scheduler is suspended
27+
regs: ~Registers
28+
}
2029

2130
pub impl Context {
2231
fn empty() -> Context {
23-
Context(new_regs())
32+
Context {
33+
start: None,
34+
regs: new_regs()
35+
}
2436
}
2537

2638
/// Create a new context that will resume execution by running ~fn()
27-
/// # Safety Note
28-
/// The `start` closure must remain valid for the life of the Task
29-
fn new(start: &~fn(), stack: &mut StackSegment) -> Context {
39+
fn new(start: ~fn(), stack: &mut StackSegment) -> Context {
40+
// XXX: Putting main into a ~ so it's a thin pointer and can
41+
// be passed to the spawn function. Another unfortunate
42+
// allocation
43+
let start = ~start;
3044

3145
// The C-ABI function that is the task entry point
3246
extern fn task_start_wrapper(f: &~fn()) { (*f)() }
@@ -40,21 +54,29 @@ pub impl Context {
4054
// which we will then modify to call the given function when restored
4155
let mut regs = new_regs();
4256
unsafe {
43-
swap_registers(transmute_mut_region(&mut *regs),
44-
transmute_region(&*regs))
57+
swap_registers(transmute_mut_region(&mut *regs), transmute_region(&*regs))
4558
};
4659

4760
initialize_call_frame(&mut *regs, fp, argp, sp);
4861

49-
return Context(regs);
62+
return Context {
63+
start: Some(start),
64+
regs: regs
65+
}
5066
}
5167

68+
/* Switch contexts
69+
70+
Suspend the current execution context and resume another by
71+
saving the registers values of the executing thread to a Context
72+
then loading the registers from a previously saved Context.
73+
*/
5274
fn swap(out_context: &mut Context, in_context: &Context) {
5375
let out_regs: &mut Registers = match out_context {
54-
&Context(~ref mut r) => r
76+
&Context { regs: ~ref mut r, _ } => r
5577
};
5678
let in_regs: &Registers = match in_context {
57-
&Context(~ref r) => r
79+
&Context { regs: ~ref r, _ } => r
5880
};
5981

6082
unsafe { swap_registers(out_regs, in_regs) };
@@ -84,11 +106,10 @@ fn new_regs() -> ~Registers {
84106
}
85107

86108
#[cfg(target_arch = "x86")]
87-
fn initialize_call_frame(regs: &mut Registers,
88-
fptr: *c_void, arg: *c_void, sp: *mut uint) {
109+
fn initialize_call_frame(regs: &mut Registers, fptr: *c_void, arg: *c_void, sp: *mut uint) {
89110

90111
let sp = align_down(sp);
91-
let sp = mut_offset(sp, -4); // XXX: -4 words? Needs this be done at all?
112+
let sp = mut_offset(sp, -4);
92113

93114
unsafe { *sp = arg as uint; }
94115
let sp = mut_offset(sp, -1);
@@ -108,8 +129,7 @@ type Registers = [uint * 22];
108129
fn new_regs() -> ~Registers { ~[0, .. 22] }
109130

110131
#[cfg(target_arch = "x86_64")]
111-
fn initialize_call_frame(regs: &mut Registers,
112-
fptr: *c_void, arg: *c_void, sp: *mut uint) {
132+
fn initialize_call_frame(regs: &mut Registers, fptr: *c_void, arg: *c_void, sp: *mut uint) {
113133

114134
// Redefinitions from regs.h
115135
static RUSTRT_ARG0: uint = 3;
@@ -143,8 +163,7 @@ type Registers = [uint * 32];
143163
fn new_regs() -> ~Registers { ~[0, .. 32] }
144164

145165
#[cfg(target_arch = "arm")]
146-
fn initialize_call_frame(regs: &mut Registers,
147-
fptr: *c_void, arg: *c_void, sp: *mut uint) {
166+
fn initialize_call_frame(regs: &mut Registers, fptr: *c_void, arg: *c_void, sp: *mut uint) {
148167
let sp = mut_offset(sp, -1);
149168

150169
// The final return address. 0 indicates the bottom of the stack
@@ -162,8 +181,7 @@ type Registers = [uint * 32];
162181
fn new_regs() -> ~Registers { ~[0, .. 32] }
163182

164183
#[cfg(target_arch = "mips")]
165-
fn initialize_call_frame(regs: &mut Registers,
166-
fptr: *c_void, arg: *c_void, sp: *mut uint) {
184+
fn initialize_call_frame(regs: &mut Registers, fptr: *c_void, arg: *c_void, sp: *mut uint) {
167185
let sp = mut_offset(sp, -1);
168186

169187
// The final return address. 0 indicates the bottom of the stack
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
use prelude::*;
12+
use super::super::sched::*;
13+
use super::super::rtio::*;
14+
use super::Stream;
15+
16+
pub struct FileStream;
17+
18+
pub impl FileStream {
19+
fn new(_path: Path) -> FileStream {
20+
fail!()
21+
}
22+
}
23+
24+
impl Stream for FileStream {
25+
fn read(&mut self, _buf: &mut [u8]) -> uint {
26+
fail!()
27+
}
28+
29+
fn eof(&mut self) -> bool {
30+
fail!()
31+
}
32+
33+
fn write(&mut self, _v: &const [u8]) {
34+
fail!()
35+
}
36+
}
37+
38+
#[test]
39+
#[ignore]
40+
fn super_simple_smoke_test_lets_go_read_some_files_and_have_a_good_time() {
41+
let message = "it's alright. have a good time";
42+
let filename = Path("test.txt");
43+
let mut outstream = FileStream::new(filename);
44+
outstream.write(message.to_bytes());
45+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
use option::*;
12+
use comm::{GenericPort, GenericChan};
13+
14+
pub mod file;
15+
16+
// FIXME #5370 Strongly want this to be StreamError(&mut Stream)
17+
pub struct StreamError;
18+
19+
// XXX: Can't put doc comments on macros
20+
// Raised by `Stream` instances on error. Returning `true` from the handler
21+
// indicates that the `Stream` should continue, `false` that it should fail.
22+
condition! {
23+
stream_error: super::StreamError -> bool;
24+
}
25+
26+
pub trait Stream {
27+
/// Read bytes, up to the length of `buf` and place them in `buf`,
28+
/// returning the number of bytes read or an `IoError`. Reads
29+
/// 0 bytes on EOF.
30+
///
31+
/// # Failure
32+
///
33+
/// Raises the `reader_error` condition on error
34+
fn read(&mut self, buf: &mut [u8]) -> uint;
35+
36+
/// Return whether the Reader has reached the end of the stream
37+
fn eof(&mut self) -> bool;
38+
39+
/// Write the given buffer
40+
///
41+
/// # Failure
42+
///
43+
/// Raises the `writer_error` condition on error
44+
fn write(&mut self, v: &const [u8]);
45+
}

0 commit comments

Comments
 (0)