Project

General

Profile

Bug #13014 » ruby-trunk-add-setjmp-volatile-1.diff

Patch adding several volatile specifiers, adapted from FreeBSD port - _dim (Dimitry Andric), 12/07/2016 08:50 PM

View differences:

cont.c (working copy)
static VALUE
cont_capture(volatile int *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();
volatile VALUE contval;
eval.c (working copy)
{
int state;
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 e_info = th->errinfo;
va_list args;
......
volatile VALUE result = Qnil;
volatile int status;
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;
rb_jmpbuf_t org_jmpbuf;
eval_error.c (working copy)
}
void
rb_threadptr_error_print(rb_thread_t *th, VALUE errinfo)
rb_threadptr_error_print(rb_thread_t *volatile th, volatile VALUE errinfo)
{
volatile VALUE errat = Qundef;
int raised_flag = th->raised_flag;
volatile int raised_flag = th->raised_flag;
volatile VALUE eclass = Qundef, e = Qundef;
const char *volatile einfo;
volatile long elen;
thread.c (working copy)
void
rb_thread_terminate_all(void)
{
rb_thread_t *th = GET_THREAD(); /* main thread */
rb_vm_t *vm = th->vm;
rb_thread_t *volatile th = GET_THREAD(); /* main thread */
rb_vm_t *volatile vm = th->vm;
volatile int sleeping = 0;
if (vm->main_thread != th) {
vm_core.h (working copy)
void rb_threadptr_pending_interrupt_clear(rb_thread_t *th);
void rb_threadptr_pending_interrupt_enque(rb_thread_t *th, VALUE v);
int rb_threadptr_pending_interrupt_active_p(rb_thread_t *th);
void rb_threadptr_error_print(rb_thread_t *th, VALUE errinfo);
void rb_threadptr_error_print(rb_thread_t *volatile th, volatile VALUE errinfo);
#define RUBY_VM_CHECK_INTS(th) ruby_vm_check_ints(th)
static inline void
vm_eval.c (working copy)
{
int state;
VALUE result = Qundef;
rb_thread_t *th = GET_THREAD();
rb_thread_t *volatile th = GET_THREAD();
struct rb_block block;
const struct rb_block *base_block;
volatile VALUE file;
......
return rb_catch_obj(vtag, func, data);
}
static VALUE vm_catch_protect(VALUE, rb_block_call_func *, VALUE, int *, rb_thread_t *);
static VALUE vm_catch_protect(VALUE, rb_block_call_func *, VALUE, int *, rb_thread_t *volatile);
VALUE
rb_catch_obj(VALUE t, VALUE (*func)(), VALUE data)
......
static VALUE
vm_catch_protect(VALUE tag, rb_block_call_func *func, VALUE data,
int *stateptr, rb_thread_t *th)
int *stateptr, rb_thread_t *volatile th)
{
int state;
VALUE val = Qnil; /* OK */
rb_control_frame_t *saved_cfp = th->cfp;
rb_control_frame_t *volatile saved_cfp = th->cfp;
TH_PUSH_TAG(th);
vm_trace.c (working copy)
volatile int raised;
volatile int outer_state;
VALUE result = Qnil;
rb_thread_t *th = GET_THREAD();
rb_thread_t *volatile th = GET_THREAD();
int state;
const int tracing = th->trace_arg ? 1 : 0;
rb_trace_arg_t dummy_trace_arg;
(1-1/2)