@geastack/compiler 1.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +149 -0
- package/dist/cli-analyze.d.ts +1 -0
- package/dist/cli-analyze.js +61 -0
- package/dist/cli-coverage.d.ts +1 -0
- package/dist/cli-coverage.js +329 -0
- package/dist/cli-emit.d.ts +10 -0
- package/dist/cli-emit.js +398 -0
- package/dist/cli-module-graph.d.ts +18 -0
- package/dist/cli-module-graph.js +123 -0
- package/dist/cli-package-source.d.ts +5 -0
- package/dist/cli-package-source.js +116 -0
- package/dist/cli-project.d.ts +2 -0
- package/dist/cli-project.js +60 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +199 -0
- package/dist/compiler.d.ts +228 -0
- package/dist/compiler.js +1029 -0
- package/dist/conversion/algebra.d.ts +218 -0
- package/dist/conversion/algebra.js +155 -0
- package/dist/conversion/build.d.ts +67 -0
- package/dist/conversion/build.js +1378 -0
- package/dist/conversion/derive.d.ts +37 -0
- package/dist/conversion/derive.js +260 -0
- package/dist/conversion/graph-validation.d.ts +8 -0
- package/dist/conversion/graph-validation.js +97 -0
- package/dist/conversion/native-callable-adapter.d.ts +13 -0
- package/dist/conversion/native-callable-adapter.js +53 -0
- package/dist/conversion/native-class-reference.d.ts +12 -0
- package/dist/conversion/native-class-reference.js +39 -0
- package/dist/conversion/native-payload-transport.d.ts +25 -0
- package/dist/conversion/native-payload-transport.js +33 -0
- package/dist/conversion/native-selection.d.ts +49 -0
- package/dist/conversion/native-selection.js +135 -0
- package/dist/conversion/native-sum.d.ts +42 -0
- package/dist/conversion/native-sum.js +115 -0
- package/dist/conversion/nodes.d.ts +55 -0
- package/dist/conversion/nodes.js +91 -0
- package/dist/conversion/operand-view.d.ts +14 -0
- package/dist/conversion/operand-view.js +20 -0
- package/dist/conversion/record-view.d.ts +157 -0
- package/dist/conversion/record-view.js +273 -0
- package/dist/conversion/registry.d.ts +217 -0
- package/dist/conversion/registry.js +1 -0
- package/dist/diagnostics/model.d.ts +76 -0
- package/dist/diagnostics/model.js +60 -0
- package/dist/diagnostics/sweep.d.ts +31 -0
- package/dist/diagnostics/sweep.js +112 -0
- package/dist/identity/ids.d.ts +179 -0
- package/dist/identity/ids.js +212 -0
- package/dist/ir/absent-class-arm.d.ts +48 -0
- package/dist/ir/absent-class-arm.js +157 -0
- package/dist/ir/borrow-effects.d.ts +23 -0
- package/dist/ir/borrow-effects.js +151 -0
- package/dist/ir/borrowed-call-arguments.d.ts +40 -0
- package/dist/ir/borrowed-call-arguments.js +117 -0
- package/dist/ir/build.d.ts +168 -0
- package/dist/ir/build.js +459 -0
- package/dist/ir/call-dispatch.d.ts +38 -0
- package/dist/ir/call-dispatch.js +502 -0
- package/dist/ir/call-entry.d.ts +142 -0
- package/dist/ir/call-entry.js +386 -0
- package/dist/ir/callable-class-flow.d.ts +27 -0
- package/dist/ir/callable-class-flow.js +1386 -0
- package/dist/ir/callable-field-slots.d.ts +22 -0
- package/dist/ir/callable-field-slots.js +166 -0
- package/dist/ir/callable-identity-demand.d.ts +52 -0
- package/dist/ir/callable-identity-demand.js +460 -0
- package/dist/ir/callable-member-candidates.d.ts +9 -0
- package/dist/ir/callable-member-candidates.js +39 -0
- package/dist/ir/callable-records.d.ts +21 -0
- package/dist/ir/callable-records.js +411 -0
- package/dist/ir/captures.d.ts +26 -0
- package/dist/ir/captures.js +335 -0
- package/dist/ir/certificate.d.ts +45 -0
- package/dist/ir/certificate.js +47 -0
- package/dist/ir/certify/carrier-keys.d.ts +73 -0
- package/dist/ir/certify/carrier-keys.js +221 -0
- package/dist/ir/certify/function-source.d.ts +4 -0
- package/dist/ir/certify/function-source.js +28 -0
- package/dist/ir/certify/has-property-key.d.ts +88 -0
- package/dist/ir/certify/has-property-key.js +116 -0
- package/dist/ir/certify/instanceof-key.d.ts +24 -0
- package/dist/ir/certify/instanceof-key.js +35 -0
- package/dist/ir/certify/property-access-keys.d.ts +172 -0
- package/dist/ir/certify/property-access-keys.js +291 -0
- package/dist/ir/certify/property-access.d.ts +3 -0
- package/dist/ir/certify/property-access.js +597 -0
- package/dist/ir/certify/runtime-helper.d.ts +3 -0
- package/dist/ir/certify/runtime-helper.js +326 -0
- package/dist/ir/certify/typeof-operand.d.ts +14 -0
- package/dist/ir/certify/typeof-operand.js +16 -0
- package/dist/ir/certify.d.ts +123 -0
- package/dist/ir/certify.js +481 -0
- package/dist/ir/class-evaluation.d.ts +26 -0
- package/dist/ir/class-evaluation.js +50 -0
- package/dist/ir/class-static-fields.d.ts +60 -0
- package/dist/ir/class-static-fields.js +108 -0
- package/dist/ir/construct-entry.d.ts +26 -0
- package/dist/ir/construct-entry.js +117 -0
- package/dist/ir/dead-values.d.ts +90 -0
- package/dist/ir/dead-values.js +184 -0
- package/dist/ir/deferral.d.ts +99 -0
- package/dist/ir/deferral.js +409 -0
- package/dist/ir/dense-loops.d.ts +230 -0
- package/dist/ir/dense-loops.js +697 -0
- package/dist/ir/dominance.d.ts +82 -0
- package/dist/ir/dominance.js +268 -0
- package/dist/ir/emission-representations.d.ts +71 -0
- package/dist/ir/emission-representations.js +350 -0
- package/dist/ir/facts.d.ts +218 -0
- package/dist/ir/facts.js +181 -0
- package/dist/ir/fixed-data-definition.d.ts +19 -0
- package/dist/ir/fixed-data-definition.js +49 -0
- package/dist/ir/generator-split.d.ts +38 -0
- package/dist/ir/generator-split.js +329 -0
- package/dist/ir/hoist.d.ts +55 -0
- package/dist/ir/hoist.js +375 -0
- package/dist/ir/instantiation.d.ts +61 -0
- package/dist/ir/instantiation.js +137 -0
- package/dist/ir/integer-storage.d.ts +170 -0
- package/dist/ir/integer-storage.js +822 -0
- package/dist/ir/integers.d.ts +161 -0
- package/dist/ir/integers.js +539 -0
- package/dist/ir/integrity-restrictions.d.ts +50 -0
- package/dist/ir/integrity-restrictions.js +118 -0
- package/dist/ir/local-iterators.d.ts +4 -0
- package/dist/ir/local-iterators.js +27 -0
- package/dist/ir/lower-allocation.d.ts +4 -0
- package/dist/ir/lower-allocation.js +325 -0
- package/dist/ir/lower-completion.d.ts +15 -0
- package/dist/ir/lower-completion.js +25 -0
- package/dist/ir/lower-destructuring.d.ts +5 -0
- package/dist/ir/lower-destructuring.js +693 -0
- package/dist/ir/lower-element.d.ts +29 -0
- package/dist/ir/lower-element.js +111 -0
- package/dist/ir/lower-exceptions.d.ts +47 -0
- package/dist/ir/lower-exceptions.js +92 -0
- package/dist/ir/lower-flow.d.ts +137 -0
- package/dist/ir/lower-flow.js +600 -0
- package/dist/ir/lower-graph.d.ts +218 -0
- package/dist/ir/lower-graph.js +687 -0
- package/dist/ir/lower-invocation.d.ts +4 -0
- package/dist/ir/lower-invocation.js +514 -0
- package/dist/ir/lower-narrow.d.ts +53 -0
- package/dist/ir/lower-narrow.js +320 -0
- package/dist/ir/lower-operands.d.ts +272 -0
- package/dist/ir/lower-operands.js +461 -0
- package/dist/ir/lower-property.d.ts +21 -0
- package/dist/ir/lower-property.js +132 -0
- package/dist/ir/lower-protocol.d.ts +11 -0
- package/dist/ir/lower-protocol.js +118 -0
- package/dist/ir/lower-short-circuit.d.ts +41 -0
- package/dist/ir/lower-short-circuit.js +63 -0
- package/dist/ir/lower.d.ts +82 -0
- package/dist/ir/lower.js +1346 -0
- package/dist/ir/model.d.ts +1474 -0
- package/dist/ir/model.js +6 -0
- package/dist/ir/native-absent-property.d.ts +3 -0
- package/dist/ir/native-absent-property.js +13 -0
- package/dist/ir/native-array-transport.d.ts +7 -0
- package/dist/ir/native-array-transport.js +46 -0
- package/dist/ir/native-callable-bind.d.ts +9 -0
- package/dist/ir/native-callable-bind.js +30 -0
- package/dist/ir/native-carrier-predicate.d.ts +34 -0
- package/dist/ir/native-carrier-predicate.js +49 -0
- package/dist/ir/native-class-accessor.d.ts +18 -0
- package/dist/ir/native-class-accessor.js +52 -0
- package/dist/ir/native-class-construction.d.ts +16 -0
- package/dist/ir/native-class-construction.js +71 -0
- package/dist/ir/native-class-initialization.d.ts +15 -0
- package/dist/ir/native-class-initialization.js +56 -0
- package/dist/ir/native-class-origins.d.ts +13 -0
- package/dist/ir/native-class-origins.js +237 -0
- package/dist/ir/native-dictionary-transport.d.ts +6 -0
- package/dist/ir/native-dictionary-transport.js +37 -0
- package/dist/ir/native-enumeration.d.ts +14 -0
- package/dist/ir/native-enumeration.js +26 -0
- package/dist/ir/native-equality.d.ts +10 -0
- package/dist/ir/native-equality.js +18 -0
- package/dist/ir/native-field-owner.d.ts +37 -0
- package/dist/ir/native-field-owner.js +183 -0
- package/dist/ir/native-fixed-layout.d.ts +41 -0
- package/dist/ir/native-fixed-layout.js +232 -0
- package/dist/ir/native-host-construction.d.ts +53 -0
- package/dist/ir/native-host-construction.js +62 -0
- package/dist/ir/native-key-query.d.ts +4 -0
- package/dist/ir/native-key-query.js +38 -0
- package/dist/ir/native-merge-transport.d.ts +25 -0
- package/dist/ir/native-merge-transport.js +71 -0
- package/dist/ir/native-record-index-transport.d.ts +11 -0
- package/dist/ir/native-record-index-transport.js +34 -0
- package/dist/ir/native-record-index.d.ts +12 -0
- package/dist/ir/native-record-index.js +27 -0
- package/dist/ir/native-reflect-field.d.ts +5 -0
- package/dist/ir/native-reflect-field.js +33 -0
- package/dist/ir/native-sequence-transport.d.ts +7 -0
- package/dist/ir/native-sequence-transport.js +53 -0
- package/dist/ir/numeric-intrinsics.d.ts +13 -0
- package/dist/ir/numeric-intrinsics.js +57 -0
- package/dist/ir/object-value-conversions.d.ts +20 -0
- package/dist/ir/object-value-conversions.js +50 -0
- package/dist/ir/physical-class-reflection.d.ts +9 -0
- package/dist/ir/physical-class-reflection.js +57 -0
- package/dist/ir/presence-proof.d.ts +42 -0
- package/dist/ir/presence-proof.js +490 -0
- package/dist/ir/program-facts.d.ts +106 -0
- package/dist/ir/program-facts.js +319 -0
- package/dist/ir/proven-branches.d.ts +16 -0
- package/dist/ir/proven-branches.js +219 -0
- package/dist/ir/queries.d.ts +41 -0
- package/dist/ir/queries.js +213 -0
- package/dist/ir/reflection-demand.d.ts +64 -0
- package/dist/ir/reflection-demand.js +1394 -0
- package/dist/ir/refusal.d.ts +43 -0
- package/dist/ir/refusal.js +28 -0
- package/dist/ir/shake.d.ts +37 -0
- package/dist/ir/shake.js +1078 -0
- package/dist/ir/static-callables.d.ts +11 -0
- package/dist/ir/static-callables.js +163 -0
- package/dist/ir/string-layout-reuse.d.ts +13 -0
- package/dist/ir/string-layout-reuse.js +39 -0
- package/dist/ir/string-length-reuse.d.ts +8 -0
- package/dist/ir/string-length-reuse.js +47 -0
- package/dist/ir/transfer.d.ts +78 -0
- package/dist/ir/transfer.js +270 -0
- package/dist/ir/type-query-results.d.ts +25 -0
- package/dist/ir/type-query-results.js +96 -0
- package/dist/ir/typed-property-access.d.ts +100 -0
- package/dist/ir/typed-property-access.js +161 -0
- package/dist/ir/verify.d.ts +19 -0
- package/dist/ir/verify.js +355 -0
- package/dist/plugins/apple/constructors.d.ts +112 -0
- package/dist/plugins/apple/constructors.js +217 -0
- package/dist/plugins/apple/host.d.ts +181 -0
- package/dist/plugins/apple/host.js +262 -0
- package/dist/plugins/apple/jsx.d.ts +2 -0
- package/dist/plugins/apple/jsx.js +293 -0
- package/dist/plugins/apple/members.d.ts +16 -0
- package/dist/plugins/apple/members.js +190 -0
- package/dist/plugins/apple/plugin.d.ts +2 -0
- package/dist/plugins/apple/plugin.js +156 -0
- package/dist/plugins/gea/component-classes.d.ts +25 -0
- package/dist/plugins/gea/component-classes.js +162 -0
- package/dist/plugins/gea/component-inline.d.ts +13 -0
- package/dist/plugins/gea/component-inline.js +532 -0
- package/dist/plugins/gea/constructors.d.ts +23 -0
- package/dist/plugins/gea/constructors.js +100 -0
- package/dist/plugins/gea/contract.d.ts +150 -0
- package/dist/plugins/gea/contract.js +195 -0
- package/dist/plugins/gea/element-ref.d.ts +31 -0
- package/dist/plugins/gea/element-ref.js +45 -0
- package/dist/plugins/gea/host.d.ts +520 -0
- package/dist/plugins/gea/host.js +762 -0
- package/dist/plugins/gea/lower.d.ts +6 -0
- package/dist/plugins/gea/lower.js +195 -0
- package/dist/plugins/gea/members.d.ts +22 -0
- package/dist/plugins/gea/members.js +221 -0
- package/dist/plugins/gea/plugin.d.ts +22 -0
- package/dist/plugins/gea/plugin.js +307 -0
- package/dist/plugins/gea/prelude.d.ts +78 -0
- package/dist/plugins/gea/prelude.js +153 -0
- package/dist/plugins/gea/producer.d.ts +5 -0
- package/dist/plugins/gea/producer.js +52 -0
- package/dist/plugins/gea/reactive-slots.d.ts +49 -0
- package/dist/plugins/gea/reactive-slots.js +578 -0
- package/dist/plugins/gea/render-bridge.d.ts +6 -0
- package/dist/plugins/gea/render-bridge.js +281 -0
- package/dist/plugins/gea/slots.d.ts +15 -0
- package/dist/plugins/gea/slots.js +36 -0
- package/dist/plugins/gea/template-analysis.d.ts +151 -0
- package/dist/plugins/gea/template-analysis.js +346 -0
- package/dist/plugins/gea/user-agent-styles.d.ts +9 -0
- package/dist/plugins/gea/user-agent-styles.js +94 -0
- package/dist/plugins/installed.d.ts +19 -0
- package/dist/plugins/installed.js +21 -0
- package/dist/plugins/load.d.ts +7 -0
- package/dist/plugins/load.js +207 -0
- package/dist/plugins/model.d.ts +735 -0
- package/dist/plugins/model.js +47 -0
- package/dist/plugins/webgl/host.d.ts +77 -0
- package/dist/plugins/webgl/host.js +162 -0
- package/dist/plugins/webgl/plugin.d.ts +40 -0
- package/dist/plugins/webgl/plugin.js +99 -0
- package/dist/preflight/obligations.d.ts +206 -0
- package/dist/preflight/obligations.js +36 -0
- package/dist/preflight/report.d.ts +20 -0
- package/dist/preflight/report.js +61 -0
- package/dist/preflight/run.d.ts +39 -0
- package/dist/preflight/run.js +403 -0
- package/dist/project-preparation.d.ts +33 -0
- package/dist/project-preparation.js +314 -0
- package/dist/projection/abi.d.ts +82 -0
- package/dist/projection/abi.js +349 -0
- package/dist/projection/apply-arguments.d.ts +12 -0
- package/dist/projection/apply-arguments.js +20 -0
- package/dist/projection/bindings.d.ts +250 -0
- package/dist/projection/bindings.js +340 -0
- package/dist/projection/callee.d.ts +196 -0
- package/dist/projection/callee.js +444 -0
- package/dist/projection/class-property-presence.d.ts +28 -0
- package/dist/projection/class-property-presence.js +58 -0
- package/dist/projection/class-prototype.d.ts +5 -0
- package/dist/projection/class-prototype.js +23 -0
- package/dist/projection/class-storage.d.ts +26 -0
- package/dist/projection/class-storage.js +236 -0
- package/dist/projection/classes.d.ts +283 -0
- package/dist/projection/classes.js +944 -0
- package/dist/projection/coercions.d.ts +20 -0
- package/dist/projection/coercions.js +33 -0
- package/dist/projection/dispatch.d.ts +167 -0
- package/dist/projection/dispatch.js +379 -0
- package/dist/projection/fields.d.ts +123 -0
- package/dist/projection/fields.js +383 -0
- package/dist/projection/instance-test.d.ts +78 -0
- package/dist/projection/instance-test.js +156 -0
- package/dist/projection/slots.d.ts +146 -0
- package/dist/projection/slots.js +663 -0
- package/dist/projection/synthesized-abi.d.ts +61 -0
- package/dist/projection/synthesized-abi.js +94 -0
- package/dist/representation/array-index.d.ts +14 -0
- package/dist/representation/array-index.js +17 -0
- package/dist/representation/callable-object.d.ts +3 -0
- package/dist/representation/callable-object.js +6 -0
- package/dist/representation/collections.d.ts +84 -0
- package/dist/representation/collections.js +139 -0
- package/dist/representation/derive.d.ts +159 -0
- package/dist/representation/derive.js +2546 -0
- package/dist/representation/difference.d.ts +30 -0
- package/dist/representation/difference.js +240 -0
- package/dist/representation/field-descriptor-policy.d.ts +19 -0
- package/dist/representation/field-descriptor-policy.js +39 -0
- package/dist/representation/function-constructor.d.ts +13 -0
- package/dist/representation/function-constructor.js +9 -0
- package/dist/representation/host-abi.d.ts +32 -0
- package/dist/representation/host-abi.js +97 -0
- package/dist/representation/host-templates.d.ts +67 -0
- package/dist/representation/host-templates.js +94 -0
- package/dist/representation/intersection.d.ts +84 -0
- package/dist/representation/intersection.js +149 -0
- package/dist/representation/literal-destination.d.ts +43 -0
- package/dist/representation/literal-destination.js +133 -0
- package/dist/representation/merge.d.ts +18 -0
- package/dist/representation/merge.js +83 -0
- package/dist/representation/model.d.ts +1160 -0
- package/dist/representation/model.js +1019 -0
- package/dist/representation/numeric-index.d.ts +13 -0
- package/dist/representation/numeric-index.js +29 -0
- package/dist/representation/object-shape.d.ts +109 -0
- package/dist/representation/object-shape.js +123 -0
- package/dist/representation/optional.d.ts +12 -0
- package/dist/representation/optional.js +87 -0
- package/dist/representation/plan.d.ts +60 -0
- package/dist/representation/plan.js +78 -0
- package/dist/representation/policies.d.ts +589 -0
- package/dist/representation/policies.js +107 -0
- package/dist/representation/primitive-domain.d.ts +1 -0
- package/dist/representation/primitive-domain.js +1 -0
- package/dist/representation/primitives.d.ts +44 -0
- package/dist/representation/primitives.js +78 -0
- package/dist/representation/publish.d.ts +49 -0
- package/dist/representation/publish.js +648 -0
- package/dist/representation/record-fields.d.ts +96 -0
- package/dist/representation/record-fields.js +116 -0
- package/dist/representation/template-object.d.ts +11 -0
- package/dist/representation/template-object.js +26 -0
- package/dist/representation/union.d.ts +30 -0
- package/dist/representation/union.js +324 -0
- package/dist/representation/value-records.d.ts +3 -0
- package/dist/representation/value-records.js +307 -0
- package/dist/representation/verify.d.ts +17 -0
- package/dist/representation/verify.js +221 -0
- package/dist/semantics/alias-this-field-declaration-transform.d.ts +4 -0
- package/dist/semantics/alias-this-field-declaration-transform.js +207 -0
- package/dist/semantics/ambient-type-realization-transform.d.ts +62 -0
- package/dist/semantics/ambient-type-realization-transform.js +168 -0
- package/dist/semantics/ambient.d.ts +24 -0
- package/dist/semantics/ambient.js +119 -0
- package/dist/semantics/borrowed-builtin-call-bind-source-transform.d.ts +4 -0
- package/dist/semantics/borrowed-builtin-call-bind-source-transform.js +341 -0
- package/dist/semantics/callable-origins.d.ts +46 -0
- package/dist/semantics/callable-origins.js +354 -0
- package/dist/semantics/class-alias.d.ts +7 -0
- package/dist/semantics/class-alias.js +37 -0
- package/dist/semantics/class-heritage.d.ts +34 -0
- package/dist/semantics/class-heritage.js +104 -0
- package/dist/semantics/commonjs-wrapper.d.ts +69 -0
- package/dist/semantics/commonjs-wrapper.js +231 -0
- package/dist/semantics/constructor-slot-subclasses.d.ts +28 -0
- package/dist/semantics/constructor-slot-subclasses.js +112 -0
- package/dist/semantics/declaration-overlay-transform.d.ts +35 -0
- package/dist/semantics/declaration-overlay-transform.js +2157 -0
- package/dist/semantics/define-property-source-transform.d.ts +4 -0
- package/dist/semantics/define-property-source-transform.js +437 -0
- package/dist/semantics/diagnostic-source-preparation.d.ts +24 -0
- package/dist/semantics/diagnostic-source-preparation.js +82 -0
- package/dist/semantics/documentation-ranges.d.ts +22 -0
- package/dist/semantics/documentation-ranges.js +36 -0
- package/dist/semantics/dynamic-fallback.d.ts +86 -0
- package/dist/semantics/dynamic-fallback.js +249 -0
- package/dist/semantics/frontend-timing.d.ts +6 -0
- package/dist/semantics/frontend-timing.js +35 -0
- package/dist/semantics/frontend.d.ts +504 -0
- package/dist/semantics/frontend.js +1157 -0
- package/dist/semantics/host-declaration-provenance.d.ts +11 -0
- package/dist/semantics/host-declaration-provenance.js +18 -0
- package/dist/semantics/host-methods.d.ts +24 -0
- package/dist/semantics/host-methods.js +74 -0
- package/dist/semantics/host-protocols.d.ts +429 -0
- package/dist/semantics/host-protocols.js +1501 -0
- package/dist/semantics/inherited-accessor.d.ts +7 -0
- package/dist/semantics/inherited-accessor.js +48 -0
- package/dist/semantics/interface-families.d.ts +70 -0
- package/dist/semantics/interface-families.js +180 -0
- package/dist/semantics/interface-implementors.d.ts +53 -0
- package/dist/semantics/interface-implementors.js +87 -0
- package/dist/semantics/jsdoc-namepath-transform.d.ts +4 -0
- package/dist/semantics/jsdoc-namepath-transform.js +85 -0
- package/dist/semantics/model/coverage.d.ts +68 -0
- package/dist/semantics/model/coverage.js +73 -0
- package/dist/semantics/model/edges.d.ts +103 -0
- package/dist/semantics/model/edges.js +20 -0
- package/dist/semantics/model/graph.d.ts +55 -0
- package/dist/semantics/model/graph.js +129 -0
- package/dist/semantics/model/operands.d.ts +159 -0
- package/dist/semantics/model/operands.js +26 -0
- package/dist/semantics/model/operations.d.ts +496 -0
- package/dist/semantics/model/operations.js +2 -0
- package/dist/semantics/model/primitive-domain.d.ts +26 -0
- package/dist/semantics/model/primitive-domain.js +38 -0
- package/dist/semantics/model/selected-signature.d.ts +261 -0
- package/dist/semantics/model/selected-signature.js +55 -0
- package/dist/semantics/model/structural-type-table.d.ts +93 -0
- package/dist/semantics/model/structural-type-table.js +237 -0
- package/dist/semantics/model/structural-types.d.ts +367 -0
- package/dist/semantics/model/structural-types.js +200 -0
- package/dist/semantics/module-resolution.d.ts +23 -0
- package/dist/semantics/module-resolution.js +227 -0
- package/dist/semantics/new-callee-class-tag-source-transform.d.ts +4 -0
- package/dist/semantics/new-callee-class-tag-source-transform.js +64 -0
- package/dist/semantics/node-project.d.ts +13 -0
- package/dist/semantics/node-project.js +107 -0
- package/dist/semantics/node-source-hooks.d.ts +1 -0
- package/dist/semantics/node-source-hooks.js +63 -0
- package/dist/semantics/normalize/absent-globals.d.ts +143 -0
- package/dist/semantics/normalize/absent-globals.js +191 -0
- package/dist/semantics/normalize/arguments-objects.d.ts +43 -0
- package/dist/semantics/normalize/arguments-objects.js +60 -0
- package/dist/semantics/normalize/asserted-arm-absence.d.ts +28 -0
- package/dist/semantics/normalize/asserted-arm-absence.js +61 -0
- package/dist/semantics/normalize/assignment-patterns.d.ts +70 -0
- package/dist/semantics/normalize/assignment-patterns.js +147 -0
- package/dist/semantics/normalize/bag-absence.d.ts +8 -0
- package/dist/semantics/normalize/bag-absence.js +42 -0
- package/dist/semantics/normalize/binding-fixpoint.d.ts +36 -0
- package/dist/semantics/normalize/binding-fixpoint.js +140 -0
- package/dist/semantics/normalize/callback-parameter-contracts.d.ts +16 -0
- package/dist/semantics/normalize/callback-parameter-contracts.js +91 -0
- package/dist/semantics/normalize/cells/agreement.d.ts +46 -0
- package/dist/semantics/normalize/cells/agreement.js +34 -0
- package/dist/semantics/normalize/cells/candidates.d.ts +17 -0
- package/dist/semantics/normalize/cells/candidates.js +35 -0
- package/dist/semantics/normalize/cells/facts.d.ts +19 -0
- package/dist/semantics/normalize/cells/facts.js +90 -0
- package/dist/semantics/normalize/cells/index.d.ts +10 -0
- package/dist/semantics/normalize/cells/index.js +6 -0
- package/dist/semantics/normalize/cells/model.d.ts +98 -0
- package/dist/semantics/normalize/cells/model.js +2 -0
- package/dist/semantics/normalize/cells/policies/bag.d.ts +44 -0
- package/dist/semantics/normalize/cells/policies/bag.js +114 -0
- package/dist/semantics/normalize/cells/policies/collection.d.ts +42 -0
- package/dist/semantics/normalize/cells/policies/collection.js +218 -0
- package/dist/semantics/normalize/cells/policies/field.d.ts +28 -0
- package/dist/semantics/normalize/cells/policies/field.js +40 -0
- package/dist/semantics/normalize/cells/policies/index.d.ts +49 -0
- package/dist/semantics/normalize/cells/policies/index.js +58 -0
- package/dist/semantics/normalize/cells/policies/local.d.ts +18 -0
- package/dist/semantics/normalize/cells/policies/local.js +37 -0
- package/dist/semantics/normalize/cells/policies/parameter.d.ts +28 -0
- package/dist/semantics/normalize/cells/policies/parameter.js +39 -0
- package/dist/semantics/normalize/cells/policies/return.d.ts +26 -0
- package/dist/semantics/normalize/cells/policies/return.js +45 -0
- package/dist/semantics/normalize/cells/policies/shared.d.ts +33 -0
- package/dist/semantics/normalize/cells/policies/shared.js +45 -0
- package/dist/semantics/normalize/cells/policy.d.ts +72 -0
- package/dist/semantics/normalize/cells/policy.js +18 -0
- package/dist/semantics/normalize/cells/registry.d.ts +14 -0
- package/dist/semantics/normalize/cells/registry.js +17 -0
- package/dist/semantics/normalize/census-refusal.d.ts +62 -0
- package/dist/semantics/normalize/census-refusal.js +27 -0
- package/dist/semantics/normalize/census.d.ts +109 -0
- package/dist/semantics/normalize/census.js +667 -0
- package/dist/semantics/normalize/collection-bindings.d.ts +278 -0
- package/dist/semantics/normalize/collection-bindings.js +677 -0
- package/dist/semantics/normalize/commonjs-module-record.d.ts +21 -0
- package/dist/semantics/normalize/commonjs-module-record.js +289 -0
- package/dist/semantics/normalize/commonjs-require.d.ts +13 -0
- package/dist/semantics/normalize/commonjs-require.js +1527 -0
- package/dist/semantics/normalize/contribution.d.ts +63 -0
- package/dist/semantics/normalize/contribution.js +172 -0
- package/dist/semantics/normalize/dead-typeof-guards.d.ts +64 -0
- package/dist/semantics/normalize/dead-typeof-guards.js +152 -0
- package/dist/semantics/normalize/deferred-intrinsic-protocols.d.ts +57 -0
- package/dist/semantics/normalize/deferred-intrinsic-protocols.js +109 -0
- package/dist/semantics/normalize/derived-expression-type.d.ts +1070 -0
- package/dist/semantics/normalize/derived-expression-type.js +3463 -0
- package/dist/semantics/normalize/evaluation-order.d.ts +16 -0
- package/dist/semantics/normalize/evaluation-order.js +37 -0
- package/dist/semantics/normalize/field-bindings.d.ts +167 -0
- package/dist/semantics/normalize/field-bindings.js +1125 -0
- package/dist/semantics/normalize/flow/array-element-continuation.d.ts +27 -0
- package/dist/semantics/normalize/flow/array-element-continuation.js +1452 -0
- package/dist/semantics/normalize/flow/callable-array-origins.d.ts +42 -0
- package/dist/semantics/normalize/flow/callable-array-origins.js +318 -0
- package/dist/semantics/normalize/flow/callable-completions.d.ts +45 -0
- package/dist/semantics/normalize/flow/callable-completions.js +82 -0
- package/dist/semantics/normalize/flow/callable-reach.d.ts +237 -0
- package/dist/semantics/normalize/flow/callable-reach.js +7174 -0
- package/dist/semantics/normalize/flow/class-family-member-read.d.ts +16 -0
- package/dist/semantics/normalize/flow/class-family-member-read.js +992 -0
- package/dist/semantics/normalize/flow/collection-value-continuation.d.ts +21 -0
- package/dist/semantics/normalize/flow/collection-value-continuation.js +192 -0
- package/dist/semantics/normalize/flow/component-solver.d.ts +199 -0
- package/dist/semantics/normalize/flow/component-solver.js +587 -0
- package/dist/semantics/normalize/flow/computed-key-set.d.ts +84 -0
- package/dist/semantics/normalize/flow/computed-key-set.js +660 -0
- package/dist/semantics/normalize/flow/export-importers.d.ts +24 -0
- package/dist/semantics/normalize/flow/export-importers.js +269 -0
- package/dist/semantics/normalize/flow/host-text-sink.d.ts +25 -0
- package/dist/semantics/normalize/flow/host-text-sink.js +87 -0
- package/dist/semantics/normalize/flow/intrinsic-array-callback-frames.d.ts +84 -0
- package/dist/semantics/normalize/flow/intrinsic-array-callback-frames.js +180 -0
- package/dist/semantics/normalize/flow/intrinsic-data-definition.d.ts +35 -0
- package/dist/semantics/normalize/flow/intrinsic-data-definition.js +140 -0
- package/dist/semantics/normalize/flow/invocation-facts.d.ts +98 -0
- package/dist/semantics/normalize/flow/invocation-facts.js +257 -0
- package/dist/semantics/normalize/flow/member-call-forwarding.d.ts +122 -0
- package/dist/semantics/normalize/flow/member-call-forwarding.js +835 -0
- package/dist/semantics/normalize/flow/model.d.ts +357 -0
- package/dist/semantics/normalize/flow/model.js +177 -0
- package/dist/semantics/normalize/flow/native-collection-protocol.d.ts +24 -0
- package/dist/semantics/normalize/flow/native-collection-protocol.js +252 -0
- package/dist/semantics/normalize/flow/node-path-token.d.ts +3 -0
- package/dist/semantics/normalize/flow/node-path-token.js +53 -0
- package/dist/semantics/normalize/flow/object-binding-continuation.d.ts +11 -0
- package/dist/semantics/normalize/flow/object-binding-continuation.js +42 -0
- package/dist/semantics/normalize/flow/origin-authority.d.ts +56 -0
- package/dist/semantics/normalize/flow/origin-authority.js +2 -0
- package/dist/semantics/normalize/flow/owned-class-receivers.d.ts +35 -0
- package/dist/semantics/normalize/flow/owned-class-receivers.js +191 -0
- package/dist/semantics/normalize/flow/parameter-values.d.ts +27 -0
- package/dist/semantics/normalize/flow/parameter-values.js +251 -0
- package/dist/semantics/normalize/flow/proof-hypotheses.d.ts +66 -0
- package/dist/semantics/normalize/flow/proof-hypotheses.js +162 -0
- package/dist/semantics/normalize/flow/record-alias-closure.d.ts +27 -0
- package/dist/semantics/normalize/flow/record-alias-closure.js +298 -0
- package/dist/semantics/normalize/flow/seeded-origins.d.ts +43 -0
- package/dist/semantics/normalize/flow/seeded-origins.js +54 -0
- package/dist/semantics/normalize/flow/source-class-data.d.ts +132 -0
- package/dist/semantics/normalize/flow/source-class-data.js +838 -0
- package/dist/semantics/normalize/flow/source-class-instanceof.d.ts +13 -0
- package/dist/semantics/normalize/flow/source-class-instanceof.js +37 -0
- package/dist/semantics/normalize/flow/source-class-static-data.d.ts +16 -0
- package/dist/semantics/normalize/flow/source-class-static-data.js +47 -0
- package/dist/semantics/normalize/flow/source-construction-frames.d.ts +12 -0
- package/dist/semantics/normalize/flow/source-construction-frames.js +118 -0
- package/dist/semantics/normalize/flow/source-invocation-frame-layout.d.ts +34 -0
- package/dist/semantics/normalize/flow/source-invocation-frame-layout.js +78 -0
- package/dist/semantics/normalize/flow/source-invocation-receiver.d.ts +37 -0
- package/dist/semantics/normalize/flow/source-invocation-receiver.js +95 -0
- package/dist/semantics/normalize/flow/source-prototype-method-identity.d.ts +23 -0
- package/dist/semantics/normalize/flow/source-prototype-method-identity.js +81 -0
- package/dist/semantics/normalize/flow/source-record-data.d.ts +29 -0
- package/dist/semantics/normalize/flow/source-record-data.js +626 -0
- package/dist/semantics/normalize/flow/source-value-session.d.ts +77 -0
- package/dist/semantics/normalize/flow/source-value-session.js +3089 -0
- package/dist/semantics/normalize/flow/targets.d.ts +118 -0
- package/dist/semantics/normalize/flow/targets.js +405 -0
- package/dist/semantics/normalize/flow/value-flow.d.ts +36 -0
- package/dist/semantics/normalize/flow/value-flow.js +823 -0
- package/dist/semantics/normalize/flow/value-provenance.d.ts +31 -0
- package/dist/semantics/normalize/flow/value-provenance.js +112 -0
- package/dist/semantics/normalize/gating.d.ts +51 -0
- package/dist/semantics/normalize/gating.js +560 -0
- package/dist/semantics/normalize/generic-function-choice.d.ts +31 -0
- package/dist/semantics/normalize/generic-function-choice.js +115 -0
- package/dist/semantics/normalize/global-host-mutations.d.ts +51 -0
- package/dist/semantics/normalize/global-host-mutations.js +5989 -0
- package/dist/semantics/normalize/host-effect-contracts.d.ts +77 -0
- package/dist/semantics/normalize/host-effect-contracts.js +143 -0
- package/dist/semantics/normalize/host-mutation-computed-keys.d.ts +38 -0
- package/dist/semantics/normalize/host-mutation-computed-keys.js +26 -0
- package/dist/semantics/normalize/host-mutation-key-reader.d.ts +66 -0
- package/dist/semantics/normalize/host-mutation-key-reader.js +192 -0
- package/dist/semantics/normalize/host-mutation-keys.d.ts +114 -0
- package/dist/semantics/normalize/host-mutation-keys.js +183 -0
- package/dist/semantics/normalize/identities.d.ts +172 -0
- package/dist/semantics/normalize/identities.js +426 -0
- package/dist/semantics/normalize/implicit-arguments-tuple.d.ts +97 -0
- package/dist/semantics/normalize/implicit-arguments-tuple.js +197 -0
- package/dist/semantics/normalize/implicit-arguments.d.ts +11 -0
- package/dist/semantics/normalize/implicit-arguments.js +39 -0
- package/dist/semantics/normalize/instantiation.d.ts +73 -0
- package/dist/semantics/normalize/instantiation.js +399 -0
- package/dist/semantics/normalize/intrinsic-property-call.d.ts +18 -0
- package/dist/semantics/normalize/intrinsic-property-call.js +69 -0
- package/dist/semantics/normalize/intrinsic-prototype.d.ts +41 -0
- package/dist/semantics/normalize/intrinsic-prototype.js +87 -0
- package/dist/semantics/normalize/intrinsic-static-member.d.ts +14 -0
- package/dist/semantics/normalize/intrinsic-static-member.js +23 -0
- package/dist/semantics/normalize/jsdoc-type-names.d.ts +32 -0
- package/dist/semantics/normalize/jsdoc-type-names.js +512 -0
- package/dist/semantics/normalize/keyof.d.ts +32 -0
- package/dist/semantics/normalize/keyof.js +110 -0
- package/dist/semantics/normalize/local-bindings.d.ts +176 -0
- package/dist/semantics/normalize/local-bindings.js +1826 -0
- package/dist/semantics/normalize/logical-result-type.d.ts +16 -0
- package/dist/semantics/normalize/logical-result-type.js +102 -0
- package/dist/semantics/normalize/namespace-paths.d.ts +57 -0
- package/dist/semantics/normalize/namespace-paths.js +108 -0
- package/dist/semantics/normalize/normalize.d.ts +57 -0
- package/dist/semantics/normalize/normalize.js +68 -0
- package/dist/semantics/normalize/object-bag-bindings.d.ts +305 -0
- package/dist/semantics/normalize/object-bag-bindings.js +1290 -0
- package/dist/semantics/normalize/omitted-stated-parameter.d.ts +53 -0
- package/dist/semantics/normalize/omitted-stated-parameter.js +59 -0
- package/dist/semantics/normalize/open-type-form.d.ts +10 -0
- package/dist/semantics/normalize/open-type-form.js +32 -0
- package/dist/semantics/normalize/parameter-bindings.d.ts +361 -0
- package/dist/semantics/normalize/parameter-bindings.js +3339 -0
- package/dist/semantics/normalize/parameter-slot.d.ts +264 -0
- package/dist/semantics/normalize/parameter-slot.js +491 -0
- package/dist/semantics/normalize/physical-overload-result.d.ts +77 -0
- package/dist/semantics/normalize/physical-overload-result.js +99 -0
- package/dist/semantics/normalize/primitive-property-absence.d.ts +12 -0
- package/dist/semantics/normalize/primitive-property-absence.js +60 -0
- package/dist/semantics/normalize/producer-context.d.ts +376 -0
- package/dist/semantics/normalize/producer-context.js +1 -0
- package/dist/semantics/normalize/producers/allocations.d.ts +3 -0
- package/dist/semantics/normalize/producers/allocations.js +863 -0
- package/dist/semantics/normalize/producers/binding-kind.d.ts +37 -0
- package/dist/semantics/normalize/producers/binding-kind.js +36 -0
- package/dist/semantics/normalize/producers/bindings.d.ts +85 -0
- package/dist/semantics/normalize/producers/bindings.js +710 -0
- package/dist/semantics/normalize/producers/boundary.d.ts +34 -0
- package/dist/semantics/normalize/producers/boundary.js +123 -0
- package/dist/semantics/normalize/producers/class-lifecycle.d.ts +3 -0
- package/dist/semantics/normalize/producers/class-lifecycle.js +902 -0
- package/dist/semantics/normalize/producers/computations.d.ts +3 -0
- package/dist/semantics/normalize/producers/computations.js +613 -0
- package/dist/semantics/normalize/producers/control-loops.d.ts +30 -0
- package/dist/semantics/normalize/producers/control-loops.js +91 -0
- package/dist/semantics/normalize/producers/control.d.ts +30 -0
- package/dist/semantics/normalize/producers/control.js +923 -0
- package/dist/semantics/normalize/producers/declaration-lifecycle.d.ts +3 -0
- package/dist/semantics/normalize/producers/declaration-lifecycle.js +390 -0
- package/dist/semantics/normalize/producers/destructuring.d.ts +45 -0
- package/dist/semantics/normalize/producers/destructuring.js +1180 -0
- package/dist/semantics/normalize/producers/dynamic-language.d.ts +3 -0
- package/dist/semantics/normalize/producers/dynamic-language.js +70 -0
- package/dist/semantics/normalize/producers/erasure.d.ts +51 -0
- package/dist/semantics/normalize/producers/erasure.js +90 -0
- package/dist/semantics/normalize/producers/installed.d.ts +3 -0
- package/dist/semantics/normalize/producers/installed.js +55 -0
- package/dist/semantics/normalize/producers/invocations.d.ts +35 -0
- package/dist/semantics/normalize/producers/invocations.js +1796 -0
- package/dist/semantics/normalize/producers/iteration-yield.d.ts +59 -0
- package/dist/semantics/normalize/producers/iteration-yield.js +235 -0
- package/dist/semantics/normalize/producers/jsx.d.ts +3 -0
- package/dist/semantics/normalize/producers/jsx.js +360 -0
- package/dist/semantics/normalize/producers/mint.d.ts +39 -0
- package/dist/semantics/normalize/producers/mint.js +44 -0
- package/dist/semantics/normalize/producers/nullish.d.ts +16 -0
- package/dist/semantics/normalize/producers/nullish.js +27 -0
- package/dist/semantics/normalize/producers/object-assignment.d.ts +8 -0
- package/dist/semantics/normalize/producers/object-assignment.js +204 -0
- package/dist/semantics/normalize/producers/object-tag.d.ts +9 -0
- package/dist/semantics/normalize/producers/object-tag.js +119 -0
- package/dist/semantics/normalize/producers/optional-chain.d.ts +44 -0
- package/dist/semantics/normalize/producers/optional-chain.js +75 -0
- package/dist/semantics/normalize/producers/properties.d.ts +21 -0
- package/dist/semantics/normalize/producers/properties.js +1053 -0
- package/dist/semantics/normalize/producers/protocol.d.ts +67 -0
- package/dist/semantics/normalize/producers/protocol.js +695 -0
- package/dist/semantics/normalize/producers/references.d.ts +53 -0
- package/dist/semantics/normalize/producers/references.js +1027 -0
- package/dist/semantics/normalize/producers/shared.d.ts +561 -0
- package/dist/semantics/normalize/producers/shared.js +1683 -0
- package/dist/semantics/normalize/producers/spread-arguments.d.ts +72 -0
- package/dist/semantics/normalize/producers/spread-arguments.js +375 -0
- package/dist/semantics/normalize/producers/tagged-template.d.ts +5 -0
- package/dist/semantics/normalize/producers/tagged-template.js +307 -0
- package/dist/semantics/normalize/producers/tuple-spread.d.ts +189 -0
- package/dist/semantics/normalize/producers/tuple-spread.js +279 -0
- package/dist/semantics/normalize/property-key-domain.d.ts +36 -0
- package/dist/semantics/normalize/property-key-domain.js +150 -0
- package/dist/semantics/normalize/reachability.d.ts +189 -0
- package/dist/semantics/normalize/reachability.js +1057 -0
- package/dist/semantics/normalize/reassigned-bindings.d.ts +13 -0
- package/dist/semantics/normalize/reassigned-bindings.js +41 -0
- package/dist/semantics/normalize/record-storage-families.d.ts +11 -0
- package/dist/semantics/normalize/record-storage-families.js +109 -0
- package/dist/semantics/normalize/return-bindings.d.ts +260 -0
- package/dist/semantics/normalize/return-bindings.js +1311 -0
- package/dist/semantics/normalize/return-paths.d.ts +2 -0
- package/dist/semantics/normalize/return-paths.js +28 -0
- package/dist/semantics/normalize/script-global-redefinition.d.ts +44 -0
- package/dist/semantics/normalize/script-global-redefinition.js +75 -0
- package/dist/semantics/normalize/specialization.d.ts +201 -0
- package/dist/semantics/normalize/specialization.js +1824 -0
- package/dist/semantics/normalize/structural-array-element.d.ts +176 -0
- package/dist/semantics/normalize/structural-array-element.js +700 -0
- package/dist/semantics/normalize/structural-array-read.d.ts +13 -0
- package/dist/semantics/normalize/structural-array-read.js +124 -0
- package/dist/semantics/normalize/structural-callable.d.ts +12 -0
- package/dist/semantics/normalize/structural-callable.js +82 -0
- package/dist/semantics/normalize/structural-creation-order.d.ts +32 -0
- package/dist/semantics/normalize/structural-creation-order.js +111 -0
- package/dist/semantics/normalize/structural-declarations.d.ts +395 -0
- package/dist/semantics/normalize/structural-declarations.js +968 -0
- package/dist/semantics/normalize/structural-declared-body.d.ts +25 -0
- package/dist/semantics/normalize/structural-declared-body.js +147 -0
- package/dist/semantics/normalize/structural-generics.d.ts +56 -0
- package/dist/semantics/normalize/structural-generics.js +120 -0
- package/dist/semantics/normalize/structural-indexed-access.d.ts +11 -0
- package/dist/semantics/normalize/structural-indexed-access.js +126 -0
- package/dist/semantics/normalize/structural-instantiated-member.d.ts +64 -0
- package/dist/semantics/normalize/structural-instantiated-member.js +407 -0
- package/dist/semantics/normalize/structural-joins.d.ts +44 -0
- package/dist/semantics/normalize/structural-joins.js +143 -0
- package/dist/semantics/normalize/structural-layout-relevance.d.ts +29 -0
- package/dist/semantics/normalize/structural-layout-relevance.js +391 -0
- package/dist/semantics/normalize/structural-layout-type.d.ts +11 -0
- package/dist/semantics/normalize/structural-layout-type.js +1468 -0
- package/dist/semantics/normalize/structural-leaves.d.ts +49 -0
- package/dist/semantics/normalize/structural-leaves.js +125 -0
- package/dist/semantics/normalize/structural-local-union.d.ts +13 -0
- package/dist/semantics/normalize/structural-local-union.js +133 -0
- package/dist/semantics/normalize/structural-members.d.ts +26 -0
- package/dist/semantics/normalize/structural-members.js +84 -0
- package/dist/semantics/normalize/structural-mutable-method.d.ts +15 -0
- package/dist/semantics/normalize/structural-mutable-method.js +109 -0
- package/dist/semantics/normalize/structural-parts.d.ts +131 -0
- package/dist/semantics/normalize/structural-parts.js +737 -0
- package/dist/semantics/normalize/structural-receiver.d.ts +66 -0
- package/dist/semantics/normalize/structural-receiver.js +551 -0
- package/dist/semantics/normalize/structural-rules.d.ts +112 -0
- package/dist/semantics/normalize/structural-rules.js +93 -0
- package/dist/semantics/normalize/structural-self-reference.d.ts +150 -0
- package/dist/semantics/normalize/structural-self-reference.js +494 -0
- package/dist/semantics/normalize/structural.d.ts +202 -0
- package/dist/semantics/normalize/structural.js +4218 -0
- package/dist/semantics/normalize/unreduced-type-form.d.ts +41 -0
- package/dist/semantics/normalize/unreduced-type-form.js +53 -0
- package/dist/semantics/normalize/unresolvable-names.d.ts +56 -0
- package/dist/semantics/normalize/unresolvable-names.js +140 -0
- package/dist/semantics/package-sources.d.ts +16 -0
- package/dist/semantics/package-sources.js +365 -0
- package/dist/semantics/program.d.ts +151 -0
- package/dist/semantics/program.js +667 -0
- package/dist/semantics/prototype-install-source-transform.d.ts +4 -0
- package/dist/semantics/prototype-install-source-transform.js +341 -0
- package/dist/semantics/prototype-object-class-source-transform.d.ts +4 -0
- package/dist/semantics/prototype-object-class-source-transform.js +525 -0
- package/dist/semantics/prototype-reparenting.d.ts +50 -0
- package/dist/semantics/prototype-reparenting.js +317 -0
- package/dist/semantics/stable-checker.d.ts +10 -0
- package/dist/semantics/stable-checker.js +148 -0
- package/dist/semantics/subclass-member-overlay-transform.d.ts +35 -0
- package/dist/semantics/subclass-member-overlay-transform.js +1418 -0
- package/dist/semantics/symbol-keyed-expando-source-transform.d.ts +4 -0
- package/dist/semantics/symbol-keyed-expando-source-transform.js +66 -0
- package/dist/semantics/this-constructor-source-transform.d.ts +4 -0
- package/dist/semantics/this-constructor-source-transform.js +122 -0
- package/dist/semantics/uninstantiable-classes.d.ts +22 -0
- package/dist/semantics/uninstantiable-classes.js +75 -0
- package/dist/targets/cpp/balanced-units.d.ts +3 -0
- package/dist/targets/cpp/balanced-units.js +58 -0
- package/dist/targets/cpp/borrowed-call-entry.d.ts +30 -0
- package/dist/targets/cpp/borrowed-call-entry.js +68 -0
- package/dist/targets/cpp/captures.d.ts +68 -0
- package/dist/targets/cpp/captures.js +269 -0
- package/dist/targets/cpp/class-layout.d.ts +313 -0
- package/dist/targets/cpp/class-layout.js +483 -0
- package/dist/targets/cpp/class-properties/computed-method-value.d.ts +25 -0
- package/dist/targets/cpp/class-properties/computed-method-value.js +22 -0
- package/dist/targets/cpp/class-properties/emit-class-properties.d.ts +216 -0
- package/dist/targets/cpp/class-properties/emit-class-properties.js +917 -0
- package/dist/targets/cpp/class-properties/native-prototype.d.ts +11 -0
- package/dist/targets/cpp/class-properties/native-prototype.js +101 -0
- package/dist/targets/cpp/class-ref-transport.d.ts +12 -0
- package/dist/targets/cpp/class-ref-transport.js +32 -0
- package/dist/targets/cpp/conversions.d.ts +3 -0
- package/dist/targets/cpp/conversions.js +2027 -0
- package/dist/targets/cpp/deferral-safety.d.ts +82 -0
- package/dist/targets/cpp/deferral-safety.js +86 -0
- package/dist/targets/cpp/direct-call-receivers.d.ts +37 -0
- package/dist/targets/cpp/direct-call-receivers.js +79 -0
- package/dist/targets/cpp/document.d.ts +74 -0
- package/dist/targets/cpp/document.js +106 -0
- package/dist/targets/cpp/emit-allocation.d.ts +60 -0
- package/dist/targets/cpp/emit-allocation.js +573 -0
- package/dist/targets/cpp/emit-arrays.d.ts +119 -0
- package/dist/targets/cpp/emit-arrays.js +1047 -0
- package/dist/targets/cpp/emit-binding-reference.d.ts +17 -0
- package/dist/targets/cpp/emit-binding-reference.js +120 -0
- package/dist/targets/cpp/emit-bindings.d.ts +158 -0
- package/dist/targets/cpp/emit-bindings.js +769 -0
- package/dist/targets/cpp/emit-buffers.d.ts +156 -0
- package/dist/targets/cpp/emit-buffers.js +573 -0
- package/dist/targets/cpp/emit-callable.d.ts +230 -0
- package/dist/targets/cpp/emit-callable.js +2154 -0
- package/dist/targets/cpp/emit-carrier-members.d.ts +406 -0
- package/dist/targets/cpp/emit-carrier-members.js +1224 -0
- package/dist/targets/cpp/emit-coercion.d.ts +26 -0
- package/dist/targets/cpp/emit-coercion.js +39 -0
- package/dist/targets/cpp/emit-context.d.ts +1882 -0
- package/dist/targets/cpp/emit-context.js +904 -0
- package/dist/targets/cpp/emit-dynamic-properties.d.ts +174 -0
- package/dist/targets/cpp/emit-dynamic-properties.js +1249 -0
- package/dist/targets/cpp/emit-equality.d.ts +39 -0
- package/dist/targets/cpp/emit-equality.js +472 -0
- package/dist/targets/cpp/emit-exceptions.d.ts +104 -0
- package/dist/targets/cpp/emit-exceptions.js +513 -0
- package/dist/targets/cpp/emit-field-owner.d.ts +4 -0
- package/dist/targets/cpp/emit-field-owner.js +27 -0
- package/dist/targets/cpp/emit-in.d.ts +31 -0
- package/dist/targets/cpp/emit-in.js +426 -0
- package/dist/targets/cpp/emit-instanceof.d.ts +19 -0
- package/dist/targets/cpp/emit-instanceof.js +601 -0
- package/dist/targets/cpp/emit-integers.d.ts +68 -0
- package/dist/targets/cpp/emit-integers.js +184 -0
- package/dist/targets/cpp/emit-iterator.d.ts +100 -0
- package/dist/targets/cpp/emit-iterator.js +1137 -0
- package/dist/targets/cpp/emit-json.d.ts +73 -0
- package/dist/targets/cpp/emit-json.js +823 -0
- package/dist/targets/cpp/emit-jsx.d.ts +74 -0
- package/dist/targets/cpp/emit-jsx.js +806 -0
- package/dist/targets/cpp/emit-mixed-binary.d.ts +51 -0
- package/dist/targets/cpp/emit-mixed-binary.js +60 -0
- package/dist/targets/cpp/emit-namespaces.d.ts +101 -0
- package/dist/targets/cpp/emit-namespaces.js +133 -0
- package/dist/targets/cpp/emit-narrowing.d.ts +738 -0
- package/dist/targets/cpp/emit-narrowing.js +3967 -0
- package/dist/targets/cpp/emit-native-equality.d.ts +3 -0
- package/dist/targets/cpp/emit-native-equality.js +14 -0
- package/dist/targets/cpp/emit-native-selection.d.ts +5 -0
- package/dist/targets/cpp/emit-native-selection.js +37 -0
- package/dist/targets/cpp/emit-object-tag.d.ts +4 -0
- package/dist/targets/cpp/emit-object-tag.js +108 -0
- package/dist/targets/cpp/emit-owned-record.d.ts +2 -0
- package/dist/targets/cpp/emit-owned-record.js +15 -0
- package/dist/targets/cpp/emit-presence.d.ts +78 -0
- package/dist/targets/cpp/emit-presence.js +376 -0
- package/dist/targets/cpp/emit-properties.d.ts +105 -0
- package/dist/targets/cpp/emit-properties.js +1640 -0
- package/dist/targets/cpp/emit-record-view.d.ts +20 -0
- package/dist/targets/cpp/emit-record-view.js +354 -0
- package/dist/targets/cpp/emit-return.d.ts +5 -0
- package/dist/targets/cpp/emit-return.js +237 -0
- package/dist/targets/cpp/emit-sum-widening.d.ts +10 -0
- package/dist/targets/cpp/emit-sum-widening.js +69 -0
- package/dist/targets/cpp/emit-tonumber.d.ts +38 -0
- package/dist/targets/cpp/emit-tonumber.js +177 -0
- package/dist/targets/cpp/emit-tostring.d.ts +92 -0
- package/dist/targets/cpp/emit-tostring.js +556 -0
- package/dist/targets/cpp/emit-typeof.d.ts +49 -0
- package/dist/targets/cpp/emit-typeof.js +317 -0
- package/dist/targets/cpp/emit-union-properties.d.ts +181 -0
- package/dist/targets/cpp/emit-union-properties.js +1281 -0
- package/dist/targets/cpp/emit.d.ts +45 -0
- package/dist/targets/cpp/emit.js +2225 -0
- package/dist/targets/cpp/error-types.d.ts +4 -0
- package/dist/targets/cpp/error-types.js +11 -0
- package/dist/targets/cpp/function-source-reads.d.ts +72 -0
- package/dist/targets/cpp/function-source-reads.js +148 -0
- package/dist/targets/cpp/host/atomics.d.ts +25 -0
- package/dist/targets/cpp/host/atomics.js +63 -0
- package/dist/targets/cpp/host/core-globals.d.ts +108 -0
- package/dist/targets/cpp/host/core-globals.js +158 -0
- package/dist/targets/cpp/host/dynamic-argument-members.d.ts +42 -0
- package/dist/targets/cpp/host/dynamic-argument-members.js +61 -0
- package/dist/targets/cpp/host/emit-host-arity.d.ts +139 -0
- package/dist/targets/cpp/host/emit-host-arity.js +232 -0
- package/dist/targets/cpp/host/emit-host-invoke.d.ts +91 -0
- package/dist/targets/cpp/host/emit-host-invoke.js +1105 -0
- package/dist/targets/cpp/host/emit-host-object.d.ts +55 -0
- package/dist/targets/cpp/host/emit-host-object.js +2206 -0
- package/dist/targets/cpp/host/emit-host-properties.d.ts +69 -0
- package/dist/targets/cpp/host/emit-host-properties.js +533 -0
- package/dist/targets/cpp/host/emit-host-reflect.d.ts +4 -0
- package/dist/targets/cpp/host/emit-host-reflect.js +180 -0
- package/dist/targets/cpp/host/emit-host-value.d.ts +120 -0
- package/dist/targets/cpp/host/emit-host-value.js +392 -0
- package/dist/targets/cpp/host/host-members.d.ts +505 -0
- package/dist/targets/cpp/host/host-members.js +819 -0
- package/dist/targets/cpp/host/host-method-aliases.d.ts +30 -0
- package/dist/targets/cpp/host/host-method-aliases.js +76 -0
- package/dist/targets/cpp/host/native-protocols.d.ts +47 -0
- package/dist/targets/cpp/host/native-protocols.js +183 -0
- package/dist/targets/cpp/host/object-protocol.d.ts +351 -0
- package/dist/targets/cpp/host/object-protocol.js +671 -0
- package/dist/targets/cpp/host-namespace-reads.d.ts +83 -0
- package/dist/targets/cpp/host-namespace-reads.js +113 -0
- package/dist/targets/cpp/manifest/capabilities.d.ts +39 -0
- package/dist/targets/cpp/manifest/capabilities.js +1484 -0
- package/dist/targets/cpp/manifest.d.ts +23 -0
- package/dist/targets/cpp/manifest.js +113 -0
- package/dist/targets/cpp/native-error-base.d.ts +38 -0
- package/dist/targets/cpp/native-error-base.js +74 -0
- package/dist/targets/cpp/native-narrowing-transport.d.ts +12 -0
- package/dist/targets/cpp/native-narrowing-transport.js +151 -0
- package/dist/targets/cpp/native-selection-helpers.d.ts +11 -0
- package/dist/targets/cpp/native-selection-helpers.js +46 -0
- package/dist/targets/cpp/native-symbol-keys.d.ts +8 -0
- package/dist/targets/cpp/native-symbol-keys.js +34 -0
- package/dist/targets/cpp/ownership.d.ts +43 -0
- package/dist/targets/cpp/ownership.js +38 -0
- package/dist/targets/cpp/owning-conversion-input.d.ts +14 -0
- package/dist/targets/cpp/owning-conversion-input.js +12 -0
- package/dist/targets/cpp/property-read-claims.d.ts +62 -0
- package/dist/targets/cpp/property-read-claims.js +23 -0
- package/dist/targets/cpp/property-store-claims.d.ts +62 -0
- package/dist/targets/cpp/property-store-claims.js +26 -0
- package/dist/targets/cpp/prototype/emit-prototype-array.d.ts +111 -0
- package/dist/targets/cpp/prototype/emit-prototype-array.js +602 -0
- package/dist/targets/cpp/prototype/emit-prototype-date.d.ts +133 -0
- package/dist/targets/cpp/prototype/emit-prototype-date.js +515 -0
- package/dist/targets/cpp/prototype/emit-prototype-error.d.ts +13 -0
- package/dist/targets/cpp/prototype/emit-prototype-error.js +54 -0
- package/dist/targets/cpp/prototype/emit-prototype-invoke.d.ts +34 -0
- package/dist/targets/cpp/prototype/emit-prototype-invoke.js +1003 -0
- package/dist/targets/cpp/prototype/emit-prototype-iterator.d.ts +47 -0
- package/dist/targets/cpp/prototype/emit-prototype-iterator.js +250 -0
- package/dist/targets/cpp/prototype/emit-prototype-promise.d.ts +46 -0
- package/dist/targets/cpp/prototype/emit-prototype-promise.js +143 -0
- package/dist/targets/cpp/prototype/emit-prototype-regexp.d.ts +335 -0
- package/dist/targets/cpp/prototype/emit-prototype-regexp.js +853 -0
- package/dist/targets/cpp/prototype/emit-prototype-string.d.ts +42 -0
- package/dist/targets/cpp/prototype/emit-prototype-string.js +252 -0
- package/dist/targets/cpp/prototype/prototype-method-reads.d.ts +25 -0
- package/dist/targets/cpp/prototype/prototype-method-reads.js +182 -0
- package/dist/targets/cpp/reactive-dependencies.d.ts +140 -0
- package/dist/targets/cpp/reactive-dependencies.js +432 -0
- package/dist/targets/cpp/reactive-origins.d.ts +44 -0
- package/dist/targets/cpp/reactive-origins.js +82 -0
- package/dist/targets/cpp/records.d.ts +277 -0
- package/dist/targets/cpp/records.js +2427 -0
- package/dist/targets/cpp/recursive-containers.d.ts +43 -0
- package/dist/targets/cpp/recursive-containers.js +144 -0
- package/dist/targets/cpp/regexp-types.d.ts +56 -0
- package/dist/targets/cpp/regexp-types.js +59 -0
- package/dist/targets/cpp/substrate.d.ts +125 -0
- package/dist/targets/cpp/substrate.js +12 -0
- package/dist/targets/cpp/translation-unit.d.ts +219 -0
- package/dist/targets/cpp/translation-unit.js +2063 -0
- package/dist/targets/cpp/types.d.ts +280 -0
- package/dist/targets/cpp/types.js +1135 -0
- package/dist/targets/cpp/virtual-methods.d.ts +95 -0
- package/dist/targets/cpp/virtual-methods.js +264 -0
- package/package.json +95 -0
- package/src/targets/cpp/runtime/gea_dynamic_proxy.h +824 -0
- package/src/targets/cpp/runtime/gea_eval.h +1376 -0
- package/src/targets/cpp/runtime/gea_native_class_prototype.h +44 -0
- package/src/targets/cpp/runtime/gea_runtime.h +29222 -0
- package/src/targets/cpp/runtime/gea_runtime_builtins.cpp +55 -0
|
@@ -0,0 +1,1882 @@
|
|
|
1
|
+
import type { NativeSelectionHelper } from './native-selection-helpers.js';
|
|
2
|
+
import type { StableBorrowEntry } from './borrowed-call-entry.js';
|
|
3
|
+
import type { SharedStringLayout } from '../../ir/string-layout-reuse.js';
|
|
4
|
+
import type { CapabilityKey } from '../../ir/certify.js';
|
|
5
|
+
import type { DeclarationId, FunctionId, IrValueId, RegionId, SemanticResultId } from '../../identity/ids.js';
|
|
6
|
+
import type { BindingPlacement } from '../../projection/bindings.js';
|
|
7
|
+
import type { ClassLayout } from '../../projection/classes.js';
|
|
8
|
+
import type { RecordLayoutPolicy } from '../../representation/policies.js';
|
|
9
|
+
import type { CallOperation, ComputeOperation, GetOperation, IrBlockId, IrBody, IrNonTerminatorOperation, IrOperand, IrResult } from '../../ir/model.js';
|
|
10
|
+
import type { NumericIntrinsic } from '../../ir/numeric-intrinsics.js';
|
|
11
|
+
import type { DenseAccess, DenseArray, DenseGroup } from '../../ir/dense-loops.js';
|
|
12
|
+
import type { TypeQueryComparison } from '../../ir/type-query-results.js';
|
|
13
|
+
import type { ForwardedBinding } from '../../ir/deferral.js';
|
|
14
|
+
import { type InstantiationFacts } from '../../ir/instantiation.js';
|
|
15
|
+
import { type CallableIdentityDemand } from '../../ir/callable-identity-demand.js';
|
|
16
|
+
import type { HostCallSpelling, HostSpellings } from './host/host-members.js';
|
|
17
|
+
import type { CallableAbi, RecordField, Representation } from '../../representation/model.js';
|
|
18
|
+
import type { RepresentationDeriver } from '../../representation/derive.js';
|
|
19
|
+
import type { HostMethodAlias } from './host/host-method-aliases.js';
|
|
20
|
+
import type { PrinterDrift } from './emit-narrowing.js';
|
|
21
|
+
import { type ConversionCensus } from '../../conversion/nodes.js';
|
|
22
|
+
/**
|
|
23
|
+
* The per-body naming state every emitter helper reads, and the refusal shape
|
|
24
|
+
* they all raise.
|
|
25
|
+
*
|
|
26
|
+
* Split out of `emit.ts` so the property spine can live in its own file without
|
|
27
|
+
* either half owning the context the other needs. Nothing here decides what a
|
|
28
|
+
* construct means; it is the bookkeeping an emitter needs to name what it has
|
|
29
|
+
* already decided.
|
|
30
|
+
*/
|
|
31
|
+
/**
|
|
32
|
+
* Lowered IR bodies to C++ statement text, carried across the sealed
|
|
33
|
+
* emission boundary in `document.ts`.
|
|
34
|
+
*
|
|
35
|
+
* Every SSA value, binding cell, and block gets its name from exactly one
|
|
36
|
+
* counter and one map, walked in `body.blockOrder` order, so two calls over
|
|
37
|
+
* the same body produce byte-identical text. An operation kind this file does
|
|
38
|
+
* not lower throws rather than approximating -- a refused block is a stated
|
|
39
|
+
* gap; a wrong one that happens to compile is a miscompile with no signal.
|
|
40
|
+
*/
|
|
41
|
+
/**
|
|
42
|
+
* `src/targets/` forbids `class` (`scripts/architecture.mjs`), so this is a
|
|
43
|
+
* branded shape plus a factory and predicate instead of an `Error` subclass --
|
|
44
|
+
* the same shape `ir/lower-graph.ts`'s `IrLoweringBlockedError` plays for the
|
|
45
|
+
* IR layer, adapted to a plain object because this layer may not use a class
|
|
46
|
+
* to carry it.
|
|
47
|
+
*/
|
|
48
|
+
export interface CppEmitBlockedError extends Error {
|
|
49
|
+
readonly cppEmitBlocked: true;
|
|
50
|
+
/**
|
|
51
|
+
* The capability this refusal lacked, in `ir/certify.ts`'s one key
|
|
52
|
+
* namespace. Typed by that union rather than `string` so a renderer cannot
|
|
53
|
+
* refuse with a kind the certifier could never have demanded: a print-stage
|
|
54
|
+
* refusal of a certified program is then always attributable to a demand
|
|
55
|
+
* the certifier failed to raise (the certifier has already passed).
|
|
56
|
+
*/
|
|
57
|
+
readonly kind: CapabilityKey;
|
|
58
|
+
}
|
|
59
|
+
export declare const createCppEmitBlockedError: (kind: CapabilityKey, reason: string) => CppEmitBlockedError;
|
|
60
|
+
export declare const isCppEmitBlockedError: (error: unknown) => error is CppEmitBlockedError;
|
|
61
|
+
/**
|
|
62
|
+
* The standard `Symbol.<name>` identity encoded by a `sym(declaration)`
|
|
63
|
+
* property key, read straight off the key TEXT.
|
|
64
|
+
*
|
|
65
|
+
* A record field's key arrives as text and never as an operand
|
|
66
|
+
* (`derive.ts`'s `recordFieldKeyOf` mints it), so a reader that only has a
|
|
67
|
+
* layout cannot go through `wellKnownSymbolMemberOf` below. Both spellings of
|
|
68
|
+
* the question resolve against the one census the frontend published
|
|
69
|
+
* (`host-protocols.ts`'s `wellKnownSymbolDeclarationsOf`), which is what keeps
|
|
70
|
+
* "which declaration is `Symbol.match`" a single answer.
|
|
71
|
+
*/
|
|
72
|
+
export declare const wellKnownSymbolMemberOfKey: (wellKnownSymbols: ReadonlyMap<DeclarationId, string>, key: string) => string | null;
|
|
73
|
+
/** The standard `Symbol.<name>` identity encoded by a static `sym(declaration)` property key. */
|
|
74
|
+
export declare const wellKnownSymbolMemberOf: (ctx: EmitContext, operand: IrOperand) => string | null;
|
|
75
|
+
/**
|
|
76
|
+
* One value a closure carries from the frame that allocated it into the frame
|
|
77
|
+
* that runs it.
|
|
78
|
+
*
|
|
79
|
+
* `declaration` is the cell being transported, exactly as `binding-read` and
|
|
80
|
+
* `binding-write` already name it -- there is no second identity for "the same
|
|
81
|
+
* variable, but captured". `representation` is copied from the plan's own
|
|
82
|
+
* answer for that cell (`BindingPlacement.representation`) rather than
|
|
83
|
+
* re-derived, for the same reason every other emitter reads a carrier instead
|
|
84
|
+
* of guessing one.
|
|
85
|
+
*/
|
|
86
|
+
export interface CaptureSlot {
|
|
87
|
+
readonly declaration: DeclarationId;
|
|
88
|
+
readonly representation: Representation;
|
|
89
|
+
/**
|
|
90
|
+
* `true` when this slot's cell is shared by aliasing rather than by copying:
|
|
91
|
+
* the environment field holds a `std::shared_ptr` to a heap cell every
|
|
92
|
+
* frame that captures this declaration -- including the frame that owns
|
|
93
|
+
* it -- reads and writes through, instead of each frame's own independent
|
|
94
|
+
* copy of the value. `ir/captures.ts`'s `computeCaptureFacts` decides this
|
|
95
|
+
* once, whole-program, for exactly the cases an ordinary by-value copy
|
|
96
|
+
* gets wrong: a declaration reassigned somewhere after it is captured (a
|
|
97
|
+
* stale copy would stop seeing later writes), a declaration that holds the
|
|
98
|
+
* very closure capturing it (the copy would be taken before the cell is
|
|
99
|
+
* ever written), and a declaration captured before any owning write of it
|
|
100
|
+
* dominates the allocation. Published onto `IrBody.facts.boxed`, keyed by
|
|
101
|
+
* the OWNING body, and read back here by `captures.ts`'s `buildCaptureIndex`
|
|
102
|
+
* as one whole-program set. Every other capture stays a plain value copy,
|
|
103
|
+
* unchanged.
|
|
104
|
+
*/
|
|
105
|
+
readonly boxed: boolean;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* What one capturing function's environment is made of.
|
|
109
|
+
*
|
|
110
|
+
* `receiver` is kept apart from `slots` because it has no `DeclarationId` --
|
|
111
|
+
* `this` inside an arrow is not a binding cell, it is the enclosing method's
|
|
112
|
+
* own receiver read across the same frame boundary -- so it needs its own
|
|
113
|
+
* field rather than a synthesized declaration identity standing in for one.
|
|
114
|
+
*/
|
|
115
|
+
export interface CaptureLayout {
|
|
116
|
+
readonly slots: readonly CaptureSlot[];
|
|
117
|
+
readonly receiver: Representation | null;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Whether one capturing function's environment can be built at all.
|
|
121
|
+
*
|
|
122
|
+
* `refused` is not `none`: `none` is an ordinary function that closes over
|
|
123
|
+
* nothing, ok, `refused` is one that closes over something this backend has
|
|
124
|
+
* proof it cannot transport safely (an ownership it does not admit, or a cell
|
|
125
|
+
* it cannot prove is never written after the closure captures it) -- naming
|
|
126
|
+
* the reason here is what lets `emitAllocateCallable`/`emitAllocateConstructor`
|
|
127
|
+
* and `bindingReference` raise the *same* refusal instead of each guessing at
|
|
128
|
+
* why the other one gave up.
|
|
129
|
+
*
|
|
130
|
+
* @semanticCategory generic-primitive
|
|
131
|
+
*/
|
|
132
|
+
export type CaptureAdmission = {
|
|
133
|
+
readonly kind: 'none';
|
|
134
|
+
} | {
|
|
135
|
+
readonly kind: 'ok';
|
|
136
|
+
readonly layout: CaptureLayout;
|
|
137
|
+
} | {
|
|
138
|
+
readonly kind: 'refused';
|
|
139
|
+
readonly reason: string;
|
|
140
|
+
};
|
|
141
|
+
/** Every capturing function's environment, computed once for the whole program by `translation-unit.ts`. */
|
|
142
|
+
export interface CaptureIndex {
|
|
143
|
+
readonly of: (owner: FunctionId | RegionId) => CaptureAdmission;
|
|
144
|
+
/**
|
|
145
|
+
* Whether this declaration's cell is boxed -- the same whole-program fact
|
|
146
|
+
* `CaptureSlot.boxed` states for one capturing function's own slot, asked
|
|
147
|
+
* here for the frame that OWNS the cell instead. A local's own frame never
|
|
148
|
+
* consults `CaptureAdmission` for its own declarations (only a capturing
|
|
149
|
+
* frame does), so `bindingReference`'s owned-local branch needs this
|
|
150
|
+
* independent, declaration-keyed answer to know its plain `T b0;` must be a
|
|
151
|
+
* `std::shared_ptr<T>` instead -- the same box every capturing frame's
|
|
152
|
+
* environment field aliases.
|
|
153
|
+
*/
|
|
154
|
+
readonly isBoxed: (declaration: DeclarationId) => boolean;
|
|
155
|
+
/**
|
|
156
|
+
* Whether any closure in the program captures this declaration, boxed or by
|
|
157
|
+
* value. A by-value capture copies the cell when the closure is allocated,
|
|
158
|
+
* which is a read of the cell no `binding-read` operation in the owning body
|
|
159
|
+
* records -- the one fact that makes the owning body's own read count an
|
|
160
|
+
* incomplete answer to "who reads this cell" (`EmitContext.forwardedBindings`).
|
|
161
|
+
*/
|
|
162
|
+
readonly isCaptured: (declaration: DeclarationId) => boolean;
|
|
163
|
+
/**
|
|
164
|
+
* Whether the owning frame must allocate this boxed cell before its first
|
|
165
|
+
* rendered block. These are captured locals for which no individual write
|
|
166
|
+
* dominates the closure allocation: allocating at whichever branch happens
|
|
167
|
+
* to render first leaves the other branch dereferencing an empty handle.
|
|
168
|
+
*/
|
|
169
|
+
readonly requiresEarlyBox: (declaration: DeclarationId) => boolean;
|
|
170
|
+
/**
|
|
171
|
+
* Whether this body reads `this` -- in its own operations, or in a closure
|
|
172
|
+
* it allocates that has no receiver of its own and so reads this one.
|
|
173
|
+
*
|
|
174
|
+
* Read off `IrBodyFacts.readsReceiver`, closed over the allocation graph
|
|
175
|
+
* the same way captures themselves are (`ir/captures.ts`'s
|
|
176
|
+
* `computeCaptureFacts`). The one caller is `emit-callable.ts`, deciding
|
|
177
|
+
* whether a method read as a VALUE can be passed on: the language calls a
|
|
178
|
+
* detached method with no receiver, so a body that reads `this` must not be
|
|
179
|
+
* bound to the object it was read from.
|
|
180
|
+
*/
|
|
181
|
+
readonly readsReceiver: (owner: FunctionId | RegionId) => boolean;
|
|
182
|
+
}
|
|
183
|
+
/** The index a body with no capture information at all reads as: every owner closes over nothing. */
|
|
184
|
+
export declare const emptyCaptureIndex: CaptureIndex;
|
|
185
|
+
/**
|
|
186
|
+
* Per-body naming state.
|
|
187
|
+
*
|
|
188
|
+
* Three independent counters, not one shared counter split by prefix: a
|
|
189
|
+
* value, a binding cell, and a block are different namespaces in the target
|
|
190
|
+
* language (a local variable, a mutable slot, and a `goto` label never
|
|
191
|
+
* collide by construction), so giving them one counter would only make an
|
|
192
|
+
* accidental collision look like a naming bug instead of the impossible thing
|
|
193
|
+
* it actually is.
|
|
194
|
+
*/
|
|
195
|
+
/**
|
|
196
|
+
* Where an array's reserved capacity is read from at the allocation site.
|
|
197
|
+
*
|
|
198
|
+
* Two spellings because a loop bound arrives two ways. A plain SSA value is
|
|
199
|
+
* named by `operandText`. A value read out of a binding cell is NOT: the read
|
|
200
|
+
* the loop test uses happens inside the loop, and naming that SSA value at the
|
|
201
|
+
* allocation would name a variable the emitter has not defined yet. What is
|
|
202
|
+
* available there is the CELL, whose contents the census already proved the
|
|
203
|
+
* loop cannot change.
|
|
204
|
+
*/
|
|
205
|
+
/**
|
|
206
|
+
* One host member reached but not rendered: which member, on which receiver.
|
|
207
|
+
*
|
|
208
|
+
* The receiver is the OPERAND, not its spelling. A record that held
|
|
209
|
+
* `operandText(ctx, receiver)` was a rendered string, and a rendered string is
|
|
210
|
+
* not a fact -- it could only be produced while a body was being printed, which
|
|
211
|
+
* is what kept this whole channel a render-time write (docs/SINGLE-CENSUS-
|
|
212
|
+
* REFACTOR.md 2.3, invariant 5). Naming the operand instead says the same thing
|
|
213
|
+
* in the IR's own terms, and the consumer -- which is always the call that
|
|
214
|
+
* fills the host's template -- spells it there through
|
|
215
|
+
* `hostMemberReceiverText`.
|
|
216
|
+
*
|
|
217
|
+
* `null` is not "no receiver operand": it is a receiver that has no spelling at
|
|
218
|
+
* all, because it is a host CLASS object (`ctx.hostClassReads`) or a host
|
|
219
|
+
* namespace path. A template naming `{receiver}` for one of those is refused by
|
|
220
|
+
* `fillHostTemplate`, which is the fail-closed answer for a row written for the
|
|
221
|
+
* wrong position.
|
|
222
|
+
*/
|
|
223
|
+
/**
|
|
224
|
+
* The receiver of a deferred `String`/`Array`/`Date`/... prototype method read.
|
|
225
|
+
*
|
|
226
|
+
* The same split `HostMemberRead` makes, for the same reason: what the access
|
|
227
|
+
* knows is WHICH value the method was reached on, and that is an operand. The
|
|
228
|
+
* spelling is produced by `prototypeMethodReceiverText` at the call that fuses
|
|
229
|
+
* with it.
|
|
230
|
+
*
|
|
231
|
+
* `match-elements` is the one receiver that is not the operand's own text: a
|
|
232
|
+
* `RegExp` match result is reached through `gea::runtime::regex::matchElements`,
|
|
233
|
+
* a view over the receiver rather than the receiver. It travels as its own kind
|
|
234
|
+
* instead of as a pre-rendered string so the record stays a fact -- the view is
|
|
235
|
+
* named here, and built where every other receiver is built.
|
|
236
|
+
*
|
|
237
|
+
* `none` is a receiver with no spelling at all: a host intrinsic's own
|
|
238
|
+
* reflection method (`Math.hasOwnProperty`), whose renderer names the intrinsic
|
|
239
|
+
* outright and asks nothing of the value.
|
|
240
|
+
*/
|
|
241
|
+
export type PrototypeMethodReceiver = {
|
|
242
|
+
readonly kind: 'operand';
|
|
243
|
+
readonly operand: IrOperand;
|
|
244
|
+
} | {
|
|
245
|
+
readonly kind: 'match-elements';
|
|
246
|
+
readonly operand: IrOperand;
|
|
247
|
+
} | {
|
|
248
|
+
readonly kind: 'none';
|
|
249
|
+
};
|
|
250
|
+
/**
|
|
251
|
+
* The companion revision cell a value's origin ticks, as a FACT rather than as
|
|
252
|
+
* an lvalue.
|
|
253
|
+
*
|
|
254
|
+
* The same three fields `reactiveFieldReads` carries, and for the same reason:
|
|
255
|
+
* the owning object is an OPERAND, and its C++ name does not exist until the
|
|
256
|
+
* operation that defines it renders. Spelling this at the read would make the
|
|
257
|
+
* fact depend on emission order; `reactiveRevisionText` spells it at each of
|
|
258
|
+
* the two stores that tick it.
|
|
259
|
+
*/
|
|
260
|
+
export interface ReactiveRevisionOrigin {
|
|
261
|
+
readonly struct: string;
|
|
262
|
+
readonly key: string;
|
|
263
|
+
readonly receiver: IrOperand;
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* A method call that goes through the object rather than to a named body:
|
|
267
|
+
* the C++ member the family dispatches through, and the ABI that member was
|
|
268
|
+
* declared with. See `EmitContext.virtualCallees`.
|
|
269
|
+
*
|
|
270
|
+
* Named rather than left inline because the field is now a `ReadonlyMap`, and
|
|
271
|
+
* the walk that fills it (`virtual-methods.ts`) has to spell the same value
|
|
272
|
+
* type to hand it over -- an inline object literal repeated in two files is a
|
|
273
|
+
* shape stated twice, which is the thing this refactor keeps removing.
|
|
274
|
+
*/
|
|
275
|
+
export interface VirtualCallee {
|
|
276
|
+
readonly member: string;
|
|
277
|
+
readonly abi: CallableAbi;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* One arm of a deferred tagged-union method read: which body answers, and
|
|
281
|
+
* where in the union that arm lives.
|
|
282
|
+
*
|
|
283
|
+
* `path` is the sequence of arm indices to descend, not a rendered receiver.
|
|
284
|
+
* The union's own receiver is an operand on the read, and the call spells
|
|
285
|
+
* `armAt`/`armIs` down the path from it -- because a name minted for that
|
|
286
|
+
* receiver does not exist until its defining operation renders, which is
|
|
287
|
+
* after this fact is settled.
|
|
288
|
+
*/
|
|
289
|
+
export interface UnionMethodArm {
|
|
290
|
+
readonly path: readonly number[];
|
|
291
|
+
readonly receiverRepresentation: Representation;
|
|
292
|
+
readonly callable: FunctionId;
|
|
293
|
+
}
|
|
294
|
+
/** A method read through a tagged union, by the union it was read through and the arms that answer it. */
|
|
295
|
+
export interface UnionMethodRead {
|
|
296
|
+
readonly receiver: IrOperand;
|
|
297
|
+
readonly arms: readonly UnionMethodArm[];
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* What `typeof <union>.<member>` answers, one entry per arm, in arm order.
|
|
301
|
+
*
|
|
302
|
+
* The answers are ECMA-262's own `typeof` strings; the receiver is the union
|
|
303
|
+
* operand the discriminant is read off, which is the only value this read
|
|
304
|
+
* still needs. See `EmitContext.unionMemberTypeofReads` for when it is
|
|
305
|
+
* claimed.
|
|
306
|
+
*/
|
|
307
|
+
export type UnionMemberTypeofAnswer =
|
|
308
|
+
/** The arm's own carrier settles it: a declared field, a class method, a prototype member, or absence. */
|
|
309
|
+
{
|
|
310
|
+
readonly kind: 'constant';
|
|
311
|
+
readonly answer: string;
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* A class arm that declares no such member. The INHERITED half is closed by
|
|
315
|
+
* the layouts, but an own property put there at run time is not, and the
|
|
316
|
+
* expando table is where one would be -- so the arm reads it and asks the
|
|
317
|
+
* boxed value its own tag, which is exact without a census proof that this
|
|
318
|
+
* read (publishing no value at all) could not have carried.
|
|
319
|
+
*/
|
|
320
|
+
| {
|
|
321
|
+
readonly kind: 'expando';
|
|
322
|
+
};
|
|
323
|
+
export interface UnionMemberTypeofRead {
|
|
324
|
+
readonly receiver: IrOperand;
|
|
325
|
+
readonly member: string;
|
|
326
|
+
readonly answers: readonly UnionMemberTypeofAnswer[];
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* One deferred prototype-method read: which method, on which receiver, with
|
|
330
|
+
* whatever its family needs at the call.
|
|
331
|
+
*
|
|
332
|
+
* Named rather than inline because it is what a claim function returns --
|
|
333
|
+
* each carrier family states its own claim beside its own method table
|
|
334
|
+
* (`deferredStringMethodClaim` and friends), and the walk that settles
|
|
335
|
+
* `EmitContext.prototypeMethodReads` composes those. One implementation of
|
|
336
|
+
* each test, two callers: the walk that records it and the renderer that
|
|
337
|
+
* spells it.
|
|
338
|
+
*/
|
|
339
|
+
export interface PrototypeMethodRead {
|
|
340
|
+
readonly receiverKind: 'string' | 'number' | 'bigint' | 'array-object' | 'promise' | 'keyed-collection' | 'date' | 'regexp' | 'native-error' | 'union-to-string' | 'typed-array' | 'typed-array-union' | 'mixed-union' | 'array-buffer' | 'data-view' | 'dictionary' | 'iterator' | 'object-shape' | 'native-handle-shape' | 'callable-shape' | 'dynamic-object';
|
|
341
|
+
readonly member: string;
|
|
342
|
+
readonly receiver: PrototypeMethodReceiver;
|
|
343
|
+
readonly receiverElement: string | null;
|
|
344
|
+
/**
|
|
345
|
+
* Which of the four keyed collections this receiver is, for a
|
|
346
|
+
* `'keyed-collection'` read and never for any other.
|
|
347
|
+
*
|
|
348
|
+
* The kind alone is not enough here the way it is for the four receiver
|
|
349
|
+
* families above: `Map`, `Set`, `WeakMap` and `WeakSet` share one
|
|
350
|
+
* carrier kind and spell their methods differently (`gea::mapSet` vs.
|
|
351
|
+
* `gea::setAdd`, and the weak pair has neither `clear` nor `size`), so
|
|
352
|
+
* the family has to travel with the read rather than be re-derived at
|
|
353
|
+
* the call from a receiver the call no longer has.
|
|
354
|
+
*/
|
|
355
|
+
/**
|
|
356
|
+
* The union this call dispatches over, and what each of its arms answers,
|
|
357
|
+
* for a `'mixed-union'` read and never for any other.
|
|
358
|
+
*
|
|
359
|
+
* Unlike `typedArrayUnionCarrier` -- whose arms differ in what they store
|
|
360
|
+
* and never in what the method MEANS -- these arms disagree outright:
|
|
361
|
+
* `string | string[]` answers `join` on one arm with `Array.prototype.join`
|
|
362
|
+
* and on the other with nothing at all. So each arm carries its OWN recorded
|
|
363
|
+
* read, rendered through the same ladder a lone receiver of that carrier
|
|
364
|
+
* would take, and an arm that provably has no callable member of this name
|
|
365
|
+
* is `null`: at a CALL that is the TypeError the language itself throws one
|
|
366
|
+
* step later, so the arm renders it rather than refusing every other arm on
|
|
367
|
+
* account of one the program says cannot occur.
|
|
368
|
+
*/
|
|
369
|
+
readonly mixedUnionCarrier?: Extract<Representation, {
|
|
370
|
+
kind: 'tagged-union';
|
|
371
|
+
}>;
|
|
372
|
+
readonly mixedUnionArms?: readonly (PrototypeMethodRead | null)[];
|
|
373
|
+
readonly collectionFamily?: 'map' | 'set' | 'weak-map' | 'weak-set';
|
|
374
|
+
/**
|
|
375
|
+
* The receiver's own key and value carriers, for a `'keyed-collection'`
|
|
376
|
+
* read and never for any other.
|
|
377
|
+
*
|
|
378
|
+
* `receiverElement` above is a `representationKey` STRING, which is
|
|
379
|
+
* enough to re-check an Array element against but not enough to convert
|
|
380
|
+
* an argument into: `Map<string, any>` stores `gea::Value`, so
|
|
381
|
+
* `map.set('a', 1)` has to box its `double` at the call, and building
|
|
382
|
+
* that text needs the carrier itself rather than its key. The whole
|
|
383
|
+
* `keyed-collection` arm travels rather than the two halves, so the
|
|
384
|
+
* family and the two carriers can never be recorded out of step.
|
|
385
|
+
*/
|
|
386
|
+
readonly collectionCarrier?: Extract<Representation, {
|
|
387
|
+
kind: 'keyed-collection';
|
|
388
|
+
}>;
|
|
389
|
+
/**
|
|
390
|
+
* The receiver's own array carrier, for an `'array-object'` read and
|
|
391
|
+
* never for any other.
|
|
392
|
+
*
|
|
393
|
+
* `receiverElement` above is enough to RE-CHECK a rest pack's element
|
|
394
|
+
* against, which is all `push`/`unshift` ever needed. The rest of
|
|
395
|
+
* `Array.prototype` asks harder questions of the same element: `join`
|
|
396
|
+
* and the comparator-less `sort` ask whether this runtime states a
|
|
397
|
+
* ToString for it, `concat` asks whether the packed rest's element is
|
|
398
|
+
* that carrier or an array OF it, and `find`/`at`/`pop`/`shift` compare
|
|
399
|
+
* it against the call's own optional result payload. None of those can
|
|
400
|
+
* be answered from a key string, and the call no longer has the
|
|
401
|
+
* receiver -- so the carrier travels with the read, exactly as
|
|
402
|
+
* `collectionCarrier` does above.
|
|
403
|
+
*/
|
|
404
|
+
readonly arrayCarrier?: Extract<Representation, {
|
|
405
|
+
kind: 'array-object';
|
|
406
|
+
}>;
|
|
407
|
+
/**
|
|
408
|
+
* The receiver's own promise carrier, for a `'promise'` read and never
|
|
409
|
+
* for any other.
|
|
410
|
+
*
|
|
411
|
+
* `catch` is the member that needs it, for the same reason
|
|
412
|
+
* `arrayCarrier` above exists: its result promise has to be constructed
|
|
413
|
+
* from the RECEIVER's fulfillment value on the path where the receiver
|
|
414
|
+
* was not rejected, and `Promise<T>` into `Promise<T | TResult>` is a
|
|
415
|
+
* conversion whose source carrier the call no longer has.
|
|
416
|
+
*/
|
|
417
|
+
readonly promiseCarrier?: Extract<Representation, {
|
|
418
|
+
kind: 'promise';
|
|
419
|
+
}>;
|
|
420
|
+
/**
|
|
421
|
+
* The receiver's own cursor carrier, for an `'iterator'` read and never
|
|
422
|
+
* for any other: `next()`'s rendering reconciles the element the cursor
|
|
423
|
+
* yields against the `value` field of the result record the checker
|
|
424
|
+
* typed the call with, and the call no longer has the receiver.
|
|
425
|
+
*/
|
|
426
|
+
readonly iteratorCarrier?: Extract<Representation, {
|
|
427
|
+
kind: 'iterator';
|
|
428
|
+
}>;
|
|
429
|
+
/** The typed-array-only tagged union deferred with a shared prototype method. */
|
|
430
|
+
readonly typedArrayUnionCarrier?: Extract<Representation, {
|
|
431
|
+
kind: 'tagged-union';
|
|
432
|
+
}>;
|
|
433
|
+
/**
|
|
434
|
+
* How to reach the table, and what it is keyed by, for a `'dictionary'`
|
|
435
|
+
* read and never for any other.
|
|
436
|
+
*
|
|
437
|
+
* `Object.prototype.hasOwnProperty` off a `{ [k: string]: V }` receiver
|
|
438
|
+
* is the case: the index signature covers every string key, but the
|
|
439
|
+
* checker still resolves that one name against `Object.prototype`, so
|
|
440
|
+
* the read's published carrier is the method's signature and not `V`.
|
|
441
|
+
* Rendering it as a table read is what emitted
|
|
442
|
+
* `CallableObject<...> = std::string`. The call is `has`, and reaching
|
|
443
|
+
* it needs the receiver's own accessor (`->` for `shared-refcount`, `.`
|
|
444
|
+
* otherwise) plus the key domain to reconcile the argument against --
|
|
445
|
+
* neither of which the call site can re-derive from the CARRIER alone.
|
|
446
|
+
* So `dictionaryTableOf`'s own answer travels with the read, exactly as
|
|
447
|
+
* `collectionCarrier` and `arrayCarrier` do above -- as the accessor
|
|
448
|
+
* TOKEN, not as a rendered `<receiver><accessor>`: the receiver is
|
|
449
|
+
* already named by `receiver` above and spelled by
|
|
450
|
+
* `prototypeMethodReceiverText`, and holding a second, pre-rendered copy
|
|
451
|
+
* of it here is what made this record something only a printing body
|
|
452
|
+
* could build.
|
|
453
|
+
*/
|
|
454
|
+
readonly dictionaryTable?: {
|
|
455
|
+
readonly accessor: string;
|
|
456
|
+
readonly key: 'string' | 'number' | 'symbol';
|
|
457
|
+
};
|
|
458
|
+
/**
|
|
459
|
+
* A known-shape receiver's own field list and member accessor (`->`/`.`),
|
|
460
|
+
* for an `'object-shape'` read (`hasOwnProperty`/`propertyIsEnumerable` off
|
|
461
|
+
* a `record`/`native-record-ref`/`class-ref` whose fields the checker
|
|
462
|
+
* already knows) and never for any other.
|
|
463
|
+
*
|
|
464
|
+
* `Object.hasOwn(o, key)` answers the identical question off the same
|
|
465
|
+
* layout (`host/object-protocol.ts`'s `objectViewOf`/`ownKeyPresenceText`),
|
|
466
|
+
* and this is that question asked of the METHOD form instead of the
|
|
467
|
+
* static -- the fields and accessor travel with the read for the same
|
|
468
|
+
* reason `dictionaryTable` above does: the call no longer has the
|
|
469
|
+
* receiver's representation, only its rendered text.
|
|
470
|
+
*/
|
|
471
|
+
readonly objectShapeFields?: readonly RecordField[];
|
|
472
|
+
readonly objectShapeAccessor?: string;
|
|
473
|
+
/**
|
|
474
|
+
* The protocol name a `'native-handle-shape'` read answers
|
|
475
|
+
* `hasOwnProperty`/`propertyIsEnumerable` from -- `Math.hasOwnProperty`
|
|
476
|
+
* off `hostMemberOf`'s own static member table
|
|
477
|
+
* (`host/object-protocol.ts`'s `nativeHandleShapeCallText` is the call
|
|
478
|
+
* renderer). A `native-handle` carries no runtime value at all, so
|
|
479
|
+
* unlike `objectShapeFields` above there is no receiver text worth
|
|
480
|
+
* keeping either -- the protocol name alone is the whole question.
|
|
481
|
+
*/
|
|
482
|
+
readonly intrinsicProtocol?: string;
|
|
483
|
+
}
|
|
484
|
+
export interface HostMemberRead {
|
|
485
|
+
readonly protocol: string;
|
|
486
|
+
readonly member: string;
|
|
487
|
+
readonly receiver: IrOperand | null;
|
|
488
|
+
}
|
|
489
|
+
export type CapacitySource = {
|
|
490
|
+
readonly kind: 'value';
|
|
491
|
+
readonly operand: IrOperand;
|
|
492
|
+
} | {
|
|
493
|
+
readonly kind: 'binding';
|
|
494
|
+
readonly declaration: DeclarationId;
|
|
495
|
+
} | {
|
|
496
|
+
readonly kind: 'literal';
|
|
497
|
+
readonly text: string;
|
|
498
|
+
};
|
|
499
|
+
/**
|
|
500
|
+
* A counted `push` loop the emitter renders as one bulk append.
|
|
501
|
+
*
|
|
502
|
+
* `array` and `counter` are C++ names rather than operands because the append
|
|
503
|
+
* is emitted at the loop HEADER, where the SSA values the body reads them
|
|
504
|
+
* through are not defined yet -- both are binding cells, which the header can
|
|
505
|
+
* name (`denseCellName`, `emit-arrays.ts`). `literal` is the same problem for
|
|
506
|
+
* the pushed value: a constant is assigned to its own variable INSIDE the loop,
|
|
507
|
+
* so a constant is carried as its own text and any other value has to have been
|
|
508
|
+
* defined before the loop.
|
|
509
|
+
*/
|
|
510
|
+
export interface FillLoop {
|
|
511
|
+
readonly exit: IrBlockId;
|
|
512
|
+
readonly counter: string;
|
|
513
|
+
readonly bound: IrOperand;
|
|
514
|
+
readonly inclusive: boolean;
|
|
515
|
+
readonly array: string;
|
|
516
|
+
readonly value: IrOperand;
|
|
517
|
+
readonly literal: string | null;
|
|
518
|
+
/** The array's own element carrier, which a restated `literal` has to be spelled in. */
|
|
519
|
+
readonly element: Representation;
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* Every per-body fact `emitBody` settles before it renders a single line,
|
|
523
|
+
* bundled as one argument to `createEmitContext` instead of twelve fields a
|
|
524
|
+
* caller mutates onto the context after building it.
|
|
525
|
+
*
|
|
526
|
+
* The no-write-during-render rule, which moved these facts out of the target:
|
|
527
|
+
* rendering is a READ of settled facts, and a printer that writes one during
|
|
528
|
+
* render is a second authority over it. Before this type existed, these
|
|
529
|
+
* twelve fields were typed exactly like `EmitContext`'s real OUTPUT buffers
|
|
530
|
+
* (`valueNames`, `declarations`, `ownedValues`, minted during the render walk
|
|
531
|
+
* itself) -- `Map`/`Set`, mutable, with nothing in the type distinguishing
|
|
532
|
+
* "settled once, up front" from "grows as printing proceeds". Three of the
|
|
533
|
+
* twelve (`computeOrigins`, `propertyReadOrigins`, `bindingReadDeclarations`)
|
|
534
|
+
* were not even settled up front in practice: `targets/cpp/emit.ts`'s
|
|
535
|
+
* `emitCompute`, `targets/cpp/emit-properties.ts`'s `emitGet` and
|
|
536
|
+
* `targets/cpp/emit-bindings.ts`'s `emitBindingRead` filled them as a side
|
|
537
|
+
* effect of rendering the very operation each answer is keyed by, and
|
|
538
|
+
* `registerDirectCalleeOfDeadValue` kept an independent second copy of the
|
|
539
|
+
* `bindingReadDeclarations` write for a value `deadValuesOf` skips rendering
|
|
540
|
+
* -- one fact, two writers, agreeing only because nobody had asked them to.
|
|
541
|
+
*
|
|
542
|
+
* Every field here is computed by `emitBody` from `body` (and, for
|
|
543
|
+
* `constructorOf`, the `classes` layout it already receives as a plain
|
|
544
|
+
* parameter) BEFORE `createEmitContext` is called at all, so none of it can
|
|
545
|
+
* observe -- or be observed to depend on -- anything a printer has emitted.
|
|
546
|
+
* The remaining ~25 fields this refactor's inventory also classifies as
|
|
547
|
+
* settled-before-render facts (the `ir/facts.ts` `IrBodyCensus` output,
|
|
548
|
+
* `formalCells`/`capacityHints`/`fillLoops`/`directBindingSinks`/the dense-loop
|
|
549
|
+
* admission) are not bundled here: they are already filled by `emitBody`
|
|
550
|
+
* strictly before its render loop runs (verified by inventory -- zero write
|
|
551
|
+
* sites outside that prologue), but moving THEM into this same
|
|
552
|
+
* caller-computes-first shape would also require narrowing the several
|
|
553
|
+
* `ctx: EmitContext`-typed helper functions their policy hooks call
|
|
554
|
+
* (`isPlainMemberRead`, `directClassMethodBody`, `denseCellName`, ...) to a
|
|
555
|
+
* type that does not presuppose a fully-built context -- real, but separable,
|
|
556
|
+
* follow-up work recorded outside this file rather than
|
|
557
|
+
* smuggled into this change.
|
|
558
|
+
*/
|
|
559
|
+
export interface EmitBodyFacts {
|
|
560
|
+
/** Whether this body is a `function*` -- see `EmitContext.generatorBody`. */
|
|
561
|
+
readonly generatorBody: boolean;
|
|
562
|
+
/** See `EmitContext.receiverValues`. */
|
|
563
|
+
readonly receiverValues: ReadonlySet<IrValueId>;
|
|
564
|
+
/** See `EmitContext.bindingWriteCounts`. */
|
|
565
|
+
readonly bindingWriteCounts: ReadonlyMap<DeclarationId, number>;
|
|
566
|
+
/** See `EmitContext.constructorOf`. */
|
|
567
|
+
readonly constructorOf: {
|
|
568
|
+
readonly layout: ClassLayout;
|
|
569
|
+
readonly derived: boolean;
|
|
570
|
+
readonly callsSuper: boolean;
|
|
571
|
+
} | null;
|
|
572
|
+
/** See `EmitContext.ownedDyingValues`. */
|
|
573
|
+
readonly ownedDyingValues: ReadonlySet<IrValueId>;
|
|
574
|
+
/** See `EmitContext.consumingFormalConversions`. */
|
|
575
|
+
readonly consumingFormalConversions: ReadonlySet<IrValueId>;
|
|
576
|
+
/** See `EmitContext.classTableRoots`. */
|
|
577
|
+
readonly classTableRoots: ReadonlyMap<IrValueId, IrValueId>;
|
|
578
|
+
/** See `EmitContext.stableBorrowActuals`. */
|
|
579
|
+
readonly stableBorrowActuals: ReadonlySet<IrValueId>;
|
|
580
|
+
/** See `EmitContext.computeOrigins`. */
|
|
581
|
+
readonly computeOrigins: ReadonlyMap<IrValueId, ComputeOperation>;
|
|
582
|
+
/** See `EmitContext.propertyReadOrigins`. */
|
|
583
|
+
readonly propertyReadOrigins: ReadonlyMap<IrValueId, GetOperation>;
|
|
584
|
+
/** See `EmitContext.bindingReadDeclarations`. */
|
|
585
|
+
readonly bindingReadDeclarations: ReadonlyMap<IrValueId, DeclarationId>;
|
|
586
|
+
/** See `EmitContext.conversionSources`. */
|
|
587
|
+
readonly conversionSources: ReadonlyMap<IrValueId, IrOperand>;
|
|
588
|
+
/** See `EmitContext.callCallees`. */
|
|
589
|
+
/**
|
|
590
|
+
* Settled before anything renders, from `ir/facts.ts`'s `bodyValueOriginsOf`
|
|
591
|
+
* -- `operation.callee.value` of every call with a result. It used to be
|
|
592
|
+
* written by `emitCall` ahead of its dispatch paths, with a comment saying
|
|
593
|
+
* the answer is the same whichever path renders, which is exactly the
|
|
594
|
+
* argument for it not being a render-time write at all (invariant 5, 2.3).
|
|
595
|
+
* The one behaviour that moved with it: a `Function.prototype.toString`
|
|
596
|
+
* call returns before the old write and so registered nothing, an exclusion
|
|
597
|
+
* with no reason behind it that the byte-identity gate confirmed no program
|
|
598
|
+
* depended on.
|
|
599
|
+
*/
|
|
600
|
+
readonly callCallees: ReadonlyMap<IrValueId, IrValueId>;
|
|
601
|
+
/** See `EmitContext.calleeOnlyValues`. */
|
|
602
|
+
readonly calleeOnlyValues: ReadonlySet<IrValueId>;
|
|
603
|
+
/** See `EmitContext.recordFieldSources`. */
|
|
604
|
+
readonly recordFieldSources: ReadonlyMap<IrValueId, ReadonlyMap<string, IrOperand>>;
|
|
605
|
+
/** See `EmitContext.thunkValues`. */
|
|
606
|
+
readonly thunkValues: ReadonlyMap<IrValueId, FunctionId>;
|
|
607
|
+
/** See `EmitContext.hostClassReads`. */
|
|
608
|
+
readonly hostClassReads: ReadonlyMap<IrValueId, {
|
|
609
|
+
readonly kind: 'class' | 'singleton';
|
|
610
|
+
readonly declaration: DeclarationId;
|
|
611
|
+
readonly linkageName: string;
|
|
612
|
+
}>;
|
|
613
|
+
/** See `EmitContext.classObjectReads`. */
|
|
614
|
+
readonly classObjectReads: ReadonlyMap<IrValueId, DeclarationId>;
|
|
615
|
+
/** See `EmitContext.hostMemberReads`. Settled by `host/emit-host-properties.ts`'s `hostMemberReadsOf`. */
|
|
616
|
+
readonly hostMemberReads: ReadonlyMap<IrValueId, HostMemberRead>;
|
|
617
|
+
/** See `EmitContext.valueCellReads`. */
|
|
618
|
+
readonly valueCellReads: ReadonlyMap<IrValueId, ReadonlySet<DeclarationId>>;
|
|
619
|
+
/** See `EmitContext.staticKeyTexts`. */
|
|
620
|
+
readonly staticKeyTexts: ReadonlyMap<IrValueId, string>;
|
|
621
|
+
/**
|
|
622
|
+
* See `EmitContext.hostNamespaceReads`. Settled by `host-namespace-reads.ts`'s
|
|
623
|
+
* `hostNamespaceReadsOf` alongside its two siblings below -- ONE fixed point,
|
|
624
|
+
* because a `get` off a namespace path is classified against the very maps it
|
|
625
|
+
* also extends, and splitting them would mean re-running the walk.
|
|
626
|
+
*/
|
|
627
|
+
readonly hostNamespaceReads: ReadonlyMap<IrValueId, string>;
|
|
628
|
+
/** See `EmitContext.hostNamespaceValues`. */
|
|
629
|
+
readonly hostNamespaceValues: ReadonlyMap<IrValueId, string>;
|
|
630
|
+
/** See `EmitContext.hostFunctionReads`. */
|
|
631
|
+
readonly hostFunctionReads: ReadonlyMap<IrValueId, HostCallSpelling>;
|
|
632
|
+
/**
|
|
633
|
+
* See `EmitContext.functionSourceReads`. Settled by `function-source-reads.
|
|
634
|
+
* ts`'s `functionSourceReadsOf`, which takes only `staticKeyTexts` and
|
|
635
|
+
* `body` -- never `ctx` -- so it moved here alongside its siblings rather
|
|
636
|
+
* than staying a post-construction merge.
|
|
637
|
+
*/
|
|
638
|
+
readonly functionSourceReads: ReadonlyMap<IrValueId, string>;
|
|
639
|
+
/** See `EmitContext.functionSourceSnapshotNames`, settled by the same walk. */
|
|
640
|
+
readonly functionSourceSnapshotNames: ReadonlyMap<IrValueId, string>;
|
|
641
|
+
/**
|
|
642
|
+
* See `EmitContext.directCallees`. Settled by `directCalleesOf`, a walk over
|
|
643
|
+
* every `call` whose `CallOperation.target` is already `direct` -- the
|
|
644
|
+
* dispatch decision itself is `ir/call-dispatch.ts`'s, filled once for the
|
|
645
|
+
* whole program after the shake, so this is a straight projection of it
|
|
646
|
+
* plus `abiOfCallable`, neither of which any printer is asked about.
|
|
647
|
+
*/
|
|
648
|
+
readonly directCallees: ReadonlyMap<IrValueId, string>;
|
|
649
|
+
/** See `EmitContext.directCalleeAbis`, settled by the same walk. */
|
|
650
|
+
readonly directCalleeAbis: ReadonlyMap<IrValueId, CallableAbi>;
|
|
651
|
+
}
|
|
652
|
+
export interface EmitContext {
|
|
653
|
+
/**
|
|
654
|
+
* The calling convention this body implements, or `null` for an uncalled
|
|
655
|
+
* region.
|
|
656
|
+
*
|
|
657
|
+
* For a body that captures the enclosing method's receiver, this is the
|
|
658
|
+
* *real* semantic ABI with `.receiver` overridden to the captured
|
|
659
|
+
* representation -- never the other way around. Nothing outside this file
|
|
660
|
+
* ever sees the override: a caller of this callable still consults the real,
|
|
661
|
+
* unmodified ABI (`abiOfCallee`, `emitCall`'s own receiver check), so an
|
|
662
|
+
* arrow still takes no receiver argument at its call sites. The override
|
|
663
|
+
* only changes how *this body itself* reads the value once it is inside the
|
|
664
|
+
* frame, exactly as `emitReceiver` already does for an ordinary method's own
|
|
665
|
+
* `this` -- the capture just moves where that value comes from.
|
|
666
|
+
*/
|
|
667
|
+
readonly abi: CallableAbi | null;
|
|
668
|
+
/**
|
|
669
|
+
* Whether this body is a `function*` (`IrBody.generator`) -- the frame is a
|
|
670
|
+
* C++20 coroutine and every `return` spells `co_return`. Stated by the
|
|
671
|
+
* declaration, never inferred from `abi.result`: an ordinary function that
|
|
672
|
+
* returns a generator's cursor unchanged has the identical result carrier.
|
|
673
|
+
*
|
|
674
|
+
* Settled at construction, from `EmitBodyFacts` -- see that type's own doc
|
|
675
|
+
* for why this and its eleven siblings are no longer filled by mutating the
|
|
676
|
+
* context after building it.
|
|
677
|
+
*/
|
|
678
|
+
readonly generatorBody: boolean;
|
|
679
|
+
/** The conventions of emitted bodies, shared with their signature renderer. */
|
|
680
|
+
readonly abiOfCallable: (callable: FunctionId) => CallableAbi | null;
|
|
681
|
+
/** The execution context whose frame this body is, so a cell owned elsewhere is recognisable as one. */
|
|
682
|
+
readonly owner: FunctionId | RegionId;
|
|
683
|
+
/** See `emit-narrowing.ts`'s `PrinterDrift`; one program-wide list, shared by every body's context. */
|
|
684
|
+
readonly printerDrift: PrinterDrift[];
|
|
685
|
+
/**
|
|
686
|
+
* The conversion census (`conversion/nodes.ts`): the one answer to "how does
|
|
687
|
+
* this carrier become that one", the same node lowering named on every
|
|
688
|
+
* `convert` it minted. A printer site that still converts on its own
|
|
689
|
+
* (`emit-narrowing.ts`'s `alignedValueText`) asks it first.
|
|
690
|
+
*/
|
|
691
|
+
readonly conversions: ConversionCensus;
|
|
692
|
+
readonly nativeSelectionHelpers?: ReadonlyMap<string, NativeSelectionHelper>;
|
|
693
|
+
/** Where each binding cell lives, projected once for the whole program. */
|
|
694
|
+
readonly placements: ReadonlyMap<DeclarationId, BindingPlacement>;
|
|
695
|
+
/** What each class is made of, so a key on a class receiver resolves to storage or to a method. */
|
|
696
|
+
readonly classes: ReadonlyMap<DeclarationId, ClassLayout>;
|
|
697
|
+
/** Every capturing function's environment, so a binding owned by another frame can resolve through this owner's own slot instead of refusing outright. */
|
|
698
|
+
readonly captures: CaptureIndex;
|
|
699
|
+
/**
|
|
700
|
+
* The one authority on what a structural type physically is, threaded here
|
|
701
|
+
* so `targets/cpp/emit-properties.ts` can ask a receiver's own declared
|
|
702
|
+
* shape what representation one field holds -- the same question
|
|
703
|
+
* `targets/cpp/records.ts`'s `cppRecordDeclarations` asks to build struct
|
|
704
|
+
* bodies, reused rather than re-derived a second, independently-drifting
|
|
705
|
+
* way. See citations.md finding 1.
|
|
706
|
+
*/
|
|
707
|
+
readonly deriver: RepresentationDeriver;
|
|
708
|
+
/** The record layout policy the conversion registry decides with (`projection/fields.ts`'s `recordLayoutPolicyOf`): the printer renders record views from the same plan. */
|
|
709
|
+
readonly layouts: RecordLayoutPolicy;
|
|
710
|
+
readonly valueNames: Map<IrValueId, string>;
|
|
711
|
+
readonly ownedValues: Set<IrValueId>;
|
|
712
|
+
/** Settled from `EmitBodyFacts.ownedDyingValues` -- see that type's own doc. */
|
|
713
|
+
readonly ownedDyingValues: ReadonlySet<IrValueId>;
|
|
714
|
+
/** Settled from `EmitBodyFacts.consumingFormalConversions` -- see that type's own doc. */
|
|
715
|
+
readonly consumingFormalConversions: ReadonlySet<IrValueId>;
|
|
716
|
+
/**
|
|
717
|
+
* How many times this body writes each binding cell, censused by `emitBody`
|
|
718
|
+
* before a single operation renders (`EmitBodyFacts.bindingWriteCounts`).
|
|
719
|
+
*
|
|
720
|
+
* Read by `emit-bindings.ts` and by nothing else. A host-object read may name
|
|
721
|
+
* its cell instead of copying out of it (`defineValueAlias`) only where the
|
|
722
|
+
* cell still holds the same object at every use of the read -- which a body
|
|
723
|
+
* that writes the cell more than once cannot promise. Absent a declaration,
|
|
724
|
+
* this body never writes it.
|
|
725
|
+
*/
|
|
726
|
+
readonly bindingWriteCounts: ReadonlyMap<DeclarationId, number>;
|
|
727
|
+
/**
|
|
728
|
+
* Cells that ARE a formal of this frame, and the formal's own name.
|
|
729
|
+
*
|
|
730
|
+
* `function f(n) { ... }` lowers `n` to a cell seeded by one write from the
|
|
731
|
+
* `parameter` operation, and that cell is then a second copy of a value the
|
|
732
|
+
* frame already holds -- a retain and a release for a `gea::Ref`, a heap copy
|
|
733
|
+
* for a `std::string`, on every call. Where the program never writes the cell
|
|
734
|
+
* again, the two are the same storage and the cell can simply be the formal.
|
|
735
|
+
*
|
|
736
|
+
* Filled by `emitBody` before anything renders, under conditions the write
|
|
737
|
+
* itself cannot check on its own: the cell must be written exactly once, be
|
|
738
|
+
* this frame's own unboxed local, and spell the same C++ type the formal
|
|
739
|
+
* does -- an integer-narrowed cell is `long long` where its formal is
|
|
740
|
+
* `double`, and those are two storages, not one.
|
|
741
|
+
*
|
|
742
|
+
* Not yet `ReadonlyMap`: its one write site is `collectFormalCells`
|
|
743
|
+
* (`emit-bindings.ts`), mutating through `ctx` directly -- see
|
|
744
|
+
* `narrowedFormalValues`'s doc, the sibling field that function also fills.
|
|
745
|
+
*/
|
|
746
|
+
readonly formalCells: ReadonlyMap<DeclarationId, string>;
|
|
747
|
+
/** Every `constant` operation's own literal text, keyed by the value it defined -- the only legal source for a static property key. */
|
|
748
|
+
readonly constantTexts: Map<IrValueId, string>;
|
|
749
|
+
/**
|
|
750
|
+
* The same `constant` texts, settled from the IR before this body renders.
|
|
751
|
+
*
|
|
752
|
+
* NOT a copy of `constantTexts`, which additionally accumulates the folded
|
|
753
|
+
* `typeof` results the render mints as it goes (`emit.ts`'s own `namespace\
|
|
754
|
+
* Typeof` and settled-typeof writes). Those must never widen the set of keys
|
|
755
|
+
* a claim will treat as STATIC: a value the render happens to have folded is
|
|
756
|
+
* not a property name the program wrote, and admitting one would turn a
|
|
757
|
+
* computed key into a static one. So every claim that decides a deferred
|
|
758
|
+
* read asks this map, at both of its two callers -- the prepass walk and the
|
|
759
|
+
* resolver -- and the folding readers keep `constantTexts`.
|
|
760
|
+
*/
|
|
761
|
+
readonly staticKeyTexts: ReadonlyMap<IrValueId, string>;
|
|
762
|
+
/**
|
|
763
|
+
* Every host member spelling this compilation installed -- the backend's own
|
|
764
|
+
* plus every plugin's, unioned once by `compiler.ts`.
|
|
765
|
+
*
|
|
766
|
+
* Threaded rather than imported. A plugin's host protocols are the plugin's,
|
|
767
|
+
* and a lookup that read this file's own module-level table would answer for
|
|
768
|
+
* half the compilation while preflight had certified against all of it.
|
|
769
|
+
*/
|
|
770
|
+
readonly hosts: HostSpellings;
|
|
771
|
+
/** Standard unique symbols by the declaration identity encoded in static property keys. */
|
|
772
|
+
readonly wellKnownSymbols: ReadonlyMap<DeclarationId, string>;
|
|
773
|
+
/**
|
|
774
|
+
* Host members reached but not yet rendered.
|
|
775
|
+
*
|
|
776
|
+
* A host object's method is not a value any host symbol corresponds to:
|
|
777
|
+
* `el.setAttribute` on its own names nothing in C++, and only
|
|
778
|
+
* `el.setAttribute(a, b)` does. So the access records which member was
|
|
779
|
+
* reached, on which receiver, and the *call* renders the host's template.
|
|
780
|
+
* Nothing else may read this value -- a program that passes a host method
|
|
781
|
+
* around as a first-class function is refused at the call site rather than
|
|
782
|
+
* handed a callable that was never materialised.
|
|
783
|
+
*/
|
|
784
|
+
readonly hostMemberReads: ReadonlyMap<IrValueId, HostMemberRead>;
|
|
785
|
+
/**
|
|
786
|
+
* Host class objects reached but not rendered, to the name the program wrote.
|
|
787
|
+
*
|
|
788
|
+
* `hostMemberReads`'s own mechanism for a different unrenderable thing: a
|
|
789
|
+
* host's class is not a value, so reading it produces no C++ and only what is
|
|
790
|
+
* done THROUGH it does. Keeping the name is what lets a refusal say which
|
|
791
|
+
* class was used as a value instead of naming an anonymous slot.
|
|
792
|
+
*/
|
|
793
|
+
/**
|
|
794
|
+
* Reads of a field this compilation holds in a reactive cell, to what a
|
|
795
|
+
* consumer needs in order to SUBSCRIBE to it.
|
|
796
|
+
*
|
|
797
|
+
* `hostMemberReads`'s mechanism, with one deliberate difference: those maps
|
|
798
|
+
* record a read that produced NO C++ and is rendered whole by its consumer.
|
|
799
|
+
* This one records a read that renders perfectly well and did render -- the
|
|
800
|
+
* cell converts to `const T&`, so `v7 = v5->count;` is the same line it was
|
|
801
|
+
* before the field was celled, and every arithmetic use of it keeps working
|
|
802
|
+
* untouched. What is recorded is only the extra fact that this particular
|
|
803
|
+
* value CAME FROM a cell, so a JSX position that consumes it can register an
|
|
804
|
+
* effect instead of reading it once. Suppressing the read instead would
|
|
805
|
+
* break every non-JSX use of the same field.
|
|
806
|
+
*
|
|
807
|
+
* The DECLARING struct travels with it, not the receiver's own: a
|
|
808
|
+
* pointer-to-member names the struct that declares the member, which for an
|
|
809
|
+
* inherited field is the base. A struct name rather than a declaration id
|
|
810
|
+
* because a reactive struct is not only a class -- the element record of a
|
|
811
|
+
* reactive array is one too, and has no declaration.
|
|
812
|
+
*/
|
|
813
|
+
readonly reactiveFieldReads: ReadonlyMap<IrValueId, ReactiveRevisionOrigin>;
|
|
814
|
+
/**
|
|
815
|
+
* Every callable this body allocated, to the function whose body it runs.
|
|
816
|
+
*
|
|
817
|
+
* A JSX slot that computes something -- `class={done ? 'a' : 'b'}` -- reaches
|
|
818
|
+
* the emitter as a thunk allocation followed by a call of it (see
|
|
819
|
+
* `plugins/gea/reactive-slots.ts`), and the slot has to name the *thunk* in
|
|
820
|
+
* order to re-run it. Keeping the function identity is what lets it ask
|
|
821
|
+
* `hosts.reactive.dependencies` what that body reads, which is a question
|
|
822
|
+
* about the callee that only its `FunctionId` can answer.
|
|
823
|
+
*
|
|
824
|
+
* Recorded, never consumed as a substitute for the value: the callable is
|
|
825
|
+
* still emitted exactly as before and is still a real `CallableObject`.
|
|
826
|
+
*
|
|
827
|
+
* Settled before anything renders, from `ir/facts.ts`'s `bodyValueOriginsOf`
|
|
828
|
+
* (invariant 5, 2.3). The two write sites this replaces tested one and the
|
|
829
|
+
* same condition -- a zero-parameter, receiver-less
|
|
830
|
+
* `function-value-dispatch` result -- and differed only in WHEN they ran,
|
|
831
|
+
* which is the order dependence itself: the dead-value path needed its own
|
|
832
|
+
* write because skipping a producer's render skipped its registration, and
|
|
833
|
+
* a reactive JSX slot that looked the thunk up first found nothing.
|
|
834
|
+
*/
|
|
835
|
+
readonly thunkValues: ReadonlyMap<IrValueId, FunctionId>;
|
|
836
|
+
/**
|
|
837
|
+
* Callable values that need no environment, to the C++ function their call
|
|
838
|
+
* runs directly.
|
|
839
|
+
*
|
|
840
|
+
* A `CallableObject` is a function pointer and a `void*`, and `call` invokes
|
|
841
|
+
* through the pointer. That indirection is the whole point for a callable
|
|
842
|
+
* whose identity is a runtime fact -- a callback held in a variable, a
|
|
843
|
+
* method passed as a value -- and it is pure loss for `c.tick(i)`, where the
|
|
844
|
+
* body is decided at the call site and the environment is `nullptr`: the
|
|
845
|
+
* call could not be inlined, the arguments crossed a second frame, and a
|
|
846
|
+
* method whose C++ was three instructions was reached through two.
|
|
847
|
+
*
|
|
848
|
+
* Recorded only where the environment really is `nullptr`. A closure carries
|
|
849
|
+
* state its body reads out of that pointer, so its call has to go through the
|
|
850
|
+
* carrier no matter how visible the body is.
|
|
851
|
+
*
|
|
852
|
+
* Settled from `EmitBodyFacts.directCallees` (`directCalleesOf`, invariant 5,
|
|
853
|
+
* 2.3). The write used to be `registerDirectCallee`, called from the same
|
|
854
|
+
* direct-dispatch walk that now runs before `createEmitContext` instead of
|
|
855
|
+
* after it -- the walk only ever asked `CallOperation.target` and
|
|
856
|
+
* `abiOfCallable`, neither of which needs a built context.
|
|
857
|
+
*/
|
|
858
|
+
readonly directCallees: ReadonlyMap<IrValueId, string>;
|
|
859
|
+
/**
|
|
860
|
+
* The body convention behind the corresponding direct spelling. Its result
|
|
861
|
+
* can be physically broader than the covariant method value published at
|
|
862
|
+
* the read. Settled from `EmitBodyFacts.directCalleeAbis` alongside
|
|
863
|
+
* `directCallees` -- see that field's doc.
|
|
864
|
+
*/
|
|
865
|
+
readonly directCalleeAbis: ReadonlyMap<IrValueId, CallableAbi>;
|
|
866
|
+
/**
|
|
867
|
+
* The RECEIVER a direct callee needs, for a method value whose own carrier
|
|
868
|
+
* declares none.
|
|
869
|
+
*
|
|
870
|
+
* A class's method body takes the instance as its leading formal, and
|
|
871
|
+
* `boundMethodValueRepresentation` (`class-properties/emit-class-properties.
|
|
872
|
+
* ts`) puts that back into the carrier of a materialized method value. The
|
|
873
|
+
* CALL, though, reads the plan's carrier -- and a member reached through a
|
|
874
|
+
* slot the program declared with an INTERFACE type carries the interface's
|
|
875
|
+
* own method signature, which states no receiver. The call then renders as a
|
|
876
|
+
* property read plus a receiver-less invocation (the semantic graph is
|
|
877
|
+
* right: an interface member IS storage), and the direct bind named a body
|
|
878
|
+
* one formal wider than the arguments it was given.
|
|
879
|
+
*
|
|
880
|
+
* hono's `this.router.add(method, path, ...)` is that shape once
|
|
881
|
+
* `InterfaceImplementorPolicy` resolves `Router` to `PatternRouter`: the
|
|
882
|
+
* slot holds the class, the member read finds a real method, and the call
|
|
883
|
+
* still declares no receiver. Recorded here so the direct call can pass the
|
|
884
|
+
* one the read already had, rather than binding it into an environment --
|
|
885
|
+
* which would heap-allocate per call on a request path. The map also retains
|
|
886
|
+
* the receiver for an immediate class-method call whose materialized
|
|
887
|
+
* callable already publishes a receiver-bearing convention but is not
|
|
888
|
+
* eligible for body-by-name binding. It is keyed by the property read's SSA
|
|
889
|
+
* result, so a detached method read cannot acquire a receiver from it.
|
|
890
|
+
*/
|
|
891
|
+
readonly directCallReceivers: ReadonlyMap<IrValueId, IrOperand>;
|
|
892
|
+
/**
|
|
893
|
+
* The DISPATCHED counterpart of `directCallees`: a method the program
|
|
894
|
+
* overrides, by the C++ member its family dispatches through.
|
|
895
|
+
*
|
|
896
|
+
* A direct bind is only right while nothing below the receiver's class
|
|
897
|
+
* redeclares the key (`virtual-methods.ts`). Where something does, the call
|
|
898
|
+
* has to go through the object, so the callee's value is recorded here
|
|
899
|
+
* INSTEAD and `emit-callable.ts` renders `receiver->member(args)`.
|
|
900
|
+
*/
|
|
901
|
+
readonly virtualCallees: ReadonlyMap<IrValueId, VirtualCallee>;
|
|
902
|
+
/**
|
|
903
|
+
* Which of those a call actually consumed.
|
|
904
|
+
*
|
|
905
|
+
* A dispatched method reference that is STORED rather than called would be
|
|
906
|
+
* carried as an ordinary `CallableObject` over one statically named body --
|
|
907
|
+
* the base's -- which is the defect the dispatch exists to remove. So the
|
|
908
|
+
* body refuses on any entry left unconsumed rather than emitting a carrier
|
|
909
|
+
* that silently picks one implementation.
|
|
910
|
+
*/
|
|
911
|
+
readonly virtualCalleesUsed: Set<IrValueId>;
|
|
912
|
+
/**
|
|
913
|
+
* A method read through a tagged union whose class arms each resolve to a
|
|
914
|
+
* concrete, nonoverridden body. The read itself has no single callable ABI:
|
|
915
|
+
* each arm keeps its own receiver and covariant result, so the following
|
|
916
|
+
* call dispatches the already-materialized arguments directly by union tag.
|
|
917
|
+
*/
|
|
918
|
+
readonly unionMethodReads: ReadonlyMap<IrValueId, UnionMethodRead>;
|
|
919
|
+
/** Which deferred union method reads were consumed by a direct call. */
|
|
920
|
+
readonly unionMethodReadsUsed: Set<IrValueId>;
|
|
921
|
+
/**
|
|
922
|
+
* A member read off a tagged union whose arms DISAGREE about whether the
|
|
923
|
+
* member exists, and which nothing but `typeof` consumes.
|
|
924
|
+
*
|
|
925
|
+
* `typeof (res as Promise<Response>).then === 'function'` is the shape, and
|
|
926
|
+
* it is the whole of `@hono/node-server`'s `isPromise`. The read has no
|
|
927
|
+
* value to produce -- one arm's member is a `Promise.prototype` method,
|
|
928
|
+
* which is not a function object this backend can materialize, and the other
|
|
929
|
+
* arm has no such member at all -- but the QUESTION the program asks has an
|
|
930
|
+
* exact per-arm answer, which the discriminant already selects between.
|
|
931
|
+
*
|
|
932
|
+
* So the read renders nothing and the `typeof` renders the dispatch. Claimed
|
|
933
|
+
* only where the arms disagree AND at least one of them answers by absence:
|
|
934
|
+
* a union whose arms agree is already a constant, and one whose arms all
|
|
935
|
+
* declare the member renders the member itself.
|
|
936
|
+
*/
|
|
937
|
+
readonly unionMemberTypeofReads: ReadonlyMap<IrValueId, UnionMemberTypeofRead>;
|
|
938
|
+
/**
|
|
939
|
+
* The general iterator protocol's own `next()` call, cached by the
|
|
940
|
+
* iterator-record value it was called on.
|
|
941
|
+
*
|
|
942
|
+
* ECMA-262 7.4.3 `IteratorNext` is ONE call producing `{value, done}`
|
|
943
|
+
* together; this IR splits that into two operations (`iterator-next` reads
|
|
944
|
+
* `value`, `iterator-done` reads `done` -- `ir/model.ts`'s
|
|
945
|
+
* `IteratorDoneOperation` doc explains why). The native array-cursor path
|
|
946
|
+
* answers that split for free (`gea::Iterator::arrayNext` sets a flag,
|
|
947
|
+
* `.done()` reads it back), but a "record"-carried iterator-record has no
|
|
948
|
+
* such cursor -- its `next` is a real, once-only call through a
|
|
949
|
+
* `gea::CallableObject`. So `emit-iterator.ts`'s `emitIteratorNext` calls it
|
|
950
|
+
* exactly once, stores the `{value, done}` result in a fresh local, and
|
|
951
|
+
* records that local's name and field-access operator here; the paired
|
|
952
|
+
* `emitIteratorDone` reads the SAME local instead of calling `next()` a
|
|
953
|
+
* second time, which would both double the side effect and skip an element.
|
|
954
|
+
*/
|
|
955
|
+
readonly protocolNextResults: Map<IrValueId, {
|
|
956
|
+
readonly tempName: string;
|
|
957
|
+
readonly accessor: string;
|
|
958
|
+
readonly valueName: string;
|
|
959
|
+
readonly valueText: string;
|
|
960
|
+
readonly doneText: string;
|
|
961
|
+
}>;
|
|
962
|
+
/**
|
|
963
|
+
* The one `runtime::iterator::step` result shared by a dynamic iterator's
|
|
964
|
+
* value and done reads. Calling `next()` separately for each would advance
|
|
965
|
+
* the user iterator twice, so the dynamic path has the same cache invariant
|
|
966
|
+
* as the statically-shaped iterator-record path above.
|
|
967
|
+
*/
|
|
968
|
+
readonly dynamicIteratorSteps: Map<IrValueId, string>;
|
|
969
|
+
/** Whether a dynamic iterator record has observed `done: true`. */
|
|
970
|
+
readonly dynamicIteratorDoneStates: Map<IrValueId, string>;
|
|
971
|
+
/**
|
|
972
|
+
* The UTF-16 metadata local captured beside an invariant `charCodeAt`
|
|
973
|
+
* receiver, by the read it belongs to.
|
|
974
|
+
*
|
|
975
|
+
* A naming table, not a fact, which is why it is here rather than a field of
|
|
976
|
+
* `prototypeMethodReads`: what it holds is the NAME of a scratch local this
|
|
977
|
+
* body minted and declared, and the decision to mint one is about a hoisted
|
|
978
|
+
* preheader -- a rendering choice -- rather than about what the read means.
|
|
979
|
+
* Keeping it inside the read's own record was also what made that record
|
|
980
|
+
* re-written mid-body, and it is what the struct's ordinal used to count.
|
|
981
|
+
*/
|
|
982
|
+
readonly stringMetadataNames: Map<IrValueId, string>;
|
|
983
|
+
/**
|
|
984
|
+
* Every value a `receiver` operation defined.
|
|
985
|
+
*
|
|
986
|
+
* `ir/lower.ts` mints one for exactly two spellings: `this`, which takes the
|
|
987
|
+
* frame's own receiver representation, and `super.x`, which mints a SECOND
|
|
988
|
+
* one at the BASE class's representation because the checker types bare
|
|
989
|
+
* `super` as the base. So a receiver-defined value whose class is not this
|
|
990
|
+
* frame's own receiver class came from `super` and from nothing else -- which
|
|
991
|
+
* is what tells a statically bound super call apart from a dispatched one.
|
|
992
|
+
*
|
|
993
|
+
* Settled from `EmitBodyFacts.receiverValues` -- see that type's own doc.
|
|
994
|
+
*/
|
|
995
|
+
readonly receiverValues: ReadonlySet<IrValueId>;
|
|
996
|
+
/**
|
|
997
|
+
* The class whose constructor body this is, or `null` for every other body
|
|
998
|
+
* -- and, for a derived one, whether its IR holds a `super-initialize` at
|
|
999
|
+
* all. ECMA-262 10.2.2 step 13: a derived constructor completing normally
|
|
1000
|
+
* with `this` still uninitialized throws a ReferenceError, and one returning
|
|
1001
|
+
* a non-object, non-undefined value throws a TypeError. Both facts are
|
|
1002
|
+
* static here (the base initializer is an explicit operation, the return's
|
|
1003
|
+
* carrier is known), so `emit-return.ts` renders the throw instead of
|
|
1004
|
+
* silently constructing the instance anyway.
|
|
1005
|
+
*
|
|
1006
|
+
* Settled from `EmitBodyFacts.constructorOf` -- see that type's own doc.
|
|
1007
|
+
*/
|
|
1008
|
+
readonly constructorOf: {
|
|
1009
|
+
readonly layout: ClassLayout;
|
|
1010
|
+
readonly derived: boolean;
|
|
1011
|
+
readonly callsSuper: boolean;
|
|
1012
|
+
} | null;
|
|
1013
|
+
/** Every `class key` this unit really emitted, with the root virtual member ABI. */
|
|
1014
|
+
readonly virtualDispatch: ReadonlyMap<string, CallableAbi>;
|
|
1015
|
+
/** The unit-wide answer behind `directCallees` for a cell: see `buildDirectCallableIndex`. */
|
|
1016
|
+
/** Capture-free bodies with proved borrowed parameters and unchanged non-reference ABI. */
|
|
1017
|
+
readonly borrowableMemberBodies: ReadonlySet<FunctionId>;
|
|
1018
|
+
readonly stableBorrowEntries: ReadonlyMap<string, StableBorrowEntry>;
|
|
1019
|
+
/** Settled from `EmitBodyFacts.stableBorrowActuals` -- see that type's own doc. */
|
|
1020
|
+
readonly stableBorrowActuals: ReadonlySet<IrValueId>;
|
|
1021
|
+
readonly callableMemberCandidates: ReadonlyMap<string, FunctionId>;
|
|
1022
|
+
readonly directCallableBindings: ReadonlyMap<DeclarationId, FunctionId>;
|
|
1023
|
+
/** Constructor cells this unit constructs through repeatedly, and the class each names -- see `buildRepeatedConstructorIndex`. */
|
|
1024
|
+
readonly repeatedConstructors: ReadonlyMap<DeclarationId, DeclarationId>;
|
|
1025
|
+
/** Argument reads whose cell is dead after the call, so the argument moves -- see `buildDyingArgumentIndex`. */
|
|
1026
|
+
readonly dyingArguments: ReadonlySet<IrValueId>;
|
|
1027
|
+
/** Module-level cells that hold one host method forever, so a read of one is that host member -- see `buildHostMethodAliasIndex`. */
|
|
1028
|
+
readonly hostMethodAliases: ReadonlyMap<DeclarationId, HostMethodAlias>;
|
|
1029
|
+
/**
|
|
1030
|
+
* Deferred `Function.prototype.toString` reads, keyed by callee result and
|
|
1031
|
+
* carrying the complete string-producing expression.
|
|
1032
|
+
*
|
|
1033
|
+
* Settled from `EmitBodyFacts.functionSourceReads` -- see that field's own
|
|
1034
|
+
* doc. Was two writers minting into this map AT THE RENDER SITE off a
|
|
1035
|
+
* shared `.size` counter; both moved into `functionSourceReadsOf`'s own walk
|
|
1036
|
+
* alongside `functionSourceSnapshotNames`, which is why the two still share
|
|
1037
|
+
* one ordinal without sharing a render-time write.
|
|
1038
|
+
*/
|
|
1039
|
+
readonly functionSourceReads: ReadonlyMap<IrValueId, string>;
|
|
1040
|
+
/**
|
|
1041
|
+
* The snapshot variable's name for each entry in `functionSourceReads`.
|
|
1042
|
+
*
|
|
1043
|
+
* Was `gea_function_source_${ctx.functionSourceReads.size}` and
|
|
1044
|
+
* `gea_union_to_string_source_${ctx.functionSourceReads.size}`, minted by two
|
|
1045
|
+
* different writers sharing one counter AT THE RENDER SITE. A `.size`-derived
|
|
1046
|
+
* ordinal is only stable if the mint order is a property of the IR, and this
|
|
1047
|
+
* one was a property of which writer's render path reached a given `get`
|
|
1048
|
+
* first. `function-source-reads.ts` mints both maps in one walk of
|
|
1049
|
+
* `blockOrder` before anything renders, so the ordinal is the IR's --
|
|
1050
|
+
* settled from `EmitBodyFacts.functionSourceSnapshotNames`, computed
|
|
1051
|
+
* alongside `functionSourceReads` before `createEmitContext` is called.
|
|
1052
|
+
*
|
|
1053
|
+
* The renderer still decides WHERE to declare and assign the snapshot, which
|
|
1054
|
+
* is a real ordering requirement -- a following call argument may replace the
|
|
1055
|
+
* cell the receiver was read from -- it only stops deciding the NAME.
|
|
1056
|
+
*/
|
|
1057
|
+
readonly functionSourceSnapshotNames: ReadonlyMap<IrValueId, string>;
|
|
1058
|
+
readonly callCallees: ReadonlyMap<IrValueId, IrValueId>;
|
|
1059
|
+
/** Values read only as a call's callee -- `ir/facts.ts`'s `calleeOnlyValues`. */
|
|
1060
|
+
readonly calleeOnlyValues: ReadonlySet<IrValueId>;
|
|
1061
|
+
/**
|
|
1062
|
+
* The operand each `convert` result was converted FROM, so a value's history
|
|
1063
|
+
* survives a carrier change.
|
|
1064
|
+
*
|
|
1065
|
+
* Since lowering owns conversions (Phase 1.4), a thunk call whose result
|
|
1066
|
+
* enters a slot in another carrier -- a style member's `double` stored into
|
|
1067
|
+
* the struct's `Optional<double>` -- is two SSA values: the call, and a
|
|
1068
|
+
* `convert` of it. `recordFieldSources` records the one the store sees,
|
|
1069
|
+
* which is the conversion; the call, and with it the thunk the reactive
|
|
1070
|
+
* question is about, is one step behind it. This map is that step. Without
|
|
1071
|
+
* it every converted style member fell through to the once-only
|
|
1072
|
+
* `styleProperty` and a program that used to animate rendered one frame
|
|
1073
|
+
* and never moved again (button-tetris on the AMOLED board, 2026-09-06).
|
|
1074
|
+
*
|
|
1075
|
+
* Settled before anything renders, from `ir/facts.ts`'s `bodyValueOriginsOf`
|
|
1076
|
+
* -- the same move `valueCellReads` made, and for the same reason. It used
|
|
1077
|
+
* to be written by `emitConvert` as each conversion rendered, so a consumer
|
|
1078
|
+
* walking a value's history saw only the conversions emitted SO FAR: the
|
|
1079
|
+
* chain `emit-jsx.ts` follows was as long as render order had made it,
|
|
1080
|
+
* which is precisely what invariant 5 (2.3) exists to forbid. Nothing about
|
|
1081
|
+
* the answer needs a printer -- it is `operation.source` of every `convert`
|
|
1082
|
+
* in the body -- so there was never a reason for it to be a render-time
|
|
1083
|
+
* write.
|
|
1084
|
+
*/
|
|
1085
|
+
readonly conversionSources: ReadonlyMap<IrValueId, IrOperand>;
|
|
1086
|
+
/**
|
|
1087
|
+
* Every record allocation's members to the values they were initialized FROM.
|
|
1088
|
+
*
|
|
1089
|
+
* A style object is the reason: `emitElementProp` spells `style={{ ... }}`
|
|
1090
|
+
* one `styleProperty` call per member, reading each out of the allocated
|
|
1091
|
+
* struct -- and a struct field is storage, not a value with a history, so by
|
|
1092
|
+
* then there is no way back to the expression that produced it. A member
|
|
1093
|
+
* wired to a thunk (`plugins/gea/reactive-slots.ts` claims style members
|
|
1094
|
+
* individually) has to be recognisable as one, and this is the only place
|
|
1095
|
+
* that correspondence still exists.
|
|
1096
|
+
*
|
|
1097
|
+
* Recorded, never substituted: the struct is still allocated and still
|
|
1098
|
+
* initialized exactly as before, and a member with no reactive dependency
|
|
1099
|
+
* still renders by reading the field.
|
|
1100
|
+
*/
|
|
1101
|
+
/**
|
|
1102
|
+
* Settled before anything renders, from `ir/facts.ts`'s `bodyValueOriginsOf`
|
|
1103
|
+
* (invariant 5, 2.3). The accumulation an object literal needs -- each
|
|
1104
|
+
* `set` carrying the map so far onto its receiver and onto its own result --
|
|
1105
|
+
* is a walk in block order there, which is the same order the stores used to
|
|
1106
|
+
* render in; and the "is this key a constant" test it gates on is now asked
|
|
1107
|
+
* of the `constant` operation the printer's own table was filled from,
|
|
1108
|
+
* rather than of the table.
|
|
1109
|
+
*/
|
|
1110
|
+
readonly recordFieldSources: ReadonlyMap<IrValueId, ReadonlyMap<string, IrOperand>>;
|
|
1111
|
+
/**
|
|
1112
|
+
* Values that came OUT of a reactive field whose own carrier cannot be a
|
|
1113
|
+
* cell, to the C++ lvalue of that field's companion revision cell.
|
|
1114
|
+
*
|
|
1115
|
+
* `this.cells` is an array field: writing an element, or a property of an
|
|
1116
|
+
* element, changes what a list rendered from it should show, and neither
|
|
1117
|
+
* write goes anywhere near the field itself. So the *origin* travels with the
|
|
1118
|
+
* value -- through the element read, through the local the program binds it
|
|
1119
|
+
* to -- and a store through any of them ticks the revision the list is
|
|
1120
|
+
* subscribed to. This is v1's own answer (`cpp-reactive-component.ts` routes
|
|
1121
|
+
* `arr[i] = v` through a notifying wrapper, and its hub path marks nested
|
|
1122
|
+
* writes dirty), computed from the value graph instead of by rewriting
|
|
1123
|
+
* generated text.
|
|
1124
|
+
*
|
|
1125
|
+
* Deliberately an over-approximation in one direction only: a value whose
|
|
1126
|
+
* origin is lost renders a list that does not re-render (the gap that already
|
|
1127
|
+
* existed), never one that re-renders against the wrong array. Nothing here
|
|
1128
|
+
* changes what a read or a write emits; it only adds the tick beside it.
|
|
1129
|
+
*/
|
|
1130
|
+
readonly reactiveOrigins: ReadonlyMap<IrValueId, ReactiveRevisionOrigin>;
|
|
1131
|
+
/** The same origin, surviving the binding cell a program stores it in -- `const cell = this.cells[i]`. */
|
|
1132
|
+
readonly reactiveBindingOrigins: ReadonlyMap<DeclarationId, ReactiveRevisionOrigin>;
|
|
1133
|
+
/** Settled before anything renders by `emit-bindings.ts`'s `hostClassReadsOf` (invariant 5, 2.3), whose doc states the seed and the three propagation steps. */
|
|
1134
|
+
readonly hostClassReads: ReadonlyMap<IrValueId, {
|
|
1135
|
+
readonly kind: 'class' | 'singleton';
|
|
1136
|
+
readonly declaration: DeclarationId;
|
|
1137
|
+
readonly linkageName: string;
|
|
1138
|
+
}>;
|
|
1139
|
+
/** Settled before anything renders by `emit-bindings.ts`'s `classObjectReadsOf`, whose doc states why such a read has no cell. */
|
|
1140
|
+
readonly classObjectReads: ReadonlyMap<IrValueId, DeclarationId>;
|
|
1141
|
+
/**
|
|
1142
|
+
* Host free functions reached but not rendered, to the C++ function each is.
|
|
1143
|
+
*
|
|
1144
|
+
* The same mechanism again, for the third unrenderable thing a host owns. A
|
|
1145
|
+
* host function's name is C++ only where it is CALLED: there is no object of
|
|
1146
|
+
* that name to load, so the read produces nothing and the call renders
|
|
1147
|
+
* `gea::apple::AppKit::installRootViewController(vc)` from what is kept here.
|
|
1148
|
+
* Keeping the spelling rather than the program's name is deliberate -- a
|
|
1149
|
+
* refusal for one used as a value then says which C++ function was meant.
|
|
1150
|
+
*/
|
|
1151
|
+
readonly hostFunctionReads: ReadonlyMap<IrValueId, HostCallSpelling>;
|
|
1152
|
+
/**
|
|
1153
|
+
* Host NAMESPACE paths reached but not rendered, to the program-facing path
|
|
1154
|
+
* each value stands for.
|
|
1155
|
+
*
|
|
1156
|
+
* The fourth unrenderable thing a host owns, and the only one that is not a
|
|
1157
|
+
* leaf: `navigator` is a path, `navigator.bluetooth` is a longer path, and
|
|
1158
|
+
* only `navigator.bluetooth.keyboard.tap(x)` is C++. So a read records the
|
|
1159
|
+
* path, a member access extends it or resolves it against the host's tables,
|
|
1160
|
+
* and a use of the namespace ITSELF as a value refuses by name.
|
|
1161
|
+
*/
|
|
1162
|
+
readonly hostNamespaceReads: ReadonlyMap<IrValueId, string>;
|
|
1163
|
+
/**
|
|
1164
|
+
* Values that DO exist and also carry namespace member spellings.
|
|
1165
|
+
*
|
|
1166
|
+
* `__gea_audioContext` is the case: the host states it as a constant -- a
|
|
1167
|
+
* real object the program may hold and pass -- and states its methods under
|
|
1168
|
+
* that same name, because they really are members of that one object. So the
|
|
1169
|
+
* value renders, and a member reached through it resolves against the same
|
|
1170
|
+
* tables a pure namespace uses.
|
|
1171
|
+
*
|
|
1172
|
+
* Kept apart from `hostNamespaceReads` because the two answer opposite
|
|
1173
|
+
* questions about being used as a value: a pure namespace has no rendering
|
|
1174
|
+
* and must refuse, and this has one and must not.
|
|
1175
|
+
*/
|
|
1176
|
+
readonly hostNamespaceValues: ReadonlyMap<IrValueId, string>;
|
|
1177
|
+
/**
|
|
1178
|
+
* String/Array.prototype method reads reached but not yet rendered --
|
|
1179
|
+
* `hostMemberReads`'s own mechanism, applied to a different receiver family
|
|
1180
|
+
* for a different reason (see `emit-prototype-invoke.ts`'s header). Kept as
|
|
1181
|
+
* its own map rather than folded into `hostMemberReads` so a
|
|
1182
|
+
* `String.prototype`/`Array.prototype` method can never be mistaken for a
|
|
1183
|
+
* `gea::host` protocol member: the two mechanisms share a shape, not a
|
|
1184
|
+
* table. `receiverElement` is the receiver's own element carrier
|
|
1185
|
+
* (`representationKey`-encoded) for an Array read, and `null` for a String
|
|
1186
|
+
* read, which has no element type to re-check against.
|
|
1187
|
+
*/
|
|
1188
|
+
/**
|
|
1189
|
+
* Results moved to a dominating loop preheader by the IR hoist plan.
|
|
1190
|
+
*
|
|
1191
|
+
* Settled by `emitBody`'s census strictly before `sealFactFieldsForRender`
|
|
1192
|
+
* -- see `EmitBodyPrepassFacts`'s own doc for why this and its sixteen
|
|
1193
|
+
* siblings below are handed back through that type rather than through
|
|
1194
|
+
* `EmitBodyFacts`: `irBodyCensusOf`'s own hooks need a `ctx` to already
|
|
1195
|
+
* exist, so these cannot be computed before `createEmitContext` runs. What
|
|
1196
|
+
* still holds is the render-time half of invariant 5: no printer writes
|
|
1197
|
+
* this field, ever, and the type now says so.
|
|
1198
|
+
*/
|
|
1199
|
+
readonly hoistedResults: ReadonlySet<IrValueId>;
|
|
1200
|
+
/** See `hoistedResults`'s doc for why this is settled the same way. */
|
|
1201
|
+
readonly sharedStringLayouts: ReadonlyMap<IrValueId, SharedStringLayout>;
|
|
1202
|
+
readonly prototypeMethodReads: ReadonlyMap<IrValueId, PrototypeMethodRead>;
|
|
1203
|
+
/**
|
|
1204
|
+
* Lazy-arrow-field GETs whose one reader is the call that reads them as its
|
|
1205
|
+
* own callee -- see `class-layout.ts`'s `lazyCalleeReadsOf`, which settles
|
|
1206
|
+
* this the same way `prototypeMethodReads` above is settled (it needs a
|
|
1207
|
+
* built `ctx` -- `abiOfCallable` and `classes` -- so it cannot be computed
|
|
1208
|
+
* before `createEmitContext` runs). `emit-properties.ts`'s `emitGet` reads a
|
|
1209
|
+
* result in this set as a raw, unmaterialized snapshot copy rather than
|
|
1210
|
+
* through `lazyMaterializedFieldText`'s materialize-on-read text, and
|
|
1211
|
+
* `emit-callable.ts`'s `emitLazyArrowFieldCall` reads it back as that
|
|
1212
|
+
* snapshot rather than re-reading the field's current value.
|
|
1213
|
+
*/
|
|
1214
|
+
readonly lazyCalleeReads: ReadonlySet<IrValueId>;
|
|
1215
|
+
readonly bindingNames: Map<DeclarationId, string>;
|
|
1216
|
+
/**
|
|
1217
|
+
* Values whose one emitted statement may be rendered at their single use
|
|
1218
|
+
* instead of into storage of their own.
|
|
1219
|
+
*
|
|
1220
|
+
* The IR is three-address form -- one operation, one named temporary -- and
|
|
1221
|
+
* for a scalar that costs nothing, because the C++ compiler propagates a
|
|
1222
|
+
* `double` copy away entirely. For every other carrier it is a real machine
|
|
1223
|
+
* operation the optimizer may not remove: a `std::shared_ptr` copy is an
|
|
1224
|
+
* atomic increment and a matching decrement, and a `std::string` copy is a
|
|
1225
|
+
* heap allocation. An array read in a loop was paying one atomic pair per
|
|
1226
|
+
* iteration purely to name the array it was already holding.
|
|
1227
|
+
*
|
|
1228
|
+
* `emit.ts`'s `deferrableValuesOf` censuses which values may move, and the
|
|
1229
|
+
* rule it enforces is what makes the move sound: the value has exactly one
|
|
1230
|
+
* use, that use is in the same block, its own operation is side-effect-free,
|
|
1231
|
+
* and every operation between the two is itself deferred. Nothing with an
|
|
1232
|
+
* effect can therefore be crossed, so the reads land in a window in which
|
|
1233
|
+
* nothing writes -- which is why their relative order inside the use's own
|
|
1234
|
+
* expression, which C++ leaves unspecified, cannot be observed.
|
|
1235
|
+
*/
|
|
1236
|
+
/** Results nothing reads, whose operations render nothing -- see `ir/dead-values.ts`. Settled the same way as `hoistedResults`; see that field's doc. */
|
|
1237
|
+
readonly deadValues: ReadonlySet<IrValueId>;
|
|
1238
|
+
/** Effectful producers that must run but whose returned carrier is never read. Settled the same way as `hoistedResults`. */
|
|
1239
|
+
readonly unreadValues: ReadonlySet<IrValueId>;
|
|
1240
|
+
/** Boolean literals by value, so a branch on one renders as the jump it is -- see `emit.ts`'s `emitTerminator`. Settled the same way as `hoistedResults`. */
|
|
1241
|
+
readonly booleanConstants: ReadonlyMap<IrValueId, boolean>;
|
|
1242
|
+
/** SSA cursors used only by their native next/done protocol steps. Settled the same way as `hoistedResults`. */
|
|
1243
|
+
readonly localIterators: ReadonlySet<IrValueId>;
|
|
1244
|
+
/**
|
|
1245
|
+
* Values whose one emitted statement may be rendered at their single use
|
|
1246
|
+
* instead of into storage of their own.
|
|
1247
|
+
*
|
|
1248
|
+
* Three writers, all of them in the prepass: `emitBody` seeds it from
|
|
1249
|
+
* `ir/deferral.ts` and then drops whatever the hoists and the length reuse
|
|
1250
|
+
* claimed, and `emit-arrays.ts`'s `admitDenseWindows` withdraws a value
|
|
1251
|
+
* whose array a preheader has to NAME rather than substitute at each use.
|
|
1252
|
+
* That last one was recorded here for a long time as a RENDER-time write --
|
|
1253
|
+
* it is not, and the belief was never checked against the call graph:
|
|
1254
|
+
* `materializeDenseReference` has exactly one caller, and it is the prepass.
|
|
1255
|
+
* The mistake is worth leaving on the record because it is the shape a stale
|
|
1256
|
+
* comment takes: it named a real function and a real mechanism, and only the
|
|
1257
|
+
* word "render-time" was wrong, which is exactly the word nothing checks.
|
|
1258
|
+
*/
|
|
1259
|
+
readonly deferrable: ReadonlySet<IrValueId>;
|
|
1260
|
+
/** Dominating native length results, selected by the IR reuse proof. Settled the same way as `hoistedResults`. */
|
|
1261
|
+
readonly reusedStringLengths: ReadonlyMap<IrValueId, IrOperand>;
|
|
1262
|
+
/** Withheld values whose single reader is a call, and which therefore reach exactly one operand position -- see `emit.ts`'s `consumedByCall`. Settled the same way as `hoistedResults`. */
|
|
1263
|
+
readonly callArgumentOnly: ReadonlySet<IrValueId>;
|
|
1264
|
+
/**
|
|
1265
|
+
* Every value belonging to a class-map table this body MIGHT spell as a token
|
|
1266
|
+
* list, mapped to the table it belongs to -- `emit-jsx.ts`'s
|
|
1267
|
+
* `classTokenTablesOf`.
|
|
1268
|
+
*
|
|
1269
|
+
* A candidate, not a decision. Whether the table is really spelled away is
|
|
1270
|
+
* settled at the `class` prop, which is the only place that knows whether the
|
|
1271
|
+
* reactive path claimed it, so the allocation and its stores render into
|
|
1272
|
+
* `pendingClassTableLines` and the prop either flushes that buffer or drops
|
|
1273
|
+
* it. Deciding at the allocation instead would mean re-deriving the reactive
|
|
1274
|
+
* answer from facts that are not filled until callables render.
|
|
1275
|
+
*/
|
|
1276
|
+
/**
|
|
1277
|
+
* Functions no copy of which names its receiver, and classes whose
|
|
1278
|
+
* construction nothing can observe -- `ir/instantiation.ts`. Together they
|
|
1279
|
+
* are what lets a `construct` that exists only to manufacture a receiver its
|
|
1280
|
+
* callee ignores be deleted whole; both are whole-program facts, computed
|
|
1281
|
+
* once by `translation-unit.ts` and read here.
|
|
1282
|
+
*/
|
|
1283
|
+
readonly instantiation: InstantiationFacts;
|
|
1284
|
+
/** Whether a callable allocation must mint its function-object identity -- see `ir/callable-identity-demand.ts`; `observesEveryCallableIdentity` for a context built without the program census. */
|
|
1285
|
+
readonly callableIdentityDemand: CallableIdentityDemand;
|
|
1286
|
+
/**
|
|
1287
|
+
* Whether any operation in the unit can freeze, seal or redefine a native
|
|
1288
|
+
* object's properties (`ir/integrity-restrictions.ts`). `false` lets a
|
|
1289
|
+
* native field store skip its writability guard; `true` -- the default for
|
|
1290
|
+
* a context built without the census -- keeps every guard.
|
|
1291
|
+
*/
|
|
1292
|
+
readonly nativeIntegrityRestricted: boolean;
|
|
1293
|
+
/**
|
|
1294
|
+
* Whether a required field's presence bit is a program-wide constant
|
|
1295
|
+
* (`ir/program-facts.ts`'s `fixedFieldStateConstant`: nothing deletes,
|
|
1296
|
+
* freezes, seals or redefines a declared field). `true` lets a field store
|
|
1297
|
+
* skip re-setting a bit that is `true` already -- and that `records.ts` has
|
|
1298
|
+
* made a `static` member; `false` keeps the store.
|
|
1299
|
+
*/
|
|
1300
|
+
readonly fixedFieldStateConstant: boolean;
|
|
1301
|
+
/** Settled from `EmitBodyFacts.classTableRoots` -- see that type's own doc. */
|
|
1302
|
+
readonly classTableRoots: ReadonlyMap<IrValueId, IrValueId>;
|
|
1303
|
+
/** One candidate table's withheld lines, keyed by the table's own value. See `classTableRoots`. */
|
|
1304
|
+
readonly pendingClassTableLines: Map<IrValueId, string[]>;
|
|
1305
|
+
/** The expression each deferred value stands for, recorded by `emit.ts` when its statement is withheld and substituted by `operandText`. */
|
|
1306
|
+
readonly deferredTexts: Map<IrValueId, string>;
|
|
1307
|
+
/**
|
|
1308
|
+
* An array literal withheld whole: its element expressions, in order, rather
|
|
1309
|
+
* than a temporary holding the object they were pushed into.
|
|
1310
|
+
*
|
|
1311
|
+
* `ir/lower-operands.ts`'s `packRestArguments` packs every argument of a
|
|
1312
|
+
* variadic call into one fresh Array, which is exactly right for a callee
|
|
1313
|
+
* that binds `...rest` -- and pure waste for `Array.prototype.push`, whose
|
|
1314
|
+
* emitted form (`emit-prototype-array.ts`) immediately drains that Array back
|
|
1315
|
+
* into the receiver. `arr.push(x)` in a loop was allocating one control block
|
|
1316
|
+
* and one `ArrayObject` per iteration to carry a single element three lines.
|
|
1317
|
+
* Recording the elements lets the bulk-insert renderer push them directly,
|
|
1318
|
+
* and lets any other consumer materialize the same Array as one expression.
|
|
1319
|
+
*/
|
|
1320
|
+
readonly pendingPacks: Map<IrValueId, {
|
|
1321
|
+
readonly elements: readonly string[];
|
|
1322
|
+
readonly elementType: string;
|
|
1323
|
+
}>;
|
|
1324
|
+
/**
|
|
1325
|
+
* How many elements an array allocation is about to be given, when a loop
|
|
1326
|
+
* further down says so.
|
|
1327
|
+
*
|
|
1328
|
+
* Growing a `std::vector` from empty by ten million `push_back`s reallocates
|
|
1329
|
+
* about two dozen times and copies, in total, roughly twice the final
|
|
1330
|
+
* buffer -- for `array_read`'s ten million elements that is 160 MB of
|
|
1331
|
+
* memcpy the program never asked for, and it is the whole of the gap
|
|
1332
|
+
* against a hand-written baseline that opens with `reserve`. The count is a
|
|
1333
|
+
* HINT and nothing depends on it: the loop may push fewer times, more times,
|
|
1334
|
+
* or none, and every one of those still runs correctly. That is what lets
|
|
1335
|
+
* `emit-arrays.ts` take the loop's own bound as the count without proving
|
|
1336
|
+
* the trip count exactly.
|
|
1337
|
+
*
|
|
1338
|
+
* Keyed by the allocation's value; the operand is the bound, already checked
|
|
1339
|
+
* to be nameable at the allocation.
|
|
1340
|
+
*
|
|
1341
|
+
* Not yet `ReadonlyMap`: written by `collectCapacityHints` (`emit-arrays.
|
|
1342
|
+
* ts`) through `ctx` directly -- same follow-up as `formalCells`.
|
|
1343
|
+
*/
|
|
1344
|
+
readonly capacityHints: ReadonlyMap<IrValueId, CapacitySource>;
|
|
1345
|
+
/**
|
|
1346
|
+
* The counted loops whose entire body is one `push` of an unchanging value,
|
|
1347
|
+
* keyed by the loop header whose terminator becomes the append
|
|
1348
|
+
* (`collectFillLoop`, `emit-arrays.ts`). Unlike `capacityHints` this is not a
|
|
1349
|
+
* hint: the block's back edge is replaced, so a wrong entry runs the wrong
|
|
1350
|
+
* program.
|
|
1351
|
+
*
|
|
1352
|
+
* Not yet `ReadonlyMap`, for the same reason `capacityHints` is not.
|
|
1353
|
+
*/
|
|
1354
|
+
readonly fillLoops: ReadonlyMap<IrBlockId, FillLoop>;
|
|
1355
|
+
/**
|
|
1356
|
+
* What `ir/integers.ts` settled before anything renders, because the choice is
|
|
1357
|
+
* whole-body: which `number` values and cells may hold in a `long long`, which
|
|
1358
|
+
* ABI positions the signature declares one (`ir/integer-storage.ts`, spelled by
|
|
1359
|
+
* `formalsOf`), what no loop can change, and which `%` results admit a cheaper
|
|
1360
|
+
* spelling than `gea::remainder`. A cell's storage is settled by its first write.
|
|
1361
|
+
*/
|
|
1362
|
+
readonly narrowedFormals: ReadonlySet<number>;
|
|
1363
|
+
/**
|
|
1364
|
+
* The `parameter` results of the narrowed formals, so a read of one is
|
|
1365
|
+
* known to be a `long long` -- filled by `collectFormalCells`
|
|
1366
|
+
* (`emit-bindings.ts`), which writes it through `ctx` directly. Not
|
|
1367
|
+
* converted with its seventeen siblings: the write site is outside
|
|
1368
|
+
* `emit.ts`/`emit-context.ts`, so eliminating it means changing
|
|
1369
|
+
* `collectFormalCells`'s own signature to return the table instead of
|
|
1370
|
+
* mutating through `ctx` -- real, scoped follow-up, recorded here rather
|
|
1371
|
+
* than smuggled into this pass.
|
|
1372
|
+
*/
|
|
1373
|
+
readonly narrowedFormalValues: ReadonlySet<IrValueId>;
|
|
1374
|
+
/** Shared builtin facts used by the integer census and direct call emission. Settled the same way as `hoistedResults`; see that field's doc. */
|
|
1375
|
+
readonly numericCalls: ReadonlyMap<CallOperation, NumericIntrinsic>;
|
|
1376
|
+
/** Settled the same way as `hoistedResults`. */
|
|
1377
|
+
readonly numericCallOnly: ReadonlySet<IrValueId>;
|
|
1378
|
+
/** Settled the same way as `hoistedResults`. */
|
|
1379
|
+
readonly integerValues: ReadonlySet<IrValueId>;
|
|
1380
|
+
/** Settled the same way as `hoistedResults`. */
|
|
1381
|
+
readonly integerBindings: ReadonlySet<DeclarationId>;
|
|
1382
|
+
/** Finite typeof snapshots proved by the IR, confined to comparison-only uses. Settled the same way as `hoistedResults`. */
|
|
1383
|
+
readonly typeQueryValues: ReadonlySet<IrValueId>;
|
|
1384
|
+
/** Settled the same way as `hoistedResults`. */
|
|
1385
|
+
readonly typeQueryBindings: ReadonlySet<DeclarationId>;
|
|
1386
|
+
/** Settled the same way as `hoistedResults`. */
|
|
1387
|
+
readonly typeQueryComparisons: ReadonlyMap<ComputeOperation, TypeQueryComparison>;
|
|
1388
|
+
/** Settled the same way as `hoistedResults`. */
|
|
1389
|
+
readonly loopInvariantValues: ReadonlySet<IrValueId>;
|
|
1390
|
+
/** Settled the same way as `hoistedResults`. */
|
|
1391
|
+
readonly remainderForms: ReadonlyMap<IrValueId, 'restated' | 'dynamic'>;
|
|
1392
|
+
/**
|
|
1393
|
+
* The dense-loop windows this body admitted, and which window each element
|
|
1394
|
+
* access renders against (`ir/dense-loops.ts`).
|
|
1395
|
+
*
|
|
1396
|
+
* Filled by `emitBody` before anything renders, for the same reason the
|
|
1397
|
+
* integer census is: an access has to know at its own site whether a
|
|
1398
|
+
* preheader already computed a pointer and a flag for it.
|
|
1399
|
+
*
|
|
1400
|
+
* `admitDenseWindows` (`emit-arrays.ts`) is the one writer of this and of
|
|
1401
|
+
* `denseAccesses`/`denseGroups`/`denseLengths` below, and it takes the
|
|
1402
|
+
* `EmitBodyPrepassFacts` handle rather than reaching through `ctx` -- which
|
|
1403
|
+
* is what lets all four be read-only here even though their writer lives in
|
|
1404
|
+
* a file full of renderers.
|
|
1405
|
+
*/
|
|
1406
|
+
readonly denseArrays: readonly DenseArray[];
|
|
1407
|
+
readonly denseAccesses: ReadonlyMap<IrNonTerminatorOperation, DenseAccess>;
|
|
1408
|
+
readonly denseGroups: ReadonlyMap<number, DenseGroup>;
|
|
1409
|
+
/** Reads of a wrapped window's `length` that the preheader already took, by the window's ordinal. */
|
|
1410
|
+
readonly denseLengths: ReadonlyMap<IrValueId, number>;
|
|
1411
|
+
/** Subscripts a wrapped window may take in the integers -- see `denseRemainderCompanion`. */
|
|
1412
|
+
readonly denseIndices: Map<IrValueId, string>;
|
|
1413
|
+
/**
|
|
1414
|
+
* Every `compute` operation this body defines, by the value it produced --
|
|
1415
|
+
* read by `emit-bindings.ts` to recognize a cell's own compound update.
|
|
1416
|
+
*
|
|
1417
|
+
* Settled from `EmitBodyFacts.computeOrigins` (`ir/facts.ts`'s
|
|
1418
|
+
* `bodyValueOriginsOf`): a purely syntactic index over the IR, with no
|
|
1419
|
+
* dependency on render order -- unlike its predecessor, which
|
|
1420
|
+
* `targets/cpp/emit.ts`'s `emitCompute` used to fill as a side effect of
|
|
1421
|
+
* rendering the very operation it indexes.
|
|
1422
|
+
*/
|
|
1423
|
+
readonly computeOrigins: ReadonlyMap<IrValueId, ComputeOperation>;
|
|
1424
|
+
/**
|
|
1425
|
+
* Plain property read origins used to prove that a string store appends to
|
|
1426
|
+
* its own field. Settled from `EmitBodyFacts.propertyReadOrigins` -- see
|
|
1427
|
+
* `computeOrigins`'s doc above for why this moved out of the renderer that
|
|
1428
|
+
* used to fill it (`emit-properties.ts`'s `emitGet`).
|
|
1429
|
+
*/
|
|
1430
|
+
readonly propertyReadOrigins: ReadonlyMap<IrValueId, GetOperation>;
|
|
1431
|
+
/**
|
|
1432
|
+
* The declaration each `binding-read` value loaded from, for the same
|
|
1433
|
+
* recognition. Settled from `EmitBodyFacts.bindingReadDeclarations` -- see
|
|
1434
|
+
* `computeOrigins`'s doc above; this one used to be filled from TWO places
|
|
1435
|
+
* (`emit-bindings.ts`'s `emitBindingRead` for a live read, `emit.ts`'s
|
|
1436
|
+
* `registerDirectCalleeOfDeadValue` for a dead one), which is exactly the
|
|
1437
|
+
* two-authorities shape this refactor removes.
|
|
1438
|
+
*/
|
|
1439
|
+
readonly bindingReadDeclarations: ReadonlyMap<IrValueId, DeclarationId>;
|
|
1440
|
+
/**
|
|
1441
|
+
* Every cell a value transitively READS, over the whole body -- a value's own
|
|
1442
|
+
* `binding-read` declaration unioned with those of every operand that
|
|
1443
|
+
* produced it, to a fixpoint.
|
|
1444
|
+
*
|
|
1445
|
+
* `bindingReadDeclarations` answers this for a value that IS a read. The
|
|
1446
|
+
* question a write-in-place has to ask is one level wider: an argument that
|
|
1447
|
+
* merely *derives* from the cell -- `JSON.stringify(wrap(s))`, a record whose
|
|
1448
|
+
* field is loaded from it -- still reads storage the fill is about to
|
|
1449
|
+
* `clear()`, and asking only whether the argument is itself that read admits
|
|
1450
|
+
* exactly the aliasing a fast path must refuse. Filled before anything
|
|
1451
|
+
* renders, because a use may precede its own producer in emission order.
|
|
1452
|
+
*
|
|
1453
|
+
* Settled from `EmitBodyFacts.valueCellReads` (formerly
|
|
1454
|
+
* `targets/cpp/deferral-safety.ts`'s `collectValueCellReads`, which mutated
|
|
1455
|
+
* this field in place -- the fixpoint itself has no C++ in it, so it moved
|
|
1456
|
+
* to `ir/facts.ts`'s `bodyValueOriginsOf`).
|
|
1457
|
+
*/
|
|
1458
|
+
readonly valueCellReads: ReadonlyMap<IrValueId, ReadonlySet<DeclarationId>>;
|
|
1459
|
+
/** Declarations that have already emitted their one declaring statement in this body; a later write is a plain assignment. */
|
|
1460
|
+
readonly declaredBindings: Set<DeclarationId>;
|
|
1461
|
+
/**
|
|
1462
|
+
* A value whose ONLY use is the binding write that immediately follows it,
|
|
1463
|
+
* and the cell that write fills -- see `emit-json.ts`'s
|
|
1464
|
+
* `jsonStringifyFillLines`.
|
|
1465
|
+
*
|
|
1466
|
+
* Not yet `ReadonlyMap`: written by `collectDirectBindingSinks`
|
|
1467
|
+
* (`emit-bindings.ts`) through `ctx` directly -- same follow-up as
|
|
1468
|
+
* `formalCells`.
|
|
1469
|
+
*/
|
|
1470
|
+
readonly directBindingSinks: ReadonlyMap<IrValueId, DeclarationId>;
|
|
1471
|
+
/**
|
|
1472
|
+
* Cells this body never materializes: written once, read once in the same
|
|
1473
|
+
* effect-free window, and private to this frame, so the write renders
|
|
1474
|
+
* nothing and the read spells the written value (`ir/deferral.ts`'s
|
|
1475
|
+
* `ForwardedBinding`). `const f = fns[(slot + 1) % 16]; total += f(i)` was a
|
|
1476
|
+
* 32-byte `CallableObject` copied into `f`'s cell -- two retains, two
|
|
1477
|
+
* releases and the branch misses that came with them -- to be called once;
|
|
1478
|
+
* the call now runs on the array element in place.
|
|
1479
|
+
*/
|
|
1480
|
+
readonly forwardedBindings: ReadonlyMap<DeclarationId, ForwardedBinding>;
|
|
1481
|
+
/**
|
|
1482
|
+
* Every local this body needs, declared once at the top rather than where it
|
|
1483
|
+
* is first assigned.
|
|
1484
|
+
*
|
|
1485
|
+
* Blocks render as `goto`-labelled straight-line code, and C++ forbids a jump
|
|
1486
|
+
* that enters the scope of a variable with a non-vacuous initializer -- which
|
|
1487
|
+
* every `T v = expr;` is. Hoisting the declarations is what makes a branch
|
|
1488
|
+
* legal at all, and it is also what lets a merge assign one variable from two
|
|
1489
|
+
* different predecessors.
|
|
1490
|
+
*/
|
|
1491
|
+
readonly declarations: {
|
|
1492
|
+
readonly name: string;
|
|
1493
|
+
readonly type: string;
|
|
1494
|
+
}[];
|
|
1495
|
+
/**
|
|
1496
|
+
* Every `Symbol.for(<literal>)` key this UNIT reaches, to the static that
|
|
1497
|
+
* holds it. Shared across bodies -- the map is the translation unit's, not
|
|
1498
|
+
* this body's -- because one key must be one static, and two bodies that name
|
|
1499
|
+
* the same key must name the same one.
|
|
1500
|
+
*
|
|
1501
|
+
* `Symbol.for` is a registry lookup by string, and a lookup per use is a
|
|
1502
|
+
* `std::map` probe on a hot property access. Interning it to a static means
|
|
1503
|
+
* the lookup happens once per unit, and every use afterwards is a load of a
|
|
1504
|
+
* 32-bit id -- which is v1's own answer to the same question (`Symbol.for('gea.*')`
|
|
1505
|
+
* lowered to a static `__geawebsym_*`). Cross-unit identity is unaffected:
|
|
1506
|
+
* each unit's static is initialized THROUGH the registry, so every unit
|
|
1507
|
+
* resolves the same key to the same symbol.
|
|
1508
|
+
*/
|
|
1509
|
+
readonly symbolKeys: Map<string, string>;
|
|
1510
|
+
/**
|
|
1511
|
+
* Every tagged-template site this UNIT reaches, to the accessor that returns
|
|
1512
|
+
* its template object. Shared across bodies for the same reason `symbolKeys`
|
|
1513
|
+
* is -- the map is the translation unit's -- though the sharing does not do
|
|
1514
|
+
* the same work here: two sites never share an entry, because ECMA-262
|
|
1515
|
+
* 13.2.8.3 caches `GetTemplateObject` per PARSE NODE, so two textually
|
|
1516
|
+
* identical template sites are two different objects and deduplicating them
|
|
1517
|
+
* by text would silently merge them.
|
|
1518
|
+
*
|
|
1519
|
+
* Keyed by the site's own semantic result plus its carrier: one Parse Node is
|
|
1520
|
+
* one entry, except where a generic body was emitted at two instantiations,
|
|
1521
|
+
* where the two copies genuinely need two differently-typed statics.
|
|
1522
|
+
*/
|
|
1523
|
+
readonly templateObjects: Map<string, TemplateObjectDefinition>;
|
|
1524
|
+
nextValueOrdinal: number;
|
|
1525
|
+
nextBindingOrdinal: number;
|
|
1526
|
+
}
|
|
1527
|
+
/**
|
|
1528
|
+
* The ABI a capturing body itself reads through, as opposed to the one its
|
|
1529
|
+
* callers push.
|
|
1530
|
+
*
|
|
1531
|
+
* A caller of a callable carrier -- `abiOfCallee`, `emitCall`'s own receiver
|
|
1532
|
+
* check, the thunk's own external signature (`translation-unit.ts`'s
|
|
1533
|
+
* `thunkOf`) -- always consults the *real*, unmodified ABI: an arrow still
|
|
1534
|
+
* takes no receiver argument at its call sites, full stop. Only the body's
|
|
1535
|
+
* own frame needs to know that a receiver it declares no ABI slot for is
|
|
1536
|
+
* nonetheless available, because a nested arrow's `this` captured it from the
|
|
1537
|
+
* enclosing method. Overriding `.receiver` here, in one place, is what lets
|
|
1538
|
+
* `emitReceiver` read it exactly as it already reads an ordinary method's own
|
|
1539
|
+
* `this` -- the capture only moves where the value comes from, not how the
|
|
1540
|
+
* body asks for it.
|
|
1541
|
+
*/
|
|
1542
|
+
export declare const effectiveAbiOf: (abi: CallableAbi | null, admission: CaptureAdmission) => CallableAbi | null;
|
|
1543
|
+
/**
|
|
1544
|
+
* Mutable handles onto the thirty-three settled fields
|
|
1545
|
+
* `EmitContext` exposes as `ReadonlyMap`/`ReadonlySet` -- the SAME Map/Set
|
|
1546
|
+
* instances `ctx` itself carries, under an ordinarily-mutable type.
|
|
1547
|
+
*
|
|
1548
|
+
* `EmitBodyFacts`'s own doc explains why these thirty-three could not join it:
|
|
1549
|
+
* `emitBody`'s census (`irBodyCensusOf`) needs a real, already-built `ctx` to
|
|
1550
|
+
* run at all, because several of its hooks call claims that read OTHER
|
|
1551
|
+
* settled fields off `ctx` (`isPlainMemberRead`, `directClassMethodBody`,
|
|
1552
|
+
* `spellConstants`). So `ctx` has to exist before these thirty-three can be
|
|
1553
|
+
* filled, which rules out computing them up front the way `EmitBodyFacts`
|
|
1554
|
+
* does -- but every one of them is still settled strictly before
|
|
1555
|
+
* `sealFactFieldsForRender` is called (verified by inventory: their only
|
|
1556
|
+
* write sites are `emit.ts`'s own prepass, never a printer), so the render
|
|
1557
|
+
* half of invariant 5 holds regardless. `createEmitContext` returns this
|
|
1558
|
+
* alongside `ctx` so `emitBody`'s prepass keeps the one authorized way to
|
|
1559
|
+
* fill them, while every other reader -- meaning every renderer, in every
|
|
1560
|
+
* other file -- sees only `ctx`'s `ReadonlyMap`/`ReadonlySet` view and cannot
|
|
1561
|
+
* compile a `.set`/`.add`/`.delete` on any of them.
|
|
1562
|
+
*
|
|
1563
|
+
* Nine of them are filled by a collector that does not live in `emit.ts` at
|
|
1564
|
+
* all -- `collectFormalCells`, `collectDirectBindingSinks` (`emit-bindings.
|
|
1565
|
+
* ts`), `collectCapacityHints`, `admitDenseWindows` (`emit-arrays.ts`). Those
|
|
1566
|
+
* take this handle as a parameter rather than reaching through `ctx`, which
|
|
1567
|
+
* is what lets the field stay read-only for everyone else: the collector's
|
|
1568
|
+
* own signature now states that it writes, and a renderer in the same file
|
|
1569
|
+
* still cannot, because it was never handed one. `scripts/architecture.mjs`
|
|
1570
|
+
* used to guard these nine by matching the enclosing FUNCTION NAME of every
|
|
1571
|
+
* `ctx.<field>.set(...)`; that rule is deleted for them, because a type the
|
|
1572
|
+
* compiler checks in every program beats a name a script matches in the
|
|
1573
|
+
* files it happens to scan.
|
|
1574
|
+
*
|
|
1575
|
+
* `deferrable` was the last holdout, on the belief that
|
|
1576
|
+
* `materializeDenseReference` deleted from it mid-render. It does not: its one
|
|
1577
|
+
* caller is `admitDenseWindows`, which runs in the prepass like the rest. The
|
|
1578
|
+
* belief had been written down twice and never checked against the call graph,
|
|
1579
|
+
* which is why it survived three passes over this file.
|
|
1580
|
+
*/
|
|
1581
|
+
export interface EmitBodyPrepassFacts {
|
|
1582
|
+
readonly hoistedResults: Set<IrValueId>;
|
|
1583
|
+
readonly sharedStringLayouts: Map<IrValueId, SharedStringLayout>;
|
|
1584
|
+
readonly reusedStringLengths: Map<IrValueId, IrOperand>;
|
|
1585
|
+
readonly loopInvariantValues: Set<IrValueId>;
|
|
1586
|
+
readonly numericCalls: Map<CallOperation, NumericIntrinsic>;
|
|
1587
|
+
readonly numericCallOnly: Set<IrValueId>;
|
|
1588
|
+
readonly integerValues: Set<IrValueId>;
|
|
1589
|
+
readonly integerBindings: Set<DeclarationId>;
|
|
1590
|
+
readonly typeQueryValues: Set<IrValueId>;
|
|
1591
|
+
readonly typeQueryBindings: Set<DeclarationId>;
|
|
1592
|
+
readonly typeQueryComparisons: Map<ComputeOperation, TypeQueryComparison>;
|
|
1593
|
+
readonly remainderForms: Map<IrValueId, 'restated' | 'dynamic'>;
|
|
1594
|
+
readonly deadValues: Set<IrValueId>;
|
|
1595
|
+
readonly unreadValues: Set<IrValueId>;
|
|
1596
|
+
readonly booleanConstants: Map<IrValueId, boolean>;
|
|
1597
|
+
readonly localIterators: Set<IrValueId>;
|
|
1598
|
+
readonly callArgumentOnly: Set<IrValueId>;
|
|
1599
|
+
readonly prototypeMethodReads: Map<IrValueId, PrototypeMethodRead>;
|
|
1600
|
+
readonly lazyCalleeReads: Set<IrValueId>;
|
|
1601
|
+
readonly directCallReceivers: Map<IrValueId, IrOperand>;
|
|
1602
|
+
readonly virtualCallees: Map<IrValueId, VirtualCallee>;
|
|
1603
|
+
readonly unionMethodReads: Map<IrValueId, UnionMethodRead>;
|
|
1604
|
+
readonly unionMemberTypeofReads: Map<IrValueId, UnionMemberTypeofRead>;
|
|
1605
|
+
readonly reactiveOrigins: Map<IrValueId, ReactiveRevisionOrigin>;
|
|
1606
|
+
readonly reactiveBindingOrigins: Map<DeclarationId, ReactiveRevisionOrigin>;
|
|
1607
|
+
readonly reactiveFieldReads: Map<IrValueId, ReactiveRevisionOrigin>;
|
|
1608
|
+
readonly formalCells: Map<DeclarationId, string>;
|
|
1609
|
+
readonly narrowedFormalValues: Set<IrValueId>;
|
|
1610
|
+
readonly directBindingSinks: Map<IrValueId, DeclarationId>;
|
|
1611
|
+
readonly forwardedBindings: Map<DeclarationId, ForwardedBinding>;
|
|
1612
|
+
readonly capacityHints: Map<IrValueId, CapacitySource>;
|
|
1613
|
+
readonly fillLoops: Map<IrBlockId, FillLoop>;
|
|
1614
|
+
readonly denseArrays: DenseArray[];
|
|
1615
|
+
readonly denseAccesses: Map<IrNonTerminatorOperation, DenseAccess>;
|
|
1616
|
+
readonly denseGroups: Map<number, DenseGroup>;
|
|
1617
|
+
readonly denseLengths: Map<IrValueId, number>;
|
|
1618
|
+
readonly deferrable: Set<IrValueId>;
|
|
1619
|
+
}
|
|
1620
|
+
/** Every deferred direct callee this body's `call` operations resolved to, straight off `CallOperation.target` -- see `EmitContext.directCallees`'s doc. */
|
|
1621
|
+
export declare const directCalleesOf: (body: IrBody, abiOfCallable: (callable: FunctionId) => CallableAbi | null) => {
|
|
1622
|
+
readonly directCallees: ReadonlyMap<IrValueId, string>;
|
|
1623
|
+
readonly directCalleeAbis: ReadonlyMap<IrValueId, CallableAbi>;
|
|
1624
|
+
};
|
|
1625
|
+
export declare const createEmitContext: (abi: CallableAbi | null, owner: FunctionId | RegionId, placements: ReadonlyMap<DeclarationId, BindingPlacement>, classes: ReadonlyMap<DeclarationId, ClassLayout>, hosts: HostSpellings, deriver: RepresentationDeriver, bodyFacts: EmitBodyFacts, wellKnownSymbols?: ReadonlyMap<DeclarationId, string>, captures?: CaptureIndex, symbolKeys?: Map<string, string>, templateObjects?: Map<string, TemplateObjectDefinition>, directCallableBindings?: ReadonlyMap<DeclarationId, FunctionId>, virtualDispatch?: ReadonlyMap<string, CallableAbi>, narrowedFormals?: ReadonlySet<number>, repeatedConstructors?: ReadonlyMap<DeclarationId, DeclarationId>, dyingArguments?: ReadonlySet<IrValueId>, instantiation?: InstantiationFacts, abiOfCallable?: (callable: FunctionId) => CallableAbi | null, hostMethodAliases?: ReadonlyMap<DeclarationId, HostMethodAlias>, callableMemberCandidates?: ReadonlyMap<string, FunctionId>, borrowableMemberBodies?: ReadonlySet<FunctionId>, stableBorrowEntries?: ReadonlyMap<string, StableBorrowEntry>, printerDrift?: PrinterDrift[], conversions?: ConversionCensus | null, nativeSelections?: ReadonlyMap<string, NativeSelectionHelper> | undefined, callableIdentityDemand?: CallableIdentityDemand, nativeIntegrityRestricted?: boolean, fixedFieldStateConstant?: boolean) => {
|
|
1626
|
+
readonly ctx: EmitContext;
|
|
1627
|
+
readonly prepass: EmitBodyPrepassFacts;
|
|
1628
|
+
};
|
|
1629
|
+
/**
|
|
1630
|
+
* Mints this result's name and records the declaration it needs.
|
|
1631
|
+
*
|
|
1632
|
+
* Throws on a second definition: SSA form makes that an internal-consistency
|
|
1633
|
+
* bug, not a missing feature. `spelling` overrides the type only where the
|
|
1634
|
+
* carrier a value is *read* as differs from the one its result declares -- a
|
|
1635
|
+
* receiver read through the ABI's declared receiver slot, for instance.
|
|
1636
|
+
*/
|
|
1637
|
+
/**
|
|
1638
|
+
* `long long` where the integer census narrowed this value, and the carrier's
|
|
1639
|
+
* own spelling everywhere else.
|
|
1640
|
+
*
|
|
1641
|
+
* An explicit spelling always wins: a caller that named the type knows
|
|
1642
|
+
* something this does not.
|
|
1643
|
+
*/
|
|
1644
|
+
export declare const storageTypeOf: (ctx: EmitContext, value: IrValueId, representation: Representation) => string;
|
|
1645
|
+
/**
|
|
1646
|
+
* Whether a value's rendered text is a `long long`, from every storage that
|
|
1647
|
+
* can make it one: the value census (`integerValues`), the cell a read names
|
|
1648
|
+
* (`integerBindings`, through `bindingReadDeclarations`), or the narrowed
|
|
1649
|
+
* formal a parameter reads. `storageTypeOf` answers only the first, which is
|
|
1650
|
+
* right for a value's OWN declaration -- a read of an integer cell is spelled
|
|
1651
|
+
* as the cell's name and declares nothing -- and wrong for a consumer choosing
|
|
1652
|
+
* an overload by the text's type: `examples/apps/weather` indexed its arrays
|
|
1653
|
+
* with `long long` loop counters through `elementAt(double)`, converting the
|
|
1654
|
+
* index to a double and back on every read, 47 times.
|
|
1655
|
+
*/
|
|
1656
|
+
export declare const isIntegerStorageValue: (ctx: EmitContext, value: IrValueId) => boolean;
|
|
1657
|
+
/**
|
|
1658
|
+
* One capture slot's initializer, cast to the field the environment declares.
|
|
1659
|
+
*
|
|
1660
|
+
* The struct's field is `cppTypeOf(slot.representation)` -- the CARRIER -- and
|
|
1661
|
+
* a cell the integer census narrowed is held in a `long long`. A braced init
|
|
1662
|
+
* list forbids that conversion ([dcl.init.list] admits no narrowing), so the
|
|
1663
|
+
* pair that reads fine everywhere else is a hard error here, exactly as it is
|
|
1664
|
+
* for an array literal's elements (`emit-arrays.ts`'s `packElementText`).
|
|
1665
|
+
*/
|
|
1666
|
+
export declare const captureFieldText: (ctx: EmitContext, declaration: DeclarationId, representation: Representation, text: string) => string;
|
|
1667
|
+
export declare const defineValue: (ctx: EmitContext, result: IrResult, spelling?: string) => string;
|
|
1668
|
+
/**
|
|
1669
|
+
* Mints this result's name without hoisting a declaration for it.
|
|
1670
|
+
*
|
|
1671
|
+
* For a value some other C++ construct already declares -- the catch clause's
|
|
1672
|
+
* own parameter is the one case today (`CatchBindingOperation`). The region's
|
|
1673
|
+
* own `catch (const gea::Value& vN)` text IS this value's declaration;
|
|
1674
|
+
* hoisting a second one under the same name would redeclare it.
|
|
1675
|
+
*/
|
|
1676
|
+
export declare const defineValueBoundElsewhere: (ctx: EmitContext, result: IrResult) => string;
|
|
1677
|
+
/**
|
|
1678
|
+
* Publishes this result under storage that already exists, rather than under a
|
|
1679
|
+
* fresh temporary of its own.
|
|
1680
|
+
*
|
|
1681
|
+
* The one use is a read of a HOST OBJECT (`native-handle`) out of its cell. In
|
|
1682
|
+
* the source language that read is not a copy: `const ctx = Display.ctx` binds
|
|
1683
|
+
* a reference to one object, and `ctx.fillStyle = c` then `ctx.fillText(...)`
|
|
1684
|
+
* are two operations on that same object. Minting a temporary and assigning the
|
|
1685
|
+
* cell into it makes each read a fresh C++ VALUE, and every host type that
|
|
1686
|
+
* carries state behind its handle -- `CanvasRenderingContext2D` holds
|
|
1687
|
+
* `batchDepth_`, `presentRecording_`, `fillStyle_`, `fontSizePx_` and the
|
|
1688
|
+
* present-command buffer -- then loses whatever the previous statement set on
|
|
1689
|
+
* it, silently and with no diagnostic. The cell IS the object, so the read
|
|
1690
|
+
* names the cell.
|
|
1691
|
+
*/
|
|
1692
|
+
export declare const defineValueAlias: (ctx: EmitContext, result: IrResult, storage: string) => void;
|
|
1693
|
+
/** Records a local binding cell's declaration, for the same reason values are hoisted. */
|
|
1694
|
+
export declare const declareCell: (ctx: EmitContext, name: string, type: string) => void;
|
|
1695
|
+
/**
|
|
1696
|
+
* Whether a value renders as the expression that computes it rather than as a
|
|
1697
|
+
* cell of its own -- `emitOperation`'s withholding, or a whole withheld array
|
|
1698
|
+
* literal. Such a value is a prvalue at its use: it has no storage anyone could
|
|
1699
|
+
* move FROM, and `std::move` around it is either redundant (gcc's
|
|
1700
|
+
* -Wredundant-move / -Wpessimizing-move, both errors under the boards' -Werror)
|
|
1701
|
+
* or, when the withheld expression happens to name a field, a move out of that
|
|
1702
|
+
* field's storage.
|
|
1703
|
+
*/
|
|
1704
|
+
export declare const isDeferredValue: (ctx: EmitContext, value: IrValueId) => boolean;
|
|
1705
|
+
/** The one name a value was minted under. Reading an undefined value is a dominance bug in the body, not a rendering choice. */
|
|
1706
|
+
export declare const nameOfValue: (ctx: EmitContext, value: IrValueId) => string;
|
|
1707
|
+
/**
|
|
1708
|
+
* A host method is not a value.
|
|
1709
|
+
*
|
|
1710
|
+
* `storage.getItem` names no C++ symbol on its own -- the host states a
|
|
1711
|
+
* spelling for the *call*, `gea::host::storage::getItem(k)`, and there
|
|
1712
|
+
* is nothing to bind the bare access to. So the access publishes no name, and
|
|
1713
|
+
* any use of it other than as a callee is refused here, by name, rather than
|
|
1714
|
+
* crashing on a value that was never minted.
|
|
1715
|
+
*/
|
|
1716
|
+
export declare const operandText: (ctx: EmitContext, operand: IrOperand) => string;
|
|
1717
|
+
/**
|
|
1718
|
+
* The receiver a deferred prototype-method call renders on.
|
|
1719
|
+
*
|
|
1720
|
+
* The mirror of `hostMemberReceiverText` for the other deferral family, and
|
|
1721
|
+
* here for the same reason: the access that recorded the read produced no C++,
|
|
1722
|
+
* so it had no occasion to print anything, and the record it leaves behind
|
|
1723
|
+
* names the operand rather than a spelling of it.
|
|
1724
|
+
*/
|
|
1725
|
+
export declare const prototypeMethodReceiverText: (ctx: EmitContext, receiver: PrototypeMethodReceiver) => string;
|
|
1726
|
+
/** One dense window's element pointer: the array's own storage, named once at the preheader. */
|
|
1727
|
+
export declare const cppDensePointerName: (ordinal: number) => string;
|
|
1728
|
+
/** The row a dense window indexes, when the array is itself an element of another: `grid[i]`, taken once at the preheader. */
|
|
1729
|
+
export declare const cppDenseRowName: (ordinal: number) => string;
|
|
1730
|
+
/** One loop's dense-window condition. Loop-invariant by construction, which is what lets the backend version the loop on it. */
|
|
1731
|
+
export declare const cppDenseFlagName: (group: number) => string;
|
|
1732
|
+
/** A wrapped window's own length, read once at the preheader -- see `DenseLoopPlan.lengths`. */
|
|
1733
|
+
export declare const cppDenseLengthName: (ordinal: number) => string;
|
|
1734
|
+
/** The reciprocal of that length, built once at the preheader rather than re-checked by `gea::preparedDivisor` on every turn. */
|
|
1735
|
+
export declare const cppDenseDivisorName: (ordinal: number) => string;
|
|
1736
|
+
/** The formal this body declares for one ABI position. `translation-unit.ts`'s `formalsOf` spells the same names. */
|
|
1737
|
+
export declare const cppFormalName: (ordinal: number) => string;
|
|
1738
|
+
/** The formal a body declares for the receiver. `translation-unit.ts`'s `formalsOf` spells the same name. */
|
|
1739
|
+
export declare const cppReceiverName = "gea_this";
|
|
1740
|
+
/** The thunk that adapts one function body to the environment-passing invoke pointer a callable carrier holds. */
|
|
1741
|
+
export declare const cppThunkName: (functionId: string) => string;
|
|
1742
|
+
/** The thunk that adapts one class's construct function to the environment-passing construct pointer a constructor carrier holds. */
|
|
1743
|
+
export declare const cppConstructThunkName: (declaration: DeclarationId) => string;
|
|
1744
|
+
/**
|
|
1745
|
+
* The same pointer for a pre-`class` JavaScript constructor FUNCTION, whose
|
|
1746
|
+
* construction has no separate construct function to adapt: one body serves
|
|
1747
|
+
* both entry points, so the thunk itself is where the instance is allocated
|
|
1748
|
+
* (`translation-unit.ts`'s `constructThunkOf`). Keyed by the function rather
|
|
1749
|
+
* than by a declaration, because that is the identity the carrier's allocation
|
|
1750
|
+
* site names (`emit-callable.ts`'s `emitAllocateCallable`).
|
|
1751
|
+
*/
|
|
1752
|
+
export declare const cppConstructedThunkName: (functionId: string) => string;
|
|
1753
|
+
/**
|
|
1754
|
+
* The environment struct one capturing function's closure allocates.
|
|
1755
|
+
*
|
|
1756
|
+
* One struct per capturing function, not one shared layout: two closures
|
|
1757
|
+
* capture different cells in general, and a shared struct would need every
|
|
1758
|
+
* field every closure ever captures, most of them unused in most instances.
|
|
1759
|
+
*/
|
|
1760
|
+
export declare const cppEnvironmentStructName: (functionId: string) => string;
|
|
1761
|
+
/** One captured cell's field inside its function's environment struct, in capture order. `translation-unit.ts`'s thunk unpacking spells the same name. */
|
|
1762
|
+
export declare const cppCaptureFieldName: (index: number) => string;
|
|
1763
|
+
/** The captured-receiver's own field, kept apart from `cppCaptureFieldName` because it has no capture-order index -- there is at most one per environment. */
|
|
1764
|
+
export declare const cppCaptureReceiverFieldName = "crecv";
|
|
1765
|
+
/** The thunk's own `void*` formal, named only when a body actually has an environment to unpack. */
|
|
1766
|
+
export declare const cppEnvironmentParamName = "gea_env";
|
|
1767
|
+
/** The local the thunk casts `cppEnvironmentParamName` to, so the body call and the field reads inside a captured body share one pointer. */
|
|
1768
|
+
export declare const cppEnvironmentLocalName = "gea_e";
|
|
1769
|
+
/** The thunk's own one-pointer stack storage, which a captured state small enough to travel inside the carrier's pointer is copied back into. */
|
|
1770
|
+
export declare const cppEnvironmentSlotName = "gea_env_slot";
|
|
1771
|
+
/**
|
|
1772
|
+
* The environment actual a capturing accessor's body is called with, read in
|
|
1773
|
+
* place out of the object that carries it.
|
|
1774
|
+
*
|
|
1775
|
+
* An accessor is reached by NAME off the shape, so unlike a closure it has no
|
|
1776
|
+
* carrier to hold its captures: the object carries them
|
|
1777
|
+
* (`cppRecordAccessorEnvironmentName`, packed at the allocation). Reading it
|
|
1778
|
+
* back is an EXPRESSION -- `gea::storedEnvironment` casts the member in place
|
|
1779
|
+
* rather than copying an inline environment into a stack slot the way a
|
|
1780
|
+
* thunk's `unpackEnvironment` must -- which is what lets every accessor call
|
|
1781
|
+
* site, including the ones that render a whole call as one expression
|
|
1782
|
+
* (`emit-iterator.ts`), pass it without first emitting statements.
|
|
1783
|
+
*/
|
|
1784
|
+
export declare const storedEnvironmentText: (body: string, member: string) => string;
|
|
1785
|
+
/**
|
|
1786
|
+
* The payload needed to read a property or invoke a nullable carrier.
|
|
1787
|
+
* Optional chaining guards this access, but a TypeScript non-null assertion
|
|
1788
|
+
* erases and proves nothing at runtime. Check presence before unwrapping so
|
|
1789
|
+
* `a!.b` and `(a?.b)!.c` throw on absence instead of dereferencing a default
|
|
1790
|
+
* payload. Name the payload once even when a recipe uses it twice.
|
|
1791
|
+
*/
|
|
1792
|
+
export declare const unwrapPresentValue: (ctx: EmitContext, lines: string[], operand: IrOperand) => IrOperand;
|
|
1793
|
+
/**
|
|
1794
|
+
* The arguments a call actually passes, padded out to the frame the callee
|
|
1795
|
+
* declares.
|
|
1796
|
+
*
|
|
1797
|
+
* A JavaScript call may pass fewer arguments than the function has parameters,
|
|
1798
|
+
* and the parameters it skipped are `undefined` -- so a parameter that may be
|
|
1799
|
+
* omitted is carried as an `optional`, and the frame still has a slot for it.
|
|
1800
|
+
* C++ has no such rule: `construct()` against a
|
|
1801
|
+
* `ConstructorObject<T(Optional<double>, Optional<double>, ...)>` is "too few
|
|
1802
|
+
* arguments", full stop. `new Quaternion()` against `constructor(w = 1, x = 0,
|
|
1803
|
+
* y = 0, z = 0)` is exactly that call.
|
|
1804
|
+
*
|
|
1805
|
+
* So the absence is passed, not assumed. Only a slot whose own carrier states
|
|
1806
|
+
* the absence `undefined` can hold an omitted argument; a slot that cannot is
|
|
1807
|
+
* refused by name rather than default-constructed into whatever its carrier
|
|
1808
|
+
* happens to allow -- an `optional` tagged `null` would answer a later
|
|
1809
|
+
* `=== null` with `true`, which is a wrong answer and not a spelling gap. A
|
|
1810
|
+
* rest slot is refused here too: what a caller owes a rest parameter is an
|
|
1811
|
+
* allocated array, and building one is lowering's, not this line's.
|
|
1812
|
+
*
|
|
1813
|
+
* Shared between the generic callable-carrier invoke path (`emit-callable.ts`)
|
|
1814
|
+
* and the plugin-stated host construct-template path (`emit-host-invoke.ts`'s
|
|
1815
|
+
* `nativeHandleInvocationText`): a host that states a fixed-arity construct
|
|
1816
|
+
* template for a protocol whose checker signature has a trailing optional
|
|
1817
|
+
* parameter (`new MediaRecorder(stream)` against `new (stream, options?)`)
|
|
1818
|
+
* needs the identical padding a generic constructor carrier already gets --
|
|
1819
|
+
* without it, only the call sites that happen to pass every optional argument
|
|
1820
|
+
* explicitly would emit, and the ones that rely on the parameter's own
|
|
1821
|
+
* optionality would refuse for no reason the host template states.
|
|
1822
|
+
*/
|
|
1823
|
+
export declare const paddedArguments: (abi: CallableAbi, args: readonly string[], what: string) => readonly string[];
|
|
1824
|
+
/**
|
|
1825
|
+
* The identifier this unit uses for one `Symbol.for` key, minting it on first
|
|
1826
|
+
* ask.
|
|
1827
|
+
*
|
|
1828
|
+
* The ordinal, not the sanitized text, is what makes the name unique: two
|
|
1829
|
+
* different keys can sanitize identically (`gea.d.dirty` and `gea/d/dirty`),
|
|
1830
|
+
* and a name collision between two distinct symbols would be a silently wrong
|
|
1831
|
+
* program rather than a build error. The text is still in the name because a
|
|
1832
|
+
* reader of the emitted C++ should be able to see which key a static is.
|
|
1833
|
+
*/
|
|
1834
|
+
export declare const internSymbolKey: (symbolKeys: Map<string, string>, key: string) => string;
|
|
1835
|
+
/**
|
|
1836
|
+
* The namespace-scope definitions for every key this unit interned.
|
|
1837
|
+
*
|
|
1838
|
+
* `inline` so a split build's units share one object rather than one each --
|
|
1839
|
+
* and even where they do not (a key only one unit interns), correctness does
|
|
1840
|
+
* not depend on it: the initializer goes THROUGH `gea::symbolFor`, so two
|
|
1841
|
+
* separate statics for one key still resolve to the same registry entry.
|
|
1842
|
+
*
|
|
1843
|
+
* Emitted ahead of every body, because C++ requires a name to be declared
|
|
1844
|
+
* before it is used and these are used from inside bodies.
|
|
1845
|
+
*/
|
|
1846
|
+
export declare const symbolKeyDefinitions: (symbolKeys: ReadonlyMap<string, string>) => readonly string[];
|
|
1847
|
+
/**
|
|
1848
|
+
* One tagged-template site's per-site template object: the accessor a body
|
|
1849
|
+
* calls, and the namespace-scope definition that holds the object itself.
|
|
1850
|
+
*/
|
|
1851
|
+
export interface TemplateObjectDefinition {
|
|
1852
|
+
readonly name: string;
|
|
1853
|
+
readonly text: string;
|
|
1854
|
+
/** The one C++ carrier every specialization view of this parse site must share. */
|
|
1855
|
+
readonly holder: string;
|
|
1856
|
+
}
|
|
1857
|
+
/**
|
|
1858
|
+
* Reserves this site's accessor and records its definition.
|
|
1859
|
+
*
|
|
1860
|
+
* The `static` inside the accessor is what makes the object per-site: it is
|
|
1861
|
+
* initialized on the first call and every later call returns the SAME object,
|
|
1862
|
+
* which is exactly `GetTemplateObject`'s per-Parse-Node cache (ECMA-262
|
|
1863
|
+
* 13.2.8.3) and the property a tag's own `WeakMap` cache depends on. A
|
|
1864
|
+
* function-local `static` rather than a namespace-scope object because the
|
|
1865
|
+
* initializer builds a `shared_ptr` graph, and a namespace-scope one would run
|
|
1866
|
+
* during static initialization, before the runtime this unit links against is
|
|
1867
|
+
* necessarily up.
|
|
1868
|
+
*
|
|
1869
|
+
* `inline` so a split build's units share one definition instead of one each --
|
|
1870
|
+
* and unlike an interned symbol key, that sharing is load-bearing rather than
|
|
1871
|
+
* an optimization: two copies of one site's object would be two objects, which
|
|
1872
|
+
* is the one thing this may not be.
|
|
1873
|
+
*/
|
|
1874
|
+
export declare const internTemplateObject: (templateObjects: Map<string, TemplateObjectDefinition>, operation: {
|
|
1875
|
+
readonly lineage: SemanticResultId | null;
|
|
1876
|
+
readonly result: IrResult;
|
|
1877
|
+
}, holder: string, body: readonly string[]) => string;
|
|
1878
|
+
/** The namespace-scope definitions for every tagged-template site this unit reached, emitted ahead of the bodies that call them. */
|
|
1879
|
+
export declare const templateObjectDefinitions: (templateObjects: ReadonlyMap<string, TemplateObjectDefinition>) => readonly string[];
|
|
1880
|
+
export { bindingReference } from './emit-binding-reference.js';
|
|
1881
|
+
/** Seals every fact collection on `ctx` for the caller's render, and returns the undo. */
|
|
1882
|
+
export declare const sealFactFieldsForRender: (ctx: EmitContext) => (() => void);
|