@scriptc/compiler 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ambient/scriptc-node-fallback.d.ts +5 -2
- package/dist/backend/llvm/bigint-wrap.d.ts +4 -0
- package/dist/backend/llvm/bigint-wrap.js +590 -0
- package/dist/backend/llvm/bigint-wrap.js.map +1 -0
- package/dist/backend/llvm/blocks.d.ts +2 -0
- package/dist/backend/llvm/blocks.js +4 -0
- package/dist/backend/llvm/blocks.js.map +1 -1
- package/dist/backend/llvm/call-lifetimes.js +15 -4
- package/dist/backend/llvm/call-lifetimes.js.map +1 -1
- package/dist/backend/llvm/call-lifetimes.test.js +14 -3
- package/dist/backend/llvm/call-lifetimes.test.js.map +1 -1
- package/dist/backend/llvm/checked-narrows.test.js +1 -1
- package/dist/backend/llvm/checked-narrows.test.js.map +1 -1
- package/dist/backend/llvm/classes.js +57 -12
- package/dist/backend/llvm/classes.js.map +1 -1
- package/dist/backend/llvm/classes.test.js +4 -4
- package/dist/backend/llvm/classes.test.js.map +1 -1
- package/dist/backend/llvm/common.d.ts +7 -5
- package/dist/backend/llvm/common.js +7 -5
- package/dist/backend/llvm/common.js.map +1 -1
- package/dist/backend/llvm/constant-callbacks.js +10 -28
- package/dist/backend/llvm/constant-callbacks.js.map +1 -1
- package/dist/backend/llvm/dense-array-access.js +133 -45
- package/dist/backend/llvm/dense-array-access.js.map +1 -1
- package/dist/backend/llvm/dense-array-access.test.js +53 -1
- package/dist/backend/llvm/dense-array-access.test.js.map +1 -1
- package/dist/backend/llvm/dyn.d.ts +2 -0
- package/dist/backend/llvm/dyn.js +4 -0
- package/dist/backend/llvm/dyn.js.map +1 -1
- package/dist/backend/llvm/emitter.d.ts +120 -6
- package/dist/backend/llvm/emitter.js +676 -77
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/backend/llvm/emitter.test.js +14 -7
- package/dist/backend/llvm/emitter.test.js.map +1 -1
- package/dist/backend/llvm/expr-async.js +120 -43
- package/dist/backend/llvm/expr-async.js.map +1 -1
- package/dist/backend/llvm/expr-async.test.js +1 -1
- package/dist/backend/llvm/expr-async.test.js.map +1 -1
- package/dist/backend/llvm/expr-bytes.js +51 -36
- package/dist/backend/llvm/expr-bytes.js.map +1 -1
- package/dist/backend/llvm/expr-callbacks.js +72 -3
- package/dist/backend/llvm/expr-callbacks.js.map +1 -1
- package/dist/backend/llvm/expr-calls.d.ts +1 -1
- package/dist/backend/llvm/expr-calls.js +159 -30
- package/dist/backend/llvm/expr-calls.js.map +1 -1
- package/dist/backend/llvm/expr-calls.test.d.ts +1 -0
- package/dist/backend/llvm/expr-calls.test.js +132 -0
- package/dist/backend/llvm/expr-calls.test.js.map +1 -0
- package/dist/backend/llvm/expr-containers.js +13 -0
- package/dist/backend/llvm/expr-containers.js.map +1 -1
- package/dist/backend/llvm/expr-context.d.ts +2 -0
- package/dist/backend/llvm/expr-dispatch.js +3 -0
- package/dist/backend/llvm/expr-dispatch.js.map +1 -1
- package/dist/backend/llvm/expr-dynamic.js +26 -4
- package/dist/backend/llvm/expr-dynamic.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.d.ts +7 -0
- package/dist/backend/llvm/expr-primitives.js +80 -22
- package/dist/backend/llvm/expr-primitives.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.test.js +95 -5
- package/dist/backend/llvm/expr-primitives.test.js.map +1 -1
- package/dist/backend/llvm/expr-records.d.ts +9 -0
- package/dist/backend/llvm/expr-records.js +134 -16
- package/dist/backend/llvm/expr-records.js.map +1 -1
- package/dist/backend/llvm/expr-stream-bridges.d.ts +1 -1
- package/dist/backend/llvm/expr-stream-bridges.js +80 -1
- package/dist/backend/llvm/expr-stream-bridges.js.map +1 -1
- package/dist/backend/llvm/expr-stream-bridges.test.js +50 -1
- package/dist/backend/llvm/expr-stream-bridges.test.js.map +1 -1
- package/dist/backend/llvm/int32-abi.d.ts +31 -0
- package/dist/backend/llvm/int32-abi.js +62 -0
- package/dist/backend/llvm/int32-abi.js.map +1 -0
- package/dist/backend/llvm/int32-abi.test.d.ts +1 -0
- package/dist/backend/llvm/int32-abi.test.js +107 -0
- package/dist/backend/llvm/int32-abi.test.js.map +1 -0
- package/dist/backend/llvm/int32-locals.d.ts +30 -0
- package/dist/backend/llvm/int32-locals.js +95 -0
- package/dist/backend/llvm/int32-locals.js.map +1 -0
- package/dist/backend/llvm/integer-values.d.ts +4 -0
- package/dist/backend/llvm/integer-values.js +30 -1
- package/dist/backend/llvm/integer-values.js.map +1 -1
- package/dist/backend/llvm/integer-views.d.ts +8 -1
- package/dist/backend/llvm/integer-views.js +47 -2
- package/dist/backend/llvm/integer-views.js.map +1 -1
- package/dist/backend/llvm/lazy-captures.d.ts +16 -0
- package/dist/backend/llvm/lazy-captures.js +88 -2
- package/dist/backend/llvm/lazy-captures.js.map +1 -1
- package/dist/backend/llvm/lazy-captures.test.js +48 -0
- package/dist/backend/llvm/lazy-captures.test.js.map +1 -1
- package/dist/backend/llvm/lib-dispatch.js +14 -0
- package/dist/backend/llvm/lib-dispatch.js.map +1 -1
- package/dist/backend/llvm/lib-filesystem.js +3 -0
- package/dist/backend/llvm/lib-filesystem.js.map +1 -1
- package/dist/backend/llvm/lib-shared.js +7 -0
- package/dist/backend/llvm/lib-shared.js.map +1 -1
- package/dist/backend/llvm/local-array-reads.js +21 -2
- package/dist/backend/llvm/local-array-reads.js.map +1 -1
- package/dist/backend/llvm/local-array-reads.test.js +3 -2
- package/dist/backend/llvm/local-array-reads.test.js.map +1 -1
- package/dist/backend/llvm/local-union-storage.test.js +2 -2
- package/dist/backend/llvm/local-union-storage.test.js.map +1 -1
- package/dist/backend/llvm/map-read-lifetimes.test.js +2 -2
- package/dist/backend/llvm/map-read-lifetimes.test.js.map +1 -1
- package/dist/backend/llvm/reference-effects.js +2 -0
- package/dist/backend/llvm/reference-effects.js.map +1 -1
- package/dist/backend/llvm/reference-writes.d.ts +3 -0
- package/dist/backend/llvm/reference-writes.js +10 -2
- package/dist/backend/llvm/reference-writes.js.map +1 -1
- package/dist/backend/llvm/regex-matchers.d.ts +39 -0
- package/dist/backend/llvm/regex-matchers.js +1649 -0
- package/dist/backend/llvm/regex-matchers.js.map +1 -0
- package/dist/backend/llvm/regex-matchers.test.d.ts +1 -0
- package/dist/backend/llvm/regex-matchers.test.js +96 -0
- package/dist/backend/llvm/regex-matchers.test.js.map +1 -0
- package/dist/backend/llvm/shapes.d.ts +36 -1
- package/dist/backend/llvm/shapes.js +127 -14
- package/dist/backend/llvm/shapes.js.map +1 -1
- package/dist/backend/llvm/stack-unions.test.js +1 -1
- package/dist/backend/llvm/stack-unions.test.js.map +1 -1
- package/dist/backend/llvm/string-construction.test.js +2 -2
- package/dist/backend/llvm/string-construction.test.js.map +1 -1
- package/dist/backend/llvm/string-lifetimes.test.js +5 -5
- package/dist/backend/llvm/string-lifetimes.test.js.map +1 -1
- package/dist/backend/llvm/string-literal-equality.d.ts +22 -0
- package/dist/backend/llvm/string-literal-equality.js +78 -0
- package/dist/backend/llvm/string-literal-equality.js.map +1 -0
- package/dist/backend/llvm/switch-dispatch.js +59 -13
- package/dist/backend/llvm/switch-dispatch.js.map +1 -1
- package/dist/backend/llvm/switch-dispatch.test.js +71 -6
- package/dist/backend/llvm/switch-dispatch.test.js.map +1 -1
- package/dist/backend/llvm/union-retype.test.d.ts +1 -0
- package/dist/backend/llvm/union-retype.test.js +229 -0
- package/dist/backend/llvm/union-retype.test.js.map +1 -0
- package/dist/backend/llvm/wrapping-sums.d.ts +17 -0
- package/dist/backend/llvm/wrapping-sums.js +113 -0
- package/dist/backend/llvm/wrapping-sums.js.map +1 -0
- package/dist/backend/loop-polls.js +1 -0
- package/dist/backend/loop-polls.js.map +1 -1
- package/dist/backend/mangle.d.ts +9 -0
- package/dist/backend/mangle.js +15 -0
- package/dist/backend/mangle.js.map +1 -1
- package/dist/backend/may-throw.js +6 -3
- package/dist/backend/may-throw.js.map +1 -1
- package/dist/backend/runtime-abi.d.ts +2 -2
- package/dist/backend/runtime-abi.js +2 -2
- package/dist/backend/runtime-pack-targets.test.js +1 -1
- package/dist/backend/runtime-pack.test.js +1 -1
- package/dist/contracts/check.js +4 -0
- package/dist/contracts/check.js.map +1 -1
- package/dist/frontend/lowering/array-values.d.ts +14 -0
- package/dist/frontend/lowering/array-values.js +29 -0
- package/dist/frontend/lowering/array-values.js.map +1 -1
- package/dist/frontend/lowering/containers/array-callbacks.js +40 -0
- package/dist/frontend/lowering/containers/array-callbacks.js.map +1 -1
- package/dist/frontend/lowering/containers/array-pipelines.d.ts +54 -0
- package/dist/frontend/lowering/containers/array-pipelines.js +1827 -0
- package/dist/frontend/lowering/containers/array-pipelines.js.map +1 -0
- package/dist/frontend/lowering/containers/exec-result-uses.d.ts +10 -0
- package/dist/frontend/lowering/containers/exec-result-uses.js +88 -0
- package/dist/frontend/lowering/containers/exec-result-uses.js.map +1 -0
- package/dist/frontend/lowering/containers/string-and-regexp.js +15 -7
- package/dist/frontend/lowering/containers/string-and-regexp.js.map +1 -1
- package/dist/frontend/lowering/containers/string-replacement.d.ts +2 -1
- package/dist/frontend/lowering/containers/string-replacement.js +32 -136
- package/dist/frontend/lowering/containers/string-replacement.js.map +1 -1
- package/dist/frontend/lowering/devirtualize.d.ts +33 -0
- package/dist/frontend/lowering/devirtualize.js +199 -0
- package/dist/frontend/lowering/devirtualize.js.map +1 -0
- package/dist/frontend/lowering/expressions/nullish-assignment.js +55 -7
- package/dist/frontend/lowering/expressions/nullish-assignment.js.map +1 -1
- package/dist/frontend/lowering/identifier-uses.d.ts +7 -0
- package/dist/frontend/lowering/identifier-uses.js +23 -0
- package/dist/frontend/lowering/identifier-uses.js.map +1 -0
- package/dist/frontend/lowering/iterator-adapters.js +51 -3
- package/dist/frontend/lowering/iterator-adapters.js.map +1 -1
- package/dist/frontend/lowering/lower-array-sort.js +13 -0
- package/dist/frontend/lowering/lower-array-sort.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.js +64 -30
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-classes.js +1 -11
- package/dist/frontend/lowering/lower-classes.js.map +1 -1
- package/dist/frontend/lowering/lower-console.d.ts +14 -0
- package/dist/frontend/lowering/lower-console.js +195 -0
- package/dist/frontend/lowering/lower-console.js.map +1 -0
- package/dist/frontend/lowering/lower-exprs.js +135 -3
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-functions.js +7 -3
- package/dist/frontend/lowering/lower-functions.js.map +1 -1
- package/dist/frontend/lowering/lower-generators.d.ts +10 -0
- package/dist/frontend/lowering/lower-generators.js +108 -41
- package/dist/frontend/lowering/lower-generators.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.js +4 -0
- package/dist/frontend/lowering/lower-modules.js.map +1 -1
- package/dist/frontend/lowering/lower-stream.js +13 -10
- package/dist/frontend/lowering/lower-stream.js.map +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +25 -4
- package/dist/frontend/lowering/lowerer.js +120 -47
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/lowering/nan-coded-reads.d.ts +16 -0
- package/dist/frontend/lowering/nan-coded-reads.js +108 -1
- package/dist/frontend/lowering/nan-coded-reads.js.map +1 -1
- package/dist/frontend/lowering/runtime-optional-bounds.d.ts +4 -0
- package/dist/frontend/lowering/runtime-optional-bounds.js +2 -0
- package/dist/frontend/lowering/runtime-optional-bounds.js.map +1 -1
- package/dist/frontend/lowering/runtime-optional-bounds.test.js +27 -0
- package/dist/frontend/lowering/runtime-optional-bounds.test.js.map +1 -1
- package/dist/frontend/lowering/split-consumers.js +2 -18
- package/dist/frontend/lowering/split-consumers.js.map +1 -1
- package/dist/frontend/lowering/surfaces.js +3 -8
- package/dist/frontend/lowering/surfaces.js.map +1 -1
- package/dist/frontend/lowering/union-retag.d.ts +6 -1
- package/dist/frontend/lowering/union-retag.js +64 -1
- package/dist/frontend/lowering/union-retag.js.map +1 -1
- package/dist/frontend/lowering/union-retag.test.js +46 -0
- package/dist/frontend/lowering/union-retag.test.js.map +1 -1
- package/dist/frontend/type-mapper.js +16 -3
- package/dist/frontend/type-mapper.js.map +1 -1
- package/dist/ir/builtin-effects.js +2 -0
- package/dist/ir/builtin-effects.js.map +1 -1
- package/dist/ir/builtin-signatures.d.ts +1 -1
- package/dist/ir/builtin-signatures.js +12 -1
- package/dist/ir/builtin-signatures.js.map +1 -1
- package/dist/ir/function-references.d.ts +12 -0
- package/dist/ir/function-references.js +29 -0
- package/dist/ir/function-references.js.map +1 -0
- package/dist/ir/function-references.test.d.ts +1 -0
- package/dist/ir/function-references.test.js +276 -0
- package/dist/ir/function-references.test.js.map +1 -0
- package/dist/ir/int32-slots.d.ts +7 -4
- package/dist/ir/int32-slots.js +214 -49
- package/dist/ir/int32-slots.js.map +1 -1
- package/dist/ir/int32-slots.test.js +38 -1
- package/dist/ir/int32-slots.test.js.map +1 -1
- package/dist/ir/integer-ranges.d.ts +4 -4
- package/dist/ir/integer-ranges.js +89 -64
- package/dist/ir/integer-ranges.js.map +1 -1
- package/dist/ir/integer-ranges.test.js +71 -9
- package/dist/ir/integer-ranges.test.js.map +1 -1
- package/dist/ir/intrinsic-signatures.js +1 -0
- package/dist/ir/intrinsic-signatures.js.map +1 -1
- package/dist/ir/ir.d.ts +52 -6
- package/dist/ir/ir.js +1 -0
- package/dist/ir/ir.js.map +1 -1
- package/dist/ir/runtime-features.js +3 -2
- package/dist/ir/runtime-features.js.map +1 -1
- package/dist/ir/traverse.js +4 -0
- package/dist/ir/traverse.js.map +1 -1
- package/dist/ir/validate.js +57 -6
- package/dist/ir/validate.js.map +1 -1
- package/dist/ir/validate.test.js +25 -7
- package/dist/ir/validate.test.js.map +1 -1
- package/package.json +20 -20
- package/surface-manifest.json +1 -17
|
@@ -2,6 +2,8 @@ import type { IrBytesElem, IrExpr, IrFfiImport, IrFunction, IrLocal, IrModule, I
|
|
|
2
2
|
import { type SplitSpan } from "./split-loops.js";
|
|
3
3
|
import { type IntegerRanges } from "../../ir/integer-ranges.js";
|
|
4
4
|
import { type Int32Slots } from "../../ir/int32-slots.js";
|
|
5
|
+
import { type Int32Abi } from "./int32-abi.js";
|
|
6
|
+
import { type Int32Local } from "./int32-locals.js";
|
|
5
7
|
import { type ConstantNumericTable } from "../../ir/constant-tables.js";
|
|
6
8
|
import { type FfiCallbackAdapter } from "../ffi-callbacks.js";
|
|
7
9
|
import { type CallLifetimes } from "./call-lifetimes.js";
|
|
@@ -83,6 +85,14 @@ export declare class LlEmitter {
|
|
|
83
85
|
* indices; see ShapeHost.nextCycKind). */
|
|
84
86
|
private cycKinds;
|
|
85
87
|
readonly wasi: boolean;
|
|
88
|
+
/** Synchronous generator bodies compile to LLVM switched coroutines (a
|
|
89
|
+
* heap frame resumed by an ordinary call) instead of running on a fiber
|
|
90
|
+
* stack. Worker programs keep fibers (context shutdown unwinds suspended
|
|
91
|
+
* generator stacks) and so do debug builds (the debugger reads locals
|
|
92
|
+
* from the native frame). */
|
|
93
|
+
private stacklessGenerators;
|
|
94
|
+
/** Some function in the module is lowered as a coroutine. */
|
|
95
|
+
private usesCoroutines;
|
|
86
96
|
/** The target lacks a rounding instruction at its baseline CPU (x86-64
|
|
87
97
|
* before SSE4.1), so `llvm.trunc` would lower to a libm call: emit
|
|
88
98
|
* truncation inline through an integer round trip instead. */
|
|
@@ -102,6 +112,10 @@ export declare class LlEmitter {
|
|
|
102
112
|
/** Interned string literals: UTF-8 text → { symbol, byte length } —
|
|
103
113
|
* first-use order, the runtime ABI’s determinism discipline. */
|
|
104
114
|
private readonly literals;
|
|
115
|
+
/** Literal equality helpers: literal text → helper symbol (literalEquals). */
|
|
116
|
+
private readonly literalEqualities;
|
|
117
|
+
/** Interned bigint literals: hex magnitude with sign → { symbol, value }. */
|
|
118
|
+
private readonly bigintLiterals;
|
|
105
119
|
/** Symbols of interned constant data, named by content (contentSymbol). */
|
|
106
120
|
private readonly contentSymbols;
|
|
107
121
|
/** Interned unit-armed union instances: "unionId:tag" → symbol — one
|
|
@@ -110,6 +124,10 @@ export declare class LlEmitter {
|
|
|
110
124
|
private readonly unitInstances;
|
|
111
125
|
/** unionId → symbol of the union's immortal ABSENT field-slot instance. */
|
|
112
126
|
private readonly absentInstances;
|
|
127
|
+
/** unionId → symbol of a flag set once a checked-dynamic cast caches one
|
|
128
|
+
* of the union's boxes. A cached box is refreshed in place, possibly with
|
|
129
|
+
* a tag that another union numbers apart, so it is never shared. */
|
|
130
|
+
private readonly retypeGuards;
|
|
113
131
|
/** The nullable-union ABSENT sentinel was referenced (absentInstanceRef). */
|
|
114
132
|
private needsNullableAbsent;
|
|
115
133
|
private readonly immortalValues;
|
|
@@ -122,6 +140,8 @@ export declare class LlEmitter {
|
|
|
122
140
|
sym: string;
|
|
123
141
|
src: string;
|
|
124
142
|
fl: string;
|
|
143
|
+
pattern: string;
|
|
144
|
+
flags: string;
|
|
125
145
|
}>;
|
|
126
146
|
/** Interned tagged-template strings objects: per-site key → { symbol,
|
|
127
147
|
* interned cooked-literal refs }. One immortal ScrArr of string slots
|
|
@@ -182,6 +202,9 @@ export declare class LlEmitter {
|
|
|
182
202
|
private readonly lazyCaptureBoxes;
|
|
183
203
|
private readonly lazyStackBoxes;
|
|
184
204
|
private borrowedParameters;
|
|
205
|
+
/** Captures of the current closure body that its environment holds
|
|
206
|
+
* unchanged for the closure's whole life (LazyCaptures.stableCaptures). */
|
|
207
|
+
private stableCaptureIds;
|
|
185
208
|
/** Parameters proven projection-only: callers may pass stack boxes. */
|
|
186
209
|
private projectedParameters;
|
|
187
210
|
private stableCallBindings;
|
|
@@ -237,6 +260,17 @@ export declare class LlEmitter {
|
|
|
237
260
|
/** Method names with at least one may-throw implementation — the
|
|
238
261
|
* virtualCall pending check's key. */
|
|
239
262
|
readonly mayThrowMethods: Set<string>;
|
|
263
|
+
/** Async functions awaited directly at some `await f(...)` site; each
|
|
264
|
+
* gets an await-call entry (emitAsyncAwaitCall). */
|
|
265
|
+
readonly awaitCallees: Set<string>;
|
|
266
|
+
/** Async functions returned directly at some `return f(...)` site of an
|
|
267
|
+
* async function; each gets an adopting entry (emitAsyncAwaitCall). */
|
|
268
|
+
readonly adoptCallees: Set<string>;
|
|
269
|
+
/** The promise a `return` emitted past its finally regions already
|
|
270
|
+
* produced for its adopting await (borrowed from the return's parked
|
|
271
|
+
* slot); that await takes it instead of evaluating its operand. */
|
|
272
|
+
private adoptedOperand;
|
|
273
|
+
takeAdoptedOperand(): LlValue | null;
|
|
240
274
|
/** setTimeout and friends appeared somewhere: main must run the event
|
|
241
275
|
* loop even in programs with no async functions. */
|
|
242
276
|
usesTimers: boolean;
|
|
@@ -309,6 +343,8 @@ export declare class LlEmitter {
|
|
|
309
343
|
private readonly initializerBindings;
|
|
310
344
|
/** Whole-program int32 storage and parameter/result facts. */
|
|
311
345
|
readonly int32Slots: Int32Slots;
|
|
346
|
+
/** Functions whose direct calls use i32 parameters or results. */
|
|
347
|
+
readonly int32Abis: ReadonlyMap<string, Int32Abi>;
|
|
312
348
|
/** Immutable module constants (contract types) whose graphs become
|
|
313
349
|
* immortal once initialized: their reads need no reference counting. */
|
|
314
350
|
readonly immortalGlobals: ReadonlySet<string>;
|
|
@@ -334,10 +370,17 @@ export declare class LlEmitter {
|
|
|
334
370
|
* not a constructor (where they change), not async or a generator. */
|
|
335
371
|
private finalFieldBorrows;
|
|
336
372
|
integerRanges: IntegerRanges;
|
|
373
|
+
/** Sums whose result only feeds 32-bit conversions (wrapping-sums.ts). */
|
|
374
|
+
wrappingSums: Set<IrExpr>;
|
|
337
375
|
private byteWindowsEnabled;
|
|
338
376
|
private byteWindowEntries;
|
|
339
377
|
bytesBounds: ReadonlySet<IrExpr | IrStmt>;
|
|
340
378
|
integerViews: Map<string, string>;
|
|
379
|
+
/** Number locals of the current function stored only as an i32
|
|
380
|
+
* (int32-locals.ts); their slots are `alloca i32`. */
|
|
381
|
+
int32Locals: Map<string, Int32Local>;
|
|
382
|
+
/** The written values (and `++`/`--` nodes) the int32 proof covers. */
|
|
383
|
+
int32LocalWrites: ReadonlySet<IrExpr>;
|
|
341
384
|
/** Enclosing try-with-FINALLY regions, innermost last: a `return`
|
|
342
385
|
* inside one runs every crossed finally (innermost first) before the
|
|
343
386
|
* actual ret — the runtime ABI’s pending-return path, with the finally
|
|
@@ -357,9 +400,12 @@ export declare class LlEmitter {
|
|
|
357
400
|
/** Return type of the function being emitted — the unwind path returns
|
|
358
401
|
* a dummy of this type (never read: callers check the flag first). */
|
|
359
402
|
private currentReturnType;
|
|
360
|
-
/**
|
|
361
|
-
|
|
362
|
-
|
|
403
|
+
/** The current body returns its number result as i32. */
|
|
404
|
+
private currentInt32Result;
|
|
405
|
+
/** Active only while emitting a body lowered with LLVM's
|
|
406
|
+
* switched-coroutine intrinsics (wasm32 async bodies and generators,
|
|
407
|
+
* native synchronous generators; see coroLowered). */
|
|
408
|
+
currentCoro: {
|
|
363
409
|
kind: "async" | "generator";
|
|
364
410
|
id: string;
|
|
365
411
|
handle: string;
|
|
@@ -445,6 +491,24 @@ export declare class LlEmitter {
|
|
|
445
491
|
* fresh promise from its outcome — the fiber trampoline's epilogue,
|
|
446
492
|
* without the fiber. */
|
|
447
493
|
private emitFiberlessAsyncSpawn;
|
|
494
|
+
/** Whether `await f(...)` may enter f through its await-call entry. The
|
|
495
|
+
* entry's result is the awaited value of f's own body type; direct calls
|
|
496
|
+
* never carry a lifted environment. */
|
|
497
|
+
awaitCallEligible(fnName: string): boolean;
|
|
498
|
+
/** The await-call entry of an async function (`sc_aw_*`): one direct
|
|
499
|
+
* `await f(...)` as a call returning the awaited value, so the call site
|
|
500
|
+
* needs no promise of its own. A fiberless body runs on the caller's
|
|
501
|
+
* stack as in its spawn wrapper; a clean result then takes the await's
|
|
502
|
+
* one microtask turn (scr_await_hop) and is returned without ever
|
|
503
|
+
* materializing the promise, which nothing else could observe. A throw
|
|
504
|
+
* builds the rejected promise exactly as the spawn wrapper would and
|
|
505
|
+
* awaits it, so the rejection reaches the awaiter on the same turn. Other
|
|
506
|
+
* bodies pack their arguments as the spawn wrapper does and enter
|
|
507
|
+
* scr_async_spawn_await_*, which parks the caller on the promise as soon
|
|
508
|
+
* as the body first suspends. The adopting entry (`sc_ad_*`, for
|
|
509
|
+
* `return f(...)` in an async function) adds the turn of the then job
|
|
510
|
+
* that adopts the returned promise, before the await proper. */
|
|
511
|
+
private emitAsyncAwaitCall;
|
|
448
512
|
/** Per-async-function machinery — async.ts's scaffolding, .ll
|
|
449
513
|
* flavored: an argument-pack struct type, a fiber trampoline (unpacks,
|
|
450
514
|
* frees the pack, runs the ordinary compiled body, settles the
|
|
@@ -453,6 +517,9 @@ export declare class LlEmitter {
|
|
|
453
517
|
* closures enter through (packs the args +1, scr_async_spawn runs the
|
|
454
518
|
* fiber eagerly to its first suspension and returns the promise). */
|
|
455
519
|
private emitAsyncScaffolding;
|
|
520
|
+
/** Whether `fn`'s body is emitted as an LLVM switched coroutine: every
|
|
521
|
+
* wasm32 async or generator body, and native synchronous generators. */
|
|
522
|
+
private coroLowered;
|
|
456
523
|
/** Per-generator-function machinery — the async scaffolding's lazy
|
|
457
524
|
* sibling (async.ts's emitGenScaffolding): the same argument pack,
|
|
458
525
|
* a fiber trampoline whose epilogue stores the COMPLETION value (or
|
|
@@ -467,6 +534,14 @@ export declare class LlEmitter {
|
|
|
467
534
|
* collision retries with a counter, still in first-use order. */
|
|
468
535
|
private contentSymbol;
|
|
469
536
|
internLiteral(text: string): string;
|
|
537
|
+
/** The inline equality test against one string literal (an
|
|
538
|
+
* `i1 (ptr)` helper LLVM inlines at each site), by literal symbol. */
|
|
539
|
+
literalEquals(text: string): string;
|
|
540
|
+
/** `@`-ref of an immortal ScrBigInt holding `value`, or null when the
|
|
541
|
+
* text is not a valid StringToBigInt input (the runtime parse then
|
|
542
|
+
* throws as usual). BigInt here is the same StringToBigInt as the
|
|
543
|
+
* program's, so every accepted spelling folds to the value Node gives. */
|
|
544
|
+
internBigIntLiteral(text: string): string | null;
|
|
470
545
|
/** Interned NUL-terminated C-string constant (the scr_jb_puts /
|
|
471
546
|
* stringify-indent currency) — `@`-ref, first-use order. */
|
|
472
547
|
cstr(text: string): string;
|
|
@@ -476,6 +551,9 @@ export declare class LlEmitter {
|
|
|
476
551
|
* emission initializes undefined-admitting fields through it
|
|
477
552
|
* (ClassHost). */
|
|
478
553
|
unitInstanceRef(unionId: string, tag: number): string;
|
|
554
|
+
/** The i8 flag that a checked-dynamic cast sets before caching one of
|
|
555
|
+
* this tagged union's boxes (unionRetype rebuilds once it is set). */
|
|
556
|
+
retypeGuardRef(unionId: string): string;
|
|
479
557
|
/** The immortal ABSENT state of an undefined-armed record field slot
|
|
480
558
|
* (IR fieldAbsent). */
|
|
481
559
|
absentInstanceRef(unionId: string): string;
|
|
@@ -699,6 +777,11 @@ export declare class LlEmitter {
|
|
|
699
777
|
/** Declaration stores initialize an empty TDZ box. Later stores check
|
|
700
778
|
* it after the RHS and update scalar cells in place. References move in. */
|
|
701
779
|
writeBindingBox(box: string, local: IrLocal, value: string, initializes?: boolean, borrowed?: boolean): void;
|
|
780
|
+
/** True when `fnName`'s borrowing body lends every reference parameter
|
|
781
|
+
* and returns an owned result: a closure over it then carries that body
|
|
782
|
+
* as its borrowing entry (ScrClosure.fn_borrowed), which callers that
|
|
783
|
+
* keep their arguments alive across the call may enter instead of `fn`. */
|
|
784
|
+
lendsEveryArgument(fnName: string): boolean;
|
|
702
785
|
/** The LLVM symbol a direct call or closure enters a function through:
|
|
703
786
|
* async bodies are entered via their emitted spawn wrapper (which runs
|
|
704
787
|
* the fiber eagerly to its first suspension and returns the promise);
|
|
@@ -711,13 +794,25 @@ export declare class LlEmitter {
|
|
|
711
794
|
emitWasiSuspend(promise: string | null): void;
|
|
712
795
|
/** Suspend after a target-specific runtime helper already queued the
|
|
713
796
|
* continuation (used by module awaits, which skip the hop when settled). */
|
|
714
|
-
|
|
797
|
+
emitCoroSuspendPrepared(): void;
|
|
715
798
|
/** Move a clean async return value into the current fiber's promise. */
|
|
716
799
|
private emitWasiFulfill;
|
|
717
800
|
private emitFunction;
|
|
801
|
+
/** The double-ABI entry of a function with an i32 entry: every caller
|
|
802
|
+
* that is not a direct call (closures, dispatch, adapters, the runtime)
|
|
803
|
+
* enters here. A pending exception passes through to its caller. */
|
|
804
|
+
private emitInt32AbiWrapper;
|
|
805
|
+
/** The i32 bits of a number proven an int32 (a direct call's i32
|
|
806
|
+
* argument or an i32 result): its exact integer when the value carries
|
|
807
|
+
* one, else the conversion the proof makes exact. */
|
|
808
|
+
int32Argument(value: LlValue, expr: IrExpr): string;
|
|
809
|
+
/** A direct call's i32 result as a number, with the i32 as its integer
|
|
810
|
+
* and ToUint32 forms. */
|
|
811
|
+
int32Result(bits: string, type: IrType): LlValue;
|
|
718
812
|
/** Keep the ordinary owned ABI for closures, virtual dispatch, generated
|
|
719
|
-
* runtime adapters and library exports. Only direct IR calls
|
|
720
|
-
*
|
|
813
|
+
* runtime adapters and library exports. Only direct IR calls, calls of a
|
|
814
|
+
* known closure body and borrowing closure entries (fn_borrowed) select
|
|
815
|
+
* the borrowing body. Ownership of other parameters moves into that body;
|
|
721
816
|
* borrowed parameters are released here on normal and exceptional exits.
|
|
722
817
|
* The pending exception remains for the adapter's caller to handle. */
|
|
723
818
|
/** With `kept`, the virtual adapter of a borrowing slot instead: the
|
|
@@ -751,6 +846,14 @@ export declare class LlEmitter {
|
|
|
751
846
|
* borrow the element when the callee and later arguments (`writes`)
|
|
752
847
|
* write no array element and nothing keeping the array alive. */
|
|
753
848
|
unwrittenCallArrayRead(read: LocalArrayRead, writes: Writes): boolean;
|
|
849
|
+
/** `return p` of a promise inside try regions of an async function. JS
|
|
850
|
+
* completes the return first: p is evaluated, every crossed finally runs,
|
|
851
|
+
* and only then does the function's promise adopt p's settlement (a then
|
|
852
|
+
* job, then p's reaction). So the promise parks in a slot through the
|
|
853
|
+
* finally copies, like any pending return value, and the adopting await
|
|
854
|
+
* runs afterwards with no handler in scope: a rejection settles the
|
|
855
|
+
* function's promise instead of reaching its own catch clauses. */
|
|
856
|
+
private emitAdoptingReturn;
|
|
754
857
|
/** `return x` of a local whose slot is an owned scope entry of the same
|
|
755
858
|
* type: the return can take over the local's reference. */
|
|
756
859
|
private movableReturn;
|
|
@@ -851,6 +954,9 @@ export declare class LlEmitter {
|
|
|
851
954
|
private emitMovedSelfConcat;
|
|
852
955
|
emitContainerExpr(e: ExprOf<"arrayLit" | "arrayNewLen" | "arrayGet" | "arrayHas" | "arrayState" | "arrIntrinsic" | "bytesNew" | "bytesIntrinsic" | "mapNew" | "mapIntrinsic" | "setIntrinsic" | "setNew">): LlValue;
|
|
853
956
|
emitCallExpr(e: ExprOf<"call" | "ffiCall" | "closure" | "callValue" | "selfRef" | "new" | "classRef" | "newValue" | "instanceOfValue" | "promiseVoidWiden" | "upcast" | "downcast" | "instanceOf" | "virtualCall">): LlValue;
|
|
957
|
+
/** A direct async call an enclosing `await` consumes whole: emitted
|
|
958
|
+
* through the callee's await-call entry, yielding the awaited value. */
|
|
959
|
+
emitAwaitedCall(e: ExprOf<"call">, adopt?: boolean): LlValue;
|
|
854
960
|
emitRecordExpr(e: ExprOf<"fieldGet" | "recordGet" | "recordLit" | "recordClone" | "recordKeyGet" | "recordOvfKeys" | "recordOvfHas" | "recordHas" | "fieldAbsent">): LlValue;
|
|
855
961
|
emitDynamicExpr(e: ExprOf<"dynFrom" | "dynCall" | "dynInvoke" | "dynArrLit" | "dynObjLit" | "unionWrap" | "unionNarrow" | "unionDisc" | "unionKeyGet" | "unionIsTag" | "dynKeyGet" | "dynHasKey" | "dynScalarEq" | "dynTest" | "unionEq" | "unionFuncEq" | "caughtTest" | "caughtCheck" | "caughtNarrow" | "caughtToDyn">): LlValue;
|
|
856
962
|
emitIntrinsicExpr(e: ExprOf<"intrinsic">): LlValue;
|
|
@@ -1032,6 +1138,14 @@ export declare class LlEmitter {
|
|
|
1032
1138
|
emitBytesLength(elem: IrBytesElem, receiver: string, bytes: boolean): LlValue;
|
|
1033
1139
|
emitBytesGet(elem: IrBytesElem, receiver: string, index: LlValue, expr?: IrExpr, inBounds?: boolean, invalidNaN?: boolean): LlValue;
|
|
1034
1140
|
emitToUint32(value: string, expr?: IrExpr, uint32?: string): string;
|
|
1141
|
+
/** Stores a number into its int32-stored local, when it is one. The
|
|
1142
|
+
* value is proven to be in the local's range, so its low 32 bits are the
|
|
1143
|
+
* exact value. */
|
|
1144
|
+
storeInt32Local(localId: string, value: LlValue, expr?: IrExpr): boolean;
|
|
1145
|
+
/** The number of an int32-stored local's i32, with the i32 as its
|
|
1146
|
+
* integer and ToUint32 forms. A parameter the body never writes reads
|
|
1147
|
+
* as its incoming double, which is the same number. */
|
|
1148
|
+
int32LocalValue(localId: string, bits: string, type: IrType): LlValue;
|
|
1035
1149
|
storeIntegerView(localId: string, value: LlValue, expr?: IrExpr): void;
|
|
1036
1150
|
private emitBytesSet;
|
|
1037
1151
|
emitBytesIntrinsic(e: IrExpr & {
|