vm.c (cipop): fix improper code to check if env is reclaimed; fix #6369

The callinfo refers blk since #5786 but not marked at the time. Later we
added reclamation check by #5791 but its repeated heap scans decrease
the performance drastically in some cases. So the original @dearblue's
solution should be taken

Probably we need to always keep the original block at the bottom of
arguments. And the explicit block argument should be a normal local
variable. We will investigate it later.
This commit is contained in:
Yukihiro "Matz" Matsumoto
2024-09-25 14:12:50 +09:00
parent 12264e33e5
commit 204928120b
2 changed files with 2 additions and 2 deletions
+1
View File
@@ -582,6 +582,7 @@ mark_context(mrb_state *mrb, struct mrb_context *c)
if (c->cibase) {
for (ci = c->cibase; ci <= c->ci; ci++) {
mrb_gc_mark(mrb, (struct RBasic*)ci->proc);
mrb_gc_mark(mrb, (struct RBasic*)ci->blk);
mrb_gc_mark(mrb, (struct RBasic*)ci->u.target_class);
}
}
+1 -2
View File
@@ -460,8 +460,7 @@ cipop(mrb_state *mrb)
ci_env_set(ci, NULL); // make possible to free env by GC if not needed
struct RProc *b = ci->blk;
if (b && !mrb_object_dead_p(mrb, (struct RBasic*)b) && b->tt == MRB_TT_PROC &&
!MRB_PROC_STRICT_P(b) && MRB_PROC_ENV(b) == CI_ENV(&ci[-1])) {
if (b && !MRB_PROC_STRICT_P(b) && MRB_PROC_ENV(b) == CI_ENV(&ci[-1])) {
b->flags |= MRB_PROC_ORPHAN;
}
if (env && !mrb_env_unshare(mrb, env, TRUE)) {