summaryrefslogtreecommitdiffhomepage
path: root/src/gc.c
diff options
context:
space:
mode:
authordearblue <[email protected]>2021-01-10 10:36:03 +0900
committerdearblue <[email protected]>2021-01-10 13:23:35 +0900
commit16baea06771f38fea810ad1eaf3239086442c258 (patch)
treeb186bc1a7f3468edcf645dd36282434c8f171fd2 /src/gc.c
parent58e94427377952b0953bcdf2d544c62b0fefd4a6 (diff)
downloadmruby-16baea06771f38fea810ad1eaf3239086442c258.tar.gz
mruby-16baea06771f38fea810ad1eaf3239086442c258.zip
Changes `stackent` to `stack` of `mrb_callinfo`
This enhances self-containment. Previously `mrb_context::stack` had the current call level stack, but now it owns it. The `mrb_context::stack` field, which is no longer needed, will be removed.
Diffstat (limited to 'src/gc.c')
-rw-r--r--src/gc.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/gc.c b/src/gc.c
index 73b7838e5..5943a0e3b 100644
--- a/src/gc.c
+++ b/src/gc.c
@@ -626,11 +626,14 @@ mark_context_stack(mrb_state *mrb, struct mrb_context *c)
size_t e;
mrb_value nil;
- if (c->stack == NULL) return;
- e = c->stack - c->stbase;
+ if (c->stbase == NULL) return;
if (c->ci) {
+ e = (c->ci->stack ? c->ci->stack - c->stbase : 0);
e += ci_nregs(c->ci);
}
+ else {
+ e = 0;
+ }
if (c->stbase + e > c->stend) e = c->stend - c->stbase;
for (i=0; i<e; i++) {
mrb_value v = c->stbase[i];
@@ -1001,7 +1004,7 @@ gc_gray_counts(mrb_state *mrb, mrb_gc *gc, struct RBasic *obj)
if (!c || c->status == MRB_FIBER_TERMINATED) break;
/* mark stack */
- i = c->stack - c->stbase;
+ i = c->ci->stack - c->stbase;
if (c->ci) {
i += ci_nregs(c->ci);