ruby-changes:57852
From: Fangrui <ko1@a...>
Date: Sat, 21 Sep 2019 13:25:22 +0900 (JST)
Subject: [ruby-changes:57852] e006b992c2 (master): typedef rb_jmpbuf_t to void *[5] if __builtin_setjmp is used
https://git.ruby-lang.org/ruby.git/commit/?id=e006b992c2 From e006b992c29decb01865b0749e35a4cfc872bdaf Mon Sep 17 00:00:00 2001 From: Fangrui Song <i@m...> Date: Thu, 19 Sep 2019 00:04:29 -0700 Subject: typedef rb_jmpbuf_t to void *[5] if __builtin_setjmp is used The built-in version operates on a buffer of 5 words, much smaller than the size of jmp_buf defined in libc. Note, powerpc requires 5 words, while arm and x86_64 just require 3. diff --git a/tool/m4/ruby_setjmp_type.m4 b/tool/m4/ruby_setjmp_type.m4 index e054a54..9da9a88 100644 --- a/tool/m4/ruby_setjmp_type.m4 +++ b/tool/m4/ruby_setjmp_type.m4 @@ -47,6 +47,6 @@ AS_IF([test x$setjmp_prefix:$setjmp_sigmask = xsig:], [ https://github.com/ruby/ruby/blob/trunk/tool/m4/ruby_setjmp_type.m4#L47 AC_MSG_RESULT(${setjmp_prefix}setjmp${setjmp_suffix}${setjmp_cast:+\($setjmp_cast\)}${setjmp_sigmask}) AC_DEFINE_UNQUOTED([RUBY_SETJMP(env)], [${setjmp_prefix}setjmp${setjmp_suffix}($setjmp_cast(env)${setjmp_sigmask})]) AC_DEFINE_UNQUOTED([RUBY_LONGJMP(env,val)], [${setjmp_prefix}longjmp($setjmp_cast(env),val)]) -AC_DEFINE_UNQUOTED(RUBY_JMP_BUF, ${setjmp_sigmask+${setjmp_prefix}}jmp_buf) +AS_IF([test x$setjmp_prefix != x__builtin_], AC_DEFINE_UNQUOTED(RUBY_JMP_BUF, ${setjmp_sigmask+${setjmp_prefix}}jmp_buf)) AS_IF([test x$setjmp_suffix = xex], [AC_DEFINE_UNQUOTED(RUBY_USE_SETJMPEX, 1)]) ])dnl diff --git a/vm_core.h b/vm_core.h index 99c4d13..bc7e6be 100644 --- a/vm_core.h +++ b/vm_core.h @@ -775,7 +775,11 @@ enum rb_thread_status { https://github.com/ruby/ruby/blob/trunk/vm_core.h#L775 THREAD_KILLED }; +#ifdef RUBY_JMP_BUF typedef RUBY_JMP_BUF rb_jmpbuf_t; +#else +typedef void *rb_jmpbuf_t[5]; +#endif /* the members which are written in EC_PUSH_TAG() should be placed at -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/