Skip to content

Commit 1b5339a

Browse files
committed
---
yaml --- r: 151922 b: refs/heads/try2 c: 022a7b3 h: refs/heads/master v: v3
1 parent e2591fb commit 1b5339a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+622
-528
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: f1ce693e618dbf4273e0e1af8fd101e15964f5f0
8+
refs/heads/try2: 022a7b3cfb8014f79c79ba85a8273d16cda6e423
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/mk/target.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$(4): \
7474
$$(CRATE_FULLDEPS_$(1)_T_$(2)_H_$(3)_$(4)) \
7575
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
7676
| $$(TLIB$(1)_T_$(2)_H_$(3))/
77-
@$$(call E, oxidize: $$(@D)/lib$(4))
77+
@$$(call E, rustc: $$(@D)/lib$(4))
7878
$$(call REMOVE_ALL_OLD_GLOB_MATCHES,\
7979
$$(dir $$@)$$(call CFG_LIB_GLOB_$(2),$(4)))
8080
$$(call REMOVE_ALL_OLD_GLOB_MATCHES,\
@@ -114,7 +114,7 @@ $$(TBIN$(1)_T_$(2)_H_$(3))/$(4)$$(X_$(2)): \
114114
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(dep)) \
115115
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
116116
| $$(TBIN$(1)_T_$(4)_H_$(3))/
117-
@$$(call E, oxidize: $$@)
117+
@$$(call E, rustc: $$@)
118118
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --cfg $(4)
119119

120120
endef

branches/try2/mk/tests.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ $(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2)): CFG_COMPILER_HOST_TRIPLE = $(2)
372372
$(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2)): \
373373
$$(CRATEFILE_$(4)) \
374374
$$(TESTDEP_$(1)_$(2)_$(3)_$(4))
375-
@$$(call E, oxidize: $$@)
375+
@$$(call E, rustc: $$@)
376376
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test \
377377
-L "$$(RT_OUTPUT_DIR_$(2))" \
378378
-L "$$(LLVM_LIBDIR_$(2))"

branches/try2/src/etc/vim/syntax/rust.vim

Lines changed: 43 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,30 +18,40 @@ syn keyword rustOperator as
1818

1919
syn match rustAssert "\<assert\(\w\)*!" contained
2020
syn match rustFail "\<fail\(\w\)*!" contained
21-
syn keyword rustKeyword break box continue
22-
syn keyword rustKeyword extern nextgroup=rustExternCrate,rustObsoleteExternMod skipwhite
21+
syn keyword rustKeyword break
22+
syn keyword rustKeyword box nextgroup=rustBoxPlacement skipwhite skipempty
23+
syn keyword rustKeyword continue
24+
syn keyword rustKeyword extern nextgroup=rustExternCrate,rustObsoleteExternMod skipwhite skipempty
25+
syn keyword rustKeyword fn nextgroup=rustFuncName skipwhite skipempty
2326
syn keyword rustKeyword for in if impl let
24-
syn keyword rustKeyword loop once priv pub
25-
syn keyword rustKeyword return
26-
syn keyword rustKeyword unsafe while
27-
syn keyword rustKeyword use nextgroup=rustModPath skipwhite
27+
syn keyword rustKeyword loop once proc pub
28+
syn keyword rustKeyword return super
29+
syn keyword rustKeyword unsafe virtual while
30+
syn keyword rustKeyword use nextgroup=rustModPath skipwhite skipempty
2831
" FIXME: Scoped impl's name is also fallen in this category
29-
syn keyword rustKeyword mod trait struct enum type nextgroup=rustIdentifier skipwhite
30-
syn keyword rustKeyword fn nextgroup=rustFuncName skipwhite
31-
syn keyword rustKeyword proc
32+
syn keyword rustKeyword mod trait struct enum type nextgroup=rustIdentifier skipwhite skipempty
3233
syn keyword rustStorage mut ref static
3334
syn keyword rustObsoleteStorage const
3435

3536
syn keyword rustInvalidBareKeyword crate
3637

37-
syn keyword rustExternCrate crate contained nextgroup=rustIdentifier skipwhite
38-
syn keyword rustObsoleteExternMod mod contained nextgroup=rustIdentifier skipwhite
38+
syn keyword rustExternCrate crate contained nextgroup=rustIdentifier skipwhite skipempty
39+
syn keyword rustObsoleteExternMod mod contained nextgroup=rustIdentifier skipwhite skipempty
3940

