add the ability to snag the frame so we can verify that we are inlining
This commit is contained in:
parent
3d104cfb41
commit
7d0958f70f
|
@ -4583,6 +4583,13 @@ fn collect_inlined_items(ccx: crate_ctxt, inline_map: inline::inline_map) {
|
|||
let abi = @mutable none::<ast::native_abi>;
|
||||
inline_map.values {|item|
|
||||
collect_item(ccx, abi, item);
|
||||
|
||||
alt item.node {
|
||||
ast::item_fn(_, _, _) {
|
||||
set_always_inline(ccx.item_ids.get(item.id));
|
||||
}
|
||||
_ { /* fallthrough */ }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ native mod rustrt {
|
|||
fn unsupervise();
|
||||
fn shape_log_str<T>(t: *sys::type_desc, data: T) -> str;
|
||||
fn rust_set_exit_status(code: ctypes::intptr_t);
|
||||
fn rust_frame_address() -> ctypes::uintptr_t;
|
||||
}
|
||||
|
||||
#[abi = "rust-intrinsic"]
|
||||
|
@ -77,6 +78,10 @@ fn log_str<T>(t: T) -> str {
|
|||
rustrt::shape_log_str(get_type_desc::<T>(), t)
|
||||
}
|
||||
|
||||
fn frame_address() -> uint {
|
||||
rustrt::rust_frame_address()
|
||||
}
|
||||
|
||||
#[doc(
|
||||
brief = "Sets the process exit code",
|
||||
desc = "Sets the exit code returned by the process if all supervised \
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "rust_util.h"
|
||||
#include "rust_scheduler.h"
|
||||
#include "sync/timer.h"
|
||||
#include "rust_abi.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <crt_externs.h>
|
||||
|
@ -681,6 +682,11 @@ rust_dbg_call(dbg_callback cb, void *data) {
|
|||
return cb(data);
|
||||
}
|
||||
|
||||
extern "C" CDECL void *
|
||||
rust_frame_address() {
|
||||
return __builtin_frame_address(1);
|
||||
}
|
||||
|
||||
//
|
||||
// Local Variables:
|
||||
// mode: C++
|
||||
|
|
|
@ -87,6 +87,23 @@ inline size_t vec_size(size_t elems) {
|
|||
return sizeof(rust_vec) + sizeof(T) * elems;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline rust_vec *
|
||||
vec_alloc(size_t alloc_elts, size_t fill_elts, const char *name) {
|
||||
rust_task *task = rust_task_thread::get_task();
|
||||
size_t size = vec_size<T>(alloc_elts);
|
||||
rust_vec *vec = (rust_vec *) task->kernel->malloc(size, name);
|
||||
vec->fill = fill_elts * sizeof(T);
|
||||
vec->alloc = alloc_elts * sizeof(T);
|
||||
return vec;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline T *
|
||||
vec_data(rust_vec *v) {
|
||||
return reinterpret_cast<T*>(v->data);
|
||||
}
|
||||
|
||||
inline void reserve_vec_exact(rust_task* task, rust_vec** vpp, size_t size) {
|
||||
if (size > (*vpp)->alloc) {
|
||||
*vpp = (rust_vec*)task->kernel->realloc(*vpp, size + sizeof(rust_vec));
|
||||
|
|
|
@ -101,3 +101,4 @@ rust_dbg_lock_unlock
|
|||
rust_dbg_lock_wait
|
||||
rust_dbg_lock_signal
|
||||
rust_dbg_call
|
||||
rust_frame_address
|
||||
|
|
Loading…
Reference in New Issue