about summary refs log tree commit diff
path: root/src/libstd/rt/stack.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-08-19 04:32:04 -0700
committerbors <bors@rust-lang.org>2013-08-19 04:32:04 -0700
commit81a78161b5354c9cfecd8c659cc1dc3711d347d6 (patch)
treebe212089ce62d2909018cf36d7c3aa563b886d94 /src/libstd/rt/stack.rs
parent3e4f40ec5aee04c0e5386153644255b6beeba095 (diff)
parent0479d946c83cf9ed90bba5b33820ea4118dd8f9e (diff)
downloadrust-81a78161b5354c9cfecd8c659cc1dc3711d347d6.tar.gz
rust-81a78161b5354c9cfecd8c659cc1dc3711d347d6.zip
auto merge of #8535 : nikomatsakis/rust/issue-3678-wrappers-be-gone-2, r=graydon
Long-standing branch to remove foreign function wrappers altogether. Calls to C functions are done "in place" with no stack manipulation; the scheme relies entirely on the correct use of `#[fixed_stack_segment]` to guarantee adequate stack space. A linter is added to detect when `#[fixed_stack_segment]` annotations are missing. An `externfn!` macro is added to make it easier to declare foreign fns and wrappers in one go: this macro may need some refinement, though, for example it might be good to be able to declare a group of foreign fns. I leave that for future work (hopefully somebody else's work :) ).

Fixes #3678.

Diffstat (limited to 'src/libstd/rt/stack.rs')
-rw-r--r--src/libstd/rt/stack.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libstd/rt/stack.rs b/src/libstd/rt/stack.rs
index a1269968921..4b2a9b7a6cc 100644
--- a/src/libstd/rt/stack.rs
+++ b/src/libstd/rt/stack.rs
@@ -21,6 +21,8 @@ pub struct StackSegment {
 
 impl StackSegment {
     pub fn new(size: uint) -> StackSegment {
+        #[fixed_stack_segment]; #[inline(never)];
+
         unsafe {
             // Crate a block of uninitialized values
             let mut stack = vec::with_capacity(size);
@@ -50,6 +52,8 @@ impl StackSegment {
 
 impl Drop for StackSegment {
     fn drop(&self) {
+        #[fixed_stack_segment]; #[inline(never)];
+
         unsafe {
             // XXX: Using the FFI to call a C macro. Slow
             rust_valgrind_stack_deregister(self.valgrind_id);