mirror of
https://codeberg.org/andyscott/marCsweep.git
synced 2024-09-19 11:28:07 -04: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"
|
#include "vm.h"
|
||||||
|
|
||||||
void mark(struct garbageObject *obj) {
|
void mark(struct garbageObject *obj) {
|
||||||
if (obj->mark) return;
|
if (obj->mark)
|
||||||
|
return;
|
||||||
|
|
||||||
++obj->mark;
|
++obj->mark;
|
||||||
|
|
||||||
|
@ -36,10 +37,8 @@ void sweep(struct virtualMachine *vm) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int collect(struct virtualMachine *vm) {
|
void collect(struct virtualMachine *vm) {
|
||||||
int count = vm->refCount;
|
|
||||||
markAll(vm);
|
markAll(vm);
|
||||||
sweep(vm);
|
sweep(vm);
|
||||||
vm->refMax = vm->refCount * 2;
|
vm->refMax = vm->refCount * 2 <= STACK_MAX ? vm->refCount * 2 : STACK_MAX;
|
||||||
return count - vm->refCount;
|
|
||||||
}
|
}
|
||||||
|
|
2
gc.h
2
gc.h
|
@ -13,6 +13,6 @@ void markAll(struct virtualMachine *vm);
|
||||||
void sweep(struct virtualMachine *vm);
|
void sweep(struct virtualMachine *vm);
|
||||||
|
|
||||||
// Marks and Sweeps all references
|
// Marks and Sweeps all references
|
||||||
int collect(struct virtualMachine *vm);
|
void collect(struct virtualMachine *vm);
|
||||||
|
|
||||||
#endif /* GC_H */
|
#endif /* GC_H */
|
||||||
|
|
Loading…
Reference in a new issue