runtime (gc_blocks.go): simplify scanning logic

Loop over valid pointer locations in heap objects instead of checking if each location is valid.
The conservative scanning code is now shared between markRoots and the heap scan.

This also removes the ending alignment requirement from markRoots, since the new scan* functions do not require an aligned length.
This requirement was occasionally violated by the linux global marking code.

This saves some code space and has negligible impact on performance.
This commit is contained in:
Nia Waldvogel
2025-11-30 12:21:55 -05:00
committed by Ron Evans
parent c9aa88b8ef
commit 26ac03a3f6
4 changed files with 104 additions and 152 deletions
+3 -3
View File
@@ -42,9 +42,9 @@ func TestBinarySize(t *testing.T) {
// This is a small number of very diverse targets that we want to test.
tests := []sizeTest{
// microcontrollers
{"hifive1b", "examples/echo", 3756, 280, 0, 2268},
{"microbit", "examples/serial", 2756, 340, 8, 2272},
{"wioterminal", "examples/pininterrupt", 7297, 1491, 116, 6912},
{"hifive1b", "examples/echo", 3568, 280, 0, 2268},
{"microbit", "examples/serial", 2630, 342, 8, 2272},
{"wioterminal", "examples/pininterrupt", 7175, 1493, 116, 6912},
// TODO: also check wasm. Right now this is difficult, because
// wasm binaries are run through wasm-opt and therefore the