@geastack/compiler 1.0.49 → 1.0.63
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/README.md +57 -19
- package/dist/cli.js +2 -1
- package/dist/compiler.js +8 -2
- package/dist/conversion/derive.js +5 -0
- package/dist/conversion/native-field-view.d.ts +7 -0
- package/dist/conversion/native-field-view.js +50 -0
- package/dist/conversion/native-record-products.js +1 -0
- package/dist/conversion/native-view-origins.d.ts +1 -1
- package/dist/conversion/native-view-origins.js +5 -4
- package/dist/conversion/nodes.d.ts +9 -0
- package/dist/conversion/nodes.js +18 -0
- package/dist/conversion/record-view.d.ts +25 -1
- package/dist/conversion/record-view.js +61 -2
- package/dist/conversion/structural-plan.js +7 -6
- package/dist/ir/borrowed-field-reads.d.ts +30 -0
- package/dist/ir/borrowed-field-reads.js +218 -0
- package/dist/ir/borrowed-window-cells.d.ts +35 -0
- package/dist/ir/borrowed-window-cells.js +117 -0
- package/dist/ir/call-dispatch.js +21 -4
- package/dist/ir/callable-class-flow.js +269 -43
- package/dist/ir/captures.js +18 -1
- package/dist/ir/certify.js +14 -1
- package/dist/ir/construction-only-fields.d.ts +15 -1
- package/dist/ir/construction-only-fields.js +71 -3
- package/dist/ir/dead-logical-merge.d.ts +4 -0
- package/dist/ir/dead-logical-merge.js +89 -18
- package/dist/ir/dense-loops.d.ts +38 -4
- package/dist/ir/dense-loops.js +120 -18
- package/dist/ir/dense-read-windows.d.ts +42 -0
- package/dist/ir/dense-read-windows.js +137 -0
- package/dist/ir/facts.d.ts +12 -0
- package/dist/ir/facts.js +18 -2
- package/dist/ir/field-read-reuse.d.ts +71 -0
- package/dist/ir/field-read-reuse.js +430 -0
- package/dist/ir/hoist.d.ts +19 -2
- package/dist/ir/hoist.js +143 -24
- package/dist/ir/lower-narrow.js +19 -1
- package/dist/ir/model.d.ts +19 -0
- package/dist/ir/native-field-view-domains.d.ts +12 -2
- package/dist/ir/native-field-view-domains.js +51 -15
- package/dist/ir/native-field-view-facts.js +5 -2
- package/dist/ir/native-method-frames.js +15 -2
- package/dist/ir/plain-field-read.d.ts +31 -0
- package/dist/ir/plain-field-read.js +51 -0
- package/dist/ir/program-facts.d.ts +14 -0
- package/dist/ir/program-facts.js +85 -2
- package/dist/ir/proven-branches.js +8 -1
- package/dist/ir/publish-conversion-recipes.js +5 -1
- package/dist/ir/short-circuit-threading.d.ts +12 -4
- package/dist/ir/short-circuit-threading.js +124 -12
- package/dist/ir/stable-cell-reads.d.ts +24 -1
- package/dist/ir/stable-cell-reads.js +65 -42
- package/dist/ir/write-effects.d.ts +42 -0
- package/dist/ir/write-effects.js +208 -0
- package/dist/plugins/gea/contract.d.ts +3 -2
- package/dist/plugins/gea/contract.js +3 -1
- package/dist/plugins/gea/host.d.ts +7 -2
- package/dist/plugins/gea/host.js +25 -5
- package/dist/project-preparation.d.ts +11 -0
- package/dist/project-preparation.js +44 -0
- package/dist/projection/classes.d.ts +8 -0
- package/dist/projection/classes.js +112 -12
- package/dist/projection/dispatch.d.ts +24 -4
- package/dist/projection/dispatch.js +71 -2
- package/dist/projection/fields.js +2 -2
- package/dist/representation/model.d.ts +3 -0
- package/dist/representation/model.js +3 -0
- package/dist/representation/value-records.js +22 -0
- package/dist/semantics/frontend-timing.d.ts +9 -0
- package/dist/semantics/frontend-timing.js +43 -2
- package/dist/semantics/frontend.js +103 -7
- package/dist/semantics/model/operations.d.ts +7 -0
- package/dist/semantics/normalize/binding-fixpoint.js +7 -2
- package/dist/semantics/normalize/callable-data-write.js +6 -2
- package/dist/semantics/normalize/field-bindings.js +151 -111
- package/dist/semantics/normalize/flow/callable-reach.js +27 -0
- package/dist/semantics/normalize/flow/component-solver.js +23 -5
- package/dist/semantics/normalize/flow/source-record-data.js +6 -2
- package/dist/semantics/normalize/flow/source-value-session.d.ts +13 -0
- package/dist/semantics/normalize/flow/source-value-session.js +207 -65
- package/dist/semantics/normalize/global-host-mutations.js +162 -1
- package/dist/semantics/normalize/parameter-bindings.js +16 -1
- package/dist/semantics/normalize/producers/class-lifecycle.js +2 -1
- package/dist/semantics/normalize/producers/erasure.js +13 -8
- package/dist/semantics/subclass-member-overlay-transform.js +17 -4
- package/dist/semantics/typescript-tsgo.d.ts +20 -0
- package/dist/semantics/typescript-tsgo.js +832 -0
- package/dist/semantics/typescript.d.ts +0 -9
- package/dist/semantics/typescript.js +4 -1
- package/dist/targets/cpp/borrowed-call-entry.d.ts +9 -0
- package/dist/targets/cpp/borrowed-call-entry.js +12 -2
- package/dist/targets/cpp/captures.js +4 -0
- package/dist/targets/cpp/class-properties/computed-method-value.d.ts +1 -1
- package/dist/targets/cpp/class-properties/computed-method-value.js +17 -7
- package/dist/targets/cpp/class-properties/emit-class-properties.d.ts +8 -0
- package/dist/targets/cpp/class-properties/emit-class-properties.js +62 -2
- package/dist/targets/cpp/class-properties/native-method-read.js +12 -1
- package/dist/targets/cpp/conversions.js +1 -0
- package/dist/targets/cpp/emit-arrays.d.ts +5 -0
- package/dist/targets/cpp/emit-arrays.js +60 -10
- package/dist/targets/cpp/emit-binding-reference.d.ts +19 -6
- package/dist/targets/cpp/emit-binding-reference.js +26 -8
- package/dist/targets/cpp/emit-bindings.js +22 -0
- package/dist/targets/cpp/emit-callable.js +133 -16
- package/dist/targets/cpp/emit-carrier-members.d.ts +6 -0
- package/dist/targets/cpp/emit-carrier-members.js +24 -2
- package/dist/targets/cpp/emit-context.d.ts +97 -1
- package/dist/targets/cpp/emit-context.js +52 -0
- package/dist/targets/cpp/emit-equality.js +3 -0
- package/dist/targets/cpp/emit-narrowing.js +9 -0
- package/dist/targets/cpp/emit-native-field-view.d.ts +24 -0
- package/dist/targets/cpp/emit-native-field-view.js +87 -8
- package/dist/targets/cpp/emit-properties.js +139 -16
- package/dist/targets/cpp/emit-record-view.js +49 -22
- package/dist/targets/cpp/emit-return.js +5 -1
- package/dist/targets/cpp/emit-tonumber.js +4 -1
- package/dist/targets/cpp/emit-union-properties.js +1 -1
- package/dist/targets/cpp/emit.d.ts +4 -1
- package/dist/targets/cpp/emit.js +148 -6
- package/dist/targets/cpp/reactive-dependencies.js +100 -28
- package/dist/targets/cpp/translation-unit.js +71 -17
- package/dist/targets/cpp/virtual-methods.d.ts +2 -2
- package/dist/targets/cpp/virtual-methods.js +11 -3
- package/package.json +1 -1
- package/src/targets/cpp/runtime/gea_runtime.h +400 -21
|
@@ -66,7 +66,7 @@ import { withJsDocTypeNames } from './normalize/jsdoc-type-names.js';
|
|
|
66
66
|
import { censusReachability, wholeProgram, fileEvaluates, moduleEvaluationOrder, nodeIsReachable } from './normalize/reachability.js';
|
|
67
67
|
import { createProgram, defaultCompilerOptions } from './program.js';
|
|
68
68
|
import { createJsxRuntimeModuleResolver } from './jsx-runtime-provider.js';
|
|
69
|
-
import { createFrontendTiming } from './frontend-timing.js';
|
|
69
|
+
import { createFrontendTiming, progress, progressed } from './frontend-timing.js';
|
|
70
70
|
import { deadMethodCopiesOf } from './normalize/dead-method-copies.js';
|
|
71
71
|
import { classCopyHeritageOf, classHeritageOf, nativeCollectionOverridesOf, nativeErrorOverridesOf } from './class-heritage.js';
|
|
72
72
|
import { constructorSlotSubclassesOf } from './constructor-slot-subclasses.js';
|
|
@@ -600,7 +600,7 @@ export const runFrontend = (input) => {
|
|
|
600
600
|
// move until the very round that settles, and holding the previous index
|
|
601
601
|
// alive across the boundary raised the peak from 7 GB to 11 GB.
|
|
602
602
|
const built = upstream && !process.env['GEA_FLOW_CENSUS_OFF']
|
|
603
|
-
? indexValueFlow(compiled.checker, compiled.sourceFiles, reachable, censusTypeVia(upstream), upstream.callDeclarationAt, upstream.callTargetsAt, buildIsStrict, upstream.explicitThisAt)
|
|
603
|
+
? progressed(' round: value-flow index', () => indexValueFlow(compiled.checker, compiled.sourceFiles, reachable, censusTypeVia(upstream), upstream.callDeclarationAt, upstream.callTargetsAt, buildIsStrict, upstream.explicitThisAt))
|
|
604
604
|
: baseValueFlow;
|
|
605
605
|
// The round that settles the fixpoint rebuilds the very index the round
|
|
606
606
|
// before it built (its census inputs no longer move), and that round's
|
|
@@ -625,6 +625,9 @@ export const runFrontend = (input) => {
|
|
|
625
625
|
// consumers now also see one set of write and call-site objects instead
|
|
626
626
|
// of two that are equal only field by field.
|
|
627
627
|
const valueFlow = contentEqual ? { ...contentEqual } : built;
|
|
628
|
+
const previousFlow = roundFlows[roundFlows.length - 1];
|
|
629
|
+
if (previousFlow !== undefined)
|
|
630
|
+
progress(` round: index vs previous round: ${contentEqual ? 'content-equal' : 'changed'}`);
|
|
628
631
|
if (contentEqual)
|
|
629
632
|
shareSourceValueSession(contentEqual, valueFlow);
|
|
630
633
|
// No round's solver is retired when the next round replaces it. Every
|
|
@@ -646,7 +649,7 @@ export const runFrontend = (input) => {
|
|
|
646
649
|
attachStatedModuleSet(valueFlow, statedModules);
|
|
647
650
|
if (scriptScope)
|
|
648
651
|
attachClosedScriptScope(valueFlow, scriptScope);
|
|
649
|
-
const collectionsThisRound = censusCollectionBindings(compiled.checker, compiled.sourceFiles, reachable, upstream ?? emptyParameterBindingCensus, valueFlow);
|
|
652
|
+
const collectionsThisRound = progressed(' round: collection census', () => censusCollectionBindings(compiled.checker, compiled.sourceFiles, reachable, upstream ?? emptyParameterBindingCensus, valueFlow));
|
|
650
653
|
// MOVED INSIDE the fixpoint, exactly as `collections` was, and the long
|
|
651
654
|
// comment that used to sit below this loop explaining why it could not be
|
|
652
655
|
// was WRONG. It argued that a bag's answer is an `ObjectBagShape` with no
|
|
@@ -662,15 +665,15 @@ export const runFrontend = (input) => {
|
|
|
662
665
|
// downstream of the cache's getter was dynamic behind that one refusal.
|
|
663
666
|
const bagsThisRound = process.env['GEA_BAG_OFF']
|
|
664
667
|
? emptyObjectBagCensus
|
|
665
|
-
: censusObjectBagBindings(compiled.checker, compiled.sourceFiles, reachable, upstream ?? emptyParameterBindingCensus, valueFlow);
|
|
666
|
-
const returnStage = composeReturnBindings(compiled.checker, compiled.sourceFiles, reachable, censusParameterBindings(compiled.checker, compiled.sourceFiles, reachable, upstream,
|
|
668
|
+
: progressed(' round: object-bag census', () => censusObjectBagBindings(compiled.checker, compiled.sourceFiles, reachable, upstream ?? emptyParameterBindingCensus, valueFlow));
|
|
669
|
+
const returnStage = progressed(' round: parameter and return censuses', () => composeReturnBindings(compiled.checker, compiled.sourceFiles, reachable, censusParameterBindings(compiled.checker, compiled.sourceFiles, reachable, upstream,
|
|
667
670
|
// `GEA_PARAM_INDEX_OFF` hands the census no index, so it builds its
|
|
668
671
|
// own -- which is what every round used to do. Kept the way
|
|
669
672
|
// `GEA_BAG_OFF` and `GEA_FLOW_CENSUS_OFF` are kept: the arms of the
|
|
670
673
|
// measurement that justified this have to stay runnable from one
|
|
671
674
|
// build, or the next person cannot check the claim.
|
|
672
|
-
process.env['GEA_PARAM_INDEX_OFF'] ? undefined : parameterIndex, valueFlow, specializations, hostProvidedNames), collectionsThisRound, valueFlow, bagsThisRound, upstream, commonJsModuleRecords);
|
|
673
|
-
const parameters = withSharedArrayStorage(compiled.checker, compiled.sourceFiles, reachable, withJsDocTypeNames(compiled.checker, compiled.sourceFiles, reachable, withFieldBindings(compiled.checker, compiled.sourceFiles, reachable, withLocalBindings(compiled.checker, compiled.sourceFiles, reachable, returnStage.view, collectionsThisRound, valueFlow, bagsThisRound, upstream, commonJsModuleRecords), collectionsThisRound, valueFlow)), valueFlow);
|
|
675
|
+
process.env['GEA_PARAM_INDEX_OFF'] ? undefined : parameterIndex, valueFlow, specializations, hostProvidedNames), collectionsThisRound, valueFlow, bagsThisRound, upstream, commonJsModuleRecords));
|
|
676
|
+
const parameters = progressed(' round: field, local and storage views', () => withSharedArrayStorage(compiled.checker, compiled.sourceFiles, reachable, withJsDocTypeNames(compiled.checker, compiled.sourceFiles, reachable, withFieldBindings(compiled.checker, compiled.sourceFiles, reachable, withLocalBindings(compiled.checker, compiled.sourceFiles, reachable, returnStage.view, collectionsThisRound, valueFlow, bagsThisRound, upstream, commonJsModuleRecords), collectionsThisRound, valueFlow)), valueFlow));
|
|
674
677
|
return { parameters, facts: { returns: returnStage.returns, collections: collectionsThisRound, bags: bagsThisRound, valueFlow } };
|
|
675
678
|
};
|
|
676
679
|
/**
|
|
@@ -726,23 +729,31 @@ export const runFrontend = (input) => {
|
|
|
726
729
|
// A stable count alone can hide changed carriers or a same-size swap of cells.
|
|
727
730
|
const settled = settleBindingCensus(compose);
|
|
728
731
|
timing.mark('binding-fixpoint');
|
|
732
|
+
progress('structural @1457 if');
|
|
729
733
|
if (process.env['GEA_ROUNDS_DEBUG'])
|
|
730
734
|
process.stderr.write(`[ROUNDS] ${settled.round} rounds, boundCount ${settled.parameters.boundCount}\n`);
|
|
735
|
+
progress('structural @1459 parameters');
|
|
731
736
|
const parameters = settled.parameters;
|
|
732
737
|
// Every one of these is the SETTLING round's own instance, which is what the
|
|
733
738
|
// snapshot exists to guarantee: the structural mapper below and the censuses
|
|
734
739
|
// that produced `parameters` are looking at the identical answers.
|
|
740
|
+
progress('structural @1463 { collections, bags, valueFlow }');
|
|
735
741
|
const { collections, bags, valueFlow } = settled.facts;
|
|
736
742
|
// The census belonging to the round `parameters` is, which is the one
|
|
737
743
|
// `types` (and therefore every `typeAt`) answers from.
|
|
744
|
+
progress('structural @1466 returns');
|
|
738
745
|
const returns = settled.facts.returns;
|
|
746
|
+
progress('structural @1467 absent');
|
|
739
747
|
const absent = censusAbsentGlobals(compiled.checker, compiled.sourceFiles, input.absentGlobals ?? new Set(), platformDeclarationTest(compiled.program), namespacePaths, hostProvidedNames);
|
|
740
748
|
// Beside `argumentsObjects`, and for the identical reason: the reference
|
|
741
749
|
// producer publishes an unresolvable name's value and `citeExpressionResult`
|
|
742
750
|
// predicts it, so both must read one census rather than ask the checker
|
|
743
751
|
// twice. See `unresolvable-names.ts`.
|
|
752
|
+
progress('structural @1479 unresolvableNames');
|
|
744
753
|
const unresolvableNames = censusUnresolvableNames(compiled.checker, compiled.sourceFiles, hostProvidedNames);
|
|
754
|
+
progress('structural @1480 identities');
|
|
745
755
|
const identities = createIdentityTable(compiled.program, compiled.checker, specializations);
|
|
756
|
+
progress('structural @1481 prototypeReparentings');
|
|
746
757
|
const prototypeReparentings = prototypeReparentingsOf(compiled.checker, identities, compiled.sourceFiles);
|
|
747
758
|
// Beside `absent` and `identities`, the two facts this rests on: which host
|
|
748
759
|
// globals are declared absent, and how to name the AST positions the answer
|
|
@@ -750,8 +761,11 @@ export const runFrontend = (input) => {
|
|
|
750
761
|
// any type -- a structural `never` here would collapse to the same id as a
|
|
751
762
|
// TypeScript inference's own `never`, so the proof has to come from the
|
|
752
763
|
// guard's own shape and the host's own statement instead.
|
|
764
|
+
progress('structural @1488 deadTypeofGuards');
|
|
753
765
|
const deadTypeofGuards = censusDeadTypeofGuards(compiled.sourceFiles, absent, identities);
|
|
766
|
+
progress('structural @1489 declaredIntegers');
|
|
754
767
|
const declaredIntegers = censusDeclaredIntegers(compiled.checker, compiled.sourceFiles, identities);
|
|
768
|
+
progress('structural @1490 nativeFunctionSignatures');
|
|
755
769
|
const nativeFunctionSignatures = censusNativeFunctionSignatures(compiled.checker, compiled.sourceFiles, identities, input.nativeFunctionDeclarations ?? []);
|
|
756
770
|
// The array/collection census now runs INSIDE the fixpoint above (see
|
|
757
771
|
// `compose`'s own comment) rather than once more here over the settled
|
|
@@ -776,10 +790,12 @@ export const runFrontend = (input) => {
|
|
|
776
790
|
// `parameters` would answer some nodes more precisely than the one those
|
|
777
791
|
// censuses actually consulted, and the mapper would then disagree with the
|
|
778
792
|
// view that produced the bindings it is mapping.
|
|
793
|
+
progress('structural @1519 if');
|
|
779
794
|
if (process.env['GEA_BINDING_DEBUG']) {
|
|
780
795
|
process.stderr.write(`[BINDINGS] bound=${parameters.boundCount} refusals=${JSON.stringify([...censusRefusalCounts(parameters.refusals)])}\n`);
|
|
781
796
|
process.stderr.write(parameters.debugReport?.() ?? '');
|
|
782
797
|
}
|
|
798
|
+
progress('structural @1525 if');
|
|
783
799
|
if (process.env['GEA_BAG_DEBUG']) {
|
|
784
800
|
process.stderr.write(`[BAG] bound=${bags.boundCount} refusals=${JSON.stringify([...censusRefusalCounts(bags.refusals)])}\n`);
|
|
785
801
|
process.stderr.write(bags.debugReport());
|
|
@@ -789,6 +805,7 @@ export const runFrontend = (input) => {
|
|
|
789
805
|
// refuses names a carrier the checker's `[TYPE]` line does not show -- a
|
|
790
806
|
// `typeof`-narrowed `string` read that reaches the field as a number is a
|
|
791
807
|
// disagreement between these two lines, and only seeing both locates it.
|
|
808
|
+
progress('structural @1534 if');
|
|
792
809
|
if (process.env['GEA_TYPE_AT']) {
|
|
793
810
|
const [want, lineText] = String(process.env['GEA_TYPE_AT']).split('#');
|
|
794
811
|
const wantLine = Number(lineText);
|
|
@@ -814,7 +831,9 @@ export const runFrontend = (input) => {
|
|
|
814
831
|
}
|
|
815
832
|
// Before the mapper, which lays every family member out as the one layout
|
|
816
833
|
// this census names -- see `interface-families.ts`.
|
|
834
|
+
progress('structural @1560 interfaceFamilies');
|
|
817
835
|
const interfaceFamilies = interfaceFamiliesOf(compiled.checker, identities, compiled.sourceFiles);
|
|
836
|
+
progress('structural @1561 if');
|
|
818
837
|
if (process.env['GEA_FAMILY_DEBUG']) {
|
|
819
838
|
for (const family of interfaceFamilies.families) {
|
|
820
839
|
process.stderr.write(`[FAMILY] ${family.key}: ${family.members.map((member) => member.name.text).join(' ')}\n`);
|
|
@@ -823,12 +842,16 @@ export const runFrontend = (input) => {
|
|
|
823
842
|
// Descriptor input facts become usable only after the existing mutation
|
|
824
843
|
// census seals this shared set. Its rawTypeAt input bypasses structural
|
|
825
844
|
// descriptor inference, so this introduces no inference cycle.
|
|
845
|
+
progress('structural @1569 globalHostMutationTaint');
|
|
826
846
|
const globalHostMutationTaint = new HostMutationTaint();
|
|
827
847
|
// One reaching-definition proof, shared by the invocation producer (which
|
|
828
848
|
// lowers a static `require` to a module record) and the global host
|
|
829
849
|
// mutation census (which must agree with it on which calls those are).
|
|
850
|
+
progress('structural @1573 commonJsRequire');
|
|
830
851
|
const commonJsRequire = createCommonJsRequireCensus(compiled.checker, compiled.program.getSourceFiles(), input.commonJsGlobals ?? new Map());
|
|
852
|
+
progress('structural @1578 hostMutationFactsSealed');
|
|
831
853
|
let hostMutationFactsSealed = false;
|
|
854
|
+
progress('structural @1579 intrinsicPropertyContext');
|
|
832
855
|
const intrinsicPropertyContext = {
|
|
833
856
|
checker: compiled.checker,
|
|
834
857
|
identities,
|
|
@@ -848,12 +871,14 @@ export const runFrontend = (input) => {
|
|
|
848
871
|
* on faith. After the seal the same receipt is replayed against the sealed
|
|
849
872
|
* facts. A receipt with no obligations is the same answer at both stages.
|
|
850
873
|
*/
|
|
874
|
+
progress('structural @1598 receiptUnderIntrinsicObligations');
|
|
851
875
|
const receiptUnderIntrinsicObligations = (work) => {
|
|
852
876
|
const proof = intrinsicProtocols.capture(work);
|
|
853
877
|
if (!hostMutationFactsSealed)
|
|
854
878
|
return proof.requirements.length === 0 || intrinsicProtocols.include(proof.requirements) ? proof.value : null;
|
|
855
879
|
return failedIntrinsicProtocolRequirements(intrinsicPropertyContext, proof.requirements).length === 0 ? proof.value : null;
|
|
856
880
|
};
|
|
881
|
+
progress('structural @1604 types');
|
|
857
882
|
const types = createStructuralMapper(compiled.checker, identities, table, instantiations, specializations, parameters, absent, collections, bags, valueFlow, interfaceFamilies, commonJsModuleRecords, censusDeclaredMembers(compiled.checker, compiled.sourceFiles, identities, (body) => bodyReadsThis(body), reachable), (call) => hostMutationFactsSealed && intrinsicPropertyCallOf(intrinsicPropertyContext, call, call.expression) === 'getOwnPropertyDescriptor',
|
|
858
883
|
// A record spreading a class instance into a union whose only home for it
|
|
859
884
|
// is that class keeps its own arm in every union it reaches -- see
|
|
@@ -887,10 +912,12 @@ export const runFrontend = (input) => {
|
|
|
887
912
|
// into `parameters`/`returns`/`collections`/`bags`, and nothing downstream
|
|
888
913
|
// reads `cellFacts` back, so this cannot change what any of those censuses,
|
|
889
914
|
// or `types` itself, answer.
|
|
915
|
+
progress('structural @1660 cellFacts');
|
|
890
916
|
const cellFacts = publishCellFacts(buildCellFactsTable(identities, valueFlow, compiled.sourceFiles, createCellPolicyRegistry(defaultCellEvidencePolicies(compiled.checker, reachable, bags.identity))), types,
|
|
891
917
|
// Only when asked -- see `cells/agreement.ts` for why an unasked `typeAt`
|
|
892
918
|
// renumbers the emitted C++.
|
|
893
919
|
Boolean(process.env['GEA_CELL_FACTS_AGREEMENT']));
|
|
920
|
+
progress('structural @1672 if');
|
|
894
921
|
if (process.env['GEA_CELL_FACTS_DEBUG']) {
|
|
895
922
|
process.stderr.write(`[CELLS] declarations=${cellFacts.table.all.length} twoOwner=${cellFacts.table.twoOwnerClaims.length} ` +
|
|
896
923
|
`refusals=${cellFacts.table.refusals.length} agreement=${JSON.stringify(cellFacts.agreement)}\n`);
|
|
@@ -898,6 +925,7 @@ export const runFrontend = (input) => {
|
|
|
898
925
|
// The STRUCTURAL half of `GEA_TYPE_AT`: the mapper's own answer, which is
|
|
899
926
|
// what every producer publishes -- a `[CENSUS]` union-arms line and a
|
|
900
927
|
// `[STRUCT]` line that disagree locate a reduction between the two.
|
|
928
|
+
progress('structural @1681 if');
|
|
901
929
|
if (process.env['GEA_TYPE_AT']) {
|
|
902
930
|
const [want, lineText] = String(process.env['GEA_TYPE_AT']).split('#');
|
|
903
931
|
const wantLine = Number(lineText);
|
|
@@ -919,18 +947,27 @@ export const runFrontend = (input) => {
|
|
|
919
947
|
visit(file);
|
|
920
948
|
}
|
|
921
949
|
}
|
|
950
|
+
progress('structural @1700 prototypeFallback');
|
|
922
951
|
const prototypeFallback = input.dynamicFallback
|
|
923
952
|
? prototypeMutatedConstructorTypes(compiled.sourceFiles, compiled.checker, types, identities)
|
|
924
953
|
: { types: new Set(), callables: new Set() };
|
|
954
|
+
progress('structural @1703 dynamicFallbackTypes');
|
|
925
955
|
const dynamicFallbackTypes = input.dynamicFallback
|
|
926
956
|
? new Set([...proxyFallbackTypes(compiled.sourceFiles, compiled.checker, types), ...prototypeFallback.types])
|
|
927
957
|
: new Set();
|
|
958
|
+
progress('structural @1706 dynamicWrittenTypes');
|
|
928
959
|
const dynamicWrittenTypes = anyKeyedWriteTypes(compiled.sourceFiles, compiled.checker, types);
|
|
960
|
+
progress('structural @1707 classHeritage');
|
|
929
961
|
const classHeritage = classHeritageOf(compiled.checker, identities, compiled.sourceFiles, prototypeReparentings.baseOf);
|
|
962
|
+
progress('structural @1708 classCopyHeritage');
|
|
930
963
|
const classCopyHeritage = classCopyHeritageOf(compiled.checker, identities, specializations, compiled.sourceFiles, classHeritage);
|
|
964
|
+
progress('structural @1709 deadMethodCopies');
|
|
931
965
|
const deadMethodCopies = deadMethodCopiesOf(compiled.checker, identities, specializations, compiled.sourceFiles, classHeritage, classCopyHeritage);
|
|
966
|
+
progress('structural @1717 census');
|
|
932
967
|
const census = censusProgram(compiled.sourceFiles, identities, reachable, specializations, namespacePaths, deadMethodCopies);
|
|
968
|
+
progress('structural @1718 sourceValueSession');
|
|
933
969
|
const sourceValueSession = sourceValueSessionOf(compiled.checker, valueFlow);
|
|
970
|
+
progress('structural @1719 specializedSourceFramesOf');
|
|
934
971
|
const specializedSourceFramesOf = createSpecializedSourceFrames(census, identities, specializations, types, sourceValueSession);
|
|
935
972
|
// Before normalization, not after: the table seals when the graph does, and a
|
|
936
973
|
// census that interns a type it is the first to ask about would be asking a
|
|
@@ -949,6 +986,7 @@ export const runFrontend = (input) => {
|
|
|
949
986
|
// `context.hostProtocols` holds the SAME map instance -- never a copy --
|
|
950
987
|
// every producer sees it fully populated by the time `normalizeProgram`
|
|
951
988
|
// actually calls any of them.
|
|
989
|
+
progress('structural @1737 hosts');
|
|
952
990
|
const hosts = {
|
|
953
991
|
protocols: new Map(),
|
|
954
992
|
externals: new Map(),
|
|
@@ -966,6 +1004,7 @@ export const runFrontend = (input) => {
|
|
|
966
1004
|
// One authority, two readers -- `derive.ts`'s carrier policy (through
|
|
967
1005
|
// `compiler.ts`) and the iteration producers below, which have to agree
|
|
968
1006
|
// about which sources take the native-cursor path.
|
|
1007
|
+
progress('structural @1754 keyedCollections');
|
|
969
1008
|
const keyedCollections = keyedCollectionDeclarationsOf(compiled.checker, identities, compiled.sourceFiles);
|
|
970
1009
|
// The same shape of fact as `keyedCollections`, with the same two readers
|
|
971
1010
|
// that must agree: `derive.ts`'s `GeneratorDeclarationPolicy` (through
|
|
@@ -974,11 +1013,17 @@ export const runFrontend = (input) => {
|
|
|
974
1013
|
// `for`-`of` over one skips the `@@iterator` lookup. Resolving it twice would
|
|
975
1014
|
// let one side take the fast path for a declaration the other did not
|
|
976
1015
|
// recognise.
|
|
1016
|
+
progress('structural @1762 generatorDeclarationEarly');
|
|
977
1017
|
const generatorDeclarationEarly = generatorDeclarationOf(compiled.checker, identities, compiled.sourceFiles);
|
|
1018
|
+
progress('structural @1763 asyncGeneratorDeclarationEarly');
|
|
978
1019
|
const asyncGeneratorDeclarationEarly = asyncGeneratorDeclarationOf(compiled.checker, identities, compiled.sourceFiles);
|
|
1020
|
+
progress('structural @1764 mapIteratorDeclarationEarly');
|
|
979
1021
|
const mapIteratorDeclarationEarly = mapIteratorDeclarationOf(compiled.checker, identities, compiled.sourceFiles);
|
|
1022
|
+
progress('structural @1765 arrayIteratorDeclarationEarly');
|
|
980
1023
|
const arrayIteratorDeclarationEarly = arrayIteratorDeclarationOf(compiled.checker, identities, compiled.sourceFiles);
|
|
1024
|
+
progress('structural @1766 standardBuffers');
|
|
981
1025
|
const standardBuffers = standardBufferDeclarationsOf(compiled.checker, identities, compiled.sourceFiles);
|
|
1026
|
+
progress('structural @1767 wellKnownSymbols');
|
|
982
1027
|
const wellKnownSymbols = wellKnownSymbolDeclarationsOf(compiled.checker, identities, compiled.sourceFiles);
|
|
983
1028
|
// A computed write key narrowed to a proven finite set -- a
|
|
984
1029
|
// `setValues(values)` method writing `this[ key ] = newValue` for each key. Built
|
|
@@ -987,6 +1032,7 @@ export const runFrontend = (input) => {
|
|
|
987
1032
|
// `computedKeyTextsOf` a few lines down (which narrows a `get`/`set`
|
|
988
1033
|
// operation's REFLECTION demand, `ir/reflection-demand.ts`).
|
|
989
1034
|
// `GEA_HOST_CENSUS_KEY_SETS_OFF` keeps every computed key unknown for both.
|
|
1035
|
+
progress('structural @1775 computedKeysOf');
|
|
990
1036
|
const computedKeysOf = process.env['GEA_HOST_CENSUS_KEY_SETS_OFF']
|
|
991
1037
|
? undefined
|
|
992
1038
|
: createCensusComputedKeysOf(compiled.checker, valueFlow, closedCallableAuthorityOf(compiled.checker, valueFlow, (expression) => types.rawTypeAt(expression), (declaration) => argumentsObjects.usesByOwner.get(declaration)));
|
|
@@ -994,6 +1040,7 @@ export const runFrontend = (input) => {
|
|
|
994
1040
|
// `computedKeyTextsOf` below checks the for-in arm's "Object.prototype
|
|
995
1041
|
// carries no enumerable key" assumption against -- the same identity
|
|
996
1042
|
// `global-host-mutations.ts`'s own `objectPrototypeKeysOf` resolves.
|
|
1043
|
+
progress('structural @1791 objectPrototypeDeclaration');
|
|
997
1044
|
const objectPrototypeDeclaration = (() => {
|
|
998
1045
|
const anchor = compiled.sourceFiles[0];
|
|
999
1046
|
const objectSymbol = anchor ? compiled.checker.resolveName('Object', anchor, ts.SymbolFlags.Value, false) : undefined;
|
|
@@ -1006,6 +1053,7 @@ export const runFrontend = (input) => {
|
|
|
1006
1053
|
// copy that reaches it -- an unmemoized re-proof per copy is exactly the
|
|
1007
1054
|
// mistake that once turned a 32s compile into 746s (see
|
|
1008
1055
|
// `geatsc-escape-proof-needs-memoized-predicates` in project memory).
|
|
1056
|
+
progress('structural @1804 provenKeyTextsCache');
|
|
1009
1057
|
const provenKeyTextsCache = new Map();
|
|
1010
1058
|
/**
|
|
1011
1059
|
* `ProducerContext.computedKeyTextsOf` -- see that field's own comment for
|
|
@@ -1020,6 +1068,7 @@ export const runFrontend = (input) => {
|
|
|
1020
1068
|
* proven" answer a refused proof gives, never a stale one built on an
|
|
1021
1069
|
* incomplete census.
|
|
1022
1070
|
*/
|
|
1071
|
+
progress('structural @1818 computedKeyTextsOf');
|
|
1023
1072
|
const computedKeyTextsOf = (key) => {
|
|
1024
1073
|
if (!hostMutationFactsSealed)
|
|
1025
1074
|
return null;
|
|
@@ -1065,21 +1114,29 @@ export const runFrontend = (input) => {
|
|
|
1065
1114
|
provenKeyTextsCache.set(key, result);
|
|
1066
1115
|
return result;
|
|
1067
1116
|
};
|
|
1117
|
+
progress('structural @1855 nativeCollectionOverrides');
|
|
1068
1118
|
const nativeCollectionOverrides = nativeCollectionOverridesOf(compiled.checker, identities, compiled.sourceFiles, classHeritage);
|
|
1119
|
+
progress('structural @1856 nativeErrorOverrides');
|
|
1069
1120
|
const nativeErrorOverrides = nativeErrorOverridesOf(compiled.checker, identities, compiled.sourceFiles, classHeritage);
|
|
1121
|
+
progress('structural @1857 installedGlobalProperties');
|
|
1070
1122
|
const installedGlobalProperties = new Map();
|
|
1123
|
+
progress('structural @1858 ownedGlobalProperties');
|
|
1071
1124
|
const ownedGlobalProperties = new Set();
|
|
1072
1125
|
// The final parameter census is also the signature mapper's authority for
|
|
1073
1126
|
// full actual-argument frames. Publication and citation share these sites.
|
|
1127
|
+
progress('structural @1861 actualArgumentSites');
|
|
1074
1128
|
const actualArgumentSites = new Set();
|
|
1129
|
+
progress('structural @1862 for');
|
|
1075
1130
|
for (const [owner, sites] of argumentsObjects.usesByOwner)
|
|
1076
1131
|
if (parameters.implicitArgumentsTupleAt?.(owner))
|
|
1077
1132
|
for (const site of sites)
|
|
1078
1133
|
actualArgumentSites.add(site);
|
|
1134
|
+
progress('structural @1864 settledArgumentsObjects');
|
|
1079
1135
|
const settledArgumentsObjects = { ...argumentsObjects, actualFrameOf: (node) => actualArgumentSites.has(node) };
|
|
1080
1136
|
// Everything a producer reads but the two ordinal counters, which are minted
|
|
1081
1137
|
// per normalization below: the counters are read only while operations are
|
|
1082
1138
|
// minted, and this context lives as long as the frontend does.
|
|
1139
|
+
progress('structural @1868 context');
|
|
1083
1140
|
const context = {
|
|
1084
1141
|
nativeIterableAt: (source, consumer) => {
|
|
1085
1142
|
if (!hostMutationFactsSealed)
|
|
@@ -1191,6 +1248,7 @@ export const runFrontend = (input) => {
|
|
|
1191
1248
|
arrayIteratorDeclaration: arrayIteratorDeclarationEarly,
|
|
1192
1249
|
...(returns ? { returns } : {})
|
|
1193
1250
|
};
|
|
1251
|
+
progress('structural @1992 hostInput');
|
|
1194
1252
|
const hostInput = {
|
|
1195
1253
|
checker: compiled.checker,
|
|
1196
1254
|
identities,
|
|
@@ -1217,14 +1275,18 @@ export const runFrontend = (input) => {
|
|
|
1217
1275
|
hostProvidedNames: unresolvableNames.hostProvidedNames,
|
|
1218
1276
|
absent
|
|
1219
1277
|
};
|
|
1278
|
+
progress('structural @2020 typedArrayElements');
|
|
1220
1279
|
const typedArrayElements = new Map();
|
|
1280
|
+
progress('structural @2021 hostProtocolBindings');
|
|
1221
1281
|
hostProtocolBindings(hostInput, hosts);
|
|
1282
|
+
progress('structural @2022 ambientHostBindings');
|
|
1222
1283
|
ambientHostBindings(hostInput, hosts, typedArrayElements);
|
|
1223
1284
|
// The nine typed-array INSTANCE interfaces, resolved by name and unioned
|
|
1224
1285
|
// over whatever the seed walk above already found. Unconditional, because a
|
|
1225
1286
|
// program can hold a typed array without ever naming one -- see
|
|
1226
1287
|
// `typedArrayDeclarationsOf`. The two agree wherever both answer; this one
|
|
1227
1288
|
// also answers where the walk has no seed.
|
|
1289
|
+
progress('structural @2028 for');
|
|
1228
1290
|
for (const [declaration, domain] of typedArrayDeclarationsOf(compiled.checker, identities, compiled.sourceFiles, compiled.program, input.hostTypedArrayDeclarations ?? [])) {
|
|
1229
1291
|
typedArrayElements.set(declaration, domain);
|
|
1230
1292
|
}
|
|
@@ -1232,24 +1294,32 @@ export const runFrontend = (input) => {
|
|
|
1232
1294
|
// census already bound weakly (as a structural body, or as a protocol with
|
|
1233
1295
|
// no carrier) must end up on the backend's own carrier, not beside it. See
|
|
1234
1296
|
// `bindStandardClasses`.
|
|
1297
|
+
progress('structural @2041 bindStandardClasses');
|
|
1235
1298
|
bindStandardClasses(hostInput, hosts, input.standardClasses ?? new Set());
|
|
1299
|
+
progress('structural @2042 hostGlobalBindings');
|
|
1236
1300
|
const hostGlobalBindings = new Set([...hosts.hostSingletonBindings, ...hosts.hostNamespaceBindings]);
|
|
1237
1301
|
// The mutation census must see the exact identities whose representation
|
|
1238
1302
|
// policy carries them outside `globalThis`: typed-array instances and native
|
|
1239
1303
|
// host handles. Passing identities, rather than spelling names in the
|
|
1240
1304
|
// census, keeps a caller declaration or merged ambient symbol from acquiring
|
|
1241
1305
|
// this proof.
|
|
1306
|
+
progress('structural @2048 nativeReceiverDeclarations');
|
|
1242
1307
|
const nativeReceiverDeclarations = new Set(typedArrayElements.keys());
|
|
1308
|
+
progress('structural @2049 for');
|
|
1243
1309
|
for (const [declaration, binding] of hosts.protocols)
|
|
1244
1310
|
if (binding.native !== null)
|
|
1245
1311
|
nativeReceiverDeclarations.add(declaration);
|
|
1312
|
+
progress('structural @2050 nativeReceiverSymbols');
|
|
1246
1313
|
const nativeReceiverSymbols = new Set();
|
|
1314
|
+
progress('structural @2051 nativeConstructorSymbols');
|
|
1247
1315
|
const nativeConstructorSymbols = new Set();
|
|
1248
1316
|
// `bindStandardClasses` publishes the carrier policy, while the mutation
|
|
1249
1317
|
// census needs the checker's instance identity at each call result. Resolve
|
|
1250
1318
|
// that identity again from the policy's own names so an unmentioned class is
|
|
1251
1319
|
// still proven (and a caller declaration with the same spelling is not).
|
|
1320
|
+
progress('structural @2056 receiverAnchor');
|
|
1252
1321
|
const receiverAnchor = compiled.sourceFiles[0];
|
|
1322
|
+
progress('structural @2057 if');
|
|
1253
1323
|
if (receiverAnchor) {
|
|
1254
1324
|
for (const name of [...typedArrayInstanceInterfaceNames, ...(input.standardClasses ?? [])]) {
|
|
1255
1325
|
const symbol = compiled.checker.resolveName(name, receiverAnchor, ts.SymbolFlags.Interface, false);
|
|
@@ -1265,7 +1335,9 @@ export const runFrontend = (input) => {
|
|
|
1265
1335
|
nativeReceiverDeclarations.add(declaration);
|
|
1266
1336
|
}
|
|
1267
1337
|
}
|
|
1338
|
+
progress('structural @2073 standardClassNames');
|
|
1268
1339
|
const standardClassNames = input.standardClasses ?? new Set();
|
|
1340
|
+
progress('structural @2074 admitNativeConstructor');
|
|
1269
1341
|
const admitNativeConstructor = (constructor, location) => {
|
|
1270
1342
|
const valueDeclaration = constructor?.valueDeclaration;
|
|
1271
1343
|
if (!constructor || !valueDeclaration || !isAmbientDeclaration(valueDeclaration))
|
|
@@ -1283,7 +1355,9 @@ export const runFrontend = (input) => {
|
|
|
1283
1355
|
nativeReceiverDeclarations.add(declaration);
|
|
1284
1356
|
}
|
|
1285
1357
|
};
|
|
1358
|
+
progress('structural @2088 executableSourceFiles');
|
|
1286
1359
|
const executableSourceFiles = new Set(compiled.sourceFiles);
|
|
1360
|
+
progress('structural @2089 for');
|
|
1287
1361
|
for (const file of compiled.program.getSourceFiles()) {
|
|
1288
1362
|
if (executableSourceFiles.has(file)) {
|
|
1289
1363
|
for (const name of standardClassNames) {
|
|
@@ -1315,6 +1389,7 @@ export const runFrontend = (input) => {
|
|
|
1315
1389
|
}
|
|
1316
1390
|
}
|
|
1317
1391
|
}
|
|
1392
|
+
progress('structural @2120 native constructors done; censusGlobalHostMutations');
|
|
1318
1393
|
// `absorb`, not a copy of the set: the census's per-key facts are not in
|
|
1319
1394
|
// its legacy set view, and dropping them would lose writes.
|
|
1320
1395
|
globalHostMutationTaint.absorb(censusGlobalHostMutations(compiled.checker, identities, compiled.sourceFiles, unresolvableNames, hostGlobalBindings, valueFlow, reachable, nativeReceiverDeclarations, nativeReceiverSymbols, nativeConstructorSymbols, types.rawTypeAt, compiled.program.getSourceFiles().filter((file) => file.isDeclarationFile),
|
|
@@ -1323,6 +1398,7 @@ export const runFrontend = (input) => {
|
|
|
1323
1398
|
// both readers.
|
|
1324
1399
|
computedKeysOf, (call) => staticRequireOutcomeOf(commonJsRequire, call, compiled.runtimeModuleTargetOf, compiled.sourceFileOf, compiled.absentRequirePackageOf)?.kind ?? null));
|
|
1325
1400
|
hostMutationFactsSealed = true;
|
|
1401
|
+
progress('structural @2151 for');
|
|
1326
1402
|
for (const [file, protocols] of compiled.sourceTransformProtocols ?? []) {
|
|
1327
1403
|
const proof = intrinsicProtocols.capture(() => {
|
|
1328
1404
|
for (const protocol of protocols) {
|
|
@@ -1345,17 +1421,21 @@ export const runFrontend = (input) => {
|
|
|
1345
1421
|
// protocol must not fall through to the replacement's host template.
|
|
1346
1422
|
intrinsicProtocols.replace(protocols, proof.requirements);
|
|
1347
1423
|
}
|
|
1424
|
+
progress('structural @2171 installedGlobals');
|
|
1348
1425
|
const installedGlobals = installedGlobalPropertiesOf(compiled.checker, identities, compiled.sourceFiles, {
|
|
1349
1426
|
isIntrinsicGlobalThis: unresolvableNames.isIntrinsicGlobalThis,
|
|
1350
1427
|
hostProvidedNames: new Set([...unresolvableNames.hostProvidedNames, ...(input.absentGlobals ?? [])])
|
|
1351
1428
|
}, input.closedScriptScope === true, !globalHostMutationTaint.has('*'), census.candidates);
|
|
1429
|
+
progress('structural @2183 for');
|
|
1352
1430
|
for (const [access, declaration] of installedGlobals.accesses)
|
|
1353
1431
|
installedGlobalProperties.set(access, declaration);
|
|
1432
|
+
progress('structural @2184 for');
|
|
1354
1433
|
for (const declaration of installedGlobals.declarations) {
|
|
1355
1434
|
ownedGlobalProperties.add(declaration);
|
|
1356
1435
|
hosts.externals.delete(declaration);
|
|
1357
1436
|
hosts.externalFiles.delete(declaration);
|
|
1358
1437
|
}
|
|
1438
|
+
progress('structural @2189 failedIntrinsicRequirements');
|
|
1359
1439
|
const failedIntrinsicRequirements = failedIntrinsicProtocolRequirements(intrinsicPropertyContext, intrinsicProtocols.requirements());
|
|
1360
1440
|
// `GEA_LEDGER_DEBUG=1` pairs with the publish-time `[LEDGER]` lines
|
|
1361
1441
|
// `createDeferredIntrinsicProtocolLedger`'s `replace` prints for every scope:
|
|
@@ -1364,6 +1444,7 @@ export const runFrontend = (input) => {
|
|
|
1364
1444
|
// point the compiler itself asks -- the same `failedIntrinsicProtocolRequirements`
|
|
1365
1445
|
// call the certification gate uses, so nothing here can disagree with the
|
|
1366
1446
|
// real answer; it only narrates it.
|
|
1447
|
+
progress('structural @2197 if');
|
|
1367
1448
|
if (process.env['GEA_LEDGER_DEBUG'] !== undefined) {
|
|
1368
1449
|
const clauses = new Map();
|
|
1369
1450
|
for (const requirement of failedIntrinsicRequirements) {
|
|
@@ -1382,6 +1463,7 @@ export const runFrontend = (input) => {
|
|
|
1382
1463
|
}
|
|
1383
1464
|
console.error(`[LEDGER-SUMMARY] failed=${failedIntrinsicRequirements.length} clauses=${[...clauses].map(([clause, count]) => `${clause}:${count}`).join(',')}`);
|
|
1384
1465
|
}
|
|
1466
|
+
progress('structural @2220 intrinsicProtocolDiagnostics');
|
|
1385
1467
|
const intrinsicProtocolDiagnostics = failedIntrinsicRequirements.map((requirement, ordinal) => {
|
|
1386
1468
|
const file = requirement.location.getSourceFile();
|
|
1387
1469
|
const position = file.getLineAndCharacterOfPosition(requirement.location.getStart(file));
|
|
@@ -1407,21 +1489,35 @@ export const runFrontend = (input) => {
|
|
|
1407
1489
|
location: { file: file.fileName, line: position.line + 1, column: position.character + 1 }
|
|
1408
1490
|
};
|
|
1409
1491
|
});
|
|
1492
|
+
progress('structural @2248 promiseDeclaration');
|
|
1410
1493
|
const promiseDeclaration = promiseDeclarationOf(compiled.checker, identities, compiled.sourceFiles);
|
|
1494
|
+
progress('structural @2249 promiseLikeDeclaration');
|
|
1411
1495
|
const promiseLikeDeclaration = promiseLikeDeclarationOf(compiled.checker, identities, compiled.sourceFiles);
|
|
1496
|
+
progress('structural @2250 dateDeclaration');
|
|
1412
1497
|
const dateDeclaration = dateDeclarationOf(compiled.checker, identities, compiled.sourceFiles);
|
|
1498
|
+
progress('structural @2251 stringObjectDeclaration');
|
|
1413
1499
|
const stringObjectDeclaration = stringObjectDeclarationOf(compiled.checker, identities, compiled.sourceFiles);
|
|
1500
|
+
progress('structural @2252 errorDeclarations');
|
|
1414
1501
|
const errorDeclarations = errorDeclarationsOf(compiled.checker, identities, compiled.sourceFiles);
|
|
1502
|
+
progress('structural @2253 functionDeclaration');
|
|
1415
1503
|
const functionDeclaration = functionDeclarationOf(compiled.checker, identities, compiled.sourceFiles);
|
|
1504
|
+
progress('structural @2254 constructorSlotSubclasses');
|
|
1416
1505
|
const constructorSlotSubclasses = constructorSlotSubclassesOf(compiled.checker, identities, compiled.sourceFiles, classHeritage);
|
|
1506
|
+
progress('structural @2255 uninstantiableClasses');
|
|
1417
1507
|
const uninstantiableClasses = uninstantiableClassesOf(compiled.checker, identities, compiled.sourceFiles);
|
|
1508
|
+
progress('structural @2256 interfaceImplementors');
|
|
1418
1509
|
const interfaceImplementors = interfaceImplementorsOf(compiled.checker, identities, compiled.sourceFiles);
|
|
1510
|
+
progress('structural @2257 generatorDeclaration');
|
|
1419
1511
|
const generatorDeclaration = generatorDeclarationEarly;
|
|
1512
|
+
progress('structural @2258 asyncGeneratorDeclaration');
|
|
1420
1513
|
const asyncGeneratorDeclaration = asyncGeneratorDeclarationEarly;
|
|
1514
|
+
progress('structural @2259 mapIteratorDeclaration');
|
|
1421
1515
|
const mapIteratorDeclaration = mapIteratorDeclarationEarly;
|
|
1422
1516
|
// Resolved the same way and for the same reason as `keyedCollections` above.
|
|
1517
|
+
progress('structural @2261 regexpDeclarations');
|
|
1423
1518
|
const regexpDeclarations = regexpDeclarationsOf(compiled.checker, identities, compiled.sourceFiles);
|
|
1424
1519
|
timing.mark('structural-and-host-censuses');
|
|
1520
|
+
progress('structural @2263 normalized');
|
|
1425
1521
|
const normalized = normalizeProgram({
|
|
1426
1522
|
census,
|
|
1427
1523
|
types: table,
|
|
@@ -572,6 +572,13 @@ export interface ClassLifecycleOperation extends SemanticOperationBase {
|
|
|
572
572
|
readonly placement: 'own' | 'prototype' | 'static' | null;
|
|
573
573
|
/** True only for a field synthesized onto an ancestor by the subclass-member overlay. */
|
|
574
574
|
readonly syntheticSubclassMemberOverlay?: boolean;
|
|
575
|
+
/**
|
|
576
|
+
* An `abstract` method or accessor: the class states the key for its
|
|
577
|
+
* subclasses and installs nothing. A lookup on an instance of this very
|
|
578
|
+
* class (reachable by reflection: an abstract constructor runs at run time)
|
|
579
|
+
* misses it and continues to the base.
|
|
580
|
+
*/
|
|
581
|
+
readonly abstractMember?: true;
|
|
575
582
|
/** A layout demand, not evaluation or allocation of this class's constructor. */
|
|
576
583
|
readonly classLayoutOnly?: boolean;
|
|
577
584
|
/** Definition effects remain; constructor/instance initializer execution is absent. */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { progress, progressed } from '../frontend-timing.js';
|
|
1
2
|
import { sameImplicitArgumentsTuple } from './implicit-arguments-tuple.js';
|
|
2
3
|
/** A frame fact is a fresh object each round; it settles when it states the same frame, not when it is the same object. */
|
|
3
4
|
const isFrameFact = (fact) => fact !== null && !Array.isArray(fact) && 'frame' in fact;
|
|
@@ -40,7 +41,9 @@ export const settleBindingCensus = (compose, limit = 64) => {
|
|
|
40
41
|
// a ~2.1GB fixpoint peak. Only `.parameters` is ever read back out of
|
|
41
42
|
// a settled round (to seed the next round's `observed` view and to compare
|
|
42
43
|
// `boundCount`), so only `.parameters` needs to survive the boundary.
|
|
43
|
-
let previousCensus = compose().parameters;
|
|
44
|
+
let previousCensus = progressed('census round 1', () => compose()).parameters;
|
|
45
|
+
if (process.env['GEA_STOP_AFTER_ROUND_ONE'] === '1')
|
|
46
|
+
process.exit(0);
|
|
44
47
|
let unsettled = [];
|
|
45
48
|
const identities = new Map();
|
|
46
49
|
const factLabel = (fact) => {
|
|
@@ -102,11 +105,12 @@ export const settleBindingCensus = (compose, limit = 64) => {
|
|
|
102
105
|
// `compose` is called with nothing in this function's own scope naming the
|
|
103
106
|
// previous round's `facts` -- `observed` closes over `previousCensus`
|
|
104
107
|
// (a `ParameterBindingCensus`), never over the `RoundCensus` it came from.
|
|
105
|
-
const next = compose(observed);
|
|
108
|
+
const next = progressed(`census round ${rounds}`, () => compose(observed));
|
|
106
109
|
let changed = next.parameters.boundCount !== previousBoundCount;
|
|
107
110
|
unsettled = changed ? [`boundCount ${previousBoundCount} -> ${next.parameters.boundCount}`] : [];
|
|
108
111
|
// Reads may lazily consult earlier views. Snapshot before querying `next`
|
|
109
112
|
// so forwarding to `observed` cannot extend the map during iteration.
|
|
113
|
+
progress(`census round ${rounds} convergence check over ${[...(reads ?? [])].reduce((sum, [, nodes]) => sum + nodes.size, 0)} queries`);
|
|
110
114
|
const pending = [...(reads ?? [])].map(([name, nodes]) => [name, [...nodes]]);
|
|
111
115
|
reads = null;
|
|
112
116
|
for (const [name, nodes] of pending) {
|
|
@@ -139,6 +143,7 @@ export const settleBindingCensus = (compose, limit = 64) => {
|
|
|
139
143
|
// this round's `facts` and the round's index/session graph is free the
|
|
140
144
|
// moment `next` goes out of scope, unlike the old flow where the outer
|
|
141
145
|
// `round` binding kept it reachable until being overwritten one line later.
|
|
146
|
+
progress(`census round ${rounds} ${changed ? 'changed' : 'settled'}: boundCount ${next.parameters.boundCount}${unsettled.length ? ` -- ${unsettled[0]?.slice(0, 200)}` : ''}`);
|
|
142
147
|
if (!changed)
|
|
143
148
|
return { ...next, round: rounds };
|
|
144
149
|
previousCensus = next.parameters;
|
|
@@ -5,7 +5,10 @@ import { isStandardGlobalValue } from './derived-expression-type.js';
|
|
|
5
5
|
import { failedIntrinsicProtocolRequirements } from './deferred-intrinsic-protocols.js';
|
|
6
6
|
/** A lexical const cannot acquire a different value through an erased type
|
|
7
7
|
* assertion. Only initializer aliases are followed, never readonly object
|
|
8
|
-
* properties, formal parameters, or the unique-symbol type alone.
|
|
8
|
+
* properties, formal parameters, or the unique-symbol type alone. An imported
|
|
9
|
+
* name is followed to the exporting module's declaration: an import binding is
|
|
10
|
+
* an immutable live view of that binding, so a `const` there is a `const` here
|
|
11
|
+
* (`import { kDecoratedKeys } from './constants'`). */
|
|
9
12
|
const readonlySourceOf = (checker, expression) => {
|
|
10
13
|
const seen = new Set();
|
|
11
14
|
let current = unwrapErasedExpression(expression);
|
|
@@ -13,7 +16,8 @@ const readonlySourceOf = (checker, expression) => {
|
|
|
13
16
|
if (seen.has(current))
|
|
14
17
|
return null;
|
|
15
18
|
seen.add(current);
|
|
16
|
-
const
|
|
19
|
+
const local = checker.getSymbolAtLocation(current);
|
|
20
|
+
const symbol = local && local.flags & ts.SymbolFlags.Alias ? checker.getAliasedSymbol(local) : local;
|
|
17
21
|
const declaration = symbol?.valueDeclaration;
|
|
18
22
|
if (!declaration || !ts.isVariableDeclaration(declaration) || !declaration.initializer)
|
|
19
23
|
return current;
|