@geastack/compiler 1.0.37 → 1.0.39
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/cli-emit.js +5 -0
- package/dist/cli.js +10 -0
- package/dist/compiler.d.ts +10 -3
- package/dist/compiler.js +364 -224
- package/dist/conversion/build.d.ts +13 -1
- package/dist/conversion/build.js +336 -141
- package/dist/conversion/graph-validation.d.ts +7 -2
- package/dist/conversion/graph-validation.js +36 -22
- package/dist/conversion/native-sum.js +106 -17
- package/dist/diagnostics/sweep.js +1 -1
- package/dist/ir/callable-class-flow.d.ts +0 -11
- package/dist/ir/callable-class-flow.js +970 -169
- package/dist/ir/certificate.d.ts +1 -1
- package/dist/ir/certificate.js +12 -1
- package/dist/ir/certify/carrier-keys.d.ts +17 -1
- package/dist/ir/certify/carrier-keys.js +35 -2
- package/dist/ir/certify/function-source.js +2 -1
- package/dist/ir/certify/has-property-key.d.ts +6 -0
- package/dist/ir/certify/has-property-key.js +8 -1
- package/dist/ir/certify/property-access-keys.js +2 -1
- package/dist/ir/certify/runtime-helper.js +2 -1
- package/dist/ir/emission-representations.d.ts +2 -2
- package/dist/ir/emission-representations.js +9 -3
- package/dist/ir/generic-call-entry.d.ts +3 -1
- package/dist/ir/logical-receivers.js +29 -1
- package/dist/ir/lower-completion.js +11 -6
- package/dist/ir/lower-destructuring.js +3 -2
- package/dist/ir/native-host-method-reads.d.ts +5 -0
- package/dist/ir/native-host-method-reads.js +30 -21
- package/dist/ir/operation-conversions.js +4 -1
- package/dist/ir/publish-conversion-recipes.js +12 -1
- package/dist/plugins/apple/jsx.js +1 -1
- package/dist/plugins/gea/component-classes.js +1 -1
- package/dist/plugins/gea/component-inline.js +1 -1
- package/dist/plugins/gea/contract.d.ts +1 -1
- package/dist/plugins/gea/contract.js +1 -1
- package/dist/plugins/gea/host.js +27 -1
- package/dist/plugins/gea/lower.js +8 -1
- package/dist/plugins/gea/producer.js +1 -1
- package/dist/plugins/gea/reactive-slots.d.ts +1 -1
- package/dist/plugins/gea/reactive-slots.js +1 -1
- package/dist/plugins/load.js +51 -22
- package/dist/preflight/run.d.ts +12 -1
- package/dist/preflight/run.js +65 -29
- package/dist/projection/native-callable-data.js +2 -1
- package/dist/representation/plan.js +102 -4
- package/dist/semantics/alias-this-field-declaration-transform.js +1 -1
- package/dist/semantics/ambient-type-realization-transform.js +1 -1
- package/dist/semantics/ambient.d.ts +1 -1
- package/dist/semantics/ambient.js +1 -1
- package/dist/semantics/borrowed-builtin-call-bind-source-transform.js +1 -1
- package/dist/semantics/borrowed-method-receiver-copy-source-transform.js +1 -1
- package/dist/semantics/call-invalidated-narrowing.d.ts +1 -1
- package/dist/semantics/call-invalidated-narrowing.js +4 -2
- package/dist/semantics/callable-own-data-slots.d.ts +6 -0
- package/dist/semantics/callable-own-data-slots.js +177 -101
- package/dist/semantics/class-alias.d.ts +1 -1
- package/dist/semantics/class-alias.js +1 -1
- package/dist/semantics/class-heritage.d.ts +1 -1
- package/dist/semantics/class-heritage.js +1 -1
- package/dist/semantics/commonjs-wrapper.d.ts +4 -3
- package/dist/semantics/commonjs-wrapper.js +50 -7
- package/dist/semantics/constructor-function-class-source-transform.js +1 -1
- package/dist/semantics/constructor-slot-subclasses.d.ts +1 -1
- package/dist/semantics/constructor-slot-subclasses.js +1 -1
- package/dist/semantics/declaration-overlay-transform.js +3 -2
- package/dist/semantics/declared-integers.d.ts +1 -1
- package/dist/semantics/declared-integers.js +1 -1
- package/dist/semantics/define-property-source-transform.js +1 -1
- package/dist/semantics/diagnostic-source-preparation.d.ts +1 -1
- package/dist/semantics/documentation-ranges.d.ts +1 -1
- package/dist/semantics/documentation-ranges.js +1 -1
- package/dist/semantics/dynamic-fallback.d.ts +1 -1
- package/dist/semantics/dynamic-fallback.js +1 -1
- package/dist/semantics/frontend-timing.js +19 -0
- package/dist/semantics/frontend.d.ts +2 -2
- package/dist/semantics/frontend.js +127 -54
- package/dist/semantics/host-declaration-provenance.d.ts +1 -1
- package/dist/semantics/host-methods.d.ts +1 -1
- package/dist/semantics/host-methods.js +1 -1
- package/dist/semantics/host-protocols.d.ts +1 -1
- package/dist/semantics/host-protocols.js +1 -1
- package/dist/semantics/inherited-accessor.d.ts +1 -1
- package/dist/semantics/inherited-accessor.js +1 -1
- package/dist/semantics/interface-families.d.ts +1 -1
- package/dist/semantics/interface-families.js +1 -1
- package/dist/semantics/interface-implementors.d.ts +1 -1
- package/dist/semantics/interface-implementors.js +1 -1
- package/dist/semantics/jsdoc-namepath-transform.js +1 -1
- package/dist/semantics/jsx-runtime-provider.d.ts +1 -1
- package/dist/semantics/jsx-runtime-provider.js +1 -1
- package/dist/semantics/known-caller-predicate-parameters.d.ts +1 -1
- package/dist/semantics/known-caller-predicate-parameters.js +1 -1
- package/dist/semantics/model/edges.d.ts +124 -0
- package/dist/semantics/model/edges.js +192 -0
- package/dist/semantics/model/graph.d.ts +26 -2
- package/dist/semantics/model/graph.js +54 -0
- package/dist/semantics/model/sealed-facts.d.ts +19 -0
- package/dist/semantics/model/sealed-facts.js +221 -0
- package/dist/semantics/model/selected-signature.d.ts +1 -1
- package/dist/semantics/model/selected-signature.js +1 -1
- package/dist/semantics/module-resolution.d.ts +1 -1
- package/dist/semantics/module-resolution.js +1 -1
- package/dist/semantics/native-function-signatures.d.ts +1 -1
- package/dist/semantics/native-function-signatures.js +1 -1
- package/dist/semantics/native-object-data-slots.js +20 -4
- package/dist/semantics/new-callee-class-tag-source-transform.js +1 -1
- package/dist/semantics/node-project.d.ts +1 -1
- package/dist/semantics/node-project.js +1 -1
- package/dist/semantics/node-source-hooks.js +1 -1
- package/dist/semantics/normalize/absent-globals.d.ts +1 -1
- package/dist/semantics/normalize/absent-globals.js +1 -1
- package/dist/semantics/normalize/any-cast-member-call.d.ts +1 -1
- package/dist/semantics/normalize/any-cast-member-call.js +1 -1
- package/dist/semantics/normalize/arguments-objects.d.ts +1 -1
- package/dist/semantics/normalize/arguments-objects.js +1 -1
- package/dist/semantics/normalize/asserted-argument-arms.d.ts +1 -1
- package/dist/semantics/normalize/asserted-argument-arms.js +1 -1
- package/dist/semantics/normalize/asserted-arm-absence.d.ts +1 -1
- package/dist/semantics/normalize/asserted-arm-absence.js +1 -1
- package/dist/semantics/normalize/assignment-patterns.d.ts +1 -1
- package/dist/semantics/normalize/assignment-patterns.js +1 -1
- package/dist/semantics/normalize/bag-absence.d.ts +1 -1
- package/dist/semantics/normalize/bag-absence.js +1 -1
- package/dist/semantics/normalize/binding-fixpoint.js +9 -2
- package/dist/semantics/normalize/bivariant-slot-parameter.d.ts +1 -1
- package/dist/semantics/normalize/bivariant-slot-parameter.js +1 -1
- package/dist/semantics/normalize/callable-data-write.d.ts +1 -1
- package/dist/semantics/normalize/callable-data-write.js +1 -1
- package/dist/semantics/normalize/callback-parameter-contracts.d.ts +1 -1
- package/dist/semantics/normalize/callback-parameter-contracts.js +1 -1
- package/dist/semantics/normalize/cells/agreement.d.ts +18 -1
- package/dist/semantics/normalize/cells/agreement.js +8 -0
- package/dist/semantics/normalize/cells/candidates.d.ts +1 -1
- package/dist/semantics/normalize/cells/candidates.js +1 -1
- package/dist/semantics/normalize/cells/facts.d.ts +1 -1
- package/dist/semantics/normalize/cells/facts.js +1 -1
- package/dist/semantics/normalize/cells/index.d.ts +2 -2
- package/dist/semantics/normalize/cells/index.js +1 -1
- package/dist/semantics/normalize/cells/model.d.ts +1 -1
- package/dist/semantics/normalize/cells/policies/bag.d.ts +1 -1
- package/dist/semantics/normalize/cells/policies/collection.d.ts +1 -1
- package/dist/semantics/normalize/cells/policies/collection.js +1 -1
- package/dist/semantics/normalize/cells/policies/field.d.ts +1 -1
- package/dist/semantics/normalize/cells/policies/field.js +1 -1
- package/dist/semantics/normalize/cells/policies/index.d.ts +1 -1
- package/dist/semantics/normalize/cells/policies/local.d.ts +1 -1
- package/dist/semantics/normalize/cells/policies/local.js +1 -1
- package/dist/semantics/normalize/cells/policies/parameter.d.ts +1 -1
- package/dist/semantics/normalize/cells/policies/parameter.js +1 -1
- package/dist/semantics/normalize/cells/policies/return.d.ts +1 -1
- package/dist/semantics/normalize/cells/policies/return.js +1 -1
- package/dist/semantics/normalize/cells/policies/shared.d.ts +1 -1
- package/dist/semantics/normalize/cells/policy.d.ts +1 -1
- package/dist/semantics/normalize/census.d.ts +1 -1
- package/dist/semantics/normalize/census.js +45 -12
- package/dist/semantics/normalize/class-instance-record-statement.d.ts +1 -1
- package/dist/semantics/normalize/class-instance-record-statement.js +1 -1
- package/dist/semantics/normalize/collection-bindings.d.ts +1 -1
- package/dist/semantics/normalize/collection-bindings.js +1 -1
- package/dist/semantics/normalize/commonjs-module-record.d.ts +1 -1
- package/dist/semantics/normalize/commonjs-module-record.js +1 -1
- package/dist/semantics/normalize/commonjs-require.d.ts +1 -1
- package/dist/semantics/normalize/commonjs-require.js +1 -1
- package/dist/semantics/normalize/contribution.d.ts +4 -3
- package/dist/semantics/normalize/contribution.js +145 -42
- package/dist/semantics/normalize/dead-event-emissions.d.ts +1 -1
- package/dist/semantics/normalize/dead-event-emissions.js +1 -1
- package/dist/semantics/normalize/dead-method-copies.d.ts +1 -1
- package/dist/semantics/normalize/dead-method-copies.js +1 -1
- package/dist/semantics/normalize/dead-typeof-guards.d.ts +1 -1
- package/dist/semantics/normalize/dead-typeof-guards.js +1 -1
- package/dist/semantics/normalize/deferred-intrinsic-protocols.d.ts +1 -1
- package/dist/semantics/normalize/deferred-intrinsic-protocols.js +1 -1
- package/dist/semantics/normalize/derived-expression-type.d.ts +1 -1
- package/dist/semantics/normalize/derived-expression-type.js +4 -4
- package/dist/semantics/normalize/evaluation-order.d.ts +1 -1
- package/dist/semantics/normalize/evaluation-order.js +1 -1
- package/dist/semantics/normalize/field-bindings.d.ts +1 -1
- package/dist/semantics/normalize/field-bindings.js +4 -3
- package/dist/semantics/normalize/flow/array-element-continuation.d.ts +1 -1
- package/dist/semantics/normalize/flow/array-element-continuation.js +3 -3
- package/dist/semantics/normalize/flow/callable-array-origins.d.ts +1 -1
- package/dist/semantics/normalize/flow/callable-array-origins.js +1 -1
- package/dist/semantics/normalize/flow/callable-completions.d.ts +1 -1
- package/dist/semantics/normalize/flow/callable-completions.js +1 -1
- package/dist/semantics/normalize/flow/callable-reach.d.ts +1 -1
- package/dist/semantics/normalize/flow/callable-reach.js +73 -52
- package/dist/semantics/normalize/flow/class-family-member-read.d.ts +1 -1
- package/dist/semantics/normalize/flow/class-family-member-read.js +3 -3
- package/dist/semantics/normalize/flow/collection-value-continuation.d.ts +1 -1
- package/dist/semantics/normalize/flow/collection-value-continuation.js +1 -1
- package/dist/semantics/normalize/flow/component-solver.d.ts +181 -3
- package/dist/semantics/normalize/flow/component-solver.js +705 -164
- package/dist/semantics/normalize/flow/computed-key-set.d.ts +1 -1
- package/dist/semantics/normalize/flow/computed-key-set.js +1 -1
- package/dist/semantics/normalize/flow/export-importers.d.ts +1 -1
- package/dist/semantics/normalize/flow/export-importers.js +13 -3
- package/dist/semantics/normalize/flow/host-text-sink.d.ts +1 -1
- package/dist/semantics/normalize/flow/host-text-sink.js +1 -1
- package/dist/semantics/normalize/flow/intrinsic-array-callback-frames.d.ts +1 -1
- package/dist/semantics/normalize/flow/intrinsic-array-callback-frames.js +1 -1
- package/dist/semantics/normalize/flow/intrinsic-data-definition.d.ts +1 -1
- package/dist/semantics/normalize/flow/intrinsic-data-definition.js +1 -1
- package/dist/semantics/normalize/flow/invocation-facts.d.ts +1 -1
- package/dist/semantics/normalize/flow/invocation-facts.js +1 -1
- package/dist/semantics/normalize/flow/member-call-forwarding.d.ts +1 -1
- package/dist/semantics/normalize/flow/member-call-forwarding.js +1 -1
- package/dist/semantics/normalize/flow/model.d.ts +1 -1
- package/dist/semantics/normalize/flow/model.js +5 -1
- package/dist/semantics/normalize/flow/native-collection-protocol.d.ts +1 -1
- package/dist/semantics/normalize/flow/native-collection-protocol.js +1 -1
- package/dist/semantics/normalize/flow/node-path-token.d.ts +1 -1
- package/dist/semantics/normalize/flow/object-binding-continuation.d.ts +1 -1
- package/dist/semantics/normalize/flow/object-binding-continuation.js +1 -1
- package/dist/semantics/normalize/flow/origin-authority.d.ts +1 -1
- package/dist/semantics/normalize/flow/owned-class-receivers.d.ts +1 -1
- package/dist/semantics/normalize/flow/owned-class-receivers.js +1 -1
- package/dist/semantics/normalize/flow/parameter-values.d.ts +1 -1
- package/dist/semantics/normalize/flow/parameter-values.js +1 -1
- package/dist/semantics/normalize/flow/record-alias-closure.d.ts +1 -1
- package/dist/semantics/normalize/flow/record-alias-closure.js +1 -1
- package/dist/semantics/normalize/flow/seeded-origins.d.ts +1 -1
- package/dist/semantics/normalize/flow/seeded-origins.js +1 -1
- package/dist/semantics/normalize/flow/source-accessor-descriptor.d.ts +1 -1
- package/dist/semantics/normalize/flow/source-accessor-descriptor.js +1 -1
- package/dist/semantics/normalize/flow/source-callable-own-data.d.ts +1 -1
- package/dist/semantics/normalize/flow/source-callable-own-data.js +1 -1
- package/dist/semantics/normalize/flow/source-callable-readonly-set.d.ts +1 -1
- package/dist/semantics/normalize/flow/source-callable-readonly-set.js +1 -1
- package/dist/semantics/normalize/flow/source-class-data.d.ts +1 -1
- package/dist/semantics/normalize/flow/source-class-data.js +1 -1
- package/dist/semantics/normalize/flow/source-class-instanceof.d.ts +1 -1
- package/dist/semantics/normalize/flow/source-class-instanceof.js +1 -1
- package/dist/semantics/normalize/flow/source-class-static-data.d.ts +1 -1
- package/dist/semantics/normalize/flow/source-class-static-data.js +1 -1
- package/dist/semantics/normalize/flow/source-commonjs-exports.d.ts +1 -1
- package/dist/semantics/normalize/flow/source-construction-frames.d.ts +1 -1
- package/dist/semantics/normalize/flow/source-construction-frames.js +1 -1
- package/dist/semantics/normalize/flow/source-descriptor-protocol.d.ts +1 -1
- package/dist/semantics/normalize/flow/source-descriptor-protocol.js +1 -1
- package/dist/semantics/normalize/flow/source-executing-parameter-values.d.ts +1 -1
- package/dist/semantics/normalize/flow/source-executing-parameter-values.js +1 -1
- package/dist/semantics/normalize/flow/source-global-binding.d.ts +1 -1
- package/dist/semantics/normalize/flow/source-global-binding.js +1 -1
- package/dist/semantics/normalize/flow/source-intrinsic-member-data.d.ts +1 -1
- package/dist/semantics/normalize/flow/source-intrinsic-member-data.js +1 -1
- package/dist/semantics/normalize/flow/source-invocation-frame-layout.d.ts +1 -1
- package/dist/semantics/normalize/flow/source-invocation-frame-layout.js +24 -32
- package/dist/semantics/normalize/flow/source-invocation-receiver.d.ts +1 -1
- package/dist/semantics/normalize/flow/source-invocation-receiver.js +1 -1
- package/dist/semantics/normalize/flow/source-native-class-alias.d.ts +1 -1
- package/dist/semantics/normalize/flow/source-native-class-alias.js +1 -1
- package/dist/semantics/normalize/flow/source-native-iterable-integrity.d.ts +1 -1
- package/dist/semantics/normalize/flow/source-native-iterable-integrity.js +1 -1
- package/dist/semantics/normalize/flow/source-native-origin.d.ts +1 -1
- package/dist/semantics/normalize/flow/source-native-origin.js +1 -1
- package/dist/semantics/normalize/flow/source-normal-predecessor.d.ts +1 -1
- package/dist/semantics/normalize/flow/source-normal-predecessor.js +1 -1
- package/dist/semantics/normalize/flow/source-property-key.d.ts +1 -1
- package/dist/semantics/normalize/flow/source-property-key.js +1 -1
- package/dist/semantics/normalize/flow/source-prototype-method-identity.d.ts +1 -1
- package/dist/semantics/normalize/flow/source-prototype-method-identity.js +1 -1
- package/dist/semantics/normalize/flow/source-proxy-operation.d.ts +1 -1
- package/dist/semantics/normalize/flow/source-proxy-operation.js +1 -1
- package/dist/semantics/normalize/flow/source-raw-constructor-entry.d.ts +1 -1
- package/dist/semantics/normalize/flow/source-raw-constructor-entry.js +1 -1
- package/dist/semantics/normalize/flow/source-read-protocol.d.ts +1 -1
- package/dist/semantics/normalize/flow/source-read-protocol.js +1 -1
- package/dist/semantics/normalize/flow/source-record-data.d.ts +1 -1
- package/dist/semantics/normalize/flow/source-record-data.js +1 -1
- package/dist/semantics/normalize/flow/source-value-session.d.ts +33 -3
- package/dist/semantics/normalize/flow/source-value-session.js +381 -173
- package/dist/semantics/normalize/flow/standard-prototype-method-source.d.ts +1 -1
- package/dist/semantics/normalize/flow/standard-prototype-method-source.js +1 -1
- package/dist/semantics/normalize/flow/targets.d.ts +1 -1
- package/dist/semantics/normalize/flow/targets.js +1 -1
- package/dist/semantics/normalize/flow/value-flow.d.ts +1 -1
- package/dist/semantics/normalize/flow/value-flow.js +243 -52
- package/dist/semantics/normalize/flow/value-provenance.d.ts +1 -1
- package/dist/semantics/normalize/flow/value-provenance.js +1 -1
- package/dist/semantics/normalize/fresh-dictionary-storage.d.ts +1 -1
- package/dist/semantics/normalize/fresh-dictionary-storage.js +1 -1
- package/dist/semantics/normalize/fresh-ordinary-object.d.ts +1 -1
- package/dist/semantics/normalize/fresh-ordinary-object.js +1 -1
- package/dist/semantics/normalize/fresh-table-last-use.d.ts +1 -1
- package/dist/semantics/normalize/fresh-table-last-use.js +1 -1
- package/dist/semantics/normalize/gating.d.ts +3 -3
- package/dist/semantics/normalize/gating.js +17 -20
- package/dist/semantics/normalize/generic-function-choice.d.ts +1 -1
- package/dist/semantics/normalize/generic-function-choice.js +1 -1
- package/dist/semantics/normalize/global-host-mutations.d.ts +1 -1
- package/dist/semantics/normalize/global-host-mutations.js +420 -138
- package/dist/semantics/normalize/host-effect-contracts.d.ts +1 -1
- package/dist/semantics/normalize/host-effect-contracts.js +1 -1
- package/dist/semantics/normalize/host-mutation-computed-keys.d.ts +1 -1
- package/dist/semantics/normalize/host-mutation-key-reader.d.ts +1 -1
- package/dist/semantics/normalize/host-mutation-key-reader.js +1 -1
- package/dist/semantics/normalize/identities.d.ts +41 -1
- package/dist/semantics/normalize/identities.js +75 -9
- package/dist/semantics/normalize/implicit-arguments-tuple.d.ts +1 -1
- package/dist/semantics/normalize/implicit-arguments-tuple.js +1 -1
- package/dist/semantics/normalize/implicit-arguments.d.ts +1 -1
- package/dist/semantics/normalize/implicit-arguments.js +1 -1
- package/dist/semantics/normalize/installed-global-properties.d.ts +1 -1
- package/dist/semantics/normalize/installed-global-properties.js +1 -1
- package/dist/semantics/normalize/instantiation.d.ts +1 -1
- package/dist/semantics/normalize/instantiation.js +1 -1
- package/dist/semantics/normalize/intrinsic-accessor-getter.d.ts +1 -1
- package/dist/semantics/normalize/intrinsic-accessor-getter.js +1 -1
- package/dist/semantics/normalize/intrinsic-property-call.d.ts +1 -1
- package/dist/semantics/normalize/intrinsic-property-call.js +1 -1
- package/dist/semantics/normalize/intrinsic-prototype.d.ts +1 -1
- package/dist/semantics/normalize/intrinsic-prototype.js +1 -1
- package/dist/semantics/normalize/intrinsic-return-identity.d.ts +1 -1
- package/dist/semantics/normalize/intrinsic-return-identity.js +1 -1
- package/dist/semantics/normalize/intrinsic-static-member.d.ts +1 -1
- package/dist/semantics/normalize/jsdoc-type-names.d.ts +1 -1
- package/dist/semantics/normalize/jsdoc-type-names.js +1 -1
- package/dist/semantics/normalize/local-bindings.d.ts +1 -1
- package/dist/semantics/normalize/local-bindings.js +3 -2
- package/dist/semantics/normalize/logical-object-truthiness.d.ts +1 -1
- package/dist/semantics/normalize/logical-object-truthiness.js +1 -1
- package/dist/semantics/normalize/logical-result-type.d.ts +1 -1
- package/dist/semantics/normalize/logical-result-type.js +1 -1
- package/dist/semantics/normalize/merged-declaration.d.ts +1 -1
- package/dist/semantics/normalize/merged-declaration.js +1 -1
- package/dist/semantics/normalize/namespace-paths.d.ts +1 -1
- package/dist/semantics/normalize/namespace-paths.js +1 -1
- package/dist/semantics/normalize/never-override-result.d.ts +1 -1
- package/dist/semantics/normalize/never-override-result.js +1 -1
- package/dist/semantics/normalize/normalize.d.ts +23 -4
- package/dist/semantics/normalize/normalize.js +125 -15
- package/dist/semantics/normalize/null-blind-parameter.d.ts +1 -1
- package/dist/semantics/normalize/null-blind-parameter.js +1 -1
- package/dist/semantics/normalize/nullable-memo.d.ts +28 -0
- package/dist/semantics/normalize/nullable-memo.js +99 -0
- package/dist/semantics/normalize/object-bag-bindings.d.ts +1 -1
- package/dist/semantics/normalize/object-bag-bindings.js +15 -4
- package/dist/semantics/normalize/omitted-stated-parameter.d.ts +1 -1
- package/dist/semantics/normalize/omitted-stated-parameter.js +1 -1
- package/dist/semantics/normalize/open-type-form.d.ts +1 -1
- package/dist/semantics/normalize/open-type-form.js +1 -1
- package/dist/semantics/normalize/override-field-arms.d.ts +1 -1
- package/dist/semantics/normalize/override-field-arms.js +1 -1
- package/dist/semantics/normalize/parameter-bindings.d.ts +1 -52
- package/dist/semantics/normalize/parameter-bindings.js +105 -10
- package/dist/semantics/normalize/parameter-slot.d.ts +1 -1
- package/dist/semantics/normalize/parameter-slot.js +1 -1
- package/dist/semantics/normalize/physical-overload-result.d.ts +1 -1
- package/dist/semantics/normalize/physical-overload-result.js +1 -1
- package/dist/semantics/normalize/primitive-property-absence.d.ts +1 -1
- package/dist/semantics/normalize/producer-context.d.ts +1 -1
- package/dist/semantics/normalize/producers/allocations.d.ts +1 -1
- package/dist/semantics/normalize/producers/allocations.js +1 -1
- package/dist/semantics/normalize/producers/binding-kind.d.ts +1 -1
- package/dist/semantics/normalize/producers/binding-kind.js +1 -1
- package/dist/semantics/normalize/producers/bindings.d.ts +1 -1
- package/dist/semantics/normalize/producers/bindings.js +1 -1
- package/dist/semantics/normalize/producers/boundary.d.ts +1 -1
- package/dist/semantics/normalize/producers/boundary.js +1 -1
- package/dist/semantics/normalize/producers/cited-value-type.d.ts +1 -1
- package/dist/semantics/normalize/producers/cited-value-type.js +1 -1
- package/dist/semantics/normalize/producers/class-lifecycle.js +1 -1
- package/dist/semantics/normalize/producers/computations.js +1 -1
- package/dist/semantics/normalize/producers/conditional-guard.d.ts +1 -1
- package/dist/semantics/normalize/producers/control-loops.d.ts +1 -1
- package/dist/semantics/normalize/producers/control-loops.js +1 -1
- package/dist/semantics/normalize/producers/control.d.ts +1 -1
- package/dist/semantics/normalize/producers/control.js +1 -1
- package/dist/semantics/normalize/producers/declaration-lifecycle.js +1 -1
- package/dist/semantics/normalize/producers/destructuring.d.ts +1 -1
- package/dist/semantics/normalize/producers/destructuring.js +1 -1
- package/dist/semantics/normalize/producers/dynamic-language.js +1 -1
- package/dist/semantics/normalize/producers/enums.d.ts +1 -1
- package/dist/semantics/normalize/producers/enums.js +1 -1
- package/dist/semantics/normalize/producers/erasure.d.ts +1 -1
- package/dist/semantics/normalize/producers/erasure.js +1 -1
- package/dist/semantics/normalize/producers/exact-arms.d.ts +1 -1
- package/dist/semantics/normalize/producers/exact-arms.js +1 -1
- package/dist/semantics/normalize/producers/intrinsic-accessor-getter.d.ts +1 -1
- package/dist/semantics/normalize/producers/invocations.d.ts +1 -1
- package/dist/semantics/normalize/producers/invocations.js +1 -1
- package/dist/semantics/normalize/producers/iteration-yield.d.ts +1 -1
- package/dist/semantics/normalize/producers/iteration-yield.js +1 -1
- package/dist/semantics/normalize/producers/jsx.js +1 -1
- package/dist/semantics/normalize/producers/logical-merge-type.d.ts +1 -1
- package/dist/semantics/normalize/producers/logical-merge-type.js +1 -1
- package/dist/semantics/normalize/producers/mint.js +88 -5
- package/dist/semantics/normalize/producers/native-callable-readonly-set.d.ts +1 -1
- package/dist/semantics/normalize/producers/native-own-assignment.d.ts +1 -1
- package/dist/semantics/normalize/producers/native-own-assignment.js +1 -1
- package/dist/semantics/normalize/producers/nullish.d.ts +1 -1
- package/dist/semantics/normalize/producers/nullish.js +1 -1
- package/dist/semantics/normalize/producers/object-assignment.d.ts +1 -1
- package/dist/semantics/normalize/producers/object-assignment.js +1 -1
- package/dist/semantics/normalize/producers/object-tag.d.ts +1 -1
- package/dist/semantics/normalize/producers/object-tag.js +1 -1
- package/dist/semantics/normalize/producers/optional-chain.d.ts +1 -1
- package/dist/semantics/normalize/producers/optional-chain.js +1 -1
- package/dist/semantics/normalize/producers/properties.d.ts +1 -1
- package/dist/semantics/normalize/producers/properties.js +1 -1
- package/dist/semantics/normalize/producers/protocol.d.ts +1 -1
- package/dist/semantics/normalize/producers/protocol.js +1 -1
- package/dist/semantics/normalize/producers/references.d.ts +1 -1
- package/dist/semantics/normalize/producers/references.js +1 -1
- package/dist/semantics/normalize/producers/shared.d.ts +1 -1
- package/dist/semantics/normalize/producers/shared.js +1 -1
- package/dist/semantics/normalize/producers/spread-arguments.d.ts +1 -1
- package/dist/semantics/normalize/producers/spread-arguments.js +1 -1
- package/dist/semantics/normalize/producers/tagged-template.d.ts +1 -1
- package/dist/semantics/normalize/producers/tagged-template.js +1 -1
- package/dist/semantics/normalize/producers/tuple-spread.d.ts +1 -1
- package/dist/semantics/normalize/producers/tuple-spread.js +1 -1
- package/dist/semantics/normalize/property-key-domain.d.ts +8 -1
- package/dist/semantics/normalize/property-key-domain.js +74 -47
- package/dist/semantics/normalize/reachability.d.ts +1 -1
- package/dist/semantics/normalize/reachability.js +3 -2
- package/dist/semantics/normalize/reassigned-bindings.d.ts +1 -1
- package/dist/semantics/normalize/record-home-arms.d.ts +1 -1
- package/dist/semantics/normalize/record-home-arms.js +1 -1
- package/dist/semantics/normalize/record-link-families.d.ts +1 -1
- package/dist/semantics/normalize/record-link-families.js +1 -1
- package/dist/semantics/normalize/record-stand-in-arms.d.ts +1 -1
- package/dist/semantics/normalize/record-stand-in-arms.js +1 -1
- package/dist/semantics/normalize/record-storage-families.d.ts +1 -1
- package/dist/semantics/normalize/record-storage-families.js +1 -1
- package/dist/semantics/normalize/return-bindings.d.ts +1 -1
- package/dist/semantics/normalize/return-bindings.js +1 -1
- package/dist/semantics/normalize/return-paths.d.ts +1 -1
- package/dist/semantics/normalize/return-paths.js +1 -1
- package/dist/semantics/normalize/round-tables.d.ts +21 -0
- package/dist/semantics/normalize/round-tables.js +59 -0
- package/dist/semantics/normalize/script-global-redefinition.d.ts +1 -1
- package/dist/semantics/normalize/script-global-redefinition.js +1 -1
- package/dist/semantics/normalize/shared-array-storage.d.ts +1 -1
- package/dist/semantics/normalize/shared-array-storage.js +1 -1
- package/dist/semantics/normalize/sloppy-absence.d.ts +1 -1
- package/dist/semantics/normalize/sloppy-absence.js +1 -1
- package/dist/semantics/normalize/source-native-iterable.d.ts +2 -2
- package/dist/semantics/normalize/source-native-iterable.js +4 -2
- package/dist/semantics/normalize/source-object-prototype-absence.d.ts +1 -1
- package/dist/semantics/normalize/source-object-prototype-absence.js +1 -1
- package/dist/semantics/normalize/specialization.d.ts +1 -1
- package/dist/semantics/normalize/specialization.js +1 -1
- package/dist/semantics/normalize/specialized-source-frames.d.ts +1 -1
- package/dist/semantics/normalize/specialized-source-frames.js +12 -4
- package/dist/semantics/normalize/structural-any-binding-consumer.d.ts +1 -1
- package/dist/semantics/normalize/structural-any-binding-consumer.js +1 -1
- package/dist/semantics/normalize/structural-array-element.d.ts +1 -1
- package/dist/semantics/normalize/structural-array-element.js +1 -1
- package/dist/semantics/normalize/structural-array-read.d.ts +1 -1
- package/dist/semantics/normalize/structural-array-read.js +1 -1
- package/dist/semantics/normalize/structural-callable.d.ts +1 -1
- package/dist/semantics/normalize/structural-callable.js +1 -1
- package/dist/semantics/normalize/structural-creation-order.d.ts +1 -1
- package/dist/semantics/normalize/structural-creation-order.js +1 -1
- package/dist/semantics/normalize/structural-declarations.d.ts +1 -1
- package/dist/semantics/normalize/structural-declarations.js +1 -1
- package/dist/semantics/normalize/structural-declared-body.d.ts +1 -1
- package/dist/semantics/normalize/structural-declared-body.js +1 -1
- package/dist/semantics/normalize/structural-generics.d.ts +1 -1
- package/dist/semantics/normalize/structural-generics.js +1 -1
- package/dist/semantics/normalize/structural-indexed-access.d.ts +1 -1
- package/dist/semantics/normalize/structural-indexed-access.js +1 -1
- package/dist/semantics/normalize/structural-instantiated-member.d.ts +1 -1
- package/dist/semantics/normalize/structural-instantiated-member.js +199 -68
- package/dist/semantics/normalize/structural-joins.d.ts +1 -1
- package/dist/semantics/normalize/structural-layout-relevance.d.ts +1 -1
- package/dist/semantics/normalize/structural-layout-relevance.js +1 -1
- package/dist/semantics/normalize/structural-layout-type.d.ts +1 -1
- package/dist/semantics/normalize/structural-layout-type.js +14 -2
- package/dist/semantics/normalize/structural-leaves.d.ts +1 -1
- package/dist/semantics/normalize/structural-leaves.js +1 -1
- package/dist/semantics/normalize/structural-local-union.d.ts +1 -1
- package/dist/semantics/normalize/structural-local-union.js +21 -16
- package/dist/semantics/normalize/structural-members.d.ts +1 -1
- package/dist/semantics/normalize/structural-members.js +1 -1
- package/dist/semantics/normalize/structural-mutable-field.d.ts +1 -2
- package/dist/semantics/normalize/structural-mutable-field.js +17 -4
- package/dist/semantics/normalize/structural-mutable-method.d.ts +1 -1
- package/dist/semantics/normalize/structural-mutable-method.js +1 -1
- package/dist/semantics/normalize/structural-parts.d.ts +1 -1
- package/dist/semantics/normalize/structural-parts.js +1 -1
- package/dist/semantics/normalize/structural-receiver.d.ts +1 -1
- package/dist/semantics/normalize/structural-receiver.js +1 -1
- package/dist/semantics/normalize/structural-rules.d.ts +4 -4
- package/dist/semantics/normalize/structural-rules.js +30 -12
- package/dist/semantics/normalize/structural-self-reference.d.ts +1 -1
- package/dist/semantics/normalize/structural-self-reference.js +1 -1
- package/dist/semantics/normalize/structural.d.ts +1 -1
- package/dist/semantics/normalize/structural.js +2467 -2239
- package/dist/semantics/normalize/suppressed-write-arms.d.ts +1 -1
- package/dist/semantics/normalize/suppressed-write-arms.js +1 -1
- package/dist/semantics/normalize/symbol-keyed-this-slots.d.ts +1 -1
- package/dist/semantics/normalize/symbol-keyed-this-slots.js +1 -1
- package/dist/semantics/normalize/unreduced-type-form.d.ts +1 -1
- package/dist/semantics/normalize/unreduced-type-form.js +1 -1
- package/dist/semantics/normalize/unresolvable-names.d.ts +1 -1
- package/dist/semantics/normalize/unresolvable-names.js +1 -1
- package/dist/semantics/normalize/unshared-array-result.d.ts +1 -1
- package/dist/semantics/normalize/unshared-array-result.js +1 -1
- package/dist/semantics/package-sources.d.ts +1 -1
- package/dist/semantics/package-sources.js +1 -1
- package/dist/semantics/program.d.ts +1 -1
- package/dist/semantics/program.js +11 -5
- package/dist/semantics/prototype-install-source-transform.js +1 -1
- package/dist/semantics/prototype-object-class-source-transform.js +1 -1
- package/dist/semantics/prototype-reparenting.d.ts +1 -1
- package/dist/semantics/prototype-reparenting.js +1 -1
- package/dist/semantics/shared-declaration-files.d.ts +1 -1
- package/dist/semantics/source-transform-exports.js +1 -1
- package/dist/semantics/stable-checker.d.ts +9 -1
- package/dist/semantics/stable-checker.js +21 -5
- package/dist/semantics/subclass-member-overlay-transform.js +46 -5
- package/dist/semantics/symbol-keyed-expando-source-transform.js +1 -1
- package/dist/semantics/this-constructor-source-transform.js +1 -1
- package/dist/semantics/typescript.d.ts +12 -0
- package/dist/semantics/typescript.js +12 -0
- package/dist/semantics/uncached-jsdoc-tags.d.ts +16 -0
- package/dist/semantics/uncached-jsdoc-tags.js +23 -0
- package/dist/semantics/unchecked-guard-argument-copies.d.ts +1 -1
- package/dist/semantics/unchecked-guard-argument-copies.js +1 -1
- package/dist/semantics/unchecked-write-member-declarations.d.ts +1 -1
- package/dist/semantics/unchecked-write-member-declarations.js +1 -1
- package/dist/semantics/uninstantiable-classes.d.ts +1 -1
- package/dist/semantics/uninstantiable-classes.js +1 -1
- package/dist/targets/cpp/conversions.js +137 -87
- package/dist/targets/cpp/emit-in.js +2 -1
- package/dist/targets/cpp/emit-iterator.d.ts +6 -5
- package/dist/targets/cpp/emit-iterator.js +23 -13
- package/dist/targets/cpp/emit-narrowing.d.ts +8 -0
- package/dist/targets/cpp/emit-narrowing.js +11 -1
- package/dist/targets/cpp/emit-record-view.d.ts +9 -0
- package/dist/targets/cpp/emit-record-view.js +12 -1
- package/package.json +7 -1
- package/src/targets/cpp/runtime/gea_runtime.h +6 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { callableCompletionSummaryOf } from './flow/callable-completions.js';
|
|
2
2
|
import { relative } from 'node:path';
|
|
3
|
-
import ts from 'typescript';
|
|
3
|
+
import ts from '#typescript';
|
|
4
4
|
import { globalSymbolBehindModuleAmbientConst, isAmbientDeclaration, moduleAmbientGlobalSatisfiesDeclaration } from '../ambient.js';
|
|
5
5
|
import { outermostErasureOf, unwrapErasedExpression } from './producers/erasure.js';
|
|
6
6
|
import { scriptGlobalValueRedefinitionOf } from './script-global-redefinition.js';
|
|
@@ -26,6 +26,123 @@ import { programSymbolOriginOf } from './callable-data-write.js';
|
|
|
26
26
|
import { intrinsicAccessorGetterChainOf } from './intrinsic-accessor-getter.js';
|
|
27
27
|
// A source file named the way a reader finds it: from the directory the compiler runs in.
|
|
28
28
|
const displayPath = (fileName) => relative(process.cwd(), fileName);
|
|
29
|
+
const absent = Symbol('absent');
|
|
30
|
+
const SMALL_SET_LIST = 8;
|
|
31
|
+
/**
|
|
32
|
+
* The alias graph's per-node and per-component sets: a node's copy edges and
|
|
33
|
+
* seeds, a component's edges and terms. A large program builds a quarter of a
|
|
34
|
+
* million nodes and as many components, and nearly every one of those sets
|
|
35
|
+
* holds a handful of members -- while even an empty `Set` costs about two
|
|
36
|
+
* hundred bytes of hash table, which made these sets most of the census's
|
|
37
|
+
* peak. One member is held inline and up to eight in a list; a `Set` is
|
|
38
|
+
* built only beyond that.
|
|
39
|
+
* Iteration is insertion order and visits a member added while it runs,
|
|
40
|
+
* exactly as a `Set`'s does, so no visit order -- and no answer -- depends on
|
|
41
|
+
* which form a set holds.
|
|
42
|
+
*/
|
|
43
|
+
class SmallSet {
|
|
44
|
+
first = absent;
|
|
45
|
+
/** Two to `SMALL_SET_LIST` members, in insertion order. */
|
|
46
|
+
list = null;
|
|
47
|
+
members = null;
|
|
48
|
+
get size() {
|
|
49
|
+
return this.members !== null ? this.members.size : this.list !== null ? this.list.length : this.first === absent ? 0 : 1;
|
|
50
|
+
}
|
|
51
|
+
has(member) {
|
|
52
|
+
return this.members !== null ? this.members.has(member) : this.list !== null ? this.list.includes(member) : this.first === member;
|
|
53
|
+
}
|
|
54
|
+
add(member) {
|
|
55
|
+
if (this.members !== null)
|
|
56
|
+
this.members.add(member);
|
|
57
|
+
else if (this.list !== null) {
|
|
58
|
+
if (this.list.includes(member))
|
|
59
|
+
return this;
|
|
60
|
+
// Rebuilt at its exact length: `push` (and a spread) would grow a
|
|
61
|
+
// two-member list to nineteen slots.
|
|
62
|
+
if (this.list.length < SMALL_SET_LIST) {
|
|
63
|
+
const list = new Array(this.list.length + 1);
|
|
64
|
+
for (let index = 0; index < this.list.length; index++)
|
|
65
|
+
list[index] = this.list[index];
|
|
66
|
+
list[this.list.length] = member;
|
|
67
|
+
this.list = list;
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
this.members = new Set(this.list).add(member);
|
|
71
|
+
this.list = null;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
else if (this.first === absent)
|
|
75
|
+
this.first = member;
|
|
76
|
+
else if (this.first !== member)
|
|
77
|
+
this.list = [this.first, member];
|
|
78
|
+
return this;
|
|
79
|
+
}
|
|
80
|
+
clear() {
|
|
81
|
+
this.first = absent;
|
|
82
|
+
this.list = null;
|
|
83
|
+
this.members = null;
|
|
84
|
+
}
|
|
85
|
+
values() {
|
|
86
|
+
return this[Symbol.iterator]();
|
|
87
|
+
}
|
|
88
|
+
// Each form holds the earlier form's members first and in order, so a
|
|
89
|
+
// visit that sees the set grow into the next form resumes at the same
|
|
90
|
+
// position in it.
|
|
91
|
+
*[Symbol.iterator]() {
|
|
92
|
+
let visited = 0;
|
|
93
|
+
for (;;) {
|
|
94
|
+
if (this.members !== null)
|
|
95
|
+
break;
|
|
96
|
+
if (this.list !== null) {
|
|
97
|
+
if (visited >= this.list.length)
|
|
98
|
+
return;
|
|
99
|
+
yield this.list[visited++];
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
if (visited > 0 || this.first === absent)
|
|
103
|
+
return;
|
|
104
|
+
visited = 1;
|
|
105
|
+
yield this.first;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
let skipped = 0;
|
|
109
|
+
for (const member of this.members) {
|
|
110
|
+
if (skipped < visited)
|
|
111
|
+
skipped++;
|
|
112
|
+
else
|
|
113
|
+
yield member;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* A short insertion-ordered set that never changes once built: adding a member
|
|
119
|
+
* yields another list (`withTerm` in the census). The alias graph's term sets
|
|
120
|
+
* are a few hundred thousand, nearly all of two to eight members, and nearly
|
|
121
|
+
* all repeats of a few thousand distinct lists -- each held once this way
|
|
122
|
+
* instead of once per component and per selector. Iterating one visits a
|
|
123
|
+
* snapshot, which no caller can tell apart from a `SmallSet`'s live visit: no
|
|
124
|
+
* walk over a set's terms adds a term to that same set.
|
|
125
|
+
*/
|
|
126
|
+
class SharedList {
|
|
127
|
+
members;
|
|
128
|
+
id;
|
|
129
|
+
constructor(members, id) {
|
|
130
|
+
this.members = members;
|
|
131
|
+
this.id = id;
|
|
132
|
+
}
|
|
133
|
+
get size() {
|
|
134
|
+
return this.members.length;
|
|
135
|
+
}
|
|
136
|
+
has(member) {
|
|
137
|
+
return this.members.includes(member);
|
|
138
|
+
}
|
|
139
|
+
values() {
|
|
140
|
+
return this.members.values();
|
|
141
|
+
}
|
|
142
|
+
[Symbol.iterator]() {
|
|
143
|
+
return this.members.values();
|
|
144
|
+
}
|
|
145
|
+
}
|
|
29
146
|
const staticKeyOf = (node) => {
|
|
30
147
|
if (ts.isPropertyAccessExpression(node))
|
|
31
148
|
return node.name.text;
|
|
@@ -1135,6 +1252,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
1135
1252
|
// the prototype object's identity itself, so absence proofs and inherited
|
|
1136
1253
|
// descriptor reads observe the same mutation through direct or aliased use.
|
|
1137
1254
|
const intrinsicPrototypeOrigins = new Map();
|
|
1255
|
+
const noIntrinsicPrototypes = [];
|
|
1138
1256
|
const intrinsicPrototypesOf = (expression) => {
|
|
1139
1257
|
const root = unwrapErasedExpression(expression);
|
|
1140
1258
|
const cached = intrinsicPrototypeOrigins.get(root);
|
|
@@ -1165,7 +1283,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
1165
1283
|
if (flowSiteIsReachable(write.site) && write.slot === 'whole' && write.value !== null)
|
|
1166
1284
|
pending.push(write.value);
|
|
1167
1285
|
}
|
|
1168
|
-
const result = [...identities];
|
|
1286
|
+
const result = identities.size === 0 ? noIntrinsicPrototypes : [...identities];
|
|
1169
1287
|
intrinsicPrototypeOrigins.set(root, result);
|
|
1170
1288
|
return result;
|
|
1171
1289
|
};
|
|
@@ -2207,10 +2325,17 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
2207
2325
|
// edges and discharge whole components before a consumer can use a result.
|
|
2208
2326
|
// In particular, the expected type returned while a query is active is only
|
|
2209
2327
|
// a constraint variable: an ungrounded cycle cannot certify its own origin.
|
|
2328
|
+
//
|
|
2329
|
+
// Only an expression that has dependencies holds an entry: one for every
|
|
2330
|
+
// expression ever asked was a quarter of a million entries on a 48K-line
|
|
2331
|
+
// app, nearly all of them answering "none" -- which a missing entry already
|
|
2332
|
+
// says.
|
|
2210
2333
|
const publicationDependencies = new Map();
|
|
2211
2334
|
const publicationStack = [];
|
|
2335
|
+
const noPublicationDependencies = Object.freeze([]);
|
|
2212
2336
|
const publicationVerdict = seededOriginSolver((expression) => {
|
|
2213
|
-
const
|
|
2337
|
+
const recorded = publicationDependencies.get(expression);
|
|
2338
|
+
const dependencies = recorded === undefined ? noPublicationDependencies : [...recorded];
|
|
2214
2339
|
return {
|
|
2215
2340
|
admitted: publishedRepresentations.get(expression) != null,
|
|
2216
2341
|
seed: (dependencies.length === 0 || publicationAllocations.has(expression)) && publishedRepresentations.get(expression) != null,
|
|
@@ -2220,8 +2345,6 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
2220
2345
|
publishedRepresentationOf = (expression) => {
|
|
2221
2346
|
const current = unwrapErasedExpression(expression);
|
|
2222
2347
|
const parent = publicationStack.at(-1);
|
|
2223
|
-
if (!publicationDependencies.has(current))
|
|
2224
|
-
publicationDependencies.set(current, new Set());
|
|
2225
2348
|
publicationStack.push(current);
|
|
2226
2349
|
let candidate;
|
|
2227
2350
|
try {
|
|
@@ -2230,8 +2353,12 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
2230
2353
|
finally {
|
|
2231
2354
|
publicationStack.pop();
|
|
2232
2355
|
}
|
|
2233
|
-
if (parent && candidate !== null)
|
|
2234
|
-
publicationDependencies.get(parent)
|
|
2356
|
+
if (parent && candidate !== null) {
|
|
2357
|
+
let dependencies = publicationDependencies.get(parent);
|
|
2358
|
+
if (!dependencies)
|
|
2359
|
+
publicationDependencies.set(parent, (dependencies = new SmallSet()));
|
|
2360
|
+
dependencies.add(current);
|
|
2361
|
+
}
|
|
2235
2362
|
if (parent)
|
|
2236
2363
|
return candidate;
|
|
2237
2364
|
return candidate !== null && publicationVerdict(current) === 'allocated' ? candidate : null;
|
|
@@ -3067,7 +3194,11 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
3067
3194
|
const cached = writesByDeclaration.get(declaration);
|
|
3068
3195
|
if (cached)
|
|
3069
3196
|
return cached;
|
|
3070
|
-
|
|
3197
|
+
// The flow index's own list when every write is reachable, as nearly all
|
|
3198
|
+
// are: a filtered copy per declaration held the same list twice.
|
|
3199
|
+
const all = flow.writesToDeclaration(declaration);
|
|
3200
|
+
const reachableOnly = all.filter((write) => flowSiteIsReachable(write.site));
|
|
3201
|
+
const writes = reachableOnly.length === all.length ? all : reachableOnly;
|
|
3071
3202
|
writesByDeclaration.set(declaration, writes);
|
|
3072
3203
|
return writes;
|
|
3073
3204
|
};
|
|
@@ -3243,6 +3374,32 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
3243
3374
|
}
|
|
3244
3375
|
}
|
|
3245
3376
|
const indexedWritesByDeclaration = new Map();
|
|
3377
|
+
// Most declarations have none of most write kinds; a kept list is copied at
|
|
3378
|
+
// its exact length, since `push` left each with room for seventeen.
|
|
3379
|
+
const noExpressions = [];
|
|
3380
|
+
const noMemberWrites = new Map();
|
|
3381
|
+
const keptExpressions = (values) => (values.length === 0 ? noExpressions : values.slice());
|
|
3382
|
+
const noStagedMembers = [];
|
|
3383
|
+
const noStagedBulk = [];
|
|
3384
|
+
// A declaration with no write of any kind -- most of them -- shares one index.
|
|
3385
|
+
const noIndexedWrites = {
|
|
3386
|
+
whole: noExpressions,
|
|
3387
|
+
members: noMemberWrites,
|
|
3388
|
+
everyMember: noExpressions,
|
|
3389
|
+
elements: noExpressions,
|
|
3390
|
+
contained: noExpressions,
|
|
3391
|
+
bulk: noExpressions,
|
|
3392
|
+
stagedMembers: noStagedMembers,
|
|
3393
|
+
stagedBulk: noStagedBulk
|
|
3394
|
+
};
|
|
3395
|
+
const isEmptyIndex = (indexed) => indexed.whole.length === 0 &&
|
|
3396
|
+
indexed.members.size === 0 &&
|
|
3397
|
+
indexed.everyMember.length === 0 &&
|
|
3398
|
+
indexed.elements.length === 0 &&
|
|
3399
|
+
indexed.contained.length === 0 &&
|
|
3400
|
+
indexed.bulk.length === 0 &&
|
|
3401
|
+
indexed.stagedMembers.length === 0 &&
|
|
3402
|
+
indexed.stagedBulk.length === 0;
|
|
3246
3403
|
const indexedWritesOf = (declaration) => {
|
|
3247
3404
|
const cached = indexedWritesByDeclaration.get(declaration);
|
|
3248
3405
|
if (cached)
|
|
@@ -3277,16 +3434,16 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
3277
3434
|
bulk.push(write.value);
|
|
3278
3435
|
}
|
|
3279
3436
|
const indexed = {
|
|
3280
|
-
whole,
|
|
3281
|
-
members: mutableMembers,
|
|
3282
|
-
everyMember,
|
|
3283
|
-
elements,
|
|
3284
|
-
contained,
|
|
3285
|
-
bulk,
|
|
3286
|
-
stagedMembers: stagedMembers.get(declaration) ??
|
|
3287
|
-
stagedBulk: stagedBulk.get(declaration) ??
|
|
3437
|
+
whole: keptExpressions(whole),
|
|
3438
|
+
members: mutableMembers.size === 0 ? noMemberWrites : mutableMembers,
|
|
3439
|
+
everyMember: keptExpressions(everyMember),
|
|
3440
|
+
elements: keptExpressions(elements),
|
|
3441
|
+
contained: keptExpressions(contained),
|
|
3442
|
+
bulk: keptExpressions(bulk),
|
|
3443
|
+
stagedMembers: stagedMembers.get(declaration) ?? noStagedMembers,
|
|
3444
|
+
stagedBulk: stagedBulk.get(declaration) ?? noStagedBulk
|
|
3288
3445
|
};
|
|
3289
|
-
indexedWritesByDeclaration.set(declaration, indexed);
|
|
3446
|
+
indexedWritesByDeclaration.set(declaration, isEmptyIndex(indexed) ? noIndexedWrites : indexed);
|
|
3290
3447
|
return indexed;
|
|
3291
3448
|
};
|
|
3292
3449
|
const wholeValuesOf = (declaration) => indexedWritesOf(declaration).whole;
|
|
@@ -3343,6 +3500,53 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
3343
3500
|
indexedLiterals.set(literal, indexed);
|
|
3344
3501
|
return indexed;
|
|
3345
3502
|
};
|
|
3503
|
+
// Most nodes and components never get an edge, and every node's seeds and
|
|
3504
|
+
// edges are spent once the graph is condensed: an empty set is this one
|
|
3505
|
+
// frozen instance, which a write would throw on, and a set is built on the
|
|
3506
|
+
// first member (`ownSet`).
|
|
3507
|
+
const noMembers = Object.freeze(new SmallSet());
|
|
3508
|
+
const ownSet = (set) => (set === noMembers ? new SmallSet() : set);
|
|
3509
|
+
const addSeed = (node, term) => {
|
|
3510
|
+
node.seeds = ownSet(node.seeds).add(term);
|
|
3511
|
+
};
|
|
3512
|
+
// Each short term set is the one shared list of exactly its members in their
|
|
3513
|
+
// order, reached from the list one member shorter. A transition is keyed by
|
|
3514
|
+
// that list's index and the added term's, both counted up from zero.
|
|
3515
|
+
const termIds = new Map();
|
|
3516
|
+
const TERM_ID_LIMIT = 2 ** 26;
|
|
3517
|
+
const sharedTermLists = new Map();
|
|
3518
|
+
const noTerms = new SharedList([], 0);
|
|
3519
|
+
let sharedTermListCount = 1;
|
|
3520
|
+
const ownTerms = (terms, term) => {
|
|
3521
|
+
const own = new SmallSet();
|
|
3522
|
+
for (const member of terms)
|
|
3523
|
+
own.add(member);
|
|
3524
|
+
return own.add(term);
|
|
3525
|
+
};
|
|
3526
|
+
/** `terms` with `term` added, which it does not hold: a long set is private and grows in place. */
|
|
3527
|
+
const withTerm = (terms, term) => {
|
|
3528
|
+
const base = terms ?? noTerms;
|
|
3529
|
+
if (base instanceof SmallSet)
|
|
3530
|
+
return base.add(term);
|
|
3531
|
+
if (base.size >= SMALL_SET_LIST)
|
|
3532
|
+
return ownTerms(base, term);
|
|
3533
|
+
let termId = termIds.get(term);
|
|
3534
|
+
if (termId === undefined)
|
|
3535
|
+
termIds.set(term, (termId = termIds.size));
|
|
3536
|
+
if (termId >= TERM_ID_LIMIT)
|
|
3537
|
+
return ownTerms(base, term);
|
|
3538
|
+
const key = base.id * TERM_ID_LIMIT + termId;
|
|
3539
|
+
let next = sharedTermLists.get(key);
|
|
3540
|
+
if (next === undefined) {
|
|
3541
|
+
// At its exact length: a spread left room for growth in every list.
|
|
3542
|
+
const members = new Array(base.size + 1);
|
|
3543
|
+
for (let index = 0; index < base.size; index++)
|
|
3544
|
+
members[index] = base.members[index];
|
|
3545
|
+
members[base.size] = term;
|
|
3546
|
+
sharedTermLists.set(key, (next = new SharedList(members, sharedTermListCount++)));
|
|
3547
|
+
}
|
|
3548
|
+
return next;
|
|
3549
|
+
};
|
|
3346
3550
|
const childModeOf = (mode) => (mode === 'copied-reachable' ? 'reachable' : mode);
|
|
3347
3551
|
const copyModeOf = (mode) => (mode === 'own' ? 'own' : 'copied-reachable');
|
|
3348
3552
|
const inheritedPrototypeTerms = new Map();
|
|
@@ -3518,14 +3722,13 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
3518
3722
|
const allValueNodes = [];
|
|
3519
3723
|
const pendingExpansion = [];
|
|
3520
3724
|
const selectors = [];
|
|
3521
|
-
let nextValueNodeId = 0;
|
|
3522
3725
|
const newValueNode = (expression) => {
|
|
3523
3726
|
const node = {
|
|
3524
|
-
id: nextValueNodeId++,
|
|
3525
3727
|
expression,
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3728
|
+
component: null,
|
|
3729
|
+
out: noMembers,
|
|
3730
|
+
incoming: noMembers,
|
|
3731
|
+
seeds: noMembers,
|
|
3529
3732
|
expanded: expression === null
|
|
3530
3733
|
};
|
|
3531
3734
|
allValueNodes.push(node);
|
|
@@ -3546,7 +3749,9 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
3546
3749
|
const link = (source, target) => {
|
|
3547
3750
|
if (source === target || source.out.has(target))
|
|
3548
3751
|
return;
|
|
3752
|
+
source.out = ownSet(source.out);
|
|
3549
3753
|
source.out.add(target);
|
|
3754
|
+
target.incoming = ownSet(target.incoming);
|
|
3550
3755
|
target.incoming.add(source);
|
|
3551
3756
|
};
|
|
3552
3757
|
const select = (source, key, target, mode = 'own') => {
|
|
@@ -3569,7 +3774,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
3569
3774
|
return existing;
|
|
3570
3775
|
const storage = syntheticValueNode();
|
|
3571
3776
|
storageValueNodes.set(declaration, storage);
|
|
3572
|
-
storage
|
|
3777
|
+
addSeed(storage, storageTermOf(declaration));
|
|
3573
3778
|
for (const write of writesOf(declaration))
|
|
3574
3779
|
if (write.value)
|
|
3575
3780
|
valueNodeOf(write.value);
|
|
@@ -3583,7 +3788,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
3583
3788
|
else {
|
|
3584
3789
|
const source = syntheticValueNode();
|
|
3585
3790
|
selectPath(read.source, read.keys, source);
|
|
3586
|
-
storage
|
|
3791
|
+
addSeed(storage, { kind: 'rest', source, rest: read.rest });
|
|
3587
3792
|
}
|
|
3588
3793
|
}
|
|
3589
3794
|
return storage;
|
|
@@ -3835,7 +4040,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
3835
4040
|
// is a source class or registered native receiver seeds what it
|
|
3836
4041
|
// proved instead of the unconditional unknown a frame-proof gap does
|
|
3837
4042
|
// not, by itself, establish.
|
|
3838
|
-
node
|
|
4043
|
+
addSeed(node, publishedRepresentationOf(current) !== null ? representedNonGlobalTerm : opaqueTerm);
|
|
3839
4044
|
return;
|
|
3840
4045
|
}
|
|
3841
4046
|
const sourceFact = ts.isCallExpression(current) && sourceFrameOwnedCalls.has(current) ? sourceInvocationFacts.get(current) : undefined;
|
|
@@ -3853,7 +4058,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
3853
4058
|
if (!declaration || declaration.getSourceFile().isDeclarationFile)
|
|
3854
4059
|
continue;
|
|
3855
4060
|
if (!flow.callableBodyIsIndexed(declaration))
|
|
3856
|
-
node
|
|
4061
|
+
addSeed(node, opaqueTerm);
|
|
3857
4062
|
for (const returned of observableCompletionValuesOf(declaration))
|
|
3858
4063
|
linkReturnedValue(current, returned, node);
|
|
3859
4064
|
}
|
|
@@ -3871,30 +4076,30 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
3871
4076
|
link(storageValueNodeOf(storage), node);
|
|
3872
4077
|
const sourceContents = sourceContainmentOf(current);
|
|
3873
4078
|
if (sourceContents)
|
|
3874
|
-
node
|
|
4079
|
+
addSeed(node, sourceContents);
|
|
3875
4080
|
for (const term of inheritedPrototypesOf(current))
|
|
3876
|
-
node
|
|
4081
|
+
addSeed(node, term);
|
|
3877
4082
|
for (const declaration of intrinsicPrototypesOf(current)) {
|
|
3878
4083
|
let term = prototypeTerms.get(declaration);
|
|
3879
4084
|
if (!term) {
|
|
3880
4085
|
term = { kind: 'INTRINSIC_OBJECT', declaration };
|
|
3881
4086
|
prototypeTerms.set(declaration, term);
|
|
3882
4087
|
}
|
|
3883
|
-
node
|
|
4088
|
+
addSeed(node, term);
|
|
3884
4089
|
}
|
|
3885
4090
|
if (isProvenGlobalObject(current)) {
|
|
3886
|
-
node
|
|
4091
|
+
addSeed(node, globalTerm);
|
|
3887
4092
|
return;
|
|
3888
4093
|
}
|
|
3889
4094
|
if (ts.isObjectLiteralExpression(current) || ts.isArrayLiteralExpression(current)) {
|
|
3890
|
-
node
|
|
4095
|
+
addSeed(node, literalTermOf(current));
|
|
3891
4096
|
addLiteralChildren(current);
|
|
3892
4097
|
return;
|
|
3893
4098
|
}
|
|
3894
4099
|
if (!ts.isCallExpression(current) && !ts.isNewExpression(current)) {
|
|
3895
4100
|
const representation = publishedRepresentationOf(current);
|
|
3896
4101
|
if (representation !== null && representation !== 'object') {
|
|
3897
|
-
node
|
|
4102
|
+
addSeed(node, representedNonGlobalTerm);
|
|
3898
4103
|
return;
|
|
3899
4104
|
}
|
|
3900
4105
|
}
|
|
@@ -3926,7 +4131,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
3926
4131
|
return;
|
|
3927
4132
|
}
|
|
3928
4133
|
if (refusedSourceInvocationCalls.has(current)) {
|
|
3929
|
-
node
|
|
4134
|
+
addSeed(node, opaqueTerm);
|
|
3930
4135
|
return;
|
|
3931
4136
|
}
|
|
3932
4137
|
// `require( 'optional-peer' )` of a package absent from the build never
|
|
@@ -3961,7 +4166,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
3961
4166
|
linkReturnedValue(current, value, node);
|
|
3962
4167
|
return;
|
|
3963
4168
|
}
|
|
3964
|
-
node
|
|
4169
|
+
addSeed(node, representedNonGlobalTerm);
|
|
3965
4170
|
if (representation === 'object' && declaration && !declaration.getSourceFile().isDeclarationFile && body) {
|
|
3966
4171
|
for (const returned of observableCompletionValuesOf(declaration))
|
|
3967
4172
|
linkReturnedValue(current, returned, node);
|
|
@@ -3975,7 +4180,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
3975
4180
|
process.stderr.write(`${file.fileName}:${position.line + 1}:${position.character + 1}: opaque call result: ${current.getText(file).slice(0, 60)} :: ` +
|
|
3976
4181
|
`type=${checker.typeToString(type)} primitive=${primitiveResult(type)} native=${nativeResult(type, current)} represented=${representedObjectResult(type)}\n`);
|
|
3977
4182
|
}
|
|
3978
|
-
node
|
|
4183
|
+
addSeed(node, opaqueTerm);
|
|
3979
4184
|
}
|
|
3980
4185
|
else {
|
|
3981
4186
|
if (call?.thisArgument) {
|
|
@@ -3991,7 +4196,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
3991
4196
|
const proxy = programProxyOf(current);
|
|
3992
4197
|
if (proxy !== null) {
|
|
3993
4198
|
link(valueNodeOf(proxy.target), node);
|
|
3994
|
-
node
|
|
4199
|
+
addSeed(node, { kind: 'proxy', reads: proxy.reads.map(valueNodeOf) });
|
|
3995
4200
|
return;
|
|
3996
4201
|
}
|
|
3997
4202
|
const constructionReturns = sourceConstructionReturnsOf(current.expression);
|
|
@@ -4000,12 +4205,12 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
4000
4205
|
const declaration = executableDeclarationOf(callDeclarationAt(current));
|
|
4001
4206
|
const body = declaration && ts.isFunctionLike(declaration) ? declaration.body : undefined;
|
|
4002
4207
|
if (publishedRepresentationOf(current) !== null)
|
|
4003
|
-
node
|
|
4208
|
+
addSeed(node, representedNonGlobalTerm);
|
|
4004
4209
|
else if (constructionReturns !== null && constructionReturns.length > 0) {
|
|
4005
4210
|
// All inherited completion origins were linked above.
|
|
4006
4211
|
}
|
|
4007
4212
|
else if (!declaration || declaration.getSourceFile().isDeclarationFile || !body || !constructedChainIsSourceOwned(current))
|
|
4008
|
-
node
|
|
4213
|
+
addSeed(node, opaqueTerm);
|
|
4009
4214
|
// A `new` whose constructor is compiled here evaluates to an object
|
|
4010
4215
|
// THIS program allocated. That is a statement about provenance, and it
|
|
4011
4216
|
// does not depend on the representation layer having placed the class:
|
|
@@ -4049,11 +4254,11 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
4049
4254
|
// receiver, so it (and the two checks beside it) apply unchanged.
|
|
4050
4255
|
if (current.kind === ts.SyntaxKind.ThisKeyword || current.kind === ts.SyntaxKind.SuperKeyword) {
|
|
4051
4256
|
if (sourceClassThisIsRepresented(current)) {
|
|
4052
|
-
node
|
|
4257
|
+
addSeed(node, representedNonGlobalTerm);
|
|
4053
4258
|
return;
|
|
4054
4259
|
}
|
|
4055
4260
|
if (globalObjectReceivers.has(current)) {
|
|
4056
|
-
node
|
|
4261
|
+
addSeed(node, globalTerm);
|
|
4057
4262
|
return;
|
|
4058
4263
|
}
|
|
4059
4264
|
const receivers = enumeratedThisReceiversOf(current);
|
|
@@ -4082,10 +4287,10 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
4082
4287
|
if (current.kind === ts.SyntaxKind.ThisKeyword &&
|
|
4083
4288
|
!anyCallSiteMayBindThisToGlobal &&
|
|
4084
4289
|
sourceFileIsProvablyStrict(current.getSourceFile())) {
|
|
4085
|
-
node
|
|
4290
|
+
addSeed(node, representedNonGlobalTerm);
|
|
4086
4291
|
}
|
|
4087
4292
|
else {
|
|
4088
|
-
node
|
|
4293
|
+
addSeed(node, opaqueTerm);
|
|
4089
4294
|
}
|
|
4090
4295
|
}
|
|
4091
4296
|
else
|
|
@@ -4131,7 +4336,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
4131
4336
|
for (const value of parameterValues)
|
|
4132
4337
|
link(valueNodeOf(value), node);
|
|
4133
4338
|
else
|
|
4134
|
-
node
|
|
4339
|
+
addSeed(node, opaqueTerm);
|
|
4135
4340
|
}
|
|
4136
4341
|
link(storageValueNodeOf(declaration), node);
|
|
4137
4342
|
};
|
|
@@ -4180,7 +4385,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
4180
4385
|
let expansionIndex = 0;
|
|
4181
4386
|
while (expansionIndex < pendingExpansion.length)
|
|
4182
4387
|
expandValueNode(pendingExpansion[expansionIndex++]);
|
|
4183
|
-
|
|
4388
|
+
let graphNodeCount = allValueNodes.length;
|
|
4184
4389
|
const assertGraphFrozen = () => {
|
|
4185
4390
|
if (allValueNodes.length !== graphNodeCount)
|
|
4186
4391
|
throw new Error('global-host mutation graph grew after discovery');
|
|
@@ -4211,45 +4416,74 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
4211
4416
|
}
|
|
4212
4417
|
}
|
|
4213
4418
|
}
|
|
4214
|
-
const componentOf = new Map();
|
|
4215
4419
|
const components = [];
|
|
4420
|
+
// A component's member list is read only by the scale debug below; without
|
|
4421
|
+
// it every component, nearly all of one node, would keep an array.
|
|
4422
|
+
const componentNodes = process.env['GEA_HOST_MUTATION_SCALE_DEBUG'] === '1' ? new Map() : null;
|
|
4423
|
+
// Marks a node the walk below has claimed before its component exists.
|
|
4424
|
+
const claimed = { out: noMembers, terms: null };
|
|
4216
4425
|
for (let finishIndex = finishOrder.length - 1; finishIndex >= 0; finishIndex--) {
|
|
4217
4426
|
const root = finishOrder[finishIndex];
|
|
4218
|
-
if (
|
|
4427
|
+
if (root.component !== null)
|
|
4219
4428
|
continue;
|
|
4220
4429
|
const members = [];
|
|
4221
4430
|
const stack = [root];
|
|
4222
|
-
|
|
4431
|
+
root.component = claimed;
|
|
4223
4432
|
while (stack.length > 0) {
|
|
4224
4433
|
const node = stack.pop();
|
|
4225
4434
|
members.push(node);
|
|
4226
4435
|
for (const incoming of node.incoming) {
|
|
4227
|
-
if (
|
|
4436
|
+
if (incoming.component !== null)
|
|
4228
4437
|
continue;
|
|
4229
|
-
|
|
4438
|
+
incoming.component = claimed;
|
|
4230
4439
|
stack.push(incoming);
|
|
4231
4440
|
}
|
|
4232
4441
|
}
|
|
4233
|
-
const component = {
|
|
4442
|
+
const component = { out: noMembers, terms: null };
|
|
4234
4443
|
components.push(component);
|
|
4444
|
+
componentNodes?.set(component, members);
|
|
4235
4445
|
for (const member of members)
|
|
4236
|
-
|
|
4446
|
+
member.component = component;
|
|
4237
4447
|
}
|
|
4238
4448
|
for (const node of allValueNodes) {
|
|
4239
|
-
const source =
|
|
4449
|
+
const source = node.component;
|
|
4240
4450
|
for (const targetNode of node.out) {
|
|
4241
|
-
const target =
|
|
4242
|
-
if (source !== target)
|
|
4451
|
+
const target = targetNode.component;
|
|
4452
|
+
if (source !== target) {
|
|
4453
|
+
source.out = ownSet(source.out);
|
|
4243
4454
|
source.out.add(target);
|
|
4455
|
+
}
|
|
4244
4456
|
}
|
|
4245
4457
|
}
|
|
4458
|
+
// The condensation is done: the node edges, the walk's own state and the
|
|
4459
|
+
// expansion queue are spent, and only components carry edges from here.
|
|
4460
|
+
for (const node of allValueNodes) {
|
|
4461
|
+
node.out = noMembers;
|
|
4462
|
+
node.incoming = noMembers;
|
|
4463
|
+
}
|
|
4464
|
+
// Every question from here names an expression and wants its component, so
|
|
4465
|
+
// the tables answer that directly and the nodes go once they are seeded --
|
|
4466
|
+
// a quarter of a million of them on a large program. The few a term holds
|
|
4467
|
+
// (a rest source, a proxy's reads, a containment's values) stay with it.
|
|
4468
|
+
const componentByExpression = new Map();
|
|
4469
|
+
for (const [expression, node] of valueNodes)
|
|
4470
|
+
componentByExpression.set(expression, node.component);
|
|
4471
|
+
valueNodes.clear();
|
|
4472
|
+
const containsRequestComponents = new Map();
|
|
4473
|
+
for (const [expression, node] of containsRequests)
|
|
4474
|
+
containsRequestComponents.set(expression, node.component);
|
|
4475
|
+
containsRequests.clear();
|
|
4476
|
+
visited.clear();
|
|
4477
|
+
finishOrder.length = 0;
|
|
4478
|
+
pendingExpansion.length = 0;
|
|
4246
4479
|
if (process.env['GEA_HOST_MUTATION_SCALE_DEBUG'] === '1') {
|
|
4247
|
-
const
|
|
4248
|
-
|
|
4480
|
+
const sizeOf = (component) => componentNodes?.get(component)?.length ?? 0;
|
|
4481
|
+
const biggest = components.reduce((max, candidate) => (sizeOf(candidate) > sizeOf(max) ? candidate : max));
|
|
4482
|
+
process.stderr.write(`[HOST-MUTATION-SCALE] components=${components.length} allValueNodes=${allValueNodes.length} biggest component id=${components.indexOf(biggest)} nodes=${sizeOf(biggest)}\n`);
|
|
4249
4483
|
let shown = 0;
|
|
4250
4484
|
let total = 0;
|
|
4251
4485
|
for (const [declaration, node] of storageValueNodes) {
|
|
4252
|
-
if (
|
|
4486
|
+
if (node.component !== biggest)
|
|
4253
4487
|
continue;
|
|
4254
4488
|
total++;
|
|
4255
4489
|
if (shown >= 20)
|
|
@@ -4261,15 +4495,25 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
4261
4495
|
}
|
|
4262
4496
|
process.stderr.write(` total storage declarations mapping to biggest component: ${total} of ${storageValueNodes.size}\n`);
|
|
4263
4497
|
}
|
|
4264
|
-
|
|
4498
|
+
storageValueNodes.clear();
|
|
4499
|
+
storageSelectionNodes.clear();
|
|
4265
4500
|
const selectorTargets = new Map();
|
|
4266
4501
|
const dynamicOut = new Map();
|
|
4502
|
+
// Each worklist is two parallel columns rather than an array of pairs: a
|
|
4503
|
+
// pair object per entry was most of a queue's size.
|
|
4504
|
+
const pendingTermComponents = [];
|
|
4267
4505
|
const pendingTerms = [];
|
|
4268
4506
|
let pendingIndex = 0;
|
|
4507
|
+
const pendingSelectors = [];
|
|
4269
4508
|
const pendingSelections = [];
|
|
4270
4509
|
let pendingSelectionIndex = 0;
|
|
4271
|
-
|
|
4510
|
+
// Per (source, key), the known targets of each mode in a three-slot list --
|
|
4511
|
+
// kept only for a source with many selectors. Nearly every source has one
|
|
4512
|
+
// or two, and a key map per source was the largest table the census held;
|
|
4513
|
+
// a short list is scanned instead, which answers the same question.
|
|
4272
4514
|
const selectorTargetsByKey = new Map();
|
|
4515
|
+
const SELECTOR_SCAN_LIMIT = 16;
|
|
4516
|
+
const selectorModeSlot = { own: 0, reachable: 1, 'copied-reachable': 2 };
|
|
4273
4517
|
// GEA_HOST_MUTATION_SCALE_DEBUG=1: rank which components are the source of
|
|
4274
4518
|
// the most SCHEDULED (selector, term) expansions, to find a blowup without
|
|
4275
4519
|
// guessing. Never gated into the solve loop itself.
|
|
@@ -4277,14 +4521,14 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
4277
4521
|
const scheduleCountBySource = new Map();
|
|
4278
4522
|
const functionWalkCounts = new Map();
|
|
4279
4523
|
const sampleTextOf = (component) => {
|
|
4280
|
-
for (const node of component
|
|
4524
|
+
for (const node of componentNodes?.get(component) ?? []) {
|
|
4281
4525
|
if (node.expression) {
|
|
4282
4526
|
const file = node.expression.getSourceFile();
|
|
4283
4527
|
const { line, character } = file.getLineAndCharacterOfPosition(node.expression.getStart(file));
|
|
4284
4528
|
return `${displayPath(file.fileName)}:${line + 1}:${character + 1} ${node.expression.getText(file).slice(0, 80)}`;
|
|
4285
4529
|
}
|
|
4286
4530
|
}
|
|
4287
|
-
return `<synthetic component ${component
|
|
4531
|
+
return `<synthetic component ${components.indexOf(component)}>`;
|
|
4288
4532
|
};
|
|
4289
4533
|
let scheduleDebugCount = 0;
|
|
4290
4534
|
const reportScaleDebug = () => {
|
|
@@ -4292,16 +4536,16 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
4292
4536
|
if (scheduleDebugCount % 200000 !== 0)
|
|
4293
4537
|
return;
|
|
4294
4538
|
const top = [...scheduleCountBySource.entries()].sort((left, right) => right[1] - left[1]).slice(0, 10);
|
|
4295
|
-
process.stderr.write(`[HOST-MUTATION-SCALE] scheduled=${scheduleDebugCount} pendingSelections=${pendingSelections.length}
|
|
4539
|
+
process.stderr.write(`[HOST-MUTATION-SCALE] scheduled=${scheduleDebugCount} pendingSelections=${pendingSelections.length} distinctSources=${scheduleCountBySource.size}\n`);
|
|
4296
4540
|
for (const [component, count] of top) {
|
|
4297
|
-
process.stderr.write(` count=${count} selectors=${selectorTargets.get(component)?.length ?? 0} terms=${
|
|
4541
|
+
process.stderr.write(` count=${count} selectors=${selectorTargets.get(component)?.length ?? 0} terms=${component.terms?.size ?? 0} :: ${sampleTextOf(component)}\n`);
|
|
4298
4542
|
}
|
|
4299
4543
|
if (top[0]) {
|
|
4300
4544
|
const [worstComponent] = top[0];
|
|
4301
4545
|
const list = selectorTargets.get(worstComponent) ?? [];
|
|
4302
4546
|
const sample = list.slice(-8);
|
|
4303
4547
|
for (const selector of sample) {
|
|
4304
|
-
process.stderr.write(` [WORST-SAMPLE] key=${JSON.stringify(selector.key)} mode=${selector.mode} target.id=${selector.target
|
|
4548
|
+
process.stderr.write(` [WORST-SAMPLE] key=${JSON.stringify(selector.key)} mode=${selector.mode} target.id=${components.indexOf(selector.target)} targetSample=${sampleTextOf(selector.target)}\n`);
|
|
4305
4549
|
}
|
|
4306
4550
|
}
|
|
4307
4551
|
const topWalks = [...functionWalkCounts.entries()].sort((left, right) => right[1] - left[1]).slice(0, 5);
|
|
@@ -4313,26 +4557,20 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
4313
4557
|
};
|
|
4314
4558
|
const componentOfExpression = (expression) => {
|
|
4315
4559
|
const current = unwrapErasedExpression(expression);
|
|
4316
|
-
const
|
|
4317
|
-
if (
|
|
4560
|
+
const component = componentByExpression.get(current);
|
|
4561
|
+
if (component === undefined) {
|
|
4318
4562
|
const file = current.getSourceFile();
|
|
4319
4563
|
const { line, character } = file.getLineAndCharacterOfPosition(current.getStart());
|
|
4320
4564
|
throw new Error(`global-host mutation graph was not closed for ${ts.SyntaxKind[current.kind]} \`${current.getText()}\` at ${file.fileName}:${line + 1}:${character + 1}`);
|
|
4321
4565
|
}
|
|
4322
|
-
const component = componentOf.get(node);
|
|
4323
|
-
if (!component)
|
|
4324
|
-
throw new Error(`global-host mutation graph has no component for ${current.kind}`);
|
|
4325
4566
|
return component;
|
|
4326
4567
|
};
|
|
4327
4568
|
const addTerm = (component, term) => {
|
|
4328
|
-
|
|
4329
|
-
if (!terms) {
|
|
4330
|
-
terms =
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
if (!terms.has(term)) {
|
|
4334
|
-
terms.add(term);
|
|
4335
|
-
pendingTerms.push({ component, term });
|
|
4569
|
+
const terms = component.terms;
|
|
4570
|
+
if (terms === null || !terms.has(term)) {
|
|
4571
|
+
component.terms = withTerm(terms, term);
|
|
4572
|
+
pendingTermComponents.push(component);
|
|
4573
|
+
pendingTerms.push(term);
|
|
4336
4574
|
}
|
|
4337
4575
|
};
|
|
4338
4576
|
const addFlow = (source, target) => {
|
|
@@ -4340,25 +4578,22 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
4340
4578
|
return;
|
|
4341
4579
|
let targets = dynamicOut.get(source);
|
|
4342
4580
|
if (!targets) {
|
|
4343
|
-
targets = new
|
|
4581
|
+
targets = new SmallSet();
|
|
4344
4582
|
dynamicOut.set(source, targets);
|
|
4345
4583
|
}
|
|
4346
4584
|
if (targets.has(target))
|
|
4347
4585
|
return;
|
|
4348
4586
|
targets.add(target);
|
|
4349
|
-
for (const term of
|
|
4587
|
+
for (const term of source.terms ?? [])
|
|
4350
4588
|
addTerm(target, term);
|
|
4351
4589
|
};
|
|
4352
4590
|
const scheduleSelection = (selector, term) => {
|
|
4353
|
-
|
|
4354
|
-
if (
|
|
4355
|
-
expanded = new Set();
|
|
4356
|
-
expandedSelections.set(selector, expanded);
|
|
4357
|
-
}
|
|
4358
|
-
if (expanded.has(term))
|
|
4591
|
+
const expanded = selector.expanded;
|
|
4592
|
+
if (expanded !== null && expanded.has(term))
|
|
4359
4593
|
return;
|
|
4360
|
-
expanded
|
|
4361
|
-
|
|
4594
|
+
selector.expanded = withTerm(expanded, term);
|
|
4595
|
+
pendingSelectors.push(selector);
|
|
4596
|
+
pendingSelections.push(term);
|
|
4362
4597
|
if (scaleDebug) {
|
|
4363
4598
|
scheduleCountBySource.set(selector.source, (scheduleCountBySource.get(selector.source) ?? 0) + 1);
|
|
4364
4599
|
reportScaleDebug();
|
|
@@ -4372,50 +4607,61 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
4372
4607
|
// One synthetic component per source holds the answer -- it carries the
|
|
4373
4608
|
// source's only null selector, and every other null-key selection on that
|
|
4374
4609
|
// source, an asker's or a containing value's, is a flow out of it.
|
|
4610
|
+
// Per source, its deep component for each mode, in a three-slot list.
|
|
4375
4611
|
const deepComponents = new Map();
|
|
4376
4612
|
const deepOf = (source, mode) => {
|
|
4377
4613
|
let modes = deepComponents.get(source);
|
|
4378
4614
|
if (!modes)
|
|
4379
|
-
deepComponents.set(source, (modes =
|
|
4380
|
-
const existing = modes
|
|
4615
|
+
deepComponents.set(source, (modes = [undefined, undefined, undefined]));
|
|
4616
|
+
const existing = modes[selectorModeSlot[mode]];
|
|
4381
4617
|
if (existing)
|
|
4382
4618
|
return existing;
|
|
4383
|
-
const deep = {
|
|
4619
|
+
const deep = { out: noMembers, terms: null };
|
|
4384
4620
|
components.push(deep);
|
|
4385
|
-
modes
|
|
4621
|
+
modes[selectorModeSlot[mode]] = deep;
|
|
4386
4622
|
addSelector(source, null, deep, mode);
|
|
4387
4623
|
return deep;
|
|
4388
4624
|
};
|
|
4625
|
+
const knownTargetsOf = (byKey, key, mode) => {
|
|
4626
|
+
let byMode = byKey.get(key);
|
|
4627
|
+
if (!byMode) {
|
|
4628
|
+
byMode = [undefined, undefined, undefined];
|
|
4629
|
+
byKey.set(key, byMode);
|
|
4630
|
+
}
|
|
4631
|
+
let knownTargets = byMode[selectorModeSlot[mode]];
|
|
4632
|
+
if (!knownTargets) {
|
|
4633
|
+
knownTargets = new SmallSet();
|
|
4634
|
+
byMode[selectorModeSlot[mode]] = knownTargets;
|
|
4635
|
+
}
|
|
4636
|
+
return knownTargets;
|
|
4637
|
+
};
|
|
4389
4638
|
const addSelector = (source, key, target, mode = 'own') => {
|
|
4390
|
-
if (key === null && deepComponents.get(source)?.
|
|
4639
|
+
if (key === null && deepComponents.get(source)?.[selectorModeSlot[mode]] !== target) {
|
|
4391
4640
|
addFlow(deepOf(source, mode), target);
|
|
4392
4641
|
return;
|
|
4393
4642
|
}
|
|
4643
|
+
const targets = selectorTargets.get(source);
|
|
4394
4644
|
let byKey = selectorTargetsByKey.get(source);
|
|
4395
|
-
if (
|
|
4645
|
+
if (byKey === undefined && targets !== undefined && targets.length >= SELECTOR_SCAN_LIMIT) {
|
|
4396
4646
|
byKey = new Map();
|
|
4647
|
+
for (const known of targets)
|
|
4648
|
+
knownTargetsOf(byKey, known.key, known.mode).add(known.target);
|
|
4397
4649
|
selectorTargetsByKey.set(source, byKey);
|
|
4398
4650
|
}
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
let knownTargets = byMode.get(mode);
|
|
4405
|
-
if (!knownTargets) {
|
|
4406
|
-
knownTargets = new Set();
|
|
4407
|
-
byMode.set(mode, knownTargets);
|
|
4651
|
+
if (byKey !== undefined) {
|
|
4652
|
+
const knownTargets = knownTargetsOf(byKey, key, mode);
|
|
4653
|
+
if (knownTargets.has(target))
|
|
4654
|
+
return;
|
|
4655
|
+
knownTargets.add(target);
|
|
4408
4656
|
}
|
|
4409
|
-
if (
|
|
4657
|
+
else if (targets?.some((known) => known.key === key && known.target === target && known.mode === mode))
|
|
4410
4658
|
return;
|
|
4411
|
-
|
|
4412
|
-
const selector = { source, key, target, mode };
|
|
4413
|
-
const targets = selectorTargets.get(source);
|
|
4659
|
+
const selector = { source, key, target, mode, expanded: null };
|
|
4414
4660
|
if (targets)
|
|
4415
4661
|
targets.push(selector);
|
|
4416
4662
|
else
|
|
4417
4663
|
selectorTargets.set(source, [selector]);
|
|
4418
|
-
for (const term of
|
|
4664
|
+
for (const term of source.terms ?? [])
|
|
4419
4665
|
scheduleSelection(selector, term);
|
|
4420
4666
|
};
|
|
4421
4667
|
const addLiteralSelection = (literal, key, target, mode = 'own') => {
|
|
@@ -4519,7 +4765,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
4519
4765
|
// trap a read forwards to the target, whose terms this proxy's node
|
|
4520
4766
|
// already carries.
|
|
4521
4767
|
for (const value of term.reads) {
|
|
4522
|
-
const source =
|
|
4768
|
+
const source = value.component;
|
|
4523
4769
|
if (!source)
|
|
4524
4770
|
throw new Error('global-host mutation proxy read was not condensed');
|
|
4525
4771
|
if (selector.key === null)
|
|
@@ -4532,7 +4778,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
4532
4778
|
if (term.kind === 'source-containment') {
|
|
4533
4779
|
if (selector.key === null) {
|
|
4534
4780
|
for (const value of selector.mode === 'copied-reachable' ? term.ownValues : term.values) {
|
|
4535
|
-
const source =
|
|
4781
|
+
const source = value.component;
|
|
4536
4782
|
if (!source)
|
|
4537
4783
|
throw new Error('global-host mutation source containment was not condensed');
|
|
4538
4784
|
addSelector(source, null, target, childModeOf(selector.mode));
|
|
@@ -4622,7 +4868,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
4622
4868
|
else if (term.kind === 'storage')
|
|
4623
4869
|
addStorageSelection(term.declaration, selector.key, target, selector.mode);
|
|
4624
4870
|
else {
|
|
4625
|
-
const source =
|
|
4871
|
+
const source = term.source.component;
|
|
4626
4872
|
if (!source)
|
|
4627
4873
|
throw new Error('global-host mutation rest source was not condensed');
|
|
4628
4874
|
if (selector.key === null)
|
|
@@ -4643,7 +4889,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
4643
4889
|
// selector is the terminating answer: it matches EVERY key, so it
|
|
4644
4890
|
// over-approximates the enumeration it replaces rather than dropping
|
|
4645
4891
|
// any of it.
|
|
4646
|
-
if (term.rest.offset > 0 &&
|
|
4892
|
+
if (term.rest.offset > 0 && source.terms?.has(term))
|
|
4647
4893
|
addSelector(source, null, target, selector.mode);
|
|
4648
4894
|
else
|
|
4649
4895
|
addSelector(source, String(index + term.rest.offset), target, selector.mode);
|
|
@@ -4654,19 +4900,21 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
4654
4900
|
// The worklists only ever grow; entries behind the read index are dead.
|
|
4655
4901
|
// Dropping them once they outnumber the live tail keeps each array within
|
|
4656
4902
|
// V8's element limit at amortized constant cost.
|
|
4657
|
-
const compact = (
|
|
4658
|
-
if (index < 1 << 20 || index * 2 <
|
|
4903
|
+
const compact = (first, second, index) => {
|
|
4904
|
+
if (index < 1 << 20 || index * 2 < first.length)
|
|
4659
4905
|
return index;
|
|
4660
|
-
|
|
4906
|
+
first.splice(0, index);
|
|
4907
|
+
second.splice(0, index);
|
|
4661
4908
|
return 0;
|
|
4662
4909
|
};
|
|
4663
4910
|
const solve = () => {
|
|
4664
4911
|
while (pendingIndex < pendingTerms.length || pendingSelectionIndex < pendingSelections.length) {
|
|
4665
|
-
pendingIndex = compact(pendingTerms, pendingIndex);
|
|
4666
|
-
pendingSelectionIndex = compact(pendingSelections, pendingSelectionIndex);
|
|
4912
|
+
pendingIndex = compact(pendingTermComponents, pendingTerms, pendingIndex);
|
|
4913
|
+
pendingSelectionIndex = compact(pendingSelectors, pendingSelections, pendingSelectionIndex);
|
|
4667
4914
|
if (pendingIndex < pendingTerms.length) {
|
|
4668
|
-
const
|
|
4669
|
-
|
|
4915
|
+
const component = pendingTermComponents[pendingIndex];
|
|
4916
|
+
const term = pendingTerms[pendingIndex++];
|
|
4917
|
+
if (!(component.terms?.has(term) ?? false))
|
|
4670
4918
|
continue;
|
|
4671
4919
|
for (const target of component.out)
|
|
4672
4920
|
addTerm(target, term);
|
|
@@ -4676,20 +4924,45 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
4676
4924
|
scheduleSelection(selector, term);
|
|
4677
4925
|
continue;
|
|
4678
4926
|
}
|
|
4679
|
-
const
|
|
4927
|
+
const selector = pendingSelectors[pendingSelectionIndex];
|
|
4928
|
+
const term = pendingSelections[pendingSelectionIndex++];
|
|
4680
4929
|
expandSelector(selector, term);
|
|
4681
4930
|
}
|
|
4931
|
+
// Every entry is behind its read index now. The census's answers outlive
|
|
4932
|
+
// the solve through the closures this function returns, and so would two
|
|
4933
|
+
// queues of nothing but spent entries -- most of a million on a large
|
|
4934
|
+
// program.
|
|
4935
|
+
pendingTermComponents.length = 0;
|
|
4936
|
+
pendingTerms.length = 0;
|
|
4937
|
+
pendingIndex = 0;
|
|
4938
|
+
pendingSelectors.length = 0;
|
|
4939
|
+
pendingSelections.length = 0;
|
|
4940
|
+
pendingSelectionIndex = 0;
|
|
4682
4941
|
};
|
|
4683
4942
|
assertGraphFrozen();
|
|
4684
4943
|
for (const selector of selectors)
|
|
4685
|
-
addSelector(
|
|
4944
|
+
addSelector(selector.source.component, selector.key, selector.target.component, selector.mode);
|
|
4945
|
+
selectors.length = 0;
|
|
4686
4946
|
for (const node of allValueNodes) {
|
|
4687
|
-
const component =
|
|
4947
|
+
const component = node.component;
|
|
4688
4948
|
for (const seed of node.seeds)
|
|
4689
4949
|
addTerm(component, seed);
|
|
4950
|
+
node.seeds = noMembers;
|
|
4690
4951
|
}
|
|
4952
|
+
// Every node is seeded and reached through its expression's entry from
|
|
4953
|
+
// here; the list is kept only as the frozen graph's size, which a node
|
|
4954
|
+
// minted now would still change.
|
|
4955
|
+
allValueNodes.length = 0;
|
|
4956
|
+
graphNodeCount = 0;
|
|
4691
4957
|
solve();
|
|
4692
4958
|
const factsByComponent = new Map();
|
|
4959
|
+
// Nearly every component reaches no intrinsic object, and its facts are
|
|
4960
|
+
// then one of eight flag combinations: they are shared, with one shared
|
|
4961
|
+
// empty prototype set, instead of an object and a `Set` per component.
|
|
4962
|
+
const noPrototypes = new Set();
|
|
4963
|
+
const plainFacts = [];
|
|
4964
|
+
for (let flags = 0; flags < 8; flags++)
|
|
4965
|
+
plainFacts.push({ global: (flags & 1) !== 0, opaque: (flags & 2) !== 0, represented: (flags & 4) !== 0, prototypes: noPrototypes });
|
|
4693
4966
|
// The contains census -- a null-key selection through every member an
|
|
4694
4967
|
// argument can reach -- answers one question, asked once below at
|
|
4695
4968
|
// `global contained in unknown call argument`: for a call whose callee this
|
|
@@ -4707,32 +4980,42 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
4707
4980
|
continue;
|
|
4708
4981
|
for (const argument of node.arguments) {
|
|
4709
4982
|
const current = unwrapErasedExpression(argument);
|
|
4710
|
-
const target =
|
|
4983
|
+
const target = containsRequestComponents.get(current);
|
|
4711
4984
|
if (!target)
|
|
4712
4985
|
throw new Error(`global-host contains census has no request for ${ts.SyntaxKind[current.kind]}`);
|
|
4713
4986
|
containsCensused.add(current);
|
|
4714
|
-
addSelector(componentOfExpression(current), null,
|
|
4987
|
+
addSelector(componentOfExpression(current), null, target, 'reachable');
|
|
4715
4988
|
}
|
|
4716
4989
|
}
|
|
4717
4990
|
solve();
|
|
4718
4991
|
assertGraphFrozen();
|
|
4992
|
+
// The census is closed: nothing adds a selector or a flow after this, so
|
|
4993
|
+
// the solver's own indexes and the copy graph's edges are spent. Only the
|
|
4994
|
+
// terms are read again, through the node-to-component map.
|
|
4995
|
+
selectorTargets.clear();
|
|
4996
|
+
selectorTargetsByKey.clear();
|
|
4997
|
+
dynamicOut.clear();
|
|
4998
|
+
for (const component of components)
|
|
4999
|
+
component.out = noMembers;
|
|
4719
5000
|
for (const component of components) {
|
|
4720
5001
|
let global = false;
|
|
4721
5002
|
let opaque = false;
|
|
4722
5003
|
let represented = false;
|
|
4723
|
-
|
|
4724
|
-
for (const term of
|
|
5004
|
+
let prototypes = null;
|
|
5005
|
+
for (const term of component.terms ?? []) {
|
|
4725
5006
|
opaque ||= term.kind === 'OPAQUE_UNKNOWN';
|
|
4726
5007
|
global ||= term.kind === 'GLOBAL_TRUE';
|
|
4727
5008
|
represented ||= term.kind === 'REPRESENTED_NON_GLOBAL';
|
|
4728
5009
|
if (term.kind === 'INTRINSIC_OBJECT')
|
|
4729
|
-
prototypes.add(term.declaration);
|
|
5010
|
+
(prototypes ??= new Set()).add(term.declaration);
|
|
4730
5011
|
}
|
|
4731
|
-
factsByComponent.set(component,
|
|
5012
|
+
factsByComponent.set(component, prototypes === null
|
|
5013
|
+
? plainFacts[(global ? 1 : 0) | (opaque ? 2 : 0) | (represented ? 4 : 0)]
|
|
5014
|
+
: { global, opaque, represented, prototypes });
|
|
4732
5015
|
}
|
|
4733
5016
|
};
|
|
4734
5017
|
// `finishCensus` (below) sets `factsByComponent` for every member of
|
|
4735
|
-
// `components`, and `componentOfExpression`/`
|
|
5018
|
+
// `components`, and `componentOfExpression`/`node.component` can only ever
|
|
4736
5019
|
// hand back a component that is a member of `components` -- both already
|
|
4737
5020
|
// throw rather than return an unknown component. A missing entry here is
|
|
4738
5021
|
// therefore not a value this census failed to reach; it is `aliasFacts` or
|
|
@@ -4745,7 +5028,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
4745
5028
|
const component = componentOfExpression(expression);
|
|
4746
5029
|
const facts = factsByComponent.get(component);
|
|
4747
5030
|
if (!facts)
|
|
4748
|
-
throw new Error(`global-host mutation graph has no alias facts for component ${component
|
|
5031
|
+
throw new Error(`global-host mutation graph has no alias facts for component ${components.indexOf(component)}`);
|
|
4749
5032
|
return facts;
|
|
4750
5033
|
};
|
|
4751
5034
|
/**
|
|
@@ -5107,14 +5390,13 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
5107
5390
|
/** Does this value, including concrete object/array fields, retain or obscure the global object? */
|
|
5108
5391
|
const containsGlobal = (expression) => {
|
|
5109
5392
|
const current = unwrapErasedExpression(expression);
|
|
5110
|
-
const
|
|
5111
|
-
if (!
|
|
5393
|
+
const component = containsRequestComponents.get(current);
|
|
5394
|
+
if (!component || !containsCensused.has(current)) {
|
|
5112
5395
|
throw new Error(`global-host contains census was not filed for ${ts.SyntaxKind[current.kind]}`);
|
|
5113
5396
|
}
|
|
5114
|
-
const component = componentOf.get(target);
|
|
5115
5397
|
const facts = factsByComponent.get(component);
|
|
5116
5398
|
if (!facts)
|
|
5117
|
-
throw new Error(`global-host mutation graph has no alias facts for component ${component
|
|
5399
|
+
throw new Error(`global-host mutation graph has no alias facts for component ${components.indexOf(component)}`);
|
|
5118
5400
|
if (facts.global)
|
|
5119
5401
|
return true;
|
|
5120
5402
|
if (!facts.opaque || publishedRepresentationOf(current) !== null)
|
|
@@ -5214,11 +5496,11 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
5214
5496
|
if (cached)
|
|
5215
5497
|
return cached;
|
|
5216
5498
|
const keys = new Set();
|
|
5217
|
-
const pending = [...(
|
|
5499
|
+
const pending = [...(root.terms ?? [])];
|
|
5218
5500
|
const seen = new Set();
|
|
5219
5501
|
let unknown = false;
|
|
5220
5502
|
const addExpression = (value) => {
|
|
5221
|
-
for (const term of
|
|
5503
|
+
for (const term of componentOfExpression(value).terms ?? [])
|
|
5222
5504
|
pending.push(term);
|
|
5223
5505
|
};
|
|
5224
5506
|
while (pending.length > 0) {
|
|
@@ -5829,7 +6111,7 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
5829
6111
|
// `const { initialize } = optional`, where `optional` only ever holds the
|
|
5830
6112
|
// program's own `{ kModuleError }` stub for a types-only peer package.
|
|
5831
6113
|
// A source the alias graph never modelled proves nothing either way.
|
|
5832
|
-
const receiver =
|
|
6114
|
+
const receiver = componentByExpression.has(unwrapErasedExpression(source)) ? aliasFacts(source) : null;
|
|
5833
6115
|
if (receiver && !receiver.opaque && !receiver.global && !receiver.represented && receiver.prototypes.size === 0)
|
|
5834
6116
|
return null;
|
|
5835
6117
|
const name = element.propertyName ?? element.name;
|
|
@@ -6632,8 +6914,8 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
6632
6914
|
const scalarParameters = hostNativeScalarParametersOf(node);
|
|
6633
6915
|
for (const [position, argument] of node.arguments.entries()) {
|
|
6634
6916
|
const current = unwrapErasedExpression(argument);
|
|
6635
|
-
const target =
|
|
6636
|
-
const component = target ? factsByComponent.get(
|
|
6917
|
+
const target = containsRequestComponents.get(current);
|
|
6918
|
+
const component = target ? factsByComponent.get(target) : undefined;
|
|
6637
6919
|
// A scalar host parameter reaches what its primitive reaches, and
|
|
6638
6920
|
// nothing else of the cell's component (`hostNativeScalarParametersOf`).
|
|
6639
6921
|
const scalar = scalarParameters.get(position);
|