bug: parallel callable lowering panics "alias metadata operand: ParseIntError { kind: Empty }" on inline !alias.scope !{...} from indexed owner loops

Aperta
#14,980 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
56/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
rust, typescript
Ambito
backend, compilers

Direzione di ricerca

Start by reading crates/perry-codegen/src/codegen/callable_reloc.rs around line 149 and the metadata emission in stmt/indexed_owner_loop.rs around line 830. Reproduce with the provided owner_scope_workers.ts and perry compile owner_scope_workers.ts --no-link -o a.o; compare with the single-worker settings. Done when parallel compilation handles the inline alias metadata without panicking and the reproduction compiles.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

area:compiler effort:S impact:med type:bug

Summary

perry compile panics in crates/perry-codegen/src/codegen/callable_reloc.rs:149 with alias metadata operand: ParseIntError { kind: Empty }. It happens when a module has an indexed owner loop (a typed-array read-modify-write through local aliases) and enough functions that callable lowering runs in parallel.

Cause (from the code at 86988bec62): the parallel callable relocation (callable_reloc.rs) renumbers metadata after "!alias.scope !" / "!noalias !" and expects a numbered operand (!alias.scope !12). But stmt/indexed_owner_loop.rs:830 emits inline metadata nodes: , !alias.scope !{...}, !noalias !{...}. So the digit scan finds an empty string, and .parse().expect("alias metadata operand") panics. Expected: skip (or recurse into) inline !{...} operands, or have the owner loop emit numbered metadata.

Reproduction

owner_scope_workers.ts (80 one-line closures to make the module big enough for parallel lowering, plus the loop):

const pad0 = (x: any) => [x, 'p0'];
const pad1 = (x: any) => [x, 'p1'];
// ... pad2 .. pad78, the same shape ...
const pad79 = (x: any) => [x, 'p79'];
const operate = (a: Float64Array, scale: any, b: Float64Array) => { for (let i = 0; i < 4; i++) { const x = a; const j = i; x[j] = x[j] + b[i]; } return a[0]; };
console.log(operate(new Float64Array(4), 1, new Float64Array(4)), pad0(1));

Generate it with: (for i in $(seq 0 79); do echo "const pad$i = (x: any) => [x, 'p$i'];"; done; echo '<the operate and console.log lines above>') > owner_scope_workers.ts

perry compile owner_scope_workers.ts --no-link -o a.o
Error: perry crashed unexpectedly.
thread 'perry-module-0' panicked at crates/perry-codegen/src/codegen/callable_reloc.rs:149:59:
alias metadata operand: ParseIntError { kind: Empty }

With PERRY_CODEGEN_UNIT_JOBS=1 PERRY_MODULE_JOBS=1 the same file compiles and runs: it prints 0 [ 1, 'p0' ], as Node does.

Environment

  • PerryTS/perry main 86988bec62 (pristine, current head), and 08c74942f1. Linux host build (cargo build --release -p perry --no-default-features --features dev-cli plus the runtime/stdlib static archives); default compile settings.
  • Linux x86_64, 32 threads, Ubuntu 24.04.
Lingua principale
Rust
Stelle
4.9k
Fork
166
Merge medio
4h 54m
PR unite (30g)
909

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di PerryTS/perry

Tutte le issue di PerryTS/perry

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.