Merge pull request #6185 from dearblue/keep_context

Added `mrb_callinfo::u.keep_context` for clarity
This commit is contained in:
Yukihiro "Matz" Matsumoto
2024-02-29 19:13:59 +09:00
committed by GitHub
3 changed files with 4 additions and 3 deletions
+1
View File
@@ -184,6 +184,7 @@ typedef struct {
union {
struct REnv *env;
struct RClass *target_class;
const void *keep_context; /* if NULL, it means that the fiber has switched; for internal use */
} u;
} mrb_callinfo;
+1 -1
View File
@@ -156,7 +156,7 @@ fiber_result(mrb_state *mrb, const mrb_value *a, mrb_int len)
}
/* mark return from context modifying method */
#define MARK_CONTEXT_MODIFY(c) (c)->ci->u.target_class = NULL
#define MARK_CONTEXT_MODIFY(c) (c)->ci->u.keep_context = NULL
static void
fiber_check_cfunc(mrb_state *mrb, struct mrb_context *c)
+2 -2
View File
@@ -1915,7 +1915,7 @@ RETRY_TRY_BLOCK:
mrb_gc_arena_shrink(mrb, ai);
if (mrb->exc) goto L_RAISE;
ci = mrb->c->ci;
if (!ci->u.target_class) { /* return from context modifying method (resume/yield) */
if (!ci->u.keep_context) { /* return from context modifying method (resume/yield) */
if (ci->cci == CINFO_RESUMED) {
mrb->jmp = prev_jmp;
return recv;
@@ -2410,7 +2410,7 @@ RETRY_TRY_BLOCK:
ci = mrb->c->ci;
}
if (mrb->c->vmexec && !CI_TARGET_CLASS(ci)) {
if (mrb->c->vmexec && !ci->u.keep_context) {
mrb_gc_arena_restore(mrb, ai);
mrb->c->vmexec = FALSE;
mrb->jmp = prev_jmp;