mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
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()`.
This commit is contained in:
@@ -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. */
|
||||
|
||||
Reference in New Issue
Block a user