Large LLVM metadata tables crash compilation with a stack overflow
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 22/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Ferma
- Stack tecnologico
- typescript
- Ambito
- compilers
Direzione di ricerca
Start with out.push(...emitter.fieldAliasMetadata()) in emitModuleParts in packages/compiler/src/backend/llvm/emit-module.ts, in both the executable and library branches. Run the repro script from the issue, which calls LlEmitter.emitParts with 100,000 field aliases. Done means both branches append each line in order without spreading arguments, and the repro no longer throws. Pull request #2401 already proposes this fix, so check its state before starting.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
We are experimenting with compiling a complete Node.js CLI and its existing dependencies with scriptc, keeping its logging, terminal UI and persistence. While investigating large builds, we found that assembling a sufficiently large LLVM metadata table crashes the compiler.
The metadata fits in memory. The crash happens because the compiler passes every metadata line as a separate argument to one JavaScript push call. The reduced stress test below demonstrates this without needing the full CLI.
Reproduction
After building the compiler workspace, save this as repro.mjs in the repository root:
import { LlEmitter } from "./packages/compiler/dist/backend/llvm/emitter.js";
import { VOID } from "./packages/compiler/dist/ir/ir.js";
const loc = { file: "large-metadata.ts", start: 0, end: 0 };
const mod = {
irVersion: 17,
sourceFile: loc.file,
entry: "main",
functions: [{ name: "main", params: [], returnType: VOID,
locals: [], body: [], loc }],
};
const emitter = new LlEmitter(mod, {});
for (let i = 0; i < 100_000; i++) {
emitter.fieldAliasTags.set(`field.${i}`, 2 + i * 2);
}
console.log(emitter.fieldAliasMetadata().length); // 200001
emitter.emitParts();
$ node repro.mjs
200001
RangeError: Maximum call stack size exceeded
The stack points to emitModuleParts in packages/compiler/src/backend/llvm/emit-module.ts, at out.push(...emitter.fieldAliasMetadata()). The executable and library branches both contain this append. Separate regressions reproduce the same failure in each branch. A ten-tag control succeeds; the large RC-tail append now also succeeds because that neighboring path already iterates over its lines.
Expected behavior
Emitting a metadata table should not depend on the JavaScript engine's function-argument limit. Preserve every line and its order, for both executable and library modules, without changing ordinary emitted LLVM.
Scope
The existing iterative append pattern is sufficient for these two sites. No runtime ABI, metadata format, type inference or code-generation policy needs to change.
This is distinct from #1796 and #1575, which concern appending WASM FunctionTranslator body lines. This reproduction contains no WASM module and fails in LLVM module assembly instead.
Proposed fix and regression tests: #2401.
Tested environment
Reproduced with a source build from scriptc’s main development branch on macOS arm64, using Node 24.22.0 and matching native compiler/runtime packages. The source build reports version 0.4.5. The original gap was also checked against later main changes before opening the linked PR.
- Lingua principale
- TypeScript
- Stelle
- 6.4k
- Fork
- 201
- Merge medio
- 6h 24m
- PR unite (30g)
- 913
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di vercel-labs/scriptc
-
fs.readSync rejects valid large BigInt file offsetsForse già presa @MathurAditya724 l’ha presa 2 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 20/100
vercel-labs/scriptc#2404 ·
I maintainer di solito rispondono entro 1 giorno
-
for-in rejects records that may be null or undefinedForse già presa @MathurAditya724 l’ha presa 2 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
vercel-labs/scriptc#2403 ·
I maintainer di solito rispondono entro 1 giorno
-
SC2003 'string | undefined' when a method returning an element of its array field is used inlineAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 30/100
vercel-labs/scriptc#2400 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 30/100
vercel-labs/scriptc#2399 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
vercel-labs/scriptc#2209 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di vercel-labs/scriptc
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
lichess-org/lila#22324 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[Feature Request] [Web] Expose kvCacheQuantizationBits in the onnxruntime-web WebGPU EP optionsApertaep:WebGPU platform:web quantization
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
microsoft/onnxruntime#33752 ·
I maintainer di solito rispondono entro 2 giorni
-
[Skill Bug]: entra-agent-id: inaccurate blueprint permission inheritance and parent token sub claimApertabug entra-agent-id
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
microsoft/GitHub-Copilot-for-Azure#3467 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
fix(worker): keep normal prepare waiting states failure-freeForse già presa @LichKing-2234 l’ha presa oggi. Apertaagent:codex priority:P1
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
AgoraIO-Extensions/agent-infra#3745 ·
I maintainer di solito rispondono entro 1 giorno
-
The five-line work window can drop its oldest line: the per-line byte share ignores the JSON framingForse già presa @Eapp1e l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
makecindy/cindy#7973 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno