summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-object-ext
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2017-04-19 19:41:40 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2017-04-19 19:54:55 +0900
commit6a0b68f8b81adff8bc9fa58764eb014fa30de1c5 (patch)
tree05d0b17066208105a4565000c60bbb5272381793 /mrbgems/mruby-object-ext
parent77c2aa7b8aaf2c3611189e84c48ac3ee74d2f47d (diff)
downloadmruby-6a0b68f8b81adff8bc9fa58764eb014fa30de1c5.tar.gz
mruby-6a0b68f8b81adff8bc9fa58764eb014fa30de1c5.zip
Use trampoline technique for `instance_exec`; ref #3359
A new function `mrb_yield_cont()` is provided. You have to call it at the end of a C defined method, e.g. `return mrb_yield_cont()`.
Diffstat (limited to 'mrbgems/mruby-object-ext')
-rw-r--r--mrbgems/mruby-object-ext/src/object.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/mrbgems/mruby-object-ext/src/object.c b/mrbgems/mruby-object-ext/src/object.c
index 8a2325ef9..c6caf935f 100644
--- a/mrbgems/mruby-object-ext/src/object.c
+++ b/mrbgems/mruby-object-ext/src/object.c
@@ -1,6 +1,7 @@
#include <mruby.h>
#include <mruby/array.h>
#include <mruby/class.h>
+#include <mruby/proc.h>
/*
* call-seq:
@@ -86,7 +87,8 @@ mrb_obj_instance_exec(mrb_state *mrb, mrb_value self)
}
args = mrb_ary_new_from_values(mrb, argc, argv);
argv = RARRAY_PTR(args);
- return mrb_yield_with_class(mrb, blk, argc, argv, self, c);
+ mrb->c->ci->target_class = c;
+ return mrb_yield_cont(mrb, blk, self, argc, argv);
}
void