Skip to content

Train 187r: startup, CJS, Wasm, Android TLS, regex and window fixes (v0.5.1565) - #10256

Merged
proggeramlug merged 35 commits into
mainfrom
train187r
Sep 14, 2026
Merged

proggeramlug merged 35 commits into
mainfrom
train187r

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Land the audited startup, live CJS re-export, WebAssembly re-entry, regex, Android TLS, and desktop window changes as Perry 0.5.1565. The train contains #10144, #10244, #10156, #10066, #10193, #10246, and #10245 through its originally assembled head bfacdfb66b. PR #10245 remains open for the newer purity-inference follow-ups queued for the next train.

Integration fixes preserve Caller-routed Wasm re-entry, meet the raw-handle ratchet, compare CJS descriptor prefixes by byte bounds, isolate the class-field inline test gate, gate the regex expando guard with its only caller, and give bound text methods canonical static names across release codegen units. Changelog fragments are keyed to their PRs. The owner explicitly approved #10193's 2.78% CSV slowdown.

Validation uses the approved fast protocol: each original PR's full gap, GC-stress, and cargo-test CI was compared with its main baseline, followed by targeted local validation of the combined tree.

  • Full lint: 80/83 pass; the remaining public-baseline freshness, API-docs drift, and WebAssembly dead-code warning gates reproduce on main. The separate thread-local check reports the known regex owner.
  • Release static wrappers and compiler build pass. Codegen: 2,032 tests pass. Runtime on the final commit: 3,827 pass, four ignored; only the known release-only heap-generation debug-assertion test fails.
  • Android TLS pool, Wasm-host, UI, compiler unit tests, 48 source-graph cases, Wasm end-to-end, eight Solid JSX cases, and define-resolution integration pass. All 28 tiny/fallback fixtures pass. The root-dominance corpus compiles all 164 sources (192 LLVM files); both checks pass.
  • Area filters: startup 5/5, CJS 7/7, regex 25/25, and Wasm 1/1 pass. Re-export is 13/14: Node itself fails on the RxJS fixture's missing index.js; the source and fixture are byte-identical to main, and Node reproduces the same error from an extracted main tree. All actual test_gap_*reexport* cases pass. Crypto is 16 passing, one inherited suite skip, and one catalog-enumeration mismatch: the train reports exactly main's unchanged literal tables (15 ciphers, six curves, 17 hashes), while Node exposes 130/82/52. All six actual crypto test_gap_* cases pass. Neither the skip list nor the crypto stdlib changes in this train.

CI baselines: main before the earlier PRs and current main. The current baseline has three gap failures (static helpers, DisposableStack, and iterator-prototype patching) and the known native-stack cargo-test failure. The older HTTP/2 gap/GC failure is confined to the earlier baseline comparison.

Closes #10153
Closes #10179
Closes #10170
Closes #10219

Summary by CodeRabbit

  • New Features
    • Added desktop window-frame persistence through frameAutosaveName.
    • Added automatic optimization for eligible tiny programs and source-free Unix runtime builds.
    • Added optional small-process memory profiling for Linux.
    • Added pruning of unused, side-effect-free re-exports.
    • Added RegExp construction caching and faster common RegExp operations.
  • Bug Fixes
    • Improved CommonJS getter re-export handling.
    • Improved WebAssembly promise, host-binding, and reentrancy behavior.
    • Improved Android thread-local stability and event-loop beforeExit handling.
  • Documentation
    • Added guidance for new runtime, UI, benchmarking, and RegExp features.

