@geastack/compiler 1.0.15
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/LICENSE +202 -0
- package/README.md +149 -0
- package/dist/cli-analyze.d.ts +1 -0
- package/dist/cli-analyze.js +61 -0
- package/dist/cli-coverage.d.ts +1 -0
- package/dist/cli-coverage.js +329 -0
- package/dist/cli-emit.d.ts +10 -0
- package/dist/cli-emit.js +398 -0
- package/dist/cli-module-graph.d.ts +18 -0
- package/dist/cli-module-graph.js +123 -0
- package/dist/cli-package-source.d.ts +5 -0
- package/dist/cli-package-source.js +116 -0
- package/dist/cli-project.d.ts +2 -0
- package/dist/cli-project.js +60 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +199 -0
- package/dist/compiler.d.ts +228 -0
- package/dist/compiler.js +1029 -0
- package/dist/conversion/algebra.d.ts +218 -0
- package/dist/conversion/algebra.js +155 -0
- package/dist/conversion/build.d.ts +67 -0
- package/dist/conversion/build.js +1378 -0
- package/dist/conversion/derive.d.ts +37 -0
- package/dist/conversion/derive.js +260 -0
- package/dist/conversion/graph-validation.d.ts +8 -0
- package/dist/conversion/graph-validation.js +97 -0
- package/dist/conversion/native-callable-adapter.d.ts +13 -0
- package/dist/conversion/native-callable-adapter.js +53 -0
- package/dist/conversion/native-class-reference.d.ts +12 -0
- package/dist/conversion/native-class-reference.js +39 -0
- package/dist/conversion/native-payload-transport.d.ts +25 -0
- package/dist/conversion/native-payload-transport.js +33 -0
- package/dist/conversion/native-selection.d.ts +49 -0
- package/dist/conversion/native-selection.js +135 -0
- package/dist/conversion/native-sum.d.ts +42 -0
- package/dist/conversion/native-sum.js +115 -0
- package/dist/conversion/nodes.d.ts +55 -0
- package/dist/conversion/nodes.js +91 -0
- package/dist/conversion/operand-view.d.ts +14 -0
- package/dist/conversion/operand-view.js +20 -0
- package/dist/conversion/record-view.d.ts +157 -0
- package/dist/conversion/record-view.js +273 -0
- package/dist/conversion/registry.d.ts +217 -0
- package/dist/conversion/registry.js +1 -0
- package/dist/diagnostics/model.d.ts +76 -0
- package/dist/diagnostics/model.js +60 -0
- package/dist/diagnostics/sweep.d.ts +31 -0
- package/dist/diagnostics/sweep.js +112 -0
- package/dist/identity/ids.d.ts +179 -0
- package/dist/identity/ids.js +212 -0
- package/dist/ir/absent-class-arm.d.ts +48 -0
- package/dist/ir/absent-class-arm.js +157 -0
- package/dist/ir/borrow-effects.d.ts +23 -0
- package/dist/ir/borrow-effects.js +151 -0
- package/dist/ir/borrowed-call-arguments.d.ts +40 -0
- package/dist/ir/borrowed-call-arguments.js +117 -0
- package/dist/ir/build.d.ts +168 -0
- package/dist/ir/build.js +459 -0
- package/dist/ir/call-dispatch.d.ts +38 -0
- package/dist/ir/call-dispatch.js +502 -0
- package/dist/ir/call-entry.d.ts +142 -0
- package/dist/ir/call-entry.js +386 -0
- package/dist/ir/callable-class-flow.d.ts +27 -0
- package/dist/ir/callable-class-flow.js +1386 -0
- package/dist/ir/callable-field-slots.d.ts +22 -0
- package/dist/ir/callable-field-slots.js +166 -0
- package/dist/ir/callable-identity-demand.d.ts +52 -0
- package/dist/ir/callable-identity-demand.js +460 -0
- package/dist/ir/callable-member-candidates.d.ts +9 -0
- package/dist/ir/callable-member-candidates.js +39 -0
- package/dist/ir/callable-records.d.ts +21 -0
- package/dist/ir/callable-records.js +411 -0
- package/dist/ir/captures.d.ts +26 -0
- package/dist/ir/captures.js +335 -0
- package/dist/ir/certificate.d.ts +45 -0
- package/dist/ir/certificate.js +47 -0
- package/dist/ir/certify/carrier-keys.d.ts +73 -0
- package/dist/ir/certify/carrier-keys.js +221 -0
- package/dist/ir/certify/function-source.d.ts +4 -0
- package/dist/ir/certify/function-source.js +28 -0
- package/dist/ir/certify/has-property-key.d.ts +88 -0
- package/dist/ir/certify/has-property-key.js +116 -0
- package/dist/ir/certify/instanceof-key.d.ts +24 -0
- package/dist/ir/certify/instanceof-key.js +35 -0
- package/dist/ir/certify/property-access-keys.d.ts +172 -0
- package/dist/ir/certify/property-access-keys.js +291 -0
- package/dist/ir/certify/property-access.d.ts +3 -0
- package/dist/ir/certify/property-access.js +597 -0
- package/dist/ir/certify/runtime-helper.d.ts +3 -0
- package/dist/ir/certify/runtime-helper.js +326 -0
- package/dist/ir/certify/typeof-operand.d.ts +14 -0
- package/dist/ir/certify/typeof-operand.js +16 -0
- package/dist/ir/certify.d.ts +123 -0
- package/dist/ir/certify.js +481 -0
- package/dist/ir/class-evaluation.d.ts +26 -0
- package/dist/ir/class-evaluation.js +50 -0
- package/dist/ir/class-static-fields.d.ts +60 -0
- package/dist/ir/class-static-fields.js +108 -0
- package/dist/ir/construct-entry.d.ts +26 -0
- package/dist/ir/construct-entry.js +117 -0
- package/dist/ir/dead-values.d.ts +90 -0
- package/dist/ir/dead-values.js +184 -0
- package/dist/ir/deferral.d.ts +99 -0
- package/dist/ir/deferral.js +409 -0
- package/dist/ir/dense-loops.d.ts +230 -0
- package/dist/ir/dense-loops.js +697 -0
- package/dist/ir/dominance.d.ts +82 -0
- package/dist/ir/dominance.js +268 -0
- package/dist/ir/emission-representations.d.ts +71 -0
- package/dist/ir/emission-representations.js +350 -0
- package/dist/ir/facts.d.ts +218 -0
- package/dist/ir/facts.js +181 -0
- package/dist/ir/fixed-data-definition.d.ts +19 -0
- package/dist/ir/fixed-data-definition.js +49 -0
- package/dist/ir/generator-split.d.ts +38 -0
- package/dist/ir/generator-split.js +329 -0
- package/dist/ir/hoist.d.ts +55 -0
- package/dist/ir/hoist.js +375 -0
- package/dist/ir/instantiation.d.ts +61 -0
- package/dist/ir/instantiation.js +137 -0
- package/dist/ir/integer-storage.d.ts +170 -0
- package/dist/ir/integer-storage.js +822 -0
- package/dist/ir/integers.d.ts +161 -0
- package/dist/ir/integers.js +539 -0
- package/dist/ir/integrity-restrictions.d.ts +50 -0
- package/dist/ir/integrity-restrictions.js +118 -0
- package/dist/ir/local-iterators.d.ts +4 -0
- package/dist/ir/local-iterators.js +27 -0
- package/dist/ir/lower-allocation.d.ts +4 -0
- package/dist/ir/lower-allocation.js +325 -0
- package/dist/ir/lower-completion.d.ts +15 -0
- package/dist/ir/lower-completion.js +25 -0
- package/dist/ir/lower-destructuring.d.ts +5 -0
- package/dist/ir/lower-destructuring.js +693 -0
- package/dist/ir/lower-element.d.ts +29 -0
- package/dist/ir/lower-element.js +111 -0
- package/dist/ir/lower-exceptions.d.ts +47 -0
- package/dist/ir/lower-exceptions.js +92 -0
- package/dist/ir/lower-flow.d.ts +137 -0
- package/dist/ir/lower-flow.js +600 -0
- package/dist/ir/lower-graph.d.ts +218 -0
- package/dist/ir/lower-graph.js +687 -0
- package/dist/ir/lower-invocation.d.ts +4 -0
- package/dist/ir/lower-invocation.js +514 -0
- package/dist/ir/lower-narrow.d.ts +53 -0
- package/dist/ir/lower-narrow.js +320 -0
- package/dist/ir/lower-operands.d.ts +272 -0
- package/dist/ir/lower-operands.js +461 -0
- package/dist/ir/lower-property.d.ts +21 -0
- package/dist/ir/lower-property.js +132 -0
- package/dist/ir/lower-protocol.d.ts +11 -0
- package/dist/ir/lower-protocol.js +118 -0
- package/dist/ir/lower-short-circuit.d.ts +41 -0
- package/dist/ir/lower-short-circuit.js +63 -0
- package/dist/ir/lower.d.ts +82 -0
- package/dist/ir/lower.js +1346 -0
- package/dist/ir/model.d.ts +1474 -0
- package/dist/ir/model.js +6 -0
- package/dist/ir/native-absent-property.d.ts +3 -0
- package/dist/ir/native-absent-property.js +13 -0
- package/dist/ir/native-array-transport.d.ts +7 -0
- package/dist/ir/native-array-transport.js +46 -0
- package/dist/ir/native-callable-bind.d.ts +9 -0
- package/dist/ir/native-callable-bind.js +30 -0
- package/dist/ir/native-carrier-predicate.d.ts +34 -0
- package/dist/ir/native-carrier-predicate.js +49 -0
- package/dist/ir/native-class-accessor.d.ts +18 -0
- package/dist/ir/native-class-accessor.js +52 -0
- package/dist/ir/native-class-construction.d.ts +16 -0
- package/dist/ir/native-class-construction.js +71 -0
- package/dist/ir/native-class-initialization.d.ts +15 -0
- package/dist/ir/native-class-initialization.js +56 -0
- package/dist/ir/native-class-origins.d.ts +13 -0
- package/dist/ir/native-class-origins.js +237 -0
- package/dist/ir/native-dictionary-transport.d.ts +6 -0
- package/dist/ir/native-dictionary-transport.js +37 -0
- package/dist/ir/native-enumeration.d.ts +14 -0
- package/dist/ir/native-enumeration.js +26 -0
- package/dist/ir/native-equality.d.ts +10 -0
- package/dist/ir/native-equality.js +18 -0
- package/dist/ir/native-field-owner.d.ts +37 -0
- package/dist/ir/native-field-owner.js +183 -0
- package/dist/ir/native-fixed-layout.d.ts +41 -0
- package/dist/ir/native-fixed-layout.js +232 -0
- package/dist/ir/native-host-construction.d.ts +53 -0
- package/dist/ir/native-host-construction.js +62 -0
- package/dist/ir/native-key-query.d.ts +4 -0
- package/dist/ir/native-key-query.js +38 -0
- package/dist/ir/native-merge-transport.d.ts +25 -0
- package/dist/ir/native-merge-transport.js +71 -0
- package/dist/ir/native-record-index-transport.d.ts +11 -0
- package/dist/ir/native-record-index-transport.js +34 -0
- package/dist/ir/native-record-index.d.ts +12 -0
- package/dist/ir/native-record-index.js +27 -0
- package/dist/ir/native-reflect-field.d.ts +5 -0
- package/dist/ir/native-reflect-field.js +33 -0
- package/dist/ir/native-sequence-transport.d.ts +7 -0
- package/dist/ir/native-sequence-transport.js +53 -0
- package/dist/ir/numeric-intrinsics.d.ts +13 -0
- package/dist/ir/numeric-intrinsics.js +57 -0
- package/dist/ir/object-value-conversions.d.ts +20 -0
- package/dist/ir/object-value-conversions.js +50 -0
- package/dist/ir/physical-class-reflection.d.ts +9 -0
- package/dist/ir/physical-class-reflection.js +57 -0
- package/dist/ir/presence-proof.d.ts +42 -0
- package/dist/ir/presence-proof.js +490 -0
- package/dist/ir/program-facts.d.ts +106 -0
- package/dist/ir/program-facts.js +319 -0
- package/dist/ir/proven-branches.d.ts +16 -0
- package/dist/ir/proven-branches.js +219 -0
- package/dist/ir/queries.d.ts +41 -0
- package/dist/ir/queries.js +213 -0
- package/dist/ir/reflection-demand.d.ts +64 -0
- package/dist/ir/reflection-demand.js +1394 -0
- package/dist/ir/refusal.d.ts +43 -0
- package/dist/ir/refusal.js +28 -0
- package/dist/ir/shake.d.ts +37 -0
- package/dist/ir/shake.js +1078 -0
- package/dist/ir/static-callables.d.ts +11 -0
- package/dist/ir/static-callables.js +163 -0
- package/dist/ir/string-layout-reuse.d.ts +13 -0
- package/dist/ir/string-layout-reuse.js +39 -0
- package/dist/ir/string-length-reuse.d.ts +8 -0
- package/dist/ir/string-length-reuse.js +47 -0
- package/dist/ir/transfer.d.ts +78 -0
- package/dist/ir/transfer.js +270 -0
- package/dist/ir/type-query-results.d.ts +25 -0
- package/dist/ir/type-query-results.js +96 -0
- package/dist/ir/typed-property-access.d.ts +100 -0
- package/dist/ir/typed-property-access.js +161 -0
- package/dist/ir/verify.d.ts +19 -0
- package/dist/ir/verify.js +355 -0
- package/dist/plugins/apple/constructors.d.ts +112 -0
- package/dist/plugins/apple/constructors.js +217 -0
- package/dist/plugins/apple/host.d.ts +181 -0
- package/dist/plugins/apple/host.js +262 -0
- package/dist/plugins/apple/jsx.d.ts +2 -0
- package/dist/plugins/apple/jsx.js +293 -0
- package/dist/plugins/apple/members.d.ts +16 -0
- package/dist/plugins/apple/members.js +190 -0
- package/dist/plugins/apple/plugin.d.ts +2 -0
- package/dist/plugins/apple/plugin.js +156 -0
- package/dist/plugins/gea/component-classes.d.ts +25 -0
- package/dist/plugins/gea/component-classes.js +162 -0
- package/dist/plugins/gea/component-inline.d.ts +13 -0
- package/dist/plugins/gea/component-inline.js +532 -0
- package/dist/plugins/gea/constructors.d.ts +23 -0
- package/dist/plugins/gea/constructors.js +100 -0
- package/dist/plugins/gea/contract.d.ts +150 -0
- package/dist/plugins/gea/contract.js +195 -0
- package/dist/plugins/gea/element-ref.d.ts +31 -0
- package/dist/plugins/gea/element-ref.js +45 -0
- package/dist/plugins/gea/host.d.ts +520 -0
- package/dist/plugins/gea/host.js +762 -0
- package/dist/plugins/gea/lower.d.ts +6 -0
- package/dist/plugins/gea/lower.js +195 -0
- package/dist/plugins/gea/members.d.ts +22 -0
- package/dist/plugins/gea/members.js +221 -0
- package/dist/plugins/gea/plugin.d.ts +22 -0
- package/dist/plugins/gea/plugin.js +307 -0
- package/dist/plugins/gea/prelude.d.ts +78 -0
- package/dist/plugins/gea/prelude.js +153 -0
- package/dist/plugins/gea/producer.d.ts +5 -0
- package/dist/plugins/gea/producer.js +52 -0
- package/dist/plugins/gea/reactive-slots.d.ts +49 -0
- package/dist/plugins/gea/reactive-slots.js +578 -0
- package/dist/plugins/gea/render-bridge.d.ts +6 -0
- package/dist/plugins/gea/render-bridge.js +281 -0
- package/dist/plugins/gea/slots.d.ts +15 -0
- package/dist/plugins/gea/slots.js +36 -0
- package/dist/plugins/gea/template-analysis.d.ts +151 -0
- package/dist/plugins/gea/template-analysis.js +346 -0
- package/dist/plugins/gea/user-agent-styles.d.ts +9 -0
- package/dist/plugins/gea/user-agent-styles.js +94 -0
- package/dist/plugins/installed.d.ts +19 -0
- package/dist/plugins/installed.js +21 -0
- package/dist/plugins/load.d.ts +7 -0
- package/dist/plugins/load.js +207 -0
- package/dist/plugins/model.d.ts +735 -0
- package/dist/plugins/model.js +47 -0
- package/dist/plugins/webgl/host.d.ts +77 -0
- package/dist/plugins/webgl/host.js +162 -0
- package/dist/plugins/webgl/plugin.d.ts +40 -0
- package/dist/plugins/webgl/plugin.js +99 -0
- package/dist/preflight/obligations.d.ts +206 -0
- package/dist/preflight/obligations.js +36 -0
- package/dist/preflight/report.d.ts +20 -0
- package/dist/preflight/report.js +61 -0
- package/dist/preflight/run.d.ts +39 -0
- package/dist/preflight/run.js +403 -0
- package/dist/project-preparation.d.ts +33 -0
- package/dist/project-preparation.js +314 -0
- package/dist/projection/abi.d.ts +82 -0
- package/dist/projection/abi.js +349 -0
- package/dist/projection/apply-arguments.d.ts +12 -0
- package/dist/projection/apply-arguments.js +20 -0
- package/dist/projection/bindings.d.ts +250 -0
- package/dist/projection/bindings.js +340 -0
- package/dist/projection/callee.d.ts +196 -0
- package/dist/projection/callee.js +444 -0
- package/dist/projection/class-property-presence.d.ts +28 -0
- package/dist/projection/class-property-presence.js +58 -0
- package/dist/projection/class-prototype.d.ts +5 -0
- package/dist/projection/class-prototype.js +23 -0
- package/dist/projection/class-storage.d.ts +26 -0
- package/dist/projection/class-storage.js +236 -0
- package/dist/projection/classes.d.ts +283 -0
- package/dist/projection/classes.js +944 -0
- package/dist/projection/coercions.d.ts +20 -0
- package/dist/projection/coercions.js +33 -0
- package/dist/projection/dispatch.d.ts +167 -0
- package/dist/projection/dispatch.js +379 -0
- package/dist/projection/fields.d.ts +123 -0
- package/dist/projection/fields.js +383 -0
- package/dist/projection/instance-test.d.ts +78 -0
- package/dist/projection/instance-test.js +156 -0
- package/dist/projection/slots.d.ts +146 -0
- package/dist/projection/slots.js +663 -0
- package/dist/projection/synthesized-abi.d.ts +61 -0
- package/dist/projection/synthesized-abi.js +94 -0
- package/dist/representation/array-index.d.ts +14 -0
- package/dist/representation/array-index.js +17 -0
- package/dist/representation/callable-object.d.ts +3 -0
- package/dist/representation/callable-object.js +6 -0
- package/dist/representation/collections.d.ts +84 -0
- package/dist/representation/collections.js +139 -0
- package/dist/representation/derive.d.ts +159 -0
- package/dist/representation/derive.js +2546 -0
- package/dist/representation/difference.d.ts +30 -0
- package/dist/representation/difference.js +240 -0
- package/dist/representation/field-descriptor-policy.d.ts +19 -0
- package/dist/representation/field-descriptor-policy.js +39 -0
- package/dist/representation/function-constructor.d.ts +13 -0
- package/dist/representation/function-constructor.js +9 -0
- package/dist/representation/host-abi.d.ts +32 -0
- package/dist/representation/host-abi.js +97 -0
- package/dist/representation/host-templates.d.ts +67 -0
- package/dist/representation/host-templates.js +94 -0
- package/dist/representation/intersection.d.ts +84 -0
- package/dist/representation/intersection.js +149 -0
- package/dist/representation/literal-destination.d.ts +43 -0
- package/dist/representation/literal-destination.js +133 -0
- package/dist/representation/merge.d.ts +18 -0
- package/dist/representation/merge.js +83 -0
- package/dist/representation/model.d.ts +1160 -0
- package/dist/representation/model.js +1019 -0
- package/dist/representation/numeric-index.d.ts +13 -0
- package/dist/representation/numeric-index.js +29 -0
- package/dist/representation/object-shape.d.ts +109 -0
- package/dist/representation/object-shape.js +123 -0
- package/dist/representation/optional.d.ts +12 -0
- package/dist/representation/optional.js +87 -0
- package/dist/representation/plan.d.ts +60 -0
- package/dist/representation/plan.js +78 -0
- package/dist/representation/policies.d.ts +589 -0
- package/dist/representation/policies.js +107 -0
- package/dist/representation/primitive-domain.d.ts +1 -0
- package/dist/representation/primitive-domain.js +1 -0
- package/dist/representation/primitives.d.ts +44 -0
- package/dist/representation/primitives.js +78 -0
- package/dist/representation/publish.d.ts +49 -0
- package/dist/representation/publish.js +648 -0
- package/dist/representation/record-fields.d.ts +96 -0
- package/dist/representation/record-fields.js +116 -0
- package/dist/representation/template-object.d.ts +11 -0
- package/dist/representation/template-object.js +26 -0
- package/dist/representation/union.d.ts +30 -0
- package/dist/representation/union.js +324 -0
- package/dist/representation/value-records.d.ts +3 -0
- package/dist/representation/value-records.js +307 -0
- package/dist/representation/verify.d.ts +17 -0
- package/dist/representation/verify.js +221 -0
- package/dist/semantics/alias-this-field-declaration-transform.d.ts +4 -0
- package/dist/semantics/alias-this-field-declaration-transform.js +207 -0
- package/dist/semantics/ambient-type-realization-transform.d.ts +62 -0
- package/dist/semantics/ambient-type-realization-transform.js +168 -0
- package/dist/semantics/ambient.d.ts +24 -0
- package/dist/semantics/ambient.js +119 -0
- package/dist/semantics/borrowed-builtin-call-bind-source-transform.d.ts +4 -0
- package/dist/semantics/borrowed-builtin-call-bind-source-transform.js +341 -0
- package/dist/semantics/callable-origins.d.ts +46 -0
- package/dist/semantics/callable-origins.js +354 -0
- package/dist/semantics/class-alias.d.ts +7 -0
- package/dist/semantics/class-alias.js +37 -0
- package/dist/semantics/class-heritage.d.ts +34 -0
- package/dist/semantics/class-heritage.js +104 -0
- package/dist/semantics/commonjs-wrapper.d.ts +69 -0
- package/dist/semantics/commonjs-wrapper.js +231 -0
- package/dist/semantics/constructor-slot-subclasses.d.ts +28 -0
- package/dist/semantics/constructor-slot-subclasses.js +112 -0
- package/dist/semantics/declaration-overlay-transform.d.ts +35 -0
- package/dist/semantics/declaration-overlay-transform.js +2157 -0
- package/dist/semantics/define-property-source-transform.d.ts +4 -0
- package/dist/semantics/define-property-source-transform.js +437 -0
- package/dist/semantics/diagnostic-source-preparation.d.ts +24 -0
- package/dist/semantics/diagnostic-source-preparation.js +82 -0
- package/dist/semantics/documentation-ranges.d.ts +22 -0
- package/dist/semantics/documentation-ranges.js +36 -0
- package/dist/semantics/dynamic-fallback.d.ts +86 -0
- package/dist/semantics/dynamic-fallback.js +249 -0
- package/dist/semantics/frontend-timing.d.ts +6 -0
- package/dist/semantics/frontend-timing.js +35 -0
- package/dist/semantics/frontend.d.ts +504 -0
- package/dist/semantics/frontend.js +1157 -0
- package/dist/semantics/host-declaration-provenance.d.ts +11 -0
- package/dist/semantics/host-declaration-provenance.js +18 -0
- package/dist/semantics/host-methods.d.ts +24 -0
- package/dist/semantics/host-methods.js +74 -0
- package/dist/semantics/host-protocols.d.ts +429 -0
- package/dist/semantics/host-protocols.js +1501 -0
- package/dist/semantics/inherited-accessor.d.ts +7 -0
- package/dist/semantics/inherited-accessor.js +48 -0
- package/dist/semantics/interface-families.d.ts +70 -0
- package/dist/semantics/interface-families.js +180 -0
- package/dist/semantics/interface-implementors.d.ts +53 -0
- package/dist/semantics/interface-implementors.js +87 -0
- package/dist/semantics/jsdoc-namepath-transform.d.ts +4 -0
- package/dist/semantics/jsdoc-namepath-transform.js +85 -0
- package/dist/semantics/model/coverage.d.ts +68 -0
- package/dist/semantics/model/coverage.js +73 -0
- package/dist/semantics/model/edges.d.ts +103 -0
- package/dist/semantics/model/edges.js +20 -0
- package/dist/semantics/model/graph.d.ts +55 -0
- package/dist/semantics/model/graph.js +129 -0
- package/dist/semantics/model/operands.d.ts +159 -0
- package/dist/semantics/model/operands.js +26 -0
- package/dist/semantics/model/operations.d.ts +496 -0
- package/dist/semantics/model/operations.js +2 -0
- package/dist/semantics/model/primitive-domain.d.ts +26 -0
- package/dist/semantics/model/primitive-domain.js +38 -0
- package/dist/semantics/model/selected-signature.d.ts +261 -0
- package/dist/semantics/model/selected-signature.js +55 -0
- package/dist/semantics/model/structural-type-table.d.ts +93 -0
- package/dist/semantics/model/structural-type-table.js +237 -0
- package/dist/semantics/model/structural-types.d.ts +367 -0
- package/dist/semantics/model/structural-types.js +200 -0
- package/dist/semantics/module-resolution.d.ts +23 -0
- package/dist/semantics/module-resolution.js +227 -0
- package/dist/semantics/new-callee-class-tag-source-transform.d.ts +4 -0
- package/dist/semantics/new-callee-class-tag-source-transform.js +64 -0
- package/dist/semantics/node-project.d.ts +13 -0
- package/dist/semantics/node-project.js +107 -0
- package/dist/semantics/node-source-hooks.d.ts +1 -0
- package/dist/semantics/node-source-hooks.js +63 -0
- package/dist/semantics/normalize/absent-globals.d.ts +143 -0
- package/dist/semantics/normalize/absent-globals.js +191 -0
- package/dist/semantics/normalize/arguments-objects.d.ts +43 -0
- package/dist/semantics/normalize/arguments-objects.js +60 -0
- package/dist/semantics/normalize/asserted-arm-absence.d.ts +28 -0
- package/dist/semantics/normalize/asserted-arm-absence.js +61 -0
- package/dist/semantics/normalize/assignment-patterns.d.ts +70 -0
- package/dist/semantics/normalize/assignment-patterns.js +147 -0
- package/dist/semantics/normalize/bag-absence.d.ts +8 -0
- package/dist/semantics/normalize/bag-absence.js +42 -0
- package/dist/semantics/normalize/binding-fixpoint.d.ts +36 -0
- package/dist/semantics/normalize/binding-fixpoint.js +140 -0
- package/dist/semantics/normalize/callback-parameter-contracts.d.ts +16 -0
- package/dist/semantics/normalize/callback-parameter-contracts.js +91 -0
- package/dist/semantics/normalize/cells/agreement.d.ts +46 -0
- package/dist/semantics/normalize/cells/agreement.js +34 -0
- package/dist/semantics/normalize/cells/candidates.d.ts +17 -0
- package/dist/semantics/normalize/cells/candidates.js +35 -0
- package/dist/semantics/normalize/cells/facts.d.ts +19 -0
- package/dist/semantics/normalize/cells/facts.js +90 -0
- package/dist/semantics/normalize/cells/index.d.ts +10 -0
- package/dist/semantics/normalize/cells/index.js +6 -0
- package/dist/semantics/normalize/cells/model.d.ts +98 -0
- package/dist/semantics/normalize/cells/model.js +2 -0
- package/dist/semantics/normalize/cells/policies/bag.d.ts +44 -0
- package/dist/semantics/normalize/cells/policies/bag.js +114 -0
- package/dist/semantics/normalize/cells/policies/collection.d.ts +42 -0
- package/dist/semantics/normalize/cells/policies/collection.js +218 -0
- package/dist/semantics/normalize/cells/policies/field.d.ts +28 -0
- package/dist/semantics/normalize/cells/policies/field.js +40 -0
- package/dist/semantics/normalize/cells/policies/index.d.ts +49 -0
- package/dist/semantics/normalize/cells/policies/index.js +58 -0
- package/dist/semantics/normalize/cells/policies/local.d.ts +18 -0
- package/dist/semantics/normalize/cells/policies/local.js +37 -0
- package/dist/semantics/normalize/cells/policies/parameter.d.ts +28 -0
- package/dist/semantics/normalize/cells/policies/parameter.js +39 -0
- package/dist/semantics/normalize/cells/policies/return.d.ts +26 -0
- package/dist/semantics/normalize/cells/policies/return.js +45 -0
- package/dist/semantics/normalize/cells/policies/shared.d.ts +33 -0
- package/dist/semantics/normalize/cells/policies/shared.js +45 -0
- package/dist/semantics/normalize/cells/policy.d.ts +72 -0
- package/dist/semantics/normalize/cells/policy.js +18 -0
- package/dist/semantics/normalize/cells/registry.d.ts +14 -0
- package/dist/semantics/normalize/cells/registry.js +17 -0
- package/dist/semantics/normalize/census-refusal.d.ts +62 -0
- package/dist/semantics/normalize/census-refusal.js +27 -0
- package/dist/semantics/normalize/census.d.ts +109 -0
- package/dist/semantics/normalize/census.js +667 -0
- package/dist/semantics/normalize/collection-bindings.d.ts +278 -0
- package/dist/semantics/normalize/collection-bindings.js +677 -0
- package/dist/semantics/normalize/commonjs-module-record.d.ts +21 -0
- package/dist/semantics/normalize/commonjs-module-record.js +289 -0
- package/dist/semantics/normalize/commonjs-require.d.ts +13 -0
- package/dist/semantics/normalize/commonjs-require.js +1527 -0
- package/dist/semantics/normalize/contribution.d.ts +63 -0
- package/dist/semantics/normalize/contribution.js +172 -0
- package/dist/semantics/normalize/dead-typeof-guards.d.ts +64 -0
- package/dist/semantics/normalize/dead-typeof-guards.js +152 -0
- package/dist/semantics/normalize/deferred-intrinsic-protocols.d.ts +57 -0
- package/dist/semantics/normalize/deferred-intrinsic-protocols.js +109 -0
- package/dist/semantics/normalize/derived-expression-type.d.ts +1070 -0
- package/dist/semantics/normalize/derived-expression-type.js +3463 -0
- package/dist/semantics/normalize/evaluation-order.d.ts +16 -0
- package/dist/semantics/normalize/evaluation-order.js +37 -0
- package/dist/semantics/normalize/field-bindings.d.ts +167 -0
- package/dist/semantics/normalize/field-bindings.js +1125 -0
- package/dist/semantics/normalize/flow/array-element-continuation.d.ts +27 -0
- package/dist/semantics/normalize/flow/array-element-continuation.js +1452 -0
- package/dist/semantics/normalize/flow/callable-array-origins.d.ts +42 -0
- package/dist/semantics/normalize/flow/callable-array-origins.js +318 -0
- package/dist/semantics/normalize/flow/callable-completions.d.ts +45 -0
- package/dist/semantics/normalize/flow/callable-completions.js +82 -0
- package/dist/semantics/normalize/flow/callable-reach.d.ts +237 -0
- package/dist/semantics/normalize/flow/callable-reach.js +7174 -0
- package/dist/semantics/normalize/flow/class-family-member-read.d.ts +16 -0
- package/dist/semantics/normalize/flow/class-family-member-read.js +992 -0
- package/dist/semantics/normalize/flow/collection-value-continuation.d.ts +21 -0
- package/dist/semantics/normalize/flow/collection-value-continuation.js +192 -0
- package/dist/semantics/normalize/flow/component-solver.d.ts +199 -0
- package/dist/semantics/normalize/flow/component-solver.js +587 -0
- package/dist/semantics/normalize/flow/computed-key-set.d.ts +84 -0
- package/dist/semantics/normalize/flow/computed-key-set.js +660 -0
- package/dist/semantics/normalize/flow/export-importers.d.ts +24 -0
- package/dist/semantics/normalize/flow/export-importers.js +269 -0
- package/dist/semantics/normalize/flow/host-text-sink.d.ts +25 -0
- package/dist/semantics/normalize/flow/host-text-sink.js +87 -0
- package/dist/semantics/normalize/flow/intrinsic-array-callback-frames.d.ts +84 -0
- package/dist/semantics/normalize/flow/intrinsic-array-callback-frames.js +180 -0
- package/dist/semantics/normalize/flow/intrinsic-data-definition.d.ts +35 -0
- package/dist/semantics/normalize/flow/intrinsic-data-definition.js +140 -0
- package/dist/semantics/normalize/flow/invocation-facts.d.ts +98 -0
- package/dist/semantics/normalize/flow/invocation-facts.js +257 -0
- package/dist/semantics/normalize/flow/member-call-forwarding.d.ts +122 -0
- package/dist/semantics/normalize/flow/member-call-forwarding.js +835 -0
- package/dist/semantics/normalize/flow/model.d.ts +357 -0
- package/dist/semantics/normalize/flow/model.js +177 -0
- package/dist/semantics/normalize/flow/native-collection-protocol.d.ts +24 -0
- package/dist/semantics/normalize/flow/native-collection-protocol.js +252 -0
- package/dist/semantics/normalize/flow/node-path-token.d.ts +3 -0
- package/dist/semantics/normalize/flow/node-path-token.js +53 -0
- package/dist/semantics/normalize/flow/object-binding-continuation.d.ts +11 -0
- package/dist/semantics/normalize/flow/object-binding-continuation.js +42 -0
- package/dist/semantics/normalize/flow/origin-authority.d.ts +56 -0
- package/dist/semantics/normalize/flow/origin-authority.js +2 -0
- package/dist/semantics/normalize/flow/owned-class-receivers.d.ts +35 -0
- package/dist/semantics/normalize/flow/owned-class-receivers.js +191 -0
- package/dist/semantics/normalize/flow/parameter-values.d.ts +27 -0
- package/dist/semantics/normalize/flow/parameter-values.js +251 -0
- package/dist/semantics/normalize/flow/proof-hypotheses.d.ts +66 -0
- package/dist/semantics/normalize/flow/proof-hypotheses.js +162 -0
- package/dist/semantics/normalize/flow/record-alias-closure.d.ts +27 -0
- package/dist/semantics/normalize/flow/record-alias-closure.js +298 -0
- package/dist/semantics/normalize/flow/seeded-origins.d.ts +43 -0
- package/dist/semantics/normalize/flow/seeded-origins.js +54 -0
- package/dist/semantics/normalize/flow/source-class-data.d.ts +132 -0
- package/dist/semantics/normalize/flow/source-class-data.js +838 -0
- package/dist/semantics/normalize/flow/source-class-instanceof.d.ts +13 -0
- package/dist/semantics/normalize/flow/source-class-instanceof.js +37 -0
- package/dist/semantics/normalize/flow/source-class-static-data.d.ts +16 -0
- package/dist/semantics/normalize/flow/source-class-static-data.js +47 -0
- package/dist/semantics/normalize/flow/source-construction-frames.d.ts +12 -0
- package/dist/semantics/normalize/flow/source-construction-frames.js +118 -0
- package/dist/semantics/normalize/flow/source-invocation-frame-layout.d.ts +34 -0
- package/dist/semantics/normalize/flow/source-invocation-frame-layout.js +78 -0
- package/dist/semantics/normalize/flow/source-invocation-receiver.d.ts +37 -0
- package/dist/semantics/normalize/flow/source-invocation-receiver.js +95 -0
- package/dist/semantics/normalize/flow/source-prototype-method-identity.d.ts +23 -0
- package/dist/semantics/normalize/flow/source-prototype-method-identity.js +81 -0
- package/dist/semantics/normalize/flow/source-record-data.d.ts +29 -0
- package/dist/semantics/normalize/flow/source-record-data.js +626 -0
- package/dist/semantics/normalize/flow/source-value-session.d.ts +77 -0
- package/dist/semantics/normalize/flow/source-value-session.js +3089 -0
- package/dist/semantics/normalize/flow/targets.d.ts +118 -0
- package/dist/semantics/normalize/flow/targets.js +405 -0
- package/dist/semantics/normalize/flow/value-flow.d.ts +36 -0
- package/dist/semantics/normalize/flow/value-flow.js +823 -0
- package/dist/semantics/normalize/flow/value-provenance.d.ts +31 -0
- package/dist/semantics/normalize/flow/value-provenance.js +112 -0
- package/dist/semantics/normalize/gating.d.ts +51 -0
- package/dist/semantics/normalize/gating.js +560 -0
- package/dist/semantics/normalize/generic-function-choice.d.ts +31 -0
- package/dist/semantics/normalize/generic-function-choice.js +115 -0
- package/dist/semantics/normalize/global-host-mutations.d.ts +51 -0
- package/dist/semantics/normalize/global-host-mutations.js +5989 -0
- package/dist/semantics/normalize/host-effect-contracts.d.ts +77 -0
- package/dist/semantics/normalize/host-effect-contracts.js +143 -0
- package/dist/semantics/normalize/host-mutation-computed-keys.d.ts +38 -0
- package/dist/semantics/normalize/host-mutation-computed-keys.js +26 -0
- package/dist/semantics/normalize/host-mutation-key-reader.d.ts +66 -0
- package/dist/semantics/normalize/host-mutation-key-reader.js +192 -0
- package/dist/semantics/normalize/host-mutation-keys.d.ts +114 -0
- package/dist/semantics/normalize/host-mutation-keys.js +183 -0
- package/dist/semantics/normalize/identities.d.ts +172 -0
- package/dist/semantics/normalize/identities.js +426 -0
- package/dist/semantics/normalize/implicit-arguments-tuple.d.ts +97 -0
- package/dist/semantics/normalize/implicit-arguments-tuple.js +197 -0
- package/dist/semantics/normalize/implicit-arguments.d.ts +11 -0
- package/dist/semantics/normalize/implicit-arguments.js +39 -0
- package/dist/semantics/normalize/instantiation.d.ts +73 -0
- package/dist/semantics/normalize/instantiation.js +399 -0
- package/dist/semantics/normalize/intrinsic-property-call.d.ts +18 -0
- package/dist/semantics/normalize/intrinsic-property-call.js +69 -0
- package/dist/semantics/normalize/intrinsic-prototype.d.ts +41 -0
- package/dist/semantics/normalize/intrinsic-prototype.js +87 -0
- package/dist/semantics/normalize/intrinsic-static-member.d.ts +14 -0
- package/dist/semantics/normalize/intrinsic-static-member.js +23 -0
- package/dist/semantics/normalize/jsdoc-type-names.d.ts +32 -0
- package/dist/semantics/normalize/jsdoc-type-names.js +512 -0
- package/dist/semantics/normalize/keyof.d.ts +32 -0
- package/dist/semantics/normalize/keyof.js +110 -0
- package/dist/semantics/normalize/local-bindings.d.ts +176 -0
- package/dist/semantics/normalize/local-bindings.js +1826 -0
- package/dist/semantics/normalize/logical-result-type.d.ts +16 -0
- package/dist/semantics/normalize/logical-result-type.js +102 -0
- package/dist/semantics/normalize/namespace-paths.d.ts +57 -0
- package/dist/semantics/normalize/namespace-paths.js +108 -0
- package/dist/semantics/normalize/normalize.d.ts +57 -0
- package/dist/semantics/normalize/normalize.js +68 -0
- package/dist/semantics/normalize/object-bag-bindings.d.ts +305 -0
- package/dist/semantics/normalize/object-bag-bindings.js +1290 -0
- package/dist/semantics/normalize/omitted-stated-parameter.d.ts +53 -0
- package/dist/semantics/normalize/omitted-stated-parameter.js +59 -0
- package/dist/semantics/normalize/open-type-form.d.ts +10 -0
- package/dist/semantics/normalize/open-type-form.js +32 -0
- package/dist/semantics/normalize/parameter-bindings.d.ts +361 -0
- package/dist/semantics/normalize/parameter-bindings.js +3339 -0
- package/dist/semantics/normalize/parameter-slot.d.ts +264 -0
- package/dist/semantics/normalize/parameter-slot.js +491 -0
- package/dist/semantics/normalize/physical-overload-result.d.ts +77 -0
- package/dist/semantics/normalize/physical-overload-result.js +99 -0
- package/dist/semantics/normalize/primitive-property-absence.d.ts +12 -0
- package/dist/semantics/normalize/primitive-property-absence.js +60 -0
- package/dist/semantics/normalize/producer-context.d.ts +376 -0
- package/dist/semantics/normalize/producer-context.js +1 -0
- package/dist/semantics/normalize/producers/allocations.d.ts +3 -0
- package/dist/semantics/normalize/producers/allocations.js +863 -0
- package/dist/semantics/normalize/producers/binding-kind.d.ts +37 -0
- package/dist/semantics/normalize/producers/binding-kind.js +36 -0
- package/dist/semantics/normalize/producers/bindings.d.ts +85 -0
- package/dist/semantics/normalize/producers/bindings.js +710 -0
- package/dist/semantics/normalize/producers/boundary.d.ts +34 -0
- package/dist/semantics/normalize/producers/boundary.js +123 -0
- package/dist/semantics/normalize/producers/class-lifecycle.d.ts +3 -0
- package/dist/semantics/normalize/producers/class-lifecycle.js +902 -0
- package/dist/semantics/normalize/producers/computations.d.ts +3 -0
- package/dist/semantics/normalize/producers/computations.js +613 -0
- package/dist/semantics/normalize/producers/control-loops.d.ts +30 -0
- package/dist/semantics/normalize/producers/control-loops.js +91 -0
- package/dist/semantics/normalize/producers/control.d.ts +30 -0
- package/dist/semantics/normalize/producers/control.js +923 -0
- package/dist/semantics/normalize/producers/declaration-lifecycle.d.ts +3 -0
- package/dist/semantics/normalize/producers/declaration-lifecycle.js +390 -0
- package/dist/semantics/normalize/producers/destructuring.d.ts +45 -0
- package/dist/semantics/normalize/producers/destructuring.js +1180 -0
- package/dist/semantics/normalize/producers/dynamic-language.d.ts +3 -0
- package/dist/semantics/normalize/producers/dynamic-language.js +70 -0
- package/dist/semantics/normalize/producers/erasure.d.ts +51 -0
- package/dist/semantics/normalize/producers/erasure.js +90 -0
- package/dist/semantics/normalize/producers/installed.d.ts +3 -0
- package/dist/semantics/normalize/producers/installed.js +55 -0
- package/dist/semantics/normalize/producers/invocations.d.ts +35 -0
- package/dist/semantics/normalize/producers/invocations.js +1796 -0
- package/dist/semantics/normalize/producers/iteration-yield.d.ts +59 -0
- package/dist/semantics/normalize/producers/iteration-yield.js +235 -0
- package/dist/semantics/normalize/producers/jsx.d.ts +3 -0
- package/dist/semantics/normalize/producers/jsx.js +360 -0
- package/dist/semantics/normalize/producers/mint.d.ts +39 -0
- package/dist/semantics/normalize/producers/mint.js +44 -0
- package/dist/semantics/normalize/producers/nullish.d.ts +16 -0
- package/dist/semantics/normalize/producers/nullish.js +27 -0
- package/dist/semantics/normalize/producers/object-assignment.d.ts +8 -0
- package/dist/semantics/normalize/producers/object-assignment.js +204 -0
- package/dist/semantics/normalize/producers/object-tag.d.ts +9 -0
- package/dist/semantics/normalize/producers/object-tag.js +119 -0
- package/dist/semantics/normalize/producers/optional-chain.d.ts +44 -0
- package/dist/semantics/normalize/producers/optional-chain.js +75 -0
- package/dist/semantics/normalize/producers/properties.d.ts +21 -0
- package/dist/semantics/normalize/producers/properties.js +1053 -0
- package/dist/semantics/normalize/producers/protocol.d.ts +67 -0
- package/dist/semantics/normalize/producers/protocol.js +695 -0
- package/dist/semantics/normalize/producers/references.d.ts +53 -0
- package/dist/semantics/normalize/producers/references.js +1027 -0
- package/dist/semantics/normalize/producers/shared.d.ts +561 -0
- package/dist/semantics/normalize/producers/shared.js +1683 -0
- package/dist/semantics/normalize/producers/spread-arguments.d.ts +72 -0
- package/dist/semantics/normalize/producers/spread-arguments.js +375 -0
- package/dist/semantics/normalize/producers/tagged-template.d.ts +5 -0
- package/dist/semantics/normalize/producers/tagged-template.js +307 -0
- package/dist/semantics/normalize/producers/tuple-spread.d.ts +189 -0
- package/dist/semantics/normalize/producers/tuple-spread.js +279 -0
- package/dist/semantics/normalize/property-key-domain.d.ts +36 -0
- package/dist/semantics/normalize/property-key-domain.js +150 -0
- package/dist/semantics/normalize/reachability.d.ts +189 -0
- package/dist/semantics/normalize/reachability.js +1057 -0
- package/dist/semantics/normalize/reassigned-bindings.d.ts +13 -0
- package/dist/semantics/normalize/reassigned-bindings.js +41 -0
- package/dist/semantics/normalize/record-storage-families.d.ts +11 -0
- package/dist/semantics/normalize/record-storage-families.js +109 -0
- package/dist/semantics/normalize/return-bindings.d.ts +260 -0
- package/dist/semantics/normalize/return-bindings.js +1311 -0
- package/dist/semantics/normalize/return-paths.d.ts +2 -0
- package/dist/semantics/normalize/return-paths.js +28 -0
- package/dist/semantics/normalize/script-global-redefinition.d.ts +44 -0
- package/dist/semantics/normalize/script-global-redefinition.js +75 -0
- package/dist/semantics/normalize/specialization.d.ts +201 -0
- package/dist/semantics/normalize/specialization.js +1824 -0
- package/dist/semantics/normalize/structural-array-element.d.ts +176 -0
- package/dist/semantics/normalize/structural-array-element.js +700 -0
- package/dist/semantics/normalize/structural-array-read.d.ts +13 -0
- package/dist/semantics/normalize/structural-array-read.js +124 -0
- package/dist/semantics/normalize/structural-callable.d.ts +12 -0
- package/dist/semantics/normalize/structural-callable.js +82 -0
- package/dist/semantics/normalize/structural-creation-order.d.ts +32 -0
- package/dist/semantics/normalize/structural-creation-order.js +111 -0
- package/dist/semantics/normalize/structural-declarations.d.ts +395 -0
- package/dist/semantics/normalize/structural-declarations.js +968 -0
- package/dist/semantics/normalize/structural-declared-body.d.ts +25 -0
- package/dist/semantics/normalize/structural-declared-body.js +147 -0
- package/dist/semantics/normalize/structural-generics.d.ts +56 -0
- package/dist/semantics/normalize/structural-generics.js +120 -0
- package/dist/semantics/normalize/structural-indexed-access.d.ts +11 -0
- package/dist/semantics/normalize/structural-indexed-access.js +126 -0
- package/dist/semantics/normalize/structural-instantiated-member.d.ts +64 -0
- package/dist/semantics/normalize/structural-instantiated-member.js +407 -0
- package/dist/semantics/normalize/structural-joins.d.ts +44 -0
- package/dist/semantics/normalize/structural-joins.js +143 -0
- package/dist/semantics/normalize/structural-layout-relevance.d.ts +29 -0
- package/dist/semantics/normalize/structural-layout-relevance.js +391 -0
- package/dist/semantics/normalize/structural-layout-type.d.ts +11 -0
- package/dist/semantics/normalize/structural-layout-type.js +1468 -0
- package/dist/semantics/normalize/structural-leaves.d.ts +49 -0
- package/dist/semantics/normalize/structural-leaves.js +125 -0
- package/dist/semantics/normalize/structural-local-union.d.ts +13 -0
- package/dist/semantics/normalize/structural-local-union.js +133 -0
- package/dist/semantics/normalize/structural-members.d.ts +26 -0
- package/dist/semantics/normalize/structural-members.js +84 -0
- package/dist/semantics/normalize/structural-mutable-method.d.ts +15 -0
- package/dist/semantics/normalize/structural-mutable-method.js +109 -0
- package/dist/semantics/normalize/structural-parts.d.ts +131 -0
- package/dist/semantics/normalize/structural-parts.js +737 -0
- package/dist/semantics/normalize/structural-receiver.d.ts +66 -0
- package/dist/semantics/normalize/structural-receiver.js +551 -0
- package/dist/semantics/normalize/structural-rules.d.ts +112 -0
- package/dist/semantics/normalize/structural-rules.js +93 -0
- package/dist/semantics/normalize/structural-self-reference.d.ts +150 -0
- package/dist/semantics/normalize/structural-self-reference.js +494 -0
- package/dist/semantics/normalize/structural.d.ts +202 -0
- package/dist/semantics/normalize/structural.js +4218 -0
- package/dist/semantics/normalize/unreduced-type-form.d.ts +41 -0
- package/dist/semantics/normalize/unreduced-type-form.js +53 -0
- package/dist/semantics/normalize/unresolvable-names.d.ts +56 -0
- package/dist/semantics/normalize/unresolvable-names.js +140 -0
- package/dist/semantics/package-sources.d.ts +16 -0
- package/dist/semantics/package-sources.js +365 -0
- package/dist/semantics/program.d.ts +151 -0
- package/dist/semantics/program.js +667 -0
- package/dist/semantics/prototype-install-source-transform.d.ts +4 -0
- package/dist/semantics/prototype-install-source-transform.js +341 -0
- package/dist/semantics/prototype-object-class-source-transform.d.ts +4 -0
- package/dist/semantics/prototype-object-class-source-transform.js +525 -0
- package/dist/semantics/prototype-reparenting.d.ts +50 -0
- package/dist/semantics/prototype-reparenting.js +317 -0
- package/dist/semantics/stable-checker.d.ts +10 -0
- package/dist/semantics/stable-checker.js +148 -0
- package/dist/semantics/subclass-member-overlay-transform.d.ts +35 -0
- package/dist/semantics/subclass-member-overlay-transform.js +1418 -0
- package/dist/semantics/symbol-keyed-expando-source-transform.d.ts +4 -0
- package/dist/semantics/symbol-keyed-expando-source-transform.js +66 -0
- package/dist/semantics/this-constructor-source-transform.d.ts +4 -0
- package/dist/semantics/this-constructor-source-transform.js +122 -0
- package/dist/semantics/uninstantiable-classes.d.ts +22 -0
- package/dist/semantics/uninstantiable-classes.js +75 -0
- package/dist/targets/cpp/balanced-units.d.ts +3 -0
- package/dist/targets/cpp/balanced-units.js +58 -0
- package/dist/targets/cpp/borrowed-call-entry.d.ts +30 -0
- package/dist/targets/cpp/borrowed-call-entry.js +68 -0
- package/dist/targets/cpp/captures.d.ts +68 -0
- package/dist/targets/cpp/captures.js +269 -0
- package/dist/targets/cpp/class-layout.d.ts +313 -0
- package/dist/targets/cpp/class-layout.js +483 -0
- package/dist/targets/cpp/class-properties/computed-method-value.d.ts +25 -0
- package/dist/targets/cpp/class-properties/computed-method-value.js +22 -0
- package/dist/targets/cpp/class-properties/emit-class-properties.d.ts +216 -0
- package/dist/targets/cpp/class-properties/emit-class-properties.js +917 -0
- package/dist/targets/cpp/class-properties/native-prototype.d.ts +11 -0
- package/dist/targets/cpp/class-properties/native-prototype.js +101 -0
- package/dist/targets/cpp/class-ref-transport.d.ts +12 -0
- package/dist/targets/cpp/class-ref-transport.js +32 -0
- package/dist/targets/cpp/conversions.d.ts +3 -0
- package/dist/targets/cpp/conversions.js +2027 -0
- package/dist/targets/cpp/deferral-safety.d.ts +82 -0
- package/dist/targets/cpp/deferral-safety.js +86 -0
- package/dist/targets/cpp/direct-call-receivers.d.ts +37 -0
- package/dist/targets/cpp/direct-call-receivers.js +79 -0
- package/dist/targets/cpp/document.d.ts +74 -0
- package/dist/targets/cpp/document.js +106 -0
- package/dist/targets/cpp/emit-allocation.d.ts +60 -0
- package/dist/targets/cpp/emit-allocation.js +573 -0
- package/dist/targets/cpp/emit-arrays.d.ts +119 -0
- package/dist/targets/cpp/emit-arrays.js +1047 -0
- package/dist/targets/cpp/emit-binding-reference.d.ts +17 -0
- package/dist/targets/cpp/emit-binding-reference.js +120 -0
- package/dist/targets/cpp/emit-bindings.d.ts +158 -0
- package/dist/targets/cpp/emit-bindings.js +769 -0
- package/dist/targets/cpp/emit-buffers.d.ts +156 -0
- package/dist/targets/cpp/emit-buffers.js +573 -0
- package/dist/targets/cpp/emit-callable.d.ts +230 -0
- package/dist/targets/cpp/emit-callable.js +2154 -0
- package/dist/targets/cpp/emit-carrier-members.d.ts +406 -0
- package/dist/targets/cpp/emit-carrier-members.js +1224 -0
- package/dist/targets/cpp/emit-coercion.d.ts +26 -0
- package/dist/targets/cpp/emit-coercion.js +39 -0
- package/dist/targets/cpp/emit-context.d.ts +1882 -0
- package/dist/targets/cpp/emit-context.js +904 -0
- package/dist/targets/cpp/emit-dynamic-properties.d.ts +174 -0
- package/dist/targets/cpp/emit-dynamic-properties.js +1249 -0
- package/dist/targets/cpp/emit-equality.d.ts +39 -0
- package/dist/targets/cpp/emit-equality.js +472 -0
- package/dist/targets/cpp/emit-exceptions.d.ts +104 -0
- package/dist/targets/cpp/emit-exceptions.js +513 -0
- package/dist/targets/cpp/emit-field-owner.d.ts +4 -0
- package/dist/targets/cpp/emit-field-owner.js +27 -0
- package/dist/targets/cpp/emit-in.d.ts +31 -0
- package/dist/targets/cpp/emit-in.js +426 -0
- package/dist/targets/cpp/emit-instanceof.d.ts +19 -0
- package/dist/targets/cpp/emit-instanceof.js +601 -0
- package/dist/targets/cpp/emit-integers.d.ts +68 -0
- package/dist/targets/cpp/emit-integers.js +184 -0
- package/dist/targets/cpp/emit-iterator.d.ts +100 -0
- package/dist/targets/cpp/emit-iterator.js +1137 -0
- package/dist/targets/cpp/emit-json.d.ts +73 -0
- package/dist/targets/cpp/emit-json.js +823 -0
- package/dist/targets/cpp/emit-jsx.d.ts +74 -0
- package/dist/targets/cpp/emit-jsx.js +806 -0
- package/dist/targets/cpp/emit-mixed-binary.d.ts +51 -0
- package/dist/targets/cpp/emit-mixed-binary.js +60 -0
- package/dist/targets/cpp/emit-namespaces.d.ts +101 -0
- package/dist/targets/cpp/emit-namespaces.js +133 -0
- package/dist/targets/cpp/emit-narrowing.d.ts +738 -0
- package/dist/targets/cpp/emit-narrowing.js +3967 -0
- package/dist/targets/cpp/emit-native-equality.d.ts +3 -0
- package/dist/targets/cpp/emit-native-equality.js +14 -0
- package/dist/targets/cpp/emit-native-selection.d.ts +5 -0
- package/dist/targets/cpp/emit-native-selection.js +37 -0
- package/dist/targets/cpp/emit-object-tag.d.ts +4 -0
- package/dist/targets/cpp/emit-object-tag.js +108 -0
- package/dist/targets/cpp/emit-owned-record.d.ts +2 -0
- package/dist/targets/cpp/emit-owned-record.js +15 -0
- package/dist/targets/cpp/emit-presence.d.ts +78 -0
- package/dist/targets/cpp/emit-presence.js +376 -0
- package/dist/targets/cpp/emit-properties.d.ts +105 -0
- package/dist/targets/cpp/emit-properties.js +1640 -0
- package/dist/targets/cpp/emit-record-view.d.ts +20 -0
- package/dist/targets/cpp/emit-record-view.js +354 -0
- package/dist/targets/cpp/emit-return.d.ts +5 -0
- package/dist/targets/cpp/emit-return.js +237 -0
- package/dist/targets/cpp/emit-sum-widening.d.ts +10 -0
- package/dist/targets/cpp/emit-sum-widening.js +69 -0
- package/dist/targets/cpp/emit-tonumber.d.ts +38 -0
- package/dist/targets/cpp/emit-tonumber.js +177 -0
- package/dist/targets/cpp/emit-tostring.d.ts +92 -0
- package/dist/targets/cpp/emit-tostring.js +556 -0
- package/dist/targets/cpp/emit-typeof.d.ts +49 -0
- package/dist/targets/cpp/emit-typeof.js +317 -0
- package/dist/targets/cpp/emit-union-properties.d.ts +181 -0
- package/dist/targets/cpp/emit-union-properties.js +1281 -0
- package/dist/targets/cpp/emit.d.ts +45 -0
- package/dist/targets/cpp/emit.js +2225 -0
- package/dist/targets/cpp/error-types.d.ts +4 -0
- package/dist/targets/cpp/error-types.js +11 -0
- package/dist/targets/cpp/function-source-reads.d.ts +72 -0
- package/dist/targets/cpp/function-source-reads.js +148 -0
- package/dist/targets/cpp/host/atomics.d.ts +25 -0
- package/dist/targets/cpp/host/atomics.js +63 -0
- package/dist/targets/cpp/host/core-globals.d.ts +108 -0
- package/dist/targets/cpp/host/core-globals.js +158 -0
- package/dist/targets/cpp/host/dynamic-argument-members.d.ts +42 -0
- package/dist/targets/cpp/host/dynamic-argument-members.js +61 -0
- package/dist/targets/cpp/host/emit-host-arity.d.ts +139 -0
- package/dist/targets/cpp/host/emit-host-arity.js +232 -0
- package/dist/targets/cpp/host/emit-host-invoke.d.ts +91 -0
- package/dist/targets/cpp/host/emit-host-invoke.js +1105 -0
- package/dist/targets/cpp/host/emit-host-object.d.ts +55 -0
- package/dist/targets/cpp/host/emit-host-object.js +2206 -0
- package/dist/targets/cpp/host/emit-host-properties.d.ts +69 -0
- package/dist/targets/cpp/host/emit-host-properties.js +533 -0
- package/dist/targets/cpp/host/emit-host-reflect.d.ts +4 -0
- package/dist/targets/cpp/host/emit-host-reflect.js +180 -0
- package/dist/targets/cpp/host/emit-host-value.d.ts +120 -0
- package/dist/targets/cpp/host/emit-host-value.js +392 -0
- package/dist/targets/cpp/host/host-members.d.ts +505 -0
- package/dist/targets/cpp/host/host-members.js +819 -0
- package/dist/targets/cpp/host/host-method-aliases.d.ts +30 -0
- package/dist/targets/cpp/host/host-method-aliases.js +76 -0
- package/dist/targets/cpp/host/native-protocols.d.ts +47 -0
- package/dist/targets/cpp/host/native-protocols.js +183 -0
- package/dist/targets/cpp/host/object-protocol.d.ts +351 -0
- package/dist/targets/cpp/host/object-protocol.js +671 -0
- package/dist/targets/cpp/host-namespace-reads.d.ts +83 -0
- package/dist/targets/cpp/host-namespace-reads.js +113 -0
- package/dist/targets/cpp/manifest/capabilities.d.ts +39 -0
- package/dist/targets/cpp/manifest/capabilities.js +1484 -0
- package/dist/targets/cpp/manifest.d.ts +23 -0
- package/dist/targets/cpp/manifest.js +113 -0
- package/dist/targets/cpp/native-error-base.d.ts +38 -0
- package/dist/targets/cpp/native-error-base.js +74 -0
- package/dist/targets/cpp/native-narrowing-transport.d.ts +12 -0
- package/dist/targets/cpp/native-narrowing-transport.js +151 -0
- package/dist/targets/cpp/native-selection-helpers.d.ts +11 -0
- package/dist/targets/cpp/native-selection-helpers.js +46 -0
- package/dist/targets/cpp/native-symbol-keys.d.ts +8 -0
- package/dist/targets/cpp/native-symbol-keys.js +34 -0
- package/dist/targets/cpp/ownership.d.ts +43 -0
- package/dist/targets/cpp/ownership.js +38 -0
- package/dist/targets/cpp/owning-conversion-input.d.ts +14 -0
- package/dist/targets/cpp/owning-conversion-input.js +12 -0
- package/dist/targets/cpp/property-read-claims.d.ts +62 -0
- package/dist/targets/cpp/property-read-claims.js +23 -0
- package/dist/targets/cpp/property-store-claims.d.ts +62 -0
- package/dist/targets/cpp/property-store-claims.js +26 -0
- package/dist/targets/cpp/prototype/emit-prototype-array.d.ts +111 -0
- package/dist/targets/cpp/prototype/emit-prototype-array.js +602 -0
- package/dist/targets/cpp/prototype/emit-prototype-date.d.ts +133 -0
- package/dist/targets/cpp/prototype/emit-prototype-date.js +515 -0
- package/dist/targets/cpp/prototype/emit-prototype-error.d.ts +13 -0
- package/dist/targets/cpp/prototype/emit-prototype-error.js +54 -0
- package/dist/targets/cpp/prototype/emit-prototype-invoke.d.ts +34 -0
- package/dist/targets/cpp/prototype/emit-prototype-invoke.js +1003 -0
- package/dist/targets/cpp/prototype/emit-prototype-iterator.d.ts +47 -0
- package/dist/targets/cpp/prototype/emit-prototype-iterator.js +250 -0
- package/dist/targets/cpp/prototype/emit-prototype-promise.d.ts +46 -0
- package/dist/targets/cpp/prototype/emit-prototype-promise.js +143 -0
- package/dist/targets/cpp/prototype/emit-prototype-regexp.d.ts +335 -0
- package/dist/targets/cpp/prototype/emit-prototype-regexp.js +853 -0
- package/dist/targets/cpp/prototype/emit-prototype-string.d.ts +42 -0
- package/dist/targets/cpp/prototype/emit-prototype-string.js +252 -0
- package/dist/targets/cpp/prototype/prototype-method-reads.d.ts +25 -0
- package/dist/targets/cpp/prototype/prototype-method-reads.js +182 -0
- package/dist/targets/cpp/reactive-dependencies.d.ts +140 -0
- package/dist/targets/cpp/reactive-dependencies.js +432 -0
- package/dist/targets/cpp/reactive-origins.d.ts +44 -0
- package/dist/targets/cpp/reactive-origins.js +82 -0
- package/dist/targets/cpp/records.d.ts +277 -0
- package/dist/targets/cpp/records.js +2427 -0
- package/dist/targets/cpp/recursive-containers.d.ts +43 -0
- package/dist/targets/cpp/recursive-containers.js +144 -0
- package/dist/targets/cpp/regexp-types.d.ts +56 -0
- package/dist/targets/cpp/regexp-types.js +59 -0
- package/dist/targets/cpp/substrate.d.ts +125 -0
- package/dist/targets/cpp/substrate.js +12 -0
- package/dist/targets/cpp/translation-unit.d.ts +219 -0
- package/dist/targets/cpp/translation-unit.js +2063 -0
- package/dist/targets/cpp/types.d.ts +280 -0
- package/dist/targets/cpp/types.js +1135 -0
- package/dist/targets/cpp/virtual-methods.d.ts +95 -0
- package/dist/targets/cpp/virtual-methods.js +264 -0
- package/package.json +95 -0
- package/src/targets/cpp/runtime/gea_dynamic_proxy.h +824 -0
- package/src/targets/cpp/runtime/gea_eval.h +1376 -0
- package/src/targets/cpp/runtime/gea_native_class_prototype.h +44 -0
- package/src/targets/cpp/runtime/gea_runtime.h +29222 -0
- package/src/targets/cpp/runtime/gea_runtime_builtins.cpp +55 -0
|
@@ -0,0 +1,1386 @@
|
|
|
1
|
+
import { classLayoutOfCopy, constructedBaseOf } from '../projection/classes.js';
|
|
2
|
+
import { extendsClass } from '../projection/dispatch.js';
|
|
3
|
+
import { abiOfCallee } from '../projection/callee.js';
|
|
4
|
+
import { classMemberOf, classMethodOverrideOf, classPrototypeMethodMutableOf } from '../projection/fields.js';
|
|
5
|
+
import { nativeClassReferenceTransportMatches } from '../conversion/native-class-reference.js';
|
|
6
|
+
import { nativeCallablePrefixAdapterMatches } from '../conversion/native-callable-adapter.js';
|
|
7
|
+
import { nativePayloadTransportMatches } from '../conversion/native-payload-transport.js';
|
|
8
|
+
import { nativeMergePayloadTransportMatches } from './native-merge-transport.js';
|
|
9
|
+
import { nativeArrayTransportOf } from './native-array-transport.js';
|
|
10
|
+
import { nativeDictionaryTransportOf } from './native-dictionary-transport.js';
|
|
11
|
+
import { nativeSequenceTransportOf } from './native-sequence-transport.js';
|
|
12
|
+
import { nativeClassInitializationOf, nativeSuperInitializationOf } from './native-class-initialization.js';
|
|
13
|
+
import { nativeClassConstructionOf } from './native-class-construction.js';
|
|
14
|
+
import { nativeClassAccessorEntryOf } from './native-class-accessor.js';
|
|
15
|
+
import { hasNativePropertyLayout } from './native-fixed-layout.js';
|
|
16
|
+
import { nativeKeyQueryOf } from './native-key-query.js';
|
|
17
|
+
import { abiKey, representationKey, walkRepresentation } from '../representation/model.js';
|
|
18
|
+
import { nativeArgumentsMatch, receivedCallArguments } from './call-entry.js';
|
|
19
|
+
import { classConstructorBodyMatches, constructMatchesAbi, explicitObjectConstructEntryOf, ordinaryConstructBodyMatches } from './construct-entry.js';
|
|
20
|
+
import { observesNativeCarrierOnly, operandsOfIrOperation, resultOfIrOperation } from './queries.js';
|
|
21
|
+
/**
|
|
22
|
+
* Flow-insensitive native field provenance. A field write contributes
|
|
23
|
+
* every implementation it can store; it never establishes an immutable-field
|
|
24
|
+
* fact. Unknown calls and publications poison the affected heap, including
|
|
25
|
+
* functions written there in a later solver round. Calls are resolved from
|
|
26
|
+
* allocator identities before treating still-unresolved entries as external.
|
|
27
|
+
*
|
|
28
|
+
* This authority does not consume reflection demand: it proves the origins
|
|
29
|
+
* which that demand needs. Unsupported transports fail closed. In particular,
|
|
30
|
+
* an arbitrary matching callable signature is never an implementation source.
|
|
31
|
+
*/
|
|
32
|
+
export const nativeCallableFlowOf = (bodies, placements, classes, conversions, trace, deriver) => {
|
|
33
|
+
const propertyLayoutCache = new Map();
|
|
34
|
+
const nativePropertyLayoutOf = (representation) => hasNativePropertyLayout(representation, deriver ?? null, classes, new Set(), propertyLayoutCache);
|
|
35
|
+
const cells = [];
|
|
36
|
+
const pendingCells = [];
|
|
37
|
+
const nextSweep = [];
|
|
38
|
+
let sweepIndex = null;
|
|
39
|
+
let revision = 0;
|
|
40
|
+
// Preserve the old sweep's cell order, including its backwards edges, while
|
|
41
|
+
// visiting only changed cells. This also preserves closed-family ordering.
|
|
42
|
+
const pushCell = (cell) => {
|
|
43
|
+
let index = pendingCells.length;
|
|
44
|
+
pendingCells.push(cell);
|
|
45
|
+
while (index > 0) {
|
|
46
|
+
const parent = (index - 1) >>> 1;
|
|
47
|
+
if (pendingCells[parent].index <= cell.index)
|
|
48
|
+
break;
|
|
49
|
+
pendingCells[index] = pendingCells[parent];
|
|
50
|
+
index = parent;
|
|
51
|
+
}
|
|
52
|
+
pendingCells[index] = cell;
|
|
53
|
+
};
|
|
54
|
+
const popCell = () => {
|
|
55
|
+
const first = pendingCells[0];
|
|
56
|
+
const last = pendingCells.pop();
|
|
57
|
+
if (pendingCells.length > 0) {
|
|
58
|
+
let index = 0;
|
|
59
|
+
for (;;) {
|
|
60
|
+
const left = index * 2 + 1;
|
|
61
|
+
if (left >= pendingCells.length)
|
|
62
|
+
break;
|
|
63
|
+
const right = left + 1;
|
|
64
|
+
const child = right < pendingCells.length && pendingCells[right].index < pendingCells[left].index ? right : left;
|
|
65
|
+
if (last.index <= pendingCells[child].index)
|
|
66
|
+
break;
|
|
67
|
+
pendingCells[index] = pendingCells[child];
|
|
68
|
+
index = child;
|
|
69
|
+
}
|
|
70
|
+
pendingCells[index] = last;
|
|
71
|
+
}
|
|
72
|
+
first.queued = false;
|
|
73
|
+
return first;
|
|
74
|
+
};
|
|
75
|
+
const schedule = (cell) => {
|
|
76
|
+
if (cell.queued)
|
|
77
|
+
return;
|
|
78
|
+
cell.queued = true;
|
|
79
|
+
if (sweepIndex !== null && cell.index <= sweepIndex)
|
|
80
|
+
nextSweep.push(cell);
|
|
81
|
+
else
|
|
82
|
+
pushCell(cell);
|
|
83
|
+
};
|
|
84
|
+
const changed = (cell) => {
|
|
85
|
+
revision++;
|
|
86
|
+
schedule(cell);
|
|
87
|
+
};
|
|
88
|
+
const addFunction = (cell, id) => {
|
|
89
|
+
if (cell.functions.has(id))
|
|
90
|
+
return;
|
|
91
|
+
cell.functions.add(id);
|
|
92
|
+
changed(cell);
|
|
93
|
+
};
|
|
94
|
+
const addHeap = (cell, heap) => {
|
|
95
|
+
if (cell.heaps.has(heap))
|
|
96
|
+
return;
|
|
97
|
+
cell.heaps.add(heap);
|
|
98
|
+
changed(cell);
|
|
99
|
+
};
|
|
100
|
+
const markUnknown = (cell, reason) => {
|
|
101
|
+
if (!cell.unknown) {
|
|
102
|
+
cell.unknown = true;
|
|
103
|
+
changed(cell);
|
|
104
|
+
}
|
|
105
|
+
if (trace && reason !== undefined)
|
|
106
|
+
cell.unknownReason ??= reason;
|
|
107
|
+
};
|
|
108
|
+
const markEscaped = (cell, reason) => {
|
|
109
|
+
if (!cell.escaped) {
|
|
110
|
+
cell.escaped = true;
|
|
111
|
+
changed(cell);
|
|
112
|
+
for (const source of cell.incoming)
|
|
113
|
+
schedule(source);
|
|
114
|
+
}
|
|
115
|
+
if (trace && reason !== undefined)
|
|
116
|
+
cell.escapeReason ??= reason;
|
|
117
|
+
};
|
|
118
|
+
const fresh = () => {
|
|
119
|
+
const cell = {
|
|
120
|
+
index: cells.length,
|
|
121
|
+
incoming: new Set(),
|
|
122
|
+
queued: false,
|
|
123
|
+
functions: new Set(),
|
|
124
|
+
heaps: new Set(),
|
|
125
|
+
edges: new Map(),
|
|
126
|
+
unknown: false,
|
|
127
|
+
escaped: false
|
|
128
|
+
};
|
|
129
|
+
cells.push(cell);
|
|
130
|
+
return cell;
|
|
131
|
+
};
|
|
132
|
+
const values = new Map();
|
|
133
|
+
const value = (id) => {
|
|
134
|
+
const found = values.get(id);
|
|
135
|
+
if (found)
|
|
136
|
+
return found;
|
|
137
|
+
const cell = fresh();
|
|
138
|
+
values.set(id, cell);
|
|
139
|
+
return cell;
|
|
140
|
+
};
|
|
141
|
+
const bindings = new Map();
|
|
142
|
+
const binding = (id) => {
|
|
143
|
+
const found = bindings.get(id);
|
|
144
|
+
if (found)
|
|
145
|
+
return found;
|
|
146
|
+
const cell = fresh();
|
|
147
|
+
bindings.set(id, cell);
|
|
148
|
+
return cell;
|
|
149
|
+
};
|
|
150
|
+
const classHeaps = new Map();
|
|
151
|
+
const recordHeaps = new Map();
|
|
152
|
+
const arrayHeaps = new Map();
|
|
153
|
+
const dictionaryHeaps = new Map();
|
|
154
|
+
const recordViews = new WeakMap();
|
|
155
|
+
const adaptedFrames = new Map();
|
|
156
|
+
const transportsCallablePrefix = (from, to, node) => {
|
|
157
|
+
if (!nativeCallablePrefixAdapterMatches(from, to, node))
|
|
158
|
+
return false;
|
|
159
|
+
const source = abiKey(abiOfCallee(from));
|
|
160
|
+
const targets = adaptedFrames.get(source) ?? new Set();
|
|
161
|
+
targets.add(abiKey(abiOfCallee(to)));
|
|
162
|
+
adaptedFrames.set(source, targets);
|
|
163
|
+
return true;
|
|
164
|
+
};
|
|
165
|
+
const methodFallback = (declaration, key) => {
|
|
166
|
+
if (!classMethodOverrideOf(classes, declaration, key) || classPrototypeMethodMutableOf(classes, declaration, key))
|
|
167
|
+
return null;
|
|
168
|
+
const member = classMemberOf(classes, declaration, key);
|
|
169
|
+
return member?.kind === 'method' ? member.method.callable : null;
|
|
170
|
+
};
|
|
171
|
+
for (const layout of classes.values()) {
|
|
172
|
+
const slots = new Map();
|
|
173
|
+
for (const field of layout.nativeStorage?.fields ?? []) {
|
|
174
|
+
const cell = fresh();
|
|
175
|
+
const fallback = methodFallback(layout.declaration, field.key);
|
|
176
|
+
if (fallback) {
|
|
177
|
+
addFunction(cell, fallback);
|
|
178
|
+
const member = classMemberOf(classes, layout.declaration, field.key);
|
|
179
|
+
const source = member?.kind === 'method' ? member.method.representation : undefined;
|
|
180
|
+
if (source && conversions?.nodeFor)
|
|
181
|
+
transportsCallablePrefix(source, field.value, conversions.nodeFor(source, field.value));
|
|
182
|
+
}
|
|
183
|
+
slots.set(field.key, { cell, representation: field.value });
|
|
184
|
+
}
|
|
185
|
+
classHeaps.set(layout.declaration, { declaration: layout.declaration, fields: slots, layoutKey: null, valid: true });
|
|
186
|
+
}
|
|
187
|
+
const operations = bodies.flatMap((body) => [...body.blocks.values()].flatMap((block) => [...block.operations, block.terminator]));
|
|
188
|
+
const producers = new Map();
|
|
189
|
+
const bodyById = new Map();
|
|
190
|
+
const returns = new Map();
|
|
191
|
+
// super() consumes the frame receiver even when the body never spells this
|
|
192
|
+
// and lowering therefore produces no receiver SSA operation.
|
|
193
|
+
const frameReceivers = new Map();
|
|
194
|
+
const parameters = new Map();
|
|
195
|
+
const owner = new Map();
|
|
196
|
+
for (const body of bodies) {
|
|
197
|
+
const id = body.sourceOwner;
|
|
198
|
+
bodyById.set(id, bodyById.has(id) ? null : body);
|
|
199
|
+
returns.set(id, fresh());
|
|
200
|
+
if (body.abi?.receiver)
|
|
201
|
+
frameReceivers.set(id, fresh());
|
|
202
|
+
const inputs = [];
|
|
203
|
+
for (const block of body.blocks.values())
|
|
204
|
+
for (const operation of [...block.operations, block.terminator]) {
|
|
205
|
+
owner.set(operation, id);
|
|
206
|
+
if (operation.kind === 'parameter' || operation.kind === 'receiver')
|
|
207
|
+
inputs.push(operation);
|
|
208
|
+
}
|
|
209
|
+
parameters.set(id, inputs);
|
|
210
|
+
}
|
|
211
|
+
for (const operation of operations) {
|
|
212
|
+
const result = resultOfIrOperation(operation);
|
|
213
|
+
if (result)
|
|
214
|
+
producers.set(result.id, operation);
|
|
215
|
+
}
|
|
216
|
+
const recordHeapOf = (representation) => {
|
|
217
|
+
if (representation.kind !== 'record' && representation.kind !== 'record-with-index' && representation.kind !== 'native-record-ref')
|
|
218
|
+
return null;
|
|
219
|
+
const known = recordViews.get(representation);
|
|
220
|
+
if (known)
|
|
221
|
+
return known;
|
|
222
|
+
const layout = representation.kind === 'native-record-ref'
|
|
223
|
+
? representation.native === null
|
|
224
|
+
? deriver?.layoutOf(representation.shapeId)
|
|
225
|
+
: null
|
|
226
|
+
: representation;
|
|
227
|
+
const fields = layout?.kind === 'record' || layout?.kind === 'record-with-index' ? layout.fields : [];
|
|
228
|
+
const valid = layout?.kind === 'record' && layout.accessors.length === 0;
|
|
229
|
+
const layoutKey = layout ? representationKey(layout) : null;
|
|
230
|
+
let heap = recordHeaps.get(representation.shapeId);
|
|
231
|
+
if (!heap) {
|
|
232
|
+
heap = { declaration: null, fields: new Map(), layoutKey, valid };
|
|
233
|
+
recordHeaps.set(representation.shapeId, heap);
|
|
234
|
+
}
|
|
235
|
+
else if (!valid || heap.layoutKey !== layoutKey) {
|
|
236
|
+
heap.valid = false;
|
|
237
|
+
slotCache.clear();
|
|
238
|
+
}
|
|
239
|
+
for (const field of fields)
|
|
240
|
+
if (!heap.fields.has(field.key))
|
|
241
|
+
heap.fields.set(field.key, { cell: fresh(), representation: field.value });
|
|
242
|
+
recordViews.set(representation, heap);
|
|
243
|
+
return heap;
|
|
244
|
+
};
|
|
245
|
+
const arrayHeapOf = (representation) => {
|
|
246
|
+
// Extension views share element storage. Indexing by the whole array
|
|
247
|
+
// representation would let writes through one view evade another's proof.
|
|
248
|
+
const key = representationKey(representation.element);
|
|
249
|
+
let heap = arrayHeaps.get(key);
|
|
250
|
+
if (!heap) {
|
|
251
|
+
heap = {
|
|
252
|
+
declaration: null,
|
|
253
|
+
fields: new Map([['', { cell: fresh(), representation: representation.element }]]),
|
|
254
|
+
layoutKey: null,
|
|
255
|
+
valid: representation.ownership === 'shared-refcount'
|
|
256
|
+
};
|
|
257
|
+
arrayHeaps.set(key, heap);
|
|
258
|
+
}
|
|
259
|
+
else if (representation.ownership !== 'shared-refcount')
|
|
260
|
+
heap.valid = false;
|
|
261
|
+
return heap;
|
|
262
|
+
};
|
|
263
|
+
const nativeReferences = (representation) => {
|
|
264
|
+
if (representation.kind === 'class-ref') {
|
|
265
|
+
const heap = classHeaps.get(representation.declaration);
|
|
266
|
+
return { heaps: heap ? [heap] : [], complete: heap !== undefined };
|
|
267
|
+
}
|
|
268
|
+
if (representation.kind === 'optional')
|
|
269
|
+
return nativeReferences(representation.payload);
|
|
270
|
+
if (representation.kind === 'borrowed-ref')
|
|
271
|
+
return nativeReferences(representation.referent);
|
|
272
|
+
if (representation.kind === 'tagged-union') {
|
|
273
|
+
const arms = representation.arms.map((arm) => nativeReferences(arm.value));
|
|
274
|
+
return { heaps: arms.flatMap((arm) => arm.heaps), complete: arms.every((arm) => arm.complete) };
|
|
275
|
+
}
|
|
276
|
+
if (representation.kind === 'dictionary') {
|
|
277
|
+
const key = representationKey(representation.value);
|
|
278
|
+
let heap = dictionaryHeaps.get(key);
|
|
279
|
+
if (!heap) {
|
|
280
|
+
heap = {
|
|
281
|
+
declaration: null,
|
|
282
|
+
fields: new Map([['', { cell: fresh(), representation: representation.value }]]),
|
|
283
|
+
layoutKey: null,
|
|
284
|
+
valid: representation.ownership === 'shared-refcount'
|
|
285
|
+
};
|
|
286
|
+
dictionaryHeaps.set(key, heap);
|
|
287
|
+
}
|
|
288
|
+
else if (representation.ownership !== 'shared-refcount')
|
|
289
|
+
heap.valid = false;
|
|
290
|
+
return { heaps: [heap], complete: heap.valid };
|
|
291
|
+
}
|
|
292
|
+
if (representation.kind === 'array-object') {
|
|
293
|
+
const heap = arrayHeapOf(representation);
|
|
294
|
+
return { heaps: [heap], complete: heap.valid };
|
|
295
|
+
}
|
|
296
|
+
const heap = recordHeapOf(representation);
|
|
297
|
+
return heap
|
|
298
|
+
? { heaps: [heap], complete: heap.valid }
|
|
299
|
+
: { heaps: [], complete: representation.kind === 'null' || representation.kind === 'undefined' };
|
|
300
|
+
};
|
|
301
|
+
const related = (a, b) => a === b || extendsClass(classes, a, b) || extendsClass(classes, b, a);
|
|
302
|
+
const families = new WeakMap();
|
|
303
|
+
const familyOf = (heap) => {
|
|
304
|
+
const known = families.get(heap);
|
|
305
|
+
if (known)
|
|
306
|
+
return known;
|
|
307
|
+
// All class summaries are installed before solving. Field validity may
|
|
308
|
+
// change, but class ancestry and allocation identity do not.
|
|
309
|
+
const family = heap.template !== undefined || heap.declaration === null
|
|
310
|
+
? [heap]
|
|
311
|
+
: [...classHeaps.values()].filter((candidate) => candidate.declaration !== null && related(heap.declaration, candidate.declaration));
|
|
312
|
+
families.set(heap, family);
|
|
313
|
+
return family;
|
|
314
|
+
};
|
|
315
|
+
const keyOf = (operand) => {
|
|
316
|
+
const producer = producers.get(operand.value);
|
|
317
|
+
return producer?.kind === 'constant' && producer.literal === 'string' ? producer.text : null;
|
|
318
|
+
};
|
|
319
|
+
const slotCache = new Map();
|
|
320
|
+
const slotTemplatesOf = (receiver, key) => {
|
|
321
|
+
// Carrier keys can be large. Nest the property map instead of serializing
|
|
322
|
+
// the complete carrier into a new JSON string on every solver visit.
|
|
323
|
+
const receiverKey = representationKey(receiver);
|
|
324
|
+
const cached = slotCache.get(receiverKey);
|
|
325
|
+
if (cached?.has(key))
|
|
326
|
+
return cached.get(key);
|
|
327
|
+
const remember = (answer) => {
|
|
328
|
+
let slots = slotCache.get(receiverKey);
|
|
329
|
+
if (!slots)
|
|
330
|
+
slotCache.set(receiverKey, (slots = new Map()));
|
|
331
|
+
slots.set(key, answer);
|
|
332
|
+
return answer;
|
|
333
|
+
};
|
|
334
|
+
const { heaps, complete } = nativeReferences(receiver);
|
|
335
|
+
const family = [...new Set(heaps.flatMap(familyOf))];
|
|
336
|
+
if (!complete ||
|
|
337
|
+
heaps.length === 0 ||
|
|
338
|
+
heaps.some((heap) => !heap.valid || !heap.fields.has(key)) ||
|
|
339
|
+
family.some((heap) => {
|
|
340
|
+
if (heap.declaration === null)
|
|
341
|
+
return !heap.valid;
|
|
342
|
+
const layout = classes.get(heap.declaration);
|
|
343
|
+
const member = classMemberOf(classes, layout.declaration, key);
|
|
344
|
+
return (layout.nativeStorage === undefined ||
|
|
345
|
+
layout.nativeBase !== null ||
|
|
346
|
+
(member !== null && member.kind !== 'field' && methodFallback(layout.declaration, key) === null));
|
|
347
|
+
})) {
|
|
348
|
+
return remember(null);
|
|
349
|
+
}
|
|
350
|
+
const sources = family.flatMap((heap) => {
|
|
351
|
+
const slot = heap.fields.get(key);
|
|
352
|
+
return slot ? [slot.cell] : [];
|
|
353
|
+
});
|
|
354
|
+
return remember(sources);
|
|
355
|
+
};
|
|
356
|
+
const seedHeaps = (cell, representation) => {
|
|
357
|
+
for (const heap of nativeReferences(representation).heaps)
|
|
358
|
+
addHeap(cell, heap);
|
|
359
|
+
};
|
|
360
|
+
const external = (cell, representation, reason = 'unattributed-input') => {
|
|
361
|
+
markUnknown(cell, reason);
|
|
362
|
+
seedHeaps(cell, representation);
|
|
363
|
+
};
|
|
364
|
+
const escape = (cell, reason) => {
|
|
365
|
+
markEscaped(cell, reason);
|
|
366
|
+
};
|
|
367
|
+
const link = (from, to) => {
|
|
368
|
+
if (from.edges.get(to) === null)
|
|
369
|
+
return;
|
|
370
|
+
from.edges.set(to, null);
|
|
371
|
+
to.incoming.add(from);
|
|
372
|
+
changed(from);
|
|
373
|
+
};
|
|
374
|
+
const linkPayload = (from, to, representations) => {
|
|
375
|
+
const references = representations.map(nativeReferences);
|
|
376
|
+
// Only a sealed payload-preserving conversion calls this. Layouts bound
|
|
377
|
+
// which input allocations can survive its native tag/identity selection;
|
|
378
|
+
// they never create an origin for an allocation not present in the input.
|
|
379
|
+
if (references.some((reference) => !reference.complete) || from.edges.has(to))
|
|
380
|
+
link(from, to);
|
|
381
|
+
else {
|
|
382
|
+
from.edges.set(to, references.flatMap((reference) => reference.heaps));
|
|
383
|
+
to.incoming.add(from);
|
|
384
|
+
changed(from);
|
|
385
|
+
}
|
|
386
|
+
};
|
|
387
|
+
const heapAdmitted = (heap, allowed) => {
|
|
388
|
+
const template = heap.template ?? heap;
|
|
389
|
+
return allowed.some((target) => template === target ||
|
|
390
|
+
(heap.declaration !== null &&
|
|
391
|
+
target.declaration !== null &&
|
|
392
|
+
(heap.declaration === target.declaration || extendsClass(classes, heap.declaration, target.declaration))));
|
|
393
|
+
};
|
|
394
|
+
const allocations = new Map();
|
|
395
|
+
const seedAllocation = (id, representation) => {
|
|
396
|
+
const known = allocations.get(id);
|
|
397
|
+
if (known)
|
|
398
|
+
return known;
|
|
399
|
+
const heaps = nativeReferences(representation).heaps.map((template) => {
|
|
400
|
+
const fields = new Map();
|
|
401
|
+
const templates = template.declaration === null
|
|
402
|
+
? [template]
|
|
403
|
+
: familyOf(template).filter((candidate) => candidate.declaration !== null &&
|
|
404
|
+
(candidate.declaration === template.declaration || extendsClass(classes, template.declaration, candidate.declaration)));
|
|
405
|
+
for (const parent of [...templates].reverse())
|
|
406
|
+
for (const [key, slot] of parent.fields)
|
|
407
|
+
fields.set(key, { cell: fresh(), representation: slot.representation });
|
|
408
|
+
for (const [key, slot] of template.fields)
|
|
409
|
+
fields.set(key, { cell: fresh(), representation: slot.representation });
|
|
410
|
+
const heap = { declaration: template.declaration, layoutKey: template.layoutKey, valid: template.valid, template, fields };
|
|
411
|
+
// A fresh instance owns no override yet. Seed its prototype alternative
|
|
412
|
+
// before stores add replacement bodies; otherwise a later assignment
|
|
413
|
+
// would falsely prove that all reads, including earlier ones, name it.
|
|
414
|
+
if (heap.declaration !== null)
|
|
415
|
+
for (const [key, slot] of fields) {
|
|
416
|
+
const fallback = methodFallback(heap.declaration, key);
|
|
417
|
+
if (fallback)
|
|
418
|
+
addFunction(slot.cell, fallback);
|
|
419
|
+
}
|
|
420
|
+
if (heap.declaration !== null)
|
|
421
|
+
for (const parent of templates)
|
|
422
|
+
for (const field of classes.get(parent.declaration).fields) {
|
|
423
|
+
const returned = field.initializer === null ? undefined : returns.get(field.initializer);
|
|
424
|
+
const slot = fields.get(field.key);
|
|
425
|
+
if (returned && slot)
|
|
426
|
+
link(returned, slot.cell);
|
|
427
|
+
}
|
|
428
|
+
return heap;
|
|
429
|
+
});
|
|
430
|
+
allocations.set(id, heaps);
|
|
431
|
+
for (const heap of heaps)
|
|
432
|
+
addHeap(value(id), heap);
|
|
433
|
+
return heaps;
|
|
434
|
+
};
|
|
435
|
+
const slotsOf = (receiver, key) => {
|
|
436
|
+
if (slotTemplatesOf(receiver.representation, key) === null)
|
|
437
|
+
return null;
|
|
438
|
+
const slots = [];
|
|
439
|
+
for (const heap of value(receiver.value).heaps) {
|
|
440
|
+
if (!heap.valid || heap.template?.valid === false || !heap.fields.has(key))
|
|
441
|
+
return null;
|
|
442
|
+
slots.push(heap.fields.get(key).cell);
|
|
443
|
+
}
|
|
444
|
+
return slots;
|
|
445
|
+
};
|
|
446
|
+
// Field edges wait for receiver origins. A type supplies a layout, never an
|
|
447
|
+
// alias to every allocation of that type. The same worklist handles stores,
|
|
448
|
+
// loads and array copies as new call/return origins arrive.
|
|
449
|
+
const heapEffects = [];
|
|
450
|
+
const heapEffect = (operation, apply, reject) => {
|
|
451
|
+
heapEffects.push({ operation, apply, ...(reject ? { reject } : {}) });
|
|
452
|
+
};
|
|
453
|
+
const citedEntriesOf = (operation) => new Set([
|
|
454
|
+
...(operation.family ?? []).map((member) => member.functionId),
|
|
455
|
+
...(operation.target?.kind === 'direct' ? [operation.target.functionId] : []),
|
|
456
|
+
...(operation.closedCallee === undefined
|
|
457
|
+
? []
|
|
458
|
+
: operation.closedCallee.kind === 'exact'
|
|
459
|
+
? [operation.closedCallee.functionId]
|
|
460
|
+
: operation.closedCallee.functionIds)
|
|
461
|
+
]);
|
|
462
|
+
const constructionEntriesOf = (layout, seen = new Set()) => {
|
|
463
|
+
if (seen.has(layout.declaration))
|
|
464
|
+
return [];
|
|
465
|
+
seen.add(layout.declaration);
|
|
466
|
+
const constructed = constructedBaseOf(layout);
|
|
467
|
+
const base = constructed === null ? undefined : classes.get(constructed);
|
|
468
|
+
return [
|
|
469
|
+
...(layout.constructor === null ? [] : [layout.constructor]),
|
|
470
|
+
...layout.fields.flatMap((field) => (field.initializer === null ? [] : [field.initializer])),
|
|
471
|
+
...(base ? constructionEntriesOf(base, seen) : [])
|
|
472
|
+
];
|
|
473
|
+
};
|
|
474
|
+
const externalEntry = (id, reason) => {
|
|
475
|
+
enter(id);
|
|
476
|
+
const receiver = frameReceivers.get(id);
|
|
477
|
+
const representation = bodyById.get(id)?.abi?.receiver;
|
|
478
|
+
if (receiver && representation)
|
|
479
|
+
external(receiver, representation, reason);
|
|
480
|
+
for (const input of parameters.get(id) ?? [])
|
|
481
|
+
external(value(input.result.id), input.result.representation, reason);
|
|
482
|
+
const returned = returns.get(id);
|
|
483
|
+
if (returned)
|
|
484
|
+
escape(returned, reason);
|
|
485
|
+
};
|
|
486
|
+
const untrusted = (operation) => {
|
|
487
|
+
const reason = `${operation.kind}:${operation.lineage}`;
|
|
488
|
+
const operands = operation.kind === 'call'
|
|
489
|
+
? [operation.callee, ...(operation.receiver ? [operation.receiver] : []), ...receivedCallArguments(operation)]
|
|
490
|
+
: operandsOfIrOperation(operation);
|
|
491
|
+
for (const operand of operands)
|
|
492
|
+
escape(value(operand.value), reason);
|
|
493
|
+
// super() also receives this even though the IR operation lists only
|
|
494
|
+
// explicit arguments. An unmodeled base entry may publish that receiver.
|
|
495
|
+
if (operation.kind === 'super-initialize') {
|
|
496
|
+
const receiver = frameReceivers.get(owner.get(operation));
|
|
497
|
+
if (receiver)
|
|
498
|
+
escape(receiver, reason);
|
|
499
|
+
for (const input of parameters.get(owner.get(operation)) ?? [])
|
|
500
|
+
if (input.kind === 'receiver')
|
|
501
|
+
escape(value(input.result.id), reason);
|
|
502
|
+
for (const layout of classes.values())
|
|
503
|
+
if (layout.constructor === owner.get(operation))
|
|
504
|
+
for (const id of constructionEntriesOf(layout))
|
|
505
|
+
externalEntry(id, reason);
|
|
506
|
+
}
|
|
507
|
+
if (operation.kind === 'construct') {
|
|
508
|
+
const targets = operation.target.kind === 'exact'
|
|
509
|
+
? [operation.target.target]
|
|
510
|
+
: operation.target.kind === 'closed-family'
|
|
511
|
+
? operation.target.targets
|
|
512
|
+
: [];
|
|
513
|
+
for (const target of targets) {
|
|
514
|
+
const layouts = [...classes.values()].filter((layout) => target.kind === 'function' ? layout.constructor === target.functionId : layout.declaration === target.classDeclaration);
|
|
515
|
+
for (const layout of layouts)
|
|
516
|
+
for (const id of constructionEntriesOf(layout))
|
|
517
|
+
externalEntry(id, reason);
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
const result = resultOfIrOperation(operation);
|
|
521
|
+
if (result)
|
|
522
|
+
external(value(result.id), result.representation, reason);
|
|
523
|
+
// A physical/semantic citation can enter a body even when its callable SSA
|
|
524
|
+
// value has no modeled provenance. Preserve that entry without pretending
|
|
525
|
+
// the unknown caller's arguments were part of a closed native frame.
|
|
526
|
+
if (operation.kind === 'call')
|
|
527
|
+
for (const id of citedEntriesOf(operation))
|
|
528
|
+
externalEntry(id, reason);
|
|
529
|
+
};
|
|
530
|
+
const called = new Set();
|
|
531
|
+
// Retaining an allocation or native prototype method does not execute it.
|
|
532
|
+
// Calls and publications open those bodies through the same provenance
|
|
533
|
+
// lattice. Implicit accessors, host entries and ambiguous variants remain
|
|
534
|
+
// roots; an unentered recursive cycle stays dormant.
|
|
535
|
+
const allocated = new Set(operations.flatMap((operation) => (operation.kind === 'allocate-callable' ? [operation.functionId] : [])));
|
|
536
|
+
const instanceMethods = new Set();
|
|
537
|
+
const instanceAccessors = new Set();
|
|
538
|
+
for (const layout of classes.values()) {
|
|
539
|
+
const family = familyOf(classHeaps.get(layout.declaration));
|
|
540
|
+
if (family.some((heap) => heap.declaration !== null && classes.get(heap.declaration)?.nativeBase !== null))
|
|
541
|
+
continue;
|
|
542
|
+
for (const method of layout.methods)
|
|
543
|
+
if (method.callable !== null)
|
|
544
|
+
instanceMethods.add(method.callable);
|
|
545
|
+
for (const accessor of layout.accessors)
|
|
546
|
+
for (const id of [accessor.getter, accessor.setter])
|
|
547
|
+
if (id !== null)
|
|
548
|
+
instanceAccessors.add(id);
|
|
549
|
+
}
|
|
550
|
+
const implicitEntries = new Set();
|
|
551
|
+
const constructionBodies = new Set();
|
|
552
|
+
const allocatedClasses = new Set(operations.flatMap((operation) => (operation.kind === 'allocate-constructor' ? [operation.declaration] : [])));
|
|
553
|
+
for (const layout of classes.values()) {
|
|
554
|
+
if (!allocatedClasses.has(layout.declaration) || layout.nativeBase !== null || layout.instance === null)
|
|
555
|
+
continue;
|
|
556
|
+
const constructor = layout.constructor === null ? null : bodyById.get(layout.constructor);
|
|
557
|
+
if (layout.constructor !== null && (!constructor || !classConstructorBodyMatches(layout, constructor)))
|
|
558
|
+
continue;
|
|
559
|
+
for (const id of [layout.constructor, ...layout.fields.map((field) => field.initializer)])
|
|
560
|
+
if (id !== null && bodyById.get(id)?.abi)
|
|
561
|
+
constructionBodies.add(id);
|
|
562
|
+
}
|
|
563
|
+
const implicitAccessorEntries = new Set();
|
|
564
|
+
const implicitEntry = (id) => {
|
|
565
|
+
if (id !== null)
|
|
566
|
+
implicitEntries.add(id);
|
|
567
|
+
};
|
|
568
|
+
const representations = [];
|
|
569
|
+
for (const layout of classes.values()) {
|
|
570
|
+
if (layout.constructor !== null && !constructionBodies.has(layout.constructor))
|
|
571
|
+
implicitEntry(layout.constructor);
|
|
572
|
+
for (const field of layout.fields)
|
|
573
|
+
if (field.initializer !== null && !constructionBodies.has(field.initializer))
|
|
574
|
+
implicitEntry(field.initializer);
|
|
575
|
+
for (const field of layout.staticFields)
|
|
576
|
+
implicitEntry(field.initializer);
|
|
577
|
+
for (const method of layout.methods)
|
|
578
|
+
if (method.callable === null || !instanceMethods.has(method.callable))
|
|
579
|
+
implicitEntry(method.callable);
|
|
580
|
+
for (const method of layout.staticMethods)
|
|
581
|
+
implicitEntry(method.callable);
|
|
582
|
+
for (const accessor of layout.accessors)
|
|
583
|
+
for (const id of [accessor.getter, accessor.setter])
|
|
584
|
+
if (id !== null && !instanceAccessors.has(id)) {
|
|
585
|
+
implicitEntry(id);
|
|
586
|
+
implicitAccessorEntries.add(id);
|
|
587
|
+
}
|
|
588
|
+
for (const accessor of layout.staticAccessors)
|
|
589
|
+
for (const id of [accessor.getter, accessor.setter])
|
|
590
|
+
if (id !== null) {
|
|
591
|
+
implicitEntry(id);
|
|
592
|
+
implicitAccessorEntries.add(id);
|
|
593
|
+
}
|
|
594
|
+
if (layout.instance)
|
|
595
|
+
representations.push(layout.instance);
|
|
596
|
+
for (const field of layout.nativeStorage?.fields ?? [])
|
|
597
|
+
representations.push(field.value);
|
|
598
|
+
}
|
|
599
|
+
for (const operation of operations) {
|
|
600
|
+
for (const operand of operandsOfIrOperation(operation))
|
|
601
|
+
representations.push(operand.representation);
|
|
602
|
+
const result = resultOfIrOperation(operation);
|
|
603
|
+
if (result)
|
|
604
|
+
representations.push(result.representation);
|
|
605
|
+
}
|
|
606
|
+
const visited = new Set();
|
|
607
|
+
let implicitEntriesComplete = true;
|
|
608
|
+
for (const representation of representations)
|
|
609
|
+
for (const carrier of walkRepresentation(representation, visited)) {
|
|
610
|
+
if (carrier.kind === 'function' &&
|
|
611
|
+
!instanceMethods.has(carrier.functionId) &&
|
|
612
|
+
!instanceAccessors.has(carrier.functionId) &&
|
|
613
|
+
!constructionBodies.has(carrier.functionId))
|
|
614
|
+
implicitEntry(carrier.functionId);
|
|
615
|
+
if (carrier.kind === 'function-family' || carrier.kind === 'function-value-family')
|
|
616
|
+
for (const id of carrier.members)
|
|
617
|
+
if (!instanceMethods.has(id) && !instanceAccessors.has(id) && !constructionBodies.has(id))
|
|
618
|
+
implicitEntry(id);
|
|
619
|
+
const layout = carrier.kind === 'native-record-ref' ? deriver?.layoutOf(carrier.shapeId) : carrier;
|
|
620
|
+
if (carrier.kind === 'native-record-ref') {
|
|
621
|
+
if (layout)
|
|
622
|
+
representations.push(layout);
|
|
623
|
+
else
|
|
624
|
+
implicitEntriesComplete = false;
|
|
625
|
+
}
|
|
626
|
+
if (layout?.kind !== 'record')
|
|
627
|
+
continue;
|
|
628
|
+
for (const accessor of layout.accessors) {
|
|
629
|
+
implicitEntry(accessor.getter);
|
|
630
|
+
implicitEntry(accessor.setter);
|
|
631
|
+
if (accessor.getter)
|
|
632
|
+
implicitAccessorEntries.add(accessor.getter);
|
|
633
|
+
if (accessor.setter)
|
|
634
|
+
implicitAccessorEntries.add(accessor.setter);
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
const deferred = new Set([...new Set([...allocated, ...instanceMethods, ...instanceAccessors, ...constructionBodies])].filter((id) => {
|
|
638
|
+
const body = bodyById.get(id);
|
|
639
|
+
return implicitEntriesComplete && body?.abi != null && body.construct === null && !implicitEntries.has(id);
|
|
640
|
+
}));
|
|
641
|
+
const entered = new Set();
|
|
642
|
+
const pendingBodies = [];
|
|
643
|
+
const enter = (id) => {
|
|
644
|
+
const body = bodyById.get(id);
|
|
645
|
+
if (!body || entered.has(body))
|
|
646
|
+
return;
|
|
647
|
+
entered.add(body);
|
|
648
|
+
revision++;
|
|
649
|
+
pendingBodies.push(body);
|
|
650
|
+
};
|
|
651
|
+
for (const body of bodies) {
|
|
652
|
+
if (deferred.has(body.sourceOwner))
|
|
653
|
+
continue;
|
|
654
|
+
entered.add(body);
|
|
655
|
+
pendingBodies.push(body);
|
|
656
|
+
}
|
|
657
|
+
const invoke = (id, args, receiver, result) => {
|
|
658
|
+
if (!called.has(id))
|
|
659
|
+
revision++;
|
|
660
|
+
called.add(id);
|
|
661
|
+
enter(id);
|
|
662
|
+
const frameReceiver = frameReceivers.get(id);
|
|
663
|
+
if (receiver && frameReceiver)
|
|
664
|
+
link(receiver, frameReceiver);
|
|
665
|
+
for (const parameter of parameters.get(id) ?? []) {
|
|
666
|
+
const incoming = parameter.kind === 'receiver' ? receiver : args[parameter.ordinal] ? value(args[parameter.ordinal].value) : null;
|
|
667
|
+
if (incoming)
|
|
668
|
+
link(incoming, value(parameter.result.id));
|
|
669
|
+
}
|
|
670
|
+
const returned = returns.get(id);
|
|
671
|
+
if (result && returned)
|
|
672
|
+
link(returned, result);
|
|
673
|
+
};
|
|
674
|
+
const pendingCalls = [];
|
|
675
|
+
const fieldReads = [];
|
|
676
|
+
const seedMethodValue = (cell, representation) => {
|
|
677
|
+
if (representation.kind === 'optional')
|
|
678
|
+
seedMethodValue(cell, representation.payload);
|
|
679
|
+
else if (representation.kind === 'borrowed-ref')
|
|
680
|
+
seedMethodValue(cell, representation.referent);
|
|
681
|
+
else if (representation.kind === 'tagged-union')
|
|
682
|
+
for (const arm of representation.arms)
|
|
683
|
+
seedMethodValue(cell, arm.value);
|
|
684
|
+
else if (representation.kind === 'function') {
|
|
685
|
+
if (instanceMethods.has(representation.functionId))
|
|
686
|
+
addFunction(cell, representation.functionId);
|
|
687
|
+
}
|
|
688
|
+
else if (representation.kind === 'function-family' || representation.kind === 'function-value-family')
|
|
689
|
+
for (const id of representation.members)
|
|
690
|
+
if (instanceMethods.has(id))
|
|
691
|
+
addFunction(cell, id);
|
|
692
|
+
};
|
|
693
|
+
const processOperation = (operation) => {
|
|
694
|
+
const result = resultOfIrOperation(operation);
|
|
695
|
+
// A method identity in a carrier describes the value, not an invocation.
|
|
696
|
+
// Publish it when that value is produced/used so ordinary escape edges also
|
|
697
|
+
// cover detached methods without rooting every method in every layout.
|
|
698
|
+
for (const operand of operandsOfIrOperation(operation))
|
|
699
|
+
seedMethodValue(value(operand.value), operand.representation);
|
|
700
|
+
if (result)
|
|
701
|
+
seedMethodValue(value(result.id), result.representation);
|
|
702
|
+
if (operation.kind === 'call' && operation.fixedDataDefinition?.nativeFieldProtocol === 'unused') {
|
|
703
|
+
const recipe = operation.fixedDataDefinition;
|
|
704
|
+
const target = operation.arguments[0];
|
|
705
|
+
const descriptor = operation.arguments[2];
|
|
706
|
+
const node = conversions?.nodeById(recipe.conversion);
|
|
707
|
+
if (!target ||
|
|
708
|
+
!descriptor ||
|
|
709
|
+
!node ||
|
|
710
|
+
representationKey(target.representation) !== recipe.target ||
|
|
711
|
+
representationKey(descriptor.representation) !== recipe.descriptor ||
|
|
712
|
+
representationKey(node.source) !== representationKey(recipe.value.value) ||
|
|
713
|
+
representationKey(node.target) !== representationKey(recipe.held)) {
|
|
714
|
+
untrusted(operation);
|
|
715
|
+
return;
|
|
716
|
+
}
|
|
717
|
+
// This is the same sealed native update reflection and emission consume,
|
|
718
|
+
// not a call to an unknown implementation of Object.defineProperty.
|
|
719
|
+
heapEffect(operation, () => {
|
|
720
|
+
const targets = slotsOf(target, recipe.field.key);
|
|
721
|
+
const sources = slotsOf(descriptor, recipe.value.key);
|
|
722
|
+
if (targets === null || sources === null) {
|
|
723
|
+
untrusted(operation);
|
|
724
|
+
return true;
|
|
725
|
+
}
|
|
726
|
+
for (const destination of targets)
|
|
727
|
+
if (nativePayloadTransportMatches(node.source, node.target, node))
|
|
728
|
+
for (const source of sources)
|
|
729
|
+
linkPayload(source, destination, [node.target]);
|
|
730
|
+
else if (representationKey(node.source) === representationKey(node.target) ||
|
|
731
|
+
nativeClassReferenceTransportMatches(node.source, node.target, node) ||
|
|
732
|
+
transportsCallablePrefix(node.source, node.target, node))
|
|
733
|
+
for (const source of sources)
|
|
734
|
+
link(source, destination);
|
|
735
|
+
else
|
|
736
|
+
external(destination, recipe.held, 'unmodeled-native-definition-value');
|
|
737
|
+
return targets.length > 0 && sources.length > 0;
|
|
738
|
+
});
|
|
739
|
+
if (operation.result)
|
|
740
|
+
link(value(target.value), value(operation.result.id));
|
|
741
|
+
for (const operand of operandsOfIrOperation(operation))
|
|
742
|
+
if (!producers.has(operand.value))
|
|
743
|
+
external(value(operand.value), operand.representation);
|
|
744
|
+
return;
|
|
745
|
+
}
|
|
746
|
+
if (nativeDictionaryTransportOf(operation)) {
|
|
747
|
+
if (operation.kind === 'allocate-record' || operation.kind === 'allocate-ordinary-object') {
|
|
748
|
+
const heap = seedAllocation(operation.result.id, operation.result.representation)[0];
|
|
749
|
+
const entries = heap?.fields.get('')?.cell;
|
|
750
|
+
if (!entries)
|
|
751
|
+
untrusted(operation);
|
|
752
|
+
else if (operation.kind === 'allocate-record')
|
|
753
|
+
for (const field of operation.fields)
|
|
754
|
+
link(value(field.value.value), entries);
|
|
755
|
+
}
|
|
756
|
+
else if (operation.kind === 'get' || operation.kind === 'set' || operation.kind === 'define-own-property') {
|
|
757
|
+
if (operation.kind === 'get')
|
|
758
|
+
fieldReads.push(operation);
|
|
759
|
+
heapEffect(operation, () => {
|
|
760
|
+
const slots = slotsOf(operation.receiver, '');
|
|
761
|
+
if (slots === null) {
|
|
762
|
+
untrusted(operation);
|
|
763
|
+
return true;
|
|
764
|
+
}
|
|
765
|
+
for (const slot of slots)
|
|
766
|
+
if (operation.kind === 'get')
|
|
767
|
+
link(slot, value(operation.result.id));
|
|
768
|
+
else
|
|
769
|
+
link(value(operation.value.value), slot);
|
|
770
|
+
return slots.length > 0;
|
|
771
|
+
});
|
|
772
|
+
// Stores thread the container onward. The assignment expression's RHS
|
|
773
|
+
// already has its own SSA value, as for native class accessor stores.
|
|
774
|
+
if (operation.kind !== 'get' && operation.result)
|
|
775
|
+
if (representationKey(operation.result.representation) === representationKey(operation.receiver.representation))
|
|
776
|
+
link(value(operation.receiver.value), value(operation.result.id));
|
|
777
|
+
else
|
|
778
|
+
external(value(operation.result.id), operation.result.representation, 'unmodeled-dictionary-store-result');
|
|
779
|
+
}
|
|
780
|
+
// Deletion and existence queries only inspect native entry metadata.
|
|
781
|
+
for (const operand of operandsOfIrOperation(operation))
|
|
782
|
+
if (!producers.has(operand.value))
|
|
783
|
+
external(value(operand.value), operand.representation);
|
|
784
|
+
return;
|
|
785
|
+
}
|
|
786
|
+
if (operation.kind === 'get' || operation.kind === 'set') {
|
|
787
|
+
const entry = nativeClassAccessorEntryOf(operation, keyOf(operation.key), classes, (id) => bodyById.get(id), conversions);
|
|
788
|
+
if (entry) {
|
|
789
|
+
if (operation.kind === 'get')
|
|
790
|
+
fieldReads.push(operation);
|
|
791
|
+
invoke(entry.functionId, entry.arguments, value(operation.receiver.value), operation.kind === 'get' ? value(operation.result.id) : null);
|
|
792
|
+
if (operation.kind === 'set' && operation.result) {
|
|
793
|
+
// A lowered property store threads the receiver onward; the source
|
|
794
|
+
// assignment expression already retains its RHS in a separate SSA.
|
|
795
|
+
const source = representationKey(operation.result.representation) === representationKey(operation.receiver.representation)
|
|
796
|
+
? operation.receiver
|
|
797
|
+
: null;
|
|
798
|
+
if (source)
|
|
799
|
+
link(value(source.value), value(operation.result.id));
|
|
800
|
+
else
|
|
801
|
+
external(value(operation.result.id), operation.result.representation, 'unmodeled-setter-result');
|
|
802
|
+
}
|
|
803
|
+
for (const operand of operandsOfIrOperation(operation))
|
|
804
|
+
if (!producers.has(operand.value))
|
|
805
|
+
external(value(operand.value), operand.representation);
|
|
806
|
+
return;
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
if (nativeSequenceTransportOf(operation)) {
|
|
810
|
+
if (operation.kind === 'get-iterator') {
|
|
811
|
+
const carried = operation.receiver.representation;
|
|
812
|
+
const source = carried.kind === 'optional' ? carried.payload : carried;
|
|
813
|
+
if (source.kind === 'array-object' || source.kind === 'iterator' || source.kind === 'record')
|
|
814
|
+
// The cursor retains this allocation's storage, not every container
|
|
815
|
+
// with the same element type. Publication of the cursor still flows
|
|
816
|
+
// back to its source, just as publication of an ordinary alias does.
|
|
817
|
+
link(value(operation.receiver.value), value(operation.result.id));
|
|
818
|
+
else
|
|
819
|
+
external(value(operation.result.id), operation.result.representation, 'unmodeled-native-sequence-storage');
|
|
820
|
+
}
|
|
821
|
+
else if (operation.kind === 'iterator-next') {
|
|
822
|
+
const output = value(operation.result.id);
|
|
823
|
+
const unknownResult = () => external(output, operation.result.representation, 'unmodeled-native-sequence-element');
|
|
824
|
+
heapEffect(operation, () => {
|
|
825
|
+
const cursor = value(operation.iterator.value);
|
|
826
|
+
if (cursor.unknown)
|
|
827
|
+
unknownResult();
|
|
828
|
+
for (const heap of cursor.heaps) {
|
|
829
|
+
if (!heap.valid) {
|
|
830
|
+
unknownResult();
|
|
831
|
+
continue;
|
|
832
|
+
}
|
|
833
|
+
const elements = heap.fields.has('') ? [heap.fields.get('')] : [...heap.fields.values()];
|
|
834
|
+
for (const element of elements)
|
|
835
|
+
link(element.cell, output);
|
|
836
|
+
}
|
|
837
|
+
return cursor.unknown || cursor.heaps.size > 0;
|
|
838
|
+
}, unknownResult);
|
|
839
|
+
}
|
|
840
|
+
// Native stepping/metadata inspection cannot invoke an unknown getter.
|
|
841
|
+
// A missing element origin loses only the result's identity, not the
|
|
842
|
+
// identities of every method stored on the source's objects.
|
|
843
|
+
return;
|
|
844
|
+
}
|
|
845
|
+
switch (operation.kind) {
|
|
846
|
+
case 'bind-callable':
|
|
847
|
+
if (operation.sourceFunctionId !== null)
|
|
848
|
+
addFunction(value(operation.source.value), operation.sourceFunctionId);
|
|
849
|
+
untrusted(operation);
|
|
850
|
+
break;
|
|
851
|
+
case 'allocate-callable':
|
|
852
|
+
addFunction(value(operation.result.id), operation.functionId);
|
|
853
|
+
// An ordinary constructor's implicit receiver is not its void return
|
|
854
|
+
// cell. Publication still exposes instances created by external callers.
|
|
855
|
+
if (bodyById.get(operation.functionId)?.construct)
|
|
856
|
+
seedHeaps(value(operation.result.id), bodyById.get(operation.functionId).construct.result);
|
|
857
|
+
break;
|
|
858
|
+
case 'allocate-constructor': {
|
|
859
|
+
// Publishing the constructor publishes its future instances too.
|
|
860
|
+
// Its ordinary return cell is void, so that escape cannot be found by
|
|
861
|
+
// following constructor-body returns like an ordinary factory's.
|
|
862
|
+
const heap = classHeaps.get(operation.declaration);
|
|
863
|
+
if (heap)
|
|
864
|
+
addHeap(value(operation.result.id), heap);
|
|
865
|
+
const layout = classLayoutOfCopy(classes, operation.declaration);
|
|
866
|
+
if (layout)
|
|
867
|
+
for (const id of constructionEntriesOf(layout))
|
|
868
|
+
addFunction(value(operation.result.id), id);
|
|
869
|
+
break;
|
|
870
|
+
}
|
|
871
|
+
case 'constant':
|
|
872
|
+
case 'parameter':
|
|
873
|
+
case 'jump':
|
|
874
|
+
case 'branch':
|
|
875
|
+
case 'switch':
|
|
876
|
+
case 'test':
|
|
877
|
+
break;
|
|
878
|
+
case 'receiver': {
|
|
879
|
+
const receiver = frameReceivers.get(owner.get(operation));
|
|
880
|
+
if (receiver)
|
|
881
|
+
link(receiver, value(operation.result.id));
|
|
882
|
+
break;
|
|
883
|
+
}
|
|
884
|
+
case 'allocate-ordinary-object':
|
|
885
|
+
case 'allocate-record': {
|
|
886
|
+
const references = nativeReferences(operation.result.representation);
|
|
887
|
+
seedAllocation(operation.result.id, operation.result.representation);
|
|
888
|
+
if (!references.complete || references.heaps.length !== 1 || !references.heaps[0].valid) {
|
|
889
|
+
untrusted(operation);
|
|
890
|
+
break;
|
|
891
|
+
}
|
|
892
|
+
for (const field of operation.kind === 'allocate-record' ? operation.fields : []) {
|
|
893
|
+
const slots = slotsOf({ value: operation.result.id, representation: operation.result.representation }, field.key);
|
|
894
|
+
if (slots)
|
|
895
|
+
for (const slot of slots)
|
|
896
|
+
link(value(field.value.value), slot);
|
|
897
|
+
else
|
|
898
|
+
untrusted(operation);
|
|
899
|
+
}
|
|
900
|
+
break;
|
|
901
|
+
}
|
|
902
|
+
case 'allocate-array-object': {
|
|
903
|
+
const heap = seedAllocation(operation.result.id, operation.result.representation)[0];
|
|
904
|
+
const elements = heap?.fields.get('')?.cell;
|
|
905
|
+
if (!elements || !nativeArrayTransportOf(operation, null)) {
|
|
906
|
+
untrusted(operation);
|
|
907
|
+
break;
|
|
908
|
+
}
|
|
909
|
+
for (const slot of operation.elements) {
|
|
910
|
+
if (slot.kind === 'element')
|
|
911
|
+
link(value(slot.value.value), elements);
|
|
912
|
+
else if (slot.kind === 'spread') {
|
|
913
|
+
heapEffect(operation, () => {
|
|
914
|
+
const sources = slotsOf(slot.value, '');
|
|
915
|
+
if (sources === null) {
|
|
916
|
+
untrusted(operation);
|
|
917
|
+
return true;
|
|
918
|
+
}
|
|
919
|
+
for (const source of sources)
|
|
920
|
+
link(source, elements);
|
|
921
|
+
return sources.length > 0;
|
|
922
|
+
});
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
break;
|
|
926
|
+
}
|
|
927
|
+
case 'binding-write':
|
|
928
|
+
link(value(operation.value.value), binding(operation.declaration));
|
|
929
|
+
if (!['local', 'region'].includes(placements.get(operation.declaration)?.storage.kind ?? ''))
|
|
930
|
+
markEscaped(value(operation.value.value));
|
|
931
|
+
break;
|
|
932
|
+
case 'binding-read':
|
|
933
|
+
link(binding(operation.declaration), value(operation.result.id));
|
|
934
|
+
if (!['local', 'region'].includes(placements.get(operation.declaration)?.storage.kind ?? ''))
|
|
935
|
+
external(value(operation.result.id), operation.result.representation);
|
|
936
|
+
if (operation.closedCallable)
|
|
937
|
+
for (const id of operation.closedCallable.kind === 'exact'
|
|
938
|
+
? [operation.closedCallable.functionId]
|
|
939
|
+
: operation.closedCallable.functionIds)
|
|
940
|
+
addFunction(value(operation.result.id), id);
|
|
941
|
+
break;
|
|
942
|
+
case 'phi':
|
|
943
|
+
for (const incoming of operation.incoming)
|
|
944
|
+
link(value(incoming.value.value), value(operation.result.id));
|
|
945
|
+
break;
|
|
946
|
+
case 'return':
|
|
947
|
+
if (operation.value)
|
|
948
|
+
link(value(operation.value.value), returns.get(owner.get(operation)));
|
|
949
|
+
break;
|
|
950
|
+
case 'get': {
|
|
951
|
+
const key = keyOf(operation.key);
|
|
952
|
+
if (nativeArrayTransportOf(operation, key)) {
|
|
953
|
+
if (key !== 'length') {
|
|
954
|
+
fieldReads.push(operation);
|
|
955
|
+
heapEffect(operation, () => {
|
|
956
|
+
const sources = slotsOf(operation.receiver, '');
|
|
957
|
+
if (sources === null) {
|
|
958
|
+
untrusted(operation);
|
|
959
|
+
return true;
|
|
960
|
+
}
|
|
961
|
+
for (const source of sources)
|
|
962
|
+
link(source, value(operation.result.id));
|
|
963
|
+
return sources.length > 0;
|
|
964
|
+
});
|
|
965
|
+
}
|
|
966
|
+
break;
|
|
967
|
+
}
|
|
968
|
+
if (key !== null && slotTemplatesOf(operation.receiver.representation, key) !== null) {
|
|
969
|
+
fieldReads.push(operation);
|
|
970
|
+
heapEffect(operation, () => {
|
|
971
|
+
const sources = slotsOf(operation.receiver, key);
|
|
972
|
+
if (sources === null) {
|
|
973
|
+
untrusted(operation);
|
|
974
|
+
return true;
|
|
975
|
+
}
|
|
976
|
+
for (const source of sources)
|
|
977
|
+
link(source, value(operation.result.id));
|
|
978
|
+
return sources.length > 0;
|
|
979
|
+
});
|
|
980
|
+
}
|
|
981
|
+
else if (operation.closedCallable) {
|
|
982
|
+
for (const id of operation.closedCallable.kind === 'exact'
|
|
983
|
+
? [operation.closedCallable.functionId]
|
|
984
|
+
: operation.closedCallable.functionIds)
|
|
985
|
+
addFunction(value(operation.result.id), id);
|
|
986
|
+
}
|
|
987
|
+
else
|
|
988
|
+
untrusted(operation);
|
|
989
|
+
break;
|
|
990
|
+
}
|
|
991
|
+
case 'set':
|
|
992
|
+
case 'define-own-property': {
|
|
993
|
+
const key = keyOf(operation.key);
|
|
994
|
+
if (operation.kind === 'set' && nativeArrayTransportOf(operation, key)) {
|
|
995
|
+
if (key !== 'length')
|
|
996
|
+
heapEffect(operation, () => {
|
|
997
|
+
const targets = slotsOf(operation.receiver, '');
|
|
998
|
+
if (targets === null) {
|
|
999
|
+
untrusted(operation);
|
|
1000
|
+
return true;
|
|
1001
|
+
}
|
|
1002
|
+
for (const target of targets)
|
|
1003
|
+
link(value(operation.value.value), target);
|
|
1004
|
+
return targets.length > 0;
|
|
1005
|
+
});
|
|
1006
|
+
if (operation.result && representationKey(operation.result.representation) === representationKey(operation.value.representation))
|
|
1007
|
+
link(value(operation.value.value), value(operation.result.id));
|
|
1008
|
+
break;
|
|
1009
|
+
}
|
|
1010
|
+
if (key !== null && slotTemplatesOf(operation.receiver.representation, key) !== null) {
|
|
1011
|
+
heapEffect(operation, () => {
|
|
1012
|
+
const targets = slotsOf(operation.receiver, key);
|
|
1013
|
+
if (targets === null) {
|
|
1014
|
+
untrusted(operation);
|
|
1015
|
+
return true;
|
|
1016
|
+
}
|
|
1017
|
+
for (const target of targets)
|
|
1018
|
+
link(value(operation.value.value), target);
|
|
1019
|
+
return targets.length > 0;
|
|
1020
|
+
});
|
|
1021
|
+
if (operation.result &&
|
|
1022
|
+
representationKey(operation.result.representation) ===
|
|
1023
|
+
representationKey(operation.kind === 'set' ? operation.value.representation : operation.receiver.representation))
|
|
1024
|
+
link(value(operation.kind === 'set' ? operation.value.value : operation.receiver.value), value(operation.result.id));
|
|
1025
|
+
}
|
|
1026
|
+
else
|
|
1027
|
+
untrusted(operation);
|
|
1028
|
+
break;
|
|
1029
|
+
}
|
|
1030
|
+
case 'merge-live-arm-rebuild': {
|
|
1031
|
+
const source = operation.source.representation;
|
|
1032
|
+
const payload = source.kind === 'optional' ? source.payload : source;
|
|
1033
|
+
if (!conversions || payload.kind !== 'tagged-union' || !nativeMergePayloadTransportMatches(operation, conversions)) {
|
|
1034
|
+
untrusted(operation);
|
|
1035
|
+
break;
|
|
1036
|
+
}
|
|
1037
|
+
// A live source arm and the destination must both admit an allocation.
|
|
1038
|
+
// Neither a discarded arm nor a type alone supplies a new origin.
|
|
1039
|
+
const live = fresh();
|
|
1040
|
+
linkPayload(value(operation.source.value), live, operation.liveArms.map((index) => payload.arms[index].value));
|
|
1041
|
+
linkPayload(live, value(operation.result.id), [operation.result.representation]);
|
|
1042
|
+
break;
|
|
1043
|
+
}
|
|
1044
|
+
case 'convert': {
|
|
1045
|
+
const node = conversions?.nodeById(operation.conversionUse);
|
|
1046
|
+
const from = operation.source.representation;
|
|
1047
|
+
const to = operation.result.representation;
|
|
1048
|
+
const native = node?.capability.kind === 'identity' ||
|
|
1049
|
+
((node?.capability.kind === 'atom' || node?.capability.kind === 'static') &&
|
|
1050
|
+
node.capability.materializer.nativeFieldProtocol === 'unused');
|
|
1051
|
+
if (nativePayloadTransportMatches(from, to, node))
|
|
1052
|
+
linkPayload(value(operation.source.value), value(operation.result.id), [to]);
|
|
1053
|
+
else if (representationKey(from) === representationKey(to) ||
|
|
1054
|
+
nativeClassReferenceTransportMatches(from, to, node) ||
|
|
1055
|
+
transportsCallablePrefix(from, to, node) ||
|
|
1056
|
+
(native && abiOfCallee(from) !== null && abiOfCallee(to) !== null && abiKey(abiOfCallee(from)) === abiKey(abiOfCallee(to))))
|
|
1057
|
+
link(value(operation.source.value), value(operation.result.id));
|
|
1058
|
+
else
|
|
1059
|
+
untrusted(operation);
|
|
1060
|
+
break;
|
|
1061
|
+
}
|
|
1062
|
+
case 'construct': {
|
|
1063
|
+
const branches = nativeClassConstructionOf(operation, classes, (id) => bodyById.get(id), conversions);
|
|
1064
|
+
if (branches !== null) {
|
|
1065
|
+
const heaps = seedAllocation(operation.result.id, operation.result.representation);
|
|
1066
|
+
for (const branch of branches) {
|
|
1067
|
+
const receiver = fresh();
|
|
1068
|
+
for (const heap of heaps)
|
|
1069
|
+
if (heap.declaration === branch.declaration)
|
|
1070
|
+
addHeap(receiver, heap);
|
|
1071
|
+
for (const entry of branch.entries)
|
|
1072
|
+
invoke(entry.functionId, entry.arguments, receiver, null);
|
|
1073
|
+
}
|
|
1074
|
+
break;
|
|
1075
|
+
}
|
|
1076
|
+
const target = operation.target;
|
|
1077
|
+
const constructor = target.kind === 'exact' && target.target.kind === 'function' ? target.target.functionId : null;
|
|
1078
|
+
const layout = constructor !== null
|
|
1079
|
+
? [...classes.values()].find((candidate) => candidate.constructor === constructor)
|
|
1080
|
+
: target.kind === 'exact' && target.target.kind === 'implicit-source-constructor'
|
|
1081
|
+
? classLayoutOfCopy(classes, target.target.classDeclaration)
|
|
1082
|
+
: undefined;
|
|
1083
|
+
const ordinaryBody = constructor === null ? null : bodyById.get(constructor);
|
|
1084
|
+
const ordinaryEntry = layout === undefined ? explicitObjectConstructEntryOf(operation, ordinaryBody?.abi ?? null) : undefined;
|
|
1085
|
+
if (ordinaryEntry && constructMatchesAbi(operation, ordinaryEntry.abi, conversions)) {
|
|
1086
|
+
invoke(ordinaryEntry.functionId, operation.arguments, null, value(operation.result.id));
|
|
1087
|
+
break;
|
|
1088
|
+
}
|
|
1089
|
+
if (layout === undefined && ordinaryBody && ordinaryConstructBodyMatches(operation, ordinaryBody, conversions)) {
|
|
1090
|
+
seedAllocation(operation.result.id, operation.result.representation);
|
|
1091
|
+
invoke(constructor, operation.arguments, ordinaryBody.abi.receiver === null ? null : value(operation.result.id), null);
|
|
1092
|
+
break;
|
|
1093
|
+
}
|
|
1094
|
+
const entries = layout?.construct &&
|
|
1095
|
+
operation.callee.value === operation.newTarget.value &&
|
|
1096
|
+
constructMatchesAbi(operation, layout.construct, conversions)
|
|
1097
|
+
? nativeClassInitializationOf(layout, operation.arguments, classes, (id) => bodyById.get(id), conversions)
|
|
1098
|
+
: null;
|
|
1099
|
+
if (entries !== null) {
|
|
1100
|
+
seedAllocation(operation.result.id, operation.result.representation);
|
|
1101
|
+
for (const entry of entries)
|
|
1102
|
+
invoke(entry.functionId, entry.arguments, value(operation.result.id), null);
|
|
1103
|
+
}
|
|
1104
|
+
else
|
|
1105
|
+
untrusted(operation);
|
|
1106
|
+
break;
|
|
1107
|
+
}
|
|
1108
|
+
case 'super-initialize': {
|
|
1109
|
+
const id = owner.get(operation);
|
|
1110
|
+
const entries = nativeSuperInitializationOf(operation, bodyById.get(id), classes, (entry) => bodyById.get(entry), conversions);
|
|
1111
|
+
const receiver = frameReceivers.get(id);
|
|
1112
|
+
if (entries === null || !receiver)
|
|
1113
|
+
untrusted(operation);
|
|
1114
|
+
else
|
|
1115
|
+
for (const entry of entries)
|
|
1116
|
+
invoke(entry.functionId, entry.arguments, receiver, null);
|
|
1117
|
+
break;
|
|
1118
|
+
}
|
|
1119
|
+
case 'has-property':
|
|
1120
|
+
case 'own-property-keys':
|
|
1121
|
+
case 'get-iterator':
|
|
1122
|
+
if (!nativeKeyQueryOf(operation, nativePropertyLayoutOf))
|
|
1123
|
+
untrusted(operation);
|
|
1124
|
+
break;
|
|
1125
|
+
case 'call':
|
|
1126
|
+
if (!nativeKeyQueryOf(operation, nativePropertyLayoutOf)) {
|
|
1127
|
+
// A call's citation is an execution edge of its containing body,
|
|
1128
|
+
// not a root. Opening it before frame matching is conservative;
|
|
1129
|
+
// failed matching subsequently publishes unknown inputs above.
|
|
1130
|
+
for (const id of citedEntriesOf(operation))
|
|
1131
|
+
enter(id);
|
|
1132
|
+
if (operation.closedCallee)
|
|
1133
|
+
for (const id of operation.closedCallee.kind === 'exact'
|
|
1134
|
+
? [operation.closedCallee.functionId]
|
|
1135
|
+
: operation.closedCallee.functionIds)
|
|
1136
|
+
addFunction(value(operation.callee.value), id);
|
|
1137
|
+
pendingCalls.push(operation);
|
|
1138
|
+
}
|
|
1139
|
+
break;
|
|
1140
|
+
case 'compute':
|
|
1141
|
+
if (observesNativeCarrierOnly(operation)) {
|
|
1142
|
+
if (operation.form === 'require-object-coercible' ||
|
|
1143
|
+
operation.form === 'require-iterable-present' ||
|
|
1144
|
+
operation.form === 'require-tagged-union-arm') {
|
|
1145
|
+
const source = operation.operands[0];
|
|
1146
|
+
if (source)
|
|
1147
|
+
link(value(source.value), value(operation.result.id));
|
|
1148
|
+
}
|
|
1149
|
+
break;
|
|
1150
|
+
}
|
|
1151
|
+
untrusted(operation);
|
|
1152
|
+
break;
|
|
1153
|
+
default:
|
|
1154
|
+
untrusted(operation);
|
|
1155
|
+
}
|
|
1156
|
+
// An SSA operand without a producer cannot be invented by this analysis.
|
|
1157
|
+
for (const operand of operandsOfIrOperation(operation)) {
|
|
1158
|
+
if (!producers.has(operand.value))
|
|
1159
|
+
external(value(operand.value), operand.representation);
|
|
1160
|
+
}
|
|
1161
|
+
};
|
|
1162
|
+
const escapedFunctions = new Set();
|
|
1163
|
+
const escapedHeaps = new Set();
|
|
1164
|
+
const matchedCalls = new Set();
|
|
1165
|
+
const visitedCallTargets = new Map();
|
|
1166
|
+
const unknownCalls = new Set();
|
|
1167
|
+
const settle = () => {
|
|
1168
|
+
for (;;) {
|
|
1169
|
+
const before = revision;
|
|
1170
|
+
while (pendingBodies.length > 0) {
|
|
1171
|
+
const body = pendingBodies.pop();
|
|
1172
|
+
for (const block of body.blocks.values())
|
|
1173
|
+
for (const operation of [...block.operations, block.terminator])
|
|
1174
|
+
processOperation(operation);
|
|
1175
|
+
}
|
|
1176
|
+
for (const effect of heapEffects)
|
|
1177
|
+
effect.apply();
|
|
1178
|
+
// Conflicting physical views and unsupported record protocols cannot
|
|
1179
|
+
// retain facts inferred through an earlier plain view of the same shape.
|
|
1180
|
+
for (const heap of recordHeaps.values())
|
|
1181
|
+
if (!heap.valid)
|
|
1182
|
+
for (const slot of heap.fields.values())
|
|
1183
|
+
external(slot.cell, slot.representation, 'unproven-record-layout');
|
|
1184
|
+
for (const heap of arrayHeaps.values())
|
|
1185
|
+
if (!heap.valid)
|
|
1186
|
+
for (const slot of heap.fields.values())
|
|
1187
|
+
external(slot.cell, slot.representation, 'unproven-array-storage');
|
|
1188
|
+
while (pendingCells.length > 0) {
|
|
1189
|
+
const cell = popCell();
|
|
1190
|
+
sweepIndex = cell.index;
|
|
1191
|
+
for (const [target, allowed] of cell.edges) {
|
|
1192
|
+
for (const id of cell.functions)
|
|
1193
|
+
addFunction(target, id);
|
|
1194
|
+
for (const heap of cell.heaps)
|
|
1195
|
+
if (allowed === null || heapAdmitted(heap, allowed))
|
|
1196
|
+
addHeap(target, heap);
|
|
1197
|
+
if (cell.unknown)
|
|
1198
|
+
markUnknown(target, cell.unknownReason);
|
|
1199
|
+
// Publication of an alias is publication of its sources too.
|
|
1200
|
+
if (target.escaped)
|
|
1201
|
+
markEscaped(cell, target.escapeReason);
|
|
1202
|
+
}
|
|
1203
|
+
if (!cell.unknown && !cell.escaped)
|
|
1204
|
+
continue;
|
|
1205
|
+
for (const id of cell.functions) {
|
|
1206
|
+
if (escapedFunctions.has(id))
|
|
1207
|
+
continue;
|
|
1208
|
+
escapedFunctions.add(id);
|
|
1209
|
+
enter(id);
|
|
1210
|
+
const reason = `external-entry:${id}:${cell.unknownReason ?? cell.escapeReason ?? 'publication'}`;
|
|
1211
|
+
externalEntry(id, reason);
|
|
1212
|
+
for (const layout of classes.values())
|
|
1213
|
+
if (layout.constructor === id)
|
|
1214
|
+
for (const entry of constructionEntriesOf(layout))
|
|
1215
|
+
externalEntry(entry, reason);
|
|
1216
|
+
}
|
|
1217
|
+
for (const heap of cell.heaps) {
|
|
1218
|
+
if (escapedHeaps.has(heap))
|
|
1219
|
+
continue;
|
|
1220
|
+
escapedHeaps.add(heap);
|
|
1221
|
+
if (heap.template !== undefined)
|
|
1222
|
+
for (const summary of familyOf(heap.template))
|
|
1223
|
+
for (const [key, slot] of heap.fields) {
|
|
1224
|
+
const externalSlot = summary.fields.get(key);
|
|
1225
|
+
if (!externalSlot)
|
|
1226
|
+
continue;
|
|
1227
|
+
// Once published, an external return/parameter may alias this
|
|
1228
|
+
// allocation. Writes through either view must reach the other.
|
|
1229
|
+
link(slot.cell, externalSlot.cell);
|
|
1230
|
+
link(externalSlot.cell, slot.cell);
|
|
1231
|
+
}
|
|
1232
|
+
for (const candidate of familyOf(heap)) {
|
|
1233
|
+
// Unknown observers can call prototype methods as well as values
|
|
1234
|
+
// stored in own fields. Opening these entries is what makes method
|
|
1235
|
+
// deferral safe after publication, including base-typed aliases.
|
|
1236
|
+
const methodLayouts = candidate.declaration === null
|
|
1237
|
+
? []
|
|
1238
|
+
: [...classes.values()].filter((layout) => layout.declaration === candidate.declaration || extendsClass(classes, candidate.declaration, layout.declaration));
|
|
1239
|
+
for (const layout of methodLayouts) {
|
|
1240
|
+
// An observer can recover a native instance's constructor from
|
|
1241
|
+
// its prototype and create another instance. Deferring the
|
|
1242
|
+
// constructor must not hide those future initializer effects.
|
|
1243
|
+
for (const id of constructionEntriesOf(layout))
|
|
1244
|
+
externalEntry(id, cell.unknownReason ?? cell.escapeReason ?? 'external-instance-constructor');
|
|
1245
|
+
for (const accessor of layout.accessors)
|
|
1246
|
+
for (const id of [accessor.getter, accessor.setter])
|
|
1247
|
+
if (id !== null)
|
|
1248
|
+
externalEntry(id, cell.unknownReason ?? cell.escapeReason ?? 'external-instance-accessor');
|
|
1249
|
+
for (const method of layout.methods) {
|
|
1250
|
+
if (method.callable === null)
|
|
1251
|
+
continue;
|
|
1252
|
+
const reason = cell.unknownReason ?? cell.escapeReason ?? 'external-method-receiver';
|
|
1253
|
+
externalEntry(method.callable, reason);
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1256
|
+
for (const slot of candidate.fields.values())
|
|
1257
|
+
external(slot.cell, slot.representation, cell.unknownReason ?? cell.escapeReason ?? 'external-heap');
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
sweepIndex = null;
|
|
1262
|
+
for (const cell of nextSweep)
|
|
1263
|
+
pushCell(cell);
|
|
1264
|
+
nextSweep.length = 0;
|
|
1265
|
+
for (const operation of pendingCalls) {
|
|
1266
|
+
const callee = value(operation.callee.value);
|
|
1267
|
+
if (callee.unknown) {
|
|
1268
|
+
if (!unknownCalls.has(operation)) {
|
|
1269
|
+
unknownCalls.add(operation);
|
|
1270
|
+
untrusted(operation);
|
|
1271
|
+
}
|
|
1272
|
+
continue;
|
|
1273
|
+
}
|
|
1274
|
+
let visited = visitedCallTargets.get(operation);
|
|
1275
|
+
if (!visited)
|
|
1276
|
+
visitedCallTargets.set(operation, (visited = new Set()));
|
|
1277
|
+
for (const id of callee.functions) {
|
|
1278
|
+
// Frame compatibility is immutable. Once linked, argument and
|
|
1279
|
+
// return edges carry future origins without re-invoking the site.
|
|
1280
|
+
if (visited.has(id))
|
|
1281
|
+
continue;
|
|
1282
|
+
visited.add(id);
|
|
1283
|
+
const abi = bodyById.get(id)?.abi;
|
|
1284
|
+
const held = abiOfCallee(operation.callee.representation);
|
|
1285
|
+
// Only an observed, certified native adapter can enter the original
|
|
1286
|
+
// original body through its public held frame. All
|
|
1287
|
+
// identity propagation into this cell already crossed proven edges.
|
|
1288
|
+
const adaptsFrame = abi && held && adaptedFrames.get(abiKey(abi))?.has(abiKey(held)) === true;
|
|
1289
|
+
const argumentsForBody = adaptsFrame ? operation.arguments.slice(0, abi.parameters.length) : operation.arguments;
|
|
1290
|
+
if (!abi ||
|
|
1291
|
+
!held ||
|
|
1292
|
+
operation.argumentsAreSpread ||
|
|
1293
|
+
(abiKey(held) !== abiKey(abi) && !adaptsFrame) ||
|
|
1294
|
+
!nativeArgumentsMatch(abi, argumentsForBody, conversions) ||
|
|
1295
|
+
(held.receiver === null
|
|
1296
|
+
? operation.receiver !== null
|
|
1297
|
+
: operation.receiver === null || representationKey(held.receiver) !== representationKey(operation.receiver.representation))) {
|
|
1298
|
+
untrusted(operation);
|
|
1299
|
+
continue;
|
|
1300
|
+
}
|
|
1301
|
+
matchedCalls.add(operation);
|
|
1302
|
+
let receiverForBody = abi.receiver !== null && operation.receiver ? value(operation.receiver.value) : null;
|
|
1303
|
+
if (receiverForBody &&
|
|
1304
|
+
abi.receiver &&
|
|
1305
|
+
operation.receiver &&
|
|
1306
|
+
representationKey(abi.receiver) !== representationKey(operation.receiver.representation)) {
|
|
1307
|
+
const adaptedReceiver = fresh();
|
|
1308
|
+
linkPayload(receiverForBody, adaptedReceiver, [abi.receiver]);
|
|
1309
|
+
receiverForBody = adaptedReceiver;
|
|
1310
|
+
}
|
|
1311
|
+
invoke(id, argumentsForBody, receiverForBody, operation.result ? value(operation.result.id) : null);
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
// Heap effects observe receiver origins from the preceding propagation
|
|
1315
|
+
// sweep. Repeat after any mutation, even when every queued cell was
|
|
1316
|
+
// already visited, so those new origins receive their field edges.
|
|
1317
|
+
if (revision === before && pendingCells.length === 0 && pendingBodies.length === 0)
|
|
1318
|
+
break;
|
|
1319
|
+
}
|
|
1320
|
+
};
|
|
1321
|
+
settle();
|
|
1322
|
+
// Unknown calls can expose another stored callable, opening another body and
|
|
1323
|
+
// its calls. Exhaust that worklist before publishing any closed identities.
|
|
1324
|
+
const rejectedCalls = new Set();
|
|
1325
|
+
const rejectedHeapEffects = new Set();
|
|
1326
|
+
for (const [id, inputs] of parameters) {
|
|
1327
|
+
if (!called.has(id) && !deferred.has(id)) {
|
|
1328
|
+
const receiver = frameReceivers.get(id);
|
|
1329
|
+
const representation = bodyById.get(id)?.abi?.receiver;
|
|
1330
|
+
if (receiver && representation)
|
|
1331
|
+
external(receiver, representation, `unentered-body:${id}`);
|
|
1332
|
+
for (const input of inputs)
|
|
1333
|
+
external(value(input.result.id), input.result.representation, `unentered-body:${id}`);
|
|
1334
|
+
const returned = returns.get(id);
|
|
1335
|
+
if (returned)
|
|
1336
|
+
escape(returned, `unentered-body:${id}`);
|
|
1337
|
+
}
|
|
1338
|
+
// Property access invokes an accessor without an ordinary call/return edge
|
|
1339
|
+
// in this graph. Its returned functions and containing objects must stay
|
|
1340
|
+
// observable even if another, explicit call to that accessor was counted.
|
|
1341
|
+
if (implicitAccessorEntries.has(id)) {
|
|
1342
|
+
const returned = returns.get(id);
|
|
1343
|
+
if (returned)
|
|
1344
|
+
escape(returned, `implicit-accessor-return:${id}`);
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
for (;;) {
|
|
1348
|
+
for (const operation of pendingCalls) {
|
|
1349
|
+
if (matchedCalls.has(operation) || rejectedCalls.has(operation))
|
|
1350
|
+
continue;
|
|
1351
|
+
rejectedCalls.add(operation);
|
|
1352
|
+
untrusted(operation);
|
|
1353
|
+
}
|
|
1354
|
+
for (const effect of heapEffects) {
|
|
1355
|
+
if (effect.apply() || rejectedHeapEffects.has(effect.operation))
|
|
1356
|
+
continue;
|
|
1357
|
+
rejectedHeapEffects.add(effect.operation);
|
|
1358
|
+
if (effect.reject)
|
|
1359
|
+
effect.reject();
|
|
1360
|
+
else
|
|
1361
|
+
untrusted(effect.operation);
|
|
1362
|
+
}
|
|
1363
|
+
settle();
|
|
1364
|
+
if (pendingCalls.every((operation) => matchedCalls.has(operation) || rejectedCalls.has(operation)) &&
|
|
1365
|
+
heapEffects.every((effect) => rejectedHeapEffects.has(effect.operation) || effect.apply()))
|
|
1366
|
+
break;
|
|
1367
|
+
}
|
|
1368
|
+
const result = new Map();
|
|
1369
|
+
// Presence is checked by the later optional conversion. This fact names
|
|
1370
|
+
// possible implementations, never a physical call ABI or a non-null value.
|
|
1371
|
+
const hasCallablePayload = (representation) => representation.kind === 'optional' ? hasCallablePayload(representation.payload) : abiOfCallee(representation) !== null;
|
|
1372
|
+
for (const read of fieldReads) {
|
|
1373
|
+
const cell = value(read.result.id);
|
|
1374
|
+
if (trace && hasCallablePayload(read.result.representation) && (cell.unknown || cell.functions.size === 0))
|
|
1375
|
+
trace(read, cell.unknownReason ?? 'no-implementation-source');
|
|
1376
|
+
if (cell.unknown || cell.functions.size === 0 || !hasCallablePayload(read.result.representation))
|
|
1377
|
+
continue;
|
|
1378
|
+
const ids = [...cell.functions];
|
|
1379
|
+
if (ids.some((id) => !bodyById.get(id)?.abi))
|
|
1380
|
+
continue;
|
|
1381
|
+
result.set(read.result.id, ids.length === 1 ? { kind: 'exact', functionId: ids[0] } : { kind: 'closed-family', functionIds: ids });
|
|
1382
|
+
}
|
|
1383
|
+
return { callables: result, enteredBodies: new Set([...entered].map((body) => body.owner)) };
|
|
1384
|
+
};
|
|
1385
|
+
/** Compatibility view of the same execution/escape census; no second analysis policy. */
|
|
1386
|
+
export const closedClassFieldCallablesOf = (...args) => nativeCallableFlowOf(...args).callables;
|