Skip to content

Commit 6451045

Browse files
author
Alexandros Tasos
committed
---
yaml --- r: 94774 b: refs/heads/try c: 32c480d h: refs/heads/master v: v3
1 parent 7c56014 commit 6451045

File tree

30 files changed

+216
-725
lines changed

30 files changed

+216
-725
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 0da105a8b7b6b1e0568e8ff20f6ff4b13cc7ecc2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a6d3e57dca68fde4effdda3e4ae2887aa535fcd6
5-
refs/heads/try: a5fa1d95bc422b8f7da00c5098db232916a0d1b7
5+
refs/heads/try: 32c480d63d5f867f44719a83c4f58aa6cec6bea7
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ syn keyword rustTrait Default
7878
syn keyword rustTrait Hash
7979
syn keyword rustTrait FromStr
8080
syn keyword rustTrait FromIterator Extendable
81-
syn keyword rustTrait Iterator DoubleEndedIterator RandomAccessIterator ClonableIterator
81+
syn keyword rustTrait Iterator DoubleEndedIterator RandomAccessIterator CloneableIterator
8282
syn keyword rustTrait OrdIterator MutableDoubleEndedIterator ExactSize
8383
syn keyword rustTrait Times
8484

branches/try/src/libextra/enum_set.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
//! This module defines a container which uses an efficient bit mask
1414
//! representation to hold C-like enum variants.
1515
16-
#[deriving(Clone, Eq, IterBytes, ToStr, Encodable, Decodable)]
16+
#[deriving(Clone, Eq, IterBytes, ToStr)]
1717
/// A specialized Set implementation to use enum types.
1818
pub struct EnumSet<E> {
1919
// We must maintain the invariant that no bits are set

branches/try/src/libgreen/lib.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,11 @@ impl SchedPool {
214214
pool.handles.push(sched.make_handle());
215215
let sched = sched;
216216
pool.threads.push(do Thread::start {
217-
sched.bootstrap();
217+
let mut sched = sched;
218+
let task = do GreenTask::new(&mut sched.stack_pool, None) {
219+
rtdebug!("boostraping a non-primary scheduler");
220+
};
221+
sched.bootstrap(task);
218222
});
219223
}
220224

@@ -266,7 +270,13 @@ impl SchedPool {
266270
let ret = sched.make_handle();
267271
self.handles.push(sched.make_handle());
268272
let sched = sched;
269-
self.threads.push(do Thread::start { sched.bootstrap() });
273+
self.threads.push(do Thread::start {
274+
let mut sched = sched;
275+
let task = do GreenTask::new(&mut sched.stack_pool, None) {
276+
rtdebug!("boostraping a non-primary scheduler");
277+
};
278+
sched.bootstrap(task);
279+
});
270280

271281
return ret;
272282
}

branches/try/src/libgreen/sched.rs

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ impl Scheduler {
171171

172172
// Take a main task to run, and a scheduler to run it in. Create a
173173
// scheduler task and bootstrap into it.
174-
pub fn bootstrap(mut ~self) {
174+
pub fn bootstrap(mut ~self, task: ~GreenTask) {
175175

176176
// Build an Idle callback.
177177
let cb = ~SchedRunner as ~Callback;
@@ -187,11 +187,18 @@ impl Scheduler {
187187
self.idle_callback.get_mut_ref().resume();
188188

189189
// Now, as far as all the scheduler state is concerned, we are inside
190-
// the "scheduler" context. The scheduler immediately hands over control
191-
// to the event loop, and this will only exit once the event loop no
192-
// longer has any references (handles or I/O objects).
193-
rtdebug!("starting scheduler {}", self.sched_id());
194-
let mut sched_task = self.run(sched_task);
190+
// the "scheduler" context. So we can act like the scheduler and resume
191+
// the provided task. Let it think that the currently running task is
192+
// actually the sched_task so it knows where to squirrel it away.
193+
let mut sched_task = self.resume_task_immediately(sched_task, task);
194+
195+
// Now we are back in the scheduler context, having
196+
// successfully run the input task. Start by running the
197+
// scheduler. Grab it out of TLS - performing the scheduler
198+
// action will have given it away.
199+
let sched = sched_task.sched.take_unwrap();
200+
rtdebug!("starting scheduler {}", sched.sched_id());
201+
let mut sched_task = sched.run(sched_task);
195202

196203
// Close the idle callback.
197204
let mut sched = sched_task.sched.take_unwrap();
@@ -541,10 +548,7 @@ impl Scheduler {
541548
// We push the task onto our local queue clone.
542549
assert!(!task.is_sched());
543550
self.work_queue.push(task);
544-
match self.idle_callback {
545-
Some(ref mut idle) => idle.resume(),
546-
None => {} // allow enqueuing before the scheduler starts
547-
}
551+
self.idle_callback.get_mut_ref().resume();
548552

549553
// We've made work available. Notify a
550554
// sleeping scheduler.
@@ -1172,21 +1176,25 @@ mod test {
11721176
let mut sh = special_handle;
11731177
sh.send(Shutdown);
11741178
};
1175-
normal_sched.enqueue_task(normal_task);
1179+
11761180

11771181
let special_task = do GreenTask::new(&mut special_sched.stack_pool,
11781182
None) {
11791183
run(task1);
11801184
run(task3);
11811185
chan.send(());
11821186
};
1183-
special_sched.enqueue_task(special_task);
1187+
11841188

11851189
let normal_sched = normal_sched;
1186-
let normal_thread = do Thread::start { normal_sched.bootstrap() };
1190+
let normal_thread = do Thread::start {
1191+
normal_sched.bootstrap(normal_task);
1192+
};
11871193

11881194
let special_sched = special_sched;
1189-
let special_thread = do Thread::start { special_sched.bootstrap() };
1195+
let special_thread = do Thread::start {
1196+
special_sched.bootstrap(special_task);
1197+
};
11901198

11911199
normal_thread.join();
11921200
special_thread.join();

branches/try/src/librustc/metadata/tydecode.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,6 @@ pub fn parse_trait_ref_data(data: &[u8], crate_num: ast::CrateNum, pos: uint, tc
129129
parse_trait_ref(&mut st, conv)
130130
}
131131

132-
pub fn parse_substs_data(data: &[u8], crate_num: ast::CrateNum, pos: uint, tcx: ty::ctxt,
133-
conv: conv_did) -> ty::substs {
134-
let mut st = parse_state_from_data(data, crate_num, pos, tcx);
135-
parse_substs(&mut st, conv)
136-
}
137-
138132
fn parse_sigil(st: &mut PState) -> ast::Sigil {
139133
match next(st) {
140134
'@' => ast::ManagedSigil,

branches/try/src/librustc/metadata/tyencode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ fn enc_opt<T>(w: &mut MemWriter, t: Option<T>, enc_f: |&mut MemWriter, T|) {
140140
}
141141
}
142142

143-
pub fn enc_substs(w: &mut MemWriter, cx: @ctxt, substs: &ty::substs) {
143+
fn enc_substs(w: &mut MemWriter, cx: @ctxt, substs: &ty::substs) {
144144
enc_region_substs(w, cx, &substs.regions);
145145
enc_opt(w, substs.self_ty, |w, t| enc_ty(w, cx, t));
146146
mywrite!(w, "[");

branches/try/src/librustc/middle/astencode.rs

Lines changed: 12 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -450,13 +450,15 @@ impl tr for ast::Def {
450450
// ______________________________________________________________________
451451
// Encoding and decoding of adjustment information
452452

453-
impl tr for ty::AutoDerefRef {
454-
fn tr(&self, xcx: @ExtendedDecodeContext) -> ty::AutoDerefRef {
455-
ty::AutoDerefRef {
456-
autoderefs: self.autoderefs,
457-
autoref: match self.autoref {
458-
Some(ref autoref) => Some(autoref.tr(xcx)),
459-
None => None
453+
impl tr for ty::AutoAdjustment {
454+
fn tr(&self, xcx: @ExtendedDecodeContext) -> ty::AutoAdjustment {
455+
match *self {
456+
ty::AutoAddEnv(r, s) => ty::AutoAddEnv(r.tr(xcx), s),
457+
ty::AutoDerefRef(ref adr) => {
458+
ty::AutoDerefRef(ty::AutoDerefRef {
459+
autoderefs: adr.autoderefs,
460+
autoref: adr.autoref.map(|ar| ar.tr(xcx)),
461+
})
460462
}
461463
}
462464
}
@@ -784,8 +786,6 @@ trait ebml_writer_helpers {
784786
fn emit_tpbt(&mut self,
785787
ecx: &e::EncodeContext,
786788
tpbt: ty::ty_param_bounds_and_ty);
787-
fn emit_substs(&mut self, ecx: &e::EncodeContext, substs: &ty::substs);
788-
fn emit_auto_adjustment(&mut self, ecx: &e::EncodeContext, adj: &ty::AutoAdjustment);
789789
}
790790

791791
impl<'a> ebml_writer_helpers for writer::Encoder<'a> {
@@ -833,40 +833,6 @@ impl<'a> ebml_writer_helpers for writer::Encoder<'a> {
833833
})
834834
})
835835
}
836-
837-
fn emit_substs(&mut self, ecx: &e::EncodeContext, substs: &ty::substs) {
838-
self.emit_opaque(|this| tyencode::enc_substs(this.writer, ecx.ty_str_ctxt(), substs))
839-
}
840-
841-
fn emit_auto_adjustment(&mut self, ecx: &e::EncodeContext, adj: &ty::AutoAdjustment) {
842-
self.emit_enum("AutoAdjustment", |this| {
843-
match *adj {
844-
ty::AutoAddEnv(region, sigil) => {
845-
this.emit_enum_variant("AutoAddEnv", 0, 2, |this| {
846-
this.emit_enum_variant_arg(0, |this| region.encode(this));
847-
this.emit_enum_variant_arg(1, |this| sigil.encode(this));
848-
});
849-
}
850-
851-
ty::AutoDerefRef(ref auto_deref_ref) => {
852-
this.emit_enum_variant("AutoDerefRef", 1, 1, |this| {
853-
this.emit_enum_variant_arg(0, |this| auto_deref_ref.encode(this));
854-
});
855-
}
856-
857-
ty::AutoObject(sigil, region, m, b, def_id, ref substs) => {
858-
this.emit_enum_variant("AutoObject", 2, 6, |this| {
859-
this.emit_enum_variant_arg(0, |this| sigil.encode(this));
860-
this.emit_enum_variant_arg(1, |this| region.encode(this));
861-
this.emit_enum_variant_arg(2, |this| m.encode(this));
862-
this.emit_enum_variant_arg(3, |this| b.encode(this));
863-
this.emit_enum_variant_arg(4, |this| def_id.encode(this));
864-
this.emit_enum_variant_arg(5, |this| this.emit_substs(ecx, substs));
865-
});
866-
}
867-
}
868-
});
869-
}
870836
}
871837

872838
trait write_tag_and_id {
@@ -1057,7 +1023,7 @@ fn encode_side_tables_for_id(ecx: &e::EncodeContext,
10571023
ebml_w.tag(c::tag_table_adjustments, |ebml_w| {
10581024
ebml_w.id(id);
10591025
ebml_w.tag(c::tag_table_val, |ebml_w| {
1060-
ebml_w.emit_auto_adjustment(ecx, **adj);
1026+
(**adj).encode(ebml_w)
10611027
})
10621028
})
10631029
}
@@ -1098,8 +1064,6 @@ trait ebml_decoder_decoder_helpers {
10981064
-> ty::TypeParameterDef;
10991065
fn read_ty_param_bounds_and_ty(&mut self, xcx: @ExtendedDecodeContext)
11001066
-> ty::ty_param_bounds_and_ty;
1101-
fn read_substs(&mut self, xcx: @ExtendedDecodeContext) -> ty::substs;
1102-
fn read_auto_adjustment(&mut self, xcx: @ExtendedDecodeContext) -> ty::AutoAdjustment;
11031067
fn convert_def_id(&mut self,
11041068
xcx: @ExtendedDecodeContext,
11051069
source: DefIdSource,
@@ -1208,61 +1172,6 @@ impl<'a> ebml_decoder_decoder_helpers for reader::Decoder<'a> {
12081172
})
12091173
}
12101174

1211-
fn read_substs(&mut self, xcx: @ExtendedDecodeContext) -> ty::substs {
1212-
self.read_opaque(|this, doc| {
1213-
tydecode::parse_substs_data(doc.data,
1214-
xcx.dcx.cdata.cnum,
1215-
doc.start,
1216-
xcx.dcx.tcx,
1217-
|s, a| this.convert_def_id(xcx, s, a))
1218-
})
1219-
}
1220-
1221-
fn read_auto_adjustment(&mut self, xcx: @ExtendedDecodeContext) -> ty::AutoAdjustment {
1222-
self.read_enum("AutoAdjustment", |this| {
1223-
let variants = ["AutoAddEnv", "AutoDerefRef", "AutoObject"];
1224-
this.read_enum_variant(variants, |this, i| {
1225-
match i {
1226-
0 => {
1227-
let region: ty::Region =
1228-
this.read_enum_variant_arg(0, |this| Decodable::decode(this));
1229-
let sigil: ast::Sigil =
1230-
this.read_enum_variant_arg(1, |this| Decodable::decode(this));
1231-
1232-
ty:: AutoAddEnv(region.tr(xcx), sigil)
1233-
}
1234-
1 => {
1235-
let auto_deref_ref: ty::AutoDerefRef =
1236-
this.read_enum_variant_arg(0, |this| Decodable::decode(this));
1237-
1238-
ty::AutoDerefRef(auto_deref_ref.tr(xcx))
1239-
}
1240-
2 => {
1241-
let sigil: ast::Sigil =
1242-
this.read_enum_variant_arg(0, |this| Decodable::decode(this));
1243-
let region: Option<ty::Region> =
1244-
this.read_enum_variant_arg(1, |this| Decodable::decode(this));
1245-
let m: ast::Mutability =
1246-
this.read_enum_variant_arg(2, |this| Decodable::decode(this));
1247-
let b: ty::BuiltinBounds =
1248-
this.read_enum_variant_arg(3, |this| Decodable::decode(this));
1249-
let def_id: ast::DefId =
1250-
this.read_enum_variant_arg(4, |this| Decodable::decode(this));
1251-
let substs = this.read_enum_variant_arg(5, |this| this.read_substs(xcx));
1252-
1253-
let region = match region {
1254-
Some(r) => Some(r.tr(xcx)),
1255-
None => None
1256-
};
1257-
1258-
ty::AutoObject(sigil, region, m, b, def_id.tr(xcx), substs)
1259-
}
1260-
_ => fail!("bad enum variant for ty::AutoAdjustment")
1261-
}
1262-
})
1263-
})
1264-
}
1265-
12661175
fn convert_def_id(&mut self,
12671176
xcx: @ExtendedDecodeContext,
12681177
source: tydecode::DefIdSource,
@@ -1380,7 +1289,8 @@ fn decode_side_tables(xcx: @ExtendedDecodeContext,
13801289
vtable_map.get().insert(id, vtable_res);
13811290
}
13821291
c::tag_table_adjustments => {
1383-
let adj: @ty::AutoAdjustment = @val_dsr.read_auto_adjustment(xcx);
1292+
let adj: @ty::AutoAdjustment = @Decodable::decode(val_dsr);
1293+
adj.tr(xcx);
13841294
let mut adjustments = dcx.tcx
13851295
.adjustments
13861296
.borrow_mut();

branches/try/src/librustc/middle/borrowck/gather_loans/mod.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -419,10 +419,6 @@ impl<'a> GatherLoanCtxt<'a> {
419419
ty::AutoUnsafe(_) => {}
420420
}
421421
}
422-
423-
ty::AutoObject(..) => {
424-
// XXX: Handle @Trait to &Trait casts here?
425-
}
426422
}
427423
}
428424

branches/try/src/librustc/middle/borrowck/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ impl BorrowckCtxt {
490490
adj: @ty::AutoAdjustment)
491491
-> mc::cmt {
492492
match *adj {
493-
ty::AutoAddEnv(..) | ty::AutoObject(..) => {
493+
ty::AutoAddEnv(..) => {
494494
// no autoderefs
495495
mc::cat_expr_unadjusted(self.tcx, self.method_map, expr)
496496
}

0 commit comments

Comments
 (0)