4041
syn match rustIdentifier contains=rustIdentifierPrime "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained
4142
syn match rustFuncName "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained
4243

44+
syn region rustBoxPlacement matchgroup=rustBoxPlacementParens start="(" end=")" contains=TOP contained
45+
syn keyword rustBoxPlacementExpr GC containedin=rustBoxPlacement
46+
" Ideally we'd have syntax rules set up to match arbitrary expressions. Since
47+
" we don't, we'll just define temporary contained rules to handle balancing
48+
" delimiters.
49+
syn region rustBoxPlacementBalance start="(" end=")" containedin=rustBoxPlacement transparent
50+
syn region rustBoxPlacementBalance start="\[" end="\]" containedin=rustBoxPlacement transparent
51+
" {} are handled by rustFoldBraces
52+
4353
" Reserved (but not yet used) keywords {{{2
44-
syn keyword rustReservedKeyword alignof be do offsetof pure sizeof typeof yield
54+
syn keyword rustReservedKeyword alignof be do offsetof priv pure sizeof typeof unsized yield
4555

4656
" Built-in types {{{2
4757
syn keyword rustType int uint float char bool u8 u16 u32 u64 f32
@@ -52,10 +62,10 @@ syn keyword rustType f64 i8 i16 i32 i64 str Self
5262
" to make it easy to update.
5363

5464
" Core operators {{{3
55-
syn keyword rustTrait Share Copy Send Sized
65+
syn keyword rustTrait Copy Send Sized Share
5666
syn keyword rustTrait Add Sub Mul Div Rem Neg Not
5767
syn keyword rustTrait BitAnd BitOr BitXor
58-
syn keyword rustTrait Drop
68+
syn keyword rustTrait Drop Deref DerefMut
5969
syn keyword rustTrait Shl Shr Index
6070
syn keyword rustEnum Option
6171
syn keyword rustEnumVariant Some None
@@ -68,7 +78,6 @@ syn keyword rustEnumVariant Ok Err
6878
"syn keyword rustFunction drop
6979

7080
" Types and traits {{{3
71-
syn keyword rustTrait Any AnyOwnExt AnyRefExt AnyMutRefExt
7281
syn keyword rustTrait Ascii AsciiCast OwnedAsciiCast AsciiStr IntoBytes
7382
syn keyword rustTrait ToCStr
7483
syn keyword rustTrait Char
@@ -80,25 +89,32 @@ syn keyword rustTrait FromIterator Extendable
8089
syn keyword rustTrait Iterator DoubleEndedIterator RandomAccessIterator CloneableIterator
8190
syn keyword rustTrait OrdIterator MutableDoubleEndedIterator ExactSize
8291
syn keyword rustTrait Num NumCast CheckedAdd CheckedSub CheckedMul
83-
syn keyword rustTrait Signed Unsigned Round
84-
syn keyword rustTrait Primitive Int Float ToPrimitive FromPrimitive
92+
syn keyword rustTrait Signed Unsigned
93+
syn keyword rustTrait Primitive Int Float FloatMath ToPrimitive FromPrimitive
94+
"syn keyword rustTrait Expect
95+
syn keyword rustTrait Box
8596
syn keyword rustTrait GenericPath Path PosixPath WindowsPath
8697
syn keyword rustTrait RawPtr
8798
syn keyword rustTrait Buffer Writer Reader Seek
88-
syn keyword rustTrait Str StrVector StrSlice OwnedStr IntoMaybeOwned StrBuf
99+
syn keyword rustTrait Str StrVector StrSlice OwnedStr IntoMaybeOwned
100+
syn keyword rustTrait StrAllocating
89101
syn keyword rustTrait ToStr IntoStr
90102
syn keyword rustTrait Tuple1 Tuple2 Tuple3 Tuple4
91103
syn keyword rustTrait Tuple5 Tuple6 Tuple7 Tuple8
92104
syn keyword rustTrait Tuple9 Tuple10 Tuple11 Tuple12
93-
syn keyword rustTrait ImmutableEqVector ImmutableTotalOrdVector ImmutableCloneableVector
94-
syn keyword rustTrait OwnedVector OwnedCloneableVector OwnedEqVector
95-
syn keyword rustTrait MutableVector MutableTotalOrdVector
96-
syn keyword rustTrait Vector VectorVector CloneableVector ImmutableVector
97-
98-
"syn keyword rustFunction stream
99-
syn keyword rustTrait Sender Receiver
105+
syn keyword rustTrait CloneableVector ImmutableCloneableVector MutableCloneableVector
106+
syn keyword rustTrait ImmutableVector MutableVector
107+
syn keyword rustTrait ImmutableEqVector ImmutableTotalOrdVector MutableTotalOrdVector
108+
syn keyword rustTrait Vector VectorVector OwnedVector MutableVectorAllocating
109+
syn keyword rustTrait StrBuf
110+
syn keyword rustTrait Vec
111+
112+
"syn keyword rustFunction sync_channel channel
113+
syn keyword rustTrait SyncSender Sender Receiver
100114
"syn keyword rustFunction spawn
101115

