`Function::lookup` keys cache entries by `intptr_t(structType)` via `getLookupHash(types)`. After gc sweep, freed Structure addresses can be reused by later allocations — a stale cached `false` then poisons the lookup for the new Structure at the same address, surfacing as a flaky "no matching functions or generics" on legitimate calls. Clear every function/generic cache before gc_guard sweeps.
| 665 | // "no matching functions or generics" on legitimate calls. Clear every |
| 666 | // function/generic cache before gc_guard sweeps. |
| 667 | static void clearAllFunctionLookups() { |
| 668 | Module::foreach([](Module * m) -> bool { |
| 669 | m->functions.foreach([](auto & fn) { fn->lookup.clear(); }); |
| 670 | m->generics.foreach([](auto & fn) { fn->lookup.clear(); }); |
| 671 | return true; |
| 672 | }); |
| 673 | } |
| 674 | |
| 675 | // compileDaScript runs its top-level post-parse steps (deriveAliases/allocateStack/...) |
| 676 | // on a transient gc_guard root; on exit this merges that scratch into the program's |
no test coverage detected