@scriptc/compiler 0.2.7 → 0.2.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/scriptc-node-fallback.d.ts +3 -0
- package/dist/backend/cycle-analysis.js +50 -17
- package/dist/backend/cycle-analysis.js.map +1 -1
- package/dist/backend/cycle-analysis.test.js +138 -14
- package/dist/backend/cycle-analysis.test.js.map +1 -1
- package/dist/backend/cycle-mutability.d.ts +31 -6
- package/dist/backend/cycle-mutability.js +120 -18
- package/dist/backend/cycle-mutability.js.map +1 -1
- package/dist/backend/llvm/alloc.d.ts +16 -3
- package/dist/backend/llvm/alloc.js +78 -23
- package/dist/backend/llvm/alloc.js.map +1 -1
- package/dist/backend/llvm/alloc.test.js +5 -5
- package/dist/backend/llvm/alloc.test.js.map +1 -1
- package/dist/backend/llvm/blocks.d.ts +9 -0
- package/dist/backend/llvm/blocks.js +9 -0
- package/dist/backend/llvm/blocks.js.map +1 -1
- package/dist/backend/llvm/borrowed-receivers.d.ts +7 -0
- package/dist/backend/llvm/borrowed-receivers.js +39 -0
- package/dist/backend/llvm/borrowed-receivers.js.map +1 -1
- package/dist/backend/llvm/byte-numbers.js +2 -3
- package/dist/backend/llvm/byte-numbers.js.map +1 -1
- package/dist/backend/llvm/call-lifetimes.d.ts +4 -1
- package/dist/backend/llvm/call-lifetimes.js +14 -3
- package/dist/backend/llvm/call-lifetimes.js.map +1 -1
- package/dist/backend/llvm/call-lifetimes.test.js +8 -3
- package/dist/backend/llvm/call-lifetimes.test.js.map +1 -1
- package/dist/backend/llvm/checked-narrows.d.ts +24 -0
- package/dist/backend/llvm/checked-narrows.js +108 -0
- package/dist/backend/llvm/checked-narrows.js.map +1 -0
- package/dist/backend/llvm/checked-narrows.test.d.ts +1 -0
- package/dist/backend/llvm/checked-narrows.test.js +208 -0
- package/dist/backend/llvm/checked-narrows.test.js.map +1 -0
- package/dist/backend/llvm/classes.d.ts +13 -1
- package/dist/backend/llvm/classes.js +32 -23
- package/dist/backend/llvm/classes.js.map +1 -1
- package/dist/backend/llvm/classes.test.js +32 -3
- package/dist/backend/llvm/classes.test.js.map +1 -1
- package/dist/backend/llvm/common.d.ts +17 -0
- package/dist/backend/llvm/common.js +28 -0
- package/dist/backend/llvm/common.js.map +1 -1
- package/dist/backend/llvm/debug-info.d.ts +6 -2
- package/dist/backend/llvm/debug-info.js +11 -1
- package/dist/backend/llvm/debug-info.js.map +1 -1
- package/dist/backend/llvm/dense-array-access.js +1 -1
- package/dist/backend/llvm/dense-array-access.test.js +89 -0
- package/dist/backend/llvm/dense-array-access.test.js.map +1 -1
- package/dist/backend/llvm/dyn.d.ts +8 -4
- package/dist/backend/llvm/dyn.js +58 -31
- package/dist/backend/llvm/dyn.js.map +1 -1
- package/dist/backend/llvm/emitter.d.ts +227 -12
- package/dist/backend/llvm/emitter.js +1492 -169
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/backend/llvm/emitter.test.js +54 -1
- package/dist/backend/llvm/emitter.test.js.map +1 -1
- package/dist/backend/llvm/expr-async.js +4 -4
- package/dist/backend/llvm/expr-async.js.map +1 -1
- package/dist/backend/llvm/expr-bytes.d.ts +1 -1
- package/dist/backend/llvm/expr-bytes.js +116 -32
- package/dist/backend/llvm/expr-bytes.js.map +1 -1
- package/dist/backend/llvm/expr-callbacks.js +29 -21
- package/dist/backend/llvm/expr-callbacks.js.map +1 -1
- package/dist/backend/llvm/expr-calls.d.ts +5 -0
- package/dist/backend/llvm/expr-calls.js +55 -10
- package/dist/backend/llvm/expr-calls.js.map +1 -1
- package/dist/backend/llvm/expr-containers.d.ts +7 -1
- package/dist/backend/llvm/expr-containers.js +231 -28
- package/dist/backend/llvm/expr-containers.js.map +1 -1
- package/dist/backend/llvm/expr-context.d.ts +2 -0
- package/dist/backend/llvm/expr-control.js +70 -14
- package/dist/backend/llvm/expr-control.js.map +1 -1
- package/dist/backend/llvm/expr-dynamic.js +75 -21
- package/dist/backend/llvm/expr-dynamic.js.map +1 -1
- package/dist/backend/llvm/expr-island.js +3 -8
- package/dist/backend/llvm/expr-island.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.js +41 -12
- package/dist/backend/llvm/expr-primitives.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.test.js +50 -2
- package/dist/backend/llvm/expr-primitives.test.js.map +1 -1
- package/dist/backend/llvm/expr-records.js +28 -14
- package/dist/backend/llvm/expr-records.js.map +1 -1
- package/dist/backend/llvm/expr-stream-bridges.d.ts +3 -0
- package/dist/backend/llvm/expr-stream-bridges.js +114 -42
- package/dist/backend/llvm/expr-stream-bridges.js.map +1 -1
- package/dist/backend/llvm/expr-stream-callbacks.js +6 -3
- package/dist/backend/llvm/expr-stream-callbacks.js.map +1 -1
- package/dist/backend/llvm/layouts.d.ts +2 -1
- package/dist/backend/llvm/layouts.js +2 -2
- package/dist/backend/llvm/layouts.js.map +1 -1
- package/dist/backend/llvm/lib-abi.js +10 -0
- package/dist/backend/llvm/lib-abi.js.map +1 -1
- package/dist/backend/llvm/lib-filesystem.js +25 -13
- package/dist/backend/llvm/lib-filesystem.js.map +1 -1
- package/dist/backend/llvm/lib-process.js +8 -8
- package/dist/backend/llvm/lib-process.js.map +1 -1
- package/dist/backend/llvm/lib-shared.js +2 -0
- package/dist/backend/llvm/lib-shared.js.map +1 -1
- package/dist/backend/llvm/local-array-reads.d.ts +17 -6
- package/dist/backend/llvm/local-array-reads.js +223 -51
- package/dist/backend/llvm/local-array-reads.js.map +1 -1
- package/dist/backend/llvm/local-array-reads.test.js +7 -3
- package/dist/backend/llvm/local-array-reads.test.js.map +1 -1
- package/dist/backend/llvm/local-union-storage.js +10 -6
- package/dist/backend/llvm/local-union-storage.js.map +1 -1
- package/dist/backend/llvm/local-union-storage.test.js +3 -2
- package/dist/backend/llvm/local-union-storage.test.js.map +1 -1
- package/dist/backend/llvm/map-number-lookup.d.ts +18 -0
- package/dist/backend/llvm/map-number-lookup.js +62 -0
- package/dist/backend/llvm/map-number-lookup.js.map +1 -0
- package/dist/backend/llvm/map-read-lifetimes.d.ts +6 -0
- package/dist/backend/llvm/map-read-lifetimes.js +24 -3
- package/dist/backend/llvm/map-read-lifetimes.js.map +1 -1
- package/dist/backend/llvm/map-read-lifetimes.test.js +38 -19
- package/dist/backend/llvm/map-read-lifetimes.test.js.map +1 -1
- package/dist/backend/llvm/nullable-unions.d.ts +68 -0
- package/dist/backend/llvm/nullable-unions.js +132 -0
- package/dist/backend/llvm/nullable-unions.js.map +1 -0
- package/dist/backend/llvm/publish.d.ts +58 -0
- package/dist/backend/llvm/publish.js +286 -0
- package/dist/backend/llvm/publish.js.map +1 -0
- package/dist/backend/llvm/rebound-parameters.d.ts +12 -0
- package/dist/backend/llvm/rebound-parameters.js +72 -0
- package/dist/backend/llvm/rebound-parameters.js.map +1 -0
- package/dist/backend/llvm/rebound-parameters.test.d.ts +1 -0
- package/dist/backend/llvm/rebound-parameters.test.js +67 -0
- package/dist/backend/llvm/rebound-parameters.test.js.map +1 -0
- package/dist/backend/llvm/reference-effects.d.ts +18 -2
- package/dist/backend/llvm/reference-effects.js +140 -17
- package/dist/backend/llvm/reference-effects.js.map +1 -1
- package/dist/backend/llvm/reference-effects.test.js +52 -1
- package/dist/backend/llvm/reference-effects.test.js.map +1 -1
- package/dist/backend/llvm/shapes.d.ts +58 -19
- package/dist/backend/llvm/shapes.js +171 -62
- package/dist/backend/llvm/shapes.js.map +1 -1
- package/dist/backend/llvm/shapes.test.js +36 -11
- package/dist/backend/llvm/shapes.test.js.map +1 -1
- package/dist/backend/llvm/stack-unions.test.js +5 -2
- package/dist/backend/llvm/stack-unions.test.js.map +1 -1
- package/dist/backend/llvm/string-construction.d.ts +10 -0
- package/dist/backend/llvm/string-construction.js +42 -0
- package/dist/backend/llvm/string-construction.js.map +1 -1
- package/dist/backend/llvm/string-key-hash.d.ts +9 -2
- package/dist/backend/llvm/string-key-hash.js +20 -3
- package/dist/backend/llvm/string-key-hash.js.map +1 -1
- package/dist/backend/llvm/string-key-hash.test.js +14 -3
- package/dist/backend/llvm/string-key-hash.test.js.map +1 -1
- package/dist/backend/llvm/string-lifetimes.test.js +24 -11
- package/dist/backend/llvm/string-lifetimes.test.js.map +1 -1
- package/dist/backend/llvm/string-reads.d.ts +7 -0
- package/dist/backend/llvm/string-reads.js +79 -0
- package/dist/backend/llvm/string-reads.js.map +1 -0
- package/dist/backend/llvm/string-slices.js +1 -1
- package/dist/backend/llvm/switch-dispatch.test.js +1 -1
- package/dist/backend/llvm/switch-dispatch.test.js.map +1 -1
- package/dist/backend/llvm/test-boxed-unions.d.ts +5 -0
- package/dist/backend/llvm/test-boxed-unions.js +13 -0
- package/dist/backend/llvm/test-boxed-unions.js.map +1 -0
- package/dist/backend/llvm/trunc.d.ts +8 -0
- package/dist/backend/llvm/trunc.js +28 -0
- package/dist/backend/llvm/trunc.js.map +1 -0
- package/dist/backend/llvm/union-repr.d.ts +15 -0
- package/dist/backend/llvm/union-repr.js +89 -0
- package/dist/backend/llvm/union-repr.js.map +1 -0
- package/dist/backend/llvm/virtual-borrows.d.ts +31 -0
- package/dist/backend/llvm/virtual-borrows.js +82 -0
- package/dist/backend/llvm/virtual-borrows.js.map +1 -0
- package/dist/backend/llvm/walk-borrows.d.ts +43 -0
- package/dist/backend/llvm/walk-borrows.js +150 -0
- package/dist/backend/llvm/walk-borrows.js.map +1 -0
- package/dist/backend/llvm/walk-borrows.test.d.ts +1 -0
- package/dist/backend/llvm/walk-borrows.test.js +119 -0
- package/dist/backend/llvm/walk-borrows.test.js.map +1 -0
- package/dist/backend/llvm/walkers.d.ts +5 -1
- package/dist/backend/llvm/walkers.js +24 -21
- package/dist/backend/llvm/walkers.js.map +1 -1
- package/dist/backend/loop-polls.d.ts +14 -0
- package/dist/backend/loop-polls.js +100 -0
- package/dist/backend/loop-polls.js.map +1 -0
- package/dist/backend/loop-polls.test.d.ts +1 -0
- package/dist/backend/loop-polls.test.js +86 -0
- package/dist/backend/loop-polls.test.js.map +1 -0
- package/dist/backend/may-throw.d.ts +29 -1
- package/dist/backend/may-throw.js +365 -3
- package/dist/backend/may-throw.js.map +1 -1
- package/dist/backend/may-throw.test.js +136 -1
- package/dist/backend/may-throw.test.js.map +1 -1
- package/dist/backend/native/runtime-inputs.d.ts +1 -1
- package/dist/backend/native/runtime-inputs.js +1 -0
- package/dist/backend/native/runtime-inputs.js.map +1 -1
- package/dist/backend/native-codegen-core.d.ts +7 -5
- package/dist/backend/native-codegen-core.js +14 -9
- package/dist/backend/native-codegen-core.js.map +1 -1
- package/dist/backend/native-codegen.d.ts +2 -0
- package/dist/backend/native-codegen.js +21 -2
- package/dist/backend/native-codegen.js.map +1 -1
- package/dist/backend/native-codegen.test.js +41 -10
- package/dist/backend/native-codegen.test.js.map +1 -1
- package/dist/backend/native-tools.d.ts +2 -0
- package/dist/backend/native-tools.js +3 -0
- package/dist/backend/native-tools.js.map +1 -1
- package/dist/backend/publication.d.ts +28 -0
- package/dist/backend/publication.js +155 -0
- package/dist/backend/publication.js.map +1 -0
- package/dist/backend/publication.test.d.ts +1 -0
- package/dist/backend/publication.test.js +72 -0
- package/dist/backend/publication.test.js.map +1 -0
- package/dist/backend/runtime-abi.d.ts +2 -2
- package/dist/backend/runtime-abi.js +2 -2
- package/dist/backend/runtime-abi.js.map +1 -1
- package/dist/backend/runtime-pack-targets.test.js +1 -1
- package/dist/backend/runtime-pack-targets.test.js.map +1 -1
- package/dist/backend/runtime-pack.test.js +1 -1
- package/dist/backend/runtime-pack.test.js.map +1 -1
- package/dist/cli/command.js +78 -8
- package/dist/cli/command.js.map +1 -1
- 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 +8 -1
- package/dist/cli/usage.js +14 -1
- package/dist/cli/usage.js.map +1 -1
- package/dist/compile-types.d.ts +17 -3
- package/dist/coverage/report.d.ts +25 -2
- package/dist/coverage/report.js +161 -33
- package/dist/coverage/report.js.map +1 -1
- package/dist/coverage/verdict-cache.d.ts +63 -0
- package/dist/coverage/verdict-cache.js +193 -0
- package/dist/coverage/verdict-cache.js.map +1 -0
- package/dist/coverage/verdict-cache.test.d.ts +1 -0
- package/dist/coverage/verdict-cache.test.js +52 -0
- package/dist/coverage/verdict-cache.test.js.map +1 -0
- package/dist/coverage/verdict-semantic.d.ts +2 -0
- package/dist/coverage/verdict-semantic.js +24 -0
- package/dist/coverage/verdict-semantic.js.map +1 -0
- package/dist/coverage/verdict-startup.d.ts +15 -0
- package/dist/coverage/verdict-startup.js +66 -0
- package/dist/coverage/verdict-startup.js.map +1 -0
- package/dist/diagnostics/diagnostic.d.ts +29 -1
- package/dist/diagnostics/diagnostic.js +74 -4
- package/dist/diagnostics/diagnostic.js.map +1 -1
- package/dist/diagnostics/envelope.d.ts +130 -0
- package/dist/diagnostics/envelope.js +257 -0
- package/dist/diagnostics/envelope.js.map +1 -0
- package/dist/diagnostics/envelope.test.d.ts +1 -0
- package/dist/diagnostics/envelope.test.js +91 -0
- package/dist/diagnostics/envelope.test.js.map +1 -0
- package/dist/diagnostics/render.d.ts +3 -0
- package/dist/diagnostics/render.js +13 -2
- package/dist/diagnostics/render.js.map +1 -1
- package/dist/executable/executable-cache.d.ts +2 -0
- package/dist/executable/executable-cache.js +3 -0
- package/dist/executable/executable-cache.js.map +1 -1
- package/dist/executable/executable-cache.test.js +1 -0
- package/dist/executable/executable-cache.test.js.map +1 -1
- package/dist/executable/prepare.d.ts +4 -0
- package/dist/executable/prepare.js +7 -1
- package/dist/executable/prepare.js.map +1 -1
- package/dist/frontend/analysis.js +1 -0
- package/dist/frontend/analysis.js.map +1 -1
- package/dist/frontend/lowering/array-values.d.ts +7 -0
- package/dist/frontend/lowering/array-values.js +157 -5
- package/dist/frontend/lowering/array-values.js.map +1 -1
- package/dist/frontend/lowering/builtins/numbers.js +29 -1
- package/dist/frontend/lowering/builtins/numbers.js.map +1 -1
- package/dist/frontend/lowering/builtins/process.d.ts +4 -0
- package/dist/frontend/lowering/builtins/process.js +10 -0
- package/dist/frontend/lowering/builtins/process.js.map +1 -1
- package/dist/frontend/lowering/builtins/strings.js +4 -1
- package/dist/frontend/lowering/builtins/strings.js.map +1 -1
- package/dist/frontend/lowering/builtins/workers.js +4 -2
- package/dist/frontend/lowering/builtins/workers.js.map +1 -1
- package/dist/frontend/lowering/call-arguments.js +96 -4
- package/dist/frontend/lowering/call-arguments.js.map +1 -1
- package/dist/frontend/lowering/class-assertions.d.ts +8 -0
- package/dist/frontend/lowering/class-assertions.js +217 -1
- package/dist/frontend/lowering/class-assertions.js.map +1 -1
- package/dist/frontend/lowering/class-dynamic-dispatch.js +8 -5
- package/dist/frontend/lowering/class-dynamic-dispatch.js.map +1 -1
- package/dist/frontend/lowering/class-method-mutations.js +88 -0
- package/dist/frontend/lowering/class-method-mutations.js.map +1 -1
- package/dist/frontend/lowering/coercions/state.d.ts +6 -0
- package/dist/frontend/lowering/coercions/state.js +2 -0
- package/dist/frontend/lowering/coercions/state.js.map +1 -1
- package/dist/frontend/lowering/coercions/unions.d.ts +8 -0
- package/dist/frontend/lowering/coercions/unions.js +67 -2
- package/dist/frontend/lowering/coercions/unions.js.map +1 -1
- package/dist/frontend/lowering/collation-repertoire.d.ts +1 -0
- package/dist/frontend/lowering/collation-repertoire.js +19 -0
- package/dist/frontend/lowering/collation-repertoire.js.map +1 -0
- package/dist/frontend/lowering/construction-escapes.d.ts +38 -0
- package/dist/frontend/lowering/construction-escapes.js +146 -0
- package/dist/frontend/lowering/construction-escapes.js.map +1 -0
- package/dist/frontend/lowering/construction-escapes.test.d.ts +1 -0
- package/dist/frontend/lowering/construction-escapes.test.js +150 -0
- package/dist/frontend/lowering/construction-escapes.test.js.map +1 -0
- package/dist/frontend/lowering/containers/array-callbacks.js +81 -44
- package/dist/frontend/lowering/containers/array-callbacks.js.map +1 -1
- package/dist/frontend/lowering/containers/array-construction.js +15 -2
- package/dist/frontend/lowering/containers/array-construction.js.map +1 -1
- package/dist/frontend/lowering/containers/array-methods.js +231 -12
- package/dist/frontend/lowering/containers/array-methods.js.map +1 -1
- package/dist/frontend/lowering/containers/bytes.js +15 -4
- package/dist/frontend/lowering/containers/bytes.js.map +1 -1
- package/dist/frontend/lowering/containers/callback-arguments.js +43 -1
- package/dist/frontend/lowering/containers/callback-arguments.js.map +1 -1
- package/dist/frontend/lowering/containers/string-and-regexp.js +7 -63
- package/dist/frontend/lowering/containers/string-and-regexp.js.map +1 -1
- package/dist/frontend/lowering/cycle-initialization.d.ts +6 -1
- package/dist/frontend/lowering/cycle-initialization.js +59 -33
- package/dist/frontend/lowering/cycle-initialization.js.map +1 -1
- package/dist/frontend/lowering/divergences.d.ts +9 -0
- package/dist/frontend/lowering/divergences.js +630 -0
- package/dist/frontend/lowering/divergences.js.map +1 -0
- package/dist/frontend/lowering/expressions/object-literals.js +40 -2
- package/dist/frontend/lowering/expressions/object-literals.js.map +1 -1
- package/dist/frontend/lowering/expressions/union-fields.d.ts +19 -0
- package/dist/frontend/lowering/expressions/union-fields.js +236 -0
- package/dist/frontend/lowering/expressions/union-fields.js.map +1 -0
- package/dist/frontend/lowering/lower-calls.d.ts +5 -0
- package/dist/frontend/lowering/lower-calls.js +237 -158
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-classes.d.ts +4 -0
- package/dist/frontend/lowering/lower-classes.js +72 -22
- package/dist/frontend/lowering/lower-classes.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.d.ts +19 -0
- package/dist/frontend/lowering/lower-exprs.js +592 -109
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-generators.d.ts +19 -13
- package/dist/frontend/lowering/lower-generators.js +67 -44
- package/dist/frontend/lowering/lower-generators.js.map +1 -1
- package/dist/frontend/lowering/lower-inspect.js +3 -2
- package/dist/frontend/lowering/lower-inspect.js.map +1 -1
- package/dist/frontend/lowering/lower-island.d.ts +1 -1
- package/dist/frontend/lowering/lower-island.js +10 -7
- package/dist/frontend/lowering/lower-island.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.js +90 -1
- package/dist/frontend/lowering/lower-modules.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.js +47 -7
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +83 -2
- package/dist/frontend/lowering/lowerer.js +1158 -79
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/lowering/nan-coded-reads.d.ts +161 -0
- package/dist/frontend/lowering/nan-coded-reads.js +1342 -0
- package/dist/frontend/lowering/nan-coded-reads.js.map +1 -0
- package/dist/frontend/lowering/runtime-optional-bounds.d.ts +31 -0
- package/dist/frontend/lowering/runtime-optional-bounds.js +360 -0
- package/dist/frontend/lowering/runtime-optional-bounds.js.map +1 -0
- package/dist/frontend/lowering/runtime-optional-bounds.test.d.ts +1 -0
- package/dist/frontend/lowering/runtime-optional-bounds.test.js +94 -0
- package/dist/frontend/lowering/runtime-optional-bounds.test.js.map +1 -0
- package/dist/frontend/lowering/runtime-optional-elements.d.ts +117 -0
- package/dist/frontend/lowering/runtime-optional-elements.js +738 -0
- package/dist/frontend/lowering/runtime-optional-elements.js.map +1 -0
- package/dist/frontend/lowering/runtime-optional-guards.d.ts +36 -0
- package/dist/frontend/lowering/runtime-optional-guards.js +375 -0
- package/dist/frontend/lowering/runtime-optional-guards.js.map +1 -0
- package/dist/frontend/lowering/runtime-optional-guards.test.d.ts +1 -0
- package/dist/frontend/lowering/runtime-optional-guards.test.js +92 -0
- package/dist/frontend/lowering/runtime-optional-guards.test.js.map +1 -0
- package/dist/frontend/lowering/runtime-optional-ownership.d.ts +63 -0
- package/dist/frontend/lowering/runtime-optional-ownership.js +382 -0
- package/dist/frontend/lowering/runtime-optional-ownership.js.map +1 -0
- package/dist/frontend/lowering/runtime-optional-provenance.d.ts +2 -1
- package/dist/frontend/lowering/runtime-optional-provenance.js +2 -1
- package/dist/frontend/lowering/runtime-optional-provenance.js.map +1 -1
- package/dist/frontend/lowering/string-index-bounds.d.ts +36 -0
- package/dist/frontend/lowering/string-index-bounds.js +537 -0
- package/dist/frontend/lowering/string-index-bounds.js.map +1 -0
- package/dist/frontend/lowering/string-index-bounds.test.d.ts +1 -0
- package/dist/frontend/lowering/string-index-bounds.test.js +223 -0
- package/dist/frontend/lowering/string-index-bounds.test.js.map +1 -0
- package/dist/frontend/lowering/surfaces.js +8 -0
- package/dist/frontend/lowering/surfaces.js.map +1 -1
- package/dist/frontend/lowering/union-narrow.d.ts +2 -0
- package/dist/frontend/lowering/union-narrow.js +10 -6
- package/dist/frontend/lowering/union-narrow.js.map +1 -1
- package/dist/frontend/program-analysis.d.ts +10 -0
- package/dist/frontend/program-analysis.js +7 -0
- package/dist/frontend/program-analysis.js.map +1 -1
- package/dist/frontend/program.d.ts +25 -0
- package/dist/frontend/program.js +613 -17
- package/dist/frontend/program.js.map +1 -1
- package/dist/frontend/program.test.js +64 -1
- package/dist/frontend/program.test.js.map +1 -1
- package/dist/frontend/resolve.d.ts +6 -0
- package/dist/frontend/resolve.js +14 -0
- package/dist/frontend/resolve.js.map +1 -1
- package/dist/frontend/threads-import.d.ts +5 -0
- package/dist/frontend/threads-import.js +21 -0
- package/dist/frontend/threads-import.js.map +1 -0
- package/dist/frontend/type-mapper.d.ts +3 -0
- package/dist/frontend/type-mapper.js +72 -6
- package/dist/frontend/type-mapper.js.map +1 -1
- package/dist/frontend/worker-target.d.ts +4 -0
- package/dist/frontend/worker-target.js +8 -1
- package/dist/frontend/worker-target.js.map +1 -1
- package/dist/index.d.ts +7 -2
- package/dist/index.js +67 -17
- package/dist/index.js.map +1 -1
- package/dist/ir/build.d.ts +5 -0
- package/dist/ir/build.js +7 -0
- package/dist/ir/build.js.map +1 -1
- package/dist/ir/builtin-signatures.d.ts +1 -1
- package/dist/ir/builtin-signatures.js +5 -0
- package/dist/ir/builtin-signatures.js.map +1 -1
- package/dist/ir/constant-globals.d.ts +14 -0
- package/dist/ir/constant-globals.js +81 -0
- package/dist/ir/constant-globals.js.map +1 -0
- package/dist/ir/constant-globals.test.d.ts +1 -0
- package/dist/ir/constant-globals.test.js +97 -0
- package/dist/ir/constant-globals.test.js.map +1 -0
- package/dist/ir/final-fields.d.ts +35 -0
- package/dist/ir/final-fields.js +187 -0
- package/dist/ir/final-fields.js.map +1 -0
- package/dist/ir/final-fields.test.d.ts +1 -0
- package/dist/ir/final-fields.test.js +106 -0
- package/dist/ir/final-fields.test.js.map +1 -0
- package/dist/ir/int32-slots.d.ts +81 -0
- package/dist/ir/int32-slots.js +850 -0
- package/dist/ir/int32-slots.js.map +1 -0
- package/dist/ir/int32-slots.test.d.ts +1 -0
- package/dist/ir/int32-slots.test.js +249 -0
- package/dist/ir/int32-slots.test.js.map +1 -0
- package/dist/ir/integer-loops.d.ts +5 -0
- package/dist/ir/integer-loops.js +20 -4
- package/dist/ir/integer-loops.js.map +1 -1
- package/dist/ir/integer-loops.test.js +17 -0
- package/dist/ir/integer-loops.test.js.map +1 -1
- package/dist/ir/integer-ranges.d.ts +19 -3
- package/dist/ir/integer-ranges.js +168 -23
- package/dist/ir/integer-ranges.js.map +1 -1
- package/dist/ir/integer-ranges.test.js +74 -2
- package/dist/ir/integer-ranges.test.js.map +1 -1
- package/dist/ir/ir.d.ts +30 -7
- package/dist/ir/ir.js +4 -0
- package/dist/ir/ir.js.map +1 -1
- package/dist/ir/serialize.d.ts +12 -2
- package/dist/ir/serialize.js +190 -39
- package/dist/ir/serialize.js.map +1 -1
- package/dist/ir/serialize.test.js +65 -1
- package/dist/ir/serialize.test.js.map +1 -1
- package/dist/ir/validate.js +21 -2
- package/dist/ir/validate.js.map +1 -1
- package/dist/ir/validate.test.js +39 -0
- package/dist/ir/validate.test.js.map +1 -1
- package/dist/native/cache.d.ts +11 -1
- package/dist/native/cache.js +87 -2
- package/dist/native/cache.js.map +1 -1
- package/dist/native/cache.test.js +32 -1
- package/dist/native/cache.test.js.map +1 -1
- package/dist/native/cli.js +1 -1
- package/dist/native/cli.js.map +1 -1
- package/dist/native/compiler.d.ts +5 -0
- package/dist/native/compiler.js +55 -7
- package/dist/native/compiler.js.map +1 -1
- package/dist/native/prepare.d.ts +7 -1
- package/dist/native/prepare.js +65 -29
- package/dist/native/prepare.js.map +1 -1
- package/dist/native/prepare.test.js +23 -1
- package/dist/native/prepare.test.js.map +1 -1
- package/dist/native/text-file.d.ts +10 -0
- package/dist/native/text-file.js +41 -0
- package/dist/native/text-file.js.map +1 -0
- package/dist/startup-cache.d.ts +2 -0
- package/dist/startup-cache.js +2 -0
- package/dist/startup-cache.js.map +1 -1
- package/dist/text-parts.d.ts +5 -0
- package/dist/text-parts.js +36 -0
- package/dist/text-parts.js.map +1 -0
- package/package.json +20 -20
- package/surface-manifest.json +7 -1
- package/dist/frontend/lowering/expressions/union-field-write.d.ts +0 -8
- package/dist/frontend/lowering/expressions/union-field-write.js +0 -108
- package/dist/frontend/lowering/expressions/union-field-write.js.map +0 -1
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import type { IrBytesElem, IrExpr, IrFfiImport, IrFunction, IrLocal, IrModule, IrRecordShape, IrStmt, IrType, IrUnionDef, SrcLoc } from "../../ir/ir.js";
|
|
2
2
|
import { type SplitSpan } from "./split-loops.js";
|
|
3
3
|
import { type IntegerRanges } from "../../ir/integer-ranges.js";
|
|
4
|
+
import { type Int32Slots } from "../../ir/int32-slots.js";
|
|
4
5
|
import { type ConstantNumericTable } from "../../ir/constant-tables.js";
|
|
5
6
|
import { type FfiCallbackAdapter } from "../ffi-callbacks.js";
|
|
6
7
|
import { type CallLifetimes } from "./call-lifetimes.js";
|
|
7
8
|
import { BlockBuilder } from "./blocks.js";
|
|
8
9
|
import { NullableRefFields, type NullableRefField } from "./nullable-fields.js";
|
|
9
10
|
import { OptionalArrayReads, type LocalArrayRead } from "./local-array-reads.js";
|
|
11
|
+
import { CheckedNarrows } from "./checked-narrows.js";
|
|
10
12
|
import { type MapReadLifetimes } from "./map-read-lifetimes.js";
|
|
11
13
|
import { ReferenceEffects } from "./reference-effects.js";
|
|
12
14
|
import { StackCallbacks } from "./stack-callbacks.js";
|
|
13
15
|
import { AmbientReceiverReaders } from "./constant-callbacks.js";
|
|
14
16
|
import { type StringSliceSnapshot } from "./string-slices.js";
|
|
17
|
+
import { type PublishedTypes } from "../publication.js";
|
|
15
18
|
import { type LlClassMeta } from "./classes.js";
|
|
16
19
|
import { LlDyn, type DynHost } from "./dyn.js";
|
|
17
20
|
import { LlWalkers } from "./walkers.js";
|
|
21
|
+
import { NullableUnions } from "./nullable-unions.js";
|
|
18
22
|
import { type MapKeyAccess } from "./shapes.js";
|
|
19
23
|
import type { ExprOf, LibCallExpr, LlStreamTypedRefAdapter, LlValue } from "./expr-context.js";
|
|
20
24
|
export { LlvmUnsupportedError } from "./unsupported.js";
|
|
@@ -41,6 +45,10 @@ export interface LlvmTargetOptions {
|
|
|
41
45
|
/** Emit retain/release fast paths inline (the `speed` posture). Off, every
|
|
42
46
|
* retain and release is a runtime call. */
|
|
43
47
|
inlineRc?: boolean;
|
|
48
|
+
/** Define `scr_detached_exit` so the Linux runtime hands the address-space
|
|
49
|
+
* teardown after `process.exit` to a helper process (`--detached-exit`).
|
|
50
|
+
* Executables only; the runtime's weak default keeps it off. */
|
|
51
|
+
detachedExit?: boolean;
|
|
44
52
|
}
|
|
45
53
|
export declare function emitLlvmModule(mod: IrModule, options?: LlvmTargetOptions): string;
|
|
46
54
|
/** Keep large translation units below the host's single-string limit. */
|
|
@@ -69,19 +77,40 @@ export declare class LlEmitter {
|
|
|
69
77
|
private debugScope;
|
|
70
78
|
readonly sizeType: "i32" | "i64";
|
|
71
79
|
readonly ffiExtendNarrowIntegers: boolean;
|
|
72
|
-
readonly
|
|
80
|
+
readonly cycleBufferedOffset: number;
|
|
81
|
+
/** Emitted ScrCycType descriptors so far (their collector statistics
|
|
82
|
+
* indices; see ShapeHost.nextCycKind). */
|
|
83
|
+
private cycKinds;
|
|
73
84
|
readonly wasi: boolean;
|
|
85
|
+
/** The target lacks a rounding instruction at its baseline CPU (x86-64
|
|
86
|
+
* before SSE4.1), so `llvm.trunc` would lower to a libm call: emit
|
|
87
|
+
* truncation inline through an integer round trip instead. */
|
|
88
|
+
readonly inlineTrunc: boolean;
|
|
89
|
+
/** ELF worker executables give thread-locals the executable TLS models. */
|
|
90
|
+
private readonly executableTls;
|
|
91
|
+
/** Source loops enclosing the statement being emitted in the current
|
|
92
|
+
* function body. */
|
|
93
|
+
private loopDepth;
|
|
94
|
+
/** Darwin worker executables read the stack guard from a pthread
|
|
95
|
+
* thread-specific-data slot off the thread pointer (scr_runtime.h's
|
|
96
|
+
* SCR_STACK_GUARD_TSD): the architecture names the access sequence. */
|
|
97
|
+
private readonly stackGuardTsd;
|
|
74
98
|
private readonly emitLibraryIdentity;
|
|
75
99
|
private readonly runtimeAbiMarker;
|
|
100
|
+
private readonly detachedExit;
|
|
76
101
|
/** Interned string literals: UTF-8 text → { symbol, byte length } —
|
|
77
102
|
* first-use order, the runtime ABI’s determinism discipline. */
|
|
78
103
|
private readonly literals;
|
|
104
|
+
/** Symbols of interned constant data, named by content (contentSymbol). */
|
|
105
|
+
private readonly contentSymbols;
|
|
79
106
|
/** Interned unit-armed union instances: "unionId:tag" → symbol — one
|
|
80
107
|
* immortal (rc == SIZE_MAX) static per (union, unit tag).
|
|
81
108
|
* RC entry points and the collector skip immortals. */
|
|
82
109
|
private readonly unitInstances;
|
|
83
110
|
/** unionId → symbol of the union's immortal ABSENT field-slot instance. */
|
|
84
111
|
private readonly absentInstances;
|
|
112
|
+
/** The nullable-union ABSENT sentinel was referenced (absentInstanceRef). */
|
|
113
|
+
private needsNullableAbsent;
|
|
85
114
|
private readonly immortalValues;
|
|
86
115
|
/** Regex literal templates: "<flags>/<pattern>" → { symbol, interned
|
|
87
116
|
* source/flags literal refs } — one immortal ScrRegex template per distinct
|
|
@@ -131,6 +160,7 @@ export declare class LlEmitter {
|
|
|
131
160
|
private readonly fnDefText;
|
|
132
161
|
readonly referenceEffects: ReferenceEffects;
|
|
133
162
|
readonly optionalArrayReads: OptionalArrayReads;
|
|
163
|
+
readonly checkedNarrows: CheckedNarrows;
|
|
134
164
|
callArrayReads: Map<IrExpr, LocalArrayRead>;
|
|
135
165
|
mapReadLifetimes: MapReadLifetimes;
|
|
136
166
|
readonly callLifetimes: CallLifetimes;
|
|
@@ -148,6 +178,18 @@ export declare class LlEmitter {
|
|
|
148
178
|
/** Parameters proven projection-only: callers may pass stack boxes. */
|
|
149
179
|
private projectedParameters;
|
|
150
180
|
private stableCallBindings;
|
|
181
|
+
/** Locals and rebound parameters holding borrowed pointers for their
|
|
182
|
+
* whole lifetime (walk-borrows.ts), per function and for the current one. */
|
|
183
|
+
private readonly walkBorrowsByFunction;
|
|
184
|
+
private walkBorrows;
|
|
185
|
+
/** Functions whose borrowing body returns its result without a reference
|
|
186
|
+
* (analyzeBorrowedReturns), and whether the current body is one. */
|
|
187
|
+
readonly borrowedReturns: Set<string>;
|
|
188
|
+
/** Rebound parameters that keep the borrowed convention with an owner
|
|
189
|
+
* slot (rebound-parameters.ts), per function, and the current owner slots. */
|
|
190
|
+
private readonly reboundByFunction;
|
|
191
|
+
private readonly reboundOwnerSlots;
|
|
192
|
+
private currentBorrowedReturn;
|
|
151
193
|
/** Manifest-bound native imports, used by ffiCall emission. */
|
|
152
194
|
readonly ffiByName: Map<string, IrFfiImport>;
|
|
153
195
|
/** C-ABI callback trampolines and (for raw/no-userdata callbacks) their
|
|
@@ -166,6 +208,15 @@ export declare class LlEmitter {
|
|
|
166
208
|
* checks are emitted only after calls that can actually raise. */
|
|
167
209
|
readonly mayThrow: Set<string>;
|
|
168
210
|
readonly indirectMayThrow: boolean;
|
|
211
|
+
/** Worker programs: the functions that poll for termination on entry
|
|
212
|
+
* (workerTerminationPolls); null outside worker programs. */
|
|
213
|
+
private readonly workerEntryPolls;
|
|
214
|
+
/** Functions that check the native stack guard on entry
|
|
215
|
+
* (stackCheckedFunctions); null where the runtime has no guard. */
|
|
216
|
+
private readonly stackChecks;
|
|
217
|
+
/** Static types whose values can be published (@scriptc/threads): their
|
|
218
|
+
* stores carry the frozen-object guard. Null without publish calls. */
|
|
219
|
+
readonly publishedTypes: PublishedTypes | null;
|
|
169
220
|
/** Method names with at least one may-throw implementation — the
|
|
170
221
|
* virtualCall pending check's key. */
|
|
171
222
|
readonly mayThrowMethods: Set<string>;
|
|
@@ -187,6 +238,10 @@ export declare class LlEmitter {
|
|
|
187
238
|
readonly dynPromiseAdapters: Map<string, string>;
|
|
188
239
|
readonly unionsById: Map<string, IrUnionDef>;
|
|
189
240
|
readonly nullableFields: NullableRefFields;
|
|
241
|
+
/** Unions whose values are nullable arm pointers (nullable-unions.ts). */
|
|
242
|
+
readonly nullableUnions: NullableUnions;
|
|
243
|
+
/** The union table without nullable unions: the stack-box analyses. */
|
|
244
|
+
readonly boxedUnionsById: Map<string, IrUnionDef>;
|
|
190
245
|
readonly recordsById: Map<string, IrRecordShape>;
|
|
191
246
|
readonly recordCloneShapes: Set<string>;
|
|
192
247
|
readonly tracedShapes: Set<string>;
|
|
@@ -194,6 +249,8 @@ export declare class LlEmitter {
|
|
|
194
249
|
/** The class graph (buildClassGraph): preorder numbering, hierarchy
|
|
195
250
|
* membership, virtual slot lists. */
|
|
196
251
|
readonly classMeta: Map<string, LlClassMeta>;
|
|
252
|
+
/** Which vtable slots borrow which parameters (virtual-borrows.ts). */
|
|
253
|
+
private virtualBorrows;
|
|
197
254
|
/** Class objects (classes as first-class values): className → the
|
|
198
255
|
* interned .name literal ref — registered during body emission, the
|
|
199
256
|
* statics and construct thunks assemble around the bodies. */
|
|
@@ -233,6 +290,8 @@ export declare class LlEmitter {
|
|
|
233
290
|
private storedSplits;
|
|
234
291
|
private streamingSplitsEnabled;
|
|
235
292
|
private readonly initializerBindings;
|
|
293
|
+
/** Whole-program int32 storage and parameter/result facts. */
|
|
294
|
+
readonly int32Slots: Int32Slots;
|
|
236
295
|
private numericLocals;
|
|
237
296
|
private captureIds;
|
|
238
297
|
/** Active induction bindings retain their width independently of size_t. */
|
|
@@ -246,6 +305,11 @@ export declare class LlEmitter {
|
|
|
246
305
|
};
|
|
247
306
|
}>;
|
|
248
307
|
private countedLoopsEnabled;
|
|
308
|
+
/** Whole-program final reference fields (ir/final-fields.ts). */
|
|
309
|
+
private finalFields;
|
|
310
|
+
/** The current function may borrow final fields of borrowable objects:
|
|
311
|
+
* not a constructor (where they change), not async or a generator. */
|
|
312
|
+
private finalFieldBorrows;
|
|
249
313
|
integerRanges: IntegerRanges;
|
|
250
314
|
private byteWindowsEnabled;
|
|
251
315
|
private byteWindowEntries;
|
|
@@ -293,6 +357,11 @@ export declare class LlEmitter {
|
|
|
293
357
|
logArgSlots: number;
|
|
294
358
|
private readonly stackTraces;
|
|
295
359
|
constructor(mod: IrModule, options: LlvmTargetOptions);
|
|
360
|
+
/** The borrowed parameters of a hierarchy's vtable slot (empty: owned). */
|
|
361
|
+
virtualSlotBorrowed(rootName: string, slotIndex: number): ReadonlySet<number>;
|
|
362
|
+
/** The vtable entry for one implementation (VirtualBorrows.entry). */
|
|
363
|
+
virtualEntry(implFn: string): string;
|
|
364
|
+
private implSlotBorrowed;
|
|
296
365
|
abiOffset(native64: number, wasm32: number): number;
|
|
297
366
|
llType(t: IrType): string;
|
|
298
367
|
ffiCallbackAdapter(binding: string, id: string): FfiCallbackAdapter;
|
|
@@ -303,6 +372,7 @@ export declare class LlEmitter {
|
|
|
303
372
|
private emitFfiCallbackDefs;
|
|
304
373
|
emit(): string;
|
|
305
374
|
emitParts(): string[];
|
|
375
|
+
private emitModuleParts;
|
|
306
376
|
/** LIBRARY mode: the profile-declared external definitions — the
|
|
307
377
|
* export-map wrappers plus init / sink-registration / reset / collect.
|
|
308
378
|
* Plain `define` (not `define internal`) — the exact linkage distinction
|
|
@@ -367,6 +437,12 @@ export declare class LlEmitter {
|
|
|
367
437
|
* spawn wrapper that only ALLOCATES the suspended fiber, and the
|
|
368
438
|
* never-started teardown that drops the packed (+1) arguments. */
|
|
369
439
|
private emitGenScaffolding;
|
|
440
|
+
/** A symbol derived from the constant's text rather than its first-use
|
|
441
|
+
* index, so an edit that interns one more string leaves every other
|
|
442
|
+
* constant's symbol, and the code referencing it, unchanged. This lets
|
|
443
|
+
* native builds reuse the compiled partitions an edit does not touch. A
|
|
444
|
+
* collision retries with a counter, still in first-use order. */
|
|
445
|
+
private contentSymbol;
|
|
370
446
|
internLiteral(text: string): string;
|
|
371
447
|
/** Interned NUL-terminated C-string constant (the scr_jb_puts /
|
|
372
448
|
* stringify-indent currency) — `@`-ref, first-use order. */
|
|
@@ -383,6 +459,9 @@ export declare class LlEmitter {
|
|
|
383
459
|
/** i1: a union value loaded from a field slot is the ABSENT state — the
|
|
384
460
|
* undefined arm's tag with the absent payload marker. */
|
|
385
461
|
fieldAbsentTest(value: string, unionId: string): string;
|
|
462
|
+
/** fieldAbsentTest in another block builder (helper generators). A
|
|
463
|
+
* nullable union's ABSENT state is the module's immortal sentinel. */
|
|
464
|
+
fieldAbsentTestIn(B: BlockBuilder, value: string, unionId: string): string;
|
|
386
465
|
/** Loads a record field slot as a VALUE: an undefined-armed union slot
|
|
387
466
|
* holding the ABSENT state surfaces as the ordinary undefined arm, so
|
|
388
467
|
* absence never travels beyond its slot (a later `{ f: r.f }` is an
|
|
@@ -391,6 +470,12 @@ export declare class LlEmitter {
|
|
|
391
470
|
declare(decl: string): void;
|
|
392
471
|
needOom(): void;
|
|
393
472
|
private currentFrame;
|
|
473
|
+
/** Whether a value is immortal: an interned constant, or a temp marked by
|
|
474
|
+
* markImmortal. */
|
|
475
|
+
private isImmortal;
|
|
476
|
+
/** Record that a temp holds an immortal value (a choice between interned
|
|
477
|
+
* literals): nothing owns it, and retains, releases and moves skip it. */
|
|
478
|
+
markImmortal(v: LlValue): LlValue;
|
|
394
479
|
/** Registers an owned refcounted value on the current statement frame. */
|
|
395
480
|
own(v: LlValue): LlValue;
|
|
396
481
|
/** Registers a SLOT whose current contents the frame owns (conditional
|
|
@@ -420,13 +505,51 @@ export declare class LlEmitter {
|
|
|
420
505
|
* function — and branch to the handler / return a dummy value (never
|
|
421
506
|
* read: callers of a may-throw function test the pending flag before
|
|
422
507
|
* using the result). Callers own the surrounding pending branch; a
|
|
423
|
-
* `throw` unwinds unconditionally.
|
|
508
|
+
* `throw` unwinds unconditionally. `passThrough` names a scalar call
|
|
509
|
+
* result of the function's own return type: with nothing to release, the
|
|
510
|
+
* unwind returns it as the dummy, so a call in tail position keeps a single
|
|
511
|
+
* return and stays eligible for tail-call and recursion elimination. */
|
|
424
512
|
private emitUnwind;
|
|
513
|
+
/** Loads the running thread's exact pending word (ELF worker
|
|
514
|
+
* executables, scr_exception.c): bit 0 mirrors the active cell, bit 1
|
|
515
|
+
* requests the context's stop. It lives in the executable's static TLS
|
|
516
|
+
* block, so the access is one thread-pointer-relative load. Monotonic by
|
|
517
|
+
* default: a loop must not hoist the load out and miss a cross-thread
|
|
518
|
+
* stop (see emitPendingCheck for the unordered tests). */
|
|
519
|
+
private loadExcFlag;
|
|
520
|
+
/** Instructions (two-space indented) that set the i1 `dest` to "an
|
|
521
|
+
* exception is pending in the active context" — scr_exc_pending()'s
|
|
522
|
+
* meaning — for the helper and adapter bodies that test it outside
|
|
523
|
+
* emitPendingCheck. Executables read the runtime's exported active-cell
|
|
524
|
+
* pointer and compare its i32 kind (offset 0) against SCR_EXC_NONE inline,
|
|
525
|
+
* as emitPendingCheck does; the out-of-line call would be opaque to LLVM
|
|
526
|
+
* because the runtime links as prebuilt objects. Libraries and worker
|
|
527
|
+
* programs keep the runtime call, which is emitPendingCheck's path there
|
|
528
|
+
* too (workers also observe cross-thread termination in it). */
|
|
529
|
+
pendingTestLines(dest: string): string[];
|
|
425
530
|
/** The emitter contract for exceptions: after EVERY call that can throw
|
|
426
531
|
* (per the may-throw analysis), test the pending flag and unwind. The
|
|
427
532
|
* call's result temp must join its frame BEFORE this runs so the unwind
|
|
428
|
-
* releases the dummy (NULL for refcounted kinds) harmlessly.
|
|
429
|
-
|
|
533
|
+
* releases the dummy (NULL for refcounted kinds) harmlessly. A scalar
|
|
534
|
+
* call result of the function's return type may be passed as the unwind's
|
|
535
|
+
* dummy value (see emitUnwind). `poll` marks a worker termination poll
|
|
536
|
+
* (function entry or loop budget), whose test must stay ordered. */
|
|
537
|
+
emitPendingCheck(passThrough?: {
|
|
538
|
+
name: string;
|
|
539
|
+
type: IrType;
|
|
540
|
+
}, poll?: boolean): void;
|
|
541
|
+
/** After a runtime call that ALWAYS leaves an exception pending (the
|
|
542
|
+
* compiler-resolved Node throws): the pending test would always answer
|
|
543
|
+
* true, so unwind unconditionally. Emission continues in a block with no
|
|
544
|
+
* predecessors so the caller's remaining instructions stay well-formed;
|
|
545
|
+
* LLVM deletes it. */
|
|
546
|
+
emitAlwaysPendingUnwind(): void;
|
|
547
|
+
/** A recursive function's entry check: below the running stack's guard,
|
|
548
|
+
* throw Node's RangeError and unwind like any other pending exception. */
|
|
549
|
+
private emitStackCheck;
|
|
550
|
+
/** Whether the emitter follows this call with a pending test (the
|
|
551
|
+
* conditions in expr-calls.ts). */
|
|
552
|
+
private callTestsPending;
|
|
430
553
|
private workerLoopBudget;
|
|
431
554
|
private emitWorkerLoopCheck;
|
|
432
555
|
/** Moves an already-evaluated value into the runtime's exception cell —
|
|
@@ -442,11 +565,16 @@ export declare class LlEmitter {
|
|
|
442
565
|
/** Emit truthiness for one non-union kind. Union arms are known-present,
|
|
443
566
|
* so object kinds become the constant true instead of a pointer test. */
|
|
444
567
|
private truthyOf;
|
|
445
|
-
/**
|
|
446
|
-
|
|
568
|
+
/** A union value's tag (i32): the box's tag word, or the NULL test of a
|
|
569
|
+
* nullable union's pointer. */
|
|
570
|
+
unionTag(uName: string, unionId: string): string;
|
|
571
|
+
/** Guard for helpers that build or read a union's `%ScrUnion` box
|
|
572
|
+
* directly (library-shaped unions with fixed arms): a nullable union
|
|
573
|
+
* reaching one is an emitter bug, never a silent miscompile. */
|
|
574
|
+
requireBoxedUnion(unionId: string): void;
|
|
447
575
|
/** The BORROWED payload pointer of a ref arm (scr_union_peek inlined —
|
|
448
|
-
* the runtime's is a static inline). */
|
|
449
|
-
unionPeek(uName: string): string;
|
|
576
|
+
* the runtime's is a static inline); a nullable union is its payload. */
|
|
577
|
+
unionPeek(uName: string, unionId: string): string;
|
|
450
578
|
/** Emits `switch` over a union's tag with one block per arm; each arm
|
|
451
579
|
* body must TERMINATE its block (the callers branch to a join). The
|
|
452
580
|
* default block is the runtime ABI’s invalid-tag abort. Shared field
|
|
@@ -455,7 +583,7 @@ export declare class LlEmitter {
|
|
|
455
583
|
/** The +1 extraction of a union's single narrowed arm (unionNarrow /
|
|
456
584
|
* the nullish-family reads): scalars via inline payload loads, ref arms
|
|
457
585
|
* a retained peek. */
|
|
458
|
-
unionExtract(uName: string, arm: IrType): string;
|
|
586
|
+
unionExtract(uName: string, unionId: string, arm: IrType): string;
|
|
459
587
|
/** A scalar f64 arm's payload (scr_union_get_f64 inlined). Inline loads
|
|
460
588
|
* keep stack boxes free of escaping calls, so LLVM can scalarize them. */
|
|
461
589
|
unionGetF64(uName: string): string;
|
|
@@ -464,7 +592,7 @@ export declare class LlEmitter {
|
|
|
464
592
|
/** Constructs a union box around an OWNED (+1, already moved) value —
|
|
465
593
|
* the scr_union_new_* dispatch of unionWrap and the wrap-into-join
|
|
466
594
|
* sites (shift). */
|
|
467
|
-
unionNewOwned(tag: number, v: LlValue): string;
|
|
595
|
+
unionNewOwned(unionId: string, tag: number, v: LlValue): string;
|
|
468
596
|
classMetaOf(className: string): LlClassMeta;
|
|
469
597
|
/** The field-slot pointer of a class member: rc at 0, the vtable word at
|
|
470
598
|
* 1 on hierarchy members, then the flattened field list. Runtime error
|
|
@@ -497,6 +625,12 @@ export declare class LlEmitter {
|
|
|
497
625
|
loadField(ptr: string, t: IrType): string;
|
|
498
626
|
/** Stores a record field (i1 zext to the i8 storage). */
|
|
499
627
|
storeField(ptr: string, t: IrType, value: string): void;
|
|
628
|
+
/** Reads an int32-specialized class field: the i32 slot is the value,
|
|
629
|
+
* and its widening is the exact double every program observation sees. */
|
|
630
|
+
loadInt32Field(ptr: string, type: IrType): LlValue;
|
|
631
|
+
/** Stores a value the whole-program analysis proved to be an int32 (never
|
|
632
|
+
* -0, NaN or fractional) into an int32-specialized class field. */
|
|
633
|
+
storeInt32Field(ptr: string, value: LlValue, expr: IrExpr): void;
|
|
500
634
|
/** A binding's storage: a module global, a plain local slot, or a boxed
|
|
501
635
|
* local (the slot holds the capture BOX; access goes through it). */
|
|
502
636
|
binding(id: string): {
|
|
@@ -522,6 +656,13 @@ export declare class LlEmitter {
|
|
|
522
656
|
* array cell holding the value and move it into the ARR-kind box
|
|
523
657
|
* (set_ref releases nothing — the slot was the empty sentinel). */
|
|
524
658
|
private tdzScalarInit;
|
|
659
|
+
/** The payload a TDZ box holds before its declaration runs, when that is
|
|
660
|
+
* not NULL. A nullable union's value is its arm pointer with NULL as a
|
|
661
|
+
* unit arm (nullable-unions.ts), so a stored `null`/`undefined` would
|
|
662
|
+
* read back as the temporal dead zone; such boxes start at the module's
|
|
663
|
+
* immortal NULLABLE_ABSENT sentinel instead, which no value of the
|
|
664
|
+
* binding can hold and every RC entry point and the collector skip. */
|
|
665
|
+
private tdzEmptySentinel;
|
|
525
666
|
/** The TDZ-guarded read of a boxed binding: an empty payload slot is
|
|
526
667
|
* the temporal dead zone — throw Node's exact catchable ReferenceError
|
|
527
668
|
* (exprs.ts's varRef guard). Scalars then peek the one-element
|
|
@@ -556,6 +697,9 @@ export declare class LlEmitter {
|
|
|
556
697
|
* borrowing body. Ownership of other parameters moves into that body;
|
|
557
698
|
* borrowed parameters are released here on normal and exceptional exits.
|
|
558
699
|
* The pending exception remains for the adapter's caller to handle. */
|
|
700
|
+
/** With `kept`, the virtual adapter of a borrowing slot instead: the
|
|
701
|
+
* slot's parameters stay borrowed, the body's other borrowed ones are
|
|
702
|
+
* released here. */
|
|
559
703
|
private emitOwnedCallAdapter;
|
|
560
704
|
/** A local stable binding keeps its value alive while later arguments
|
|
561
705
|
* and the callee execute. A proven local union box cannot escape or be
|
|
@@ -615,6 +759,22 @@ export declare class LlEmitter {
|
|
|
615
759
|
emitBranchInto(slot: string, expr: IrExpr, integerSlot?: string): boolean;
|
|
616
760
|
emitLiteralExpr(e: ExprOf<"numLit" | "boolLit" | "strLit" | "moduleNsRef" | "unitLit" | "varRef">): LlValue;
|
|
617
761
|
emitOperatorExpr(e: ExprOf<"bin" | "unary" | "incDec" | "fieldIncDec" | "assignExpr" | "seqExpr">): LlValue;
|
|
762
|
+
/** Saved operands can feed later call arguments. Transfer ownership of a
|
|
763
|
+
* sequence's locals to this expression's frame so they survive those
|
|
764
|
+
* reads and still die on the path that created them, including inside
|
|
765
|
+
* lazy branches. */
|
|
766
|
+
private emitSequence;
|
|
767
|
+
/** A statement-position expression whose value is dropped. When a
|
|
768
|
+
* sequence's result only reads an unchanged local (a derived
|
|
769
|
+
* constructor's `super()` evaluates to `this`), its statements still run
|
|
770
|
+
* in place, but the result is neither retained nor released. */
|
|
771
|
+
/** Whether a discarded value can be skipped entirely: a borrowable read
|
|
772
|
+
* with no effect of its own. canBorrowCallArgument also accepts checked
|
|
773
|
+
* projections (a ternary or narrow whose failing arm throws, and the
|
|
774
|
+
* throwing call itself) because a borrowed use still evaluates them;
|
|
775
|
+
* skipping those would drop the throw. */
|
|
776
|
+
private discardableRead;
|
|
777
|
+
private emitDiscarded;
|
|
618
778
|
emitControlExpr(e: ExprOf<"dynDestrCheck" | "dynIterN" | "toBool" | "logical" | "ternary" | "optChain" | "chainRecv" | "orDefault" | "nullish">): LlValue;
|
|
619
779
|
emitStringExpr(e: ExprOf<"strConcat" | "strEq" | "strCmp" | "toString" | "strIntrinsic" | "regexLit" | "templateStrings" | "regexIntrinsic">): LlValue;
|
|
620
780
|
/**
|
|
@@ -624,11 +784,39 @@ export declare class LlEmitter {
|
|
|
624
784
|
* value, making the snapshot unique unless a real observable alias exists.
|
|
625
785
|
*/
|
|
626
786
|
emitStringSelfConcatAssign(localId: string, left: IrExpr, suffix: IrExpr, retainForYield: boolean): LlValue;
|
|
787
|
+
/** `local = local + suffix` when the suffix cannot read or write the
|
|
788
|
+
* local (an unboxed binding is only reachable through this function's own
|
|
789
|
+
* expressions): reading the binding after the suffix gives the value the
|
|
790
|
+
* left side had, so it moves into a consuming concat, and the result takes
|
|
791
|
+
* its place. Null when the general snapshot path is needed. */
|
|
792
|
+
private emitMovedSelfConcat;
|
|
627
793
|
emitContainerExpr(e: ExprOf<"arrayLit" | "arrayNewLen" | "arrayGet" | "arrayHas" | "arrayState" | "arrIntrinsic" | "bytesNew" | "bytesIntrinsic" | "mapNew" | "mapIntrinsic" | "setIntrinsic" | "setNew">): LlValue;
|
|
628
794
|
emitCallExpr(e: ExprOf<"call" | "ffiCall" | "closure" | "callValue" | "selfRef" | "new" | "classRef" | "newValue" | "instanceOfValue" | "promiseVoidWiden" | "upcast" | "downcast" | "instanceOf" | "virtualCall">): LlValue;
|
|
629
795
|
emitRecordExpr(e: ExprOf<"fieldGet" | "recordGet" | "recordLit" | "recordClone" | "recordKeyGet" | "recordOvfKeys" | "recordOvfHas" | "recordHas" | "fieldAbsent">): LlValue;
|
|
630
796
|
emitDynamicExpr(e: ExprOf<"dynFrom" | "dynFromJsval" | "dynCall" | "dynInvoke" | "dynArrLit" | "dynObjLit" | "unionWrap" | "unionNarrow" | "unionDisc" | "unionKeyGet" | "unionIsTag" | "dynKeyGet" | "dynHasKey" | "dynScalarEq" | "dynTest" | "unionEq" | "unionFuncEq" | "caughtTest" | "caughtCheck" | "caughtNarrow" | "caughtToDyn">): LlValue;
|
|
631
797
|
emitIntrinsicExpr(e: ExprOf<"intrinsic">): LlValue;
|
|
798
|
+
private publishWalkersCache;
|
|
799
|
+
/** Per-type publication walkers, created on the first publish. */
|
|
800
|
+
private get publishWalkers();
|
|
801
|
+
/** `publish(value)` (@scriptc/threads): makes the graph immortal and
|
|
802
|
+
* immutable (scr_publish with the static type's walker) and answers the
|
|
803
|
+
* same value. Throws (pending) when a dyn part is unpublishable. */
|
|
804
|
+
private emitPublish;
|
|
805
|
+
/** Branches on "`obj` is published" (rc == SIZE_MAX); leaves the builder
|
|
806
|
+
* in the cold block and answers the continuation label. */
|
|
807
|
+
private emitPublishedTest;
|
|
808
|
+
private publishedNamesSym;
|
|
809
|
+
/** The class-name table the hierarchy field guards index by preorder. */
|
|
810
|
+
private publishedClassNamesDefs;
|
|
811
|
+
/** The frozen-object guard of a class field or record field store:
|
|
812
|
+
* Node's "Cannot assign to read only property" TypeError when the target
|
|
813
|
+
* is published. `className` null means a record (`#<Object>`). */
|
|
814
|
+
emitPublishedFieldGuard(obj: string, className: string | null, field: string): void;
|
|
815
|
+
/** The frozen-array guard (scr_throw_published_array's ops): `index` and
|
|
816
|
+
* `count` are doubles (the written index, the argument count). */
|
|
817
|
+
emitPublishedArrayGuard(arr: string, arrType: IrType, op: number, index?: string, count?: string): void;
|
|
818
|
+
/** The published Map/Set guard: "Cannot modify a published Map/Set". */
|
|
819
|
+
emitPublishedCollectionGuard(m: string, t: IrType): void;
|
|
632
820
|
emitSerializationExpr(e: ExprOf<"jsonStringify" | "dynCheck">): LlValue;
|
|
633
821
|
emitAsyncExpr(e: ExprOf<"yieldExpr" | "genResume" | "awaitExpr" | "awaitUnionExpr" | "newPromise" | "promiseWithResolvers">): LlValue;
|
|
634
822
|
emitJsInteropExpr(e: ExprOf<"jsMarshal" | "jsOp" | "jsExit" | "jsBridgePromise">): LlValue;
|
|
@@ -679,6 +867,33 @@ export declare class LlEmitter {
|
|
|
679
867
|
* box must only be projected: never retained, released, or stored. */
|
|
680
868
|
isStackUnionLocal(localId: string): boolean;
|
|
681
869
|
canBorrowReceiver(e: IrExpr): boolean;
|
|
870
|
+
/** A reference held as one plain pointer that emitReadReceiver can read
|
|
871
|
+
* without owning: class instances, records, arrays, strings and
|
|
872
|
+
* nullable-pointer unions. Tagged union boxes, closures and dynamic
|
|
873
|
+
* values keep ordinary ownership. */
|
|
874
|
+
plainReference(type: IrType): boolean;
|
|
875
|
+
/** Functions returning a walk of their borrowed parameters return it
|
|
876
|
+
* without a reference (+0) from their borrowing body; direct callers
|
|
877
|
+
* either consume it as a receiver/walk or retain it at once, and the owned
|
|
878
|
+
* adapter retains before releasing its parameters. Candidates preserve
|
|
879
|
+
* every heap edge (so the result stays reachable from the arguments),
|
|
880
|
+
* borrow every reference parameter and return plain pointers. The set
|
|
881
|
+
* grows to a fixpoint because a call to a borrowed-return function with
|
|
882
|
+
* walk arguments is itself a walk; walk facts are then recomputed with
|
|
883
|
+
* the final set, admitting only parameters whose convention borrows. */
|
|
884
|
+
private analyzeBorrowedReturns;
|
|
885
|
+
/** emitReadReceiver produces this node's pointer without acquiring a
|
|
886
|
+
* reference, given operands (and ternary arms) that do the same: plain
|
|
887
|
+
* class/record field reads, class casts, nullable-pointer narrows and
|
|
888
|
+
* wraps, and checked ternaries. Stack-boxed, map-read and boxed-field
|
|
889
|
+
* sources are owned. Depends only on module facts, not the current
|
|
890
|
+
* function. */
|
|
891
|
+
borrowsWithoutOwning(e: IrExpr): boolean;
|
|
892
|
+
/** A wrap into a nullable-pointer union is the payload pointer itself
|
|
893
|
+
* (the reference arm) or an immortal constant (a unit arm), so it can
|
|
894
|
+
* borrow exactly when its payload can. Void payloads run for effects and
|
|
895
|
+
* keep the ordinary path; tagged unions still construct a box. */
|
|
896
|
+
borrowableNullableWrap(e: IrExpr): "unit" | "ref" | null;
|
|
682
897
|
materializeSplitLocal(localId: string): void;
|
|
683
898
|
emitExpr(e: IrExpr): LlValue;
|
|
684
899
|
emitJsMarshal(e: IrExpr & {
|
|
@@ -740,7 +955,7 @@ export declare class LlEmitter {
|
|
|
740
955
|
}): string;
|
|
741
956
|
streamCbThunkFor(kind: "r" | "w" | "f" | "d" | "t" | "l" | "e", cbT: IrType): string;
|
|
742
957
|
resolveThunkFor(inner: IrType): string;
|
|
743
|
-
tagInSet(uName: string, tags: number[]): string;
|
|
958
|
+
tagInSet(uName: string, unionId: string, tags: number[]): string;
|
|
744
959
|
arrPush(arr: string, acc: "f64" | "bool" | "ref", value: string): string;
|
|
745
960
|
emitArrayCopyLoop(dst: string, src: string, acc: "f64" | "bool" | "ref"): void;
|
|
746
961
|
emitStrIntrinsic(e: IrExpr & {
|
|
@@ -767,7 +982,7 @@ export declare class LlEmitter {
|
|
|
767
982
|
emitBytesIndex(receiver: string, index: LlValue, expr?: IrExpr, inBounds?: boolean): string;
|
|
768
983
|
emitBytesData(receiver: string): string;
|
|
769
984
|
emitBytesLength(elem: IrBytesElem, receiver: string, bytes: boolean): LlValue;
|
|
770
|
-
emitBytesGet(elem: IrBytesElem, receiver: string, index: LlValue, expr?: IrExpr, inBounds?: boolean): LlValue;
|
|
985
|
+
emitBytesGet(elem: IrBytesElem, receiver: string, index: LlValue, expr?: IrExpr, inBounds?: boolean, invalidNaN?: boolean): LlValue;
|
|
771
986
|
emitToUint32(value: string, expr?: IrExpr, uint32?: string): string;
|
|
772
987
|
storeIntegerView(localId: string, value: LlValue, expr?: IrExpr): void;
|
|
773
988
|
private emitBytesSet;
|