runtime: use precise layouts with Boehm GC - #5686
jakebailey wants to merge 2 commits into
Conversation
|
Thanks for working on this @jakebailey! Here are some notes, edited from an automated review. I built both branches locally and measured on linux/amd64 and wasip1.
The binary size increase is pretty large IMO... |
|
I'm measuring a different size increase than you, 4.8% on linux/amd64, 6.5% on wasip1, but I'll look into the rest... |
|
I also do not see 9% perf hit, either. |
9e3dfbd to
10affef
Compare
|
Ah, the measurement difference is because dev already got a little larger with the stack unwinding changes. |
10affef to
59cf513
Compare
I don't think it can; the Go cache would need to allocate, which would be a cycle, as it is itself part of the alloc. |
Use Boehm explicitly typed allocations for pointer-containing Go objects. Cache one descriptor per TinyGo element layout and use typed calloc so array and slice backing stores repeat that descriptor without allocation-sized descriptor growth. Keep pointer-free and raw stack allocations on the existing atomic and conservative paths. Compile the Boehm bridge only for Boehm builds and use the public BDWGC headers for its declarations. Build typed allocation and finalization support because complex typed array descriptors use disappearing links internally. Bump the Boehm cache version for the changed source and flag set. Add regressions showing that integer fields in inline, external, and repeated layouts do not retain heap objects.
Canonicalize all-pointer layouts so Boehm can use conservative allocation when it is exact. Bypass trivial allocation wrappers and skip typed-array setup for scalar objects.
59cf513 to
fbc65de
Compare
| ], | ||
| "extra-files": [ | ||
| "src/runtime/asm_tinygowasm.S", | ||
| "src/runtime/gc_boehm.c" |
There was a problem hiding this comment.
Not sure I understand why these were placed here unconditionally
|
Thanks for the corrections @jakebailey, you were right on two of my points. I rebuilt both sides from the merge base
Item 7 is probably the only one that might require some action. Otherwise, since Boehm is not the default for any target, the ~9 KB fixed code growth is an opt-in cost paid only by users who ask for it. |
Providing exact GC shapes to Boehm should make it faster.