Ralph Küpper and others added 30 commits September 14, 2026 05:58
…ler (#10144)

The PR's borrow flag refused every nested store access, so a JavaScript
import calling back into WebAssembly failed (import -> export returned
InvalidExport; Emscripten invoke_*/dynCall trampolines and imports calling
_malloc break). Publish each import callback's wasmi Caller as the innermost
store context for the callback's extent and hand nested host operations a
StoreContextMut borrowed from it; only the outermost operation uses the
thread-local store. Overlapping access with no import boundary in between
is still refused.

Regressions: import -> export, import -> funcref-table function via
perry_wasm_host_func_call, import -> standalone Global, and the refused
overlap. The first three fail against the PR's guard.
…the raw-handle ratchet (#10144)

The PR added three bare get_raw_mut_ptr reads to webassembly.rs (22 against
its ceiling of 19), failing the bare raw_handle_debt.py run. Box the export
closure through with_mut_ptr and route the instantiate(Module) result through
a resolved_promise_value helper that roots the value before allocating the
promise and passes the promise through scoped reads.
strip_comments_and_strings goes through from_utf8_lossy, so its offsets are
not guaranteed to be char boundaries of (or even within) the stripped copy.
Probe the byte range instead of slicing the String, so an unusual source
cannot panic export discovery.
…s_gc_init tests (#10066)

js_gc_init disables the process-wide class-field inline gate whenever typed
feedback is active, and typed feedback is always active in test builds. The
new empty-checkpoint and finalization-boundary tests call js_gc_init on a
spawned thread, which isolates thread locals but not that atomic, and they
sort directly before proxy::tests. The two whole-loop write-guard proofs then
rejected at the gate (PERRY_TRACE_OBJECT_ARRAY_WRITE_GUARD: 'disabled gate')
and published 0.

Restore the gate after each js_gc_init test, and have the two proofs that
require the gate establish it first.
Squashed net change of PR #10193 (head 15e2a76, based on 9fda98d):
share compiled Perex programs across constructions via a bounded LRU keyed
by source identity and canonical flags, guard canonical builtin test/replace
dispatch, and assemble empty replacements from match spans. Fixes #10179.

Merge-train resolution: scripts/gc_runtime_root_holders.json merged
structurally with #10066's PASS1_MARKED audit note (both notes kept, source
pins recomputed from the merged tree) and #10193's REGEX_DIAG removal.
Ralph Kuepper added 5 commits September 14, 2026 05:58
Use named static arrays so the captured method name and the lookup result have one identity across codegen units. This preserves the rooting tests without relying on anonymous literal pooling under thin LTO.
@proggeramlug
proggeramlug merged commit 4945fc1 into main Sep 14, 2026
38 of 46 checks passed
@proggeramlug
proggeramlug deleted the train187r branch September 14, 2026 06:31
@coderabbitai

coderabbitai Bot commented Sep 14, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 0058775d-1cf3-4765-9aec-858bb28c1851

📥 Commits

Reviewing files that changed from the base of the PR and between eb13fa1 and 28051a2.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (196)
  • .github/workflows/release-packages.yml
  • CLAUDE.md
  • Cargo.toml
  • benchmarks/regexp-construction/README.md
  • benchmarks/regexp-construction/app-samples.json
  • benchmarks/regexp-construction/compare.py
  • benchmarks/regexp-construction/controls-samples.json
  • benchmarks/regexp-construction/current-app-samples.json
  • benchmarks/regexp-construction/current-json-control-samples.json
  • benchmarks/regexp-construction/current-other-control-samples.json
  • benchmarks/regexp-construction/current-probe-samples.json
  • benchmarks/regexp-construction/current-results.md
  • benchmarks/regexp-construction/current-test262-comparison.json
  • benchmarks/regexp-construction/final-app-samples.json
  • benchmarks/regexp-construction/final-json-control-samples.json
  • benchmarks/regexp-construction/final-loaded-control-samples.json
  • benchmarks/regexp-construction/final-probe-samples.json
  • benchmarks/regexp-construction/final-results.md
  • benchmarks/regexp-construction/final-test262-comparison.json
  • benchmarks/regexp-construction/hint-experiment-samples.json
  • benchmarks/regexp-construction/measure.py
  • benchmarks/regexp-construction/merged-app-samples.json
  • benchmarks/regexp-construction/merged-control-samples.json
  • benchmarks/regexp-construction/merged-probe-samples.json
  • benchmarks/regexp-construction/merged-results.md
  • benchmarks/regexp-construction/pre-hint-app-samples.json
  • benchmarks/regexp-construction/pre-hint-probe-samples.json
  • benchmarks/regexp-construction/prepare.py
  • benchmarks/regexp-construction/probe-samples.json
  • benchmarks/regexp-construction/probe.ts.in
  • benchmarks/regexp-construction/results.md
  • changelog.d/10066-startup-empty-checkpoint.md
  • changelog.d/10066-startup-lazy-class-parents.md
  • changelog.d/10066-startup-memory-profile.md
  • changelog.d/10066-startup-prebuilt-core.md
  • changelog.d/10066-startup-tiny-program.md
  • changelog.d/10144-wasm-review-hardening.md
  • changelog.d/10156-cjs-getter-reexport-binding.md
  • changelog.d/10193-regexp-construction-cache.md
  • changelog.d/10244-android-tls-pool.md
  • changelog.d/10245-prune-unused-reexports.md
  • changelog.d/10246-window-frame-persistence.md
  • crates/perry-codegen/src/codegen/artifacts.rs
  • crates/perry-codegen/src/codegen/cjs_exports.rs
  • crates/perry-codegen/src/codegen/entry.rs
  • crates/perry-codegen/src/codegen/entry/tests.rs
  • crates/perry-codegen/src/codegen/mod.rs
  • crates/perry-codegen/src/codegen/module_globals_emit.rs
  • crates/perry-codegen/src/codegen/namespace_value_getters.rs
  • crates/perry-codegen/src/expr/dyn_extern_i18n.rs
  • crates/perry-codegen/src/lower_call/native/native_ui_appshell_branch.rs
  • crates/perry-codegen/src/runtime_decls/strings_part2.rs
  • crates/perry-codegen/tests/app_window_config_options.rs
  • crates/perry-runtime/Cargo.toml
  • crates/perry-runtime/build.rs
  • crates/perry-runtime/src/async_hooks.rs
  • crates/perry-runtime/src/bun_ffi/callback.rs
  • crates/perry-runtime/src/closure/dynamic_props.rs
  • crates/perry-runtime/src/closure/mod.rs
  • crates/perry-runtime/src/ffi/perry_memory_profile.c
  • crates/perry-runtime/src/gc/census.rs
  • crates/perry-runtime/src/gc/mod.rs
  • crates/perry-runtime/src/gc/tests/copying/survival_and_malloc.rs
  • crates/perry-runtime/src/gc/tests/host_safepoints.rs
  • crates/perry-runtime/src/gc/tests/runtime_roots/perex_lifecycle.rs
  • crates/perry-runtime/src/gc/tests/runtime_roots/perex_match_all.rs
  • crates/perry-runtime/src/gc/tests/runtime_roots/perex_public.rs
  • crates/perry-runtime/src/gc/tests/runtime_roots/perex_reuse.rs
  • crates/perry-runtime/src/gc/tests/runtime_roots/regexp_last_index.rs
  • crates/perry-runtime/src/gc/tests/support.rs
  • crates/perry-runtime/src/hot_diag.rs
  • crates/perry-runtime/src/lib.rs
  • crates/perry-runtime/src/node_submodules/diagnostics.rs
  • crates/perry-runtime/src/object/class_image.rs
  • crates/perry-runtime/src/object/class_meta_registry.rs
  • crates/perry-runtime/src/object/exotic_expando.rs
  • crates/perry-runtime/src/object/global_this_webassembly.rs
  • crates/perry-runtime/src/object/mod.rs
  • crates/perry-runtime/src/object/regex_canonical.rs
  • crates/perry-runtime/src/object/regex_proto_thunks.rs
  • crates/perry-runtime/src/os.rs
  • crates/perry-runtime/src/os_process_streams.rs
  • crates/perry-runtime/src/perf_hooks.rs
  • crates/perry-runtime/src/promise/microtasks.rs
  • crates/perry-runtime/src/promise/microtasks/empty.rs
  • crates/perry-runtime/src/promise/mod.rs
  • crates/perry-runtime/src/promise/native_async.rs
  • crates/perry-runtime/src/promise/rejection.rs
  • crates/perry-runtime/src/proxy.rs
  • crates/perry-runtime/src/regex.rs
  • crates/perry-runtime/src/regex/flags.rs
  • crates/perry-runtime/src/regex/perex_api.rs
  • crates/perry-runtime/src/regex/perex_cache.rs
  • crates/perry-runtime/src/regex/perex_cache/tests.rs
  • crates/perry-runtime/src/regex/perex_construct.rs
  • crates/perry-runtime/src/regex/perex_dispatch.rs
  • crates/perry-runtime/src/regex/perex_owner.rs
  • crates/perry-runtime/src/regex/perex_remove.rs
  • crates/perry-runtime/src/regex/perex_replace.rs
  • crates/perry-runtime/src/regex/perex_runtime.rs
  • crates/perry-runtime/src/startup_memory_profile.rs
  • crates/perry-runtime/src/text.rs
  • crates/perry-runtime/src/timer.rs
  • crates/perry-runtime/src/timer/ownership.rs
  • crates/perry-runtime/src/tls_hot.rs
  • crates/perry-runtime/src/tls_hot/provider_tests.rs
  • crates/perry-runtime/src/tls_os_pool.rs
  • crates/perry-runtime/src/tls_os_pool/tests.rs
  • crates/perry-runtime/src/weakref/test_support.rs
  • crates/perry-runtime/src/webassembly.rs
  • crates/perry-runtime/src/webassembly_calls.rs
  • crates/perry-runtime/src/webassembly_host.rs
  • crates/perry-runtime/tests/android_tls_pool.rs
  • crates/perry-runtime/tests/fixtures/memory_profile_probe.c
  • crates/perry-ui-android/src/ffi/tabbar_layout.rs
  • crates/perry-ui-gtk4/src/app.rs
  • crates/perry-ui-gtk4/src/ffi/app_window.rs
  • crates/perry-ui-gtk4/src/frame_persistence.rs
  • crates/perry-ui-gtk4/src/lib.rs
  • crates/perry-ui-ios/src/ffi/dialogs_lifecycle.rs
  • crates/perry-ui-macos/src/app.rs
  • crates/perry-ui-macos/src/lib_ffi/core_widgets.rs
  • crates/perry-ui-tvos/src/ffi/app_keychain.rs
  • crates/perry-ui-visionos/src/ffi_system.rs
  • crates/perry-ui-watchos/src/lib.rs
  • crates/perry-ui-windows-winui/src/app.rs
  • crates/perry-ui-windows/src/app.rs
  • crates/perry-ui-windows/src/ffi/app_window.rs
  • crates/perry-ui-windows/src/frame_persistence.rs
  • crates/perry-ui-windows/src/lib.rs
  • crates/perry-ui/Cargo.toml
  • crates/perry-ui/src/frame.rs
  • crates/perry-ui/src/lib.rs
  • crates/perry-wasm-host/src/externals.rs
  • crates/perry-wasm-host/src/host_runtime.rs
  • crates/perry-wasm-host/src/lib.rs
  • crates/perry-wasm-host/src/reentrancy_tests.rs
  • crates/perry-wasm-host/src/tables.rs
  • crates/perry/src/commands/compile.rs
  • crates/perry/src/commands/compile/bootstrap.rs
  • crates/perry/src/commands/compile/build_cache.rs
  • crates/perry/src/commands/compile/cjs_wrap/detect.rs
  • crates/perry/src/commands/compile/cjs_wrap/extract_exports.rs
  • crates/perry/src/commands/compile/cjs_wrap/mod.rs
  • crates/perry/src/commands/compile/cjs_wrap/tests/source_graph.rs
  • crates/perry/src/commands/compile/collect_modules.rs
  • crates/perry/src/commands/compile/collect_modules/reexport_prune.rs
  • crates/perry/src/commands/compile/collect_modules/reexport_prune/forwarding.rs
  • crates/perry/src/commands/compile/collect_modules/reexport_prune/scan.rs
  • crates/perry/src/commands/compile/collect_modules/reexport_prune/side_effects.rs
  • crates/perry/src/commands/compile/collect_modules/tests.rs
  • crates/perry/src/commands/compile/collect_modules/walk.rs
  • crates/perry/src/commands/compile/collect_modules_helpers.rs
  • crates/perry/src/commands/compile/library_search.rs
  • crates/perry/src/commands/compile/optimized_libs.rs
  • crates/perry/src/commands/compile/optimized_libs/driver.rs
  • crates/perry/src/commands/compile/optimized_libs/prebuilt_core.rs
  • crates/perry/src/commands/compile/run_pipeline.rs
  • crates/perry/src/commands/compile/tiny_program/analysis.rs
  • crates/perry/src/commands/compile/tiny_program/emit.rs
  • crates/perry/src/commands/compile/tiny_program/mod.rs
  • crates/perry/src/commands/compile/tiny_program/output.c
  • crates/perry/src/commands/compile/types.rs
  • crates/perry/tests/issue_5234_wasm_esm_import.rs
  • crates/perry/tests/source_graph_export_regressions.rs
  • crates/perry/tests/source_graph_export_regressions/issue_10153.rs
  • crates/perry/tests/source_graph_export_regressions/issue_10180.rs
  • docs/examples/ui/overview/frame-persistence.ts
  • docs/src/SUMMARY.md
  • docs/src/cli/flags.md
  • docs/src/internals/regexp-program-cache.md
  • docs/src/runtime/small-process-memory.md
  • docs/src/runtime/tiny-programs.md
  • docs/src/ui/overview.md
  • npm/perry/README.md
  • scripts/build_core_runtime.sh
  • scripts/build_linux_glibc_2_31.sh
  • scripts/build_linux_musl.sh
  • scripts/gc_runtime_root_holders.json
  • scripts/stage-npm.sh
  • scripts/verify_tiny_output.py
  • scripts/verify_tiny_program.py
  • test-files/cjs_getter_reexport/index.cjs
  • test-files/cjs_getter_reexport/transform.cjs
  • test-files/test_cjs_getter_reexport.ts
  • test-files/test_gap_10179_regexp_cache.ts
  • test-files/test_gap_startup_before_exit_microtasks_only.ts
  • test-files/test_gap_startup_before_exit_unref.ts
  • test-files/test_gap_startup_empty_checkpoint_before_exit.ts
  • test-files/test_gap_startup_empty_checkpoint_timing.ts
  • test-files/test_gap_startup_exit_job_boundary.ts
  • test-parity/expected/test_cjs_getter_reexport.txt
  • third_party/windows-winui/VENDORED.md
  • third_party/windows-winui/windows-reactor/src/app.rs
  • third_party/windows-winui/windows-reactor/src/winui/host.rs
  • types/perry/ui/index.d.ts

📝 Walkthrough

Walkthrough

Changes

Runtime and compiler behavior

Layer / File(s) Summary
Runtime checkpoints and RegExp execution
crates/perry-runtime/...
Adds empty event-loop checkpoints, before-exit handling, bounded RegExp program caching, canonical fast paths, and related GC and diagnostic support.
Compiler module behavior
crates/perry-codegen/..., crates/perry/src/commands/compile/...
Adds live CommonJS getter exports, side-effect-aware re-export pruning, prebuilt core selection, and automatic tiny-program compilation.
Platform integrations
crates/perry-ui/..., crates/perry-wasm-host/..., crates/perry-runtime/...
Adds desktop frame persistence, shared WebAssembly host-store reentrancy, Android pooled TLS, startup memory policy, and external-handle cleanup.

Validation and release

Layer / File(s) Summary
Tests and benchmark evidence
crates/perry/tests/..., crates/perry-runtime/..., benchmarks/regexp-construction/..., scripts/verify_*.py
Adds regression tests, benchmark harnesses, recorded measurements, verification reports, and validation scripts.
Release packaging and documentation
.github/workflows/..., scripts/..., docs/..., npm/perry/README.md, Cargo.toml, CLAUDE.md
Builds and stages libperry_runtime_core.a, documents the new features, and updates the version to 0.5.1565.

Estimated code review effort: 5 (Critical) | ~120 minutes

✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch train187r

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment