mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-30 07:14:39 +08:00
The LLVM emitter's constructor walks the whole module about 33 times. Several walks repeat work another already did, or run where the result is provably empty: - computePublishedTypes and computeCycleMutability run once and are shared (may-throw, immutable fields and traced shapes took their own). - The WebCrypto-asymmetric and Ed25519 runtime-feature conditions join the feature scan's one walk instead of walking the module again. - int32 slots: the fixpoint skips the write walk of a function without a candidate write, dynamicFieldStores stops once every field name is dynamic, and dynamicallyStoredFamilies returns early when no f64 field can be named by a dynamic store. - stableGlobals stops once no candidate is left, the second pass of findAppendedArrayLiterals and the target resolution of findConstantCallbacks run only when there is something to find, boxedUnionIds needs unions, and observesStacks walks for call sites and the "stack" literal only when a dynamic key asks. - everyModuleNode visits type trees without a closure per node. The emitted LLVM IR is unchanged.