cleanup of gchdr'ed objects in moo_fini()
This commit is contained in:
parent
2ce8c35e0f
commit
023d147e14
@ -205,6 +205,9 @@ static MOO_INLINE void vm_cleanup (moo_t* moo)
|
|||||||
*/
|
*/
|
||||||
moo_deregallfinalizables (moo);
|
moo_deregallfinalizables (moo);
|
||||||
|
|
||||||
|
/* final garbage collection */
|
||||||
|
moo_gc (moo);
|
||||||
|
|
||||||
MOO_DEBUG0 (moo, "VM cleaned up\n");
|
MOO_DEBUG0 (moo, "VM cleaned up\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -688,8 +691,7 @@ static void terminate_process (moo_t* moo, moo_oop_process_t proc)
|
|||||||
proc->sp = MOO_SMOOI_TO_OOP(-1); /* invalidate the process stack */
|
proc->sp = MOO_SMOOI_TO_OOP(-1); /* invalidate the process stack */
|
||||||
MOO_STORE_OOP (moo, (moo_oop_t*)&proc->current_context, (moo_oop_t)proc->initial_context); /* not needed but just in case */
|
MOO_STORE_OOP (moo, (moo_oop_t*)&proc->current_context, (moo_oop_t)proc->initial_context); /* not needed but just in case */
|
||||||
|
|
||||||
/* a runnable or running process must not be chanined to the
|
/* a runnable or running process must not be chanined to the process list of a semaphore */
|
||||||
* process list of a semaphore */
|
|
||||||
MOO_ASSERT (moo, (moo_oop_t)proc->sem == moo->_nil);
|
MOO_ASSERT (moo, (moo_oop_t)proc->sem == moo->_nil);
|
||||||
|
|
||||||
if (nrp == proc)
|
if (nrp == proc)
|
||||||
@ -5146,6 +5148,7 @@ static MOO_INLINE int switch_process_if_needed (moo_t* moo)
|
|||||||
"%zd suspended process(es) found - check your program\n",
|
"%zd suspended process(es) found - check your program\n",
|
||||||
MOO_OOP_TO_SMOOI(moo->processor->suspended.count));
|
MOO_OOP_TO_SMOOI(moo->processor->suspended.count));
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,8 +250,24 @@ void moo_fini (moo_t* moo)
|
|||||||
* the heap may not exist */
|
* the heap may not exist */
|
||||||
if (moo->heap) moo_killheap (moo, moo->heap);
|
if (moo->heap) moo_killheap (moo, moo->heap);
|
||||||
|
|
||||||
|
#if defined(MOO_ENABLE_GC_MARK_SWEEP)
|
||||||
|
if (moo->gch)
|
||||||
|
{
|
||||||
|
moo_gchdr_t* next;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
next = moo->gch->next;
|
||||||
|
moo_freemem (moo, moo->gch);
|
||||||
|
moo->gch = next;
|
||||||
|
}
|
||||||
|
while (moo->gch);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
moo_finidbgi (moo);
|
moo_finidbgi (moo);
|
||||||
|
|
||||||
|
|
||||||
for (i = 0; i < MOO_COUNTOF(moo->sbuf); i++)
|
for (i = 0; i < MOO_COUNTOF(moo->sbuf); i++)
|
||||||
{
|
{
|
||||||
if (moo->sbuf[i].ptr)
|
if (moo->sbuf[i].ptr)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user