Skip to content

Commit 1809725

Browse files
committed
---
yaml --- r: 73309 b: refs/heads/dist-snap c: 6d48456 h: refs/heads/master i: 73307: 915319d v: v3
1 parent 26c5e01 commit 1809725

27 files changed

+381
-525
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
99
refs/heads/incoming: b50030718cf28f2a5a81857a26b57442734fe854
10-
refs/heads/dist-snap: a246e8faf362a1615b5bb4938455dd70642e0f4b
10+
refs/heads/dist-snap: 6d4845668f1755bb92c3053419cb182a4599f1d5
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/libcore/cast.rs

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,17 @@
1212
1313
use sys;
1414
use unstable;
15-
16-
pub mod rusti {
17-
#[abi = "rust-intrinsic"]
18-
#[link_name = "rusti"]
19-
pub extern "rust-intrinsic" {
20-
fn forget<T>(x: T);
21-
22-
fn transmute<T,U>(e: T) -> U;
23-
}
24-
}
15+
use unstable::intrinsics;
2516

2617
/// Casts the value at `src` to U. The two types must have the same length.
2718
pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
28-
let mut dest: U = unstable::intrinsics::init();
19+
let mut dest: U = intrinsics::init();
2920
{
30-
let dest_ptr: *mut u8 = rusti::transmute(&mut dest);
31-
let src_ptr: *u8 = rusti::transmute(src);
32-
unstable::intrinsics::memmove64(dest_ptr,
33-
src_ptr,
34-
sys::size_of::<U>() as u64);
21+
let dest_ptr: *mut u8 = transmute(&mut dest);
22+
let src_ptr: *u8 = transmute(src);
23+
intrinsics::memmove64(dest_ptr,
24+
src_ptr,
25+
sys::size_of::<U>() as u64);
3526
}
3627
dest
3728
}
@@ -45,7 +36,7 @@ pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
4536
* reinterpret_cast on pointer types.
4637
*/
4738
#[inline(always)]
48-
pub unsafe fn forget<T>(thing: T) { rusti::forget(thing); }
39+
pub unsafe fn forget<T>(thing: T) { intrinsics::forget(thing); }
4940

5041
/**
5142
* Force-increment the reference count on a shared box. If used
@@ -65,7 +56,7 @@ pub unsafe fn bump_box_refcount<T>(t: @T) { forget(t); }
6556
*/
6657
#[inline(always)]
6758
pub unsafe fn transmute<L, G>(thing: L) -> G {
68-
rusti::transmute(thing)
59+
intrinsics::transmute(thing)
6960
}
7061

7162
/// Coerce an immutable reference to be mutable.

branches/dist-snap/src/libcore/logging.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,8 @@ pub fn log_type<T>(level: u32, object: &T) {
6666
}
6767

6868
fn newsched_log_str(msg: ~str) {
69-
use rt::task::Task;
70-
use rt::local::Local;
71-
7269
unsafe {
73-
match Local::try_unsafe_borrow::<Task>() {
70+
match rt::local_services::unsafe_try_borrow_local_services() {
7471
Some(local) => {
7572
// Use the available logger
7673
(*local).logger.log(Left(msg));

branches/dist-snap/src/libcore/rt/comm.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ use cast;
2020
use util;
2121
use ops::Drop;
2222
use kinds::Owned;
23-
use rt::sched::{Scheduler, Coroutine};
24-
use rt::local::Local;
23+
use rt::sched::Coroutine;
24+
use rt::local_sched;
2525
use unstable::intrinsics::{atomic_xchg, atomic_load};
2626
use util::Void;
2727
use comm::{GenericChan, GenericSmartChan, GenericPort, Peekable};
@@ -127,7 +127,7 @@ impl<T> ChanOne<T> {
127127
task_as_state => {
128128
// Port is blocked. Wake it up.
129129
let recvr: ~Coroutine = cast::transmute(task_as_state);
130-
let sched = Local::take::<Scheduler>();
130+
let sched = local_sched::take();
131131
sched.schedule_task(recvr);
132132
}
133133
}
@@ -157,7 +157,7 @@ impl<T> PortOne<T> {
157157
// XXX: Optimize this to not require the two context switches when data is available
158158

159159
// Switch to the scheduler to put the ~Task into the Packet state.
160-
let sched = Local::take::<Scheduler>();
160+
let sched = local_sched::take();
161161
do sched.deschedule_running_task_and_then |task| {
162162
unsafe {
163163
// Atomically swap the task pointer into the Packet state, issuing
@@ -173,7 +173,7 @@ impl<T> PortOne<T> {
173173
STATE_ONE => {
174174
// Channel is closed. Switch back and check the data.
175175
let task: ~Coroutine = cast::transmute(task_as_state);
176-
let sched = Local::take::<Scheduler>();
176+
let sched = local_sched::take();
177177
sched.resume_task_immediately(task);
178178
}
179179
_ => util::unreachable()
@@ -239,7 +239,7 @@ impl<T> Drop for ChanOneHack<T> {
239239
// The port is blocked waiting for a message we will never send. Wake it.
240240
assert!((*this.packet()).payload.is_none());
241241
let recvr: ~Coroutine = cast::transmute(task_as_state);
242-
let sched = Local::take::<Scheduler>();
242+
let sched = local_sched::take();
243243
sched.schedule_task(recvr);
244244
}
245245
}

branches/dist-snap/src/libcore/rt/io/net/tcp.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010

1111
use option::{Option, Some, None};
1212
use result::{Ok, Err};
13+
use rt::sched::local_sched::unsafe_borrow_io;
1314
use rt::io::net::ip::IpAddr;
1415
use rt::io::{Reader, Writer, Listener};
1516
use rt::io::{io_error, read_error, EndOfFile};
16-
use rt::rtio::{IoFactory, IoFactoryObject,
17+
use rt::rtio::{IoFactory,
1718
RtioTcpListener, RtioTcpListenerObject,
1819
RtioTcpStream, RtioTcpStreamObject};
19-
use rt::local::Local;
2020

2121
pub struct TcpStream {
2222
rtstream: ~RtioTcpStreamObject
@@ -32,7 +32,7 @@ impl TcpStream {
3232
pub fn connect(addr: IpAddr) -> Option<TcpStream> {
3333
let stream = unsafe {
3434
rtdebug!("borrowing io to connect");
35-
let io = Local::unsafe_borrow::<IoFactoryObject>();
35+
let io = unsafe_borrow_io();
3636
rtdebug!("about to connect");
3737
(*io).tcp_connect(addr)
3838
};
@@ -88,10 +88,7 @@ pub struct TcpListener {
8888

8989
impl TcpListener {
9090
pub fn bind(addr: IpAddr) -> Option<TcpListener> {
91-
let listener = unsafe {
92-
let io = Local::unsafe_borrow::<IoFactoryObject>();
93-
(*io).tcp_bind(addr)
94-
};
91+
let listener = unsafe { (*unsafe_borrow_io()).tcp_bind(addr) };
9592
match listener {
9693
Ok(l) => {
9794
Some(TcpListener {

branches/dist-snap/src/libcore/rt/local.rs

Lines changed: 0 additions & 118 deletions
This file was deleted.

0 commit comments

Comments
 (0)