Skip to content

Commit af94ea3

Browse files
committed
---
yaml --- r: 146260 b: refs/heads/try2 c: 2290131 h: refs/heads/master v: v3
1 parent 556d5bb commit af94ea3

File tree

19 files changed

+233
-220
lines changed

19 files changed

+233
-220
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: 671ab42a3b86addf7b90ff126554a092579e589a
8+
refs/heads/try2: 2290131543af4da764343c546efbd5c6dc9e7d71
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libextra/future.rs

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

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

branches/try2/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/try2/src/librustc/middle/trans/base.rs

Lines changed: 6 additions & 14 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);
@@ -2850,8 +2844,6 @@ pub fn declare_intrinsics(llmod: ModuleRef) -> HashMap<&'static str, ValueRef> {
28502844
ifn!(intrinsics, "llvm.umul.with.overflow.i64",
28512845
[Type::i64(), Type::i64()], Type::struct_([Type::i64(), Type::i1()], false));
28522846

2853-
ifn!(intrinsics, "llvm.expect.i1", [Type::i1(), Type::i1()], Type::i1());
2854-
28552847
return intrinsics;
28562848
}
28572849

branches/try2/src/librustc/middle/trans/expr.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -981,9 +981,7 @@ fn trans_lvalue_unadjusted(bcx: @mut Block, expr: &ast::Expr) -> DatumBlock {
981981
debug!("trans_index: len {}", bcx.val_to_str(len));
982982

983983
let bounds_check = ICmp(bcx, lib::llvm::IntUGE, ix_val, len);
984-
let expect = ccx.intrinsics.get_copy(&("llvm.expect.i1"));
985-
let expected = Call(bcx, expect, [bounds_check, C_i1(false)], []);
986-
let bcx = do with_cond(bcx, expected) |bcx| {
984+
let bcx = do with_cond(bcx, bounds_check) |bcx| {
987985
controlflow::trans_fail_bounds_check(bcx, index_expr.span, ix_val, len)
988986
};
989987
let elt = InBoundsGEP(bcx, base, [ix_val]);

branches/try2/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/try2/src/libstd/rt/comm.rs

Lines changed: 17 additions & 23 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(self, val: T, do_resched: bool) -> bool {
116+
fn try_send_inner(mut self, val: T, do_resched: bool) -> bool {
117117
if do_resched {
118118
rtassert!(!rt::in_sched_context());
119119
}
@@ -129,9 +129,8 @@ impl<T> ChanOne<T> {
129129
sched.maybe_yield();
130130
}
131131

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

136135
unsafe {
137136

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

155154
match oldstate {
156155
STATE_BOTH => {
157156
// Port is not waiting yet. Nothing to do
158157
}
159158
STATE_ONE => {
160159
// Port has closed. Need to clean up.
161-
let _packet: ~Packet<T> = cast::transmute(this.void_packet);
160+
let _packet: ~Packet<T> = cast::transmute(self.void_packet);
162161
recvr_active = false;
163162
}
164163
task_as_state => {
@@ -202,22 +201,20 @@ impl<T> PortOne<T> {
202201
}
203202

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

219216
// Task resumes.
220-
this.recv_ready()
217+
self.recv_ready()
221218
}
222219
}
223220

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

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

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

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

380376
unsafe {
381-
let this = cast::transmute_mut(self);
382-
let oldstate = (*this.packet()).state.swap(STATE_ONE, SeqCst);
377+
let oldstate = (*self.packet()).state.swap(STATE_ONE, SeqCst);
383378
match oldstate {
384379
STATE_BOTH => {
385380
// Port still active. It will destroy the Packet.
386381
},
387382
STATE_ONE => {
388-
let _packet: ~Packet<T> = cast::transmute(this.void_packet);
383+
let _packet: ~Packet<T> = cast::transmute(self.void_packet);
389384
},
390385
task_as_state => {
391386
// The port is blocked waiting for a message we will never send. Wake it.
392-
rtassert!((*this.packet()).payload.is_none());
387+
rtassert!((*self.packet()).payload.is_none());
393388
let recvr = BlockedTask::cast_from_uint(task_as_state);
394389
do recvr.wake().map |woken_task| {
395390
Scheduler::run_task(woken_task);
@@ -406,14 +401,13 @@ impl<T> Drop for PortOne<T> {
406401
if self.suppress_finalize { return }
407402

408403
unsafe {
409-
let this = cast::transmute_mut(self);
410-
let oldstate = (*this.packet()).state.swap(STATE_ONE, SeqCst);
404+
let oldstate = (*self.packet()).state.swap(STATE_ONE, SeqCst);
411405
match oldstate {
412406
STATE_BOTH => {
413407
// Chan still active. It will destroy the packet.
414408
},
415409
STATE_ONE => {
416-
let _packet: ~Packet<T> = cast::transmute(this.void_packet);
410+
let _packet: ~Packet<T> = cast::transmute(self.void_packet);
417411
}
418412
task_as_state => {
419413
// This case occurs during unwinding, when the blocked

branches/try2/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)