* eval_intern.h: rename macros rb_thread_raised_* to

rb_ec_raised_*.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2017-11-07 05:22:09 +00:00
Родитель ee189904f0
Коммит 48ce4cb414
8 изменённых файлов: 27 добавлений и 29 удалений

2
eval.c
Просмотреть файл

@ -598,7 +598,7 @@ rb_longjmp(rb_execution_context_t *ec, int tag, volatile VALUE mesg, VALUE cause
{ {
mesg = exc_setup_message(ec, mesg, &cause); mesg = exc_setup_message(ec, mesg, &cause);
setup_exception(ec, tag, mesg, cause); setup_exception(ec, tag, mesg, cause);
rb_thread_raised_clear(rb_ec_thread_ptr(ec)); rb_ec_raised_clear(ec);
EC_JUMP_TAG(ec, tag); EC_JUMP_TAG(ec, tag);
} }

Просмотреть файл

@ -172,7 +172,7 @@ rb_ec_error_print(rb_execution_context_t * volatile ec, volatile VALUE errinfo)
if (NIL_P(errinfo)) if (NIL_P(errinfo))
return; return;
rb_thread_raised_clear(rb_ec_thread_ptr(ec)); rb_ec_raised_clear(ec);
EC_PUSH_TAG(ec); EC_PUSH_TAG(ec);
if (EC_EXEC_TAG() == TAG_NONE) { if (EC_EXEC_TAG() == TAG_NONE) {
@ -203,7 +203,7 @@ rb_ec_error_print(rb_execution_context_t * volatile ec, volatile VALUE errinfo)
error: error:
EC_POP_TAG(); EC_POP_TAG();
ec->errinfo = errinfo; ec->errinfo = errinfo;
rb_thread_raised_set(rb_ec_thread_ptr(ec), raised_flag); rb_ec_raised_set(ec, raised_flag);
} }
#define undef_mesg_for(v, k) rb_fstring_cstr("undefined"v" method `%1$s' for "k" `%2$s'") #define undef_mesg_for(v, k) rb_fstring_cstr("undefined"v" method `%1$s' for "k" `%2$s'")

Просмотреть файл

@ -98,7 +98,7 @@ extern int select_large_fdset(int, fd_set *, fd_set *, fd_set *, struct timeval
#define SAVE_ROOT_JMPBUF_AFTER_STMT \ #define SAVE_ROOT_JMPBUF_AFTER_STMT \
} \ } \
__except (GetExceptionCode() == EXCEPTION_STACK_OVERFLOW ? \ __except (GetExceptionCode() == EXCEPTION_STACK_OVERFLOW ? \
(rb_thread_raised_set(GET_THREAD(), RAISED_STACKOVERFLOW), \ (rb_ec_raised_set(GET_EC(), RAISED_STACKOVERFLOW), \
raise(SIGSEGV), \ raise(SIGSEGV), \
EXCEPTION_EXECUTE_HANDLER) : \ EXCEPTION_EXECUTE_HANDLER) : \
EXCEPTION_CONTINUE_SEARCH) { \ EXCEPTION_CONTINUE_SEARCH) { \
@ -280,10 +280,10 @@ enum {
RAISED_STACKOVERFLOW = 2, RAISED_STACKOVERFLOW = 2,
RAISED_NOMEMORY = 4 RAISED_NOMEMORY = 4
}; };
#define rb_thread_raised_set(th, f) ((th)->ec->raised_flag |= (f)) #define rb_ec_raised_set(ec, f) ((ec)->raised_flag |= (f))
#define rb_thread_raised_reset(th, f) ((th)->ec->raised_flag &= ~(f)) #define rb_ec_raised_reset(ec, f) ((ec)->raised_flag &= ~(f))
#define rb_thread_raised_p(th, f) (((th)->ec->raised_flag & (f)) != 0) #define rb_ec_raised_p(ec, f) (((ec)->raised_flag & (f)) != 0)
#define rb_thread_raised_clear(th) ((th)->ec->raised_flag = 0) #define rb_ec_raised_clear(ec) ((ec)->raised_flag = 0)
int rb_ec_set_raised(rb_execution_context_t *ec); int rb_ec_set_raised(rb_execution_context_t *ec);
int rb_ec_reset_raised(rb_execution_context_t *th); int rb_ec_reset_raised(rb_execution_context_t *th);
int rb_ec_stack_check(rb_execution_context_t *ec); int rb_ec_stack_check(rb_execution_context_t *ec);

16
gc.c
Просмотреть файл

@ -7697,27 +7697,27 @@ ruby_memerror(void)
void void
rb_memerror(void) rb_memerror(void)
{ {
rb_thread_t *th = GET_THREAD(); rb_execution_context_t *ec = GET_EC();
rb_objspace_t *objspace = rb_objspace_of(th->vm); rb_objspace_t *objspace = rb_objspace_of(rb_ec_vm_ptr(ec));
VALUE exc; VALUE exc;
if (during_gc) gc_exit(objspace, "rb_memerror"); if (during_gc) gc_exit(objspace, "rb_memerror");
exc = nomem_error; exc = nomem_error;
if (!exc || if (!exc ||
rb_thread_raised_p(th, RAISED_NOMEMORY)) { rb_ec_raised_p(ec, RAISED_NOMEMORY)) {
fprintf(stderr, "[FATAL] failed to allocate memory\n"); fprintf(stderr, "[FATAL] failed to allocate memory\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
if (rb_thread_raised_p(th, RAISED_NOMEMORY)) { if (rb_ec_raised_p(ec, RAISED_NOMEMORY)) {
rb_thread_raised_clear(th); rb_ec_raised_clear(ec);
} }
else { else {
rb_thread_raised_set(th, RAISED_NOMEMORY); rb_ec_raised_set(ec, RAISED_NOMEMORY);
exc = ruby_vm_special_exception_copy(exc); exc = ruby_vm_special_exception_copy(exc);
} }
th->ec->errinfo = exc; ec->errinfo = exc;
EC_JUMP_TAG(th->ec, TAG_RAISE); EC_JUMP_TAG(ec, TAG_RAISE);
} }
static void * static void *

Просмотреть файл

@ -734,7 +734,7 @@ native_reset_timer_thread(void)
int int
ruby_stack_overflowed_p(const rb_thread_t *th, const void *addr) ruby_stack_overflowed_p(const rb_thread_t *th, const void *addr)
{ {
return rb_thread_raised_p(th, RAISED_STACKOVERFLOW); return rb_ec_raised_p(th->ec, RAISED_STACKOVERFLOW);
} }
#if defined(__MINGW32__) #if defined(__MINGW32__)
@ -742,7 +742,7 @@ LONG WINAPI
rb_w32_stack_overflow_handler(struct _EXCEPTION_POINTERS *exception) rb_w32_stack_overflow_handler(struct _EXCEPTION_POINTERS *exception)
{ {
if (exception->ExceptionRecord->ExceptionCode == EXCEPTION_STACK_OVERFLOW) { if (exception->ExceptionRecord->ExceptionCode == EXCEPTION_STACK_OVERFLOW) {
rb_thread_raised_set(GET_THREAD(), RAISED_STACKOVERFLOW); rb_ec_raised_set(GET_EC(), RAISED_STACKOVERFLOW);
raise(SIGSEGV); raise(SIGSEGV);
} }
return EXCEPTION_CONTINUE_SEARCH; return EXCEPTION_CONTINUE_SEARCH;
@ -754,9 +754,9 @@ void
ruby_alloca_chkstk(size_t len, void *sp) ruby_alloca_chkstk(size_t len, void *sp)
{ {
if (ruby_stack_length(NULL) * sizeof(VALUE) >= len) { if (ruby_stack_length(NULL) * sizeof(VALUE) >= len) {
rb_thread_t *th = GET_THREAD(); rb_execution_context_t *ec = GET_EC();
if (!rb_thread_raised_p(th, RAISED_STACKOVERFLOW)) { if (!rb_ec_raised_p(ec, RAISED_STACKOVERFLOW)) {
rb_thread_raised_set(th, RAISED_STACKOVERFLOW); rb_ec_raised_set(ec, RAISED_STACKOVERFLOW);
rb_exc_raise(sysstack_error); rb_exc_raise(sysstack_error);
} }
} }

2
vm.c
Просмотреть файл

@ -1813,7 +1813,7 @@ vm_exec(rb_execution_context_t *ec)
const rb_control_frame_t *escape_cfp; const rb_control_frame_t *escape_cfp;
err = (struct vm_throw_data *)ec->errinfo; err = (struct vm_throw_data *)ec->errinfo;
rb_thread_raised_reset(rb_ec_thread_ptr(ec), RAISED_STACKOVERFLOW); rb_ec_raised_reset(ec, RAISED_STACKOVERFLOW);
exception_handler: exception_handler:
cont_pc = cont_sp = 0; cont_pc = cont_sp = 0;

Просмотреть файл

@ -255,12 +255,10 @@ rb_current_receiver(void)
static inline void static inline void
stack_check(rb_execution_context_t *ec) stack_check(rb_execution_context_t *ec)
{ {
rb_thread_t *th = rb_ec_thread_ptr(ec); if (!rb_ec_raised_p(ec, RAISED_STACKOVERFLOW) &&
if (!rb_thread_raised_p(th, RAISED_STACKOVERFLOW) &&
rb_ec_stack_check(ec)) { rb_ec_stack_check(ec)) {
rb_thread_raised_set(th, RAISED_STACKOVERFLOW); rb_ec_raised_set(ec, RAISED_STACKOVERFLOW);
rb_ec_stack_overflow(th->ec, FALSE); rb_ec_stack_overflow(ec, FALSE);
} }
} }

Просмотреть файл

@ -1859,8 +1859,8 @@ vm_cfp_consistent_p(rb_execution_context_t *ec, const rb_control_frame_t *reg_cf
{ {
const int ov_flags = RAISED_STACKOVERFLOW; const int ov_flags = RAISED_STACKOVERFLOW;
if (LIKELY(reg_cfp == ec->cfp + 1)) return TRUE; if (LIKELY(reg_cfp == ec->cfp + 1)) return TRUE;
if (rb_thread_raised_p(rb_ec_thread_ptr(ec), ov_flags)) { if (rb_ec_raised_p(ec, ov_flags)) {
rb_thread_raised_reset(rb_ec_thread_ptr(ec), ov_flags); rb_ec_raised_reset(ec, ov_flags);
return TRUE; return TRUE;
} }
return FALSE; return FALSE;