Debugged mark()

Co-authored-by: ValterMiari <ValterMiari@users.noreply.github.com>
This commit is contained in:
Victor Olin 2023-02-17 12:14:11 +01:00
parent fb5f283dfd
commit b79a83c32a
5 changed files with 66 additions and 33 deletions

View file

@ -6,16 +6,13 @@ Goal for next week (17/2):
- Functioning garbage collector
- Test it with valgrind
TODO:
## GC TODO:
- Merge to main branch
## Algorithm
Potential algorithms:
- mark & sweep
- Don't empty m_free_chunks, reuse in a better way **Victor fixes this**
## Tests TODO
### Library linking
**Victor fixes this**
Compile the GC lib and a test separately, link them together
and evalutate the following:
@ -24,3 +21,17 @@ and evalutate the following:
__builtin_return_address(0)
__builtin_return_address(1)
### GC Init and __b_f_a
1. Save the first stack fram globally as the stack start
2. For each call to collect, save the prev stack frame as the stack end
3. Scan through the span
gc_init()
global stack_end = __builtin_frame_address(1)
collect()
global stack_start = __builtin_frame_address(1)
sweep()
for all addr in range(stack_end, stack_start)
mark if chunk