Commit Graph
5497 Commits
Author SHA1 Message Date
Chris Tate 2d557bc87b Test a scalar optional left of ?? in JavaScript on the typed path (#2345) 2026-10-26 16:54:11 -05:00
Chris Tate 1b2e591a02 Keep the typed ?? path to literal defaults 2026-10-26 16:18:58 -05:00
Chris Tate c5e8a876ec Store ordinary objects as a layout plus value slots (#2353) 2026-10-26 16:18:38 -05:00
Chris Tate 9f47d74e21 Poll the loops of a nest on every iteration in ELF worker executables (#2351) 2026-10-26 16:04:06 -05:00
Chris Tate 4dd32da391 Lower discarded logical expressions over void conditionals as branches (#2356) 2026-10-26 15:56:00 -05:00
Chris Tate bfd3cf2daf Build node:zlib on the zlib Node bundles (#2355) 2026-10-26 15:48:37 -05:00
Chris Tate 301de61915 Read int32-slot arrays at their width in integer clones (#2354) 2026-10-26 15:43:31 -05:00
Chris TateandMathurAditya724 3417a5adc4 Lower a discarded logical over a void conditional as a branch
`skip || (flag ? warnA() : warnB())`, with void calls in both arms, as
React's development warnings write it, failed with SC9001 "ternary must
not be void": the statement lowered the logical as a value, and a
conditional of void calls has none. A logical whose result is discarded
now lowers as `if (!skip) ...` (or `if (skip) ...` for `&&`) when its
right operand needs no value: its type maps to void, or it is a logical
or comma expression whose last operand needs none. This holds in
statements and in a for loop's initializer and update, and for a
generic callback's conditional whose type parameter maps to void.

Closes #2322

Co-authored-by: MathurAditya724 <57684218+MathurAditya724@users.noreply.github.com>
2026-10-26 15:25:52 -05:00
Chris Tate 133551d76e Build node:zlib on the zlib Node bundles
The runtime vendored zlib 1.3.1 and archived it at -Os, and host C-lane
builds linked the system libz, so deflate, raw deflate and gzip output
differed from Node's at every level. The vendored copy is now Node
v24.22.0's deps/zlib (Chromium's zlib, 1.3.2.1-motley-285e94b), built at
-O3 with the units and defines Node's zlib.gyp selects per target: the
SSSE3 Adler-32 and SSE2 inflate and slide-hash code on x86-64, the NEON
and ARMv8 CRC-32 code on arm64, and the portable code on wasm32. The SIMD
units check the CPU at run time and give the same output, so compressed
bytes match Node's on every target.

zlibInputs (runtime-pack-common/scripts/zlib-inputs.mjs for the runtime
packs, vendor-inputs.ts for Zig cross builds and the sanitized runtime)
holds the per-target table, and a unit test keeps the two identical.
Every C-lane driver now links the vendored objects instead of -lz.
Chromium's BSD license ships beside zlib's in the runtime packs.

Corpus 8405 compares compressed bytes with Node across levels,
strategies, memLevel, windowBits, dictionaries and flushing streams;
8406 covers chunked inflation with small input pieces and output chunks.
2026-10-26 15:12:51 -05:00
Chris Tate eb2ebb619f Cheaper trial deletion in the cycle collector (#2352) 2026-10-26 15:08:20 -05:00
Chris Tate 1d72466f51 Read int32-slot arrays at their width in integer clones
An integer clone reads a number array's element as an 8-byte double. A
number array proven to hold only int32s keeps 4-byte int32 slots
(SCR_ELEM_I32), so the clone read such an array at the wrong width: it
returned wrong values, and near the array's end it read past the slots.

The clone now tests the array's element kind: int32 slots load as 4-byte
int32s, double slots load as doubles and keep the exact-int32 test, and
any other storage bails to the ordinary body.

New corpus program: integer-clone-int32-slots.ts.
2026-10-26 15:00:12 -05:00
Chris Tate 6db3393d41 Read TypeScript 7.1's heritage clause elements beside 7.0's (#2350) 2026-10-26 14:37:59 -05:00
Chris Tate f12b2b041d Cheaper trial deletion in the cycle collector 2026-10-26 14:34:49 -05:00
Chris Tate f1e27f2e44 Poll the loops of a nest on every iteration in ELF worker executables 2026-10-26 14:31:32 -05:00
Chris Tate ecaeadc1d7 Give every numbered registry one source of truth and a check (#2277) 2026-10-26 14:25:43 -05:00
Chris Tate 05dda22efa Read TypeScript 7.1's heritage clause elements beside 7.0's
TypeScript 7.1 parses the elements of an interface's `extends` and a
class's `implements` as TypeReference nodes, whose names are entity names,
where 7.0 gives ExpressionWithTypeArguments nodes. heritage-elements.ts
recognizes both forms, and the readers that took an element's expression
read either:

- contract-types.ts finds `implements ProgramLifetime` and
  `implements Acyclic` written as type references;
- narrowing-stability.ts takes a qualified name as it takes a property
  access;
- generic-functions.ts reads an element's name in either form, and keeps
  counting a name in a heritage clause as a value reference.
2026-10-26 14:09:17 -05:00
Chris Tate 40b189fcdc Talk to TypeScript 7.1's API server beside 7.0's (#2349) 2026-10-26 13:55:20 -05:00
Chris Tate b4e9e134f1 Merge main and address review feedback 2026-10-26 13:48:37 -05:00
Chris Tate de3a75ff81 Push localized failure down to the failing component of a declared type (#2307) 2026-10-26 13:10:05 -05:00
Chris Tate 21c199ce0d Keep the layout of arrays and records passed to wider parameter types (#2329) 2026-10-26 13:08:31 -05:00
Chris Tate 6a24aae11a Address review feedback 2026-10-26 12:59:08 -05:00
Chris Tate 58197ed89d Close the largest canonical-mapping gaps the shadow census found (#2340) 2026-10-26 12:42:03 -05:00
Chris Tate 4cacdfe821 Merge main 2026-10-26 12:38:20 -05:00
Chris Tate 2aafe6b406 Address review feedback 2026-10-26 12:36:57 -05:00
Chris Tate 68e2556fda Merge main 2026-10-26 12:24:22 -05:00
Chris Tate 2cdd286f66 Talk to TypeScript 7.1's API server beside 7.0's
The TypeScript session reads initialize's answer to tell a 7.1 server
(caseSensitivity) from a 7.0 one (useCaseSensitiveFileNames), and on a
7.1 server sends 7.1's requests and reads its answers:

- snapshots: the first comes from createSnapshot and later ones from
  updateSnapshot with the latest snapshot as the base, which the server
  keeps until the next update. Each asks for current programs
  (ensurePrograms), and a project's root files and options come from its
  parsed command line. Projects an update does not list carry over from
  the base.
- symbols: a symbol is named by its reference, a source file or the
  snapshot and project that owns it plus its id. The semantic model keeps
  numeric symbol ids: each reference, and each compact reference other
  answers hold, gets a local id, and requests send the reference back.
  Symbol property methods take it in `symbol`.
- requests: getApparentType, getConstraintOfTypeParameter,
  getNonNullableType and getReturnTypeOfSignature name their type or
  signature in `objectId`, the diagnostics methods take `files`, and
  signatureToSignatureDeclaration's kind is a 7.1 SyntaxKind.
- answers: isTupleType is read from the type, JsxEmit's React and
  ReactNative values are swapped back, and parseConfigFile returns the
  options and file names.
- file system callbacks reply with {kind, value}: a value, "missing" for
  a hidden path, or "useOS" to delegate to the server.

The session, checker and semantic checker tests run against tsc 7.0.2 and
against tsc 7.1.0-beta, from the typescript-7.1 test dependency.
2026-10-26 12:13:27 -05:00
Chris Tate 9b4a6ffdf1 Regenerate the IR field readers for dynCheck's inferred site (#2347) 2026-10-26 12:08:27 -05:00
Chris Tate 5b29eb1bae Merge main 2026-10-26 12:07:21 -05:00
Chris Tate 91014dfb66 Read TypeScript 7.1's binary AST format beside 7.0's (#2346) 2026-10-26 11:59:28 -05:00
Chris Tate 34c2f9851d Have the native CLI packages depend on their LLVM helper and runtime pack (#2333) 2026-10-26 11:47:34 -05:00
Chris Tate 6dbdf39120 Track a stream's 'data' listeners instead of looking them up per chunk (#2344) 2026-10-26 11:38:04 -05:00
Chris Tate 2f13edd058 Merge main 2026-10-26 11:36:06 -05:00
Chris Tate 341ddd41ae Regenerate the IR field readers for dynCheck's inferred site 2026-10-26 11:34:57 -05:00
Chris Tate de6cdf1156 Add the shape overlay: typed JavaScript from analysis-proven facts (opt-in) (#2176) 2026-10-26 11:33:47 -05:00
Chris Tate ce1f3c4d2b Read TypeScript 7.1's binary AST format beside 7.0's
The AST reader accepts protocol 9, TypeScript 7.1's encoding, as well as
protocol 5 (7.0's), so scriptc can read either checker's responses:

- the 64-byte header of protocol 9;
- its node kinds, which count 7.1's SourceKeyword: each kind above it
  reads as 7.0's, and node handles name the response's own kinds;
- a module declaration's child mask, whose attributes slot moves the
  body to slot 3.

A protocol 9 response with a node 7.0 has no form for (a SourceKeyword
node, import attributes on a module declaration, or an `import source`
clause) throws an AstDecodeError that names it.
2026-10-26 11:27:36 -05:00
Malte UblandClaude Opus 5.5 dc1e8acc1d Store ordinary objects as a layout plus value slots
A checked object (SCR_DYN_OBJ) now starts in layout mode: v.obj.layout names
its key sequence, a node of the thread's interned transition tree, and
v.obj.slots holds one 8-byte value per key, where every property used to take
a 48-byte entry. All properties of a layout-mode object are writable,
enumerable, configurable data properties. An accessor, a non-default
attribute, a delete, more than 64 keys, spent layout budgets, publication to
other threads, or any code that reads entries directly moves the object to
dictionary mode (today's entries) for good, so unported paths stay correct.

Layouts replace the dynamic tier's lazily computed hidden classes (ScrJsShape)
and keep their budgets. Inline caches key on the layout pointer and read the
slot directly; JSON.parse builds objects along layouts; stringify, key
enumeration, release, trace and the runtime read cache read slots in place.
The emitted index-signature checks read members through runtime accessors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 09:18:53 -07:00
Chris Tate a5971450ec Tear down self-recursive records and classes in one loop (#2343) 2026-10-26 11:14:35 -05:00
Chris Tate d1963dc8a5 Test a scalar optional left of ?? in JavaScript on the typed path
In JavaScript, `counts.get(key) ?? 0` on a Map the compiler types as
Map<string, number> is typed `any` by the checker, so `??` was lowered
on checked-dynamic values: the `number | undefined` read converted to a
dynamic value, which allocated a heap union for every read, and the test
ran on that value.

When the left of such a `??` is a union of one number, boolean or string
arm with undefined or null, and the default has the same type, the test
and the default now run on the typed path, where the read needs no heap
union, and only the result converts to a dynamic value. Other defaults
keep the dynamic path.

New corpus program: untyped-nullish-scalar-defaults.mjs.
2026-10-26 11:12:57 -05:00
Chris Tate b1b6b98c0d Compare canonical mapping with mapType in an opt-in shadow mode (#2334) 2026-10-26 11:03:38 -05:00
Chris Tate cc5c81fb4d Keep frontend snapshots stable when a file is read before and after it settles (#2342) 2026-10-26 11:02:20 -05:00
Chris Tate e7f3ab29c2 Track a stream's 'data' listeners instead of looking them up per chunk
Each chunk a readable side delivered looked up its 'data' listeners by
name twice: once to decide whether a flowing stream emits directly, and
again in emit('data'), which scans the stream's event names even when a
piped stream has no 'data' listener at all. The stream now keeps a
data_listeners flag, set from the emitter registry's empty/nonempty
transitions through scr_emitter_observe, and reads it on those paths;
emit('data') is skipped when the stream has no 'data' listener.
2026-10-26 10:59:32 -05:00
Chris Tate 1e2887c22b Degrade the types of a statement's own expressions where the statement commits (#2308) 2026-10-26 10:57:29 -05:00
Chris Tate 09a73ab6ed Fix Array.prototype calls on native arrays, typeof on ambient names, and net connections to Unix sockets (#2326) 2026-10-26 10:56:58 -05:00
Chris Tate 6e4fdf95d0 Link the exported bootstrap package's helper and runtime pack dependencies
The native bootstrap's package checks copy the seed's distribution into a
package directory outside the workspace and, since the CLI packages depend
on their LLVM helper and runtime pack, drop the bundled copies. Nothing in
that directory resolved @scriptc/llvm-linux-x64-gnu, so
verify-native-cli.mjs failed with 'Cannot find module'. The test now links
both packages into the directory's node_modules, as pnpm links a workspace
package's dependencies.
2026-10-26 10:56:27 -05:00
Chris Tate 36273adc8f Unroll counted loops by the period of a guard on the counter's low bits (#2341) 2026-10-26 10:56:09 -05:00
Chris Tate d5dc896576 Merge main 2026-10-26 10:53:46 -05:00
Chris Tate 48c521dc27 Address review feedback 2026-10-26 10:43:59 -05:00
Chris Tate 9b96314c20 Tear down self-recursive records and classes in one loop
The teardown of a type with children of its own type called itself for
each child: a call, its register saves and the segment bookkeeping per
node, 45 instructions per node in a binary tree.

A record or standalone class whose every reference field holds its own
type and that has no collector header now tears down in one loop. A child
whose last reference the dead node held goes onto a pending list linked
through its own count word, which it no longer needs, and the loop takes
the list's first node next, so nodes are visited parent first. Each node
frees its block as before (dispose observers, the RC audit, blocks of
other arenas), the calling thread's blocks go into the teardown segment
in visit order, and the segment goes onto the free list in one step, so a
structure built parent first takes the blocks in its allocation order.
Shared and immortal children keep their release. The loop needs no depth
budget. Other teardowns keep the recursive form.
2026-10-26 10:42:41 -05:00
Chris Tate dec2b8a454 Record one probe for two reads of a file that saw the same content
A read within IDENTITY_SETTLE_MS of a file's last write records no
identity, and a later read of the same bytes in the same frontend does.
FrontendInputTracker.record compared the two probes as JSON and marked
the snapshot unstable. A build or coverage run that read its entry
before and after that point then published no cache entry: the exact
repeat of a build lowered again, and a coverage verdict was not replayed.
Two file probes with the same digest now merge into one that keeps the
settled identity; any other difference still marks the snapshot
unstable.
2026-10-26 10:33:02 -05:00
Chris Tate 6fa88c7243 Observe every top-level mapping in the canonical shadow 2026-10-26 10:32:41 -05:00