summaryrefslogtreecommitdiffhomepage
path: root/include
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 /include
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 'include')
-rw-r--r--include/mruby.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/mruby.h b/include/mruby.h
index 8adce289b..7a3def3fa 100644
--- a/include/mruby.h
+++ b/include/mruby.h
@@ -1121,6 +1121,11 @@ MRB_API mrb_value mrb_yield(mrb_state *mrb, mrb_value b, mrb_value arg);
MRB_API mrb_value mrb_yield_argv(mrb_state *mrb, mrb_value b, mrb_int argc, const mrb_value *argv);
MRB_API mrb_value mrb_yield_with_class(mrb_state *mrb, mrb_value b, mrb_int argc, const mrb_value *argv, mrb_value self, struct RClass *c);
+/* continue execution to the proc */
+/* this function should always be called as the last function of a method */
+/* e.g. return mrb_yield_cont(mrb, proc, self, argc, argv); */
+mrb_value mrb_yield_cont(mrb_state *mrb, mrb_value b, mrb_value self, mrb_int argc, const mrb_value *argv);
+
/* mrb_gc_protect() leaves the object in the arena */
MRB_API void mrb_gc_protect(mrb_state *mrb, mrb_value obj);
/* mrb_gc_register() keeps the object from GC. */