swissChili | 6d6525e | 2021-06-15 21:20:53 -0700 | [diff] [blame] | 1 | #pragma once |
| 2 | |
swissChili | 9e57da4 | 2021-06-15 22:22:46 -0700 | [diff] [blame] | 3 | #include "lisp.h" |
| 4 | |
| 5 | // I hate this |
| 6 | extern value_t *gc_base; |
| 7 | |
swissChili | a890aed | 2022-07-30 17:13:07 -0700 | [diff] [blame] | 8 | struct gc_stats |
| 9 | { |
| 10 | // bytes currently used |
| 11 | unsigned long bytes_used; |
| 12 | // bytes ever freed by the GC |
| 13 | unsigned long bytes_freed; |
| 14 | // how many total allocations are currently alive |
| 15 | unsigned long total_allocs; |
| 16 | // how many times has the GC ever been run |
| 17 | unsigned long gc_runs; |
| 18 | }; |
| 19 | |
swissChili | 9e57da4 | 2021-06-15 22:22:46 -0700 | [diff] [blame] | 20 | void gc_set_base_here(); |
| 21 | |
swissChili | e9fec8b | 2021-06-22 13:59:33 -0700 | [diff] [blame] | 22 | value_t alloc_to_value(struct alloc *a); |
swissChili | 6d6525e | 2021-06-15 21:20:53 -0700 | [diff] [blame] | 23 | void _do_gc(unsigned int esp, unsigned int ebp); |
swissChili | e9fec8b | 2021-06-22 13:59:33 -0700 | [diff] [blame] | 24 | void _mark(value_t value, unsigned int *marked); |
swissChili | 6d6525e | 2021-06-15 21:20:53 -0700 | [diff] [blame] | 25 | void _sweep(); |
swissChili | b8fd471 | 2021-06-23 15:32:04 -0700 | [diff] [blame] | 26 | void free_all(); |
swissChili | a890aed | 2022-07-30 17:13:07 -0700 | [diff] [blame] | 27 | struct gc_stats gc_get_stats(); |