Commit Graph
1439 Commits
Author SHA1 Message Date
Chris Tate 9621b895ce Define new runtime globals with initializers so library localization hides them
scr_cyc_types, scr_str_scan and scr_wtf8_lone were tentative definitions.
The macOS runtime build emits tentative definitions as COMMON symbols, and
Mach-O `ld -r` writes COMMON symbols back out as commons, which
-exported_symbols_list does not demote. Every runtime-localized library
archive therefore defined them next to its declared API, failing the
library-multi M1 and M7 symbol checks on macOS. Linux clang defaults to
-fno-common, so the same declarations were ordinary definitions there and
the checks passed.

Initialize the three globals explicitly, as scr_sa and
scr_stdio_write_hook already are, and add a runtime test that compiles
every runtime source with -fcommon in the plain and worker configurations
and expects no COMMON symbols, so a new tentative definition fails on
Linux too.
2026-10-14 19:48:01 -05:00
Chris Tate f6e9fbe056 Support subclassing EventTarget and Event (#988) 2026-10-14 18:57:20 -05:00
Chris Tate cfe28b7ad1 Move scriptc to Node 24.22.0 (#989) 2026-10-14 18:49:17 -05:00
Chris Tate bb24a37329 Write typed JSON.stringify arrays from their slots and append fixed text inline (#991) 2026-10-14 18:39:51 -05:00
Chris Tate b710e74acb Lower value-position writes to the writable Event accessors
Assignments to returnValue and cancelBubble on a typed Event subclass
receiver lower in value position as well as in statements: an
initializer (`const r = (ev.returnValue = false)`), a call argument, and
a chained assignment write the accessor through event.set and yield the
assigned value. The short-circuit forms (&&=, ||=, ??=) read the
accessor through event.get and write it only on the branch that assigns.
The receiver now evaluates before the assigned value, as in Node.
2026-10-14 18:25:05 -05:00
Chris Tate f7390b4f05 Match Node 24.22 HTTP write coalescing, fetch connection headers and crypto.constants
OutgoingMessage now corks the message for a tick like Node 24.22, so
chunked writes in one tick (and a corked end(chunk)) go out as one chunk,
for server responses and client requests. Fetch accepts a connection
header that is a comma list of tokens, as Undici 7.29.1 does. The
crypto.constants declaration matches the Node 24.22 table, with a pin test.
2026-10-14 18:12:09 -05:00
Chris Tate d2a84e4a41 Write typed JSON.stringify arrays from their slots and append fixed text inline
The emitted JSON writers read each array element through scr_arr_state
and scr_arr_get_ref, retaining and releasing it, and appended every
bracket, comma and key through a runtime call. Arrays whose indices below
the length all hold values now serialize from their slots
(scr_arr_dense_slots) with borrowed elements; other arrays keep the
element walk. Fixed text is stored inline when it fits the buffer's spare
capacity, booleans write their literal inline, and numbers are formatted
directly into the buffer.
2026-10-14 18:05:50 -05:00
Chris Tate 022ac6eba9 Store arrays of interface values natively and read interface fields directly
Arrays whose elements are class-backed interface values are native arrays
of the element capsules, so iteration, indexing and most array methods no
longer go through the checked-dynamic array, and method calls receive a
receiver they can dispatch. Methods without a native form for these
elements run on the array's live dynamic view.

A read of an interface property signature has the property's static type
and reads the field of an implementing class directly. Accessors, object
literals and JavaScript classes keep the checked property read.
2026-10-14 17:38:02 -05:00
Chris Tate 9835ad0d75 Move scriptc to Node 24.22.0
Pin Node v24.22.0 (commit f14cd3aa7bf9, Undici 7.29.1, OpenSSL 3.5.8) in
.node-version, Dockerfile.sandbox, the docs matrix fallback, the
compatibility pin, the fetch profile, and process.version. A node-pin test
checks that these pins agree. The Node compatibility snapshot is
regenerated from the v24.22.0 API docs; the new stream_iter chapter maps
to node:stream/iter, and the SuiteContext rows no longer match the
TestContext evidence.

Runtime and compiler changes follow Node 24.22 behavior:

- fs.read, fs.readSync, and FileHandle.read validate the position before
  the zero-length return.
- fs.statfs results include frsize; Windows reads
  FileFsFullSizeInformation and reports bfree and bavail separately.
- fs.utimes, futimes, and lutimes keep nanosecond precision.
- ServerResponse sets writableFinished where 'finish' is emitted and runs
  end() callbacks before the 'finish' listeners while the socket is still
  attached; a request read to 'end' closes before its response.
- socket.write(string, 'buffer') throws ERR_UNKNOWN_ENCODING.
- URL protocol-setter rejections keep the current URL, the host setter
  no longer leaves a "/." escape when it adds a port to a "//" path, and
  new URLSearchParams(null) parses "null".
- util.stripVTControlCharacters uses Node 24.22's ANSI pattern,
  util.styleText accepts #RGB and #RRGGBB colors, and
  util.types.isDataView has its JS name and length.
- structuredClone and AbortSignal.any use the "cannot be converted to
  sequence" message.
- crypto.getCiphers, getHashes, and constants match Node 24.22.
- dns.lookup, net.connect, and tls.connect throw ERR_INVALID_ARG_VALUE for
  hosts with null bytes.
- fs.readFile validates options.buffer and refuses its valid forms;
  httpValidation and certificateCompression refuse by name.
- url.domainToASCII, url.domainToUnicode, and url.parse hostnames follow
  ada 4.0: ASCII domains are lowercased without checking their xn--
  labels, the RFC 5893 rule checks how LTR labels end and how RTL labels
  start, a Punycode label whose decoded form begins with "xn--" fails, and
  ToUnicode decodes only labels that pass the ToASCII checks. The url
  legacy test cases are regenerated with Node 24.22.

Corpus programs 5275-5279 cover the new behavior. 1640, 2283, 2599, and
3136 are updated where they pinned Node 24.15 output.
2026-10-14 17:27:02 -05:00
Chris Tate 30e291a341 Support subclassing EventTarget and Event
Typed and JavaScript classes can extend the global EventTarget and Event.
%EventTarget and %Event are runtime-provided hierarchy roots like the
EventEmitter: a subclass instance embeds a prefix pointing at the engine
state that super() creates (the target's listener core, the event's
state), and the backend's emitter prefix handling becomes a table of
runtime prefixes that covers all three bases.

The instances' checked-dynamic capsules use the runtime RC adapters, so
the engine recognizes them: a target instance is its listeners' `this`
and its events' target, and an Event subclass instance is the event its
listeners receive, with its own fields and methods. The inherited
methods and accessors lower directly on typed receivers (including
super.dispatchEvent) and answer through the class property dispatch and
the runtime's capsule hooks for checked-dynamic values, with Node's
util.inspect output, @@toStringTag and leak-warning class name. Members
read as values are the prototype's functions, also for plain handles.

A target keeps its own capsule in its state, so repeated dispatches reuse
it; the state and an event's target are traced, so the collector
reclaims targets whose listeners capture them. Subclass members that
spell an inherited member are refused, since the engine would never call
or read them.

Listener objects that are class instances now work: when a program can
register EventTarget listeners and declares a class with a handleEvent
method, %main installs a compiled `listener.handleEvent` reader that the
engine uses at every dispatch, so the class's own, inherited or
overridden method runs with the instance as `this`, as in Node. An
unannotated arrow in an object literal whose contextual type maps to a
checked-dynamic slot or to no lowered type (an EventTarget subclass's
listener union) no longer adopts the void callback slot's return type,
so `{ handleEvent: (e) => n++ }` passed as a listener keeps the result
its record field promises.
2026-10-14 17:18:04 -05:00
Chris Tate 99386913c4 Inline Map/Set iteration steps and skip deleted leading entries (#987) 2026-10-14 17:01:30 -05:00
Chris Tate 90c035adee Add readline/promises, stream.addAbortSignal and the stream/promises options (#983) 2026-10-14 16:11:25 -05:00
Chris Tate 766b564659 Inline Map/Set iteration steps and skip deleted leading entries 2026-10-14 15:17:21 -05:00
Chris Tate ed55fa44d8 Make typed record to unknown conversions cheaper 2026-10-14 14:11:58 -05:00
Chris Tate 63012c09b1 Add readline/promises, stream.addAbortSignal and the stream/promises options 2026-10-14 14:10:43 -05:00
Chris Tate f7a9887709 Add process.memoryUsage, process identity members, and performance marks and measures (#977) 2026-10-14 13:57:47 -05:00
Chris Tate 397290579e Expand dynamic spreads into checked performance argument arrays 2026-10-14 13:16:30 -05:00
Chris Tate f3ace69760 Store scalar-union fields inline in records and objects 2026-10-14 13:02:38 -05:00
Chris Tate f951af1e8f Merge main into process and perf_hooks 2026-10-14 12:46:19 -05:00
Chris Tate 47223bdfaa Use plain wording in docs, comments and test names (#981) 2026-10-14 12:25:43 -05:00
Chris Tate d25fa587ae Add the legacy url API and url.domainToASCII/domainToUnicode (#973) 2026-10-14 12:08:16 -05:00
Chris Tate 5cb25cfcde Lower typed-array sort and toSorted (#980) 2026-10-14 11:48:27 -05:00
Chris Tate 3f8e0bcb13 Use plain wording in docs, comments and test names 2026-10-14 11:43:44 -05:00
Chris Tate 5ef650b5e7 Merge main into the legacy url API 2026-10-14 11:30:47 -05:00
Chris Tate a93c7f4400 Call class methods directly through interfaces (#974) 2026-10-14 11:24:50 -05:00
Chris Tate 23124ccdb0 Lower typed-array sort and toSorted 2026-10-14 11:15:37 -05:00
Chris Tate c7439a179e Read interface methods before arguments another function can assign 2026-10-14 10:55:08 -05:00
Chris Tate 86f77c88e9 Add process.memoryUsage, process identity members, and performance marks and measures 2026-10-14 09:58:18 -05:00
Chris Tate 2852ded748 Add EventTarget to the 0.3.2 changelog 2026-10-14 09:32:40 -05:00
Chris Tate ea7a856329 Add EventTarget, Event and CustomEvent (#966) 2026-10-14 09:29:46 -05:00
Chris Tate 6cc88fbf11 v0.3.2 2026-10-14 09:22:56 -05:00
Chris Tate b22a9a7b59 Build Object.entries natively and walk Object.values directly for unknown values (#975) 2026-10-14 09:04:27 -05:00
Chris Tate 8043da9e06 Merge main into EventTarget 2026-10-14 08:46:13 -05:00
Chris Tate 2c8ea042fd Build Object.entries natively and walk Object.values directly for unknown values 2026-10-14 08:34:53 -05:00
Chris Tate a52394e842 Describe the unsupported Url prototype methods plainly 2026-10-14 08:28:30 -05:00
Chris Tate 7a9d89d611 Call class methods directly through interfaces 2026-10-14 08:21:35 -05:00
Chris Tate bd9a994060 Add the legacy url API and url.domainToASCII/domainToUnicode 2026-10-14 08:10:02 -05:00
Chris Tate 3008f2ff1a Support util.inherits, util.deprecate, util.callbackify and util.debuglog 2026-10-14 08:08:06 -05:00
Chris Tate 48ccbddfec Merge main into EventTarget 2026-10-14 08:03:27 -05:00
Chris Tate 634c5c291a Keep events.errorMonitor out of the string event-name space 2026-10-14 08:00:40 -05:00
Chris Tate 0fe19bd3ed Copy only stable descriptor fields when registering a cycle type (#971) 2026-10-14 07:46:29 -05:00
Chris Tate 9246c45126 Sort by key for recognized numeric comparators (#970) 2026-10-14 07:28:42 -05:00
Chris Tate 619ba3d1c7 Box function-field receivers only when the callee reads this (#961) 2026-10-14 07:14:26 -05:00
Chris Tate 5cfcc0d565 Copy only stable descriptor fields when registering a cycle type 2026-10-14 07:08:55 -05:00
Chris Tate 6fe81f0ce6 Sort by key for recognized numeric comparators 2026-10-14 06:48:48 -05:00
Chris Tate f2d0aa6bb6 Bind the class view of lazily boxed field-call receivers 2026-10-14 06:43:46 -05:00
Chris Tate 688f7bb866 Shrink the cycle-collector object header to 8 bytes (#969) 2026-10-14 06:03:36 -05:00
Chris Tate 6eac0fee3b Read cycle descriptor ids with acquire loads 2026-10-14 05:30:17 -05:00
Chris Tate e932714bfa Shrink the cycle-collector object header to 8 bytes 2026-10-14 04:53:07 -05:00
Chris Tate 4aba593f28 Keep updated and passed-through number objects in frame storage 2026-10-14 04:50:50 -05:00