Commit Graph
6750 Commits
Author SHA1 Message Date
Chris Tate 5e624865b5 Merge main 2026-10-22 23:27:30 -05:00
Chris Tate ebefb8d208 Merge main 2026-10-22 23:23:00 -05:00
Chris Tate 6134dc4c89 Run two-counter while loops as two-counter for loops 2026-10-22 23:20:40 -05:00
Malte Ubl 313936fb9c Merge remote-tracking branch 'origin/ni/i10-js-island-requires' into tmp-merge 2026-10-22 21:15:07 -07:00
Malte Ubl d6df00635a Merge remote-tracking branch 'origin/ni/i9-recorded-deferral' into tmp-merge 2026-10-22 21:15:03 -07:00
Malte Ubl 63598a816d Merge remote-tracking branch 'origin/ni/i8-exit' into tmp-merge 2026-10-22 21:14:58 -07:00
Malte Ubl 4046d0a448 Merge remote-tracking branch 'origin/ni/i7-routing' into tmp-merge 2026-10-22 21:14:54 -07:00
Malte Ubl 18120bdc0d Merge remote-tracking branch 'origin/ni/i6-subclasses' into tmp-merge 2026-10-22 21:14:49 -07:00
Malte Ubl 087cce7793 Merge remote-tracking branch 'origin/ni/i5-shared-modules' into tmp-merge 2026-10-22 21:14:44 -07:00
Malte Ubl dee84facad Merge remote-tracking branch 'origin/ni/i4-deferred' into tmp-merge 2026-10-22 21:14:40 -07:00
Malte Ubl 7ed1abdbb8 Merge remote-tracking branch 'origin/ni/i3-exports' into tmp-merge 2026-10-22 21:14:35 -07:00
Malte Ubl f7f1228d41 Merge remote-tracking branch 'origin/ni/i2-handles' into tmp-merge 2026-10-22 21:14:30 -07:00
Malte Ubl c7260ddee7 Merge remote-tracking branch 'origin/ni/i1-stack-bound' into tmp-merge 2026-10-22 21:14:26 -07:00
Chris Tate da289bb593 Support writev on Transform and PassThrough, and runtime stream option values 2026-10-22 23:13:49 -05:00
Chris Tate acb31f7144 Dispatch String-only method names on untyped receivers by runtime kind (#1926) 2026-10-22 23:06:28 -05:00
Luis Alvarez D 04583b419f Merge branch 'main' of https://github.com/vercel-labs/scriptc into spli-commonjs-require-bindings 2026-10-22 23:05:49 -05:00
Luis Alvarez D c009b582e2 Support split CommonJS require bindings 2026-10-22 23:05:28 -05:00
Chris Tate 608c6202d4 Spread untyped iterables into Math.min and Math.max (#1928) 2026-10-22 23:02:05 -05:00
Chris Tate ac3cb1c98f Merge main 2026-10-22 22:59:19 -05:00
Chris Tate 7d424368ce Dispatch splice on arrays of unknown elements (#1935) 2026-10-22 22:57:55 -05:00
Malte UblandClaude Opus 5.5 aad6823099 Node islands: run the hosted loop's scheduling entries on Node's stack
The hosted loop's scheduling entries (a tick, a timer or an immediate goes
through the bootstrap's helpers; a checkpoint drains ticks and microtasks)
and island process-event listeners called the bridge on whatever stack the
runtime was on: the main thread's for the first checkpoint, or an async
fiber's. JavaScript then ran there, and a collection it triggered failed
V8's "Check failed: isolate_->IsOnCentralStack()" (node-island-handles,
about 1 run in 15 sanitized: promise reactions run by the first checkpoint
on the main stack allocated a microtask). They now run on Node's stack like
every other entry, below the mark when they come from a fiber.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 20:56:21 -07:00
Chris Tate fc31dd5060 Enumerate each record in the key order its object literal wrote 2026-10-22 22:56:12 -05:00
Chris Tate e3e955eda0 Register Math.min and Math.max spreads as generator steps
dyn.mathFold steps the iterator of an untyped iterable, so the generator
dispatch pass now counts it among the runtime entry points that step
iterators. A generator whose only consumer is Math.min or Math.max then has
its step hooks registered, and the spread folds its values instead of
throwing "Reading this native iterator result has no lowering".
2026-10-22 22:55:26 -05:00
Chris Tate 4dce87dbcb Name the compiler's own shim files independently of the install path (#1941) 2026-10-22 22:51:57 -05:00
Chris Tate 0624d34786 Merge main 2026-10-22 22:50:18 -05:00
Malte UblandClaude Opus 5.5 dd770477b0 Format the boundary harness test
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 20:47:13 -07:00
Chris Tate d190edd228 Declare the stream write-with-encoding helper's IrExpr result (#1939) 2026-10-22 22:46:52 -05:00
Chris Tate b161d0be13 Authenticate empty AES-CCM messages in decipher
A CCM decipher skipped its one update() when the data was empty, and
final() accepted when an update had run without failing, so it never
compared the tag. setAuthTag() with any tag of the right length, then
update() with empty data, then final(), succeeded: anyone could forge an
empty message, or one with different AAD or a different declared
plaintextLength, without the key.

A decipher's update() now runs the authenticated decryption for empty
data too. As in OpenSSL, the tag covers the nonce, the AAD and the
length, so the right tag still opens an empty message and any other
tag, AAD or length fails in final() with "Unsupported state or unable to
authenticate data". final() succeeds only after a tag comparison has
succeeded. A cipher's empty update() is unchanged.
2026-10-22 22:46:00 -05:00
Chris Tate 1e4889bebe Declare the stream write-with-encoding helper's IrExpr result 2026-10-22 22:44:30 -05:00
Chris Tate 1171109012 Check with tsc-ts 0.0.8 on every platform (#1937) 2026-10-22 22:41:35 -05:00
Chris Tate b40f268c35 Build the native compiler again (#1938) 2026-10-22 22:41:11 -05:00
Malte UblandClaude Opus 5.5 0b969479c3 Build fresh literals a JavaScript callee may reshape as plain objects
A fresh TypeScript data literal passed to a checked-dynamic slot became a
typed view whose record layout requires every property, so a JavaScript
callee deleting one (zod 4's `normalizeParams` deletes `params.message`
from `.refine(fn, { message })`) threw "Cannot delete property". When
the callee is implemented in JavaScript (a call through an untyped value,
an untyped parameter of a JavaScript function, or a non-library `.d.ts`
signature whose parameter is untyped or makes one of the literal's
properties optional), the literal has no typed alias and is now built as
the plain object the callee receives. Standard-library and TypeScript
callees, and literals with methods or accessors, keep their native
storage.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 20:40:40 -07:00
Chris Tate 1e35b1c56c Build the native compiler again
The self-hosted compiler spreads only known record shapes and tests a
value against null with == or != only as a plain read (SC1090).
rewriteCandidates in int32-arrays.ts spread whole IR statement and
expression unions: each spread now names one kind. The loop and block
cases spread per kind, the hoisted read and sequence rewrites narrow with
an if, switch cases spread through a typed helper, and the inlined
ternary, a fresh copy, takes the call's location directly. The checked
int32 array test in int32-slots.ts binds the range it reads first.
2026-10-22 22:36:34 -05:00
Chris Tate f030e5ad44 Check with tsc-ts 0.0.8 on every platform
tsc-ts 0.0.8's API server serves on the named pipe the Node host
connects over on Windows (tsc-ts --api --pipe), and the native compiler
already starts it over its standard streams there, so tsc-ts is the
default checker on every platform. SCRIPTC_CHECKER=tsgo still selects
tsgo.

The compiler depends on tsc-ts 0.0.8, which the release-age exclusions
admit with its platform packages and @scriptc/threads 0.4.2.

The Windows CLI smoke test runs with both checkers, and
verify-native-cli.mjs --run checks that a distribution's tsc-ts runs on
its platform (tsc-ts.exe on Windows).
2026-10-22 22:36:11 -05:00
Malte Ubl bb28b57063 Merge commit '4f801f1b39285271a755fb6016926a3815f46cac' into HEAD
# Conflicts:
#	packages/runtime/src/scr_node_island_handle.c
2026-10-22 20:32:53 -07:00
Malte Ubl 4f801f1b39 Merge remote-tracking branch 'origin/ni/i9-recorded-deferral' into HEAD 2026-10-22 20:32:37 -07:00
Malte Ubl 5f0941fd5c Merge remote-tracking branch 'origin/ni/i8-exit' into HEAD 2026-10-22 20:32:21 -07:00
Chris Tate 7b9ac8d5bb Merge main 2026-10-22 22:26:04 -05:00
Malte Ubl 02e499f434 Merge remote-tracking branch 'origin/ni/i7-routing' into HEAD
# Conflicts:
#	packages/libnode-common/bridge/scr_node_bridge.cc
2026-10-22 20:26:01 -07:00
Malte Ubl 5695f91291 Merge remote-tracking branch 'origin/ni/i6-subclasses' into HEAD 2026-10-22 20:25:37 -07:00
Malte UblandClaude Opus 5.5 9a452b8129 Keep replaceable method results that have no dynamic form native
A method whose name an untyped write can replace is called through the
instance's property lookup: a ternary between the dynamic call of an
installed replacement and the native call, both boxed into a dynamic
value and converted back to the method's result type. A result with no
dynamic form, such as an Iterable<T> (its generator arm does not box),
stayed unboxed in the dynamic ternary, which failed IR validation with
"ternary else-branch: expected dyn, got union". Methods of generic class
instantiations always take this path once any write can replace their
name, because their prototype data is not modeled, so importing zod
(whose JavaScript has unknown-key writes) broke every such call.

Such a result now keeps its native type: the native call's value is used
as it is, and only a replacement's dynamic result takes the checked
conversion into the result type. Results that box are lowered as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 20:24:18 -07:00
Chris Tate 97921c2764 Read and write Error.stackTraceLimit through the Error constructor value (#1932) 2026-10-22 22:21:42 -05:00
Malte Ubl 267eb7444e Merge remote-tracking branch 'origin/ni/i5-shared-modules' into HEAD
# Conflicts:
#	packages/compiler/src/backend/llvm/lib-shared.ts
#	packages/compiler/src/ir/builtin-signatures.ts
2026-10-22 20:19:46 -07:00
Malte Ubl b66a1104fe Merge remote-tracking branch 'origin/ni/i4-deferred' into HEAD
# Conflicts:
#	packages/compiler/src/backend/llvm/lib-shared.ts
#	packages/compiler/src/ir/builtin-effects.ts
#	packages/compiler/src/ir/builtin-signatures.ts
#	packages/libnode-common/bridge/scr_node_bridge.cc
2026-10-22 20:19:15 -07:00
Malte Ubl 05f7696eed Merge remote-tracking branch 'origin/ni/i3-exports' into HEAD 2026-10-22 20:18:50 -07:00
Malte UblandClaude Opus 5.5 a8285c756b Clone native data in islands and copy island arrays of plain values
structuredClone in an island of a value holding native records, class
instances or objects (interceptor objects V8's serializer cannot clone)
clones a plain copy of that data, as Node clones the objects themselves.
An island array of primitives or strings (or arrays of those) returned
directly or through a promise crosses as a copy, which the checked cast
then meets, instead of failing the cast as an object handle.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 20:18:17 -07:00
Chris Tate 143f2e11e9 Keep an own stackTraceLimit on the Error value ahead of the limit 2026-10-22 22:15:57 -05:00
Malte UblandClaude Opus 5.5 9ab876faa9 Compile the @hono/node-server shim under any program's stream types
The shim compiles inside each program that imports the package, and under
some lib and @types/node settings ReadableStreamReadResult<Uint8Array>
lowered as unknown while reader.read() produced a record, so the
buffered-read path refused (SC2003). The shim spells out its read-result
record and types the body reader.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 20:15:30 -07:00
Chris TateandQuino Terrasa 84eba88276 Convert typed arrays to BigInt through their element text
BigInt(typedArray) compiled in JavaScript but stopped at run time with
SC2020. Node converts the typed array through ToPrimitive to its elements
joined with "," and parses that text: one element reads as its value, an
empty array as 0n, and several elements, fractions, NaN, Infinity or an
exponent form throw the SyntaxError for the joined text.

- BigInt of a typed array lowers to bigint.parse of its "," join, the same
  conversion Node performs.
- A union whose arms are typed arrays and other BigInt sources dispatches
  each typed-array arm the same way.

Corpus 7403 covers every supported element kind, negative and clamped
values, float formatting (2 ** 60 reads through its shortest decimal
text), empty arrays and views, the SyntaxError cases and results in
arithmetic, and matches Node.

Refs #1647

Co-authored-by: Quino Terrasa <26749475+espetro@users.noreply.github.com>
2026-10-22 22:13:46 -05:00
Chris Tate 75cf8f0e52 Run zod 4's core constructor factory in the dynamic tier (#1918) 2026-10-22 22:08:46 -05:00