Skip to content

batch: land #8848, #8849, #8850, #8852, #8853 - #8857

Merged
proggeramlug merged 17 commits into
mainfrom
merge/batch-8848-8853
Aug 26, 2026
Merged

batch: land #8848, #8849, #8850, #8852, #8853#8857
proggeramlug merged 17 commits into
mainfrom
merge/batch-8848-8853

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Batch landing of five reviewed PRs, validated once as a single merged tree.

PR
#8848 perf: remove residual Wolf ECS admission overhead
#8849 perf: optimize proven Array length truncation
#8850 runtime: add Node-API host core
#8852 codegen(calls): pad under-applied same-module direct calls
#8853 fix(async_hooks): complete node suite parity

Fixes applied while landing

Validation (merged tree)

  • all 30 lint-job gates pass
  • perry-runtime 2701, perry-codegen 1270, perry-stdlib 120, perry-hir 337 — all 0 failed
  • moving-GC arm (PERRY_GC_FORCE_EVACUATE=1 PERRY_GC_VERIFY_EVACUATION=1): 16 failed on the batch and 16 on clean main — same-commit A/B, so none introduced here
  • df checked before and after every run; no result produced under ENOSPC

Coverage note on #8850

At +3002 lines and 81 C-ABI entry points, cargo check plus the unit suites are shallow coverage for a surface that size. It is opt-in behind the node-api-host feature, so it cannot affect default builds, but no actual addon integration test was run here — real exercise of those entry points is still outstanding.

Summary by CodeRabbit

  • New Features

    • Added an opt-in Node-API host core supporting values, properties, arrays, callbacks, references, scopes, and exceptions for native addons.
    • Same-module function calls now correctly fill omitted parameters with undefined.
  • Bug Fixes & Performance

    • Improved strict assignment behavior for arrays and typed arrays.
    • Accelerated dense array truncation while clearing stale values.
    • Improved length handling for array subclasses.
  • Compatibility

    • Achieved complete async_hooks parity across 195 fixtures, including Windows and Unix scenarios.
  • Documentation

    • Updated Node-API host status and async_hooks parity documentation.

