debugging gc

This commit is contained in:
hyunghwan.chung 2020-10-19 10:10:40 +00:00
parent 29c919626f
commit a01c9fc3f1
3 changed files with 10 additions and 9 deletions

View File

@ -1834,6 +1834,7 @@ moo_oop_method_t moo_findmethod_noseterr (moo_t* moo, moo_oop_t receiver, moo_oo
message.ptr = MOO_OBJ_GET_CHAR_SLOT(selector); message.ptr = MOO_OBJ_GET_CHAR_SLOT(selector);
message.len = MOO_OBJ_GET_SIZE(selector); message.len = MOO_OBJ_GET_SIZE(selector);
//MOO_DEBUG4 (moo, "XXXXXXXXXxx %p %p %O %O\n", receiver, selector, receiver, selector);
_class = MOO_CLASSOF(moo, receiver); _class = MOO_CLASSOF(moo, receiver);
if (_class == moo->_class) if (_class == moo->_class)
{ {

View File

@ -852,9 +852,7 @@ static MOO_INLINE void gc_mark_root (moo_t* moo)
for (i = 0; i < MOO_COUNTOF(kernel_classes); i++) for (i = 0; i < MOO_COUNTOF(kernel_classes); i++)
{ {
moo_oop_t tmp; gc_mark (moo, *(moo_oop_t*)((moo_uint8_t*)moo + kernel_classes[i].offset));
tmp = *(moo_oop_t*)((moo_uint8_t*)moo + kernel_classes[i].offset);
gc_mark (moo, tmp);
} }
gc_mark (moo, (moo_oop_t)moo->sysdic); gc_mark (moo, (moo_oop_t)moo->sysdic);
@ -907,7 +905,7 @@ static MOO_INLINE void gc_mark_root (moo_t* moo)
if (cb->gc) cb->gc (moo); if (cb->gc) cb->gc (moo);
} }
gcfin_count = move_finalizable_objects (moo); /* mark finalizable objects */ gcfin_count = move_finalizable_objects(moo); /* mark finalizable objects */
if (moo->symtab) if (moo->symtab)
{ {
@ -951,6 +949,8 @@ static MOO_INLINE void gc_sweep (moo_t* moo)
/* destroy */ /* destroy */
if (prev) prev->next = next; if (prev) prev->next = next;
else moo->gch = next; else moo->gch = next;
if (!moo->igniting)
MOO_DEBUG2(moo, "** DESTROYING curr %p %O\n", curr, obj);
moo_freemem (moo, curr); moo_freemem (moo, curr);
} }
@ -1447,7 +1447,7 @@ static moo_oow_t move_finalizable_objects (moo_t* moo)
} }
else else
{ {
x->oop = moo_moveoop (moo, x->oop); x->oop = moo_moveoop(moo, x->oop);
} }
x = y; x = y;

View File

@ -34,7 +34,7 @@
/* TODO: move this macro out to the build files.... */ /* TODO: move this macro out to the build files.... */
#define MOO_INCLUDE_COMPILER #define MOO_INCLUDE_COMPILER
/*#define MOO_ENABLE_GC_MARK_SWEEP*/ //#define MOO_ENABLE_GC_MARK_SWEEP
typedef struct moo_mod_t moo_mod_t; typedef struct moo_mod_t moo_mod_t;
@ -1710,15 +1710,15 @@ struct moo_t
moo_oop_semaphore_t sem_gcfin; moo_oop_semaphore_t sem_gcfin;
int sem_gcfin_sigreq; int sem_gcfin_sigreq;
moo_oop_t* volat_stack[256]; /* stack for temporaries */
moo_oow_t volat_count;
moo_oop_t* proc_map; moo_oop_t* proc_map;
moo_oow_t proc_map_capa; moo_oow_t proc_map_capa;
moo_oow_t proc_map_used; moo_oow_t proc_map_used;
moo_ooi_t proc_map_free_first; moo_ooi_t proc_map_free_first;
moo_ooi_t proc_map_free_last; moo_ooi_t proc_map_free_last;
moo_oop_t* volat_stack[256]; /* stack for temporaries */
moo_oow_t volat_count;
/* ============================================================= /* =============================================================
* EXECUTION REGISTERS * EXECUTION REGISTERS
* ============================================================= */ * ============================================================= */