Commit Graph
2502 Commits
Author SHA1 Message Date
Chris Tate f3a0858a5a Use the runtime's rounding and libm definitions in musl executables (#2614) 2026-10-30 08:04:48 -05:00
Chris Tate d404610842 Read SharedArrayBuffer, DataView, BigInt64Array, BigUint64Array, Proxy and Intl as values (#2620) 2026-10-30 07:23:58 -05:00
Chris Tate 353d8533ea Validate untyped listen ports and give net errors Node's system properties (#2619) 2026-10-30 07:18:37 -05:00
Chris Tate ce2e6624ff Check http.request options as Node does (#2606) 2026-10-30 07:16:38 -05:00
Chris Tate 4610fe32be Read SharedArrayBuffer, DataView, BigInt64Array, BigUint64Array, Proxy and Intl as values
SharedArrayBuffer, DataView, BigInt64Array, BigUint64Array and Proxy read
as values are interned constructor values with Node's name and length.
Calling one throws Node's TypeError "Constructor X requires 'new'".
instanceof through a stored value answers as Node does: SharedArrayBuffer
and DataView test the value's kind, BigInt64Array and BigUint64Array answer
false (neither is constructed), and Proxy answers false for a primitive and
throws Node's TypeError for an object.

Intl read as a value is a namespace object with Node's 12 members in
Node's order. Its members are function values that throw the SC1090 fence
when called; direct calls such as new Intl.NumberFormat("en-US") keep
their lowerings.

TypeScript sources read the same values into any and unknown slots, so
the diagnostics program uses Atomics for a builtin without a value.
2026-10-30 06:30:40 -05:00
Chris Tate f1e4311881 Check the request path and method before a socket is opened
http.request runs the ClientRequest constructor's path and method checks
before it calls a createConnection option, takes a pooled socket or dials
a socketPath, as Node does. Before, the createConnection callback had
already run, and a socketPath server had seen a connection, when the
check threw ERR_UNESCAPED_CHARACTERS or ERR_INVALID_HTTP_TOKEN.
2026-10-30 06:16:58 -05:00
Chris Tate a54dd09e04 Validate untyped listen ports and give net errors Node's system properties 2026-10-30 06:14:57 -05:00
Chris Tate 50b9976483 Use the runtime's rounding and libm definitions in musl executables
floor, ceil and trunc in a musl executable came from zig's libc as weak
bit-manipulation routines, and the runtime's date arithmetic and the
compiler's rounding intrinsics call them. scr_glibc_math.c now applies to
musl executables too: floor, ceil, trunc, round, sqrt, fmod, scalbn,
ldexp and frexp are the same exactly specified definitions as on glibc.
A static musl executable has no ifunc, so on x86_64 floor, ceil and trunc
call through a pointer that their first call sets to the SSE4.1 rounding
instruction when the CPU has it. Library artifacts keep the embedder's
libm.

Adds a test that builds the same program against glibc's libm and, for
x86_64-linux-musl, against these definitions, and compares every result.
2026-10-30 04:28:03 -05:00
Chris Tate 5a95e8a076 Compile scr_intl.c with the ICU headers in the COMMON-symbol test
common-symbols.test.ts compiles every runtime source with the vendored
include paths only. scr_intl.c includes ICU's C API headers, which the
runtime pack build takes from the fetched ICU release, so on a host
without system ICU headers both of the test's compiles failed with
"'unicode/ubrk.h' file not found", and the aarch64-macos compile failed
on every host. The test now passes the same source/common and
source/i18n include paths for scr_intl.c, through icu-data.mjs's
ensureIcuSources.
2026-10-30 03:43:48 -05:00
Chris Tate 5a70967a0e Read inherited keys in assert.throws with a shared expected object
assert.throws and assert.rejects with an expected object held in a
variable compare each key with the thrown error's own or inherited value,
as Node's `key in actual` check does. An error's name is on its
prototype, so { name, message, code } failed against every error.
2026-10-30 02:55:44 -05:00
Chris Tate 0ad917929e Check http.request options as Node does 2026-10-30 01:51:42 -05:00
Chris Tate 13c5fc6748 pi wave 5: node process APIs, stdlib singletons, misc lowering (#2548) 2026-10-30 01:00:51 -05:00
Chris Tate 8e07b89461 Keep typed records unboxed in object-mode streams (#2601) 2026-10-30 00:41:54 -05:00
Chris Tate 8a5d2e14a2 Match Node's socket encodings, rejected writes and event loop liveness (#2599) 2026-10-30 00:09:13 -05:00
Chris Tate c36c5d99ce Support non-Error 'error' payloads and checked-dynamic listeners in listeners() and meta events (#2586) 2026-10-30 00:04:33 -05:00
Chris Tate e36a442468 Throw for primitive Reflect.has targets, record isRaw, and match StringDecoder chunks
Reflect.has over a target held as any, unknown or a union answered a
presence result for a primitive. It now checks the target at run time
after both arguments are evaluated and throws Node's TypeError
("Reflect.has called on non-object"). The stdlib-fence snapshot no
longer lists Reflect.has, which lowers.

process.stdin.isRaw read a flag that only the dynamic setRawMode path
set, so a direct process.stdin.setRawMode(true) on a TTY left it false.
The flag now lives with scr_process_stdin_set_raw_mode, which every
path calls, readline's raw mode included.

StringDecoder.end(chunk) with a dynamic chunk that is undefined threw
ERR_INVALID_ARG_TYPE. It now only flushes, as Node's end skips the
write for undefined. A dynamic ArrayBuffer or SharedArrayBuffer chunk
decoded its contents; write and end now throw Node's
ERR_INVALID_ARG_TYPE for it, as it is not an ArrayBufferView.
2026-10-29 23:59:44 -05:00
Chris Tate bcda45ab7f Merge main 2026-10-29 23:58:03 -05:00
Chris Tate 2353a04540 Keep typed records unboxed in object-mode streams 2026-10-29 23:46:36 -05:00
Chris Tate e6cea05db9 Ship ICU data without the categories no Intl form reads (#2598) 2026-10-29 23:29:51 -05:00
Chris Tate f67678b422 Pipe decoded socket strings and give lane jobs their own tmpdirs
After socket.setEncoding(enc), socket.pipe(destination) wrote the raw
bytes it read to the destination. It now writes the decoded strings, as
Node's pipe writes each string chunk: the destination receives their
UTF-8 bytes, and a partial character the decoder holds at EOF is written
before the destination ends.

tests/node-parallel/run.mjs runs each job's files with its own
TEST_THREAD_ID, as Node's test runner does, so test/common/tmpdir gives
concurrent files different directories instead of one shared .tmp.0.
2026-10-29 23:16:13 -05:00
Chris Tate 2cc51b1427 Reject import() of unresolvable specifiers with Node's ERR_MODULE_NOT_FOUND (#2563) 2026-10-29 22:35:34 -05:00
Chris Tate d80b34d92d Match Node's socket encodings, rejected writes and event loop liveness 2026-10-29 22:18:16 -05:00
Chris Tate 902e8b4396 Ship ICU data without the categories no Intl form reads
The runtime pack shipped ICU's full icudt78l.dat (33.1 MB), and every
Intl executable gets a copy beside it. scr_intl.c answers its Intl forms
with ICU's break iterators, number and date formatters, calendars and
locale IDs, which never read the charset converters or the collation,
language, region, time zone name, unit, spell-out and transliterator
trees: 21.5 MB of the file.

- The pack build writes icudt78l.dat without those items
  (ICU_DATA_DROPPED in icu-inputs.mjs). filterIcuData rewrites the data
  file's table of contents to the remaining items, and the result is
  checked against a pinned sha256 and size (11,653,984 B).
- tests/harness/icu-data-filter.test.ts runs every @requires-icu corpus
  program under 47 locales and 3 time zones with the pack's data, with
  the full data and in Node, and fails when the outputs differ, so an
  Intl form that reads a dropped category fails there.
- intl-word-segmenter-dictionaries.ts segments Chinese, Japanese, Thai,
  Lao, Khmer and Burmese text, which ICU breaks with the dictionaries in
  brkitr/.
2026-10-29 22:17:47 -05:00
Chris Tate 6a05a2588f Merge main 2026-10-29 21:25:26 -05:00
Chris Tate 2a1f7ac212 Give class methods and function values jsval entries for untyped calls (#2543) 2026-10-29 21:17:19 -05:00
Chris Tate 919151d339 Lower partial record assertions to record views (#2555) 2026-10-29 20:56:21 -05:00
Chris Tate d4c6aee135 Merge main 2026-10-29 20:04:10 -05:00
Chris Tate 794ede51db Read the callee before the arguments in calls through untyped receivers (#2510) 2026-10-29 19:53:04 -05:00
Chris Tate 48dd898db6 Support non-Error 'error' payloads and checked-dynamic listeners in listeners() and meta events 2026-10-29 19:16:06 -05:00
Chris Tate e62348d849 Copy record sources field by field in Object.assign onto a live record 2026-10-29 16:46:35 -05:00
Chris Tate 7b27410698 Intl over ICU 78.3: Segmenter (grapheme, word) and default-locale toLocaleString (linux-x64-gnu) (#2504) 2026-10-29 16:42:38 -05:00
Chris Tate 78dbd98b1a Merge main 2026-10-29 16:39:31 -05:00
Chris Tate fb9499c846 Keep timer deadlines on macOS and re-arm intervals as Node does
The event loop slept to its next timer with nanosleep. macOS applies the
timer slack of the thread's QoS class to nanosleep: a 5 ms sleep takes
about 38 ms at utility QoS and 180 ms at background QoS, where launchd
services such as CI jobs run. Timers then fired out of order against
Node, whose libuv loop waits with a kevent timeout that keeps its
deadline at every QoS. On macOS the loop now sleeps with a kevent timeout
on a kqueue with no events, shared by every thread's loop.

Intervals also re-arm from the time their callback started, as Node's
listOnTimeout does, instead of from the clock after the callback: a
callback that takes 30 ms of a 50 ms interval keeps the ticks 50 ms
apart, and one slower than the interval makes the next tick due on the
next turn. interval-slow-callback.ts checks both against Node.
2026-10-29 16:11:17 -05:00
Chris Tate 3cd2f97c7c Ignore SIGPIPE and SIGXFSZ in executables, as Node does (#2578) 2026-10-29 16:05:14 -05:00
Chris Tate 21b919cad7 Use SSE2 and string-instruction memory routines in x86_64 musl executables (#2576) 2026-10-29 16:02:07 -05:00
Chris Tate e3a42c52a8 Ignore SIGPIPE and SIGXFSZ in executables, as Node does
Node sets SIGPIPE and SIGXFSZ to SIG_IGN at startup, so a write to a
closed pipe or past RLIMIT_FSIZE fails with EPIPE or EFBIG, and libuv's
spawns start children with every signal at its default action. The
runtime instead blocked both signals in the writing thread. On Linux the
signal a write raises goes to that thread, but on macOS it goes to the
process, so a write to a closed pipe from the fs pool's threads ended the
program with SIGPIPE.

- scr_init ignores SIGPIPE and SIGXFSZ. A process.on listener replaces the
  disposition while it is registered, as before.
- scr_fs_write_once writes directly in executables, and the fs pool's
  threads no longer block the two signals. Library builds keep the
  per-thread blocking, since their host owns the dispositions.
- scr_spawn_command starts children with SIGPIPE and SIGXFSZ at their
  default actions (POSIX_SPAWN_SETSIGDEF), for spawnSync, execFileSync
  and spawn alike.

write-signals-ignored.ts and write-signals-listener.mjs check the ignored
signals, a listener, and each spawn path's child against Node.
2026-10-29 16:00:39 -05:00
Chris Tate 4e67c5ce2c Host stdio: typed process.stdout.write slot, write-callback errors, drain, run-time-typed chunks (#2546) 2026-10-29 15:59:21 -05:00
Chris Tate 7f10ed6d90 Use SSE2 and string-instruction memory routines in x86_64 musl executables
The musl lane links zig's libc, whose memset, memcmp, bcmp and strlen are
byte loops, and whose memcpy and memmove copy without string
instructions. An x86_64 musl executable now defines these six routines
(scr_musl_mem.h): SSE2 for short and medium lengths, and rep stosb or rep
movsb from 2 KiB for memset, memcpy and forward memmove. zig's
definitions are weak, so these replace them. Library artifacts keep the
routines of the program they link into.

Adds a test that checks every length up to 600 and longer ones, every
alignment in a 32-byte window, overlapping moves in both directions,
memcmp's sign at each position, and strlen up to the end of a readable
page, optimized and under ASan and UBSan.
2026-10-29 15:58:15 -05:00
Chris Tate 3b1a2c41b6 Merge main 2026-10-29 15:55:05 -05:00
Chris Tate b507472888 Take from a Readable's buffered queue by moving its head index (#2573) 2026-10-29 15:50:34 -05:00
Chris Tate f1825611fb Collect garbage cycles across the scriptc and V8 heaps (NI-8) (#1908) 2026-10-29 15:33:24 -05:00
Chris Tate 87c8d14510 Test262: String/Number/Boolean wrapper objects in JavaScript sources (#2550) 2026-10-29 15:24:04 -05:00
Chris Tate d972a6bc13 Defer island modules whose recorded load is deterministic (NI-7b/7d/7e/7f) (#1906) 2026-10-29 15:18:28 -05:00
Chris Tate 145f8fcd5e fs.watch names the changed entry; fs.watchFile polls in its own gated unit (#2507) 2026-10-29 15:13:12 -05:00
Chris Tate 03b26a7e8e Stdio write hook: console lines pass (line, errorHandler), byte chunks pass a Buffer (#2511) 2026-10-29 15:12:31 -05:00
Chris Tate dfa940a82d Return freed memory sooner: chunked shared writes, a bounded string spare, idle trims (#2518) 2026-10-29 15:12:10 -05:00
Chris Tate 4458e11a75 Read /proc/self/maps once per glibc thread heap (#2527) 2026-10-29 15:11:09 -05:00
Chris Tate 16f3c16752 Match Node's node:path behavior from Node 24's path tests (#2495) 2026-10-29 15:10:50 -05:00
Chris Tate 7eda6fa880 Trim the per-chunk work of compiled object-mode stream callbacks (#2523) 2026-10-29 15:09:24 -05:00
Chris Tate 4db725e622 Don't offset a null pointer when an array has no dense storage (#2559) 2026-10-29 15:07:27 -05:00