bug: --target windows: stack-map rewriter refuses COFF alias symbol records (`.def`/`.scl`/`.endef`) after .llvm_stackmaps for $pshape method aliases
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 82/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- rust, typescript
Línea de trabajo
Empieza en crates/perry-codegen/src/gc_map.rs y lee is_zero_width_directive, que el issue identifica como el lugar donde se deben manejar los registros de símbolos COFF. Comprueba el manejo actual de las directivas y las pruebas del reescritor de stack maps; luego reproduce el problema con el ejemplo de TypeScript proporcionado y el comando de compilación para Windows. Se considera terminado cuando las directivas COFF indicadas ya no provocan el error de análisis y el reescrito de stack maps sigue conservando las raíces GC.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Summary
On --target windows (COFF), a class whose method's $pshape clone has the same body as the ordinary method fails to compile. The error is "unrecognised directive .def inside the stack-map block".
What happens: inprocess/equivalent_shape_bodies.rs replaces the $pshape clone with an external LLVM alias of the method. On COFF, LLVM prints the alias's symbol record after .llvm_stackmaps:
.globl <sym>
.def <sym>;
.scl 2;
.type 32;
.endef
<sym> = <method>
The compact stack-map rewriter in crates/perry-codegen/src/gc_map.rs accepts .type and sym = expr, but not .def / .scl / .endef, so it refuses the module. This is the COFF counterpart of the Mach-O .alt_entry alias case (#12736).
Reproduction
coff_pshape_alias.ts:
// A method whose `$pshape` capability body equals the ordinary body becomes
// an LLVM alias after optimization. On COFF its symbol record
// (`.def`/`.scl`/`.type`/`.endef`) prints after the stack map; the
// Windows-target compile regression assembles this module.
export class Img {
private template = false;
setTemplateImage(option: boolean): void {
this.template = option;
}
isTemplateImage(): boolean {
return this.template;
}
}
const image = new Img();
image.setTemplateImage(true);
console.log(image.isTemplateImage());
perry compile coff_pshape_alias.ts --target windows --no-link -o c.o
perry: this module emits an LLVM stack map that the compact-map rewriter could not parse, so its GC roots would be invisible to the collector (the runtime reads only the compact section). Refusing to emit a binary that would lose roots silently.
reason: line 5440: unrecognised directive `.def` inside the stack-map block (`.def perry_method_coff_pshape_alias_ts__Img__setTemplateImage$pshape;`). [...] Add it to `directive_width` (with its width) or to `is_zero_width_directive`.
No special settings are needed. It fails the same way with the default settings, with PERRY_LL_OPT_LEVEL=0, with PERRY_LLVM_INPROCESS=1, and with both.
Suggested fix
Treat .def, .scl, .endef (and .safeseh) as zero-width in is_zero_width_directive. They only build COFF symbol-table records and emit no section bytes, so they can be carried through verbatim, as .type already is.
Environment
- PerryTS/perry main 86988bec62 (pristine, current head). Linux host build (
cargo build --release -p perry --no-default-features --features dev-cliplus the runtime/stdlib static archives), cross-compiling with--target windows. - Linux x86_64, Ubuntu 24.04.
- Lenguaje dominante
- Rust
- Estrellas
- 4.9k
- Forks
- 166
- Merge medio
- 4 h 54 min
- PR fusionados (30 d)
- 909
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de PerryTS/perry
-
area:compiler effort:S impact:med type:bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
area:runtime-gc effort:S impact:low platform:linux type:bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
PerryTS/perry#14789 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
-
area:compiler effort:S impact:med type:bug
Dificultad 4/5 3-5 días Aptitud para principiantes 56/100
Los mantenedores suelen responder en 1 día
-
area:runtime-gc effort:L impact:med type:perf
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
Los mantenedores suelen responder en 1 día
Todos los issues de PerryTS/perry
Issues similares
-
<input type="number"> misses text-entry leaf sizing in layoutPosiblemente ocupada @GoCoder7 la tomó hoy. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
DioxusLabs/blitz#1675 ·
Los mantenedores suelen responder en 1 día
-
[Bug]: NP 管理器文件编辑器里删除键无效Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
metasequoiaime/msime#11666 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
camunda/orchestration-cluster-api-rust#179 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
Los mantenedores suelen responder en 1 día
-
bug drawings help wanted ui
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
userFRM/egui-charts#3479 ·
Los mantenedores suelen responder en 1 día