summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
authoreban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-02-11 07:12:02 +0000
committereban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-02-11 07:12:02 +0000
commit59f25626cdf82789468f8b062cfcde1dd6bde41c (patch)
tree21a5af47385ca4dc18c08e21c9327a5eaf4743b3 /gc.c
parent64b7c00a5f83cd5aa66eb88035a5bed89244b73d (diff)
* eval.c (stack_length): use __builtin_frame_address() only if
GCC and i386 CPU. * gc.c (rb_gc, Init_stack): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@1175 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/gc.c b/gc.c
index f8cc4cff35..e470ea9407 100644
--- a/gc.c
+++ b/gc.c
@@ -31,6 +31,25 @@ void rb_io_fptr_finalize _((struct OpenFile*));
#endif
#endif
+/* Make alloca work the best possible way. */
+#ifdef __GNUC__
+# ifndef atarist
+# ifndef alloca
+# define alloca __builtin_alloca
+# endif
+# endif /* atarist */
+#else
+# if defined(HAVE_ALLOCA_H)
+# include <alloca.h>
+# elif !defined(alloca)
+char *alloca();
+# endif
+#endif /* __GNUC__ */
+
+#ifdef _AIX
+#pragma alloca
+#endif
+
#ifdef C_ALLOCA
#ifndef alloca
void *alloca();
@@ -930,7 +949,7 @@ rb_gc()
alloca(0);
# define STACK_END (&stack_end)
#else
-# if defined(__GNUC__) && !defined(__alpha__) && !defined(__APPLE__)
+# if defined(__GNUC__) && defined(__i386__)
VALUE *stack_end = __builtin_frame_address(0);
# else
VALUE *stack_end = alloca(1);
@@ -1010,7 +1029,7 @@ Init_stack(addr)
#if defined(__human68k__)
extern void *_SEND;
rb_gc_stack_start = _SEND;
-#elif defined(__GNUC__) && !defined(__alpha__) && !defined(__APPLE__)
+#elif defined(__GNUC__) && defined(__i386__)
rb_gc_stack_start = __builtin_frame_address(2);
#else
VALUE start;