mirror of
https://codeberg.org/andyscott/marCsweep.git
synced 2024-12-21 09:23:09 -05:00
GC: remove return value from collect()
This commit is contained in:
parent
9a54a80ccb
commit
302a0c986b
2 changed files with 5 additions and 6 deletions
9
gc.c
9
gc.c
|
@ -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
2
gc.h
|
@ -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 */
|
||||
|
|
Loading…
Reference in a new issue