summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-03-31 17:58:41 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-03-31 17:58:41 +0000
commitb39676f6a9b699f204d4313ae5589b71d436d4e5 (patch)
treec4ae86bd8774ee11d9b4104ad35d39da92a4d442 /gc.c
parent29b538fa7146f899775b001a55bf1716c486b293 (diff)
* configure.in (RUBY_SETJMP, RUBY_LONGJMP, RUBY_JMP_BUF): prefers
__builtin_setjmp, _setjmp over setjmp and sigsetjmp. [ruby-core:16023], [ruby-core:16086] * configure.in (--with-setjmp-type): new option to override the default rule in the above. * eval_intern.h (ruby_setjmp, ruby_longjmp), gc.c (rb_setjmp), vm_core.h (rb_jmpbuf_t): use RUBY_SETJMP, RUBY_LONGJMP and RUBY_JMP_BUF. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/gc.c b/gc.c
index f54048718f..e090b0db49 100644
--- a/gc.c
+++ b/gc.c
@@ -52,9 +52,8 @@
int rb_io_fptr_finalize(struct rb_io_t*);
-#if !defined(setjmp) && defined(HAVE__SETJMP) && !defined(sigsetjmp) && !defined(HAVE_SIGSETJMP)
-#define setjmp(env) _setjmp(env)
-#endif
+#define rb_setjmp(env) RUBY_SETJMP(env)
+#define rb_jmp_buf rb_jmpbuf_t
/* Make alloca work the best possible way. */
#ifdef __GNUC__
@@ -1427,6 +1426,8 @@ obj_free(VALUE obj)
#ifdef __GNUC__
#if defined(__human68k__) || defined(DJGPP)
+#undef rb_setjmp
+#undef rb_jmp_buf
#if defined(__human68k__)
typedef unsigned long rb_jmp_buf[8];
__asm__ (".even\n\
@@ -1435,9 +1436,6 @@ _rb_setjmp:\n\
movem.l d3-d7/a3-a5,(a0)\n\
moveq.l #0,d0\n\
rts");
-#ifdef setjmp
-#undef setjmp
-#endif
#else
#if defined(DJGPP)
typedef unsigned long rb_jmp_buf[6];
@@ -1458,8 +1456,6 @@ _rb_setjmp:\n\
#endif
#endif
int rb_setjmp (rb_jmp_buf);
-#define jmp_buf rb_jmp_buf
-#define setjmp rb_setjmp
#endif /* __human68k__ or DJGPP */
#endif /* __GNUC__ */
@@ -1470,7 +1466,7 @@ void rb_vm_mark(void *ptr);
static void
mark_current_machine_context(rb_thread_t *th)
{
- jmp_buf save_regs_gc_mark;
+ rb_jmp_buf save_regs_gc_mark;
VALUE *stack_start, *stack_end;
SET_STACK_END;
@@ -1493,7 +1489,7 @@ mark_current_machine_context(rb_thread_t *th)
FLUSH_REGISTER_WINDOWS;
/* This assumes that all registers are saved into the jmp_buf (and stack) */
- setjmp(save_regs_gc_mark);
+ rb_setjmp(save_regs_gc_mark);
mark_locations_array((VALUE*)save_regs_gc_mark,
sizeof(save_regs_gc_mark) / sizeof(VALUE));