Skip to content

Commit c1dcd8f

Browse files
committed
---
yaml --- r: 92788 b: refs/heads/auto c: 3c4eb2b h: refs/heads/master v: v3
1 parent 589f3e5 commit c1dcd8f

Some content is hidden

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

112 files changed

+3613
-5265
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: 00d87e0d8198ffb268251b5af2eb2ce19249c7f8
16+
refs/heads/auto: 3c4eb2b1d1e1dbebe42a9a93bd23b7eab8dc0f0f
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/libextra/ebml.rs

Lines changed: 40 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -593,13 +593,22 @@ pub mod writer {
593593
use std::io::extensions::u64_to_be_bytes;
594594

595595
// ebml writing
596-
pub struct Encoder<'a> {
596+
pub struct Encoder {
597597
// FIXME(#5665): this should take a trait object
598-
writer: &'a mut MemWriter,
598+
writer: @mut MemWriter,
599599
priv size_positions: ~[uint],
600600
}
601601

602-
fn write_sized_vuint(w: &mut MemWriter, n: uint, size: uint) {
602+
impl Clone for Encoder {
603+
fn clone(&self) -> Encoder {
604+
Encoder {
605+
writer: self.writer,
606+
size_positions: self.size_positions.clone(),
607+
}
608+
}
609+
}
610+
611+
fn write_sized_vuint(w: @mut MemWriter, n: uint, size: uint) {
603612
match size {
604613
1u => w.write(&[0x80u8 | (n as u8)]),
605614
2u => w.write(&[0x40u8 | ((n >> 8_u) as u8), n as u8]),
@@ -611,15 +620,15 @@ pub mod writer {
611620
};
612621
}
613622

614-
fn write_vuint(w: &mut MemWriter, n: uint) {
623+
fn write_vuint(w: @mut MemWriter, n: uint) {
615624
if n < 0x7f_u { write_sized_vuint(w, n, 1u); return; }
616625
if n < 0x4000_u { write_sized_vuint(w, n, 2u); return; }
617626
if n < 0x200000_u { write_sized_vuint(w, n, 3u); return; }
618627
if n < 0x10000000_u { write_sized_vuint(w, n, 4u); return; }
619628
fail!("vint to write too big: {}", n);
620629
}
621630

622-
pub fn Encoder<'a>(w: &'a mut MemWriter) -> Encoder<'a> {
631+
pub fn Encoder(w: @mut MemWriter) -> Encoder {
623632
let size_positions: ~[uint] = ~[];
624633
Encoder {
625634
writer: w,
@@ -628,15 +637,7 @@ pub mod writer {
628637
}
629638

630639
// FIXME (#2741): Provide a function to write the standard ebml header.
631-
impl<'a> Encoder<'a> {
632-
/// XXX(pcwalton): Workaround for badness in trans. DO NOT USE ME.
633-
pub unsafe fn unsafe_clone(&self) -> Encoder<'a> {
634-
Encoder {
635-
writer: cast::transmute_copy(&self.writer),
636-
size_positions: self.size_positions.clone(),
637-
}
638-
}
639-
640+
impl Encoder {
640641
pub fn start_tag(&mut self, tag_id: uint) {
641642
debug!("Start tag {}", tag_id);
642643

@@ -738,7 +739,7 @@ pub mod writer {
738739
// Totally lame approach.
739740
static DEBUG: bool = true;
740741

741-
impl<'a> Encoder<'a> {
742+
impl Encoder {
742743
// used internally to emit things like the vector length and so on
743744
fn _emit_tagged_uint(&mut self, t: EbmlEncoderTag, v: uint) {
744745
assert!(v <= 0xFFFF_FFFF_u);
@@ -754,15 +755,17 @@ pub mod writer {
754755
// try and check failures more quickly.
755756
if DEBUG { self.wr_tagged_str(EsLabel as uint, label) }
756757
}
758+
}
757759

760+
impl Encoder {
758761
pub fn emit_opaque(&mut self, f: |&mut Encoder|) {
759762
self.start_tag(EsOpaque as uint);
760763
f(self);
761764
self.end_tag();
762765
}
763766
}
764767

765-
impl<'a> ::serialize::Encoder for Encoder<'a> {
768+
impl ::serialize::Encoder for Encoder {
766769
fn emit_nil(&mut self) {}
767770

768771
fn emit_uint(&mut self, v: uint) {
@@ -817,7 +820,7 @@ pub mod writer {
817820
self.wr_tagged_str(EsStr as uint, v)
818821
}
819822

820-
fn emit_enum(&mut self, name: &str, f: |&mut Encoder<'a>|) {
823+
fn emit_enum(&mut self, name: &str, f: |&mut Encoder|) {
821824
self._emit_label(name);
822825
self.start_tag(EsEnum as uint);
823826
f(self);
@@ -828,103 +831,98 @@ pub mod writer {
828831
_: &str,
829832
v_id: uint,
830833
_: uint,
831-
f: |&mut Encoder<'a>|) {
834+
f: |&mut Encoder|) {
832835
self._emit_tagged_uint(EsEnumVid, v_id);
833836
self.start_tag(EsEnumBody as uint);
834837
f(self);
835838
self.end_tag();
836839
}
837840

838-
fn emit_enum_variant_arg(&mut self, _: uint, f: |&mut Encoder<'a>|) {
841+
fn emit_enum_variant_arg(&mut self, _: uint, f: |&mut Encoder|) {
839842
f(self)
840843
}
841844

842845
fn emit_enum_struct_variant(&mut self,
843846
v_name: &str,
844847
v_id: uint,
845848
cnt: uint,
846-
f: |&mut Encoder<'a>|) {
849+
f: |&mut Encoder|) {
847850
self.emit_enum_variant(v_name, v_id, cnt, f)
848851
}
849852

850853
fn emit_enum_struct_variant_field(&mut self,
851854
_: &str,
852855
idx: uint,
853-
f: |&mut Encoder<'a>|) {
856+
f: |&mut Encoder|) {
854857
self.emit_enum_variant_arg(idx, f)
855858
}
856859

857-
fn emit_struct(&mut self,
858-
_: &str,
859-
_len: uint,
860-
f: |&mut Encoder<'a>|) {
860+
fn emit_struct(&mut self, _: &str, _len: uint, f: |&mut Encoder|) {
861861
f(self)
862862
}
863863

864864
fn emit_struct_field(&mut self,
865865
name: &str,
866866
_: uint,
867-
f: |&mut Encoder<'a>|) {
867+
f: |&mut Encoder|) {
868868
self._emit_label(name);
869869
f(self)
870870
}
871871

872-
fn emit_tuple(&mut self, len: uint, f: |&mut Encoder<'a>|) {
872+
fn emit_tuple(&mut self, len: uint, f: |&mut Encoder|) {
873873
self.emit_seq(len, f)
874874
}
875-
fn emit_tuple_arg(&mut self, idx: uint, f: |&mut Encoder<'a>|) {
875+
fn emit_tuple_arg(&mut self, idx: uint, f: |&mut Encoder|) {
876876
self.emit_seq_elt(idx, f)
877877
}
878878

879879
fn emit_tuple_struct(&mut self,
880880
_: &str,
881881
len: uint,
882-
f: |&mut Encoder<'a>|) {
882+
f: |&mut Encoder|) {
883883
self.emit_seq(len, f)
884884
}
885-
fn emit_tuple_struct_arg(&mut self,
886-
idx: uint,
887-
f: |&mut Encoder<'a>|) {
885+
fn emit_tuple_struct_arg(&mut self, idx: uint, f: |&mut Encoder|) {
888886
self.emit_seq_elt(idx, f)
889887
}
890888

891-
fn emit_option(&mut self, f: |&mut Encoder<'a>|) {
889+
fn emit_option(&mut self, f: |&mut Encoder|) {
892890
self.emit_enum("Option", f);
893891
}
894892
fn emit_option_none(&mut self) {
895893
self.emit_enum_variant("None", 0, 0, |_| ())
896894
}
897-
fn emit_option_some(&mut self, f: |&mut Encoder<'a>|) {
895+
fn emit_option_some(&mut self, f: |&mut Encoder|) {
898896
self.emit_enum_variant("Some", 1, 1, f)
899897
}
900898

901-
fn emit_seq(&mut self, len: uint, f: |&mut Encoder<'a>|) {
899+
fn emit_seq(&mut self, len: uint, f: |&mut Encoder|) {
902900
self.start_tag(EsVec as uint);
903901
self._emit_tagged_uint(EsVecLen, len);
904902
f(self);
905903
self.end_tag();
906904
}
907905

908-
fn emit_seq_elt(&mut self, _idx: uint, f: |&mut Encoder<'a>|) {
906+
fn emit_seq_elt(&mut self, _idx: uint, f: |&mut Encoder|) {
909907
self.start_tag(EsVecElt as uint);
910908
f(self);
911909
self.end_tag();
912910
}
913911

914-
fn emit_map(&mut self, len: uint, f: |&mut Encoder<'a>|) {
912+
fn emit_map(&mut self, len: uint, f: |&mut Encoder|) {
915913
self.start_tag(EsMap as uint);
916914
self._emit_tagged_uint(EsMapLen, len);
917915
f(self);
918916
self.end_tag();
919917
}
920918

921-
fn emit_map_elt_key(&mut self, _idx: uint, f: |&mut Encoder<'a>|) {
919+
fn emit_map_elt_key(&mut self, _idx: uint, f: |&mut Encoder|) {
922920
self.start_tag(EsMapKey as uint);
923921
f(self);
924922
self.end_tag();
925923
}
926924

927-
fn emit_map_elt_val(&mut self, _idx: uint, f: |&mut Encoder<'a>|) {
925+
fn emit_map_elt_val(&mut self, _idx: uint, f: |&mut Encoder|) {
928926
self.start_tag(EsMapVal as uint);
929927
f(self);
930928
self.end_tag();
@@ -950,11 +948,9 @@ mod tests {
950948
fn test_option_int() {
951949
fn test_v(v: Option<int>) {
952950
debug!("v == {:?}", v);
953-
let mut wr = MemWriter::new();
954-
{
955-
let mut ebml_w = writer::Encoder(&mut wr);
956-
v.encode(&mut ebml_w);
957-
}
951+
let wr = @mut MemWriter::new();
952+
let mut ebml_w = writer::Encoder(wr);
953+
v.encode(&mut ebml_w);
958954
let ebml_doc = reader::Doc(*wr.inner_ref());
959955
let mut deser = reader::Decoder(ebml_doc);
960956
let v1 = serialize::Decodable::decode(&mut deser);

branches/auto/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/auto/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/auto/src/librustc/back/archive.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,7 @@ impl Archive {
187187

188188
let mut rustpath = filesearch::rust_path();
189189
rustpath.push(self.sess.filesearch.get_target_lib_path());
190-
let addl_lib_search_paths = self.sess
191-
.opts
192-
.addl_lib_search_paths
193-
.borrow();
194-
let path = addl_lib_search_paths.get().iter();
190+
let path = self.sess.opts.addl_lib_search_paths.iter();
195191
for path in path.chain(rustpath.iter()) {
196192
debug!("looking for {} inside {}", name, path.display());
197193
let test = path.join(oslibname.as_slice());

0 commit comments

Comments
 (0)