path: root/gc.c
diff options
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-12-13 09:58:12 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-12-13 09:58:12 +0000
commit293534986f336e9f65ba9d8f9f66fcd86607eca7 (patch)
tree2e073d3e8fff6dc1b1b93d2fd081495bfa4c5d2b /gc.c
parent9b04f5880e475c727c2c019af1d4f96f41dfdd58 (diff)
* gc.c (stack_end_address): new function to obtain stack end address.
stack_end_address calls __builtin_frame_address(0) to obtain the frame pointer of a stack frame of stack_end_address. The address is the stack pointer of the caller's stack frame. (SET_STACK_END): use stack_end_address. This makes the conservative garbage collector to scan a stack frame of the garbage_collect function itself. This is required because callee-save registers may be stored in the frame. [ruby-dev:25158] git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
1 files changed, 6 insertions, 1 deletions
diff --git a/gc.c b/gc.c
index b00c170..6259286 100644
--- a/gc.c
+++ b/gc.c
@@ -432,7 +432,12 @@ static unsigned int STACK_LEVEL_MAX = 655300;
# define STACK_END (&stack_end)
# if defined(__GNUC__) && defined(USE_BUILTIN_FRAME_ADDRESS) && !defined(__ia64__)
-# define SET_STACK_END VALUE *stack_end = __builtin_frame_address(0)
+__attribute__ ((noinline)) static VALUE *
+ return (VALUE *)__builtin_frame_address(0);
+# define SET_STACK_END VALUE *stack_end = stack_end_address()
# else
# define SET_STACK_END VALUE *stack_end = alloca(1)
# endif