diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2012-02-28 11:58:50 -0800 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2012-02-29 11:54:47 -0800 |
| commit | 7d0958f70ff16ee40649a943306c9b104a5fc829 (patch) | |
| tree | 6698c2b8f3cd7134d3e9937e774d9c57048996f4 | |
| parent | 3d104cfb410211cb313a50c6cdb8b652f62ce9f4 (diff) | |
| download | rust-7d0958f70ff16ee40649a943306c9b104a5fc829.tar.gz rust-7d0958f70ff16ee40649a943306c9b104a5fc829.zip | |
add the ability to snag the frame so we can verify that we are inlining
| -rw-r--r-- | src/comp/middle/trans/base.rs | 7 | ||||
| -rw-r--r-- | src/libcore/sys.rs | 5 | ||||
| -rw-r--r-- | src/rt/rust_builtin.cpp | 6 | ||||
| -rw-r--r-- | src/rt/rust_util.h | 17 | ||||
| -rw-r--r-- | src/rt/rustrt.def.in | 3 |
5 files changed, 37 insertions, 1 deletions
diff --git a/src/comp/middle/trans/base.rs b/src/comp/middle/trans/base.rs index 9d05ec5e10b..04b51b85bcf 100644 --- a/src/comp/middle/trans/base.rs +++ b/src/comp/middle/trans/base.rs @@ -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 */ } + } } } diff --git a/src/libcore/sys.rs b/src/libcore/sys.rs index 9d9bdb58078..9cdbfaa61af 100644 --- a/src/libcore/sys.rs +++ b/src/libcore/sys.rs @@ -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 \ diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp index 29940492f79..a1b2d9eb45a 100644 --- a/src/rt/rust_builtin.cpp +++ b/src/rt/rust_builtin.cpp @@ -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++ diff --git a/src/rt/rust_util.h b/src/rt/rust_util.h index e1efbdf315e..211ad71b545 100644 --- a/src/rt/rust_util.h +++ b/src/rt/rust_util.h @@ -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)); diff --git a/src/rt/rustrt.def.in b/src/rt/rustrt.def.in index 2b5929600b0..3ccee2ea508 100644 --- a/src/rt/rustrt.def.in +++ b/src/rt/rustrt.def.in @@ -100,4 +100,5 @@ rust_dbg_lock_lock rust_dbg_lock_unlock rust_dbg_lock_wait rust_dbg_lock_signal -rust_dbg_call \ No newline at end of file +rust_dbg_call +rust_frame_address |
