Go patch committed: Don't split stack in bytes.IndexByte

Submitted by Ian Taylor on Dec. 17, 2010, 6:36 a.m.

Details

Message ID mcrhbecx5wk.fsf@google.com
State New
Headers show

Commit Message

Ian Taylor Dec. 17, 2010, 6:36 a.m.
The function bytes.IndexByte is written in C and simply calls memchr.
This patch changes it to not always split the stack, on the theory that
memchr does not require much stack space.  Bootstrapped and ran Go
testsuite on x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

Patch hide | download patch | download mbox

diff -r d82eb7b97cee libgo/go/bytes/indexbyte.c
--- a/libgo/go/bytes/indexbyte.c	Thu Dec 16 22:28:48 2010 -0800
+++ b/libgo/go/bytes/indexbyte.c	Thu Dec 16 22:34:03 2010 -0800
@@ -8,11 +8,13 @@ 
 
 #include "array.h"
 
-/* This is in C so that the compiler can optimize it
-   appropriately.  */
+/* This is in C so that the compiler can optimize it appropriately.
+   We deliberately don't split the stack in case it does call the
+   library function, which shouldn't need much stack space.  */
 
 int IndexByte (struct __go_open_array, char)
-  asm ("libgo_bytes.bytes.IndexByte");
+  asm ("libgo_bytes.bytes.IndexByte")
+  __attribute__ ((no_split_stack));
 
 int
 IndexByte (struct __go_open_array s, char b)