@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
|
@@ -1,13 +1,31 @@
|
|
|
1
1
|
import { type IrExpr, type IrType } from "../../ir/ir.js";
|
|
2
2
|
import type { LlValue, LlvmEmitterContext } from "./expr-context.js";
|
|
3
|
+
/** Whether the array at `array` has state bytes, as an i1. `spare` changes
|
|
4
|
+
* only in runtime calls, so its loads take their own alias tag. */
|
|
5
|
+
export declare function emitArrayHasStates(host: LlvmEmitterContext, array: string): string;
|
|
3
6
|
/** Call-site effects of the non-retaining read fallbacks: they only read
|
|
4
7
|
* module-visible memory, or trap without returning to the caller (the trap
|
|
5
8
|
* writes runtime-private stderr/TLS state). Declaring this lets LLVM keep
|
|
6
9
|
* array header loads out of loops whose only calls are these cold paths. */
|
|
7
10
|
export declare const READ_FALLBACK = " cold memory(read, inaccessiblemem: readwrite)";
|
|
11
|
+
/** How an array's dense slots hold its elements: the access kind (`i32`
|
|
12
|
+
* for int32 arrays, ir/int32-arrays.ts), or `cref` for references to compact
|
|
13
|
+
* class instances (SCR_ELEM_CREF: a 4-byte slot holding the address over 8;
|
|
14
|
+
* LlEmitter.compactArrayElem). */
|
|
15
|
+
type SlotKind = ArrayAccess | "cref";
|
|
8
16
|
/** Bytes per dense slot (scr_arr_slot_width). */
|
|
9
|
-
export declare function slotWidth(
|
|
10
|
-
|
|
17
|
+
export declare function slotWidth(kind: SlotKind): number;
|
|
18
|
+
/** Bytes per dense slot of an array of `element` (scr_arr_slot_width). */
|
|
19
|
+
export declare function denseSlotWidth(host: LlvmEmitterContext, element: IrType): number;
|
|
20
|
+
/** The runtime accessor family of an access: int32 arrays answer through
|
|
21
|
+
* the double-valued entry points, which convert their slots. */
|
|
22
|
+
export declare function runtimeAccess(acc: ArrayAccess): "f64" | "bool" | "ref";
|
|
23
|
+
/** The ScrElemKind of int32 arrays (scr_array.h). */
|
|
24
|
+
export declare const SCR_ELEM_I32 = 7;
|
|
25
|
+
/** How a dense array's slots are read and written: doubles, booleans,
|
|
26
|
+
* references, or the int32 slots of SCR_ELEM_I32 arrays (ir/int32-arrays.ts),
|
|
27
|
+
* whose values are doubles at the emitter's interface. */
|
|
28
|
+
export type ArrayAccess = "f64" | "bool" | "ref" | "i32";
|
|
11
29
|
/** Before a self-append (`a[i] = a[i] + suffix`) replaces a reference
|
|
12
30
|
* element: when `index` lies in the hole-free prefix and the slot still
|
|
13
31
|
* holds `expected` (the caller's owned snapshot of the old element), the
|
|
@@ -23,19 +41,31 @@ export declare function emitDenseSlotUnlink(host: LlvmEmitterContext, array: str
|
|
|
23
41
|
* properties; it also answers sparse indices. Null reference slots take
|
|
24
42
|
* the runtime path, which returns them without a retain. */
|
|
25
43
|
export declare function emitDenseArrayGet(host: LlvmEmitterContext, array: string, index: LlValue, indexExpr: IrExpr | undefined, acc: ArrayAccess, element: IrType, getter: string, retain: boolean, proven?: boolean): string;
|
|
44
|
+
/** emitDenseArrayGet, with the int32 of an int32 array's element: the
|
|
45
|
+
* slot itself on the dense path, the runtime getter's double converted
|
|
46
|
+
* (exactly: the element is an int32) on the other. */
|
|
47
|
+
export declare function emitDenseArrayRead(host: LlvmEmitterContext, array: string, index: LlValue, indexExpr: IrExpr | undefined, acc: ArrayAccess, element: IrType, getter: string, retain: boolean, proven?: boolean): {
|
|
48
|
+
value: string;
|
|
49
|
+
int32: string | null;
|
|
50
|
+
};
|
|
26
51
|
/** `scr_arr_get_number`: a numeric element, or NaN for every missing,
|
|
27
52
|
* hole, or present-undefined slot (answered by the runtime). */
|
|
28
|
-
export declare function emitDenseArrayNumber(host: LlvmEmitterContext, array: string, index: LlValue, indexExpr: IrExpr | undefined, proven?: boolean): string;
|
|
53
|
+
export declare function emitDenseArrayNumber(host: LlvmEmitterContext, array: string, index: LlValue, indexExpr: IrExpr | undefined, proven?: boolean, acc?: "f64" | "i32"): string;
|
|
29
54
|
/** `scr_arr_state` (as a double) or `scr_arr_has` (as an i1). Dense
|
|
30
55
|
* in-range indices answer from the state byte; everything else keeps the
|
|
31
56
|
* runtime query, including canonical indices at or past the length. */
|
|
32
|
-
export declare function emitDenseArrayState(host: LlvmEmitterContext, array: string, index: LlValue, indexExpr: IrExpr | undefined, kind: "state" | "has", width: number
|
|
57
|
+
export declare function emitDenseArrayState(host: LlvmEmitterContext, array: string, index: LlValue, indexExpr: IrExpr | undefined, kind: "state" | "has", width: number,
|
|
58
|
+
/** The index is a dense array loop counter its entry test proved below
|
|
59
|
+
* the hole-free prefix (provenDenseIndex): the slot is a present value. */
|
|
60
|
+
proven?: boolean): string;
|
|
33
61
|
/** Element write with `scr_arr_set_*` semantics: the array takes the
|
|
34
62
|
* value's reference. A dense index stores the slot, marks it present, and
|
|
35
63
|
* extends the length when it lands at or past it; a replaced present
|
|
36
64
|
* reference is released after the new edge is published (a release can
|
|
37
|
-
* collect cycles). Every other index takes the unchanged runtime call.
|
|
38
|
-
|
|
65
|
+
* collect cycles). Every other index takes the unchanged runtime call.
|
|
66
|
+
* `int32`, for an int32 array, is the value as an i32 when the caller has
|
|
67
|
+
* it at hand. */
|
|
68
|
+
export declare function emitDenseArraySet(host: LlvmEmitterContext, array: string, index: LlValue, indexExpr: IrExpr | undefined, acc: ArrayAccess, element: IrType, value: string, proven?: boolean, int32?: string | null): void;
|
|
39
69
|
/** The dense half of `pop`. An empty array branches to `empty` (the
|
|
40
70
|
* runtime's pop returns a hole state there and changes nothing). When the
|
|
41
71
|
* hole-free prefix bound equals the length, the last element is a present
|
|
@@ -44,11 +74,12 @@ export declare function emitDenseArraySet(host: LlvmEmitterContext, array: strin
|
|
|
44
74
|
* slot out. That block is left open and its slot bits are returned as an
|
|
45
75
|
* i64 (a boolean's 0 or 1, zero-extended); every other array branches to
|
|
46
76
|
* `slow`, which keeps the runtime call. */
|
|
47
|
-
export declare function emitDenseArrayPop(host: LlvmEmitterContext, array: string, acc: ArrayAccess, empty: string, slow: string): string;
|
|
77
|
+
export declare function emitDenseArrayPop(host: LlvmEmitterContext, array: string, acc: ArrayAccess, element: IrType, empty: string, slow: string): string;
|
|
48
78
|
/** `scr_arr_push_*` (the array takes the value's reference) returning the
|
|
49
79
|
* new length as a double. When `len < cap` the runtime's append is exactly
|
|
50
80
|
* a dense store at `len` plus `len + 1`: no sparse entry can exist past the
|
|
51
81
|
* length, nothing is released, and the dense capacity never exceeds the
|
|
52
82
|
* maximum index. A full array takes the unchanged (cold) runtime call,
|
|
53
83
|
* which grows storage. */
|
|
54
|
-
export declare function emitDenseArrayPush(host: LlvmEmitterContext, array: string, acc: ArrayAccess, value: string): string;
|
|
84
|
+
export declare function emitDenseArrayPush(host: LlvmEmitterContext, array: string, acc: ArrayAccess, element: IrType | null, value: string): string;
|
|
85
|
+
export {};
|
|
@@ -14,11 +14,29 @@
|
|
|
14
14
|
* state bytes altogether: the runtime keeps every state below it a present
|
|
15
15
|
* value, so reads load the slot directly and writes replace it without
|
|
16
16
|
* touching its state. Other dense indices take the state-checked path,
|
|
17
|
-
* whose writes extend the bound when they continue it.
|
|
17
|
+
* whose writes extend the bound when they continue it. An array without
|
|
18
|
+
* state bytes (SCR_ARR_STATES clear in `spare`) keeps its bound at its
|
|
19
|
+
* length, so reads never reach the state check for it; a write past the
|
|
20
|
+
* bound tests the flag and, without states, appends at the length. */
|
|
18
21
|
import { isRefCounted } from "../../ir/ir.js";
|
|
19
|
-
import { f64Lit, loadArrCount, SCR_ARR_FIELD, scrArrStatePtr, scrArrStates, sizeToDouble, storeArrCount, } from "./common.js";
|
|
20
|
-
import {
|
|
22
|
+
import { f64Lit, loadArrCount, SCR_ARR_FIELD, SCR_ARR_STATES, scrArrStatePtr, scrArrStates, sizeToDouble, storeArrCount, } from "./common.js";
|
|
23
|
+
import { compactRefLoadLines, compactRefStoreLines } from "./classes.js";
|
|
24
|
+
import { elemAccess } from "./shapes.js";
|
|
25
|
+
import { indexInteger } from "./integer-values.js";
|
|
26
|
+
import { integerOrNaNIndex } from "./wrapping-sums.js";
|
|
21
27
|
const SCR_ARR_VALUE = 1;
|
|
28
|
+
/** Whether the array at `array` has state bytes, as an i1. `spare` changes
|
|
29
|
+
* only in runtime calls, so its loads take their own alias tag. */
|
|
30
|
+
export function emitArrayHasStates(host, array) {
|
|
31
|
+
const B = host.B;
|
|
32
|
+
const sparePtr = B.tmp(), spare = B.tmp(), bit = B.tmp(), has = B.tmp();
|
|
33
|
+
B.line(`${sparePtr} = getelementptr inbounds %ScrArr, ptr ${array}, i32 0, i32 ${SCR_ARR_FIELD.spare}`);
|
|
34
|
+
host.markMemoryPointer(sparePtr, "array:spare");
|
|
35
|
+
B.line(`${spare} = load i16, ptr ${sparePtr}${host.fieldAliasAttachment(sparePtr)}`);
|
|
36
|
+
B.line(`${bit} = and i16 ${spare}, ${SCR_ARR_STATES}`);
|
|
37
|
+
B.line(`${has} = icmp ne i16 ${bit}, 0`);
|
|
38
|
+
return has;
|
|
39
|
+
}
|
|
22
40
|
/** Call-site effects of the non-retaining read fallbacks: they only read
|
|
23
41
|
* module-visible memory, or trap without returning to the caller (the trap
|
|
24
42
|
* writes runtime-private stderr/TLS state). Declaring this lets LLVM keep
|
|
@@ -37,13 +55,22 @@ export const READ_FALLBACK = " cold memory(read, inaccessiblemem: readwrite)";
|
|
|
37
55
|
function emitDenseGuard(host, array, index, indexExpr, slow, requireBelowLen, filledLabel, width, proven = false, prefixOnly = false) {
|
|
38
56
|
const B = host.B;
|
|
39
57
|
const size = host.sizeType;
|
|
40
|
-
const integer =
|
|
58
|
+
const integer = indexInteger(host, index, indexExpr);
|
|
59
|
+
const nanIndex = integer === null ? integerOrNaNIndex(host, index, indexExpr) : null;
|
|
41
60
|
let wide;
|
|
42
61
|
let integral = null;
|
|
43
|
-
if (integer) {
|
|
44
|
-
// A proven integer
|
|
45
|
-
//
|
|
46
|
-
|
|
62
|
+
if (integer !== null) {
|
|
63
|
+
// A proven integer, or a wide view that equals the double at every
|
|
64
|
+
// index below a length, needs no double round-trip. Negative signed
|
|
65
|
+
// values compare above any length or capacity as unsigned 64-bit
|
|
66
|
+
// integers, and every index that fails the comparisons takes the
|
|
67
|
+
// double's path.
|
|
68
|
+
wide = integer;
|
|
69
|
+
}
|
|
70
|
+
else if (nanIndex) {
|
|
71
|
+
// An exact integer or NaN is an index exactly when it is ordered.
|
|
72
|
+
wide = nanIndex.wide;
|
|
73
|
+
integral = nanIndex.ordered;
|
|
47
74
|
}
|
|
48
75
|
else {
|
|
49
76
|
// freeze keeps NaN/out-of-range conversions from producing poison; the
|
|
@@ -156,19 +183,35 @@ function statePointer(host, guard) {
|
|
|
156
183
|
host.markMemoryPointer(statePtr, "array:present");
|
|
157
184
|
return statePtr;
|
|
158
185
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
186
|
+
function slotKind(host, acc, element) {
|
|
187
|
+
return acc === "ref" && host.compactArrayElem(element) ? "cref" : acc;
|
|
188
|
+
}
|
|
189
|
+
/** The dense slot type: boolean arrays store one byte per element, compact
|
|
190
|
+
* references and int32 arrays four, every other element kind an 8-byte slot. */
|
|
191
|
+
function slotType(kind) {
|
|
192
|
+
return kind === "bool" ? "i8" : kind === "cref" || kind === "i32" ? "i32" : "i64";
|
|
163
193
|
}
|
|
164
194
|
/** Bytes per dense slot (scr_arr_slot_width). */
|
|
165
|
-
export function slotWidth(
|
|
166
|
-
return
|
|
195
|
+
export function slotWidth(kind) {
|
|
196
|
+
return kind === "bool" ? 1 : kind === "cref" || kind === "i32" ? 4 : 8;
|
|
167
197
|
}
|
|
168
|
-
|
|
198
|
+
/** Bytes per dense slot of an array of `element` (scr_arr_slot_width). */
|
|
199
|
+
export function denseSlotWidth(host, element) {
|
|
200
|
+
return slotWidth(slotKind(host, elemAccess(element), element));
|
|
201
|
+
}
|
|
202
|
+
/** The runtime accessor family of an access: int32 arrays answer through
|
|
203
|
+
* the double-valued entry points, which convert their slots. */
|
|
204
|
+
export function runtimeAccess(acc) {
|
|
205
|
+
return acc === "i32" ? "f64" : acc;
|
|
206
|
+
}
|
|
207
|
+
/** The LLVM type of an access's values at the emitter's interface. */
|
|
208
|
+
function valueType(acc) {
|
|
209
|
+
return acc === "f64" || acc === "i32" ? "double" : acc === "bool" ? "i1" : "ptr";
|
|
210
|
+
}
|
|
211
|
+
function valuePointer(host, guard, kind) {
|
|
169
212
|
const B = host.B;
|
|
170
213
|
const valuePtr = B.tmp();
|
|
171
|
-
B.line(`${valuePtr} = getelementptr inbounds ${slotType(
|
|
214
|
+
B.line(`${valuePtr} = getelementptr inbounds ${slotType(kind)}, ptr ${guard.data}, ${host.sizeType} ${guard.offset}`);
|
|
172
215
|
host.markMemoryPointer(valuePtr, "array:elements");
|
|
173
216
|
return valuePtr;
|
|
174
217
|
}
|
|
@@ -178,6 +221,8 @@ function loadState(host, guard) {
|
|
|
178
221
|
host.B.line(`${state} = load i8, ptr ${ptr}${host.fieldAliasAttachment(ptr)}`);
|
|
179
222
|
return state;
|
|
180
223
|
}
|
|
224
|
+
/** The ScrElemKind of int32 arrays (scr_array.h). */
|
|
225
|
+
export const SCR_ELEM_I32 = 7;
|
|
181
226
|
/** Before a self-append (`a[i] = a[i] + suffix`) replaces a reference
|
|
182
227
|
* element: when `index` lies in the hole-free prefix and the slot still
|
|
183
228
|
* holds `expected` (the caller's owned snapshot of the old element), the
|
|
@@ -210,14 +255,22 @@ export function emitDenseSlotUnlink(host, array, index, indexExpr, expected, pla
|
|
|
210
255
|
* properties; it also answers sparse indices. Null reference slots take
|
|
211
256
|
* the runtime path, which returns them without a retain. */
|
|
212
257
|
export function emitDenseArrayGet(host, array, index, indexExpr, acc, element, getter, retain, proven = false) {
|
|
258
|
+
return emitDenseArrayRead(host, array, index, indexExpr, acc, element, getter, retain, proven)
|
|
259
|
+
.value;
|
|
260
|
+
}
|
|
261
|
+
/** emitDenseArrayGet, with the int32 of an int32 array's element: the
|
|
262
|
+
* slot itself on the dense path, the runtime getter's double converted
|
|
263
|
+
* (exactly: the element is an int32) on the other. */
|
|
264
|
+
export function emitDenseArrayRead(host, array, index, indexExpr, acc, element, getter, retain, proven = false) {
|
|
213
265
|
const B = host.B;
|
|
214
|
-
const ty = acc
|
|
266
|
+
const ty = valueType(acc);
|
|
215
267
|
const ret = acc === "bool" ? "zeroext i1" : ty;
|
|
268
|
+
const kind = slotKind(host, acc, element);
|
|
216
269
|
host.declare(`declare ${ret} @${getter}(ptr, double)`);
|
|
217
270
|
if (acc === "ref" && retain && !isRefCounted(element)) {
|
|
218
271
|
const t = B.tmp();
|
|
219
272
|
B.line(`${t} = call ${ty} @${getter}(ptr ${array}, double ${index.name})`);
|
|
220
|
-
return t;
|
|
273
|
+
return { value: t, int32: null };
|
|
221
274
|
}
|
|
222
275
|
const slow = B.newLabel("arr.get.slow"), join = B.newLabel("arr.get.join"), valueLabel = B.newLabel("arr.get.value");
|
|
223
276
|
// The state of slot i is at data + cap * (width + 1) - 1 - i: an inline
|
|
@@ -225,7 +278,7 @@ export function emitDenseArrayGet(host, array, index, indexExpr, acc, element, g
|
|
|
225
278
|
// -1 - i as a second induction variable, so above the prefix the runtime
|
|
226
279
|
// getter reads the slot.
|
|
227
280
|
const induction = indexExpr?.kind === "varRef" && host.integerLoopBindings.has(indexExpr.localId);
|
|
228
|
-
const guard = emitDenseGuard(host, array, index, indexExpr, slow, true, valueLabel, slotWidth(
|
|
281
|
+
const guard = emitDenseGuard(host, array, index, indexExpr, slow, true, valueLabel, slotWidth(kind), proven, induction);
|
|
229
282
|
if (!induction) {
|
|
230
283
|
const state = loadState(host, guard);
|
|
231
284
|
const present = B.tmp();
|
|
@@ -233,13 +286,20 @@ export function emitDenseArrayGet(host, array, index, indexExpr, acc, element, g
|
|
|
233
286
|
B.condBr(present, valueLabel, slow);
|
|
234
287
|
}
|
|
235
288
|
B.startBlock(valueLabel);
|
|
236
|
-
const ptr = valuePointer(host, guard,
|
|
289
|
+
const ptr = valuePointer(host, guard, kind);
|
|
237
290
|
let fast;
|
|
291
|
+
let fastInt = null;
|
|
238
292
|
let fastLabel = valueLabel;
|
|
239
293
|
if (acc === "f64") {
|
|
240
294
|
fast = B.tmp();
|
|
241
295
|
B.line(`${fast} = load double, ptr ${ptr}${host.fieldAliasAttachment(ptr)}`);
|
|
242
296
|
}
|
|
297
|
+
else if (acc === "i32") {
|
|
298
|
+
fastInt = B.tmp();
|
|
299
|
+
fast = B.tmp();
|
|
300
|
+
B.line(`${fastInt} = load i32, ptr ${ptr}${host.fieldAliasAttachment(ptr)}`);
|
|
301
|
+
B.line(`${fast} = sitofp i32 ${fastInt} to double`);
|
|
302
|
+
}
|
|
243
303
|
else if (acc === "bool") {
|
|
244
304
|
const raw = B.tmp();
|
|
245
305
|
fast = B.tmp();
|
|
@@ -248,7 +308,15 @@ export function emitDenseArrayGet(host, array, index, indexExpr, acc, element, g
|
|
|
248
308
|
}
|
|
249
309
|
else {
|
|
250
310
|
const raw = B.tmp(), nonnull = B.tmp();
|
|
251
|
-
|
|
311
|
+
if (kind === "cref") {
|
|
312
|
+
const ref = B.tmp();
|
|
313
|
+
B.line(`${ref} = load i32, ptr ${ptr}${host.fieldAliasAttachment(ptr)}`);
|
|
314
|
+
for (const line of compactRefLoadLines(ref, raw, `${raw}.r`))
|
|
315
|
+
B.line(line.trimStart());
|
|
316
|
+
}
|
|
317
|
+
else {
|
|
318
|
+
B.line(`${raw} = load ptr, ptr ${ptr}${host.fieldAliasAttachment(ptr)}`);
|
|
319
|
+
}
|
|
252
320
|
B.line(`${nonnull} = icmp ne ptr ${raw}, null`);
|
|
253
321
|
fastLabel = B.newLabel("arr.get.ref");
|
|
254
322
|
B.condBr(nonnull, fastLabel, slow);
|
|
@@ -260,22 +328,37 @@ export function emitDenseArrayGet(host, array, index, indexExpr, acc, element, g
|
|
|
260
328
|
const slowValue = B.tmp();
|
|
261
329
|
const attrs = acc === "ref" && retain ? " cold" : READ_FALLBACK;
|
|
262
330
|
B.line(`${slowValue} = call ${ty} @${getter}(ptr ${array}, double ${index.name})${attrs}`);
|
|
331
|
+
let slowInt = null;
|
|
332
|
+
if (fastInt !== null) {
|
|
333
|
+
slowInt = B.tmp();
|
|
334
|
+
B.line(`${slowInt} = fptosi double ${slowValue} to i32`);
|
|
335
|
+
}
|
|
263
336
|
B.br(join);
|
|
264
337
|
B.startBlock(join);
|
|
265
338
|
const result = B.tmp();
|
|
266
339
|
B.line(`${result} = phi ${ty} [ ${fast}, %${fastLabel} ], [ ${slowValue}, %${slow} ]`);
|
|
267
|
-
|
|
340
|
+
let int32 = null;
|
|
341
|
+
if (fastInt !== null && slowInt !== null) {
|
|
342
|
+
int32 = B.tmp();
|
|
343
|
+
B.line(`${int32} = phi i32 [ ${fastInt}, %${fastLabel} ], [ ${slowInt}, %${slow} ]`);
|
|
344
|
+
}
|
|
345
|
+
return { value: result, int32 };
|
|
268
346
|
}
|
|
269
347
|
/** `scr_arr_get_number`: a numeric element, or NaN for every missing,
|
|
270
348
|
* hole, or present-undefined slot (answered by the runtime). */
|
|
271
|
-
export function emitDenseArrayNumber(host, array, index, indexExpr, proven = false) {
|
|
272
|
-
return emitDenseArrayGet(host, array, index, indexExpr,
|
|
349
|
+
export function emitDenseArrayNumber(host, array, index, indexExpr, proven = false, acc = "f64") {
|
|
350
|
+
return emitDenseArrayGet(host, array, index, indexExpr, acc, { kind: "f64" }, "scr_arr_get_number", false, proven);
|
|
273
351
|
}
|
|
274
352
|
/** `scr_arr_state` (as a double) or `scr_arr_has` (as an i1). Dense
|
|
275
353
|
* in-range indices answer from the state byte; everything else keeps the
|
|
276
354
|
* runtime query, including canonical indices at or past the length. */
|
|
277
|
-
export function emitDenseArrayState(host, array, index, indexExpr, kind, width
|
|
355
|
+
export function emitDenseArrayState(host, array, index, indexExpr, kind, width,
|
|
356
|
+
/** The index is a dense array loop counter its entry test proved below
|
|
357
|
+
* the hole-free prefix (provenDenseIndex): the slot is a present value. */
|
|
358
|
+
proven = false) {
|
|
278
359
|
const B = host.B;
|
|
360
|
+
if (proven)
|
|
361
|
+
return kind === "state" ? f64Lit(SCR_ARR_VALUE) : "true";
|
|
279
362
|
const fn = kind === "state" ? "scr_arr_state" : "scr_arr_has";
|
|
280
363
|
const ty = kind === "state" ? "double" : "i1";
|
|
281
364
|
host.declare(`declare ${kind === "state" ? "double" : "zeroext i1"} @${fn}(ptr, double)`);
|
|
@@ -308,45 +391,92 @@ export function emitDenseArrayState(host, array, index, indexExpr, kind, width)
|
|
|
308
391
|
* value's reference. A dense index stores the slot, marks it present, and
|
|
309
392
|
* extends the length when it lands at or past it; a replaced present
|
|
310
393
|
* reference is released after the new edge is published (a release can
|
|
311
|
-
* collect cycles). Every other index takes the unchanged runtime call.
|
|
312
|
-
|
|
394
|
+
* collect cycles). Every other index takes the unchanged runtime call.
|
|
395
|
+
* `int32`, for an int32 array, is the value as an i32 when the caller has
|
|
396
|
+
* it at hand. */
|
|
397
|
+
export function emitDenseArraySet(host, array, index, indexExpr, acc, element, value, proven = false, int32 = null) {
|
|
313
398
|
const B = host.B;
|
|
314
|
-
const ty = acc
|
|
315
|
-
const
|
|
399
|
+
const ty = valueType(acc);
|
|
400
|
+
const kind = slotKind(host, acc, element);
|
|
401
|
+
const setter = `scr_arr_set_${runtimeAccess(acc)}`;
|
|
316
402
|
host.declare(`declare void @${setter}(ptr, double, ${acc === "bool" ? "i1 zeroext" : ty})`);
|
|
317
403
|
const call = (attrs) => B.line(`call void @${setter}(ptr ${array}, double ${index.name}, ${ty} ${value})${attrs}`);
|
|
318
404
|
if (acc === "ref" && !isRefCounted(element)) {
|
|
319
405
|
call("");
|
|
320
406
|
return;
|
|
321
407
|
}
|
|
408
|
+
// An int32 array's stores are proven int32s (ir/int32-arrays.ts); both
|
|
409
|
+
// dense paths below store the converted value.
|
|
410
|
+
let int32Value = int32;
|
|
411
|
+
if (acc === "i32" && int32Value === null) {
|
|
412
|
+
int32Value = B.tmp();
|
|
413
|
+
B.line(`${int32Value} = fptosi double ${value} to i32`);
|
|
414
|
+
}
|
|
322
415
|
const slow = B.newLabel("arr.set.slow"), join = B.newLabel("arr.set.join"), filledLabel = B.newLabel("arr.set.filled");
|
|
323
|
-
const guard = emitDenseGuard(host, array, index, indexExpr, slow, false, filledLabel, slotWidth(
|
|
416
|
+
const guard = emitDenseGuard(host, array, index, indexExpr, slow, false, filledLabel, slotWidth(kind), proven);
|
|
324
417
|
const { offset, len } = guard;
|
|
325
418
|
const storeValue = (valuePtr) => {
|
|
326
419
|
if (acc === "f64") {
|
|
327
420
|
B.line(`store double ${value}, ptr ${valuePtr}${host.fieldAliasAttachment(valuePtr)}`);
|
|
328
421
|
}
|
|
422
|
+
else if (acc === "i32") {
|
|
423
|
+
B.line(`store i32 ${int32Value}, ptr ${valuePtr}${host.fieldAliasAttachment(valuePtr)}`);
|
|
424
|
+
}
|
|
329
425
|
else if (acc === "bool") {
|
|
330
426
|
const bits = B.tmp();
|
|
331
427
|
B.line(`${bits} = zext i1 ${value} to i8`);
|
|
332
428
|
B.line(`store i8 ${bits}, ptr ${valuePtr}${host.fieldAliasAttachment(valuePtr)}`);
|
|
333
429
|
}
|
|
430
|
+
else if (kind === "cref") {
|
|
431
|
+
const ref = B.tmp();
|
|
432
|
+
for (const line of compactRefStoreLines(value, ref, `${ref}.r`))
|
|
433
|
+
B.line(line.trimStart());
|
|
434
|
+
B.line(`store i32 ${ref}, ptr ${valuePtr}${host.fieldAliasAttachment(valuePtr)}`);
|
|
435
|
+
}
|
|
334
436
|
else {
|
|
335
437
|
B.line(`store ptr ${value}, ptr ${valuePtr}${host.fieldAliasAttachment(valuePtr)}`);
|
|
336
438
|
}
|
|
337
439
|
};
|
|
440
|
+
const stated = B.newLabel("arr.set.states"), plain = B.newLabel("arr.set.plain"), plainStore = B.newLabel("arr.set.values"), stored = B.newLabel("arr.set.stored.slot");
|
|
441
|
+
B.condBr(emitArrayHasStates(host, array), stated, plain);
|
|
442
|
+
B.startBlock(stated);
|
|
338
443
|
const statePtr = statePointer(host, guard);
|
|
339
|
-
const valuePtr = valuePointer(host, guard,
|
|
340
|
-
let
|
|
341
|
-
let
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
444
|
+
const valuePtr = valuePointer(host, guard, kind);
|
|
445
|
+
let statedOld = null;
|
|
446
|
+
let statedHad = null;
|
|
447
|
+
// Compact instances are never released: a replaced one needs nothing.
|
|
448
|
+
if (kind === "ref") {
|
|
449
|
+
const oldState = B.tmp();
|
|
450
|
+
statedOld = B.tmp();
|
|
451
|
+
statedHad = B.tmp();
|
|
345
452
|
B.line(`${oldState} = load i8, ptr ${statePtr}${host.fieldAliasAttachment(statePtr)}`);
|
|
346
|
-
B.line(`${
|
|
453
|
+
B.line(`${statedOld} = load ptr, ptr ${valuePtr}${host.fieldAliasAttachment(valuePtr)}`);
|
|
454
|
+
B.line(`${statedHad} = icmp eq i8 ${oldState}, ${SCR_ARR_VALUE}`);
|
|
347
455
|
}
|
|
348
456
|
storeValue(valuePtr);
|
|
349
457
|
B.line(`store i8 ${SCR_ARR_VALUE}, ptr ${statePtr}${host.fieldAliasAttachment(statePtr)}`);
|
|
458
|
+
const statedEnd = B.currentLabel();
|
|
459
|
+
B.br(stored);
|
|
460
|
+
// Without states the bound is the length, so a store here appends at
|
|
461
|
+
// the length (it replaces no value) or leaves holes, which the runtime
|
|
462
|
+
// gives states.
|
|
463
|
+
B.startBlock(plain);
|
|
464
|
+
const appends = B.tmp();
|
|
465
|
+
B.line(`${appends} = icmp eq ${host.sizeType} ${offset}, ${len}`);
|
|
466
|
+
B.condBr(appends, plainStore, slow);
|
|
467
|
+
B.startBlock(plainStore);
|
|
468
|
+
storeValue(valuePointer(host, guard, kind));
|
|
469
|
+
const plainEnd = B.currentLabel();
|
|
470
|
+
B.br(stored);
|
|
471
|
+
B.startBlock(stored);
|
|
472
|
+
let old = null;
|
|
473
|
+
let hadValue = null;
|
|
474
|
+
if (kind === "ref") {
|
|
475
|
+
old = B.tmp();
|
|
476
|
+
hadValue = B.tmp();
|
|
477
|
+
B.line(`${old} = phi ptr [ ${statedOld}, %${statedEnd} ], [ null, %${plainEnd} ]`);
|
|
478
|
+
B.line(`${hadValue} = phi i1 [ ${statedHad}, %${statedEnd} ], [ false, %${plainEnd} ]`);
|
|
479
|
+
}
|
|
350
480
|
// A store at the bound continues the hole-free prefix.
|
|
351
481
|
const filledWide = sizedFilled(host, guard.filled), continues = B.tmp();
|
|
352
482
|
B.line(`${continues} = icmp eq ${host.sizeType} ${offset}, ${filledWide}`);
|
|
@@ -381,9 +511,7 @@ export function emitDenseArraySet(host, array, index, indexExpr, acc, element, v
|
|
|
381
511
|
storeArrCount(host, nextLen, lenPtr, host.fieldAliasAttachment(lenPtr));
|
|
382
512
|
B.br(storedLabel);
|
|
383
513
|
B.startBlock(storedLabel);
|
|
384
|
-
if (
|
|
385
|
-
const hadValue = B.tmp();
|
|
386
|
-
B.line(`${hadValue} = icmp eq i8 ${oldState}, ${SCR_ARR_VALUE}`);
|
|
514
|
+
if (kind === "ref" && hadValue && old) {
|
|
387
515
|
const releaseLabel = B.newLabel("arr.set.release");
|
|
388
516
|
B.condBr(hadValue, releaseLabel, join);
|
|
389
517
|
B.startBlock(releaseLabel);
|
|
@@ -393,9 +521,9 @@ export function emitDenseArraySet(host, array, index, indexExpr, acc, element, v
|
|
|
393
521
|
// Below the bound the slot holds a present value: replace it, leaving
|
|
394
522
|
// the state alone, and release a replaced reference after the store.
|
|
395
523
|
B.startBlock(filledLabel);
|
|
396
|
-
const filledValuePtr = valuePointer(host, guard,
|
|
524
|
+
const filledValuePtr = valuePointer(host, guard, kind);
|
|
397
525
|
let filledOld = null;
|
|
398
|
-
if (
|
|
526
|
+
if (kind === "ref") {
|
|
399
527
|
filledOld = B.tmp();
|
|
400
528
|
B.line(`${filledOld} = load ptr, ptr ${filledValuePtr}${host.fieldAliasAttachment(filledValuePtr)}`);
|
|
401
529
|
}
|
|
@@ -416,8 +544,9 @@ export function emitDenseArraySet(host, array, index, indexExpr, acc, element, v
|
|
|
416
544
|
* slot out. That block is left open and its slot bits are returned as an
|
|
417
545
|
* i64 (a boolean's 0 or 1, zero-extended); every other array branches to
|
|
418
546
|
* `slow`, which keeps the runtime call. */
|
|
419
|
-
export function emitDenseArrayPop(host, array, acc, empty, slow) {
|
|
547
|
+
export function emitDenseArrayPop(host, array, acc, element, empty, slow) {
|
|
420
548
|
const B = host.B;
|
|
549
|
+
const kind = slotKind(host, acc, element);
|
|
421
550
|
const size = host.sizeType;
|
|
422
551
|
const header = (field) => {
|
|
423
552
|
const ptr = B.tmp();
|
|
@@ -442,10 +571,10 @@ export function emitDenseArrayPop(host, array, acc, empty, slow) {
|
|
|
442
571
|
const dataPtr = header(SCR_ARR_FIELD.data), data = B.tmp(), capPtr = header(SCR_ARR_FIELD.cap), cap = B.tmp(), states = B.tmp();
|
|
443
572
|
B.line(`${data} = load ptr, ptr ${dataPtr}${host.fieldAliasAttachment(dataPtr)}`);
|
|
444
573
|
loadArrCount(host, cap, capPtr, host.fieldAliasAttachment(capPtr));
|
|
445
|
-
scrArrStates(host, states, data, cap, slotWidth(
|
|
446
|
-
const valuePtr = valuePointer(host, { offset: last, data },
|
|
574
|
+
scrArrStates(host, states, data, cap, slotWidth(kind));
|
|
575
|
+
const valuePtr = valuePointer(host, { offset: last, data }, kind);
|
|
447
576
|
const statePtr = statePointer(host, { offset: last, states });
|
|
448
|
-
const slotTy = slotType(
|
|
577
|
+
const slotTy = slotType(kind);
|
|
449
578
|
let raw = B.tmp();
|
|
450
579
|
B.line(`${raw} = load ${slotTy}, ptr ${valuePtr}${host.fieldAliasAttachment(valuePtr)}`);
|
|
451
580
|
if (slotTy === "i8") {
|
|
@@ -453,8 +582,30 @@ export function emitDenseArrayPop(host, array, acc, empty, slow) {
|
|
|
453
582
|
B.line(`${wide} = zext i8 ${raw} to i64`);
|
|
454
583
|
raw = wide;
|
|
455
584
|
}
|
|
585
|
+
else if (slotTy === "i32") {
|
|
586
|
+
if (kind === "cref") {
|
|
587
|
+
// The 8-byte slot of a compact reference is its address.
|
|
588
|
+
const wide = B.tmp(), address = B.tmp();
|
|
589
|
+
B.line(`${wide} = zext i32 ${raw} to i64`);
|
|
590
|
+
B.line(`${address} = shl nuw nsw i64 ${wide}, 3`);
|
|
591
|
+
raw = address;
|
|
592
|
+
}
|
|
593
|
+
else {
|
|
594
|
+
// The slot bits of an int32 element's double, as the f64 path returns them.
|
|
595
|
+
const number = B.tmp(), bits = B.tmp();
|
|
596
|
+
B.line(`${number} = sitofp i32 ${raw} to double`);
|
|
597
|
+
B.line(`${bits} = bitcast double ${number} to i64`);
|
|
598
|
+
raw = bits;
|
|
599
|
+
}
|
|
600
|
+
}
|
|
456
601
|
B.line(`store ${slotTy} 0, ptr ${valuePtr}${host.fieldAliasAttachment(valuePtr)}`);
|
|
602
|
+
// Only an array with states has a state byte to clear.
|
|
603
|
+
const clear = B.newLabel("arr.pop.state"), cleared = B.newLabel("arr.pop.cleared");
|
|
604
|
+
B.condBr(emitArrayHasStates(host, array), clear, cleared);
|
|
605
|
+
B.startBlock(clear);
|
|
457
606
|
B.line(`store i8 0, ptr ${statePtr}${host.fieldAliasAttachment(statePtr)}`);
|
|
607
|
+
B.br(cleared);
|
|
608
|
+
B.startBlock(cleared);
|
|
458
609
|
let last32 = last;
|
|
459
610
|
if (size === "i64") {
|
|
460
611
|
last32 = B.tmp();
|
|
@@ -470,11 +621,12 @@ export function emitDenseArrayPop(host, array, acc, empty, slow) {
|
|
|
470
621
|
* length, nothing is released, and the dense capacity never exceeds the
|
|
471
622
|
* maximum index. A full array takes the unchanged (cold) runtime call,
|
|
472
623
|
* which grows storage. */
|
|
473
|
-
export function emitDenseArrayPush(host, array, acc, value) {
|
|
624
|
+
export function emitDenseArrayPush(host, array, acc, element, value) {
|
|
474
625
|
const B = host.B;
|
|
475
626
|
const size = host.sizeType;
|
|
476
|
-
const
|
|
477
|
-
const
|
|
627
|
+
const kind = element === null ? acc : slotKind(host, acc, element);
|
|
628
|
+
const ty = valueType(acc);
|
|
629
|
+
const pusher = `scr_arr_push_${runtimeAccess(acc)}`;
|
|
478
630
|
host.declare(`declare double @${pusher}(ptr, ${acc === "bool" ? "i1 zeroext" : ty})`);
|
|
479
631
|
const header = (field) => {
|
|
480
632
|
const ptr = B.tmp();
|
|
@@ -496,21 +648,38 @@ export function emitDenseArrayPush(host, array, acc, value) {
|
|
|
496
648
|
// `cap - len` formed first, the store addresses it from one register sum.
|
|
497
649
|
B.line(`${spare} = sub nuw ${size} ${cap}, ${len}`);
|
|
498
650
|
B.line(`${near} = getelementptr inbounds i8, ptr ${data}, ${size} ${spare}`);
|
|
499
|
-
B.line(`${statePtr} = getelementptr inbounds [${slotWidth(
|
|
651
|
+
B.line(`${statePtr} = getelementptr inbounds [${slotWidth(kind)} x i8], ptr ${near}, ${size} ${cap}, ${size} -1`);
|
|
500
652
|
host.markMemoryPointer(statePtr, "array:present");
|
|
501
|
-
const valuePtr = valuePointer(host, { offset: len, data },
|
|
653
|
+
const valuePtr = valuePointer(host, { offset: len, data }, kind);
|
|
502
654
|
if (acc === "f64") {
|
|
503
655
|
B.line(`store double ${value}, ptr ${valuePtr}${host.fieldAliasAttachment(valuePtr)}`);
|
|
504
656
|
}
|
|
657
|
+
else if (acc === "i32") {
|
|
658
|
+
const int32 = B.tmp();
|
|
659
|
+
B.line(`${int32} = fptosi double ${value} to i32`);
|
|
660
|
+
B.line(`store i32 ${int32}, ptr ${valuePtr}${host.fieldAliasAttachment(valuePtr)}`);
|
|
661
|
+
}
|
|
505
662
|
else if (acc === "bool") {
|
|
506
663
|
const bits = B.tmp();
|
|
507
664
|
B.line(`${bits} = zext i1 ${value} to i8`);
|
|
508
665
|
B.line(`store i8 ${bits}, ptr ${valuePtr}${host.fieldAliasAttachment(valuePtr)}`);
|
|
509
666
|
}
|
|
667
|
+
else if (kind === "cref") {
|
|
668
|
+
const ref = B.tmp();
|
|
669
|
+
for (const line of compactRefStoreLines(value, ref, `${ref}.r`))
|
|
670
|
+
B.line(line.trimStart());
|
|
671
|
+
B.line(`store i32 ${ref}, ptr ${valuePtr}${host.fieldAliasAttachment(valuePtr)}`);
|
|
672
|
+
}
|
|
510
673
|
else {
|
|
511
674
|
B.line(`store ptr ${value}, ptr ${valuePtr}${host.fieldAliasAttachment(valuePtr)}`);
|
|
512
675
|
}
|
|
676
|
+
// Only an array with states has a state byte to mark.
|
|
677
|
+
const mark = B.newLabel("arr.push.state"), marked = B.newLabel("arr.push.marked");
|
|
678
|
+
B.condBr(emitArrayHasStates(host, array), mark, marked);
|
|
679
|
+
B.startBlock(mark);
|
|
513
680
|
B.line(`store i8 ${SCR_ARR_VALUE}, ptr ${statePtr}${host.fieldAliasAttachment(statePtr)}`);
|
|
681
|
+
B.br(marked);
|
|
682
|
+
B.startBlock(marked);
|
|
514
683
|
const next = B.tmp(), fastValue = B.tmp();
|
|
515
684
|
B.line(`${next} = add nuw ${size} ${len}, 1`);
|
|
516
685
|
storeArrCount(host, next, lenPtr, host.fieldAliasAttachment(lenPtr));
|
|
@@ -523,6 +692,7 @@ export function emitDenseArrayPush(host, array, acc, value) {
|
|
|
523
692
|
B.line(`${bumped} = select i1 ${packed}, i32 ${nextFilled}, i32 ${filled}`);
|
|
524
693
|
B.line(`store i32 ${bumped}, ptr ${filledPtr}${host.fieldAliasAttachment(filledPtr)}`);
|
|
525
694
|
B.line(`${fastValue} = ${sizeToDouble(size)} ${size} ${next} to double`);
|
|
695
|
+
const fastEnd = B.currentLabel();
|
|
526
696
|
B.br(join);
|
|
527
697
|
B.startBlock(slow);
|
|
528
698
|
const slowValue = B.tmp();
|
|
@@ -530,7 +700,7 @@ export function emitDenseArrayPush(host, array, acc, value) {
|
|
|
530
700
|
B.br(join);
|
|
531
701
|
B.startBlock(join);
|
|
532
702
|
const result = B.tmp();
|
|
533
|
-
B.line(`${result} = phi double [ ${fastValue}, %${
|
|
703
|
+
B.line(`${result} = phi double [ ${fastValue}, %${fastEnd} ], [ ${slowValue}, %${slow} ]`);
|
|
534
704
|
return result;
|
|
535
705
|
}
|
|
536
706
|
//# sourceMappingURL=dense-array-access.js.map
|