mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-12 23:37:38 +02:00
Testing in isolation without gc_sweep enabled
This commit is contained in:
parent
ec6140b3a4
commit
91e018c78b
1 changed files with 14 additions and 1 deletions
15
gc.c
15
gc.c
|
@ -692,10 +692,23 @@ PHASE 2 - multi-threaded mutator (IE, more than one stack thread):
|
||||||
// we need to ensure any heap objects affected are traced
|
// we need to ensure any heap objects affected are traced
|
||||||
void gc_stack_mark_gray(gc_thread_data *thd, object obj)
|
void gc_stack_mark_gray(gc_thread_data *thd, object obj)
|
||||||
{
|
{
|
||||||
|
char tmp;
|
||||||
|
object low_limit = &tmp;
|
||||||
|
object high_limit = ((gc_thread_data *)thd)->stack_start;
|
||||||
int color;
|
int color;
|
||||||
|
|
||||||
if (is_object_type(obj)) {
|
if (is_object_type(obj)) {
|
||||||
color = mark(obj);
|
color = mark(obj);
|
||||||
|
// TODO: no need to run this all the time. enclose in an "ifdef DEBUG" once
|
||||||
|
// the GC is stabilized
|
||||||
|
if (check_overflow(low_limit, obj) &&
|
||||||
|
check_overflow(obj, high_limit) &&
|
||||||
|
color != gc_color_red){
|
||||||
|
printf("stack object has wrong color %d!\n", color);
|
||||||
|
Cyc_display(obj, stdout);
|
||||||
|
printf("\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
if (color == gc_color_clear) {
|
if (color == gc_color_clear) {
|
||||||
gc_mark_gray(thd, obj);
|
gc_mark_gray(thd, obj);
|
||||||
} else if (color == gc_color_red) {
|
} else if (color == gc_color_red) {
|
||||||
|
@ -1074,7 +1087,7 @@ printf("DEBUG - swap clear %d / mark %d\n", gc_color_clear, gc_color_mark);
|
||||||
gc_stage = STAGE_SWEEPING;
|
gc_stage = STAGE_SWEEPING;
|
||||||
//
|
//
|
||||||
//sweep :
|
//sweep :
|
||||||
max_freed = gc_sweep(gc_get_heap(), &freed);
|
//max_freed = gc_sweep(gc_get_heap(), &freed);
|
||||||
// TODO: grow heap if it is mostly full after collection??
|
// TODO: grow heap if it is mostly full after collection??
|
||||||
//#if GC_DEBUG_CONCISE_PRINTFS
|
//#if GC_DEBUG_CONCISE_PRINTFS
|
||||||
printf("sweep done, freed = %d, max_freed = %d, elapsed = %ld\n",
|
printf("sweep done, freed = %d, max_freed = %d, elapsed = %ld\n",
|
||||||
|
|
Loading…
Add table
Reference in a new issue