mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-14 08:17:35 +02:00
WIP
This commit is contained in:
parent
b24cc73982
commit
d3a6418b0b
2 changed files with 29 additions and 22 deletions
49
gc.c
49
gc.c
|
@ -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;
|
||||||
// exchange values of markColor and clearColor
|
// TODO: what kind of sync is required here?
|
||||||
// weakRefsList:clear()
|
|
||||||
// Handshake(sync1)
|
//clear
|
||||||
// mark: Handshake(sync2)
|
gc_stage = STAGE_CLEAR_OR_MARKING;
|
||||||
// stage tracing
|
// exchange values of markColor and clearColor
|
||||||
// postHandshake(async)
|
tmp = gc_color_clear;
|
||||||
// mark global roots
|
gc_color_clear = gc_color_mark;
|
||||||
// waitHandshake
|
gc_color_mark = tmp;
|
||||||
// trace : CollectorTrace()
|
gc_handshake(STATUS_SYNC1);
|
||||||
// stage refProcessing
|
//mark:
|
||||||
// processRefs()
|
gc_handshake(STATUS_SYNC2)
|
||||||
// stage sweeping
|
gc_stage = STAGE_TRACING;
|
||||||
// sweep : For each object x in the heap:
|
gc_post_handshake(STATUS_ASYNC);
|
||||||
// if (color(x) = clearColor)
|
TODO: mark global roots
|
||||||
// free free [ x
|
gc_wait_handshake();
|
||||||
// color(x) blue
|
//trace :
|
||||||
// stage resting
|
CollectorTrace()
|
||||||
//}
|
gc_stage = STAGE_SWEEPING;
|
||||||
|
//sweep :
|
||||||
|
For each object x in the heap:
|
||||||
|
if (color(x) = clearColor)
|
||||||
|
free free [ x
|
||||||
|
color(x) blue
|
||||||
|
gc_stage = STAGE_RESTING;
|
||||||
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////
|
/////////////////////////////////////////////
|
||||||
// END tri-color marking section
|
// END tri-color marking section
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Add table
Reference in a new issue