Remove unused TyDesc parameter from the glue functions
To remove the environment pointer, support for function pointers without an environment argument is needed (i.e. a fixed version of #6661).
This commit is contained in:
parent
1b76bac41d
commit
e2f1049bd5
9 changed files with 66 additions and 37 deletions
|
|
@ -11,9 +11,10 @@
|
|||
#[doc(hidden)];
|
||||
|
||||
use libc::{c_char, intptr_t, uintptr_t};
|
||||
use ptr::{mut_null, to_unsafe_ptr};
|
||||
use ptr::{mut_null};
|
||||
use repr::BoxRepr;
|
||||
use cast::transmute;
|
||||
use unstable::intrinsics::TyDesc;
|
||||
#[cfg(not(test))] use unstable::lang::clear_task_borrow_list;
|
||||
|
||||
/**
|
||||
|
|
@ -158,6 +159,19 @@ fn debug_mem() -> bool {
|
|||
false
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[cfg(not(stage0))]
|
||||
unsafe fn call_drop_glue(tydesc: *TyDesc, data: *i8) {
|
||||
// This function should be inlined when stage0 is gone
|
||||
((*tydesc).drop_glue)(data);
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[cfg(stage0)]
|
||||
unsafe fn call_drop_glue(tydesc: *TyDesc, data: *i8) {
|
||||
((*tydesc).drop_glue)(0 as **TyDesc, data);
|
||||
}
|
||||
|
||||
/// Destroys all managed memory (i.e. @ boxes) held by the current task.
|
||||
#[cfg(not(test))]
|
||||
#[lang="annihilate"]
|
||||
|
|
@ -201,7 +215,7 @@ pub unsafe fn annihilate() {
|
|||
if !uniq {
|
||||
let tydesc = (*box).header.type_desc;
|
||||
let data = transmute(&(*box).data);
|
||||
((*tydesc).drop_glue)(to_unsafe_ptr(&tydesc), data);
|
||||
call_drop_glue(tydesc, data);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -316,6 +316,19 @@ fn expect_sentinel() -> bool { true }
|
|||
#[cfg(nogc)]
|
||||
fn expect_sentinel() -> bool { false }
|
||||
|
||||
#[inline]
|
||||
#[cfg(not(stage0))]
|
||||
unsafe fn call_drop_glue(tydesc: *TyDesc, data: *i8) {
|
||||
// This function should be inlined when stage0 is gone
|
||||
((*tydesc).drop_glue)(data);
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[cfg(stage0)]
|
||||
unsafe fn call_drop_glue(tydesc: *TyDesc, data: *i8) {
|
||||
((*tydesc).drop_glue)(0 as **TyDesc, data);
|
||||
}
|
||||
|
||||
// Entry point for GC-based cleanup. Walks stack looking for exchange
|
||||
// heap and stack allocations requiring drop, and runs all
|
||||
// destructors.
|
||||
|
|
@ -359,7 +372,7 @@ pub fn cleanup_stack_for_failure() {
|
|||
// FIXME #4420: Destroy this box
|
||||
// FIXME #4330: Destroy this box
|
||||
} else {
|
||||
((*tydesc).drop_glue)(&tydesc as **TyDesc, *root as *i8);
|
||||
call_drop_glue(tydesc, *root as *i8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,10 @@ A quick refresher on memory ordering:
|
|||
#[cfg(test)]
|
||||
pub use realstd::unstable::intrinsics::{TyDesc, Opaque, TyVisitor};
|
||||
|
||||
#[cfg(not(stage0))]
|
||||
pub type GlueFn = extern "Rust" fn(*i8);
|
||||
|
||||
#[cfg(stage0)]
|
||||
pub type GlueFn = extern "Rust" fn(**TyDesc, *i8);
|
||||
|
||||
// NB: this has to be kept in sync with the Rust ABI.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue