summaryrefslogtreecommitdiff
path: root/vm_eval.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-03-28 05:22:04 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-03-28 05:22:04 +0000
commitdd6ab6b8116ea485ea7de5144b256e18e7d21872 (patch)
treeca9a1987ad99ce3a89a46ceefb2da0d6ac0c5f4d /vm_eval.c
parent0a321b21fa52b47a764b0fee2ab6a3de80807777 (diff)
vm_eval.c: simplify
* vm_eval.c (rb_iterate0): simplify TAG_BREAK and TAG_RETRY by sharing common code. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_eval.c')
-rw-r--r--vm_eval.c38
1 files changed, 13 insertions, 25 deletions
diff --git a/vm_eval.c b/vm_eval.c
index 2dbe610..1e36c54 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -1130,34 +1130,22 @@ rb_iterate(VALUE (* it_proc) (VALUE), VALUE data1,
}
retval = (*it_proc) (data1);
}
- else {
- const struct vm_throw_data *err = (struct vm_throw_data *)th->errinfo;
- if (state == TAG_BREAK) {
- const rb_control_frame_t *escape_cfp = THROW_DATA_CATCH_FRAME(err);
+ else if (state == TAG_BREAK || state == TAG_RETRY) {
+ const struct vm_throw_data *const err = (struct vm_throw_data *)th->errinfo;
+ const rb_control_frame_t *const escape_cfp = THROW_DATA_CATCH_FRAME(err);
- if (cfp == escape_cfp) {
- state = 0;
- th->state = 0;
- th->errinfo = Qnil;
- retval = THROW_DATA_VAL(err);
+ if (cfp == escape_cfp) {
+ rb_vm_rewind_cfp(th, cfp);
- rb_vm_rewind_cfp(th, cfp);
- }
- else if (0) {
- SDR(); fprintf(stderr, "%p, %p\n", cfp, escape_cfp);
- }
- }
- else if (state == TAG_RETRY) {
- const rb_control_frame_t *escape_cfp = THROW_DATA_CATCH_FRAME(err);
+ state = 0;
+ th->state = 0;
+ th->errinfo = Qnil;
- if (cfp == escape_cfp) {
- rb_vm_rewind_cfp(th, cfp);
-
- state = 0;
- th->state = 0;
- th->errinfo = Qnil;
- goto iter_retry;
- }
+ if (state == TAG_RETRY) goto iter_retry;
+ retval = THROW_DATA_VAL(err);
+ }
+ else if (0) {
+ SDR(); fprintf(stderr, "%p, %p\n", cfp, escape_cfp);
}
}
TH_POP_TAG();