This commit is contained in:
Justin Ethier 2015-11-09 23:04:56 -05:00
parent b24cc73982
commit d3a6418b0b
2 changed files with 29 additions and 22 deletions

47
gc.c
View file

@ -665,27 +665,34 @@ void gc_wait_handshake()
// GC Collection cycle // GC Collection cycle
// TODO: // TODO:
//void gc_collector() void gc_collector()
//{ {
// clear : stage clear-or-marking int tmp;
// TODO: what kind of sync is required here?
//clear
gc_stage = STAGE_CLEAR_OR_MARKING;
// exchange values of markColor and clearColor // exchange values of markColor and clearColor
// weakRefsList:clear() tmp = gc_color_clear;
// Handshake(sync1) gc_color_clear = gc_color_mark;
// mark: Handshake(sync2) gc_color_mark = tmp;
// stage tracing gc_handshake(STATUS_SYNC1);
// postHandshake(async) //mark:
// mark global roots gc_handshake(STATUS_SYNC2)
// waitHandshake gc_stage = STAGE_TRACING;
// trace : CollectorTrace() gc_post_handshake(STATUS_ASYNC);
// stage refProcessing TODO: mark global roots
// processRefs() gc_wait_handshake();
// stage sweeping //trace :
// sweep : For each object x in the heap: CollectorTrace()
// if (color(x) = clearColor) gc_stage = STAGE_SWEEPING;
// free free [ x //sweep :
// color(x) blue For each object x in the heap:
// stage resting if (color(x) = clearColor)
//} free free [ x
color(x) blue
gc_stage = STAGE_RESTING;
}
///////////////////////////////////////////// /////////////////////////////////////////////
// END tri-color marking section // END tri-color marking section

View file

@ -108,7 +108,7 @@ typedef enum { STATUS_ASYNC
typedef enum { STAGE_CLEAR_OR_MARKING typedef enum { STAGE_CLEAR_OR_MARKING
, STAGE_TRACING , STAGE_TRACING
, STAGE_REF_PROCESSING //, STAGE_REF_PROCESSING
, STAGE_SWEEPING , STAGE_SWEEPING
, STAGE_RESTING , STAGE_RESTING
} gc_stage_type; } gc_stage_type;