Skip to content

Commit 2c17a1f

Browse files
committed
---
yaml --- r: 151923 b: refs/heads/try2 c: 06eb976 h: refs/heads/master i: 151921: e2591fb 151919: 7edd11c v: v3
1 parent 1b5339a commit 2c17a1f

Some content is hidden

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

70 files changed

+802
-860
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: 022a7b3cfb8014f79c79ba85a8273d16cda6e423
8+
refs/heads/try2: 06eb9765fec87dc66e17c97f667e30e6726d133e
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, rustc: $$(@D)/lib$(4))
77+
@$$(call E, oxidize: $$(@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, rustc: $$@)
117+
@$$(call E, oxidize: $$@)
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, rustc: $$@)
375+
@$$(call E, oxidize: $$@)
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: 25 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -18,40 +18,30 @@ syn keyword rustOperator as
1818

1919
syn match rustAssert "\<assert\(\w\)*!" contained
2020
syn match rustFail "\<fail\(\w\)*!" contained
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
21+
syn keyword rustKeyword break box continue
22+
syn keyword rustKeyword extern nextgroup=rustExternCrate,rustObsoleteExternMod skipwhite
2623
syn keyword rustKeyword for in if impl let
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
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
3128
" FIXME: Scoped impl's name is also fallen in this category
32-
syn keyword rustKeyword mod trait struct enum type nextgroup=rustIdentifier skipwhite skipempty
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
3332
syn keyword rustStorage mut ref static
3433
syn keyword rustObsoleteStorage const
3534

3635
syn keyword rustInvalidBareKeyword crate
3736

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

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

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-
5343
" Reserved (but not yet used) keywords {{{2
54-
syn keyword rustReservedKeyword alignof be do offsetof priv pure sizeof typeof unsized yield
44+
syn keyword rustReservedKeyword alignof be do offsetof pure sizeof typeof yield
5545

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

6454
" Core operators {{{3
65-
syn keyword rustTrait Copy Send Sized Share
55+
syn keyword rustTrait Share Copy Send Sized
6656
syn keyword rustTrait Add Sub Mul Div Rem Neg Not
6757
syn keyword rustTrait BitAnd BitOr BitXor
68-
syn keyword rustTrait Drop Deref DerefMut
58+
syn keyword rustTrait Drop
6959
syn keyword rustTrait Shl Shr Index
7060
syn keyword rustEnum Option
7161
syn keyword rustEnumVariant Some None
@@ -78,6 +68,7 @@ syn keyword rustEnumVariant Ok Err
7868
"syn keyword rustFunction drop
7969

8070
" Types and traits {{{3
71+
syn keyword rustTrait Any AnyOwnExt AnyRefExt AnyMutRefExt
8172
syn keyword rustTrait Ascii AsciiCast OwnedAsciiCast AsciiStr IntoBytes
8273
syn keyword rustTrait ToCStr
8374
syn keyword rustTrait Char
@@ -89,31 +80,24 @@ syn keyword rustTrait FromIterator Extendable
8980
syn keyword rustTrait Iterator DoubleEndedIterator RandomAccessIterator CloneableIterator
9081
syn keyword rustTrait OrdIterator MutableDoubleEndedIterator ExactSize
9182
syn keyword rustTrait Num NumCast CheckedAdd CheckedSub CheckedMul
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
83+
syn keyword rustTrait Signed Unsigned Round
84+
syn keyword rustTrait Primitive Int Float ToPrimitive FromPrimitive
9685
syn keyword rustTrait GenericPath Path PosixPath WindowsPath
9786
syn keyword rustTrait RawPtr
9887
syn keyword rustTrait Buffer Writer Reader Seek
99-
syn keyword rustTrait Str StrVector StrSlice OwnedStr IntoMaybeOwned
100-
syn keyword rustTrait StrAllocating
88+
syn keyword rustTrait Str StrVector StrSlice OwnedStr IntoMaybeOwned StrBuf
10189
syn keyword rustTrait ToStr IntoStr
10290
syn keyword rustTrait Tuple1 Tuple2 Tuple3 Tuple4
10391
syn keyword rustTrait Tuple5 Tuple6 Tuple7 Tuple8
10492
syn keyword rustTrait Tuple9 Tuple10 Tuple11 Tuple12
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
114-
"syn keyword rustFunction spawn
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
11597

116-
"syn keyword rustConstant GC
98+
"syn keyword rustFunction stream
99+
syn keyword rustTrait Sender Receiver
100+
"syn keyword rustFunction spawn
117101

118102
syn keyword rustSelf self
119103
syn keyword rustBoolean true false
@@ -255,8 +239,6 @@ hi def link rustLifetime Special
255239
hi def link rustInvalidBareKeyword Error
256240
hi def link rustExternCrate rustKeyword
257241
hi def link rustObsoleteExternMod Error
258-
hi def link rustBoxPlacementParens Delimiter
259-
hi def link rustBoxPlacementExpr rustKeyword
260242

