Skip to content

fix(migrate): keep SDK macros private and restore native verification - #1107

Merged
ehartford merged 26 commits into
mainfrom
macro-token-paste
Sep 12, 2026
Merged

ehartford merged 26 commits into
mainfrom
macro-token-paste

Conversation

@ehartford

@ehartford ehartford commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Migrated C modules expose project declarations while keeping SDK macros private for expansion. Origin classification covers Windows SDK paths, mixed separators, and materialized Clang builtin headers; project token-paste aliases preserve their C values and callable behavior.

The CI repairs remove the gunzip helper's dependency on an accidentally exported SDK UINT_MAX and normalize project-absolute action paths in both native and interpreted ToolFs. Write and directory permissions remain enforced. The approved SDK test correction checks project-owned aliases, requires SDK declarations to stay private, and preserves every original C runtime assertion.

Gunzip now uses owned buffers and scoped file cleanup. Defer temporaries stay on their exit edge, and bindings acquire cleanup only after initialization completes. The ownership validator rejects never-initialized drops, models parameters/globals/explicit zero initialization correctly, and reports failures from every body. Debugger evidence and regression fixtures accompany the changes.

Direct malformed-MIR tests now import the independent MIR data/validator layer, avoiding full compiler and LLVM linkage. All 16 internals tests pass locally at 392 MiB peak RSS. Large compiler inputs use 16 partitions independently of CPU count, with one emitter on hosts up to 8 GiB; the frozen seed receives this bounded layout only for stage1. Native measurements reduce peak compiler RSS from 13.4 GiB with three partitions to 5.5 GiB with sixteen. Timeouts, optimization levels, assertions, and memory limits remain unchanged.

Local verification passed: full build, byte-identical fixpoint, full tests (995 behavior files and 16 internals tests; 414 MiB peak test-target RSS), test-green/last-green evidence for 67e7560, fresh pinned v0.15.2.0 bootstrap, compiler audit (2,508,491 facts / zero violations), 15 move cases and 115 drop cases with zero regressions.

All five native CI platforms passed on 67e7560: macOS ARM64, Linux x86_64, Linux ARM64, Windows x86_64, and Windows ARM64. The macOS full battery passed at 415 MiB peak test-target RSS; its internals tests completed in 11 seconds.

Fresh seed verification exposed missing cache inputs in the seed-compat target, tracked in #1113. The recorded bootstrap run was forced fresh and its copied source checked against the final tree. Debugger evidence is recorded in docs/defer-temporary-drop-debug.md, docs/initializer-drop-debug.md, docs/global-drop-state-debug.md, docs/mir-core-test-dependencies.md, and docs/codegen-low-memory-debug.md.

Based on main after C4 merged. No seed update or installation.

Fixes #1102.
Fixes #1109.
Fixes #1111.
Fixes #1112.

Eric Hartford added 2 commits September 9, 2026 13:47
Track system-header and preprocessing-driver origins in the bridge's
existing macro flag slot. Filter migration declaration emission, retaining
all captured values for expression expansion and normal c_import access.

Expand private dependencies before parsing project macro bodies, preserve
grouped-expression precedence, and emit callable macro aliases as functions
instead of globals containing unspecialized generic functions.

LLDB proved the original emitter reached ci_migrate_shared_decl_add with
system flag 1; HAVE_UNISTD_H came from the synthetic driver's main file.
It also proved the emitted-name guard rejected a private macro dependency,
the postfix parser returned an empty string for grouped INT32_MIN arithmetic,
and callable macro aliases escaped the C-function-only classification.
Exact branches, registers, and reproduction commands are recorded in
docs/migrate-macro-origin-debug.md.

Regenerate PCRE2 and zlib: implementation files remain byte-identical;
only shared definitions change. Compiler/corpus source checks and the
macro-origin, grouped-macro, and compound-literal behavior tests pass.
Eric Hartford added 3 commits September 9, 2026 18:30
LLDB observed ci_is_system_path return w0=0 for input\Windows Kits/ucrt/system.h to ci_migrate_decl_is_filtered+80 (PC 0x1001889d8). Normalize before the shared classifier and preserve generated include paths. Source check, stage2, and four focused regressions pass.
LLDB observes cimport_location_path_is_system return w0=0 for the embedded __stddef_null.h to macro_location_is_system_from_cursor+120, PC 0x10094cf88. Recognize the configured resource root with a path boundary. Five macro regressions pass; regeneration changes only shared SDK definitions in both corpora.
Eric Hartford added 15 commits September 9, 2026 21:13
LLDB: fs_mkdir_p_c+92 compares byte 0x5c to 47 and branches to +64 without creating the parent (rt_core.w:3467). Windows run 34432173059 fails preparing that mixed path. Preserve POSIX backslash names and restore the original separator. Runtime check, dev build, and native separator regression pass on macOS; Windows CI remains required. Missing runner panic details tracked in #1110.
LLDB: check_ident reached the undefined-variable branch at SemaCheck.w:7168 (return PC 0x1001fa538) for UINT_MAX after SDK export hygiene. The handwritten facade owns this limit; migrated implementation files are unchanged. Existing zlib and gzip behavior assertions pass against the corrected facade. The next build verifies its embedded import.
LLDB observed link_stage_artifact_root returning the inherited parent WITH_OUT_DIR to link_stage_output_dir_for_source at 0x1002f2650. Linux CI 34432540002 linked shared out/src/main.o from different case working directories. The deterministic two-case regression fails before the helper fix and passes after it; Windows-origin and normal std.zlib regressions also pass.
LLDB at emit_defers_for_return+68 (0x1007f6f54) and register_stmt_temp proved local _2 escaped into the enclosing statement frame. The actual gunzip binary freed its live Vec through a string cleanup at 0x100009470; scoped cleanup now passes with zero allocator leaks.

Reject reachable Uninit drops in both MIR drop forms, report invalid drop plans honestly, and widen the dataflow sweep bound after observing overflow at 0x1004ee618. Add direct validator and control-flow regressions. Fixes #1111.
@ehartford ehartford changed the title fix(migrate): keep SDK macros private while preserving project expressions fix(migrate): keep SDK macros private and restore native verification Sep 11, 2026
@ehartford
ehartford marked this pull request as ready for review September 11, 2026 12:11
@ehartford
ehartford merged commit 1ed5b00 into main Sep 12, 2026
5 checks passed
@ehartford
ehartford deleted the macro-token-paste branch September 24, 2026 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant