@scriptc/compiler 0.0.33 → 0.0.35
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/dist/backend/cc-cache.test.js +1091 -7
- package/dist/backend/cc-cache.test.js.map +1 -1
- package/dist/backend/cc.d.ts +109 -18
- package/dist/backend/cc.js +1057 -289
- package/dist/backend/cc.js.map +1 -1
- package/dist/backend/emission/emit-exprs.js +26 -1
- package/dist/backend/emission/emit-exprs.js.map +1 -1
- package/dist/backend/emission/emit-shapes.js +37 -4
- package/dist/backend/emission/emit-shapes.js.map +1 -1
- package/dist/backend/emission/emitter.d.ts +11 -2
- package/dist/backend/emission/emitter.js +11 -5
- package/dist/backend/emission/emitter.js.map +1 -1
- package/dist/backend/library-identity.d.ts +22 -0
- package/dist/backend/library-identity.js +103 -0
- package/dist/backend/library-identity.js.map +1 -0
- package/dist/backend/llvm/emitter.d.ts +3 -0
- package/dist/backend/llvm/emitter.js +35 -5
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/backend/llvm/shapes.d.ts +1 -0
- package/dist/backend/llvm/shapes.js +25 -1
- package/dist/backend/llvm/shapes.js.map +1 -1
- package/dist/backend/llvm/split.d.ts +43 -0
- package/dist/backend/llvm/split.js +227 -0
- package/dist/backend/llvm/split.js.map +1 -0
- package/dist/backend/llvm/split.test.d.ts +1 -0
- package/dist/backend/llvm/split.test.js +102 -0
- package/dist/backend/llvm/split.test.js.map +1 -0
- package/dist/backend/mangle.d.ts +1 -0
- package/dist/backend/mangle.js +3 -0
- package/dist/backend/mangle.js.map +1 -1
- package/dist/backend/object-localize.d.ts +5 -5
- package/dist/backend/object-localize.js +19 -16
- package/dist/backend/object-localize.js.map +1 -1
- package/dist/backend/object-localize.test.js +57 -13
- package/dist/backend/object-localize.test.js.map +1 -1
- package/dist/executable/early-cache.d.ts +86 -0
- package/dist/executable/early-cache.js +460 -0
- package/dist/executable/early-cache.js.map +1 -0
- package/dist/executable/early-cache.test.d.ts +1 -0
- package/dist/executable/early-cache.test.js +300 -0
- package/dist/executable/early-cache.test.js.map +1 -0
- package/dist/ffi/profile.d.ts +7 -2
- package/dist/ffi/profile.js +1 -0
- package/dist/ffi/profile.js.map +1 -1
- package/dist/frontend/input-tracker.d.ts +82 -0
- package/dist/frontend/input-tracker.js +380 -0
- package/dist/frontend/input-tracker.js.map +1 -0
- package/dist/frontend/input-tracker.test.d.ts +1 -0
- package/dist/frontend/input-tracker.test.js +137 -0
- package/dist/frontend/input-tracker.test.js.map +1 -0
- package/dist/frontend/lowering/lower-builtins.js +4 -10
- package/dist/frontend/lowering/lower-builtins.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.js +169 -144
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-classes.js +3 -0
- package/dist/frontend/lowering/lower-classes.js.map +1 -1
- package/dist/frontend/lowering/lower-containers.js +66 -32
- package/dist/frontend/lowering/lower-containers.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.js +89 -11
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-inspect.js +45 -26
- package/dist/frontend/lowering/lower-inspect.js.map +1 -1
- package/dist/frontend/lowering/lower-island.js +3 -3
- package/dist/frontend/lowering/lower-island.js.map +1 -1
- package/dist/frontend/lowering/lower-mixins.js +1 -1
- package/dist/frontend/lowering/lower-mixins.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.js +1 -1
- package/dist/frontend/lowering/lower-modules.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.js +49 -4
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +73 -29
- package/dist/frontend/lowering/lowerer.js +588 -116
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/lowering/surfaces.js +1 -1
- package/dist/frontend/lowering/surfaces.js.map +1 -1
- package/dist/frontend/npm-static-rewrite.js +25 -26
- package/dist/frontend/npm-static-rewrite.js.map +1 -1
- package/dist/frontend/npm-static.js +29 -30
- package/dist/frontend/npm-static.js.map +1 -1
- package/dist/frontend/npm-static.test.d.ts +1 -0
- package/dist/frontend/npm-static.test.js +15 -0
- package/dist/frontend/npm-static.test.js.map +1 -0
- package/dist/frontend/npm.js +5 -17
- package/dist/frontend/npm.js.map +1 -1
- package/dist/frontend/program.js +44 -19
- package/dist/frontend/program.js.map +1 -1
- package/dist/frontend/resolve.js +8 -29
- package/dist/frontend/resolve.js.map +1 -1
- package/dist/frontend/ts7/checker.d.ts +40 -2
- package/dist/frontend/ts7/checker.js +194 -32
- package/dist/frontend/ts7/checker.js.map +1 -1
- package/dist/frontend/ts7/program.js +17 -18
- package/dist/frontend/ts7/program.js.map +1 -1
- package/dist/frontend/types.d.ts +33 -0
- package/dist/frontend/types.js +134 -45
- package/dist/frontend/types.js.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.js +458 -141
- package/dist/index.js.map +1 -1
- package/dist/ir/nodes.d.ts +27 -4
- package/dist/ir/nodes.js +28 -0
- package/dist/ir/nodes.js.map +1 -1
- package/dist/ir/serialize.d.ts +1 -1
- package/dist/ir/serialize.js +1 -1
- package/dist/ir/validate.js +37 -1
- package/dist/ir/validate.js.map +1 -1
- package/dist/library/early-cache.d.ts +65 -0
- package/dist/library/early-cache.js +361 -0
- package/dist/library/early-cache.js.map +1 -0
- package/dist/library/early-cache.test.d.ts +1 -0
- package/dist/library/early-cache.test.js +528 -0
- package/dist/library/early-cache.test.js.map +1 -0
- package/dist/library/implementation-identity.d.ts +23 -0
- package/dist/library/implementation-identity.js +84 -0
- package/dist/library/implementation-identity.js.map +1 -0
- package/dist/library/int-infer.js +14 -0
- package/dist/library/int-infer.js.map +1 -1
- package/dist/library/int-infer.test.js +21 -4
- package/dist/library/int-infer.test.js.map +1 -1
- package/dist/library/semantic-source.d.ts +13 -0
- package/dist/library/semantic-source.js +257 -0
- package/dist/library/semantic-source.js.map +1 -0
- package/dist/library/semantic-source.test.d.ts +1 -0
- package/dist/library/semantic-source.test.js +113 -0
- package/dist/library/semantic-source.test.js.map +1 -0
- package/dist/library/sidecar.d.ts +6 -0
- package/dist/library/sidecar.js +11 -0
- package/dist/library/sidecar.js.map +1 -1
- package/dist/startup-cache.d.ts +6 -0
- package/dist/startup-cache.js +6 -0
- package/dist/startup-cache.js.map +1 -0
- package/package.json +3 -2
- package/surface-manifest.json +1 -1
|
@@ -232,13 +232,13 @@ export interface LowerOptions {
|
|
|
232
232
|
}
|
|
233
233
|
/** The Lowerer's pass configuration (see lowerToIr). */
|
|
234
234
|
export interface LowererMode {
|
|
235
|
-
/** Names of bodies
|
|
235
|
+
/** Names of bodies a prior reachability pass reached; null lowers everything. */
|
|
236
236
|
reachable?: ReadonlySet<string> | null;
|
|
237
237
|
/** Coverage remainder: lower ONLY bodies outside `reachable`, skip the
|
|
238
238
|
* always-reachable init bodies and module building, and report deferred
|
|
239
239
|
* collection diagnostics nothing flushed. */
|
|
240
240
|
remainder?: boolean;
|
|
241
|
-
/** Symbols whose deferred diagnostics
|
|
241
|
+
/** Symbols whose deferred diagnostics reachable emit already flushed —
|
|
242
242
|
* the remainder must not report them a second time. */
|
|
243
243
|
alreadyFlushed?: ReadonlySet<ts.Symbol>;
|
|
244
244
|
/** The build's target platform (LowerOptions.targetPlatform — lowerToIr
|
|
@@ -261,24 +261,22 @@ export interface LowererMode {
|
|
|
261
261
|
/** LowerOptions.externalTypeSpecifiersByFile, shared by every pass. */
|
|
262
262
|
externalTypeSpecifiersByFile?: ReadonlyMap<string, readonly string[]>;
|
|
263
263
|
}
|
|
264
|
-
/** Build lowering runs
|
|
264
|
+
/** Build lowering runs as a reachability worklist over the ts.Program:
|
|
265
265
|
*
|
|
266
|
-
* 1.
|
|
266
|
+
* 1. REACHABLE EMIT — a worklist computes the set of reachable bodies.
|
|
267
|
+
* Seeds are
|
|
267
268
|
* the per-file init bodies (module top-level statements always run, in
|
|
268
269
|
* import order); lowering a body yields IR whose call/closure/new/
|
|
269
|
-
* virtualCall nodes are the edges that enqueue further bodies. The
|
|
270
|
-
*
|
|
271
|
-
*
|
|
272
|
-
*
|
|
273
|
-
*
|
|
274
|
-
*
|
|
275
|
-
* pass did not mark. Keeping the emit order (and lambda/instance
|
|
276
|
-
* numbering) identical to the pre-reachability compiler means a fully
|
|
277
|
-
* reachable program emits byte-identical C.
|
|
270
|
+
* virtualCall nodes are the edges that enqueue further bodies. The pass
|
|
271
|
+
* retains that IR. Once the graph closes, those functions are assembled in
|
|
272
|
+
* deterministic declaration order beside the already-lowered init,
|
|
273
|
+
* generic-instance, and lifted bodies. Checker-backed IR construction
|
|
274
|
+
* therefore happens once instead of once for discovery and again for
|
|
275
|
+
* emission.
|
|
278
276
|
*
|
|
279
|
-
* `coverage: true` adds a
|
|
280
|
-
* the bodies
|
|
281
|
-
* nothing flushed), reported separately: whole-program analysis without
|
|
277
|
+
* `coverage: true` adds a second pass — the REMAINDER — that lowers only
|
|
278
|
+
* the bodies reachable emit did NOT mark (plus deferred collection
|
|
279
|
+
* diagnostics nothing flushed), reported separately: whole-program analysis without
|
|
282
280
|
* letting unreached code fail builds. */
|
|
283
281
|
export declare function lowerToIr(program: ts.Program, entry: ts.SourceFile, moduleOrder: ts.SourceFile[], options?: LowerOptions): LowerResult;
|
|
284
282
|
/** The island-handle type a `import(...)` initializer gives a binding
|
|
@@ -429,6 +427,26 @@ export declare class Lowerer {
|
|
|
429
427
|
info: GenericFnInfo;
|
|
430
428
|
inst: GenericInstance;
|
|
431
429
|
}[];
|
|
430
|
+
/** Historical emit rank of the retained declaration/init body currently
|
|
431
|
+
* lowering, and the earliest such owner that demanded each generic
|
|
432
|
+
* instance. Reachability can encounter a later caller first; the minimum
|
|
433
|
+
* rank recovers the old emitter's source-order monomorphization queue. */
|
|
434
|
+
private genericDemandOwner;
|
|
435
|
+
private readonly genericDemandRoots;
|
|
436
|
+
private readonly genericFunctionDemandOwner;
|
|
437
|
+
private readonly genericClassDemandOwner;
|
|
438
|
+
private readonly genericDemandPriority;
|
|
439
|
+
private readonly genericClassDemandPriority;
|
|
440
|
+
private withGenericDemandOwner;
|
|
441
|
+
noteGenericInstanceDemand(inst: GenericInstance): void;
|
|
442
|
+
noteGenericClassInstanceDemand(info: ClassInfo): void;
|
|
443
|
+
/** The old emitter lowered all reachable declarations in source order,
|
|
444
|
+
* then every init, before draining generic instances FIFO. Reorder the
|
|
445
|
+
* retained queue from those recorded demands before any generic body
|
|
446
|
+
* lowers, so immediate support decisions see the same shape metadata too. */
|
|
447
|
+
private restoreGenericInstanceOrder;
|
|
448
|
+
private restoreGenericClassInstanceOrder;
|
|
449
|
+
private settleGenericDemandPriorities;
|
|
432
450
|
/** Non-null while an instance body lowers: type-parameter symbol →
|
|
433
451
|
* concrete IR type, consulted inside mapType's recursion. */
|
|
434
452
|
typeParamBindings: Map<ts.Symbol, IrType> | null;
|
|
@@ -482,6 +500,16 @@ export declare class Lowerer {
|
|
|
482
500
|
/** Synthetic array-HOF loop functions (map/filter/forEach desugar),
|
|
483
501
|
* interned per method + element/callback-result type: key → fn name. */
|
|
484
502
|
readonly arrHofHelpers: Map<string, string>;
|
|
503
|
+
/** Derived shape metadata that depends on another shape's declaration
|
|
504
|
+
* order. These settle before helper bodies rebuild from that metadata. */
|
|
505
|
+
readonly shapeOrderMetadataFinalizers: (() => void)[];
|
|
506
|
+
/** Settled generic class-rest metadata requires the historical emit
|
|
507
|
+
* fallback so its fence can poison the original statement atomically. */
|
|
508
|
+
requiresHistoricalOrderRelower: boolean;
|
|
509
|
+
/** Helpers that snapshot shape declaration order into their bodies.
|
|
510
|
+
* Reachability lowers inits before the declarations they discover, so
|
|
511
|
+
* these rebuild after the worklist restores historical shape metadata. */
|
|
512
|
+
readonly shapeOrderHelperFinalizers: (() => void)[];
|
|
485
513
|
/** Emit-override specializations (`%C.emit:<event>` — lower-emitter.ts's
|
|
486
514
|
* emit-overrides block): interned names, the drive-loop queue, and the
|
|
487
515
|
* currently-lowering specialization's context (the super-forward
|
|
@@ -726,7 +754,7 @@ export declare class Lowerer {
|
|
|
726
754
|
* through `this`, so the same ctx serves generic bodies too). */
|
|
727
755
|
readonly typeCtx: TypeMapperCtx;
|
|
728
756
|
readonly stats: LowerStats;
|
|
729
|
-
/**
|
|
757
|
+
/** Reachability edge sink: every resolution of
|
|
730
758
|
* a reference to a lowerable body reports its name here — recorded even
|
|
731
759
|
* when the enclosing statement later poisons. */
|
|
732
760
|
onEdge: ((name: string) => void) | null;
|
|
@@ -767,9 +795,12 @@ export declare class Lowerer {
|
|
|
767
795
|
readonly varGlobalEntryInits: Map<ts.SourceFile, IrGlobal[]>;
|
|
768
796
|
get ctx(): FnCtx;
|
|
769
797
|
get scopes(): Map<ts.Symbol, IrLocal>[];
|
|
770
|
-
/** Names of bodies
|
|
771
|
-
* (the discovery pass itself). */
|
|
798
|
+
/** Names of bodies a prior reachability pass reached; null lowers everything. */
|
|
772
799
|
readonly reachable: ReadonlySet<string> | null;
|
|
800
|
+
/** Reachability computed by this same Lowerer when retained worklist IR
|
|
801
|
+
* is assembled directly. The configured reachable set remains null so
|
|
802
|
+
* demand-driven instance lowering keeps its existing gates. */
|
|
803
|
+
reachableForArtifacts: ReadonlySet<string> | null;
|
|
773
804
|
/** Coverage remainder mode: the reachability gate inverts (see wantBody)
|
|
774
805
|
* and no module is built. */
|
|
775
806
|
readonly remainder: boolean;
|
|
@@ -848,7 +879,7 @@ export declare class Lowerer {
|
|
|
848
879
|
* namespace path (nsPathPrefix), so `namespace A { export class C }`
|
|
849
880
|
* and a top-level `class C` never collide. Class EXPRESSIONS name by
|
|
850
881
|
* SOURCE POSITION (`%cx<start>.<name>`): deterministic across the
|
|
851
|
-
*
|
|
882
|
+
* builds (no counter can drift between invocations),
|
|
852
883
|
* program-unique through the file qualifier, and collision-free with
|
|
853
884
|
* user identifiers ('%'). */
|
|
854
885
|
readonly classNamer: (decl: ts.ClassLikeDeclaration) => string;
|
|
@@ -939,13 +970,16 @@ export declare class Lowerer {
|
|
|
939
970
|
* their external dependencies by name). Null for everything else
|
|
940
971
|
* (builtins load nothing; the rest kept its preflight fence). */
|
|
941
972
|
requireInitStmt(spec: string, node: ts.Node): IrStmt | null;
|
|
942
|
-
/** True when this body should lower: everything with no reachable set
|
|
943
|
-
*
|
|
973
|
+
/** True when this body should lower: everything with no reachable set,
|
|
974
|
+
* the marked bodies in an externally-gated pass, and exactly the
|
|
944
975
|
* UNMARKED bodies in the coverage remainder. */
|
|
945
976
|
wantBody(name: string): boolean;
|
|
946
977
|
collectNpmImports(parts: FileParts[]): void;
|
|
947
978
|
collectJsonImports(parts: FileParts[]): void;
|
|
948
979
|
run(): LowerResult;
|
|
980
|
+
/** Final retention, pruning, and module assembly shared by ordinary emit
|
|
981
|
+
* and the retained reachability worklist. */
|
|
982
|
+
finishModule(functions: IrFunction[]): LowerResult;
|
|
949
983
|
/** The unregistered-class type sweep (run()'s last step before the
|
|
950
984
|
* module assembles): every `{kind:"object"}` TYPE naming a class with
|
|
951
985
|
* no registered ClassInfo is rewritten IN PLACE to the f64 dummy.
|
|
@@ -962,12 +996,13 @@ export declare class Lowerer {
|
|
|
962
996
|
typeNamesUnregisteredClass(t: IrType, seen?: Set<string>): boolean;
|
|
963
997
|
/** Whether run() counts a signature-blocked declaration in
|
|
964
998
|
* stats.functionsSkipped: whole-program passes and the coverage
|
|
965
|
-
* remainder do;
|
|
999
|
+
* remainder do; an externally-gated emit pass leaves the counting to the
|
|
966
1000
|
* remainder (the declaration was never reached). */
|
|
967
1001
|
countsSkips(): boolean;
|
|
968
|
-
/**
|
|
969
|
-
* reaches. Seeds are the per-file
|
|
970
|
-
* run); edges fire from
|
|
1002
|
+
/** Reachable emit: computes the set of body names the program's entry
|
|
1003
|
+
* reaches and retains each body IR as it lowers. Seeds are the per-file
|
|
1004
|
+
* init bodies (top-level statements always run); edges fire from
|
|
1005
|
+
* RESOLUTION sites while a body lowers (noteEdge /
|
|
971
1006
|
* noteVirtualEdge) — direct calls, closure creation (a taken closure may
|
|
972
1007
|
* be called indirectly), `new`, super calls, accessor invocations, and
|
|
973
1008
|
* virtual dispatch. Recording at resolution time (not off the produced
|
|
@@ -977,9 +1012,12 @@ export declare class Lowerer {
|
|
|
977
1012
|
* demand-driven) and lifted lambdas lower inline with their enclosing
|
|
978
1013
|
* body; both fire edges through the same hooks and are not units
|
|
979
1014
|
* themselves. */
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
1015
|
+
emitReachable(extraRoots?: readonly string[]): {
|
|
1016
|
+
reachable: Set<string>;
|
|
1017
|
+
result: LowerResult;
|
|
1018
|
+
};
|
|
1019
|
+
/** Reachability hook (see emitReachable): fires when lowering resolves a
|
|
1020
|
+
* reference to a lowerable body. */
|
|
983
1021
|
noteEdge(name: string): void;
|
|
984
1022
|
/** Discovery hook for virtual dispatch: a virtualCall on `info`'s static
|
|
985
1023
|
* class reaches the nearest declaration at/above it plus every override
|
|
@@ -1639,6 +1677,12 @@ export declare class Lowerer {
|
|
|
1639
1677
|
lowerGenericFnValue(ref: ts.Expression, info: GenericFnInfo): IrExpr;
|
|
1640
1678
|
inferTypeParamBindings(expr: ts.CallExpression, info: GenericFnInfo, rsig: ts.Signature, tsBindings?: Map<ts.Symbol, ts.Type>): Map<ts.Symbol, IrType>;
|
|
1641
1679
|
lowerGenericInstance(info: GenericFnInfo, inst: GenericInstance): IrFunction;
|
|
1680
|
+
/** Checker work class SHAPE collection performs inside otherwise
|
|
1681
|
+
* deferred JavaScript bodies. Constructor assignments declare fields,
|
|
1682
|
+
* so collection asks for each `this.x` symbol and RHS type even when the
|
|
1683
|
+
* constructor is unreachable. Keep that mandatory work batched without
|
|
1684
|
+
* sweeping unrelated dead method bodies. */
|
|
1685
|
+
private prefetchClassCollection;
|
|
1642
1686
|
collectClassShape(decl: ts.ClassDeclaration): void;
|
|
1643
1687
|
collectClassShapeInner(decl: ts.ClassLikeDeclaration, jsNameOverride?: string, inst?: {
|
|
1644
1688
|
family: ClassInfo;
|