const builtin = @import("builtin"); const std = @import("std"); const Alloc = std.mem.Allocator; const value = @import("value.zig"); pub const PairPool = @import("gc/PairPool.zig"); pub const IstrSet = @import("gc/IstrSet.zig"); var main_alloc: Alloc = undefined; var main_pair_pool: PairPool = undefined; var main_istr_set: IstrSet = undefined; var init_done = false; pub fn init() !void { if (init_done) return; defer init_done = true; const alloc = std.heap.smp_allocator; initCustom( alloc, try PairPool.init(alloc), try IstrSet.init(alloc), ); } pub fn initCustom( alloc: Alloc, pair_pool: PairPool, istr_set: IstrSet, ) void { main_alloc = alloc; main_pair_pool = pair_pool; main_istr_set = istr_set; } pub fn mainPairPool() *PairPool { init() catch @panic("OOM"); // TODO this is only here for the test suite return &main_pair_pool; } pub fn mainIstrSet() *IstrSet { init() catch @panic("OOM"); // TODO this is only here for the test suite return &main_istr_set; }