bug: --target windows: stack-map rewriter refuses COFF alias symbol records (`.def`/`.scl`/`.endef`) after .llvm_stackmaps for $pshape method aliases
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 82/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- rust, typescript
Hướng nghiên cứu
Bắt đầu tại crates/perry-codegen/src/gc_map.rs và đọc is_zero_width_directive, nơi issue xác định là chỗ xử lý các bản ghi ký hiệu COFF. Kiểm tra cách xử lý directive hiện có và các bài kiểm tra của trình viết lại stack map, sau đó tái hiện lỗi bằng ví dụ TypeScript được cung cấp và lệnh biên dịch Windows. Công việc được xem là hoàn tất khi các directive COFF được liệt kê không còn gây ra lỗi phân tích cú pháp và việc viết lại stack map vẫn bảo toàn các gốc GC.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Rust
- Star
- 4.9k
- Fork
- 166
- Merge trung bình
- 4 giờ 54 phút
- Pull request đã merge (30 ngày)
- 909
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của PerryTS/perry
-
area:compiler effort:S impact:med type:bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
area:runtime-gc effort:S impact:low platform:linux type:bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
PerryTS/perry#14789 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày
-
area:compiler effort:S impact:med type:bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 56/100
Maintainer thường phản hồi trong vòng 1 ngày
-
area:runtime-gc effort:L impact:med type:perf
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của PerryTS/perry
Issue tương tự
-
<input type="number"> misses text-entry leaf sizing in layoutCó thể đã có người làm @GoCoder7 đã nhận hôm nay. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
DioxusLabs/blitz#1675 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: NP 管理器文件编辑器里删除键无效Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
metasequoiaime/msime#11666 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
camunda/orchestration-cluster-api-rust#179 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug drawings help wanted ui
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
userFRM/egui-charts#3479 ·
Maintainer thường phản hồi trong vòng 1 ngày