Added mrb_callinfo::u.keep_context for clarity

This commit is contained in:
dearblue
2024-02-24 21:32:11 +09:00
parent 6248e9c2ef
commit ce8b2d4973
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;