Skip to content

Commit 07135e9

Browse files
author
Keegan McAllister
committed
---
yaml --- r: 93310 b: refs/heads/try c: f6b236b h: refs/heads/master v: v3
1 parent 6d4ac44 commit 07135e9

File tree

19 files changed

+257
-195
lines changed

19 files changed

+257
-195
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: 73091583dd42991213e102daefa9181ce500feb0
5+
refs/heads/try: f6b236b9d2780edc1336ea5f62c2ba0fed6e34c5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/libextra/future.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,10 @@ impl<A:Clone> Future<A> {
5151

5252
impl<A> Future<A> {
5353
/// Gets the value from this future, forcing evaluation.
54-
pub fn unwrap(mut self) -> A {
55-
self.get_ref();
56-
let state = replace(&mut self.state, Evaluating);
54+
pub fn unwrap(self) -> A {
55+
let mut this = self;
56+
this.get_ref();
57+
let state = replace(&mut this.state, Evaluating);
5758
match state {
5859
Forced(v) => v,
5960
_ => fail!( "Logic error." ),

branches/try/src/librustc/lib/llvm.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -693,8 +693,6 @@ pub mod llvm {
693693
pub fn LLVMAddReturnAttribute(Fn: ValueRef, PA: c_uint);
694694
pub fn LLVMRemoveReturnAttribute(Fn: ValueRef, PA: c_uint);
695695

696-
pub fn LLVMAddColdAttribute(Fn: ValueRef);
697-
698696
pub fn LLVMRemoveFunctionAttr(Fn: ValueRef,
699697
PA: c_ulonglong,
700698
HighPA: c_ulonglong);

branches/try/src/librustc/middle/trans/base.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -202,21 +202,19 @@ pub fn get_extern_fn(externs: &mut ExternMap, llmod: ModuleRef, name: &str,
202202
f
203203
}
204204

205-
fn get_extern_rust_fn(ccx: &mut CrateContext, inputs: &[ty::t], output: ty::t,
206-
name: &str, did: ast::DefId) -> ValueRef {
205+
pub fn get_extern_rust_fn(ccx: &mut CrateContext, inputs: &[ty::t], output: ty::t,
206+
name: &str) -> ValueRef {
207207
match ccx.externs.find_equiv(&name) {
208208
Some(n) => return *n,
209209
None => ()
210210
}
211211
let f = decl_rust_fn(ccx, inputs, output, name);
212-
do csearch::get_item_attrs(ccx.tcx.cstore, did) |meta_items| {
213-
set_llvm_fn_attrs(meta_items.iter().map(|&x| attr::mk_attr(x)).to_owned_vec(), f)
214-
}
215212
ccx.externs.insert(name.to_owned(), f);
216213
f
217214
}
218215

219-
fn decl_rust_fn(ccx: &mut CrateContext, inputs: &[ty::t], output: ty::t, name: &str) -> ValueRef {
216+
pub fn decl_rust_fn(ccx: &mut CrateContext, inputs: &[ty::t], output: ty::t,
217+
name: &str) -> ValueRef {
220218
let llfty = type_of_rust_fn(ccx, inputs, output);
221219
let llfn = decl_cdecl_fn(ccx.llmod, name, llfty);
222220

@@ -483,10 +481,6 @@ pub fn set_llvm_fn_attrs(attrs: &[ast::Attribute], llfn: ValueRef) {
483481
if contains_name(attrs, "no_split_stack") {
484482
set_no_split_stack(llfn);
485483
}
486-
487-
if contains_name(attrs, "cold") {
488-
unsafe { llvm::LLVMAddColdAttribute(llfn) }
489-
}
490484
}
491485

492486
pub fn set_always_inline(f: ValueRef) {
@@ -846,7 +840,7 @@ pub fn trans_external_path(ccx: &mut CrateContext, did: ast::DefId, t: ty::t) ->
846840
ty::ty_bare_fn(ref fn_ty) => {
847841
match fn_ty.abis.for_arch(ccx.sess.targ_cfg.arch) {
848842
Some(Rust) | Some(RustIntrinsic) => {
849-
get_extern_rust_fn(ccx, fn_ty.sig.inputs, fn_ty.sig.output, name, did)
843+
get_extern_rust_fn(ccx, fn_ty.sig.inputs, fn_ty.sig.output, name)
850844
}
851845
Some(*) | None => {
852846
let c = foreign::llvm_calling_convention(ccx, fn_ty.abis);
@@ -857,7 +851,7 @@ pub fn trans_external_path(ccx: &mut CrateContext, did: ast::DefId, t: ty::t) ->
857851
}
858852
}
859853
ty::ty_closure(ref f) => {
860-
get_extern_rust_fn(ccx, f.sig.inputs, f.sig.output, name, did)
854+
get_extern_rust_fn(ccx, f.sig.inputs, f.sig.output, name)
861855
}
862856
_ => {
863857
let llty = type_of(ccx, t);

branches/try/src/libstd/rt/borrowck.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ pub fn clear_task_borrow_list() {
5757
let _ = try_take_task_borrow_list();
5858
}
5959

60-
#[cold]
6160
unsafe fn fail_borrowed(box: *mut raw::Box<()>, file: *c_char, line: size_t) -> ! {
6261
debug_borrow("fail_borrowed: ", box, 0, 0, file, line);
6362

branches/try/src/libstd/rt/comm.rs

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ impl<T> ChanOne<T> {
113113

114114
// 'do_resched' configures whether the scheduler immediately switches to
115115
// the receiving task, or leaves the sending task still running.
116-
fn try_send_inner(mut self, val: T, do_resched: bool) -> bool {
116+
fn try_send_inner(self, val: T, do_resched: bool) -> bool {
117117
if do_resched {
118118
rtassert!(!rt::in_sched_context());
119119
}
@@ -129,8 +129,9 @@ impl<T> ChanOne<T> {
129129
sched.maybe_yield();
130130
}
131131

132+
let mut this = self;
132133
let mut recvr_active = true;
133-
let packet = self.packet();
134+
let packet = this.packet();
134135

135136
unsafe {
136137

@@ -149,15 +150,15 @@ impl<T> ChanOne<T> {
149150
// done with the packet. NB: In case of do_resched, this *must*
150151
// happen before waking up a blocked task (or be unkillable),
151152
// because we might get a kill signal during the reschedule.
152-
self.suppress_finalize = true;
153+
this.suppress_finalize = true;
153154

154155
match oldstate {
155156
STATE_BOTH => {
156157
// Port is not waiting yet. Nothing to do
157158
}
158159
STATE_ONE => {
159160
// Port has closed. Need to clean up.
160-
let _packet: ~Packet<T> = cast::transmute(self.void_packet);
161+
let _packet: ~Packet<T> = cast::transmute(this.void_packet);
161162
recvr_active = false;
162163
}
163164
task_as_state => {
@@ -201,20 +202,22 @@ impl<T> PortOne<T> {
201202
}
202203

203204
/// As `recv`, but returns `None` if the send end is closed rather than failing.
204-
pub fn try_recv(mut self) -> Option<T> {
205+
pub fn try_recv(self) -> Option<T> {
206+
let mut this = self;
207+
205208
// Optimistic check. If data was sent already, we don't even need to block.
206209
// No release barrier needed here; we're not handing off our task pointer yet.
207-
if !self.optimistic_check() {
210+
if !this.optimistic_check() {
208211
// No data available yet.
209212
// Switch to the scheduler to put the ~Task into the Packet state.
210213
let sched: ~Scheduler = Local::take();
211214
do sched.deschedule_running_task_and_then |sched, task| {
212-
self.block_on(sched, task);
215+
this.block_on(sched, task);
213216
}
214217
}
215218

216219
// Task resumes.
217-
self.recv_ready()
220+
this.recv_ready()
218221
}
219222
}
220223

@@ -322,8 +325,9 @@ impl<T> SelectInner for PortOne<T> {
322325
impl<T> Select for PortOne<T> { }
323326

324327
impl<T> SelectPortInner<T> for PortOne<T> {
325-
fn recv_ready(mut self) -> Option<T> {
326-
let packet = self.packet();
328+
fn recv_ready(self) -> Option<T> {
329+
let mut this = self;
330+
let packet = this.packet();
327331

328332
// No further memory barrier is needed here to access the
329333
// payload. Some scenarios:
@@ -344,9 +348,9 @@ impl<T> SelectPortInner<T> for PortOne<T> {
344348
let payload = (*packet).payload.take();
345349

346350
// The sender has closed up shop. Drop the packet.
347-
let _packet: ~Packet<T> = cast::transmute(self.void_packet);
351+
let _packet: ~Packet<T> = cast::transmute(this.void_packet);
348352
// Suppress the synchronizing actions in the finalizer. We're done with the packet.
349-
self.suppress_finalize = true;
353+
this.suppress_finalize = true;
350354
return payload;
351355
}
352356
}
@@ -374,17 +378,18 @@ impl<T> Drop for ChanOne<T> {
374378
if self.suppress_finalize { return }
375379

376380
unsafe {
377-
let oldstate = (*self.packet()).state.swap(STATE_ONE, SeqCst);
381+
let this = cast::transmute_mut(self);
382+
let oldstate = (*this.packet()).state.swap(STATE_ONE, SeqCst);
378383
match oldstate {
379384
STATE_BOTH => {
380385
// Port still active. It will destroy the Packet.
381386
},
382387
STATE_ONE => {
383-
let _packet: ~Packet<T> = cast::transmute(self.void_packet);
388+
let _packet: ~Packet<T> = cast::transmute(this.void_packet);
384389
},
385390
task_as_state => {
386391
// The port is blocked waiting for a message we will never send. Wake it.
387-
rtassert!((*self.packet()).payload.is_none());
392+
rtassert!((*this.packet()).payload.is_none());
388393
let recvr = BlockedTask::cast_from_uint(task_as_state);
389394
do recvr.wake().map |woken_task| {
390395
Scheduler::run_task(woken_task);
@@ -401,13 +406,14 @@ impl<T> Drop for PortOne<T> {
401406
if self.suppress_finalize { return }
402407

403408
unsafe {
404-
let oldstate = (*self.packet()).state.swap(STATE_ONE, SeqCst);
409+
let this = cast::transmute_mut(self);
410+
let oldstate = (*this.packet()).state.swap(STATE_ONE, SeqCst);
405411
match oldstate {
406412
STATE_BOTH => {
407413
// Chan still active. It will destroy the packet.
408414
},
409415
STATE_ONE => {
410-
let _packet: ~Packet<T> = cast::transmute(self.void_packet);
416+
let _packet: ~Packet<T> = cast::transmute(this.void_packet);
411417
}
412418
task_as_state => {
413419
// This case occurs during unwinding, when the blocked

branches/try/src/libstd/rt/io/net/unix.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,7 @@ mod tests {
243243
let mut stop = false;
244244
while !stop{
245245
do io_error::cond.trap(|e| {
246-
assert!(e.kind == BrokenPipe || e.kind == NotConnected,
247-
"unknown error {:?}", e);
246+
assert_eq!(e.kind, BrokenPipe);
248247
stop = true;
249248
}).inside {
250249
server.write(buf);

0 commit comments

Comments
 (0)