Skip to content

Commit 8e8c4cb

Browse files
author
James Miller
committed
---
yaml --- r: 62707 b: refs/heads/snap-stage3 c: 008e6e5 h: refs/heads/master i: 62705: 8a3e885 62703: b8e99ad v: v3
1 parent aeafe26 commit 8e8c4cb

File tree

19 files changed

+329
-599
lines changed

19 files changed

+329
-599
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: bf57d65a117f2d3634b4eda62001e45fe31b0e9d
4+
refs/heads/snap-stage3: 008e6e5e7e4d2e102d7048a948e9fcac82e1e210
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ src/.DS_Store
7373
/doc/html
7474
/doc/latex
7575
/doc/std
76-
/doc/extra
7776
/nd/
7877
/llvm/
7978
version.md
@@ -82,6 +81,7 @@ keywords.md
8281
x86_64-apple-darwin/
8382
x86_64-unknown-linux-gnu/
8483
i686-unknown-linux-gnu/
84+
doc/core/
8585
tmp.*.rs
8686
config.stamp
8787
.DS_Store

branches/snap-stage3/configure

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -555,11 +555,11 @@ then
555555
CFG_CLANG_VERSION=$("$CFG_CLANG" \
556556
--version \
557557
| grep version \
558-
| sed 's/.*\(version .*\)/\1/; s/.*based on \(LLVM .*\))/\1/' \
558+
| sed 's/.*\(version .*\)/\1/' \
559559
| cut -d ' ' -f 2)
560560

561561
case $CFG_CLANG_VERSION in
562-
(3.0svn | 3.0 | 3.1* | 3.2* | 3.3*)
562+
(3.0svn | 3.0 | 3.1* | 3.2* | 3.3* | 4.0* | 4.1* | 4.2*)
563563
step_msg "found ok version of CLANG: $CFG_CLANG_VERSION"
564564
CFG_C_COMPILER="clang"
565565
;;

branches/snap-stage3/mk/platform.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ $(foreach t,$(CFG_TARGET_TRIPLES),$(info cfg: os for $(t) is $(OSTYPE_$(t))))
2929
# FIXME: no-omit-frame-pointer is just so that task_start_wrapper
3030
# has a frame pointer and the stack walker can understand it. Turning off
3131
# frame pointers everywhere is overkill
32-
CFG_GCCISH_CFLAGS += -fno-omit-frame-pointer -DUSE_UTF8
32+
CFG_GCCISH_CFLAGS += -fno-omit-frame-pointer
3333

3434
# On Darwin, we need to run dsymutil so the debugging information ends
3535
# up in the right place. On other platforms, it automatically gets

branches/snap-stage3/src/libextra/arc.rs

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ pub impl<'self> Condvar<'self> {
107107
****************************************************************************/
108108

109109
/// An atomically reference counted wrapper for shared immutable state.
110-
pub struct ARC<T> { x: UnsafeAtomicRcBox<T> }
110+
struct ARC<T> { x: UnsafeAtomicRcBox<T> }
111111

112112
/// Create an atomically reference counted wrapper.
113113
pub fn ARC<T:Const + Owned>(data: T) -> ARC<T> {
@@ -118,22 +118,29 @@ pub fn ARC<T:Const + Owned>(data: T) -> ARC<T> {
118118
* Access the underlying data in an atomically reference counted
119119
* wrapper.
120120
*/
121-
pub impl<T:Const+Owned> ARC<T> {
122-
fn get<'a>(&'a self) -> &'a T {
121+
pub fn get<'a, T:Const + Owned>(rc: &'a ARC<T>) -> &'a T {
122+
rc.get()
123+
}
124+
125+
impl<T:Const+Owned> ARC<T> {
126+
pub fn get<'a>(&'a self) -> &'a T {
123127
unsafe { &*self.x.get_immut() }
124128
}
125129
}
126-
127130
/**
128131
* Duplicate an atomically reference counted wrapper.
129132
*
130133
* The resulting two `arc` objects will point to the same underlying data
131134
* object. However, one of the `arc` objects can be sent to another task,
132135
* allowing them to share the underlying data.
133136
*/
137+
pub fn clone<T:Const + Owned>(rc: &ARC<T>) -> ARC<T> {
138+
ARC { x: rc.x.clone() }
139+
}
140+
134141
impl<T:Const + Owned> Clone for ARC<T> {
135142
fn clone(&self) -> ARC<T> {
136-
ARC { x: self.x.clone() }
143+
clone(self)
137144
}
138145
}
139146

