@scriptc/compiler 0.4.2 → 0.4.3
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/ambient/scriptc-node-fallback.d.ts +397 -37
- package/dist/backend/cycle-analysis.d.ts +4 -1
- package/dist/backend/cycle-analysis.js +6 -4
- package/dist/backend/cycle-analysis.js.map +1 -1
- package/dist/backend/cycle-analysis.test.js +55 -0
- package/dist/backend/cycle-analysis.test.js.map +1 -1
- package/dist/backend/cycle-mutability.d.ts +7 -0
- package/dist/backend/cycle-mutability.js +19 -1
- package/dist/backend/cycle-mutability.js.map +1 -1
- package/dist/backend/executable-features.js +2 -0
- package/dist/backend/executable-features.js.map +1 -1
- package/dist/backend/immutability.d.ts +6 -3
- package/dist/backend/immutability.js +33 -29
- package/dist/backend/immutability.js.map +1 -1
- package/dist/backend/library-pack.js +1 -0
- package/dist/backend/library-pack.js.map +1 -1
- package/dist/backend/llvm/alloc.d.ts +16 -1
- package/dist/backend/llvm/alloc.js +54 -4
- package/dist/backend/llvm/alloc.js.map +1 -1
- package/dist/backend/llvm/appended-array-literals.d.ts +2 -1
- package/dist/backend/llvm/appended-array-literals.js +44 -36
- package/dist/backend/llvm/appended-array-literals.js.map +1 -1
- package/dist/backend/llvm/appended-array-literals.test.js +4 -3
- package/dist/backend/llvm/appended-array-literals.test.js.map +1 -1
- package/dist/backend/llvm/array-search.d.ts +4 -3
- package/dist/backend/llvm/array-search.js +21 -9
- package/dist/backend/llvm/array-search.js.map +1 -1
- package/dist/backend/llvm/blocks.d.ts +1 -1
- package/dist/backend/llvm/blocks.js +2 -2
- package/dist/backend/llvm/blocks.js.map +1 -1
- package/dist/backend/llvm/byte-windows.js +2 -0
- package/dist/backend/llvm/byte-windows.js.map +1 -1
- package/dist/backend/llvm/bytes-alias.d.ts +6 -1
- package/dist/backend/llvm/bytes-alias.js +8 -2
- package/dist/backend/llvm/bytes-alias.js.map +1 -1
- package/dist/backend/llvm/bytes-loop-versions.d.ts +47 -5
- package/dist/backend/llvm/bytes-loop-versions.js +473 -32
- package/dist/backend/llvm/bytes-loop-versions.js.map +1 -1
- package/dist/backend/llvm/bytes-loop-versions.test.js +258 -2
- package/dist/backend/llvm/bytes-loop-versions.test.js.map +1 -1
- package/dist/backend/llvm/checked-value-lifetimes.js +2 -0
- package/dist/backend/llvm/checked-value-lifetimes.js.map +1 -1
- package/dist/backend/llvm/classes.d.ts +7 -5
- package/dist/backend/llvm/classes.js +44 -20
- package/dist/backend/llvm/classes.js.map +1 -1
- package/dist/backend/llvm/classes.test.js +167 -7
- package/dist/backend/llvm/classes.test.js.map +1 -1
- package/dist/backend/llvm/common.d.ts +9 -3
- package/dist/backend/llvm/common.js +9 -3
- package/dist/backend/llvm/common.js.map +1 -1
- package/dist/backend/llvm/constant-callbacks.d.ts +2 -1
- package/dist/backend/llvm/constant-callbacks.js +83 -52
- package/dist/backend/llvm/constant-callbacks.js.map +1 -1
- package/dist/backend/llvm/counted-loops.d.ts +7 -0
- package/dist/backend/llvm/counted-loops.js +18 -0
- package/dist/backend/llvm/counted-loops.js.map +1 -1
- package/dist/backend/llvm/dense-array-access.d.ts +39 -8
- package/dist/backend/llvm/dense-array-access.js +222 -52
- package/dist/backend/llvm/dense-array-access.js.map +1 -1
- package/dist/backend/llvm/dense-array-access.test.js +36 -0
- package/dist/backend/llvm/dense-array-access.test.js.map +1 -1
- package/dist/backend/llvm/dense-array-loops.d.ts +17 -1
- package/dist/backend/llvm/dense-array-loops.js +194 -5
- package/dist/backend/llvm/dense-array-loops.js.map +1 -1
- package/dist/backend/llvm/dense-array-loops.test.js +90 -1
- package/dist/backend/llvm/dense-array-loops.test.js.map +1 -1
- package/dist/backend/llvm/dyn-handle-tags.test.js +6 -1
- package/dist/backend/llvm/dyn-handle-tags.test.js.map +1 -1
- package/dist/backend/llvm/dyn.d.ts +26 -0
- package/dist/backend/llvm/dyn.js +352 -61
- package/dist/backend/llvm/dyn.js.map +1 -1
- package/dist/backend/llvm/emit-function.js +11 -20
- package/dist/backend/llvm/emit-function.js.map +1 -1
- package/dist/backend/llvm/emit-journal.d.ts +93 -0
- package/dist/backend/llvm/emit-journal.js +170 -0
- package/dist/backend/llvm/emit-journal.js.map +1 -0
- package/dist/backend/llvm/emit-module.js +195 -27
- package/dist/backend/llvm/emit-module.js.map +1 -1
- package/dist/backend/llvm/emit-statements.d.ts +0 -4
- package/dist/backend/llvm/emit-statements.js +268 -84
- package/dist/backend/llvm/emit-statements.js.map +1 -1
- package/dist/backend/llvm/emitter-state.d.ts +7 -0
- package/dist/backend/llvm/emitter-state.js +14 -0
- package/dist/backend/llvm/emitter-state.js.map +1 -0
- package/dist/backend/llvm/emitter.d.ts +176 -37
- package/dist/backend/llvm/emitter.js +724 -85
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/backend/llvm/emitter.test.js +54 -5
- package/dist/backend/llvm/emitter.test.js.map +1 -1
- package/dist/backend/llvm/expr-bytes.js +34 -12
- package/dist/backend/llvm/expr-bytes.js.map +1 -1
- package/dist/backend/llvm/expr-callbacks.js +47 -0
- package/dist/backend/llvm/expr-callbacks.js.map +1 -1
- package/dist/backend/llvm/expr-calls.js +28 -14
- package/dist/backend/llvm/expr-calls.js.map +1 -1
- package/dist/backend/llvm/expr-containers.d.ts +14 -2
- package/dist/backend/llvm/expr-containers.js +129 -37
- package/dist/backend/llvm/expr-containers.js.map +1 -1
- package/dist/backend/llvm/expr-context.d.ts +14 -0
- package/dist/backend/llvm/expr-dynamic.js +18 -11
- package/dist/backend/llvm/expr-dynamic.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.js +100 -28
- package/dist/backend/llvm/expr-primitives.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.test.js +11 -6
- package/dist/backend/llvm/expr-primitives.test.js.map +1 -1
- package/dist/backend/llvm/expr-records.d.ts +12 -0
- package/dist/backend/llvm/expr-records.js +106 -0
- package/dist/backend/llvm/expr-records.js.map +1 -1
- package/dist/backend/llvm/expr-stream-bridges.d.ts +2 -2
- package/dist/backend/llvm/expr-stream-bridges.js +194 -65
- package/dist/backend/llvm/expr-stream-bridges.js.map +1 -1
- package/dist/backend/llvm/expr-stream-bridges.test.js +1 -1
- package/dist/backend/llvm/expr-stream-bridges.test.js.map +1 -1
- package/dist/backend/llvm/expr-stream-callbacks.d.ts +2 -2
- package/dist/backend/llvm/expr-stream-callbacks.js +74 -20
- package/dist/backend/llvm/expr-stream-callbacks.js.map +1 -1
- package/dist/backend/llvm/int32-kind-loops.d.ts +39 -0
- package/dist/backend/llvm/int32-kind-loops.js +106 -0
- package/dist/backend/llvm/int32-kind-loops.js.map +1 -0
- package/dist/backend/llvm/integer-or-nan-indexes.test.d.ts +1 -0
- package/dist/backend/llvm/integer-or-nan-indexes.test.js +118 -0
- package/dist/backend/llvm/integer-or-nan-indexes.test.js.map +1 -0
- package/dist/backend/llvm/integer-values.d.ts +20 -1
- package/dist/backend/llvm/integer-values.js +71 -0
- package/dist/backend/llvm/integer-values.js.map +1 -1
- package/dist/backend/llvm/js-ic.d.ts +1 -1
- package/dist/backend/llvm/js-ic.js +1 -1
- package/dist/backend/llvm/js-ic.js.map +1 -1
- package/dist/backend/llvm/key-orders.d.ts +7 -0
- package/dist/backend/llvm/key-orders.js +33 -0
- package/dist/backend/llvm/key-orders.js.map +1 -0
- package/dist/backend/llvm/lib-connect.js +4 -0
- package/dist/backend/llvm/lib-connect.js.map +1 -1
- package/dist/backend/llvm/lib-datagram.js +11 -0
- package/dist/backend/llvm/lib-datagram.js.map +1 -1
- package/dist/backend/llvm/lib-dispatch.js +80 -2
- package/dist/backend/llvm/lib-dispatch.js.map +1 -1
- package/dist/backend/llvm/lib-filesystem.js +4 -4
- package/dist/backend/llvm/lib-filesystem.js.map +1 -1
- package/dist/backend/llvm/lib-http2.js +4 -0
- package/dist/backend/llvm/lib-http2.js.map +1 -1
- package/dist/backend/llvm/lib-lookup.js +16 -6
- package/dist/backend/llvm/lib-lookup.js.map +1 -1
- package/dist/backend/llvm/lib-shared.js +73 -2
- package/dist/backend/llvm/lib-shared.js.map +1 -1
- package/dist/backend/llvm/lib-stream.js +35 -5
- package/dist/backend/llvm/lib-stream.js.map +1 -1
- package/dist/backend/llvm/local-array-reads.js +115 -19
- package/dist/backend/llvm/local-array-reads.js.map +1 -1
- package/dist/backend/llvm/local-array-reads.test.js +14 -0
- package/dist/backend/llvm/local-array-reads.test.js.map +1 -1
- package/dist/backend/llvm/loop-state.d.ts +33 -0
- package/dist/backend/llvm/loop-state.js +42 -0
- package/dist/backend/llvm/loop-state.js.map +1 -0
- package/dist/backend/llvm/map-number-lookup.d.ts +26 -8
- package/dist/backend/llvm/map-number-lookup.js +91 -31
- package/dist/backend/llvm/map-number-lookup.js.map +1 -1
- package/dist/backend/llvm/map-number-lookup.test.js +55 -0
- package/dist/backend/llvm/map-number-lookup.test.js.map +1 -1
- package/dist/backend/llvm/map-read-lifetimes.js +4 -2
- package/dist/backend/llvm/map-read-lifetimes.js.map +1 -1
- package/dist/backend/llvm/nullable-unions.d.ts +2 -1
- package/dist/backend/llvm/nullable-unions.js +15 -3
- package/dist/backend/llvm/nullable-unions.js.map +1 -1
- package/dist/backend/llvm/publish.d.ts +10 -0
- package/dist/backend/llvm/publish.js +12 -0
- package/dist/backend/llvm/publish.js.map +1 -1
- package/dist/backend/llvm/receivers.js +6 -1
- package/dist/backend/llvm/receivers.js.map +1 -1
- package/dist/backend/llvm/record-results.d.ts +1 -9
- package/dist/backend/llvm/record-results.js +2 -11
- package/dist/backend/llvm/record-results.js.map +1 -1
- package/dist/backend/llvm/reference-writes.d.ts +7 -2
- package/dist/backend/llvm/reference-writes.js +89 -72
- package/dist/backend/llvm/reference-writes.js.map +1 -1
- package/dist/backend/llvm/running-extrema.d.ts +11 -0
- package/dist/backend/llvm/running-extrema.js +115 -0
- package/dist/backend/llvm/running-extrema.js.map +1 -0
- package/dist/backend/llvm/running-extrema.test.d.ts +1 -0
- package/dist/backend/llvm/running-extrema.test.js +89 -0
- package/dist/backend/llvm/running-extrema.test.js.map +1 -0
- package/dist/backend/llvm/shapes.d.ts +71 -15
- package/dist/backend/llvm/shapes.js +222 -33
- package/dist/backend/llvm/shapes.js.map +1 -1
- package/dist/backend/llvm/shapes.test.js +53 -7
- package/dist/backend/llvm/shapes.test.js.map +1 -1
- package/dist/backend/llvm/speculative-integers.d.ts +6 -0
- package/dist/backend/llvm/speculative-integers.js +2 -2
- package/dist/backend/llvm/speculative-integers.js.map +1 -1
- package/dist/backend/llvm/stack-objects.d.ts +3 -2
- package/dist/backend/llvm/stack-objects.js +5 -2
- package/dist/backend/llvm/stack-objects.js.map +1 -1
- package/dist/backend/llvm/string-reads.d.ts +12 -0
- package/dist/backend/llvm/string-reads.js +44 -0
- package/dist/backend/llvm/string-reads.js.map +1 -1
- package/dist/backend/llvm/walk-borrows.d.ts +3 -0
- package/dist/backend/llvm/walk-borrows.js +46 -41
- package/dist/backend/llvm/walk-borrows.js.map +1 -1
- package/dist/backend/llvm/walkers.d.ts +3 -0
- package/dist/backend/llvm/walkers.js +88 -65
- package/dist/backend/llvm/walkers.js.map +1 -1
- package/dist/backend/llvm/wrapping-sums.d.ts +16 -1
- package/dist/backend/llvm/wrapping-sums.js +126 -0
- package/dist/backend/llvm/wrapping-sums.js.map +1 -1
- package/dist/backend/may-throw.d.ts +8 -10
- package/dist/backend/may-throw.js +14 -10
- package/dist/backend/may-throw.js.map +1 -1
- package/dist/backend/native/contracts.d.ts +5 -0
- package/dist/backend/native/executable.js +7 -0
- package/dist/backend/native/executable.js.map +1 -1
- package/dist/backend/native/runtime-inputs.d.ts +1 -1
- package/dist/backend/native/runtime-inputs.js +1 -0
- package/dist/backend/native/runtime-inputs.js.map +1 -1
- package/dist/backend/native-link-info-core.d.ts +4 -0
- package/dist/backend/native-link-info-core.js.map +1 -1
- package/dist/backend/publication.d.ts +12 -1
- package/dist/backend/publication.js +37 -14
- package/dist/backend/publication.js.map +1 -1
- package/dist/backend/publication.test.js +30 -0
- package/dist/backend/publication.test.js.map +1 -1
- package/dist/backend/result-slots.d.ts +16 -0
- package/dist/backend/result-slots.js +23 -0
- package/dist/backend/result-slots.js.map +1 -0
- package/dist/backend/runtime-abi.d.ts +2 -2
- package/dist/backend/runtime-abi.js +2 -2
- package/dist/backend/runtime-pack-core.d.ts +1 -0
- package/dist/backend/runtime-pack-core.js +1 -0
- package/dist/backend/runtime-pack-core.js.map +1 -1
- package/dist/backend/runtime-pack-targets.test.js +2 -1
- package/dist/backend/runtime-pack-targets.test.js.map +1 -1
- package/dist/backend/runtime-pack.test.js +2 -1
- package/dist/backend/runtime-pack.test.js.map +1 -1
- package/dist/backend/stack-observations.d.ts +2 -1
- package/dist/backend/stack-observations.js +67 -42
- package/dist/backend/stack-observations.js.map +1 -1
- package/dist/backend/target-diagnostics.js +5 -3
- package/dist/backend/target-diagnostics.js.map +1 -1
- package/dist/backend/warm-cache.js +1 -0
- package/dist/backend/warm-cache.js.map +1 -1
- package/dist/cli/usage.d.ts +1 -1
- package/dist/cli/usage.js +3 -3
- package/dist/compat/fetch-profile.js +1 -1
- package/dist/compat/fetch-profile.js.map +1 -1
- package/dist/contracts/check.js +4 -3
- package/dist/contracts/check.js.map +1 -1
- package/dist/contracts/int32-elements.js +10 -2
- package/dist/contracts/int32-elements.js.map +1 -1
- package/dist/coverage/report.js +12 -3
- package/dist/coverage/report.js.map +1 -1
- package/dist/diagnostics/diagnostic.d.ts +4 -0
- package/dist/diagnostics/diagnostic.js.map +1 -1
- package/dist/diagnostics/envelope.d.ts +3 -0
- package/dist/diagnostics/envelope.js +1 -0
- package/dist/diagnostics/envelope.js.map +1 -1
- package/dist/executable/executable-cache.d.ts +2 -0
- package/dist/executable/executable-cache.js +1 -0
- package/dist/executable/executable-cache.js.map +1 -1
- package/dist/executable/executable-cache.test.js +1 -0
- package/dist/executable/executable-cache.test.js.map +1 -1
- package/dist/frontend/decl-projection.d.ts +41 -0
- package/dist/frontend/decl-projection.js +854 -0
- package/dist/frontend/decl-projection.js.map +1 -0
- package/dist/frontend/decl-projection.test.d.ts +1 -0
- package/dist/frontend/decl-projection.test.js +30 -0
- package/dist/frontend/decl-projection.test.js.map +1 -0
- package/dist/frontend/dts-paths.d.ts +15 -0
- package/dist/frontend/dts-paths.js +25 -0
- package/dist/frontend/dts-paths.js.map +1 -1
- package/dist/frontend/input-tracker.d.ts +6 -0
- package/dist/frontend/input-tracker.js +51 -28
- package/dist/frontend/input-tracker.js.map +1 -1
- package/dist/frontend/input-tracker.test.js +19 -0
- package/dist/frontend/input-tracker.test.js.map +1 -1
- package/dist/frontend/lowering/array-values.js +100 -2
- package/dist/frontend/lowering/array-values.js.map +1 -1
- package/dist/frontend/lowering/builtins/child-process-methods.js +46 -15
- package/dist/frontend/lowering/builtins/child-process-methods.js.map +1 -1
- package/dist/frontend/lowering/builtins/child-process.js +13 -2
- package/dist/frontend/lowering/builtins/child-process.js.map +1 -1
- package/dist/frontend/lowering/builtins/crypto.js +84 -9
- package/dist/frontend/lowering/builtins/crypto.js.map +1 -1
- package/dist/frontend/lowering/builtins/global-namespace-keys.d.ts +3 -0
- package/dist/frontend/lowering/builtins/global-namespace-keys.js +122 -0
- package/dist/frontend/lowering/builtins/global-namespace-keys.js.map +1 -0
- package/dist/frontend/lowering/builtins/numbers.js +9 -1
- package/dist/frontend/lowering/builtins/numbers.js.map +1 -1
- package/dist/frontend/lowering/builtins/promises.d.ts +6 -0
- package/dist/frontend/lowering/builtins/promises.js +88 -2
- package/dist/frontend/lowering/builtins/promises.js.map +1 -1
- package/dist/frontend/lowering/builtins/readline.d.ts +5 -1
- package/dist/frontend/lowering/builtins/readline.js +35 -3
- package/dist/frontend/lowering/builtins/readline.js.map +1 -1
- package/dist/frontend/lowering/builtins/url.js +24 -1
- package/dist/frontend/lowering/builtins/url.js.map +1 -1
- package/dist/frontend/lowering/builtins/webassembly.js +6 -3
- package/dist/frontend/lowering/builtins/webassembly.js.map +1 -1
- package/dist/frontend/lowering/class-callbacks.d.ts +5 -2
- package/dist/frontend/lowering/class-callbacks.js +82 -12
- package/dist/frontend/lowering/class-callbacks.js.map +1 -1
- package/dist/frontend/lowering/class-construction.d.ts +4 -1
- package/dist/frontend/lowering/class-construction.js +17 -3
- package/dist/frontend/lowering/class-construction.js.map +1 -1
- package/dist/frontend/lowering/class-dynamic-dispatch.d.ts +39 -2
- package/dist/frontend/lowering/class-dynamic-dispatch.js +766 -108
- package/dist/frontend/lowering/class-dynamic-dispatch.js.map +1 -1
- package/dist/frontend/lowering/class-dynamic-dispatch.test.js +47 -0
- package/dist/frontend/lowering/class-dynamic-dispatch.test.js.map +1 -1
- package/dist/frontend/lowering/class-iterables.d.ts +2 -1
- package/dist/frontend/lowering/class-iterables.js +9 -1
- package/dist/frontend/lowering/class-iterables.js.map +1 -1
- package/dist/frontend/lowering/class-method-mutations.js +32 -9
- package/dist/frontend/lowering/class-method-mutations.js.map +1 -1
- package/dist/frontend/lowering/class-prototypes.js +31 -2
- package/dist/frontend/lowering/class-prototypes.js.map +1 -1
- package/dist/frontend/lowering/class-runtime-statics.d.ts +9 -3
- package/dist/frontend/lowering/class-runtime-statics.js +29 -4
- package/dist/frontend/lowering/class-runtime-statics.js.map +1 -1
- package/dist/frontend/lowering/coercions/structural-plans.js +48 -1
- package/dist/frontend/lowering/coercions/structural-plans.js.map +1 -1
- package/dist/frontend/lowering/coercions/structural.js +91 -1
- package/dist/frontend/lowering/coercions/structural.js.map +1 -1
- package/dist/frontend/lowering/containers/array-callback-call.js +2 -2
- package/dist/frontend/lowering/containers/array-callback-call.js.map +1 -1
- package/dist/frontend/lowering/containers/array-callbacks.js +338 -18
- package/dist/frontend/lowering/containers/array-callbacks.js.map +1 -1
- package/dist/frontend/lowering/containers/array-concat.js +10 -0
- package/dist/frontend/lowering/containers/array-concat.js.map +1 -1
- package/dist/frontend/lowering/containers/array-methods.js +15 -0
- package/dist/frontend/lowering/containers/array-methods.js.map +1 -1
- package/dist/frontend/lowering/containers/array-pipelines.js +19 -8
- package/dist/frontend/lowering/containers/array-pipelines.js.map +1 -1
- package/dist/frontend/lowering/containers/bytes.js +2 -1
- package/dist/frontend/lowering/containers/bytes.js.map +1 -1
- package/dist/frontend/lowering/containers/callback-arguments.js +3 -0
- package/dist/frontend/lowering/containers/callback-arguments.js.map +1 -1
- package/dist/frontend/lowering/containers/collection-methods.js +7 -2
- package/dist/frontend/lowering/containers/collection-methods.js.map +1 -1
- package/dist/frontend/lowering/containers/filter-predicates.d.ts +6 -0
- package/dist/frontend/lowering/containers/filter-predicates.js +205 -0
- package/dist/frontend/lowering/containers/filter-predicates.js.map +1 -0
- package/dist/frontend/lowering/containers/indexed-objects.d.ts +0 -12
- package/dist/frontend/lowering/containers/indexed-objects.js +46 -7
- package/dist/frontend/lowering/containers/indexed-objects.js.map +1 -1
- package/dist/frontend/lowering/containers/string-and-regexp.js +55 -9
- package/dist/frontend/lowering/containers/string-and-regexp.js.map +1 -1
- package/dist/frontend/lowering/containers/string-replacement.js +43 -19
- package/dist/frontend/lowering/containers/string-replacement.js.map +1 -1
- package/dist/frontend/lowering/dispatch-sites.js +15 -1
- package/dist/frontend/lowering/dispatch-sites.js.map +1 -1
- package/dist/frontend/lowering/divergences.js +9 -1
- package/dist/frontend/lowering/divergences.js.map +1 -1
- package/dist/frontend/lowering/error-methods.js +47 -2
- package/dist/frontend/lowering/error-methods.js.map +1 -1
- package/dist/frontend/lowering/expressions/array-literals.js +47 -0
- package/dist/frontend/lowering/expressions/array-literals.js.map +1 -1
- package/dist/frontend/lowering/expressions/binary.js +36 -2
- package/dist/frontend/lowering/expressions/binary.js.map +1 -1
- package/dist/frontend/lowering/expressions/element-access.js +90 -13
- package/dist/frontend/lowering/expressions/element-access.js.map +1 -1
- package/dist/frontend/lowering/expressions/identifiers.js +33 -4
- package/dist/frontend/lowering/expressions/identifiers.js.map +1 -1
- package/dist/frontend/lowering/expressions/narrowing.js +95 -1
- package/dist/frontend/lowering/expressions/narrowing.js.map +1 -1
- package/dist/frontend/lowering/expressions/nullish-assignment.js +3 -1
- package/dist/frontend/lowering/expressions/nullish-assignment.js.map +1 -1
- package/dist/frontend/lowering/expressions/object-literals.d.ts +10 -0
- package/dist/frontend/lowering/expressions/object-literals.js +138 -51
- package/dist/frontend/lowering/expressions/object-literals.js.map +1 -1
- package/dist/frontend/lowering/expressions/optional-chains.js +12 -0
- package/dist/frontend/lowering/expressions/optional-chains.js.map +1 -1
- package/dist/frontend/lowering/expressions/property-access.js +113 -11
- package/dist/frontend/lowering/expressions/property-access.js.map +1 -1
- package/dist/frontend/lowering/expressions/relational.js +212 -33
- package/dist/frontend/lowering/expressions/relational.js.map +1 -1
- package/dist/frontend/lowering/expressions/union-fields.js +4 -0
- package/dist/frontend/lowering/expressions/union-fields.js.map +1 -1
- package/dist/frontend/lowering/expressions/updates.js +22 -3
- package/dist/frontend/lowering/expressions/updates.js.map +1 -1
- package/dist/frontend/lowering/frozen-records.d.ts +28 -0
- package/dist/frontend/lowering/frozen-records.js +322 -0
- package/dist/frontend/lowering/frozen-records.js.map +1 -0
- package/dist/frontend/lowering/function-returns.js +49 -0
- package/dist/frontend/lowering/function-returns.js.map +1 -1
- package/dist/frontend/lowering/generic-functions.js +7 -2
- package/dist/frontend/lowering/generic-functions.js.map +1 -1
- package/dist/frontend/lowering/iterable-values.d.ts +49 -0
- package/dist/frontend/lowering/iterable-values.js +297 -0
- package/dist/frontend/lowering/iterable-values.js.map +1 -0
- package/dist/frontend/lowering/iterator-adapters.js +186 -1
- package/dist/frontend/lowering/iterator-adapters.js.map +1 -1
- package/dist/frontend/lowering/js-class-fields.d.ts +8 -0
- package/dist/frontend/lowering/js-class-fields.js +45 -10
- package/dist/frontend/lowering/js-class-fields.js.map +1 -1
- package/dist/frontend/lowering/key-order-witness.d.ts +18 -3
- package/dist/frontend/lowering/key-order-witness.js +770 -22
- package/dist/frontend/lowering/key-order-witness.js.map +1 -1
- package/dist/frontend/lowering/key-order-witness.test.js +428 -8
- package/dist/frontend/lowering/key-order-witness.test.js.map +1 -1
- package/dist/frontend/lowering/lower-async-iteration.js +4 -1
- package/dist/frontend/lowering/lower-async-iteration.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.d.ts +7 -0
- package/dist/frontend/lowering/lower-calls.js +443 -41
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-classes.d.ts +11 -2
- package/dist/frontend/lowering/lower-classes.js +302 -22
- package/dist/frontend/lowering/lower-classes.js.map +1 -1
- package/dist/frontend/lowering/lower-dgram.js +3 -1
- package/dist/frontend/lowering/lower-dgram.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.js +10 -2
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-functions.d.ts +11 -0
- package/dist/frontend/lowering/lower-functions.js +83 -0
- package/dist/frontend/lowering/lower-functions.js.map +1 -1
- package/dist/frontend/lowering/lower-generators.js +41 -31
- package/dist/frontend/lowering/lower-generators.js.map +1 -1
- package/dist/frontend/lowering/lower-global-value.js +6 -3
- package/dist/frontend/lowering/lower-global-value.js.map +1 -1
- package/dist/frontend/lowering/lower-inspect.js +18 -6
- package/dist/frontend/lowering/lower-inspect.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.js +32 -0
- package/dist/frontend/lowering/lower-modules.js.map +1 -1
- package/dist/frontend/lowering/lower-namespaces.js +5 -1
- package/dist/frontend/lowering/lower-namespaces.js.map +1 -1
- package/dist/frontend/lowering/lower-server.js +2 -2
- package/dist/frontend/lowering/lower-server.js.map +1 -1
- package/dist/frontend/lowering/lower-stdlib.d.ts +5 -0
- package/dist/frontend/lowering/lower-stdlib.js +30 -0
- package/dist/frontend/lowering/lower-stdlib.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.d.ts +23 -0
- package/dist/frontend/lowering/lower-stmts.js +454 -48
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lower-stream.d.ts +20 -2
- package/dist/frontend/lowering/lower-stream.js +1483 -156
- package/dist/frontend/lowering/lower-stream.js.map +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +77 -6
- package/dist/frontend/lowering/lowerer.js +313 -29
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/lowering/module-namespace-elements.d.ts +11 -1
- package/dist/frontend/lowering/module-namespace-elements.js +82 -5
- package/dist/frontend/lowering/module-namespace-elements.js.map +1 -1
- package/dist/frontend/lowering/new-target.d.ts +12 -0
- package/dist/frontend/lowering/new-target.js +280 -0
- package/dist/frontend/lowering/new-target.js.map +1 -0
- package/dist/frontend/lowering/surfaces.d.ts +3 -0
- package/dist/frontend/lowering/surfaces.js +18 -6
- package/dist/frontend/lowering/surfaces.js.map +1 -1
- package/dist/frontend/lowering/undefined-index.d.ts +27 -0
- package/dist/frontend/lowering/undefined-index.js +82 -0
- package/dist/frontend/lowering/undefined-index.js.map +1 -0
- package/dist/frontend/lowering/var-hoisting.js +29 -13
- package/dist/frontend/lowering/var-hoisting.js.map +1 -1
- package/dist/frontend/lowering/width-lift.d.ts +18 -0
- package/dist/frontend/npm-static-bundled-chunks.js +9 -11
- package/dist/frontend/npm-static-bundled-chunks.js.map +1 -1
- package/dist/frontend/npm-static-bundled-chunks.test.js +6 -5
- package/dist/frontend/npm-static-bundled-chunks.test.js.map +1 -1
- package/dist/frontend/npm-static-rewrite-syntax.js +9 -1
- package/dist/frontend/npm-static-rewrite-syntax.js.map +1 -1
- package/dist/frontend/npm-static.js +4 -20
- package/dist/frontend/npm-static.js.map +1 -1
- package/dist/frontend/package-shims.d.ts +3 -0
- package/dist/frontend/package-shims.js +71 -8
- package/dist/frontend/package-shims.js.map +1 -1
- package/dist/frontend/pipeline.js +18 -10
- package/dist/frontend/pipeline.js.map +1 -1
- package/dist/frontend/process-fork.d.ts +25 -0
- package/dist/frontend/process-fork.js +2 -0
- package/dist/frontend/process-fork.js.map +1 -0
- package/dist/frontend/program.d.ts +8 -1
- package/dist/frontend/program.js +484 -69
- package/dist/frontend/program.js.map +1 -1
- package/dist/frontend/program.test.js +43 -3
- package/dist/frontend/program.test.js.map +1 -1
- package/dist/frontend/token-equivalence.d.ts +3 -0
- package/dist/frontend/token-equivalence.js +409 -0
- package/dist/frontend/token-equivalence.js.map +1 -0
- package/dist/frontend/token-equivalence.test.d.ts +1 -0
- package/dist/frontend/token-equivalence.test.js +67 -0
- package/dist/frontend/token-equivalence.test.js.map +1 -0
- package/dist/frontend/ts7/ast-node.d.ts +22 -0
- package/dist/frontend/ts7/ast-node.js +1048 -103
- package/dist/frontend/ts7/ast-node.js.map +1 -1
- package/dist/frontend/ts7/ast-node.test.js +24 -0
- package/dist/frontend/ts7/ast-node.test.js.map +1 -1
- package/dist/frontend/ts7/ast-wire.d.ts +4 -3
- package/dist/frontend/ts7/ast-wire.js +34 -24
- package/dist/frontend/ts7/ast-wire.js.map +1 -1
- package/dist/frontend/ts7/ast-wire.test.js +23 -0
- package/dist/frontend/ts7/ast-wire.test.js.map +1 -1
- package/dist/frontend/ts7/checker-backend.d.ts +3 -4
- package/dist/frontend/ts7/checker-backend.js +2 -2
- package/dist/frontend/ts7/checker-backend.js.map +1 -1
- package/dist/frontend/ts7/checker-backend.test.js +5 -9
- package/dist/frontend/ts7/checker-backend.test.js.map +1 -1
- package/dist/frontend/ts7/checker.d.ts +4 -0
- package/dist/frontend/ts7/checker.js +7 -0
- package/dist/frontend/ts7/checker.js.map +1 -1
- package/dist/frontend/ts7/lib-diagnostics.d.ts +24 -0
- package/dist/frontend/ts7/lib-diagnostics.js +307 -0
- package/dist/frontend/ts7/lib-diagnostics.js.map +1 -0
- package/dist/frontend/ts7/lib-diagnostics.test.d.ts +1 -0
- package/dist/frontend/ts7/lib-diagnostics.test.js +199 -0
- package/dist/frontend/ts7/lib-diagnostics.test.js.map +1 -0
- package/dist/frontend/ts7/program-host.d.ts +7 -0
- package/dist/frontend/ts7/program-host.js +25 -2
- package/dist/frontend/ts7/program-host.js.map +1 -1
- package/dist/frontend/ts7/session.d.ts +14 -1
- package/dist/frontend/ts7/session.js +22 -0
- package/dist/frontend/ts7/session.js.map +1 -1
- package/dist/frontend/type-mapper.d.ts +13 -1
- package/dist/frontend/type-mapper.js +191 -11
- package/dist/frontend/type-mapper.js.map +1 -1
- package/dist/index.d.ts +0 -5
- package/dist/index.js +34 -4
- package/dist/index.js.map +1 -1
- package/dist/ir/analysis.js +5 -3
- package/dist/ir/analysis.js.map +1 -1
- package/dist/ir/array-length-stability.d.ts +4 -0
- package/dist/ir/array-length-stability.js +19 -6
- package/dist/ir/array-length-stability.js.map +1 -1
- package/dist/ir/array-length-stability.test.js +24 -0
- package/dist/ir/array-length-stability.test.js.map +1 -1
- package/dist/ir/builtin-effects.d.ts +7 -0
- package/dist/ir/builtin-effects.js +52 -0
- package/dist/ir/builtin-effects.js.map +1 -1
- package/dist/ir/builtin-signatures.d.ts +6 -4
- package/dist/ir/builtin-signatures.js +166 -13
- package/dist/ir/builtin-signatures.js.map +1 -1
- package/dist/ir/callback-specialization.d.ts +2 -1
- package/dist/ir/callback-specialization.js +23 -18
- package/dist/ir/callback-specialization.js.map +1 -1
- package/dist/ir/char-unit-locals.d.ts +19 -0
- package/dist/ir/char-unit-locals.js +185 -0
- package/dist/ir/char-unit-locals.js.map +1 -0
- package/dist/ir/char-unit-locals.test.d.ts +1 -0
- package/dist/ir/char-unit-locals.test.js +94 -0
- package/dist/ir/char-unit-locals.test.js.map +1 -0
- package/dist/ir/final-fields.d.ts +2 -1
- package/dist/ir/final-fields.js +14 -16
- package/dist/ir/final-fields.js.map +1 -1
- package/dist/ir/function-references.d.ts +2 -0
- package/dist/ir/function-references.js +2 -0
- package/dist/ir/function-references.js.map +1 -1
- package/dist/ir/function-references.test.js +3 -0
- package/dist/ir/function-references.test.js.map +1 -1
- package/dist/ir/initializer-bindings.d.ts +2 -1
- package/dist/ir/initializer-bindings.js +27 -20
- package/dist/ir/initializer-bindings.js.map +1 -1
- package/dist/ir/int32-arrays.d.ts +108 -0
- package/dist/ir/int32-arrays.js +831 -0
- package/dist/ir/int32-arrays.js.map +1 -0
- package/dist/ir/int32-slots.d.ts +24 -2
- package/dist/ir/int32-slots.js +259 -57
- package/dist/ir/int32-slots.js.map +1 -1
- package/dist/ir/integer-loops.d.ts +3 -3
- package/dist/ir/integer-loops.js +14 -6
- package/dist/ir/integer-loops.js.map +1 -1
- package/dist/ir/integer-loops.test.js +10 -0
- package/dist/ir/integer-loops.test.js.map +1 -1
- package/dist/ir/integer-ranges.d.ts +5 -0
- package/dist/ir/integer-ranges.js +125 -12
- package/dist/ir/integer-ranges.js.map +1 -1
- package/dist/ir/integer-ranges.test.js +30 -0
- package/dist/ir/integer-ranges.test.js.map +1 -1
- package/dist/ir/ir.d.ts +70 -7
- package/dist/ir/ir.js +58 -1
- package/dist/ir/ir.js.map +1 -1
- package/dist/ir/ir.test.js +21 -1
- package/dist/ir/ir.test.js.map +1 -1
- package/dist/ir/js-ic.d.ts +19 -2
- package/dist/ir/js-ic.js +95 -11
- package/dist/ir/js-ic.js.map +1 -1
- package/dist/ir/js-ic.test.js +188 -0
- package/dist/ir/js-ic.test.js.map +1 -1
- package/dist/ir/node-index.d.ts +57 -0
- package/dist/ir/node-index.js +215 -0
- package/dist/ir/node-index.js.map +1 -0
- package/dist/ir/paired-while-loops.d.ts +25 -0
- package/dist/ir/paired-while-loops.js +335 -0
- package/dist/ir/paired-while-loops.js.map +1 -0
- package/dist/ir/paired-while-loops.test.d.ts +1 -0
- package/dist/ir/paired-while-loops.test.js +163 -0
- package/dist/ir/paired-while-loops.test.js.map +1 -0
- package/dist/ir/parameter-versions.d.ts +25 -0
- package/dist/ir/parameter-versions.js +300 -0
- package/dist/ir/parameter-versions.js.map +1 -0
- package/dist/ir/runtime-features.d.ts +34 -13
- package/dist/ir/runtime-features.js +152 -38
- package/dist/ir/runtime-features.js.map +1 -1
- package/dist/ir/serialize.d.ts +12 -2
- package/dist/ir/serialize.js +16 -3
- package/dist/ir/serialize.js.map +1 -1
- package/dist/ir/serialize.test.js +17 -0
- package/dist/ir/serialize.test.js.map +1 -1
- package/dist/ir/traverse.js +18 -6
- package/dist/ir/traverse.js.map +1 -1
- package/dist/ir/validate.js +122 -36
- package/dist/ir/validate.js.map +1 -1
- package/dist/library/ir-policy.js +2 -0
- package/dist/library/ir-policy.js.map +1 -1
- package/dist/native/cache.d.ts +6 -1
- package/dist/native/cache.js +28 -5
- package/dist/native/cache.js.map +1 -1
- package/dist/native/cache.test.js +16 -2
- package/dist/native/cache.test.js.map +1 -1
- package/dist/native/cli.js +21 -1
- package/dist/native/cli.js.map +1 -1
- package/dist/native/compiler.js +8 -6
- package/dist/native/compiler.js.map +1 -1
- package/dist/native/executable-cache.d.ts +1 -1
- package/dist/native/executable-cache.js +2 -2
- package/dist/native/executable-cache.js.map +1 -1
- package/dist/native/prepare.d.ts +3 -1
- package/dist/native/prepare.js +119 -31
- package/dist/native/prepare.js.map +1 -1
- package/dist/native/prepare.test.js +78 -18
- package/dist/native/prepare.test.js.map +1 -1
- package/dist/native/sanitizer.test.js +2 -0
- package/dist/native/sanitizer.test.js.map +1 -1
- package/dist/native/text-file.d.ts +13 -3
- package/dist/native/text-file.js +63 -9
- package/dist/native/text-file.js.map +1 -1
- package/dist/native/text-file.test.d.ts +1 -0
- package/dist/native/text-file.test.js +49 -0
- package/dist/native/text-file.test.js.map +1 -0
- package/dist/native/toolchain.js +4 -4
- package/dist/native/toolchain.js.map +1 -1
- package/dist/native/toolchain.test.js +3 -3
- package/dist/native/toolchain.test.js.map +1 -1
- package/package.json +21 -21
- package/shims/chalk/v5.ts +688 -0
- package/shims/hono-node-server/v2.ts +645 -0
- package/shims/hot-shots/client.ts +1126 -0
- package/shims/hot-shots/v8-unix-dgram.ts +8 -0
- package/shims/hot-shots/v8.ts +8 -0
- package/surface-manifest.json +26 -4
package/dist/ir/int32-slots.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { analyzeIntegerRanges, INT32_RANGE, NON_NEGATIVE_INT32_RANGE, withinInt32, } from "./integer-ranges.js";
|
|
2
|
-
import { exprFunctionReference, moduleFunctionReferences } from "./function-references.js";
|
|
2
|
+
import { exprFunctionReference, FUNCTION_REFERENCE_KINDS, moduleFunctionReferences, } from "./function-references.js";
|
|
3
|
+
import { eachNodeOfKinds, } from "./node-index.js";
|
|
3
4
|
import { findInitializerBindings, withInitializerBindings } from "./initializer-bindings.js";
|
|
4
|
-
import {
|
|
5
|
+
import { checkableInt32Allocations, int32ArrayGroups, int32ArrayKey, int32ArraySlot, int32ArrayStores, } from "./int32-arrays.js";
|
|
6
|
+
import { everyExprChild, everyStmtChild, everyTypeChild } from "./traverse.js";
|
|
5
7
|
/** The storage slot an array-valued expression reads, as an
|
|
6
8
|
* IrContracts.int32Elements key: a local or parameter
|
|
7
9
|
* (`l:${function}\0${localId}`), a module global (`g:${globalId}`), a class
|
|
@@ -151,8 +153,11 @@ export class Int32Slots {
|
|
|
151
153
|
result.locals = (localId) => this.int32Locals.has(`${fnName}\0${localId}`) || this.int32Locals.has(`\0${localId}`)
|
|
152
154
|
? INT32_RANGE
|
|
153
155
|
: null;
|
|
154
|
-
if (this.int32Elements.size > 0)
|
|
156
|
+
if (this.int32Elements.size > 0) {
|
|
155
157
|
result.elements = (arr) => this.hasInt32Elements(fnName, arr);
|
|
158
|
+
if (this.narrowedReads)
|
|
159
|
+
result.narrowedReads = true;
|
|
160
|
+
}
|
|
156
161
|
const params = this.paramFacts.get(fnName);
|
|
157
162
|
if (params)
|
|
158
163
|
result.params =
|
|
@@ -212,6 +217,29 @@ export class Int32Slots {
|
|
|
212
217
|
addInt32Elements(key) {
|
|
213
218
|
this.int32Elements.add(key);
|
|
214
219
|
}
|
|
220
|
+
dropInt32Elements(key) {
|
|
221
|
+
return this.int32Elements.delete(key);
|
|
222
|
+
}
|
|
223
|
+
hasInt32ElementSlot(key) {
|
|
224
|
+
return this.int32Elements.has(key);
|
|
225
|
+
}
|
|
226
|
+
/** Whether the module has int32 array candidates (the narrowedReads
|
|
227
|
+
* range fact). */
|
|
228
|
+
narrowedReads = false;
|
|
229
|
+
/** Number arrays stored as int32 slots (int32ArrayKey keys: locals and
|
|
230
|
+
* parameters as `function\0local`, globals as `\0global`): the module's
|
|
231
|
+
* int32 array candidates whose every stored element, through every
|
|
232
|
+
* binding that can hold the same array, the fixpoint proved an int32. */
|
|
233
|
+
int32Arrays = new Set();
|
|
234
|
+
/** Local number arrays that may hold int32 slots with checked stores: the
|
|
235
|
+
* candidates whose element stores the fixpoint proved exact integers but
|
|
236
|
+
* not int32s, allocated only by fills that may be long. A fill of at least
|
|
237
|
+
* CHECKED_INT32_MIN_LENGTH elements creates one with int32 slots and a
|
|
238
|
+
* shorter one with doubles. Their elements give no int32 facts; compiled
|
|
239
|
+
* accesses test the array's kind (once per innermost loop where they can,
|
|
240
|
+
* backend/llvm/int32-kind-loops.ts), and a store that is not an int32
|
|
241
|
+
* widens it first (scr_arr_widen_i32). */
|
|
242
|
+
checkedInt32Arrays = new Set();
|
|
215
243
|
/** Whether every present element of the number array `arr` evaluates to
|
|
216
244
|
* (read inside `fnName`) is an int32. */
|
|
217
245
|
hasInt32Elements(fnName, arr) {
|
|
@@ -351,6 +379,7 @@ const DYN_READ_ONLY = new Set([
|
|
|
351
379
|
"dyn.forInStable",
|
|
352
380
|
"dyn.getOwnPropertyNames",
|
|
353
381
|
"dyn.getPrototype",
|
|
382
|
+
"dyn.getPrototypeForIdentity",
|
|
354
383
|
"dyn.hasKey",
|
|
355
384
|
"dyn.hasOwn",
|
|
356
385
|
"dyn.in",
|
|
@@ -426,7 +455,58 @@ const DYN_READ_ONLY = new Set([
|
|
|
426
455
|
"text.decodeStream",
|
|
427
456
|
"worker.new",
|
|
428
457
|
]);
|
|
429
|
-
|
|
458
|
+
/** The node kinds each walk below reads. */
|
|
459
|
+
const LIB_CALL_KINDS = ["libCall"];
|
|
460
|
+
const CALL_FACT_KINDS = [
|
|
461
|
+
...FUNCTION_REFERENCE_KINDS,
|
|
462
|
+
"virtualCall",
|
|
463
|
+
"instanceOfValue",
|
|
464
|
+
"varRef",
|
|
465
|
+
"assignExpr",
|
|
466
|
+
"incDec",
|
|
467
|
+
"classRef",
|
|
468
|
+
"varDecl",
|
|
469
|
+
"assign",
|
|
470
|
+
"forOf",
|
|
471
|
+
];
|
|
472
|
+
const CENSUS_KINDS = [
|
|
473
|
+
"call",
|
|
474
|
+
"new",
|
|
475
|
+
"varRef",
|
|
476
|
+
"fieldGet",
|
|
477
|
+
"fieldIncDec",
|
|
478
|
+
"closure",
|
|
479
|
+
"classRef",
|
|
480
|
+
"incDec",
|
|
481
|
+
"forOf",
|
|
482
|
+
"tryCatch",
|
|
483
|
+
];
|
|
484
|
+
const DECLARATION_KINDS = ["varDecl"];
|
|
485
|
+
const CANDIDATE_WRITE_KINDS = [
|
|
486
|
+
"assign",
|
|
487
|
+
"varDecl",
|
|
488
|
+
"fieldSet",
|
|
489
|
+
"return",
|
|
490
|
+
"call",
|
|
491
|
+
"new",
|
|
492
|
+
"assignExpr",
|
|
493
|
+
];
|
|
494
|
+
const CALL_KINDS = ["call", "new"];
|
|
495
|
+
const SLOT_WRITE_KINDS = ["return", "call", "new"];
|
|
496
|
+
const NARROW_WRITE_KINDS = ["assign", "varDecl", "fieldSet", "assignExpr"];
|
|
497
|
+
/** Visits the nodes of `fn` in walk order; with `scan`, only those of its
|
|
498
|
+
* kinds, read from the module's node index (the visitors must ignore the
|
|
499
|
+
* other kinds). */
|
|
500
|
+
function walkFunction(fn, scan, visit) {
|
|
501
|
+
if (scan !== undefined) {
|
|
502
|
+
eachNodeOfKinds(fn, scan, (node, statement) => {
|
|
503
|
+
if (statement)
|
|
504
|
+
visit.stmt?.(node);
|
|
505
|
+
else
|
|
506
|
+
visit.expr?.(node);
|
|
507
|
+
});
|
|
508
|
+
return;
|
|
509
|
+
}
|
|
430
510
|
const expr = (e) => {
|
|
431
511
|
visit.expr?.(e);
|
|
432
512
|
return everyExprChild(e, expr, stmt);
|
|
@@ -440,7 +520,7 @@ function walkFunction(fn, visit) {
|
|
|
440
520
|
}
|
|
441
521
|
/** Computes DynamicFieldStores with one walk of every function. Analyses of
|
|
442
522
|
* the same module accept the result so the emitter walks the module once. */
|
|
443
|
-
export function dynamicFieldStores(mod, records = new Map((mod.records ?? []).map((r) => [r.id, r])), unions = new Map((mod.unions ?? []).map((u) => [u.id, u]))) {
|
|
523
|
+
export function dynamicFieldStores(mod, records = new Map((mod.records ?? []).map((r) => [r.id, r])), unions = new Map((mod.unions ?? []).map((u) => [u.id, u])), nodes) {
|
|
444
524
|
const dynTypes = new Map();
|
|
445
525
|
const dynNamed = new Map();
|
|
446
526
|
const dynish = (type) => {
|
|
@@ -480,8 +560,13 @@ export function dynamicFieldStores(mod, records = new Map((mod.records ?? []).ma
|
|
|
480
560
|
};
|
|
481
561
|
const dynWritten = new Set();
|
|
482
562
|
let dynWritesAll = false;
|
|
483
|
-
|
|
484
|
-
|
|
563
|
+
// A store whose key is not a literal names every field: later stores add
|
|
564
|
+
// nothing, so the walk stops there.
|
|
565
|
+
const scan = nodes?.scan(LIB_CALL_KINDS);
|
|
566
|
+
for (const fn of mod.functions) {
|
|
567
|
+
if (dynWritesAll)
|
|
568
|
+
break;
|
|
569
|
+
walkFunction(fn, scan, {
|
|
485
570
|
expr: (e) => {
|
|
486
571
|
if (dynWritesAll)
|
|
487
572
|
return;
|
|
@@ -496,6 +581,7 @@ export function dynamicFieldStores(mod, records = new Map((mod.records ?? []).ma
|
|
|
496
581
|
}
|
|
497
582
|
},
|
|
498
583
|
});
|
|
584
|
+
}
|
|
499
585
|
return { all: dynWritesAll, names: dynWritten };
|
|
500
586
|
}
|
|
501
587
|
/** The f64 class field families a runtime store through a live dynamic view
|
|
@@ -503,6 +589,21 @@ export function dynamicFieldStores(mod, records = new Map((mod.records ?? []).ma
|
|
|
503
589
|
* another exposed type), and some dynamic store in the program can name the
|
|
504
590
|
* field. */
|
|
505
591
|
export function dynamicallyStoredFamilies(mod, slots, stores) {
|
|
592
|
+
const records = new Map((mod.records ?? []).map((r) => [r.id, r]));
|
|
593
|
+
const unions = new Map((mod.unions ?? []).map((u) => [u.id, u]));
|
|
594
|
+
// A live dyn view (typed-ref capsule) of an instance writes back into
|
|
595
|
+
// its fields only after a runtime store into the capsule; the commit then
|
|
596
|
+
// writes every field from the view, which holds the exact snapshot value
|
|
597
|
+
// of any property no store named. So reaching dynamic code disqualifies
|
|
598
|
+
// exactly the field names some dynamic store in the program can name.
|
|
599
|
+
const { all: dynWritesAll, names: dynWritten } = stores ?? dynamicFieldStores(mod, records, unions);
|
|
600
|
+
const storable = (field) => field.type.kind === "f64" &&
|
|
601
|
+
!field.name.startsWith("%") &&
|
|
602
|
+
(dynWritesAll || dynWritten.has(field.name));
|
|
603
|
+
const families = new Set();
|
|
604
|
+
// Without a field some store can name, no class is worth exposing.
|
|
605
|
+
if (!(mod.classes ?? []).some((cls) => cls.fields.some(storable)))
|
|
606
|
+
return families;
|
|
506
607
|
const classes = new Map((mod.classes ?? []).map((c) => [c.name, c]));
|
|
507
608
|
const children = new Map();
|
|
508
609
|
for (const cls of classes.values())
|
|
@@ -524,8 +625,6 @@ export function dynamicallyStoredFamilies(mod, slots, stores) {
|
|
|
524
625
|
}
|
|
525
626
|
return out;
|
|
526
627
|
};
|
|
527
|
-
const records = new Map((mod.records ?? []).map((r) => [r.id, r]));
|
|
528
|
-
const unions = new Map((mod.unions ?? []).map((u) => [u.id, u]));
|
|
529
628
|
const exposedClasses = new Set();
|
|
530
629
|
const seenNamed = new Set();
|
|
531
630
|
let exposeAll = false;
|
|
@@ -574,14 +673,8 @@ export function dynamicallyStoredFamilies(mod, slots, stores) {
|
|
|
574
673
|
});
|
|
575
674
|
}
|
|
576
675
|
};
|
|
577
|
-
// A live dyn view (typed-ref capsule) of an instance writes back into
|
|
578
|
-
// its fields only after a runtime store into the capsule; the commit then
|
|
579
|
-
// writes every field from the view, which holds the exact snapshot value
|
|
580
|
-
// of any property no store named. So reaching dynamic code disqualifies
|
|
581
|
-
// exactly the field names some dynamic store in the program can name.
|
|
582
|
-
const { all: dynWritesAll, names: dynWritten } = stores ?? dynamicFieldStores(mod, records, unions);
|
|
583
676
|
for (const fn of mod.functions)
|
|
584
|
-
walkFunction(fn, {
|
|
677
|
+
walkFunction(fn, undefined, {
|
|
585
678
|
expr: (e) => {
|
|
586
679
|
const dynResult = DYN_KINDS.has(e.type.kind);
|
|
587
680
|
const boundary = BOUNDARY_KINDS.has(e.kind);
|
|
@@ -604,14 +697,11 @@ export function dynamicallyStoredFamilies(mod, slots, stores) {
|
|
|
604
697
|
expose(s.value.type);
|
|
605
698
|
},
|
|
606
699
|
});
|
|
607
|
-
const families = new Set();
|
|
608
700
|
for (const cls of classes.values()) {
|
|
609
701
|
if (!exposeAll && !exposedClasses.has(cls.name))
|
|
610
702
|
continue;
|
|
611
703
|
for (const field of cls.fields)
|
|
612
|
-
if (field
|
|
613
|
-
!field.name.startsWith("%") &&
|
|
614
|
-
(dynWritesAll || dynWritten.has(field.name)))
|
|
704
|
+
if (storable(field))
|
|
615
705
|
families.add(slots.family(cls.name, field.name));
|
|
616
706
|
}
|
|
617
707
|
return families;
|
|
@@ -620,7 +710,7 @@ export function dynamicallyStoredFamilies(mod, slots, stores) {
|
|
|
620
710
|
* the entry, constructors behind class values: `valueEscaped`), through
|
|
621
711
|
* virtual dispatch (`virtualTargets`), or as vtable entries the runtime
|
|
622
712
|
* calls (`runtimeVirtual`: methods of runtime-rooted hierarchies). */
|
|
623
|
-
export function functionCallFacts(mod, classes, subtree) {
|
|
713
|
+
export function functionCallFacts(mod, classes, subtree, nodes) {
|
|
624
714
|
const escaped = new Set(moduleFunctionReferences(mod));
|
|
625
715
|
const virtualTargets = new Set();
|
|
626
716
|
// Virtual dispatch: a `virtualCall` can reach the method's implementation
|
|
@@ -652,7 +742,7 @@ export function functionCallFacts(mod, classes, subtree) {
|
|
|
652
742
|
const count = (map, id) => {
|
|
653
743
|
map.set(id, (map.get(id) ?? 0) + 1);
|
|
654
744
|
};
|
|
655
|
-
walkFunction(fn, {
|
|
745
|
+
walkFunction(fn, nodes?.scan(CALL_FACT_KINDS), {
|
|
656
746
|
expr: (e) => {
|
|
657
747
|
const referenced = exprFunctionReference(e);
|
|
658
748
|
if (referenced !== undefined)
|
|
@@ -695,6 +785,7 @@ export function functionCallFacts(mod, classes, subtree) {
|
|
|
695
785
|
return { valueEscaped: escaped, virtualTargets, runtimeVirtual };
|
|
696
786
|
}
|
|
697
787
|
export function analyzeInt32Slots(mod, inputs = {}) {
|
|
788
|
+
const nodes = inputs.nodes;
|
|
698
789
|
const classes = new Map((mod.classes ?? []).map((c) => [c.name, c]));
|
|
699
790
|
const slots = new Int32Slots(classes);
|
|
700
791
|
if (mod.lib)
|
|
@@ -723,6 +814,32 @@ export function analyzeInt32Slots(mod, inputs = {}) {
|
|
|
723
814
|
slots.addInt32Local(key);
|
|
724
815
|
for (const key of contracts?.int32Elements ?? [])
|
|
725
816
|
slots.addInt32Elements(key);
|
|
817
|
+
// Int32 array candidates (ir/int32-arrays.ts): assumed to hold int32
|
|
818
|
+
// elements until a store the fixpoint cannot prove drops one, with every
|
|
819
|
+
// candidate the same array can reach (its group).
|
|
820
|
+
const arrayCandidates = new Map();
|
|
821
|
+
const globalArrays = new Set();
|
|
822
|
+
const arrayKeys = new Set(mod.int32ArrayCandidates ?? []);
|
|
823
|
+
slots.narrowedReads = arrayKeys.size > 0;
|
|
824
|
+
for (const key of arrayKeys) {
|
|
825
|
+
const cut = key.indexOf("\0");
|
|
826
|
+
if (cut === 0)
|
|
827
|
+
globalArrays.add(key.slice(1));
|
|
828
|
+
else {
|
|
829
|
+
const fnName = key.slice(0, cut);
|
|
830
|
+
const set = arrayCandidates.get(fnName) ?? new Set();
|
|
831
|
+
set.add(key.slice(cut + 1));
|
|
832
|
+
arrayCandidates.set(fnName, set);
|
|
833
|
+
}
|
|
834
|
+
slots.addInt32Elements(int32ArraySlot(key));
|
|
835
|
+
}
|
|
836
|
+
const arrayGroups = arrayKeys.size > 0 ? int32ArrayGroups(mod, arrayKeys) : null;
|
|
837
|
+
// Functions that read or write a candidate global.
|
|
838
|
+
const globalArrayFunctions = new Set();
|
|
839
|
+
if (arrayGroups)
|
|
840
|
+
for (const names of arrayGroups.globalReaders.values())
|
|
841
|
+
for (const name of names)
|
|
842
|
+
globalArrayFunctions.add(name);
|
|
726
843
|
/* ── candidate fields ── */
|
|
727
844
|
const children = new Map();
|
|
728
845
|
for (const cls of classes.values())
|
|
@@ -783,7 +900,7 @@ export function analyzeInt32Slots(mod, inputs = {}) {
|
|
|
783
900
|
}
|
|
784
901
|
/* ── functions: escapes, parameter and return candidates ── */
|
|
785
902
|
const functions = new Map(mod.functions.map((fn) => [fn.name, fn]));
|
|
786
|
-
const calls = functionCallFacts(mod, classes, subtree);
|
|
903
|
+
const calls = functionCallFacts(mod, classes, subtree, nodes);
|
|
787
904
|
const escaped = new Set([...calls.valueEscaped, ...calls.virtualTargets]);
|
|
788
905
|
const virtual = calls.runtimeVirtual;
|
|
789
906
|
const paramKey = (fnName, localId) => `param:${fnName}\0${localId}`;
|
|
@@ -846,7 +963,7 @@ export function analyzeInt32Slots(mod, inputs = {}) {
|
|
|
846
963
|
for (const capture of fn.classCaptures ?? [])
|
|
847
964
|
unstableBoxes.add(boxKey(fn.name, capture.localId));
|
|
848
965
|
const read = new Set();
|
|
849
|
-
walkFunction(fn, {
|
|
966
|
+
walkFunction(fn, nodes?.scan(CENSUS_KINDS), {
|
|
850
967
|
expr: (e) => {
|
|
851
968
|
if (e.kind === "call") {
|
|
852
969
|
called.add(e.callee);
|
|
@@ -958,7 +1075,7 @@ export function analyzeInt32Slots(mod, inputs = {}) {
|
|
|
958
1075
|
let ids = initializedDeclarations.get(fn.name);
|
|
959
1076
|
if (ids === undefined) {
|
|
960
1077
|
const found = new Set();
|
|
961
|
-
walkFunction(fn, {
|
|
1078
|
+
walkFunction(fn, nodes?.scan(DECLARATION_KINDS), {
|
|
962
1079
|
stmt: (s) => {
|
|
963
1080
|
if (s.kind === "varDecl" && s.init)
|
|
964
1081
|
found.add(s.localId);
|
|
@@ -1032,31 +1149,44 @@ export function analyzeInt32Slots(mod, inputs = {}) {
|
|
|
1032
1149
|
}
|
|
1033
1150
|
return false;
|
|
1034
1151
|
};
|
|
1152
|
+
const candidateWrites = nodes?.scan(CANDIDATE_WRITE_KINDS);
|
|
1035
1153
|
const hasCandidateWrite = (fn) => {
|
|
1154
|
+
if (arrayCandidates.has(fn.name))
|
|
1155
|
+
return true;
|
|
1156
|
+
if (globalArrayFunctions.has(fn.name))
|
|
1157
|
+
return true;
|
|
1036
1158
|
const box = (localId) => slots.hasBox(slots.boxGroup(fn.name, localId));
|
|
1037
1159
|
const returns = slots.hasReturn(fn.name);
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1160
|
+
let found = false;
|
|
1161
|
+
eachNodeOfKinds(fn, candidateWrites, (node) => {
|
|
1162
|
+
switch (node.kind) {
|
|
1163
|
+
case "assign":
|
|
1164
|
+
found = box(node.localId);
|
|
1165
|
+
break;
|
|
1166
|
+
case "varDecl":
|
|
1167
|
+
found = node.init !== null && box(node.localId);
|
|
1168
|
+
break;
|
|
1169
|
+
case "fieldSet": {
|
|
1170
|
+
const family = slots.family(node.className, node.field);
|
|
1171
|
+
found = !!family && slots.hasFamily(family);
|
|
1172
|
+
break;
|
|
1047
1173
|
}
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1174
|
+
case "return":
|
|
1175
|
+
found = returns;
|
|
1176
|
+
break;
|
|
1177
|
+
case "call":
|
|
1178
|
+
found = candidateArgs(functions.get(node.callee), node.args.length, 0);
|
|
1179
|
+
break;
|
|
1180
|
+
case "new":
|
|
1181
|
+
found = candidateArgs(functions.get(`%${node.className}.constructor`), node.args.length, 1);
|
|
1182
|
+
break;
|
|
1183
|
+
case "assignExpr":
|
|
1184
|
+
found = box(node.localId);
|
|
1185
|
+
break;
|
|
1186
|
+
}
|
|
1187
|
+
return !found;
|
|
1059
1188
|
});
|
|
1189
|
+
return found;
|
|
1060
1190
|
};
|
|
1061
1191
|
const provenByFunction = new Map();
|
|
1062
1192
|
// Each function's parameter and result writes under its latest analysis:
|
|
@@ -1071,15 +1201,84 @@ export function analyzeInt32Slots(mod, inputs = {}) {
|
|
|
1071
1201
|
reads(`param:${fn.name}\0${id}`, fn.name);
|
|
1072
1202
|
// Range facts are consulted only at writes into candidate slots; slots
|
|
1073
1203
|
// are only ever dropped, so a body without such a write needs none.
|
|
1074
|
-
const
|
|
1204
|
+
const candidate = hasCandidateWrite(fn);
|
|
1205
|
+
const ranges = candidate
|
|
1075
1206
|
? analyzeIntegerRanges(numeric(fn), slots.facts(fn.name))
|
|
1076
1207
|
: new Map();
|
|
1077
1208
|
if (ranges.size > 0)
|
|
1078
|
-
lastWrites.set(fn.name, slotWrites(fn, ranges, functions));
|
|
1209
|
+
lastWrites.set(fn.name, slotWrites(fn, ranges, functions, nodes));
|
|
1079
1210
|
else
|
|
1080
1211
|
lastWrites.delete(fn.name);
|
|
1081
1212
|
const proven = [];
|
|
1213
|
+
// The walk below acts only at writes into candidate slots.
|
|
1214
|
+
if (!candidate) {
|
|
1215
|
+
provenByFunction.set(fn.name, proven);
|
|
1216
|
+
continue;
|
|
1217
|
+
}
|
|
1082
1218
|
const int32 = (e) => withinInt32(ranges.get(e));
|
|
1219
|
+
// Every element stored into an int32 array candidate must be an int32
|
|
1220
|
+
// under the facts that assume the candidates' own elements are; a
|
|
1221
|
+
// failing store drops its array's element facts, and the function is
|
|
1222
|
+
// analyzed again without them. When every failing store is still an
|
|
1223
|
+
// exact integer under those facts (a counter, `a[i]! + 1`) and the array
|
|
1224
|
+
// is only ever allocated by a fill that may be long
|
|
1225
|
+
// (checkableInt32Allocations), it keeps int32 slots with checked stores
|
|
1226
|
+
// (checkedInt32Arrays), which widen it to doubles in place at the first
|
|
1227
|
+
// store that is not an int32.
|
|
1228
|
+
const locals = arrayCandidates.get(fn.name);
|
|
1229
|
+
let arrays = locals;
|
|
1230
|
+
if (globalArrayFunctions.has(fn.name)) {
|
|
1231
|
+
const both = new Set();
|
|
1232
|
+
if (locals)
|
|
1233
|
+
for (const id of locals)
|
|
1234
|
+
both.add(id);
|
|
1235
|
+
for (const id of globalArrays)
|
|
1236
|
+
both.add(id);
|
|
1237
|
+
arrays = both;
|
|
1238
|
+
}
|
|
1239
|
+
if (arrays && arrayGroups) {
|
|
1240
|
+
const requeue = (name) => {
|
|
1241
|
+
if (queued.has(name))
|
|
1242
|
+
return;
|
|
1243
|
+
queued.add(name);
|
|
1244
|
+
queue.push(name);
|
|
1245
|
+
};
|
|
1246
|
+
const params = new Set(fn.params.map((param) => param.localId));
|
|
1247
|
+
for (const [id, values] of int32ArrayStores(fn, arrays)) {
|
|
1248
|
+
const key = int32ArrayKey(fn.name, id);
|
|
1249
|
+
if (!slots.hasInt32ElementSlot(int32ArraySlot(key)) || values.every(int32))
|
|
1250
|
+
continue;
|
|
1251
|
+
// The array's group drops together: every function reading a
|
|
1252
|
+
// member is analyzed again without its facts.
|
|
1253
|
+
const group = arrayGroups.group.get(key) ?? [key];
|
|
1254
|
+
for (const member of group) {
|
|
1255
|
+
slots.dropInt32Elements(int32ArraySlot(member));
|
|
1256
|
+
if (member.startsWith("\0")) {
|
|
1257
|
+
const names = arrayGroups.globalReaders.get(member);
|
|
1258
|
+
if (names)
|
|
1259
|
+
for (const name of names)
|
|
1260
|
+
requeue(name);
|
|
1261
|
+
}
|
|
1262
|
+
else
|
|
1263
|
+
requeue(member.slice(0, member.indexOf("\0")));
|
|
1264
|
+
}
|
|
1265
|
+
// Checked stores serve a lone local: its allocations are the only
|
|
1266
|
+
// arrays it holds.
|
|
1267
|
+
const checkable = (value) => {
|
|
1268
|
+
const range = ranges.get(value);
|
|
1269
|
+
return int32(value) || range != null;
|
|
1270
|
+
};
|
|
1271
|
+
if (group.length === 1 &&
|
|
1272
|
+
!key.startsWith("\0") &&
|
|
1273
|
+
!params.has(id) &&
|
|
1274
|
+
values.every(checkable) &&
|
|
1275
|
+
checkableInt32Allocations(fn, id))
|
|
1276
|
+
slots.checkedInt32Arrays.add(key);
|
|
1277
|
+
else
|
|
1278
|
+
for (const member of group)
|
|
1279
|
+
reason(`array:${member}`, "an element store is not int32");
|
|
1280
|
+
}
|
|
1281
|
+
}
|
|
1083
1282
|
// An int32 written into a slot still assumed non-negative: widen the
|
|
1084
1283
|
// assumption when the value may be negative, and reanalyze its readers.
|
|
1085
1284
|
const settle = (slot, e) => {
|
|
@@ -1125,7 +1324,7 @@ export function analyzeInt32Slots(mod, inputs = {}) {
|
|
|
1125
1324
|
else if (dropBox(group, `write in ${fn.name} is not int32`))
|
|
1126
1325
|
invalidate(`box:${group}`);
|
|
1127
1326
|
};
|
|
1128
|
-
walkFunction(fn, {
|
|
1327
|
+
walkFunction(fn, nodes?.scan(CANDIDATE_WRITE_KINDS), {
|
|
1129
1328
|
stmt: (s) => {
|
|
1130
1329
|
if (s.kind === "assign")
|
|
1131
1330
|
boxWrite(s.localId, s.value);
|
|
@@ -1166,8 +1365,11 @@ export function analyzeInt32Slots(mod, inputs = {}) {
|
|
|
1166
1365
|
for (const proven of provenByFunction.values())
|
|
1167
1366
|
for (const value of proven)
|
|
1168
1367
|
slots.provenWrites.add(value);
|
|
1169
|
-
|
|
1170
|
-
|
|
1368
|
+
for (const key of arrayKeys)
|
|
1369
|
+
if (slots.hasInt32ElementSlot(int32ArraySlot(key)))
|
|
1370
|
+
slots.int32Arrays.add(key);
|
|
1371
|
+
const ranged = rangedParameters(slots, functions, retry, numeric, (callee) => readers.get(`ret:${callee}`), nodes);
|
|
1372
|
+
narrowSlotRanges(slots, functions, numeric, lastWrites, ranged, (slot) => readers.get(slot), nodes);
|
|
1171
1373
|
return slots;
|
|
1172
1374
|
}
|
|
1173
1375
|
/** Bounds a widened parameter range jumps to: the int32 limits, and the
|
|
@@ -1194,7 +1396,7 @@ const widenMax = (max) => WIDEN_MAX.find((bound) => bound >= max) ?? Infinity;
|
|
|
1194
1396
|
* other waiting functions) fail their parameters and are analyzed too, so
|
|
1195
1397
|
* every call site is checked under the final ranges. The facts the main
|
|
1196
1398
|
* fixpoint proved are fixed here: these ranges only add precision. */
|
|
1197
|
-
function rangedParameters(slots, functions, retry, numeric, callersOf) {
|
|
1399
|
+
function rangedParameters(slots, functions, retry, numeric, callersOf, nodes) {
|
|
1198
1400
|
const changed = new Set();
|
|
1199
1401
|
if (retry.size === 0)
|
|
1200
1402
|
return changed;
|
|
@@ -1277,7 +1479,7 @@ function rangedParameters(slots, functions, retry, numeric, callersOf) {
|
|
|
1277
1479
|
contribute(callee, param.localId, ranges.get(arg) ?? null);
|
|
1278
1480
|
});
|
|
1279
1481
|
};
|
|
1280
|
-
walkFunction(fn, {
|
|
1482
|
+
walkFunction(fn, nodes?.scan(CALL_KINDS), {
|
|
1281
1483
|
expr: (e) => {
|
|
1282
1484
|
if (e.kind === "call")
|
|
1283
1485
|
args(functions.get(e.callee), e.args, 0);
|
|
@@ -1320,7 +1522,7 @@ const sameRange = (a, b) => a.min === b.min && a.max === b.max;
|
|
|
1320
1522
|
/** The values one analysis of a function writes into parameter slots of
|
|
1321
1523
|
* its direct callees and into its own result slot (`param:` and `ret:`
|
|
1322
1524
|
* keys), joined per slot; null when some write has no proven range. */
|
|
1323
|
-
function slotWrites(fn, ranges, functions) {
|
|
1525
|
+
function slotWrites(fn, ranges, functions, nodes) {
|
|
1324
1526
|
const writes = new Map();
|
|
1325
1527
|
const write = (key, value) => {
|
|
1326
1528
|
const range = value ? (ranges.get(value) ?? null) : null;
|
|
@@ -1336,7 +1538,7 @@ function slotWrites(fn, ranges, functions) {
|
|
|
1336
1538
|
write(`param:${callee.name}\0${param.localId}`, arg);
|
|
1337
1539
|
});
|
|
1338
1540
|
};
|
|
1339
|
-
walkFunction(fn, {
|
|
1541
|
+
walkFunction(fn, nodes?.scan(SLOT_WRITE_KINDS), {
|
|
1340
1542
|
stmt: (s) => {
|
|
1341
1543
|
if (s.kind === "return")
|
|
1342
1544
|
write(`ret:${fn.name}`, s.value);
|
|
@@ -1373,7 +1575,7 @@ const NARROW_ROUNDS = 6;
|
|
|
1373
1575
|
* function must still prove every write into a field or box slot (whose
|
|
1374
1576
|
* facts do not change here), or the narrowing is abandoned. Pinned
|
|
1375
1577
|
* (contract) slots keep their contract range. */
|
|
1376
|
-
function narrowSlotRanges(slots, functions, numeric, lastWrites, changed, readersOf) {
|
|
1578
|
+
function narrowSlotRanges(slots, functions, numeric, lastWrites, changed, readersOf, nodes) {
|
|
1377
1579
|
// Every parameter and result slot with a fact, and that fact.
|
|
1378
1580
|
const proven = new Map();
|
|
1379
1581
|
const fixed = new Set();
|
|
@@ -1434,7 +1636,7 @@ function narrowSlotRanges(slots, functions, numeric, lastWrites, changed, reader
|
|
|
1434
1636
|
if (!rangeWithin(range, level))
|
|
1435
1637
|
sound = false;
|
|
1436
1638
|
};
|
|
1437
|
-
walkFunction(fn, {
|
|
1639
|
+
walkFunction(fn, nodes?.scan(NARROW_WRITE_KINDS), {
|
|
1438
1640
|
stmt: (s) => {
|
|
1439
1641
|
if (s.kind === "assign")
|
|
1440
1642
|
box(s.localId, s.value);
|
|
@@ -1449,7 +1651,7 @@ function narrowSlotRanges(slots, functions, numeric, lastWrites, changed, reader
|
|
|
1449
1651
|
box(e.localId, e.value);
|
|
1450
1652
|
},
|
|
1451
1653
|
});
|
|
1452
|
-
return { writes: slotWrites(fn, ranges, functions), sound };
|
|
1654
|
+
return { writes: slotWrites(fn, ranges, functions, nodes), sound };
|
|
1453
1655
|
};
|
|
1454
1656
|
const writesByFunction = new Map(lastWrites);
|
|
1455
1657
|
const join = () => {
|