ruby-changes:48922
From: ko1 <ko1@a...>
Date: Wed, 6 Dec 2017 12:16:21 +0900 (JST)
Subject: [ruby-changes:48922] ko1:r61040 (trunk): remove `PUSH_TAG`/`EXEC_AG`/`POP_TAG`/`JUMO_TAG`.
ko1 2017-12-06 12:16:08 +0900 (Wed, 06 Dec 2017) New Revision: 61040 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61040 Log: remove `PUSH_TAG`/`EXEC_AG`/`POP_TAG`/`JUMO_TAG`. * eval_intern.h: remove non-`EC_` prefix *_TAG() macros. Use `EC_` prefix macros explicitly. Modified files: trunk/cont.c trunk/eval.c trunk/eval_intern.h trunk/eval_jump.c trunk/load.c trunk/signal.c trunk/thread.c trunk/vm.c trunk/vm_backtrace.c trunk/vm_trace.c Index: load.c =================================================================== --- load.c (revision 61039) +++ load.c (revision 61040) @@ -592,7 +592,7 @@ rb_load_internal0(rb_execution_context_t https://github.com/ruby/ruby/blob/trunk/load.c#L592 } 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, i https://github.com/ruby/ruby/blob/trunk/load.c#L666 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 saf https://github.com/ruby/ruby/blob/trunk/load.c#L970 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) https://github.com/ruby/ruby/blob/trunk/load.c#L1041 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); Index: eval_intern.h =================================================================== --- eval_intern.h (revision 61039) +++ eval_intern.h (revision 61040) @@ -144,9 +144,6 @@ LONG WINAPI rb_w32_stack_overflow_handle https://github.com/ruby/ruby/blob/trunk/eval_intern.h#L144 #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_contex https://github.com/ruby/ruby/blob/trunk/eval_intern.h#L195 #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 */ Index: vm_backtrace.c =================================================================== --- vm_backtrace.c (revision 61039) +++ vm_backtrace.c (revision 61040) @@ -1208,7 +1208,7 @@ rb_debug_inspector_open(rb_debug_inspect https://github.com/ruby/ruby/blob/trunk/vm_backtrace.c#L1208 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(); Index: vm.c =================================================================== --- vm.c (revision 61039) +++ vm.c (revision 61040) @@ -1143,7 +1143,7 @@ vm_invoke_proc(rb_execution_context_t *e https://github.com/ruby/ruby/blob/trunk/vm.c#L1143 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) https://github.com/ruby/ruby/blob/trunk/vm.c#L1436 { 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) https://github.com/ruby/ruby/blob/trunk/vm.c#L1772 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); Index: eval.c =================================================================== --- eval.c (revision 61039) +++ eval.c (revision 61040) @@ -56,13 +56,13 @@ ruby_setup(void) https://github.com/ruby/ruby/blob/trunk/eval.c#L56 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) https://github.com/ruby/ruby/blob/trunk/eval.c#L100 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) https://github.com/ruby/ruby/blob/trunk/eval.c#L109 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) https://github.com/ruby/ruby/blob/trunk/eval.c#L170 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) https://github.com/ruby/ruby/blob/trunk/eval.c#L242 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 * https://github.com/ruby/ruby/blob/trunk/eval.c#L509 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 * https://github.com/ruby/ruby/blob/trunk/eval.c#L540 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) https://github.com/ruby/ruby/blob/trunk/eval.c#L823 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), VALU https://github.com/ruby/ruby/blob/trunk/eval.c#L1033 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(); Index: eval_jump.c =================================================================== --- eval_jump.c (revision 61039) +++ eval_jump.c (revision 61040) @@ -119,7 +119,7 @@ rb_exec_end_proc(void) https://github.com/ruby/ruby/blob/trunk/eval_jump.c#L119 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); Index: cont.c =================================================================== --- cont.c (revision 61039) +++ cont.c (revision 61040) @@ -1413,7 +1413,7 @@ rb_fiber_start(void) https://github.com/ruby/ruby/blob/trunk/cont.c#L1413 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; Index: thread.c =================================================================== --- thread.c (revision 61039) +++ thread.c (revision 61040) @@ -634,7 +634,7 @@ thread_start_func_2(rb_thread_t *th, VAL https://github.com/ruby/ruby/blob/trunk/thread.c#L634 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 https://github.com/ruby/ruby/blob/trunk/thread.c#L1450 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, https://github.com/ruby/ruby/blob/trunk/thread.c#L1884 } 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, VAL https://github.com/ruby/ruby/blob/trunk/thread.c#L4666 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, VAL https://github.com/ruby/ruby/blob/trunk/thread.c#L4674 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; } } Index: vm_trace.c =================================================================== --- vm_trace.c (revision 61039) +++ vm_trace.c (revision 61040) @@ -1623,7 +1623,7 @@ rb_postponed_job_flush(rb_vm_t *vm) https://github.com/ruby/ruby/blob/trunk/vm_trace.c#L1623 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) { Index: signal.c =================================================================== --- signal.c (revision 61039) +++ signal.c (revision 61040) @@ -1002,7 +1002,7 @@ signal_exec(VALUE cmd, int safe, int sig https://github.com/ruby/ruby/blob/trunk/signal.c#L1002 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); } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/