]> git.lizzy.rs Git - rust.git/commitdiff
rt: Make unwinding through __morestack work on mac
authorBrian Anderson <banderson@mozilla.com>
Mon, 12 Dec 2011 01:50:12 +0000 (17:50 -0800)
committerBrian Anderson <banderson@mozilla.com>
Mon, 12 Dec 2011 02:49:04 +0000 (18:49 -0800)
Had to bump the min stack size in some of the tests from 256 bytes
to 1024 bytes. Not sure why yet.

src/rt/arch/i386/morestack.S
src/rt/arch/x86_64/morestack.S
src/test/run-fail/morestack2.rs
src/test/run-fail/morestack3.rs

index 23aa36353a195ddb335e5932b05294c047d3b12f..b30a5af21525f86c0258eef23883c58f27fe2c36 100644 (file)
 #endif
 
 MORESTACK:
-#ifdef __linux__
+#if defined(__linux__) || defined(__APPLE__)
        .cfi_startproc
 #endif
 
        pushl %ebp
-#ifdef __linux__
+#if defined(__linux__) || defined(__APPLE__)
        .cfi_def_cfa_offset 8
        .cfi_offset %ebp, -8
 #endif
        movl %esp, %ebp
-#ifdef __linux__
+#if defined(__linux__) || defined(__APPLE__)
        .cfi_def_cfa_register %ebp
 #endif
 
@@ -69,7 +69,7 @@ MORESTACK:
        jz .L$bail
 
        // During unwinding we want to skip our caller.
-#ifdef __linux__
+#if defined(__linux__) || defined(__APPLE__)
        // Don't understand this line. I think it means that
        // the next frame's pc is the return address of our caller.
        .cfi_offset 8, 8
@@ -134,7 +134,7 @@ MORESTACK:
        addl $16,%esp
 
        popl %ebp
-#ifdef __linux__
+#if defined(__linux__) || defined(__APPLE__)
        .cfi_restore %ebp
        .cfi_def_cfa %esp, 4
 #endif
@@ -150,7 +150,7 @@ MORESTACK:
        
        jmpl *%edx
 
-#ifdef __linux__
+#if defined(__linux__) || defined(__APPLE__)
        .cfi_endproc
 #endif
 
index fafedb54418d47ca6618ba827fea22da827942ec..6686071361b966b4da6cca68c7cc9bab6529af1d 100644 (file)
 
 #if defined(__linux__) || defined(__APPLE__)
 MORESTACK:
-#if defined(__ELF__)
        .cfi_startproc
-#endif
        
        // Set up a normal backtrace
        pushq %rbp
-#if defined(__ELF__)
        .cfi_def_cfa_offset 16
        .cfi_offset %rbp, -16
-#endif
        movq %rsp, %rbp
-#if defined(__ELF__)
        .cfi_def_cfa_register %rbp
-#endif
 
        // During unwinding we want to skip our caller since it's not
        // a complete frame and will make the unwinder sad
-#if defined(__linux__)
        // Don't understand this line
        .cfi_offset 16, 0
        // Tell the unwinding where to get the stack pointer for
        // our grandparent frame
        .cfi_offset %rsp, -24
-#endif
 
        // Save the grandparent stack pointer for the unwinder
        leaq 16(%rbp), %rax
@@ -147,15 +139,11 @@ MORESTACK:
 
        addq $8, %rsp
        popq %rbp
-#ifdef __linux__
        .cfi_restore %rbp
        .cfi_def_cfa %rsp, 8
-#endif
        ret
        
-#if defined(__ELF__)
        .cfi_endproc
-#endif
 
 #else
 MORESTACK:
index 02b1adae481669c1b2cb8e9be32aab1175df8560..b47108ba026da4ab8c36745c76028a073e875ab6 100644 (file)
@@ -33,7 +33,7 @@ fn getbig(i: int) {
 }
 
 fn main() {
-    rustrt::set_min_stack(256u);
+    rustrt::set_min_stack(1024u);
     std::task::spawn((), fn (&&_i: ()) {
         let r = and_then_get_big_again(());
         getbig_call_c_and_fail(10000);
index 9796017a8eb0885d5a5135d9e8e19f4e95daa6a3..93faea60a52ae92a068c6faf30705f9b1438619d 100644 (file)
@@ -29,6 +29,6 @@ fn getbig(i: int) {
 }
 
 fn main() {
-    rustrt::set_min_stack(256u);
-    std::task::spawn(100, getbig_and_fail);
+    rustrt::set_min_stack(1024u);
+    std::task::spawn(400, getbig_and_fail);
 }
\ No newline at end of file