Skip to content

Commit 4651142

Browse files
committed
---
yaml --- r: 97192 b: refs/heads/dist-snap c: 200c52a h: refs/heads/master v: v3
1 parent 8e5111f commit 4651142

File tree

31 files changed

+750
-240
lines changed

31 files changed

+750
-240
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: c274a6888410ce3e357e014568b43310ed787d36
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: 2a4f9d69afd19603ed3354fa8e64ab0e67c6a915
9+
refs/heads/dist-snap: 200c52a34e7673ab4186f86394c52874c98b4ffa
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/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/dist-snap/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)]
16+
#[deriving(Clone, Eq, IterBytes, ToStr, Encodable, Decodable)]
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/dist-snap/src/libgreen/lib.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -214,11 +214,7 @@ impl SchedPool {
214214
pool.handles.push(sched.make_handle());
215215
let sched = sched;
216216
pool.threads.push(do Thread::start {
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);
217+
sched.bootstrap();
222218
});
223219
}
224220

@@ -270,13 +266,7 @@ impl SchedPool {
270266
let ret = sched.make_handle();
271267
self.handles.push(sched.make_handle());
272268
let sched = sched;
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-
});
269+
self.threads.push(do Thread::start { sched.bootstrap() });
280270

281271
return ret;
282272
}

branches/dist-snap/src/libgreen/sched.rs

Lines changed: 14 additions & 22 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, task: ~GreenTask) {
174+
pub fn bootstrap(mut ~self) {
175175

176176
// Build an Idle callback.
177177
let cb = ~SchedRunner as ~Callback;
@@ -187,18 +187,11 @@ 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. 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);
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);
202195

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

553549
// We've made work available. Notify a
554550
// sleeping scheduler.
@@ -1176,25 +1172,21 @@ mod test {
11761172
let mut sh = special_handle;
11771173
sh.send(Shutdown);
11781174
};
1179-
1175+
normal_sched.enqueue_task(normal_task);
11801176

11811177
let special_task = do GreenTask::new(&mut special_sched.stack_pool,
11821178
None) {
11831179
run(task1);
11841180
run(task3);
11851181
chan.send(());
11861182
};
1187-
1183+
special_sched.enqueue_task(special_task);
11881184

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

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

11991191
normal_thread.join();
12001192
special_thread.join();

