minor refactoring

This commit is contained in:
2020-12-07 14:35:14 -06:00
parent d00b803e6f
commit aff011a8d1
3 changed files with 16 additions and 21 deletions

View File

@@ -22,13 +22,17 @@ typedef enum IStringEnum {
ISTRING_MAX
} IStringEnum;
typedef struct ArrayCObj {
CObj **array;
int count;
int capacity;
} ArrayCObj;
typedef struct CState {
bool panic;
int freezeGC; // when > 0, GC events will be ignored (for internal use)
CObj *objects; // tracks all of our allocated objects
CObj **grayStack; // keeps track of which objects *haven't yet* been traversed in our GC, but *have been* found
int grayCount;
int grayCapacity;
ArrayCObj grayStack; // keeps track of which objects *haven't yet* been traversed in our GC, but *have been* found
size_t allocatedBytes;
size_t nextGC; // when allocatedBytes reaches this threshhold, trigger a GC event