ReviewOS

home-lang/home

Port native Buffer validators and SIMD encoding parity

#635
Closed chris opened this 10 days ago ·
10 days ago

Problem

The pinned js/node/buffer.test.js corpus still had seven Home-only failures. The reduced JSC realm exposed JavaScript validator fallbacks that could not preserve Bun call/construct behavior, Buffer hex and latin1 conversion bypassed native encoding paths, and the corpus runner returned fabricated throughput data for the benchmark subprocess. Home also disabled the SIMD policy used by the copied Bun string implementation and reported release metadata from debug binaries, which caused the upstream harness to run release-only performance checks in debug mode.

Required implementation

  • Install native isAscii and isUtf8 JSC host functions with matching call and construct callbacks.
  • Route reduced-realm hex and latin1 Buffer conversion through the copied native encoding implementation.
  • Restore the copied Bun SIMD build policy and export every SIMD-gated string primitive it requires.
  • Keep Bun version, SHA, user agent, and debug suffix derived from one pinned build configuration.
  • Delete the benchmark fixture and the exact-source constructor rewrite; no substituted output or weakened upstream assertion is permitted.

Acceptance criteria

  • Unchanged pinned upstream buffer.test.js: 507/507 in a true ReleaseFast build.
  • Copied reduced corpus buffer.test.js: 507/507 in ReleaseFast.
  • Debug native run: 506 pass, one legitimate upstream performance skip, zero failures.
  • Debug reduced corpus run: 506 pass, one corresponding todo, zero failures or unsupported cases.
  • Both debug and ReleaseFast native-JSC builds succeed.

Parent trackers: #621 and #66.

10 days ago

Completed on main by 6fe245d.

Implemented native JSC call/construct validators for Buffer.isAscii and Buffer.isUtf8, native hex and latin1 conversion for the reduced realm, the copied Bun SIMD policy with its required string exports, and one build-mode-aware pinned version/SHA source of truth. Removed both the fabricated throughput subprocess result and the exact-source new-isAscii rewrite.

Verified after rebasing onto and pushing the current origin/main:

  • zig build debug -Denable_jsc=true: pass
  • zig build release-fast -Doptimize=ReleaseFast -Denable_jsc=true: pass
  • unchanged upstream buffer.test.js in debug: 506 pass, 1 legitimate upstream skip, 0 fail
  • copied corpus buffer.test.js in debug: 506 pass, 1 corresponding todo, 0 fail, 0 unsupported
  • unchanged upstream buffer.test.js in ReleaseFast: 507 pass, 0 fail, 28,365 expectations; real throughput benchmark executed
  • copied corpus buffer.test.js in ReleaseFast: 507 pass, 0 fail, 0 todo, 0 unsupported

No test assertion, workload, deadline, or source file was weakened.

Sign in to comment on this issue.