Repository navigation
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Implement the public class/object callback model required by real JavaScriptCore embedders.
Acceptance:
- Implement JSClassCreate, retain, release, parent retention, and deep-copied definitions.
- Materialize static functions on shared automatic prototypes and as own functions for
NoAutomaticPrototype. - Materialize static value accessors with exact handled/fallback and attribute semantics.
- Honor inherited initialize/finalize callbacks with parent-first/child-first ordering.
- Honor property, deletion, enumeration, conversion, call, constructor, and instanceof callbacks.
- Implement JSPropertyNameArray and JSPropertyNameAccumulator lifecycle/APIs.
- Integrate callback-owned objects with exactly-once GC finalization and context teardown.
- Define deterministic exception propagation and wrong-context behavior for every callback family.
- Add complete C ABI conformance coverage for static members, every callback family, enumeration, and exception paths.
Progress
- 29178a3 lands the ownership foundation: atomic JSClassRef retain/release, retained parents, deep copies of class/static names and sentinel tables, per-object exact/ancestor identity, parent-first initialize, child-first finalize, and host private-data coexistence.
- Arena teardown and precise-GC collection both finalize class instances exactly once. Focused Zig tests pass without leaks; real C/C++ hosts pass.
- The system-JSC differential fixture now covers inherited class identity: 7/7 rows match (
2dd418694a0f2741). - The pinned public matrix is 97/117 complete, 20 pending, with 98 public symbols and 9 zig-js extensions present.
- A pinned system-JSC probe establishes the next static-member model: static value accessors are own per-instance properties, static functions live on a shared class prototype, and inherited property-name snapshots include both.
- 0da233c adds per-context GC-rooted class prototypes, retained cache ownership, inherited/static function placement, and distinct own functions for
NoAutomaticPrototype. C/C++ hosts pass, the focused GC-root test passes without leaks, and the JSC differential is 10/10 (99ffdeb6b62b08d1). - 00372b1 routes static-value get/set/has through the interpreter internal-method layer. Null getters remain absent, true setters consume writes, and false setters decline without creating accidental data properties, matching system JSC.
- 9e5421a adds JSC-compatible static-value descriptors plus deterministic child-first own-key enumeration. C/C++ hosts pass, and the system-JSC differential now matches 14/14 rows (
5469cad196099616). Static-value deletion remains before the static-values acceptance item can close. - 50abb92 completes static-value deletion attributes and routes inherited
deletePropertycallbacks through[[Delete]]: true consumes, false falls through child-to-parent then ordinary deletion, and exceptions propagate. C/C++ hosts pass; the differential matches 17/17 rows (95d11a24046d59b6). - 417375c implements inherited dynamic
hasProperty/getProperty/setPropertydispatch, getter-only presence fallback, handled versus ordinary-write setter behavior, mixed static/dynamic ordering, reflection, and get/set exception propagation. C/C++ hosts pass; the differential matches 23/23 rows (086732cdbe02b61a). - cf99d29 implements
getPropertyNames, retained/deduplicated property-name snapshots, all six array/accumulator APIs, prototype-inclusive C snapshots, and exact JSCObject.keys/Reflect.ownKeys/for-inbehavior. The inventory is 103/117 complete with 14 pending and 104 public symbols; C/C++ hosts pass and the differential matches 25/25 rows (6cd37c97bdb91aa0). - f0cdff0 completes inherited call/constructor/hasInstance/conversion callbacks and
JSObjectMakeConstructor, including JSC construct-only behavior, callback exceptions, default class-instance construction, and retained class ownership through precise GC. The matrix is 104/117 complete with 13 pending and 105 public symbols; C/C++ hosts pass, focused GC tests pass 2/2 without leaks, and the differential matches 30/30 rows (49887167fbda291a). - e831e7b adds focused realm-validation and invalid-return coverage. Foreign values/exceptions, null required results, non-object constructor returns, and object-valued conversions become deterministic local exceptions. The focused test passes 2/2 without leaks; the promoted matrix is 105/117 complete with 12 pending and no C API: implement JSClassRef definitions, callbacks, and property-name APIs #137-owned entry left pending.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
Activity
feat(c-api): add class ownership foundation (#137)
feat(c-api): materialize shared class functions (#137)
feat(c-api): dispatch static class values (#137)
feat(c-api): reflect static class values (#137)
feat(c-api): dispatch class deletion callbacks (#137)
feat(c-api): dispatch class property callbacks (#137)
feat(c-api): implement property-name snapshots (#137)
feat(c-api): complete class runtime callbacks (#137)
test(c-api): harden class callback boundaries (#137)
chrisbbreuer commentedon Jul 17, 2026
Post-completion layout repair: the two host-class metadata pointers had pushed ObjectColdState from 224 to 240 bytes, crossing its GC allocation from 256 bytes to the next size class. d4ad50e folds hooks into the context-owned class record and stores its single owner pointer in the already-required object storage wrapper, restoring the 224-byte sidecar / 256-byte allocation invariant. Focused layout and JSClass lifecycle tests pass.