branches/dist-snap/src/librustc/back/link.rs

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -111,38 +111,14 @@ pub mod write {
111111
let llmod = trans.module;
112112
let llcx = trans.context;
113113
unsafe {
114-
llvm::LLVMInitializePasses();
115-
116-
// Only initialize the platforms supported by Rust here, because
117-
// using --llvm-root will have multiple platforms that rustllvm
118-
// doesn't actually link to and it's pointless to put target info
119-
// into the registry that Rust can not generate machine code for.
120-
llvm::LLVMInitializeX86TargetInfo();
121-
llvm::LLVMInitializeX86Target();
122-
llvm::LLVMInitializeX86TargetMC();
123-
llvm::LLVMInitializeX86AsmPrinter();
124-
llvm::LLVMInitializeX86AsmParser();
125-
126-
llvm::LLVMInitializeARMTargetInfo();
127-
llvm::LLVMInitializeARMTarget();
128-
llvm::LLVMInitializeARMTargetMC();
129-
llvm::LLVMInitializeARMAsmPrinter();
130-
llvm::LLVMInitializeARMAsmParser();
131-
132-
llvm::LLVMInitializeMipsTargetInfo();
133-
llvm::LLVMInitializeMipsTarget();
134-
llvm::LLVMInitializeMipsTargetMC();
135-
llvm::LLVMInitializeMipsAsmPrinter();
136-
llvm::LLVMInitializeMipsAsmParser();
114+
configure_llvm(sess);
137115

138116
if sess.opts.save_temps {
139117
output.with_extension("no-opt.bc").with_c_str(|buf| {
140118
llvm::LLVMWriteBitcodeToFile(llmod, buf);
141119
})
142120
}
143121

144-
configure_llvm(sess);
145-
146122
let OptLevel = match sess.opts.optimize {
147123
session::No => lib::llvm::CodeGenLevelNone,
148124
session::Less => lib::llvm::CodeGenLevelLess,
@@ -367,6 +343,30 @@ pub mod write {
367343

368344
LOCK.lock();
369345
if !CONFIGURED {
346+
llvm::LLVMInitializePasses();
347+
348+
// Only initialize the platforms supported by Rust here, because
349+
// using --llvm-root will have multiple platforms that rustllvm
350+
// doesn't actually link to and it's pointless to put target info
351+
// into the registry that Rust can not generate machine code for.
352+
llvm::LLVMInitializeX86TargetInfo();
353+
llvm::LLVMInitializeX86Target();
354+
llvm::LLVMInitializeX86TargetMC();
355+
llvm::LLVMInitializeX86AsmPrinter();
356+
llvm::LLVMInitializeX86AsmParser();
357+
358+
llvm::LLVMInitializeARMTargetInfo();
359+
llvm::LLVMInitializeARMTarget();
360+
llvm::LLVMInitializeARMTargetMC();
361+
llvm::LLVMInitializeARMAsmPrinter();
362+
llvm::LLVMInitializeARMAsmParser();
363+
364+
llvm::LLVMInitializeMipsTargetInfo();
365+
llvm::LLVMInitializeMipsTarget();
366+
llvm::LLVMInitializeMipsTargetMC();
367+
llvm::LLVMInitializeMipsAsmPrinter();
368+
llvm::LLVMInitializeMipsAsmParser();
369+
370370
llvm::LLVMRustSetLLVMOptions(llvm_args.len() as c_int,
371371
llvm_args.as_ptr());
372372
CONFIGURED = true;

branches/dist-snap/src/librustc/metadata/tydecode.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,12 @@ 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+
132138
fn parse_sigil(st: &mut PState) -> ast::Sigil {
133139
match next(st) {
134140
'@' => ast::ManagedSigil,

branches/dist-snap/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-
fn enc_substs(w: &mut MemWriter, cx: @ctxt, substs: &ty::substs) {
143+
pub 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/dist-snap/src/librustc/middle/astencode.rs

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

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-
})
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
462460
}
463461
}
464462
}
@@ -786,6 +784,8 @@ trait ebml_writer_helpers {
786784
fn emit_tpbt(&mut self,
787785
ecx: &e::EncodeContext,
788786
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,6 +833,40 @@ 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+
}
836870
}
837871

838872
trait write_tag_and_id {
@@ -1023,7 +1057,7 @@ fn encode_side_tables_for_id(ecx: &e::EncodeContext,
10231057
ebml_w.tag(c::tag_table_adjustments, |ebml_w| {
10241058
ebml_w.id(id);
10251059
ebml_w.tag(c::tag_table_val, |ebml_w| {
1026-
(**adj).encode(ebml_w)
1060+
ebml_w.emit_auto_adjustment(ecx, **adj);
10271061
})
10281062
})
10291063
}
@@ -1064,6 +1098,8 @@ trait ebml_decoder_decoder_helpers {
10641098
-> ty::TypeParameterDef;
10651099
fn read_ty_param_bounds_and_ty(&mut self, xcx: @ExtendedDecodeContext)
10661100
-> 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;
10671103
fn convert_def_id(&mut self,
10681104
xcx: @ExtendedDecodeContext,
10691105
source: DefIdSource,
@@ -1172,6 +1208,61 @@ impl<'a> ebml_decoder_decoder_helpers for reader::Decoder<'a> {
11721208
})
11731209
}
11741210

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+
11751266
fn convert_def_id(&mut self,
11761267
xcx: @ExtendedDecodeContext,
11771268
source: tydecode::DefIdSource,
@@ -1289,8 +1380,7 @@ fn decode_side_tables(xcx: @ExtendedDecodeContext,
12891380
vtable_map.get().insert(id, vtable_res);
12901381
}
12911382
c::tag_table_adjustments => {
1292-
let adj: @ty::AutoAdjustment = @Decodable::decode(val_dsr);
1293-
adj.tr(xcx);
1383+
let adj: @ty::AutoAdjustment = @val_dsr.read_auto_adjustment(xcx);
12941384
let mut adjustments = dcx.tcx
12951385
.adjustments
12961386
.borrow_mut();

branches/dist-snap/src/librustc/middle/borrowck/gather_loans/mod.rs

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

0 commit comments

Comments
 (0)