mirror of
https://github.com/ruby/ruby.git
synced 2025-09-17 01:23:57 +02:00
merge revision(s) 57020,57021: [Backport #13014]
Add clang volatile fixes from FreeBSD and NetBSD. Use volatile instead of optnone to avoid optimization which causes segmentation faults. Patch by Dimitry Andric. [ruby-core:78531] [Bug #13014] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@57216 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ed8c211a64
commit
04d79490da
8 changed files with 21 additions and 16 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
Tue Dec 27 19:49:01 2016 Shugo Maeda <shugo@ruby-lang.org>
|
||||||
|
|
||||||
|
* cont.c, eval.c, eval_error.c, thread.c, vm_eval.c, vm_trace.c: add
|
||||||
|
clang volatile fixes from FreeBSD and NetBSD.
|
||||||
|
|
||||||
|
Use volatile instead of optnone to avoid optimization which causes
|
||||||
|
segmentation faults.
|
||||||
|
Patch by Dimitry Andric. [Bug #13014]
|
||||||
|
|
||||||
Tue Dec 27 19:40:09 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Tue Dec 27 19:40:09 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* README.EXT{.ja,}: [DOC] optional keyword arguments are defaulted to
|
* README.EXT{.ja,}: [DOC] optional keyword arguments are defaulted to
|
||||||
|
|
10
cont.c
10
cont.c
|
@ -167,7 +167,7 @@ static VALUE rb_eFiberError;
|
||||||
if (!(ptr)) rb_raise(rb_eFiberError, "uninitialized fiber"); \
|
if (!(ptr)) rb_raise(rb_eFiberError, "uninitialized fiber"); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
NOINLINE(static VALUE cont_capture(volatile int *stat));
|
NOINLINE(static VALUE cont_capture(volatile int *volatile stat));
|
||||||
|
|
||||||
#define THREAD_MUST_BE_RUNNING(th) do { \
|
#define THREAD_MUST_BE_RUNNING(th) do { \
|
||||||
if (!(th)->tag) rb_raise(rb_eThreadError, "not running thread"); \
|
if (!(th)->tag) rb_raise(rb_eThreadError, "not running thread"); \
|
||||||
|
@ -478,13 +478,9 @@ cont_new(VALUE klass)
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
cont_capture(volatile int *stat)
|
cont_capture(volatile int *volatile stat)
|
||||||
#if defined(__clang__) && \
|
|
||||||
__clang_major__ == 3 && __clang_minor__ == 8 && __clang_patch__ == 0
|
|
||||||
__attribute__ ((optnone))
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
rb_context_t *cont;
|
rb_context_t *volatile cont;
|
||||||
rb_thread_t *th = GET_THREAD();
|
rb_thread_t *th = GET_THREAD();
|
||||||
volatile VALUE contval;
|
volatile VALUE contval;
|
||||||
|
|
||||||
|
|
4
eval.c
4
eval.c
|
@ -814,7 +814,7 @@ rb_rescue2(VALUE (* b_proc) (ANYARGS), VALUE data1,
|
||||||
{
|
{
|
||||||
int state;
|
int state;
|
||||||
rb_thread_t *th = GET_THREAD();
|
rb_thread_t *th = GET_THREAD();
|
||||||
rb_control_frame_t *cfp = th->cfp;
|
rb_control_frame_t *volatile cfp = th->cfp;
|
||||||
volatile VALUE result = Qfalse;
|
volatile VALUE result = Qfalse;
|
||||||
volatile VALUE e_info = th->errinfo;
|
volatile VALUE e_info = th->errinfo;
|
||||||
va_list args;
|
va_list args;
|
||||||
|
@ -880,7 +880,7 @@ rb_protect(VALUE (* proc) (VALUE), VALUE data, int * state)
|
||||||
volatile VALUE result = Qnil;
|
volatile VALUE result = Qnil;
|
||||||
volatile int status;
|
volatile int status;
|
||||||
rb_thread_t *th = GET_THREAD();
|
rb_thread_t *th = GET_THREAD();
|
||||||
rb_control_frame_t *cfp = th->cfp;
|
rb_control_frame_t *volatile cfp = th->cfp;
|
||||||
struct rb_vm_protect_tag protect_tag;
|
struct rb_vm_protect_tag protect_tag;
|
||||||
rb_jmpbuf_t org_jmpbuf;
|
rb_jmpbuf_t org_jmpbuf;
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ error_print(void)
|
||||||
volatile VALUE errat = Qundef;
|
volatile VALUE errat = Qundef;
|
||||||
rb_thread_t *th = GET_THREAD();
|
rb_thread_t *th = GET_THREAD();
|
||||||
VALUE errinfo = th->errinfo;
|
VALUE errinfo = th->errinfo;
|
||||||
int raised_flag = th->raised_flag;
|
volatile int raised_flag = th->raised_flag;
|
||||||
volatile VALUE eclass = Qundef, e = Qundef;
|
volatile VALUE eclass = Qundef, e = Qundef;
|
||||||
const char *volatile einfo;
|
const char *volatile einfo;
|
||||||
volatile long elen;
|
volatile long elen;
|
||||||
|
|
4
thread.c
4
thread.c
|
@ -462,8 +462,8 @@ rb_threadptr_unlock_all_locking_mutexes(rb_thread_t *th)
|
||||||
void
|
void
|
||||||
rb_thread_terminate_all(void)
|
rb_thread_terminate_all(void)
|
||||||
{
|
{
|
||||||
rb_thread_t *th = GET_THREAD(); /* main thread */
|
rb_thread_t *volatile th = GET_THREAD(); /* main thread */
|
||||||
rb_vm_t *vm = th->vm;
|
rb_vm_t *volatile vm = th->vm;
|
||||||
|
|
||||||
if (vm->main_thread != th) {
|
if (vm->main_thread != th) {
|
||||||
rb_bug("rb_thread_terminate_all: called by child thread (%p, %p)",
|
rb_bug("rb_thread_terminate_all: called by child thread (%p, %p)",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#define RUBY_VERSION "2.2.7"
|
#define RUBY_VERSION "2.2.7"
|
||||||
#define RUBY_RELEASE_DATE "2016-12-27"
|
#define RUBY_RELEASE_DATE "2016-12-27"
|
||||||
#define RUBY_PATCHLEVEL 406
|
#define RUBY_PATCHLEVEL 407
|
||||||
|
|
||||||
#define RUBY_RELEASE_YEAR 2016
|
#define RUBY_RELEASE_YEAR 2016
|
||||||
#define RUBY_RELEASE_MONTH 12
|
#define RUBY_RELEASE_MONTH 12
|
||||||
|
|
|
@ -1239,7 +1239,7 @@ eval_string_with_cref(VALUE self, VALUE src, VALUE scope, NODE *const cref_arg,
|
||||||
int state;
|
int state;
|
||||||
VALUE result = Qundef;
|
VALUE result = Qundef;
|
||||||
VALUE envval;
|
VALUE envval;
|
||||||
rb_thread_t *th = GET_THREAD();
|
rb_thread_t *volatile th = GET_THREAD();
|
||||||
rb_env_t *env = NULL;
|
rb_env_t *env = NULL;
|
||||||
rb_block_t block, *base_block;
|
rb_block_t block, *base_block;
|
||||||
volatile int parse_in_eval;
|
volatile int parse_in_eval;
|
||||||
|
@ -1984,7 +1984,7 @@ rb_catch_protect(VALUE t, rb_block_call_func *func, VALUE data, int *stateptr)
|
||||||
int state;
|
int state;
|
||||||
volatile VALUE val = Qnil; /* OK */
|
volatile VALUE val = Qnil; /* OK */
|
||||||
rb_thread_t *th = GET_THREAD();
|
rb_thread_t *th = GET_THREAD();
|
||||||
rb_control_frame_t *saved_cfp = th->cfp;
|
rb_control_frame_t *volatile saved_cfp = th->cfp;
|
||||||
volatile VALUE tag = t;
|
volatile VALUE tag = t;
|
||||||
|
|
||||||
TH_PUSH_TAG(th);
|
TH_PUSH_TAG(th);
|
||||||
|
|
|
@ -390,7 +390,7 @@ rb_suppress_tracing(VALUE (*func)(VALUE), VALUE arg)
|
||||||
volatile int raised;
|
volatile int raised;
|
||||||
volatile int outer_state;
|
volatile int outer_state;
|
||||||
VALUE result = Qnil;
|
VALUE result = Qnil;
|
||||||
rb_thread_t *th = GET_THREAD();
|
rb_thread_t *volatile th = GET_THREAD();
|
||||||
int state;
|
int state;
|
||||||
const int tracing = th->trace_arg ? 1 : 0;
|
const int tracing = th->trace_arg ? 1 : 0;
|
||||||
rb_trace_arg_t dummy_trace_arg;
|
rb_trace_arg_t dummy_trace_arg;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue