Part of #1
Extract Crystal's GC calls behind an abstract interface so different GC backends can be swapped at compile time.
Scope
- Define
CrystalGC module interface: alloc, alloc_atomic, collect, stats, enumerate_objects, register_stack, unregister_stack
- Implement
CrystalGC::Boehm wrapping current LibGC calls
- Replace direct
LibGC calls in src/gc/boehm.cr with interface calls
- Zero behavior change — all existing tests must pass
Key Files
src/gc/boehm.cr — current GC integration
- New:
src/gc/interface.cr — abstract interface
Upstreamable
Yes — this is a non-breaking refactor. Can be proposed to crystal-lang/crystal as-is.
Part of #1
Extract Crystal's GC calls behind an abstract interface so different GC backends can be swapped at compile time.
Scope
CrystalGCmodule interface:alloc,alloc_atomic,collect,stats,enumerate_objects,register_stack,unregister_stackCrystalGC::Boehmwrapping currentLibGCcallsLibGCcalls insrc/gc/boehm.crwith interface callsKey Files
src/gc/boehm.cr— current GC integrationsrc/gc/interface.cr— abstract interfaceUpstreamable
Yes — this is a non-breaking refactor. Can be proposed to crystal-lang/crystal as-is.