4011 Commits
Author SHA1 Message Date
Chris Tate 4d049fbb8c Merge pull request #1850 from vercel-labs/ctate/prepare-v0-4-37aaa7
Prepare v0.4.2 release
v0.4.2
2026-10-22 15:09:47 -05:00
Chris Tate f7ef188d96 Give the sanitized bootstrap seed job swap (#1864) 2026-10-22 14:34:41 -05:00
Chris Tate 5aae5531e0 Give the sanitized bootstrap seed job swap
The sanitized seed compiles the compiler's 700 MB LLVM module with one clang
process under AddressSanitizer. The compile peaks near 14 GB while the Node
process that emitted the module still holds about 6 GB, which exceeds the
runner's 16 GB of memory. The job now enlarges swap to 24 GB before it builds
the seed, as the sanitized emitter job does.
2026-10-22 14:30:37 -05:00
Chris Tate 27bc23b3c2 Include the refreshed optimization profile in v0.4.2 2026-10-22 13:24:44 -05:00
Chris Tate 8d4ee22009 Refresh the native compiler's optimization profile (#1858) 2026-10-22 13:23:05 -05:00
Chris Tate e39ddf3d00 Refresh the native compiler's optimization profile 2026-10-22 13:18:04 -05:00
Chris Tate 9aaebbab25 Prepare v0.4.2 release 2026-10-22 11:14:27 -05:00
Chris Tate 5266cb7cbe Check with tsc-ts 0.0.7 and batch contextual types and signatures (#1844) 2026-10-22 10:50:12 -05:00
Chris Tate eef3471159 Stop asking batch methods the checker server answers as unknown
tsgo has no getContextualTypes or getResolvedSignatures. Each prefetch
asked for them anyway, and a failed chunk was split and retried down to
single nodes, so a tsgo build paid about two failed requests per
prefetched node. The checker facade now remembers a batch method the
server answers with "unknown API method" and asks those queries node by
node from then on.
2026-10-22 10:46:38 -05:00
Chris Tate 5bbf2c97b8 Encode posted records from their fields, and queue a message in one block (#1824) 2026-10-22 10:25:40 -05:00
Chris Tate 08081ca1a2 Encode each field of a posted record completely before the next
A typed record encoded from its field hooks queued a plain-object field on
the visit stack and went on to the next field, so getters on later fields
ran before the properties of earlier ones were read. Node's serializer
finishes each field, nested properties included, before the next.

The record path now drains the visit stack down to where it started after
each field, so properties are read in Node's order. Corpus 7139 posts a
record whose fields hold getter-bearing objects and prints the read order.
2026-10-22 10:22:22 -05:00
Chris Tate 03495c2198 Index dispatch receivers by name instead of testing each one (#1814) 2026-10-22 10:07:29 -05:00
Chris Tate ca579641a4 Index quoted get: and set: method names under their own keys 2026-10-22 10:04:30 -05:00
Chris Tate 44bd4e1d6e Run counters that step beside a counted loop's counter as integers (#1829) 2026-10-22 10:00:28 -05:00
Chris Tate aaedce7b4a Keep a callback's captured scalars in registers in loops that call it (#1818) 2026-10-22 09:59:36 -05:00
Chris Tate b82c70d5de Bound a follower's trip count only by a safe-integer span
The trip count that bounds a follower's range was the driver's span over
its step, computed in doubles. A span above 2^53 - 1 can round down: from
-(2^53 - 1) to below 2^52 - 1 the span 3 * 2^52 - 3 becomes 3 * 2^52 - 4,
so a follower that reaches 2^53 got the range limit 2^53 - 1 and ran as an
unchecked integer. Such a span now bounds no trip count, and the follower
is tested at run time (or the loop is refused when every value is known).
Below it the quotient rounds to at least its floor, and the follower's
products and sums are exact within the safe range.
2026-10-22 09:56:19 -05:00
Chris Tate cd2b1e2574 Keep callback loop versions from nesting
A callback loop version emits its loop twice. A loop inside either copy
could be versioned again, so a nest of loops that each call a callback
built just before them (`const g = adder(i)`) doubled at every level: a
three-deep nest was emitted seven times per function.

A loop inside a callback version, or the versioned loop itself emitted
again for each copy, is no longer versioned, so a loop nest is emitted at
most twice. The outer loop keeps its version; inner loops keep their
calls as they are.
2026-10-22 09:55:01 -05:00
Chris Tate 0ec1d47b4d Build typed 'message' listener parameters from the message (#1813) 2026-10-22 09:51:04 -05:00
Chris Tate ddf7eb8a2b Check with tsc-ts 0.0.7 and batch contextual types and signatures
tsc-ts 0.0.7 answers getContextualTypes and getResolvedSignatures, so
NODE_BATCH_QUERIES is on: lowering asks the checker for the contextual
types of identity-flow sites, array literals and conditionals, and the
resolved signatures of calls, in batches instead of node by node.

The release-age exclusions move to tsc-ts 0.0.7 and its platform
packages, and add @scriptc/threads 0.4.1, which tsc-ts 0.0.7 depends on.
2026-10-22 09:50:32 -05:00
Chris Tate 8487742019 Read the shared decoded value after an untyped listener, and skip discriminated unions
- Once a 'message' listener without a typed entry has decoded the
  message, the listeners after it read that decoded value, so a typed
  listener sees what an earlier untyped listener changed, as in Node.
- A union with a literal discriminator gets no typed message entry: its
  checked conversion also tests the discriminator, which the message
  readers do not.

Corpus 7361 checks a typed listener after an untyped one that changes
the message, and a listener on a discriminated union.
2026-10-22 09:48:41 -05:00
Chris Tate a020e8ea6c Name source files relative to the entry's directory in structural positions (#1840) 2026-10-22 09:45:58 -05:00
Chris Tate b80baf92ef Filter regex start positions by their leading character sets (#1784) 2026-10-22 09:45:21 -05:00
Chris Tate 279cdcffae Name source files relative to the entry's directory in structural positions
Structural positions started with a file's absolute path, so lowered
names (closures, recursive records and unions, and every name keyed by a
type that holds one) changed with the directory the program was compiled
in. Union arms are ordered by their types' keys, so a program compiled in
a new temporary directory could also get its union arms in another order.
union-retype.test.ts compiles each program in a fresh temporary
directory, and in about one run in ten the arms of the visitor's unions
came out in an order where no retag keeps its tags, which failed "lowered
identity retags share the box".

Positions now name a file by its path relative to the entry's directory
(default library files keep their base name), so the same program gets
the same names wherever it sits.
2026-10-22 09:39:07 -05:00
Chris Tate 8b4333b166 Record the order-parity baseline for the byte-mode chunk fence fixture (#1838) 2026-10-22 09:28:54 -05:00
Chris Tate ed66338cb6 Record the order-parity baseline for the byte-mode chunk fence fixture 2026-10-22 09:25:44 -05:00
Chris Tate 9433c2ad35 Reuse the class dispatch passes' per-function scans while bodies are unchanged (#1833) 2026-10-22 09:25:09 -05:00
Chris Tate 0318671352 Reuse the class dispatch passes' per-function scans while bodies are unchanged 2026-10-22 09:17:49 -05:00
Chris Tate 60c51b9535 Merge main 2026-10-22 09:08:21 -05:00
Chris Tate 90d74a3193 Finish bailed speculative iterations outside the ordinary loop copy (#1823) 2026-10-22 08:57:41 -05:00
Chris Tate 142e10a0c4 Run counters that step beside a counted loop's counter as integers
`for (let i = 0, p = 0; i < count; i++, p += 4)` kept both counters as
doubles: the counted-loop match takes a single declaration and a single
update. A counted loop now also accepts further counters declared in its
head and stepped by a constant in its update, when the condition does not
read them and the body does not write them. On body entry k such a counter
holds `start + step * k`, so its range follows from the driver's: k is at
most the driver's span over its step.

When that range can pass 2^53, the versioned loop tests
`|start| + |step| * span / |driver step| <= 2^52` at run time, and an
unproven start is tested for an exact safe integer, as the driver's is.
Nested update blocks (`i++, j += 2, k--`) are flattened. Byte windows and
dense loops still take only single-counter loops.
2026-10-22 08:55:08 -05:00
Chris Tate 6e75e59f75 Check each speculative site of a loop in the third-copy emission test
Since dense-array loops bounded by an invariant limit are versioned, the
test's loop has a speculative site in each dense copy. The test paired
every resume point with the first site's labels; it now checks each
site's resume points against that site's third and fast copies.
2026-10-22 08:52:18 -05:00
Chris Tate 8db39e6c63 Fence non-Buffer chunk parameters on byte-mode stream callbacks again (#1810) 2026-10-22 08:40:52 -05:00
Chris Tate 2f3e25b431 Accept Buffer-compatible chunk annotations and keep super(undefined) in byte mode 2026-10-22 08:35:56 -05:00
Chris Tate d41e5c45e1 Version typed-array loops whose index adds an unranged invariant term (#1822) 2026-10-22 08:34:17 -05:00
Chris Tate 74c7c4b1ac Merge main 2026-10-22 08:31:12 -05:00
Chris Tate d406f633bd Keep the receiver index within what the native frontend lowers
The receiver index read its methods or members table by a computed key and
iterated generic method names through `?.keys() ?? []`. The native frontend
refuses dynamic keyed reads of records and cannot convert the iterator-or-array
union, so the complete frontend no longer lowered. The table is now selected
with a conditional and the generic method names are iterated under a check.
2026-10-22 08:18:18 -05:00
Chris Tate fbb4fbc5b0 Encode posted records from their fields, and queue a message in one block
postMessage of a typed record boxes it as a live record capsule, and the
message encoder materialized the capsule's checked-dynamic view to read
it: it built the view object, listed its own keys, tested each one for
enumerability and read it back, then released the view and the key list.
On an object-only run of bench/channel-messages that was about half of
the encode time.

- A live record capsule whose view was never created (no undeclared
  properties, no writes through an untyped view) now encodes from the
  record's field hooks (ScrDynTypedRecordOps), which answer exactly the
  view's keys, order and boxed values. Nested records encode the same way
  to a depth of 32, then through their views as before. Capsules with a
  view, published values, and every other value encode as before.
- The mail event that carries a message lives in the message's block, so
  a queued message is one allocation instead of two.

Corpus 7139 and 7360 post typed records on a MessageChannel and between a
worker and the main thread: optional fields, nested records, a record
reached twice, a chain deeper than the recursion limit, a parsed record
with undeclared keys, and a function-valued field.
2026-10-22 08:07:37 -05:00
Chris Tate e4a9940e5b Finish bailed speculative iterations outside the ordinary loop copy
A speculative integer loop's failed check used to continue at the failed
statement inside the ordinary copy. That gave the ordinary copy a second
entry, so LLVM saw an irreducible cycle and did not hoist its invariant
loads or keep its values in registers. A loop whose check fails on every
entry, such as an inner loop over fractional fields, then ran every
iteration in that unoptimized copy.

A failed check now continues in a third copy that is entered only from the
fast copy: it re-executes the failed statement, the rest of the body and
the update, then jumps to the ordinary copy's header. The ordinary copy has
a single entry and stays a natural loop.

Each loop site also counts its entries in a row whose fast copy bailed. A
fast copy that completes a speculated write and leaves the loop clears the
count, and after 8 bailing entries in a row the site runs the ordinary copy
only. The count is a hint, read and written with unordered atomics: both
copies give the same results.
2026-10-22 08:07:12 -05:00
Chris Tate 866c0bfea5 Version typed-array loops whose index adds an unranged invariant term
A row-major dot product, `const base = r * cols; for (let j = 0; j < cols;
j++) s += w[base + j] * v[j]`, kept one index test per `w` read: the
typed-array loop version guard covered an index `k * counter + terms + c`
only when every loop-invariant term had a proven integer range, and `base`
has none when `cols` is a parameter.

The guard now also accepts a pure loop-invariant term without a proven
range. It evaluates the term once and requires an exact integer (not -0)
between -2^32 and 2^32, then checks the first and last index as for any
affine index. In the fast copy the term has that range, so the index is
integer arithmetic and the reads take no index test. Any other value runs
the checked copy.

Adds a Float32Array matrix-vector product with four accumulators per row
to the typed-array-kernels workload.
2026-10-22 08:05:45 -05:00
Chris Tate f0c48e1b39 Bound compiled regex reads by the characters left in the subject
The 16-character searches (the first-character search, the start filter
and greedy class loops) and literal runs checked `i + n <= len` in 32-bit
arithmetic. Subjects may be up to 2^31 - 2 characters, so near that length
the sum wrapped negative, passed the check and read past the subject. Each
check now compares the characters left (`len - i`, which cannot wrap)
with the characters it reads, and advances the position only after it
passes.
2026-10-22 08:03:32 -05:00
Chris Tate a023c43410 Keep the handle tags in name order and update two tests for current main (#1811) 2026-10-22 07:47:32 -05:00
Chris Tate 6e6267934d Report JSX-lowered files to the checker server as changed (#1817) 2026-10-22 07:46:17 -05:00
Chris Tate 906f9911a1 Keep a callback's captured scalars in registers in loops that call it
A call through a binding that the constant-callback census resolves
keeps a fallback through the closure's code pointer. In a loop that
fallback is an unknown call that takes the closure, so the closure's
code pointer, its captures and a captured `let` were reloaded, and the
`let` stored back, on every iteration of `let s = 0; a.forEach((v) => {
s = (s + v) | 0; })`.

A for, while or do-while loop that calls such a binding now tests once,
before the loop, that the binding's closure has the known code pointer.
The copy where the test holds calls the function directly with no
fallback, and the other copy is the ordinary loop. A closure's code
pointer is set only when the closure is built and the census resolves
only bindings the function never rebinds, so one test covers the loop.
Only bindings declared before the loop qualify, and loops are versioned
up to a size bound.

Number and boolean box payloads get an alias category of their own, so
a store to a captured `let` no longer aliases element loads and other
memory in the loop. With the closure built in the caller, the test folds
after inlining and the captured `let` stays in a register.
2026-10-22 07:45:48 -05:00
Chris Tate 21c4359540 Merge main 2026-10-22 07:44:22 -05:00
Chris Tate bcd849a149 Version dense array loops bounded by an invariant limit (#1816) 2026-10-22 07:42:33 -05:00
Chris Tate c297971f13 Report JSX-lowered files to the checker server as changed
The program the lowering compiles serves each file that has JSX at its
own path, with the JSX rewritten to calls (host.addVirtualFile). The
host reported such a path to the checker server as created whenever it
was not virtual yet. The files exist on disk and the server had already
read them for the program that checks them as written, so tsgo kept
their original text, and lowering met the JSX syntax: SC1090 "syntax
'JsxFragment' is not supported yet" in 6822, 6824 and 6825 under
SCRIPTC_CHECKER=tsgo, while tsc-ts reread the files.

A virtual file that replaces a file on disk is now reported as changed,
and both checkers give the same LLVM IR and diagnostics for the JSX
corpus programs.
2026-10-22 07:41:13 -05:00
Chris Tate 3800a7d311 Version dense array loops bounded by an invariant limit
A counted loop whose limit is an invariant value other than the array's
length, such as `j < n` after `const n = a.length`, gets the same fast copy
as a loop to `a.length`: one test before the loop bounds the limit by
2^31 - 1 and by each indexed array's hole-free prefix, for every array the
loop provably never resizes, and the fast copy reads those slots directly.

The length proof accepts number and boolean writes to class fields, which
run no user code, and borrowed element reads in a fast copy load the slot
without the prefix test or the runtime call. The fast copy's loop body may
hold up to 160 IR nodes.
2026-10-22 07:37:58 -05:00
Chris Tate 92fb038be5 Support WebCrypto wrapKey and unwrapKey (#1800) 2026-10-22 07:26:29 -05:00
Chris Tate d4c5893f1b Answer binary requests in the literal-values test transport (#1815) 2026-10-22 07:23:13 -05:00
Chris Tate e6115f87e8 Merge main 2026-10-22 07:22:32 -05:00