Skip to content

Commit 67f5f94

Browse files
committed
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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51283 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 2731b91 commit 67f5f94

File tree

4 files changed

+33
-26
lines changed

4 files changed

+33
-26
lines changed

ChangeLog

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
Fri Jul 17 22:18:09 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
2+
3+
* compile.c (iseq_compile_each): use enum ruby_tag_type names.
4+
5+
* vm_core.h (ruby_tag_type): move from eval_intern.h for compiling
6+
break/next/redo/return.
7+
18
Fri Jul 17 15:39:19 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
29

310
* include/ruby/encoding.h (ENC_CODERANGE_CLEAN_P): predicate that

compile.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -3706,7 +3706,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
37063706
break_by_insn:
37073707
/* escape from block */
37083708
COMPILE(ret, "break val (block)", node->nd_stts);
3709-
ADD_INSN1(ret, line, throw, INT2FIX(level | 0x02) /* TAG_BREAK */ );
3709+
ADD_INSN1(ret, line, throw, INT2FIX(level | TAG_BREAK));
37103710
if (poped) {
37113711
ADD_INSN(ret, line, pop);
37123712
}
@@ -3801,7 +3801,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
38013801
}
38023802
if (ip != 0) {
38033803
COMPILE(ret, "next val", node->nd_stts);
3804-
ADD_INSN1(ret, line, throw, INT2FIX(level | 0x03) /* TAG_NEXT */ );
3804+
ADD_INSN1(ret, line, throw, INT2FIX(level | TAG_NEXT));
38053805

38063806
if (poped) {
38073807
ADD_INSN(ret, line, pop);
@@ -3868,7 +3868,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
38683868
}
38693869
if (ip != 0) {
38703870
ADD_INSN(ret, line, putnil);
3871-
ADD_INSN1(ret, line, throw, INT2FIX(level | 0x05) /* TAG_REDO */ );
3871+
ADD_INSN1(ret, line, throw, INT2FIX(level | TAG_REDO));
38723872

38733873
if (poped) {
38743874
ADD_INSN(ret, line, pop);
@@ -3883,7 +3883,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
38833883
case NODE_RETRY:{
38843884
if (iseq->type == ISEQ_TYPE_RESCUE) {
38853885
ADD_INSN(ret, line, putnil);
3886-
ADD_INSN1(ret, line, throw, INT2FIX(0x04) /* TAG_RETRY */ );
3886+
ADD_INSN1(ret, line, throw, INT2FIX(TAG_RETRY));
38873887

38883888
if (poped) {
38893889
ADD_INSN(ret, line, pop);
@@ -4812,7 +4812,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
48124812
}
48134813
}
48144814
else {
4815-
ADD_INSN1(ret, line, throw, INT2FIX(0x01) /* TAG_RETURN */ );
4815+
ADD_INSN1(ret, line, throw, INT2FIX(TAG_RETURN));
48164816
if (poped) {
48174817
ADD_INSN(ret, line, pop);
48184818
}

eval_intern.h

-21
Original file line numberDiff line numberDiff line change
@@ -178,27 +178,6 @@ rb_threadptr_tag_jump(rb_thread_t *th, int st)
178178

179179
#define INTERNAL_EXCEPTION_P(exc) FIXNUM_P(exc)
180180

181-
enum ruby_tag_type {
182-
RUBY_TAG_RETURN = 0x1,
183-
RUBY_TAG_BREAK = 0x2,
184-
RUBY_TAG_NEXT = 0x3,
185-
RUBY_TAG_RETRY = 0x4,
186-
RUBY_TAG_REDO = 0x5,
187-
RUBY_TAG_RAISE = 0x6,
188-
RUBY_TAG_THROW = 0x7,
189-
RUBY_TAG_FATAL = 0x8,
190-
RUBY_TAG_MASK = 0xf
191-
};
192-
#define TAG_RETURN RUBY_TAG_RETURN
193-
#define TAG_BREAK RUBY_TAG_BREAK
194-
#define TAG_NEXT RUBY_TAG_NEXT
195-
#define TAG_RETRY RUBY_TAG_RETRY
196-
#define TAG_REDO RUBY_TAG_REDO
197-
#define TAG_RAISE RUBY_TAG_RAISE
198-
#define TAG_THROW RUBY_TAG_THROW
199-
#define TAG_FATAL RUBY_TAG_FATAL
200-
#define TAG_MASK RUBY_TAG_MASK
201-
202181
/* CREF operators */
203182

204183
#define NODE_FL_CREF_PUSHED_BY_EVAL_ (((VALUE)1)<<15)

vm_core.h

+21
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,27 @@
124124

125125
typedef unsigned long rb_num_t;
126126

127+
enum ruby_tag_type {
128+
RUBY_TAG_RETURN = 0x1,
129+
RUBY_TAG_BREAK = 0x2,
130+
RUBY_TAG_NEXT = 0x3,
131+
RUBY_TAG_RETRY = 0x4,
132+
RUBY_TAG_REDO = 0x5,
133+
RUBY_TAG_RAISE = 0x6,
134+
RUBY_TAG_THROW = 0x7,
135+
RUBY_TAG_FATAL = 0x8,
136+
RUBY_TAG_MASK = 0xf
137+
};
138+
#define TAG_RETURN RUBY_TAG_RETURN
139+
#define TAG_BREAK RUBY_TAG_BREAK
140+
#define TAG_NEXT RUBY_TAG_NEXT
141+
#define TAG_RETRY RUBY_TAG_RETRY
142+
#define TAG_REDO RUBY_TAG_REDO
143+
#define TAG_RAISE RUBY_TAG_RAISE
144+
#define TAG_THROW RUBY_TAG_THROW
145+
#define TAG_FATAL RUBY_TAG_FATAL
146+
#define TAG_MASK RUBY_TAG_MASK
147+
127148
/* iseq data type */
128149

129150
struct iseq_compile_data_ensure_node_stack;

0 commit comments

Comments
 (0)