From 7a569fb192f16636076413c4bffa68296bc49da6 Mon Sep 17 00:00:00 2001 From: "hyunghwan.chung" Date: Fri, 23 Oct 2020 09:21:55 +0000 Subject: [PATCH] debugging gc --- moo/lib/gc.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/moo/lib/gc.c b/moo/lib/gc.c index 97cc65e..fea148b 100644 --- a/moo/lib/gc.c +++ b/moo/lib/gc.c @@ -850,13 +850,15 @@ static MOO_INLINE void gc_mark_root (moo_t* moo) { 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); - + + #if 0 + moo->active_context->ip = MOO_SMOOI_TO_OOP(moo->ip); /* not needed but do it */ + #endif } gc_mark (moo, moo->_nil); @@ -962,8 +964,8 @@ static MOO_INLINE void gc_sweep (moo_t* moo) /* destroy */ if (prev) prev->next = next; else moo->gch = next; -if (!moo->igniting) -MOO_DEBUG2(moo, "** DESTROYING curr %p %O\n", curr, obj); +//if (!moo->igniting) +//MOO_DEBUG2(moo, "** DESTROYING curr %p %O\n", curr, obj); moo_freemem (moo, curr); } @@ -1148,11 +1150,14 @@ void moo_gc (moo_t* moo) /* TODO: verify if this is correct */ MOO_ASSERT (moo, (moo_oop_t)moo->processor != moo->_nil); MOO_ASSERT (moo, (moo_oop_t)moo->processor->active != moo->_nil); - /* store the stack pointer to the active process */ + /* commit the stack pointer to the active process + * to limit scanning of the process stack properly */ moo->processor->active->sp = MOO_SMOOI_TO_OOP(moo->sp); + #if 0 /* ip doesn't need to be committed */ /* store the instruction pointer to the active context */ moo->active_context->ip = MOO_SMOOI_TO_OOP(moo->ip); + #endif } MOO_LOG4 (moo, MOO_LOG_GC | MOO_LOG_INFO,