Skip to content

Remove the C++ runtime. Sayonara #8387

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions mk/rt.mk
Original file line number Diff line number Diff line change
Expand Up @@ -66,30 +66,21 @@ RUNTIME_CXXS_$(1)_$(2) := \
rt/sync/timer.cpp \
rt/sync/lock_and_signal.cpp \
rt/sync/rust_thread.cpp \
rt/rust.cpp \
rt/rust_builtin.cpp \
rt/rust_run_program.cpp \
rt/rust_env.cpp \
rt/rust_rng.cpp \
rt/rust_sched_loop.cpp \
rt/rust_sched_launcher.cpp \
rt/rust_sched_driver.cpp \
rt/rust_scheduler.cpp \
rt/rust_sched_reaper.cpp \
rt/rust_task.cpp \
rt/rust_stack.cpp \
rt/rust_upcall.cpp \
rt/rust_uv.cpp \
rt/rust_crate_map.cpp \
rt/rust_log.cpp \
rt/rust_gc_metadata.cpp \
rt/rust_util.cpp \
rt/rust_log.cpp \
rt/rust_exchange_alloc.cpp \
rt/isaac/randport.cpp \
rt/miniz.cpp \
rt/rust_kernel.cpp \
rt/rust_abi.cpp \
rt/rust_debug.cpp \
rt/memory_region.cpp \
rt/boxed_region.cpp \
rt/arch/$$(HOST_$(1))/context.cpp \
Expand Down
4 changes: 2 additions & 2 deletions src/libextra/arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -596,14 +596,14 @@ mod tests {
let (c,p) = (Cell::new(c), Cell::new(p));
do task::spawn || {
// wait until parent gets in
comm::recv_one(p.take());
p.take().recv();
do arc2.access_cond |state, cond| {
*state = true;
cond.signal();
}
}
do arc.access_cond |state, cond| {
comm::send_one(c.take(), ());
c.take().send(());
assert!(!*state);
while !*state {
cond.wait();
Expand Down
10 changes: 5 additions & 5 deletions src/libextra/future.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

use std::cast;
use std::cell::Cell;
use std::comm::{PortOne, oneshot, send_one, recv_one};
use std::comm::{PortOne, oneshot};
use std::task;
use std::util::replace;

Expand Down Expand Up @@ -123,7 +123,7 @@ pub fn from_port<A:Send>(port: PortOne<A>) -> Future<A> {

let port = Cell::new(port);
do from_fn {
recv_one(port.take())
port.take().recv()
}
}

Expand Down Expand Up @@ -152,7 +152,7 @@ pub fn spawn<A:Send>(blk: ~fn() -> A) -> Future<A> {
let chan = Cell::new(chan);
do task::spawn {
let chan = chan.take();
send_one(chan, blk());
chan.send(blk());
}

return from_port(port);
Expand All @@ -163,7 +163,7 @@ mod test {
use future::*;

use std::cell::Cell;
use std::comm::{oneshot, send_one};
use std::comm::oneshot;
use std::task;

#[test]
Expand All @@ -175,7 +175,7 @@ mod test {
#[test]
fn test_from_port() {
let (po, ch) = oneshot();
send_one(ch, ~"whale");
ch.send(~"whale");
let mut f = from_port(po);
assert_eq!(f.get(), ~"whale");
}
Expand Down
5 changes: 3 additions & 2 deletions src/libextra/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use std::borrow;
use std::comm;
use std::comm::SendDeferred;
use std::comm::{GenericPort, Peekable};
use std::task;
use std::unstable::sync::{Exclusive, UnsafeAtomicRcBox};
use std::unstable::atomics;
Expand Down Expand Up @@ -111,7 +112,7 @@ impl<Q:Send> Sem<Q> {
/* do 1000.times { task::yield(); } */
// Need to wait outside the exclusive.
if waiter_nobe.is_some() {
let _ = comm::recv_one(waiter_nobe.unwrap());
let _ = waiter_nobe.unwrap().recv();
}
}
}
Expand Down Expand Up @@ -235,7 +236,7 @@ impl<'self> Condvar<'self> {
do (|| {
unsafe {
do task::rekillable {
let _ = comm::recv_one(WaitEnd.take_unwrap());
let _ = WaitEnd.take_unwrap().recv();
}
}
}).finally {
Expand Down
2 changes: 1 addition & 1 deletion src/libextra/task_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/// parallelism.


use std::comm::Chan;
use std::comm::{Chan, GenericChan, GenericPort};
use std::comm;
use std::task::SchedMode;
use std::task;
Expand Down
2 changes: 1 addition & 1 deletion src/libextra/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use time::precise_time_ns;
use treemap::TreeMap;

use std::clone::Clone;
use std::comm::{stream, SharedChan};
use std::comm::{stream, SharedChan, GenericPort, GenericChan};
use std::libc;
use std::either;
use std::io;
Expand Down
6 changes: 3 additions & 3 deletions src/libextra/workcache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use arc::{Arc,RWArc};
use treemap::TreeMap;

use std::cell::Cell;
use std::comm::{PortOne, oneshot, send_one, recv_one};
use std::comm::{PortOne, oneshot};
use std::either::{Either, Left, Right};
use std::io;
use std::run;
Expand Down Expand Up @@ -331,7 +331,7 @@ impl<'self> Prep<'self> {
};
let chan = chan.take();
let v = blk(&exe);
send_one(chan, (exe, v));
chan.send((exe, v));
}
Right(port)
}
Expand All @@ -355,7 +355,7 @@ impl<'self, T:Send +
None => fail!(),
Some(Left(v)) => v,
Some(Right(port)) => {
let (exe, v) = recv_one(port);
let (exe, v) = port.recv();
let s = json_encode(&v);
do prep.ctxt.db.write |db| {
db.cache(prep.fn_name,
Expand Down
17 changes: 2 additions & 15 deletions src/libstd/at_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,24 +275,11 @@ pub mod raw {
}

fn local_realloc(ptr: *(), size: uint) -> *() {
use rt;
use rt::OldTaskContext;
use rt::local::Local;
use rt::task::Task;

if rt::context() == OldTaskContext {
unsafe {
return rust_local_realloc(ptr, size as libc::size_t);
}

extern {
#[fast_ffi]
fn rust_local_realloc(ptr: *(), size: libc::size_t) -> *();
}
} else {
do Local::borrow::<Task, *()> |task| {
task.heap.realloc(ptr as *libc::c_void, size) as *()
}
do Local::borrow::<Task, *()> |task| {
task.heap.realloc(ptr as *libc::c_void, size) as *()
}
}
}
Expand Down
19 changes: 1 addition & 18 deletions src/libstd/cleanup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,8 @@ unsafe fn each_live_alloc(read_next_before: bool,

#[cfg(unix)]
fn debug_mem() -> bool {
use rt;
use rt::OldTaskContext;
// XXX: Need to port the environment struct to newsched
match rt::context() {
OldTaskContext => ::rt::env::get().debug_mem,
_ => false
}
false
}

#[cfg(windows)]
Expand Down Expand Up @@ -147,15 +142,3 @@ pub unsafe fn annihilate() {
dbg.write_str("\n");
}
}

/// Bindings to the runtime
pub mod rustrt {
use libc::c_void;

#[link_name = "rustrt"]
extern {
#[rust_stack]
// FIXME (#4386): Unable to make following method private.
pub fn rust_get_task() -> *c_void;
}
}
Loading