diff options
-rw-r--r-- | cont.c | 2 | ||||
-rw-r--r-- | eval.c | 30 | ||||
-rw-r--r-- | eval_intern.h | 8 | ||||
-rw-r--r-- | eval_jump.c | 2 | ||||
-rw-r--r-- | load.c | 12 | ||||
-rw-r--r-- | signal.c | 2 | ||||
-rw-r--r-- | thread.c | 16 | ||||
-rw-r--r-- | vm.c | 6 | ||||
-rw-r--r-- | vm_backtrace.c | 2 | ||||
-rw-r--r-- | vm_trace.c | 2 |
10 files changed, 37 insertions, 45 deletions
@@ -1413,7 +1413,7 @@ rb_fiber_start(void) VM_ASSERT(FIBER_RESUMED_P(fib)); EC_PUSH_TAG(th->ec); - if ((state = EXEC_TAG()) == TAG_NONE) { + if ((state = EC_EXEC_TAG()) == TAG_NONE) { rb_context_t *cont = &VAR_FROM_MEMORY(fib)->cont; int argc; const VALUE *argv, args = cont->value; @@ -56,13 +56,13 @@ ruby_setup(void) Init_heap(); Init_vm_objects(); - PUSH_TAG(); - if ((state = EXEC_TAG()) == TAG_NONE) { + EC_PUSH_TAG(GET_EC()); + if ((state = EC_EXEC_TAG()) == TAG_NONE) { rb_call_inits(); ruby_prog_init(); GET_VM()->running = 1; } - POP_TAG(); + EC_POP_TAG(); return state; } @@ -100,8 +100,8 @@ ruby_options(int argc, char **argv) void *volatile iseq = 0; ruby_init_stack((void *)&iseq); - PUSH_TAG(); - if ((state = EXEC_TAG()) == TAG_NONE) { + EC_PUSH_TAG(GET_EC()); + if ((state = EC_EXEC_TAG()) == TAG_NONE) { SAVE_ROOT_JMPBUF(GET_THREAD(), iseq = ruby_process_options(argc, argv)); } else { @@ -109,18 +109,18 @@ ruby_options(int argc, char **argv) state = error_handle(state); iseq = (void *)INT2FIX(state); } - POP_TAG(); + EC_POP_TAG(); return iseq; } static void ruby_finalize_0(void) { - PUSH_TAG(); - if (EXEC_TAG() == TAG_NONE) { + EC_PUSH_TAG(GET_EC()); + if (EC_EXEC_TAG() == TAG_NONE) { rb_trap_exit(); } - POP_TAG(); + EC_POP_TAG(); rb_exec_end_proc(); rb_clear_trace_func(); } @@ -170,7 +170,7 @@ ruby_cleanup(volatile int ex) rb_threadptr_interrupt(th); rb_threadptr_check_signal(th); EC_PUSH_TAG(th->ec); - if ((state = EXEC_TAG()) == TAG_NONE) { + if ((state = EC_EXEC_TAG()) == TAG_NONE) { SAVE_ROOT_JMPBUF(th, { RUBY_VM_CHECK_INTS(th->ec); }); step_0: step++; @@ -242,7 +242,7 @@ ruby_exec_internal(void *n) if (!n) return 0; EC_PUSH_TAG(th->ec); - if ((state = EXEC_TAG()) == TAG_NONE) { + if ((state = EC_EXEC_TAG()) == TAG_NONE) { SAVE_ROOT_JMPBUF(th, { rb_iseq_eval_main(iseq); }); @@ -509,7 +509,7 @@ setup_exception(rb_execution_context_t *ec, int tag, volatile VALUE mesg, VALUE volatile int state = 0; EC_PUSH_TAG(ec); - if (EXEC_TAG() == TAG_NONE && !(state = rb_ec_set_raised(ec))) { + if (EC_EXEC_TAG() == TAG_NONE && !(state = rb_ec_set_raised(ec))) { VALUE bt = rb_get_backtrace(mesg); if (!NIL_P(bt) || cause == Qundef) { if (OBJ_FROZEN(mesg)) { @@ -540,7 +540,7 @@ setup_exception(rb_execution_context_t *ec, int tag, volatile VALUE mesg, VALUE mesg = e; EC_PUSH_TAG(ec); - if ((state = EXEC_TAG()) == TAG_NONE) { + if ((state = EC_EXEC_TAG()) == TAG_NONE) { ec->errinfo = Qnil; e = rb_obj_as_string(mesg); ec->errinfo = mesg; @@ -823,7 +823,7 @@ rb_jump_tag(int tag) if (UNLIKELY(tag < TAG_RETURN || tag > TAG_FATAL)) { unknown_longjmp_status(tag); } - JUMP_TAG(tag); + EC_JUMP_TAG(GET_EC(), tag); } /*! Determines if the current method is given a block. @@ -1033,7 +1033,7 @@ rb_ensure(VALUE (*b_proc)(ANYARGS), VALUE data1, VALUE (*e_proc)(ANYARGS), VALUE ensure_list.next = ec->ensure_list; ec->ensure_list = &ensure_list; EC_PUSH_TAG(ec); - if ((state = EXEC_TAG()) == TAG_NONE) { + if ((state = EC_EXEC_TAG()) == TAG_NONE) { result = (*b_proc) (data1); } EC_POP_TAG(); diff --git a/eval_intern.h b/eval_intern.h index 93f866371e..7259a79bee 100644 --- a/eval_intern.h +++ b/eval_intern.h @@ -144,9 +144,6 @@ LONG WINAPI rb_w32_stack_overflow_handler(struct _EXCEPTION_POINTERS *); #define EC_REPUSH_TAG() (void)(_ec->tag = &_tag) -#define PUSH_TAG() EC_PUSH_TAG(GET_EC()) -#define POP_TAG() EC_POP_TAG() - #if defined __GNUC__ && __GNUC__ == 4 && (__GNUC_MINOR__ >= 6 && __GNUC_MINOR__ <= 8) # define VAR_FROM_MEMORY(var) __extension__(*(__typeof__(var) volatile *)&(var)) # define VAR_INITIALIZED(var) ((var) = VAR_FROM_MEMORY(var)) @@ -198,13 +195,8 @@ rb_ec_tag_jump(const rb_execution_context_t *ec, enum ruby_tag_type st) #define EC_EXEC_TAG() \ (ruby_setjmp(_tag.buf) ? rb_ec_tag_state(VAR_FROM_MEMORY(_ec)) : (EC_REPUSH_TAG(), 0)) -#define EXEC_TAG() \ - EC_EXEC_TAG() - #define EC_JUMP_TAG(ec, st) rb_ec_tag_jump(ec, st) -#define JUMP_TAG(st) EC_JUMP_TAG(GET_EC(), (st)) - #define INTERNAL_EXCEPTION_P(exc) FIXNUM_P(exc) /* CREF operators */ diff --git a/eval_jump.c b/eval_jump.c index c6972bf319..9ea69736cf 100644 --- a/eval_jump.c +++ b/eval_jump.c @@ -119,7 +119,7 @@ rb_exec_end_proc(void) volatile VALUE errinfo = ec->errinfo; EC_PUSH_TAG(ec); - if ((state = EXEC_TAG()) == TAG_NONE) { + if ((state = EC_EXEC_TAG()) == TAG_NONE) { again: exec_end_procs_chain(&ephemeral_end_procs, &ec->errinfo); exec_end_procs_chain(&end_procs, &ec->errinfo); @@ -592,7 +592,7 @@ rb_load_internal0(rb_execution_context_t *ec, VALUE fname, int wrap) } EC_PUSH_TAG(th->ec); - state = EXEC_TAG(); + state = EC_EXEC_TAG(); if (state == TAG_NONE) { rb_ast_t *ast; const rb_iseq_t *iseq; @@ -666,11 +666,11 @@ rb_load_protect(VALUE fname, int wrap, int *pstate) enum ruby_tag_type state; volatile VALUE path = 0; - PUSH_TAG(); - if ((state = EXEC_TAG()) == TAG_NONE) { + EC_PUSH_TAG(GET_EC()); + if ((state = EC_EXEC_TAG()) == TAG_NONE) { path = file_to_load(fname); } - POP_TAG(); + EC_POP_TAG(); if (state == TAG_NONE) state = rb_load_internal0(GET_EC(), path, wrap); if (state != TAG_NONE) *pstate = state; @@ -970,7 +970,7 @@ rb_require_internal(VALUE fname, int safe) EC_PUSH_TAG(ec); saved.safe = rb_safe_level(); - if ((state = EXEC_TAG()) == TAG_NONE) { + if ((state = EC_EXEC_TAG()) == TAG_NONE) { long handle; int found; @@ -1041,7 +1041,7 @@ rb_require_safe(VALUE fname, int safe) if (result > TAG_RETURN) { if (result == TAG_RAISE) rb_exc_raise(rb_errinfo()); - JUMP_TAG(result); + EC_JUMP_TAG(GET_EC(), result); } if (result < 0) { load_failed(fname); @@ -1002,7 +1002,7 @@ signal_exec(VALUE cmd, int safe, int sig) ec->interrupt_mask |= TRAP_INTERRUPT_MASK; EC_PUSH_TAG(ec); - if ((state = EXEC_TAG()) == TAG_NONE) { + if ((state = EC_EXEC_TAG()) == TAG_NONE) { VALUE signum = INT2NUM(sig); rb_eval_cmd(cmd, rb_ary_new3(1, signum), safe); } @@ -634,7 +634,7 @@ thread_start_func_2(rb_thread_t *th, VALUE *stack_start, VALUE *register_stack_s rb_thread_set_current(th); EC_PUSH_TAG(th->ec); - if ((state = EXEC_TAG()) == TAG_NONE) { + if ((state = EC_EXEC_TAG()) == TAG_NONE) { SAVE_ROOT_JMPBUF(th, thread_do_start(th, args)); } else { @@ -1450,7 +1450,7 @@ rb_thread_io_blocking_region(rb_blocking_function_t *func, void *data1, int fd) list_add(&rb_ec_vm_ptr(ec)->waiting_fds, &wfd.wfd_node); EC_PUSH_TAG(ec); - if ((state = EXEC_TAG()) == TAG_NONE) { + if ((state = EC_EXEC_TAG()) == TAG_NONE) { BLOCKING_REGION({ val = func(data1); saved_errno = errno; @@ -1884,7 +1884,7 @@ rb_thread_s_handle_interrupt(VALUE self, VALUE mask_arg) } EC_PUSH_TAG(th->ec); - if ((state = EXEC_TAG()) == TAG_NONE) { + if ((state = EC_EXEC_TAG()) == TAG_NONE) { r = rb_yield(Qnil); } EC_POP_TAG(); @@ -4666,7 +4666,7 @@ exec_recursive(VALUE (*func) (VALUE, VALUE, int), VALUE obj, VALUE pairid, VALUE result = rb_catch_protect(p.list, exec_recursive_i, (VALUE)&p, &state); if (!recursive_pop(p.list, p.objid, p.pairid)) goto invalid; if (!recursive_pop(p.list, ID2SYM(recursive_key), 0)) goto invalid; - if (state != TAG_NONE) JUMP_TAG(state); + if (state != TAG_NONE) EC_JUMP_TAG(GET_EC(), state); if (result == p.list) { result = (*func)(obj, arg, TRUE); } @@ -4674,18 +4674,18 @@ exec_recursive(VALUE (*func) (VALUE, VALUE, int), VALUE obj, VALUE pairid, VALUE else { volatile VALUE ret = Qundef; recursive_push(p.list, p.objid, p.pairid); - PUSH_TAG(); - if ((state = EXEC_TAG()) == TAG_NONE) { + EC_PUSH_TAG(GET_EC()); + if ((state = EC_EXEC_TAG()) == TAG_NONE) { ret = (*func)(obj, arg, FALSE); } - POP_TAG(); + EC_POP_TAG(); if (!recursive_pop(p.list, p.objid, p.pairid)) { invalid: rb_raise(rb_eTypeError, "invalid inspect_tbl pair_list " "for %+"PRIsVALUE" in %+"PRIsVALUE, sym, rb_thread_current()); } - if (state != TAG_NONE) JUMP_TAG(state); + if (state != TAG_NONE) EC_JUMP_TAG(GET_EC(), state); result = ret; } } @@ -1143,7 +1143,7 @@ vm_invoke_proc(rb_execution_context_t *ec, rb_proc_t *proc, VALUE self, volatile int stored_safe = ec->safe_level; EC_PUSH_TAG(ec); - if ((state = EXEC_TAG()) == TAG_NONE) { + if ((state = EC_EXEC_TAG()) == TAG_NONE) { ec->safe_level = proc->safe_level; val = invoke_block_from_c_proc(ec, proc, self, argc, argv, passed_block_handler, proc->is_lambda); } @@ -1436,7 +1436,7 @@ rb_vm_jump_tag_but_local_jump(int state) { VALUE exc = rb_vm_make_jump_tag_but_local_jump(state, Qundef); if (!NIL_P(exc)) rb_exc_raise(exc); - JUMP_TAG(state); + EC_JUMP_TAG(GET_EC(), state); } #endif @@ -1772,7 +1772,7 @@ vm_exec(rb_execution_context_t *ec) EC_PUSH_TAG(ec); _tag.retval = Qnil; - if ((state = EXEC_TAG()) == TAG_NONE) { + if ((state = EC_EXEC_TAG()) == TAG_NONE) { vm_loop_start: result = vm_exec_core(ec, initial); VM_ASSERT(ec->tag == &_tag); diff --git a/vm_backtrace.c b/vm_backtrace.c index 93f0cb9772..d82d73d963 100644 --- a/vm_backtrace.c +++ b/vm_backtrace.c @@ -1208,7 +1208,7 @@ rb_debug_inspector_open(rb_debug_inspector_func_t func, void *data) dbg_context.contexts = collect_caller_bindings(ec); EC_PUSH_TAG(ec); - if ((state = EXEC_TAG()) == TAG_NONE) { + if ((state = EC_EXEC_TAG()) == TAG_NONE) { result = (*func)(&dbg_context, data); } EC_POP_TAG(); diff --git a/vm_trace.c b/vm_trace.c index 9a7f0cc087..d3562a3f6c 100644 --- a/vm_trace.c +++ b/vm_trace.c @@ -1623,7 +1623,7 @@ rb_postponed_job_flush(rb_vm_t *vm) ec->interrupt_mask |= block_mask; { EC_PUSH_TAG(ec); - if (EXEC_TAG() == TAG_NONE) { + if (EC_EXEC_TAG() == TAG_NONE) { int index; while ((index = vm->postponed_job_index) > 0) { if (ATOMIC_CAS(vm->postponed_job_index, index, index-1) == index) { |