@@ -505,31 +512,34 @@ pub impl<'self, T:Const + Owned> RWReadMode<'self, T> {
505512
#[cfg(test)]
506513
mod tests {
507514
use core::prelude::*;
508-
use core::cell::Cell;
515+
509516
use arc::*;
510517
use arc;
511518

519+
use core::cell::Cell;
520+
use core::task;
521+
512522
#[test]
513523
fn manually_share_arc() {
514524
let v = ~[1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
515-
let arc_v = ARC(v);
525+
let arc_v = arc::ARC(v);
516526

517527
let (p, c) = comm::stream();
518528

519529
do task::spawn() || {
520530
let p = comm::PortSet::new();
521531
c.send(p.chan());
522532

523-
let arc_v : ARC<~[int]> = p.recv();
533+
let arc_v = p.recv();
524534

525-
let v = copy (*arc_v.get());
535+
let v = copy *arc::get::<~[int]>(&arc_v);
526536
assert_eq!(v[3], 4);
527537
};
528538

529539
let c = p.recv();
530-
c.send(arc_v.clone());
540+
c.send(arc::clone(&arc_v));
531541

532-
assert_eq!(arc_v.get()[2], 3);
542+
assert_eq!((*arc::get(&arc_v))[2], 3);
533543
assert_eq!(arc_v.get()[4], 5);
534544

535545
info!(arc_v);

branches/snap-stage3/src/librust/rust.rc

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,16 @@ extern mod rustc;
3232
use core::prelude::*;
3333

3434
use core::run;
35-
use core::libc::exit;
3635

3736
enum ValidUsage {
38-
Valid(int), Invalid
37+
Valid, Invalid
3938
}
4039

4140
impl ValidUsage {
4241
fn is_valid(&self) -> bool {
4342
match *self {
44-
Valid(_) => true,
45-
Invalid => false
43+
Valid => true,
44+
Invalid => false
4645
}
4746
}
4847
}
@@ -145,7 +144,7 @@ fn cmd_help(args: &[~str]) -> ValidUsage {
145144
UsgStr(msg) => io::println(fmt!("%s\n", msg)),
146145
UsgCall(f) => f(),
147146
}
148-
Valid(0)
147+
Valid
149148
},
150149
None => Invalid
151150
}
@@ -163,8 +162,8 @@ fn cmd_test(args: &[~str]) -> ValidUsage {
163162
let test_exec = Path(filename).filestem().unwrap() + "test~";
164163
invoke("rustc", &[~"--test", filename.to_owned(),
165164
~"-o", test_exec.to_owned()], rustc::main);
166-
let exit_code = run::run_program(~"./" + test_exec, []);
167-
Valid(exit_code)
165+
run::run_program(~"./" + test_exec, []);
166+
Valid
168167
}
169168
_ => Invalid
170169
}
@@ -176,8 +175,8 @@ fn cmd_run(args: &[~str]) -> ValidUsage {
176175
let exec = Path(filename).filestem().unwrap() + "~";
177176
invoke("rustc", &[filename.to_owned(), ~"-o", exec.to_owned()],
178177
rustc::main);
179-
let exit_code = run::run_program(~"./"+exec, prog_args);
180-
Valid(exit_code)
178+
run::run_program(~"./"+exec, prog_args);
179+
Valid
181180
}
182181
_ => Invalid
183182
}
@@ -195,7 +194,7 @@ fn do_command(command: &Command, args: &[~str]) -> ValidUsage {
195194
Call(f) => f(args),
196195
CallMain(prog, f) => {
197196
invoke(prog, args, f);
198-
Valid(0)
197+
Valid
199198
}
200199
}
201200
}
@@ -234,10 +233,7 @@ pub fn main() {
234233
if !args.is_empty() {
235234
for find_cmd(*args.head()).each |command| {
236235
let result = do_command(command, args.tail());
237-
match result {
238-
Valid(exit_code) => unsafe { exit(exit_code.to_i32()) },
239-
_ => loop
240-
}
236+
if result.is_valid() { return; }
241237
}
242238
}
243239

branches/snap-stage3/src/librustc/front/config.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,8 @@ fn fold_block(
136136
) -> ast::blk_ {
137137
let filtered_stmts =
138138
b.stmts.filter_mapped(|a| filter_stmt(cx, *a));
139-
let filtered_view_items =
140-
b.view_items.filter_mapped(|a| filter_view_item(cx, *a));
141139
ast::blk_ {
142-
view_items: vec::map(filtered_view_items, |x| fld.fold_view_item(*x)),
140+
view_items: /*bad*/copy b.view_items,
143141
stmts: vec::map(filtered_stmts, |x| fld.fold_stmt(*x)),
144142
expr: b.expr.map(|x| fld.fold_expr(*x)),
145143
id: b.id,

branches/snap-stage3/src/libstd/unstable/atomics.rs

Lines changed: 15 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,23 @@ use cast;
1717
use option::{Option,Some,None};
1818

1919
pub struct AtomicFlag {
20-
priv v:int
20+
priv v: int
2121
}
2222

2323
pub struct AtomicBool {
24-
priv v:uint
24+
priv v: uint
2525
}
2626

2727
pub struct AtomicInt {
28-
priv v:int
28+
priv v: int
2929
}
3030

3131
pub struct AtomicUint {
32-
priv v:uint
32+
priv v: uint
3333
}
3434

3535
pub struct AtomicPtr<T> {
36-
priv p:~T
36+
priv p: *mut T
3737
}
3838

3939
pub enum Ordering {
@@ -173,60 +173,28 @@ impl AtomicUint {
173173
}
174174

175175
impl<T> AtomicPtr<T> {
176-
fn new(p:~T) -> AtomicPtr<T> {
176+
fn new(p:*mut T) -> AtomicPtr<T> {
177177
AtomicPtr { p:p }
178178
}
179179

180-
/**
181-
* Atomically swaps the stored pointer with the one given.
182-
*
183-
* Returns None if the pointer stored has been taken
184-
*/
185180
#[inline(always)]
186-
fn swap(&mut self, ptr:~T, order:Ordering) -> Option<~T> {
187-
unsafe {
188-
let p = atomic_swap(&mut self.p, ptr, order);
189-
let pv : &uint = cast::transmute(&p);
190-
191-
if *pv == 0 {
192-
None
193-
} else {
194-
Some(p)
195-
}
196-
}
181+
fn load(&self, order:Ordering) -> *mut T {
182+
unsafe { atomic_load(&self.p, order) }
197183
}
198184

199-
/**
200-
* Atomically takes the stored pointer out.
201-
*
202-
* Returns None if it was already taken.
203-
*/
204185
#[inline(always)]
205-
fn take(&mut self, order:Ordering) -> Option<~T> {
206-
unsafe { self.swap(cast::transmute(0), order) }
186+
fn store(&mut self, ptr:*mut T, order:Ordering) {
187+
unsafe { atomic_store(&mut self.p, ptr, order); }
207188
}
208189

209-
/**
210-
* Atomically stores the given pointer, this will overwrite
211-
* and previous value stored.
212-
*/
213190
#[inline(always)]
214-
fn give(&mut self, ptr:~T, order:Ordering) {
215-
let _ = self.swap(ptr, order);
191+
fn swap(&mut self, ptr:*mut T, order:Ordering) -> *mut T {
192+
unsafe { atomic_swap(&mut self.p, ptr, order) }
216193
}
217194

218-
/**
219-
* Checks to see if the stored pointer has been taken.
220-
*/
221-
fn taken(&self, order:Ordering) -> bool {
222-
unsafe {
223-
let p : ~T = atomic_load(&self.p, order);
224-
225-
let pv : &uint = cast::transmute(&p);
226-
227-
cast::forget(p);
228-
*pv == 0
229-
}
195+
#[inline(always)]
196+
fn compare_and_swap(&mut self, old: *mut T, new: *mut T, order:Ordering) -> *mut T {
197+
unsafe { atomic_compare_and_swap(&mut self.v, old, new, order) }
230198
}
231199
}
232200

branches/snap-stage3/src/libsyntax/ext/trace_macros.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ use ext::base::ExtCtxt;
1616
use ext::base;
1717
use parse::lexer::{new_tt_reader, reader};
1818
use parse::parser::Parser;
19-
use parse::token::keywords;
2019

2120
pub fn expand_trace_macros(cx: @ExtCtxt,
2221
sp: span,
@@ -37,9 +36,9 @@ pub fn expand_trace_macros(cx: @ExtCtxt,
3736
rdr.dup()
3837
);
3938

40-
if rust_parser.is_keyword(keywords::True) {
39+
if rust_parser.is_keyword("true") {
4140
cx.set_trace_macros(true);
42-
} else if rust_parser.is_keyword(keywords::False) {
41+
} else if rust_parser.is_keyword("false") {
4342
cx.set_trace_macros(false);
4443
} else {
4544
cx.span_fatal(sp, "trace_macros! only accepts `true` or `false`")

0 commit comments

Comments
 (0)