Skip to content

Commit

Permalink
core: Wire up the unwinder to newsched again
Browse files Browse the repository at this point in the history
This was some merge fallout
  • Loading branch information
brson committed May 3, 2013
1 parent db6a62c commit f8dffc6
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions src/libcore/sys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,22 +204,32 @@ impl FailWithCause for &'static str {
#[cfg(stage0)]
pub fn begin_unwind(msg: ~str, file: ~str, line: uint) -> ! {

do str::as_buf(msg) |msg_buf, _msg_len| {
do str::as_buf(file) |file_buf, _file_len| {
unsafe {
let msg_buf = cast::transmute(msg_buf);
let file_buf = cast::transmute(file_buf);
begin_unwind_(msg_buf, file_buf, line as libc::size_t)
}
}
}
}

// FIXME #4427: Temporary until rt::rt_fail_ goes away
pub fn begin_unwind_(msg: *c_char, file: *c_char, line: size_t) -> ! {
use rt::{context, OldTaskContext};
use rt::local_services::unsafe_borrow_local_services;

match context() {
OldTaskContext => {
do str::as_buf(msg) |msg_buf, _msg_len| {
do str::as_buf(file) |file_buf, _file_len| {
unsafe {
let msg_buf = cast::transmute(msg_buf);
let file_buf = cast::transmute(file_buf);
begin_unwind_(msg_buf, file_buf, line as libc::size_t)
}
}
unsafe {
gc::cleanup_stack_for_failure();
rustrt::rust_upcall_fail(msg, file, line);
cast::transmute(())
}
}
_ => {
// XXX: Need to print the failure message
gc::cleanup_stack_for_failure();
unsafe {
let local_services = unsafe_borrow_local_services();
Expand All @@ -232,15 +242,6 @@ pub fn begin_unwind(msg: ~str, file: ~str, line: uint) -> ! {
}
}

// FIXME #4427: Temporary until rt::rt_fail_ goes away
pub fn begin_unwind_(msg: *c_char, file: *c_char, line: size_t) -> ! {
unsafe {
gc::cleanup_stack_for_failure();
rustrt::rust_upcall_fail(msg, file, line);
cast::transmute(())
}
}

// NOTE: remove function after snapshot
#[cfg(stage0)]
pub fn fail_assert(msg: &str, file: &str, line: uint) -> ! {
Expand Down

1 comment on commit f8dffc6

@brson
Copy link
Owner Author

@brson brson commented on f8dffc6 May 3, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r+

Please sign in to comment.