marked objects in GC

This commit is contained in:
CPunch 2020-11-04 21:37:34 -06:00
parent 185380b2c0
commit 64c6914748

View File

@ -80,10 +80,14 @@ void markArray(CState *state, CValueArray *array) {
void blackenObject(CState *state, CObj *obj) { void blackenObject(CState *state, CObj *obj) {
switch (obj->type) { switch (obj->type) {
case COBJ_STRING: case COBJ_STRING:
case COBJ_OBJECT: // TODO: when metatables are added, make sure they're marked
case COBJ_CFUNCTION: case COBJ_CFUNCTION:
// stubbed // stubbed
break; break;
case COBJ_OBJECT: {
// mark everything this object is keeping track of
markTable(state, &((CObjObject*)obj)->tbl);
break;
}
case COBJ_UPVALUE: { case COBJ_UPVALUE: {
markValue(state, ((CObjUpval*)obj)->closed); markValue(state, ((CObjUpval*)obj)->closed);
break; break;