summaryrefslogtreecommitdiff
path: root/vm_eval.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-03-27 23:51:18 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-03-27 23:51:18 +0000
commit1c59cc2ccecb81512a2789ece0691ada6172beed (patch)
tree34d5340b92abc68b0d7dc53af50f947b030ef61d /vm_eval.c
parent55152ae26d200be3bd59170e9750949058fa82a2 (diff)
vm_eval.c: simplify rb_iterate
* internal.h (IFUNC_NEW): add argument for ID. * vm_eval.c (rb_iterate): create ifunnc only when it is used. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50102 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_eval.c')
-rw-r--r--vm_eval.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/vm_eval.c b/vm_eval.c
index 9dbb05b9ed..2dbe610888 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -1105,12 +1105,11 @@ rb_iterate(VALUE (* it_proc) (VALUE), VALUE data1,
{
int state;
volatile VALUE retval = Qnil;
- struct vm_ifunc *ifunc = IFUNC_NEW(bl_proc, data2);
+ struct vm_ifunc *ifunc = bl_proc ?
+ IFUNC_NEW(bl_proc, data2, rb_frame_this_func()) : 0;
rb_thread_t *th = GET_THREAD();
rb_control_frame_t *volatile cfp = th->cfp;
- ifunc->id = rb_frame_this_func();
-
TH_PUSH_TAG(th);
state = TH_EXEC_TAG();
if (state == 0) {
@@ -1144,8 +1143,8 @@ rb_iterate(VALUE (* it_proc) (VALUE), VALUE data1,
rb_vm_rewind_cfp(th, cfp);
}
- else{
- /* SDR(); printf("%p, %p\n", cdfp, escape_dfp); */
+ else if (0) {
+ SDR(); fprintf(stderr, "%p, %p\n", cfp, escape_cfp);
}
}
else if (state == TAG_RETRY) {
@@ -1163,10 +1162,7 @@ rb_iterate(VALUE (* it_proc) (VALUE), VALUE data1,
}
TH_POP_TAG();
- switch (state) {
- case 0:
- break;
- default:
+ if (state) {
TH_JUMP_TAG(th, state);
}
return retval;