GC: remove return value from collect()

This commit is contained in:
Andrew Scott 2024-08-20 13:16:27 -04:00
parent 9a54a80ccb
commit 302a0c986b
Signed by: a
GPG key ID: 7CD5A5977E4931C1
2 changed files with 5 additions and 6 deletions

9
gc.c
View file

@ -4,7 +4,8 @@
#include "vm.h"
void mark(struct garbageObject *obj) {
if (obj->mark) return;
if (obj->mark)
return;
++obj->mark;
@ -36,10 +37,8 @@ void sweep(struct virtualMachine *vm) {
}
}
int collect(struct virtualMachine *vm) {
int count = vm->refCount;
void collect(struct virtualMachine *vm) {
markAll(vm);
sweep(vm);
vm->refMax = vm->refCount * 2;
return count - vm->refCount;
vm->refMax = vm->refCount * 2 <= STACK_MAX ? vm->refCount * 2 : STACK_MAX;
}

2
gc.h
View file

@ -13,6 +13,6 @@ void markAll(struct virtualMachine *vm);
void sweep(struct virtualMachine *vm);
// Marks and Sweeps all references
int collect(struct virtualMachine *vm);
void collect(struct virtualMachine *vm);
#endif /* GC_H */