From 6a0b68f8b81adff8bc9fa58764eb014fa30de1c5 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Wed, 19 Apr 2017 19:41:40 +0900 Subject: 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()`. --- include/mruby.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include') 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. */ -- cgit v1.2.3