@scriptc/compiler 0.4.4 → 0.4.5
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 +198 -44
- package/ambient/scriptc-overrides.d.ts +21 -0
- package/dist/backend/executable-features.js +3 -0
- package/dist/backend/executable-features.js.map +1 -1
- package/dist/backend/library-pack.js +2 -1
- package/dist/backend/library-pack.js.map +1 -1
- package/dist/backend/linker.js +11 -1
- package/dist/backend/linker.js.map +1 -1
- package/dist/backend/lld.d.ts +9 -0
- package/dist/backend/lld.js +48 -0
- package/dist/backend/lld.js.map +1 -0
- package/dist/backend/lld.test.d.ts +1 -0
- package/dist/backend/lld.test.js +53 -0
- package/dist/backend/lld.test.js.map +1 -0
- package/dist/backend/llvm/appended-array-literals.d.ts +11 -1
- package/dist/backend/llvm/appended-array-literals.js +29 -0
- package/dist/backend/llvm/appended-array-literals.js.map +1 -1
- package/dist/backend/llvm/blocks.js +10 -1
- package/dist/backend/llvm/blocks.js.map +1 -1
- package/dist/backend/llvm/bytes-alias.d.ts +13 -4
- package/dist/backend/llvm/bytes-alias.js +16 -5
- package/dist/backend/llvm/bytes-alias.js.map +1 -1
- package/dist/backend/llvm/bytes-bounds.d.ts +5 -1
- package/dist/backend/llvm/bytes-bounds.js +199 -2
- package/dist/backend/llvm/bytes-bounds.js.map +1 -1
- package/dist/backend/llvm/bytes-loop-versions.d.ts +45 -3
- package/dist/backend/llvm/bytes-loop-versions.js +238 -20
- package/dist/backend/llvm/bytes-loop-versions.js.map +1 -1
- package/dist/backend/llvm/bytes-loop-versions.test.js +11 -4
- package/dist/backend/llvm/bytes-loop-versions.test.js.map +1 -1
- package/dist/backend/llvm/call-lifetimes.d.ts +8 -2
- package/dist/backend/llvm/call-lifetimes.js +87 -18
- package/dist/backend/llvm/call-lifetimes.js.map +1 -1
- package/dist/backend/llvm/call-lifetimes.test.js +132 -0
- package/dist/backend/llvm/call-lifetimes.test.js.map +1 -1
- package/dist/backend/llvm/classes.d.ts +3 -2
- package/dist/backend/llvm/classes.js +4 -4
- package/dist/backend/llvm/classes.js.map +1 -1
- package/dist/backend/llvm/counted-loops.d.ts +14 -2
- package/dist/backend/llvm/counted-loops.js +54 -5
- package/dist/backend/llvm/counted-loops.js.map +1 -1
- package/dist/backend/llvm/debug-info.d.ts +42 -1
- package/dist/backend/llvm/debug-info.js +70 -1
- package/dist/backend/llvm/debug-info.js.map +1 -1
- package/dist/backend/llvm/dense-array-loops.js +2 -2
- package/dist/backend/llvm/dense-array-loops.js.map +1 -1
- package/dist/backend/llvm/dense-array-loops.test.js +1 -0
- package/dist/backend/llvm/dense-array-loops.test.js.map +1 -1
- package/dist/backend/llvm/dyn.d.ts +65 -8
- package/dist/backend/llvm/dyn.js +375 -40
- package/dist/backend/llvm/dyn.js.map +1 -1
- package/dist/backend/llvm/emit-function.js +28 -8
- package/dist/backend/llvm/emit-function.js.map +1 -1
- package/dist/backend/llvm/emit-journal.d.ts +8 -4
- package/dist/backend/llvm/emit-journal.js +75 -5
- package/dist/backend/llvm/emit-journal.js.map +1 -1
- package/dist/backend/llvm/emit-module.d.ts +4 -0
- package/dist/backend/llvm/emit-module.js +58 -23
- package/dist/backend/llvm/emit-module.js.map +1 -1
- package/dist/backend/llvm/emit-statements.js +297 -28
- package/dist/backend/llvm/emit-statements.js.map +1 -1
- package/dist/backend/llvm/emitter.d.ts +134 -13
- package/dist/backend/llvm/emitter.js +514 -87
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/backend/llvm/expr-bytes.d.ts +6 -4
- package/dist/backend/llvm/expr-bytes.js +31 -8
- package/dist/backend/llvm/expr-bytes.js.map +1 -1
- package/dist/backend/llvm/expr-calls.js +13 -11
- package/dist/backend/llvm/expr-calls.js.map +1 -1
- package/dist/backend/llvm/expr-containers.d.ts +11 -0
- package/dist/backend/llvm/expr-containers.js +87 -9
- package/dist/backend/llvm/expr-containers.js.map +1 -1
- package/dist/backend/llvm/expr-context.d.ts +3 -0
- package/dist/backend/llvm/expr-control.js +83 -0
- package/dist/backend/llvm/expr-control.js.map +1 -1
- package/dist/backend/llvm/expr-dynamic.d.ts +1 -1
- package/dist/backend/llvm/expr-dynamic.js +22 -4
- package/dist/backend/llvm/expr-dynamic.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.js +107 -9
- package/dist/backend/llvm/expr-primitives.js.map +1 -1
- package/dist/backend/llvm/expr-stream-bridges.js +95 -22
- package/dist/backend/llvm/expr-stream-bridges.js.map +1 -1
- package/dist/backend/llvm/forked-analysis.d.ts +8 -0
- package/dist/backend/llvm/forked-analysis.js +43 -0
- package/dist/backend/llvm/forked-analysis.js.map +1 -0
- package/dist/backend/llvm/integer-values.d.ts +7 -0
- package/dist/backend/llvm/integer-values.js +42 -2
- package/dist/backend/llvm/integer-values.js.map +1 -1
- package/dist/backend/llvm/integer-views.d.ts +2 -1
- package/dist/backend/llvm/integer-views.js +12 -1
- package/dist/backend/llvm/integer-views.js.map +1 -1
- package/dist/backend/llvm/js-ic.d.ts +4 -0
- package/dist/backend/llvm/js-ic.js +133 -15
- package/dist/backend/llvm/js-ic.js.map +1 -1
- package/dist/backend/llvm/layouts.d.ts +1 -0
- package/dist/backend/llvm/layouts.js.map +1 -1
- package/dist/backend/llvm/lazy-captures.d.ts +6 -1
- package/dist/backend/llvm/lazy-captures.js +10 -5
- package/dist/backend/llvm/lazy-captures.js.map +1 -1
- package/dist/backend/llvm/lib-abi.d.ts +5 -0
- package/dist/backend/llvm/lib-abi.js +19 -0
- package/dist/backend/llvm/lib-abi.js.map +1 -1
- package/dist/backend/llvm/lib-dispatch.js +128 -42
- package/dist/backend/llvm/lib-dispatch.js.map +1 -1
- package/dist/backend/llvm/lib-filesystem.d.ts +10 -0
- package/dist/backend/llvm/lib-filesystem.js +32 -0
- package/dist/backend/llvm/lib-filesystem.js.map +1 -1
- package/dist/backend/llvm/lib-http2.js +2 -2
- package/dist/backend/llvm/lib-http2.js.map +1 -1
- package/dist/backend/llvm/lib-network.js +2 -0
- package/dist/backend/llvm/lib-network.js.map +1 -1
- package/dist/backend/llvm/lib-process.js +11 -0
- package/dist/backend/llvm/lib-process.js.map +1 -1
- package/dist/backend/llvm/lib-shared.js +43 -0
- package/dist/backend/llvm/lib-shared.js.map +1 -1
- package/dist/backend/llvm/lib-tls.js +28 -3
- package/dist/backend/llvm/lib-tls.js.map +1 -1
- package/dist/backend/llvm/local-union-storage.test.js +2 -1
- package/dist/backend/llvm/local-union-storage.test.js.map +1 -1
- package/dist/backend/llvm/loop-array-borrows.d.ts +4 -1
- package/dist/backend/llvm/loop-array-borrows.js +11 -5
- package/dist/backend/llvm/loop-array-borrows.js.map +1 -1
- package/dist/backend/llvm/map-entry-fusion.d.ts +5 -3
- package/dist/backend/llvm/map-entry-fusion.js +20 -11
- package/dist/backend/llvm/map-entry-fusion.js.map +1 -1
- package/dist/backend/llvm/map-entry-fusion.test.js +14 -6
- package/dist/backend/llvm/map-entry-fusion.test.js.map +1 -1
- package/dist/backend/llvm/map-number-lookup.d.ts +16 -6
- package/dist/backend/llvm/map-number-lookup.js +41 -9
- package/dist/backend/llvm/map-number-lookup.js.map +1 -1
- package/dist/backend/llvm/map-number-lookup.test.js +70 -2
- package/dist/backend/llvm/map-number-lookup.test.js.map +1 -1
- package/dist/backend/llvm/map-read-lifetimes.d.ts +25 -2
- package/dist/backend/llvm/map-read-lifetimes.js +136 -6
- package/dist/backend/llvm/map-read-lifetimes.js.map +1 -1
- package/dist/backend/llvm/map-read-lifetimes.test.js +8 -3
- package/dist/backend/llvm/map-read-lifetimes.test.js.map +1 -1
- package/dist/backend/llvm/nullable-unions.d.ts +5 -0
- package/dist/backend/llvm/nullable-unions.js +29 -2
- package/dist/backend/llvm/nullable-unions.js.map +1 -1
- package/dist/backend/llvm/nullable-unions.test.js +25 -1
- package/dist/backend/llvm/nullable-unions.test.js.map +1 -1
- package/dist/backend/llvm/record-union-keys.test.d.ts +1 -0
- package/dist/backend/llvm/record-union-keys.test.js +161 -0
- package/dist/backend/llvm/record-union-keys.test.js.map +1 -0
- package/dist/backend/llvm/serialized-ir-emission.test.js +2 -0
- package/dist/backend/llvm/serialized-ir-emission.test.js.map +1 -1
- package/dist/backend/llvm/shapes.d.ts +4 -5
- package/dist/backend/llvm/shapes.js +104 -51
- package/dist/backend/llvm/shapes.js.map +1 -1
- package/dist/backend/llvm/shapes.test.js +14 -2
- package/dist/backend/llvm/shapes.test.js.map +1 -1
- package/dist/backend/llvm/speculative-integers.d.ts +50 -3
- package/dist/backend/llvm/speculative-integers.js +411 -24
- package/dist/backend/llvm/speculative-integers.js.map +1 -1
- package/dist/backend/llvm/speculative-integers.test.js +103 -1
- package/dist/backend/llvm/speculative-integers.test.js.map +1 -1
- package/dist/backend/llvm/split.d.ts +10 -1
- package/dist/backend/llvm/split.js +243 -59
- package/dist/backend/llvm/split.js.map +1 -1
- package/dist/backend/llvm/split.test.js +92 -13
- package/dist/backend/llvm/split.test.js.map +1 -1
- package/dist/backend/llvm/stack-objects.test.js +3 -2
- package/dist/backend/llvm/stack-objects.test.js.map +1 -1
- package/dist/backend/llvm/string-lifetimes.test.js +1 -1
- package/dist/backend/llvm/string-lifetimes.test.js.map +1 -1
- package/dist/backend/llvm/string-reads.d.ts +13 -0
- package/dist/backend/llvm/string-reads.js +22 -0
- package/dist/backend/llvm/string-reads.js.map +1 -1
- package/dist/backend/llvm/string-slices.d.ts +36 -2
- package/dist/backend/llvm/string-slices.js +308 -12
- package/dist/backend/llvm/string-slices.js.map +1 -1
- package/dist/backend/llvm/string-slices.test.js +182 -3
- package/dist/backend/llvm/string-slices.test.js.map +1 -1
- package/dist/backend/llvm/string-unit-versions.d.ts +11 -0
- package/dist/backend/llvm/string-unit-versions.js +191 -0
- package/dist/backend/llvm/string-unit-versions.js.map +1 -0
- package/dist/backend/llvm/string-unit-versions.test.d.ts +1 -0
- package/dist/backend/llvm/string-unit-versions.test.js +117 -0
- package/dist/backend/llvm/string-unit-versions.test.js.map +1 -0
- package/dist/backend/llvm/test-boxed-unions.d.ts +5 -2
- package/dist/backend/llvm/test-boxed-unions.js +24 -8
- package/dist/backend/llvm/test-boxed-unions.js.map +1 -1
- package/dist/backend/llvm/unwind-abi.d.ts +52 -0
- package/dist/backend/llvm/unwind-abi.js +498 -0
- package/dist/backend/llvm/unwind-abi.js.map +1 -0
- package/dist/backend/llvm/unwind-abi.test.d.ts +1 -0
- package/dist/backend/llvm/unwind-abi.test.js +255 -0
- package/dist/backend/llvm/unwind-abi.test.js.map +1 -0
- package/dist/backend/llvm/wrapping-sums.d.ts +14 -10
- package/dist/backend/llvm/wrapping-sums.js +31 -14
- package/dist/backend/llvm/wrapping-sums.js.map +1 -1
- package/dist/backend/loop-polls.d.ts +6 -0
- package/dist/backend/loop-polls.js +24 -0
- package/dist/backend/loop-polls.js.map +1 -1
- package/dist/backend/may-throw.js +8 -8
- package/dist/backend/may-throw.js.map +1 -1
- package/dist/backend/native/contracts.d.ts +12 -2
- package/dist/backend/native/executable.js +48 -6
- package/dist/backend/native/executable.js.map +1 -1
- package/dist/backend/native/library.js +4 -3
- package/dist/backend/native/library.js.map +1 -1
- package/dist/backend/native/program-shards.d.ts +2 -2
- package/dist/backend/native/program-shards.js +2 -2
- package/dist/backend/native/program-shards.js.map +1 -1
- package/dist/backend/native/runtime-inputs.d.ts +1 -1
- package/dist/backend/native/runtime-inputs.js +4 -1
- package/dist/backend/native/runtime-inputs.js.map +1 -1
- package/dist/backend/native/vendor.d.ts +1 -1
- package/dist/backend/native/vendor.js +1 -1
- package/dist/backend/native/vendor.js.map +1 -1
- package/dist/backend/native-codegen.d.ts +3 -1
- package/dist/backend/native-codegen.js +4 -3
- package/dist/backend/native-codegen.js.map +1 -1
- package/dist/backend/native-link-info-core.d.ts +8 -0
- package/dist/backend/native-link-info-core.js.map +1 -1
- package/dist/backend/native-profile.d.ts +14 -0
- package/dist/backend/native-profile.js +28 -0
- package/dist/backend/native-profile.js.map +1 -1
- package/dist/backend/native-profile.test.js +8 -1
- package/dist/backend/native-profile.test.js.map +1 -1
- package/dist/backend/native-toolchain.test.js +11 -11
- package/dist/backend/native-toolchain.test.js.map +1 -1
- 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 +3 -1
- package/dist/backend/runtime-pack-core.js +2 -0
- package/dist/backend/runtime-pack-core.js.map +1 -1
- package/dist/backend/runtime-pack-native.d.ts +17 -5
- package/dist/backend/runtime-pack-native.js +186 -14
- package/dist/backend/runtime-pack-native.js.map +1 -1
- package/dist/backend/runtime-pack-native.test.js +160 -3
- package/dist/backend/runtime-pack-native.test.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/vendor-archives.d.ts +4 -1
- package/dist/backend/vendor-archives.js +78 -4
- package/dist/backend/vendor-archives.js.map +1 -1
- package/dist/backend/vendor-inputs.d.ts +3 -1
- package/dist/backend/vendor-inputs.js +3 -1
- package/dist/backend/vendor-inputs.js.map +1 -1
- package/dist/backend/warm-cache.js +1 -0
- package/dist/backend/warm-cache.js.map +1 -1
- package/dist/cli/command.js +78 -11
- package/dist/cli/command.js.map +1 -1
- package/dist/cli/usage.d.ts +22 -1
- package/dist/cli/usage.js +33 -3
- package/dist/cli/usage.js.map +1 -1
- package/dist/compat/fetch-profile.d.ts +15 -6
- package/dist/compat/fetch-profile.js +519 -498
- package/dist/compat/fetch-profile.js.map +1 -1
- package/dist/compile-types.d.ts +7 -0
- package/dist/contracts/int32-elements.js +2 -1
- package/dist/contracts/int32-elements.js.map +1 -1
- package/dist/coverage/report.d.ts +14 -3
- package/dist/coverage/report.js +216 -0
- package/dist/coverage/report.js.map +1 -1
- package/dist/coverage/surface-manifest.js +25 -25
- package/dist/coverage/surface-manifest.js.map +1 -1
- package/dist/coverage/verdict-cache.d.ts +2 -0
- package/dist/coverage/verdict-cache.js +10 -1
- package/dist/coverage/verdict-cache.js.map +1 -1
- package/dist/diagnostics/diagnostic.d.ts +19 -0
- package/dist/diagnostics/diagnostic.js +52 -1
- package/dist/diagnostics/diagnostic.js.map +1 -1
- package/dist/diagnostics/envelope.d.ts +54 -0
- package/dist/diagnostics/envelope.js +7 -1
- package/dist/diagnostics/envelope.js.map +1 -1
- package/dist/diagnostics/render.d.ts +7 -0
- package/dist/diagnostics/render.js +15 -4
- package/dist/diagnostics/render.js.map +1 -1
- package/dist/executable/executable-cache.d.ts +3 -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/executable/prepare.js +5 -1
- package/dist/executable/prepare.js.map +1 -1
- package/dist/frontend/analysis.js +26 -2
- package/dist/frontend/analysis.js.map +1 -1
- package/dist/frontend/fork-target.js +67 -1
- package/dist/frontend/fork-target.js.map +1 -1
- package/dist/frontend/fork-target.test.js +43 -0
- package/dist/frontend/fork-target.test.js.map +1 -1
- package/dist/frontend/input-tracker.d.ts +4 -1
- package/dist/frontend/input-tracker.js +42 -4
- package/dist/frontend/input-tracker.js.map +1 -1
- package/dist/frontend/input-tracker.test.js +45 -0
- package/dist/frontend/input-tracker.test.js.map +1 -1
- package/dist/frontend/lowering/abstract-equality.js +38 -1
- package/dist/frontend/lowering/abstract-equality.js.map +1 -1
- package/dist/frontend/lowering/argument-counts.d.ts +36 -0
- package/dist/frontend/lowering/argument-counts.js +201 -0
- package/dist/frontend/lowering/argument-counts.js.map +1 -0
- package/dist/frontend/lowering/array-values.d.ts +27 -0
- package/dist/frontend/lowering/array-values.js +112 -0
- package/dist/frontend/lowering/array-values.js.map +1 -1
- package/dist/frontend/lowering/binding-analysis.d.ts +3 -0
- package/dist/frontend/lowering/binding-analysis.js +9 -3
- package/dist/frontend/lowering/binding-analysis.js.map +1 -1
- package/dist/frontend/lowering/builtin-namespaces.d.ts +13 -0
- package/dist/frontend/lowering/builtin-namespaces.js +238 -0
- package/dist/frontend/lowering/builtin-namespaces.js.map +1 -0
- package/dist/frontend/lowering/builtins/compression.d.ts +4 -3
- package/dist/frontend/lowering/builtins/compression.js +86 -5
- package/dist/frontend/lowering/builtins/compression.js.map +1 -1
- package/dist/frontend/lowering/builtins/date-classes.js +17 -1
- package/dist/frontend/lowering/builtins/date-classes.js.map +1 -1
- package/dist/frontend/lowering/builtins/dates.d.ts +19 -5
- package/dist/frontend/lowering/builtins/dates.js +159 -8
- package/dist/frontend/lowering/builtins/dates.js.map +1 -1
- package/dist/frontend/lowering/builtins/filesystem-calls.js +26 -1
- package/dist/frontend/lowering/builtins/filesystem-calls.js.map +1 -1
- package/dist/frontend/lowering/builtins/fs-streams.d.ts +4 -0
- package/dist/frontend/lowering/builtins/fs-streams.js +24 -1
- package/dist/frontend/lowering/builtins/fs-streams.js.map +1 -1
- package/dist/frontend/lowering/builtins/json.d.ts +4 -1
- package/dist/frontend/lowering/builtins/json.js +9 -3
- package/dist/frontend/lowering/builtins/json.js.map +1 -1
- package/dist/frontend/lowering/builtins/module-bindings.d.ts +6 -0
- package/dist/frontend/lowering/builtins/module-bindings.js +23 -1
- package/dist/frontend/lowering/builtins/module-bindings.js.map +1 -1
- package/dist/frontend/lowering/builtins/module-resolution.d.ts +5 -0
- package/dist/frontend/lowering/builtins/module-resolution.js +95 -4
- package/dist/frontend/lowering/builtins/module-resolution.js.map +1 -1
- package/dist/frontend/lowering/builtins/promises.js +144 -1
- 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 +22 -11
- package/dist/frontend/lowering/builtins/readline.js.map +1 -1
- package/dist/frontend/lowering/builtins/reflection.d.ts +4 -1
- package/dist/frontend/lowering/builtins/reflection.js +41 -1
- package/dist/frontend/lowering/builtins/reflection.js.map +1 -1
- package/dist/frontend/lowering/builtins/text-codecs.js +31 -2
- package/dist/frontend/lowering/builtins/text-codecs.js.map +1 -1
- package/dist/frontend/lowering/builtins/webassembly.js +4 -1
- package/dist/frontend/lowering/builtins/webassembly.js.map +1 -1
- package/dist/frontend/lowering/builtins/x509.d.ts +33 -0
- package/dist/frontend/lowering/builtins/x509.js +431 -0
- package/dist/frontend/lowering/builtins/x509.js.map +1 -0
- package/dist/frontend/lowering/call-arguments.js +44 -0
- package/dist/frontend/lowering/call-arguments.js.map +1 -1
- package/dist/frontend/lowering/call-signatures.js +1 -1
- package/dist/frontend/lowering/call-signatures.js.map +1 -1
- package/dist/frontend/lowering/cjs-inline-require.js +1 -1
- package/dist/frontend/lowering/cjs-inline-require.js.map +1 -1
- package/dist/frontend/lowering/class-attributes.d.ts +7 -0
- package/dist/frontend/lowering/class-attributes.js +52 -10
- package/dist/frontend/lowering/class-attributes.js.map +1 -1
- package/dist/frontend/lowering/class-dynamic-dispatch.d.ts +13 -0
- package/dist/frontend/lowering/class-dynamic-dispatch.js +174 -9
- package/dist/frontend/lowering/class-dynamic-dispatch.js.map +1 -1
- package/dist/frontend/lowering/class-method-mutations.js +43 -8
- package/dist/frontend/lowering/class-method-mutations.js.map +1 -1
- package/dist/frontend/lowering/class-method-values.js +71 -1
- package/dist/frontend/lowering/class-method-values.js.map +1 -1
- package/dist/frontend/lowering/class-prototypes.d.ts +8 -0
- package/dist/frontend/lowering/class-prototypes.js +83 -2
- package/dist/frontend/lowering/class-prototypes.js.map +1 -1
- package/dist/frontend/lowering/class-to-primitive.d.ts +5 -0
- package/dist/frontend/lowering/class-to-primitive.js +79 -7
- package/dist/frontend/lowering/class-to-primitive.js.map +1 -1
- package/dist/frontend/lowering/coercions/state.d.ts +1 -0
- package/dist/frontend/lowering/coercions/state.js.map +1 -1
- package/dist/frontend/lowering/coercions/structural.js +89 -10
- package/dist/frontend/lowering/coercions/structural.js.map +1 -1
- package/dist/frontend/lowering/coercions/unions.d.ts +4 -2
- package/dist/frontend/lowering/coercions/unions.js +13 -6
- package/dist/frontend/lowering/coercions/unions.js.map +1 -1
- package/dist/frontend/lowering/containers/array-callbacks.js +51 -15
- package/dist/frontend/lowering/containers/array-callbacks.js.map +1 -1
- package/dist/frontend/lowering/containers/array-construction.d.ts +4 -1
- package/dist/frontend/lowering/containers/array-construction.js +102 -9
- package/dist/frontend/lowering/containers/array-construction.js.map +1 -1
- package/dist/frontend/lowering/containers/array-methods.js +85 -5
- package/dist/frontend/lowering/containers/array-methods.js.map +1 -1
- package/dist/frontend/lowering/containers/array-pipelines.js +346 -77
- package/dist/frontend/lowering/containers/array-pipelines.js.map +1 -1
- package/dist/frontend/lowering/containers/callback-arguments.js +11 -1
- package/dist/frontend/lowering/containers/callback-arguments.js.map +1 -1
- package/dist/frontend/lowering/containers/collection-methods.js +12 -0
- package/dist/frontend/lowering/containers/collection-methods.js.map +1 -1
- package/dist/frontend/lowering/containers/indexed-objects.js +73 -25
- package/dist/frontend/lowering/containers/indexed-objects.js.map +1 -1
- package/dist/frontend/lowering/containers/iterator-helpers.d.ts +4 -4
- package/dist/frontend/lowering/containers/iterator-helpers.js +8 -2
- package/dist/frontend/lowering/containers/iterator-helpers.js.map +1 -1
- package/dist/frontend/lowering/containers/replacer-params.d.ts +37 -0
- package/dist/frontend/lowering/containers/replacer-params.js +294 -0
- package/dist/frontend/lowering/containers/replacer-params.js.map +1 -0
- package/dist/frontend/lowering/containers/replacer-params.test.d.ts +1 -0
- package/dist/frontend/lowering/containers/replacer-params.test.js +61 -0
- package/dist/frontend/lowering/containers/replacer-params.test.js.map +1 -0
- package/dist/frontend/lowering/containers/string-and-regexp.js +2 -1
- package/dist/frontend/lowering/containers/string-and-regexp.js.map +1 -1
- package/dist/frontend/lowering/containers/string-replacement.js +7 -3
- package/dist/frontend/lowering/containers/string-replacement.js.map +1 -1
- package/dist/frontend/lowering/cycle-initialization.d.ts +4 -2
- package/dist/frontend/lowering/cycle-initialization.js +4 -1
- package/dist/frontend/lowering/cycle-initialization.js.map +1 -1
- package/dist/frontend/lowering/date-values.d.ts +9 -6
- package/dist/frontend/lowering/date-values.js +63 -16
- package/dist/frontend/lowering/date-values.js.map +1 -1
- package/dist/frontend/lowering/deferred-module-initializers.js +16 -8
- package/dist/frontend/lowering/deferred-module-initializers.js.map +1 -1
- package/dist/frontend/lowering/deferred-module-initializers.test.js +22 -6
- package/dist/frontend/lowering/deferred-module-initializers.test.js.map +1 -1
- package/dist/frontend/lowering/dispatch-sites.js +1 -0
- package/dist/frontend/lowering/dispatch-sites.js.map +1 -1
- package/dist/frontend/lowering/expressions/array-literals.d.ts +0 -8
- package/dist/frontend/lowering/expressions/array-literals.js +119 -26
- package/dist/frontend/lowering/expressions/array-literals.js.map +1 -1
- package/dist/frontend/lowering/expressions/binary.js +38 -0
- package/dist/frontend/lowering/expressions/binary.js.map +1 -1
- package/dist/frontend/lowering/expressions/element-access.js +50 -6
- package/dist/frontend/lowering/expressions/element-access.js.map +1 -1
- package/dist/frontend/lowering/expressions/identifiers.js +35 -3
- package/dist/frontend/lowering/expressions/identifiers.js.map +1 -1
- package/dist/frontend/lowering/expressions/narrowing.d.ts +2 -1
- package/dist/frontend/lowering/expressions/narrowing.js +8 -1
- package/dist/frontend/lowering/expressions/narrowing.js.map +1 -1
- package/dist/frontend/lowering/expressions/object-literals.js +8 -2
- package/dist/frontend/lowering/expressions/object-literals.js.map +1 -1
- package/dist/frontend/lowering/expressions/property-access.js +65 -34
- package/dist/frontend/lowering/expressions/property-access.js.map +1 -1
- package/dist/frontend/lowering/expressions/relational.js +76 -11
- package/dist/frontend/lowering/expressions/relational.js.map +1 -1
- package/dist/frontend/lowering/expressions/typeof.js +6 -1
- package/dist/frontend/lowering/expressions/typeof.js.map +1 -1
- package/dist/frontend/lowering/expressions/updates.js +20 -11
- package/dist/frontend/lowering/expressions/updates.js.map +1 -1
- package/dist/frontend/lowering/f64-handles.d.ts +8 -0
- package/dist/frontend/lowering/f64-handles.js +16 -0
- package/dist/frontend/lowering/f64-handles.js.map +1 -0
- package/dist/frontend/lowering/frozen-records.d.ts +5 -0
- package/dist/frontend/lowering/frozen-records.js +12 -4
- package/dist/frontend/lowering/frozen-records.js.map +1 -1
- package/dist/frontend/lowering/function-context.d.ts +3 -0
- package/dist/frontend/lowering/function-context.js.map +1 -1
- package/dist/frontend/lowering/function-returns.js +15 -0
- package/dist/frontend/lowering/function-returns.js.map +1 -1
- package/dist/frontend/lowering/generic-functions.js +17 -6
- package/dist/frontend/lowering/generic-functions.js.map +1 -1
- package/dist/frontend/lowering/instantiation-path.d.ts +3 -2
- package/dist/frontend/lowering/instantiation-path.js.map +1 -1
- package/dist/frontend/lowering/instantiation-path.test.js +6 -4
- package/dist/frontend/lowering/instantiation-path.test.js.map +1 -1
- package/dist/frontend/lowering/iterator-adapters.d.ts +4 -2
- package/dist/frontend/lowering/iterator-adapters.js +26 -33
- package/dist/frontend/lowering/iterator-adapters.js.map +1 -1
- package/dist/frontend/lowering/js-collection-types.d.ts +11 -0
- package/dist/frontend/lowering/js-collection-types.js +490 -0
- package/dist/frontend/lowering/js-collection-types.js.map +1 -0
- package/dist/frontend/lowering/lib-boundary.js +2 -2
- package/dist/frontend/lowering/lib-boundary.js.map +1 -1
- package/dist/frontend/lowering/lower-assert.d.ts +14 -0
- package/dist/frontend/lowering/lower-assert.js +283 -26
- package/dist/frontend/lowering/lower-assert.js.map +1 -1
- package/dist/frontend/lowering/lower-builtin-values.js +3 -3
- package/dist/frontend/lowering/lower-builtin-values.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.js +97 -7
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-classes.d.ts +59 -7
- package/dist/frontend/lowering/lower-classes.js +647 -176
- package/dist/frontend/lowering/lower-classes.js.map +1 -1
- package/dist/frontend/lowering/lower-console.js +2 -1
- package/dist/frontend/lowering/lower-console.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.d.ts +5 -0
- package/dist/frontend/lowering/lower-exprs.js +52 -5
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-functions.js +7 -0
- package/dist/frontend/lowering/lower-functions.js.map +1 -1
- package/dist/frontend/lowering/lower-generators.js +4 -3
- package/dist/frontend/lowering/lower-generators.js.map +1 -1
- package/dist/frontend/lowering/lower-inspect.js +264 -46
- package/dist/frontend/lowering/lower-inspect.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.js +28 -17
- package/dist/frontend/lowering/lower-modules.js.map +1 -1
- package/dist/frontend/lowering/lower-namespaces.d.ts +3 -0
- package/dist/frontend/lowering/lower-namespaces.js +44 -1
- package/dist/frontend/lowering/lower-namespaces.js.map +1 -1
- package/dist/frontend/lowering/lower-node-module.js +1 -1
- package/dist/frontend/lowering/lower-node-module.js.map +1 -1
- package/dist/frontend/lowering/lower-server.js +126 -32
- package/dist/frontend/lowering/lower-server.js.map +1 -1
- package/dist/frontend/lowering/lower-stdlib.d.ts +4 -1
- package/dist/frontend/lowering/lower-stdlib.js +51 -37
- package/dist/frontend/lowering/lower-stdlib.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.js +294 -46
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lower-stream.js +515 -121
- package/dist/frontend/lowering/lower-stream.js.map +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +52 -10
- package/dist/frontend/lowering/lowerer.js +249 -37
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/lowering/lowerer.test.js +1 -1
- package/dist/frontend/lowering/lowerer.test.js.map +1 -1
- package/dist/frontend/lowering/module-namespace-elements.d.ts +13 -0
- package/dist/frontend/lowering/module-namespace-elements.js +118 -1
- package/dist/frontend/lowering/module-namespace-elements.js.map +1 -1
- package/dist/frontend/lowering/private-brands.d.ts +5 -0
- package/dist/frontend/lowering/private-brands.js +39 -0
- package/dist/frontend/lowering/private-brands.js.map +1 -1
- package/dist/frontend/lowering/runtime-optional-elements.d.ts +6 -0
- package/dist/frontend/lowering/runtime-optional-elements.js +14 -3
- package/dist/frontend/lowering/runtime-optional-elements.js.map +1 -1
- package/dist/frontend/lowering/sanitize-class-types.js +2 -0
- package/dist/frontend/lowering/sanitize-class-types.js.map +1 -1
- package/dist/frontend/lowering/site-dependencies.d.ts +7 -2
- package/dist/frontend/lowering/site-dependencies.js +0 -15
- package/dist/frontend/lowering/site-dependencies.js.map +1 -1
- package/dist/frontend/lowering/site-dependencies.test.js +7 -5
- package/dist/frontend/lowering/site-dependencies.test.js.map +1 -1
- package/dist/frontend/lowering/string-index-bounds.d.ts +7 -4
- package/dist/frontend/lowering/string-index-bounds.js +21 -7
- package/dist/frontend/lowering/string-index-bounds.js.map +1 -1
- package/dist/frontend/lowering/surfaces.d.ts +12 -3
- package/dist/frontend/lowering/surfaces.js +1576 -1539
- package/dist/frontend/lowering/surfaces.js.map +1 -1
- package/dist/frontend/lowering/symbol-fields.d.ts +7 -0
- package/dist/frontend/lowering/symbol-fields.js +45 -2
- package/dist/frontend/lowering/symbol-fields.js.map +1 -1
- package/dist/frontend/lowering/union-narrow.d.ts +5 -2
- package/dist/frontend/lowering/union-narrow.js +6 -3
- package/dist/frontend/lowering/union-narrow.js.map +1 -1
- package/dist/frontend/lowering/union-narrow.test.js +10 -0
- package/dist/frontend/lowering/union-narrow.test.js.map +1 -1
- package/dist/frontend/npm-static-namespace-defaults.d.ts +6 -0
- package/dist/frontend/npm-static-namespace-defaults.js +163 -0
- package/dist/frontend/npm-static-namespace-defaults.js.map +1 -0
- package/dist/frontend/npm-static-namespace-defaults.test.d.ts +1 -0
- package/dist/frontend/npm-static-namespace-defaults.test.js +72 -0
- package/dist/frontend/npm-static-namespace-defaults.test.js.map +1 -0
- package/dist/frontend/npm-static-prune.js +152 -111
- package/dist/frontend/npm-static-prune.js.map +1 -1
- package/dist/frontend/npm-static.js +35 -32
- package/dist/frontend/npm-static.js.map +1 -1
- package/dist/frontend/package-shims.d.ts +7 -4
- package/dist/frontend/package-shims.js +39 -40
- package/dist/frontend/package-shims.js.map +1 -1
- package/dist/frontend/pipeline-native.d.ts +2 -2
- package/dist/frontend/pipeline-native.js +2 -2
- package/dist/frontend/pipeline-native.js.map +1 -1
- package/dist/frontend/pipeline.d.ts +19 -2
- package/dist/frontend/pipeline.js +102 -11
- package/dist/frontend/pipeline.js.map +1 -1
- package/dist/frontend/program-analysis.d.ts +2 -0
- package/dist/frontend/program-analysis.js +3 -0
- package/dist/frontend/program-analysis.js.map +1 -1
- package/dist/frontend/program.d.ts +15 -0
- package/dist/frontend/program.js +227 -64
- package/dist/frontend/program.js.map +1 -1
- package/dist/frontend/resolve.d.ts +2 -0
- package/dist/frontend/resolve.js +5 -0
- package/dist/frontend/resolve.js.map +1 -1
- package/dist/frontend/services.d.ts +3 -0
- package/dist/frontend/services.js +31 -4
- package/dist/frontend/services.js.map +1 -1
- package/dist/frontend/shape-inference/analyze.d.ts +93 -0
- package/dist/frontend/shape-inference/analyze.js +3138 -0
- package/dist/frontend/shape-inference/analyze.js.map +1 -0
- package/dist/frontend/shape-inference/constant-graphs.d.ts +54 -0
- package/dist/frontend/shape-inference/constant-graphs.js +357 -0
- package/dist/frontend/shape-inference/constant-graphs.js.map +1 -0
- package/dist/frontend/shape-inference/domain.d.ts +32 -0
- package/dist/frontend/shape-inference/domain.js +104 -0
- package/dist/frontend/shape-inference/domain.js.map +1 -0
- package/dist/frontend/shape-inference/index.d.ts +7 -0
- package/dist/frontend/shape-inference/index.js +19 -0
- package/dist/frontend/shape-inference/index.js.map +1 -0
- package/dist/frontend/shape-inference/report.d.ts +21 -0
- package/dist/frontend/shape-inference/report.js +348 -0
- package/dist/frontend/shape-inference/report.js.map +1 -0
- package/dist/frontend/token-equivalence.d.ts +6 -0
- package/dist/frontend/token-equivalence.js +66 -9
- package/dist/frontend/token-equivalence.js.map +1 -1
- package/dist/frontend/token-equivalence.test.js +33 -1
- package/dist/frontend/token-equivalence.test.js.map +1 -1
- package/dist/frontend/ts7/checker-features.d.ts +15 -0
- package/dist/frontend/ts7/checker-features.js +45 -0
- package/dist/frontend/ts7/checker-features.js.map +1 -0
- package/dist/frontend/ts7/checker-features.test.d.ts +1 -0
- package/dist/frontend/ts7/checker-features.test.js +40 -0
- package/dist/frontend/ts7/checker-features.test.js.map +1 -0
- package/dist/frontend/ts7/checker-server.d.ts +19 -0
- package/dist/frontend/ts7/checker-server.js +46 -0
- package/dist/frontend/ts7/checker-server.js.map +1 -0
- package/dist/frontend/ts7/checker-server.test.d.ts +1 -0
- package/dist/frontend/ts7/checker-server.test.js +38 -0
- package/dist/frontend/ts7/checker-server.test.js.map +1 -0
- package/dist/frontend/ts7/lib-diagnostics.js +39 -13
- package/dist/frontend/ts7/lib-diagnostics.js.map +1 -1
- package/dist/frontend/ts7/lib-diagnostics.test.js +40 -0
- package/dist/frontend/ts7/lib-diagnostics.test.js.map +1 -1
- package/dist/frontend/ts7/native-api.d.ts +1 -0
- package/dist/frontend/ts7/native-api.js +25 -2
- package/dist/frontend/ts7/native-api.js.map +1 -1
- package/dist/frontend/ts7/native-process.d.ts +9 -2
- package/dist/frontend/ts7/native-process.js +22 -4
- package/dist/frontend/ts7/native-process.js.map +1 -1
- package/dist/frontend/ts7/program-host.d.ts +11 -0
- package/dist/frontend/ts7/program-host.js +36 -22
- package/dist/frontend/ts7/program-host.js.map +1 -1
- package/dist/frontend/ts7/semantic-json.d.ts +9 -0
- package/dist/frontend/ts7/semantic-json.js +25 -5
- package/dist/frontend/ts7/semantic-json.js.map +1 -1
- package/dist/frontend/ts7/semantic-model.js +3 -1
- package/dist/frontend/ts7/semantic-model.js.map +1 -1
- package/dist/frontend/ts7/source-parser.js +3 -1
- package/dist/frontend/ts7/source-parser.js.map +1 -1
- package/dist/frontend/tsc-codes.js +10 -0
- package/dist/frontend/tsc-codes.js.map +1 -1
- package/dist/frontend/type-mapper.d.ts +18 -6
- package/dist/frontend/type-mapper.js +160 -28
- package/dist/frontend/type-mapper.js.map +1 -1
- package/dist/index.d.ts +44 -3
- package/dist/index.js +27 -8
- package/dist/index.js.map +1 -1
- package/dist/ir/builtin-effects.js +29 -0
- package/dist/ir/builtin-effects.js.map +1 -1
- package/dist/ir/builtin-signatures.d.ts +7 -2
- package/dist/ir/builtin-signatures.js +5104 -4950
- package/dist/ir/builtin-signatures.js.map +1 -1
- package/dist/ir/callback-specialization.d.ts +4 -2
- package/dist/ir/callback-specialization.js +24 -9
- package/dist/ir/callback-specialization.js.map +1 -1
- package/dist/ir/capture-values.js +4 -2
- package/dist/ir/capture-values.js.map +1 -1
- package/dist/ir/char-unit-locals.d.ts +12 -2
- package/dist/ir/char-unit-locals.js +400 -58
- package/dist/ir/char-unit-locals.js.map +1 -1
- package/dist/ir/char-unit-locals.test.js +111 -0
- package/dist/ir/char-unit-locals.test.js.map +1 -1
- package/dist/ir/constant-globals.js +18 -4
- package/dist/ir/constant-globals.js.map +1 -1
- package/dist/ir/expression-inlining.d.ts +15 -0
- package/dist/ir/expression-inlining.js +166 -0
- package/dist/ir/expression-inlining.js.map +1 -0
- package/dist/ir/expression-inlining.test.d.ts +1 -0
- package/dist/ir/expression-inlining.test.js +123 -0
- package/dist/ir/expression-inlining.test.js.map +1 -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 +6 -0
- package/dist/ir/function-references.test.js.map +1 -1
- package/dist/ir/int32-arrays.d.ts +27 -6
- package/dist/ir/int32-arrays.js +106 -18
- package/dist/ir/int32-arrays.js.map +1 -1
- package/dist/ir/int32-slots.d.ts +26 -1
- package/dist/ir/int32-slots.js +284 -5
- package/dist/ir/int32-slots.js.map +1 -1
- package/dist/ir/int32-slots.test.js +5 -0
- package/dist/ir/int32-slots.test.js.map +1 -1
- package/dist/ir/integer-loop-facts.d.ts +5 -0
- package/dist/ir/integer-loop-facts.js +90 -1
- package/dist/ir/integer-loop-facts.js.map +1 -1
- package/dist/ir/integer-loops.d.ts +14 -1
- package/dist/ir/integer-loops.js +93 -7
- package/dist/ir/integer-loops.js.map +1 -1
- package/dist/ir/integer-loops.test.js +70 -0
- package/dist/ir/integer-loops.test.js.map +1 -1
- package/dist/ir/integer-ranges.js +18 -2
- package/dist/ir/integer-ranges.js.map +1 -1
- package/dist/ir/integer-ranges.test.js +64 -4
- package/dist/ir/integer-ranges.test.js.map +1 -1
- package/dist/ir/ir.d.ts +50 -8
- package/dist/ir/ir.js +38 -12
- package/dist/ir/ir.js.map +1 -1
- package/dist/ir/js-ic.d.ts +25 -5
- package/dist/ir/js-ic.js +93 -13
- package/dist/ir/js-ic.js.map +1 -1
- package/dist/ir/js-ic.test.js +153 -0
- package/dist/ir/js-ic.test.js.map +1 -1
- package/dist/ir/node-index.d.ts +7 -0
- package/dist/ir/node-index.js +32 -0
- package/dist/ir/node-index.js.map +1 -1
- package/dist/ir/receiver-readers.d.ts +6 -1
- package/dist/ir/receiver-readers.js +53 -28
- package/dist/ir/receiver-readers.js.map +1 -1
- package/dist/ir/row-pairs.d.ts +15 -0
- package/dist/ir/row-pairs.js +373 -0
- package/dist/ir/row-pairs.js.map +1 -0
- package/dist/ir/row-pairs.test.d.ts +1 -0
- package/dist/ir/row-pairs.test.js +129 -0
- package/dist/ir/row-pairs.test.js.map +1 -0
- package/dist/ir/runtime-features.d.ts +17 -4
- package/dist/ir/runtime-features.js +69 -12
- package/dist/ir/runtime-features.js.map +1 -1
- package/dist/ir/scalar-records.d.ts +15 -0
- package/dist/ir/scalar-records.js +301 -1
- package/dist/ir/scalar-records.js.map +1 -1
- package/dist/ir/scalar-records.test.js +181 -1
- package/dist/ir/scalar-records.test.js.map +1 -1
- package/dist/ir/self-captures.js +8 -0
- package/dist/ir/self-captures.js.map +1 -1
- package/dist/ir/validate.js +37 -28
- package/dist/ir/validate.js.map +1 -1
- package/dist/library/fence-eval.js +4 -4
- package/dist/library/fence-eval.js.map +1 -1
- package/dist/library/ir-policy.js +4 -0
- package/dist/library/ir-policy.js.map +1 -1
- package/dist/library/library-cache.d.ts +1 -0
- package/dist/library/library-cache.js +1 -0
- package/dist/library/library-cache.js.map +1 -1
- package/dist/library/library-cache.test.js +13 -0
- package/dist/library/library-cache.test.js.map +1 -1
- package/dist/native/cache.d.ts +5 -1
- package/dist/native/cache.js +15 -3
- package/dist/native/cache.js.map +1 -1
- package/dist/native/cli.js +6 -0
- package/dist/native/cli.js.map +1 -1
- package/dist/native/compiler.d.ts +3 -0
- package/dist/native/compiler.js +72 -26
- package/dist/native/compiler.js.map +1 -1
- package/dist/native/compiler.test.js +87 -2
- package/dist/native/compiler.test.js.map +1 -1
- package/dist/native/executable-cache-open.test.d.ts +1 -0
- package/dist/native/executable-cache-open.test.js +80 -0
- package/dist/native/executable-cache-open.test.js.map +1 -0
- package/dist/native/executable-cache.d.ts +43 -3
- package/dist/native/executable-cache.js +177 -36
- package/dist/native/executable-cache.js.map +1 -1
- package/dist/native/executable-cache.test.js +103 -0
- package/dist/native/executable-cache.test.js.map +1 -1
- package/dist/native/prepare.js +38 -16
- package/dist/native/prepare.js.map +1 -1
- package/dist/native/prepare.test.js +51 -1
- package/dist/native/prepare.test.js.map +1 -1
- package/dist/native/sanitizer.d.ts +1 -1
- package/dist/native/sanitizer.js +17 -3
- package/dist/native/sanitizer.js.map +1 -1
- package/dist/native/sanitizer.test.js +4 -0
- package/dist/native/sanitizer.test.js.map +1 -1
- package/dist/node-islands/classify.d.ts +14 -0
- package/dist/node-islands/classify.js +114 -0
- package/dist/node-islands/classify.js.map +1 -0
- package/dist/node-islands/detect.d.ts +13 -0
- package/dist/node-islands/detect.js +805 -0
- package/dist/node-islands/detect.js.map +1 -0
- package/dist/node-islands/detect.test.d.ts +1 -0
- package/dist/node-islands/detect.test.js +136 -0
- package/dist/node-islands/detect.test.js.map +1 -0
- package/dist/node-islands/origin.d.ts +21 -0
- package/dist/node-islands/origin.js +60 -0
- package/dist/node-islands/origin.js.map +1 -0
- package/dist/node-islands/policy.d.ts +49 -0
- package/dist/node-islands/policy.js +130 -0
- package/dist/node-islands/policy.js.map +1 -0
- package/dist/node-islands/report.d.ts +22 -0
- package/dist/node-islands/report.js +326 -0
- package/dist/node-islands/report.js.map +1 -0
- package/dist/node-islands/report.test.d.ts +1 -0
- package/dist/node-islands/report.test.js +228 -0
- package/dist/node-islands/report.test.js.map +1 -0
- package/dist/node-islands/rules.d.ts +20 -0
- package/dist/node-islands/rules.js +91 -0
- package/dist/node-islands/rules.js.map +1 -0
- package/dist/node-islands/scan.d.ts +53 -0
- package/dist/node-islands/scan.js +104 -0
- package/dist/node-islands/scan.js.map +1 -0
- package/dist/node-islands/summary.d.ts +78 -0
- package/dist/node-islands/summary.js +26 -0
- package/dist/node-islands/summary.js.map +1 -0
- package/dist/project-config.d.ts +50 -0
- package/dist/project-config.js +372 -0
- package/dist/project-config.js.map +1 -0
- package/dist/project-config.test.d.ts +1 -0
- package/dist/project-config.test.js +154 -0
- package/dist/project-config.test.js.map +1 -0
- package/dist/wasm/discover.js +6 -31
- package/dist/wasm/discover.js.map +1 -1
- package/package.json +20 -20
- package/surface-manifest.json +20 -35
|
@@ -9,22 +9,25 @@ import { CYC_BUF, CYC_HDR, FIRST_EMITTED_CYC_KIND, inlineAllocSupported, RECORD_
|
|
|
9
9
|
import { youngNurseryRequested } from "../young-nursery.js";
|
|
10
10
|
import { llvmBytes as llBytes, wtf8Bytes } from "../literals.js";
|
|
11
11
|
import { InternalCompilerError } from "../../errors.js";
|
|
12
|
+
import { serializeModuleParts } from "../../ir/serialize.js";
|
|
12
13
|
import { createHash } from "node:crypto";
|
|
13
14
|
import { endsWithJump, matchFieldSelfConcat, readsArraySlot, streamTypedRefEligible, undefinedArmTag, } from "../../ir/analysis.js";
|
|
14
15
|
import { loopTestsEveryIteration } from "../loop-polls.js";
|
|
15
|
-
import { isDynTypedRefType, isRefCounted, isUnitType, POINTER_KINDS, RUNTIME_EMITTER_CLASS, RUNTIME_EVENT_CLASS, RUNTIME_EVENT_TARGET_CLASS, RUNTIME_ERROR_CLASSES, RUNTIME_STREAM_CLASSES, typeEquals, typeKey, VOID, classJsName, } from "../../ir/ir.js";
|
|
16
|
+
import { isDynTypedRefType, isRefCounted, isUnitType, POINTER_KINDS, RUNTIME_EMITTER_CLASS, RUNTIME_EVENT_CLASS, RUNTIME_EVENT_TARGET_CLASS, RUNTIME_ERROR_CLASSES, RUNTIME_STREAM_CLASSES, typeEquals, typeKey, VOID, classJsName, classValueAbiEquals, } from "../../ir/ir.js";
|
|
16
17
|
import { moduleRuntimeFeatures } from "../../ir/runtime-features.js";
|
|
17
18
|
import { captureFreeFunctions, observesStacks } from "../stack-observations.js";
|
|
18
19
|
import { findInitializedByteLoopBindings } from "./byte-windows.js";
|
|
19
20
|
import { matchBytesLoopVersion } from "./bytes-loop-versions.js";
|
|
20
21
|
import { globalSlotAlias } from "./bytes-alias.js";
|
|
21
22
|
import { materializeSplitPiece, } from "./split-loops.js";
|
|
22
|
-
import { scalarizeNumericRecords } from "../../ir/scalar-records.js";
|
|
23
|
+
import { scalarizeLiteralResults, scalarizeNumericRecords } from "../../ir/scalar-records.js";
|
|
23
24
|
import { addRecordResultEntries, resultEntryName } from "./record-results.js";
|
|
24
25
|
import { specializeCallbackCalls } from "../../ir/callback-specialization.js";
|
|
25
26
|
import { EmitJournal, registerReplay, renameChunk, replayJournal, } from "./emit-journal.js";
|
|
26
27
|
import { specializeNumericCalls } from "../../ir/numeric-call-specialization.js";
|
|
27
28
|
import { versionLoopBoundParameters } from "../../ir/parameter-versions.js";
|
|
29
|
+
import { inlineExpressionFunctions } from "../../ir/expression-inlining.js";
|
|
30
|
+
import { pairRowSums } from "../../ir/row-pairs.js";
|
|
28
31
|
import { allocatedLiteral, fillAllocationLength, int32ArrayKey, selectInt32Arrays, } from "../../ir/int32-arrays.js";
|
|
29
32
|
import { everyExpr, everyExprChild, everyStmtChild, everyStmtList } from "../../ir/traverse.js";
|
|
30
33
|
import { INT32_RANGE, withinInt32, } from "../../ir/integer-ranges.js";
|
|
@@ -32,13 +35,15 @@ import { unshareNodes } from "../../ir/unshare.js";
|
|
|
32
35
|
import { runPairedWhileLoopsAsFor } from "../../ir/paired-while-loops.js";
|
|
33
36
|
import { copyStableCaptures } from "../../ir/capture-values.js";
|
|
34
37
|
import { resolveSelfCaptures } from "../../ir/self-captures.js";
|
|
35
|
-
import { analyzeInt32Slots, dynamicFieldStores } from "../../ir/int32-slots.js";
|
|
38
|
+
import { analyzeInt32Slots, dynamicFieldStores, Int32RevisionConflict, Int32Slots, } from "../../ir/int32-slots.js";
|
|
36
39
|
import { analyzeFinalFields } from "../../ir/final-fields.js";
|
|
37
40
|
import { foldConstantGlobals } from "../../ir/constant-globals.js";
|
|
38
41
|
import { dropUnwrittenPropertyBags } from "../../ir/property-bags.js";
|
|
39
42
|
import { freezeInitOnlyGlobals } from "../../ir/init-only-globals.js";
|
|
40
43
|
import { hoistFinalFieldReads } from "../../ir/field-values.js";
|
|
41
44
|
import { holdCharLocalsAsUnits } from "../../ir/char-unit-locals.js";
|
|
45
|
+
import { unitSafeFunctions } from "./string-unit-versions.js";
|
|
46
|
+
import { stringScanInline } from "./string-reads.js";
|
|
42
47
|
import { findInt32Abis, INT32_ABI_SUFFIX, SCALAR_UNION_DUMMY, SCALAR_UNION_RESULT, } from "./int32-abi.js";
|
|
43
48
|
import {} from "./int32-locals.js";
|
|
44
49
|
import { findIntegerClones, NO_INTEGER_CLONES } from "./integer-clones.js";
|
|
@@ -47,6 +52,7 @@ import { findInitializerBindings } from "../../ir/initializer-bindings.js";
|
|
|
47
52
|
import { findConstantNumericTables } from "../../ir/constant-tables.js";
|
|
48
53
|
import { allocateFfiCallbackAdapters, hasForeignFfiCallback, hasRetainedFfiCallback, } from "../ffi-callbacks.js";
|
|
49
54
|
import { computeMayThrow } from "../may-throw.js";
|
|
55
|
+
import { UNWIND_PERSONALITY, UNWIND_RAISE, UNWIND_RAISE_DECLARATION, UNWIND_RESUME, UNWIND_SLOT, UnwindAbiViolation, bridgePlainUnwindCalls, unwindAbiFunctions, } from "./unwind-abi.js";
|
|
50
56
|
import { mangleAsyncInlineAwaitCall, mangleAsyncSpawn, mangleBorrowedFunction, mangleClassObj, mangleFnClosure, mangleFunction, mangleGenSpawn, mangleGlobal, mangleLocal, mangleRecordStruct, mangleWrapper, mangleBorrowingWrapper, } from "../mangle.js";
|
|
51
57
|
import { analyzeCallLifetimes } from "./call-lifetimes.js";
|
|
52
58
|
import { stackObjectStruct, } from "./stack-objects.js";
|
|
@@ -62,16 +68,16 @@ import {} from "./map-entry-fusion.js";
|
|
|
62
68
|
import { emitBorrowedFieldSequence, guardedValue } from "./borrowed-receivers.js";
|
|
63
69
|
import { emitBorrowedInputs } from "./borrowed-inputs.js";
|
|
64
70
|
import { findWalkBorrows } from "./walk-borrows.js";
|
|
65
|
-
import { IrNodeIndex } from "../../ir/node-index.js";
|
|
71
|
+
import { eachNodeOfKinds, IrNodeIndex } from "../../ir/node-index.js";
|
|
66
72
|
import { lastUseRead } from "./local-extents.js";
|
|
67
73
|
import { findReboundParameters } from "./rebound-parameters.js";
|
|
68
74
|
import { ReferenceEffects } from "./reference-effects.js";
|
|
69
75
|
import { ReferenceWrites } from "./reference-writes.js";
|
|
70
76
|
import { LlvmDebugInfo } from "./debug-info.js";
|
|
71
77
|
import { StackCallbacks } from "./stack-callbacks.js";
|
|
72
|
-
import { findAppendedArrayLiterals } from "./appended-array-literals.js";
|
|
78
|
+
import { findAppendedArrayLiterals, reservedArrayLength } from "./appended-array-literals.js";
|
|
73
79
|
import { AmbientReceiverReaders, findConstantCallbacks } from "./constant-callbacks.js";
|
|
74
|
-
import { findLentStringParameters, } from "./string-slices.js";
|
|
80
|
+
import { findLentRecordFields, findLentStringParameters, findRecordFieldProducers, } from "./string-slices.js";
|
|
75
81
|
import { LazyCaptures } from "./lazy-captures.js";
|
|
76
82
|
import { StackCaptures } from "./stack-captures.js";
|
|
77
83
|
import { emitFieldAbsentTest, f64Lit, SCR_ARR_FIELD, SCR_ARR_FROZEN } from "./common.js";
|
|
@@ -109,7 +115,9 @@ import { emitNullablePresent, emitUnionPeek, emitUnionTag } from "./union-repr.j
|
|
|
109
115
|
import { emitConcatInputs, emitMixedConcat, numberPart, stringParts, } from "./string-construction.js";
|
|
110
116
|
import { arrNewCall, boxAccess, elemAccess, boxNewCall, boxReleaseSym, computeTraced, emitInlineRcHelpers, emitNullableRetainWrappers, emitShapeUnionHelpers, FN_ATTRS, inlineRcDecls, llFieldType, mapFlagsOffset, releaseSym, retainSym, traceArg, vAdapters, } from "./shapes.js";
|
|
111
117
|
import { INLINE_LITERAL_BYTES } from "./string-literal-equality.js";
|
|
112
|
-
import {
|
|
118
|
+
import { inlinableNumberFunction, withSpeculativeValue, } from "./speculative-integers.js";
|
|
119
|
+
import { emitFfiCallbackDefs, emitLibDefs, emitModuleParts, emitParts, helperDefs, workerMinFunctions, } from "./emit-module.js";
|
|
120
|
+
import { forkedAnalysis } from "./forked-analysis.js";
|
|
113
121
|
import { emitLoopCopies, emitSpeculativeWrite, emitStmtBody, emitStringSelfConcatAssign, emitSwitch, emitTryCatch, } from "./emit-statements.js";
|
|
114
122
|
import { emitArgPackAndTrampolinePrologue, emitAsyncAwaitCall, emitAsyncScaffolding, emitFunction, emitGenScaffolding, emitWasiFulfill, fiberlessAsyncFunctions, parkingFunctions, } from "./emit-function.js";
|
|
115
123
|
import { analyzeBorrowedReturns, canBorrowCallArgument, canBorrowReceiver, canStackReceiver, emitReadReceiver, fieldAliasMetadata, isStackUnionSource, } from "./receivers.js";
|
|
@@ -155,14 +163,53 @@ function versionParameters(mod) {
|
|
|
155
163
|
return mod;
|
|
156
164
|
return versionLoopBoundParameters(mod, mangleFunction);
|
|
157
165
|
}
|
|
158
|
-
/** The int32
|
|
159
|
-
*
|
|
160
|
-
|
|
166
|
+
/** The int32 slot analysis of `mod`, with the inputs LlEmitter gives it.
|
|
167
|
+
* With `revise`, the analysis revises the functions of candidates that drop
|
|
168
|
+
* (Int32SlotInputs.revise), and `mod` is the module it started from. */
|
|
169
|
+
function analyzeModuleInt32Slots(mod, revise) {
|
|
170
|
+
const nodeIndex = new IrNodeIndex(mod);
|
|
171
|
+
const initializerBindings = findInitializerBindings(mod, nodeIndex);
|
|
172
|
+
const dynamicStores = dynamicFieldStores(mod, undefined, undefined, nodeIndex);
|
|
161
173
|
const slots = analyzeInt32Slots(mod, {
|
|
162
|
-
dynamicStores
|
|
163
|
-
initializerBindings
|
|
174
|
+
dynamicStores,
|
|
175
|
+
initializerBindings,
|
|
176
|
+
nodes: nodeIndex,
|
|
177
|
+
...(revise === undefined ? {} : { revise }),
|
|
164
178
|
});
|
|
165
|
-
return
|
|
179
|
+
return { mod, nodeIndex, initializerBindings, dynamicStores, slots };
|
|
180
|
+
}
|
|
181
|
+
/** The candidates an analysis keeps: int32 arrays and checked ones. */
|
|
182
|
+
function keptInt32Arrays(analysis) {
|
|
183
|
+
return new Set([...analysis.slots.int32Arrays, ...analysis.slots.checkedInt32Arrays]);
|
|
184
|
+
}
|
|
185
|
+
/** An analysis that revised functions (analyzeModuleInt32Slots' `revise`)
|
|
186
|
+
* as the analysis of `mod`, the module of the functions it ended with: the
|
|
187
|
+
* node index of `mod`, and its initializer bindings and dynamic stores,
|
|
188
|
+
* which must be the ones the analysis read. Null when they differ. */
|
|
189
|
+
function revisedAnalysis(analysis, mod) {
|
|
190
|
+
const nodeIndex = new IrNodeIndex(mod);
|
|
191
|
+
const initializerBindings = findInitializerBindings(mod, nodeIndex);
|
|
192
|
+
const dynamicStores = dynamicFieldStores(mod, undefined, undefined, nodeIndex);
|
|
193
|
+
const read = analysis.initializerBindings;
|
|
194
|
+
if (initializerBindings.size !== read.size)
|
|
195
|
+
return null;
|
|
196
|
+
for (const [name, globals] of initializerBindings) {
|
|
197
|
+
const other = read.get(name);
|
|
198
|
+
if (other?.length !== globals.length || globals.some((g, i) => other[i] !== g))
|
|
199
|
+
return null;
|
|
200
|
+
}
|
|
201
|
+
const stores = analysis.dynamicStores;
|
|
202
|
+
if (dynamicStores.all !== stores.all ||
|
|
203
|
+
dynamicStores.names.size !== stores.names.size ||
|
|
204
|
+
[...dynamicStores.names].some((name) => !stores.names.has(name)))
|
|
205
|
+
return null;
|
|
206
|
+
return {
|
|
207
|
+
mod,
|
|
208
|
+
nodeIndex,
|
|
209
|
+
initializerBindings,
|
|
210
|
+
dynamicStores,
|
|
211
|
+
slots: analysis.slots,
|
|
212
|
+
};
|
|
166
213
|
}
|
|
167
214
|
/** The functions whose calls the backend may emit as calls of their
|
|
168
215
|
* result-slot entries (record-results.ts). */
|
|
@@ -179,26 +226,119 @@ function moduleEmitter(input, options) {
|
|
|
179
226
|
// Facts are keyed by node identity: emit the same module whether it was
|
|
180
227
|
// lowered in memory or read back from its serialized form.
|
|
181
228
|
const mod = unshareNodes(input);
|
|
229
|
+
// Each proof selectInt32Arrays asks for analyzes a marked module; the
|
|
230
|
+
// emitter of the module it returns reuses the last one. A proof that
|
|
231
|
+
// revised functions analyzed the module of the functions it ended with.
|
|
232
|
+
const rounds = { last: null, functions: null, revising: true };
|
|
233
|
+
const proven = (marked, revise) => {
|
|
234
|
+
rounds.functions = null;
|
|
235
|
+
if (revise === null || !rounds.revising) {
|
|
236
|
+
rounds.last = analyzeModuleInt32Slots(marked);
|
|
237
|
+
return { kept: keptInt32Arrays(rounds.last), functions: null };
|
|
238
|
+
}
|
|
239
|
+
const latest = new Map();
|
|
240
|
+
try {
|
|
241
|
+
rounds.last = analyzeModuleInt32Slots(marked, (fnName, dropped) => {
|
|
242
|
+
const fn = revise(fnName, dropped);
|
|
243
|
+
latest.set(fnName, fn);
|
|
244
|
+
return fn;
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
catch (error) {
|
|
248
|
+
if (!(error instanceof Int32RevisionConflict))
|
|
249
|
+
throw error;
|
|
250
|
+
rounds.last = null;
|
|
251
|
+
return null;
|
|
252
|
+
}
|
|
253
|
+
if (latest.size === 0)
|
|
254
|
+
return { kept: keptInt32Arrays(rounds.last), functions: null };
|
|
255
|
+
rounds.functions = marked.functions.map((fn) => latest.get(fn.name) ?? fn);
|
|
256
|
+
return { kept: keptInt32Arrays(rounds.last), functions: rounds.functions };
|
|
257
|
+
};
|
|
182
258
|
// Keep source storage intact for debugger inspection in dev builds.
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
259
|
+
if (options.debugSources !== undefined)
|
|
260
|
+
return new LlEmitter(mod, options, null, null);
|
|
261
|
+
const passed = versionParameters(addRecordResultEntries(scalarizeLiteralResults(scalarizeNumericRecords(specializeCallbackCalls(specializeNumericCalls(pairRowSums(inlineExpressionFunctions(foldConstantGlobals(copyStableCaptures(resolveSelfCaptures(hoistFinalFieldReads(freezeInitOnlyGlobals(holdCharLocalsAsUnits(dropUnwrittenPropertyBags(runPairedWhileLoopsAsFor(mod)))))))))), mangleFunction), mangleFunction)))));
|
|
262
|
+
let emitted = selectInt32Arrays(passed, proven, resultEntryTargets);
|
|
263
|
+
let prepared = rounds.last;
|
|
264
|
+
// A proof that revised functions analyzed the module of the functions it
|
|
265
|
+
// ended with, which is the selected module unless selection fell back to
|
|
266
|
+
// rounds: then the selected module was proved by its own round.
|
|
267
|
+
if (prepared !== null && rounds.functions !== null && prepared.mod !== emitted) {
|
|
268
|
+
const functions = rounds.functions;
|
|
269
|
+
prepared =
|
|
270
|
+
emitted !== passed &&
|
|
271
|
+
emitted.functions.length === functions.length &&
|
|
272
|
+
emitted.functions.every((fn, i) => fn === functions[i])
|
|
273
|
+
? revisedAnalysis(prepared, emitted)
|
|
274
|
+
: null;
|
|
275
|
+
if (prepared === null && emitted !== passed) {
|
|
276
|
+
rounds.revising = false;
|
|
277
|
+
emitted = selectInt32Arrays(passed, proven, resultEntryTargets);
|
|
278
|
+
prepared = rounds.last;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
if (process.env["SCRIPTC_INT32_VERIFY"] === "1")
|
|
282
|
+
verifyInt32Selection(passed, emitted, prepared?.mod === emitted ? prepared : null);
|
|
283
|
+
return new LlEmitter(emitted, options, null, prepared?.mod === emitted ? prepared : null);
|
|
284
|
+
}
|
|
285
|
+
/** SCRIPTC_INT32_VERIFY=1: throws unless the selection with revisions
|
|
286
|
+
* (`emitted`, and the analysis the emitter takes over) is the one rounds
|
|
287
|
+
* without revisions give: the same module, and the same facts. */
|
|
288
|
+
function verifyInt32Selection(passed, emitted, analysis) {
|
|
289
|
+
let last = null;
|
|
290
|
+
const reference = selectInt32Arrays(passed, (marked) => {
|
|
291
|
+
last = analyzeModuleInt32Slots(marked);
|
|
292
|
+
return { kept: keptInt32Arrays(last), functions: null };
|
|
293
|
+
}, resultEntryTargets);
|
|
294
|
+
const text = (mod) => serializeModuleParts(mod).join("");
|
|
295
|
+
if (text(reference) !== text(emitted))
|
|
296
|
+
throw new InternalCompilerError("int32 selection: the revised module differs from the rounds'");
|
|
297
|
+
const facts = (mod, prepared) => (prepared?.mod === mod ? prepared : analyzeModuleInt32Slots(mod)).slots.summary(mod);
|
|
298
|
+
const expected = facts(reference, last);
|
|
299
|
+
const actual = facts(emitted, analysis);
|
|
300
|
+
if (expected !== actual) {
|
|
301
|
+
const want = expected.split("\n");
|
|
302
|
+
const got = actual.split("\n");
|
|
303
|
+
const line = want.findIndex((entry, i) => entry !== got[i]);
|
|
304
|
+
throw new InternalCompilerError(`int32 selection: the revised analysis differs from the rounds': ${want[line]?.slice(0, 400)} != ${got[line]?.slice(0, 400)}`);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
/** Emits the module's parts, emitting it again with the functions an
|
|
308
|
+
* UnwindAbiViolation names on the pending-flag ABI. */
|
|
309
|
+
function emitModuleText(input, options) {
|
|
310
|
+
for (let excluded = options.unwindExcluded ?? new Set();;) {
|
|
311
|
+
const emitter = moduleEmitter(input, { ...options, unwindExcluded: excluded });
|
|
312
|
+
try {
|
|
313
|
+
return emitter.emitParts();
|
|
314
|
+
}
|
|
315
|
+
catch (error) {
|
|
316
|
+
if (!(error instanceof UnwindAbiViolation))
|
|
317
|
+
throw error;
|
|
318
|
+
const names = new Set(excluded);
|
|
319
|
+
for (const name of emitter.unwindAbi)
|
|
320
|
+
for (const symbol of [mangleFunction(name), mangleBorrowedFunction(name)])
|
|
321
|
+
if (error.symbols.has(symbol) || error.symbols.has(symbol + INT32_ABI_SUFFIX))
|
|
322
|
+
names.add(name);
|
|
323
|
+
if (names.size === excluded.size)
|
|
324
|
+
throw error;
|
|
325
|
+
excluded = names;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
186
328
|
}
|
|
187
329
|
export function emitLlvmModule(input, options = {}) {
|
|
188
|
-
return
|
|
330
|
+
return emitModuleText(input, options).join("\n");
|
|
189
331
|
}
|
|
190
332
|
/** emitLlvmModule's text as parts that concatenate to it, without the copy
|
|
191
333
|
* that joining them makes: a large program's text is 150 MB. */
|
|
192
334
|
export function emitLlvmModuleParts(input, options = {}) {
|
|
193
|
-
return
|
|
194
|
-
.emitParts()
|
|
195
|
-
.flatMap((part, index) => (index === 0 ? [part] : ["\n", part]));
|
|
335
|
+
return emitModuleText(input, options).flatMap((part, index) => index === 0 ? [part] : ["\n", part]);
|
|
196
336
|
}
|
|
197
337
|
/** Keep large translation units below the host's single-string limit. */
|
|
198
338
|
export function emitLlvmModuleSource(input, options = {}) {
|
|
199
339
|
// IR validation, contracts and the frontend's disposal run after lowering without checks.
|
|
200
340
|
relieveHeapPressure(true);
|
|
201
|
-
const parts =
|
|
341
|
+
const parts = emitModuleText(input, options);
|
|
202
342
|
const length = parts.reduce((total, part) => total + part.length, Math.max(0, parts.length - 1));
|
|
203
343
|
if (length <= 256 * 1024 * 1024)
|
|
204
344
|
return parts.join("\n");
|
|
@@ -208,6 +348,17 @@ export function llStrBytes(text) {
|
|
|
208
348
|
return llBytes(wtf8Bytes(text));
|
|
209
349
|
}
|
|
210
350
|
const NO_BORROWED = new Set();
|
|
351
|
+
/** The nodes that write a binding by its id (numberGlobalWriters). */
|
|
352
|
+
const GLOBAL_WRITE_KINDS = ["assign", "varDecl", "assignExpr", "incDec"];
|
|
353
|
+
/** Runtime library calls (readsLoopMetrics). */
|
|
354
|
+
const LIB_CALL_KINDS = ["libCall"];
|
|
355
|
+
/** [A-Za-z0-9_] */
|
|
356
|
+
function isIdentifierByte(code) {
|
|
357
|
+
return ((code >= 48 && code <= 57) ||
|
|
358
|
+
(code >= 65 && code <= 90) ||
|
|
359
|
+
(code >= 97 && code <= 122) ||
|
|
360
|
+
code === 95);
|
|
361
|
+
}
|
|
211
362
|
/** Runtime entry points (and await-call entries) that may park the running
|
|
212
363
|
* execution context, as they appear in emitted function text. */
|
|
213
364
|
export const SUSPENDS = /@(?:scr_(?:await_|module_await\b|promise_await_settled\b|test_sub\b|gen_yield_|async_gen_|fiber_)|sc_a[wd]_)/;
|
|
@@ -322,8 +473,9 @@ export class LlEmitter {
|
|
|
322
473
|
stringSlices = new Map();
|
|
323
474
|
/** Slices written into stack buffers (findScratchStringSlices). */
|
|
324
475
|
scratchStringSlices = new Set();
|
|
325
|
-
/** String parameters
|
|
326
|
-
|
|
476
|
+
/** String parameters, record fields and record producers a caller may
|
|
477
|
+
* lend scratch slices to. */
|
|
478
|
+
lendingFacts = { strings: new Map(), records: new Map(), producers: new Map() };
|
|
327
479
|
localStackUnions = new Map();
|
|
328
480
|
localStackObjects = new Map();
|
|
329
481
|
reassignedStackObjects = new Set();
|
|
@@ -730,7 +882,13 @@ export class LlEmitter {
|
|
|
730
882
|
checkedNarrows;
|
|
731
883
|
callArrayReads = new Map();
|
|
732
884
|
mapReadLifetimes = { locals: new Map(), arguments: new Map() };
|
|
885
|
+
/** Locals of the current function that hold a Map.get result as the
|
|
886
|
+
* entry's own reference (findMapReadBorrows, borrowableMapGet). */
|
|
887
|
+
borrowedMapGets = new Set();
|
|
733
888
|
readNumberMapWrites = new Set();
|
|
889
|
+
/** The integer views of the current function's number Map/Set keys, by
|
|
890
|
+
* the key's double operand (noteNumberMapKey, map-number-lookup.ts). */
|
|
891
|
+
numberMapKeyIntegers = new Map();
|
|
734
892
|
/** The current function's fused string-key Map get-then-set pairs (map-entry-fusion.ts). */
|
|
735
893
|
mapEntryFusion = null;
|
|
736
894
|
callLifetimes;
|
|
@@ -800,6 +958,10 @@ export class LlEmitter {
|
|
|
800
958
|
/** May-throw analysis (computeMayThrow): pending
|
|
801
959
|
* checks are emitted only after calls that can actually raise. */
|
|
802
960
|
mayThrow;
|
|
961
|
+
/** The functions that propagate exceptions by unwinding (unwind-abi.ts). */
|
|
962
|
+
unwindAbi;
|
|
963
|
+
/** Whether the function being emitted is one of unwindAbi. */
|
|
964
|
+
currentUnwindAbi = false;
|
|
803
965
|
indirectMayThrow;
|
|
804
966
|
/** Worker programs: the functions that poll for termination on entry
|
|
805
967
|
* (workerTerminationPolls); null outside worker programs. */
|
|
@@ -838,6 +1000,11 @@ export class LlEmitter {
|
|
|
838
1000
|
/** Locals whose array literal emitStmts left for the `await Promise.all`
|
|
839
1001
|
* that reads them (deferredPromiseAllLocal). */
|
|
840
1002
|
deferredPromiseAllEntries = new Map();
|
|
1003
|
+
/** Empty array literals that a capacity hint follows directly
|
|
1004
|
+
* (reservedArrayLength), with that hint. Constructing the literal with
|
|
1005
|
+
* the hinted capacity consumes the hint, which then emits nothing. */
|
|
1006
|
+
reservedArrayLengths = new Map();
|
|
1007
|
+
consumedReserves = new Set();
|
|
841
1008
|
/** The promise a `return` emitted past its finally regions already
|
|
842
1009
|
* produced for its adopting await (borrowed from the return's parked
|
|
843
1010
|
* slot); that await takes it instead of evaluating its operand. */
|
|
@@ -953,12 +1120,22 @@ export class LlEmitter {
|
|
|
953
1120
|
streamingSplitsEnabled = false;
|
|
954
1121
|
initializerBindings;
|
|
955
1122
|
/** Whole-program int32 storage and parameter/result facts. */
|
|
956
|
-
int32Slots
|
|
1123
|
+
get int32Slots() {
|
|
1124
|
+
return (this.int32SlotsValue ??= this.joinInt32Slots());
|
|
1125
|
+
}
|
|
1126
|
+
int32SlotsValue;
|
|
1127
|
+
/** The join of the int32 slot analysis a forked process computes
|
|
1128
|
+
* (startInt32Slots). */
|
|
1129
|
+
int32SlotsJoin;
|
|
957
1130
|
/** The program has no runtime store into a checked-dynamic value
|
|
958
1131
|
* (dynamicFieldStores), so live views of classes and records never
|
|
959
1132
|
* commit back into their objects. Library builds keep their commits:
|
|
960
1133
|
* their values cross a native boundary. */
|
|
961
1134
|
liveViewsReadOnly;
|
|
1135
|
+
/** The program freezes, seals or prevents extensions of untyped values
|
|
1136
|
+
* (IrModule.untypedIntegrity): the commits of class views store the
|
|
1137
|
+
* view's integrity state in the instance's integrity word. */
|
|
1138
|
+
untypedIntegrity;
|
|
962
1139
|
/** Functions whose direct calls use i32 parameters or results. */
|
|
963
1140
|
int32Abis;
|
|
964
1141
|
/** Pure number functions with speculative integer clones. */
|
|
@@ -988,6 +1165,9 @@ export class LlEmitter {
|
|
|
988
1165
|
integerTempsEnabled = false;
|
|
989
1166
|
/** Speculative integer loops (speculative-integers.ts) run in this function. */
|
|
990
1167
|
speculativeLoopsEnabled = false;
|
|
1168
|
+
/** False inside the copy of a versioned loop that runs when its guard
|
|
1169
|
+
* fails: loops there get no speculative or int32 kind copies. */
|
|
1170
|
+
loopCopiesEnabled = true;
|
|
991
1171
|
/** The fast copy of a speculative integer loop being emitted: its
|
|
992
1172
|
* integer-computed writes and where each resumes in the ordinary copy. */
|
|
993
1173
|
speculation = null;
|
|
@@ -995,6 +1175,37 @@ export class LlEmitter {
|
|
|
995
1175
|
speculativeLoopSites = 0;
|
|
996
1176
|
/** The ordinary copy being emitted: resume labels still to place. */
|
|
997
1177
|
speculationResume = null;
|
|
1178
|
+
/** The rewritten values of the writes `speculationResume` resumes at. */
|
|
1179
|
+
speculationResumeValues = null;
|
|
1180
|
+
/** Hoisted speculative leaves numbered so far in the function being
|
|
1181
|
+
* emitted (emitFunction resets it): a function's local names must not
|
|
1182
|
+
* depend on which functions the same emitter emitted before it, since
|
|
1183
|
+
* function workers each emit a share of the module. */
|
|
1184
|
+
speculativeLeaves = 0;
|
|
1185
|
+
inlinableFunctions = new Map();
|
|
1186
|
+
/** What speculative loop planning may assume here (SpeculationContext). */
|
|
1187
|
+
speculationContext() {
|
|
1188
|
+
const inlinable = (callee) => {
|
|
1189
|
+
if (!this.inlinableFunctions.has(callee)) {
|
|
1190
|
+
// Unset while its body is checked: a recursive helper is not inlinable.
|
|
1191
|
+
this.inlinableFunctions.set(callee, undefined);
|
|
1192
|
+
const fn = this.fnByName.get(callee);
|
|
1193
|
+
this.inlinableFunctions.set(callee, fn ? inlinableNumberFunction(fn, inlinable) : undefined);
|
|
1194
|
+
}
|
|
1195
|
+
return this.inlinableFunctions.get(callee);
|
|
1196
|
+
};
|
|
1197
|
+
return {
|
|
1198
|
+
inlinable,
|
|
1199
|
+
unaliased: (id) => {
|
|
1200
|
+
const local = this.currentLocals.get(id);
|
|
1201
|
+
return (local !== undefined &&
|
|
1202
|
+
!local.boxed &&
|
|
1203
|
+
!this.captureIds.has(id) &&
|
|
1204
|
+
!this.lazyCaptureBoxes.has(id));
|
|
1205
|
+
},
|
|
1206
|
+
leafId: () => `%spec.leaf.${this.speculativeLeaves++}`,
|
|
1207
|
+
};
|
|
1208
|
+
}
|
|
998
1209
|
/** Run once at the top of the next loop copy's header
|
|
999
1210
|
* (`enterLoopHeader`): records the ordinary copy's header, or sends the
|
|
1000
1211
|
* third copy's header there. */
|
|
@@ -1032,9 +1243,23 @@ export class LlEmitter {
|
|
|
1032
1243
|
* (one-unit tests and switches, charAtUnitRead), with the charAt each
|
|
1033
1244
|
* stands for: a loop version's proof for the charAt covers its read. */
|
|
1034
1245
|
charAtUnitReads = new Map();
|
|
1246
|
+
/** String reads a loop version proved in bounds of a string's UTF-16
|
|
1247
|
+
* units, with the units pointer to read (string-unit-versions.ts). */
|
|
1248
|
+
stringUnitReads = new Map();
|
|
1249
|
+
/** `length` reads of a loop version's string, with the i64 UTF-16
|
|
1250
|
+
* length its guard took (bytes-loop-versions.ts). */
|
|
1251
|
+
stringLengthReads = new Map();
|
|
1035
1252
|
/** Worker programs: typed-array accesses whose views an enclosing version
|
|
1036
1253
|
* guard proved thread-owned. */
|
|
1037
1254
|
bytesOwned = new Set();
|
|
1255
|
+
/** The alias-scope attachment of each typed-array element read and write
|
|
1256
|
+
* in the current loop version's fast copy (emitVersionedLoop), and the
|
|
1257
|
+
* one the element access being emitted carries (bytesElementAlias). */
|
|
1258
|
+
bytesAliasScopes = new Map();
|
|
1259
|
+
bytesAccessScope = "";
|
|
1260
|
+
/** Loop versions with alias scopes in the current function; it names
|
|
1261
|
+
* their scopes. */
|
|
1262
|
+
aliasScopedVersions = 0;
|
|
1038
1263
|
integerViews = new Map();
|
|
1039
1264
|
/** Module globals the current function owns outright (initializer
|
|
1040
1265
|
* bindings): their function-local slot, which stands in for the global. */
|
|
@@ -1095,18 +1320,26 @@ export class LlEmitter {
|
|
|
1095
1320
|
journaled;
|
|
1096
1321
|
/** Stack-trace mode: functions no capture can include (no frame push). */
|
|
1097
1322
|
unframedFunctions;
|
|
1098
|
-
constructor(mod, options, journal = null) {
|
|
1323
|
+
constructor(mod, options, journal = null, int32Analysis = null) {
|
|
1099
1324
|
this.mod = mod;
|
|
1100
1325
|
this.targetOptions = options;
|
|
1101
1326
|
this.journal = journal;
|
|
1102
1327
|
this.journaled =
|
|
1103
1328
|
journal !== null ||
|
|
1104
|
-
((options.functionWorkers ?? 1) > 1 &&
|
|
1105
|
-
options.forkPrimitives !== undefined &&
|
|
1106
|
-
options.debugSources === undefined);
|
|
1329
|
+
((options.functionWorkers ?? 1) > 1 && options.forkPrimitives !== undefined);
|
|
1107
1330
|
// One walk of every body, which the analyses below read instead of
|
|
1108
1331
|
// walking the bodies themselves.
|
|
1109
|
-
this.nodeIndex = new IrNodeIndex(mod);
|
|
1332
|
+
this.nodeIndex = int32Analysis?.nodeIndex ?? new IrNodeIndex(mod);
|
|
1333
|
+
this.initializerBindings =
|
|
1334
|
+
int32Analysis?.initializerBindings ?? findInitializerBindings(mod, this.nodeIndex);
|
|
1335
|
+
// One walk finds the dynamic field stores every analysis below consults.
|
|
1336
|
+
const dynamicStores = int32Analysis?.dynamicStores ?? dynamicFieldStores(mod, undefined, undefined, this.nodeIndex);
|
|
1337
|
+
// Started before the other analyses, which may run while a forked
|
|
1338
|
+
// process computes it (startInt32Slots).
|
|
1339
|
+
if (int32Analysis !== null)
|
|
1340
|
+
this.int32SlotsValue = int32Analysis.slots;
|
|
1341
|
+
else
|
|
1342
|
+
this.startInt32Slots(dynamicStores);
|
|
1110
1343
|
this.stackTraces = observesStacks(mod, this.nodeIndex);
|
|
1111
1344
|
this.nullableUnions = new NullableUnions(mod, options.debugSources === undefined, this.nodeIndex);
|
|
1112
1345
|
this.mockTimers = this.runtimeFeatures.mockTimers;
|
|
@@ -1115,16 +1348,12 @@ export class LlEmitter {
|
|
|
1115
1348
|
? null
|
|
1116
1349
|
: new LlvmDebugInfo(mod.sourceFile, options.debugSources, options.pointerBits, mod.unions, this.nullableUnions.armTypes());
|
|
1117
1350
|
this.constantNumericTables = findConstantNumericTables(mod);
|
|
1118
|
-
this.
|
|
1119
|
-
// One walk finds the dynamic field stores every analysis below consults.
|
|
1120
|
-
const dynamicStores = dynamicFieldStores(mod, undefined, undefined, this.nodeIndex);
|
|
1121
|
-
this.int32Slots = analyzeInt32Slots(mod, {
|
|
1122
|
-
dynamicStores,
|
|
1123
|
-
initializerBindings: this.initializerBindings,
|
|
1124
|
-
nodes: this.nodeIndex,
|
|
1125
|
-
});
|
|
1351
|
+
this.untypedIntegrity = mod.untypedIntegrity === true;
|
|
1126
1352
|
this.liveViewsReadOnly =
|
|
1127
|
-
mod.lib === undefined &&
|
|
1353
|
+
mod.lib === undefined &&
|
|
1354
|
+
!this.untypedIntegrity &&
|
|
1355
|
+
!dynamicStores.all &&
|
|
1356
|
+
dynamicStores.names.size === 0;
|
|
1128
1357
|
this.int32Abis = this.debug === null ? findInt32Abis(mod, this.int32Slots) : new Map();
|
|
1129
1358
|
this.immortalGlobals = new Set(mod.contracts?.immortalGlobals ?? []);
|
|
1130
1359
|
this.programLifetime = new Set(mod.contracts?.programLifetime ?? []);
|
|
@@ -1193,6 +1422,16 @@ export class LlEmitter {
|
|
|
1193
1422
|
nodes: this.nodeIndex,
|
|
1194
1423
|
});
|
|
1195
1424
|
this.mayThrow = mt.fns;
|
|
1425
|
+
this.unwindAbi =
|
|
1426
|
+
options.unwindAbi === true &&
|
|
1427
|
+
!this.wasi &&
|
|
1428
|
+
mod.lib === undefined &&
|
|
1429
|
+
options.debugSources === undefined &&
|
|
1430
|
+
(options.targetTriple
|
|
1431
|
+
? /-linux-(?:gnu|musl)/.test(options.targetTriple)
|
|
1432
|
+
: process.platform === "linux")
|
|
1433
|
+
? unwindAbiFunctions(mod, this.mayThrow, options.unwindExcluded)
|
|
1434
|
+
: new Set();
|
|
1196
1435
|
this.workerEntryPolls = mt.workerEntryPolls ?? null;
|
|
1197
1436
|
this.stackChecks = mt.stackChecks ?? null;
|
|
1198
1437
|
// A stackless call's eager prefix borrows its caller's stack; the
|
|
@@ -1287,9 +1526,15 @@ export class LlEmitter {
|
|
|
1287
1526
|
}, (shapeId) => {
|
|
1288
1527
|
const shape = this.recordsById.get(shapeId);
|
|
1289
1528
|
return shape !== undefined && !recordDynKeepsIdentity(shape);
|
|
1290
|
-
});
|
|
1291
|
-
this.
|
|
1292
|
-
|
|
1529
|
+
}, (wrap) => this.borrowableNullableWrap(wrap) === "ref");
|
|
1530
|
+
if (this.debug === null) {
|
|
1531
|
+
const strings = findLentStringParameters(this.fnByName, this.callLifetimes);
|
|
1532
|
+
this.lendingFacts = {
|
|
1533
|
+
strings,
|
|
1534
|
+
records: findLentRecordFields(this.fnByName, this.callLifetimes, strings),
|
|
1535
|
+
producers: findRecordFieldProducers(this.fnByName),
|
|
1536
|
+
};
|
|
1537
|
+
}
|
|
1293
1538
|
this.constantCallbacks = findConstantCallbacks(mod, this.callLifetimes, this.nodeIndex);
|
|
1294
1539
|
// Integer clones signal a stack overflow through their result, which
|
|
1295
1540
|
// needs the single-threaded guard; worker programs also poll for
|
|
@@ -1305,10 +1550,14 @@ export class LlEmitter {
|
|
|
1305
1550
|
? (fn, index) => this.callLifetimes.borrowed.get(fn)?.has(index) === true
|
|
1306
1551
|
: undefined)
|
|
1307
1552
|
: NO_INTEGER_CLONES;
|
|
1553
|
+
// Integer clones and their dispatchers call each other through their
|
|
1554
|
+
// own lowering, which keeps plain calls and flag tests.
|
|
1555
|
+
for (const name of this.integerClones.members)
|
|
1556
|
+
this.unwindAbi.delete(name);
|
|
1308
1557
|
this.stackCallbacks = new StackCallbacks(this.fnByName);
|
|
1309
|
-
this.receiverReaders = new AmbientReceiverReaders(this.fnByName);
|
|
1558
|
+
this.receiverReaders = new AmbientReceiverReaders(this.fnByName, this.nodeIndex);
|
|
1310
1559
|
this.stackCaptures = new StackCaptures(this.fnByName, this.callLifetimes, this.stackCallbacks);
|
|
1311
|
-
this.lazyCaptures = new LazyCaptures(this.fnByName);
|
|
1560
|
+
this.lazyCaptures = new LazyCaptures(this.fnByName, this.nodeIndex);
|
|
1312
1561
|
const traced = computeTraced(mod, dynamicStores, cycleMutability);
|
|
1313
1562
|
this.tracedShapes = traced.shapes;
|
|
1314
1563
|
this.tracedUnions = traced.unions;
|
|
@@ -1397,12 +1646,11 @@ export class LlEmitter {
|
|
|
1397
1646
|
const meta = this.classMeta.get(t.className);
|
|
1398
1647
|
return meta !== undefined && programLifetimeClass(this.shapeHost, meta);
|
|
1399
1648
|
},
|
|
1400
|
-
classSubtypes: (name) =>
|
|
1401
|
-
|
|
1402
|
-
const
|
|
1403
|
-
return
|
|
1404
|
-
|
|
1405
|
-
.map((meta) => meta.def.name);
|
|
1649
|
+
classSubtypes: (name) => this.classSubtypes(name),
|
|
1650
|
+
classValueSubtypes: (name) => {
|
|
1651
|
+
const target = this.classMetaOf(name).def;
|
|
1652
|
+
return this.classSubtypes(name).filter((sub) => sub !== target.name &&
|
|
1653
|
+
classValueAbiEquals(this.classMetaOf(sub).def, target, this.fnByName));
|
|
1406
1654
|
},
|
|
1407
1655
|
pendingTestLines: (dest) => this.pendingTestLines(dest),
|
|
1408
1656
|
virtualEntry: (implFn) => this.virtualEntry(implFn),
|
|
@@ -1511,6 +1759,36 @@ export class LlEmitter {
|
|
|
1511
1759
|
// After the vtable slots: borrowing slots exclude their implementations.
|
|
1512
1760
|
if (this.debug === null)
|
|
1513
1761
|
this.analyzeBorrowedReturns();
|
|
1762
|
+
this.int32SlotsValue ??= this.joinInt32Slots();
|
|
1763
|
+
}
|
|
1764
|
+
/** Computes the int32 slot analysis, or starts it on a forked process.
|
|
1765
|
+
* Dev builds read its result only near the end of the constructor
|
|
1766
|
+
* (int32Abis is empty with debug info), so for a large module the
|
|
1767
|
+
* process computes it while the constructor runs the other analyses. */
|
|
1768
|
+
startInt32Slots(dynamicStores) {
|
|
1769
|
+
const mod = this.mod;
|
|
1770
|
+
const nodes = this.nodeIndex;
|
|
1771
|
+
const analyze = () => analyzeInt32Slots(mod, {
|
|
1772
|
+
dynamicStores,
|
|
1773
|
+
initializerBindings: this.initializerBindings,
|
|
1774
|
+
nodes,
|
|
1775
|
+
});
|
|
1776
|
+
const fork = this.targetOptions.forkPrimitives;
|
|
1777
|
+
if (fork === undefined ||
|
|
1778
|
+
this.targetOptions.debugSources === undefined ||
|
|
1779
|
+
(this.targetOptions.functionWorkers ?? 1) < 2 ||
|
|
1780
|
+
mod.functions.length < workerMinFunctions()) {
|
|
1781
|
+
this.int32SlotsValue = analyze();
|
|
1782
|
+
return;
|
|
1783
|
+
}
|
|
1784
|
+
this.int32SlotsJoin = forkedAnalysis(fork, analyze, (slots) => slots.encode(nodes), (text) => Int32Slots.decode(text, mod, nodes));
|
|
1785
|
+
}
|
|
1786
|
+
joinInt32Slots() {
|
|
1787
|
+
const join = this.int32SlotsJoin;
|
|
1788
|
+
if (join === undefined)
|
|
1789
|
+
throw new InternalCompilerError("llvm emitter bug: int32 slots read before analysis");
|
|
1790
|
+
this.int32SlotsJoin = undefined;
|
|
1791
|
+
return join();
|
|
1514
1792
|
}
|
|
1515
1793
|
/** The borrowed parameters of a hierarchy's vtable slot (empty: owned). */
|
|
1516
1794
|
virtualSlotBorrowed(rootName, slotIndex) {
|
|
@@ -1563,7 +1841,8 @@ export class LlEmitter {
|
|
|
1563
1841
|
return this.emitParts().join("\n");
|
|
1564
1842
|
}
|
|
1565
1843
|
emitParts() {
|
|
1566
|
-
|
|
1844
|
+
const parts = emitParts(this);
|
|
1845
|
+
return this.unwindAbi.size > 0 ? bridgePlainUnwindCalls(parts) : parts;
|
|
1567
1846
|
}
|
|
1568
1847
|
/** The dispose-observer gates the emitted frees and record writers test
|
|
1569
1848
|
* (alloc.ts): defined after every helper is emitted, because dynCheck
|
|
@@ -1691,10 +1970,26 @@ export class LlEmitter {
|
|
|
1691
1970
|
this.mangledFunctions.set(mangleBorrowedFunction(fn.name), fn.name);
|
|
1692
1971
|
}
|
|
1693
1972
|
}
|
|
1694
|
-
|
|
1695
|
-
|
|
1973
|
+
// The names `@(sc_b?f_[A-Za-z0-9_]+)` matches, found with indexOf.
|
|
1974
|
+
for (let at = text.indexOf("@sc_"); at >= 0;) {
|
|
1975
|
+
let start = at + 4;
|
|
1976
|
+
if (text.charCodeAt(start) === 98 /* b */)
|
|
1977
|
+
start++;
|
|
1978
|
+
if (text.charCodeAt(start) !== 102 /* f */ || text.charCodeAt(start + 1) !== 95 /* _ */) {
|
|
1979
|
+
at = text.indexOf("@sc_", at + 1);
|
|
1980
|
+
continue;
|
|
1981
|
+
}
|
|
1982
|
+
let end = start + 2;
|
|
1983
|
+
while (end < text.length && isIdentifierByte(text.charCodeAt(end)))
|
|
1984
|
+
end++;
|
|
1985
|
+
if (end === start + 2) {
|
|
1986
|
+
at = text.indexOf("@sc_", at + 1);
|
|
1987
|
+
continue;
|
|
1988
|
+
}
|
|
1989
|
+
const callee = this.mangledFunctions.get(text.slice(at + 1, end));
|
|
1696
1990
|
if (callee !== undefined)
|
|
1697
1991
|
yield callee;
|
|
1992
|
+
at = text.indexOf("@sc_", end);
|
|
1698
1993
|
}
|
|
1699
1994
|
}
|
|
1700
1995
|
/** Chooses the native async functions whose bodies compile to switched
|
|
@@ -2627,6 +2922,15 @@ export class LlEmitter {
|
|
|
2627
2922
|
else if (this.currentCoro !== null) {
|
|
2628
2923
|
terminator = `br label %${this.currentCoro.finalLabel}`;
|
|
2629
2924
|
}
|
|
2925
|
+
else if (this.currentUnwindAbi && this.inLandingPad) {
|
|
2926
|
+
// The unwind that entered the landing pad goes on to the caller's.
|
|
2927
|
+
terminator = UNWIND_RESUME;
|
|
2928
|
+
}
|
|
2929
|
+
else if (this.currentUnwindAbi) {
|
|
2930
|
+
// The caller's invoke takes the exception at its landing pad.
|
|
2931
|
+
this.declare(UNWIND_RAISE_DECLARATION);
|
|
2932
|
+
terminator = UNWIND_RAISE;
|
|
2933
|
+
}
|
|
2630
2934
|
else {
|
|
2631
2935
|
const t = this.llType(this.currentReturnType);
|
|
2632
2936
|
terminator =
|
|
@@ -2656,6 +2960,7 @@ export class LlEmitter {
|
|
|
2656
2960
|
if (passThrough !== undefined &&
|
|
2657
2961
|
!target &&
|
|
2658
2962
|
this.currentCoro === null &&
|
|
2963
|
+
!this.currentUnwindAbi &&
|
|
2659
2964
|
!this.currentInt32Result) {
|
|
2660
2965
|
const t = this.llType(this.currentReturnType);
|
|
2661
2966
|
if (t === "double" || t === "i1")
|
|
@@ -2836,6 +3141,42 @@ export class LlEmitter {
|
|
|
2836
3141
|
this.emitUnwind();
|
|
2837
3142
|
B.startBlock(B.newLabel("exc.dead"));
|
|
2838
3143
|
}
|
|
3144
|
+
/** Emits `line`, a `call` of `callee`, and reports whether the call
|
|
3145
|
+
* needs no pending check after it: a call of an unwinding-ABI function
|
|
3146
|
+
* becomes an `invoke` whose landing pad runs this frame's unwind (the
|
|
3147
|
+
* same releases and handler as emitPendingCheck's unwind path), and the
|
|
3148
|
+
* normal path continues in a fresh block. Coroutine bodies keep plain
|
|
3149
|
+
* calls (unwindAbiFunctions excludes their callees). */
|
|
3150
|
+
emitDirectCall(line, callee) {
|
|
3151
|
+
const B = this.B;
|
|
3152
|
+
if (!this.unwindAbi.has(callee) || this.currentCoro !== null || B.isTerminated()) {
|
|
3153
|
+
B.line(line);
|
|
3154
|
+
return false;
|
|
3155
|
+
}
|
|
3156
|
+
const ok = B.newLabel("inv.ok");
|
|
3157
|
+
const pad = B.newLabel("inv.lp");
|
|
3158
|
+
this.usesLandingPads = true;
|
|
3159
|
+
// A trailing comment goes after the invoke's labels.
|
|
3160
|
+
const comment = line.indexOf(" ; ");
|
|
3161
|
+
const text = comment < 0 ? line : line.slice(0, comment);
|
|
3162
|
+
B.terminate(`${text.replace(/^((?:%[\w.]+ = )?)call /, "$1invoke ")} to label %${ok} unwind label %${pad}`);
|
|
3163
|
+
B.startBlock(pad);
|
|
3164
|
+
const exception = B.tmp();
|
|
3165
|
+
B.line(`${exception} = landingpad { ptr, i32 } cleanup`);
|
|
3166
|
+
if (this.currentUnwindAbi)
|
|
3167
|
+
B.line(`store { ptr, i32 } ${exception}, ptr ${UNWIND_SLOT}`);
|
|
3168
|
+
this.inLandingPad = true;
|
|
3169
|
+
this.emitUnwind();
|
|
3170
|
+
this.inLandingPad = false;
|
|
3171
|
+
B.startBlock(ok);
|
|
3172
|
+
return true;
|
|
3173
|
+
}
|
|
3174
|
+
/** Whether emitUnwind runs for a landing pad, whose unwind goes on with
|
|
3175
|
+
* `resume` instead of raising again. */
|
|
3176
|
+
inLandingPad = false;
|
|
3177
|
+
/** Whether the function being emitted has a landing pad (its definition
|
|
3178
|
+
* needs the personality). */
|
|
3179
|
+
usesLandingPads = false;
|
|
2839
3180
|
/** A recursive function's entry check: below the running stack's guard,
|
|
2840
3181
|
* throw Node's RangeError and unwind like any other pending exception. */
|
|
2841
3182
|
emitStackCheck() {
|
|
@@ -2925,12 +3266,14 @@ export class LlEmitter {
|
|
|
2925
3266
|
return false;
|
|
2926
3267
|
}
|
|
2927
3268
|
}
|
|
3269
|
+
/** Whether `loop` needs a cancellation poll: in a worker program, unless
|
|
3270
|
+
* the loop already runs a pending test on every iteration, which observes
|
|
3271
|
+
* a terminate request itself (a separate poll would only add work). */
|
|
3272
|
+
workerLoopPolls(loop) {
|
|
3273
|
+
return (this.mod.workers === true && !loopTestsEveryIteration(loop, (e) => this.callTestsPending(e)));
|
|
3274
|
+
}
|
|
2928
3275
|
workerLoopBudget(loop) {
|
|
2929
|
-
if (!this.
|
|
2930
|
-
return null;
|
|
2931
|
-
// A loop that runs a pending test on every iteration observes a
|
|
2932
|
-
// terminate request through it; a separate poll would only add work.
|
|
2933
|
-
if (loopTestsEveryIteration(loop, (e) => this.callTestsPending(e)))
|
|
3276
|
+
if (!this.workerLoopPolls(loop))
|
|
2934
3277
|
return null;
|
|
2935
3278
|
const slot = this.B.slot();
|
|
2936
3279
|
this.B.entryAllocas.push(`${slot} = alloca i32 ; worker cancellation budget`);
|
|
@@ -3002,17 +3345,12 @@ export class LlEmitter {
|
|
|
3002
3345
|
set.add(fn.name);
|
|
3003
3346
|
writers.set(localId, set);
|
|
3004
3347
|
};
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
expr: (e) => {
|
|
3012
|
-
if (e.kind === "assignExpr" || e.kind === "incDec")
|
|
3013
|
-
note(e.localId);
|
|
3014
|
-
return true;
|
|
3015
|
-
},
|
|
3348
|
+
eachNodeOfKinds(fn, this.nodeIndex.scan(GLOBAL_WRITE_KINDS), (node) => {
|
|
3349
|
+
if (node.kind === "assign" ||
|
|
3350
|
+
node.kind === "varDecl" ||
|
|
3351
|
+
node.kind === "assignExpr" ||
|
|
3352
|
+
node.kind === "incDec")
|
|
3353
|
+
note(node.localId);
|
|
3016
3354
|
});
|
|
3017
3355
|
}
|
|
3018
3356
|
this.globalWriters = writers;
|
|
@@ -3040,13 +3378,17 @@ export class LlEmitter {
|
|
|
3040
3378
|
B.condBr(due, poll, next);
|
|
3041
3379
|
B.startBlock(poll);
|
|
3042
3380
|
B.line(`store i32 63, ptr ${slot}`);
|
|
3043
|
-
|
|
3044
|
-
// extra cancellation poll across bounded loop batches so scalar work
|
|
3045
|
-
// does not cross the runtime ABI on every iteration.
|
|
3046
|
-
this.emitPendingCheck(undefined, true);
|
|
3381
|
+
this.emitWorkerPoll();
|
|
3047
3382
|
B.br(next);
|
|
3048
3383
|
B.startBlock(next);
|
|
3049
3384
|
}
|
|
3385
|
+
/** The cancellation poll itself. Calls and throwing operations retain
|
|
3386
|
+
* their own checks. Loops amortize this extra poll across bounded
|
|
3387
|
+
* batches of iterations so scalar work does not cross the runtime ABI on
|
|
3388
|
+
* every iteration. */
|
|
3389
|
+
emitWorkerPoll() {
|
|
3390
|
+
this.emitPendingCheck(undefined, true);
|
|
3391
|
+
}
|
|
3050
3392
|
/** Moves an already-evaluated value into the runtime's exception cell —
|
|
3051
3393
|
* the `throw` statement's kind dispatch (stmts.ts's), shared with
|
|
3052
3394
|
* every synthetic thrower. Ownership of a refcounted payload must have
|
|
@@ -3364,6 +3706,14 @@ export class LlEmitter {
|
|
|
3364
3706
|
return t;
|
|
3365
3707
|
}
|
|
3366
3708
|
// ── class plumbing ──────────────────────────────────────────────────────
|
|
3709
|
+
/** `name` and every class whose membership interval falls in its own. */
|
|
3710
|
+
classSubtypes(name) {
|
|
3711
|
+
const target = this.classMetaOf(name);
|
|
3712
|
+
const intervals = classMembershipIntervals(this.classMeta, target.def.name);
|
|
3713
|
+
return [...this.classMeta.values()]
|
|
3714
|
+
.filter((meta) => intervals.some((range) => range.pre <= meta.pre && meta.pre <= range.post))
|
|
3715
|
+
.map((meta) => meta.def.name);
|
|
3716
|
+
}
|
|
3367
3717
|
classMetaOf(className) {
|
|
3368
3718
|
const meta = this.classMeta.get(className);
|
|
3369
3719
|
if (!meta)
|
|
@@ -3448,7 +3798,12 @@ export class LlEmitter {
|
|
|
3448
3798
|
classObjSym(className) {
|
|
3449
3799
|
if (!this.classObjs.has(className)) {
|
|
3450
3800
|
const meta = this.classMetaOf(className);
|
|
3451
|
-
|
|
3801
|
+
// util.inspect prints `[class C extends B]` with the base's name.
|
|
3802
|
+
const baseName = meta.base ? classJsName(meta.base.def) : "";
|
|
3803
|
+
this.classObjs.set(className, {
|
|
3804
|
+
nameSym: this.internLiteral(classJsName(meta.def)),
|
|
3805
|
+
baseNameSym: baseName ? this.internLiteral(baseName) : null,
|
|
3806
|
+
});
|
|
3452
3807
|
}
|
|
3453
3808
|
this.journal?.entry("classObj", className, this.classObjs.get(className));
|
|
3454
3809
|
return mangleClassObj(className);
|
|
@@ -3660,8 +4015,17 @@ export class LlEmitter {
|
|
|
3660
4015
|
workers: this.mod.workers === true,
|
|
3661
4016
|
owned: this.bytesOwned,
|
|
3662
4017
|
scalarStrings: new Set(this.stringSlices.keys()),
|
|
4018
|
+
unitSafeFunctions: this.unitSafeFunctions(),
|
|
3663
4019
|
}, paired);
|
|
3664
4020
|
}
|
|
4021
|
+
unitSafe;
|
|
4022
|
+
/** The functions a loop over a string's UTF-16 units may call, or null
|
|
4023
|
+
* where emitted reads do not use the runtime's scan receiver. */
|
|
4024
|
+
unitSafeFunctions() {
|
|
4025
|
+
if (this.unitSafe === undefined)
|
|
4026
|
+
this.unitSafe = stringScanInline(this) ? unitSafeFunctions(this.mod) : null;
|
|
4027
|
+
return this.unitSafe;
|
|
4028
|
+
}
|
|
3665
4029
|
/** The alias tag of a whole-slot load of a binding (module globals only). */
|
|
3666
4030
|
slotAlias(id) {
|
|
3667
4031
|
const binding = this.binding(id);
|
|
@@ -4100,6 +4464,7 @@ export class LlEmitter {
|
|
|
4100
4464
|
chunkResult() {
|
|
4101
4465
|
return {
|
|
4102
4466
|
entries: this.journal.entries,
|
|
4467
|
+
debugRequests: this.debug?.recorded() ?? [],
|
|
4103
4468
|
flags: {
|
|
4104
4469
|
usesCoroutines: this.usesCoroutines,
|
|
4105
4470
|
usesTimers: this.usesTimers,
|
|
@@ -4134,6 +4499,8 @@ export class LlEmitter {
|
|
|
4134
4499
|
// emission left them (a helper set guards the declarations its first
|
|
4135
4500
|
// request adds).
|
|
4136
4501
|
replayJournal(this, chunk.entries, names, tags);
|
|
4502
|
+
const debugIds = new Map();
|
|
4503
|
+
this.debug?.replay(chunk.debugRequests, (name) => this.functionNamed(name), debugIds);
|
|
4137
4504
|
const flags = chunk.flags;
|
|
4138
4505
|
this.usesCoroutines ||= flags.usesCoroutines;
|
|
4139
4506
|
this.usesTimers ||= flags.usesTimers;
|
|
@@ -4164,7 +4531,13 @@ export class LlEmitter {
|
|
|
4164
4531
|
this.directAwaitCallees.add(name);
|
|
4165
4532
|
for (const name of chunk.inlineAwaitCallees)
|
|
4166
4533
|
this.inlineAwaitCallees.add(name);
|
|
4167
|
-
return renameChunk(names, tags);
|
|
4534
|
+
return renameChunk(names, tags, debugIds);
|
|
4535
|
+
}
|
|
4536
|
+
functionNamed(name) {
|
|
4537
|
+
const fn = this.fnByName.get(name);
|
|
4538
|
+
if (fn === undefined)
|
|
4539
|
+
throw new InternalCompilerError(`llvm emitter bug: no function ${name}`);
|
|
4540
|
+
return fn;
|
|
4168
4541
|
}
|
|
4169
4542
|
/** Adds a content-named constant a chunk interned. Its symbol is this
|
|
4170
4543
|
* emitter's own: a digest collision retries in first-use order, which a
|
|
@@ -4257,7 +4630,9 @@ export class LlEmitter {
|
|
|
4257
4630
|
/** An emitter for a range of this module's functions: the same facts,
|
|
4258
4631
|
* empty module-level tables, and a journal of what the range adds. */
|
|
4259
4632
|
chunkEmitter() {
|
|
4260
|
-
|
|
4633
|
+
const chunk = new LlEmitter(this.mod, { ...this.targetOptions, functionChunks: 1 }, new EmitJournal());
|
|
4634
|
+
chunk.debug?.record();
|
|
4635
|
+
return chunk;
|
|
4261
4636
|
}
|
|
4262
4637
|
/** The double-ABI entry of a function with an i32 entry: every caller
|
|
4263
4638
|
* that is not a direct call (closures, dispatch, adapters, the runtime)
|
|
@@ -4420,7 +4795,23 @@ export class LlEmitter {
|
|
|
4420
4795
|
params.unshift("ptr %sc_env");
|
|
4421
4796
|
const ret = this.llType(fn.returnType);
|
|
4422
4797
|
const call = `call ${ret} @${mangleBorrowedFunction(fn.name)}(${params.join(", ")})`;
|
|
4423
|
-
|
|
4798
|
+
// The owned entry of an unwinding-ABI body releases the borrowed
|
|
4799
|
+
// parameters on the unwind too, then resumes it to its caller.
|
|
4800
|
+
const unwinding = this.unwindAbi.has(fn.name) && kept.size === 0;
|
|
4801
|
+
if (unwinding) {
|
|
4802
|
+
const ok = B.newLabel("adapt.ok");
|
|
4803
|
+
const pad = B.newLabel("adapt.lp");
|
|
4804
|
+
B.terminate(`${ret === "void" ? "" : "%result = "}invoke ${call.slice(5)} to label %${ok} unwind label %${pad}`);
|
|
4805
|
+
B.startBlock(pad);
|
|
4806
|
+
const exception = B.tmp();
|
|
4807
|
+
B.line(`${exception} = landingpad { ptr, i32 } cleanup`);
|
|
4808
|
+
for (const index of borrowed)
|
|
4809
|
+
this.releaseFrame(`%p${index}`, fn.params[index].type);
|
|
4810
|
+
B.terminate(`resume { ptr, i32 } ${exception}`);
|
|
4811
|
+
B.startBlock(ok);
|
|
4812
|
+
}
|
|
4813
|
+
else
|
|
4814
|
+
B.line(ret === "void" ? call : `%result = ${call}`);
|
|
4424
4815
|
// A borrowed result is reachable from the parameters: own it first. A
|
|
4425
4816
|
// throwing body returns a null dummy, which needs no owner (and string
|
|
4426
4817
|
// or array retains do not accept NULL).
|
|
@@ -4446,7 +4837,10 @@ export class LlEmitter {
|
|
|
4446
4837
|
this.releaseFrame(`%p${index}`, fn.params[index].type);
|
|
4447
4838
|
B.terminate(ret === "void" ? "ret void" : `ret ${ret} ${result}`);
|
|
4448
4839
|
const symbol = kept.size > 0 ? `${mangleBorrowedFunction(fn.name)}.virtual` : mangleFunction(fn.name);
|
|
4449
|
-
|
|
4840
|
+
if (unwinding)
|
|
4841
|
+
this.declare(`declare i32 @__gcc_personality_v0(...)`);
|
|
4842
|
+
const personality = unwinding ? ` ${UNWIND_PERSONALITY}` : "";
|
|
4843
|
+
return `define internal ${ret} @${symbol}(${params.join(", ")}) ${FN_ATTRS}${personality} {\n${B.render()}\n}`;
|
|
4450
4844
|
}
|
|
4451
4845
|
canBorrowCallArgument(value) {
|
|
4452
4846
|
return canBorrowCallArgument(this, value);
|
|
@@ -4621,12 +5015,20 @@ export class LlEmitter {
|
|
|
4621
5015
|
readsLoopMetrics() {
|
|
4622
5016
|
if (this.loopMetricsRead !== undefined)
|
|
4623
5017
|
return this.loopMetricsRead;
|
|
4624
|
-
|
|
4625
|
-
|
|
4626
|
-
|
|
4627
|
-
|
|
4628
|
-
|
|
4629
|
-
|
|
5018
|
+
let found = false;
|
|
5019
|
+
const scan = this.nodeIndex.scan(LIB_CALL_KINDS);
|
|
5020
|
+
for (const fn of this.mod.functions) {
|
|
5021
|
+
eachNodeOfKinds(fn, scan, (node) => {
|
|
5022
|
+
if (node.kind === "libCall" &&
|
|
5023
|
+
(node.fn === "perf.loopStart" || node.fn === "perf.idleTime"))
|
|
5024
|
+
found = true;
|
|
5025
|
+
return !found;
|
|
5026
|
+
});
|
|
5027
|
+
if (found)
|
|
5028
|
+
break;
|
|
5029
|
+
}
|
|
5030
|
+
this.loopMetricsRead = found;
|
|
5031
|
+
return found;
|
|
4630
5032
|
}
|
|
4631
5033
|
lastUseMovesAllowed() {
|
|
4632
5034
|
return (this.debug === null &&
|
|
@@ -4810,6 +5212,9 @@ export class LlEmitter {
|
|
|
4810
5212
|
if (cursor)
|
|
4811
5213
|
cursor.index = i;
|
|
4812
5214
|
this.stmtCursor = cursor;
|
|
5215
|
+
const reserve = reservedArrayLength(stmts, i);
|
|
5216
|
+
if (reserve !== null)
|
|
5217
|
+
this.reservedArrayLengths.set(reserve.literal, reserve.hint);
|
|
4813
5218
|
const deferred = this.deferredPromiseAllLocal(stmts, i);
|
|
4814
5219
|
if (deferred !== null) {
|
|
4815
5220
|
this.deferredPromiseAllEntries.set(stmts[i].localId, deferred);
|
|
@@ -4842,6 +5247,24 @@ export class LlEmitter {
|
|
|
4842
5247
|
if (resume && !resume.placed && !this.B.isTerminated()) {
|
|
4843
5248
|
// The fast copy's failed checks re-execute this statement here.
|
|
4844
5249
|
resume.placed = true;
|
|
5250
|
+
// A write with hoisted leaves resumed from its own failed check
|
|
5251
|
+
// re-executes its arithmetic over the leaves' stored doubles: each
|
|
5252
|
+
// leaf ran once, in the fast copy. Reached from an earlier statement
|
|
5253
|
+
// of this copy (a failed check before it), its leaves never ran, so
|
|
5254
|
+
// it runs as written.
|
|
5255
|
+
const rewritten = this.speculationResumeValues?.get(s);
|
|
5256
|
+
if (rewritten !== undefined && rewritten.leaves.length > 0) {
|
|
5257
|
+
const join = this.B.newLabel("spec.resume.join");
|
|
5258
|
+
this.emitStmt(s);
|
|
5259
|
+
if (!this.B.isTerminated())
|
|
5260
|
+
this.B.br(join);
|
|
5261
|
+
this.B.startBlock(resume.label);
|
|
5262
|
+
this.emitStmt(withSpeculativeValue(s, rewritten.value));
|
|
5263
|
+
if (!this.B.isTerminated())
|
|
5264
|
+
this.B.br(join);
|
|
5265
|
+
this.B.startBlock(join);
|
|
5266
|
+
return;
|
|
5267
|
+
}
|
|
4845
5268
|
this.B.br(resume.label);
|
|
4846
5269
|
this.B.startBlock(resume.label);
|
|
4847
5270
|
}
|
|
@@ -4970,6 +5393,10 @@ export class LlEmitter {
|
|
|
4970
5393
|
});
|
|
4971
5394
|
return;
|
|
4972
5395
|
}
|
|
5396
|
+
if (e.kind === "dynInvoke" && e.calleeNameValue === undefined) {
|
|
5397
|
+
emitDynamicExpr(this, e, true);
|
|
5398
|
+
return;
|
|
5399
|
+
}
|
|
4973
5400
|
this.emitExpr(e);
|
|
4974
5401
|
}
|
|
4975
5402
|
emitControlExpr(e) {
|
|
@@ -5959,8 +6386,8 @@ export class LlEmitter {
|
|
|
5959
6386
|
emitBytesLength(elem, receiver, bytes) {
|
|
5960
6387
|
return emitBytesLength(this, elem, receiver, bytes);
|
|
5961
6388
|
}
|
|
5962
|
-
emitBytesGet(elem, receiver, index, expr, inBounds = false, invalidNaN = false, owned = false) {
|
|
5963
|
-
return emitBytesGet(this, elem, receiver, index, expr, inBounds, invalidNaN, owned);
|
|
6389
|
+
emitBytesGet(elem, receiver, index, expr, inBounds = false, invalidNaN = false, owned = false, scope = "") {
|
|
6390
|
+
return emitBytesGet(this, elem, receiver, index, expr, inBounds, invalidNaN, owned, scope);
|
|
5964
6391
|
}
|
|
5965
6392
|
emitToUint32(value, expr, uint32) {
|
|
5966
6393
|
return emitToUint32(this, value, expr, uint32);
|
|
@@ -6015,8 +6442,8 @@ export class LlEmitter {
|
|
|
6015
6442
|
const integer = this.emitToUint32(value.name, expr, value.uint32);
|
|
6016
6443
|
this.B.line(`store i32 ${integer}, ptr ${slot}`);
|
|
6017
6444
|
}
|
|
6018
|
-
emitBytesSet(elem, receiver, index, value, indexExpr, expr, inBounds = false, owned = false) {
|
|
6019
|
-
return emitBytesSet(this, elem, receiver, index, value, indexExpr, expr, inBounds, owned);
|
|
6445
|
+
emitBytesSet(elem, receiver, index, value, indexExpr, expr, inBounds = false, owned = false, scope = "") {
|
|
6446
|
+
return emitBytesSet(this, elem, receiver, index, value, indexExpr, expr, inBounds, owned, scope);
|
|
6020
6447
|
}
|
|
6021
6448
|
emitBytesIntrinsic(e) {
|
|
6022
6449
|
return emitBytesIntrinsic(this, e);
|