ReviewOS

zig-utils/zig-js

ABI: implement exact JSFunction source and tier-up controls

#222
Closed chris opened this 11 days ago ·
11 days ago

Parent: #134 Profile umbrella: #140 Home inventory: #163 Bun inventory: #164 Builds on: #221

Implement the pinned shared private-JSC exports:

  • JSC__JSFunction__getSourceCode
  • JSC__JSFunction__optimizeSoon

Acceptance criteria:

  • Return the exact parser-captured source span for ordinary functions, arrows, methods, generators, async functions, and class constructors without invoking user code.
  • Return false for native, bound, non-function, invalid, and exception cells while leaving the output unchanged.
  • Publish a stable group-lifetime ZigString view with exact Latin-1/UTF-16 tagging and UTF-16 length.
  • Make optimizeSoon schedule the next invocation of an eligible bytecode function for native-tier consideration without compiling synchronously.
  • Leave already-ready/rejected tiers, tree-walk functions, native/bound functions, invalid values, and pending VM exceptions unchanged.
  • Focused tests cover source fidelity, Unicode source, rejection cases, next-invocation tier transition, VM ownership, and exception neutrality.
  • Extend the Home consumer fixture and publish exact Home/Bun inventory, ABI documentation, README, and parent counts.
  • Batch the focused test, consumer fixture, both private audits, and C-API classification before publishing.
  • Leave benchmark scores unchanged unless a benchmark path is rerun.

Completed evidence

Implemented on main in a30b91b8; pinned inventories, ABI documentation, and README counts were published in 12ff7451. Source retrieval now returns parser-exact group-lifetime ZigString views for ordinary, arrow, method, generator, async, Unicode, and class functions while rejecting native, bound, non-function, invalid, and exception cells without output mutation. Tier-up requests remain scheduling-only and prime the next eligible cold bytecode invocation without synchronous allocation or code generation; settled tiers and ineligible functions remain unchanged.

The intentionally batched verification passed 15/15: focused tests passed 3/3 with zero leaks, the Home fixture linked and exercised 203/203 symbols, Home is 204/431 (227 pending), Bun core is 198/421 (223 pending), and the public audit reports 117 public, 19 extensions, and 208 private/support exports. Benchmark scores remain unchanged because no benchmark path was affected or rerun.

11 days ago

Completed on main in a30b91b8, with inventories and documentation in 12ff7451. All acceptance criteria are checked; the recorded batch passed 15/15 with zero leaks, fixture 203/203, Home 204/431, Bun 198/421, and 208 private/support exports.

Sign in to comment on this issue.