@scriptc/compiler 0.4.3 → 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 +270 -72
- 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 +244 -20
- package/dist/backend/llvm/bytes-loop-versions.js.map +1 -1
- package/dist/backend/llvm/bytes-loop-versions.test.js +18 -6
- 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 +72 -6
- 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 +69 -8
- package/dist/backend/llvm/dyn.js +396 -49
- package/dist/backend/llvm/dyn.js.map +1 -1
- package/dist/backend/llvm/emit-function.js +30 -16
- 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 +74 -29
- 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 +144 -13
- package/dist/backend/llvm/emitter.js +523 -92
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/backend/llvm/emitter.test.js +11 -2
- package/dist/backend/llvm/emitter.test.js.map +1 -1
- package/dist/backend/llvm/expr-async.js +11 -13
- package/dist/backend/llvm/expr-async.js.map +1 -1
- package/dist/backend/llvm/expr-bytes.d.ts +6 -4
- package/dist/backend/llvm/expr-bytes.js +45 -16
- 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 +101 -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 +121 -14
- package/dist/backend/llvm/expr-primitives.js.map +1 -1
- package/dist/backend/llvm/expr-stream-bridges.js +111 -26
- 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 +12 -0
- package/dist/backend/llvm/integer-values.js +69 -5
- 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 +249 -33
- 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 +48 -1
- package/dist/backend/llvm/lib-process.js.map +1 -1
- package/dist/backend/llvm/lib-shared.js +64 -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/publish.js +3 -3
- package/dist/backend/llvm/publish.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/reference-effects.js +3 -0
- package/dist/backend/llvm/reference-effects.js.map +1 -1
- 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 +106 -58
- 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-captures.js +1 -5
- package/dist/backend/llvm/stack-captures.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/union-repr.d.ts +4 -3
- package/dist/backend/llvm/union-repr.js +6 -5
- package/dist/backend/llvm/union-repr.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/walkers.js +13 -0
- package/dist/backend/llvm/walkers.js.map +1 -1
- 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-core.d.ts +5 -3
- package/dist/backend/native-codegen-core.js +13 -6
- package/dist/backend/native-codegen-core.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-codegen.test.js +6 -4
- package/dist/backend/native-codegen.test.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/target-cpu.d.ts +26 -0
- package/dist/backend/target-cpu.js +98 -0
- package/dist/backend/target-cpu.js.map +1 -0
- package/dist/backend/target-cpu.test.d.ts +1 -0
- package/dist/backend/target-cpu.test.js +38 -0
- package/dist/backend/target-cpu.test.js.map +1 -0
- 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 +98 -12
- package/dist/cli/command.js.map +1 -1
- package/dist/cli/usage.d.ts +25 -1
- package/dist/cli/usage.js +40 -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 +14 -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 +53 -2
- 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 +6 -0
- package/dist/executable/executable-cache.js +5 -0
- package/dist/executable/executable-cache.js.map +1 -1
- package/dist/executable/executable-cache.test.js +3 -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/decl-projection.js +105 -10
- package/dist/frontend/decl-projection.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/async-context.d.ts +8 -2
- package/dist/frontend/lowering/builtins/async-context.js +62 -3
- package/dist/frontend/lowering/builtins/async-context.js.map +1 -1
- 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/crypto.js +3 -1
- package/dist/frontend/lowering/builtins/crypto.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 +163 -9
- package/dist/frontend/lowering/builtins/dates.js.map +1 -1
- package/dist/frontend/lowering/builtins/filesystem-calls.js +29 -4
- package/dist/frontend/lowering/builtins/filesystem-calls.js.map +1 -1
- package/dist/frontend/lowering/builtins/fs-glob.js +6 -3
- package/dist/frontend/lowering/builtins/fs-glob.js.map +1 -1
- package/dist/frontend/lowering/builtins/fs-paths.d.ts +43 -5
- package/dist/frontend/lowering/builtins/fs-paths.js +245 -93
- package/dist/frontend/lowering/builtins/fs-paths.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-calls.js +6 -3
- package/dist/frontend/lowering/builtins/module-calls.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.d.ts +1 -1
- package/dist/frontend/lowering/builtins/promises.js +293 -139
- 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 -2
- package/dist/frontend/lowering/call-signatures.js.map +1 -1
- package/dist/frontend/lowering/cjs-exports-object.js +1 -1
- package/dist/frontend/lowering/cjs-exports-object.js.map +1 -1
- package/dist/frontend/lowering/cjs-inline-require.d.ts +32 -0
- package/dist/frontend/lowering/cjs-inline-require.js +308 -5
- 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 +23 -0
- package/dist/frontend/lowering/class-dynamic-dispatch.js +288 -9
- package/dist/frontend/lowering/class-dynamic-dispatch.js.map +1 -1
- package/dist/frontend/lowering/class-method-mutations.js +97 -26
- 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-protocols.d.ts +25 -0
- package/dist/frontend/lowering/class-protocols.js +183 -1
- package/dist/frontend/lowering/class-protocols.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/completion-callbacks.d.ts +4 -0
- package/dist/frontend/lowering/completion-callbacks.js +146 -0
- package/dist/frontend/lowering/completion-callbacks.js.map +1 -0
- package/dist/frontend/lowering/containers/array-callbacks.d.ts +5 -4
- package/dist/frontend/lowering/containers/array-callbacks.js +58 -21
- 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 +107 -9
- package/dist/frontend/lowering/containers/array-construction.js.map +1 -1
- package/dist/frontend/lowering/containers/array-methods.js +96 -8
- 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/bytes.d.ts +25 -17
- package/dist/frontend/lowering/containers/bytes.js +453 -45
- package/dist/frontend/lowering/containers/bytes.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 +14 -0
- package/dist/frontend/lowering/date-values.js +254 -0
- package/dist/frontend/lowering/date-values.js.map +1 -0
- 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 +125 -26
- package/dist/frontend/lowering/expressions/array-literals.js.map +1 -1
- package/dist/frontend/lowering/expressions/binary.js +102 -26
- package/dist/frontend/lowering/expressions/binary.js.map +1 -1
- package/dist/frontend/lowering/expressions/element-access.js +129 -6
- package/dist/frontend/lowering/expressions/element-access.js.map +1 -1
- package/dist/frontend/lowering/expressions/identifiers.js +66 -4
- 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 +121 -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 +12 -1
- package/dist/frontend/lowering/expressions/typeof.js.map +1 -1
- package/dist/frontend/lowering/expressions/updates.js +37 -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 +30 -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/indexed-unions.d.ts +54 -0
- package/dist/frontend/lowering/indexed-unions.js +401 -0
- package/dist/frontend/lowering/indexed-unions.js.map +1 -0
- 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/key-order-witness.js +210 -32
- package/dist/frontend/lowering/key-order-witness.js.map +1 -1
- package/dist/frontend/lowering/key-order-witness.test.js +104 -4
- package/dist/frontend/lowering/key-order-witness.test.js.map +1 -1
- 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 +298 -29
- 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 +116 -10
- 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 +668 -222
- 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 +254 -3
- 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 +5 -4
- package/dist/frontend/lowering/lower-generators.js.map +1 -1
- package/dist/frontend/lowering/lower-inspect.d.ts +1 -1
- package/dist/frontend/lowering/lower-inspect.js +299 -57
- package/dist/frontend/lowering/lower-inspect.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.js +49 -22
- 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 +393 -79
- 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 +82 -12
- package/dist/frontend/lowering/lowerer.js +317 -44
- 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/object-factory-new.d.ts +5 -0
- package/dist/frontend/lowering/object-factory-new.js +20 -6
- package/dist/frontend/lowering/object-factory-new.js.map +1 -1
- package/dist/frontend/lowering/overload-choice.d.ts +33 -0
- package/dist/frontend/lowering/overload-choice.js +190 -0
- package/dist/frontend/lowering/overload-choice.js.map +1 -0
- 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 +1630 -1540
- 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 +103 -12
- package/dist/frontend/pipeline.js.map +1 -1
- package/dist/frontend/program-analysis.d.ts +7 -1
- package/dist/frontend/program-analysis.js +8 -0
- package/dist/frontend/program-analysis.js.map +1 -1
- package/dist/frontend/program.d.ts +28 -5
- package/dist/frontend/program.js +422 -76
- 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.d.ts +3 -0
- package/dist/frontend/ts7/semantic-model.js +8 -1
- package/dist/frontend/ts7/semantic-model.js.map +1 -1
- package/dist/frontend/ts7/semantic-model.test.js +6 -1
- package/dist/frontend/ts7/semantic-model.test.js.map +1 -1
- package/dist/frontend/ts7/semantic-types.d.ts +1 -1
- package/dist/frontend/ts7/semantic-types.js +1 -1
- package/dist/frontend/ts7/semantic-types.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 +205 -44
- package/dist/frontend/type-mapper.js.map +1 -1
- package/dist/index.d.ts +44 -3
- package/dist/index.js +39 -8
- package/dist/index.js.map +1 -1
- package/dist/ir/builtin-effects.js +37 -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 -4894
- 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 +291 -5
- package/dist/ir/int32-slots.js.map +1 -1
- package/dist/ir/int32-slots.test.js +38 -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 +107 -11
- 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 +63 -11
- package/dist/ir/ir.js +47 -7
- package/dist/ir/ir.js.map +1 -1
- package/dist/ir/ir.test.js +2 -1
- package/dist/ir/ir.test.js.map +1 -1
- package/dist/ir/js-ic.d.ts +10 -3
- package/dist/ir/js-ic.js +14 -2
- package/dist/ir/js-ic.js.map +1 -1
- package/dist/ir/js-ic.test.js +11 -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 +94 -13
- 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 +78 -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 +5 -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.d.ts +1 -1
- package/dist/native/prepare.js +49 -17
- package/dist/native/prepare.js.map +1 -1
- package/dist/native/prepare.test.js +69 -3
- 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 +21 -38
|
@@ -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();
|
|
@@ -642,6 +794,7 @@ export class LlEmitter {
|
|
|
642
794
|
emitLibraryIdentity;
|
|
643
795
|
runtimeAbiMarker;
|
|
644
796
|
detachedExit;
|
|
797
|
+
targetCpu;
|
|
645
798
|
wasmBoundsChecks;
|
|
646
799
|
/** Interned string literals: UTF-8 text → { symbol, byte length } —
|
|
647
800
|
* first-use order, the runtime ABI’s determinism discipline. */
|
|
@@ -729,7 +882,13 @@ export class LlEmitter {
|
|
|
729
882
|
checkedNarrows;
|
|
730
883
|
callArrayReads = new Map();
|
|
731
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();
|
|
732
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();
|
|
733
892
|
/** The current function's fused string-key Map get-then-set pairs (map-entry-fusion.ts). */
|
|
734
893
|
mapEntryFusion = null;
|
|
735
894
|
callLifetimes;
|
|
@@ -799,6 +958,10 @@ export class LlEmitter {
|
|
|
799
958
|
/** May-throw analysis (computeMayThrow): pending
|
|
800
959
|
* checks are emitted only after calls that can actually raise. */
|
|
801
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;
|
|
802
965
|
indirectMayThrow;
|
|
803
966
|
/** Worker programs: the functions that poll for termination on entry
|
|
804
967
|
* (workerTerminationPolls); null outside worker programs. */
|
|
@@ -837,6 +1000,11 @@ export class LlEmitter {
|
|
|
837
1000
|
/** Locals whose array literal emitStmts left for the `await Promise.all`
|
|
838
1001
|
* that reads them (deferredPromiseAllLocal). */
|
|
839
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();
|
|
840
1008
|
/** The promise a `return` emitted past its finally regions already
|
|
841
1009
|
* produced for its adopting await (borrowed from the return's parked
|
|
842
1010
|
* slot); that await takes it instead of evaluating its operand. */
|
|
@@ -952,12 +1120,22 @@ export class LlEmitter {
|
|
|
952
1120
|
streamingSplitsEnabled = false;
|
|
953
1121
|
initializerBindings;
|
|
954
1122
|
/** Whole-program int32 storage and parameter/result facts. */
|
|
955
|
-
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;
|
|
956
1130
|
/** The program has no runtime store into a checked-dynamic value
|
|
957
1131
|
* (dynamicFieldStores), so live views of classes and records never
|
|
958
1132
|
* commit back into their objects. Library builds keep their commits:
|
|
959
1133
|
* their values cross a native boundary. */
|
|
960
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;
|
|
961
1139
|
/** Functions whose direct calls use i32 parameters or results. */
|
|
962
1140
|
int32Abis;
|
|
963
1141
|
/** Pure number functions with speculative integer clones. */
|
|
@@ -987,6 +1165,9 @@ export class LlEmitter {
|
|
|
987
1165
|
integerTempsEnabled = false;
|
|
988
1166
|
/** Speculative integer loops (speculative-integers.ts) run in this function. */
|
|
989
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;
|
|
990
1171
|
/** The fast copy of a speculative integer loop being emitted: its
|
|
991
1172
|
* integer-computed writes and where each resumes in the ordinary copy. */
|
|
992
1173
|
speculation = null;
|
|
@@ -994,6 +1175,37 @@ export class LlEmitter {
|
|
|
994
1175
|
speculativeLoopSites = 0;
|
|
995
1176
|
/** The ordinary copy being emitted: resume labels still to place. */
|
|
996
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
|
+
}
|
|
997
1209
|
/** Run once at the top of the next loop copy's header
|
|
998
1210
|
* (`enterLoopHeader`): records the ordinary copy's header, or sends the
|
|
999
1211
|
* third copy's header there. */
|
|
@@ -1031,9 +1243,23 @@ export class LlEmitter {
|
|
|
1031
1243
|
* (one-unit tests and switches, charAtUnitRead), with the charAt each
|
|
1032
1244
|
* stands for: a loop version's proof for the charAt covers its read. */
|
|
1033
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();
|
|
1034
1252
|
/** Worker programs: typed-array accesses whose views an enclosing version
|
|
1035
1253
|
* guard proved thread-owned. */
|
|
1036
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;
|
|
1037
1263
|
integerViews = new Map();
|
|
1038
1264
|
/** Module globals the current function owns outright (initializer
|
|
1039
1265
|
* bindings): their function-local slot, which stands in for the global. */
|
|
@@ -1094,18 +1320,26 @@ export class LlEmitter {
|
|
|
1094
1320
|
journaled;
|
|
1095
1321
|
/** Stack-trace mode: functions no capture can include (no frame push). */
|
|
1096
1322
|
unframedFunctions;
|
|
1097
|
-
constructor(mod, options, journal = null) {
|
|
1323
|
+
constructor(mod, options, journal = null, int32Analysis = null) {
|
|
1098
1324
|
this.mod = mod;
|
|
1099
1325
|
this.targetOptions = options;
|
|
1100
1326
|
this.journal = journal;
|
|
1101
1327
|
this.journaled =
|
|
1102
1328
|
journal !== null ||
|
|
1103
|
-
((options.functionWorkers ?? 1) > 1 &&
|
|
1104
|
-
options.forkPrimitives !== undefined &&
|
|
1105
|
-
options.debugSources === undefined);
|
|
1329
|
+
((options.functionWorkers ?? 1) > 1 && options.forkPrimitives !== undefined);
|
|
1106
1330
|
// One walk of every body, which the analyses below read instead of
|
|
1107
1331
|
// walking the bodies themselves.
|
|
1108
|
-
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);
|
|
1109
1343
|
this.stackTraces = observesStacks(mod, this.nodeIndex);
|
|
1110
1344
|
this.nullableUnions = new NullableUnions(mod, options.debugSources === undefined, this.nodeIndex);
|
|
1111
1345
|
this.mockTimers = this.runtimeFeatures.mockTimers;
|
|
@@ -1114,16 +1348,12 @@ export class LlEmitter {
|
|
|
1114
1348
|
? null
|
|
1115
1349
|
: new LlvmDebugInfo(mod.sourceFile, options.debugSources, options.pointerBits, mod.unions, this.nullableUnions.armTypes());
|
|
1116
1350
|
this.constantNumericTables = findConstantNumericTables(mod);
|
|
1117
|
-
this.
|
|
1118
|
-
// One walk finds the dynamic field stores every analysis below consults.
|
|
1119
|
-
const dynamicStores = dynamicFieldStores(mod, undefined, undefined, this.nodeIndex);
|
|
1120
|
-
this.int32Slots = analyzeInt32Slots(mod, {
|
|
1121
|
-
dynamicStores,
|
|
1122
|
-
initializerBindings: this.initializerBindings,
|
|
1123
|
-
nodes: this.nodeIndex,
|
|
1124
|
-
});
|
|
1351
|
+
this.untypedIntegrity = mod.untypedIntegrity === true;
|
|
1125
1352
|
this.liveViewsReadOnly =
|
|
1126
|
-
mod.lib === undefined &&
|
|
1353
|
+
mod.lib === undefined &&
|
|
1354
|
+
!this.untypedIntegrity &&
|
|
1355
|
+
!dynamicStores.all &&
|
|
1356
|
+
dynamicStores.names.size === 0;
|
|
1127
1357
|
this.int32Abis = this.debug === null ? findInt32Abis(mod, this.int32Slots) : new Map();
|
|
1128
1358
|
this.immortalGlobals = new Set(mod.contracts?.immortalGlobals ?? []);
|
|
1129
1359
|
this.programLifetime = new Set(mod.contracts?.programLifetime ?? []);
|
|
@@ -1159,6 +1389,7 @@ export class LlEmitter {
|
|
|
1159
1389
|
this.emitLibraryIdentity = options.emitLibraryIdentity !== false;
|
|
1160
1390
|
this.runtimeAbiMarker = options.runtimeAbiMarker === true;
|
|
1161
1391
|
this.detachedExit = options.detachedExit === true;
|
|
1392
|
+
this.targetCpu = options.targetCpu;
|
|
1162
1393
|
this.wasmBoundsChecks =
|
|
1163
1394
|
options.wasmBoundsChecks === true ||
|
|
1164
1395
|
wasmBoundsChecks({
|
|
@@ -1191,6 +1422,16 @@ export class LlEmitter {
|
|
|
1191
1422
|
nodes: this.nodeIndex,
|
|
1192
1423
|
});
|
|
1193
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();
|
|
1194
1435
|
this.workerEntryPolls = mt.workerEntryPolls ?? null;
|
|
1195
1436
|
this.stackChecks = mt.stackChecks ?? null;
|
|
1196
1437
|
// A stackless call's eager prefix borrows its caller's stack; the
|
|
@@ -1285,9 +1526,15 @@ export class LlEmitter {
|
|
|
1285
1526
|
}, (shapeId) => {
|
|
1286
1527
|
const shape = this.recordsById.get(shapeId);
|
|
1287
1528
|
return shape !== undefined && !recordDynKeepsIdentity(shape);
|
|
1288
|
-
});
|
|
1289
|
-
this.
|
|
1290
|
-
|
|
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
|
+
}
|
|
1291
1538
|
this.constantCallbacks = findConstantCallbacks(mod, this.callLifetimes, this.nodeIndex);
|
|
1292
1539
|
// Integer clones signal a stack overflow through their result, which
|
|
1293
1540
|
// needs the single-threaded guard; worker programs also poll for
|
|
@@ -1303,10 +1550,14 @@ export class LlEmitter {
|
|
|
1303
1550
|
? (fn, index) => this.callLifetimes.borrowed.get(fn)?.has(index) === true
|
|
1304
1551
|
: undefined)
|
|
1305
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);
|
|
1306
1557
|
this.stackCallbacks = new StackCallbacks(this.fnByName);
|
|
1307
|
-
this.receiverReaders = new AmbientReceiverReaders(this.fnByName);
|
|
1558
|
+
this.receiverReaders = new AmbientReceiverReaders(this.fnByName, this.nodeIndex);
|
|
1308
1559
|
this.stackCaptures = new StackCaptures(this.fnByName, this.callLifetimes, this.stackCallbacks);
|
|
1309
|
-
this.lazyCaptures = new LazyCaptures(this.fnByName);
|
|
1560
|
+
this.lazyCaptures = new LazyCaptures(this.fnByName, this.nodeIndex);
|
|
1310
1561
|
const traced = computeTraced(mod, dynamicStores, cycleMutability);
|
|
1311
1562
|
this.tracedShapes = traced.shapes;
|
|
1312
1563
|
this.tracedUnions = traced.unions;
|
|
@@ -1395,12 +1646,11 @@ export class LlEmitter {
|
|
|
1395
1646
|
const meta = this.classMeta.get(t.className);
|
|
1396
1647
|
return meta !== undefined && programLifetimeClass(this.shapeHost, meta);
|
|
1397
1648
|
},
|
|
1398
|
-
classSubtypes: (name) =>
|
|
1399
|
-
|
|
1400
|
-
const
|
|
1401
|
-
return
|
|
1402
|
-
|
|
1403
|
-
.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));
|
|
1404
1654
|
},
|
|
1405
1655
|
pendingTestLines: (dest) => this.pendingTestLines(dest),
|
|
1406
1656
|
virtualEntry: (implFn) => this.virtualEntry(implFn),
|
|
@@ -1509,6 +1759,36 @@ export class LlEmitter {
|
|
|
1509
1759
|
// After the vtable slots: borrowing slots exclude their implementations.
|
|
1510
1760
|
if (this.debug === null)
|
|
1511
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();
|
|
1512
1792
|
}
|
|
1513
1793
|
/** The borrowed parameters of a hierarchy's vtable slot (empty: owned). */
|
|
1514
1794
|
virtualSlotBorrowed(rootName, slotIndex) {
|
|
@@ -1534,7 +1814,6 @@ export class LlEmitter {
|
|
|
1534
1814
|
return "ptr";
|
|
1535
1815
|
switch (t.kind) {
|
|
1536
1816
|
case "f64":
|
|
1537
|
-
case "date":
|
|
1538
1817
|
return "double";
|
|
1539
1818
|
case "bool":
|
|
1540
1819
|
return "i1";
|
|
@@ -1562,7 +1841,8 @@ export class LlEmitter {
|
|
|
1562
1841
|
return this.emitParts().join("\n");
|
|
1563
1842
|
}
|
|
1564
1843
|
emitParts() {
|
|
1565
|
-
|
|
1844
|
+
const parts = emitParts(this);
|
|
1845
|
+
return this.unwindAbi.size > 0 ? bridgePlainUnwindCalls(parts) : parts;
|
|
1566
1846
|
}
|
|
1567
1847
|
/** The dispose-observer gates the emitted frees and record writers test
|
|
1568
1848
|
* (alloc.ts): defined after every helper is emitted, because dynCheck
|
|
@@ -1638,7 +1918,6 @@ export class LlEmitter {
|
|
|
1638
1918
|
this.declare(`declare void @scr_promise_fulfill_void(ptr)`);
|
|
1639
1919
|
return [` call void @scr_promise_fulfill_void(ptr ${promise})`];
|
|
1640
1920
|
case "f64":
|
|
1641
|
-
case "date":
|
|
1642
1921
|
this.declare(`declare void @scr_promise_fulfill_f64(ptr, double)`);
|
|
1643
1922
|
return [` call void @scr_promise_fulfill_f64(ptr ${promise}, double %r)`];
|
|
1644
1923
|
case "bool":
|
|
@@ -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
|
|
@@ -1879,7 +2174,7 @@ export class LlEmitter {
|
|
|
1879
2174
|
return { name: "", type };
|
|
1880
2175
|
}
|
|
1881
2176
|
const t = B.tmp();
|
|
1882
|
-
if (type.kind === "f64"
|
|
2177
|
+
if (type.kind === "f64") {
|
|
1883
2178
|
this.declare(`declare double @scr_coro_direct_f64(ptr)`);
|
|
1884
2179
|
B.line(`${t} = call double @scr_coro_direct_f64(ptr ${record})`);
|
|
1885
2180
|
}
|
|
@@ -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
|
|
@@ -3236,8 +3578,12 @@ export class LlEmitter {
|
|
|
3236
3578
|
// ── union plumbing ──────────────────────────────────────────────────────
|
|
3237
3579
|
/** A union value's tag (i32): the box's tag word, or the NULL test of a
|
|
3238
3580
|
* nullable union's pointer. */
|
|
3581
|
+
/** A box's tag and payload words are written only where the box is
|
|
3582
|
+
* built (runtime constructors and untagged stack stores), so their loads
|
|
3583
|
+
* carry their own alias tags: element and field stores cannot change
|
|
3584
|
+
* them, and loops keep them hoisted. */
|
|
3239
3585
|
unionTag(uName, unionId) {
|
|
3240
|
-
return emitUnionTag(this.B, this.nullableUnions.get(unionId), uName);
|
|
3586
|
+
return emitUnionTag(this.B, this.nullableUnions.get(unionId), uName, this.memoryAliasAttachment("union.tag"));
|
|
3241
3587
|
}
|
|
3242
3588
|
/** Guard for helpers that build or read a union's `%ScrUnion` box
|
|
3243
3589
|
* directly (library-shaped unions with fixed arms): a nullable union
|
|
@@ -3249,7 +3595,7 @@ export class LlEmitter {
|
|
|
3249
3595
|
/** The BORROWED payload pointer of a ref arm (scr_union_peek inlined —
|
|
3250
3596
|
* the runtime's is a static inline); a nullable union is its payload. */
|
|
3251
3597
|
unionPeek(uName, unionId) {
|
|
3252
|
-
return emitUnionPeek(this.B, this.nullableUnions.get(unionId), uName);
|
|
3598
|
+
return emitUnionPeek(this.B, this.nullableUnions.get(unionId), uName, this.memoryAliasAttachment("union.payload"));
|
|
3253
3599
|
}
|
|
3254
3600
|
/** Emits `switch` over a union's tag with one block per arm; each arm
|
|
3255
3601
|
* body must TERMINATE its block (the callers branch to a join). The
|
|
@@ -3360,6 +3706,14 @@ export class LlEmitter {
|
|
|
3360
3706
|
return t;
|
|
3361
3707
|
}
|
|
3362
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
|
+
}
|
|
3363
3717
|
classMetaOf(className) {
|
|
3364
3718
|
const meta = this.classMeta.get(className);
|
|
3365
3719
|
if (!meta)
|
|
@@ -3444,7 +3798,12 @@ export class LlEmitter {
|
|
|
3444
3798
|
classObjSym(className) {
|
|
3445
3799
|
if (!this.classObjs.has(className)) {
|
|
3446
3800
|
const meta = this.classMetaOf(className);
|
|
3447
|
-
|
|
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
|
+
});
|
|
3448
3807
|
}
|
|
3449
3808
|
this.journal?.entry("classObj", className, this.classObjs.get(className));
|
|
3450
3809
|
return mangleClassObj(className);
|
|
@@ -3656,8 +4015,17 @@ export class LlEmitter {
|
|
|
3656
4015
|
workers: this.mod.workers === true,
|
|
3657
4016
|
owned: this.bytesOwned,
|
|
3658
4017
|
scalarStrings: new Set(this.stringSlices.keys()),
|
|
4018
|
+
unitSafeFunctions: this.unitSafeFunctions(),
|
|
3659
4019
|
}, paired);
|
|
3660
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
|
+
}
|
|
3661
4029
|
/** The alias tag of a whole-slot load of a binding (module globals only). */
|
|
3662
4030
|
slotAlias(id) {
|
|
3663
4031
|
const binding = this.binding(id);
|
|
@@ -4096,6 +4464,7 @@ export class LlEmitter {
|
|
|
4096
4464
|
chunkResult() {
|
|
4097
4465
|
return {
|
|
4098
4466
|
entries: this.journal.entries,
|
|
4467
|
+
debugRequests: this.debug?.recorded() ?? [],
|
|
4099
4468
|
flags: {
|
|
4100
4469
|
usesCoroutines: this.usesCoroutines,
|
|
4101
4470
|
usesTimers: this.usesTimers,
|
|
@@ -4130,6 +4499,8 @@ export class LlEmitter {
|
|
|
4130
4499
|
// emission left them (a helper set guards the declarations its first
|
|
4131
4500
|
// request adds).
|
|
4132
4501
|
replayJournal(this, chunk.entries, names, tags);
|
|
4502
|
+
const debugIds = new Map();
|
|
4503
|
+
this.debug?.replay(chunk.debugRequests, (name) => this.functionNamed(name), debugIds);
|
|
4133
4504
|
const flags = chunk.flags;
|
|
4134
4505
|
this.usesCoroutines ||= flags.usesCoroutines;
|
|
4135
4506
|
this.usesTimers ||= flags.usesTimers;
|
|
@@ -4160,7 +4531,13 @@ export class LlEmitter {
|
|
|
4160
4531
|
this.directAwaitCallees.add(name);
|
|
4161
4532
|
for (const name of chunk.inlineAwaitCallees)
|
|
4162
4533
|
this.inlineAwaitCallees.add(name);
|
|
4163
|
-
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;
|
|
4164
4541
|
}
|
|
4165
4542
|
/** Adds a content-named constant a chunk interned. Its symbol is this
|
|
4166
4543
|
* emitter's own: a digest collision retries in first-use order, which a
|
|
@@ -4253,7 +4630,9 @@ export class LlEmitter {
|
|
|
4253
4630
|
/** An emitter for a range of this module's functions: the same facts,
|
|
4254
4631
|
* empty module-level tables, and a journal of what the range adds. */
|
|
4255
4632
|
chunkEmitter() {
|
|
4256
|
-
|
|
4633
|
+
const chunk = new LlEmitter(this.mod, { ...this.targetOptions, functionChunks: 1 }, new EmitJournal());
|
|
4634
|
+
chunk.debug?.record();
|
|
4635
|
+
return chunk;
|
|
4257
4636
|
}
|
|
4258
4637
|
/** The double-ABI entry of a function with an i32 entry: every caller
|
|
4259
4638
|
* that is not a direct call (closures, dispatch, adapters, the runtime)
|
|
@@ -4416,7 +4795,23 @@ export class LlEmitter {
|
|
|
4416
4795
|
params.unshift("ptr %sc_env");
|
|
4417
4796
|
const ret = this.llType(fn.returnType);
|
|
4418
4797
|
const call = `call ${ret} @${mangleBorrowedFunction(fn.name)}(${params.join(", ")})`;
|
|
4419
|
-
|
|
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}`);
|
|
4420
4815
|
// A borrowed result is reachable from the parameters: own it first. A
|
|
4421
4816
|
// throwing body returns a null dummy, which needs no owner (and string
|
|
4422
4817
|
// or array retains do not accept NULL).
|
|
@@ -4442,7 +4837,10 @@ export class LlEmitter {
|
|
|
4442
4837
|
this.releaseFrame(`%p${index}`, fn.params[index].type);
|
|
4443
4838
|
B.terminate(ret === "void" ? "ret void" : `ret ${ret} ${result}`);
|
|
4444
4839
|
const symbol = kept.size > 0 ? `${mangleBorrowedFunction(fn.name)}.virtual` : mangleFunction(fn.name);
|
|
4445
|
-
|
|
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}`;
|
|
4446
4844
|
}
|
|
4447
4845
|
canBorrowCallArgument(value) {
|
|
4448
4846
|
return canBorrowCallArgument(this, value);
|
|
@@ -4617,12 +5015,20 @@ export class LlEmitter {
|
|
|
4617
5015
|
readsLoopMetrics() {
|
|
4618
5016
|
if (this.loopMetricsRead !== undefined)
|
|
4619
5017
|
return this.loopMetricsRead;
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
|
-
|
|
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;
|
|
4626
5032
|
}
|
|
4627
5033
|
lastUseMovesAllowed() {
|
|
4628
5034
|
return (this.debug === null &&
|
|
@@ -4806,6 +5212,9 @@ export class LlEmitter {
|
|
|
4806
5212
|
if (cursor)
|
|
4807
5213
|
cursor.index = i;
|
|
4808
5214
|
this.stmtCursor = cursor;
|
|
5215
|
+
const reserve = reservedArrayLength(stmts, i);
|
|
5216
|
+
if (reserve !== null)
|
|
5217
|
+
this.reservedArrayLengths.set(reserve.literal, reserve.hint);
|
|
4809
5218
|
const deferred = this.deferredPromiseAllLocal(stmts, i);
|
|
4810
5219
|
if (deferred !== null) {
|
|
4811
5220
|
this.deferredPromiseAllEntries.set(stmts[i].localId, deferred);
|
|
@@ -4838,6 +5247,24 @@ export class LlEmitter {
|
|
|
4838
5247
|
if (resume && !resume.placed && !this.B.isTerminated()) {
|
|
4839
5248
|
// The fast copy's failed checks re-execute this statement here.
|
|
4840
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
|
+
}
|
|
4841
5268
|
this.B.br(resume.label);
|
|
4842
5269
|
this.B.startBlock(resume.label);
|
|
4843
5270
|
}
|
|
@@ -4966,6 +5393,10 @@ export class LlEmitter {
|
|
|
4966
5393
|
});
|
|
4967
5394
|
return;
|
|
4968
5395
|
}
|
|
5396
|
+
if (e.kind === "dynInvoke" && e.calleeNameValue === undefined) {
|
|
5397
|
+
emitDynamicExpr(this, e, true);
|
|
5398
|
+
return;
|
|
5399
|
+
}
|
|
4969
5400
|
this.emitExpr(e);
|
|
4970
5401
|
}
|
|
4971
5402
|
emitControlExpr(e) {
|
|
@@ -5955,8 +6386,8 @@ export class LlEmitter {
|
|
|
5955
6386
|
emitBytesLength(elem, receiver, bytes) {
|
|
5956
6387
|
return emitBytesLength(this, elem, receiver, bytes);
|
|
5957
6388
|
}
|
|
5958
|
-
emitBytesGet(elem, receiver, index, expr, inBounds = false, invalidNaN = false, owned = false) {
|
|
5959
|
-
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);
|
|
5960
6391
|
}
|
|
5961
6392
|
emitToUint32(value, expr, uint32) {
|
|
5962
6393
|
return emitToUint32(this, value, expr, uint32);
|
|
@@ -6011,8 +6442,8 @@ export class LlEmitter {
|
|
|
6011
6442
|
const integer = this.emitToUint32(value.name, expr, value.uint32);
|
|
6012
6443
|
this.B.line(`store i32 ${integer}, ptr ${slot}`);
|
|
6013
6444
|
}
|
|
6014
|
-
emitBytesSet(elem, receiver, index, value, indexExpr, expr, inBounds = false, owned = false) {
|
|
6015
|
-
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);
|
|
6016
6447
|
}
|
|
6017
6448
|
emitBytesIntrinsic(e) {
|
|
6018
6449
|
return emitBytesIntrinsic(this, e);
|