@scriptc/compiler 0.2.4 → 0.2.6
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 +972 -245
- package/ambient/scriptc-overrides.d.ts +5 -1
- package/ambient/scriptc.d.ts +22 -2
- package/dist/backend/build-cache.d.ts +4 -0
- package/dist/backend/build-cache.js +16 -2
- package/dist/backend/build-cache.js.map +1 -1
- package/dist/backend/cycle-analysis.js +17 -5
- package/dist/backend/cycle-analysis.js.map +1 -1
- package/dist/backend/cycle-analysis.test.js +50 -11
- package/dist/backend/cycle-analysis.test.js.map +1 -1
- package/dist/backend/debug-symbols.js.map +1 -1
- package/dist/backend/executable-features.js +3 -1
- package/dist/backend/executable-features.js.map +1 -1
- package/dist/backend/external-c.d.ts +13 -6
- package/dist/backend/external-c.js +15 -3
- package/dist/backend/external-c.js.map +1 -1
- package/dist/backend/ffi-callbacks.js +6 -9
- package/dist/backend/ffi-callbacks.js.map +1 -1
- package/dist/backend/library-identity-markers.js.map +1 -1
- package/dist/backend/library-pack.d.ts +1 -1
- package/dist/backend/library-pack.js +81 -24
- package/dist/backend/library-pack.js.map +1 -1
- package/dist/backend/link-plan-core.d.ts +2 -0
- package/dist/backend/link-plan-core.js +10 -2
- package/dist/backend/link-plan-core.js.map +1 -1
- package/dist/backend/link-plan.d.ts +2 -1
- package/dist/backend/link-plan.js +7 -5
- package/dist/backend/link-plan.js.map +1 -1
- package/dist/backend/linker.d.ts +1 -1
- package/dist/backend/linker.js +42 -23
- package/dist/backend/linker.js.map +1 -1
- package/dist/backend/literals.js +5 -4
- package/dist/backend/literals.js.map +1 -1
- package/dist/backend/literals.test.js +30 -5
- package/dist/backend/literals.test.js.map +1 -1
- package/dist/backend/llvm/blocks.test.js +5 -2
- package/dist/backend/llvm/blocks.test.js.map +1 -1
- package/dist/backend/llvm/borrowed-inputs.js.map +1 -1
- package/dist/backend/llvm/borrowed-receivers.js +43 -19
- package/dist/backend/llvm/borrowed-receivers.js.map +1 -1
- package/dist/backend/llvm/byte-numbers.js +38 -5
- package/dist/backend/llvm/byte-numbers.js.map +1 -1
- package/dist/backend/llvm/byte-windows.d.ts +31 -0
- package/dist/backend/llvm/byte-windows.js +334 -0
- package/dist/backend/llvm/byte-windows.js.map +1 -0
- package/dist/backend/llvm/byte-windows.test.d.ts +1 -0
- package/dist/backend/llvm/byte-windows.test.js +244 -0
- package/dist/backend/llvm/byte-windows.test.js.map +1 -0
- package/dist/backend/llvm/bytes-bounds.js +73 -22
- package/dist/backend/llvm/bytes-bounds.js.map +1 -1
- package/dist/backend/llvm/call-lifetimes.d.ts +5 -2
- package/dist/backend/llvm/call-lifetimes.js +72 -19
- package/dist/backend/llvm/call-lifetimes.js.map +1 -1
- package/dist/backend/llvm/call-lifetimes.test.js +159 -28
- package/dist/backend/llvm/call-lifetimes.test.js.map +1 -1
- package/dist/backend/llvm/checked-value-lifetimes.d.ts +4 -0
- package/dist/backend/llvm/checked-value-lifetimes.js +14 -4
- package/dist/backend/llvm/checked-value-lifetimes.js.map +1 -1
- package/dist/backend/llvm/classes.d.ts +14 -1
- package/dist/backend/llvm/classes.js +94 -19
- package/dist/backend/llvm/classes.js.map +1 -1
- package/dist/backend/llvm/classes.test.d.ts +1 -0
- package/dist/backend/llvm/classes.test.js +99 -0
- package/dist/backend/llvm/classes.test.js.map +1 -0
- package/dist/backend/llvm/common.js +4 -1
- package/dist/backend/llvm/common.js.map +1 -1
- package/dist/backend/llvm/constant-callbacks.d.ts +11 -0
- package/dist/backend/llvm/constant-callbacks.js +213 -0
- package/dist/backend/llvm/constant-callbacks.js.map +1 -0
- package/dist/backend/llvm/constant-callbacks.test.d.ts +1 -0
- package/dist/backend/llvm/constant-callbacks.test.js +124 -0
- package/dist/backend/llvm/constant-callbacks.test.js.map +1 -0
- package/dist/backend/llvm/counted-loops.js +10 -3
- package/dist/backend/llvm/counted-loops.js.map +1 -1
- package/dist/backend/llvm/debug-info.js +33 -13
- package/dist/backend/llvm/debug-info.js.map +1 -1
- package/dist/backend/llvm/debug-info.test.js +28 -6
- package/dist/backend/llvm/debug-info.test.js.map +1 -1
- package/dist/backend/llvm/dyn.d.ts +1 -1
- package/dist/backend/llvm/dyn.js +75 -56
- package/dist/backend/llvm/dyn.js.map +1 -1
- package/dist/backend/llvm/emitter.d.ts +28 -3
- package/dist/backend/llvm/emitter.js +506 -145
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/backend/llvm/emitter.test.js +247 -50
- package/dist/backend/llvm/emitter.test.js.map +1 -1
- package/dist/backend/llvm/expr-async.js +25 -6
- package/dist/backend/llvm/expr-async.js.map +1 -1
- package/dist/backend/llvm/expr-bytes.js +24 -4
- package/dist/backend/llvm/expr-bytes.js.map +1 -1
- package/dist/backend/llvm/expr-callbacks.js +10 -4
- package/dist/backend/llvm/expr-callbacks.js.map +1 -1
- package/dist/backend/llvm/expr-calls.js +110 -31
- package/dist/backend/llvm/expr-calls.js.map +1 -1
- package/dist/backend/llvm/expr-containers.d.ts +2 -0
- package/dist/backend/llvm/expr-containers.js +112 -41
- package/dist/backend/llvm/expr-containers.js.map +1 -1
- package/dist/backend/llvm/expr-control.js +1 -3
- package/dist/backend/llvm/expr-control.js.map +1 -1
- package/dist/backend/llvm/expr-dispatch.js +3 -1
- package/dist/backend/llvm/expr-dispatch.js.map +1 -1
- package/dist/backend/llvm/expr-dynamic.js +55 -7
- package/dist/backend/llvm/expr-dynamic.js.map +1 -1
- package/dist/backend/llvm/expr-island.js +26 -6
- package/dist/backend/llvm/expr-island.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.js +95 -19
- package/dist/backend/llvm/expr-primitives.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.test.js +44 -2
- package/dist/backend/llvm/expr-primitives.test.js.map +1 -1
- package/dist/backend/llvm/expr-records.js +10 -9
- package/dist/backend/llvm/expr-records.js.map +1 -1
- package/dist/backend/llvm/expr-stream-bridges.js +44 -26
- package/dist/backend/llvm/expr-stream-bridges.js.map +1 -1
- package/dist/backend/llvm/expr-stream-bridges.test.js +51 -14
- package/dist/backend/llvm/expr-stream-bridges.test.js.map +1 -1
- package/dist/backend/llvm/expr-stream-callbacks.js +34 -14
- package/dist/backend/llvm/expr-stream-callbacks.js.map +1 -1
- package/dist/backend/llvm/integer-remainder.d.ts +7 -0
- package/dist/backend/llvm/integer-remainder.js +26 -0
- package/dist/backend/llvm/integer-remainder.js.map +1 -0
- package/dist/backend/llvm/integer-values.js +15 -4
- package/dist/backend/llvm/integer-values.js.map +1 -1
- package/dist/backend/llvm/integer-views.js +23 -7
- package/dist/backend/llvm/integer-views.js.map +1 -1
- package/dist/backend/llvm/integer-views.test.js +42 -7
- package/dist/backend/llvm/integer-views.test.js.map +1 -1
- package/dist/backend/llvm/layouts.js +1 -1
- package/dist/backend/llvm/layouts.js.map +1 -1
- package/dist/backend/llvm/lib-abi.js +20 -4
- package/dist/backend/llvm/lib-abi.js.map +1 -1
- package/dist/backend/llvm/lib-connect.js +7 -1
- package/dist/backend/llvm/lib-connect.js.map +1 -1
- package/dist/backend/llvm/lib-datagram.js +35 -10
- package/dist/backend/llvm/lib-datagram.js.map +1 -1
- package/dist/backend/llvm/lib-dispatch.js +42 -38
- package/dist/backend/llvm/lib-dispatch.js.map +1 -1
- package/dist/backend/llvm/lib-filesystem.js +33 -18
- package/dist/backend/llvm/lib-filesystem.js.map +1 -1
- package/dist/backend/llvm/lib-http2.js +60 -15
- package/dist/backend/llvm/lib-http2.js.map +1 -1
- package/dist/backend/llvm/lib-lookup.js +12 -5
- package/dist/backend/llvm/lib-lookup.js.map +1 -1
- package/dist/backend/llvm/lib-network.js +97 -31
- package/dist/backend/llvm/lib-network.js.map +1 -1
- package/dist/backend/llvm/lib-process.js +57 -14
- package/dist/backend/llvm/lib-process.js.map +1 -1
- package/dist/backend/llvm/lib-shared.js +122 -31
- package/dist/backend/llvm/lib-shared.js.map +1 -1
- package/dist/backend/llvm/lib-stream.js +33 -14
- package/dist/backend/llvm/lib-stream.js.map +1 -1
- package/dist/backend/llvm/lib-test.js +21 -7
- package/dist/backend/llvm/lib-test.js.map +1 -1
- package/dist/backend/llvm/lib-tls.js +69 -20
- package/dist/backend/llvm/lib-tls.js.map +1 -1
- package/dist/backend/llvm/local-array-reads.d.ts +9 -2
- package/dist/backend/llvm/local-array-reads.js +176 -89
- package/dist/backend/llvm/local-array-reads.js.map +1 -1
- package/dist/backend/llvm/local-array-reads.test.js +394 -62
- package/dist/backend/llvm/local-array-reads.test.js.map +1 -1
- package/dist/backend/llvm/local-union-storage.d.ts +25 -0
- package/dist/backend/llvm/local-union-storage.js +109 -0
- package/dist/backend/llvm/local-union-storage.js.map +1 -0
- package/dist/backend/llvm/local-union-storage.test.d.ts +1 -0
- package/dist/backend/llvm/local-union-storage.test.js +210 -0
- package/dist/backend/llvm/local-union-storage.test.js.map +1 -0
- package/dist/backend/llvm/loop-array-borrows.d.ts +11 -0
- package/dist/backend/llvm/loop-array-borrows.js +70 -0
- package/dist/backend/llvm/loop-array-borrows.js.map +1 -0
- package/dist/backend/llvm/loop-array-borrows.test.d.ts +1 -0
- package/dist/backend/llvm/loop-array-borrows.test.js +145 -0
- package/dist/backend/llvm/loop-array-borrows.test.js.map +1 -0
- package/dist/backend/llvm/map-read-lifetimes.d.ts +11 -2
- package/dist/backend/llvm/map-read-lifetimes.js +64 -19
- package/dist/backend/llvm/map-read-lifetimes.js.map +1 -1
- package/dist/backend/llvm/map-read-lifetimes.test.js +89 -17
- package/dist/backend/llvm/map-read-lifetimes.test.js.map +1 -1
- package/dist/backend/llvm/reference-effects.d.ts +5 -3
- package/dist/backend/llvm/reference-effects.js +74 -36
- package/dist/backend/llvm/reference-effects.js.map +1 -1
- package/dist/backend/llvm/reference-effects.test.js +92 -9
- package/dist/backend/llvm/reference-effects.test.js.map +1 -1
- package/dist/backend/llvm/shapes.d.ts +4 -1
- package/dist/backend/llvm/shapes.js +82 -24
- package/dist/backend/llvm/shapes.js.map +1 -1
- package/dist/backend/llvm/shapes.test.js +3 -1
- package/dist/backend/llvm/shapes.test.js.map +1 -1
- package/dist/backend/llvm/split-loops.d.ts +48 -0
- package/dist/backend/llvm/split-loops.js +183 -0
- package/dist/backend/llvm/split-loops.js.map +1 -0
- package/dist/backend/llvm/split.js +4 -11
- package/dist/backend/llvm/split.js.map +1 -1
- package/dist/backend/llvm/split.test.js +80 -8
- package/dist/backend/llvm/split.test.js.map +1 -1
- package/dist/backend/llvm/stack-callbacks.d.ts +14 -0
- package/dist/backend/llvm/stack-callbacks.js +73 -0
- package/dist/backend/llvm/stack-callbacks.js.map +1 -0
- package/dist/backend/llvm/stack-captures.d.ts +25 -0
- package/dist/backend/llvm/stack-captures.js +150 -0
- package/dist/backend/llvm/stack-captures.js.map +1 -0
- package/dist/backend/llvm/stack-unions.js +14 -5
- package/dist/backend/llvm/stack-unions.js.map +1 -1
- package/dist/backend/llvm/stack-unions.test.js +151 -32
- package/dist/backend/llvm/stack-unions.test.js.map +1 -1
- package/dist/backend/llvm/string-construction.js.map +1 -1
- package/dist/backend/llvm/string-construction.test.js +32 -7
- package/dist/backend/llvm/string-construction.test.js.map +1 -1
- package/dist/backend/llvm/string-lifetimes.js +14 -8
- package/dist/backend/llvm/string-lifetimes.js.map +1 -1
- package/dist/backend/llvm/string-lifetimes.test.js +119 -29
- package/dist/backend/llvm/string-lifetimes.test.js.map +1 -1
- package/dist/backend/llvm/string-slices.d.ts +20 -0
- package/dist/backend/llvm/string-slices.js +87 -0
- package/dist/backend/llvm/string-slices.js.map +1 -0
- package/dist/backend/llvm/string-slices.test.d.ts +1 -0
- package/dist/backend/llvm/string-slices.test.js +98 -0
- package/dist/backend/llvm/string-slices.test.js.map +1 -0
- package/dist/backend/llvm/switch-dispatch.d.ts +9 -0
- package/dist/backend/llvm/switch-dispatch.js +114 -0
- package/dist/backend/llvm/switch-dispatch.js.map +1 -0
- package/dist/backend/llvm/switch-dispatch.test.d.ts +1 -0
- package/dist/backend/llvm/switch-dispatch.test.js +83 -0
- package/dist/backend/llvm/switch-dispatch.test.js.map +1 -0
- package/dist/backend/llvm/unsupported.js.map +1 -1
- package/dist/backend/llvm/walkers.d.ts +4 -14
- package/dist/backend/llvm/walkers.js +58 -313
- package/dist/backend/llvm/walkers.js.map +1 -1
- package/dist/backend/mangle.js +9 -3
- package/dist/backend/mangle.js.map +1 -1
- package/dist/backend/may-throw.js +18 -8
- package/dist/backend/may-throw.js.map +1 -1
- package/dist/backend/may-throw.test.js +119 -23
- package/dist/backend/may-throw.test.js.map +1 -1
- package/dist/backend/native/artifact-stamps.d.ts +39 -0
- package/dist/backend/native/artifact-stamps.js +371 -0
- package/dist/backend/native/artifact-stamps.js.map +1 -0
- package/dist/backend/native/cache-warm.d.ts +24 -0
- package/dist/backend/native/cache-warm.js +80 -0
- package/dist/backend/native/cache-warm.js.map +1 -0
- package/dist/backend/native/compiler-fingerprint.d.ts +19 -0
- package/dist/backend/native/compiler-fingerprint.js +357 -0
- package/dist/backend/native/compiler-fingerprint.js.map +1 -0
- package/dist/backend/native/contracts.d.ts +316 -0
- package/dist/backend/native/contracts.js +2 -0
- package/dist/backend/native/contracts.js.map +1 -0
- package/dist/backend/native/dependency-files.d.ts +5 -0
- package/dist/backend/native/dependency-files.js +83 -0
- package/dist/backend/native/dependency-files.js.map +1 -0
- package/dist/backend/native/driver.d.ts +50 -0
- package/dist/backend/native/driver.js +294 -0
- package/dist/backend/native/driver.js.map +1 -0
- package/dist/backend/native/executable.d.ts +18 -0
- package/dist/backend/native/executable.js +1275 -0
- package/dist/backend/native/executable.js.map +1 -0
- package/dist/backend/native/library.d.ts +2 -0
- package/dist/backend/native/library.js +614 -0
- package/dist/backend/native/library.js.map +1 -0
- package/dist/backend/native/linker-fingerprint.d.ts +8 -0
- package/dist/backend/native/linker-fingerprint.js +174 -0
- package/dist/backend/native/linker-fingerprint.js.map +1 -0
- package/dist/backend/native/object-merge.d.ts +2 -0
- package/dist/backend/native/object-merge.js +154 -0
- package/dist/backend/native/object-merge.js.map +1 -0
- package/dist/backend/native/process.d.ts +17 -0
- package/dist/backend/native/process.js +42 -0
- package/dist/backend/native/process.js.map +1 -0
- package/dist/backend/native/program-shards.d.ts +21 -0
- package/dist/backend/native/program-shards.js +99 -0
- package/dist/backend/native/program-shards.js.map +1 -0
- package/dist/backend/native/runtime-inputs.d.ts +12 -0
- package/dist/backend/native/runtime-inputs.js +165 -0
- package/dist/backend/native/runtime-inputs.js.map +1 -0
- package/dist/backend/native/runtime-inputs.test.d.ts +1 -0
- package/dist/backend/native/runtime-inputs.test.js +64 -0
- package/dist/backend/native/runtime-inputs.test.js.map +1 -0
- package/dist/backend/native/runtime-objects.d.ts +16 -0
- package/dist/backend/native/runtime-objects.js +122 -0
- package/dist/backend/native/runtime-objects.js.map +1 -0
- package/dist/backend/native/session.d.ts +12 -0
- package/dist/backend/native/session.js +31 -0
- package/dist/backend/native/session.js.map +1 -0
- package/dist/backend/native/tool-identity.d.ts +37 -0
- package/dist/backend/native/tool-identity.js +310 -0
- package/dist/backend/native/tool-identity.js.map +1 -0
- package/dist/backend/native/trace-paths.d.ts +12 -0
- package/dist/backend/native/trace-paths.js +73 -0
- package/dist/backend/native/trace-paths.js.map +1 -0
- package/dist/backend/native/vendor.d.ts +1 -0
- package/dist/backend/native/vendor.js +12 -0
- package/dist/backend/native/vendor.js.map +1 -0
- package/dist/backend/native-codegen-core.d.ts +6 -0
- package/dist/backend/native-codegen-core.js +23 -1
- package/dist/backend/native-codegen-core.js.map +1 -1
- package/dist/backend/native-codegen.d.ts +5 -1
- package/dist/backend/native-codegen.js +52 -25
- package/dist/backend/native-codegen.js.map +1 -1
- package/dist/backend/native-codegen.test.js +59 -11
- package/dist/backend/native-codegen.test.js.map +1 -1
- package/dist/backend/native-link-info-core.d.ts +1 -0
- package/dist/backend/native-link-info-core.js +9 -5
- package/dist/backend/native-link-info-core.js.map +1 -1
- package/dist/backend/native-link-info.js +14 -5
- package/dist/backend/native-link-info.js.map +1 -1
- package/dist/backend/native-link-info.test.js +58 -13
- package/dist/backend/native-link-info.test.js.map +1 -1
- package/dist/backend/native-toolchain.d.ts +17 -450
- package/dist/backend/native-toolchain.js +17 -3971
- package/dist/backend/native-toolchain.js.map +1 -1
- package/dist/backend/native-toolchain.test.js +103 -72
- package/dist/backend/native-toolchain.test.js.map +1 -1
- package/dist/backend/native-tools.d.ts +3 -1
- package/dist/backend/native-tools.js +30 -9
- package/dist/backend/native-tools.js.map +1 -1
- package/dist/backend/object-localize.js +17 -14
- package/dist/backend/object-localize.js.map +1 -1
- package/dist/backend/object-localize.test.js +59 -12
- package/dist/backend/object-localize.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 +1 -0
- package/dist/backend/runtime-pack-core.js +104 -50
- package/dist/backend/runtime-pack-core.js.map +1 -1
- package/dist/backend/runtime-pack-native.js +5 -3
- package/dist/backend/runtime-pack-native.js.map +1 -1
- package/dist/backend/runtime-pack-targets.test.js +126 -17
- package/dist/backend/runtime-pack-targets.test.js.map +1 -1
- package/dist/backend/runtime-pack.d.ts +1 -1
- package/dist/backend/runtime-pack.js +11 -12
- package/dist/backend/runtime-pack.js.map +1 -1
- package/dist/backend/runtime-pack.test.js +51 -25
- package/dist/backend/runtime-pack.test.js.map +1 -1
- package/dist/backend/source-locations.js.map +1 -1
- package/dist/backend/source-locations.test.js +7 -2
- package/dist/backend/source-locations.test.js.map +1 -1
- package/dist/backend/target-diagnostics.js +44 -14
- package/dist/backend/target-diagnostics.js.map +1 -1
- package/dist/backend/target-diagnostics.test.js +93 -20
- package/dist/backend/target-diagnostics.test.js.map +1 -1
- package/dist/backend/targets.js +230 -86
- package/dist/backend/targets.js.map +1 -1
- package/dist/backend/targets.test.js +32 -18
- package/dist/backend/targets.test.js.map +1 -1
- package/dist/backend/toolchain-environment.js +5 -1
- package/dist/backend/toolchain-environment.js.map +1 -1
- package/dist/backend/vendor-archives.d.ts +2 -2
- package/dist/backend/vendor-archives.js +84 -35
- package/dist/backend/vendor-archives.js.map +1 -1
- package/dist/backend/vendor-inputs.js +13 -1
- package/dist/backend/vendor-inputs.js.map +1 -1
- package/dist/backend/warm-cache.d.ts +1 -1
- package/dist/backend/warm-cache.js +33 -9
- package/dist/backend/warm-cache.js.map +1 -1
- package/dist/cli/command.js +39 -9
- package/dist/cli/command.js.map +1 -1
- package/dist/cli/output-options.js +14 -4
- package/dist/cli/output-options.js.map +1 -1
- package/dist/cli/paths.js.map +1 -1
- package/dist/cli/wasi-runner.js.map +1 -1
- package/dist/compat/fetch-profile.js +36 -35
- package/dist/compat/fetch-profile.js.map +1 -1
- package/dist/coverage/report.js +16 -17
- package/dist/coverage/report.js.map +1 -1
- package/dist/coverage/surface-manifest.js +112 -26
- package/dist/coverage/surface-manifest.js.map +1 -1
- package/dist/diagnostics/diagnostic.js +55 -16
- package/dist/diagnostics/diagnostic.js.map +1 -1
- package/dist/executable/executable-cache.d.ts +2 -1
- package/dist/executable/executable-cache.js +79 -48
- package/dist/executable/executable-cache.js.map +1 -1
- package/dist/executable/executable-cache.test.js +90 -26
- package/dist/executable/executable-cache.test.js.map +1 -1
- package/dist/executable/prepare.js +2 -2
- package/dist/executable/prepare.js.map +1 -1
- package/dist/ffi/ffi-manifest.js +78 -20
- package/dist/ffi/ffi-manifest.js.map +1 -1
- package/dist/ffi/ffi-manifest.test.js +96 -16
- package/dist/ffi/ffi-manifest.test.js.map +1 -1
- package/dist/format-integer.js.map +1 -1
- package/dist/frontend/analysis.js +12 -2
- package/dist/frontend/analysis.js.map +1 -1
- package/dist/frontend/arguments-usage.js.map +1 -1
- package/dist/frontend/binding-source.js +9 -3
- package/dist/frontend/binding-source.js.map +1 -1
- package/dist/frontend/builtin-modules.js +46 -2
- package/dist/frontend/builtin-modules.js.map +1 -1
- package/dist/frontend/cjs-resolve.js +40 -17
- package/dist/frontend/cjs-resolve.js.map +1 -1
- package/dist/frontend/cjs-syntax.js +31 -10
- package/dist/frontend/cjs-syntax.js.map +1 -1
- package/dist/frontend/comptime-node.test.js +10 -11
- package/dist/frontend/comptime-node.test.js.map +1 -1
- package/dist/frontend/dts-paths.js +7 -3
- package/dist/frontend/dts-paths.js.map +1 -1
- package/dist/frontend/fork-target.d.ts +5 -0
- package/dist/frontend/fork-target.js +55 -18
- package/dist/frontend/fork-target.js.map +1 -1
- package/dist/frontend/fork-target.test.d.ts +1 -0
- package/dist/frontend/fork-target.test.js +59 -0
- package/dist/frontend/fork-target.test.js.map +1 -0
- package/dist/frontend/function-completion.js +11 -6
- package/dist/frontend/function-completion.js.map +1 -1
- package/dist/frontend/helper-tokens.js +53 -6
- package/dist/frontend/helper-tokens.js.map +1 -1
- package/dist/frontend/helper-tokens.test.js +18 -2
- package/dist/frontend/helper-tokens.test.js.map +1 -1
- package/dist/frontend/inferred-js-diagnostics.js +32 -12
- package/dist/frontend/inferred-js-diagnostics.js.map +1 -1
- package/dist/frontend/inferred-js-diagnostics.test.js +11 -15
- package/dist/frontend/inferred-js-diagnostics.test.js.map +1 -1
- package/dist/frontend/input-tracker.js +11 -11
- package/dist/frontend/input-tracker.js.map +1 -1
- package/dist/frontend/input-tracker.test.js +4 -1
- package/dist/frontend/input-tracker.test.js.map +1 -1
- package/dist/frontend/lib-contract.js +38 -9
- package/dist/frontend/lib-contract.js.map +1 -1
- package/dist/frontend/literal-values.js.map +1 -1
- package/dist/frontend/literal-values.test.js +28 -8
- package/dist/frontend/literal-values.test.js.map +1 -1
- package/dist/frontend/lowering/abstract-equality.js +53 -10
- package/dist/frontend/lowering/abstract-equality.js.map +1 -1
- package/dist/frontend/lowering/array-indexed-mutation.d.ts +1 -1
- package/dist/frontend/lowering/array-indexed-mutation.js +108 -106
- package/dist/frontend/lowering/array-indexed-mutation.js.map +1 -1
- package/dist/frontend/lowering/array-values.js +37 -14
- package/dist/frontend/lowering/array-values.js.map +1 -1
- package/dist/frontend/lowering/binding-analysis.d.ts +50 -0
- package/dist/frontend/lowering/binding-analysis.js +376 -0
- package/dist/frontend/lowering/binding-analysis.js.map +1 -0
- package/dist/frontend/lowering/builtin-calls.d.ts +9 -0
- package/dist/frontend/lowering/builtin-calls.js +60 -0
- package/dist/frontend/lowering/builtin-calls.js.map +1 -0
- package/dist/frontend/lowering/builtins/arguments.d.ts +43 -0
- package/dist/frontend/lowering/builtins/arguments.js +247 -0
- package/dist/frontend/lowering/builtins/arguments.js.map +1 -0
- package/dist/frontend/lowering/builtins/async-context.d.ts +52 -0
- package/dist/frontend/lowering/builtins/async-context.js +436 -0
- package/dist/frontend/lowering/builtins/async-context.js.map +1 -0
- package/dist/frontend/lowering/builtins/atomics.d.ts +6 -0
- package/dist/frontend/lowering/builtins/atomics.js +82 -0
- package/dist/frontend/lowering/builtins/atomics.js.map +1 -0
- package/dist/frontend/lowering/builtins/callable-aliases.d.ts +13 -0
- package/dist/frontend/lowering/builtins/callable-aliases.js +87 -0
- package/dist/frontend/lowering/builtins/callable-aliases.js.map +1 -0
- package/dist/frontend/lowering/builtins/child-process-async.d.ts +18 -0
- package/dist/frontend/lowering/builtins/child-process-async.js +245 -0
- package/dist/frontend/lowering/builtins/child-process-async.js.map +1 -0
- package/dist/frontend/lowering/builtins/child-process-methods.d.ts +21 -0
- package/dist/frontend/lowering/builtins/child-process-methods.js +362 -0
- package/dist/frontend/lowering/builtins/child-process-methods.js.map +1 -0
- package/dist/frontend/lowering/builtins/child-process-sync.d.ts +4 -0
- package/dist/frontend/lowering/builtins/child-process-sync.js +639 -0
- package/dist/frontend/lowering/builtins/child-process-sync.js.map +1 -0
- package/dist/frontend/lowering/builtins/child-process.d.ts +55 -0
- package/dist/frontend/lowering/builtins/child-process.js +669 -0
- package/dist/frontend/lowering/builtins/child-process.js.map +1 -0
- package/dist/frontend/lowering/builtins/compression.d.ts +7 -0
- package/dist/frontend/lowering/builtins/compression.js +115 -0
- package/dist/frontend/lowering/builtins/compression.js.map +1 -0
- package/dist/frontend/lowering/builtins/console.d.ts +10 -0
- package/dist/frontend/lowering/builtins/console.js +38 -0
- package/dist/frontend/lowering/builtins/console.js.map +1 -0
- package/dist/frontend/lowering/builtins/constants.d.ts +24 -0
- package/dist/frontend/lowering/builtins/constants.js +141 -0
- package/dist/frontend/lowering/builtins/constants.js.map +1 -0
- package/dist/frontend/lowering/builtins/crypto.d.ts +22 -0
- package/dist/frontend/lowering/builtins/crypto.js +517 -0
- package/dist/frontend/lowering/builtins/crypto.js.map +1 -0
- package/dist/frontend/lowering/builtins/dates.d.ts +7 -0
- package/dist/frontend/lowering/builtins/dates.js +101 -0
- package/dist/frontend/lowering/builtins/dates.js.map +1 -0
- package/dist/frontend/lowering/builtins/environment.d.ts +34 -0
- package/dist/frontend/lowering/builtins/environment.js +95 -0
- package/dist/frontend/lowering/builtins/environment.js.map +1 -0
- package/dist/frontend/lowering/builtins/errors.d.ts +14 -0
- package/dist/frontend/lowering/builtins/errors.js +83 -0
- package/dist/frontend/lowering/builtins/errors.js.map +1 -0
- package/dist/frontend/lowering/builtins/filesystem-calls.d.ts +35 -0
- package/dist/frontend/lowering/builtins/filesystem-calls.js +725 -0
- package/dist/frontend/lowering/builtins/filesystem-calls.js.map +1 -0
- package/dist/frontend/lowering/builtins/filesystem.d.ts +108 -0
- package/dist/frontend/lowering/builtins/filesystem.js +1061 -0
- package/dist/frontend/lowering/builtins/filesystem.js.map +1 -0
- package/dist/frontend/lowering/builtins/ipc.d.ts +8 -0
- package/dist/frontend/lowering/builtins/ipc.js +76 -0
- package/dist/frontend/lowering/builtins/ipc.js.map +1 -0
- package/dist/frontend/lowering/builtins/json.d.ts +12 -0
- package/dist/frontend/lowering/builtins/json.js +387 -0
- package/dist/frontend/lowering/builtins/json.js.map +1 -0
- package/dist/frontend/lowering/builtins/module-bindings.d.ts +85 -0
- package/dist/frontend/lowering/builtins/module-bindings.js +346 -0
- package/dist/frontend/lowering/builtins/module-bindings.js.map +1 -0
- package/dist/frontend/lowering/builtins/module-calls.d.ts +8 -0
- package/dist/frontend/lowering/builtins/module-calls.js +308 -0
- package/dist/frontend/lowering/builtins/module-calls.js.map +1 -0
- package/dist/frontend/lowering/builtins/module-resolution.d.ts +38 -0
- package/dist/frontend/lowering/builtins/module-resolution.js +344 -0
- package/dist/frontend/lowering/builtins/module-resolution.js.map +1 -0
- package/dist/frontend/lowering/builtins/numbers.d.ts +15 -0
- package/dist/frontend/lowering/builtins/numbers.js +124 -0
- package/dist/frontend/lowering/builtins/numbers.js.map +1 -0
- package/dist/frontend/lowering/builtins/operating-system.d.ts +13 -0
- package/dist/frontend/lowering/builtins/operating-system.js +148 -0
- package/dist/frontend/lowering/builtins/operating-system.js.map +1 -0
- package/dist/frontend/lowering/builtins/performance.d.ts +13 -0
- package/dist/frontend/lowering/builtins/performance.js +100 -0
- package/dist/frontend/lowering/builtins/performance.js.map +1 -0
- package/dist/frontend/lowering/builtins/process.d.ts +50 -0
- package/dist/frontend/lowering/builtins/process.js +1138 -0
- package/dist/frontend/lowering/builtins/process.js.map +1 -0
- package/dist/frontend/lowering/builtins/promises.d.ts +14 -0
- package/dist/frontend/lowering/builtins/promises.js +356 -0
- package/dist/frontend/lowering/builtins/promises.js.map +1 -0
- package/dist/frontend/lowering/builtins/properties.d.ts +11 -0
- package/dist/frontend/lowering/builtins/properties.js +186 -0
- package/dist/frontend/lowering/builtins/properties.js.map +1 -0
- package/dist/frontend/lowering/builtins/querystring.d.ts +19 -0
- package/dist/frontend/lowering/builtins/querystring.js +150 -0
- package/dist/frontend/lowering/builtins/querystring.js.map +1 -0
- package/dist/frontend/lowering/builtins/readline.d.ts +13 -0
- package/dist/frontend/lowering/builtins/readline.js +138 -0
- package/dist/frontend/lowering/builtins/readline.js.map +1 -0
- package/dist/frontend/lowering/builtins/receiver-types.d.ts +5 -0
- package/dist/frontend/lowering/builtins/receiver-types.js +15 -0
- package/dist/frontend/lowering/builtins/receiver-types.js.map +1 -0
- package/dist/frontend/lowering/builtins/reflection.d.ts +13 -0
- package/dist/frontend/lowering/builtins/reflection.js +95 -0
- package/dist/frontend/lowering/builtins/reflection.js.map +1 -0
- package/dist/frontend/lowering/builtins/strings.d.ts +14 -0
- package/dist/frontend/lowering/builtins/strings.js +121 -0
- package/dist/frontend/lowering/builtins/strings.js.map +1 -0
- package/dist/frontend/lowering/builtins/text-codecs.d.ts +29 -0
- package/dist/frontend/lowering/builtins/text-codecs.js +590 -0
- package/dist/frontend/lowering/builtins/text-codecs.js.map +1 -0
- package/dist/frontend/lowering/builtins/timers.d.ts +22 -0
- package/dist/frontend/lowering/builtins/timers.js +180 -0
- package/dist/frontend/lowering/builtins/timers.js.map +1 -0
- package/dist/frontend/lowering/builtins/url.d.ts +37 -0
- package/dist/frontend/lowering/builtins/url.js +596 -0
- package/dist/frontend/lowering/builtins/url.js.map +1 -0
- package/dist/frontend/lowering/builtins/util-types.d.ts +7 -0
- package/dist/frontend/lowering/builtins/util-types.js +31 -0
- package/dist/frontend/lowering/builtins/util-types.js.map +1 -0
- package/dist/frontend/lowering/builtins/workers.d.ts +5 -0
- package/dist/frontend/lowering/builtins/workers.js +65 -0
- package/dist/frontend/lowering/builtins/workers.js.map +1 -0
- package/dist/frontend/lowering/call-arguments.d.ts +72 -0
- package/dist/frontend/lowering/call-arguments.js +618 -0
- package/dist/frontend/lowering/call-arguments.js.map +1 -0
- package/dist/frontend/lowering/call-signatures.d.ts +115 -0
- package/dist/frontend/lowering/call-signatures.js +719 -0
- package/dist/frontend/lowering/call-signatures.js.map +1 -0
- package/dist/frontend/lowering/callback-arg.js.map +1 -1
- package/dist/frontend/lowering/checked-iterable-spread.js +53 -10
- package/dist/frontend/lowering/checked-iterable-spread.js.map +1 -1
- package/dist/frontend/lowering/checked-promise-all.js +41 -9
- package/dist/frontend/lowering/checked-promise-all.js.map +1 -1
- package/dist/frontend/lowering/class-assertions.d.ts +7 -0
- package/dist/frontend/lowering/class-assertions.js +96 -0
- package/dist/frontend/lowering/class-assertions.js.map +1 -0
- package/dist/frontend/lowering/class-callbacks.d.ts +1 -1
- package/dist/frontend/lowering/class-callbacks.js +130 -27
- package/dist/frontend/lowering/class-callbacks.js.map +1 -1
- package/dist/frontend/lowering/class-construction.d.ts +1 -1
- package/dist/frontend/lowering/class-construction.js +247 -50
- package/dist/frontend/lowering/class-construction.js.map +1 -1
- package/dist/frontend/lowering/class-descriptors.js +109 -29
- package/dist/frontend/lowering/class-descriptors.js.map +1 -1
- package/dist/frontend/lowering/class-dynamic-dispatch.d.ts +6 -1
- package/dist/frontend/lowering/class-dynamic-dispatch.js +2471 -465
- package/dist/frontend/lowering/class-dynamic-dispatch.js.map +1 -1
- package/dist/frontend/lowering/class-dynamic-dispatch.test.js +284 -44
- package/dist/frontend/lowering/class-dynamic-dispatch.test.js.map +1 -1
- package/dist/frontend/lowering/class-instance-constructor.js +17 -5
- package/dist/frontend/lowering/class-instance-constructor.js.map +1 -1
- package/dist/frontend/lowering/class-method-values.js +199 -51
- package/dist/frontend/lowering/class-method-values.js.map +1 -1
- package/dist/frontend/lowering/class-protocols.d.ts +17 -0
- package/dist/frontend/lowering/class-protocols.js +126 -0
- package/dist/frontend/lowering/class-protocols.js.map +1 -0
- package/dist/frontend/lowering/class-prototypes.js +345 -86
- package/dist/frontend/lowering/class-prototypes.js.map +1 -1
- package/dist/frontend/lowering/class-runtime-statics.d.ts +1 -1
- package/dist/frontend/lowering/class-runtime-statics.js +80 -17
- package/dist/frontend/lowering/class-runtime-statics.js.map +1 -1
- package/dist/frontend/lowering/class-static-data.js +76 -16
- package/dist/frontend/lowering/class-static-data.js.map +1 -1
- package/dist/frontend/lowering/coercions/builders.d.ts +13 -0
- package/dist/frontend/lowering/coercions/builders.js +77 -0
- package/dist/frontend/lowering/coercions/builders.js.map +1 -0
- package/dist/frontend/lowering/coercions/function-adapters.d.ts +58 -0
- package/dist/frontend/lowering/coercions/function-adapters.js +430 -0
- package/dist/frontend/lowering/coercions/function-adapters.js.map +1 -0
- package/dist/frontend/lowering/coercions/island.d.ts +37 -0
- package/dist/frontend/lowering/coercions/island.js +350 -0
- package/dist/frontend/lowering/coercions/island.js.map +1 -0
- package/dist/frontend/lowering/coercions/state.d.ts +14 -0
- package/dist/frontend/lowering/coercions/state.js +16 -0
- package/dist/frontend/lowering/coercions/state.js.map +1 -0
- package/dist/frontend/lowering/coercions/structural-plans.d.ts +40 -0
- package/dist/frontend/lowering/coercions/structural-plans.js +447 -0
- package/dist/frontend/lowering/coercions/structural-plans.js.map +1 -0
- package/dist/frontend/lowering/coercions/structural.d.ts +63 -0
- package/dist/frontend/lowering/coercions/structural.js +616 -0
- package/dist/frontend/lowering/coercions/structural.js.map +1 -0
- package/dist/frontend/lowering/coercions/unions.d.ts +65 -0
- package/dist/frontend/lowering/coercions/unions.js +318 -0
- package/dist/frontend/lowering/coercions/unions.js.map +1 -0
- package/dist/frontend/lowering/collection-ingestion.js +355 -72
- package/dist/frontend/lowering/collection-ingestion.js.map +1 -1
- package/dist/frontend/lowering/containers/array-callbacks.d.ts +88 -0
- package/dist/frontend/lowering/containers/array-callbacks.js +1611 -0
- package/dist/frontend/lowering/containers/array-callbacks.js.map +1 -0
- package/dist/frontend/lowering/containers/array-construction.d.ts +42 -0
- package/dist/frontend/lowering/containers/array-construction.js +1044 -0
- package/dist/frontend/lowering/containers/array-construction.js.map +1 -0
- package/dist/frontend/lowering/containers/array-iteration.d.ts +16 -0
- package/dist/frontend/lowering/containers/array-iteration.js +95 -0
- package/dist/frontend/lowering/containers/array-iteration.js.map +1 -0
- package/dist/frontend/lowering/containers/array-methods.d.ts +27 -0
- package/dist/frontend/lowering/containers/array-methods.js +1854 -0
- package/dist/frontend/lowering/containers/array-methods.js.map +1 -0
- package/dist/frontend/lowering/containers/bytes.d.ts +17 -17
- package/dist/frontend/lowering/containers/bytes.js +430 -138
- package/dist/frontend/lowering/containers/bytes.js.map +1 -1
- package/dist/frontend/lowering/containers/callback-arguments.d.ts +26 -0
- package/dist/frontend/lowering/containers/callback-arguments.js +179 -0
- package/dist/frontend/lowering/containers/callback-arguments.js.map +1 -0
- package/dist/frontend/lowering/containers/collection-grouping.d.ts +19 -0
- package/dist/frontend/lowering/containers/collection-grouping.js +297 -0
- package/dist/frontend/lowering/containers/collection-grouping.js.map +1 -0
- package/dist/frontend/lowering/containers/collection-methods.d.ts +57 -0
- package/dist/frontend/lowering/containers/collection-methods.js +1314 -0
- package/dist/frontend/lowering/containers/collection-methods.js.map +1 -0
- package/dist/frontend/lowering/containers/dynamic-receivers.d.ts +18 -0
- package/dist/frontend/lowering/containers/dynamic-receivers.js +114 -0
- package/dist/frontend/lowering/containers/dynamic-receivers.js.map +1 -0
- package/dist/frontend/lowering/containers/for-of.d.ts +60 -0
- package/dist/frontend/lowering/containers/for-of.js +643 -0
- package/dist/frontend/lowering/containers/for-of.js.map +1 -0
- package/dist/frontend/lowering/containers/indexed-objects.d.ts +132 -0
- package/dist/frontend/lowering/containers/indexed-objects.js +1743 -0
- package/dist/frontend/lowering/containers/indexed-objects.js.map +1 -0
- package/dist/frontend/lowering/containers/iterator-helpers.d.ts +20 -0
- package/dist/frontend/lowering/containers/iterator-helpers.js +809 -0
- package/dist/frontend/lowering/containers/iterator-helpers.js.map +1 -0
- package/dist/frontend/lowering/containers/string-and-regexp.js +601 -160
- package/dist/frontend/lowering/containers/string-and-regexp.js.map +1 -1
- package/dist/frontend/lowering/containers/string-replacement.js +213 -63
- package/dist/frontend/lowering/containers/string-replacement.js.map +1 -1
- package/dist/frontend/lowering/crypto-tables.js +263 -64
- package/dist/frontend/lowering/crypto-tables.js.map +1 -1
- package/dist/frontend/lowering/deferred-module-initializers.js +172 -68
- package/dist/frontend/lowering/deferred-module-initializers.js.map +1 -1
- package/dist/frontend/lowering/deferred-module-initializers.test.js +41 -8
- package/dist/frontend/lowering/deferred-module-initializers.test.js.map +1 -1
- package/dist/frontend/lowering/error-methods.js +339 -65
- package/dist/frontend/lowering/error-methods.js.map +1 -1
- package/dist/frontend/lowering/expressions/evaluation-safety.js +3 -2
- package/dist/frontend/lowering/expressions/evaluation-safety.js.map +1 -1
- package/dist/frontend/lowering/expressions/global-symbols.js +2 -1
- package/dist/frontend/lowering/expressions/global-symbols.js.map +1 -1
- package/dist/frontend/lowering/expressions/native-proxy.js +11 -5
- package/dist/frontend/lowering/expressions/native-proxy.js.map +1 -1
- package/dist/frontend/lowering/expressions/nullish-assignment.js +67 -13
- package/dist/frontend/lowering/expressions/nullish-assignment.js.map +1 -1
- package/dist/frontend/lowering/expressions/object-literals.js +588 -165
- package/dist/frontend/lowering/expressions/object-literals.js.map +1 -1
- package/dist/frontend/lowering/expressions/optional-chains.d.ts +1 -1
- package/dist/frontend/lowering/expressions/optional-chains.js +68 -17
- package/dist/frontend/lowering/expressions/optional-chains.js.map +1 -1
- package/dist/frontend/lowering/expressions/union-field-write.js +45 -18
- package/dist/frontend/lowering/expressions/union-field-write.js.map +1 -1
- package/dist/frontend/lowering/function-context.js +5 -1
- package/dist/frontend/lowering/function-context.js.map +1 -1
- package/dist/frontend/lowering/function-returns.d.ts +67 -0
- package/dist/frontend/lowering/function-returns.js +392 -0
- package/dist/frontend/lowering/function-returns.js.map +1 -0
- package/dist/frontend/lowering/generator-delegation.d.ts +1 -1
- package/dist/frontend/lowering/generator-delegation.js +171 -39
- package/dist/frontend/lowering/generator-delegation.js.map +1 -1
- package/dist/frontend/lowering/generator-dynamic-dispatch.d.ts +1 -1
- package/dist/frontend/lowering/generator-dynamic-dispatch.js +176 -36
- package/dist/frontend/lowering/generator-dynamic-dispatch.js.map +1 -1
- package/dist/frontend/lowering/generic-functions.d.ts +271 -0
- package/dist/frontend/lowering/generic-functions.js +1730 -0
- package/dist/frontend/lowering/generic-functions.js.map +1 -0
- package/dist/frontend/lowering/import-meta.d.ts +1 -1
- package/dist/frontend/lowering/import-meta.js +37 -14
- package/dist/frontend/lowering/import-meta.js.map +1 -1
- package/dist/frontend/lowering/indexed-comparison.js +6 -2
- package/dist/frontend/lowering/indexed-comparison.js.map +1 -1
- package/dist/frontend/lowering/instantiation-path.d.ts +8 -0
- package/dist/frontend/lowering/instantiation-path.js +10 -0
- package/dist/frontend/lowering/instantiation-path.js.map +1 -0
- package/dist/frontend/lowering/instantiation-path.test.d.ts +1 -0
- package/dist/frontend/lowering/instantiation-path.test.js +23 -0
- package/dist/frontend/lowering/instantiation-path.test.js.map +1 -0
- package/dist/frontend/lowering/iterator-consumption.d.ts +9 -0
- package/dist/frontend/lowering/iterator-consumption.js +91 -0
- package/dist/frontend/lowering/iterator-consumption.js.map +1 -0
- package/dist/frontend/lowering/lib-boundary.js +40 -17
- package/dist/frontend/lowering/lib-boundary.js.map +1 -1
- package/dist/frontend/lowering/lib-boundary.test.js +49 -11
- package/dist/frontend/lowering/lib-boundary.test.js.map +1 -1
- package/dist/frontend/lowering/lower-array-sort.d.ts +0 -19
- package/dist/frontend/lowering/lower-array-sort.js +331 -566
- package/dist/frontend/lowering/lower-array-sort.js.map +1 -1
- package/dist/frontend/lowering/lower-assert.js +248 -43
- package/dist/frontend/lowering/lower-assert.js.map +1 -1
- package/dist/frontend/lowering/lower-async-iteration.js +71 -16
- package/dist/frontend/lowering/lower-async-iteration.js.map +1 -1
- package/dist/frontend/lowering/lower-builtin-values.js +430 -77
- package/dist/frontend/lowering/lower-builtin-values.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.d.ts +39 -558
- package/dist/frontend/lowering/lower-calls.js +2628 -5669
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-classes.d.ts +248 -242
- package/dist/frontend/lowering/lower-classes.js +1820 -775
- package/dist/frontend/lowering/lower-classes.js.map +1 -1
- package/dist/frontend/lowering/lower-comptime.d.ts +35 -35
- package/dist/frontend/lowering/lower-comptime.js +39 -37
- package/dist/frontend/lowering/lower-comptime.js.map +1 -1
- package/dist/frontend/lowering/lower-dgram.js +59 -31
- package/dist/frontend/lowering/lower-dgram.js.map +1 -1
- package/dist/frontend/lowering/lower-enums.js +5 -2
- package/dist/frontend/lowering/lower-enums.js.map +1 -1
- package/dist/frontend/lowering/lower-event-emitter.js +323 -86
- package/dist/frontend/lowering/lower-event-emitter.js.map +1 -1
- package/dist/frontend/lowering/lower-expando.js +19 -7
- package/dist/frontend/lowering/lower-expando.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.d.ts +194 -194
- package/dist/frontend/lowering/lower-exprs.js +3473 -1160
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-functions.d.ts +23 -0
- package/dist/frontend/lowering/lower-functions.js +449 -0
- package/dist/frontend/lowering/lower-functions.js.map +1 -0
- package/dist/frontend/lowering/lower-generators.js +121 -32
- package/dist/frontend/lowering/lower-generators.js.map +1 -1
- package/dist/frontend/lowering/lower-global-value.js +15 -4
- package/dist/frontend/lowering/lower-global-value.js.map +1 -1
- package/dist/frontend/lowering/lower-inspect.js +479 -89
- package/dist/frontend/lowering/lower-inspect.js.map +1 -1
- package/dist/frontend/lowering/lower-island.d.ts +79 -79
- package/dist/frontend/lowering/lower-island.js +366 -274
- package/dist/frontend/lowering/lower-island.js.map +1 -1
- package/dist/frontend/lowering/lower-island.test.js +7 -2
- package/dist/frontend/lowering/lower-island.test.js.map +1 -1
- package/dist/frontend/lowering/lower-mixins.js +17 -8
- package/dist/frontend/lowering/lower-mixins.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.d.ts +95 -94
- package/dist/frontend/lowering/lower-modules.js +655 -329
- package/dist/frontend/lowering/lower-modules.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.test.js +91 -20
- package/dist/frontend/lowering/lower-modules.test.js.map +1 -1
- package/dist/frontend/lowering/lower-namespaces.js +25 -8
- package/dist/frontend/lowering/lower-namespaces.js.map +1 -1
- package/dist/frontend/lowering/lower-node-module.js +115 -34
- package/dist/frontend/lowering/lower-node-module.js.map +1 -1
- package/dist/frontend/lowering/lower-server.js +1210 -290
- package/dist/frontend/lowering/lower-server.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.d.ts +148 -148
- package/dist/frontend/lowering/lower-stmts.js +2324 -994
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.test.js +13 -5
- package/dist/frontend/lowering/lower-stmts.test.js.map +1 -1
- package/dist/frontend/lowering/lower-stream.js +363 -91
- package/dist/frontend/lowering/lower-stream.js.map +1 -1
- package/dist/frontend/lowering/lower-system-errors.js +30 -8
- package/dist/frontend/lowering/lower-system-errors.js.map +1 -1
- package/dist/frontend/lowering/lower-test.js +40 -13
- package/dist/frontend/lowering/lower-test.js.map +1 -1
- package/dist/frontend/lowering/lower-timers.d.ts +31 -0
- package/dist/frontend/lowering/lower-timers.js +336 -0
- package/dist/frontend/lowering/lower-timers.js.map +1 -0
- package/dist/frontend/lowering/lower-url.d.ts +1 -1
- package/dist/frontend/lowering/lower-url.js +46 -13
- package/dist/frontend/lowering/lower-url.js.map +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +34 -352
- package/dist/frontend/lowering/lowerer.js +1074 -2712
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/lowering/lowerer.test.js +85 -17
- package/dist/frontend/lowering/lowerer.test.js.map +1 -1
- package/dist/frontend/lowering/module-namespace-elements.js +43 -8
- package/dist/frontend/lowering/module-namespace-elements.js.map +1 -1
- package/dist/frontend/lowering/native-ffi.d.ts +21 -1
- package/dist/frontend/lowering/native-ffi.js +487 -18
- package/dist/frontend/lowering/native-ffi.js.map +1 -1
- package/dist/frontend/lowering/object-enumeration-receiver.js +55 -10
- package/dist/frontend/lowering/object-enumeration-receiver.js.map +1 -1
- package/dist/frontend/lowering/object-factory-new.d.ts +1 -1
- package/dist/frontend/lowering/object-factory-new.js +36 -11
- package/dist/frontend/lowering/object-factory-new.js.map +1 -1
- package/dist/frontend/lowering/optional-arguments.js +49 -20
- package/dist/frontend/lowering/optional-arguments.js.map +1 -1
- package/dist/frontend/lowering/pairs-snapshot.js +66 -14
- package/dist/frontend/lowering/pairs-snapshot.js.map +1 -1
- package/dist/frontend/lowering/runtime-optional-locals.js +3 -1
- package/dist/frontend/lowering/runtime-optional-locals.js.map +1 -1
- package/dist/frontend/lowering/runtime-optional-locals.test.js.map +1 -1
- package/dist/frontend/lowering/sanitize-class-types.js +4 -1
- package/dist/frontend/lowering/sanitize-class-types.js.map +1 -1
- package/dist/frontend/lowering/sanitize-class-types.test.js +86 -18
- package/dist/frontend/lowering/sanitize-class-types.test.js.map +1 -1
- package/dist/frontend/lowering/split-consumers.d.ts +7 -0
- package/dist/frontend/lowering/split-consumers.js +64 -0
- package/dist/frontend/lowering/split-consumers.js.map +1 -0
- package/dist/frontend/lowering/static-this.js +13 -6
- package/dist/frontend/lowering/static-this.js.map +1 -1
- package/dist/frontend/lowering/string-index.js +32 -10
- package/dist/frontend/lowering/string-index.js.map +1 -1
- package/dist/frontend/lowering/surfaces.d.ts +45 -46
- package/dist/frontend/lowering/surfaces.js +1129 -256
- package/dist/frontend/lowering/surfaces.js.map +1 -1
- package/dist/frontend/lowering/symbol-fields.js +40 -15
- package/dist/frontend/lowering/symbol-fields.js.map +1 -1
- package/dist/frontend/lowering/symbol-methods.js.map +1 -1
- package/dist/frontend/lowering/text-decoder-encoding.js +236 -24
- package/dist/frontend/lowering/text-decoder-encoding.js.map +1 -1
- package/dist/frontend/lowering/text-decoder-encoding.test.js +84 -12
- package/dist/frontend/lowering/text-decoder-encoding.test.js.map +1 -1
- package/dist/frontend/lowering/union-narrow.js +59 -16
- package/dist/frontend/lowering/union-narrow.js.map +1 -1
- package/dist/frontend/lowering/union-narrow.test.js +24 -7
- package/dist/frontend/lowering/union-narrow.test.js.map +1 -1
- package/dist/frontend/lowering/union-retag.js +155 -40
- package/dist/frontend/lowering/union-retag.js.map +1 -1
- package/dist/frontend/lowering/union-retag.test.js +131 -33
- package/dist/frontend/lowering/union-retag.test.js.map +1 -1
- package/dist/frontend/lowering/unregistered-class-types.js.map +1 -1
- package/dist/frontend/lowering/unregistered-class-types.test.js +34 -8
- package/dist/frontend/lowering/unregistered-class-types.test.js.map +1 -1
- package/dist/frontend/module-source-candidates.d.ts +10 -0
- package/dist/frontend/module-source-candidates.js +40 -0
- package/dist/frontend/module-source-candidates.js.map +1 -0
- package/dist/frontend/module-source-candidates.test.d.ts +1 -0
- package/dist/frontend/module-source-candidates.test.js +53 -0
- package/dist/frontend/module-source-candidates.test.js.map +1 -0
- package/dist/frontend/module-syntax.js +21 -8
- package/dist/frontend/module-syntax.js.map +1 -1
- package/dist/frontend/module-syntax.test.js +37 -13
- package/dist/frontend/module-syntax.test.js.map +1 -1
- package/dist/frontend/npm-fetch-analysis.js +13 -4
- package/dist/frontend/npm-fetch-analysis.js.map +1 -1
- package/dist/frontend/npm-fetch-analysis.test.js +33 -10
- package/dist/frontend/npm-fetch-analysis.test.js.map +1 -1
- package/dist/frontend/npm-fetch-node.js.map +1 -1
- package/dist/frontend/npm-fetch-syntax.js +4 -9
- package/dist/frontend/npm-fetch-syntax.js.map +1 -1
- package/dist/frontend/npm-node.js +3 -1
- package/dist/frontend/npm-node.js.map +1 -1
- package/dist/frontend/npm-static-bundled-cjs.js +88 -29
- package/dist/frontend/npm-static-bundled-cjs.js.map +1 -1
- package/dist/frontend/npm-static-bundled-cjs.test.js +29 -10
- package/dist/frontend/npm-static-bundled-cjs.test.js.map +1 -1
- package/dist/frontend/npm-static-declaration-syntax.js +148 -56
- package/dist/frontend/npm-static-declaration-syntax.js.map +1 -1
- package/dist/frontend/npm-static-declarations.d.ts +1 -1
- package/dist/frontend/npm-static-declarations.js.map +1 -1
- package/dist/frontend/npm-static-declarations.test.js +33 -7
- package/dist/frontend/npm-static-declarations.test.js.map +1 -1
- package/dist/frontend/npm-static-prune.js +26 -12
- package/dist/frontend/npm-static-prune.js.map +1 -1
- package/dist/frontend/npm-static-prune.test.js +17 -3
- package/dist/frontend/npm-static-prune.test.js.map +1 -1
- package/dist/frontend/npm-static-rewrite-host.js +2 -3
- package/dist/frontend/npm-static-rewrite-host.js.map +1 -1
- package/dist/frontend/npm-static-rewrite-syntax.js +64 -21
- package/dist/frontend/npm-static-rewrite-syntax.js.map +1 -1
- package/dist/frontend/npm-static-rewrite.js.map +1 -1
- package/dist/frontend/npm-static-subtyping.js +9 -4
- package/dist/frontend/npm-static-subtyping.js.map +1 -1
- package/dist/frontend/npm-static-subtyping.test.js +30 -6
- package/dist/frontend/npm-static-subtyping.test.js.map +1 -1
- package/dist/frontend/npm-static.js +15 -4
- package/dist/frontend/npm-static.js.map +1 -1
- package/dist/frontend/npm.js +122 -36
- package/dist/frontend/npm.js.map +1 -1
- package/dist/frontend/npm.test.js +30 -10
- package/dist/frontend/npm.test.js.map +1 -1
- package/dist/frontend/pipeline-native.js.map +1 -1
- package/dist/frontend/pipeline.js +25 -8
- package/dist/frontend/pipeline.js.map +1 -1
- package/dist/frontend/pipeline.test.js +21 -7
- package/dist/frontend/pipeline.test.js.map +1 -1
- package/dist/frontend/program-analysis.d.ts +2 -0
- package/dist/frontend/program-analysis.js +2 -0
- package/dist/frontend/program-analysis.js.map +1 -1
- package/dist/frontend/program-node.js +5 -3
- package/dist/frontend/program-node.js.map +1 -1
- package/dist/frontend/program.d.ts +2 -2
- package/dist/frontend/program.js +248 -127
- package/dist/frontend/program.js.map +1 -1
- package/dist/frontend/program.test.js +27 -27
- package/dist/frontend/program.test.js.map +1 -1
- package/dist/frontend/provenance-core.js +8 -4
- package/dist/frontend/provenance-core.js.map +1 -1
- package/dist/frontend/provenance-registry.js +1 -4
- package/dist/frontend/provenance-registry.js.map +1 -1
- package/dist/frontend/resolve.js +32 -20
- package/dist/frontend/resolve.js.map +1 -1
- package/dist/frontend/resolve.test.js +1 -1
- package/dist/frontend/resolve.test.js.map +1 -1
- package/dist/frontend/runtime-resolve.js +13 -4
- package/dist/frontend/runtime-resolve.js.map +1 -1
- package/dist/frontend/runtime-resolve.test.js +25 -9
- package/dist/frontend/runtime-resolve.test.js.map +1 -1
- package/dist/frontend/services-node.js +6 -2
- package/dist/frontend/services-node.js.map +1 -1
- package/dist/frontend/services-node.test.js +18 -6
- package/dist/frontend/services-node.test.js.map +1 -1
- package/dist/frontend/services.js +8 -4
- package/dist/frontend/services.js.map +1 -1
- package/dist/frontend/services.test.js +6 -2
- package/dist/frontend/services.test.js.map +1 -1
- package/dist/frontend/ts7/api.js +12 -4
- package/dist/frontend/ts7/api.js.map +1 -1
- package/dist/frontend/ts7/ast-bytes.js +10 -3
- package/dist/frontend/ts7/ast-bytes.js.map +1 -1
- package/dist/frontend/ts7/ast-bytes.test.js +23 -4
- package/dist/frontend/ts7/ast-bytes.test.js.map +1 -1
- package/dist/frontend/ts7/ast-guards.test.js +14 -5
- package/dist/frontend/ts7/ast-guards.test.js.map +1 -1
- package/dist/frontend/ts7/ast-node.d.ts +6 -1
- package/dist/frontend/ts7/ast-node.js +490 -172
- package/dist/frontend/ts7/ast-node.js.map +1 -1
- package/dist/frontend/ts7/ast-node.test.js +150 -36
- package/dist/frontend/ts7/ast-node.test.js.map +1 -1
- package/dist/frontend/ts7/ast-text.js +13 -3
- package/dist/frontend/ts7/ast-text.js.map +1 -1
- package/dist/frontend/ts7/ast-text.test.js.map +1 -1
- package/dist/frontend/ts7/ast-types.js.map +1 -1
- package/dist/frontend/ts7/ast-wire.d.ts +5 -1
- package/dist/frontend/ts7/ast-wire.js +83 -20
- package/dist/frontend/ts7/ast-wire.js.map +1 -1
- package/dist/frontend/ts7/ast-wire.test.js +53 -8
- package/dist/frontend/ts7/ast-wire.test.js.map +1 -1
- package/dist/frontend/ts7/ast.d.ts +2 -1
- package/dist/frontend/ts7/ast.js +53 -30
- package/dist/frontend/ts7/ast.js.map +1 -1
- package/dist/frontend/ts7/census-check.js +1 -1
- package/dist/frontend/ts7/census-check.js.map +1 -1
- package/dist/frontend/ts7/checker-cache.js.map +1 -1
- package/dist/frontend/ts7/checker.d.ts +8 -2
- package/dist/frontend/ts7/checker.js +46 -8
- package/dist/frontend/ts7/checker.js.map +1 -1
- package/dist/frontend/ts7/checker.test.js +96 -17
- package/dist/frontend/ts7/checker.test.js.map +1 -1
- package/dist/frontend/ts7/enums.test.js +9 -4
- package/dist/frontend/ts7/enums.test.js.map +1 -1
- package/dist/frontend/ts7/native-api.js.map +1 -1
- package/dist/frontend/ts7/native-host.js.map +1 -1
- package/dist/frontend/ts7/native-process.js +9 -3
- package/dist/frontend/ts7/native-process.js.map +1 -1
- package/dist/frontend/ts7/program-adapter.js +1 -1
- package/dist/frontend/ts7/program-adapter.js.map +1 -1
- package/dist/frontend/ts7/program-host.d.ts +7 -0
- package/dist/frontend/ts7/program-host.js +33 -6
- package/dist/frontend/ts7/program-host.js.map +1 -1
- package/dist/frontend/ts7/program-host.test.js +72 -11
- package/dist/frontend/ts7/program-host.test.js.map +1 -1
- package/dist/frontend/ts7/rpc-api.js +3 -1
- package/dist/frontend/ts7/rpc-api.js.map +1 -1
- package/dist/frontend/ts7/rpc-client.js +15 -5
- package/dist/frontend/ts7/rpc-client.js.map +1 -1
- package/dist/frontend/ts7/rpc-client.test.js +26 -8
- package/dist/frontend/ts7/rpc-client.test.js.map +1 -1
- package/dist/frontend/ts7/rpc-filesystem.js.map +1 -1
- package/dist/frontend/ts7/rpc-filesystem.test.js +43 -10
- package/dist/frontend/ts7/rpc-filesystem.test.js.map +1 -1
- package/dist/frontend/ts7/rpc-process.js +16 -6
- package/dist/frontend/ts7/rpc-process.js.map +1 -1
- package/dist/frontend/ts7/rpc-process.test.js.map +1 -1
- package/dist/frontend/ts7/rpc-wire.d.ts +1 -0
- package/dist/frontend/ts7/rpc-wire.js +41 -14
- package/dist/frontend/ts7/rpc-wire.js.map +1 -1
- package/dist/frontend/ts7/rpc-wire.test.js +36 -6
- package/dist/frontend/ts7/rpc-wire.test.js.map +1 -1
- package/dist/frontend/ts7/semantic-checker.js +209 -68
- package/dist/frontend/ts7/semantic-checker.js.map +1 -1
- package/dist/frontend/ts7/semantic-checker.test.js +29 -14
- package/dist/frontend/ts7/semantic-checker.test.js.map +1 -1
- package/dist/frontend/ts7/semantic-json.js +7 -1
- package/dist/frontend/ts7/semantic-json.js.map +1 -1
- package/dist/frontend/ts7/semantic-json.test.js +17 -3
- package/dist/frontend/ts7/semantic-json.test.js.map +1 -1
- package/dist/frontend/ts7/semantic-model.js +147 -51
- package/dist/frontend/ts7/semantic-model.js.map +1 -1
- package/dist/frontend/ts7/semantic-model.test.js +72 -19
- package/dist/frontend/ts7/semantic-model.test.js.map +1 -1
- package/dist/frontend/ts7/semantic-types.d.ts +2 -2
- package/dist/frontend/ts7/session-cache.js +10 -3
- package/dist/frontend/ts7/session-cache.js.map +1 -1
- package/dist/frontend/ts7/session-cache.test.js +13 -4
- package/dist/frontend/ts7/session-cache.test.js.map +1 -1
- package/dist/frontend/ts7/session-path.js +25 -10
- package/dist/frontend/ts7/session-path.js.map +1 -1
- package/dist/frontend/ts7/session-path.test.js +47 -4
- package/dist/frontend/ts7/session-path.test.js.map +1 -1
- package/dist/frontend/ts7/session-timing.js +22 -3
- package/dist/frontend/ts7/session-timing.js.map +1 -1
- package/dist/frontend/ts7/session-timing.test.js +12 -3
- package/dist/frontend/ts7/session-timing.test.js.map +1 -1
- package/dist/frontend/ts7/session.d.ts +1 -0
- package/dist/frontend/ts7/session.js +109 -35
- package/dist/frontend/ts7/session.js.map +1 -1
- package/dist/frontend/ts7/session.test.js +69 -15
- package/dist/frontend/ts7/session.test.js.map +1 -1
- package/dist/frontend/ts7/source-parser.js +17 -6
- package/dist/frontend/ts7/source-parser.js.map +1 -1
- package/dist/frontend/ts7/source-parser.test.js +32 -9
- package/dist/frontend/ts7/source-parser.test.js.map +1 -1
- package/dist/frontend/tsc-codes.js +56 -11
- package/dist/frontend/tsc-codes.js.map +1 -1
- package/dist/frontend/tsc-codes.test.d.ts +1 -0
- package/dist/frontend/tsc-codes.test.js +16 -0
- package/dist/frontend/tsc-codes.test.js.map +1 -0
- package/dist/frontend/type-mapper.d.ts +3 -0
- package/dist/frontend/type-mapper.js +589 -206
- package/dist/frontend/type-mapper.js.map +1 -1
- package/dist/frontend/type-mapper.test.js +108 -33
- package/dist/frontend/type-mapper.test.js.map +1 -1
- package/dist/frontend/union-discriminants.js +8 -2
- package/dist/frontend/union-discriminants.js.map +1 -1
- package/dist/frontend/union-discriminants.test.js +77 -20
- package/dist/frontend/union-discriminants.test.js.map +1 -1
- package/dist/frontend/worker-target.d.ts +6 -0
- package/dist/frontend/worker-target.js +108 -0
- package/dist/frontend/worker-target.js.map +1 -0
- package/dist/frontend/worker-target.test.d.ts +1 -0
- package/dist/frontend/worker-target.test.js +71 -0
- package/dist/frontend/worker-target.test.js.map +1 -0
- package/dist/index.d.ts +9 -8
- package/dist/index.js +174 -88
- package/dist/index.js.map +1 -1
- package/dist/ir/analysis.js +95 -38
- package/dist/ir/analysis.js.map +1 -1
- package/dist/ir/analysis.test.js +91 -15
- package/dist/ir/analysis.test.js.map +1 -1
- package/dist/ir/api.d.ts +4 -0
- package/dist/ir/api.js +6 -0
- package/dist/ir/api.js.map +1 -0
- package/dist/ir/build.d.ts +7 -0
- package/dist/ir/build.js +27 -1
- package/dist/ir/build.js.map +1 -1
- package/dist/ir/builtin-effects.d.ts +9 -0
- package/dist/ir/builtin-effects.js +643 -0
- package/dist/ir/builtin-effects.js.map +1 -0
- package/dist/ir/builtin-signatures.d.ts +15 -0
- package/dist/ir/builtin-signatures.js +3397 -0
- package/dist/ir/builtin-signatures.js.map +1 -0
- package/dist/ir/byte-numbers.js +67 -16
- package/dist/ir/byte-numbers.js.map +1 -1
- package/dist/ir/byte-numbers.test.js +17 -4
- package/dist/ir/byte-numbers.test.js.map +1 -1
- package/dist/ir/constant-tables.js +13 -5
- package/dist/ir/constant-tables.js.map +1 -1
- package/dist/ir/constant-tables.test.js +47 -7
- package/dist/ir/constant-tables.test.js.map +1 -1
- package/dist/ir/control-flow.js +2 -1
- package/dist/ir/control-flow.js.map +1 -1
- package/dist/ir/control-flow.test.js +35 -11
- package/dist/ir/control-flow.test.js.map +1 -1
- package/dist/ir/initializer-bindings.d.ts +9 -0
- package/dist/ir/initializer-bindings.js +115 -0
- package/dist/ir/initializer-bindings.js.map +1 -0
- package/dist/ir/initializer-bindings.test.d.ts +1 -0
- package/dist/ir/initializer-bindings.test.js +118 -0
- package/dist/ir/initializer-bindings.test.js.map +1 -0
- package/dist/ir/integer-loop-facts.d.ts +12 -0
- package/dist/ir/integer-loop-facts.js +137 -0
- package/dist/ir/integer-loop-facts.js.map +1 -0
- package/dist/ir/integer-loops.js +85 -30
- package/dist/ir/integer-loops.js.map +1 -1
- package/dist/ir/integer-loops.test.js +76 -13
- package/dist/ir/integer-loops.test.js.map +1 -1
- package/dist/ir/integer-ranges.js +93 -21
- package/dist/ir/integer-ranges.js.map +1 -1
- package/dist/ir/integer-ranges.test.js +199 -21
- package/dist/ir/integer-ranges.test.js.map +1 -1
- package/dist/ir/intrinsic-signatures.d.ts +20 -0
- package/dist/ir/intrinsic-signatures.js +57 -0
- package/dist/ir/intrinsic-signatures.js.map +1 -0
- package/dist/ir/ir.d.ts +15 -2160
- package/dist/ir/ir.js +160 -1396
- package/dist/ir/ir.js.map +1 -1
- package/dist/ir/ir.test.js +98 -77
- package/dist/ir/ir.test.js.map +1 -1
- package/dist/ir/numeric-call-specialization.d.ts +8 -0
- package/dist/ir/numeric-call-specialization.js +198 -0
- package/dist/ir/numeric-call-specialization.js.map +1 -0
- package/dist/ir/runtime-features.d.ts +221 -0
- package/dist/ir/runtime-features.js +552 -0
- package/dist/ir/runtime-features.js.map +1 -0
- package/dist/ir/runtime-features.test.d.ts +1 -0
- package/dist/ir/runtime-features.test.js +98 -0
- package/dist/ir/runtime-features.test.js.map +1 -0
- package/dist/ir/scalar-records.js +130 -40
- package/dist/ir/scalar-records.js.map +1 -1
- package/dist/ir/scalar-records.test.js +146 -27
- package/dist/ir/scalar-records.test.js.map +1 -1
- package/dist/ir/serialize.d.ts +1 -1
- package/dist/ir/serialize.js +7 -5
- package/dist/ir/serialize.js.map +1 -1
- package/dist/ir/serialize.test.js +44 -9
- package/dist/ir/serialize.test.js.map +1 -1
- package/dist/ir/traverse.js +156 -43
- package/dist/ir/traverse.js.map +1 -1
- package/dist/ir/traverse.test.js +99 -24
- package/dist/ir/traverse.test.js.map +1 -1
- package/dist/ir/validate.d.ts +1 -31
- package/dist/ir/validate.js +869 -1910
- package/dist/ir/validate.js.map +1 -1
- package/dist/ir/validate.test.js +697 -114
- package/dist/ir/validate.test.js.map +1 -1
- package/dist/library/cache-primitives.js +9 -10
- package/dist/library/cache-primitives.js.map +1 -1
- package/dist/library/cache-reset.test.js +2 -1
- package/dist/library/cache-reset.test.js.map +1 -1
- package/dist/library/compiler-self-identity.js +11 -5
- package/dist/library/compiler-self-identity.js.map +1 -1
- package/dist/library/compiler-self-identity.test.js +10 -3
- package/dist/library/compiler-self-identity.test.js.map +1 -1
- package/dist/library/fence-eval.js +24 -7
- package/dist/library/fence-eval.js.map +1 -1
- package/dist/library/fence-eval.test.js +31 -7
- package/dist/library/fence-eval.test.js.map +1 -1
- package/dist/library/int-infer.js +199 -59
- package/dist/library/int-infer.js.map +1 -1
- package/dist/library/int-infer.test.js +137 -61
- package/dist/library/int-infer.test.js.map +1 -1
- package/dist/library/ir-policy.d.ts +27 -0
- package/dist/library/ir-policy.js +234 -0
- package/dist/library/ir-policy.js.map +1 -0
- package/dist/library/library-cache.js +40 -17
- package/dist/library/library-cache.js.map +1 -1
- package/dist/library/library-cache.test.js +29 -18
- package/dist/library/library-cache.test.js.map +1 -1
- package/dist/library/library-profile.js +68 -13
- package/dist/library/library-profile.js.map +1 -1
- package/dist/library/prepare.js +48 -20
- package/dist/library/prepare.js.map +1 -1
- package/dist/library/semantic-source.js +16 -14
- package/dist/library/semantic-source.js.map +1 -1
- package/dist/library/semantic-source.test.js +9 -14
- package/dist/library/semantic-source.test.js.map +1 -1
- package/dist/library/sidecar-validate.js +53 -12
- package/dist/library/sidecar-validate.js.map +1 -1
- package/dist/library/sidecar.js +85 -24
- package/dist/library/sidecar.js.map +1 -1
- package/dist/library/trap-teaching.js +11 -2
- package/dist/library/trap-teaching.js.map +1 -1
- package/dist/native/cache.js +10 -4
- package/dist/native/cache.js.map +1 -1
- package/dist/native/cli.js +34 -9
- package/dist/native/cli.js.map +1 -1
- package/dist/native/compiler.js +191 -54
- package/dist/native/compiler.js.map +1 -1
- package/dist/native/compiler.test.js +134 -33
- package/dist/native/compiler.test.js.map +1 -1
- package/dist/native/comptime.js +23 -7
- package/dist/native/comptime.js.map +1 -1
- package/dist/native/comptime.test.js +26 -6
- package/dist/native/comptime.test.js.map +1 -1
- package/dist/native/executable-cache.js +77 -27
- package/dist/native/executable-cache.js.map +1 -1
- package/dist/native/executable-cache.test.js +41 -6
- package/dist/native/executable-cache.test.js.map +1 -1
- package/dist/native/file-identity.js +9 -2
- package/dist/native/file-identity.js.map +1 -1
- package/dist/native/file-identity.test.js.map +1 -1
- package/dist/native/library.js +50 -12
- package/dist/native/library.js.map +1 -1
- package/dist/native/prepare.js +121 -34
- package/dist/native/prepare.js.map +1 -1
- package/dist/native/prepare.test.js +22 -6
- package/dist/native/prepare.test.js.map +1 -1
- package/dist/native/runtime-typescript.js +24 -11
- package/dist/native/runtime-typescript.js.map +1 -1
- package/dist/native/runtime-typescript.test.js.map +1 -1
- package/dist/native/sanitizer.js +71 -18
- package/dist/native/sanitizer.js.map +1 -1
- package/dist/native/sanitizer.test.js +78 -20
- package/dist/native/sanitizer.test.js.map +1 -1
- package/dist/native/task.js.map +1 -1
- package/dist/native/task.test.js +7 -2
- package/dist/native/task.test.js.map +1 -1
- package/dist/native/toolchain.js +68 -26
- package/dist/native/toolchain.js.map +1 -1
- package/dist/native/toolchain.test.js +59 -20
- package/dist/native/toolchain.test.js.map +1 -1
- package/dist/startup-cache.d.ts +1 -1
- package/dist/startup-cache.js +1 -1
- package/dist/startup-cache.js.map +1 -1
- package/dist/timing.js.map +1 -1
- package/package.json +20 -20
- package/surface-manifest.json +30 -2
- package/dist/frontend/lowering/lower-builtins.d.ts +0 -601
- package/dist/frontend/lowering/lower-builtins.js +0 -8986
- package/dist/frontend/lowering/lower-builtins.js.map +0 -1
- package/dist/frontend/lowering/lower-containers.d.ts +0 -382
- package/dist/frontend/lowering/lower-containers.js +0 -7344
- package/dist/frontend/lowering/lower-containers.js.map +0 -1
|
@@ -21,49 +21,61 @@ import { InternalCompilerError } from "../../errors.js";
|
|
|
21
21
|
import { deflateRawSync } from "node:zlib";
|
|
22
22
|
import { endsWithJump, matchStringSelfConcat, streamTypedRefEligible } from "../../ir/analysis.js";
|
|
23
23
|
import { emitLibraryIdentityLines } from "../library-identity-markers.js";
|
|
24
|
-
import { CAUGHT, ffiCallbackType, isDynTypedRefType, isFfiContextParam, isRefCounted, isUnitType,
|
|
25
|
-
import {
|
|
24
|
+
import { CAUGHT, ffiCallbackType, isDynTypedRefType, isFfiContextParam, isRefCounted, isUnitType, POINTER_KINDS, RUNTIME_EMITTER_CLASS, RUNTIME_ERROR_CLASSES, RUNTIME_STREAM_CLASSES, typeKey, STRING, VOID, } from "../../ir/ir.js";
|
|
25
|
+
import { moduleRuntimeFeatures, moduleEmbedsBuiltin, moduleEmbedsCompressedNpm, NPM_COMPRESS_MIN, } from "../../ir/runtime-features.js";
|
|
26
|
+
import { matchIntegerArrayForLoop, matchIntegerBytesForLoop, matchIntegerCountedForLoop, } from "../../ir/integer-loops.js";
|
|
26
27
|
import { emitCountedLoopLimit } from "./counted-loops.js";
|
|
28
|
+
import { emitLiteralSwitch } from "./switch-dispatch.js";
|
|
27
29
|
import { findBytesBounds } from "./bytes-bounds.js";
|
|
30
|
+
import { emitByteWindowGuard, findInitializedByteLoopBindings, matchByteWindow, } from "./byte-windows.js";
|
|
31
|
+
import { canDeferSplitPiece, emitSplitSpanNext, materializeSplitPiece, emitSplitCursor, emitSplitNext, emitSplitScratch, emitSplitSnapshot, findPrivateSplitLocals, loadSplitSnapshot, storeSplitSnapshot, stringSplit, } from "./split-loops.js";
|
|
28
32
|
import { scalarizeNumericRecords } from "../../ir/scalar-records.js";
|
|
33
|
+
import { specializeNumericCalls } from "../../ir/numeric-call-specialization.js";
|
|
29
34
|
import { everyStmtList } from "../../ir/traverse.js";
|
|
30
35
|
import { analyzeIntegerRanges } from "../../ir/integer-ranges.js";
|
|
31
36
|
import { findIntegerViews } from "./integer-views.js";
|
|
37
|
+
import { findInitializerBindings, withInitializerBindings } from "../../ir/initializer-bindings.js";
|
|
32
38
|
import { findConstantNumericTables } from "../../ir/constant-tables.js";
|
|
33
|
-
import { allocateFfiCallbackAdapters, hasForeignFfiCallback, hasRetainedFfiCallback } from "../ffi-callbacks.js";
|
|
39
|
+
import { allocateFfiCallbackAdapters, hasForeignFfiCallback, hasRetainedFfiCallback, } from "../ffi-callbacks.js";
|
|
34
40
|
import { RUNTIME_ABI_MARKER } from "../runtime-abi.js";
|
|
35
41
|
import { computeMayThrow } from "../may-throw.js";
|
|
36
|
-
import { mangleArgPack, mangleAsyncSpawn, mangleBorrowedFunction, mangleClassObj, mangleClassStruct, mangleFnClosure, mangleFunction, mangleGenDrop, mangleGenSpawn, mangleGlobal, mangleLocal, mangleRecordStruct, mangleTrampoline, mangleWrapper, mangleVtInstance } from "../mangle.js";
|
|
42
|
+
import { mangleArgPack, mangleAsyncSpawn, mangleBorrowedFunction, mangleClassObj, mangleClassStruct, mangleFnClosure, mangleFunction, mangleGenDrop, mangleGenSpawn, mangleGlobal, mangleLocal, mangleRecordStruct, mangleTrampoline, mangleWrapper, mangleVtInstance, } from "../mangle.js";
|
|
37
43
|
import { analyzeCallLifetimes } from "./call-lifetimes.js";
|
|
38
|
-
import { emitStackUnion, findLocalStackUnions } from "./stack-unions.js";
|
|
44
|
+
import { canStackUnion, emitStackUnion, findLocalStackUnions } from "./stack-unions.js";
|
|
45
|
+
import { allocateLocalUnion, findLocalUnionStorage, storeLocalUnion, } from "./local-union-storage.js";
|
|
39
46
|
import { BlockBuilder } from "./blocks.js";
|
|
40
|
-
import { emitLocalArrayRead, findLocalArrayReads, findCallArrayReads, OptionalArrayReads } from "./local-array-reads.js";
|
|
41
|
-
import { emitStackMapRead, findMapReadLifetimes } from "./map-read-lifetimes.js";
|
|
47
|
+
import { emitLocalArrayRead, emitBorrowedArrayRead, findLocalArrayReads, findCallArrayReads, OptionalArrayReads, } from "./local-array-reads.js";
|
|
48
|
+
import { emitStackMapRead, findMapReadLifetimes, matchMapRead, } from "./map-read-lifetimes.js";
|
|
42
49
|
import { emitBorrowedFieldSequence } from "./borrowed-receivers.js";
|
|
43
50
|
import { emitBorrowedInput } from "./borrowed-inputs.js";
|
|
44
51
|
import { ReferenceEffects } from "./reference-effects.js";
|
|
45
52
|
import { LlvmDebugInfo } from "./debug-info.js";
|
|
46
|
-
import {
|
|
53
|
+
import { StackCallbacks } from "./stack-callbacks.js";
|
|
54
|
+
import { findLoopArrayBorrows } from "./loop-array-borrows.js";
|
|
55
|
+
import { findConstantCallbacks } from "./constant-callbacks.js";
|
|
56
|
+
import { findScalarStringSlices, emitStringSliceSnapshot, } from "./string-slices.js";
|
|
57
|
+
import { StackCaptures } from "./stack-captures.js";
|
|
58
|
+
import { f64Lit, ffiNativeTypeLl, ffiNativeParamLl, ffiNativeReturnLl, llvmCommentText, } from "./common.js";
|
|
47
59
|
import { ffiExtendsNarrowIntegers } from "../targets.js";
|
|
48
|
-
import { emitLiteralExpr, emitOperatorExpr, emitStringExpr, emitContainerExpr, emitRecordExpr } from "./expr-primitives.js";
|
|
60
|
+
import { emitLiteralExpr, emitOperatorExpr, emitStringExpr, emitContainerExpr, emitRecordExpr, } from "./expr-primitives.js";
|
|
49
61
|
import { emitControlExpr } from "./expr-control.js";
|
|
50
62
|
import { emitCallExpr } from "./expr-calls.js";
|
|
51
63
|
import { emitDynamicExpr } from "./expr-dynamic.js";
|
|
52
64
|
import { emitIntrinsicExpr, emitSerializationExpr, emitAsyncExpr } from "./expr-async.js";
|
|
53
65
|
import { emitJsInteropExpr, emitExpr } from "./expr-dispatch.js";
|
|
54
|
-
import { emitJsMarshal, emitJsOp, emitJsExit, islandAdapter, islandTypedAdapter } from "./expr-island.js";
|
|
55
|
-
import { dynKind, raceAdapterFor, genResultThunkFor, childExitThunkFor, childExitSignalThunkFor, childDataThunkFor, execFileThunkFor, ipcMessageThunkFor, ipcSendThunkFor, emitterFixedAdapter, wrapEmitterListener, unwrapNullableClosure, closeBindThunkFor, closeOverrideWrapFor } from "./expr-callbacks.js";
|
|
56
|
-
import { streamDataAdapter, streamDoneFnFor, cryptoBytesThunkFor, fsRenameThunkFor, streamCbThunkFor, zlibBytesThunkFor } from "./expr-stream-callbacks.js";
|
|
57
|
-
import { emitStableReceiver, resolveThunkFor, tagInSet, arrPush, emitArrayCopyLoop, emitStrIntrinsic, emitArrIntrinsic, wrapNullable, emitMapNew, mapSet, emitMapLikeIntrinsic, emitSetNew } from "./expr-containers.js";
|
|
58
|
-
import { emitIntegerLoopIndex, emitBytesIndex, emitBytesData, emitBytesLength, emitBytesGet, emitToUint32, emitBytesSet, emitBytesIntrinsic } from "./expr-bytes.js";
|
|
66
|
+
import { emitJsMarshal, emitJsOp, emitJsExit, islandAdapter, islandTypedAdapter, } from "./expr-island.js";
|
|
67
|
+
import { dynKind, raceAdapterFor, genResultThunkFor, childExitThunkFor, childExitSignalThunkFor, childDataThunkFor, execFileThunkFor, ipcMessageThunkFor, ipcSendThunkFor, emitterFixedAdapter, wrapEmitterListener, unwrapNullableClosure, closeBindThunkFor, closeOverrideWrapFor, } from "./expr-callbacks.js";
|
|
68
|
+
import { streamDataAdapter, streamDoneFnFor, cryptoBytesThunkFor, fsRenameThunkFor, streamCbThunkFor, zlibBytesThunkFor, } from "./expr-stream-callbacks.js";
|
|
69
|
+
import { emitStableReceiver, resolveThunkFor, tagInSet, arrPush, emitArrayCopyLoop, emitStrIntrinsic, emitArrIntrinsic, wrapNullable, emitMapNew, mapSet, emitMapLikeIntrinsic, emitSetNew, } from "./expr-containers.js";
|
|
70
|
+
import { emitIntegerLoopIndex, emitBytesIndex, emitBytesData, emitBytesLength, emitBytesGet, emitToUint32, emitBytesSet, emitBytesIntrinsic, } from "./expr-bytes.js";
|
|
59
71
|
import { emitRegexIntrinsic, emitRecordKeyGet, keyedRecordReadInto } from "./expr-records.js";
|
|
60
|
-
import { dynPromiseAdapter, streamTypedRefCommitAdapter, liveDynUnionRefAdapter, streamTypedRefBoxValue, streamTypedRefMaterializeAdapter, streamFromArrayAdapter } from "./expr-stream-bridges.js";
|
|
61
|
-
import { emitWebLibCall, emitDynamicLibCall, emitFilesystemLibCall, emitPathUrlLibCall, emitPrimitiveLibCall } from "./lib-filesystem.js";
|
|
62
|
-
import { emitChildProcessLibCall, emitAsyncContextLibCall, emitProcessLibCall, emitErrorsEventsLibCall } from "./lib-process.js";
|
|
72
|
+
import { dynPromiseAdapter, streamTypedRefCommitAdapter, liveDynUnionRefAdapter, streamTypedRefBoxValue, streamTypedRefMaterializeAdapter, streamFromArrayAdapter, } from "./expr-stream-bridges.js";
|
|
73
|
+
import { emitWebLibCall, emitDynamicLibCall, emitFilesystemLibCall, emitPathUrlLibCall, emitPrimitiveLibCall, } from "./lib-filesystem.js";
|
|
74
|
+
import { emitChildProcessLibCall, emitAsyncContextLibCall, emitProcessLibCall, emitErrorsEventsLibCall, } from "./lib-process.js";
|
|
63
75
|
import { emitStreamLibCall } from "./lib-stream.js";
|
|
64
76
|
import { emitNetworkHttpLibCall } from "./lib-network.js";
|
|
65
|
-
import { emitAssertInspectLibCall, emitIoLibCall, emitGenericLibCall, emitLibCall } from "./lib-dispatch.js";
|
|
66
|
-
import { buildClassGraph, classEnvironmentIndex, classFieldIndex, classStructSym, } from "./classes.js";
|
|
77
|
+
import { emitAssertInspectLibCall, emitIoLibCall, emitGenericLibCall, emitLibCall, } from "./lib-dispatch.js";
|
|
78
|
+
import { buildClassGraph, classMembershipIntervals, emitClassMembershipHelper, classEnvironmentIndex, classFieldIndex, classStructSym, } from "./classes.js";
|
|
67
79
|
import { LlDyn } from "./dyn.js";
|
|
68
80
|
import { LlvmUnsupportedError } from "./unsupported.js";
|
|
69
81
|
import { LlWalkers } from "./walkers.js";
|
|
@@ -96,15 +108,19 @@ function ffiCallbackDummyLl(callback) {
|
|
|
96
108
|
}
|
|
97
109
|
export function emitLlvmModule(mod, options = {}) {
|
|
98
110
|
// Keep source storage intact for debugger inspection in dev builds.
|
|
99
|
-
return new LlEmitter(options.debugSources === undefined
|
|
111
|
+
return new LlEmitter(options.debugSources === undefined
|
|
112
|
+
? scalarizeNumericRecords(specializeNumericCalls(mod, mangleFunction))
|
|
113
|
+
: mod, options).emit();
|
|
100
114
|
}
|
|
101
115
|
/** Keep large translation units below the host's single-string limit. */
|
|
102
116
|
export function emitLlvmModuleSource(mod, options = {}) {
|
|
103
|
-
const parts = new LlEmitter(options.debugSources === undefined
|
|
117
|
+
const parts = new LlEmitter(options.debugSources === undefined
|
|
118
|
+
? scalarizeNumericRecords(specializeNumericCalls(mod, mangleFunction))
|
|
119
|
+
: mod, options).emitParts();
|
|
104
120
|
const length = parts.reduce((total, part) => total + part.length, Math.max(0, parts.length - 1));
|
|
105
121
|
if (length <= 256 * 1024 * 1024)
|
|
106
122
|
return parts.join("\n");
|
|
107
|
-
return parts.flatMap((part, index) => index === 0 ? [part] : ["\n", part]);
|
|
123
|
+
return parts.flatMap((part, index) => (index === 0 ? [part] : ["\n", part]));
|
|
108
124
|
}
|
|
109
125
|
function llStrBytes(text) {
|
|
110
126
|
return llBytes(Buffer.from(text, "utf8"));
|
|
@@ -112,7 +128,12 @@ function llStrBytes(text) {
|
|
|
112
128
|
export class LlEmitter {
|
|
113
129
|
mod;
|
|
114
130
|
localArrayReads = new Map();
|
|
131
|
+
loopArrayBorrows = new Set();
|
|
132
|
+
scalarStringSlices = new Map();
|
|
133
|
+
stringSlices = new Map();
|
|
115
134
|
localStackUnions = new Map();
|
|
135
|
+
localUnionStorageProofs = new Map();
|
|
136
|
+
localUnionStorage = new Map();
|
|
116
137
|
integerArrayBindings = new Set();
|
|
117
138
|
fieldAliasTags = new Map();
|
|
118
139
|
fieldPointerTags = new Map();
|
|
@@ -200,6 +221,10 @@ export class LlEmitter {
|
|
|
200
221
|
callArrayReads = new Map();
|
|
201
222
|
mapReadLifetimes = { locals: new Map(), arguments: new Map() };
|
|
202
223
|
callLifetimes;
|
|
224
|
+
constantCallbacks;
|
|
225
|
+
currentConstantCallbacks = new Map();
|
|
226
|
+
stackCallbacks;
|
|
227
|
+
stackCaptures;
|
|
203
228
|
borrowedParameters = new Set();
|
|
204
229
|
stableCallBindings = new Set();
|
|
205
230
|
/** Manifest-bound native imports, used by ffiCall emission. */
|
|
@@ -282,11 +307,19 @@ export class LlEmitter {
|
|
|
282
307
|
* for blocks and switches. */
|
|
283
308
|
jumpTargets = [];
|
|
284
309
|
currentLocals = new Map();
|
|
310
|
+
privateSplitLocals = new Map();
|
|
311
|
+
splitSpans = new Map();
|
|
312
|
+
storedSplits = new Map();
|
|
313
|
+
streamingSplitsEnabled = false;
|
|
314
|
+
initializerBindings;
|
|
315
|
+
numericLocals = new Map();
|
|
285
316
|
captureIds = new Set();
|
|
286
317
|
/** Active induction bindings retain their width independently of size_t. */
|
|
287
318
|
integerLoopBindings = new Map();
|
|
288
319
|
countedLoopsEnabled = false;
|
|
289
320
|
integerRanges = new Map();
|
|
321
|
+
byteWindowsEnabled = true;
|
|
322
|
+
byteWindowEntries = new Map();
|
|
290
323
|
bytesBounds = new Set();
|
|
291
324
|
integerViews = new Map();
|
|
292
325
|
/** Enclosing try-with-FINALLY regions, innermost last: a `return`
|
|
@@ -322,12 +355,18 @@ export class LlEmitter {
|
|
|
322
355
|
constructor(mod, options) {
|
|
323
356
|
this.mod = mod;
|
|
324
357
|
this.stackTraces = mod.functions.some((fn) => !everyStmtList(fn.body, {
|
|
325
|
-
stmt: () => true,
|
|
358
|
+
stmt: () => true,
|
|
359
|
+
expr: (expr) => !(expr.kind === "libCall" && expr.fn === "error.stack"),
|
|
326
360
|
}));
|
|
327
|
-
this.debug =
|
|
361
|
+
this.debug =
|
|
362
|
+
options.debugSources === undefined
|
|
363
|
+
? null
|
|
364
|
+
: new LlvmDebugInfo(mod.sourceFile, options.debugSources, options.pointerBits, mod.unions);
|
|
328
365
|
this.constantNumericTables = findConstantNumericTables(mod);
|
|
366
|
+
this.initializerBindings = findInitializerBindings(mod);
|
|
329
367
|
this.sizeType = options.pointerBits === 32 ? "i32" : "i64";
|
|
330
|
-
this.ffiExtendNarrowIntegers =
|
|
368
|
+
this.ffiExtendNarrowIntegers =
|
|
369
|
+
options.wasi === true || ffiExtendsNarrowIntegers(options.targetTriple);
|
|
331
370
|
this.wasi = options.wasi === true;
|
|
332
371
|
this.emitLibraryIdentity = options.emitLibraryIdentity !== false;
|
|
333
372
|
this.runtimeAbiMarker = options.runtimeAbiMarker === true;
|
|
@@ -345,7 +384,10 @@ export class LlEmitter {
|
|
|
345
384
|
}
|
|
346
385
|
const mt = computeMayThrow(mod);
|
|
347
386
|
this.mayThrow = mt.fns;
|
|
348
|
-
|
|
387
|
+
if (mod.workers)
|
|
388
|
+
for (const fn of mod.functions)
|
|
389
|
+
this.mayThrow.add(fn.name);
|
|
390
|
+
this.indirectMayThrow = mt.indirect || mod.workers === true;
|
|
349
391
|
for (const cls of mod.classes ?? []) {
|
|
350
392
|
for (const m of cls.methods ?? []) {
|
|
351
393
|
if (this.mayThrow.has(`%${cls.name}.${m}`))
|
|
@@ -357,6 +399,9 @@ export class LlEmitter {
|
|
|
357
399
|
this.optionalArrayReads = new OptionalArrayReads(this.fnByName, this.unionsById);
|
|
358
400
|
this.referenceEffects = new ReferenceEffects(this.fnByName, (call) => this.optionalArrayReads.get(call) !== null);
|
|
359
401
|
this.callLifetimes = analyzeCallLifetimes(this.fnByName);
|
|
402
|
+
this.constantCallbacks = findConstantCallbacks(mod, this.callLifetimes);
|
|
403
|
+
this.stackCallbacks = new StackCallbacks(this.fnByName);
|
|
404
|
+
this.stackCaptures = new StackCaptures(this.fnByName, this.callLifetimes, this.stackCallbacks);
|
|
360
405
|
for (const r of mod.records ?? [])
|
|
361
406
|
this.recordsById.set(r.id, r);
|
|
362
407
|
const traced = computeTraced(mod);
|
|
@@ -382,7 +427,10 @@ export class LlEmitter {
|
|
|
382
427
|
isErrorClass: (name) => this.classMeta.get(name)?.root.def.name === "%Error",
|
|
383
428
|
classSubtypes: (name) => {
|
|
384
429
|
const target = this.classMetaOf(name);
|
|
385
|
-
|
|
430
|
+
const intervals = classMembershipIntervals(this.classMeta, target.def.name);
|
|
431
|
+
return [...this.classMeta.values()]
|
|
432
|
+
.filter((meta) => intervals.some((range) => range.pre <= meta.pre && meta.pre <= range.post))
|
|
433
|
+
.map((meta) => meta.def.name);
|
|
386
434
|
},
|
|
387
435
|
};
|
|
388
436
|
this.walkers = new LlWalkers(this.shapeHost);
|
|
@@ -491,7 +539,7 @@ export class LlEmitter {
|
|
|
491
539
|
if (adapter.global !== null)
|
|
492
540
|
globals.push(`@${adapter.global} = internal thread_local global ptr null`);
|
|
493
541
|
if (adapter.table !== null) {
|
|
494
|
-
globals.push(`@${adapter.table} = internal global %ScrFfiTable zeroinitializer`);
|
|
542
|
+
globals.push(`@${adapter.table} = internal ${this.mod.workers ? "thread_local " : ""}global %ScrFfiTable zeroinitializer`);
|
|
495
543
|
}
|
|
496
544
|
const params = cb.params.flatMap((param, i) => {
|
|
497
545
|
if (isFfiContextParam(param))
|
|
@@ -502,8 +550,10 @@ export class LlEmitter {
|
|
|
502
550
|
return [`${ffiNativeParamLl(param, this.ffiExtendNarrowIntegers)} %a${i}`];
|
|
503
551
|
});
|
|
504
552
|
if (cb.invoke === "foreign") {
|
|
505
|
-
if (adapter.table === null ||
|
|
506
|
-
cb.params.some(
|
|
553
|
+
if (adapter.table === null ||
|
|
554
|
+
!cb.params.some(isFfiContextParam) ||
|
|
555
|
+
cb.returns !== "void" ||
|
|
556
|
+
cb.params.some((param) => param === "i64" || param === "u64" || param === "pointer")) {
|
|
507
557
|
throw new InternalCompilerError("llvm emitter bug: invalid foreign FFI callback descriptor");
|
|
508
558
|
}
|
|
509
559
|
const dispatch = `${adapter.symbol}_dispatch`;
|
|
@@ -688,7 +738,9 @@ export class LlEmitter {
|
|
|
688
738
|
defs.push(` %invoke_pin = call ptr @scr_closure_retain_v(ptr %cb)`);
|
|
689
739
|
}
|
|
690
740
|
if (cb.returns === "void") {
|
|
691
|
-
defs.push(` call void %fn(${callArgs})`, ...(cb.lifetime === "retained"
|
|
741
|
+
defs.push(` call void %fn(${callArgs})`, ...(cb.lifetime === "retained"
|
|
742
|
+
? [` call void @scr_closure_release_v(ptr %invoke_pin)`]
|
|
743
|
+
: []), ` ret void`, `}`, ``);
|
|
692
744
|
continue;
|
|
693
745
|
}
|
|
694
746
|
defs.push(` %result = call ${internalRet} %fn(${callArgs})`);
|
|
@@ -843,18 +895,18 @@ export class LlEmitter {
|
|
|
843
895
|
// Stream-surface programs fill the loop's stream hook (the deferred
|
|
844
896
|
// next-tick emissions) and the emitter's post-registration flow kick
|
|
845
897
|
// before %main — scr_stream.c links only when the line is emitted
|
|
846
|
-
// (native
|
|
898
|
+
// (native/executable.ts gates on the same predicate).
|
|
847
899
|
const usesStream = runtimeFeatures.stream;
|
|
848
900
|
// Net-surface programs fill the loop's net hooks (and the netSocket
|
|
849
901
|
// handle-dispatch ops for the checked-dynamic boundary); http-surface
|
|
850
902
|
// programs additionally stamp the httpReq/httpRes ops — the C main's
|
|
851
|
-
// install lines, gated on the same predicates native
|
|
903
|
+
// install lines, gated on the same predicates native/executable.ts links by.
|
|
852
904
|
const usesNet = runtimeFeatures.net;
|
|
853
905
|
const usesDgram = runtimeFeatures.dgram;
|
|
854
906
|
const usesHttp2 = runtimeFeatures.http2;
|
|
855
907
|
const usesHttp = runtimeFeatures.http;
|
|
856
908
|
// Fetch-referencing programs register the native fetch bridge before
|
|
857
|
-
// any island entry (the engine's lazy boot consults it) — native
|
|
909
|
+
// any island entry (the engine's lazy boot consults it) — native/executable.ts
|
|
858
910
|
// compiles scr_fetch.c on the same predicate.
|
|
859
911
|
const usesFetch = runtimeFeatures.fetch;
|
|
860
912
|
const embedsZlib = moduleEmbedsBuiltin(this.mod, "node:zlib");
|
|
@@ -862,7 +914,8 @@ export class LlEmitter {
|
|
|
862
914
|
moduleEmbedsBuiltin(this.mod, "node:https") ||
|
|
863
915
|
moduleEmbedsBuiltin(this.mod, "node:net") ||
|
|
864
916
|
moduleEmbedsBuiltin(this.mod, "node:tls");
|
|
865
|
-
const snapshotsTlsCa = runtimeFeatures.tls ||
|
|
917
|
+
const snapshotsTlsCa = runtimeFeatures.tls ||
|
|
918
|
+
runtimeFeatures.tlsCa ||
|
|
866
919
|
moduleEmbedsBuiltin(this.mod, "node:https") ||
|
|
867
920
|
moduleEmbedsBuiltin(this.mod, "node:tls");
|
|
868
921
|
// The process verdict has the same precedence as the C reference
|
|
@@ -875,10 +928,14 @@ export class LlEmitter {
|
|
|
875
928
|
this.declare(`declare void @scr_events_install()`);
|
|
876
929
|
if (usesChildProcess)
|
|
877
930
|
this.declare(`declare void @scr_child_dyn_install()`);
|
|
878
|
-
const childStreamBoxes = usesChildProcess &&
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
931
|
+
const childStreamBoxes = usesChildProcess &&
|
|
932
|
+
usesStream &&
|
|
933
|
+
this.classMeta.has("%Readable") &&
|
|
934
|
+
this.classMeta.has("%Writable")
|
|
935
|
+
? [
|
|
936
|
+
this.dyn.toDynHelper({ kind: "object", className: "%Readable" }),
|
|
937
|
+
this.dyn.toDynHelper({ kind: "object", className: "%Writable" }),
|
|
938
|
+
]
|
|
882
939
|
: null;
|
|
883
940
|
if (childStreamBoxes) {
|
|
884
941
|
this.declare(`@scr_stream_child_ops = external constant { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }`);
|
|
@@ -928,7 +985,7 @@ export class LlEmitter {
|
|
|
928
985
|
// with neither keep the atexit path, so their listener timing is
|
|
929
986
|
// unchanged.
|
|
930
987
|
const hasRefGlobals = globals.some((g) => isRefCounted(g.type)) || fnValueProps.length > 0;
|
|
931
|
-
const inlineExitListeners = usesEvents && (hasRefGlobals || this.ffiHasRetainedCallback);
|
|
988
|
+
const inlineExitListeners = usesEvents && (this.mod.workers || hasRefGlobals || this.ffiHasRetainedCallback);
|
|
932
989
|
this.declare(`declare i32 @scr_exit_code_hint_get()`);
|
|
933
990
|
if (inlineExitListeners) {
|
|
934
991
|
this.declare(`declare void @scr_run_exit_listeners(double)`);
|
|
@@ -1056,7 +1113,10 @@ export class LlEmitter {
|
|
|
1056
1113
|
}
|
|
1057
1114
|
// Helpers assemble BEFORE the declaration table flushes (they add
|
|
1058
1115
|
// write/abort declarations).
|
|
1059
|
-
const helpers =
|
|
1116
|
+
const helpers = [
|
|
1117
|
+
...this.helperDefs(),
|
|
1118
|
+
...emitClassMembershipHelper(this.classMeta, this.sizeType),
|
|
1119
|
+
];
|
|
1060
1120
|
if (this.constantNumericTables.size > 0)
|
|
1061
1121
|
this.declare(`declare double @scr_arr_get_number(ptr, double)`);
|
|
1062
1122
|
const out = [
|
|
@@ -1096,11 +1156,11 @@ export class LlEmitter {
|
|
|
1096
1156
|
// scr_runtime.h's natural alignment: kind at 8, f64 at 16, b at 24,
|
|
1097
1157
|
// payload at 32).
|
|
1098
1158
|
`%ScrCaught = type { ${this.sizeType}, i32, double, i8, ptr, ptr, ptr, ptr }`,
|
|
1099
|
-
// ScrBytes { rc, len, elem(i32+pad), data, backing }. Indexed
|
|
1159
|
+
// ScrBytes { rc, len, elem(i32+pad), data, backing, brands, shared }. Indexed
|
|
1100
1160
|
// typed-array access GEPs through this directly: the IR type already
|
|
1101
1161
|
// fixes elem, so the hot path needs neither a runtime kind load nor
|
|
1102
1162
|
// the generic scr_bytes_get/set call.
|
|
1103
|
-
`%ScrBytes = type { ${this.sizeType}, ${this.sizeType}, i32, ptr, ptr, i8 }`,
|
|
1163
|
+
`%ScrBytes = type { ${this.sizeType}, ${this.sizeType}, i32, ptr, ptr, i8, i8, i8, ptr }`,
|
|
1104
1164
|
// The capture box { rc, kind, obj_retain, obj_release, obj_trace,
|
|
1105
1165
|
// slot } — TDZ reads peek the payload slot (offset 40) directly.
|
|
1106
1166
|
`%ScrBox = type { ${this.sizeType}, i32, ptr, ptr, ptr, i64 }`,
|
|
@@ -1123,8 +1183,8 @@ export class LlEmitter {
|
|
|
1123
1183
|
// objects compiled with -DSCR_THREAD_INSTANCES. Immutable interned
|
|
1124
1184
|
// data (string literals, unit arms, template arrays, vtables) stays
|
|
1125
1185
|
// shared.
|
|
1126
|
-
const tl = this.mod.lib?.threadInstances === true ? "thread_local " : "";
|
|
1127
|
-
out.push(``, `@scr_error_vts = external ${tl}global [${RUNTIME_ERROR_CLASSES.size} x %ScrVt]`, `declare void @scr_init()`, `declare void @scr_lib_init(i32, ptr)`, ...(this.runtimeAbiMarker && this.mod.lib === undefined
|
|
1186
|
+
const tl = this.mod.workers === true || this.mod.lib?.threadInstances === true ? "thread_local " : "";
|
|
1187
|
+
out.push(``, `@scr_error_vts = external ${tl}global [${RUNTIME_ERROR_CLASSES.size} x %ScrVt]`, `declare void @scr_init()`, `declare void @scr_lib_init(i32, ptr)`, ...(this.mod.workers ? [`declare void @scr_runtime_workers_v7()`] : []), ...(this.runtimeAbiMarker && this.mod.lib === undefined
|
|
1128
1188
|
? [`declare void @${RUNTIME_ABI_MARKER}()`]
|
|
1129
1189
|
: []));
|
|
1130
1190
|
for (const d of this.decls)
|
|
@@ -1169,9 +1229,7 @@ export class LlEmitter {
|
|
|
1169
1229
|
// entry points). Every dense slot is present; reads retain immortal
|
|
1170
1230
|
// strings — a no-op.
|
|
1171
1231
|
const n = inst.slots.length;
|
|
1172
|
-
const present = n === 0
|
|
1173
|
-
? "zeroinitializer"
|
|
1174
|
-
: `[ ${inst.slots.map(() => "i8 1").join(", ")} ]`;
|
|
1232
|
+
const present = n === 0 ? "zeroinitializer" : `[ ${inst.slots.map(() => "i8 1").join(", ")} ]`;
|
|
1175
1233
|
out.push(`@${inst.sym}_data = internal constant [${n} x ptr] [ ${inst.slots.map((s) => `ptr ${s}`).join(", ")} ]`, `@${inst.sym}_present = internal constant [${n} x i8] ${present}`, `@${inst.sym} = internal global %ScrArr { ${this.sizeType} -1, ${this.sizeType} ${n}, ${this.sizeType} ${n}, i32 2, ptr null, ptr null, ptr null, ptr @${inst.sym}_data, ptr @${inst.sym}_present, ptr null, ${this.sizeType} 0, ${this.sizeType} 0, ptr null, ${this.sizeType} 0, ${this.sizeType} 0, ptr null }`);
|
|
1176
1234
|
}
|
|
1177
1235
|
if (this.templateStringsInstances.size > 0)
|
|
@@ -1199,13 +1257,17 @@ export class LlEmitter {
|
|
|
1199
1257
|
const esm = stored.esm === null
|
|
1200
1258
|
? `ptr null, ${this.sizeType} 0, ${this.sizeType} 0`
|
|
1201
1259
|
: `ptr @sc_npm_esm_${i}, ${this.sizeType} ${stored.esm.bytes.length}, ${this.sizeType} ${stored.esm.raw}`;
|
|
1202
|
-
return `%ScrIslandModule { ptr @sc_npm_key_${i}, ptr @sc_npm_src_${i}, ` +
|
|
1260
|
+
return (`%ScrIslandModule { ptr @sc_npm_key_${i}, ptr @sc_npm_src_${i}, ` +
|
|
1203
1261
|
`${this.sizeType} ${stored.src.bytes.length}, ${this.sizeType} ${stored.src.raw}, ` +
|
|
1204
|
-
`i32 ${fmt[m.format]}, ${esm} }
|
|
1262
|
+
`i32 ${fmt[m.format]}, ${esm} }`);
|
|
1205
1263
|
});
|
|
1206
1264
|
out.push(`@sc_npm_modules = internal constant [${moduleRows.length} x %ScrIslandModule] [ ${moduleRows.join(", ")} ]`);
|
|
1207
1265
|
embedded.edges.forEach((edge, i) => {
|
|
1208
|
-
const parts = [
|
|
1266
|
+
const parts = [
|
|
1267
|
+
["from", edge.from],
|
|
1268
|
+
["spec", edge.specifier],
|
|
1269
|
+
["to", edge.to],
|
|
1270
|
+
];
|
|
1209
1271
|
for (const [part, text] of parts) {
|
|
1210
1272
|
const bytes = Buffer.from(text, "utf8");
|
|
1211
1273
|
out.push(`@sc_npm_edge_${i}_${part} = internal constant [${bytes.length + 1} x i8] c"${llBytes(bytes)}"`);
|
|
@@ -1260,7 +1322,10 @@ export class LlEmitter {
|
|
|
1260
1322
|
// The exception epilogue is emitted when the entry may throw.
|
|
1261
1323
|
const stamps = [...errorViews];
|
|
1262
1324
|
for (const iv of this.errorIntervals) {
|
|
1263
|
-
const fields = [
|
|
1325
|
+
const fields = [
|
|
1326
|
+
[0, iv.pre],
|
|
1327
|
+
[1, iv.post],
|
|
1328
|
+
];
|
|
1264
1329
|
for (const [field, value] of fields) {
|
|
1265
1330
|
stamps.push(` store ${this.sizeType} ${value}, ptr getelementptr inbounds ([${RUNTIME_ERROR_CLASSES.size} x %ScrVt], ptr @scr_error_vts, i64 0, i64 ${iv.kind}, i32 ${field})${field === 1 ? ` ; ${iv.lib}` : ""}`);
|
|
1266
1331
|
}
|
|
@@ -1276,7 +1341,7 @@ export class LlEmitter {
|
|
|
1276
1341
|
// The runtime stream vtables' intervals (streamVtStampLines) — the
|
|
1277
1342
|
// emitter story: instanceof and dynamic teardown dispatch through
|
|
1278
1343
|
// them.
|
|
1279
|
-
out.push(`@${iv.vt} = external global %ScrVt`);
|
|
1344
|
+
out.push(`@${iv.vt} = external ${tl}global %ScrVt`);
|
|
1280
1345
|
stamps.push(` store ${this.sizeType} ${iv.pre}, ptr getelementptr inbounds (%ScrVt, ptr @${iv.vt}, i64 0, i32 0)`, ` store ${this.sizeType} ${iv.post}, ptr getelementptr inbounds (%ScrVt, ptr @${iv.vt}, i64 0, i32 1) ; ${iv.lib}`);
|
|
1281
1346
|
}
|
|
1282
1347
|
if (this.streamIntervals.length > 0)
|
|
@@ -1313,11 +1378,15 @@ export class LlEmitter {
|
|
|
1313
1378
|
out.push(this.debug.render());
|
|
1314
1379
|
return out;
|
|
1315
1380
|
}
|
|
1316
|
-
out.push(`define i32 @${this.wasi ? "__main_argc_argv" : "main"}(i32 %argc, ptr %argv) ${FN_ATTRS} {`, `entry:`, ...(this.runtimeAbiMarker ? [` call void @${RUNTIME_ABI_MARKER}()`] : []), ` call void @scr_init()`, ...stamps,
|
|
1381
|
+
out.push(`define i32 @${this.mod.workers ? "sc_context_entry" : this.wasi ? "__main_argc_argv" : "main"}(i32 %argc, ptr %argv) ${FN_ATTRS} {`, `entry:`, ...(this.runtimeAbiMarker ? [` call void @${RUNTIME_ABI_MARKER}()`] : []), ...(this.mod.workers ? [` call void @scr_runtime_workers_v7()`] : []), ` call void @scr_init()`, ...stamps,
|
|
1317
1382
|
// Event-surface programs (signal/exit listeners) fill the loop's
|
|
1318
1383
|
// nullable event hooks before %main — scr_events.c links only when
|
|
1319
|
-
// this line is emitted (native
|
|
1320
|
-
...(usesEvents ? [` call void @scr_events_install()`] : []), ...(usesChildProcess ? [` call void @scr_child_dyn_install()`] : []), ...(childStreamBoxes
|
|
1384
|
+
// this line is emitted (native/executable.ts gates on the same predicate).
|
|
1385
|
+
...(usesEvents ? [` call void @scr_events_install()`] : []), ...(usesChildProcess ? [` call void @scr_child_dyn_install()`] : []), ...(childStreamBoxes
|
|
1386
|
+
? [
|
|
1387
|
+
` call void @scr_child_dyn_streams_install(ptr @scr_stream_child_ops, ptr @${childStreamBoxes[0]}, ptr @${childStreamBoxes[1]})`,
|
|
1388
|
+
]
|
|
1389
|
+
: []),
|
|
1321
1390
|
// fs.watch programs fill the loop's watch hooks the same way —
|
|
1322
1391
|
// scr_watch.c links only when this line is emitted.
|
|
1323
1392
|
...(usesFsWatch ? [` call void @scr_watch_install()`] : []), ...(this.ffiHasForeignCallback ? [` call void @scr_ffi_install()`] : []), ...(snapshotsTlsCa ? [` call void @scr_tls_ca_install()`] : []), ...(usesFetch ? [` call void @scr_fetch_install()`] : []), ...(embedsZlib ? [` call void @scr_zlib_island_install()`] : []), ...(embedsNet ? [` call void @scr_net_island_install()`] : []), ...(usesNet ? [` call void @scr_net_install()`, ` call void @scr_net_dyn_install()`] : []), ...(usesHttp ? [` call void @scr_http_dyn_install()`] : []), ...(usesDgram ? [` call void @scr_dgram_install()`] : []), ...(usesHttp2 ? [` call void @scr_http2_dyn_install()`] : []), ...(usesStream ? [` call void @scr_stream_install()`] : []), ` call void @scr_lib_init(i32 %argc, ptr %argv)`, ...(usesIsland
|
|
@@ -1422,6 +1491,9 @@ export class LlEmitter {
|
|
|
1422
1491
|
// lane's -fsanitize=address link activates instrumentation over the
|
|
1423
1492
|
// emitted functions too (the runtime TUs get theirs from clang).
|
|
1424
1493
|
`attributes #0 = { sanitize_address }`, ...(this.wasi ? [`attributes #1 = { sanitize_address presplitcoroutine }`] : []), ...(hasNoInlineRecordClone ? [`attributes #2 = { noinline sanitize_address }`] : []), ``);
|
|
1494
|
+
if (this.mod.workers) {
|
|
1495
|
+
out.push(`declare void @scr_context_cleanup()`, `declare i32 @scr_worker_argc()`, `declare ptr @scr_worker_argv()`, `define i32 @sc_worker_entry(i32 %root) ${FN_ATTRS} {`, `entry:`, ` %argc = call i32 @scr_worker_argc()`, ` %argv = call ptr @scr_worker_argv()`, ` %result = call i32 @sc_context_entry(i32 %argc, ptr %argv)`, ` ret i32 %result`, `}`, `define i32 @main(i32 %argc, ptr %argv) ${FN_ATTRS} {`, `entry:`, ` %result = call i32 @sc_context_entry(i32 %argc, ptr %argv)`, ` call void @scr_context_cleanup()`, ` ret i32 %result`, `}`);
|
|
1496
|
+
}
|
|
1425
1497
|
out.push(...this.fieldAliasMetadata());
|
|
1426
1498
|
if (this.debug !== null)
|
|
1427
1499
|
out.push(this.debug.render());
|
|
@@ -1530,7 +1602,9 @@ export class LlEmitter {
|
|
|
1530
1602
|
}
|
|
1531
1603
|
for (const e of lib.exports) {
|
|
1532
1604
|
const params = [];
|
|
1533
|
-
const body = [
|
|
1605
|
+
const body = [
|
|
1606
|
+
` call void @scr_library_entry(i1 zeroext ${autoReset ? "true" : "false"}, ptr ${symConst(e.symbol)})`,
|
|
1607
|
+
];
|
|
1534
1608
|
const args = [];
|
|
1535
1609
|
if (e.inboundBytesTrap !== undefined) {
|
|
1536
1610
|
// The bytes-in helper's trap message: the compiler-assembled
|
|
@@ -1687,7 +1761,7 @@ export class LlEmitter {
|
|
|
1687
1761
|
// never the inner return type.
|
|
1688
1762
|
const ret = fn.async === true || fn.generator !== undefined ? "ptr" : this.llType(fn.returnType);
|
|
1689
1763
|
const call = `call ${ret} @${this.callTarget(name)}(${args})`;
|
|
1690
|
-
out.push(`define internal ${ret} @${mangleWrapper(name)}(ptr %env${params.length ? ", " + params.join(", ") : ""}) ${FN_ATTRS} { ; ${name} as a value`, `entry:`, ret === "void" ? ` ${call}` : ` %r = ${call}`, ret === "void" ? ` ret void` : ` ret ${ret} %r`, `}`, `@${mangleFnClosure(name)} = internal global %ScrClosure { ${this.sizeType} -1, ptr @${mangleWrapper(name)}, ${this.sizeType} 0, ptr null, i32 ${(fn.generator ? 1 : 0) + (fn.async ? 2 : 0) + (fn.ownsPrototype ? 4 : 0)} }`, ``);
|
|
1764
|
+
out.push(`define internal ${ret} @${mangleWrapper(name)}(ptr %env${params.length ? ", " + params.join(", ") : ""}) ${FN_ATTRS} { ; ${name} as a value`, `entry:`, ret === "void" ? ` ${call}` : ` %r = ${call}`, ret === "void" ? ` ret void` : ` ret ${ret} %r`, `}`, `@${mangleFnClosure(name)} = internal ${this.mod.workers === true || this.mod.lib?.threadInstances === true ? "thread_local " : ""}global %ScrClosure { ${this.sizeType} -1, ptr @${mangleWrapper(name)}, ${this.sizeType} 0, ptr null, i32 ${(fn.generator ? 1 : 0) + (fn.async ? 2 : 0) + (fn.ownsPrototype ? 4 : 0)} }`, ``);
|
|
1691
1765
|
}
|
|
1692
1766
|
return out;
|
|
1693
1767
|
}
|
|
@@ -1889,7 +1963,7 @@ export class LlEmitter {
|
|
|
1889
1963
|
for (const fn of this.mod.functions) {
|
|
1890
1964
|
if (fn.generator === undefined)
|
|
1891
1965
|
continue;
|
|
1892
|
-
const { definitions, pack, lifted, fieldTys, ret, tr, spawnParams, argPackLines
|
|
1966
|
+
const { definitions, pack, lifted, fieldTys, ret, tr, spawnParams, argPackLines } = this.emitArgPackAndTrampolinePrologue(fn);
|
|
1893
1967
|
for (const line of definitions)
|
|
1894
1968
|
out.push(line);
|
|
1895
1969
|
this.declare(`declare zeroext i1 @scr_exc_genret_pending()`);
|
|
@@ -2170,6 +2244,20 @@ export class LlEmitter {
|
|
|
2170
2244
|
* using the result). Callers own the surrounding pending branch; a
|
|
2171
2245
|
* `throw` unwinds unconditionally. */
|
|
2172
2246
|
emitUnwind() {
|
|
2247
|
+
if (this.mod.workers && this.tryStack.length > 0) {
|
|
2248
|
+
this.declare(`declare zeroext i1 @scr_context_stopping()`);
|
|
2249
|
+
const stopped = this.B.tmp();
|
|
2250
|
+
this.B.line(`${stopped} = call zeroext i1 @scr_context_stopping()`);
|
|
2251
|
+
const stop = this.B.newLabel("context.stop");
|
|
2252
|
+
const ordinary = this.B.newLabel("context.throw");
|
|
2253
|
+
this.B.condBr(stopped, stop, ordinary);
|
|
2254
|
+
this.B.startBlock(stop);
|
|
2255
|
+
const handlers = this.tryStack;
|
|
2256
|
+
this.tryStack = [];
|
|
2257
|
+
this.emitUnwind();
|
|
2258
|
+
this.tryStack = handlers;
|
|
2259
|
+
this.B.startBlock(ordinary);
|
|
2260
|
+
}
|
|
2173
2261
|
const target = this.tryStack[this.tryStack.length - 1];
|
|
2174
2262
|
const frameDepth = target?.frameDepth ?? 0;
|
|
2175
2263
|
const scopeDepth = target?.scopeDepth ?? 0;
|
|
@@ -2185,9 +2273,14 @@ export class LlEmitter {
|
|
|
2185
2273
|
}
|
|
2186
2274
|
else {
|
|
2187
2275
|
const t = this.currentReturnType;
|
|
2188
|
-
terminator =
|
|
2189
|
-
|
|
2190
|
-
|
|
2276
|
+
terminator =
|
|
2277
|
+
t.kind === "void"
|
|
2278
|
+
? "ret void"
|
|
2279
|
+
: t.kind === "f64" || t.kind === "date"
|
|
2280
|
+
? `ret double ${f64Lit(0)}`
|
|
2281
|
+
: t.kind === "bool"
|
|
2282
|
+
? "ret i1 false"
|
|
2283
|
+
: "ret ptr null";
|
|
2191
2284
|
}
|
|
2192
2285
|
// Copy the entries now: later declarations extend these lexical scopes.
|
|
2193
2286
|
// Release order and the handler are part of the shared block's identity.
|
|
@@ -2228,6 +2321,34 @@ export class LlEmitter {
|
|
|
2228
2321
|
this.emitUnwind();
|
|
2229
2322
|
B.startBlock(lk);
|
|
2230
2323
|
}
|
|
2324
|
+
workerLoopBudget() {
|
|
2325
|
+
if (!this.mod.workers)
|
|
2326
|
+
return null;
|
|
2327
|
+
const slot = this.B.slot();
|
|
2328
|
+
this.B.entryAllocas.push(`${slot} = alloca i32 ; worker cancellation budget`);
|
|
2329
|
+
this.B.line(`store i32 0, ptr ${slot}`);
|
|
2330
|
+
return slot;
|
|
2331
|
+
}
|
|
2332
|
+
emitWorkerLoopCheck(slot) {
|
|
2333
|
+
if (slot === null)
|
|
2334
|
+
return;
|
|
2335
|
+
const B = this.B;
|
|
2336
|
+
const budget = B.tmp(), due = B.tmp(), remaining = B.tmp();
|
|
2337
|
+
const poll = B.newLabel("worker.poll"), next = B.newLabel("worker.next");
|
|
2338
|
+
B.line(`${budget} = load i32, ptr ${slot}`);
|
|
2339
|
+
B.line(`${remaining} = sub i32 ${budget}, 1`);
|
|
2340
|
+
B.line(`store i32 ${remaining}, ptr ${slot}`);
|
|
2341
|
+
B.line(`${due} = icmp eq i32 ${budget}, 0`);
|
|
2342
|
+
B.condBr(due, poll, next);
|
|
2343
|
+
B.startBlock(poll);
|
|
2344
|
+
B.line(`store i32 63, ptr ${slot}`);
|
|
2345
|
+
// Calls and throwing operations retain their own checks. Amortize the
|
|
2346
|
+
// extra cancellation poll across bounded loop batches so scalar work
|
|
2347
|
+
// does not cross the runtime ABI on every iteration.
|
|
2348
|
+
this.emitPendingCheck();
|
|
2349
|
+
B.br(next);
|
|
2350
|
+
B.startBlock(next);
|
|
2351
|
+
}
|
|
2231
2352
|
/** Moves an already-evaluated value into the runtime's exception cell —
|
|
2232
2353
|
* the `throw` statement's kind dispatch (stmts.ts's), shared with
|
|
2233
2354
|
* every synthetic thrower. Ownership of a refcounted payload must have
|
|
@@ -2258,7 +2379,10 @@ export class LlEmitter {
|
|
|
2258
2379
|
this.declare(`declare void @scr_throw_obj(ptr, ptr, ptr, ptr)`);
|
|
2259
2380
|
B.line(`call void @scr_throw_obj(ptr ${v.name}, ptr ${rc.retain}, ptr ${rc.release}, ptr ${traceArg(this.shapeHost, t)})`);
|
|
2260
2381
|
}
|
|
2261
|
-
else if (t.kind === "symbol" ||
|
|
2382
|
+
else if (t.kind === "symbol" ||
|
|
2383
|
+
t.kind === "bigint" ||
|
|
2384
|
+
t.kind === "func" ||
|
|
2385
|
+
t.kind === "classval") {
|
|
2262
2386
|
const rc = vAdapters(this.shapeHost, t);
|
|
2263
2387
|
this.declare(`declare void @scr_throw_primitive_ref(ptr, ptr, ptr, ptr)`);
|
|
2264
2388
|
B.line(`call void @scr_throw_primitive_ref(ptr ${v.name}, ptr ${rc.retain}, ptr ${rc.release}, ptr null)`);
|
|
@@ -2929,6 +3053,20 @@ export class LlEmitter {
|
|
|
2929
3053
|
this.unwindCleanups.clear();
|
|
2930
3054
|
this.jumpTargets = [];
|
|
2931
3055
|
this.currentLocals = new Map(fn.locals.map((l) => [l.id, l]));
|
|
3056
|
+
this.currentConstantCallbacks =
|
|
3057
|
+
this.debug === null ? (this.constantCallbacks.get(fn.name) ?? new Map()) : new Map();
|
|
3058
|
+
// Preserve concrete source bindings for debugger inspection. Suspended
|
|
3059
|
+
// functions keep the established array lifetime across continuations.
|
|
3060
|
+
this.streamingSplitsEnabled = this.debug === null && !fn.async && !fn.generator;
|
|
3061
|
+
this.stackCallbacks.reset(this.streamingSplitsEnabled);
|
|
3062
|
+
this.stackCaptures.reset(fn, this.streamingSplitsEnabled);
|
|
3063
|
+
this.privateSplitLocals = this.streamingSplitsEnabled ? findPrivateSplitLocals(fn) : new Map();
|
|
3064
|
+
this.storedSplits.clear();
|
|
3065
|
+
this.splitSpans.clear();
|
|
3066
|
+
this.stringSlices.clear();
|
|
3067
|
+
const initializerBindings = this.initializerBindings.get(fn.name) ?? [];
|
|
3068
|
+
const numericFn = withInitializerBindings(fn, initializerBindings);
|
|
3069
|
+
this.numericLocals = new Map(numericFn.locals.map((l) => [l.id, l]));
|
|
2932
3070
|
this.borrowedParameters.clear();
|
|
2933
3071
|
this.stableCallBindings = this.callLifetimes.bindings.get(fn.name) ?? new Set();
|
|
2934
3072
|
const borrowedParameterIndexes = this.callLifetimes.borrowed.get(fn.name);
|
|
@@ -2939,15 +3077,28 @@ export class LlEmitter {
|
|
|
2939
3077
|
this.captureIds = new Set([...(fn.captures ?? []), ...(fn.classCaptures ?? [])].map((c) => c.localId));
|
|
2940
3078
|
this.integerLoopBindings.clear();
|
|
2941
3079
|
this.countedLoopsEnabled = this.debug === null && !fn.async && !fn.generator;
|
|
3080
|
+
this.byteWindowsEnabled = this.countedLoopsEnabled;
|
|
3081
|
+
this.byteWindowEntries =
|
|
3082
|
+
this.byteWindowsEnabled && numericFn.locals.some((l) => l.type.kind === "bytes")
|
|
3083
|
+
? findInitializedByteLoopBindings(fn)
|
|
3084
|
+
: new Map();
|
|
2942
3085
|
this.integerViews.clear();
|
|
2943
3086
|
this.fieldPointerTags.clear();
|
|
2944
3087
|
this.integerArrayBindings.clear();
|
|
2945
|
-
this.
|
|
3088
|
+
this.loopArrayBorrows =
|
|
3089
|
+
this.debug === null
|
|
3090
|
+
? findLoopArrayBorrows(fn, this.callLifetimes, this.referenceEffects, this.optionalArrayReads)
|
|
3091
|
+
: new Set();
|
|
3092
|
+
this.localArrayReads = findLocalArrayReads(fn, this.fnByName, this.unionsById, this.referenceEffects.functions, this.callLifetimes, this.optionalArrayReads, this.loopArrayBorrows);
|
|
2946
3093
|
this.callArrayReads = findCallArrayReads(fn, this.optionalArrayReads, this.referenceEffects.functions, this.callLifetimes);
|
|
3094
|
+
this.scalarStringSlices =
|
|
3095
|
+
this.debug === null ? findScalarStringSlices(fn, this.callLifetimes) : new Map();
|
|
2947
3096
|
this.mapReadLifetimes = findMapReadLifetimes(fn, this.unionsById, this.callLifetimes);
|
|
2948
3097
|
this.localStackUnions = findLocalStackUnions(fn, this.callLifetimes, this.unionsById);
|
|
2949
|
-
this.
|
|
2950
|
-
this.
|
|
3098
|
+
this.localUnionStorageProofs = findLocalUnionStorage(fn, this.callLifetimes, this.unionsById);
|
|
3099
|
+
this.localUnionStorage = new Map();
|
|
3100
|
+
this.integerRanges = analyzeIntegerRanges(numericFn);
|
|
3101
|
+
this.bytesBounds = findBytesBounds(numericFn, this.integerRanges);
|
|
2951
3102
|
this.chainSlots.clear();
|
|
2952
3103
|
this.finallyStack = [];
|
|
2953
3104
|
this.tryStack = [];
|
|
@@ -2990,12 +3141,19 @@ export class LlEmitter {
|
|
|
2990
3141
|
}
|
|
2991
3142
|
const paramIds = new Set(fn.params.map((p) => p.localId));
|
|
2992
3143
|
if (this.debug === null) {
|
|
2993
|
-
for (const id of findIntegerViews(
|
|
3144
|
+
for (const id of findIntegerViews(numericFn)) {
|
|
2994
3145
|
const slot = B.slot();
|
|
2995
|
-
B.entryAllocas.push(`${slot} = alloca i32 ; integer view ${this.
|
|
3146
|
+
B.entryAllocas.push(`${slot} = alloca i32 ; integer view ${this.numericLocals.get(id).name}`);
|
|
2996
3147
|
this.integerViews.set(id, slot);
|
|
2997
3148
|
}
|
|
2998
3149
|
}
|
|
3150
|
+
for (const global of initializerBindings) {
|
|
3151
|
+
if (!this.integerViews.has(global.id))
|
|
3152
|
+
continue;
|
|
3153
|
+
const value = B.tmp();
|
|
3154
|
+
B.line(`${value} = load double, ptr @${mangleGlobal(global.id)}`);
|
|
3155
|
+
this.storeIntegerView(global.id, { name: value, type: global.type });
|
|
3156
|
+
}
|
|
2999
3157
|
for (const local of fn.locals) {
|
|
3000
3158
|
// Boxed locals' slots hold their capture BOX (a ptr); captured
|
|
3001
3159
|
// (env-borrowed) locals bind the incoming box below. A caught-typed
|
|
@@ -3073,6 +3231,8 @@ export class LlEmitter {
|
|
|
3073
3231
|
B.line(`call void @scr_stack_enter(ptr %source_frame, ptr ${this.cstr(frame)})`);
|
|
3074
3232
|
B.returnEpilogue = `call void @scr_stack_leave(ptr %source_frame)`;
|
|
3075
3233
|
}
|
|
3234
|
+
if (this.mod.workers)
|
|
3235
|
+
this.emitPendingCheck();
|
|
3076
3236
|
this.emitStmts(fn.body);
|
|
3077
3237
|
// Implicit exit of a void function: release the function scope unless
|
|
3078
3238
|
// the body already terminated its final block (return, or a throw
|
|
@@ -3163,16 +3323,23 @@ export class LlEmitter {
|
|
|
3163
3323
|
return `define internal ${ret} @${mangleFunction(fn.name)}(${params.join(", ")}) ${FN_ATTRS} {\n${B.render()}\n}`;
|
|
3164
3324
|
}
|
|
3165
3325
|
/** A local stable binding keeps its value alive while later arguments
|
|
3166
|
-
* and the callee execute.
|
|
3167
|
-
*
|
|
3326
|
+
* and the callee execute. A proven local union box cannot escape or be
|
|
3327
|
+
* rebound during a call; its independent payload owner keeps it alive.
|
|
3328
|
+
* Other writable bindings need an owned snapshot. */
|
|
3168
3329
|
canBorrowCallArgument(value) {
|
|
3169
3330
|
if (value.kind === "strLit")
|
|
3170
3331
|
return true;
|
|
3171
3332
|
if (value.kind !== "varRef")
|
|
3172
3333
|
return false;
|
|
3173
3334
|
const binding = this.binding(value.localId);
|
|
3174
|
-
return binding.kind === "local" &&
|
|
3175
|
-
|
|
3335
|
+
return (binding.kind === "local" &&
|
|
3336
|
+
binding.local !== undefined &&
|
|
3337
|
+
(!binding.local.mutable ||
|
|
3338
|
+
this.stableCallBindings.has(value.localId) ||
|
|
3339
|
+
this.borrowedParameters.has(value.localId) ||
|
|
3340
|
+
this.localUnionStorage.has(value.localId)) &&
|
|
3341
|
+
!binding.local.boxed &&
|
|
3342
|
+
!binding.local.tdz);
|
|
3176
3343
|
}
|
|
3177
3344
|
// ── statements ──────────────────────────────────────────────────────────
|
|
3178
3345
|
emitStmts(stmts) {
|
|
@@ -3216,13 +3383,30 @@ export class LlEmitter {
|
|
|
3216
3383
|
switch (s.kind) {
|
|
3217
3384
|
case "varDecl": {
|
|
3218
3385
|
const b = this.binding(s.localId);
|
|
3386
|
+
const slice = this.scalarStringSlices.get(s.localId);
|
|
3387
|
+
if (slice) {
|
|
3388
|
+
const snapshot = emitStringSliceSnapshot(this, slice);
|
|
3389
|
+
this.stringSlices.set(s.localId, snapshot);
|
|
3390
|
+
this.scopes[this.scopes.length - 1].push({ slot: snapshot.source, type: STRING });
|
|
3391
|
+
break;
|
|
3392
|
+
}
|
|
3393
|
+
const split = this.privateSplitLocals.get(s.localId);
|
|
3394
|
+
if (split) {
|
|
3395
|
+
const snapshot = storeSplitSnapshot(this, emitSplitSnapshot(this, split));
|
|
3396
|
+
this.storedSplits.set(s.localId, snapshot);
|
|
3397
|
+
this.scopes[this.scopes.length - 1].push({ slot: snapshot.sourceSlot, type: STRING }, { slot: snapshot.separatorSlot, type: STRING });
|
|
3398
|
+
break;
|
|
3399
|
+
}
|
|
3219
3400
|
const localUnion = this.localStackUnions.get(s.localId);
|
|
3220
3401
|
if (localUnion) {
|
|
3221
3402
|
const union = emitStackUnion(this, localUnion);
|
|
3222
3403
|
B.line(`store ptr ${union.value.name}, ptr ${b.slot}`);
|
|
3223
3404
|
if (union.payload) {
|
|
3224
3405
|
this.moveTemp(union.payload);
|
|
3225
|
-
this.scopes[this.scopes.length - 1].push({
|
|
3406
|
+
this.scopes[this.scopes.length - 1].push({
|
|
3407
|
+
slot: union.payloadSlot,
|
|
3408
|
+
type: union.payload.type,
|
|
3409
|
+
});
|
|
3226
3410
|
}
|
|
3227
3411
|
break;
|
|
3228
3412
|
}
|
|
@@ -3241,7 +3425,33 @@ export class LlEmitter {
|
|
|
3241
3425
|
this.scopes[this.scopes.length - 1].push(result.owner);
|
|
3242
3426
|
break;
|
|
3243
3427
|
}
|
|
3428
|
+
const localStorage = this.localUnionStorageProofs.get(s.localId);
|
|
3429
|
+
if (localStorage && s.init) {
|
|
3430
|
+
const storage = allocateLocalUnion(this, localStorage);
|
|
3431
|
+
this.localUnionStorage.set(s.localId, storage);
|
|
3432
|
+
storeLocalUnion(this, storage, s.init);
|
|
3433
|
+
B.line(`store ptr ${storage.box}, ptr ${b.slot}`);
|
|
3434
|
+
if (storage.owner && storage.ownerType)
|
|
3435
|
+
this.scopes[this.scopes.length - 1].push({
|
|
3436
|
+
slot: storage.owner,
|
|
3437
|
+
type: storage.ownerType,
|
|
3438
|
+
});
|
|
3439
|
+
break;
|
|
3440
|
+
}
|
|
3244
3441
|
if (b.kind === "boxed") {
|
|
3442
|
+
const stack = this.stackCaptures.emit(this, s.localId, b.type);
|
|
3443
|
+
if (stack) {
|
|
3444
|
+
B.line(`store ptr ${stack.box}, ptr ${b.slot}`);
|
|
3445
|
+
if (stack.owner)
|
|
3446
|
+
this.scopes[this.scopes.length - 1].push(stack.owner);
|
|
3447
|
+
if (s.init) {
|
|
3448
|
+
const value = this.emitExpr(s.init);
|
|
3449
|
+
if (isRefCounted(value.type))
|
|
3450
|
+
this.moveTemp(value);
|
|
3451
|
+
this.boxSet(stack.box, b.type, value.name);
|
|
3452
|
+
}
|
|
3453
|
+
break;
|
|
3454
|
+
}
|
|
3245
3455
|
// Box FIRST, then evaluate the initializer: a named function
|
|
3246
3456
|
// expression's closure captures this box during init evaluation.
|
|
3247
3457
|
// A SCALAR TDZ box rides an ARR-kind box: the value lives in a
|
|
@@ -3278,12 +3488,19 @@ export class LlEmitter {
|
|
|
3278
3488
|
}
|
|
3279
3489
|
break;
|
|
3280
3490
|
}
|
|
3281
|
-
|
|
3491
|
+
if (this.loopArrayBorrows.has(s) && s.init.kind === "arrayGet") {
|
|
3492
|
+
emitBorrowedArrayRead(this, s.init, b.slot);
|
|
3493
|
+
break;
|
|
3494
|
+
}
|
|
3495
|
+
// A stable lexical alias cannot outlive its unchanged local owner.
|
|
3282
3496
|
// Whole-value uses still retain their own copies, so returning or
|
|
3283
3497
|
// storing the alias preserves the ordinary heap representation.
|
|
3284
3498
|
// Boxed captures, reassigned sources and projections need ownership.
|
|
3285
|
-
if (b.kind === "local" &&
|
|
3286
|
-
|
|
3499
|
+
if (b.kind === "local" &&
|
|
3500
|
+
b.local &&
|
|
3501
|
+
isRefCounted(b.type) &&
|
|
3502
|
+
this.stableCallBindings.has(s.localId) &&
|
|
3503
|
+
this.canBorrowCallArgument(s.init)) {
|
|
3287
3504
|
const v = this.emitReadReceiver(s.init);
|
|
3288
3505
|
B.line(`store ptr ${v.name}, ptr ${b.slot}`);
|
|
3289
3506
|
break;
|
|
@@ -3298,6 +3515,11 @@ export class LlEmitter {
|
|
|
3298
3515
|
break;
|
|
3299
3516
|
}
|
|
3300
3517
|
case "assign": {
|
|
3518
|
+
const localStorage = this.localUnionStorage.get(s.localId);
|
|
3519
|
+
if (localStorage) {
|
|
3520
|
+
storeLocalUnion(this, localStorage, s.value);
|
|
3521
|
+
break;
|
|
3522
|
+
}
|
|
3301
3523
|
const concat = s.value;
|
|
3302
3524
|
const suffix = matchStringSelfConcat(s.localId, concat);
|
|
3303
3525
|
if (suffix && concat.kind === "strConcat") {
|
|
@@ -3390,7 +3612,9 @@ export class LlEmitter {
|
|
|
3390
3612
|
// release — a release can trigger a cycle collection, which must
|
|
3391
3613
|
// never see a heap edge whose count was already given up).
|
|
3392
3614
|
// Classes and records share the struct layout, so one emission.
|
|
3393
|
-
const obj = isRefCounted(s.value.type)
|
|
3615
|
+
const obj = isRefCounted(s.value.type)
|
|
3616
|
+
? this.emitExpr(s.obj)
|
|
3617
|
+
: this.emitStableReceiver(s.obj, [s.value]);
|
|
3394
3618
|
const v = this.emitExpr(s.value);
|
|
3395
3619
|
const { ptr, type } = s.kind === "fieldSet"
|
|
3396
3620
|
? this.classFieldPtr(obj.name, s.className, s.field)
|
|
@@ -3405,7 +3629,9 @@ export class LlEmitter {
|
|
|
3405
3629
|
else {
|
|
3406
3630
|
this.storeField(ptr, type, v.name);
|
|
3407
3631
|
}
|
|
3408
|
-
if (s.kind === "fieldSet" &&
|
|
3632
|
+
if (s.kind === "fieldSet" &&
|
|
3633
|
+
s.field === "name" &&
|
|
3634
|
+
this.classMeta.get(s.className)?.root.def.name === "%Error") {
|
|
3409
3635
|
const present = this.classFieldPtr(obj.name, s.className, "%namePresent").ptr;
|
|
3410
3636
|
const enumerable = this.classFieldPtr(obj.name, s.className, "%nameEnumerable").ptr;
|
|
3411
3637
|
const wasPresent = B.tmp(), wasEnumerable = B.tmp(), isPresent = B.tmp(), nextEnumerable = B.tmp();
|
|
@@ -3602,11 +3828,13 @@ export class LlEmitter {
|
|
|
3602
3828
|
break;
|
|
3603
3829
|
}
|
|
3604
3830
|
case "while": {
|
|
3831
|
+
const workerBudget = this.workerLoopBudget();
|
|
3605
3832
|
const lc = B.newLabel("loop.c");
|
|
3606
3833
|
const lb = B.newLabel("loop.b");
|
|
3607
3834
|
const le = B.newLabel("loop.e");
|
|
3608
3835
|
B.br(lc);
|
|
3609
3836
|
B.startBlock(lc);
|
|
3837
|
+
this.emitWorkerLoopCheck(workerBudget);
|
|
3610
3838
|
B.condBr(this.emitCondition(s.cond), lb, le);
|
|
3611
3839
|
B.startBlock(lb);
|
|
3612
3840
|
this.jumpTargets.push({
|
|
@@ -3625,12 +3853,14 @@ export class LlEmitter {
|
|
|
3625
3853
|
break;
|
|
3626
3854
|
}
|
|
3627
3855
|
case "doWhile": {
|
|
3856
|
+
const workerBudget = this.workerLoopBudget();
|
|
3628
3857
|
// Body first (runs at least once); continue jumps to the CONDITION.
|
|
3629
3858
|
const lb = B.newLabel("loop.b");
|
|
3630
3859
|
const lc = B.newLabel("loop.c");
|
|
3631
3860
|
const le = B.newLabel("loop.e");
|
|
3632
3861
|
B.br(lb);
|
|
3633
3862
|
B.startBlock(lb);
|
|
3863
|
+
this.emitWorkerLoopCheck(workerBudget);
|
|
3634
3864
|
this.jumpTargets.push({
|
|
3635
3865
|
kind: "loop",
|
|
3636
3866
|
brkLabel: le,
|
|
@@ -3651,9 +3881,41 @@ export class LlEmitter {
|
|
|
3651
3881
|
case "for": {
|
|
3652
3882
|
// The init's scope wraps the whole loop (break/continue must NOT
|
|
3653
3883
|
// release it — scopeDepth captured after the push, C parity).
|
|
3654
|
-
const integerArrayLoop = this.debug === null
|
|
3655
|
-
|
|
3656
|
-
|
|
3884
|
+
const integerArrayLoop = this.debug === null
|
|
3885
|
+
? matchIntegerArrayForLoop(s, this.currentLocals, this.integerArrayBindings)
|
|
3886
|
+
: null;
|
|
3887
|
+
const integerLoop = integerArrayLoop ??
|
|
3888
|
+
(this.debug === null ? matchIntegerBytesForLoop(s, this.numericLocals) : null);
|
|
3889
|
+
const countedLoop = !integerLoop && this.countedLoopsEnabled
|
|
3890
|
+
? matchIntegerCountedForLoop(s, this.numericLocals, this.integerRanges)
|
|
3891
|
+
: null;
|
|
3892
|
+
const window = countedLoop && this.byteWindowsEnabled
|
|
3893
|
+
? matchByteWindow(s, countedLoop, this.numericLocals, this.captureIds, this.integerRanges, this.byteWindowEntries.get(s) ?? new Set())
|
|
3894
|
+
: null;
|
|
3895
|
+
if (window) {
|
|
3896
|
+
const valid = emitByteWindowGuard(this, window);
|
|
3897
|
+
const fast = B.newLabel("bytes.window.fast"), slow = B.newLabel("bytes.window.slow"), done = B.newLabel("bytes.window.done");
|
|
3898
|
+
B.condBr(valid, fast, slow);
|
|
3899
|
+
const originalRanges = this.integerRanges, originalBounds = this.bytesBounds;
|
|
3900
|
+
this.byteWindowsEnabled = false;
|
|
3901
|
+
try {
|
|
3902
|
+
B.startBlock(slow);
|
|
3903
|
+
this.emitStmt(s);
|
|
3904
|
+
B.br(done);
|
|
3905
|
+
B.startBlock(fast);
|
|
3906
|
+
this.integerRanges = window.ranges;
|
|
3907
|
+
this.bytesBounds = new Set([...originalBounds, ...window.bounds]);
|
|
3908
|
+
this.emitStmt(s);
|
|
3909
|
+
B.br(done);
|
|
3910
|
+
}
|
|
3911
|
+
finally {
|
|
3912
|
+
this.integerRanges = originalRanges;
|
|
3913
|
+
this.bytesBounds = originalBounds;
|
|
3914
|
+
this.byteWindowsEnabled = true;
|
|
3915
|
+
}
|
|
3916
|
+
B.startBlock(done);
|
|
3917
|
+
break;
|
|
3918
|
+
}
|
|
3657
3919
|
let countedJoin = null;
|
|
3658
3920
|
if (countedLoop?.guarded) {
|
|
3659
3921
|
const bound = this.emitExpr(countedLoop.limit);
|
|
@@ -3684,8 +3946,11 @@ export class LlEmitter {
|
|
|
3684
3946
|
this.integerArrayBindings.add(integerLoop.localId);
|
|
3685
3947
|
}
|
|
3686
3948
|
B.line(`store ${this.sizeType} ${start}, ptr ${integerSlot}`);
|
|
3687
|
-
this.integerLoopBindings.set(integerLoop.localId, {
|
|
3688
|
-
|
|
3949
|
+
this.integerLoopBindings.set(integerLoop.localId, {
|
|
3950
|
+
slot: integerSlot,
|
|
3951
|
+
type: this.sizeType,
|
|
3952
|
+
range: { min: 0, max: integerArrayLoop ? 4294967294 : Number.MAX_SAFE_INTEGER - 1 },
|
|
3953
|
+
});
|
|
3689
3954
|
}
|
|
3690
3955
|
else if (countedLoop) {
|
|
3691
3956
|
integerSlot = B.slot();
|
|
@@ -3694,7 +3959,12 @@ export class LlEmitter {
|
|
|
3694
3959
|
const start = B.tmp();
|
|
3695
3960
|
B.line(`${start} = fptosi double ${startNumber.name} to i64`);
|
|
3696
3961
|
B.line(`store i64 ${start}, ptr ${integerSlot}`);
|
|
3697
|
-
this.integerLoopBindings.set(countedLoop.localId, {
|
|
3962
|
+
this.integerLoopBindings.set(countedLoop.localId, {
|
|
3963
|
+
slot: integerSlot,
|
|
3964
|
+
type: "i64",
|
|
3965
|
+
signed: true,
|
|
3966
|
+
range: countedLoop.range,
|
|
3967
|
+
});
|
|
3698
3968
|
countedLimit = emitCountedLoopLimit(this, countedLoop);
|
|
3699
3969
|
}
|
|
3700
3970
|
else if (s.init) {
|
|
@@ -3734,8 +4004,10 @@ export class LlEmitter {
|
|
|
3734
4004
|
};
|
|
3735
4005
|
const lu = s.update || capturedLets.length > 0 ? B.newLabel("loop.u") : lc;
|
|
3736
4006
|
freshenBindings();
|
|
4007
|
+
const workerBudget = this.workerLoopBudget();
|
|
3737
4008
|
B.br(lc);
|
|
3738
4009
|
B.startBlock(lc);
|
|
4010
|
+
this.emitWorkerLoopCheck(workerBudget);
|
|
3739
4011
|
if (integerLoop && integerSlot) {
|
|
3740
4012
|
const receiver = this.emitStableReceiver(integerLoop.limitReceiver, []);
|
|
3741
4013
|
const lenPtr = B.tmp();
|
|
@@ -3817,23 +4089,49 @@ export class LlEmitter {
|
|
|
3817
4089
|
if (s.iterable.type.kind !== "array")
|
|
3818
4090
|
throw new LlvmUnsupportedError(`forOf:${s.iterable.type.kind}`, s.loc);
|
|
3819
4091
|
const elem = s.iterable.type.elem;
|
|
3820
|
-
const
|
|
3821
|
-
const
|
|
3822
|
-
|
|
3823
|
-
|
|
4092
|
+
const stored = s.iterable.kind === "varRef" ? this.storedSplits.get(s.iterable.localId) : undefined;
|
|
4093
|
+
const direct = this.streamingSplitsEnabled ? stringSplit(s.iterable) : null;
|
|
4094
|
+
const snapshot = stored
|
|
4095
|
+
? loadSplitSnapshot(this, stored)
|
|
4096
|
+
: direct
|
|
4097
|
+
? emitSplitSnapshot(this, direct)
|
|
4098
|
+
: null;
|
|
4099
|
+
const arr = snapshot ? null : this.emitExpr(s.iterable);
|
|
4100
|
+
const cursor = snapshot ? emitSplitCursor(this, snapshot) : null;
|
|
4101
|
+
const scratch = snapshot ? emitSplitScratch(this) : null;
|
|
4102
|
+
const deferred = snapshot && canDeferSplitPiece(s, this.currentLocals.get(s.localId));
|
|
4103
|
+
const spanLength = deferred ? B.slot() : null;
|
|
4104
|
+
if (spanLength)
|
|
4105
|
+
B.entryAllocas.push(`${spanLength} = alloca ${this.sizeType}`);
|
|
4106
|
+
const idxSlot = snapshot ? null : B.slot();
|
|
4107
|
+
if (idxSlot) {
|
|
4108
|
+
B.entryAllocas.push(`${idxSlot} = alloca double`);
|
|
4109
|
+
B.line(`store double ${f64Lit(0)}, ptr ${idxSlot}`);
|
|
4110
|
+
}
|
|
3824
4111
|
const lc = B.newLabel("fof.c");
|
|
3825
4112
|
const lb = B.newLabel("fof.b");
|
|
3826
4113
|
const lu = B.newLabel("fof.u");
|
|
3827
4114
|
const le = B.newLabel("fof.e");
|
|
4115
|
+
const workerBudget = this.workerLoopBudget();
|
|
3828
4116
|
B.br(lc);
|
|
3829
4117
|
B.startBlock(lc);
|
|
3830
|
-
|
|
3831
|
-
const len = B.tmp();
|
|
4118
|
+
this.emitWorkerLoopCheck(workerBudget);
|
|
3832
4119
|
const inBounds = B.tmp();
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
4120
|
+
let cur;
|
|
4121
|
+
if (snapshot && cursor && scratch) {
|
|
4122
|
+
cur = spanLength
|
|
4123
|
+
? emitSplitSpanNext(this, snapshot, cursor, spanLength)
|
|
4124
|
+
: emitSplitNext(this, snapshot, cursor, scratch);
|
|
4125
|
+
B.line(`${inBounds} = icmp ne ptr ${cur}, null`);
|
|
4126
|
+
}
|
|
4127
|
+
else {
|
|
4128
|
+
const i = B.tmp(), len = B.tmp();
|
|
4129
|
+
this.declare(`declare double @scr_arr_len(ptr)`);
|
|
4130
|
+
B.line(`${i} = load double, ptr ${idxSlot}`);
|
|
4131
|
+
B.line(`${len} = call double @scr_arr_len(ptr ${arr.name})`);
|
|
4132
|
+
B.line(`${inBounds} = fcmp olt double ${i}, ${len}`);
|
|
4133
|
+
cur = i;
|
|
4134
|
+
}
|
|
3837
4135
|
B.condBr(inBounds, lb, le);
|
|
3838
4136
|
B.startBlock(lb);
|
|
3839
4137
|
this.jumpTargets.push({
|
|
@@ -3851,11 +4149,22 @@ export class LlEmitter {
|
|
|
3851
4149
|
this.scopes.push([]);
|
|
3852
4150
|
const localInfo = this.currentLocals.get(s.localId);
|
|
3853
4151
|
const slot = `%${mangleLocal(s.localId)}`;
|
|
3854
|
-
const
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
4152
|
+
const borrowedElement = !snapshot && this.loopArrayBorrows.has(s);
|
|
4153
|
+
if (!snapshot) {
|
|
4154
|
+
const acc = elemAccess(elem);
|
|
4155
|
+
const accTy = acc === "f64" ? "double" : acc === "bool" ? "i1" : "ptr";
|
|
4156
|
+
const getter = borrowedElement ? "scr_arr_borrow_ref" : `scr_arr_get_${acc}`;
|
|
4157
|
+
this.declare(`declare ${acc === "bool" ? "zeroext i1" : accTy} @${getter}(ptr, double)`);
|
|
4158
|
+
const value = B.tmp();
|
|
4159
|
+
B.line(`${value} = call ${accTy} @${getter}(ptr ${arr.name}, double ${cur})`);
|
|
4160
|
+
cur = value;
|
|
4161
|
+
}
|
|
4162
|
+
if (spanLength) {
|
|
4163
|
+
const length = B.tmp();
|
|
4164
|
+
B.line(`${length} = load ${this.sizeType}, ptr ${spanLength}`);
|
|
4165
|
+
this.splitSpans.set(s.localId, { bytes: cur, length, scratch: scratch });
|
|
4166
|
+
cur = "null";
|
|
4167
|
+
}
|
|
3859
4168
|
if (localInfo?.boxed) {
|
|
3860
4169
|
// Captured loop variable: a fresh box per iteration, matching the
|
|
3861
4170
|
// fresh const binding. The box takes ownership of a ref element's
|
|
@@ -3868,10 +4177,12 @@ export class LlEmitter {
|
|
|
3868
4177
|
}
|
|
3869
4178
|
else {
|
|
3870
4179
|
B.line(`store ${this.llType(elem)} ${cur}, ptr ${slot}`);
|
|
3871
|
-
if (isRefCounted(elem))
|
|
4180
|
+
if (isRefCounted(elem) && !borrowedElement)
|
|
3872
4181
|
this.scopes[this.scopes.length - 1].push({ slot, type: elem });
|
|
3873
4182
|
}
|
|
3874
4183
|
this.emitStmts(s.body);
|
|
4184
|
+
if (spanLength)
|
|
4185
|
+
this.splitSpans.delete(s.localId);
|
|
3875
4186
|
const endedWithJump = endsWithJump(s.body);
|
|
3876
4187
|
const scope = this.scopes.pop();
|
|
3877
4188
|
if (!endedWithJump)
|
|
@@ -3879,11 +4190,12 @@ export class LlEmitter {
|
|
|
3879
4190
|
this.jumpTargets.pop();
|
|
3880
4191
|
B.br(lu);
|
|
3881
4192
|
B.startBlock(lu);
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
4193
|
+
if (idxSlot) {
|
|
4194
|
+
const i2 = B.tmp(), i3 = B.tmp();
|
|
4195
|
+
B.line(`${i2} = load double, ptr ${idxSlot}`);
|
|
4196
|
+
B.line(`${i3} = fadd double ${i2}, ${f64Lit(1)}`);
|
|
4197
|
+
B.line(`store double ${i3}, ptr ${idxSlot}`);
|
|
4198
|
+
}
|
|
3887
4199
|
B.br(lc);
|
|
3888
4200
|
B.startBlock(le);
|
|
3889
4201
|
break;
|
|
@@ -4031,7 +4343,10 @@ export class LlEmitter {
|
|
|
4031
4343
|
const frame = this.frames.pop();
|
|
4032
4344
|
// return/throw already released their frames on the jump path; the
|
|
4033
4345
|
// fall-through releases after them would be dead double-release code.
|
|
4034
|
-
if (s.kind !== "return" &&
|
|
4346
|
+
if (s.kind !== "return" &&
|
|
4347
|
+
s.kind !== "throw" &&
|
|
4348
|
+
s.kind !== "rethrow" &&
|
|
4349
|
+
s.kind !== "runtimeFence") {
|
|
4035
4350
|
this.releaseFrame(frame);
|
|
4036
4351
|
}
|
|
4037
4352
|
}
|
|
@@ -4197,7 +4512,8 @@ export class LlEmitter {
|
|
|
4197
4512
|
}
|
|
4198
4513
|
/** JS-exact switch: lazily evaluated, arbitrary-expression case tests in
|
|
4199
4514
|
* source order, bodies falling through in source order until a break —
|
|
4200
|
-
*
|
|
4515
|
+
* Literal-only tests can use native dispatch; other tests keep a chain
|
|
4516
|
+
* of conditional branches. All case bodies
|
|
4201
4517
|
* share ONE scope; because dispatch can jump PAST a varDecl into a later
|
|
4202
4518
|
* case, refcounted/boxed case-body locals are NULL-reset up front and
|
|
4203
4519
|
* the scope-exit releases rely on NULL tolerance. */
|
|
@@ -4224,33 +4540,34 @@ export class LlEmitter {
|
|
|
4224
4540
|
}
|
|
4225
4541
|
const end = B.newLabel("sw.e");
|
|
4226
4542
|
const caseLabels = s.cases.map(() => B.newLabel("sw.c"));
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4543
|
+
const defaultIdx = s.cases.findIndex((c) => c.test === null);
|
|
4544
|
+
const fallback = defaultIdx >= 0 ? caseLabels[defaultIdx] : end;
|
|
4545
|
+
if (!emitLiteralSwitch(this, disc, s.cases, caseLabels, fallback)) {
|
|
4546
|
+
s.cases.forEach((c, i) => {
|
|
4547
|
+
if (c.test === null)
|
|
4548
|
+
return;
|
|
4549
|
+
// Lazy source-order test evaluation (a test after the match never
|
|
4550
|
+
// runs). Each test's temps release right after its comparison.
|
|
4551
|
+
this.frames.push([]);
|
|
4552
|
+
const t = this.emitExpr(c.test);
|
|
4553
|
+
const hit = B.tmp();
|
|
4554
|
+
if (c.test.type.kind === "string") {
|
|
4555
|
+
this.declare(`declare zeroext i1 @scr_str_eq(ptr, ptr)`);
|
|
4556
|
+
B.line(`${hit} = call zeroext i1 @scr_str_eq(ptr ${disc.name}, ptr ${t.name})`);
|
|
4557
|
+
}
|
|
4558
|
+
else if (c.test.type.kind === "bool") {
|
|
4559
|
+
B.line(`${hit} = icmp eq i1 ${disc.name}, ${t.name}`);
|
|
4560
|
+
}
|
|
4561
|
+
else {
|
|
4562
|
+
B.line(`${hit} = fcmp oeq double ${disc.name}, ${t.name}`);
|
|
4563
|
+
}
|
|
4564
|
+
this.releaseFrame(this.frames.pop());
|
|
4565
|
+
const next = B.newLabel("sw.t");
|
|
4566
|
+
B.condBr(hit, caseLabels[i], next);
|
|
4567
|
+
B.startBlock(next);
|
|
4568
|
+
});
|
|
4569
|
+
B.br(fallback);
|
|
4570
|
+
}
|
|
4254
4571
|
this.jumpTargets.push({
|
|
4255
4572
|
kind: "switch",
|
|
4256
4573
|
brkLabel: end,
|
|
@@ -4314,7 +4631,12 @@ export class LlEmitter {
|
|
|
4314
4631
|
this.scopes.push([]);
|
|
4315
4632
|
const result = emitBorrowedFieldSequence(this, e) ?? emitOperatorExpr(this, e);
|
|
4316
4633
|
for (const local of this.scopes.pop()) {
|
|
4317
|
-
this.currentFrame().push({
|
|
4634
|
+
this.currentFrame().push({
|
|
4635
|
+
name: local.slot,
|
|
4636
|
+
type: local.type,
|
|
4637
|
+
slot: true,
|
|
4638
|
+
...(local.boxed ? { boxed: true } : {}),
|
|
4639
|
+
});
|
|
4318
4640
|
}
|
|
4319
4641
|
return result;
|
|
4320
4642
|
}
|
|
@@ -4402,16 +4724,35 @@ export class LlEmitter {
|
|
|
4402
4724
|
if (e.kind === "strLit")
|
|
4403
4725
|
return { name: this.internLiteral(e.value), type: e.type };
|
|
4404
4726
|
if (e.kind === "varRef") {
|
|
4727
|
+
this.materializeSplitLocal(e.localId);
|
|
4405
4728
|
const binding = this.binding(e.localId);
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4729
|
+
if (binding.kind === "boxed") {
|
|
4730
|
+
// A projection consumes this pointer before any user code runs.
|
|
4731
|
+
// Keep TDZ checks and caught-value conversion on the owned path.
|
|
4732
|
+
if (!this.canBorrowReceiver(e))
|
|
4733
|
+
return this.emitExpr(e);
|
|
4734
|
+
const box = this.loadBox(binding.slot);
|
|
4735
|
+
const payload = this.B.tmp();
|
|
4736
|
+
const value = this.B.tmp();
|
|
4737
|
+
this.B.line(`${payload} = getelementptr inbounds %ScrBox, ptr ${box}, i32 0, i32 5`);
|
|
4738
|
+
this.B.line(`${value} = load ptr, ptr ${payload}`);
|
|
4739
|
+
return { name: value, type: e.type };
|
|
4740
|
+
}
|
|
4409
4741
|
if (binding.kind === "global")
|
|
4410
4742
|
this.checkGlobalTdz(e.localId);
|
|
4411
4743
|
const value = this.B.tmp();
|
|
4412
4744
|
this.B.line(`${value} = load ptr, ptr ${binding.slot}`);
|
|
4413
4745
|
return { name: value, type: e.type };
|
|
4414
4746
|
}
|
|
4747
|
+
const read = matchMapRead(e, this.unionsById);
|
|
4748
|
+
if (read) {
|
|
4749
|
+
const result = emitStackMapRead(this, read);
|
|
4750
|
+
if (result.owner)
|
|
4751
|
+
this.ownSlot(result.owner.slot, result.owner.type);
|
|
4752
|
+
return result.value;
|
|
4753
|
+
}
|
|
4754
|
+
if (canStackUnion(e, this.unionsById))
|
|
4755
|
+
return emitStackUnion(this, e).value;
|
|
4415
4756
|
if (e.kind === "unionNarrow") {
|
|
4416
4757
|
const union = this.emitReadReceiver(e.value);
|
|
4417
4758
|
return { name: this.unionPeek(union.name), type: e.type };
|
|
@@ -4432,7 +4773,10 @@ export class LlEmitter {
|
|
|
4432
4773
|
B.entryAllocas.push(`${slot} = alloca ptr`);
|
|
4433
4774
|
const yes = B.newLabel("read.then"), no = B.newLabel("read.else"), join = B.newLabel("read.join");
|
|
4434
4775
|
B.condBr(cond.name, yes, no);
|
|
4435
|
-
for (const [label, value] of [
|
|
4776
|
+
for (const [label, value] of [
|
|
4777
|
+
[yes, e.then],
|
|
4778
|
+
[no, e.else_],
|
|
4779
|
+
]) {
|
|
4436
4780
|
B.startBlock(label);
|
|
4437
4781
|
this.frames.push([]);
|
|
4438
4782
|
const result = this.emitReadReceiver(value);
|
|
@@ -4449,17 +4793,34 @@ export class LlEmitter {
|
|
|
4449
4793
|
}
|
|
4450
4794
|
canBorrowReceiver(e) {
|
|
4451
4795
|
switch (e.kind) {
|
|
4452
|
-
case "varRef":
|
|
4453
|
-
|
|
4796
|
+
case "varRef": {
|
|
4797
|
+
const binding = this.binding(e.localId);
|
|
4798
|
+
return (binding.kind !== "boxed" ||
|
|
4799
|
+
(!binding.local.tdz &&
|
|
4800
|
+
binding.type.kind === e.type.kind &&
|
|
4801
|
+
e.type.kind !== "caught" &&
|
|
4802
|
+
isRefCounted(e.type)));
|
|
4803
|
+
}
|
|
4804
|
+
case "unionNarrow":
|
|
4805
|
+
return this.canBorrowReceiver(e.value);
|
|
4454
4806
|
case "fieldGet":
|
|
4455
|
-
case "recordGet":
|
|
4456
|
-
|
|
4807
|
+
case "recordGet":
|
|
4808
|
+
return this.canBorrowReceiver(e.obj);
|
|
4809
|
+
case "ternary":
|
|
4810
|
+
return this.canBorrowReceiver(e.then) && this.canBorrowReceiver(e.else_);
|
|
4457
4811
|
// The runtime always sets a pending exception; its unreachable
|
|
4458
4812
|
// typed dummy is null and owns no receiver.
|
|
4459
|
-
case "libCall":
|
|
4460
|
-
|
|
4813
|
+
case "libCall":
|
|
4814
|
+
return e.fn === "error.nodeThrow";
|
|
4815
|
+
default:
|
|
4816
|
+
return false;
|
|
4461
4817
|
}
|
|
4462
4818
|
}
|
|
4819
|
+
materializeSplitLocal(localId) {
|
|
4820
|
+
const span = this.splitSpans.get(localId);
|
|
4821
|
+
if (span)
|
|
4822
|
+
materializeSplitPiece(this, localId, span);
|
|
4823
|
+
}
|
|
4463
4824
|
emitExpr(e) {
|
|
4464
4825
|
return emitExpr(this, e);
|
|
4465
4826
|
}
|