avr: use precise GC by default

AVR is especially sensitive to false positives in the GC for a few
reasons:

  * Pointer values are only two bytes, instead of four on most other
    microcontrollers.
  * Pointers are not aligned, so any two-byte value in an object coud be
    a pointer.
  * Memory typically starts at a low address, which makes it much more
    likely to clash with a regular integer value (which tend to be small
    values).

Therefore, use the precise GC (instead of the conservative GC) by
default. This increases binary size by around 350 bytes, but I think
it's a good tradeoff in most cases: it avoids some runtime errors and
generally RAM tends to be a lot more scarce than flash on AVR chips. If
this is too much, `-gc=conservative` or `-gc=leaking` can be used
instead.
This commit is contained in:
Ayke van Laethem
2023-01-28 18:04:57 +01:00
parent 5baee9a8ee
commit eca9120e21
2 changed files with 1 additions and 5 deletions
-4
View File
@@ -210,10 +210,6 @@ func runPlatTests(options compileopts.Options, tests []string, t *testing.T) {
// limited amount of memory.
continue
case "gc.go":
// Does not pass due to high mark false positive rate.
continue
case "json.go", "stdlib.go", "testing.go":
// Too big for AVR. Doesn't fit in flash/RAM.
continue
+1 -1
View File
@@ -3,7 +3,7 @@
"build-tags": ["avr", "baremetal", "linux", "arm"],
"goos": "linux",
"goarch": "arm",
"gc": "conservative",
"gc": "precise",
"linker": "ld.lld",
"scheduler": "none",
"rtlib": "compiler-rt",