ruby-changes:39202
From: nobu <ko1@a...>
Date: Fri, 17 Jul 2015 22:18:27 +0900 (JST)
Subject: [ruby-changes:39202] nobu:r51283 (trunk): compile.c: use ruby_tag_type
nobu 2015-07-17 22:18:12 +0900 (Fri, 17 Jul 2015) New Revision: 51283 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51283 Log: compile.c: use ruby_tag_type * compile.c (iseq_compile_each): use enum ruby_tag_type names. * vm_core.h (ruby_tag_type): move from eval_intern.h for compiling break/next/redo/return. Modified files: trunk/ChangeLog trunk/compile.c trunk/eval_intern.h trunk/vm_core.h Index: eval_intern.h =================================================================== --- eval_intern.h (revision 51282) +++ eval_intern.h (revision 51283) @@ -178,27 +178,6 @@ rb_threadptr_tag_jump(rb_thread_t *th, i https://github.com/ruby/ruby/blob/trunk/eval_intern.h#L178 #define INTERNAL_EXCEPTION_P(exc) FIXNUM_P(exc) -enum ruby_tag_type { - RUBY_TAG_RETURN = 0x1, - RUBY_TAG_BREAK = 0x2, - RUBY_TAG_NEXT = 0x3, - RUBY_TAG_RETRY = 0x4, - RUBY_TAG_REDO = 0x5, - RUBY_TAG_RAISE = 0x6, - RUBY_TAG_THROW = 0x7, - RUBY_TAG_FATAL = 0x8, - RUBY_TAG_MASK = 0xf -}; -#define TAG_RETURN RUBY_TAG_RETURN -#define TAG_BREAK RUBY_TAG_BREAK -#define TAG_NEXT RUBY_TAG_NEXT -#define TAG_RETRY RUBY_TAG_RETRY -#define TAG_REDO RUBY_TAG_REDO -#define TAG_RAISE RUBY_TAG_RAISE -#define TAG_THROW RUBY_TAG_THROW -#define TAG_FATAL RUBY_TAG_FATAL -#define TAG_MASK RUBY_TAG_MASK - /* CREF operators */ #define NODE_FL_CREF_PUSHED_BY_EVAL_ (((VALUE)1)<<15) Index: ChangeLog =================================================================== --- ChangeLog (revision 51282) +++ ChangeLog (revision 51283) @@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Fri Jul 17 22:18:09 2015 Nobuyoshi Nakada <nobu@r...> + + * compile.c (iseq_compile_each): use enum ruby_tag_type names. + + * vm_core.h (ruby_tag_type): move from eval_intern.h for compiling + break/next/redo/return. + Fri Jul 17 15:39:19 2015 Nobuyoshi Nakada <nobu@r...> * include/ruby/encoding.h (ENC_CODERANGE_CLEAN_P): predicate that Index: vm_core.h =================================================================== --- vm_core.h (revision 51282) +++ vm_core.h (revision 51283) @@ -124,6 +124,27 @@ https://github.com/ruby/ruby/blob/trunk/vm_core.h#L124 typedef unsigned long rb_num_t; +enum ruby_tag_type { + RUBY_TAG_RETURN = 0x1, + RUBY_TAG_BREAK = 0x2, + RUBY_TAG_NEXT = 0x3, + RUBY_TAG_RETRY = 0x4, + RUBY_TAG_REDO = 0x5, + RUBY_TAG_RAISE = 0x6, + RUBY_TAG_THROW = 0x7, + RUBY_TAG_FATAL = 0x8, + RUBY_TAG_MASK = 0xf +}; +#define TAG_RETURN RUBY_TAG_RETURN +#define TAG_BREAK RUBY_TAG_BREAK +#define TAG_NEXT RUBY_TAG_NEXT +#define TAG_RETRY RUBY_TAG_RETRY +#define TAG_REDO RUBY_TAG_REDO +#define TAG_RAISE RUBY_TAG_RAISE +#define TAG_THROW RUBY_TAG_THROW +#define TAG_FATAL RUBY_TAG_FATAL +#define TAG_MASK RUBY_TAG_MASK + /* iseq data type */ struct iseq_compile_data_ensure_node_stack; Index: compile.c =================================================================== --- compile.c (revision 51282) +++ compile.c (revision 51283) @@ -3706,7 +3706,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ https://github.com/ruby/ruby/blob/trunk/compile.c#L3706 break_by_insn: /* escape from block */ COMPILE(ret, "break val (block)", node->nd_stts); - ADD_INSN1(ret, line, throw, INT2FIX(level | 0x02) /* TAG_BREAK */ ); + ADD_INSN1(ret, line, throw, INT2FIX(level | TAG_BREAK)); if (poped) { ADD_INSN(ret, line, pop); } @@ -3801,7 +3801,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ https://github.com/ruby/ruby/blob/trunk/compile.c#L3801 } if (ip != 0) { COMPILE(ret, "next val", node->nd_stts); - ADD_INSN1(ret, line, throw, INT2FIX(level | 0x03) /* TAG_NEXT */ ); + ADD_INSN1(ret, line, throw, INT2FIX(level | TAG_NEXT)); if (poped) { ADD_INSN(ret, line, pop); @@ -3868,7 +3868,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ https://github.com/ruby/ruby/blob/trunk/compile.c#L3868 } if (ip != 0) { ADD_INSN(ret, line, putnil); - ADD_INSN1(ret, line, throw, INT2FIX(level | 0x05) /* TAG_REDO */ ); + ADD_INSN1(ret, line, throw, INT2FIX(level | TAG_REDO)); if (poped) { ADD_INSN(ret, line, pop); @@ -3883,7 +3883,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ https://github.com/ruby/ruby/blob/trunk/compile.c#L3883 case NODE_RETRY:{ if (iseq->type == ISEQ_TYPE_RESCUE) { ADD_INSN(ret, line, putnil); - ADD_INSN1(ret, line, throw, INT2FIX(0x04) /* TAG_RETRY */ ); + ADD_INSN1(ret, line, throw, INT2FIX(TAG_RETRY)); if (poped) { ADD_INSN(ret, line, pop); @@ -4812,7 +4812,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ https://github.com/ruby/ruby/blob/trunk/compile.c#L4812 } } else { - ADD_INSN1(ret, line, throw, INT2FIX(0x01) /* TAG_RETURN */ ); + ADD_INSN1(ret, line, throw, INT2FIX(TAG_RETURN)); if (poped) { ADD_INSN(ret, line, pop); } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/