diff options
author | Ayke van Laethem <[email protected]> | 2022-12-15 21:24:17 +0100 |
---|---|---|
committer | Ayke <[email protected]> | 2023-01-17 19:32:18 +0100 |
commit | 655075e5e0e09ae3d9a3247d04343c020d87162e (patch) | |
tree | 25f8f2677484aa38e9be0fe0cb6c9ed2385f84d5 /interp | |
parent | f9d0ff3becbe6835d32a146895d797d53a09fc15 (diff) | |
download | tinygo-655075e5e0e09ae3d9a3247d04343c020d87162e.tar.gz tinygo-655075e5e0e09ae3d9a3247d04343c020d87162e.zip |
runtime: implement precise GC
This implements the block-based GC as a partially precise GC. This means
that for most heap allocations it is known which words contain a pointer
and which don't. This should in theory make the GC faster (because it
can skip non-pointer object) and have fewer false positives in a GC
cycle. It does however use a bit more RAM to store the layout of each
object.
Right now this GC seems to be slower than the conservative GC, but
should be less likely to run out of memory as a result of false
positives.
Diffstat (limited to 'interp')
-rw-r--r-- | interp/memory.go | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/interp/memory.go b/interp/memory.go index 88b7783e4..1f9ed99f3 100644 --- a/interp/memory.go +++ b/interp/memory.go @@ -1236,6 +1236,8 @@ func (r *runner) getValue(llvmValue llvm.Value) value { // readObjectLayout reads the object layout as it is stored by the compiler. It // returns the size in the number of words and the bitmap. +// +// For details on this format, see src/runtime/gc_precise.go. func (r *runner) readObjectLayout(layoutValue value) (uint64, *big.Int) { pointerSize := layoutValue.len(r) if checks && uint64(pointerSize) != r.targetData.TypeAllocSize(r.i8ptrType) { |