Ralph Küpper added 17 commits August 26, 2026 08:47
…ined (#8770)

A same-module direct call with fewer arguments than the callee's declared
parameter count lowered only the provided args, leaving the remaining FP
argument registers holding caller-saved garbage — which the callee then
read as JS values. The cross-module twin (extern_func.rs, the issue #608
arm) has always padded missing trailing args with TAG_UNDEFINED; the
same-module plain arm sat "one else away" (#7154's own words) unpadded.

On the Claude Code bundle — one giant module, so EVERY direct call
resolves through the same-module arm — `aP([q])` for
`function aP(q, K = !1, _)` handed K/_ whatever d1/d2 held after
js_array_from_values: impossible-NaN bit patterns (0xffffffffffffffff)
that flowed into truthiness tests and method receivers (`_.get(A)`) and
faulted in shape_is_url_search_params / js_is_truthy (~60% of `cc -p`
runs SEGV), or silently corrupted the async iteration ("Detected
unsettled top-level await", most of the rest).

With the padding, `cc -p` runs 30/30 clean: 0 SEGV, 0 hangs, 0 unsettled
awaits, node-identical output on every run. The GC-knob correlations the
long #8770 investigation chased (scavenge pacing, conservative-scan
"fixes") were register-content side effects of the missing padding, not
collector bugs.

Regression test: an under-applied direct call to a 3-param callee must
emit all three double args, the omitted two as the TAG_UNDEFINED literal.

Claude-Session: https://claude.ai/code/session_01Ay8VyLkKbm8Hkc1xmvTEsP
@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 6a0d7549-5d16-4fdc-8710-88e48390b58d

📥 Commits

Reviewing files that changed from the base of the PR and between 63ecbaf and 3410011.

📒 Files selected for processing (43)
  • changelog.d/6764-async-hooks-final.md
  • changelog.d/8849-array-length-truncation.md
  • changelog.d/8850-node-api-host-core.md
  • crates/perry-codegen/src/expr/call_return_array_index_tests.rs
  • crates/perry-codegen/src/expr/computed_store_rooting_tests.rs
  • crates/perry-codegen/src/expr/dispatch.rs
  • crates/perry-codegen/src/expr/index_set.rs
  • crates/perry-codegen/src/expr/index_set_typed_array.rs
  • crates/perry-codegen/src/expr/proxy_reflect.rs
  • crates/perry-codegen/src/expr/typed_array_rmw.rs
  • crates/perry-codegen/src/lower_call/func_ref.rs
  • crates/perry-codegen/src/lower_call/mod.rs
  • crates/perry-codegen/src/lower_call/underapply_pad_tests.rs
  • crates/perry-codegen/src/runtime_decls/strings.rs
  • crates/perry-runtime/Cargo.toml
  • crates/perry-runtime/src/array/header.rs
  • crates/perry-runtime/src/array/header_gc_slots.rs
  • crates/perry-runtime/src/array/mod.rs
  • crates/perry-runtime/src/array/push_pop.rs
  • crates/perry-runtime/src/array/tests.rs
  • crates/perry-runtime/src/gc/mod.rs
  • crates/perry-runtime/src/lib.rs
  • crates/perry-runtime/src/node_api_host/functions.rs
  • crates/perry-runtime/src/node_api_host/mod.rs
  • crates/perry-runtime/src/node_api_host/scopes.rs
  • crates/perry-runtime/src/node_api_host/tests.rs
  • crates/perry-runtime/src/node_api_host/values.rs
  • crates/perry-runtime/src/object/field_get_set.rs
  • crates/perry-runtime/src/object/field_get_set/ic_miss.rs
  • crates/perry-runtime/src/object/field_get_set/ic_miss_array_length_tests.rs
  • crates/perry-runtime/src/typedarray/mod.rs
  • crates/perry-runtime/src/value/dyn_index.rs
  • crates/perry-runtime/src/value/mod.rs
  • docs/src/internals/node-api-host.md
  • test-parity/node-suite/async_hooks/README.md
  • test-parity/node-suite/async_hooks/hooks/provider-child-process-lifecycles.ts
  • test-parity/node-suite/async_hooks/hooks/provider-fs-watcher-lifecycles.ts
  • test-parity/node-suite/async_hooks/hooks/provider-net-lifecycle-matrix.ts
  • test-parity/node-suite/async_hooks/integrations/fs-directory.ts
  • test-parity/node-suite/async_hooks/providers/child-exec-file.ts
  • test-parity/node-suite/async_hooks/providers/child-spawn-events.ts
  • test-parity/node-suite/async_hooks/providers/dns-resolve4.ts
  • test-parity/node_suite_baseline.json

📝 Walkthrough

Walkthrough

This PR adds strict assignment propagation, array and typed-array runtime optimizations, same-module call argument padding, an opt-in Node-API host core, and portable async_hooks fixtures with a 195/195 baseline.

Changes

Runtime semantics and performance

Layer / File(s) Summary
Strict assignment propagation
crates/perry-codegen/src/expr/*, crates/perry-runtime/src/value/*, crates/perry-runtime/src/array/*
Strictness now flows through dynamic index stores, typed-array fallbacks, Symbol receivers, proxy writes, and statically proven array length assignments.
Array truncation and length lookup
crates/perry-runtime/src/array/*, crates/perry-runtime/src/object/field_get_set/*
Array GC slot bookkeeping is separated into header_gc_slots. Dense truncation clears slots in bulk. Length IC misses support proven array subclasses.
Typed-array admission cache
crates/perry-runtime/src/typedarray/mod.rs
Owning Uint32Array admission results use an invalidated direct-mapped cache.

Call lowering

Layer / File(s) Summary
Under-applied direct calls
crates/perry-codegen/src/lower_call/*
Same-module non-rest calls pad omitted trailing parameters with TAG_UNDEFINED. LLVM IR tests cover the behavior.

Node-API host core

Layer / File(s) Summary
Host environment and GC roots
crates/perry-runtime/Cargo.toml, crates/perry-runtime/src/lib.rs, crates/perry-runtime/src/gc/mod.rs, crates/perry-runtime/src/node_api_host/mod.rs
The feature-gated host defines opaque handles, environment state, error reporting, and GC root scanning.
Values and property APIs
crates/perry-runtime/src/node_api_host/values.rs
The host implements value creation, conversions, strings, properties, arrays, errors, BigInts, Symbols, Dates, and type checks.
Scopes, references, and exceptions
crates/perry-runtime/src/node_api_host/scopes.rs
Scope lifetime, handle escaping, references, pending exceptions, and fatal errors are implemented.
Native callbacks and validation
crates/perry-runtime/src/node_api_host/functions.rs, crates/perry-runtime/src/node_api_host/tests.rs, docs/src/internals/node-api-host.md, changelog.d/8850-node-api-host-core.md
Native callbacks support metadata, argument retrieval, function invocation, implicit this, new targets, return values, and exception propagation. Tests cover the host core and its GC behavior. Documentation records the staged implementation state.

Async hooks parity

Layer / File(s) Summary
Portable provider fixtures
test-parity/node-suite/async_hooks/hooks/*, test-parity/node-suite/async_hooks/providers/*, test-parity/node-suite/async_hooks/integrations/fs-directory.ts
Fixtures use platform-specific child-process commands, bounded lifecycle polling, portable temporary paths, trimmed output, and simplified DNS completion logging.
Parity documentation and baseline
test-parity/node-suite/async_hooks/README.md, test-parity/node_suite_baseline.json, changelog.d/6764-async-hooks-final.md
The documented and enforced async_hooks result is 195 passing fixtures out of 195.

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

Sequence Diagram(s)

sequenceDiagram
  participant NativeAddon
  participant NodeApiHost
  participant PerryRuntime
  participant RuntimeGC
  NativeAddon->>NodeApiHost: create handles and invoke callbacks
  NodeApiHost->>PerryRuntime: create values and call JavaScript functions
  PerryRuntime-->>NodeApiHost: return values or pending exceptions
  RuntimeGC->>NodeApiHost: scan and rewrite rooted handles
  NodeApiHost-->>NativeAddon: return N-API status and values
Loading

Suggested reviewers: thehypnoo

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch merge/batch-8848-8853

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant