@geastack/compiler 1.0.27 → 1.0.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli-coverage.js +2 -2
- package/dist/cli-emit.js +36 -12
- package/dist/compiler.d.ts +11 -9
- package/dist/compiler.js +264 -43
- package/dist/conversion/algebra.d.ts +84 -4
- package/dist/conversion/algebra.js +39 -0
- package/dist/conversion/array-view.d.ts +63 -0
- package/dist/conversion/array-view.js +186 -0
- package/dist/conversion/build.d.ts +8 -8
- package/dist/conversion/build.js +56 -50
- package/dist/conversion/certified-iterator-object-view.d.ts +13 -0
- package/dist/conversion/certified-iterator-object-view.js +31 -0
- package/dist/conversion/certified-iterator-protocols.d.ts +23 -0
- package/dist/conversion/certified-iterator-protocols.js +50 -0
- package/dist/conversion/checked-native-field-read.d.ts +7 -0
- package/dist/conversion/checked-native-field-read.js +36 -0
- package/dist/conversion/constructor-identity-family.d.ts +6 -6
- package/dist/conversion/constructor-identity-family.js +3 -3
- package/dist/conversion/derive.js +11 -8
- package/dist/conversion/dictionary-view.d.ts +114 -0
- package/dist/conversion/dictionary-view.js +275 -0
- package/dist/conversion/document-record-view.d.ts +89 -0
- package/dist/conversion/document-record-view.js +269 -0
- package/dist/conversion/dynamic-result-carriers.d.ts +6 -0
- package/dist/conversion/dynamic-result-carriers.js +43 -0
- package/dist/conversion/dynamic-wrapper.d.ts +52 -0
- package/dist/conversion/dynamic-wrapper.js +82 -0
- package/dist/conversion/impossible-field-read.d.ts +9 -0
- package/dist/conversion/impossible-field-read.js +28 -0
- package/dist/conversion/iterable-object-view.d.ts +1 -1
- package/dist/conversion/iterator-object-view.d.ts +2 -2
- package/dist/conversion/native-absence.d.ts +4 -0
- package/dist/conversion/native-absence.js +4 -0
- package/dist/conversion/native-buffer-method.d.ts +16 -0
- package/dist/conversion/native-buffer-method.js +37 -0
- package/dist/conversion/native-callable-adapter.d.ts +13 -0
- package/dist/conversion/native-callable-adapter.js +73 -0
- package/dist/conversion/native-descriptor-snapshot.d.ts +30 -0
- package/dist/conversion/native-descriptor-snapshot.js +75 -0
- package/dist/conversion/native-entry-writer.d.ts +21 -0
- package/dist/conversion/native-entry-writer.js +32 -0
- package/dist/conversion/native-field-view.d.ts +42 -0
- package/dist/conversion/native-field-view.js +145 -0
- package/dist/conversion/native-logical-receiver.d.ts +11 -0
- package/dist/conversion/native-logical-receiver.js +19 -0
- package/dist/conversion/native-method.d.ts +43 -0
- package/dist/conversion/native-method.js +56 -0
- package/dist/conversion/native-object-sample.d.ts +30 -0
- package/dist/conversion/native-object-sample.js +37 -0
- package/dist/conversion/native-payload-transport.d.ts +1 -1
- package/dist/conversion/native-payload-transport.js +1 -1
- package/dist/conversion/native-record-products.d.ts +15 -0
- package/dist/conversion/native-record-products.js +73 -0
- package/dist/conversion/native-selection.d.ts +18 -1
- package/dist/conversion/native-selection.js +117 -4
- package/dist/conversion/native-sum.d.ts +27 -0
- package/dist/conversion/native-sum.js +74 -9
- package/dist/conversion/native-view-origins.d.ts +12 -0
- package/dist/conversion/native-view-origins.js +97 -0
- package/dist/conversion/nodes.d.ts +75 -7
- package/dist/conversion/nodes.js +694 -19
- package/dist/conversion/number-storage.d.ts +8 -0
- package/dist/conversion/number-storage.js +8 -0
- package/dist/conversion/operand-view.js +10 -1
- package/dist/conversion/promise-adoption.d.ts +15 -0
- package/dist/conversion/promise-adoption.js +29 -0
- package/dist/conversion/protocol-iterator.d.ts +3 -3
- package/dist/conversion/recipe-closure.d.ts +14 -0
- package/dist/conversion/recipe-closure.js +135 -0
- package/dist/conversion/record-view.d.ts +51 -26
- package/dist/conversion/record-view.js +160 -97
- package/dist/conversion/registry.d.ts +18 -2
- package/dist/conversion/sibling-class.d.ts +4 -0
- package/dist/conversion/sibling-class.js +7 -0
- package/dist/conversion/structural-plan.d.ts +87 -0
- package/dist/conversion/structural-plan.js +480 -0
- package/dist/ir/absent-class-arm.d.ts +1 -1
- package/dist/ir/absent-class-arm.js +1 -1
- package/dist/ir/async-result-conventions.d.ts +15 -0
- package/dist/ir/async-result-conventions.js +140 -0
- package/dist/ir/borrowed-call-arguments.d.ts +3 -3
- package/dist/ir/borrowed-call-arguments.js +9 -9
- package/dist/ir/build.d.ts +20 -29
- package/dist/ir/build.js +116 -19
- package/dist/ir/call-dispatch.js +153 -40
- package/dist/ir/call-entry.d.ts +14 -3
- package/dist/ir/call-entry.js +63 -5
- package/dist/ir/callable-class-flow.d.ts +48 -3
- package/dist/ir/callable-class-flow.js +1509 -81
- package/dist/ir/callable-flow-candidates.d.ts +25 -0
- package/dist/ir/callable-flow-candidates.js +135 -0
- package/dist/ir/callable-identity-demand.d.ts +2 -2
- package/dist/ir/callable-identity-demand.js +33 -1
- package/dist/ir/callable-member-candidates.d.ts +1 -1
- package/dist/ir/callable-member-candidates.js +2 -2
- package/dist/ir/callable-records.js +1 -0
- package/dist/ir/callable-site-escape.js +3 -4
- package/dist/ir/captures.js +1 -1
- package/dist/ir/certificate.d.ts +1 -0
- package/dist/ir/certificate.js +2 -1
- package/dist/ir/certify/carrier-keys.d.ts +2 -2
- package/dist/ir/certify/carrier-keys.js +4 -4
- package/dist/ir/certify/has-property-key.d.ts +3 -3
- package/dist/ir/certify/has-property-key.js +3 -3
- package/dist/ir/certify/parallel-region.d.ts +26 -0
- package/dist/ir/certify/parallel-region.js +1331 -0
- package/dist/ir/certify/property-access-keys.d.ts +11 -11
- package/dist/ir/certify/property-access-keys.js +11 -11
- package/dist/ir/certify/property-access.js +7 -9
- package/dist/ir/certify.d.ts +66 -3
- package/dist/ir/certify.js +1197 -36
- package/dist/ir/class-allocation-domain.d.ts +9 -0
- package/dist/ir/class-allocation-domain.js +111 -0
- package/dist/ir/class-evaluation.d.ts +2 -3
- package/dist/ir/class-evaluation.js +2 -3
- package/dist/ir/class-static-fields.d.ts +12 -1
- package/dist/ir/class-static-fields.js +25 -0
- package/dist/ir/closed-normal-results.d.ts +18 -0
- package/dist/ir/closed-normal-results.js +208 -0
- package/dist/ir/construct-entry.js +1 -0
- package/dist/ir/construction-only-fields.d.ts +20 -1
- package/dist/ir/construction-only-fields.js +95 -9
- package/dist/ir/convert-carriers.d.ts +7 -0
- package/dist/ir/convert-carriers.js +12 -0
- package/dist/ir/coroutine-bodies.d.ts +74 -0
- package/dist/ir/coroutine-bodies.js +93 -0
- package/dist/ir/dead-logical-merge.d.ts +7 -0
- package/dist/ir/dead-logical-merge.js +84 -0
- package/dist/ir/dead-values.d.ts +7 -5
- package/dist/ir/dead-values.js +34 -5
- package/dist/ir/deferral.d.ts +3 -1
- package/dist/ir/deferral.js +19 -6
- package/dist/ir/dense-loops.d.ts +96 -7
- package/dist/ir/dense-loops.js +333 -17
- package/dist/ir/descriptor-own-protocol.d.ts +12 -0
- package/dist/ir/descriptor-own-protocol.js +35 -0
- package/dist/ir/dynamic-constructor-conversions.d.ts +17 -0
- package/dist/ir/dynamic-constructor-conversions.js +52 -0
- package/dist/ir/emission-representations.js +44 -2
- package/dist/ir/facts.d.ts +14 -2
- package/dist/ir/facts.js +23 -9
- package/dist/ir/fixed-data-definition-attributes.d.ts +10 -0
- package/dist/ir/fixed-data-definition-attributes.js +200 -0
- package/dist/ir/fixed-data-definition.d.ts +23 -5
- package/dist/ir/fixed-data-definition.js +80 -2
- package/dist/ir/function-reflection-demand.d.ts +11 -0
- package/dist/ir/function-reflection-demand.js +71 -0
- package/dist/ir/generic-call-entry.d.ts +18 -0
- package/dist/ir/generic-call-entry.js +94 -0
- package/dist/ir/hoist.d.ts +16 -3
- package/dist/ir/hoist.js +121 -8
- package/dist/ir/host-method-aliases.d.ts +15 -0
- package/dist/ir/host-method-aliases.js +61 -0
- package/dist/ir/host-namespace-reads.d.ts +24 -0
- package/dist/ir/host-namespace-reads.js +151 -0
- package/dist/ir/host-promise-conversions.d.ts +5 -0
- package/dist/ir/host-promise-conversions.js +61 -0
- package/dist/ir/host-template-conversions.d.ts +34 -0
- package/dist/ir/host-template-conversions.js +357 -0
- package/dist/ir/instance-reparenting.d.ts +3 -4
- package/dist/ir/instantiation.d.ts +1 -1
- package/dist/ir/instantiation.js +1 -1
- package/dist/ir/integer-storage.d.ts +19 -9
- package/dist/ir/integer-storage.js +158 -44
- package/dist/ir/integers.d.ts +34 -7
- package/dist/ir/integers.js +240 -7
- package/dist/ir/integrity-restrictions.d.ts +4 -4
- package/dist/ir/integrity-restrictions.js +7 -4
- package/dist/ir/internal-operation-conversions.d.ts +7 -0
- package/dist/ir/internal-operation-conversions.js +195 -0
- package/dist/ir/intrinsic-call-facts.d.ts +40 -0
- package/dist/ir/intrinsic-call-facts.js +176 -0
- package/dist/ir/key-order-observation.d.ts +1 -1
- package/dist/ir/lazy-splits.d.ts +20 -0
- package/dist/ir/lazy-splits.js +58 -0
- package/dist/ir/literal-set-membership.d.ts +2 -2
- package/dist/ir/literal-set-membership.js +2 -2
- package/dist/ir/logical-receivers.d.ts +15 -0
- package/dist/ir/logical-receivers.js +98 -0
- package/dist/ir/lower-allocation.js +16 -13
- package/dist/ir/lower-destructuring.js +7 -6
- package/dist/ir/lower-graph.d.ts +4 -4
- package/dist/ir/lower-graph.js +2 -2
- package/dist/ir/lower-invocation.d.ts +2 -2
- package/dist/ir/lower-invocation.js +99 -57
- package/dist/ir/lower-narrow.js +35 -13
- package/dist/ir/lower-operands.d.ts +40 -11
- package/dist/ir/lower-operands.js +206 -87
- package/dist/ir/lower-property.js +31 -8
- package/dist/ir/lower.js +9 -9
- package/dist/ir/merge-conversions.d.ts +18 -0
- package/dist/ir/merge-conversions.js +106 -0
- package/dist/ir/model.d.ts +138 -28
- package/dist/ir/native-accessor-definition.d.ts +104 -0
- package/dist/ir/native-accessor-definition.js +735 -0
- package/dist/ir/native-array-descriptor-snapshot.d.ts +45 -0
- package/dist/ir/native-array-descriptor-snapshot.js +380 -0
- package/dist/ir/native-array-insertion.d.ts +16 -0
- package/dist/ir/native-array-insertion.js +42 -0
- package/dist/ir/native-callable-argument.d.ts +38 -0
- package/dist/ir/native-callable-argument.js +128 -0
- package/dist/ir/native-callable-data-flow.d.ts +9 -0
- package/dist/ir/native-callable-data-flow.js +59 -0
- package/dist/ir/native-callable-data-owner.d.ts +45 -0
- package/dist/ir/native-callable-data-owner.js +755 -0
- package/dist/ir/native-callable-data-reads.d.ts +45 -0
- package/dist/ir/native-callable-data-reads.js +282 -0
- package/dist/ir/native-callable-data-slots.d.ts +78 -0
- package/dist/ir/native-callable-data-slots.js +403 -0
- package/dist/ir/native-callable-data-write.d.ts +58 -0
- package/dist/ir/native-callable-data-write.js +254 -0
- package/dist/ir/native-callable-integrity.d.ts +23 -0
- package/dist/ir/native-callable-integrity.js +77 -0
- package/dist/ir/native-callable-own-property.d.ts +42 -0
- package/dist/ir/native-callable-own-property.js +505 -0
- package/dist/ir/native-callable-prototype.d.ts +38 -0
- package/dist/ir/native-callable-prototype.js +307 -0
- package/dist/ir/native-callable-readonly-set.d.ts +25 -0
- package/dist/ir/native-callable-readonly-set.js +238 -0
- package/dist/ir/native-class-accessor.d.ts +3 -3
- package/dist/ir/native-class-accessor.js +3 -3
- package/dist/ir/native-class-construction.js +2 -2
- package/dist/ir/native-constructor-reads.d.ts +15 -0
- package/dist/ir/native-constructor-reads.js +156 -0
- package/dist/ir/native-constructor-static.d.ts +18 -0
- package/dist/ir/native-constructor-static.js +61 -0
- package/dist/ir/native-data-definition.d.ts +43 -0
- package/dist/ir/native-data-definition.js +222 -0
- package/dist/ir/native-document-array-entries.d.ts +15 -0
- package/dist/ir/native-document-array-entries.js +37 -0
- package/dist/ir/native-document-entries.d.ts +21 -0
- package/dist/ir/native-document-entries.js +74 -0
- package/dist/ir/native-entry-field-views.d.ts +18 -0
- package/dist/ir/native-entry-field-views.js +62 -0
- package/dist/ir/native-field-view-domains.d.ts +43 -0
- package/dist/ir/native-field-view-domains.js +300 -0
- package/dist/ir/native-field-view-facts.d.ts +97 -0
- package/dist/ir/native-field-view-facts.js +341 -0
- package/dist/ir/native-fixed-layout.js +1 -1
- package/dist/ir/native-host-construction.d.ts +4 -6
- package/dist/ir/native-host-construction.js +4 -6
- package/dist/ir/native-host-method-reads.d.ts +13 -0
- package/dist/ir/native-host-method-reads.js +53 -0
- package/dist/ir/native-iterator-field-views.d.ts +15 -0
- package/dist/ir/native-iterator-field-views.js +39 -0
- package/dist/ir/native-iterator-receivers.d.ts +8 -0
- package/dist/ir/native-iterator-receivers.js +59 -0
- package/dist/ir/native-logical-receiver-body.d.ts +8 -0
- package/dist/ir/native-logical-receiver-body.js +23 -0
- package/dist/ir/native-method-frames.d.ts +18 -0
- package/dist/ir/native-method-frames.js +127 -0
- package/dist/ir/native-method-read-source.d.ts +16 -0
- package/dist/ir/native-method-read-source.js +61 -0
- package/dist/ir/native-object-data-slots.d.ts +60 -0
- package/dist/ir/native-object-data-slots.js +493 -0
- package/dist/ir/native-object-sample.d.ts +32 -0
- package/dist/ir/native-object-sample.js +113 -0
- package/dist/ir/native-own-assignment.d.ts +123 -0
- package/dist/ir/native-own-assignment.js +529 -0
- package/dist/ir/native-property-coercibility.d.ts +3 -0
- package/dist/ir/native-property-coercibility.js +10 -0
- package/dist/ir/native-property-key-texts.d.ts +11 -0
- package/dist/ir/native-property-key-texts.js +41 -0
- package/dist/ir/native-property-presence-effects.d.ts +11 -0
- package/dist/ir/native-property-presence-effects.js +19 -0
- package/dist/ir/native-property-presence.d.ts +27 -0
- package/dist/ir/native-property-presence.js +275 -0
- package/dist/ir/native-prototype-calls.d.ts +19 -0
- package/dist/ir/native-prototype-calls.js +53 -0
- package/dist/ir/native-prototype-conversions.d.ts +5 -0
- package/dist/ir/native-prototype-conversions.js +46 -0
- package/dist/ir/native-prototype-presence-demand.d.ts +9 -0
- package/dist/ir/native-prototype-presence-demand.js +58 -0
- package/dist/ir/native-record-index.d.ts +1 -1
- package/dist/ir/native-union-method-targets.d.ts +8 -0
- package/dist/ir/native-union-method-targets.js +69 -0
- package/dist/ir/no-normal-call-completion.d.ts +15 -0
- package/dist/ir/no-normal-call-completion.js +184 -0
- package/dist/ir/non-normal-receiver.d.ts +39 -0
- package/dist/ir/non-normal-receiver.js +253 -0
- package/dist/ir/operation-conversions.d.ts +29 -0
- package/dist/ir/operation-conversions.js +484 -0
- package/dist/ir/operation-index.d.ts +1 -1
- package/dist/ir/presence-proof.d.ts +1 -1
- package/dist/ir/presence-proof.js +1 -0
- package/dist/ir/program-conversions.d.ts +48 -0
- package/dist/ir/program-conversions.js +221 -0
- package/dist/ir/program-facts.d.ts +4 -1
- package/dist/ir/program-facts.js +9 -7
- package/dist/ir/promise-reaction-conversions.d.ts +6 -0
- package/dist/ir/promise-reaction-conversions.js +92 -0
- package/dist/ir/property-read-conversions.d.ts +10 -0
- package/dist/ir/property-read-conversions.js +124 -0
- package/dist/ir/proven-branches.d.ts +2 -1
- package/dist/ir/proven-branches.js +97 -10
- package/dist/ir/publish-conversion-recipes.d.ts +27 -0
- package/dist/ir/publish-conversion-recipes.js +246 -0
- package/dist/ir/publish-native-field-view-facts.d.ts +17 -0
- package/dist/ir/publish-native-field-view-facts.js +119 -0
- package/dist/ir/queries.js +42 -4
- package/dist/ir/read-only-dictionary.d.ts +38 -0
- package/dist/ir/read-only-dictionary.js +281 -0
- package/dist/ir/reflection-demand.d.ts +2 -0
- package/dist/ir/reflection-demand.js +600 -44
- package/dist/ir/shake.d.ts +3 -0
- package/dist/ir/shake.js +24 -14
- package/dist/ir/shared-empty-records.js +1 -1
- package/dist/ir/short-circuit-threading.d.ts +23 -0
- package/dist/ir/short-circuit-threading.js +133 -0
- package/dist/ir/spread-conversions.d.ts +27 -0
- package/dist/ir/spread-conversions.js +134 -0
- package/dist/ir/spread-copy-elision.d.ts +2 -2
- package/dist/ir/spread-copy-elision.js +7 -4
- package/dist/ir/string-layout-reuse.d.ts +9 -8
- package/dist/ir/string-layout-reuse.js +8 -16
- package/dist/ir/string-length-reuse.d.ts +20 -4
- package/dist/ir/string-length-reuse.js +57 -13
- package/dist/ir/transfer.d.ts +5 -5
- package/dist/ir/transfer.js +53 -31
- package/dist/ir/typed-property-access.d.ts +2 -0
- package/dist/ir/typed-property-access.js +21 -8
- package/dist/ir/virtual-call-frames.d.ts +7 -0
- package/dist/ir/virtual-call-frames.js +8 -0
- package/dist/native-signatures.d.ts +45 -0
- package/dist/native-signatures.js +368 -0
- package/dist/plugins/gea/host.d.ts +6 -1
- package/dist/plugins/gea/host.js +30 -1
- package/dist/plugins/gea/lower.js +9 -3
- package/dist/plugins/gea/members.js +1 -1
- package/dist/plugins/gea/plugin.js +2 -1
- package/dist/plugins/gea/prelude.d.ts +1 -1
- package/dist/plugins/gea/prelude.js +1 -1
- package/dist/plugins/gea/reactive-slots.js +6 -6
- package/dist/plugins/gea/render-bridge.js +5 -6
- package/dist/plugins/gea/user-agent-styles.js +1 -1
- package/dist/plugins/installed.d.ts +2 -2
- package/dist/plugins/installed.js +2 -2
- package/dist/plugins/load.js +1 -1
- package/dist/plugins/model.d.ts +21 -36
- package/dist/plugins/webgl/host.d.ts +23 -23
- package/dist/plugins/webgl/host.js +25 -26
- package/dist/plugins/webgl/plugin.d.ts +16 -19
- package/dist/plugins/webgl/plugin.js +16 -23
- package/dist/project-preparation.js +12 -14
- package/dist/projection/abi.js +13 -10
- package/dist/projection/bindings.d.ts +8 -0
- package/dist/projection/bindings.js +36 -5
- package/dist/projection/callee.d.ts +17 -15
- package/dist/projection/callee.js +108 -81
- package/dist/projection/class-property-presence.d.ts +1 -1
- package/dist/projection/class-property-presence.js +1 -1
- package/dist/projection/classes.d.ts +2 -0
- package/dist/projection/classes.js +4 -1
- package/dist/projection/dispatch.d.ts +19 -3
- package/dist/projection/dispatch.js +39 -16
- package/dist/projection/fields.d.ts +14 -2
- package/dist/projection/fields.js +100 -38
- package/dist/projection/function-source.d.ts +5 -0
- package/dist/projection/function-source.js +15 -0
- package/dist/projection/immediate-callees.d.ts +12 -0
- package/dist/projection/immediate-callees.js +36 -0
- package/dist/projection/index-protocols.d.ts +12 -0
- package/dist/projection/index-protocols.js +39 -0
- package/dist/projection/instance-test.d.ts +8 -0
- package/dist/projection/instance-test.js +3 -1
- package/dist/projection/method-values.d.ts +7 -0
- package/dist/projection/method-values.js +29 -0
- package/dist/projection/native-accessor-access.d.ts +26 -0
- package/dist/projection/native-accessor-access.js +18 -0
- package/dist/projection/native-callable-data.d.ts +24 -0
- package/dist/projection/native-callable-data.js +101 -0
- package/dist/projection/native-expando.d.ts +3 -0
- package/dist/projection/native-expando.js +13 -0
- package/dist/projection/native-object-data.d.ts +47 -0
- package/dist/projection/native-object-data.js +203 -0
- package/dist/projection/native-prototype-methods.d.ts +22 -0
- package/dist/projection/native-prototype-methods.js +161 -0
- package/dist/projection/regexp-fields.d.ts +35 -0
- package/dist/projection/regexp-fields.js +80 -0
- package/dist/projection/slots.d.ts +5 -1
- package/dist/projection/slots.js +89 -10
- package/dist/representation/derive.d.ts +5 -7
- package/dist/representation/derive.js +78 -78
- package/dist/representation/difference.js +1 -1
- package/dist/representation/host-abi.d.ts +2 -2
- package/dist/representation/host-abi.js +4 -5
- package/dist/representation/host-templates.d.ts +6 -2
- package/dist/representation/host-templates.js +8 -2
- package/dist/representation/intersection.d.ts +3 -3
- package/dist/representation/intersection.js +3 -3
- package/dist/representation/merge.js +1 -1
- package/dist/representation/model.d.ts +27 -22
- package/dist/representation/model.js +35 -22
- package/dist/representation/native-callable-data-storage.d.ts +85 -0
- package/dist/representation/native-callable-data-storage.js +398 -0
- package/dist/representation/native-data-properties.d.ts +14 -0
- package/dist/representation/native-data-properties.js +52 -0
- package/dist/representation/native-logical-receiver.d.ts +36 -0
- package/dist/representation/native-logical-receiver.js +92 -0
- package/dist/representation/object-shape.d.ts +1 -1
- package/dist/representation/object-shape.js +1 -1
- package/dist/representation/optional.js +2 -2
- package/dist/representation/physical-carrier.d.ts +25 -0
- package/dist/representation/physical-carrier.js +153 -0
- package/dist/representation/policies.d.ts +16 -10
- package/dist/representation/policies.js +5 -1
- package/dist/representation/primitives.js +3 -0
- package/dist/representation/promise-resolution.d.ts +19 -0
- package/dist/representation/promise-resolution.js +50 -0
- package/dist/representation/prototype-domains.d.ts +43 -0
- package/dist/representation/prototype-domains.js +226 -0
- package/dist/representation/proxy-carriers.d.ts +3 -3
- package/dist/representation/proxy-carriers.js +2 -3
- package/dist/representation/publish.d.ts +4 -0
- package/dist/representation/publish.js +73 -42
- package/dist/representation/record-fields.d.ts +2 -2
- package/dist/representation/record-fields.js +2 -2
- package/dist/representation/static-field-cells.d.ts +1 -1
- package/dist/representation/structural-method-abi.d.ts +6 -0
- package/dist/representation/structural-method-abi.js +13 -0
- package/dist/representation/unassigned-binding-cells.d.ts +3 -3
- package/dist/representation/union.js +19 -4
- package/dist/representation/unwritten-record-members.d.ts +6 -6
- package/dist/representation/unwritten-record-members.js +1 -1
- package/dist/representation/value-records.js +77 -5
- package/dist/representation/verify.js +1 -1
- package/dist/representation/well-known-symbols.d.ts +3 -0
- package/dist/representation/well-known-symbols.js +11 -0
- package/dist/semantics/alias-this-field-declaration-transform.js +3 -3
- package/dist/semantics/ambient-type-realization-transform.d.ts +19 -20
- package/dist/semantics/ambient-type-realization-transform.js +20 -12
- package/dist/semantics/ambient.d.ts +13 -13
- package/dist/semantics/ambient.js +12 -12
- package/dist/semantics/borrowed-builtin-call-bind-source-transform.d.ts +5 -0
- package/dist/semantics/borrowed-builtin-call-bind-source-transform.js +110 -52
- package/dist/semantics/borrowed-method-receiver-copy-source-transform.d.ts +4 -4
- package/dist/semantics/borrowed-method-receiver-copy-source-transform.js +4 -4
- package/dist/semantics/call-invalidated-narrowing.js +2 -2
- package/dist/semantics/callable-origins.d.ts +49 -1
- package/dist/semantics/callable-origins.js +148 -32
- package/dist/semantics/callable-own-data-slots.d.ts +122 -0
- package/dist/semantics/callable-own-data-slots.js +421 -0
- package/dist/semantics/class-alias.d.ts +4 -4
- package/dist/semantics/class-alias.js +4 -4
- package/dist/semantics/class-heritage.d.ts +8 -7
- package/dist/semantics/class-heritage.js +8 -7
- package/dist/semantics/commonjs-wrapper.js +5 -2
- package/dist/semantics/constructor-function-class-source-transform.js +2 -3
- package/dist/semantics/constructor-slot-subclasses.d.ts +1 -1
- package/dist/semantics/constructor-slot-subclasses.js +5 -5
- package/dist/semantics/declaration-overlay-transform.d.ts +9 -12
- package/dist/semantics/declaration-overlay-transform.js +135 -142
- package/dist/semantics/declared-integers.d.ts +24 -0
- package/dist/semantics/declared-integers.js +34 -0
- package/dist/semantics/define-property-source-transform.js +21 -8
- package/dist/semantics/dynamic-fallback.d.ts +1 -1
- package/dist/semantics/dynamic-fallback.js +1 -1
- package/dist/semantics/frontend.d.ts +12 -16
- package/dist/semantics/frontend.js +187 -75
- package/dist/semantics/host-methods.d.ts +3 -3
- package/dist/semantics/host-methods.js +1 -1
- package/dist/semantics/host-protocols.d.ts +3 -3
- package/dist/semantics/host-protocols.js +26 -26
- package/dist/semantics/interface-families.d.ts +2 -2
- package/dist/semantics/interface-families.js +46 -47
- package/dist/semantics/interface-implementors.d.ts +12 -15
- package/dist/semantics/interface-implementors.js +12 -15
- package/dist/semantics/jsdoc-namepath-transform.js +7 -7
- package/dist/semantics/model/operands.d.ts +18 -3
- package/dist/semantics/model/operands.js +41 -0
- package/dist/semantics/model/operations.d.ts +82 -1
- package/dist/semantics/model/selected-signature.d.ts +24 -3
- package/dist/semantics/model/structural-type-table.js +24 -6
- package/dist/semantics/model/structural-types.d.ts +10 -8
- package/dist/semantics/model/structural-types.js +7 -5
- package/dist/semantics/module-resolution.js +3 -2
- package/dist/semantics/native-callable-readonly-set.d.ts +17 -0
- package/dist/semantics/native-callable-readonly-set.js +1 -0
- package/dist/semantics/native-function-signatures.d.ts +14 -0
- package/dist/semantics/native-function-signatures.js +96 -0
- package/dist/semantics/native-object-data-slots.d.ts +72 -0
- package/dist/semantics/native-object-data-slots.js +679 -0
- package/dist/semantics/native-own-assignment.d.ts +62 -0
- package/dist/semantics/native-own-assignment.js +1 -0
- package/dist/semantics/normalize/absent-globals.d.ts +8 -8
- package/dist/semantics/normalize/absent-globals.js +5 -5
- package/dist/semantics/normalize/arguments-objects.d.ts +3 -1
- package/dist/semantics/normalize/arguments-objects.js +1 -1
- package/dist/semantics/normalize/asserted-argument-arms.d.ts +7 -7
- package/dist/semantics/normalize/asserted-arm-absence.d.ts +1 -2
- package/dist/semantics/normalize/asserted-arm-absence.js +1 -2
- package/dist/semantics/normalize/binding-fixpoint.js +3 -3
- package/dist/semantics/normalize/bivariant-slot-parameter.d.ts +2 -2
- package/dist/semantics/normalize/bivariant-slot-parameter.js +6 -6
- package/dist/semantics/normalize/callable-data-write.d.ts +46 -0
- package/dist/semantics/normalize/callable-data-write.js +182 -0
- package/dist/semantics/normalize/census.js +5 -5
- package/dist/semantics/normalize/class-instance-record-statement.d.ts +1 -1
- package/dist/semantics/normalize/class-instance-record-statement.js +1 -1
- package/dist/semantics/normalize/collection-bindings.d.ts +11 -13
- package/dist/semantics/normalize/collection-bindings.js +60 -33
- package/dist/semantics/normalize/commonjs-module-record.d.ts +7 -4
- package/dist/semantics/normalize/commonjs-module-record.js +93 -4
- package/dist/semantics/normalize/contribution.js +4 -4
- package/dist/semantics/normalize/dead-method-copies.d.ts +5 -5
- package/dist/semantics/normalize/dead-typeof-guards.d.ts +2 -2
- package/dist/semantics/normalize/dead-typeof-guards.js +6 -6
- package/dist/semantics/normalize/deferred-intrinsic-protocols.d.ts +22 -13
- package/dist/semantics/normalize/deferred-intrinsic-protocols.js +85 -13
- package/dist/semantics/normalize/derived-expression-type.d.ts +129 -91
- package/dist/semantics/normalize/derived-expression-type.js +419 -192
- package/dist/semantics/normalize/field-bindings.d.ts +4 -4
- package/dist/semantics/normalize/field-bindings.js +334 -67
- package/dist/semantics/normalize/flow/array-element-continuation.d.ts +2 -2
- package/dist/semantics/normalize/flow/array-element-continuation.js +35 -18
- package/dist/semantics/normalize/flow/callable-array-origins.d.ts +1 -1
- package/dist/semantics/normalize/flow/callable-array-origins.js +3 -3
- package/dist/semantics/normalize/flow/callable-completions.d.ts +2 -2
- package/dist/semantics/normalize/flow/callable-completions.js +2 -2
- package/dist/semantics/normalize/flow/callable-reach.d.ts +19 -6
- package/dist/semantics/normalize/flow/callable-reach.js +722 -289
- package/dist/semantics/normalize/flow/class-family-member-read.js +24 -29
- package/dist/semantics/normalize/flow/collection-value-continuation.d.ts +2 -2
- package/dist/semantics/normalize/flow/collection-value-continuation.js +2 -2
- package/dist/semantics/normalize/flow/component-solver.d.ts +19 -16
- package/dist/semantics/normalize/flow/component-solver.js +138 -69
- package/dist/semantics/normalize/flow/computed-key-set.d.ts +6 -7
- package/dist/semantics/normalize/flow/computed-key-set.js +20 -1
- package/dist/semantics/normalize/flow/export-importers.js +4 -4
- package/dist/semantics/normalize/flow/host-text-sink.d.ts +3 -2
- package/dist/semantics/normalize/flow/host-text-sink.js +4 -3
- package/dist/semantics/normalize/flow/intrinsic-array-callback-frames.js +3 -2
- package/dist/semantics/normalize/flow/intrinsic-data-definition.d.ts +2 -2
- package/dist/semantics/normalize/flow/intrinsic-data-definition.js +3 -3
- package/dist/semantics/normalize/flow/invocation-facts.d.ts +3 -2
- package/dist/semantics/normalize/flow/invocation-facts.js +3 -3
- package/dist/semantics/normalize/flow/member-call-forwarding.d.ts +12 -6
- package/dist/semantics/normalize/flow/member-call-forwarding.js +94 -21
- package/dist/semantics/normalize/flow/model.d.ts +5 -5
- package/dist/semantics/normalize/flow/model.js +11 -11
- package/dist/semantics/normalize/flow/node-path-token.js +3 -3
- package/dist/semantics/normalize/flow/origin-authority.d.ts +3 -3
- package/dist/semantics/normalize/flow/owned-class-receivers.js +8 -7
- package/dist/semantics/normalize/flow/parameter-values.js +6 -6
- package/dist/semantics/normalize/flow/proof-hypotheses.d.ts +30 -4
- package/dist/semantics/normalize/flow/proof-hypotheses.js +56 -5
- package/dist/semantics/normalize/flow/proof-memo-settlement.d.ts +21 -0
- package/dist/semantics/normalize/flow/proof-memo-settlement.js +32 -0
- package/dist/semantics/normalize/flow/record-alias-closure.d.ts +1 -1
- package/dist/semantics/normalize/flow/record-alias-closure.js +1 -1
- package/dist/semantics/normalize/flow/seeded-origins.d.ts +4 -4
- package/dist/semantics/normalize/flow/seeded-origins.js +4 -4
- package/dist/semantics/normalize/flow/source-accessor-descriptor.d.ts +22 -0
- package/dist/semantics/normalize/flow/source-accessor-descriptor.js +210 -0
- package/dist/semantics/normalize/flow/source-callable-own-data.d.ts +33 -0
- package/dist/semantics/normalize/flow/source-callable-own-data.js +238 -0
- package/dist/semantics/normalize/flow/source-callable-readonly-set.d.ts +26 -0
- package/dist/semantics/normalize/flow/source-callable-readonly-set.js +337 -0
- package/dist/semantics/normalize/flow/source-class-data.d.ts +7 -7
- package/dist/semantics/normalize/flow/source-class-data.js +25 -26
- package/dist/semantics/normalize/flow/source-class-static-data.d.ts +2 -2
- package/dist/semantics/normalize/flow/source-class-static-data.js +2 -2
- package/dist/semantics/normalize/flow/source-commonjs-exports.d.ts +15 -0
- package/dist/semantics/normalize/flow/source-commonjs-exports.js +7 -0
- package/dist/semantics/normalize/flow/source-descriptor-protocol.d.ts +20 -0
- package/dist/semantics/normalize/flow/source-descriptor-protocol.js +75 -0
- package/dist/semantics/normalize/flow/source-executing-parameter-values.d.ts +8 -0
- package/dist/semantics/normalize/flow/source-executing-parameter-values.js +93 -0
- package/dist/semantics/normalize/flow/source-global-binding.d.ts +13 -0
- package/dist/semantics/normalize/flow/source-global-binding.js +42 -0
- package/dist/semantics/normalize/flow/source-intrinsic-member-data.d.ts +27 -0
- package/dist/semantics/normalize/flow/source-intrinsic-member-data.js +178 -0
- package/dist/semantics/normalize/flow/source-invocation-frame-layout.d.ts +1 -1
- package/dist/semantics/normalize/flow/source-invocation-frame-layout.js +31 -11
- package/dist/semantics/normalize/flow/source-invocation-receiver.d.ts +7 -3
- package/dist/semantics/normalize/flow/source-invocation-receiver.js +30 -2
- package/dist/semantics/normalize/flow/source-native-class-alias.d.ts +7 -0
- package/dist/semantics/normalize/flow/source-native-class-alias.js +91 -0
- package/dist/semantics/normalize/flow/source-normal-predecessor.d.ts +10 -0
- package/dist/semantics/normalize/flow/source-normal-predecessor.js +90 -0
- package/dist/semantics/normalize/flow/source-property-key.d.ts +3 -0
- package/dist/semantics/normalize/flow/source-property-key.js +7 -0
- package/dist/semantics/normalize/flow/source-read-protocol.d.ts +20 -0
- package/dist/semantics/normalize/flow/source-read-protocol.js +108 -0
- package/dist/semantics/normalize/flow/source-record-data.js +31 -30
- package/dist/semantics/normalize/flow/source-value-session.d.ts +106 -3
- package/dist/semantics/normalize/flow/source-value-session.js +1172 -218
- package/dist/semantics/normalize/flow/standard-prototype-method-source.d.ts +16 -0
- package/dist/semantics/normalize/flow/standard-prototype-method-source.js +64 -0
- package/dist/semantics/normalize/flow/targets.d.ts +13 -14
- package/dist/semantics/normalize/flow/targets.js +20 -23
- package/dist/semantics/normalize/flow/value-flow.d.ts +2 -4
- package/dist/semantics/normalize/flow/value-flow.js +4 -13
- package/dist/semantics/normalize/flow/value-provenance.d.ts +23 -3
- package/dist/semantics/normalize/flow/value-provenance.js +44 -4
- package/dist/semantics/normalize/fresh-dictionary-storage.d.ts +32 -0
- package/dist/semantics/normalize/fresh-dictionary-storage.js +530 -0
- package/dist/semantics/normalize/fresh-indexed-storage.d.ts +43 -0
- package/dist/semantics/normalize/fresh-indexed-storage.js +88 -0
- package/dist/semantics/normalize/fresh-ordinary-object.d.ts +8 -0
- package/dist/semantics/normalize/fresh-ordinary-object.js +27 -0
- package/dist/semantics/normalize/gating.js +2 -2
- package/dist/semantics/normalize/global-host-mutations.js +770 -261
- package/dist/semantics/normalize/host-effect-contracts.d.ts +1 -1
- package/dist/semantics/normalize/host-effect-contracts.js +1 -1
- package/dist/semantics/normalize/host-mutation-computed-keys.d.ts +2 -2
- package/dist/semantics/normalize/host-mutation-computed-keys.js +8 -0
- package/dist/semantics/normalize/host-mutation-key-reader.d.ts +6 -11
- package/dist/semantics/normalize/host-mutation-key-reader.js +11 -28
- package/dist/semantics/normalize/host-mutation-keys.d.ts +11 -7
- package/dist/semantics/normalize/host-mutation-keys.js +26 -15
- package/dist/semantics/normalize/identities.js +20 -17
- package/dist/semantics/normalize/implicit-arguments-tuple.d.ts +8 -3
- package/dist/semantics/normalize/implicit-arguments-tuple.js +21 -4
- package/dist/semantics/normalize/installed-global-properties.d.ts +17 -0
- package/dist/semantics/normalize/installed-global-properties.js +214 -0
- package/dist/semantics/normalize/instantiation.js +6 -6
- package/dist/semantics/normalize/intrinsic-accessor-getter.d.ts +1 -1
- package/dist/semantics/normalize/intrinsic-property-call.d.ts +6 -1
- package/dist/semantics/normalize/intrinsic-property-call.js +19 -0
- package/dist/semantics/normalize/intrinsic-prototype.d.ts +7 -0
- package/dist/semantics/normalize/intrinsic-prototype.js +10 -0
- package/dist/semantics/normalize/intrinsic-return-identity.d.ts +5 -0
- package/dist/semantics/normalize/intrinsic-return-identity.js +29 -0
- package/dist/semantics/normalize/jsdoc-type-names.js +59 -63
- package/dist/semantics/normalize/keyof.js +3 -3
- package/dist/semantics/normalize/local-bindings.d.ts +4 -4
- package/dist/semantics/normalize/local-bindings.js +60 -61
- package/dist/semantics/normalize/logical-object-truthiness.d.ts +8 -0
- package/dist/semantics/normalize/logical-object-truthiness.js +20 -0
- package/dist/semantics/normalize/merged-declaration.d.ts +3 -3
- package/dist/semantics/normalize/merged-declaration.js +3 -3
- package/dist/semantics/normalize/never-override-result.d.ts +2 -3
- package/dist/semantics/normalize/never-override-result.js +2 -3
- package/dist/semantics/normalize/null-blind-parameter.d.ts +2 -2
- package/dist/semantics/normalize/null-blind-parameter.js +2 -2
- package/dist/semantics/normalize/object-bag-bindings.d.ts +19 -19
- package/dist/semantics/normalize/object-bag-bindings.js +334 -141
- package/dist/semantics/normalize/omitted-stated-parameter.d.ts +8 -8
- package/dist/semantics/normalize/omitted-stated-parameter.js +8 -9
- package/dist/semantics/normalize/override-field-arms.d.ts +3 -3
- package/dist/semantics/normalize/override-field-arms.js +15 -16
- package/dist/semantics/normalize/parameter-bindings.d.ts +13 -12
- package/dist/semantics/normalize/parameter-bindings.js +173 -139
- package/dist/semantics/normalize/parameter-slot.d.ts +9 -10
- package/dist/semantics/normalize/parameter-slot.js +16 -17
- package/dist/semantics/normalize/physical-overload-result.d.ts +8 -8
- package/dist/semantics/normalize/physical-overload-result.js +10 -10
- package/dist/semantics/normalize/producer-context.d.ts +27 -12
- package/dist/semantics/normalize/producers/allocations.js +5 -1
- package/dist/semantics/normalize/producers/bindings.js +8 -7
- package/dist/semantics/normalize/producers/class-lifecycle.js +52 -7
- package/dist/semantics/normalize/producers/computations.js +27 -3
- package/dist/semantics/normalize/producers/control.js +5 -5
- package/dist/semantics/normalize/producers/declaration-lifecycle.js +4 -4
- package/dist/semantics/normalize/producers/destructuring.js +10 -5
- package/dist/semantics/normalize/producers/erasure.d.ts +9 -0
- package/dist/semantics/normalize/producers/erasure.js +22 -0
- package/dist/semantics/normalize/producers/invocations.d.ts +1 -1
- package/dist/semantics/normalize/producers/invocations.js +200 -55
- package/dist/semantics/normalize/producers/logical-merge-type.d.ts +2 -2
- package/dist/semantics/normalize/producers/logical-merge-type.js +12 -12
- package/dist/semantics/normalize/producers/native-callable-readonly-set.d.ts +6 -0
- package/dist/semantics/normalize/producers/native-callable-readonly-set.js +24 -0
- package/dist/semantics/normalize/producers/native-own-assignment.d.ts +14 -0
- package/dist/semantics/normalize/producers/native-own-assignment.js +153 -0
- package/dist/semantics/normalize/producers/properties.js +153 -20
- package/dist/semantics/normalize/producers/protocol.js +4 -4
- package/dist/semantics/normalize/producers/references.js +21 -19
- package/dist/semantics/normalize/producers/shared.d.ts +1 -1
- package/dist/semantics/normalize/producers/shared.js +59 -58
- package/dist/semantics/normalize/producers/spread-arguments.js +7 -3
- package/dist/semantics/normalize/producers/tuple-spread.d.ts +2 -2
- package/dist/semantics/normalize/producers/tuple-spread.js +5 -5
- package/dist/semantics/normalize/property-key-domain.d.ts +6 -6
- package/dist/semantics/normalize/property-key-domain.js +7 -7
- package/dist/semantics/normalize/reachability.d.ts +6 -7
- package/dist/semantics/normalize/reachability.js +60 -62
- package/dist/semantics/normalize/record-home-arms.js +2 -3
- package/dist/semantics/normalize/record-link-families.d.ts +1 -1
- package/dist/semantics/normalize/record-link-families.js +1 -1
- package/dist/semantics/normalize/record-stand-in-arms.d.ts +4 -5
- package/dist/semantics/normalize/return-bindings.d.ts +19 -9
- package/dist/semantics/normalize/return-bindings.js +49 -41
- package/dist/semantics/normalize/script-global-redefinition.d.ts +1 -1
- package/dist/semantics/normalize/script-global-redefinition.js +1 -1
- package/dist/semantics/normalize/shared-array-storage.d.ts +4 -5
- package/dist/semantics/normalize/shared-array-storage.js +7 -8
- package/dist/semantics/normalize/sloppy-absence.d.ts +6 -3
- package/dist/semantics/normalize/sloppy-absence.js +7 -3
- package/dist/semantics/normalize/source-object-prototype-absence.d.ts +7 -0
- package/dist/semantics/normalize/source-object-prototype-absence.js +19 -0
- package/dist/semantics/normalize/specialization.d.ts +10 -10
- package/dist/semantics/normalize/specialization.js +107 -112
- package/dist/semantics/normalize/specialized-source-frames.d.ts +11 -0
- package/dist/semantics/normalize/specialized-source-frames.js +41 -0
- package/dist/semantics/normalize/structural-array-element.d.ts +5 -5
- package/dist/semantics/normalize/structural-array-element.js +40 -39
- package/dist/semantics/normalize/structural-array-read.js +3 -3
- package/dist/semantics/normalize/structural-callable.d.ts +15 -1
- package/dist/semantics/normalize/structural-callable.js +35 -3
- package/dist/semantics/normalize/structural-creation-order.d.ts +2 -2
- package/dist/semantics/normalize/structural-declarations.d.ts +22 -21
- package/dist/semantics/normalize/structural-declarations.js +42 -42
- package/dist/semantics/normalize/structural-declared-body.js +10 -11
- package/dist/semantics/normalize/structural-indexed-access.js +2 -2
- package/dist/semantics/normalize/structural-instantiated-member.d.ts +9 -10
- package/dist/semantics/normalize/structural-instantiated-member.js +43 -30
- package/dist/semantics/normalize/structural-joins.d.ts +4 -16
- package/dist/semantics/normalize/structural-joins.js +5 -65
- package/dist/semantics/normalize/structural-layout-relevance.d.ts +5 -5
- package/dist/semantics/normalize/structural-layout-relevance.js +22 -23
- package/dist/semantics/normalize/structural-layout-type.d.ts +1 -1
- package/dist/semantics/normalize/structural-layout-type.js +140 -107
- package/dist/semantics/normalize/structural-local-union.d.ts +1 -1
- package/dist/semantics/normalize/structural-local-union.js +38 -12
- package/dist/semantics/normalize/structural-mutable-field.d.ts +9 -0
- package/dist/semantics/normalize/structural-mutable-field.js +152 -0
- package/dist/semantics/normalize/structural-parts.d.ts +6 -0
- package/dist/semantics/normalize/structural-parts.js +35 -32
- package/dist/semantics/normalize/structural-receiver.d.ts +3 -3
- package/dist/semantics/normalize/structural-receiver.js +12 -13
- package/dist/semantics/normalize/structural-self-reference.d.ts +12 -11
- package/dist/semantics/normalize/structural-self-reference.js +24 -25
- package/dist/semantics/normalize/structural.d.ts +13 -3
- package/dist/semantics/normalize/structural.js +400 -201
- package/dist/semantics/normalize/suppressed-write-arms.d.ts +10 -11
- package/dist/semantics/normalize/symbol-keyed-this-slots.d.ts +6 -6
- package/dist/semantics/normalize/symbol-keyed-this-slots.js +4 -4
- package/dist/semantics/normalize/unresolvable-names.d.ts +2 -3
- package/dist/semantics/normalize/unresolvable-names.js +2 -2
- package/dist/semantics/normalize/unshared-array-result.d.ts +4 -4
- package/dist/semantics/normalize/unshared-array-result.js +4 -4
- package/dist/semantics/package-sources.js +2 -3
- package/dist/semantics/program.d.ts +10 -13
- package/dist/semantics/program.js +80 -26
- package/dist/semantics/property-key.d.ts +9 -0
- package/dist/semantics/property-key.js +25 -0
- package/dist/semantics/prototype-object-class-source-transform.js +2 -2
- package/dist/semantics/prototype-reparenting.d.ts +1 -1
- package/dist/semantics/prototype-reparenting.js +1 -1
- package/dist/semantics/shared-declaration-files.d.ts +6 -1
- package/dist/semantics/shared-declaration-files.js +2 -2
- package/dist/semantics/source-transform-protocol.d.ts +26 -0
- package/dist/semantics/source-transform-protocol.js +1 -0
- package/dist/semantics/stable-checker.js +9 -13
- package/dist/semantics/subclass-member-overlay-transform.d.ts +2 -2
- package/dist/semantics/subclass-member-overlay-transform.js +89 -88
- package/dist/semantics/this-constructor-source-transform.js +2 -2
- package/dist/semantics/unchecked-guard-argument-copies.d.ts +3 -3
- package/dist/semantics/unchecked-write-member-declarations.d.ts +9 -11
- package/dist/semantics/unchecked-write-member-declarations.js +11 -13
- package/dist/semantics/uninstantiable-classes.d.ts +1 -1
- package/dist/semantics/uninstantiable-classes.js +1 -1
- package/dist/targets/cpp/balanced-units.d.ts +1 -1
- package/dist/targets/cpp/balanced-units.js +1 -1
- package/dist/targets/cpp/borrowed-arm-projections.d.ts +2 -3
- package/dist/targets/cpp/borrowed-arm-projections.js +2 -3
- package/dist/targets/cpp/borrowed-call-entry.js +3 -3
- package/dist/targets/cpp/captures.d.ts +2 -2
- package/dist/targets/cpp/captures.js +4 -4
- package/dist/targets/cpp/char-code-buffers.d.ts +1 -1
- package/dist/targets/cpp/char-code-buffers.js +4 -1
- package/dist/targets/cpp/class-layout.d.ts +7 -17
- package/dist/targets/cpp/class-layout.js +6 -13
- package/dist/targets/cpp/class-properties/computed-method-value.d.ts +1 -1
- package/dist/targets/cpp/class-properties/computed-method-value.js +5 -27
- package/dist/targets/cpp/class-properties/emit-class-properties.d.ts +49 -59
- package/dist/targets/cpp/class-properties/emit-class-properties.js +68 -232
- package/dist/targets/cpp/class-properties/native-method-read.d.ts +5 -0
- package/dist/targets/cpp/class-properties/native-method-read.js +60 -0
- package/dist/targets/cpp/class-properties/native-prototype.d.ts +3 -1
- package/dist/targets/cpp/class-properties/native-prototype.js +5 -6
- package/dist/targets/cpp/class-ref-transport.d.ts +1 -11
- package/dist/targets/cpp/class-ref-transport.js +1 -9
- package/dist/targets/cpp/conversions.js +613 -252
- package/dist/targets/cpp/coroutine-bodies.d.ts +1 -97
- package/dist/targets/cpp/coroutine-bodies.js +1 -187
- package/dist/targets/cpp/document.js +1 -1
- package/dist/targets/cpp/emit-allocation.d.ts +0 -38
- package/dist/targets/cpp/emit-allocation.js +63 -88
- package/dist/targets/cpp/emit-array-view.d.ts +7 -0
- package/dist/targets/cpp/emit-array-view.js +47 -0
- package/dist/targets/cpp/emit-arrays.d.ts +9 -52
- package/dist/targets/cpp/emit-arrays.js +177 -113
- package/dist/targets/cpp/emit-binding-reference.d.ts +10 -0
- package/dist/targets/cpp/emit-binding-reference.js +19 -1
- package/dist/targets/cpp/emit-bindings.js +19 -24
- package/dist/targets/cpp/emit-buffers.d.ts +8 -4
- package/dist/targets/cpp/emit-buffers.js +88 -47
- package/dist/targets/cpp/emit-callable-view.d.ts +6 -0
- package/dist/targets/cpp/emit-callable-view.js +133 -0
- package/dist/targets/cpp/emit-callable.d.ts +11 -1
- package/dist/targets/cpp/emit-callable.js +225 -266
- package/dist/targets/cpp/emit-carrier-members.d.ts +2 -2
- package/dist/targets/cpp/emit-carrier-members.js +42 -35
- package/dist/targets/cpp/emit-certified-conversion.d.ts +7 -0
- package/dist/targets/cpp/emit-certified-conversion.js +27 -0
- package/dist/targets/cpp/emit-context.d.ts +123 -64
- package/dist/targets/cpp/emit-context.js +147 -44
- package/dist/targets/cpp/emit-descriptor-snapshot.d.ts +10 -0
- package/dist/targets/cpp/emit-descriptor-snapshot.js +60 -0
- package/dist/targets/cpp/emit-dictionary-view.d.ts +6 -0
- package/dist/targets/cpp/emit-dictionary-view.js +102 -0
- package/dist/targets/cpp/emit-document-record-view.d.ts +3 -0
- package/dist/targets/cpp/emit-document-record-view.js +104 -0
- package/dist/targets/cpp/emit-dynamic-properties.d.ts +42 -17
- package/dist/targets/cpp/emit-dynamic-properties.js +118 -72
- package/dist/targets/cpp/emit-equality.d.ts +2 -1
- package/dist/targets/cpp/emit-equality.js +65 -45
- package/dist/targets/cpp/emit-exceptions.js +1 -1
- package/dist/targets/cpp/emit-in.js +22 -11
- package/dist/targets/cpp/emit-instanceof.js +15 -14
- package/dist/targets/cpp/emit-integers.d.ts +40 -3
- package/dist/targets/cpp/emit-integers.js +76 -5
- package/dist/targets/cpp/emit-iterable-object-view.d.ts +2 -0
- package/dist/targets/cpp/emit-iterable-object-view.js +15 -11
- package/dist/targets/cpp/emit-iterator-object-view.d.ts +2 -0
- package/dist/targets/cpp/emit-iterator-object-view.js +24 -16
- package/dist/targets/cpp/emit-iterator.d.ts +2 -0
- package/dist/targets/cpp/emit-iterator.js +115 -43
- package/dist/targets/cpp/emit-json.js +6 -6
- package/dist/targets/cpp/emit-jsx.js +2 -2
- package/dist/targets/cpp/emit-live-field-view.d.ts +26 -0
- package/dist/targets/cpp/emit-live-field-view.js +50 -0
- package/dist/targets/cpp/emit-narrowing.d.ts +60 -139
- package/dist/targets/cpp/emit-narrowing.js +694 -624
- package/dist/targets/cpp/emit-native-accessor-definition.d.ts +10 -0
- package/dist/targets/cpp/emit-native-accessor-definition.js +94 -0
- package/dist/targets/cpp/emit-native-callable-data.d.ts +23 -0
- package/dist/targets/cpp/emit-native-callable-data.js +117 -0
- package/dist/targets/cpp/emit-native-document-entry.d.ts +4 -0
- package/dist/targets/cpp/emit-native-document-entry.js +52 -0
- package/dist/targets/cpp/emit-native-field-view.d.ts +26 -0
- package/dist/targets/cpp/emit-native-field-view.js +217 -0
- package/dist/targets/cpp/emit-native-method.d.ts +16 -0
- package/dist/targets/cpp/emit-native-method.js +90 -0
- package/dist/targets/cpp/emit-native-object-data.d.ts +7 -0
- package/dist/targets/cpp/emit-native-object-data.js +66 -0
- package/dist/targets/cpp/emit-native-object-sample.d.ts +8 -0
- package/dist/targets/cpp/emit-native-object-sample.js +34 -0
- package/dist/targets/cpp/emit-native-own-assignment.d.ts +7 -0
- package/dist/targets/cpp/emit-native-own-assignment.js +119 -0
- package/dist/targets/cpp/emit-native-selection.d.ts +2 -2
- package/dist/targets/cpp/emit-native-selection.js +14 -5
- package/dist/targets/cpp/emit-number-storage.d.ts +2 -0
- package/dist/targets/cpp/emit-number-storage.js +1 -0
- package/dist/targets/cpp/emit-presence.d.ts +3 -4
- package/dist/targets/cpp/emit-presence.js +43 -21
- package/dist/targets/cpp/emit-properties.js +224 -111
- package/dist/targets/cpp/emit-protocol-iterator.d.ts +2 -0
- package/dist/targets/cpp/emit-protocol-iterator.js +45 -23
- package/dist/targets/cpp/emit-record-view.d.ts +5 -10
- package/dist/targets/cpp/emit-record-view.js +223 -269
- package/dist/targets/cpp/emit-return.js +33 -8
- package/dist/targets/cpp/emit-scopes.d.ts +2 -2
- package/dist/targets/cpp/emit-sum-widening.js +13 -5
- package/dist/targets/cpp/emit-tonumber.d.ts +1 -1
- package/dist/targets/cpp/emit-tonumber.js +3 -3
- package/dist/targets/cpp/emit-tostring.d.ts +20 -2
- package/dist/targets/cpp/emit-tostring.js +131 -28
- package/dist/targets/cpp/emit-typeof.d.ts +4 -0
- package/dist/targets/cpp/emit-typeof.js +29 -1
- package/dist/targets/cpp/emit-union-properties.d.ts +6 -23
- package/dist/targets/cpp/emit-union-properties.js +127 -235
- package/dist/targets/cpp/emit.d.ts +4 -1
- package/dist/targets/cpp/emit.js +336 -119
- package/dist/targets/cpp/error-types.d.ts +1 -3
- package/dist/targets/cpp/error-types.js +1 -2
- package/dist/targets/cpp/evaluated-once.d.ts +4 -4
- package/dist/targets/cpp/evaluated-once.js +5 -5
- package/dist/targets/cpp/function-source-reads.d.ts +2 -15
- package/dist/targets/cpp/function-source-reads.js +3 -38
- package/dist/targets/cpp/host/core-globals.d.ts +5 -0
- package/dist/targets/cpp/host/core-globals.js +10 -0
- package/dist/targets/cpp/host/emit-host-arity.js +1 -1
- package/dist/targets/cpp/host/emit-host-invoke.js +73 -23
- package/dist/targets/cpp/host/emit-host-object.d.ts +2 -1
- package/dist/targets/cpp/host/emit-host-object.js +328 -145
- package/dist/targets/cpp/host/emit-host-properties.js +4 -6
- package/dist/targets/cpp/host/emit-host-reflect.js +29 -5
- package/dist/targets/cpp/host/emit-host-value.d.ts +1 -1
- package/dist/targets/cpp/host/emit-host-value.js +2 -2
- package/dist/targets/cpp/host/host-members.d.ts +11 -0
- package/dist/targets/cpp/host/host-members.js +27 -5
- package/dist/targets/cpp/host/host-method-aliases.d.ts +1 -30
- package/dist/targets/cpp/host/host-method-aliases.js +1 -76
- package/dist/targets/cpp/host/native-protocols.js +1 -1
- package/dist/targets/cpp/host/object-protocol.d.ts +1 -1
- package/dist/targets/cpp/host/object-protocol.js +24 -24
- package/dist/targets/cpp/host-namespace-reads.d.ts +1 -83
- package/dist/targets/cpp/host-namespace-reads.js +1 -113
- package/dist/targets/cpp/manifest/capabilities.js +33 -33
- package/dist/targets/cpp/manifest.d.ts +5 -0
- package/dist/targets/cpp/manifest.js +38 -14
- package/dist/targets/cpp/native-collection-base.js +7 -6
- package/dist/targets/cpp/native-debug-source.d.ts +15 -0
- package/dist/targets/cpp/native-debug-source.js +21 -0
- package/dist/targets/cpp/native-error-base.d.ts +1 -1
- package/dist/targets/cpp/native-error-base.js +1 -1
- package/dist/targets/cpp/native-narrowing-transport.d.ts +2 -0
- package/dist/targets/cpp/native-narrowing-transport.js +25 -5
- package/dist/targets/cpp/native-view-targets.d.ts +3 -0
- package/dist/targets/cpp/native-view-targets.js +5 -0
- package/dist/targets/cpp/prototype/emit-prototype-array.d.ts +3 -33
- package/dist/targets/cpp/prototype/emit-prototype-array.js +40 -22
- package/dist/targets/cpp/prototype/emit-prototype-date.d.ts +1 -58
- package/dist/targets/cpp/prototype/emit-prototype-date.js +14 -97
- package/dist/targets/cpp/prototype/emit-prototype-error.d.ts +20 -0
- package/dist/targets/cpp/prototype/emit-prototype-error.js +2 -2
- package/dist/targets/cpp/prototype/emit-prototype-invoke.d.ts +3 -27
- package/dist/targets/cpp/prototype/emit-prototype-invoke.js +60 -52
- package/dist/targets/cpp/prototype/emit-prototype-iterator.d.ts +1 -41
- package/dist/targets/cpp/prototype/emit-prototype-iterator.js +4 -43
- package/dist/targets/cpp/prototype/emit-prototype-promise.d.ts +2 -13
- package/dist/targets/cpp/prototype/emit-prototype-promise.js +10 -58
- package/dist/targets/cpp/prototype/emit-prototype-regexp.d.ts +4 -25
- package/dist/targets/cpp/prototype/emit-prototype-regexp.js +16 -81
- package/dist/targets/cpp/prototype/emit-prototype-string.d.ts +1 -1
- package/dist/targets/cpp/prototype/emit-prototype-string.js +17 -28
- package/dist/targets/cpp/prototype/prototype-method-reads.js +4 -80
- package/dist/targets/cpp/reactive-dependencies.d.ts +12 -6
- package/dist/targets/cpp/reactive-dependencies.js +62 -42
- package/dist/targets/cpp/reactive-origins.js +12 -0
- package/dist/targets/cpp/records.d.ts +133 -14
- package/dist/targets/cpp/records.js +345 -153
- package/dist/targets/cpp/regexp-types.d.ts +1 -26
- package/dist/targets/cpp/regexp-types.js +4 -29
- package/dist/targets/cpp/segment-scopes.d.ts +30 -0
- package/dist/targets/cpp/segment-scopes.js +294 -0
- package/dist/targets/cpp/translation-unit.d.ts +21 -2
- package/dist/targets/cpp/translation-unit.js +121 -276
- package/dist/targets/cpp/types.d.ts +8 -3
- package/dist/targets/cpp/types.js +30 -6
- package/dist/targets/cpp/virtual-callees.d.ts +18 -0
- package/dist/targets/cpp/virtual-callees.js +27 -0
- package/dist/targets/cpp/virtual-methods.d.ts +7 -7
- package/dist/targets/cpp/virtual-methods.js +213 -58
- package/package.json +8 -3
- package/src/targets/cpp/runtime/gea_dictionary_view.h +204 -0
- package/src/targets/cpp/runtime/gea_document_view.h +845 -0
- package/src/targets/cpp/runtime/gea_dynamic_proxy.h +66 -23
- package/src/targets/cpp/runtime/gea_eval.h +6 -6
- package/src/targets/cpp/runtime/gea_runtime.h +7550 -1166
- package/dist/targets/cpp/direct-call-receivers.d.ts +0 -37
- package/dist/targets/cpp/direct-call-receivers.js +0 -79
|
@@ -1,23 +1,44 @@
|
|
|
1
|
+
import { nativeBodyIgnoresLogicalReceiver } from './native-logical-receiver-body.js';
|
|
2
|
+
import { nativeConstructorMethodBodiesOf } from './native-constructor-reads.js';
|
|
1
3
|
import { classLayoutOfCopy, classLayoutsConstructedBy, constructedBaseOf } from '../projection/classes.js';
|
|
2
4
|
import { extendsClass } from '../projection/dispatch.js';
|
|
3
5
|
import { abiOfCallee } from '../projection/callee.js';
|
|
4
6
|
import { classMemberOf, classMethodOverrideOf, classPrototypeMethodMutableOf } from '../projection/fields.js';
|
|
7
|
+
import { nativeDocumentEntryViewOf } from '../conversion/document-record-view.js';
|
|
8
|
+
import { nativeDocumentArrayEntryOf } from './native-document-array-entries.js';
|
|
9
|
+
import { nativeArrayViewIdentityTransportOf, nativeArrayRootViewPlansOf } from '../conversion/array-view.js';
|
|
5
10
|
import { nativeClassReferenceTransportMatches } from '../conversion/native-class-reference.js';
|
|
6
|
-
import {
|
|
11
|
+
import { nativeCallableEntryReceiverOf, nativeCallableDynamicIdentityTransportMatches, nativeCallableIdentityTransportMatches, nativeCallableLogicalReceiverTransportMatches } from '../conversion/native-callable-adapter.js';
|
|
7
12
|
import { nativePayloadTransportMatches } from '../conversion/native-payload-transport.js';
|
|
13
|
+
import { dynamicResultCarriersOf } from '../conversion/dynamic-result-carriers.js';
|
|
8
14
|
import { nativeMergePayloadTransportMatches } from './native-merge-transport.js';
|
|
9
15
|
import { nativeArrayTransportOf } from './native-array-transport.js';
|
|
16
|
+
import { nativeArrayInsertionOf } from './native-array-insertion.js';
|
|
10
17
|
import { nativeDictionaryTransportOf } from './native-dictionary-transport.js';
|
|
18
|
+
import { nativeFieldViewIdentityTransportOf, nativeFieldViewLiveLeavesOf, nativeFieldViewPlansOf } from '../conversion/native-field-view.js';
|
|
19
|
+
import { nativeRecordProductsOf } from '../conversion/native-record-products.js';
|
|
20
|
+
import { nativeFieldViewCarrierNeedsReceipt, nativeFieldViewBodyCitationsOf } from './native-field-view-facts.js';
|
|
21
|
+
import { nativeFieldViewDomainsOf } from './native-field-view-domains.js';
|
|
22
|
+
import { NATIVE_SUM_MATERIALIZER } from '../conversion/native-sum.js';
|
|
23
|
+
import { recipeClosureOf } from '../conversion/recipe-closure.js';
|
|
11
24
|
import { nativeSequenceTransportOf } from './native-sequence-transport.js';
|
|
12
25
|
import { nativeClassInitializationOf, nativeSuperInitializationOf } from './native-class-initialization.js';
|
|
13
26
|
import { nativeClassConstructionOf } from './native-class-construction.js';
|
|
27
|
+
import { nativeOrdinaryPropertyPreservesPresence } from './native-property-presence-effects.js';
|
|
14
28
|
import { nativeClassAccessorEntryOf } from './native-class-accessor.js';
|
|
29
|
+
import { nativeConstructorAccessorEntryOf, nativeConstructorStaticCellOf } from './native-constructor-static.js';
|
|
30
|
+
import { censusClassStaticFieldSlots, staticStorageOwnerOf } from './class-static-fields.js';
|
|
15
31
|
import { hasNativePropertyLayout } from './native-fixed-layout.js';
|
|
16
32
|
import { nativeKeyQueryOf } from './native-key-query.js';
|
|
33
|
+
import { nativeCarrierPredicateOf } from './native-carrier-predicate.js';
|
|
34
|
+
import { nativePropertyPresenceAuthorityOf, nativePropertyPresenceStorageCandidatesOf } from './native-property-presence.js';
|
|
17
35
|
import { abiKey, representationKey, walkRepresentation } from '../representation/model.js';
|
|
36
|
+
import { allOperationsOf } from './model.js';
|
|
18
37
|
import { nativeArgumentsMatch, receivedCallArguments } from './call-entry.js';
|
|
38
|
+
import { nativeGenericCallEntriesOf, nativeGenericSelectorMatches } from './generic-call-entry.js';
|
|
19
39
|
import { classConstructorBodyMatches, constructMatchesAbi, explicitObjectConstructEntryOf, ordinaryConstructBodyMatches } from './construct-entry.js';
|
|
20
40
|
import { observesNativeCarrierOnly, operandsOfIrOperation, resultOfIrOperation } from './queries.js';
|
|
41
|
+
import { nativeCallablePrimitiveDataWritePreservesOwner } from './native-callable-data-flow.js';
|
|
21
42
|
/**
|
|
22
43
|
* Flow-insensitive native field provenance. A field write contributes
|
|
23
44
|
* every implementation it can store; it never establishes an immutable-field
|
|
@@ -29,7 +50,7 @@ import { observesNativeCarrierOnly, operandsOfIrOperation, resultOfIrOperation }
|
|
|
29
50
|
* which that demand needs. Unsupported transports fail closed. In particular,
|
|
30
51
|
* an arbitrary matching callable signature is never an implementation source.
|
|
31
52
|
*/
|
|
32
|
-
const computeNativeCallableFlow = (bodies, placements, classes, conversions, trace, deriver) => {
|
|
53
|
+
const computeNativeCallableFlow = (bodies, placements, classes, conversions, trace, deriver, programConversions, constructionTopology) => {
|
|
33
54
|
const propertyLayoutCache = new Map();
|
|
34
55
|
const nativePropertyLayoutOf = (representation) => hasNativePropertyLayout(representation, deriver ?? null, classes, new Set(), propertyLayoutCache);
|
|
35
56
|
const cells = [];
|
|
@@ -37,6 +58,12 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
37
58
|
const nextSweep = [];
|
|
38
59
|
let sweepIndex = null;
|
|
39
60
|
let revision = 0;
|
|
61
|
+
// Bumped whenever an existing heap changes what `slotsOf` can answer: it
|
|
62
|
+
// loses validity, gains a field, or becomes an ordinary allocation.
|
|
63
|
+
let heapEpoch = 0;
|
|
64
|
+
// Set when a heap selection consulted a presence guard, which reads cells
|
|
65
|
+
// other than the receiver; see `heapEffect`.
|
|
66
|
+
let presenceConsulted = false;
|
|
40
67
|
// Preserve the old sweep's cell order, including its backwards edges, while
|
|
41
68
|
// visiting only changed cells. This also preserves closed-family ordering.
|
|
42
69
|
const pushCell = (cell) => {
|
|
@@ -83,9 +110,14 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
83
110
|
};
|
|
84
111
|
const changed = (cell) => {
|
|
85
112
|
revision++;
|
|
113
|
+
cell.version++;
|
|
86
114
|
schedule(cell);
|
|
87
115
|
};
|
|
88
116
|
const addFunction = (cell, id) => {
|
|
117
|
+
if (!cell.documentInstalled && !cell.documentBlocked) {
|
|
118
|
+
cell.documentBlocked = true;
|
|
119
|
+
changed(cell);
|
|
120
|
+
}
|
|
89
121
|
if (cell.functions.has(id))
|
|
90
122
|
return;
|
|
91
123
|
cell.functions.add(id);
|
|
@@ -97,24 +129,96 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
97
129
|
cell.heaps.add(heap);
|
|
98
130
|
changed(cell);
|
|
99
131
|
};
|
|
100
|
-
const markUnknown = (cell, reason) => {
|
|
132
|
+
const markUnknown = (cell, reason, admitted, installedDocumentSource = false) => {
|
|
133
|
+
if (!installedDocumentSource && !cell.documentInstalled && !cell.documentBlocked) {
|
|
134
|
+
cell.documentBlocked = true;
|
|
135
|
+
changed(cell);
|
|
136
|
+
}
|
|
101
137
|
if (!cell.unknown) {
|
|
102
138
|
cell.unknown = true;
|
|
139
|
+
cell.unknownHeaps = admitted === undefined ? null : new Set(admitted);
|
|
103
140
|
changed(cell);
|
|
104
141
|
}
|
|
142
|
+
else if (cell.unknownHeaps !== null) {
|
|
143
|
+
if (admitted === undefined) {
|
|
144
|
+
cell.unknownHeaps = null;
|
|
145
|
+
changed(cell);
|
|
146
|
+
}
|
|
147
|
+
else
|
|
148
|
+
for (const heap of admitted)
|
|
149
|
+
if (!cell.unknownHeaps.has(heap)) {
|
|
150
|
+
cell.unknownHeaps.add(heap);
|
|
151
|
+
changed(cell);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
105
154
|
if (trace && reason !== undefined)
|
|
106
155
|
cell.unknownReason ??= reason;
|
|
107
156
|
};
|
|
108
|
-
const markEscaped = (cell, reason) => {
|
|
109
|
-
|
|
110
|
-
|
|
157
|
+
const markEscaped = (cell, reason, sources = [null]) => {
|
|
158
|
+
// One reschedule per call, not one per new source: nothing pops between
|
|
159
|
+
// them, so every repeat was already a no-op on a queued cell.
|
|
160
|
+
let grew = !cell.escaped;
|
|
161
|
+
cell.escaped = true;
|
|
162
|
+
for (const source of sources)
|
|
163
|
+
if (!cell.escapeSources.has(source)) {
|
|
164
|
+
cell.escapeSources.add(source);
|
|
165
|
+
cell.escapeSourceList.push(source);
|
|
166
|
+
grew = true;
|
|
167
|
+
}
|
|
168
|
+
if (grew) {
|
|
111
169
|
changed(cell);
|
|
112
|
-
for (const
|
|
113
|
-
schedule(
|
|
170
|
+
for (const incoming of cell.incoming)
|
|
171
|
+
schedule(incoming);
|
|
114
172
|
}
|
|
115
173
|
if (trace && reason !== undefined)
|
|
116
174
|
cell.escapeReason ??= reason;
|
|
117
175
|
};
|
|
176
|
+
const absorbEscape = (cell, target) => {
|
|
177
|
+
const list = target.escapeSourceList;
|
|
178
|
+
const from = cell.escapeAbsorbed?.get(target) ?? 0;
|
|
179
|
+
if (from === list.length && cell.escaped) {
|
|
180
|
+
if (trace && target.escapeReason !== undefined)
|
|
181
|
+
cell.escapeReason ??= target.escapeReason;
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
// Exactly `markEscaped(cell, reason, target.escapeSources)`: every source
|
|
185
|
+
// before `from` is already in this cell, so only the tail can add one,
|
|
186
|
+
// and it adds them in the same order.
|
|
187
|
+
let grew = !cell.escaped;
|
|
188
|
+
cell.escaped = true;
|
|
189
|
+
for (let at = from; at < list.length; at++) {
|
|
190
|
+
const source = list[at];
|
|
191
|
+
if (!cell.escapeSources.has(source)) {
|
|
192
|
+
cell.escapeSources.add(source);
|
|
193
|
+
cell.escapeSourceList.push(source);
|
|
194
|
+
grew = true;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
if (grew) {
|
|
198
|
+
changed(cell);
|
|
199
|
+
for (const incoming of cell.incoming)
|
|
200
|
+
schedule(incoming);
|
|
201
|
+
}
|
|
202
|
+
if (trace && target.escapeReason !== undefined)
|
|
203
|
+
cell.escapeReason ??= target.escapeReason;
|
|
204
|
+
(cell.escapeAbsorbed ??= new Map()).set(target, list.length);
|
|
205
|
+
};
|
|
206
|
+
const markLogicalReceiver = (cell, dynamic = false) => {
|
|
207
|
+
if (!cell.logicalReceiver) {
|
|
208
|
+
cell.logicalReceiver = true;
|
|
209
|
+
changed(cell);
|
|
210
|
+
}
|
|
211
|
+
if (dynamic && !cell.dynamicReceiver) {
|
|
212
|
+
cell.dynamicReceiver = true;
|
|
213
|
+
changed(cell);
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
const markIgnoredLogicalReceiver = (cell) => {
|
|
217
|
+
if (!cell.ignoresLogicalReceiver) {
|
|
218
|
+
cell.ignoresLogicalReceiver = true;
|
|
219
|
+
changed(cell);
|
|
220
|
+
}
|
|
221
|
+
};
|
|
118
222
|
const fresh = () => {
|
|
119
223
|
const cell = {
|
|
120
224
|
index: cells.length,
|
|
@@ -123,8 +227,21 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
123
227
|
functions: new Set(),
|
|
124
228
|
heaps: new Set(),
|
|
125
229
|
edges: new Map(),
|
|
230
|
+
documents: new Map(),
|
|
231
|
+
arrayViews: new Set(),
|
|
232
|
+
descriptorSnapshots: new Set(),
|
|
233
|
+
fieldViews: new Set(),
|
|
234
|
+
documentInstalled: false,
|
|
235
|
+
documentBlocked: false,
|
|
126
236
|
unknown: false,
|
|
127
|
-
|
|
237
|
+
unknownHeaps: new Set(),
|
|
238
|
+
escaped: false,
|
|
239
|
+
escapeSources: new Set(),
|
|
240
|
+
escapeSourceList: [],
|
|
241
|
+
version: 0,
|
|
242
|
+
logicalReceiver: false,
|
|
243
|
+
dynamicReceiver: false,
|
|
244
|
+
ignoresLogicalReceiver: false
|
|
128
245
|
};
|
|
129
246
|
cells.push(cell);
|
|
130
247
|
return cell;
|
|
@@ -151,17 +268,38 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
151
268
|
const recordHeaps = new Map();
|
|
152
269
|
const arrayHeaps = new Map();
|
|
153
270
|
const dictionaryHeaps = new Map();
|
|
271
|
+
const proxyHeaps = new Map();
|
|
154
272
|
const recordViews = new WeakMap();
|
|
155
273
|
const adaptedFrames = new Map();
|
|
156
274
|
const transportsCallablePrefix = (from, to, node) => {
|
|
157
|
-
|
|
275
|
+
const receiver = nativeCallableEntryReceiverOf(from, to, node);
|
|
276
|
+
if (receiver === null)
|
|
158
277
|
return false;
|
|
159
278
|
const source = abiKey(abiOfCallee(from));
|
|
160
|
-
const
|
|
161
|
-
targets.
|
|
279
|
+
const target = abiKey(abiOfCallee(to));
|
|
280
|
+
const targets = adaptedFrames.get(source) ?? new Map();
|
|
281
|
+
targets.set(target, receiver === 'logical' || targets.get(target) === 'logical' ? 'logical' : 'physical');
|
|
162
282
|
adaptedFrames.set(source, targets);
|
|
163
283
|
return true;
|
|
164
284
|
};
|
|
285
|
+
const adaptedReceiverOf = (source, target) => {
|
|
286
|
+
const destination = abiKey(target);
|
|
287
|
+
const pending = [[abiKey(source), 'physical']];
|
|
288
|
+
const visited = new Set();
|
|
289
|
+
for (let index = 0; index < pending.length; index++) {
|
|
290
|
+
const [current, receiver] = pending[index];
|
|
291
|
+
if (visited.has(current))
|
|
292
|
+
continue;
|
|
293
|
+
visited.add(current);
|
|
294
|
+
for (const [next, entry] of adaptedFrames.get(current) ?? []) {
|
|
295
|
+
const forwarded = receiver === 'logical' || entry === 'logical' ? 'logical' : 'physical';
|
|
296
|
+
if (next === destination)
|
|
297
|
+
return forwarded;
|
|
298
|
+
pending.push([next, forwarded]);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
return null;
|
|
302
|
+
};
|
|
165
303
|
const methodFallback = (declaration, key) => {
|
|
166
304
|
if (!classMethodOverrideOf(classes, declaration, key) || classPrototypeMethodMutableOf(classes, declaration, key))
|
|
167
305
|
return null;
|
|
@@ -185,16 +323,67 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
185
323
|
classHeaps.set(layout.declaration, { declaration: layout.declaration, fields: slots, layoutKey: null, valid: true });
|
|
186
324
|
}
|
|
187
325
|
const operations = bodies.flatMap((body) => [...body.blocks.values()].flatMap((block) => [...block.operations, block.terminator]));
|
|
326
|
+
const staticSlots = censusClassStaticFieldSlots(bodies, classes);
|
|
327
|
+
const staticHeaps = new Map([...staticSlots.slots].map(([declaration, slots]) => [
|
|
328
|
+
declaration,
|
|
329
|
+
{
|
|
330
|
+
declaration: null,
|
|
331
|
+
layoutKey: `constructor-static:${declaration}`,
|
|
332
|
+
valid: true,
|
|
333
|
+
fields: new Map([...slots].map(([key, representation]) => [key, { cell: fresh(), representation }]))
|
|
334
|
+
}
|
|
335
|
+
]));
|
|
336
|
+
const constructorHeapsOf = (declaration) => {
|
|
337
|
+
const found = new Set();
|
|
338
|
+
const walked = new Set();
|
|
339
|
+
let current = declaration;
|
|
340
|
+
while (current !== null && !walked.has(current)) {
|
|
341
|
+
walked.add(current);
|
|
342
|
+
const heap = staticHeaps.get(staticStorageOwnerOf(classes, current));
|
|
343
|
+
if (heap)
|
|
344
|
+
found.add(heap);
|
|
345
|
+
current = classes.get(current)?.base ?? null;
|
|
346
|
+
}
|
|
347
|
+
return [...found];
|
|
348
|
+
};
|
|
349
|
+
const citedViewNodes = bodies
|
|
350
|
+
.flatMap((body) => nativeFieldViewBodyCitationsOf(body).map((id) => conversions?.nodeById(id)))
|
|
351
|
+
.filter((node) => node !== null && node !== undefined);
|
|
352
|
+
for (const recipe of programConversions ?? [])
|
|
353
|
+
if (conversions?.nodeById(recipe.conversion.id) === recipe.conversion)
|
|
354
|
+
citedViewNodes.push(recipe.conversion);
|
|
355
|
+
const viewNodes = [...recipeClosureOf(citedViewNodes, conversions?.nodeById).values()];
|
|
356
|
+
const viewShapes = new Set(nativeFieldViewPlansOf(viewNodes).map((plan) => plan.target.shapeId));
|
|
357
|
+
const viewMethodFields = new Map();
|
|
358
|
+
for (const node of viewNodes) {
|
|
359
|
+
if (!nativeFieldViewIdentityTransportOf(node) || !('materializer' in node.capability))
|
|
360
|
+
continue;
|
|
361
|
+
for (const [plan, fields] of node.capability.materializer.recordView?.fieldViews ?? []) {
|
|
362
|
+
if (plan.kind !== 'fields')
|
|
363
|
+
continue;
|
|
364
|
+
const methods = viewMethodFields.get(fields.target.shapeId) ?? new Map();
|
|
365
|
+
for (const { field, read } of plan.fields)
|
|
366
|
+
if (read.kind === 'bound-method' || read.kind === 'method-value')
|
|
367
|
+
methods.set(field.key, field.value);
|
|
368
|
+
viewMethodFields.set(fields.target.shapeId, methods);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
const valueCarriers = new Map(bodies.flatMap((body) => [...body.values]));
|
|
188
372
|
const producers = new Map();
|
|
189
373
|
const bodyById = new Map();
|
|
374
|
+
const physicalBodiesBySource = new Map();
|
|
190
375
|
const returns = new Map();
|
|
191
376
|
// super() consumes the frame receiver even when the body never spells this
|
|
192
377
|
// and lowering therefore produces no receiver SSA operation.
|
|
193
378
|
const frameReceivers = new Map();
|
|
194
379
|
const parameters = new Map();
|
|
195
380
|
const owner = new Map();
|
|
381
|
+
const physicalOwner = new Map();
|
|
196
382
|
for (const body of bodies) {
|
|
197
383
|
const id = body.sourceOwner;
|
|
384
|
+
const physicalBodies = physicalBodiesBySource.get(id) ?? [];
|
|
385
|
+
physicalBodies.push(body);
|
|
386
|
+
physicalBodiesBySource.set(id, physicalBodies);
|
|
198
387
|
bodyById.set(id, bodyById.has(id) ? null : body);
|
|
199
388
|
returns.set(id, fresh());
|
|
200
389
|
if (body.abi?.receiver)
|
|
@@ -203,6 +392,7 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
203
392
|
for (const block of body.blocks.values())
|
|
204
393
|
for (const operation of [...block.operations, block.terminator]) {
|
|
205
394
|
owner.set(operation, id);
|
|
395
|
+
physicalOwner.set(operation, body);
|
|
206
396
|
if (operation.kind === 'parameter' || operation.kind === 'receiver')
|
|
207
397
|
inputs.push(operation);
|
|
208
398
|
}
|
|
@@ -212,6 +402,41 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
212
402
|
const result = resultOfIrOperation(operation);
|
|
213
403
|
if (result)
|
|
214
404
|
producers.set(result.id, operation);
|
|
405
|
+
// These immutable recipes describe entry points even in dormant bodies.
|
|
406
|
+
// Collect them before solving calls so a later body visit cannot change
|
|
407
|
+
// whether an earlier call's frame has an admitted adapter path.
|
|
408
|
+
if (operation.kind === 'convert')
|
|
409
|
+
transportsCallablePrefix(operation.source.representation, operation.result.representation, conversions?.nodeById(operation.conversionUse));
|
|
410
|
+
if (operation.kind === 'get') {
|
|
411
|
+
for (const recipe of operation.conversionRecipes ?? [])
|
|
412
|
+
if (recipe.role === 'method-frame')
|
|
413
|
+
transportsCallablePrefix(recipe.source, recipe.target, conversions?.nodeById(recipe.conversion));
|
|
414
|
+
for (const recipe of operation.methodValueRecipes ?? [])
|
|
415
|
+
transportsCallablePrefix(recipe.source, recipe.target, conversions?.nodeById(recipe.conversion));
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
const arrayInsertions = new Map();
|
|
419
|
+
const insertionReads = new Set();
|
|
420
|
+
const uses = new Map();
|
|
421
|
+
for (const operation of operations) {
|
|
422
|
+
for (const operand of operandsOfIrOperation(operation)) {
|
|
423
|
+
const users = uses.get(operand.value) ?? new Set();
|
|
424
|
+
users.add(operation);
|
|
425
|
+
uses.set(operand.value, users);
|
|
426
|
+
}
|
|
427
|
+
if (operation.kind !== 'call')
|
|
428
|
+
continue;
|
|
429
|
+
const insertion = nativeArrayInsertionOf(operation, (id) => producers.get(id) ?? null, classes, conversions);
|
|
430
|
+
if (insertion !== null)
|
|
431
|
+
arrayInsertions.set(operation, insertion);
|
|
432
|
+
}
|
|
433
|
+
// An extracted method can be published or rebound. Only the exact fused
|
|
434
|
+
// uses above can keep its receiver's allocation closed.
|
|
435
|
+
for (const insertion of arrayInsertions.values()) {
|
|
436
|
+
const users = uses.get(insertion.read.result.id);
|
|
437
|
+
if (users !== undefined &&
|
|
438
|
+
[...users].every((user) => user.kind === 'call' && user.callee.value === insertion.read.result.id && arrayInsertions.has(user)))
|
|
439
|
+
insertionReads.add(insertion.read);
|
|
215
440
|
}
|
|
216
441
|
const recordHeapOf = (representation) => {
|
|
217
442
|
if (representation.kind !== 'record' && representation.kind !== 'record-with-index' && representation.kind !== 'native-record-ref')
|
|
@@ -234,11 +459,14 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
234
459
|
}
|
|
235
460
|
else if (!valid || heap.layoutKey !== layoutKey) {
|
|
236
461
|
heap.valid = false;
|
|
462
|
+
heapEpoch++;
|
|
237
463
|
slotCache.clear();
|
|
238
464
|
}
|
|
239
465
|
for (const field of fields)
|
|
240
|
-
if (!heap.fields.has(field.key))
|
|
466
|
+
if (!heap.fields.has(field.key)) {
|
|
241
467
|
heap.fields.set(field.key, { cell: fresh(), representation: field.value });
|
|
468
|
+
heapEpoch++;
|
|
469
|
+
}
|
|
242
470
|
recordViews.set(representation, heap);
|
|
243
471
|
return heap;
|
|
244
472
|
};
|
|
@@ -256,11 +484,36 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
256
484
|
};
|
|
257
485
|
arrayHeaps.set(key, heap);
|
|
258
486
|
}
|
|
259
|
-
else if (representation.ownership !== 'shared-refcount')
|
|
487
|
+
else if (representation.ownership !== 'shared-refcount') {
|
|
260
488
|
heap.valid = false;
|
|
489
|
+
heapEpoch++;
|
|
490
|
+
}
|
|
261
491
|
return heap;
|
|
262
492
|
};
|
|
263
493
|
const nativeReferences = (representation) => {
|
|
494
|
+
if (representation.kind === 'constructor-family')
|
|
495
|
+
return {
|
|
496
|
+
heaps: representation.members.flatMap((id) => [...constructorHeapsOf(id), ...(classHeaps.has(id) ? [classHeaps.get(id)] : [])]),
|
|
497
|
+
complete: representation.members.length > 0 && representation.members.every((id) => classes.get(id)?.nativeBase === null)
|
|
498
|
+
};
|
|
499
|
+
if (representation.kind === 'proxy-object') {
|
|
500
|
+
const key = representationKey(representation);
|
|
501
|
+
let heap = proxyHeaps.get(key);
|
|
502
|
+
if (!heap) {
|
|
503
|
+
heap = {
|
|
504
|
+
proxy: true,
|
|
505
|
+
declaration: null,
|
|
506
|
+
fields: new Map([
|
|
507
|
+
['target', { cell: fresh(), representation: representation.target }],
|
|
508
|
+
['handler', { cell: fresh(), representation: representation.handler }]
|
|
509
|
+
]),
|
|
510
|
+
layoutKey: key,
|
|
511
|
+
valid: true
|
|
512
|
+
};
|
|
513
|
+
proxyHeaps.set(key, heap);
|
|
514
|
+
}
|
|
515
|
+
return { heaps: [heap], complete: true };
|
|
516
|
+
}
|
|
264
517
|
if (representation.kind === 'class-ref') {
|
|
265
518
|
const heap = classHeaps.get(representation.declaration);
|
|
266
519
|
return { heaps: heap ? [heap] : [], complete: heap !== undefined };
|
|
@@ -285,8 +538,10 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
285
538
|
};
|
|
286
539
|
dictionaryHeaps.set(key, heap);
|
|
287
540
|
}
|
|
288
|
-
else if (representation.ownership !== 'shared-refcount')
|
|
541
|
+
else if (representation.ownership !== 'shared-refcount') {
|
|
289
542
|
heap.valid = false;
|
|
543
|
+
heapEpoch++;
|
|
544
|
+
}
|
|
290
545
|
return { heaps: [heap], complete: heap.valid };
|
|
291
546
|
}
|
|
292
547
|
if (representation.kind === 'array-object') {
|
|
@@ -328,6 +583,70 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
328
583
|
const producer = producers.get(operand.value);
|
|
329
584
|
return producer?.kind === 'constant' && producer.literal === 'string' ? producer.text : null;
|
|
330
585
|
};
|
|
586
|
+
const propertyPresence = new Map(conversions === undefined ? [] : bodies.map((body) => [body, nativePropertyPresenceAuthorityOf(body, conversions)]));
|
|
587
|
+
const ordinaryAllocated = (heap) => ordinaryObjectAllocations.has(heap) &&
|
|
588
|
+
heap.template !== undefined &&
|
|
589
|
+
heap.declaration === null &&
|
|
590
|
+
heap.valid &&
|
|
591
|
+
heap.template.valid &&
|
|
592
|
+
!heap.proxy &&
|
|
593
|
+
heap.layoutKey !== null &&
|
|
594
|
+
!heap.fields.has('__proto__');
|
|
595
|
+
const originalDescriptorAbsent = (operation, key, heap) => {
|
|
596
|
+
const receiver = value(operation.receiver.value);
|
|
597
|
+
return (operation.ordinaryObjectPrototypeKeyAbsent === true &&
|
|
598
|
+
!receiver.unknown &&
|
|
599
|
+
!receiver.escaped &&
|
|
600
|
+
!escapedHeaps.has(heap) &&
|
|
601
|
+
ordinaryAllocated(heap) &&
|
|
602
|
+
!heap.fields.has(key));
|
|
603
|
+
};
|
|
604
|
+
const preservesPresence = (operation, key, guard) => {
|
|
605
|
+
if (operation.kind === 'get') {
|
|
606
|
+
const name = keyOf(operation.key);
|
|
607
|
+
const receiver = value(operation.receiver.value);
|
|
608
|
+
return (name !== null &&
|
|
609
|
+
nativeOrdinaryPropertyPreservesPresence(operation, name, guard) &&
|
|
610
|
+
!receiver.unknown &&
|
|
611
|
+
receiver.heaps.size > 0 &&
|
|
612
|
+
[...receiver.heaps].every((heap) => ordinaryAllocated(heap) && (name === key ? guard.present : heap.fields.has(name))));
|
|
613
|
+
}
|
|
614
|
+
if (operation.kind === 'set' || operation.kind === 'define-own-property') {
|
|
615
|
+
const name = keyOf(operation.key);
|
|
616
|
+
const receiver = value(operation.receiver.value);
|
|
617
|
+
return (name !== null &&
|
|
618
|
+
operation.kind === 'set' &&
|
|
619
|
+
nativeOrdinaryPropertyPreservesPresence(operation, name, guard) &&
|
|
620
|
+
!receiver.unknown &&
|
|
621
|
+
receiver.heaps.size > 0 &&
|
|
622
|
+
[...receiver.heaps].every((heap) => ordinaryAllocated(heap) && (name === key ? guard.present : heap.fields.has(name))));
|
|
623
|
+
}
|
|
624
|
+
if (operation.kind === 'convert') {
|
|
625
|
+
const node = conversions?.nodeById(operation.conversionUse);
|
|
626
|
+
return (node?.capability.kind === 'identity' ||
|
|
627
|
+
nativeFieldViewIdentityTransportOf(node) ||
|
|
628
|
+
nativePayloadTransportMatches(operation.source.representation, operation.result.representation, node));
|
|
629
|
+
}
|
|
630
|
+
// Arithmetic over native primitive carriers cannot call a user coercion.
|
|
631
|
+
if (operation.kind === 'compute')
|
|
632
|
+
return operandsOfIrOperation(operation).every((operand) => ['scalar', 'string', 'symbol', 'null', 'undefined'].includes(operand.representation.kind));
|
|
633
|
+
return false;
|
|
634
|
+
};
|
|
635
|
+
const heapSelectionAt = (receiver, key, at) => {
|
|
636
|
+
const cell = value(receiver.value);
|
|
637
|
+
const heaps = [...cell.heaps];
|
|
638
|
+
if (at === undefined || cell.unknown || cell.escaped || heaps.length === 0 || !heaps.every(ordinaryAllocated))
|
|
639
|
+
return { heaps, present: false };
|
|
640
|
+
presenceConsulted = true;
|
|
641
|
+
const guard = propertyPresence.get(physicalOwner.get(at))?.(receiver, key, at, (operation, guard) => preservesPresence(operation, key, guard));
|
|
642
|
+
if (guard === undefined || guard === null)
|
|
643
|
+
return { heaps, present: false };
|
|
644
|
+
// The sealed standard-prototype absence fact plus this complete ordinary
|
|
645
|
+
// allocation domain turns full Has into an own-descriptor selection.
|
|
646
|
+
const selected = nativePropertyPresenceStorageCandidatesOf(guard, heaps, (heap, key) => heap.fields.has(key));
|
|
647
|
+
return { heaps: selected.length > 0 ? selected : null, present: guard.present };
|
|
648
|
+
};
|
|
649
|
+
const heapsAt = (receiver, key, at) => heapSelectionAt(receiver, key, at).heaps;
|
|
331
650
|
const slotCache = new Map();
|
|
332
651
|
const slotTemplatesOf = (receiver, key) => {
|
|
333
652
|
// Carrier keys can be large. Nest the property map instead of serializing
|
|
@@ -347,7 +666,7 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
347
666
|
const family = [...new Set(heaps.flatMap(familyOf))];
|
|
348
667
|
if (!complete ||
|
|
349
668
|
heaps.length === 0 ||
|
|
350
|
-
heaps.some((heap) => !heap.valid || !heap.fields.has(key)) ||
|
|
669
|
+
heaps.some((heap) => heap.proxy === true || !heap.valid || !heap.fields.has(key)) ||
|
|
351
670
|
family.some((heap) => {
|
|
352
671
|
if (heap.declaration === null)
|
|
353
672
|
return !heap.valid;
|
|
@@ -373,8 +692,8 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
373
692
|
markUnknown(cell, reason);
|
|
374
693
|
seedHeaps(cell, representation);
|
|
375
694
|
};
|
|
376
|
-
const escape = (cell, reason) => {
|
|
377
|
-
markEscaped(cell, reason);
|
|
695
|
+
const escape = (cell, reason, operation) => {
|
|
696
|
+
markEscaped(cell, reason, [operation ?? null]);
|
|
378
697
|
};
|
|
379
698
|
const link = (from, to) => {
|
|
380
699
|
if (from.edges.get(to) === null)
|
|
@@ -404,11 +723,18 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
404
723
|
(heap.declaration === target.declaration || extendsClass(classes, heap.declaration, target.declaration))));
|
|
405
724
|
};
|
|
406
725
|
const allocations = new Map();
|
|
407
|
-
const
|
|
726
|
+
const ordinaryObjectAllocations = new WeakSet();
|
|
727
|
+
const seedAllocation = (id, representation, selected, ordinaryObject = false) => {
|
|
728
|
+
const allocated = value(id);
|
|
729
|
+
if (!allocated.documentBlocked) {
|
|
730
|
+
allocated.documentBlocked = true;
|
|
731
|
+
changed(allocated);
|
|
732
|
+
}
|
|
408
733
|
const known = allocations.get(id);
|
|
409
734
|
if (known)
|
|
410
735
|
return known;
|
|
411
|
-
const
|
|
736
|
+
const templatesOfAllocation = selected === undefined ? nativeReferences(representation).heaps : selected.flatMap((item) => nativeReferences(item).heaps);
|
|
737
|
+
const heaps = [...new Set(templatesOfAllocation)].map((template) => {
|
|
412
738
|
const fields = new Map();
|
|
413
739
|
const templates = template.declaration === null
|
|
414
740
|
? [template]
|
|
@@ -419,7 +745,14 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
419
745
|
fields.set(key, { cell: fresh(), representation: slot.representation });
|
|
420
746
|
for (const [key, slot] of template.fields)
|
|
421
747
|
fields.set(key, { cell: fresh(), representation: slot.representation });
|
|
422
|
-
const heap = {
|
|
748
|
+
const heap = {
|
|
749
|
+
declaration: template.declaration,
|
|
750
|
+
layoutKey: template.layoutKey,
|
|
751
|
+
valid: template.valid,
|
|
752
|
+
template,
|
|
753
|
+
fields,
|
|
754
|
+
...(template.proxy === true ? { proxy: true } : {})
|
|
755
|
+
};
|
|
423
756
|
// A fresh instance owns no override yet. Seed its prototype alternative
|
|
424
757
|
// before stores add replacement bodies; otherwise a later assignment
|
|
425
758
|
// would falsely prove that all reads, including earlier ones, name it.
|
|
@@ -440,15 +773,23 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
440
773
|
return heap;
|
|
441
774
|
});
|
|
442
775
|
allocations.set(id, heaps);
|
|
443
|
-
for (const heap of heaps)
|
|
776
|
+
for (const heap of heaps) {
|
|
777
|
+
if (ordinaryObject) {
|
|
778
|
+
ordinaryObjectAllocations.add(heap);
|
|
779
|
+
heapEpoch++;
|
|
780
|
+
}
|
|
444
781
|
addHeap(value(id), heap);
|
|
782
|
+
}
|
|
445
783
|
return heaps;
|
|
446
784
|
};
|
|
447
|
-
const slotsOf = (receiver, key) => {
|
|
785
|
+
const slotsOf = (receiver, key, at) => {
|
|
448
786
|
if (slotTemplatesOf(receiver.representation, key) === null)
|
|
449
787
|
return null;
|
|
450
788
|
const slots = [];
|
|
451
|
-
|
|
789
|
+
const heaps = heapsAt(receiver, key, at);
|
|
790
|
+
if (heaps === null)
|
|
791
|
+
return null;
|
|
792
|
+
for (const heap of heaps) {
|
|
452
793
|
if (!heap.valid || heap.template?.valid === false || !heap.fields.has(key))
|
|
453
794
|
return null;
|
|
454
795
|
slots.push(heap.fields.get(key).cell);
|
|
@@ -459,8 +800,37 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
459
800
|
// alias to every allocation of that type. The same worklist handles stores,
|
|
460
801
|
// loads and array copies as new call/return origins arrive.
|
|
461
802
|
const heapEffects = [];
|
|
462
|
-
|
|
463
|
-
|
|
803
|
+
/**
|
|
804
|
+
* `receiver` names the one cell an effect reads, when that is all it reads:
|
|
805
|
+
* its `slotsOf` answer is then a function of that cell and of the heaps'
|
|
806
|
+
* state, and every write it makes (`link`, `untrusted`) is idempotent. Such
|
|
807
|
+
* an effect is replayed only after its receiver or a heap changed. Re-running
|
|
808
|
+
* every effect on every settle round was most of what this solver cost on
|
|
809
|
+
* a large program. A selection that consulted a presence guard read other cells, so
|
|
810
|
+
* it is always re-run, as is one whose receiver cell does not exist yet
|
|
811
|
+
* (creating it early would renumber the cells).
|
|
812
|
+
*/
|
|
813
|
+
const heapEffect = (operation, apply, reject, receiver) => {
|
|
814
|
+
if (receiver === undefined) {
|
|
815
|
+
heapEffects.push({ operation, apply, ...(reject ? { reject } : {}) });
|
|
816
|
+
return;
|
|
817
|
+
}
|
|
818
|
+
let seenVersion = -1;
|
|
819
|
+
let seenEpoch = -1;
|
|
820
|
+
let answer = false;
|
|
821
|
+
const replayed = () => {
|
|
822
|
+
const cell = values.get(receiver);
|
|
823
|
+
if (cell !== undefined && cell.version === seenVersion && heapEpoch === seenEpoch)
|
|
824
|
+
return answer;
|
|
825
|
+
const version = cell?.version ?? -1;
|
|
826
|
+
const epoch = heapEpoch;
|
|
827
|
+
presenceConsulted = false;
|
|
828
|
+
answer = apply();
|
|
829
|
+
seenVersion = cell === undefined || presenceConsulted ? -1 : version;
|
|
830
|
+
seenEpoch = epoch;
|
|
831
|
+
return answer;
|
|
832
|
+
};
|
|
833
|
+
heapEffects.push({ operation, apply: replayed, ...(reject ? { reject } : {}) });
|
|
464
834
|
};
|
|
465
835
|
const citedEntriesOf = (operation) => new Set([
|
|
466
836
|
...(operation.family ?? []).map((member) => member.functionId),
|
|
@@ -483,7 +853,9 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
483
853
|
...(base ? constructionEntriesOf(base, seen) : [])
|
|
484
854
|
];
|
|
485
855
|
};
|
|
856
|
+
const externalEntries = new Set();
|
|
486
857
|
const externalEntry = (id, reason) => {
|
|
858
|
+
externalEntries.add(id);
|
|
487
859
|
enter(id);
|
|
488
860
|
const receiver = frameReceivers.get(id);
|
|
489
861
|
const representation = bodyById.get(id)?.abi?.receiver;
|
|
@@ -495,22 +867,26 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
495
867
|
if (returned)
|
|
496
868
|
escape(returned, reason);
|
|
497
869
|
};
|
|
498
|
-
|
|
870
|
+
// Convert results holding only a Value injected into a union's own `dynamic`
|
|
871
|
+
// arm (see the `convert` case): their unknown origin is that arm's, never
|
|
872
|
+
// an uninstalled source of the union's Document arm.
|
|
873
|
+
const documentNeutralCells = new Set();
|
|
874
|
+
const untrusted = (operation, normalCarriers, identityResult, documentNeutral = false) => {
|
|
499
875
|
const reason = `${operation.kind}:${operation.lineage}`;
|
|
500
876
|
const operands = operation.kind === 'call'
|
|
501
877
|
? [operation.callee, ...(operation.receiver ? [operation.receiver] : []), ...receivedCallArguments(operation)]
|
|
502
878
|
: operandsOfIrOperation(operation);
|
|
503
879
|
for (const operand of operands)
|
|
504
|
-
escape(value(operand.value), reason);
|
|
880
|
+
escape(value(operand.value), reason, operation);
|
|
505
881
|
// super() also receives this even though the IR operation lists only
|
|
506
882
|
// explicit arguments. An unmodeled base entry may publish that receiver.
|
|
507
883
|
if (operation.kind === 'super-initialize') {
|
|
508
884
|
const receiver = frameReceivers.get(owner.get(operation));
|
|
509
885
|
if (receiver)
|
|
510
|
-
escape(receiver, reason);
|
|
886
|
+
escape(receiver, reason, operation);
|
|
511
887
|
for (const input of parameters.get(owner.get(operation)) ?? [])
|
|
512
888
|
if (input.kind === 'receiver')
|
|
513
|
-
escape(value(input.result.id), reason);
|
|
889
|
+
escape(value(input.result.id), reason, operation);
|
|
514
890
|
for (const layout of classes.values())
|
|
515
891
|
if (layout.constructor === owner.get(operation))
|
|
516
892
|
for (const id of constructionEntriesOf(layout))
|
|
@@ -530,8 +906,23 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
530
906
|
}
|
|
531
907
|
}
|
|
532
908
|
const result = resultOfIrOperation(operation);
|
|
533
|
-
if (result)
|
|
534
|
-
|
|
909
|
+
if (result && identityResult !== undefined)
|
|
910
|
+
link(value(identityResult.value), value(result.id));
|
|
911
|
+
else if (result) {
|
|
912
|
+
const destinations = normalCarriers?.map(nativeReferences);
|
|
913
|
+
if (destinations !== undefined && destinations.every((destination) => destination.complete)) {
|
|
914
|
+
const heaps = destinations.flatMap((destination) => destination.heaps.flatMap(familyOf));
|
|
915
|
+
markUnknown(value(result.id), reason, heaps, documentNeutral);
|
|
916
|
+
for (const heap of heaps)
|
|
917
|
+
addHeap(value(result.id), heap);
|
|
918
|
+
}
|
|
919
|
+
else if (documentNeutral) {
|
|
920
|
+
markUnknown(value(result.id), reason, undefined, true);
|
|
921
|
+
seedHeaps(value(result.id), result.representation);
|
|
922
|
+
}
|
|
923
|
+
else
|
|
924
|
+
external(value(result.id), result.representation, reason);
|
|
925
|
+
}
|
|
535
926
|
// A physical/semantic citation can enter a body even when its callable SSA
|
|
536
927
|
// value has no modeled provenance. Preserve that entry without pretending
|
|
537
928
|
// the unknown caller's arguments were part of a closed native frame.
|
|
@@ -561,7 +952,13 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
561
952
|
}
|
|
562
953
|
const implicitEntries = new Set();
|
|
563
954
|
const constructionBodies = new Set();
|
|
564
|
-
|
|
955
|
+
// A prefix can omit a later class allocation without turning its retained
|
|
956
|
+
// initializer into an unknown external entry. Recover only the allocation
|
|
957
|
+
// topology from the complete program; calls and effects still come from
|
|
958
|
+
// the bodies being solved. An actual publication opens these entries below.
|
|
959
|
+
const allocatedClasses = new Set((constructionTopology === undefined
|
|
960
|
+
? operations
|
|
961
|
+
: constructionTopology.flatMap((body) => [...body.blocks.values()].flatMap(allOperationsOf))).flatMap((operation) => (operation.kind === 'allocate-constructor' ? [operation.declaration] : [])));
|
|
565
962
|
for (const layout of classes.values()) {
|
|
566
963
|
if (!allocatedClasses.has(layout.declaration) || layout.nativeBase !== null || layout.instance === null)
|
|
567
964
|
continue;
|
|
@@ -715,17 +1112,29 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
715
1112
|
const recipe = operation.fixedDataDefinition;
|
|
716
1113
|
const target = operation.arguments[0];
|
|
717
1114
|
const descriptor = operation.arguments[2];
|
|
718
|
-
const node = conversions?.nodeById(recipe.conversion);
|
|
1115
|
+
const node = recipe.conversion === null ? null : conversions?.nodeById(recipe.conversion);
|
|
719
1116
|
if (!target ||
|
|
720
1117
|
!descriptor ||
|
|
721
|
-
!node ||
|
|
722
1118
|
representationKey(target.representation) !== recipe.target ||
|
|
723
1119
|
representationKey(descriptor.representation) !== recipe.descriptor ||
|
|
724
|
-
|
|
725
|
-
|
|
1120
|
+
(recipe.value === null
|
|
1121
|
+
? recipe.attributesOnly === undefined ||
|
|
1122
|
+
recipe.conversion !== null ||
|
|
1123
|
+
(recipe.attributesOnly.absence === null && recipe.attributesOnly.initialized === null)
|
|
1124
|
+
: !node ||
|
|
1125
|
+
representationKey(node.source) !== representationKey(recipe.value.value) ||
|
|
1126
|
+
representationKey(node.target) !== representationKey(recipe.held))) {
|
|
726
1127
|
untrusted(operation);
|
|
727
1128
|
return;
|
|
728
1129
|
}
|
|
1130
|
+
if (recipe.value === null) {
|
|
1131
|
+
// Attribute changes neither observe nor replace the payload. The
|
|
1132
|
+
// independently replayed recipe owns initial presence/Undefined
|
|
1133
|
+
// creation, so a field implementation origin is retained as-is.
|
|
1134
|
+
if (operation.result)
|
|
1135
|
+
link(value(target.value), value(operation.result.id));
|
|
1136
|
+
return;
|
|
1137
|
+
}
|
|
729
1138
|
// This is the same sealed native update reflection and emission consume,
|
|
730
1139
|
// not a call to an unknown implementation of Object.defineProperty.
|
|
731
1140
|
heapEffect(operation, () => {
|
|
@@ -741,7 +1150,8 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
741
1150
|
linkPayload(source, destination, [node.target]);
|
|
742
1151
|
else if (representationKey(node.source) === representationKey(node.target) ||
|
|
743
1152
|
nativeClassReferenceTransportMatches(node.source, node.target, node) ||
|
|
744
|
-
transportsCallablePrefix(node.source, node.target, node)
|
|
1153
|
+
transportsCallablePrefix(node.source, node.target, node) ||
|
|
1154
|
+
nativeCallableIdentityTransportMatches(node.source, node.target, node))
|
|
745
1155
|
for (const source of sources)
|
|
746
1156
|
link(source, destination);
|
|
747
1157
|
else
|
|
@@ -780,7 +1190,7 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
780
1190
|
else
|
|
781
1191
|
link(value(operation.value.value), slot);
|
|
782
1192
|
return slots.length > 0;
|
|
783
|
-
});
|
|
1193
|
+
}, undefined, operation.receiver.value);
|
|
784
1194
|
// Stores thread the container onward. The assignment expression's RHS
|
|
785
1195
|
// already has its own SSA value, as for native class accessor stores.
|
|
786
1196
|
if (operation.kind !== 'get' && operation.result)
|
|
@@ -796,6 +1206,118 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
796
1206
|
return;
|
|
797
1207
|
}
|
|
798
1208
|
if (operation.kind === 'get' || operation.kind === 'set') {
|
|
1209
|
+
const receiver = operation.receiver.representation;
|
|
1210
|
+
const viewKey = keyOf(operation.key);
|
|
1211
|
+
if (nativeFieldViewCarrierNeedsReceipt(receiver, viewShapes) && viewKey !== null) {
|
|
1212
|
+
if (operation.kind === 'get')
|
|
1213
|
+
fieldReads.push(operation);
|
|
1214
|
+
heapEffect(operation, () => {
|
|
1215
|
+
const original = value(operation.receiver.value);
|
|
1216
|
+
if (operation.kind === 'get' &&
|
|
1217
|
+
!original.unknown &&
|
|
1218
|
+
original.descriptorSnapshots.size > 0 &&
|
|
1219
|
+
['value', 'writable', 'enumerable', 'configurable'].includes(viewKey)) {
|
|
1220
|
+
// A captured descriptor owns a fresh native field table, rather
|
|
1221
|
+
// than an ordinary record heap. Losing a field value's identity
|
|
1222
|
+
// cannot publish that snapshot or execute the source accessor.
|
|
1223
|
+
external(value(operation.result.id), operation.result.representation, 'native-descriptor-snapshot-field');
|
|
1224
|
+
return true;
|
|
1225
|
+
}
|
|
1226
|
+
const heaps = heapsAt(operation.receiver, viewKey, operation);
|
|
1227
|
+
if (heaps === null)
|
|
1228
|
+
return true;
|
|
1229
|
+
if (heaps.length === 0)
|
|
1230
|
+
return false;
|
|
1231
|
+
for (const heap of heaps) {
|
|
1232
|
+
const member = heap.declaration === null ? null : classMemberOf(classes, heap.declaration, viewKey);
|
|
1233
|
+
if (member?.kind === 'accessor') {
|
|
1234
|
+
const callable = operation.kind === 'get' ? member.accessor.getter : member.accessor.setter;
|
|
1235
|
+
// Missing [[Set]] is an ordinary false result (and strict-mode
|
|
1236
|
+
// TypeError); it invokes neither half of this accessor.
|
|
1237
|
+
if (callable === null && operation.kind === 'set')
|
|
1238
|
+
continue;
|
|
1239
|
+
if (callable === null || !bodyById.has(callable)) {
|
|
1240
|
+
untrusted(operation);
|
|
1241
|
+
return true;
|
|
1242
|
+
}
|
|
1243
|
+
invoke(callable, operation.kind === 'get' ? [] : [operation.value], value(operation.receiver.value), operation.kind === 'get' ? value(operation.result.id) : null);
|
|
1244
|
+
}
|
|
1245
|
+
else if (member?.kind === 'method' && !heap.fields.has(viewKey) && operation.kind === 'get') {
|
|
1246
|
+
if (member.method.callable === null || classPrototypeMethodMutableOf(classes, heap.declaration, viewKey)) {
|
|
1247
|
+
untrusted(operation);
|
|
1248
|
+
return true;
|
|
1249
|
+
}
|
|
1250
|
+
addFunction(value(operation.result.id), member.method.callable);
|
|
1251
|
+
}
|
|
1252
|
+
else {
|
|
1253
|
+
const slot = heap.fields.get(viewKey);
|
|
1254
|
+
if (!heap.valid || !slot) {
|
|
1255
|
+
if (operation.kind === 'get' && originalDescriptorAbsent(operation, viewKey, heap))
|
|
1256
|
+
continue;
|
|
1257
|
+
// A read cannot reject its own missing-slot proof before
|
|
1258
|
+
// allocation and alias origins have reached the fixed point.
|
|
1259
|
+
// Unresolved effects are rejected by the final worklist.
|
|
1260
|
+
if (operation.kind === 'get')
|
|
1261
|
+
return false;
|
|
1262
|
+
untrusted(operation);
|
|
1263
|
+
return true;
|
|
1264
|
+
}
|
|
1265
|
+
if (operation.kind === 'get')
|
|
1266
|
+
link(slot.cell, value(operation.result.id));
|
|
1267
|
+
else
|
|
1268
|
+
link(value(operation.value.value), slot.cell);
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
return true;
|
|
1272
|
+
});
|
|
1273
|
+
if (operation.kind === 'set' && operation.result)
|
|
1274
|
+
link(value(operation.receiver.value), value(operation.result.id));
|
|
1275
|
+
return;
|
|
1276
|
+
}
|
|
1277
|
+
const staticCell = nativeConstructorStaticCellOf(operation, keyOf(operation.key), classes, staticSlots, conversions);
|
|
1278
|
+
if (staticCell !== null) {
|
|
1279
|
+
const slot = staticHeaps.get(staticCell.owner).fields.get(staticCell.key);
|
|
1280
|
+
if (operation.kind === 'get') {
|
|
1281
|
+
fieldReads.push(operation);
|
|
1282
|
+
linkPayload(slot.cell, value(operation.result.id), [operation.result.representation]);
|
|
1283
|
+
}
|
|
1284
|
+
else {
|
|
1285
|
+
linkPayload(value(operation.value.value), slot.cell, [slot.representation]);
|
|
1286
|
+
if (operation.result)
|
|
1287
|
+
link(value(operation.receiver.value), value(operation.result.id));
|
|
1288
|
+
}
|
|
1289
|
+
for (const operand of operandsOfIrOperation(operation))
|
|
1290
|
+
if (!producers.has(operand.value))
|
|
1291
|
+
external(value(operand.value), operand.representation);
|
|
1292
|
+
return;
|
|
1293
|
+
}
|
|
1294
|
+
const staticEntry = nativeConstructorAccessorEntryOf(operation, keyOf(operation.key), classes, (id) => bodyById.get(id), conversions);
|
|
1295
|
+
if (staticEntry !== null) {
|
|
1296
|
+
if (operation.kind === 'get')
|
|
1297
|
+
fieldReads.push(operation);
|
|
1298
|
+
heapEffect(operation, () => {
|
|
1299
|
+
const constructor = value(operation.receiver.value);
|
|
1300
|
+
if (constructor.unknown || constructor.escaped) {
|
|
1301
|
+
untrusted(operation);
|
|
1302
|
+
return true;
|
|
1303
|
+
}
|
|
1304
|
+
if (constructor.heaps.size === 0)
|
|
1305
|
+
return false;
|
|
1306
|
+
invoke(staticEntry.functionId, staticEntry.arguments, staticEntry.receiver === null ? null : value(staticEntry.receiver.value), null);
|
|
1307
|
+
if (operation.kind === 'get') {
|
|
1308
|
+
const returned = returns.get(staticEntry.functionId);
|
|
1309
|
+
if (returned)
|
|
1310
|
+
linkPayload(returned, value(operation.result.id), [operation.result.representation]);
|
|
1311
|
+
}
|
|
1312
|
+
else if (operation.result)
|
|
1313
|
+
link(value(operation.receiver.value), value(operation.result.id));
|
|
1314
|
+
return true;
|
|
1315
|
+
});
|
|
1316
|
+
for (const operand of operandsOfIrOperation(operation))
|
|
1317
|
+
if (!producers.has(operand.value))
|
|
1318
|
+
external(value(operand.value), operand.representation);
|
|
1319
|
+
return;
|
|
1320
|
+
}
|
|
799
1321
|
const entry = nativeClassAccessorEntryOf(operation, keyOf(operation.key), classes, (id) => bodyById.get(id), conversions);
|
|
800
1322
|
if (entry) {
|
|
801
1323
|
if (operation.kind === 'get')
|
|
@@ -867,13 +1389,52 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
867
1389
|
if (bodyById.get(operation.functionId)?.construct)
|
|
868
1390
|
seedHeaps(value(operation.result.id), bodyById.get(operation.functionId).construct.result);
|
|
869
1391
|
break;
|
|
1392
|
+
case 'allocate-proxy': {
|
|
1393
|
+
const heap = seedAllocation(operation.result.id, operation.result.representation)[0];
|
|
1394
|
+
if (operation.result.representation.kind !== 'proxy-object' || heap?.proxy !== true) {
|
|
1395
|
+
untrusted(operation);
|
|
1396
|
+
break;
|
|
1397
|
+
}
|
|
1398
|
+
link(value(operation.target.value), heap.fields.get('target').cell);
|
|
1399
|
+
link(value(operation.handler.value), heap.fields.get('handler').cell);
|
|
1400
|
+
break;
|
|
1401
|
+
}
|
|
1402
|
+
case 'proxy-part': {
|
|
1403
|
+
heapEffect(operation, () => {
|
|
1404
|
+
const proxy = value(operation.proxy.value);
|
|
1405
|
+
if (proxy.unknown) {
|
|
1406
|
+
untrusted(operation);
|
|
1407
|
+
return true;
|
|
1408
|
+
}
|
|
1409
|
+
for (const heap of proxy.heaps) {
|
|
1410
|
+
const part = heap.fields.get(operation.part);
|
|
1411
|
+
if (!heap.valid ||
|
|
1412
|
+
heap.proxy !== true ||
|
|
1413
|
+
!part ||
|
|
1414
|
+
representationKey(part.representation) !== representationKey(operation.result.representation)) {
|
|
1415
|
+
untrusted(operation);
|
|
1416
|
+
return true;
|
|
1417
|
+
}
|
|
1418
|
+
link(part.cell, value(operation.result.id));
|
|
1419
|
+
}
|
|
1420
|
+
return proxy.heaps.size > 0;
|
|
1421
|
+
});
|
|
1422
|
+
break;
|
|
1423
|
+
}
|
|
870
1424
|
case 'allocate-constructor': {
|
|
1425
|
+
const callable = value(operation.result.id);
|
|
1426
|
+
if (!callable.documentBlocked) {
|
|
1427
|
+
callable.documentBlocked = true;
|
|
1428
|
+
changed(callable);
|
|
1429
|
+
}
|
|
871
1430
|
// Publishing the constructor publishes its future instances too.
|
|
872
1431
|
// Its ordinary return cell is void, so that escape cannot be found by
|
|
873
1432
|
// following constructor-body returns like an ordinary factory's.
|
|
874
1433
|
const heap = classHeaps.get(operation.declaration);
|
|
875
1434
|
if (heap)
|
|
876
1435
|
addHeap(value(operation.result.id), heap);
|
|
1436
|
+
for (const heap of constructorHeapsOf(operation.declaration))
|
|
1437
|
+
addHeap(value(operation.result.id), heap);
|
|
877
1438
|
const layout = classLayoutOfCopy(classes, operation.declaration);
|
|
878
1439
|
if (layout)
|
|
879
1440
|
for (const id of constructionEntriesOf(layout))
|
|
@@ -881,11 +1442,21 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
881
1442
|
break;
|
|
882
1443
|
}
|
|
883
1444
|
case 'constant':
|
|
1445
|
+
if (operation.literal !== 'undefined' && operation.literal !== 'null') {
|
|
1446
|
+
const cell = value(operation.result.id);
|
|
1447
|
+
if (!cell.documentBlocked) {
|
|
1448
|
+
cell.documentBlocked = true;
|
|
1449
|
+
changed(cell);
|
|
1450
|
+
}
|
|
1451
|
+
}
|
|
1452
|
+
break;
|
|
884
1453
|
case 'parameter':
|
|
885
1454
|
case 'jump':
|
|
886
1455
|
case 'branch':
|
|
887
1456
|
case 'switch':
|
|
888
1457
|
case 'test':
|
|
1458
|
+
case 'proxy-arm-test':
|
|
1459
|
+
case 'proxy-trap-check':
|
|
889
1460
|
break;
|
|
890
1461
|
case 'receiver': {
|
|
891
1462
|
const receiver = frameReceivers.get(owner.get(operation));
|
|
@@ -896,7 +1467,7 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
896
1467
|
case 'allocate-ordinary-object':
|
|
897
1468
|
case 'allocate-record': {
|
|
898
1469
|
const references = nativeReferences(operation.result.representation);
|
|
899
|
-
seedAllocation(operation.result.id, operation.result.representation);
|
|
1470
|
+
seedAllocation(operation.result.id, operation.result.representation, undefined, operation.ordinaryObjectPrototype === true);
|
|
900
1471
|
if (!references.complete || references.heaps.length !== 1 || !references.heaps[0].valid) {
|
|
901
1472
|
untrusted(operation);
|
|
902
1473
|
break;
|
|
@@ -931,7 +1502,7 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
931
1502
|
for (const source of sources)
|
|
932
1503
|
link(source, elements);
|
|
933
1504
|
return sources.length > 0;
|
|
934
|
-
});
|
|
1505
|
+
}, undefined, slot.value.value);
|
|
935
1506
|
}
|
|
936
1507
|
}
|
|
937
1508
|
break;
|
|
@@ -939,7 +1510,7 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
939
1510
|
case 'binding-write':
|
|
940
1511
|
link(value(operation.value.value), binding(operation.declaration));
|
|
941
1512
|
if (!['local', 'region'].includes(placements.get(operation.declaration)?.storage.kind ?? ''))
|
|
942
|
-
markEscaped(value(operation.value.value));
|
|
1513
|
+
markEscaped(value(operation.value.value), undefined, [operation]);
|
|
943
1514
|
break;
|
|
944
1515
|
case 'binding-read':
|
|
945
1516
|
link(binding(operation.declaration), value(operation.result.id));
|
|
@@ -960,7 +1531,34 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
960
1531
|
link(value(operation.value.value), returns.get(owner.get(operation)));
|
|
961
1532
|
break;
|
|
962
1533
|
case 'get': {
|
|
1534
|
+
const privateSlot = operation.privateNativeCallableSlot;
|
|
1535
|
+
if (privateSlot && representationKey(privateSlot.value.representation) === representationKey(operation.result.representation)) {
|
|
1536
|
+
link(value(privateSlot.value.value), value(operation.result.id));
|
|
1537
|
+
break;
|
|
1538
|
+
}
|
|
1539
|
+
if (insertionReads.has(operation))
|
|
1540
|
+
break;
|
|
1541
|
+
if (operation.logicalReceiver === 'ignored') {
|
|
1542
|
+
markIgnoredLogicalReceiver(value(operation.result.id));
|
|
1543
|
+
break;
|
|
1544
|
+
}
|
|
1545
|
+
if (operation.logicalReceiver === 'native' || operation.logicalReceiver === 'dynamic')
|
|
1546
|
+
markLogicalReceiver(value(operation.result.id), operation.logicalReceiver === 'dynamic');
|
|
1547
|
+
if ((operation.methodValueRecipes?.length ?? 0) > 0)
|
|
1548
|
+
markLogicalReceiver(value(operation.result.id), operation.methodValueRecipes.some((recipe) => {
|
|
1549
|
+
const node = conversions?.nodeById(recipe.conversion);
|
|
1550
|
+
return (node !== undefined &&
|
|
1551
|
+
node !== null &&
|
|
1552
|
+
'materializer' in node.capability &&
|
|
1553
|
+
node.capability.materializer.nativeMethod?.receiver.kind === 'dynamic');
|
|
1554
|
+
}));
|
|
963
1555
|
const key = keyOf(operation.key);
|
|
1556
|
+
const staticMethods = nativeConstructorMethodBodiesOf(operation, key, classes, operations, placements);
|
|
1557
|
+
if (staticMethods !== null) {
|
|
1558
|
+
for (const callable of staticMethods)
|
|
1559
|
+
addFunction(value(operation.result.id), callable);
|
|
1560
|
+
break;
|
|
1561
|
+
}
|
|
964
1562
|
if (nativeArrayTransportOf(operation, key)) {
|
|
965
1563
|
if (key !== 'length') {
|
|
966
1564
|
fieldReads.push(operation);
|
|
@@ -973,14 +1571,24 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
973
1571
|
for (const source of sources)
|
|
974
1572
|
link(source, value(operation.result.id));
|
|
975
1573
|
return sources.length > 0;
|
|
976
|
-
});
|
|
1574
|
+
}, undefined, operation.receiver.value);
|
|
977
1575
|
}
|
|
978
1576
|
break;
|
|
979
1577
|
}
|
|
980
1578
|
if (key !== null && slotTemplatesOf(operation.receiver.representation, key) !== null) {
|
|
981
1579
|
fieldReads.push(operation);
|
|
982
1580
|
heapEffect(operation, () => {
|
|
983
|
-
const
|
|
1581
|
+
const receiver = value(operation.receiver.value);
|
|
1582
|
+
if (!receiver.unknown &&
|
|
1583
|
+
receiver.descriptorSnapshots.size > 0 &&
|
|
1584
|
+
['value', 'writable', 'enumerable', 'configurable'].includes(key)) {
|
|
1585
|
+
// Captured descriptor fields are native data on a new object.
|
|
1586
|
+
// Their value's identity may be unknown without exposing the
|
|
1587
|
+
// snapshot owner or invoking the original accessor.
|
|
1588
|
+
external(value(operation.result.id), operation.result.representation, 'native-descriptor-snapshot-field');
|
|
1589
|
+
return true;
|
|
1590
|
+
}
|
|
1591
|
+
const sources = slotsOf(operation.receiver, key, operation);
|
|
984
1592
|
if (sources === null) {
|
|
985
1593
|
untrusted(operation);
|
|
986
1594
|
return true;
|
|
@@ -988,7 +1596,7 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
988
1596
|
for (const source of sources)
|
|
989
1597
|
link(source, value(operation.result.id));
|
|
990
1598
|
return sources.length > 0;
|
|
991
|
-
});
|
|
1599
|
+
}, undefined, operation.receiver.value);
|
|
992
1600
|
}
|
|
993
1601
|
else if (operation.closedCallable) {
|
|
994
1602
|
for (const id of operation.closedCallable.kind === 'exact'
|
|
@@ -1002,7 +1610,39 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
1002
1610
|
}
|
|
1003
1611
|
case 'set':
|
|
1004
1612
|
case 'define-own-property': {
|
|
1613
|
+
if (operation.kind === 'set' &&
|
|
1614
|
+
conversions !== undefined &&
|
|
1615
|
+
nativeCallablePrimitiveDataWritePreservesOwner(operation, conversions, (id) => producers.get(id))) {
|
|
1616
|
+
// The receipt models a data-only primitive store, not a call or an
|
|
1617
|
+
// owner publication. Retain the incoming identity without creating
|
|
1618
|
+
// one or clearing an earlier unknown/publication edge.
|
|
1619
|
+
if (operation.result) {
|
|
1620
|
+
const returned = representationKey(operation.result.representation) === representationKey(operation.receiver.representation)
|
|
1621
|
+
? operation.receiver
|
|
1622
|
+
: representationKey(operation.result.representation) === representationKey(operation.value.representation)
|
|
1623
|
+
? operation.value
|
|
1624
|
+
: null;
|
|
1625
|
+
if (returned)
|
|
1626
|
+
link(value(returned.value), value(operation.result.id));
|
|
1627
|
+
else
|
|
1628
|
+
untrusted(operation);
|
|
1629
|
+
}
|
|
1630
|
+
break;
|
|
1631
|
+
}
|
|
1632
|
+
if (operation.kind === 'set' && operation.privateNativeCallableSlot) {
|
|
1633
|
+
if (operation.result)
|
|
1634
|
+
link(value(operation.receiver.value), value(operation.result.id));
|
|
1635
|
+
break;
|
|
1636
|
+
}
|
|
1005
1637
|
const key = keyOf(operation.key);
|
|
1638
|
+
const staticCell = nativeConstructorStaticCellOf(operation, key, classes, staticSlots, conversions);
|
|
1639
|
+
if (staticCell !== null) {
|
|
1640
|
+
const slot = staticHeaps.get(staticCell.owner).fields.get(staticCell.key);
|
|
1641
|
+
linkPayload(value(operation.value.value), slot.cell, [slot.representation]);
|
|
1642
|
+
if (operation.result)
|
|
1643
|
+
link(value(operation.receiver.value), value(operation.result.id));
|
|
1644
|
+
break;
|
|
1645
|
+
}
|
|
1006
1646
|
if (operation.kind === 'set' && nativeArrayTransportOf(operation, key)) {
|
|
1007
1647
|
if (key !== 'length')
|
|
1008
1648
|
heapEffect(operation, () => {
|
|
@@ -1014,14 +1654,14 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
1014
1654
|
for (const target of targets)
|
|
1015
1655
|
link(value(operation.value.value), target);
|
|
1016
1656
|
return targets.length > 0;
|
|
1017
|
-
});
|
|
1657
|
+
}, undefined, operation.receiver.value);
|
|
1018
1658
|
if (operation.result && representationKey(operation.result.representation) === representationKey(operation.value.representation))
|
|
1019
1659
|
link(value(operation.value.value), value(operation.result.id));
|
|
1020
1660
|
break;
|
|
1021
1661
|
}
|
|
1022
1662
|
if (key !== null && slotTemplatesOf(operation.receiver.representation, key) !== null) {
|
|
1023
1663
|
heapEffect(operation, () => {
|
|
1024
|
-
const targets = slotsOf(operation.receiver, key);
|
|
1664
|
+
const targets = slotsOf(operation.receiver, key, operation);
|
|
1025
1665
|
if (targets === null) {
|
|
1026
1666
|
untrusted(operation);
|
|
1027
1667
|
return true;
|
|
@@ -1029,7 +1669,7 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
1029
1669
|
for (const target of targets)
|
|
1030
1670
|
link(value(operation.value.value), target);
|
|
1031
1671
|
return targets.length > 0;
|
|
1032
|
-
});
|
|
1672
|
+
}, undefined, operation.receiver.value);
|
|
1033
1673
|
if (operation.result &&
|
|
1034
1674
|
representationKey(operation.result.representation) ===
|
|
1035
1675
|
representationKey(operation.kind === 'set' ? operation.value.representation : operation.receiver.representation))
|
|
@@ -1039,6 +1679,10 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
1039
1679
|
untrusted(operation);
|
|
1040
1680
|
break;
|
|
1041
1681
|
}
|
|
1682
|
+
case 'dead-logical-merge-value':
|
|
1683
|
+
// It has no normal value or observation. Certification authenticates
|
|
1684
|
+
// its exact impossible falsy edge; prior evaluation remains in IR.
|
|
1685
|
+
break;
|
|
1042
1686
|
case 'merge-live-arm-rebuild': {
|
|
1043
1687
|
const source = operation.source.representation;
|
|
1044
1688
|
const payload = source.kind === 'optional' ? source.payload : source;
|
|
@@ -1057,18 +1701,128 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
1057
1701
|
const node = conversions?.nodeById(operation.conversionUse);
|
|
1058
1702
|
const from = operation.source.representation;
|
|
1059
1703
|
const to = operation.result.representation;
|
|
1704
|
+
// A Value injected into a union's own `dynamic` arm stays in that arm:
|
|
1705
|
+
// it is dispatched by its own [[Get]], never through an installed
|
|
1706
|
+
// Document entry protocol, so it does not withdraw the protocol every
|
|
1707
|
+
// value reaching the union's Document arm still carries.
|
|
1708
|
+
const dynamicArm = from.kind === 'dynamic' &&
|
|
1709
|
+
to.kind === 'tagged-union' &&
|
|
1710
|
+
node?.capability.kind === 'atom' &&
|
|
1711
|
+
node.capability.materializer.id === NATIVE_SUM_MATERIALIZER &&
|
|
1712
|
+
to.arms.some((arm) => representationKey(arm.value) === representationKey(from));
|
|
1713
|
+
if (dynamicArm)
|
|
1714
|
+
documentNeutralCells.add(value(operation.result.id));
|
|
1715
|
+
if (node &&
|
|
1716
|
+
nativeFieldViewIdentityTransportOf(node) &&
|
|
1717
|
+
representationKey(node.source) === representationKey(from) &&
|
|
1718
|
+
representationKey(node.target) === representationKey(to)) {
|
|
1719
|
+
const cell = value(operation.result.id);
|
|
1720
|
+
if (!cell.fieldViews.has(node.id)) {
|
|
1721
|
+
cell.fieldViews.add(node.id);
|
|
1722
|
+
changed(cell);
|
|
1723
|
+
}
|
|
1724
|
+
}
|
|
1725
|
+
const document = node === null || node === undefined ? null : nativeDocumentEntryViewOf(node, conversions?.nodeById);
|
|
1726
|
+
if (document !== null &&
|
|
1727
|
+
node !== null &&
|
|
1728
|
+
node !== undefined &&
|
|
1729
|
+
representationKey(node.source) === representationKey(from) &&
|
|
1730
|
+
representationKey(node.target) === representationKey(to)) {
|
|
1731
|
+
const cell = value(operation.result.id);
|
|
1732
|
+
cell.documentInstalled = true;
|
|
1733
|
+
cell.documentBlocked = false;
|
|
1734
|
+
if (!cell.documents.has(node.id)) {
|
|
1735
|
+
cell.documents.set(node.id, document);
|
|
1736
|
+
changed(cell);
|
|
1737
|
+
}
|
|
1738
|
+
}
|
|
1739
|
+
if (node !== undefined &&
|
|
1740
|
+
node !== null &&
|
|
1741
|
+
node.capability.kind !== 'never' &&
|
|
1742
|
+
representationKey(node.source) === representationKey(from) &&
|
|
1743
|
+
representationKey(node.target) === representationKey(to)) {
|
|
1744
|
+
if (conversions && nativeArrayRootViewPlansOf(node, conversions.nodeById).length > 0) {
|
|
1745
|
+
const cell = value(operation.result.id);
|
|
1746
|
+
if (!cell.arrayViews.has(node.id)) {
|
|
1747
|
+
cell.arrayViews.add(node.id);
|
|
1748
|
+
changed(cell);
|
|
1749
|
+
}
|
|
1750
|
+
}
|
|
1751
|
+
const materializer = 'materializer' in node.capability ? node.capability.materializer : null;
|
|
1752
|
+
if (materializer?.nativeMethod !== undefined)
|
|
1753
|
+
markLogicalReceiver(value(operation.result.id), materializer.nativeMethod.receiver.kind === 'dynamic');
|
|
1754
|
+
const callable = to.kind === 'optional' ? abiOfCallee(to.payload) : abiOfCallee(to);
|
|
1755
|
+
if (from.kind === 'dynamic' && callable?.receiver === null)
|
|
1756
|
+
markLogicalReceiver(value(operation.result.id), true);
|
|
1757
|
+
// A checked dynamic record product builds its callable members with
|
|
1758
|
+
// DynamicCarrier::in. Exact native class projections do not rebuild
|
|
1759
|
+
// their fields and therefore introduce no adapter provenance.
|
|
1760
|
+
if (from.kind === 'dynamic' &&
|
|
1761
|
+
(to.kind === 'record' || to.kind === 'record-with-index' || (to.kind === 'native-record-ref' && to.native === null))) {
|
|
1762
|
+
for (const heap of nativeReferences(to).heaps)
|
|
1763
|
+
for (const slot of heap.fields.values()) {
|
|
1764
|
+
const field = slot.representation.kind === 'optional' ? slot.representation.payload : slot.representation;
|
|
1765
|
+
if (abiOfCallee(field)?.receiver === null)
|
|
1766
|
+
markLogicalReceiver(slot.cell, true);
|
|
1767
|
+
}
|
|
1768
|
+
}
|
|
1769
|
+
}
|
|
1060
1770
|
const native = node?.capability.kind === 'identity' ||
|
|
1061
1771
|
((node?.capability.kind === 'atom' || node?.capability.kind === 'static') &&
|
|
1062
1772
|
node.capability.materializer.nativeFieldProtocol === 'unused');
|
|
1063
|
-
|
|
1773
|
+
// Payload identity and the executable entry frame are independent proofs.
|
|
1774
|
+
// Register the frame even when native payload transfer wins below.
|
|
1775
|
+
const callableEntry = transportsCallablePrefix(from, to, node);
|
|
1776
|
+
const products = nativeRecordProductsOf(node).filter((product) => representationKey(product.source) === representationKey(from));
|
|
1777
|
+
if (products.length > 0 &&
|
|
1778
|
+
node &&
|
|
1779
|
+
representationKey(node.source) === representationKey(from) &&
|
|
1780
|
+
representationKey(node.target) === representationKey(to) &&
|
|
1781
|
+
(from.kind === 'record' || from.kind === 'native-record-ref') &&
|
|
1782
|
+
from.ownership === 'owned') {
|
|
1783
|
+
const heaps = seedAllocation(operation.result.id, to, products.map((plan) => plan.target), true);
|
|
1784
|
+
for (const product of products)
|
|
1785
|
+
for (const field of product.fields) {
|
|
1786
|
+
if (!field.identity)
|
|
1787
|
+
continue;
|
|
1788
|
+
heapEffect(operation, () => {
|
|
1789
|
+
const inputs = slotsOf(operation.source, field.key);
|
|
1790
|
+
if (inputs === null)
|
|
1791
|
+
return true;
|
|
1792
|
+
for (const heap of heaps)
|
|
1793
|
+
if (heap.template === recordHeapOf(product.target)) {
|
|
1794
|
+
const slot = heap.fields.get(field.key);
|
|
1795
|
+
if (slot)
|
|
1796
|
+
for (const input of inputs)
|
|
1797
|
+
link(input, slot.cell);
|
|
1798
|
+
}
|
|
1799
|
+
return inputs.length > 0;
|
|
1800
|
+
});
|
|
1801
|
+
}
|
|
1802
|
+
}
|
|
1803
|
+
else if (nativePayloadTransportMatches(from, to, node))
|
|
1064
1804
|
linkPayload(value(operation.source.value), value(operation.result.id), [to]);
|
|
1065
1805
|
else if (representationKey(from) === representationKey(to) ||
|
|
1066
1806
|
nativeClassReferenceTransportMatches(from, to, node) ||
|
|
1067
|
-
|
|
1807
|
+
nativeFieldViewIdentityTransportOf(node) ||
|
|
1808
|
+
(conversions !== undefined && nativeArrayViewIdentityTransportOf(node, conversions.nodeById)) ||
|
|
1809
|
+
callableEntry ||
|
|
1810
|
+
nativeGenericSelectorMatches(from, to, node) ||
|
|
1811
|
+
nativeCallableIdentityTransportMatches(from, to, node) ||
|
|
1812
|
+
nativeCallableDynamicIdentityTransportMatches(from, to, node) ||
|
|
1813
|
+
(native && (from.kind === 'undefined' || from.kind === 'null') && to.kind === 'dynamic') ||
|
|
1068
1814
|
(native && abiOfCallee(from) !== null && abiOfCallee(to) !== null && abiKey(abiOfCallee(from)) === abiKey(abiOfCallee(to))))
|
|
1069
1815
|
link(value(operation.source.value), value(operation.result.id));
|
|
1070
|
-
else
|
|
1071
|
-
|
|
1816
|
+
else {
|
|
1817
|
+
const destinations = conversions === undefined ||
|
|
1818
|
+
node === null ||
|
|
1819
|
+
node === undefined ||
|
|
1820
|
+
representationKey(node.source) !== representationKey(from) ||
|
|
1821
|
+
representationKey(node.target) !== representationKey(to)
|
|
1822
|
+
? null
|
|
1823
|
+
: dynamicResultCarriersOf(node, conversions.nodeById);
|
|
1824
|
+
untrusted(operation, destinations ?? undefined, undefined, dynamicArm);
|
|
1825
|
+
}
|
|
1072
1826
|
break;
|
|
1073
1827
|
}
|
|
1074
1828
|
case 'construct': {
|
|
@@ -1135,6 +1889,58 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
1135
1889
|
untrusted(operation);
|
|
1136
1890
|
break;
|
|
1137
1891
|
case 'call':
|
|
1892
|
+
if (operation.nativeArrayDescriptorReinstallation) {
|
|
1893
|
+
if (operation.result)
|
|
1894
|
+
link(value(operation.nativeArrayDescriptorReinstallation.receiver.value), value(operation.result.id));
|
|
1895
|
+
break;
|
|
1896
|
+
}
|
|
1897
|
+
if (operation.nativeArrayDescriptorSnapshot && operation.result) {
|
|
1898
|
+
const node = conversions?.nodeById(operation.nativeArrayDescriptorSnapshot.conversion);
|
|
1899
|
+
if (node &&
|
|
1900
|
+
'materializer' in node.capability &&
|
|
1901
|
+
node.capability.materializer.nativeDescriptorSnapshot &&
|
|
1902
|
+
representationKey(node.target) === representationKey(operation.result.representation)) {
|
|
1903
|
+
const snapshot = value(operation.result.id);
|
|
1904
|
+
snapshot.descriptorSnapshots.add(operation.result.id);
|
|
1905
|
+
changed(snapshot);
|
|
1906
|
+
break;
|
|
1907
|
+
}
|
|
1908
|
+
}
|
|
1909
|
+
if (nativeCarrierPredicateOf(operation))
|
|
1910
|
+
break;
|
|
1911
|
+
if (operation.intrinsicReturnIdentity === 'argument0' && operation.result && !operation.argumentsAreSpread) {
|
|
1912
|
+
const original = operation.arguments[0];
|
|
1913
|
+
if (original !== undefined && representationKey(original.representation) === representationKey(operation.result.representation)) {
|
|
1914
|
+
if (operation.intrinsicIntegrity !== undefined &&
|
|
1915
|
+
![...walkRepresentation(original.representation)].some((value) => value.kind === 'proxy-object') &&
|
|
1916
|
+
(abiOfCallee(original.representation) !== null || nativeReferences(original.representation).complete))
|
|
1917
|
+
link(value(original.value), value(operation.result.id));
|
|
1918
|
+
else
|
|
1919
|
+
untrusted(operation, undefined, original);
|
|
1920
|
+
break;
|
|
1921
|
+
}
|
|
1922
|
+
}
|
|
1923
|
+
if (arrayInsertions.has(operation) && insertionReads.has(arrayInsertions.get(operation).read)) {
|
|
1924
|
+
const insertion = arrayInsertions.get(operation);
|
|
1925
|
+
if (insertion.conversion)
|
|
1926
|
+
transportsCallablePrefix(insertion.source, insertion.target, insertion.conversion);
|
|
1927
|
+
heapEffect(operation, () => {
|
|
1928
|
+
const sources = slotsOf(insertion.packed, '');
|
|
1929
|
+
const targets = slotsOf(insertion.receiver, '');
|
|
1930
|
+
if (sources === null || targets === null) {
|
|
1931
|
+
untrusted(operation);
|
|
1932
|
+
return true;
|
|
1933
|
+
}
|
|
1934
|
+
for (const source of sources)
|
|
1935
|
+
for (const target of targets)
|
|
1936
|
+
if (insertion.conversion && nativePayloadTransportMatches(insertion.source, insertion.target, insertion.conversion))
|
|
1937
|
+
linkPayload(source, target, [insertion.target]);
|
|
1938
|
+
else
|
|
1939
|
+
link(source, target);
|
|
1940
|
+
return sources.length > 0 && targets.length > 0;
|
|
1941
|
+
});
|
|
1942
|
+
break;
|
|
1943
|
+
}
|
|
1138
1944
|
if (!nativeKeyQueryOf(operation, nativePropertyLayoutOf)) {
|
|
1139
1945
|
// A call's citation is an execution edge of its containing body,
|
|
1140
1946
|
// not a root. Opening it before frame matching is conservative;
|
|
@@ -1173,6 +1979,50 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
1173
1979
|
};
|
|
1174
1980
|
const escapedFunctions = new Set();
|
|
1175
1981
|
const escapedHeaps = new Set();
|
|
1982
|
+
const observedProxies = new Map();
|
|
1983
|
+
const observeProxy = (heap, reason) => {
|
|
1984
|
+
const target = heap.fields.get('target');
|
|
1985
|
+
const handler = heap.fields.get('handler');
|
|
1986
|
+
if (!target || !handler)
|
|
1987
|
+
return;
|
|
1988
|
+
// [[ProxyHandler]] is an internal slot. Observing the Proxy can execute
|
|
1989
|
+
// its traps and expose their answers, but cannot replace handler fields.
|
|
1990
|
+
// A returned `this` or captured handler still exposes that ordinary heap
|
|
1991
|
+
// through the source body's return edges below.
|
|
1992
|
+
escape(target.cell, reason);
|
|
1993
|
+
for (const origin of handler.cell.heaps) {
|
|
1994
|
+
if (!origin.valid || origin.template?.valid === false) {
|
|
1995
|
+
external(handler.cell, handler.representation, reason);
|
|
1996
|
+
continue;
|
|
1997
|
+
}
|
|
1998
|
+
// Open every callable field conservatively: an external observation may
|
|
1999
|
+
// invoke a trap outside the fixed native Get/Set/Has/Delete lowering.
|
|
2000
|
+
for (const trap of origin.fields.values()) {
|
|
2001
|
+
for (const id of trap.cell.functions) {
|
|
2002
|
+
const body = bodyById.get(id);
|
|
2003
|
+
if (!body?.abi)
|
|
2004
|
+
continue;
|
|
2005
|
+
if (!called.has(id))
|
|
2006
|
+
revision++;
|
|
2007
|
+
called.add(id);
|
|
2008
|
+
enter(id);
|
|
2009
|
+
const receiver = frameReceivers.get(id);
|
|
2010
|
+
if (body.abi.receiver !== null) {
|
|
2011
|
+
if (receiver && representationKey(body.abi.receiver) === representationKey(handler.representation))
|
|
2012
|
+
link(handler.cell, receiver);
|
|
2013
|
+
else
|
|
2014
|
+
external(handler.cell, handler.representation, reason);
|
|
2015
|
+
}
|
|
2016
|
+
for (const parameter of parameters.get(id) ?? [])
|
|
2017
|
+
if (parameter.kind !== 'receiver')
|
|
2018
|
+
external(value(parameter.result.id), parameter.result.representation, reason);
|
|
2019
|
+
const returned = returns.get(id);
|
|
2020
|
+
if (returned)
|
|
2021
|
+
escape(returned, reason);
|
|
2022
|
+
}
|
|
2023
|
+
}
|
|
2024
|
+
}
|
|
2025
|
+
};
|
|
1176
2026
|
const matchedCalls = new Set();
|
|
1177
2027
|
const visitedCallTargets = new Map();
|
|
1178
2028
|
const unknownCalls = new Set();
|
|
@@ -1185,6 +2035,8 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
1185
2035
|
for (const operation of [...block.operations, block.terminator])
|
|
1186
2036
|
processOperation(operation);
|
|
1187
2037
|
}
|
|
2038
|
+
for (const [heap, reason] of observedProxies)
|
|
2039
|
+
observeProxy(heap, reason);
|
|
1188
2040
|
for (const effect of heapEffects)
|
|
1189
2041
|
effect.apply();
|
|
1190
2042
|
// Conflicting physical views and unsupported record protocols cannot
|
|
@@ -1201,16 +2053,59 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
1201
2053
|
const cell = popCell();
|
|
1202
2054
|
sweepIndex = cell.index;
|
|
1203
2055
|
for (const [target, allowed] of cell.edges) {
|
|
2056
|
+
for (const id of cell.fieldViews)
|
|
2057
|
+
if (!target.fieldViews.has(id)) {
|
|
2058
|
+
target.fieldViews.add(id);
|
|
2059
|
+
changed(target);
|
|
2060
|
+
}
|
|
2061
|
+
for (const id of cell.descriptorSnapshots)
|
|
2062
|
+
if (!target.descriptorSnapshots.has(id)) {
|
|
2063
|
+
target.descriptorSnapshots.add(id);
|
|
2064
|
+
changed(target);
|
|
2065
|
+
}
|
|
2066
|
+
for (const id of cell.arrayViews)
|
|
2067
|
+
if (!target.arrayViews.has(id)) {
|
|
2068
|
+
target.arrayViews.add(id);
|
|
2069
|
+
changed(target);
|
|
2070
|
+
}
|
|
2071
|
+
if (!target.documentInstalled) {
|
|
2072
|
+
if (cell.documentBlocked && !target.documentBlocked && !documentNeutralCells.has(target)) {
|
|
2073
|
+
target.documentBlocked = true;
|
|
2074
|
+
changed(target);
|
|
2075
|
+
}
|
|
2076
|
+
for (const [id, entry] of cell.documents)
|
|
2077
|
+
if (!target.documents.has(id)) {
|
|
2078
|
+
target.documents.set(id, entry);
|
|
2079
|
+
changed(target);
|
|
2080
|
+
}
|
|
2081
|
+
}
|
|
1204
2082
|
for (const id of cell.functions)
|
|
1205
2083
|
addFunction(target, id);
|
|
2084
|
+
// A layout filter bounds which allocations a payload transport can
|
|
2085
|
+
// carry, but a value an installed live view produced is a view whose
|
|
2086
|
+
// origin is any allocation of another layout: `ContextLike | null`
|
|
2087
|
+
// holding a class instance behind a record view. Dropping that origin
|
|
2088
|
+
// left the record arm the sole implementation of a field it never held.
|
|
1206
2089
|
for (const heap of cell.heaps)
|
|
1207
|
-
if (allowed === null || heapAdmitted(heap, allowed))
|
|
2090
|
+
if (allowed === null || cell.fieldViews.size > 0 || heapAdmitted(heap, allowed))
|
|
1208
2091
|
addHeap(target, heap);
|
|
1209
|
-
if (cell.unknown)
|
|
1210
|
-
|
|
2092
|
+
if (cell.unknown) {
|
|
2093
|
+
const admitted = cell.unknownHeaps === null
|
|
2094
|
+
? undefined
|
|
2095
|
+
: [...cell.unknownHeaps].filter((heap) => allowed === null || heapAdmitted(heap, allowed));
|
|
2096
|
+
// Unknown allocation origins survive a checked Document view, but
|
|
2097
|
+
// its exact installed entry protocol still follows every alias.
|
|
2098
|
+
// An independent uninstalled incoming source blocks it above.
|
|
2099
|
+
if (allowed === null || admitted === undefined || admitted.length > 0)
|
|
2100
|
+
markUnknown(target, cell.unknownReason, admitted, (!cell.documentBlocked && cell.documents.size > 0) || documentNeutralCells.has(cell) || documentNeutralCells.has(target));
|
|
2101
|
+
}
|
|
2102
|
+
if (cell.logicalReceiver)
|
|
2103
|
+
markLogicalReceiver(target, cell.dynamicReceiver);
|
|
2104
|
+
if (cell.ignoresLogicalReceiver)
|
|
2105
|
+
markIgnoredLogicalReceiver(target);
|
|
1211
2106
|
// Publication of an alias is publication of its sources too.
|
|
1212
2107
|
if (target.escaped)
|
|
1213
|
-
|
|
2108
|
+
absorbEscape(cell, target);
|
|
1214
2109
|
}
|
|
1215
2110
|
if (!cell.unknown && !cell.escaped)
|
|
1216
2111
|
continue;
|
|
@@ -1230,6 +2125,12 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
1230
2125
|
if (escapedHeaps.has(heap))
|
|
1231
2126
|
continue;
|
|
1232
2127
|
escapedHeaps.add(heap);
|
|
2128
|
+
if (heap.proxy === true) {
|
|
2129
|
+
const reason = cell.unknownReason ?? cell.escapeReason ?? 'external-proxy';
|
|
2130
|
+
observedProxies.set(heap, reason);
|
|
2131
|
+
observeProxy(heap, reason);
|
|
2132
|
+
continue;
|
|
2133
|
+
}
|
|
1233
2134
|
if (heap.template !== undefined)
|
|
1234
2135
|
for (const summary of familyOf(heap.template))
|
|
1235
2136
|
for (const [key, slot] of heap.fields) {
|
|
@@ -1247,6 +2148,10 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
1247
2148
|
// deferral safe after publication, including base-typed aliases.
|
|
1248
2149
|
const methodLayouts = candidate.declaration === null ? [] : methodLayoutsOf(candidate.declaration);
|
|
1249
2150
|
for (const layout of methodLayouts) {
|
|
2151
|
+
// An instance observer can recover its constructor and mutate the same static cells.
|
|
2152
|
+
for (const heap of constructorHeapsOf(layout.declaration))
|
|
2153
|
+
for (const slot of heap.fields.values())
|
|
2154
|
+
external(slot.cell, slot.representation, 'external-instance-constructor-static');
|
|
1250
2155
|
// An observer can recover a native instance's constructor from
|
|
1251
2156
|
// its prototype and create another instance. Deferring the
|
|
1252
2157
|
// constructor must not hide those future initializer effects.
|
|
@@ -1275,6 +2180,8 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
1275
2180
|
for (const operation of pendingCalls) {
|
|
1276
2181
|
const callee = value(operation.callee.value);
|
|
1277
2182
|
if (callee.unknown) {
|
|
2183
|
+
if (operation.callee.representation.kind === 'generic-function-set')
|
|
2184
|
+
matchedCalls.delete(operation);
|
|
1278
2185
|
if (!unknownCalls.has(operation)) {
|
|
1279
2186
|
unknownCalls.add(operation);
|
|
1280
2187
|
untrusted(operation);
|
|
@@ -1284,6 +2191,21 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
1284
2191
|
let visited = visitedCallTargets.get(operation);
|
|
1285
2192
|
if (!visited)
|
|
1286
2193
|
visitedCallTargets.set(operation, (visited = new Set()));
|
|
2194
|
+
if (operation.callee.representation.kind === 'generic-function-set') {
|
|
2195
|
+
const entries = nativeGenericCallEntriesOf(operation, callee.functions, (id) => bodyById.get(id), conversions);
|
|
2196
|
+
if (entries === null) {
|
|
2197
|
+
matchedCalls.delete(operation);
|
|
2198
|
+
continue;
|
|
2199
|
+
}
|
|
2200
|
+
matchedCalls.add(operation);
|
|
2201
|
+
for (const entry of entries) {
|
|
2202
|
+
if (visited.has(entry.functionId))
|
|
2203
|
+
continue;
|
|
2204
|
+
visited.add(entry.functionId);
|
|
2205
|
+
invoke(entry.functionId, entry.arguments, null, operation.result ? value(operation.result.id) : null);
|
|
2206
|
+
}
|
|
2207
|
+
continue;
|
|
2208
|
+
}
|
|
1287
2209
|
for (const id of callee.functions) {
|
|
1288
2210
|
// Frame compatibility is immutable. Once linked, argument and
|
|
1289
2211
|
// return edges carry future origins without re-invoking the site.
|
|
@@ -1293,10 +2215,11 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
1293
2215
|
const abi = bodyById.get(id)?.abi;
|
|
1294
2216
|
const held = abiOfCallee(operation.callee.representation);
|
|
1295
2217
|
// Only an observed, certified native adapter can enter the original
|
|
1296
|
-
//
|
|
2218
|
+
// body through its public held frame. All
|
|
1297
2219
|
// identity propagation into this cell already crossed proven edges.
|
|
1298
|
-
const
|
|
1299
|
-
const
|
|
2220
|
+
const adaptedReceiver = abi && held ? adaptedReceiverOf(abi, held) : null;
|
|
2221
|
+
const adaptsFrame = adaptedReceiver !== null;
|
|
2222
|
+
const argumentsForBody = adaptsFrame && abi ? operation.arguments.slice(0, abi.parameters.length) : operation.arguments;
|
|
1300
2223
|
if (!abi ||
|
|
1301
2224
|
!held ||
|
|
1302
2225
|
operation.argumentsAreSpread ||
|
|
@@ -1309,11 +2232,12 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
1309
2232
|
continue;
|
|
1310
2233
|
}
|
|
1311
2234
|
matchedCalls.add(operation);
|
|
1312
|
-
|
|
2235
|
+
const incomingReceiver = adaptedReceiver === 'logical' ? (operation.thisArgument ?? operation.receiver) : operation.receiver;
|
|
2236
|
+
let receiverForBody = abi.receiver !== null && incomingReceiver ? value(incomingReceiver.value) : null;
|
|
1313
2237
|
if (receiverForBody &&
|
|
1314
2238
|
abi.receiver &&
|
|
1315
|
-
|
|
1316
|
-
representationKey(abi.receiver) !== representationKey(
|
|
2239
|
+
incomingReceiver &&
|
|
2240
|
+
(adaptedReceiver === 'logical' || representationKey(abi.receiver) !== representationKey(incomingReceiver.representation))) {
|
|
1317
2241
|
const adaptedReceiver = fresh();
|
|
1318
2242
|
linkPayload(receiverForBody, adaptedReceiver, [abi.receiver]);
|
|
1319
2243
|
receiverForBody = adaptedReceiver;
|
|
@@ -1390,33 +2314,537 @@ const computeNativeCallableFlow = (bodies, placements, classes, conversions, tra
|
|
|
1390
2314
|
continue;
|
|
1391
2315
|
result.set(read.result.id, ids.length === 1 ? { kind: 'exact', functionId: ids[0] } : { kind: 'closed-family', functionIds: ids });
|
|
1392
2316
|
}
|
|
1393
|
-
|
|
2317
|
+
const logicalReceiverValues = new Set();
|
|
2318
|
+
const dynamicReceiverValues = new Set();
|
|
2319
|
+
const ignoredLogicalReceiverValues = new Set();
|
|
2320
|
+
// Retained specializations must certify their executable entry metadata
|
|
2321
|
+
// even when this program never enters their bodies. This source-authenticated
|
|
2322
|
+
// Get contract does not execute the read or seed dormant heap/call effects.
|
|
2323
|
+
// Certification independently replays the exact host property contract.
|
|
2324
|
+
for (const operation of operations)
|
|
2325
|
+
if (operation.kind === 'get' && operation.logicalReceiver === 'ignored')
|
|
2326
|
+
ignoredLogicalReceiverValues.add(operation.result.id);
|
|
2327
|
+
const sourceIgnoresLogicalReceiver = (id) => {
|
|
2328
|
+
const variants = physicalBodiesBySource.get(id);
|
|
2329
|
+
return variants !== undefined && variants.length > 0 && variants.every(nativeBodyIgnoresLogicalReceiver);
|
|
2330
|
+
};
|
|
2331
|
+
for (const [id, cell] of values) {
|
|
2332
|
+
const bodiesReceive = [...cell.functions].some((functionId) => bodyById.get(functionId)?.abi?.receiver != null);
|
|
2333
|
+
if (cell.logicalReceiver || bodiesReceive)
|
|
2334
|
+
logicalReceiverValues.add(id);
|
|
2335
|
+
if (cell.dynamicReceiver)
|
|
2336
|
+
dynamicReceiverValues.add(id);
|
|
2337
|
+
if (!cell.unknown &&
|
|
2338
|
+
(cell.functions.size > 0 || cell.ignoresLogicalReceiver) &&
|
|
2339
|
+
[...cell.functions].every(sourceIgnoresLogicalReceiver))
|
|
2340
|
+
ignoredLogicalReceiverValues.add(id);
|
|
2341
|
+
}
|
|
2342
|
+
// A result or finite-arity adapter can lose executable-body provenance
|
|
2343
|
+
// while retaining its source's logical receiver contract. Grow that
|
|
2344
|
+
// positive contract through admitted conversions and complete SSA joins;
|
|
2345
|
+
// neither a public nil ABI nor one ignored arm licenses an unknown source.
|
|
2346
|
+
const localWrites = new Map();
|
|
2347
|
+
for (const operation of operations)
|
|
2348
|
+
if (operation.kind === 'binding-write') {
|
|
2349
|
+
const writes = localWrites.get(operation.declaration) ?? [];
|
|
2350
|
+
writes.push(operation.value.value);
|
|
2351
|
+
localWrites.set(operation.declaration, writes);
|
|
2352
|
+
}
|
|
2353
|
+
let changedReceiverContract = true;
|
|
2354
|
+
while (changedReceiverContract) {
|
|
2355
|
+
changedReceiverContract = false;
|
|
2356
|
+
for (const operation of operations) {
|
|
2357
|
+
const result = resultOfIrOperation(operation);
|
|
2358
|
+
if (!result || ignoredLogicalReceiverValues.has(result.id))
|
|
2359
|
+
continue;
|
|
2360
|
+
const sourceIgnores = (source) => ignoredLogicalReceiverValues.has(source);
|
|
2361
|
+
let ignored = false;
|
|
2362
|
+
if (operation.kind === 'convert')
|
|
2363
|
+
ignored =
|
|
2364
|
+
sourceIgnores(operation.source.value) &&
|
|
2365
|
+
nativeCallableLogicalReceiverTransportMatches(operation.source.representation, operation.result.representation, conversions?.nodeById(operation.conversionUse));
|
|
2366
|
+
else if (operation.kind === 'phi')
|
|
2367
|
+
ignored = operation.incoming.length > 0 && operation.incoming.every((incoming) => sourceIgnores(incoming.value.value));
|
|
2368
|
+
else if (operation.kind === 'binding-read') {
|
|
2369
|
+
const storage = placements.get(operation.declaration)?.storage.kind;
|
|
2370
|
+
const writes = localWrites.get(operation.declaration);
|
|
2371
|
+
ignored = (storage === 'local' || storage === 'region') && writes !== undefined && writes.length > 0 && writes.every(sourceIgnores);
|
|
2372
|
+
}
|
|
2373
|
+
if (ignored) {
|
|
2374
|
+
ignoredLogicalReceiverValues.add(result.id);
|
|
2375
|
+
changedReceiverContract = true;
|
|
2376
|
+
}
|
|
2377
|
+
}
|
|
2378
|
+
}
|
|
2379
|
+
const nativeFieldStorageValues = new Map();
|
|
2380
|
+
const nativeFieldMethodValues = new Map();
|
|
2381
|
+
const nativeAccessorStorageValues = new Map();
|
|
2382
|
+
for (const [id, cell] of values) {
|
|
2383
|
+
if (cell.unknown || cell.heaps.size === 0 || [...cell.heaps].some((heap) => !heap.valid || heap.proxy))
|
|
2384
|
+
continue;
|
|
2385
|
+
const common = new Map();
|
|
2386
|
+
for (const heap of cell.heaps) {
|
|
2387
|
+
for (const [key, slot] of heap.fields) {
|
|
2388
|
+
const members = common.get(key) ?? [];
|
|
2389
|
+
if (!members.some((member) => representationKey(member) === representationKey(slot.representation)))
|
|
2390
|
+
members.push(slot.representation);
|
|
2391
|
+
common.set(key, members);
|
|
2392
|
+
}
|
|
2393
|
+
}
|
|
2394
|
+
for (const key of [...common.keys()])
|
|
2395
|
+
if ([...cell.heaps].some((heap) => !heap.fields.has(key)))
|
|
2396
|
+
common.delete(key);
|
|
2397
|
+
nativeFieldStorageValues.set(id, common);
|
|
2398
|
+
const carrier = valueCarriers.get(id);
|
|
2399
|
+
const methods = carrier && 'shapeId' in carrier ? viewMethodFields.get(carrier.shapeId) : undefined;
|
|
2400
|
+
if (methods) {
|
|
2401
|
+
const admitted = new Map(methods);
|
|
2402
|
+
for (const key of admitted.keys())
|
|
2403
|
+
if ([...cell.heaps].some((heap) => heap.declaration === null || classMemberOf(classes, heap.declaration, key)?.kind !== 'method'))
|
|
2404
|
+
admitted.delete(key);
|
|
2405
|
+
nativeFieldMethodValues.set(id, admitted);
|
|
2406
|
+
}
|
|
2407
|
+
const accessors = new Map();
|
|
2408
|
+
for (const heap of cell.heaps) {
|
|
2409
|
+
if (heap.declaration === null)
|
|
2410
|
+
continue;
|
|
2411
|
+
const seen = new Set();
|
|
2412
|
+
for (let current = heap.declaration; current !== null && !seen.has(current); current = classes.get(current)?.base ?? null) {
|
|
2413
|
+
seen.add(current);
|
|
2414
|
+
for (const accessor of classes.get(current)?.accessors ?? []) {
|
|
2415
|
+
const selected = classMemberOf(classes, heap.declaration, accessor.key);
|
|
2416
|
+
if (selected?.kind !== 'accessor' || selected.owner !== current)
|
|
2417
|
+
continue;
|
|
2418
|
+
const getter = accessor.getter === null ? null : bodyById.get(accessor.getter)?.abi;
|
|
2419
|
+
const setter = accessor.setter === null ? null : bodyById.get(accessor.setter)?.abi;
|
|
2420
|
+
if (!getter)
|
|
2421
|
+
continue;
|
|
2422
|
+
const entries = accessors.get(accessor.key) ?? [];
|
|
2423
|
+
entries.push({ read: getter.result, write: setter?.parameters[0]?.value ?? null });
|
|
2424
|
+
accessors.set(accessor.key, entries);
|
|
2425
|
+
}
|
|
2426
|
+
}
|
|
2427
|
+
}
|
|
2428
|
+
for (const key of [...accessors.keys()])
|
|
2429
|
+
if ([...cell.heaps].some((heap) => heap.declaration === null || classMemberOf(classes, heap.declaration, key)?.kind !== 'accessor'))
|
|
2430
|
+
accessors.delete(key);
|
|
2431
|
+
nativeAccessorStorageValues.set(id, accessors);
|
|
2432
|
+
}
|
|
2433
|
+
// What a spread's copy left natively in an allocation's expando, by the
|
|
2434
|
+
// receiver's carrier and key. Read from the published copy plan, which
|
|
2435
|
+
// certification re-derives from the operation itself.
|
|
2436
|
+
const expandoStored = new Map();
|
|
2437
|
+
const storeExpando = (receiver, key, value) => {
|
|
2438
|
+
if (!('shapeId' in receiver))
|
|
2439
|
+
return;
|
|
2440
|
+
const byKey = expandoStored.get(receiver.shapeId) ?? new Map();
|
|
2441
|
+
const held = byKey.get(key) ?? [];
|
|
2442
|
+
if (!held.some((one) => representationKey(one) === representationKey(value)))
|
|
2443
|
+
held.push(value);
|
|
2444
|
+
byKey.set(key, held);
|
|
2445
|
+
expandoStored.set(receiver.shapeId, byKey);
|
|
2446
|
+
};
|
|
2447
|
+
for (const operation of operations) {
|
|
2448
|
+
if (operation.kind === 'spread-copy' && operation.spreadConversionPlan) {
|
|
2449
|
+
for (const [key, values] of operation.spreadConversionPlan.expandoKeys)
|
|
2450
|
+
for (const value of values)
|
|
2451
|
+
storeExpando(operation.receiver.representation, key, value);
|
|
2452
|
+
continue;
|
|
2453
|
+
}
|
|
2454
|
+
// `Object.assign`'s native copy stores a key its target's layout lacks in
|
|
2455
|
+
// the target's native object data, as the carrier it holds there; a
|
|
2456
|
+
// described source's run-time key outside its type lands there as the
|
|
2457
|
+
// Value it already is. A live view over the target reads both.
|
|
2458
|
+
if (operation.kind !== 'call' || !operation.nativeOwnAssignment)
|
|
2459
|
+
continue;
|
|
2460
|
+
const owner = operation.nativeOwnAssignment.owner.representation;
|
|
2461
|
+
for (const source of operation.nativeOwnAssignment.sources) {
|
|
2462
|
+
for (const field of source.fields)
|
|
2463
|
+
if (field.destination === 'extension')
|
|
2464
|
+
storeExpando(owner, field.key, field.held);
|
|
2465
|
+
if (source.described === true)
|
|
2466
|
+
storeExpando(owner, null, { kind: 'dynamic', reason: 'declared-any-never-narrowed' });
|
|
2467
|
+
}
|
|
2468
|
+
}
|
|
2469
|
+
const expandoStoredOf = (shapeId, key) => {
|
|
2470
|
+
const byKey = expandoStored.get(shapeId);
|
|
2471
|
+
if (byKey === undefined)
|
|
2472
|
+
return [];
|
|
2473
|
+
// `null`: whatever any key may hold -- an open runtime key reads them all.
|
|
2474
|
+
if (key === null) {
|
|
2475
|
+
const all = [];
|
|
2476
|
+
for (const values of byKey.values())
|
|
2477
|
+
for (const value of values)
|
|
2478
|
+
if (!all.some((one) => representationKey(one) === representationKey(value)))
|
|
2479
|
+
all.push(value);
|
|
2480
|
+
return all;
|
|
2481
|
+
}
|
|
2482
|
+
const keyed = byKey.get(key) ?? [];
|
|
2483
|
+
const any = byKey.get(null) ?? [];
|
|
2484
|
+
return [...keyed, ...any.filter((value) => !keyed.some((one) => representationKey(one) === representationKey(value)))];
|
|
2485
|
+
};
|
|
2486
|
+
const nativeFieldViewStorageValues = new Map();
|
|
2487
|
+
const descriptorDomainsOf = nativeFieldViewDomainsOf(viewNodes, deriver, (id) => bodyById.get(id)?.abi ?? null, classes, expandoStoredOf);
|
|
2488
|
+
for (const [id, carrier] of valueCarriers) {
|
|
2489
|
+
const fields = descriptorDomainsOf(carrier);
|
|
2490
|
+
if (fields !== null)
|
|
2491
|
+
nativeFieldViewStorageValues.set(id, fields);
|
|
2492
|
+
}
|
|
2493
|
+
const nativeFieldOperationStorageValues = new Map();
|
|
2494
|
+
const originDomains = new Map();
|
|
2495
|
+
for (const operation of operations) {
|
|
2496
|
+
if (operation.kind !== 'get' && operation.kind !== 'set')
|
|
2497
|
+
continue;
|
|
2498
|
+
const key = keyOf(operation.key);
|
|
2499
|
+
const receiver = value(operation.receiver.value);
|
|
2500
|
+
if (key === null || receiver.unknown || receiver.heaps.size === 0)
|
|
2501
|
+
continue;
|
|
2502
|
+
const { heaps, present } = heapSelectionAt(operation.receiver, key, operation);
|
|
2503
|
+
if (heaps === null || heaps.length === 0 || !heaps.every(ordinaryAllocated))
|
|
2504
|
+
continue;
|
|
2505
|
+
const domains = new Map();
|
|
2506
|
+
for (const name of heaps[0].fields.keys()) {
|
|
2507
|
+
if (!heaps.every((heap) => heap.fields.has(name)))
|
|
2508
|
+
continue;
|
|
2509
|
+
const entries = new Map();
|
|
2510
|
+
for (const heap of heaps) {
|
|
2511
|
+
const stored = heap.fields.get(name).representation;
|
|
2512
|
+
entries.set(representationKey(stored), { read: stored, write: stored });
|
|
2513
|
+
}
|
|
2514
|
+
domains.set(name, [...entries.values()]);
|
|
2515
|
+
}
|
|
2516
|
+
if (operation.kind === 'get' &&
|
|
2517
|
+
heaps.some((heap) => !heap.fields.has(key)) &&
|
|
2518
|
+
heaps.every((heap) => heap.fields.has(key) || originalDescriptorAbsent(operation, key, heap))) {
|
|
2519
|
+
const entries = [];
|
|
2520
|
+
for (const heap of heaps) {
|
|
2521
|
+
const slot = heap.fields.get(key);
|
|
2522
|
+
entries.push(slot === undefined
|
|
2523
|
+
? { read: { kind: 'undefined' }, write: null, originalAbsent: true }
|
|
2524
|
+
: { read: slot.representation, write: slot.representation });
|
|
2525
|
+
}
|
|
2526
|
+
domains.set(key, entries);
|
|
2527
|
+
}
|
|
2528
|
+
if (receiver.fieldViews.size > 0) {
|
|
2529
|
+
const ids = [...receiver.fieldViews].sort();
|
|
2530
|
+
const identity = JSON.stringify(ids);
|
|
2531
|
+
let installed = originDomains.get(identity);
|
|
2532
|
+
if (!installed) {
|
|
2533
|
+
const nodes = nativeFieldViewLiveLeavesOf(ids.flatMap((id) => {
|
|
2534
|
+
const node = conversions?.nodeById(id);
|
|
2535
|
+
return node && nativeFieldViewIdentityTransportOf(node) ? [node] : [];
|
|
2536
|
+
}));
|
|
2537
|
+
installed = nativeFieldViewDomainsOf(nodes, deriver, (id) => bodyById.get(id)?.abi ?? null, classes, expandoStoredOf);
|
|
2538
|
+
originDomains.set(identity, installed);
|
|
2539
|
+
}
|
|
2540
|
+
// The retained allocation's C++ slot is behind this installed reader.
|
|
2541
|
+
// Its layout alone cannot erase an intermediate Document entry route.
|
|
2542
|
+
// A dominating true Has edge proved an own descriptor on every selected
|
|
2543
|
+
// allocation, so a view leaf answering the key from a source that never
|
|
2544
|
+
// stores it (`{ $binary }` viewed as `{ $type, $binary }`) is not behind it.
|
|
2545
|
+
for (const [name, routes] of installed(operation.receiver.representation) ?? []) {
|
|
2546
|
+
// The selected heaps already prove each allocation's own slot or its
|
|
2547
|
+
// absence; a union arm's certified absence is the unknown-receiver
|
|
2548
|
+
// answer (`native-field-view-domains.ts`) and is no route behind them.
|
|
2549
|
+
if (routes.some((route) => route.originalAbsent === true || route.dynamicGet === true))
|
|
2550
|
+
continue;
|
|
2551
|
+
domains.set(name, [
|
|
2552
|
+
...(domains.get(name) ?? []),
|
|
2553
|
+
...(present && name === key ? routes.filter((route) => route.sourceAbsent !== true) : routes)
|
|
2554
|
+
]);
|
|
2555
|
+
}
|
|
2556
|
+
}
|
|
2557
|
+
nativeFieldOperationStorageValues.set(operation, domains);
|
|
2558
|
+
}
|
|
2559
|
+
const callableIdentityOrigins = new Map();
|
|
2560
|
+
const callablePublications = new Map();
|
|
2561
|
+
for (const cell of cells)
|
|
2562
|
+
if (cell.functions.size > 0 && (cell.escaped || cell.unknown))
|
|
2563
|
+
for (const functionId of cell.functions) {
|
|
2564
|
+
const sources = callablePublications.get(functionId) ?? new Set();
|
|
2565
|
+
if (cell.unknown)
|
|
2566
|
+
sources.add(null);
|
|
2567
|
+
for (const source of cell.escapeSources)
|
|
2568
|
+
sources.add(source);
|
|
2569
|
+
callablePublications.set(functionId, sources);
|
|
2570
|
+
}
|
|
2571
|
+
for (const [id, cell] of values)
|
|
2572
|
+
if (!cell.unknown && cell.functions.size > 0 && [...cell.functions].every((functionId) => bodyById.has(functionId)))
|
|
2573
|
+
callableIdentityOrigins.set(id, [...cell.functions]);
|
|
2574
|
+
const closedCallableReturns = new Set();
|
|
2575
|
+
for (const operation of operations)
|
|
2576
|
+
if (operation.kind === 'return' &&
|
|
2577
|
+
operation.value !== null &&
|
|
2578
|
+
callableIdentityOrigins.has(operation.value.value) &&
|
|
2579
|
+
!externalEntries.has(owner.get(operation)) &&
|
|
2580
|
+
!implicitAccessorEntries.has(owner.get(operation)) &&
|
|
2581
|
+
called.has(owner.get(operation)))
|
|
2582
|
+
closedCallableReturns.add(operation);
|
|
2583
|
+
const nativeDocumentEntryValues = new Map();
|
|
2584
|
+
const nativeDocumentArrayEntryValues = new Map();
|
|
2585
|
+
const documentArrayRoots = conversions
|
|
2586
|
+
? viewNodes.filter((node) => nativeArrayRootViewPlansOf(node, conversions.nodeById).length > 0)
|
|
2587
|
+
: [];
|
|
2588
|
+
const documentArrayEntries = new Map();
|
|
2589
|
+
if (conversions && documentArrayRoots.length > 0)
|
|
2590
|
+
for (const [id, carrier] of valueCarriers) {
|
|
2591
|
+
const identity = representationKey(carrier);
|
|
2592
|
+
if (!documentArrayEntries.has(identity))
|
|
2593
|
+
documentArrayEntries.set(identity, nativeDocumentArrayEntryOf(carrier, documentArrayRoots, conversions.nodeById, deriver));
|
|
2594
|
+
const entry = documentArrayEntries.get(identity) ?? null;
|
|
2595
|
+
if (entry !== null)
|
|
2596
|
+
nativeDocumentArrayEntryValues.set(id, entry);
|
|
2597
|
+
}
|
|
2598
|
+
const nativeArrayViewValues = new Set();
|
|
2599
|
+
const nativeArrayViewOrigins = new Map();
|
|
2600
|
+
const nativeDescriptorSnapshotValues = new Map();
|
|
2601
|
+
const nativeDescriptorSnapshotOpenValues = new Set();
|
|
2602
|
+
const nativeFieldViewOrigins = new Map();
|
|
2603
|
+
for (const [id, cell] of values) {
|
|
2604
|
+
if (cell.fieldViews.size > 0)
|
|
2605
|
+
nativeFieldViewOrigins.set(id, [...cell.fieldViews]);
|
|
2606
|
+
if (cell.descriptorSnapshots.size > 0) {
|
|
2607
|
+
nativeDescriptorSnapshotValues.set(id, [...cell.descriptorSnapshots]);
|
|
2608
|
+
if (cell.unknown || cell.escaped)
|
|
2609
|
+
nativeDescriptorSnapshotOpenValues.add(id);
|
|
2610
|
+
}
|
|
2611
|
+
if (cell.arrayViews.size > 0) {
|
|
2612
|
+
nativeArrayViewValues.add(id);
|
|
2613
|
+
const roots = [...cell.arrayViews].flatMap((root) => {
|
|
2614
|
+
const node = conversions?.nodeById(root);
|
|
2615
|
+
return node === undefined || node === null ? [] : [node];
|
|
2616
|
+
});
|
|
2617
|
+
nativeArrayViewOrigins.set(id, roots);
|
|
2618
|
+
}
|
|
2619
|
+
if (cell.documentBlocked || cell.documents.size === 0)
|
|
2620
|
+
continue;
|
|
2621
|
+
const entries = [...cell.documents.values()];
|
|
2622
|
+
if (entries.some((entry) => representationKey(entry) !== representationKey(entries[0])))
|
|
2623
|
+
continue;
|
|
2624
|
+
nativeDocumentEntryValues.set(id, { entry: entries[0], views: [...cell.documents.keys()] });
|
|
2625
|
+
}
|
|
2626
|
+
return {
|
|
2627
|
+
nativeFieldViewOrigins,
|
|
2628
|
+
callableIdentityOrigins,
|
|
2629
|
+
callablePublications,
|
|
2630
|
+
closedCallableReturns,
|
|
2631
|
+
nativeDocumentEntryValues,
|
|
2632
|
+
nativeDocumentArrayEntryValues,
|
|
2633
|
+
nativeArrayViewValues,
|
|
2634
|
+
nativeArrayViewOrigins,
|
|
2635
|
+
nativeDescriptorSnapshotValues,
|
|
2636
|
+
nativeDescriptorSnapshotOpenValues,
|
|
2637
|
+
nativeFieldOperationStorageValues,
|
|
2638
|
+
nativeFieldViewStorageValues,
|
|
2639
|
+
nativeFieldViewAbsentRoutesOf: (receiver, key) => {
|
|
2640
|
+
const carrier = valueCarriers.get(receiver);
|
|
2641
|
+
return carrier === undefined ? null : descriptorDomainsOf.absentRoutesOf(carrier, key);
|
|
2642
|
+
},
|
|
2643
|
+
nativeFieldStorageValues,
|
|
2644
|
+
nativeFieldMethodValues,
|
|
2645
|
+
nativeAccessorStorageValues,
|
|
2646
|
+
callables: result,
|
|
2647
|
+
enteredBodies: new Set([...entered].map((body) => body.owner)),
|
|
2648
|
+
logicalReceiverValues,
|
|
2649
|
+
dynamicReceiverValues,
|
|
2650
|
+
ignoredLogicalReceiverValues
|
|
2651
|
+
};
|
|
2652
|
+
};
|
|
2653
|
+
/**
|
|
2654
|
+
* Pairs every object of `old` with the object at the same position in `next`,
|
|
2655
|
+
* answering whether the two are the same data. Only plain objects, arrays,
|
|
2656
|
+
* Maps and Sets are looked into; anything else (a function, a class instance)
|
|
2657
|
+
* must be the very same object. A shared object is paired once, so a DAG whose
|
|
2658
|
+
* sharing differs is refused rather than mis-paired.
|
|
2659
|
+
*/
|
|
2660
|
+
const pairSameData = (old, next, pairs) => {
|
|
2661
|
+
if (old === next)
|
|
2662
|
+
return true;
|
|
2663
|
+
if (typeof old !== 'object' || typeof next !== 'object' || old === null || next === null)
|
|
2664
|
+
return Object.is(old, next);
|
|
2665
|
+
const paired = pairs.get(old);
|
|
2666
|
+
if (paired !== undefined)
|
|
2667
|
+
return paired === next;
|
|
2668
|
+
const prototype = Object.getPrototypeOf(old);
|
|
2669
|
+
if (prototype !== Object.getPrototypeOf(next))
|
|
2670
|
+
return false;
|
|
2671
|
+
pairs.set(old, next);
|
|
2672
|
+
if (Array.isArray(old)) {
|
|
2673
|
+
const other = next;
|
|
2674
|
+
if (old.length !== other.length)
|
|
2675
|
+
return false;
|
|
2676
|
+
for (let index = 0; index < old.length; index++)
|
|
2677
|
+
if (!pairSameData(old[index], other[index], pairs))
|
|
2678
|
+
return false;
|
|
2679
|
+
return true;
|
|
2680
|
+
}
|
|
2681
|
+
if (old instanceof Map || old instanceof Set) {
|
|
2682
|
+
const other = next;
|
|
2683
|
+
if (old.size !== other.size)
|
|
2684
|
+
return false;
|
|
2685
|
+
const theirs = other.entries();
|
|
2686
|
+
for (const [key, value] of old.entries()) {
|
|
2687
|
+
const [otherKey, otherValue] = theirs.next().value;
|
|
2688
|
+
if (!pairSameData(key, otherKey, pairs) || !pairSameData(value, otherValue, pairs))
|
|
2689
|
+
return false;
|
|
2690
|
+
}
|
|
2691
|
+
return true;
|
|
2692
|
+
}
|
|
2693
|
+
if (prototype !== Object.prototype && prototype !== null)
|
|
2694
|
+
return false;
|
|
2695
|
+
const keys = Object.keys(old);
|
|
2696
|
+
if (keys.length !== Object.keys(next).length)
|
|
2697
|
+
return false;
|
|
2698
|
+
for (const key of keys) {
|
|
2699
|
+
if (!Object.prototype.hasOwnProperty.call(next, key))
|
|
2700
|
+
return false;
|
|
2701
|
+
if (!pairSameData(old[key], next[key], pairs))
|
|
2702
|
+
return false;
|
|
2703
|
+
}
|
|
2704
|
+
return true;
|
|
1394
2705
|
};
|
|
1395
2706
|
/**
|
|
1396
|
-
*
|
|
1397
|
-
*
|
|
1398
|
-
*
|
|
1399
|
-
*
|
|
1400
|
-
*
|
|
1401
|
-
|
|
1402
|
-
|
|
2707
|
+
* `value` with every paired object replaced by its partner; a container nothing
|
|
2708
|
+
* inside of moved is returned as is. `fresh` holds the objects the new program
|
|
2709
|
+
* has where the old one held a different object: a remembered answer that
|
|
2710
|
+
* reaches one is holding something a pass wrote into the program after the
|
|
2711
|
+
* solve, which a solve of the new program would not share with it.
|
|
2712
|
+
*/
|
|
2713
|
+
const repointed = (value, pairs, seen, fresh) => {
|
|
2714
|
+
if (typeof value !== 'object' || value === null)
|
|
2715
|
+
return value;
|
|
2716
|
+
const partner = pairs.get(value);
|
|
2717
|
+
if (partner !== undefined)
|
|
2718
|
+
return partner;
|
|
2719
|
+
if (fresh.objects.has(value))
|
|
2720
|
+
fresh.reached = true;
|
|
2721
|
+
if (seen.has(value))
|
|
2722
|
+
return seen.get(value);
|
|
2723
|
+
seen.set(value, value);
|
|
2724
|
+
let result = value;
|
|
2725
|
+
if (Array.isArray(value)) {
|
|
2726
|
+
const items = value.map((item) => repointed(item, pairs, seen, fresh));
|
|
2727
|
+
if (items.some((item, index) => item !== value[index]))
|
|
2728
|
+
result = items;
|
|
2729
|
+
}
|
|
2730
|
+
else if (value instanceof Map) {
|
|
2731
|
+
const entries = [...value].map(([key, item]) => [repointed(key, pairs, seen, fresh), repointed(item, pairs, seen, fresh)]);
|
|
2732
|
+
if ([...value].some(([key, item], index) => entries[index][0] !== key || entries[index][1] !== item))
|
|
2733
|
+
result = new Map(entries);
|
|
2734
|
+
}
|
|
2735
|
+
else if (value instanceof Set) {
|
|
2736
|
+
const items = [...value].map((item) => repointed(item, pairs, seen, fresh));
|
|
2737
|
+
if ([...value].some((item, index) => items[index] !== item))
|
|
2738
|
+
result = new Set(items);
|
|
2739
|
+
}
|
|
2740
|
+
else {
|
|
2741
|
+
const prototype = Object.getPrototypeOf(value);
|
|
2742
|
+
if (prototype === Object.prototype || prototype === null) {
|
|
2743
|
+
let copy = null;
|
|
2744
|
+
for (const key of Object.keys(value)) {
|
|
2745
|
+
const item = value[key];
|
|
2746
|
+
const moved = repointed(item, pairs, seen, fresh);
|
|
2747
|
+
if (moved !== item)
|
|
2748
|
+
(copy ??= { ...value })[key] = moved;
|
|
2749
|
+
}
|
|
2750
|
+
if (copy !== null)
|
|
2751
|
+
result = copy;
|
|
2752
|
+
}
|
|
2753
|
+
}
|
|
2754
|
+
seen.set(value, result);
|
|
2755
|
+
return result;
|
|
2756
|
+
};
|
|
2757
|
+
/**
|
|
2758
|
+
* A remembered answer re-pointed from the program it was solved over to a
|
|
2759
|
+
* same-data copy of it, or null when it cannot stand for a solve of the copy.
|
|
2760
|
+
*/
|
|
2761
|
+
const flowOverCopy = (flow, pairs) => {
|
|
2762
|
+
const seen = new Map();
|
|
2763
|
+
const fresh = { objects: new Set(pairs.values()), reached: false };
|
|
2764
|
+
const { nativeFieldViewAbsentRoutesOf: absentRoutesOf, callables, ...data } = flow;
|
|
2765
|
+
const moved = repointed(data, pairs, seen, fresh);
|
|
2766
|
+
// A solve allocates each callee identity afresh, and the dispatch passes then
|
|
2767
|
+
// write those very objects into the program, so they are copied rather than
|
|
2768
|
+
// re-pointed: handed back as they are, the reused answer would share them
|
|
2769
|
+
// with the bodies where a solve's never does.
|
|
2770
|
+
const callees = new Map([...callables].map(([value, callee]) => [value, repointed({ ...callee }, pairs, seen, fresh)]));
|
|
2771
|
+
if (fresh.reached)
|
|
2772
|
+
return null;
|
|
2773
|
+
const answer = { ...moved, callables: callees };
|
|
2774
|
+
if (absentRoutesOf === undefined)
|
|
2775
|
+
return answer;
|
|
2776
|
+
return {
|
|
2777
|
+
...answer,
|
|
2778
|
+
nativeFieldViewAbsentRoutesOf: (receiver, key) => repointed(absentRoutesOf(receiver, key), pairs, new Map(), { objects: new Set(), reached: false })
|
|
2779
|
+
};
|
|
2780
|
+
};
|
|
2781
|
+
/**
|
|
2782
|
+
* The flow's answer is a function of its inputs' data -- the conversion census
|
|
2783
|
+
* it consults is append-only and `nodeFor` is idempotent per pair -- so a
|
|
2784
|
+
* recent answer per class map is reused when every input is the same. The
|
|
2785
|
+
* same objects reuse it directly. The publish passes between two solves
|
|
2786
|
+
* rebuild every body and operation even when they change nothing, so an input
|
|
2787
|
+
* that is the same DATA reuses the answer re-pointed at the new objects, since
|
|
2788
|
+
* its consumers look operations up by identity. On a large program that
|
|
2789
|
+
* replaces about a third of the solves, each checked against a fresh solve of
|
|
2790
|
+
* the same program: equal data, and the same program objects. The rest
|
|
2791
|
+
* differ in what the flow reads (`logicalReceiver`, `closedCallable`,
|
|
2792
|
+
* `presence`, recipe lists). A traced run reports reads as it solves and is
|
|
2793
|
+
* always solved.
|
|
1403
2794
|
*/
|
|
1404
2795
|
const rememberedFlows = new WeakMap();
|
|
2796
|
+
/** Callers alternate between asking with and without program conversions, so one remembered answer per class map was always the other kind. */
|
|
2797
|
+
const REMEMBERED_FLOWS = 3;
|
|
1405
2798
|
export const nativeCallableFlowOf = (...args) => {
|
|
1406
|
-
const [bodies, placements, classes, conversions, trace, deriver] = args;
|
|
2799
|
+
const [bodies, placements, classes, conversions, trace, deriver, programConversions, constructionTopology] = args;
|
|
1407
2800
|
if (trace !== undefined)
|
|
1408
2801
|
return computeNativeCallableFlow(...args);
|
|
1409
|
-
|
|
1410
|
-
if (held
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
2802
|
+
let held = rememberedFlows.get(classes);
|
|
2803
|
+
if (held === undefined)
|
|
2804
|
+
rememberedFlows.set(classes, (held = []));
|
|
2805
|
+
const entries = held;
|
|
2806
|
+
const remember = (flow, replaced) => {
|
|
2807
|
+
if (replaced !== -1)
|
|
2808
|
+
entries.splice(replaced, 1);
|
|
2809
|
+
entries.unshift({
|
|
2810
|
+
bodies,
|
|
2811
|
+
placements,
|
|
2812
|
+
conversions,
|
|
2813
|
+
deriver: deriver ?? null,
|
|
2814
|
+
programConversions: programConversions ?? null,
|
|
2815
|
+
constructionTopology: constructionTopology ?? null,
|
|
2816
|
+
flow
|
|
2817
|
+
});
|
|
2818
|
+
entries.length = Math.min(entries.length, REMEMBERED_FLOWS);
|
|
2819
|
+
return flow;
|
|
2820
|
+
};
|
|
2821
|
+
const sameContext = (entry) => entry.placements === placements && entry.conversions === conversions && entry.deriver === (deriver ?? null);
|
|
2822
|
+
for (const entry of entries)
|
|
2823
|
+
if (sameContext(entry) &&
|
|
2824
|
+
entry.programConversions === (programConversions ?? null) &&
|
|
2825
|
+
entry.constructionTopology === (constructionTopology ?? null) &&
|
|
2826
|
+
entry.bodies.length === bodies.length &&
|
|
2827
|
+
entry.bodies.every((body, index) => body === bodies[index]))
|
|
2828
|
+
return entry.flow;
|
|
2829
|
+
for (let index = 0; index < entries.length; index++) {
|
|
2830
|
+
const entry = entries[index];
|
|
2831
|
+
if (!sameContext(entry) ||
|
|
2832
|
+
entry.bodies.length !== bodies.length ||
|
|
2833
|
+
(entry.programConversions === null) !== (programConversions === undefined) ||
|
|
2834
|
+
(entry.constructionTopology === null) !== (constructionTopology === undefined))
|
|
2835
|
+
continue;
|
|
2836
|
+
const pairs = new Map();
|
|
2837
|
+
if (!pairSameData(entry.bodies, bodies, pairs) ||
|
|
2838
|
+
!pairSameData(entry.programConversions, programConversions ?? null, pairs) ||
|
|
2839
|
+
!pairSameData(entry.constructionTopology, constructionTopology ?? null, pairs))
|
|
2840
|
+
continue;
|
|
2841
|
+
const reused = flowOverCopy(entry.flow, pairs);
|
|
2842
|
+
if (reused === null)
|
|
2843
|
+
continue;
|
|
2844
|
+
return remember(reused, index);
|
|
2845
|
+
}
|
|
1417
2846
|
const flow = computeNativeCallableFlow(...args);
|
|
1418
|
-
|
|
1419
|
-
return flow;
|
|
2847
|
+
return remember(flow, -1);
|
|
1420
2848
|
};
|
|
1421
2849
|
/** Compatibility view of the same execution/escape census; no second analysis policy. */
|
|
1422
2850
|
export const closedClassFieldCallablesOf = (...args) => nativeCallableFlowOf(...args).callables;
|