Repository navigation
clazel-js-vm, clazel-js-builtins: Object, classes, Map/Set/Weak*, Reflect, accessors; unifies #299, #292 and #296 - #302
Merged
Merged
Conversation
…nstanceof Symbol values are heap cells (one per Symbol, so identity is equality), the 13 well-known ones made with the VM; a Symbol is a property key through clazel-js-heap's symbol contract (Y4), which the interner never collides with. typeof, ToPropertyKey, ToString/ToNumber (TypeError), ToObject, IsLooselyEqual, SetFunctionName of a computed method key and ToPrimitive's @@toPrimitive now see them; own_properties stays String-keyed and own_symbol_properties lists the rest. The ops GetIterator, IterNext, IterClose (§7.4), ForInIterator (§14.7.5.9), CallSpread, NewSpread, InstanceOf (§13.10.2 with @@hasInstance and OrdinaryHasInstance), ToObject and ThrowIfNotObject run. An Iterator Record is a heap cell only registers hold. The iterators themselves are built-ins, so a bare VM has nothing iterable. The built-ins runner classes a missing eval reported inside a test's own Test262Error, and lists 10.1.1-11-s.js (reached now that instanceof runs). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Symbol (§20.4) with Symbol.for/keyFor, the well-known symbols and Symbol.prototype; %Iterator.prototype%, the Array and String iterators (§23.1.5, §22.1.5); Function.prototype[@@hasInstance]; @@toStringTag in Object.prototype.toString and on Math, JSON and the iterator prototypes; Object.prototype.toLocaleString. Array: from, at, copyWithin, entries, keys, values (= @@iterator), findLast, findLastIndex, flat, flatMap, toLocaleString, toReversed, toSorted, toSpliced, with, @@unscopables; concat reads @@isConcatSpreadable and ArraySpeciesCreate reads @@species (the constructor itself while get Array[@@species], an accessor, is missing). Spread, for-of and destructuring over arrays and strings now run end to end (tests/iteration.rs). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
String: fromCodePoint, raw, and at, codePointAt, concat, endsWith, includes, isWellFormed, lastIndexOf, localeCompare, match, matchAll, padEnd, padStart, repeat, replace, replaceAll (GetSubstitution), search, split, startsWith, toLowerCase/toUpperCase (and the locale forms), toWellFormed, trim, trimEnd, trimStart, @@iterator, and Annex B substr, trimLeft, trimRight. The RegExp-taking methods delegate to a pattern's @@match/@@replace/... and are NotYet otherwise (no RegExp yet). Number: toExponential, toPrecision (clazel-js-number) and toLocaleString. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Installing the built-ins grew with Symbol, the iterators and String (about 25 s a case under Miri), so builtins.rs takes the stride the other built-in tests use, which keeps each test well under xtask's 300 s limit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ng and RegExp limits (7.19) The heap counts bytes (cells, string payloads, properties) against a settable limit; an op that runs out throws a RangeError made from a 64 KiB reserve, and OutOfMemory only once that is spent. Nested runs of the interpreter loop count against the native depth too, so recursion through ToPrimitive cannot overflow the host stack; the default drops from 150 to 32, measured at about 40 KB of host stack a level unoptimised. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…esting limit (7.19) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Endless loop (Terminator), unbounded recursion through JS, natives and ToPrimitive, a gigabyte string build, catching the heap limit for ever, growing arrays and objects, 10^6 nested arrays in source and in JSON, and recursion through the embedder's own natives. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…7.19) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…oop (7.19) clazel-js is a dev-dependency only, for tests/hostile.rs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ir errors Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ds globals with ToString Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the NewRegExp handler ObjKind::Host objects hold the internal slots of a built-in (Promise, RegExp); natives can carry captured values (the closures of the standard); the job queue (HostEnqueuePromiseJob) runs at the embedder's microtask checkpoint; NewRegExp calls %RegExp% (RegExpCreate). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rror Promise (constructor, all, allSettled, any, race, reject, resolve, try, withResolvers, then, catch, finally) over the VM's host objects and job queue; AggregateError; SpeciesConstructor and Invoke helpers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ods that use it RegExp (constructor, escape, exec, test, toString, compile, @@match, @@matchall, @@replace, @@search, @@split, RegExp String Iterator) over clazel-js-regexp, with the backtrack stack bounded (RangeError) and the termination flag as the matcher's interrupt; String.prototype.match, matchAll and search make a RegExp; GetSubstitution takes named captures; Object.prototype.toString knows RegExp. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CreateUnmappedArguments, CreateMappedArguments (without the parameter map) and CreateRestArray: a call of a function that reads its arguments keeps its argument list, since the frame has slots for the parameters only. try/catch/ finally and throw already compiled and ran; tests cover them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s per directory The vendored WPT testharness.js loads in its shell environment and runs sync and promise tests through Promise, RegExp and the job queue. The Test262 runner prints pass, expected failure and failure per directory. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Limits as errors and the hostile-page tests join Promise, RegExp and the job queue. The RegExp matcher's backtrack stack is bounded by Vm::regexp_backtrack_limit through regexp::backtrack_limit, as #299 describes, so the catastrophic-pattern hostile test now asserts the real RangeError instead of NotImplemented. The json.rs header keeps both deviation notes; the heap's byte count handles the Symbol and iterator-record cells. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The catastrophic-pattern test no longer expects NotImplemented: a pattern that grows the backtrack stack ends in a RangeError at Limits::regexp_backtrack_entries, and (a+)+b ends as Terminated when the terminator is set. Both tests of #296 are kept in a stronger form. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…shared natives WebIDL attributes are accessor properties on prototypes (WebIDL §3.7.6), so item 7.12 needs them in the engine: - clazel-js-vm: an accessor property is an ACCESSOR attribute bit and a Cell::Accessor pair in its slot. OrdinaryGet (§10.1.8.1 steps 4 to 8) and OrdinarySetWithOwnDescriptor (§10.1.9.2 steps 4 to 7) call the getter and setter with the receiver, for property reads and writes, global identifiers and primitive bases; ValidateAndApplyPropertyDescriptor (§10.1.6.3) gets its accessor steps (2.c, 5.c, 5.d, 6.a, 6.b); object literal getters and setters (DefineMethod forms 1 and 2) run; the instanceof operator (§13.10.2, OrdinaryHasInstance §7.3.21) runs. - clazel-js-builtins: ToPropertyDescriptor (§6.2.6.5) reads get and set. - clazel-js: define_property takes accessors; get_own_property; delete_property, new_array, new_array_from and is_array over the VM's arrays; shared_function, a re-entrant native for Sync closures (open question 14's proposal, beside function, which keeps its Busy rule). The Test262 runners gain two classifications for tests that instanceof now reaches and that stop at the missing eval (fail stays 0). The API test that listed arrays and delete_property as NotImplemented now asserts that they work. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An object carries [[Extensible]] (§10.1.3). Once Vm::prevent_extensions ran (§10.1.4.1), ValidateAndApplyPropertyDescriptor step 2.a refuses a new property and OrdinarySet step 2.d.vi fails. Vm::set_prototype_of is OrdinarySetPrototypeOf (§10.1.2.1) with its cycle check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
getOwnPropertyDescriptor(s), getOwnPropertyNames and Symbols, defineProperties, entries, values, assign, is, hasOwn, fromEntries, groupBy, freeze, seal, isFrozen, isSealed, preventExtensions, isExtensible, setPrototypeOf; Object.prototype isPrototypeOf, propertyIsEnumerable and Annex B's __proto__ accessor, __defineGetter__ and friends. Each algorithm quotes its steps; tests/object.rs runs them (also under Miri). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RegExp.prototype.flags, source, global, ignoreCase, multiline, dotAll, unicode, unicodeSets, sticky and hasIndices are the getters of §22.2.6 (with RegExpHasFlag), and get RegExp, Promise and Array [ @@species ] return the this value, so the listed deviation of #299 goes. ArraySpeciesCreate reads C[@@species] with Get. Symbol.prototype.description is the accessor of §20.4.3.2. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…new.target) The class ops the compiler already emits (specified in ops.rs) get their handlers: ClassSetup (ClassDefinitionEvaluation steps 5 to 17), SetHomeObject and GetSuperBase, GetSuper and SetSuper (super references with a receiver), SuperCall and SuperCallSpread (Construct with NewTarget, BindThisValue's once-only check), InitInstance and SetInstanceInit, ConstructResult (derived return rules), GetNewTarget, and the private-name ops (PrivateGet, PrivateSet, PrivateFieldAdd, PrivateMethodOrAccessorAdd, #x in o). [[Construct]] takes a NewTarget and enters base and derived class constructors. DefineMethod uses DefinePropertyOrThrow and names accessors with symbol keys. tests/classes.rs runs constructors, accessors, extends (including Error, Array and Promise), super, fields, static blocks and private names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The constructors (AddEntriesFromIterable, the Set adder loop with IteratorClose), Map.groupBy, @@species accessors, the prototypes' methods and size accessors, the ES2025 Set methods (GetSetRecord, union, intersection, difference, symmetricDifference, isSubsetOf, isSupersetOf, isDisjointFrom) and the Map and Set iterators. The storage is clazel-js-vm's collections table: an insertion-ordered list with SameValueZero keys whose deleted entries stay as empty places, as the standard's List does, so an iterator survives deletion. Weak collections hold strongly until the collector (item 7.6) exists; the module header lists both deviations. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
apply, construct (with NewTarget), defineProperty, deleteProperty, get and set with a receiver, getOwnPropertyDescriptor, getPrototypeOf, setPrototypeOf, has, isExtensible, preventExtensions, ownKeys and @@toStringTag, each quoting its steps. clazel-js-vm gains the public OrdinaryGet and OrdinarySet with a receiver (get_with_receiver, ordinary_set), which super references also use. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…op creates data properties CopyDataProperties (§7.3.25) runs: object spread and the rest of an object pattern. A native's Set(O, P, V, true) throws a TypeError for a failed assignment whatever the strictness of the running function (Object.assign into a frozen or sealed target). DefineProp and DefineElem are CreateDataPropertyOrThrow, so a class field on a frozen object or a static field named prototype throws. The built-ins' lib.rs header lists what is present and absent now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ed; Object.prototype is immutable The upsert proposal's methods (Test262 has their tests at its head) and §10.4.7.1's immutable prototype for %Object.prototype%. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
atiernan
had a problem deploying
to
full-verification
November 23, 2026 22:22 — with
GitHub Actions
Error
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
atiernan
temporarily deployed
to
full-verification
November 23, 2026 23:07 — with
GitHub Actions
Inactive
…, minutes); keep the embedder's limit test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
atiernan
temporarily deployed
to
full-verification
November 24, 2026 14:55 — with
GitHub Actions
Inactive
atiernan
added a commit
that referenced
this pull request
Nov 24, 2026
Both sides carry the accessor commit (4d0c1d5 here, 02c1cb2 on main, rebased onto Promise/RegExp/Symbol). The engine files were merged with 4d0c1d5 as the base, so main's rebased accessor work, classes, Object, Map/Set and Reflect come in whole, and this branch's later engine changes (re-entrant natives, Scope::run_jobs, the inline-parsing switch) stay: - clazel-js-vm (handlers, heap, interp, props), clazel-js-builtins (object, conformance_builtins), clazel-js tests/accessors: main's. This branch had nothing past the accessor commit in them. - clazel-js (scope, state, native, lib, api tests): main's plus this branch's re-entrance and run_jobs; README open question 13 from main, 14 (answered) from here. - clazel-web Cargo.toml: clazel-js is already a dependency here, so main's second entry is dropped; the README no longer calls it dev-only. - Cargo.lock: this branch's, then `cargo update -w` (clazel-js-builtins now names clazel-js-regexp). Now that classes and for...of run, two WPT dom/events pages pass (EventTarget-constructible, passive-by-default) and leave the expected failures (40 pass, 226 subtests, 24 listed), and the scripting test of an engine report uses a BigInt literal instead of a class. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 7, items 7.8 and 7.9: one engine branch that unifies three open pull requests and fills the largest built-in gaps.
This branch contains #299 (Promise, RegExp, the job queue,
arguments/rest), #292 (the built-ins it is built on, which #299 already contains) and #296 (limits as errors, hostile-page tests). It also contains the commit4d0c1d5aof #298 ("accessor properties, instanceof, re-entrant shared natives"), cherry-picked, so that this branch and #298 merge without a conflict on it.How the three pull requests were combined
origin/claude/js-promise-regexp(Phase 7: Promise and the job queue, RegExp's object half, arguments and rest parameters #299).origin/claude/js-limits(7.19: engine limits as errors (heap RangeError, native and nesting depth) and hostile-page tests #296) is merged into it. One textual conflict (the deviation list ofjson.rs: both notes kept); the heap's byte count learned theSymboland iterator-record cells.regexp::backtrack_limit(vm)is nowusize::try_from(vm.regexp_backtrack_limit()).unwrap_or(usize::MAX), as Phase 7: Promise and the job queue, RegExp's object half, arguments and rest parameters #299's body describes. 7.19: engine limits as errors (heap RangeError, native and nesting depth) and hostile-page tests #296's hostile testa_catastrophic_regexp_is_not_run_yetassertedNotImplemented, which is no longer true with a RegExp built-in: it is kept in a stronger form as two tests,a_regexp_past_the_backtrack_limit_is_a_range_error(the stack bound, aRangeErrorthatcatchsees) anda_catastrophic_regexp_is_terminated((a+)+b, ended by the terminator). Every other test of 7.19: engine limits as errors (heap RangeError, native and nesting depth) and hostile-page tests #296 and Phase 7: Promise and the job queue, RegExp's object half, arguments and rest parameters #299 is unchanged.4d0c1d5ais cherry-picked (two conflicts: the heap'sCellenum, which now hasSymbol,IterandAccessor, and a comment of the Test262 runner). Itsinstance_ofis dropped for the one Phase 7: Promise and the job queue, RegExp's object half, arguments and rest parameters #299's base already has (@@hasInstanceaware), which is the only change to its contents.What is new
Object, complete (clazel-js-builtins/src/object.rs):getOwnPropertyDescriptor(s),getOwnPropertyNames,getOwnPropertySymbols,defineProperties,entries,values,assign,is,hasOwn,fromEntries,groupBy,freeze,seal,isFrozen,isSealed,preventExtensions,isExtensible,setPrototypeOf;Object.prototype.isPrototypeOf,propertyIsEnumerable, and Annex B's__proto__accessor and__defineGetter__family. In the VM:[[Extensible]](a flag of the object; adding a property to a non-extensible object fails in ValidateAndApplyPropertyDescriptor, OrdinarySet and CreateDataProperty), OrdinarySetPrototypeOf with its cycle check,%Object.prototype%immutable (§10.4.7.1), andSet(O, P, V, true)from a native throws whatever the strictness of the running function.RegExp.prototype.flags/source/global/ignoreCase/multiline/dotAll/unicode/unicodeSets/sticky/hasIndicesare the standard's getters (withRegExpHasFlag), andget RegExp/Promise/Array/Map/Set [ @@species ],Symbol.prototype.description,Map.prototype.size,Set.prototype.sizeare accessors. Phase 7: Promise and the job queue, RegExp's object half, arguments and rest parameters #299's listed deviation (flags as own data properties) is gone.clazel-js-vm/src/class.rs; the compiler and the ops ofops.rswere already there, the interpreter had no handlers for them):ClassSetup,SetHomeObject,SetInstanceInit,InitInstance,SuperCall/SuperCallSpread(Constructwith aNewTarget),GetSuperBase/GetSuper/SetSuper,GetNewTarget,ConstructResult,NewPrivateName/GetPrivate/SetPrivate/DefinePrivate/HasPrivate;[[Construct]]takes aNewTargetand enters base and derived class constructors, soclass extends Error/Array/Promise/Mapwork.DefineMethodis DefinePropertyOrThrow and names accessors with symbol keys;DefineProp/DefineElemare CreateDataPropertyOrThrow. Constructors, accessors,extends,super, fields, static blocks, private names:tests/classes.rs.CopyDataProperties(object spread, the rest of an object pattern).Map,Set,WeakMap,WeakSet(collections.rs): constructors,Map.groupBy, the iterators, the ES2025 Set methods (union...isDisjointFrom), the upsert proposal'sgetOrInsert/getOrInsertComputed(Test262 at its head tests them). Storage isclazel-js-vm's insertion-ordered table with SameValueZero keys; deleted entries stay as empty places, so an iterator survives deletion as the standard's List does.Reflect(reflect.rs): all thirteen functions,constructwith aNewTarget.Test262
The vendored table (
tests/conformance_builtins.rs, 5,212 tests): 614 -> 701 pass, 0 fail (4,511 expected failures).Spot check from a checkout of
tc39/test262atebf6ae6(the one #299 used; scratch runner, real harness files, sloppy and strict; not committed), before = #299's base, after = this branch:built-ins/Mapbuilt-ins/Objectbuilt-ins/Promisebuilt-ins/Reflectbuilt-ins/RegExpbuilt-ins/Setbuilt-ins/Symbolbuilt-ins/WeakMapbuilt-ins/WeakSetlanguage/expressions/classlanguage/statements/class"unsupported" is a
NotYetof the VM (generators,await,eval,Function, BigInt literals,$262members) or a harness file that needs one.What the failures are: in
language/*/class, 3,406 runs stop atGeneratorStart(generator methods and theyieldtests: the VM has no generators); the rest of the class failures areeval,Proxy,Date, typed arrays, async functions. Inbuilt-ins/Object, 119 failures areDate(the harness), 85Proxy, and about 30 are String exotic objects (a String wrapper has no index properties; materializing them would make every sloppy method call on a long string O(n), so it waits for[[GetOwnProperty]]on the wrapper) and the mappedargumentsobject.Not done
Proxy(every internal method is the ordinary one),WeakRef,FinalizationRegistry; generators and async functions (GeneratorStart,Await);Date; typed arrays;evaland theFunctionconstructor.argumentsobject.clazel-js-syntaxis Tier 0 with a Verus spec of its early errors, so a new rule there is a spec change, not a cheap one; the 29 negative literal tests still parse.Symbol.disposeandSymbol.asyncDispose(newer than the edition).Deviations (all listed in the module headers)
Map/Settables are not compacted (a loop that adds and deletes without end grows a vector; the step budget and heap limit bound it).return 1is aTypeErrorraised byConstructResultinside the constructor's owntry, sotry { return 1 } catch {}can catch it (the standard raises it after the body); 3 Test262 tests.strict arguments.calleeis absent (the%ThrowTypeError%accessor), and the sloppyargumentsobject has no parameter map (both from Phase 7: Promise and the job queue, RegExp's object half, arguments and rest parameters #299).new.targetof a closure is kept in a stack of (frame base, value) pairs in the VM, because the frame header has four slots and none is free; private elements, home objects and instance initializers are tables of the VM keyed by function or object.Verification
cargo xtask verify --changed origin/claude/phase7-integration(rustfmt, clippy, tests, Miri on the changed crates and their dependents with every test under 300 s, Kani, Verus, mutations forclazel-js-vm237/237 killed, conformance) passed every step except the last, which is the known base-branch issue:The missing rows are crates this change does not touch (
docs/STATUS.mdis not edited).CI's full verification has not run on this pull request: the proof jobs wait for approval, so nothing here is "done" in the sense of CLAUDE.md.
clazel-sysis untouched, no tier is raised, no mutation or theorem is removed or relabelled, anddocs/STATUS.md,docs/SPEC-REVIEWS.mdanddocs/SYS-AUDITS.mdare not edited. The ops the class handlers implement were already inops.rsandspec.rs(rule 3: no op was added), sospec.rsandmutations.jsonare untouched.🤖 Generated with Claude Code