@scriptc/compiler 0.4.8 → 0.4.9
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/node-fallback/buffer.d.ts +2 -0
- package/ambient/node-fallback/child_process.d.ts +9 -3
- package/ambient/node-fallback/dns-promises.d.ts +25 -0
- package/ambient/node-fallback/dns.d.ts +29 -0
- package/ambient/node-fallback/test.d.ts +7 -0
- package/ambient/scriptc-node-fallback.d.ts +145 -2
- package/ambient/scriptc-overrides.d.ts +22 -13
- package/dist/backend/build-cache.d.ts +1 -1
- package/dist/backend/build-cache.js +1 -1
- package/dist/backend/build-cache.js.map +1 -1
- package/dist/backend/cache-root.d.ts +7 -0
- package/dist/backend/cache-root.js +27 -0
- package/dist/backend/cache-root.js.map +1 -1
- package/dist/backend/executable-features.js +5 -1
- package/dist/backend/executable-features.js.map +1 -1
- package/dist/backend/link-plan.js +7 -1
- package/dist/backend/link-plan.js.map +1 -1
- package/dist/backend/llvm/bytes-loop-versions.d.ts +12 -1
- package/dist/backend/llvm/bytes-loop-versions.js +107 -30
- package/dist/backend/llvm/bytes-loop-versions.js.map +1 -1
- package/dist/backend/llvm/bytes-loop-versions.test.js +96 -0
- package/dist/backend/llvm/bytes-loop-versions.test.js.map +1 -1
- package/dist/backend/llvm/checked-value-lifetimes.js +1 -0
- package/dist/backend/llvm/checked-value-lifetimes.js.map +1 -1
- package/dist/backend/llvm/classes.d.ts +16 -5
- package/dist/backend/llvm/classes.js +34 -6
- package/dist/backend/llvm/classes.js.map +1 -1
- package/dist/backend/llvm/classes.test.js +21 -2
- package/dist/backend/llvm/classes.test.js.map +1 -1
- package/dist/backend/llvm/common.d.ts +9 -0
- package/dist/backend/llvm/common.js +9 -0
- package/dist/backend/llvm/common.js.map +1 -1
- package/dist/backend/llvm/cpu-dispatch.d.ts +36 -2
- package/dist/backend/llvm/cpu-dispatch.js +96 -2
- package/dist/backend/llvm/cpu-dispatch.js.map +1 -1
- package/dist/backend/llvm/dense-array-access.d.ts +5 -2
- package/dist/backend/llvm/dense-array-access.js +16 -12
- package/dist/backend/llvm/dense-array-access.js.map +1 -1
- package/dist/backend/llvm/dense-array-access.test.js +3 -1
- package/dist/backend/llvm/dense-array-access.test.js.map +1 -1
- package/dist/backend/llvm/dyn.d.ts +24 -0
- package/dist/backend/llvm/dyn.js +117 -3
- package/dist/backend/llvm/dyn.js.map +1 -1
- package/dist/backend/llvm/emit-function.js +6 -0
- package/dist/backend/llvm/emit-function.js.map +1 -1
- package/dist/backend/llvm/emit-journal.d.ts +1 -0
- package/dist/backend/llvm/emit-journal.js.map +1 -1
- package/dist/backend/llvm/emit-module.js +48 -5
- package/dist/backend/llvm/emit-module.js.map +1 -1
- package/dist/backend/llvm/emit-module.test.js +41 -0
- package/dist/backend/llvm/emit-module.test.js.map +1 -1
- package/dist/backend/llvm/emit-statements.js +11 -0
- package/dist/backend/llvm/emit-statements.js.map +1 -1
- package/dist/backend/llvm/emitter.d.ts +87 -7
- package/dist/backend/llvm/emitter.js +136 -15
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/backend/llvm/expr-async.js +28 -6
- package/dist/backend/llvm/expr-async.js.map +1 -1
- package/dist/backend/llvm/expr-containers.js +19 -5
- package/dist/backend/llvm/expr-containers.js.map +1 -1
- package/dist/backend/llvm/expr-dynamic.js +29 -1
- package/dist/backend/llvm/expr-dynamic.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.js +104 -6
- package/dist/backend/llvm/expr-primitives.js.map +1 -1
- package/dist/backend/llvm/expr-records.js +15 -1
- package/dist/backend/llvm/expr-records.js.map +1 -1
- package/dist/backend/llvm/expr-stream-bridges.js +53 -5
- package/dist/backend/llvm/expr-stream-bridges.js.map +1 -1
- package/dist/backend/llvm/inline-arrays.js +1 -1
- package/dist/backend/llvm/inline-arrays.js.map +1 -1
- package/dist/backend/llvm/js-ic.js +126 -2
- package/dist/backend/llvm/js-ic.js.map +1 -1
- package/dist/backend/llvm/lanes.d.ts +38 -0
- package/dist/backend/llvm/lanes.js +778 -0
- package/dist/backend/llvm/lanes.js.map +1 -0
- package/dist/backend/llvm/lanes.test.d.ts +1 -0
- package/dist/backend/llvm/lanes.test.js +402 -0
- package/dist/backend/llvm/lanes.test.js.map +1 -0
- package/dist/backend/llvm/lib-dispatch.js +9 -4
- package/dist/backend/llvm/lib-dispatch.js.map +1 -1
- package/dist/backend/llvm/lib-network.js +20 -0
- package/dist/backend/llvm/lib-network.js.map +1 -1
- package/dist/backend/llvm/lib-shared.js +27 -0
- package/dist/backend/llvm/lib-shared.js.map +1 -1
- package/dist/backend/llvm/lib-test.js +11 -0
- package/dist/backend/llvm/lib-test.js.map +1 -1
- package/dist/backend/llvm/local-array-reads.js +2 -2
- package/dist/backend/llvm/local-array-reads.js.map +1 -1
- package/dist/backend/llvm/map-number-lookup.js +8 -2
- package/dist/backend/llvm/map-number-lookup.js.map +1 -1
- package/dist/backend/llvm/nullable-unions.js +5 -2
- package/dist/backend/llvm/nullable-unions.js.map +1 -1
- package/dist/backend/llvm/publish.d.ts +3 -0
- package/dist/backend/llvm/publish.js +2 -2
- package/dist/backend/llvm/publish.js.map +1 -1
- package/dist/backend/llvm/reference-writes.js +1 -0
- package/dist/backend/llvm/reference-writes.js.map +1 -1
- package/dist/backend/llvm/region-groups.js +43 -4
- package/dist/backend/llvm/region-groups.js.map +1 -1
- package/dist/backend/llvm/region-groups.test.js +79 -0
- package/dist/backend/llvm/region-groups.test.js.map +1 -1
- package/dist/backend/llvm/runtime-registries.test.js +32 -1
- package/dist/backend/llvm/runtime-registries.test.js.map +1 -1
- package/dist/backend/llvm/shapes.js +10 -1
- package/dist/backend/llvm/shapes.js.map +1 -1
- package/dist/backend/llvm/string-reads.d.ts +1 -1
- package/dist/backend/llvm/string-reads.js +1 -1
- package/dist/backend/llvm/string-reads.js.map +1 -1
- package/dist/backend/llvm/unwind-abi.js +24 -2
- package/dist/backend/llvm/unwind-abi.js.map +1 -1
- package/dist/backend/llvm/unwind-abi.test.js +38 -0
- package/dist/backend/llvm/unwind-abi.test.js.map +1 -1
- package/dist/backend/llvm/walkers.d.ts +3 -0
- package/dist/backend/llvm/walkers.js +20 -2
- package/dist/backend/llvm/walkers.js.map +1 -1
- package/dist/backend/native/contracts.d.ts +15 -3
- package/dist/backend/native/executable.js +19 -5
- package/dist/backend/native/executable.js.map +1 -1
- package/dist/backend/native-codegen-core.d.ts +20 -0
- package/dist/backend/native-codegen-core.js +15 -0
- package/dist/backend/native-codegen-core.js.map +1 -1
- package/dist/backend/native-codegen.d.ts +5 -0
- package/dist/backend/native-codegen.js +62 -8
- package/dist/backend/native-codegen.js.map +1 -1
- package/dist/backend/native-codegen.test.js +48 -8
- package/dist/backend/native-codegen.test.js.map +1 -1
- package/dist/backend/native-link-info-core.d.ts +27 -3
- package/dist/backend/native-link-info-core.js.map +1 -1
- package/dist/backend/native-link-info.test.js +17 -1
- package/dist/backend/native-link-info.test.js.map +1 -1
- package/dist/backend/native-toolchain.d.ts +1 -1
- package/dist/backend/native-toolchain.js +1 -1
- package/dist/backend/native-toolchain.js.map +1 -1
- package/dist/backend/native-toolchain.test.js +14 -1
- package/dist/backend/native-toolchain.test.js.map +1 -1
- package/dist/backend/runtime-pack-core.d.ts +9 -3
- package/dist/backend/runtime-pack-core.js +6 -1
- package/dist/backend/runtime-pack-core.js.map +1 -1
- package/dist/backend/runtime-pack.test.js +32 -1
- package/dist/backend/runtime-pack.test.js.map +1 -1
- package/dist/backend/targets.d.ts +9 -1
- package/dist/backend/targets.js +11 -2
- package/dist/backend/targets.js.map +1 -1
- package/dist/backend/targets.test.js +6 -0
- package/dist/backend/targets.test.js.map +1 -1
- package/dist/cli/command.js +15 -1
- package/dist/cli/command.js.map +1 -1
- package/dist/cli/host.d.ts +6 -0
- package/dist/cli/mcp.d.ts +72 -0
- package/dist/cli/mcp.js +601 -0
- package/dist/cli/mcp.js.map +1 -0
- package/dist/cli/mcp.test.d.ts +1 -0
- package/dist/cli/mcp.test.js +380 -0
- package/dist/cli/mcp.test.js.map +1 -0
- package/dist/cli/output-options.d.ts +1 -0
- package/dist/cli/output-options.js +3 -0
- package/dist/cli/output-options.js.map +1 -1
- package/dist/cli/usage.d.ts +51 -1
- package/dist/cli/usage.js +709 -186
- package/dist/cli/usage.js.map +1 -1
- package/dist/compat/fetch-profile.js +9 -4
- package/dist/compat/fetch-profile.js.map +1 -1
- package/dist/compile-types.d.ts +17 -0
- package/dist/coverage/report.d.ts +5 -9
- package/dist/coverage/report.js.map +1 -1
- package/dist/executable/executable-cache.d.ts +17 -3
- package/dist/executable/executable-cache.js +17 -3
- package/dist/executable/executable-cache.js.map +1 -1
- package/dist/executable/prepare.js +87 -10
- package/dist/executable/prepare.js.map +1 -1
- package/dist/frontend/analysis.js +3 -2
- package/dist/frontend/analysis.js.map +1 -1
- package/dist/frontend/canon-map.js +13 -8
- package/dist/frontend/canon-map.js.map +1 -1
- package/dist/frontend/decl-projection.d.ts +18 -0
- package/dist/frontend/decl-projection.js +90 -22
- package/dist/frontend/decl-projection.js.map +1 -1
- package/dist/frontend/decl-projection.test.js +47 -1
- package/dist/frontend/decl-projection.test.js.map +1 -1
- package/dist/frontend/default-library.d.ts +10 -0
- package/dist/frontend/default-library.js +43 -0
- package/dist/frontend/default-library.js.map +1 -0
- package/dist/frontend/fork-target.js +54 -9
- package/dist/frontend/fork-target.js.map +1 -1
- package/dist/frontend/fork-target.test.js +82 -0
- package/dist/frontend/fork-target.test.js.map +1 -1
- package/dist/frontend/inferred-js-diagnostics.test.js +73 -0
- package/dist/frontend/inferred-js-diagnostics.test.js.map +1 -1
- package/dist/frontend/lowering/abstract-equality.d.ts +2 -1
- package/dist/frontend/lowering/abstract-equality.js +7 -1
- package/dist/frontend/lowering/abstract-equality.js.map +1 -1
- package/dist/frontend/lowering/array-values.js +2 -2
- package/dist/frontend/lowering/array-values.js.map +1 -1
- package/dist/frontend/lowering/assertion-members.js +52 -2
- package/dist/frontend/lowering/assertion-members.js.map +1 -1
- package/dist/frontend/lowering/builtin-namespaces.d.ts +5 -0
- package/dist/frontend/lowering/builtin-namespaces.js +19 -12
- package/dist/frontend/lowering/builtin-namespaces.js.map +1 -1
- package/dist/frontend/lowering/builtins/callable-aliases.js +42 -6
- package/dist/frontend/lowering/builtins/callable-aliases.js.map +1 -1
- package/dist/frontend/lowering/builtins/child-process.d.ts +12 -11
- package/dist/frontend/lowering/builtins/child-process.js +235 -38
- package/dist/frontend/lowering/builtins/child-process.js.map +1 -1
- package/dist/frontend/lowering/builtins/compression.d.ts +6 -1
- package/dist/frontend/lowering/builtins/compression.js +3 -3
- package/dist/frontend/lowering/builtins/compression.js.map +1 -1
- package/dist/frontend/lowering/builtins/constants.js +2 -2
- package/dist/frontend/lowering/builtins/constants.js.map +1 -1
- package/dist/frontend/lowering/builtins/crypto.d.ts +3 -1
- package/dist/frontend/lowering/builtins/crypto.js +9 -1
- package/dist/frontend/lowering/builtins/crypto.js.map +1 -1
- package/dist/frontend/lowering/builtins/dates.js +26 -6
- package/dist/frontend/lowering/builtins/dates.js.map +1 -1
- package/dist/frontend/lowering/builtins/environment.d.ts +13 -1
- package/dist/frontend/lowering/builtins/environment.js +15 -4
- package/dist/frontend/lowering/builtins/environment.js.map +1 -1
- package/dist/frontend/lowering/builtins/module-bindings.d.ts +33 -0
- package/dist/frontend/lowering/builtins/module-bindings.js +213 -11
- package/dist/frontend/lowering/builtins/module-bindings.js.map +1 -1
- package/dist/frontend/lowering/builtins/module-resolution.d.ts +9 -2
- package/dist/frontend/lowering/builtins/module-resolution.js +187 -19
- package/dist/frontend/lowering/builtins/module-resolution.js.map +1 -1
- package/dist/frontend/lowering/builtins/performance.js +1 -1
- package/dist/frontend/lowering/builtins/performance.js.map +1 -1
- package/dist/frontend/lowering/builtins/process.js +40 -2
- package/dist/frontend/lowering/builtins/process.js.map +1 -1
- package/dist/frontend/lowering/builtins/promises.js +33 -0
- package/dist/frontend/lowering/builtins/promises.js.map +1 -1
- package/dist/frontend/lowering/builtins/readline.d.ts +9 -5
- package/dist/frontend/lowering/builtins/readline.js +184 -75
- package/dist/frontend/lowering/builtins/readline.js.map +1 -1
- package/dist/frontend/lowering/builtins/url.d.ts +4 -0
- package/dist/frontend/lowering/builtins/url.js +6 -0
- package/dist/frontend/lowering/builtins/url.js.map +1 -1
- package/dist/frontend/lowering/call-arguments.js +15 -0
- package/dist/frontend/lowering/call-arguments.js.map +1 -1
- package/dist/frontend/lowering/callable-properties.d.ts +34 -0
- package/dist/frontend/lowering/callable-properties.js +210 -0
- package/dist/frontend/lowering/callable-properties.js.map +1 -0
- package/dist/frontend/lowering/cjs-inline-require.d.ts +16 -0
- package/dist/frontend/lowering/cjs-inline-require.js +105 -0
- package/dist/frontend/lowering/cjs-inline-require.js.map +1 -1
- package/dist/frontend/lowering/cjs-inline-require.test.d.ts +1 -0
- package/dist/frontend/lowering/cjs-inline-require.test.js +61 -0
- package/dist/frontend/lowering/cjs-inline-require.test.js.map +1 -0
- package/dist/frontend/lowering/class-dynamic-dispatch.js +82 -2
- package/dist/frontend/lowering/class-dynamic-dispatch.js.map +1 -1
- package/dist/frontend/lowering/class-protocols.d.ts +57 -4
- package/dist/frontend/lowering/class-protocols.js +597 -30
- package/dist/frontend/lowering/class-protocols.js.map +1 -1
- package/dist/frontend/lowering/class-unions.js +2 -2
- package/dist/frontend/lowering/class-unions.js.map +1 -1
- package/dist/frontend/lowering/coercions/function-adapters.d.ts +12 -0
- package/dist/frontend/lowering/coercions/function-adapters.js +62 -0
- package/dist/frontend/lowering/coercions/function-adapters.js.map +1 -1
- package/dist/frontend/lowering/coercions/structural-plans.js +56 -1
- package/dist/frontend/lowering/coercions/structural-plans.js.map +1 -1
- package/dist/frontend/lowering/coercions/structural.js +9 -4
- package/dist/frontend/lowering/coercions/structural.js.map +1 -1
- package/dist/frontend/lowering/collection-ingestion.d.ts +9 -0
- package/dist/frontend/lowering/collection-ingestion.js +115 -41
- package/dist/frontend/lowering/collection-ingestion.js.map +1 -1
- package/dist/frontend/lowering/containers/array-callbacks.js +16 -0
- package/dist/frontend/lowering/containers/array-callbacks.js.map +1 -1
- package/dist/frontend/lowering/containers/bytes.js +66 -10
- package/dist/frontend/lowering/containers/bytes.js.map +1 -1
- package/dist/frontend/lowering/containers/collection-methods.js +61 -5
- package/dist/frontend/lowering/containers/collection-methods.js.map +1 -1
- package/dist/frontend/lowering/containers/filter-predicates.js +11 -0
- package/dist/frontend/lowering/containers/filter-predicates.js.map +1 -1
- package/dist/frontend/lowering/containers/indexed-objects.d.ts +15 -0
- package/dist/frontend/lowering/containers/indexed-objects.js +213 -30
- package/dist/frontend/lowering/containers/indexed-objects.js.map +1 -1
- package/dist/frontend/lowering/error-name-order.d.ts +16 -0
- package/dist/frontend/lowering/error-name-order.js +61 -0
- package/dist/frontend/lowering/error-name-order.js.map +1 -1
- package/dist/frontend/lowering/expressions/asserted-receiver.d.ts +17 -0
- package/dist/frontend/lowering/expressions/asserted-receiver.js +123 -1
- package/dist/frontend/lowering/expressions/asserted-receiver.js.map +1 -1
- package/dist/frontend/lowering/expressions/binary.js +147 -20
- package/dist/frontend/lowering/expressions/binary.js.map +1 -1
- package/dist/frontend/lowering/expressions/element-access.js +63 -14
- package/dist/frontend/lowering/expressions/element-access.js.map +1 -1
- package/dist/frontend/lowering/expressions/erased-delete.d.ts +59 -0
- package/dist/frontend/lowering/expressions/erased-delete.js +247 -0
- package/dist/frontend/lowering/expressions/erased-delete.js.map +1 -0
- package/dist/frontend/lowering/expressions/hosted-narrowing.d.ts +10 -0
- package/dist/frontend/lowering/expressions/hosted-narrowing.js +48 -1
- package/dist/frontend/lowering/expressions/hosted-narrowing.js.map +1 -1
- package/dist/frontend/lowering/expressions/identifiers.js +20 -0
- package/dist/frontend/lowering/expressions/identifiers.js.map +1 -1
- package/dist/frontend/lowering/expressions/narrowing.d.ts +7 -2
- package/dist/frontend/lowering/expressions/narrowing.js +77 -45
- package/dist/frontend/lowering/expressions/narrowing.js.map +1 -1
- package/dist/frontend/lowering/expressions/object-literals.js +62 -19
- package/dist/frontend/lowering/expressions/object-literals.js.map +1 -1
- package/dist/frontend/lowering/expressions/optional-chains.js +19 -0
- package/dist/frontend/lowering/expressions/optional-chains.js.map +1 -1
- package/dist/frontend/lowering/expressions/property-access.d.ts +7 -7
- package/dist/frontend/lowering/expressions/property-access.js +247 -48
- package/dist/frontend/lowering/expressions/property-access.js.map +1 -1
- package/dist/frontend/lowering/expressions/relational.d.ts +1 -0
- package/dist/frontend/lowering/expressions/relational.js +18 -8
- package/dist/frontend/lowering/expressions/relational.js.map +1 -1
- package/dist/frontend/lowering/expressions/union-fields.js +11 -5
- package/dist/frontend/lowering/expressions/union-fields.js.map +1 -1
- package/dist/frontend/lowering/expressions/updates.js +121 -11
- package/dist/frontend/lowering/expressions/updates.js.map +1 -1
- package/dist/frontend/lowering/function-context.d.ts +10 -0
- package/dist/frontend/lowering/function-context.js +36 -0
- package/dist/frontend/lowering/function-context.js.map +1 -1
- package/dist/frontend/lowering/function-returns.js +8 -8
- package/dist/frontend/lowering/function-returns.js.map +1 -1
- package/dist/frontend/lowering/handle-properties.d.ts +62 -3
- package/dist/frontend/lowering/handle-properties.js +674 -26
- package/dist/frontend/lowering/handle-properties.js.map +1 -1
- package/dist/frontend/lowering/handle-properties.test.js +95 -2
- package/dist/frontend/lowering/handle-properties.test.js.map +1 -1
- package/dist/frontend/lowering/lower-builtin-values.d.ts +12 -0
- package/dist/frontend/lowering/lower-builtin-values.js +44 -0
- package/dist/frontend/lowering/lower-builtin-values.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.js +328 -136
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-classes.js +82 -17
- package/dist/frontend/lowering/lower-classes.js.map +1 -1
- package/dist/frontend/lowering/lower-event-emitter.js +113 -9
- package/dist/frontend/lowering/lower-event-emitter.js.map +1 -1
- package/dist/frontend/lowering/lower-expando.d.ts +13 -21
- package/dist/frontend/lowering/lower-expando.js +90 -126
- package/dist/frontend/lowering/lower-expando.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.js +2 -2
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-functions.js +65 -0
- package/dist/frontend/lowering/lower-functions.js.map +1 -1
- package/dist/frontend/lowering/lower-inspect.js +471 -0
- package/dist/frontend/lowering/lower-inspect.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.js +36 -10
- package/dist/frontend/lowering/lower-modules.js.map +1 -1
- package/dist/frontend/lowering/lower-node-island.js +28 -0
- package/dist/frontend/lowering/lower-node-island.js.map +1 -1
- package/dist/frontend/lowering/lower-server.d.ts +53 -7
- package/dist/frontend/lowering/lower-server.js +213 -42
- package/dist/frontend/lowering/lower-server.js.map +1 -1
- package/dist/frontend/lowering/lower-stdlib.js +50 -7
- package/dist/frontend/lowering/lower-stdlib.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.d.ts +24 -0
- package/dist/frontend/lowering/lower-stmts.js +463 -220
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lower-stream.js +2 -2
- package/dist/frontend/lowering/lower-stream.js.map +1 -1
- package/dist/frontend/lowering/lower-test.js +71 -2
- package/dist/frontend/lowering/lower-test.js.map +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +81 -10
- package/dist/frontend/lowering/lowerer.js +319 -72
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/lowering/new-target.js +10 -2
- package/dist/frontend/lowering/new-target.js.map +1 -1
- package/dist/frontend/lowering/nullish-empty-pattern.js +3 -3
- package/dist/frontend/lowering/nullish-empty-pattern.js.map +1 -1
- package/dist/frontend/lowering/partial-assertions.js +30 -5
- package/dist/frontend/lowering/partial-assertions.js.map +1 -1
- package/dist/frontend/lowering/primitive-throws.js +91 -1
- package/dist/frontend/lowering/primitive-throws.js.map +1 -1
- package/dist/frontend/lowering/primitive-wrappers.d.ts +9 -0
- package/dist/frontend/lowering/primitive-wrappers.js +2 -2
- package/dist/frontend/lowering/primitive-wrappers.js.map +1 -1
- package/dist/frontend/lowering/promise-executor-adapter.js +5 -2
- package/dist/frontend/lowering/promise-executor-adapter.js.map +1 -1
- package/dist/frontend/lowering/record-links.js +7 -2
- package/dist/frontend/lowering/record-links.js.map +1 -1
- package/dist/frontend/lowering/surfaces.d.ts +4 -0
- package/dist/frontend/lowering/surfaces.js +118 -2
- package/dist/frontend/lowering/surfaces.js.map +1 -1
- package/dist/frontend/lowering/surfaces.test.d.ts +1 -0
- package/dist/frontend/lowering/surfaces.test.js +31 -0
- package/dist/frontend/lowering/surfaces.test.js.map +1 -0
- package/dist/frontend/mock-shapes.js +3 -3
- package/dist/frontend/mock-shapes.js.map +1 -1
- package/dist/frontend/npm-static-ladder.d.ts +21 -0
- package/dist/frontend/npm-static-ladder.js +2 -0
- package/dist/frontend/npm-static-ladder.js.map +1 -0
- package/dist/frontend/npm-static-ladder.test.d.ts +1 -0
- package/dist/frontend/npm-static-ladder.test.js +138 -0
- package/dist/frontend/npm-static-ladder.test.js.map +1 -0
- package/dist/frontend/npm-static-status.d.ts +15 -0
- package/dist/frontend/npm-static-status.js +2 -0
- package/dist/frontend/npm-static-status.js.map +1 -0
- package/dist/frontend/package-shims.js +1 -1
- package/dist/frontend/package-shims.js.map +1 -1
- package/dist/frontend/pipeline.d.ts +1 -1
- package/dist/frontend/pipeline.js +222 -25
- package/dist/frontend/pipeline.js.map +1 -1
- package/dist/frontend/program-analysis.d.ts +4 -0
- package/dist/frontend/program-analysis.js +6 -0
- package/dist/frontend/program-analysis.js.map +1 -1
- package/dist/frontend/program.js +258 -32
- package/dist/frontend/program.js.map +1 -1
- package/dist/frontend/program.test.js +30 -0
- package/dist/frontend/program.test.js.map +1 -1
- package/dist/frontend/resolve.js +29 -5
- package/dist/frontend/resolve.js.map +1 -1
- package/dist/frontend/resolve.test.js +40 -0
- package/dist/frontend/resolve.test.js.map +1 -1
- package/dist/frontend/services.d.ts +8 -0
- package/dist/frontend/services.js +7 -0
- package/dist/frontend/services.js.map +1 -1
- package/dist/frontend/ts7/checker.d.ts +7 -0
- package/dist/frontend/ts7/checker.js +12 -0
- package/dist/frontend/ts7/checker.js.map +1 -1
- package/dist/frontend/ts7/checker.test.js +1 -0
- package/dist/frontend/ts7/checker.test.js.map +1 -1
- package/dist/frontend/ts7/program-host.d.ts +39 -2
- package/dist/frontend/ts7/program-host.js +62 -8
- package/dist/frontend/ts7/program-host.js.map +1 -1
- package/dist/frontend/ts7/program-host.test.js +33 -0
- package/dist/frontend/ts7/program-host.test.js.map +1 -1
- package/dist/frontend/ts7/session-cache.d.ts +5 -1
- package/dist/frontend/ts7/session-cache.js +7 -1
- package/dist/frontend/ts7/session-cache.js.map +1 -1
- package/dist/frontend/ts7/session-cache.test.js +37 -0
- package/dist/frontend/ts7/session-cache.test.js.map +1 -1
- package/dist/frontend/ts7/session.js +19 -1
- package/dist/frontend/ts7/session.js.map +1 -1
- package/dist/frontend/ts7/source-parser.d.ts +17 -2
- package/dist/frontend/ts7/source-parser.js +61 -2
- package/dist/frontend/ts7/source-parser.js.map +1 -1
- package/dist/frontend/ts7/source-parser.test.js +55 -2
- package/dist/frontend/ts7/source-parser.test.js.map +1 -1
- package/dist/frontend/tsc-codes.d.ts +3 -2
- package/dist/frontend/tsc-codes.js +129 -22
- package/dist/frontend/tsc-codes.js.map +1 -1
- package/dist/frontend/type-mapper.d.ts +5 -11
- package/dist/frontend/type-mapper.js +380 -70
- package/dist/frontend/type-mapper.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +67 -7
- package/dist/index.js.map +1 -1
- package/dist/ir/builtin-effects.js +29 -0
- package/dist/ir/builtin-effects.js.map +1 -1
- package/dist/ir/builtin-signatures.d.ts +1 -1
- package/dist/ir/builtin-signatures.js +72 -6
- package/dist/ir/builtin-signatures.js.map +1 -1
- package/dist/ir/codec.generated.d.ts +1 -1
- package/dist/ir/codec.generated.js +321 -263
- package/dist/ir/codec.generated.js.map +1 -1
- package/dist/ir/constant-length-clones.d.ts +26 -0
- package/dist/ir/constant-length-clones.js +589 -0
- package/dist/ir/constant-length-clones.js.map +1 -0
- package/dist/ir/constant-length-clones.test.d.ts +1 -0
- package/dist/ir/constant-length-clones.test.js +292 -0
- package/dist/ir/constant-length-clones.test.js.map +1 -0
- package/dist/ir/constant-tables.d.ts +10 -5
- package/dist/ir/constant-tables.js +83 -17
- package/dist/ir/constant-tables.js.map +1 -1
- package/dist/ir/constant-tables.test.js +58 -1
- package/dist/ir/constant-tables.test.js.map +1 -1
- package/dist/ir/fields.generated.js +5 -2
- package/dist/ir/fields.generated.js.map +1 -1
- package/dist/ir/function-references.js +2 -0
- package/dist/ir/function-references.js.map +1 -1
- package/dist/ir/function-references.test.js +13 -0
- package/dist/ir/function-references.test.js.map +1 -1
- package/dist/ir/integer-loops.js +1 -0
- package/dist/ir/integer-loops.js.map +1 -1
- package/dist/ir/integer-loops.test.js +16 -0
- package/dist/ir/integer-loops.test.js.map +1 -1
- package/dist/ir/ir.d.ts +50 -6
- package/dist/ir/ir.js +44 -2
- package/dist/ir/ir.js.map +1 -1
- package/dist/ir/ir.test.js +83 -1
- package/dist/ir/ir.test.js.map +1 -1
- package/dist/ir/js-groups.js +5 -1
- package/dist/ir/js-groups.js.map +1 -1
- package/dist/ir/js-ic.d.ts +20 -0
- package/dist/ir/js-ic.js +81 -4
- package/dist/ir/js-ic.js.map +1 -1
- package/dist/ir/js-ic.test.js +8 -1
- package/dist/ir/js-ic.test.js.map +1 -1
- package/dist/ir/lane-plans.d.ts +86 -0
- package/dist/ir/lane-plans.js +589 -0
- package/dist/ir/lane-plans.js.map +1 -0
- package/dist/ir/lane-plans.test.d.ts +1 -0
- package/dist/ir/lane-plans.test.js +549 -0
- package/dist/ir/lane-plans.test.js.map +1 -0
- package/dist/ir/runtime-features.d.ts +68 -10
- package/dist/ir/runtime-features.js +285 -17
- package/dist/ir/runtime-features.js.map +1 -1
- package/dist/ir/runtime-features.test.js +190 -1
- package/dist/ir/runtime-features.test.js.map +1 -1
- package/dist/ir/validate.js +61 -24
- package/dist/ir/validate.js.map +1 -1
- package/dist/native/cache.d.ts +5 -0
- package/dist/native/cache.js +23 -1
- package/dist/native/cache.js.map +1 -1
- package/dist/native/cache.test.js +29 -1
- package/dist/native/cache.test.js.map +1 -1
- package/dist/native/cli.js +4 -2
- package/dist/native/cli.js.map +1 -1
- package/dist/native/compiler.d.ts +11 -3
- package/dist/native/compiler.js +102 -16
- package/dist/native/compiler.js.map +1 -1
- package/dist/native/compiler.test.js +244 -2
- package/dist/native/compiler.test.js.map +1 -1
- package/dist/native/prepare.d.ts +14 -1
- package/dist/native/prepare.js +79 -29
- package/dist/native/prepare.js.map +1 -1
- package/dist/native/sanitizer.test.js +3 -0
- package/dist/native/sanitizer.test.js.map +1 -1
- package/dist/native/unchanged.d.ts +80 -0
- package/dist/native/unchanged.js +301 -0
- package/dist/native/unchanged.js.map +1 -0
- package/dist/native/unchanged.test.d.ts +1 -0
- package/dist/native/unchanged.test.js +249 -0
- package/dist/native/unchanged.test.js.map +1 -0
- package/dist/node-islands/boundary.d.ts +16 -0
- package/dist/node-islands/boundary.js +70 -7
- package/dist/node-islands/boundary.js.map +1 -1
- package/dist/node-islands/boundary.test.js +59 -14
- package/dist/node-islands/boundary.test.js.map +1 -1
- package/dist/node-islands/detect.js +203 -47
- package/dist/node-islands/detect.js.map +1 -1
- package/dist/node-islands/detect.test.js +45 -0
- package/dist/node-islands/detect.test.js.map +1 -1
- package/dist/node-islands/growth.js +4 -16
- package/dist/node-islands/growth.js.map +1 -1
- package/dist/node-islands/modules.d.ts +3 -0
- package/dist/node-islands/modules.js +143 -12
- package/dist/node-islands/modules.js.map +1 -1
- package/dist/node-islands/modules.test.js +125 -0
- package/dist/node-islands/modules.test.js.map +1 -1
- package/dist/node-islands/report.d.ts +1 -1
- package/dist/node-islands/report.js +2 -1
- package/dist/node-islands/report.js.map +1 -1
- package/package.json +20 -20
- package/shims/undici/core/request.ts +7 -1
- package/surface-manifest.json +380 -2
|
@@ -56,6 +56,10 @@ import { type Node } from "./region-ir.js";
|
|
|
56
56
|
import { LlDyn, type DynHost, type JsEntryClosure } from "./dyn.js";
|
|
57
57
|
import { LlWalkers } from "./walkers.js";
|
|
58
58
|
import { NullableUnions } from "./nullable-unions.js";
|
|
59
|
+
/** The ABSENT marker of an optional checked-dynamic record field: an
|
|
60
|
+
* immortal ScrDyn of kind SCR_DYN_UNDEF that is address-distinct from
|
|
61
|
+
* scr_dyn_undefined(). Emitted only when a program references it. */
|
|
62
|
+
export declare const DYN_ABSENT = "@sc_dyn_absent";
|
|
59
63
|
import { type InlineRcMode, type MapKeyAccess } from "./shapes.js";
|
|
60
64
|
import type { ExprOf, LibCallExpr, LlStreamTypedRefAdapter, LlValue } from "./expr-context.js";
|
|
61
65
|
import { type SpeculationContext, type SpeculativeValue } from "./speculative-integers.js";
|
|
@@ -161,6 +165,11 @@ export interface LlvmTargetOptions {
|
|
|
161
165
|
* teardown after `process.exit` to a helper process (`--detached-exit`).
|
|
162
166
|
* Executables only; the runtime's weak default keeps it off. */
|
|
163
167
|
detachedExit?: boolean;
|
|
168
|
+
/** Define `scr_stdout_buffering` so the runtime keeps JavaScript-visible
|
|
169
|
+
* stdout in its 64 KiB buffer when fd 1 is not a terminal
|
|
170
|
+
* (`--stdout-buffering`). Executables only; the runtime's weak default
|
|
171
|
+
* keeps the per-call policy. */
|
|
172
|
+
stdoutBuffering?: boolean;
|
|
164
173
|
/** The files of the program's Node island module tree, in manifest order
|
|
165
174
|
* (node-islands/modules.ts), when the executable carries the tree. */
|
|
166
175
|
nodeIslandModuleData?: Uint8Array;
|
|
@@ -182,16 +191,28 @@ export interface LlvmTargetOptions {
|
|
|
182
191
|
* runs on any x86-64 CPU. */
|
|
183
192
|
targetCpu?: TargetCpu;
|
|
184
193
|
/** Give an x86-64 executable without a `targetCpu` an x86-64-v3 copy of
|
|
185
|
-
*
|
|
186
|
-
*
|
|
187
|
-
* with debug information. */
|
|
194
|
+
* the program functions whose loop x86-64-v3 widens (cpu-dispatch.ts),
|
|
195
|
+
* which it runs on CPUs at that level. Ignored for other targets,
|
|
196
|
+
* libraries, builds with debug information and profile-recording builds. */
|
|
188
197
|
cpuDispatch?: boolean;
|
|
198
|
+
/** The build records a profile: a dispatching build emits one body per
|
|
199
|
+
* function and keeps the functions a copy takes out of line, so the
|
|
200
|
+
* profile names the functions a `--profile-use` build copies. */
|
|
201
|
+
profileGenerate?: boolean;
|
|
202
|
+
/** The functions the build's profile names, when it uses one: the copies
|
|
203
|
+
* are limited to the functions among them that have a loop. */
|
|
204
|
+
cpuCopyFunctions?: ReadonlySet<string>;
|
|
205
|
+
/** The most program text the copies may take (cpu-dispatch.ts
|
|
206
|
+
* cpuCopyBudget by default): lowers the set for a build or a test that
|
|
207
|
+
* wants fewer copies. */
|
|
208
|
+
cpuCopyCapBytes?: number;
|
|
189
209
|
}
|
|
190
210
|
/** LlvmTargetOptions.lowRegion for an executable: Linux targets without
|
|
191
211
|
* sanitizers, whose address space below 32 GiB is free (ASan keeps its
|
|
192
|
-
* shadow memory there
|
|
193
|
-
*
|
|
194
|
-
* `
|
|
212
|
+
* shadow memory there), and macOS targets without sanitizers, which keep the
|
|
213
|
+
* window at a fixed base instead (classes.ts compactRefBaseOf). Other systems
|
|
214
|
+
* map their own images and libraries below 32 GiB. `platform` is a target
|
|
215
|
+
* platform (`linux`, `darwin`, `win32`, `wasi`). */
|
|
195
216
|
export declare function lowRegionTarget(platform: string, sanitize: boolean): boolean;
|
|
196
217
|
/** The int32 slot analysis of one module and the inputs it read: the
|
|
197
218
|
* constructor's own analyses of that module, which LlEmitter takes over
|
|
@@ -331,6 +352,10 @@ export declare class LlEmitter {
|
|
|
331
352
|
* 32-bit references (LlClassMeta.compressed):
|
|
332
353
|
* loadField/loadRef decode them and storeField/storeRef encode them. */
|
|
333
354
|
readonly compressedFieldPtrs: Set<string>;
|
|
355
|
+
/** The window base that 32-bit references are offsets from (classes.ts
|
|
356
|
+
* compactRefBaseOf): 0 unless the low region applies on a target that
|
|
357
|
+
* places the window at a base. */
|
|
358
|
+
readonly compactRefBase: bigint;
|
|
334
359
|
/** Compact class instances live in the program-lifetime region below
|
|
335
360
|
* 32 GiB (LlvmTargetOptions.lowRegion, and the program has compact
|
|
336
361
|
* classes): main reserves it before compiled code runs (scr_plr_init), and
|
|
@@ -408,7 +433,9 @@ export declare class LlEmitter {
|
|
|
408
433
|
arrayAccess(arr: IrExpr, elem: IrType): ArrayAccess;
|
|
409
434
|
/** Whether an element access at `index` of `arr` lies in the hole-free
|
|
410
435
|
* prefix: a counter of a dense array loop's fast copy indexing one of the
|
|
411
|
-
* arrays its entry test covered
|
|
436
|
+
* arrays its entry test covered, or an index proven in range of a parameter
|
|
437
|
+
* whose every call passes an array of that many present elements
|
|
438
|
+
* (IrParam.constLength). */
|
|
412
439
|
provenDenseIndex(arr: IrExpr, index: IrExpr): boolean;
|
|
413
440
|
fieldAliasAttachment(ptr: string): string;
|
|
414
441
|
fieldAliasMetadata(): string[];
|
|
@@ -455,12 +482,22 @@ export declare class LlEmitter {
|
|
|
455
482
|
readonly emitLibraryIdentity: boolean;
|
|
456
483
|
readonly runtimeAbiMarker: boolean;
|
|
457
484
|
readonly detachedExit: boolean;
|
|
485
|
+
readonly stdoutBuffering: boolean;
|
|
458
486
|
readonly nodeIslandModuleData: Uint8Array | null;
|
|
459
487
|
readonly targetCpu: TargetCpu | undefined;
|
|
488
|
+
/** LlvmTargetOptions.targetTriple, or "" for the host's ABI. */
|
|
489
|
+
readonly targetTriple: string;
|
|
460
490
|
/** Emitted functions carry `sanitize_address` (LlvmTargetOptions). */
|
|
461
491
|
readonly sanitizeAttributes: boolean;
|
|
462
492
|
/** LlvmTargetOptions.cpuDispatch, where it applies. */
|
|
463
493
|
readonly cpuDispatch: boolean;
|
|
494
|
+
/** LlvmTargetOptions.cpuCopyFunctions. */
|
|
495
|
+
private readonly cpuCopyFunctions;
|
|
496
|
+
/** LlvmTargetOptions.cpuCopyCapBytes. */
|
|
497
|
+
private readonly cpuCopyCapBytes;
|
|
498
|
+
/** Whether emission keeps the functions a dispatching build would copy out
|
|
499
|
+
* of line, so a recorded profile names them. */
|
|
500
|
+
private readonly keepCopyBodiesOutOfLine;
|
|
464
501
|
/** How the program's functions are copied (cpu-dispatch.ts): for runtime
|
|
465
502
|
* dispatch, for an x86-64-v3 `targetCpu` ("target"), or not at all. */
|
|
466
503
|
readonly cpuCopies: CpuCopies | null;
|
|
@@ -494,6 +531,8 @@ export declare class LlEmitter {
|
|
|
494
531
|
readonly retypeGuards: Map<string, string>;
|
|
495
532
|
/** The nullable-union ABSENT sentinel was referenced (absentInstanceRef). */
|
|
496
533
|
needsNullableAbsent: boolean;
|
|
534
|
+
/** The optional-dyn ABSENT marker was referenced (dynAbsentRef). */
|
|
535
|
+
needsDynAbsent: boolean;
|
|
497
536
|
private readonly immortalValues;
|
|
498
537
|
/** Regex literal templates: "<flags>/<pattern>" → { symbol, interned
|
|
499
538
|
* source/flags literal refs } — one immortal ScrRegex template per distinct
|
|
@@ -531,6 +570,17 @@ export declare class LlEmitter {
|
|
|
531
570
|
}>;
|
|
532
571
|
/** Interned ScrMapOps descriptors (scr_map.h): initializer → symbol. */
|
|
533
572
|
readonly mapOpsConsts: Map<string, string>;
|
|
573
|
+
/** Element data of the numeric array literals that become static tables
|
|
574
|
+
* (arrayLit, expr-primitives.ts): "<i32|double>:<literal location>" → the
|
|
575
|
+
* private constant's symbol, element type and the elements as their
|
|
576
|
+
* rendered literals. The array works from that data in place, so each
|
|
577
|
+
* entry also places the header in static storage (`<sym>_h`), initialized
|
|
578
|
+
* with the same table. */
|
|
579
|
+
readonly arrayConstData: Map<string, {
|
|
580
|
+
sym: string;
|
|
581
|
+
type: "i32" | "double";
|
|
582
|
+
values: readonly string[];
|
|
583
|
+
}>;
|
|
534
584
|
/** Method-id slots of checked-dynamic method calls
|
|
535
585
|
* (scr_dyn_invoke_prepared_id): method name → symbol of an i32 the
|
|
536
586
|
* runtime fills with the name's id on the first call. */
|
|
@@ -661,6 +711,9 @@ export declare class LlEmitter {
|
|
|
661
711
|
readonly nodeIndex: IrNodeIndex;
|
|
662
712
|
private readonly tdzGlobals;
|
|
663
713
|
readonly constantNumericTables: ReadonlyMap<string, ConstantNumericTable>;
|
|
714
|
+
/** Module-level numeric tables the emitter places in the program image,
|
|
715
|
+
* by their initializing array literal (ir/constant-tables.ts). */
|
|
716
|
+
readonly staticArrayTables: ReadonlySet<IrExpr>;
|
|
664
717
|
/** Constant-key reads on checked-dynamic objects, each with its own
|
|
665
718
|
* zero-initialized ScrDynReadIc (scr_runtime.h). */
|
|
666
719
|
dynReadIcSites: number;
|
|
@@ -753,6 +806,8 @@ export declare class LlEmitter {
|
|
|
753
806
|
/** Whether timer and tick scheduling goes through the *_als entry
|
|
754
807
|
* points (RuntimeFeatures asyncContext). */
|
|
755
808
|
get schedulesInContext(): boolean;
|
|
809
|
+
/** The JavaScript object model build is on (jsObjectModelFact). */
|
|
810
|
+
get jsObjectModel(): boolean;
|
|
756
811
|
/** Emitted ref-kind resolve thunks for new Promise, interned per inner
|
|
757
812
|
* typeKey → thunk symbol. */
|
|
758
813
|
readonly resolveThunks: Map<string, string>;
|
|
@@ -1022,6 +1077,9 @@ export declare class LlEmitter {
|
|
|
1022
1077
|
* not a constructor (where they change), not async or a generator. */
|
|
1023
1078
|
finalFieldBorrows: boolean;
|
|
1024
1079
|
integerRanges: IntegerRanges;
|
|
1080
|
+
/** The current function's parameters whose every call passes an array of a
|
|
1081
|
+
* known number of present elements (IrParam.constLength). */
|
|
1082
|
+
constLengthParams: Map<string, number>;
|
|
1025
1083
|
/** The current function's bounded for-loop cursors (integer-ranges.ts). */
|
|
1026
1084
|
integerLoopRanges: ReadonlyMap<IrStmt, ReadonlyMap<string, IntegerRange>>;
|
|
1027
1085
|
/** Number arrays of the current function whose every present element is
|
|
@@ -1181,6 +1239,9 @@ export declare class LlEmitter {
|
|
|
1181
1239
|
globals: string[];
|
|
1182
1240
|
defs: string[];
|
|
1183
1241
|
};
|
|
1242
|
+
/** What a dispatching build copies: the profile's functions, when it uses
|
|
1243
|
+
* one, within the text budget. */
|
|
1244
|
+
private copySelection;
|
|
1184
1245
|
emit(): string;
|
|
1185
1246
|
emitParts(): string[];
|
|
1186
1247
|
/** The entry point and JavaScript name of each named function the
|
|
@@ -1348,6 +1409,20 @@ export declare class LlEmitter {
|
|
|
1348
1409
|
* throws as usual). BigInt here is the same StringToBigInt as the
|
|
1349
1410
|
* program's, so every accepted spelling folds to the value Node gives. */
|
|
1350
1411
|
internBigIntLiteral(text: string): string | null;
|
|
1412
|
+
/** The element data of the static array table at `at`
|
|
1413
|
+
* (ir/constant-tables.ts), which the array itself holds: the emitter also
|
|
1414
|
+
* places the header, `<sym>_h`, in static storage. Each table gets its own
|
|
1415
|
+
* pair, so two tables with equal elements stay distinct arrays —
|
|
1416
|
+
* `@`-refs, first-use order.
|
|
1417
|
+
*
|
|
1418
|
+
* The elements are rendered to their literals here, not in the module
|
|
1419
|
+
* writer: a chunk's result crosses a JSON boundary (emit-module.ts), and
|
|
1420
|
+
* JSON turns NaN and the infinities into null and negative zero into zero.
|
|
1421
|
+
* `f64Lit` is the exact bit pattern, so every element survives it. */
|
|
1422
|
+
staticArrayData(at: IrExpr, values: readonly number[], type: "i32" | "double"): {
|
|
1423
|
+
data: string;
|
|
1424
|
+
header: string;
|
|
1425
|
+
};
|
|
1351
1426
|
/** Interned NUL-terminated C-string constant (the scr_jb_puts /
|
|
1352
1427
|
* stringify-indent currency) — `@`-ref, first-use order. */
|
|
1353
1428
|
cstr(text: string): string;
|
|
@@ -1367,6 +1442,11 @@ export declare class LlEmitter {
|
|
|
1367
1442
|
/** The immortal ABSENT state of an undefined-armed record field slot
|
|
1368
1443
|
* (IR fieldAbsent). */
|
|
1369
1444
|
absentInstanceRef(unionId: string): string;
|
|
1445
|
+
/** The ABSENT marker of an optional checked-dynamic record field slot
|
|
1446
|
+
* (IR fieldAbsent without a union). Address-compared, never dereferenced
|
|
1447
|
+
* by compiled code: reads select it to scr_dyn_undefined, presence tests
|
|
1448
|
+
* compare against it, and boxing omits it. */
|
|
1449
|
+
dynAbsentRef(): string;
|
|
1370
1450
|
/** i1: a union value loaded from a field slot is the ABSENT state — the
|
|
1371
1451
|
* undefined arm's tag with the absent payload marker. */
|
|
1372
1452
|
fieldAbsentTest(value: string, unionId: string): string;
|
|
@@ -16,7 +16,7 @@ import { createHash } from "node:crypto";
|
|
|
16
16
|
import { endsWithJump, matchFieldSelfConcat, readsArraySlot, streamTypedRefEligible, undefinedArmTag, } from "../../ir/analysis.js";
|
|
17
17
|
import { containsLoop, loopTestsEveryIteration } from "../loop-polls.js";
|
|
18
18
|
import { isDynTypedRefType, isRefCounted, isUnitType, POINTER_KINDS, RUNTIME_EMITTER_CLASS, RUNTIME_EVENT_CLASS, RUNTIME_EVENT_TARGET_CLASS, RUNTIME_ERROR_CLASSES, RUNTIME_STREAM_CLASSES, typeEquals, typeKey, VOID, classJsName, classValueAbiEquals, } from "../../ir/ir.js";
|
|
19
|
-
import { moduleRuntimeFeatures } from "../../ir/runtime-features.js";
|
|
19
|
+
import { jsObjectModelFact, moduleRuntimeFeatures, } from "../../ir/runtime-features.js";
|
|
20
20
|
import { captureFreeFunctions, observesStacks } from "../stack-observations.js";
|
|
21
21
|
import { findInitializedByteLoopBindings } from "./byte-windows.js";
|
|
22
22
|
import { matchBytesLoopVersion } from "./bytes-loop-versions.js";
|
|
@@ -28,6 +28,7 @@ import { specializeCallbackCalls } from "../../ir/callback-specialization.js";
|
|
|
28
28
|
import { EmitJournal, registerReplay, renameChunk, replayJournal, } from "./emit-journal.js";
|
|
29
29
|
import { specializeNumericCalls } from "../../ir/numeric-call-specialization.js";
|
|
30
30
|
import { specializeTypedArguments } from "../../ir/typed-argument-clones.js";
|
|
31
|
+
import { specializeConstantArrayLengths } from "../../ir/constant-length-clones.js";
|
|
31
32
|
import { versionLoopBoundParameters } from "../../ir/parameter-versions.js";
|
|
32
33
|
import { inlineExpressionFunctions } from "../../ir/expression-inlining.js";
|
|
33
34
|
import { inlineArrayReads, NO_INLINE_ARRAYS, planInlineArrays, } from "../../ir/inline-arrays.js";
|
|
@@ -59,11 +60,11 @@ import { writeRepresentationReport } from "./repr-report.js";
|
|
|
59
60
|
import { heapCensusOf } from "./heap-census.js";
|
|
60
61
|
import { exactInteger, narrowInteger, widenInteger } from "./integer-values.js";
|
|
61
62
|
import { findInitializerBindings } from "../../ir/initializer-bindings.js";
|
|
62
|
-
import { findConstantNumericTables } from "../../ir/constant-tables.js";
|
|
63
|
+
import { findConstantNumericTables, findStaticArrayTables, } from "../../ir/constant-tables.js";
|
|
63
64
|
import { allocateFfiCallbackAdapters, hasForeignFfiCallback, hasRetainedFfiCallback, } from "../ffi-callbacks.js";
|
|
64
65
|
import { computeMayThrow } from "../may-throw.js";
|
|
65
66
|
import { UNWIND_PERSONALITY, UNWIND_RAISE, UNWIND_RAISE_DECLARATION, UNWIND_RESUME_DECLARATION, UNWIND_RESUME, UNWIND_SLOT, UnwindAbiViolation, bridgePlainUnwindCalls, unwindAbiFunctions, } from "./unwind-abi.js";
|
|
66
|
-
import { cloneForCpuDispatch } from "./cpu-dispatch.js";
|
|
67
|
+
import { cloneForCpuDispatch, keepCopiedBodiesOutOfLine, } from "./cpu-dispatch.js";
|
|
67
68
|
import { mangleAsyncInlineAwaitCall, mangleAsyncSpawn, mangleBorrowedFunction, mangleClassObj, mangleFnClosure, mangleFunction, mangleGenSpawn, mangleGlobal, mangleLocal, mangleRecordStruct, mangleWrapper, mangleBorrowingWrapper, } from "../mangle.js";
|
|
68
69
|
import { analyzeCallLifetimes } from "./call-lifetimes.js";
|
|
69
70
|
import { stackObjectStruct, } from "./stack-objects.js";
|
|
@@ -116,7 +117,7 @@ import { emitChildProcessLibCall, emitAsyncContextLibCall, emitProcessLibCall, e
|
|
|
116
117
|
import { emitStreamLibCall } from "./lib-stream.js";
|
|
117
118
|
import { emitNetworkHttpLibCall } from "./lib-network.js";
|
|
118
119
|
import { emitAssertInspectLibCall, emitIoLibCall, emitGenericLibCall, emitLibCall, } from "./lib-dispatch.js";
|
|
119
|
-
import { assignCompactLayouts, buildClassGraph, classFieldTypes, classMembershipIntervals, classFieldIndex, compactRefLoadLines, compactRefStoreLines, classPreLines, classStructSym, programLifetimeClass, } from "./classes.js";
|
|
120
|
+
import { assignCompactLayouts, buildClassGraph, classFieldTypes, classMembershipIntervals, classFieldIndex, compactRefBaseOf, compactRefLoadLines, compactRefStoreLines, classPreLines, classStructSym, programLifetimeClass, } from "./classes.js";
|
|
120
121
|
import { LifetimeRegions, REGION_TYPES } from "./regions.js";
|
|
121
122
|
import { planTreeClasses } from "../tree-classes.js";
|
|
122
123
|
import { arenaAware, arenaCurrentAddress, arenaNewSym, arenasRequested, planArenas, } from "./arenas.js";
|
|
@@ -128,6 +129,10 @@ import { LlvmUnsupportedError } from "./unsupported.js";
|
|
|
128
129
|
import { LlWalkers } from "./walkers.js";
|
|
129
130
|
import { isObjectArm, isPayloadTag, NULLABLE_ABSENT, NULLABLE_NULL, NullableUnions, pointerTagFn, } from "./nullable-unions.js";
|
|
130
131
|
import { classUnionHeaders, emitClassUnionHelpers } from "./class-unions.js";
|
|
132
|
+
/** The ABSENT marker of an optional checked-dynamic record field: an
|
|
133
|
+
* immortal ScrDyn of kind SCR_DYN_UNDEF that is address-distinct from
|
|
134
|
+
* scr_dyn_undefined(). Emitted only when a program references it. */
|
|
135
|
+
export const DYN_ABSENT = "@sc_dyn_absent";
|
|
131
136
|
import { emitNullablePresent, emitUnionPeek, emitUnionTag } from "./union-repr.js";
|
|
132
137
|
import { emitConcatInputs, emitMixedConcat, numberPart, stringParts, } from "./string-construction.js";
|
|
133
138
|
import { arrNewCall, boxAccess, elemAccess, boxNewCall, boxReleaseSym, computeTraced, emitInlineRcHelpers, emitNullableRetainWrappers, emitShapeUnionHelpers, FN_ATTRS, inlineRcDecls, llFieldType, mapFlagsOffset, releaseSym, retainSym, traceArg, vAdapters, traceAdapter, } from "./shapes.js";
|
|
@@ -167,11 +172,12 @@ export function ffiCallbackDummyLl(callback) {
|
|
|
167
172
|
}
|
|
168
173
|
/** LlvmTargetOptions.lowRegion for an executable: Linux targets without
|
|
169
174
|
* sanitizers, whose address space below 32 GiB is free (ASan keeps its
|
|
170
|
-
* shadow memory there
|
|
171
|
-
*
|
|
172
|
-
* `
|
|
175
|
+
* shadow memory there), and macOS targets without sanitizers, which keep the
|
|
176
|
+
* window at a fixed base instead (classes.ts compactRefBaseOf). Other systems
|
|
177
|
+
* map their own images and libraries below 32 GiB. `platform` is a target
|
|
178
|
+
* platform (`linux`, `darwin`, `win32`, `wasi`). */
|
|
173
179
|
export function lowRegionTarget(platform, sanitize) {
|
|
174
|
-
return platform === "linux" && !sanitize;
|
|
180
|
+
return (platform === "linux" || platform === "darwin") && !sanitize;
|
|
175
181
|
}
|
|
176
182
|
/** Function versions on loop-bounding number parameters
|
|
177
183
|
* (ir/parameter-versions.ts). Library builds have no int32 entries, and a
|
|
@@ -296,7 +302,7 @@ function moduleEmitter(input, options) {
|
|
|
296
302
|
// an earlier pass rewrote, which the index does not record.
|
|
297
303
|
const nodes = new IrNodeIndex(mod);
|
|
298
304
|
rounds.nodes = nodes;
|
|
299
|
-
const passed = versionUnionArmLoops(versionParameters(addRecordResultEntries(scalarizeLiteralResults(scalarizeNumericRecords(specializeCallbackCalls(specializeNumericCalls(specializeTypedArguments(pairRowSums(jamRuntimeCountLoops(jamSaturatingLoops(inlineArraysPass(options, inlineExpressionFunctions(foldConstantGlobals(copyStableCaptures(resolveSelfCaptures(hoistFinalFieldReads(freezeInitOnlyGlobals(holdCharLocalsAsUnits(dropUnwrittenPropertyBags(runPairedWhileLoopsAsFor(mod, nodes), nodes), nodes), nodes), nodes), nodes), nodes), nodes), nodes)), nodes), nodes), nodes), mangleFunction, nodes), mangleFunction, nodes), mangleFunction, nodes)), nodes), nodes), nodes), nodes);
|
|
305
|
+
const passed = versionUnionArmLoops(versionParameters(addRecordResultEntries(scalarizeLiteralResults(scalarizeNumericRecords(specializeCallbackCalls(specializeNumericCalls(specializeConstantArrayLengths(specializeTypedArguments(pairRowSums(jamRuntimeCountLoops(jamSaturatingLoops(inlineArraysPass(options, inlineExpressionFunctions(foldConstantGlobals(copyStableCaptures(resolveSelfCaptures(hoistFinalFieldReads(freezeInitOnlyGlobals(holdCharLocalsAsUnits(dropUnwrittenPropertyBags(runPairedWhileLoopsAsFor(mod, nodes), nodes), nodes), nodes), nodes), nodes), nodes), nodes), nodes)), nodes), nodes), nodes), mangleFunction, nodes), mangleFunction, nodes), mangleFunction, nodes), mangleFunction, nodes)), nodes), nodes), nodes), nodes);
|
|
300
306
|
timing("llvm-emit-rewrites");
|
|
301
307
|
let emitted = selectInt32Arrays(passed, proven, resultEntryTargets);
|
|
302
308
|
let prepared = rounds.last;
|
|
@@ -570,6 +576,10 @@ export class LlEmitter {
|
|
|
570
576
|
* 32-bit references (LlClassMeta.compressed):
|
|
571
577
|
* loadField/loadRef decode them and storeField/storeRef encode them. */
|
|
572
578
|
compressedFieldPtrs = new Set();
|
|
579
|
+
/** The window base that 32-bit references are offsets from (classes.ts
|
|
580
|
+
* compactRefBaseOf): 0 unless the low region applies on a target that
|
|
581
|
+
* places the window at a base. */
|
|
582
|
+
compactRefBase;
|
|
573
583
|
/** Compact class instances live in the program-lifetime region below
|
|
574
584
|
* 32 GiB (LlvmTargetOptions.lowRegion, and the program has compact
|
|
575
585
|
* classes): main reserves it before compiled code runs (scr_plr_init), and
|
|
@@ -819,8 +829,23 @@ export class LlEmitter {
|
|
|
819
829
|
}
|
|
820
830
|
/** Whether an element access at `index` of `arr` lies in the hole-free
|
|
821
831
|
* prefix: a counter of a dense array loop's fast copy indexing one of the
|
|
822
|
-
* arrays its entry test covered
|
|
832
|
+
* arrays its entry test covered, or an index proven in range of a parameter
|
|
833
|
+
* whose every call passes an array of that many present elements
|
|
834
|
+
* (IrParam.constLength). */
|
|
823
835
|
provenDenseIndex(arr, index) {
|
|
836
|
+
if (arr.kind === "varRef") {
|
|
837
|
+
const length = this.constLengthParams.get(arr.localId);
|
|
838
|
+
if (length !== undefined) {
|
|
839
|
+
if (index.kind === "numLit" &&
|
|
840
|
+
Number.isInteger(index.value) &&
|
|
841
|
+
index.value >= 0 &&
|
|
842
|
+
index.value < length)
|
|
843
|
+
return true;
|
|
844
|
+
const range = this.integerRanges.get(index);
|
|
845
|
+
if (range !== null && range !== undefined && range.min >= 0 && range.max < length)
|
|
846
|
+
return true;
|
|
847
|
+
}
|
|
848
|
+
}
|
|
824
849
|
const loop = LOOPS.of(this).denseLoop;
|
|
825
850
|
return (loop !== null &&
|
|
826
851
|
arr.kind === "varRef" &&
|
|
@@ -879,12 +904,22 @@ export class LlEmitter {
|
|
|
879
904
|
emitLibraryIdentity;
|
|
880
905
|
runtimeAbiMarker;
|
|
881
906
|
detachedExit;
|
|
907
|
+
stdoutBuffering;
|
|
882
908
|
nodeIslandModuleData;
|
|
883
909
|
targetCpu;
|
|
910
|
+
/** LlvmTargetOptions.targetTriple, or "" for the host's ABI. */
|
|
911
|
+
targetTriple;
|
|
884
912
|
/** Emitted functions carry `sanitize_address` (LlvmTargetOptions). */
|
|
885
913
|
sanitizeAttributes;
|
|
886
914
|
/** LlvmTargetOptions.cpuDispatch, where it applies. */
|
|
887
915
|
cpuDispatch;
|
|
916
|
+
/** LlvmTargetOptions.cpuCopyFunctions. */
|
|
917
|
+
cpuCopyFunctions;
|
|
918
|
+
/** LlvmTargetOptions.cpuCopyCapBytes. */
|
|
919
|
+
cpuCopyCapBytes;
|
|
920
|
+
/** Whether emission keeps the functions a dispatching build would copy out
|
|
921
|
+
* of line, so a recorded profile names them. */
|
|
922
|
+
keepCopyBodiesOutOfLine;
|
|
888
923
|
/** How the program's functions are copied (cpu-dispatch.ts): for runtime
|
|
889
924
|
* dispatch, for an x86-64-v3 `targetCpu` ("target"), or not at all. */
|
|
890
925
|
cpuCopies;
|
|
@@ -912,6 +947,8 @@ export class LlEmitter {
|
|
|
912
947
|
retypeGuards = new Map();
|
|
913
948
|
/** The nullable-union ABSENT sentinel was referenced (absentInstanceRef). */
|
|
914
949
|
needsNullableAbsent = false;
|
|
950
|
+
/** The optional-dyn ABSENT marker was referenced (dynAbsentRef). */
|
|
951
|
+
needsDynAbsent = false;
|
|
915
952
|
immortalValues = new Set();
|
|
916
953
|
/** Regex literal templates: "<flags>/<pattern>" → { symbol, interned
|
|
917
954
|
* source/flags literal refs } — one immortal ScrRegex template per distinct
|
|
@@ -932,6 +969,13 @@ export class LlEmitter {
|
|
|
932
969
|
cstrs = new Map();
|
|
933
970
|
/** Interned ScrMapOps descriptors (scr_map.h): initializer → symbol. */
|
|
934
971
|
mapOpsConsts = new Map();
|
|
972
|
+
/** Element data of the numeric array literals that become static tables
|
|
973
|
+
* (arrayLit, expr-primitives.ts): "<i32|double>:<literal location>" → the
|
|
974
|
+
* private constant's symbol, element type and the elements as their
|
|
975
|
+
* rendered literals. The array works from that data in place, so each
|
|
976
|
+
* entry also places the header in static storage (`<sym>_h`), initialized
|
|
977
|
+
* with the same table. */
|
|
978
|
+
arrayConstData = new Map();
|
|
935
979
|
/** Method-id slots of checked-dynamic method calls
|
|
936
980
|
* (scr_dyn_invoke_prepared_id): method name → symbol of an i32 the
|
|
937
981
|
* runtime fills with the name's id on the first call. */
|
|
@@ -1057,6 +1101,9 @@ export class LlEmitter {
|
|
|
1057
1101
|
nodeIndex;
|
|
1058
1102
|
tdzGlobals = new Map();
|
|
1059
1103
|
constantNumericTables;
|
|
1104
|
+
/** Module-level numeric tables the emitter places in the program image,
|
|
1105
|
+
* by their initializing array literal (ir/constant-tables.ts). */
|
|
1106
|
+
staticArrayTables;
|
|
1060
1107
|
/** Constant-key reads on checked-dynamic objects, each with its own
|
|
1061
1108
|
* zero-initialized ScrDynReadIc (scr_runtime.h). */
|
|
1062
1109
|
dynReadIcSites = 0;
|
|
@@ -1148,6 +1195,10 @@ export class LlEmitter {
|
|
|
1148
1195
|
get schedulesInContext() {
|
|
1149
1196
|
return this.runtimeFeatures.asyncContext;
|
|
1150
1197
|
}
|
|
1198
|
+
/** The JavaScript object model build is on (jsObjectModelFact). */
|
|
1199
|
+
get jsObjectModel() {
|
|
1200
|
+
return jsObjectModelFact(this.runtimeFeatures);
|
|
1201
|
+
}
|
|
1151
1202
|
/** Emitted ref-kind resolve thunks for new Promise, interned per inner
|
|
1152
1203
|
* typeKey → thunk symbol. */
|
|
1153
1204
|
resolveThunks = new Map();
|
|
@@ -1374,6 +1425,9 @@ export class LlEmitter {
|
|
|
1374
1425
|
* not a constructor (where they change), not async or a generator. */
|
|
1375
1426
|
finalFieldBorrows = false;
|
|
1376
1427
|
integerRanges = new Map();
|
|
1428
|
+
/** The current function's parameters whose every call passes an array of a
|
|
1429
|
+
* known number of present elements (IrParam.constLength). */
|
|
1430
|
+
constLengthParams = new Map();
|
|
1377
1431
|
/** The current function's bounded for-loop cursors (integer-ranges.ts). */
|
|
1378
1432
|
integerLoopRanges = new Map();
|
|
1379
1433
|
/** Number arrays of the current function whose every present element is
|
|
@@ -1513,6 +1567,7 @@ export class LlEmitter {
|
|
|
1513
1567
|
? null
|
|
1514
1568
|
: new LlvmDebugInfo(mod.sourceFile, options.debugSources, options.pointerBits, mod.unions, this.nullableUnions.armTypes());
|
|
1515
1569
|
this.constantNumericTables = findConstantNumericTables(mod);
|
|
1570
|
+
this.staticArrayTables = findStaticArrayTables(mod);
|
|
1516
1571
|
this.untypedIntegrity = mod.untypedIntegrity === true;
|
|
1517
1572
|
this.sloppyDynWrites = new Set(mod.sloppyDynWrites ?? []);
|
|
1518
1573
|
this.liveViewsReadOnly =
|
|
@@ -1539,6 +1594,7 @@ export class LlEmitter {
|
|
|
1539
1594
|
(options.targetTriple
|
|
1540
1595
|
? /^(x86_64|amd64)\b/i.test(options.targetTriple)
|
|
1541
1596
|
: process.arch === "x64");
|
|
1597
|
+
this.compactRefBase = options.lowRegion === true ? compactRefBaseOf(options.targetTriple) : 0n;
|
|
1542
1598
|
this.executableTls =
|
|
1543
1599
|
mod.workers === true &&
|
|
1544
1600
|
mod.lib === undefined &&
|
|
@@ -1556,14 +1612,24 @@ export class LlEmitter {
|
|
|
1556
1612
|
this.emitLibraryIdentity = options.emitLibraryIdentity !== false;
|
|
1557
1613
|
this.runtimeAbiMarker = options.runtimeAbiMarker === true;
|
|
1558
1614
|
this.detachedExit = options.detachedExit === true;
|
|
1615
|
+
this.stdoutBuffering = options.stdoutBuffering === true;
|
|
1559
1616
|
this.nodeIslandModuleData = options.nodeIslandModuleData ?? null;
|
|
1560
1617
|
this.targetCpu = options.targetCpu;
|
|
1618
|
+
this.targetTriple = options.targetTriple ?? "";
|
|
1561
1619
|
this.sanitizeAttributes = options.sanitizeAttributes !== false;
|
|
1562
1620
|
const copyable = !this.wasi &&
|
|
1563
1621
|
mod.lib === undefined &&
|
|
1564
1622
|
this.debug === null &&
|
|
1565
1623
|
/^(x86_64|amd64|x64)\b/.test(options.targetTriple || process.arch);
|
|
1566
|
-
this.cpuDispatch =
|
|
1624
|
+
this.cpuDispatch =
|
|
1625
|
+
options.cpuDispatch === true &&
|
|
1626
|
+
options.targetCpu === undefined &&
|
|
1627
|
+
copyable &&
|
|
1628
|
+
options.profileGenerate !== true;
|
|
1629
|
+
this.cpuCopyFunctions = options.cpuCopyFunctions;
|
|
1630
|
+
this.cpuCopyCapBytes = options.cpuCopyCapBytes;
|
|
1631
|
+
this.keepCopyBodiesOutOfLine =
|
|
1632
|
+
options.cpuDispatch === true && options.profileGenerate === true && copyable;
|
|
1567
1633
|
this.cpuCopies = this.cpuDispatch
|
|
1568
1634
|
? "dispatch"
|
|
1569
1635
|
: options.targetCpu === "x86-64-v3" && copyable
|
|
@@ -1798,8 +1864,9 @@ export class LlEmitter {
|
|
|
1798
1864
|
// Worker programs keep one allocator per script thread: the inline
|
|
1799
1865
|
// paths address its thread-local state.
|
|
1800
1866
|
threadLocalAlloc: mod.workers === true,
|
|
1801
|
-
// Linux executables find a block's owner in the chunk map
|
|
1802
|
-
|
|
1867
|
+
// Linux executables find a block's owner in the chunk map, which
|
|
1868
|
+
// indexes the low 32 GiB by address; a window with a base has none.
|
|
1869
|
+
windowMap: options.lowRegion === true && compactRefBaseOf(options.targetTriple) === 0n,
|
|
1803
1870
|
rcHelpers: this.rcHelpers,
|
|
1804
1871
|
...(this.rcMode !== undefined ? { rcMode: this.rcMode } : {}),
|
|
1805
1872
|
...(this.rcHelpersNoinline ? { rcHelpersNoinline: true } : {}),
|
|
@@ -1817,8 +1884,10 @@ export class LlEmitter {
|
|
|
1817
1884
|
retypeGuardRef: (unionId) => this.retypeGuardRef(unionId),
|
|
1818
1885
|
fieldAbsentTestIn: (B, value, unionId) => this.fieldAbsentTestIn(B, value, unionId),
|
|
1819
1886
|
absentInstanceRef: (unionId) => this.absentInstanceRef(unionId),
|
|
1887
|
+
dynAbsentRef: () => this.dynAbsentRef(),
|
|
1820
1888
|
liveDynRefAdapter: (type) => this.liveDynRefAdapter(type),
|
|
1821
1889
|
usesDynBuiltinStream: () => this.usesDynBuiltinStream,
|
|
1890
|
+
jsObjectModel: () => jsObjectModelFact(this.runtimeFeatures),
|
|
1822
1891
|
liveDynUnionRefAdapter: (type) => this.liveDynUnionRefAdapter(type),
|
|
1823
1892
|
declBoundary: () => this.mod.declBoundary === true,
|
|
1824
1893
|
dynPromiseAdapter: (type) => this.dynPromiseAdapter(type),
|
|
@@ -2156,13 +2225,26 @@ export class LlEmitter {
|
|
|
2156
2225
|
emitFfiCallbackDefs() {
|
|
2157
2226
|
return emitFfiCallbackDefs(this);
|
|
2158
2227
|
}
|
|
2228
|
+
/** What a dispatching build copies: the profile's functions, when it uses
|
|
2229
|
+
* one, within the text budget. */
|
|
2230
|
+
copySelection() {
|
|
2231
|
+
const selection = {};
|
|
2232
|
+
if (this.cpuCopyFunctions !== undefined)
|
|
2233
|
+
selection.hot = this.cpuCopyFunctions;
|
|
2234
|
+
if (this.cpuCopyCapBytes !== undefined)
|
|
2235
|
+
selection.capBytes = this.cpuCopyCapBytes;
|
|
2236
|
+
return selection;
|
|
2237
|
+
}
|
|
2159
2238
|
emit() {
|
|
2160
2239
|
return this.emitParts().join("\n");
|
|
2161
2240
|
}
|
|
2162
2241
|
emitParts() {
|
|
2163
2242
|
const parts = emitParts(this);
|
|
2164
2243
|
const bridged = this.unwindAbi.size > 0 ? bridgePlainUnwindCalls(parts) : parts;
|
|
2165
|
-
const
|
|
2244
|
+
const profiled = this.keepCopyBodiesOutOfLine ? keepCopiedBodiesOutOfLine(bridged) : bridged;
|
|
2245
|
+
const out = this.cpuCopies === null
|
|
2246
|
+
? profiled
|
|
2247
|
+
: cloneForCpuDispatch(profiled, this.cpuCopies, this.cpuCopies === "dispatch" ? this.copySelection() : undefined);
|
|
2166
2248
|
return this.heapCensus === null ? out : [...out, this.heapCensus.definitions().join("\n")];
|
|
2167
2249
|
}
|
|
2168
2250
|
/** The entry point and JavaScript name of each named function the
|
|
@@ -2926,6 +3008,30 @@ export class LlEmitter {
|
|
|
2926
3008
|
this.immortalValues.add(name);
|
|
2927
3009
|
return name;
|
|
2928
3010
|
}
|
|
3011
|
+
/** The element data of the static array table at `at`
|
|
3012
|
+
* (ir/constant-tables.ts), which the array itself holds: the emitter also
|
|
3013
|
+
* places the header, `<sym>_h`, in static storage. Each table gets its own
|
|
3014
|
+
* pair, so two tables with equal elements stay distinct arrays —
|
|
3015
|
+
* `@`-refs, first-use order.
|
|
3016
|
+
*
|
|
3017
|
+
* The elements are rendered to their literals here, not in the module
|
|
3018
|
+
* writer: a chunk's result crosses a JSON boundary (emit-module.ts), and
|
|
3019
|
+
* JSON turns NaN and the infinities into null and negative zero into zero.
|
|
3020
|
+
* `f64Lit` is the exact bit pattern, so every element survives it. */
|
|
3021
|
+
staticArrayData(at, values, type) {
|
|
3022
|
+
const key = `${type}:${at.loc?.file}:${at.loc?.start}:${at.loc?.end}`;
|
|
3023
|
+
let c = this.arrayConstData.get(key);
|
|
3024
|
+
if (!c) {
|
|
3025
|
+
c = {
|
|
3026
|
+
sym: this.contentSymbol("sc_arr_const_", key),
|
|
3027
|
+
type,
|
|
3028
|
+
values: values.map((v) => (type === "i32" ? String(v) : f64Lit(v))),
|
|
3029
|
+
};
|
|
3030
|
+
this.arrayConstData.set(key, c);
|
|
3031
|
+
}
|
|
3032
|
+
this.journal?.entry("arrayConst", key, c);
|
|
3033
|
+
return { data: `@${c.sym}`, header: `@${c.sym}_h` };
|
|
3034
|
+
}
|
|
2929
3035
|
/** Interned NUL-terminated C-string constant (the scr_jb_puts /
|
|
2930
3036
|
* stringify-indent currency) — `@`-ref, first-use order. */
|
|
2931
3037
|
cstr(text) {
|
|
@@ -3021,6 +3127,15 @@ export class LlEmitter {
|
|
|
3021
3127
|
this.immortalValues.add(name);
|
|
3022
3128
|
return name;
|
|
3023
3129
|
}
|
|
3130
|
+
/** The ABSENT marker of an optional checked-dynamic record field slot
|
|
3131
|
+
* (IR fieldAbsent without a union). Address-compared, never dereferenced
|
|
3132
|
+
* by compiled code: reads select it to scr_dyn_undefined, presence tests
|
|
3133
|
+
* compare against it, and boxing omits it. */
|
|
3134
|
+
dynAbsentRef() {
|
|
3135
|
+
this.needsDynAbsent = true;
|
|
3136
|
+
this.immortalValues.add(DYN_ABSENT);
|
|
3137
|
+
return DYN_ABSENT;
|
|
3138
|
+
}
|
|
3024
3139
|
/** i1: a union value loaded from a field slot is the ABSENT state — the
|
|
3025
3140
|
* undefined arm's tag with the absent payload marker. */
|
|
3026
3141
|
fieldAbsentTest(value, unionId) {
|
|
@@ -4265,7 +4380,7 @@ export class LlEmitter {
|
|
|
4265
4380
|
}
|
|
4266
4381
|
const idx = B.tmp();
|
|
4267
4382
|
B.line(`${idx} = load i32, ptr ${ptr}${tags}`);
|
|
4268
|
-
for (const line of compactRefLoadLines(idx, v, `${v}.r`))
|
|
4383
|
+
for (const line of compactRefLoadLines(this.compactRefBase, idx, v, `${v}.r`))
|
|
4269
4384
|
B.line(line.trimStart());
|
|
4270
4385
|
return v;
|
|
4271
4386
|
}
|
|
@@ -5198,6 +5313,7 @@ export class LlEmitter {
|
|
|
5198
5313
|
usesGenSlots: this.usesGenSlots,
|
|
5199
5314
|
needsUnionNone: this.needsUnionNone,
|
|
5200
5315
|
needsNullableAbsent: this.needsNullableAbsent,
|
|
5316
|
+
needsDynAbsent: this.needsDynAbsent,
|
|
5201
5317
|
needsOom: this.needsOom,
|
|
5202
5318
|
needsBadTag: this.needsBadTag,
|
|
5203
5319
|
needsBadKey: this.needsBadKey,
|
|
@@ -5235,6 +5351,7 @@ export class LlEmitter {
|
|
|
5235
5351
|
this.usesGenSlots ||= flags.usesGenSlots;
|
|
5236
5352
|
this.needsUnionNone ||= flags.needsUnionNone;
|
|
5237
5353
|
this.needsNullableAbsent ||= flags.needsNullableAbsent;
|
|
5354
|
+
this.needsDynAbsent ||= flags.needsDynAbsent;
|
|
5238
5355
|
this.needsOom ||= flags.needsOom;
|
|
5239
5356
|
this.needsBadTag ||= flags.needsBadTag;
|
|
5240
5357
|
this.needsBadKey ||= flags.needsBadKey;
|
|
@@ -5303,6 +5420,9 @@ export class LlEmitter {
|
|
|
5303
5420
|
case "cstr":
|
|
5304
5421
|
this.addContentEntry(this.cstrs, key, value, "sc_cs_", names);
|
|
5305
5422
|
return;
|
|
5423
|
+
case "arrayConst":
|
|
5424
|
+
this.addContentEntry(this.arrayConstData, key, value, "sc_arr_const_", names);
|
|
5425
|
+
return;
|
|
5306
5426
|
case "mapOps": {
|
|
5307
5427
|
let own = this.mapOpsConsts.get(key);
|
|
5308
5428
|
if (own === undefined) {
|
|
@@ -6568,6 +6688,7 @@ export class LlEmitter {
|
|
|
6568
6688
|
declare: (decl) => this.declare(decl),
|
|
6569
6689
|
cstr: (text) => this.cstr(text),
|
|
6570
6690
|
sizeType: this.sizeType,
|
|
6691
|
+
compactRefBase: this.compactRefBase,
|
|
6571
6692
|
rcAudit: this.shapeHost.objectAudit !== false,
|
|
6572
6693
|
tracedShapes: this.tracedShapes,
|
|
6573
6694
|
unionsById: this.unionsById,
|