From 332a60d6630e48d1744db3df24dba2700a8e2100 Mon Sep 17 00:00:00 2001 From: "hyunghwan.chung" Date: Thu, 22 Oct 2020 10:46:45 +0000 Subject: [PATCH] debugging gc problems --- moo/lib/gc.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/moo/lib/gc.c b/moo/lib/gc.c index e646c4c..97cc65e 100644 --- a/moo/lib/gc.c +++ b/moo/lib/gc.c @@ -846,6 +846,19 @@ static MOO_INLINE void gc_mark_root (moo_t* moo) moo_oow_t i, gcfin_count; moo_evtcb_t* cb; + if (moo->active_context) + { + MOO_ASSERT (moo, (moo_oop_t)moo->processor != moo->_nil); + MOO_ASSERT (moo, (moo_oop_t)moo->processor->active != moo->_nil); + moo->active_context->ip = MOO_SMOOI_TO_OOP(moo->ip); /* not needed but do it */ + + /* commit the stack pointer to the active process because + * gc utilizes the stack pointer of a process object when marking */ + + moo->processor->active->sp = MOO_SMOOI_TO_OOP(moo->sp); + + } + gc_mark (moo, moo->_nil); gc_mark (moo, moo->_true); gc_mark (moo, moo->_false);