116+
"syn keyword rustConstant GC
117+
102118
syn keyword rustSelf self
103119
syn keyword rustBoolean true false
104120

@@ -239,6 +255,8 @@ hi def link rustLifetime Special
239255
hi def link rustInvalidBareKeyword Error
240256
hi def link rustExternCrate rustKeyword
241257
hi def link rustObsoleteExternMod Error
258+
hi def link rustBoxPlacementParens Delimiter
259+
hi def link rustBoxPlacementExpr rustKeyword
242260

243261
" Other Suggestions:
244262
" hi rustAttribute ctermfg=cyan

branches/try2/src/libgreen/basic.rs

Lines changed: 19 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
//! This implementation is also used as the fallback implementation of an event
1616
//! loop if no other one is provided (and M:N scheduling is desired).
1717
18+
use alloc::arc::Arc;
19+
use std::sync::atomics;
1820
use std::mem;
1921
use std::rt::rtio::{EventLoop, IoFactory, RemoteCallback};
2022
use std::rt::rtio::{PausableIdleCallback, Callback};
@@ -27,10 +29,11 @@ pub fn event_loop() -> Box<EventLoop:Send> {
2729

2830
struct BasicLoop {
2931
work: Vec<proc():Send>, // pending work
30-
idle: Option<*mut BasicPausable>, // only one is allowed
3132
remotes: Vec<(uint, Box<Callback:Send>)>,
3233
next_remote: uint,
3334
messages: Exclusive<Vec<Message>>,
35+
idle: Option<Box<Callback:Send>>,
36+
idle_active: Option<Arc<atomics::AtomicBool>>,
3437
}
3538

3639
enum Message { RunRemote(uint), RemoveRemote(uint) }
@@ -40,6 +43,7 @@ impl BasicLoop {
4043
BasicLoop {
4144
work: vec![],
4245
idle: None,
46+
idle_active: None,
4347
next_remote: 0,
4448
remotes: vec![],
4549
messages: Exclusive::new(vec![]),
@@ -92,20 +96,18 @@ impl BasicLoop {
9296

9397
/// Run the idle callback if one is registered
9498
fn idle(&mut self) {
95-
unsafe {
96-
match self.idle {
97-
Some(idle) => {
98-
if (*idle).active {
99-
(*idle).work.call();
100-
}
99+
match self.idle {
100+
Some(ref mut idle) => {
101+
if self.idle_active.get_ref().load(atomics::SeqCst) {
102+
idle.call();
101103
}
102-
None => {}
103104
}
105+
None => {}
104106
}
105107
}
106108

107109
fn has_idle(&self) -> bool {
108-
unsafe { self.idle.is_some() && (**self.idle.get_ref()).active }
110+
self.idle.is_some() && self.idle_active.get_ref().load(atomics::SeqCst)
109111
}
110112
}
111113

@@ -141,13 +143,11 @@ impl EventLoop for BasicLoop {
141143
// FIXME: Seems like a really weird requirement to have an event loop provide.
142144
fn pausable_idle_callback(&mut self, cb: Box<Callback:Send>)
143145
-> Box<PausableIdleCallback:Send> {
144-
let callback = box BasicPausable::new(self, cb);
145146
rtassert!(self.idle.is_none());
146-
unsafe {
147-
let cb_ptr: &*mut BasicPausable = mem::transmute(&callback);
148-
self.idle = Some(*cb_ptr);
149-
}
150-
callback as Box<PausableIdleCallback:Send>
147+
self.idle = Some(cb);
148+
let a = Arc::new(atomics::AtomicBool::new(true));
149+
self.idle_active = Some(a.clone());
150+
box BasicPausable { active: a } as Box<PausableIdleCallback:Send>
151151
}
152152

153153
fn remote_callback(&mut self, f: Box<Callback:Send>)
@@ -196,35 +196,21 @@ impl Drop for BasicRemote {
196196
}
197197

198198
struct BasicPausable {
199-
eloop: *mut BasicLoop,
200-
work: Box<Callback:Send>,
201-
active: bool,
202-
}
203-
204-
impl BasicPausable {
205-
fn new(eloop: &mut BasicLoop, cb: Box<Callback:Send>) -> BasicPausable {
206-
BasicPausable {
207-
active: false,
208-
work: cb,
209-
eloop: eloop,
210-
}
211-
}
199+
active: Arc<atomics::AtomicBool>,
212200
}
213201

214202
impl PausableIdleCallback for BasicPausable {
215203
fn pause(&mut self) {
216-
self.active = false;
204+
self.active.store(false, atomics::SeqCst);
217205
}
218206
fn resume(&mut self) {
219-
self.active = true;
207+
self.active.store(true, atomics::SeqCst);
220208
}
221209
}
222210

223211
impl Drop for BasicPausable {
224212
fn drop(&mut self) {
225-
unsafe {
226-
(*self.eloop).idle = None;
227-
}
213+
self.active.store(false, atomics::SeqCst);
228214
}
229215
}
230216

branches/try2/src/libgreen/lib.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,9 @@
214214
#[cfg(test)] extern crate rustuv;
215215
extern crate rand;
216216
extern crate libc;
217+
extern crate alloc;
217218

219+
use alloc::arc::Arc;
218220
use std::mem::replace;
219221
use std::os;
220222
use std::rt::rtio;
@@ -223,7 +225,6 @@ use std::rt;
223225
use std::sync::atomics::{SeqCst, AtomicUint, INIT_ATOMIC_UINT};
224226
use std::sync::deque;
225227
use std::task::TaskOpts;
226-
use std::sync::arc::UnsafeArc;
227228

228229
use sched::{Shutdown, Scheduler, SchedHandle, TaskFromFriend, NewNeighbor};
229230
use sleeper_list::SleeperList;
@@ -375,7 +376,7 @@ pub struct SchedPool {
375376
/// sending on a channel once the entire pool has been drained of all tasks.
376377
#[deriving(Clone)]
377378
struct TaskState {
378-
cnt: UnsafeArc<AtomicUint>,
379+
cnt: Arc<AtomicUint>,
379380
done: Sender<()>,
380381
}
381382

@@ -434,7 +435,6 @@ impl SchedPool {
434435
pool.sleepers.clone(),
435436
pool.task_state.clone());
436437
pool.handles.push(sched.make_handle());
437-
let sched = sched;
438438
pool.threads.push(Thread::start(proc() { sched.bootstrap(); }));
439439
}
440440

@@ -496,7 +496,6 @@ impl SchedPool {
496496
self.task_state.clone());
497497
let ret = sched.make_handle();
498498
self.handles.push(sched.make_handle());
499-
let sched = sched;
500499
self.threads.push(Thread::start(proc() { sched.bootstrap() }));
501500

502501
return ret;
@@ -537,21 +536,21 @@ impl TaskState {
537536
fn new() -> (Receiver<()>, TaskState) {
538537
let (tx, rx) = channel();
539538
(rx, TaskState {
540-
cnt: UnsafeArc::new(AtomicUint::new(0)),
539+
cnt: Arc::new(AtomicUint::new(0)),
541540
done: tx,
542541
})
543542
}
544543

545544
fn increment(&mut self) {
546-
unsafe { (*self.cnt.get()).fetch_add(1, SeqCst); }
545+
self.cnt.fetch_add(1, SeqCst);
547546
}
548547

549548
fn active(&self) -> bool {
550-
unsafe { (*self.cnt.get()).load(SeqCst) != 0 }
549+
self.cnt.load(SeqCst) != 0
551550
}
552551

553552
fn decrement(&mut self) {
554-
let prev = unsafe { (*self.cnt.get()).fetch_sub(1, SeqCst) };
553+
let prev = self.cnt.fetch_sub(1, SeqCst);
555554
if prev == 1 {
556555
self.done.send(());
557556
}

0 commit comments

Comments
 (0)