261243
" Other Suggestions:
262244
" hi rustAttribute ctermfg=cyan

branches/try2/src/liballoc/heap.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
// FIXME: #13994: port to the sized deallocation API when available
12-
// FIXME: #13996: mark the `allocate` and `reallocate` return value as `noalias` and `nonnull`
12+
// FIXME: #13996: need a way to mark the `allocate` and `reallocate` return values as `noalias`
1313

1414
use core::intrinsics::{abort, cttz32};
1515
use core::option::{None, Option};
@@ -119,8 +119,14 @@ pub fn stats_print() {
119119
/// The allocator for unique pointers.
120120
#[cfg(not(test))]
121121
#[lang="exchange_malloc"]
122+
#[inline(always)]
123+
pub unsafe fn exchange_malloc_(size: uint, align: uint) -> *mut u8 {
124+
exchange_malloc(size, align)
125+
}
126+
127+
/// The allocator for unique pointers.
122128
#[inline]
123-
unsafe fn exchange_malloc(size: uint, align: uint) -> *mut u8 {
129+
pub unsafe fn exchange_malloc(size: uint, align: uint) -> *mut u8 {
124130
// The compiler never calls `exchange_free` on ~ZeroSizeType, so zero-size
125131
// allocations can point to this `static`. It would be incorrect to use a null
126132
// pointer, due to enums assuming types like unique pointers are never null.
@@ -133,20 +139,14 @@ unsafe fn exchange_malloc(size: uint, align: uint) -> *mut u8 {
133139
}
134140
}
135141

136-
#[cfg(not(test), stage0)]
142+
#[cfg(not(test))]
137143
#[lang="exchange_free"]
138144
#[inline]
145+
// FIXME: #13994 (rustc should pass align and size here)
139146
unsafe fn exchange_free(ptr: *mut u8) {
140147
deallocate(ptr, 0, 8);
141148
}
142149

143-
#[cfg(not(test), not(stage0))]
144-
#[lang="exchange_free"]
145-
#[inline]
146-
unsafe fn exchange_free(ptr: *mut u8, size: uint, align: uint) {
147-
deallocate(ptr, size, align);
148-
}
149-
150150
// FIXME: #7496
151151
#[cfg(not(test))]
152152
#[lang="closure_exchange_malloc"]
@@ -167,16 +167,16 @@ unsafe fn closure_exchange_malloc(drop_glue: fn(*mut u8), size: uint, align: uin
167167
#[doc(hidden)]
168168
#[deprecated]
169169
#[cfg(not(test))]
170-
pub unsafe extern "C" fn rust_allocate(size: uint, align: uint) -> *mut u8 {
171-
allocate(size, align)
170+
pub unsafe extern "C" fn rust_malloc(size: uint, align: uint) -> *mut u8 {
171+
exchange_malloc(size, align)
172172
}
173173

174174
// hack for libcore
175175
#[no_mangle]
176176
#[doc(hidden)]
177177
#[deprecated]
178178
#[cfg(not(test))]
179-
pub unsafe extern "C" fn rust_deallocate(ptr: *mut u8, size: uint, align: uint) {
179+
pub unsafe extern "C" fn rust_free(ptr: *mut u8, size: uint, align: uint) {
180180
deallocate(ptr, size, align)
181181
}
182182

branches/try2/src/libarena/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ use std::mem;
3838
use std::num;
3939
use std::ptr::read;
4040
use std::rc::Rc;
41-
use std::rt::heap::allocate;
41+
use std::rt::heap::exchange_malloc;
4242

4343
// The way arena uses arrays is really deeply awful. The arrays are
4444
// allocated, and have capacities reserved, but the fill for the array
@@ -358,7 +358,8 @@ impl<T> TypedArenaChunk<T> {
358358
size = size.checked_add(&elems_size).unwrap();
359359

360360
let mut chunk = unsafe {
361-
let chunk = allocate(size, mem::min_align_of::<TypedArenaChunk<T>>());
361+
let chunk = exchange_malloc(size,
362+
mem::min_align_of::<TypedArenaChunk<T>>());
362363
let mut chunk: Box<TypedArenaChunk<T>> = mem::transmute(chunk);
363364
mem::overwrite(&mut chunk.next, next);
364365
chunk

branches/try2/src/libcore/should_not_exist.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ use str::StrSlice;
4444

4545
#[allow(ctypes)]
4646
extern {
47-
fn rust_allocate(size: uint, align: uint) -> *u8;
48-
fn rust_deallocate(ptr: *u8, size: uint, align: uint);
47+
fn rust_malloc(size: uint, align: uint) -> *u8;
48+
fn rust_free(ptr: *u8, size: uint, align: uint);
4949
}
5050

5151
unsafe fn alloc(cap: uint) -> *mut Vec<()> {
5252
let cap = cap.checked_add(&mem::size_of::<Vec<()>>()).unwrap();
5353
// this should use the real alignment, but the new representation will take care of that
54-
let ret = rust_allocate(cap, 8) as *mut Vec<()>;
54+
let ret = rust_malloc(cap, 8) as *mut Vec<()>;
5555
if ret.is_null() {
5656
intrinsics::abort();
5757
}
@@ -119,7 +119,7 @@ impl FromIterator<char> for ~str {
119119
&(*ptr).data,
120120
len);
121121
// FIXME: #13994: port to the sized deallocation API when available
122-
rust_deallocate(ptr as *u8, 0, 8);
122+
rust_free(ptr as *u8, 0, 8);
123123
mem::forget(ret);
124124
ret = mem::transmute(ptr2);
125125
ptr = ptr2;
@@ -191,7 +191,7 @@ impl<A: Clone> Clone for ~[A] {
191191
for j in range(0, *i as int) {
192192
ptr::read(&*p.offset(j));
193193
}
194-
rust_deallocate(ret as *u8, 0, 8);
194+
rust_free(ret as *u8, 0, 8);
195195
});
196196
mem::transmute(ret)
197197
}

branches/try2/src/libgreen/basic.rs

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
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;
2018
use std::mem;
2119
use std::rt::rtio::{EventLoop, IoFactory, RemoteCallback};
2220
use std::rt::rtio::{PausableIdleCallback, Callback};
@@ -29,11 +27,10 @@ pub fn event_loop() -> Box<EventLoop:Send> {
2927

3028
struct BasicLoop {
3129
work: Vec<proc():Send>, // pending work
30+
idle: Option<*mut BasicPausable>, // only one is allowed
3231
remotes: Vec<(uint, Box<Callback:Send>)>,
3332
next_remote: uint,
3433
messages: Exclusive<Vec<Message>>,
35-
idle: Option<Box<Callback:Send>>,
36-
idle_active: Option<Arc<atomics::AtomicBool>>,
3734
}
3835

3936
enum Message { RunRemote(uint), RemoveRemote(uint) }
@@ -43,7 +40,6 @@ impl BasicLoop {
4340
BasicLoop {
4441
work: vec![],
4542
idle: None,
46-
idle_active: None,
4743
next_remote: 0,
4844
remotes: vec![],
4945
messages: Exclusive::new(vec![]),
@@ -96,18 +92,20 @@ impl BasicLoop {
9692

9793
/// Run the idle callback if one is registered
9894
fn idle(&mut self) {
99-
match self.idle {
100-
Some(ref mut idle) => {
101-
if self.idle_active.get_ref().load(atomics::SeqCst) {
102-
idle.call();
95+
unsafe {
96+
match self.idle {
97+
Some(idle) => {
98+
if (*idle).active {
99+
(*idle).work.call();
100+
}
103101
}
102+
None => {}
104103
}
105-
None => {}
106104
}
107105
}
108106

109107
fn has_idle(&self) -> bool {
110-
self.idle.is_some() && self.idle_active.get_ref().load(atomics::SeqCst)
108+
unsafe { self.idle.is_some() && (**self.idle.get_ref()).active }
111109
}
112110
}
113111

@@ -143,11 +141,13 @@ impl EventLoop for BasicLoop {
143141
// FIXME: Seems like a really weird requirement to have an event loop provide.
144142
fn pausable_idle_callback(&mut self, cb: Box<Callback:Send>)
145143
-> Box<PausableIdleCallback:Send> {
144+
let callback = box BasicPausable::new(self, cb);
146145
rtassert!(self.idle.is_none());
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>
146+
unsafe {
147+
let cb_ptr: &*mut BasicPausable = mem::transmute(&callback);
148+
self.idle = Some(*cb_ptr);
149+
}
150+
callback as Box<PausableIdleCallback:Send>
151151
}
152152

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

198198
struct BasicPausable {
199-
active: Arc<atomics::AtomicBool>,
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+
}
200212
}
201213

202214
impl PausableIdleCallback for BasicPausable {
203215
fn pause(&mut self) {
204-
self.active.store(false, atomics::SeqCst);
216+
self.active = false;
205217
}
206218
fn resume(&mut self) {
207-
self.active.store(true, atomics::SeqCst);
219+
self.active = true;
208220
}
209221
}
210222

211223
impl Drop for BasicPausable {
212224
fn drop(&mut self) {
213-
self.active.store(false, atomics::SeqCst);
225+
unsafe {
226+
(*self.eloop).idle = None;
227+
}
214228
}
215229
}
216230

0 commit comments

Comments
 (0)