@scriptc/compiler 0.2.10 → 0.3.0
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 +2 -36
- package/ambient/scriptc-overrides.d.ts +1 -25
- package/ambient/scriptc.d.ts +1 -9
- package/dist/backend/cycle-analysis.test.js +1 -1
- package/dist/backend/cycle-mutability.d.ts +1 -1
- package/dist/backend/cycle-mutability.js +1 -18
- package/dist/backend/cycle-mutability.js.map +1 -1
- package/dist/backend/executable-features.d.ts +1 -1
- package/dist/backend/executable-features.js +3 -8
- package/dist/backend/executable-features.js.map +1 -1
- package/dist/backend/immutability.d.ts +1 -1
- package/dist/backend/immutability.js +1 -1
- package/dist/backend/immutability.test.js +1 -1
- package/dist/backend/library-pack.js +0 -2
- package/dist/backend/library-pack.js.map +1 -1
- package/dist/backend/linker.js +1 -1
- package/dist/backend/linker.js.map +1 -1
- package/dist/backend/llvm/checked-narrows.test.js +1 -1
- package/dist/backend/llvm/classes.js +3 -9
- package/dist/backend/llvm/classes.js.map +1 -1
- package/dist/backend/llvm/classes.test.js +7 -7
- package/dist/backend/llvm/constant-callbacks.d.ts +1 -1
- package/dist/backend/llvm/constant-callbacks.js +3 -3
- package/dist/backend/llvm/constant-callbacks.js.map +1 -1
- package/dist/backend/llvm/constant-callbacks.test.js +1 -1
- package/dist/backend/llvm/dense-array-access.test.js +1 -1
- package/dist/backend/llvm/dyn.d.ts +0 -1
- package/dist/backend/llvm/dyn.js +0 -73
- package/dist/backend/llvm/dyn.js.map +1 -1
- package/dist/backend/llvm/emitter.d.ts +3 -17
- package/dist/backend/llvm/emitter.js +53 -181
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/backend/llvm/emitter.test.js +3 -3
- package/dist/backend/llvm/expr-async.test.js +1 -1
- package/dist/backend/llvm/expr-containers.js +12 -8
- package/dist/backend/llvm/expr-containers.js.map +1 -1
- package/dist/backend/llvm/expr-control.js +4 -107
- package/dist/backend/llvm/expr-control.js.map +1 -1
- package/dist/backend/llvm/expr-dispatch.d.ts +1 -2
- package/dist/backend/llvm/expr-dispatch.js +0 -41
- package/dist/backend/llvm/expr-dispatch.js.map +1 -1
- package/dist/backend/llvm/expr-dynamic.d.ts +1 -1
- package/dist/backend/llvm/expr-dynamic.js +13 -27
- package/dist/backend/llvm/expr-dynamic.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.test.js +2 -2
- package/dist/backend/llvm/expr-stream-bridges.test.js +1 -1
- package/dist/backend/llvm/lib-dispatch.js +0 -1
- package/dist/backend/llvm/lib-dispatch.js.map +1 -1
- package/dist/backend/llvm/lib-filesystem.js +0 -13
- package/dist/backend/llvm/lib-filesystem.js.map +1 -1
- package/dist/backend/llvm/lib-shared.js +0 -8
- package/dist/backend/llvm/lib-shared.js.map +1 -1
- package/dist/backend/llvm/local-array-reads.test.js +1 -1
- package/dist/backend/llvm/local-union-storage.test.js +1 -1
- package/dist/backend/llvm/map-number-lookup.d.ts +7 -0
- package/dist/backend/llvm/map-number-lookup.js +16 -2
- package/dist/backend/llvm/map-number-lookup.js.map +1 -1
- package/dist/backend/llvm/map-read-lifetimes.js +7 -1
- package/dist/backend/llvm/map-read-lifetimes.js.map +1 -1
- package/dist/backend/llvm/map-read-lifetimes.test.js +24 -7
- package/dist/backend/llvm/map-read-lifetimes.test.js.map +1 -1
- package/dist/backend/llvm/shapes.js +1 -2
- package/dist/backend/llvm/shapes.js.map +1 -1
- package/dist/backend/llvm/shapes.test.js +3 -3
- package/dist/backend/llvm/stack-unions.test.js +1 -1
- package/dist/backend/llvm/string-construction.test.js +1 -1
- package/dist/backend/llvm/string-lifetimes.test.js +1 -1
- package/dist/backend/llvm/switch-dispatch.test.js +1 -1
- package/dist/backend/may-throw.js +0 -9
- package/dist/backend/may-throw.js.map +1 -1
- package/dist/backend/may-throw.test.js +1 -1
- package/dist/backend/native/artifact-stamps.js +0 -2
- package/dist/backend/native/artifact-stamps.js.map +1 -1
- package/dist/backend/native/cache-warm.d.ts +1 -1
- package/dist/backend/native/cache-warm.js +2 -3
- package/dist/backend/native/cache-warm.js.map +1 -1
- package/dist/backend/native/compiler-fingerprint.d.ts +1 -1
- package/dist/backend/native/compiler-fingerprint.js +4 -7
- package/dist/backend/native/compiler-fingerprint.js.map +1 -1
- package/dist/backend/native/contracts.d.ts +3 -28
- package/dist/backend/native/driver.js +1 -3
- package/dist/backend/native/driver.js.map +1 -1
- package/dist/backend/native/executable.d.ts +0 -15
- package/dist/backend/native/executable.js +17 -172
- package/dist/backend/native/executable.js.map +1 -1
- package/dist/backend/native/tool-identity.js +0 -1
- package/dist/backend/native/tool-identity.js.map +1 -1
- package/dist/backend/native/vendor.d.ts +1 -1
- package/dist/backend/native/vendor.js +1 -1
- package/dist/backend/native/vendor.js.map +1 -1
- package/dist/backend/native-link-info-core.d.ts +0 -2
- package/dist/backend/native-link-info-core.js.map +1 -1
- package/dist/backend/native-toolchain.test.js +23 -33
- package/dist/backend/native-toolchain.test.js.map +1 -1
- package/dist/backend/publication.test.js +1 -1
- package/dist/backend/runtime-abi.d.ts +2 -2
- package/dist/backend/runtime-abi.js +2 -2
- package/dist/backend/runtime-pack-core.d.ts +1 -2
- package/dist/backend/runtime-pack-core.js +5 -14
- package/dist/backend/runtime-pack-core.js.map +1 -1
- package/dist/backend/runtime-pack-targets.test.js +3 -8
- package/dist/backend/runtime-pack-targets.test.js.map +1 -1
- package/dist/backend/runtime-pack.test.js +22 -19
- package/dist/backend/runtime-pack.test.js.map +1 -1
- package/dist/backend/target-diagnostics.d.ts +0 -5
- package/dist/backend/target-diagnostics.js +1 -11
- package/dist/backend/target-diagnostics.js.map +1 -1
- package/dist/backend/target-diagnostics.test.js +1 -1
- package/dist/backend/vendor-archives.d.ts +1 -7
- package/dist/backend/vendor-archives.js +9 -189
- package/dist/backend/vendor-archives.js.map +1 -1
- package/dist/backend/vendor-inputs.d.ts +0 -1
- package/dist/backend/vendor-inputs.js +0 -1
- package/dist/backend/vendor-inputs.js.map +1 -1
- package/dist/backend/warm-cache.js +3 -5
- package/dist/backend/warm-cache.js.map +1 -1
- package/dist/cli/command.js +4 -8
- package/dist/cli/command.js.map +1 -1
- package/dist/cli/host.d.ts +1 -1
- package/dist/cli/usage.d.ts +1 -5
- package/dist/cli/usage.js +4 -9
- package/dist/cli/usage.js.map +1 -1
- package/dist/compat/fetch-profile.d.ts +2 -2
- package/dist/compat/fetch-profile.js +16 -25
- package/dist/compat/fetch-profile.js.map +1 -1
- package/dist/compile-types.d.ts +2 -17
- package/dist/contracts/check.js +2 -6
- package/dist/contracts/check.js.map +1 -1
- package/dist/coverage/report.d.ts +5 -22
- package/dist/coverage/report.js +12 -76
- package/dist/coverage/report.js.map +1 -1
- package/dist/coverage/surface-manifest.d.ts +3 -3
- package/dist/coverage/surface-manifest.js +22 -27
- package/dist/coverage/surface-manifest.js.map +1 -1
- package/dist/coverage/verdict-cache.d.ts +1 -3
- package/dist/coverage/verdict-cache.js +2 -7
- package/dist/coverage/verdict-cache.js.map +1 -1
- package/dist/diagnostics/diagnostic.d.ts +11 -60
- package/dist/diagnostics/diagnostic.js +39 -118
- package/dist/diagnostics/diagnostic.js.map +1 -1
- package/dist/diagnostics/envelope.d.ts +3 -4
- package/dist/diagnostics/envelope.js +0 -9
- package/dist/diagnostics/envelope.js.map +1 -1
- package/dist/diagnostics/envelope.test.js +1 -1
- package/dist/diagnostics/envelope.test.js.map +1 -1
- package/dist/executable/executable-cache.d.ts +0 -3
- package/dist/executable/executable-cache.js +2 -4
- package/dist/executable/executable-cache.js.map +1 -1
- package/dist/executable/executable-cache.test.js +0 -4
- package/dist/executable/executable-cache.test.js.map +1 -1
- package/dist/executable/prepare.js +5 -2
- package/dist/executable/prepare.js.map +1 -1
- package/dist/frontend/analysis.js +10 -10
- package/dist/frontend/analysis.js.map +1 -1
- package/dist/frontend/cjs-syntax.js +0 -88
- package/dist/frontend/cjs-syntax.js.map +1 -1
- package/dist/frontend/dts-paths.d.ts +1 -1
- package/dist/frontend/dts-paths.js +1 -1
- package/dist/frontend/lowering/abstract-equality.js +1 -4
- package/dist/frontend/lowering/abstract-equality.js.map +1 -1
- package/dist/frontend/lowering/array-values.js +4 -11
- package/dist/frontend/lowering/array-values.js.map +1 -1
- package/dist/frontend/lowering/builtins/arguments.js +0 -13
- package/dist/frontend/lowering/builtins/arguments.js.map +1 -1
- package/dist/frontend/lowering/builtins/crypto.d.ts +0 -4
- package/dist/frontend/lowering/builtins/crypto.js +0 -4
- package/dist/frontend/lowering/builtins/crypto.js.map +1 -1
- package/dist/frontend/lowering/builtins/json.js +1 -39
- package/dist/frontend/lowering/builtins/json.js.map +1 -1
- package/dist/frontend/lowering/builtins/module-resolution.d.ts +0 -15
- package/dist/frontend/lowering/builtins/module-resolution.js +5 -44
- package/dist/frontend/lowering/builtins/module-resolution.js.map +1 -1
- package/dist/frontend/lowering/builtins/numbers.d.ts +0 -6
- package/dist/frontend/lowering/builtins/numbers.js +6 -57
- package/dist/frontend/lowering/builtins/numbers.js.map +1 -1
- package/dist/frontend/lowering/builtins/promises.js +4 -67
- package/dist/frontend/lowering/builtins/promises.js.map +1 -1
- package/dist/frontend/lowering/builtins/workers.js +1 -1
- package/dist/frontend/lowering/builtins/workers.js.map +1 -1
- package/dist/frontend/lowering/call-arguments.d.ts +1 -37
- package/dist/frontend/lowering/call-arguments.js +11 -94
- package/dist/frontend/lowering/call-arguments.js.map +1 -1
- package/dist/frontend/lowering/call-signatures.d.ts +1 -6
- package/dist/frontend/lowering/call-signatures.js +16 -68
- package/dist/frontend/lowering/call-signatures.js.map +1 -1
- package/dist/frontend/lowering/class-dynamic-dispatch.d.ts +19 -4
- package/dist/frontend/lowering/class-dynamic-dispatch.js +168 -98
- package/dist/frontend/lowering/class-dynamic-dispatch.js.map +1 -1
- package/dist/frontend/lowering/class-dynamic-dispatch.test.js +44 -4
- package/dist/frontend/lowering/class-dynamic-dispatch.test.js.map +1 -1
- package/dist/frontend/lowering/class-method-mutations.js +0 -2
- package/dist/frontend/lowering/class-method-mutations.js.map +1 -1
- package/dist/frontend/lowering/class-protocols.js +1 -1
- package/dist/frontend/lowering/class-protocols.js.map +1 -1
- package/dist/frontend/lowering/coercions/function-adapters.js +5 -35
- package/dist/frontend/lowering/coercions/function-adapters.js.map +1 -1
- package/dist/frontend/lowering/coercions/state.d.ts +0 -1
- package/dist/frontend/lowering/coercions/state.js +0 -1
- package/dist/frontend/lowering/coercions/state.js.map +1 -1
- package/dist/frontend/lowering/coercions/structural-plans.js +2 -4
- package/dist/frontend/lowering/coercions/structural-plans.js.map +1 -1
- package/dist/frontend/lowering/coercions/structural.js +2 -12
- package/dist/frontend/lowering/coercions/structural.js.map +1 -1
- package/dist/frontend/lowering/coercions/unions.js +0 -1
- package/dist/frontend/lowering/coercions/unions.js.map +1 -1
- package/dist/frontend/lowering/containers/array-callbacks.js +9 -28
- package/dist/frontend/lowering/containers/array-callbacks.js.map +1 -1
- package/dist/frontend/lowering/containers/array-construction.js +2 -3
- package/dist/frontend/lowering/containers/array-construction.js.map +1 -1
- package/dist/frontend/lowering/containers/array-methods.js +10 -54
- package/dist/frontend/lowering/containers/array-methods.js.map +1 -1
- package/dist/frontend/lowering/containers/bytes.js +0 -1
- package/dist/frontend/lowering/containers/bytes.js.map +1 -1
- package/dist/frontend/lowering/containers/callback-arguments.js +2 -10
- package/dist/frontend/lowering/containers/callback-arguments.js.map +1 -1
- package/dist/frontend/lowering/containers/collection-methods.js +1 -6
- package/dist/frontend/lowering/containers/collection-methods.js.map +1 -1
- package/dist/frontend/lowering/containers/indexed-objects.js +0 -2
- package/dist/frontend/lowering/containers/indexed-objects.js.map +1 -1
- package/dist/frontend/lowering/containers/string-and-regexp.d.ts +0 -6
- package/dist/frontend/lowering/containers/string-and-regexp.js +2 -10
- package/dist/frontend/lowering/containers/string-and-regexp.js.map +1 -1
- package/dist/frontend/lowering/expressions/evaluation-safety.js +0 -3
- package/dist/frontend/lowering/expressions/evaluation-safety.js.map +1 -1
- package/dist/frontend/lowering/expressions/native-proxy.js +1 -1
- package/dist/frontend/lowering/expressions/native-proxy.js.map +1 -1
- package/dist/frontend/lowering/expressions/nullish-assignment.js +0 -1
- package/dist/frontend/lowering/expressions/nullish-assignment.js.map +1 -1
- package/dist/frontend/lowering/expressions/object-literals.d.ts +0 -8
- package/dist/frontend/lowering/expressions/object-literals.js +8 -35
- package/dist/frontend/lowering/expressions/object-literals.js.map +1 -1
- package/dist/frontend/lowering/expressions/optional-chains.d.ts +0 -4
- package/dist/frontend/lowering/expressions/optional-chains.js +3 -66
- package/dist/frontend/lowering/expressions/optional-chains.js.map +1 -1
- package/dist/frontend/lowering/function-context.js +0 -1
- package/dist/frontend/lowering/function-context.js.map +1 -1
- package/dist/frontend/lowering/generic-functions.js +0 -1
- package/dist/frontend/lowering/generic-functions.js.map +1 -1
- package/dist/frontend/lowering/lib-boundary.js +10 -77
- package/dist/frontend/lowering/lib-boundary.js.map +1 -1
- package/dist/frontend/lowering/lower-array-sort.js +1 -10
- package/dist/frontend/lowering/lower-array-sort.js.map +1 -1
- package/dist/frontend/lowering/lower-array-sort.test.js +2 -2
- package/dist/frontend/lowering/lower-array-sort.test.js.map +1 -1
- package/dist/frontend/lowering/lower-assert.js +2 -3
- package/dist/frontend/lowering/lower-assert.js.map +1 -1
- package/dist/frontend/lowering/lower-async-iteration.js +1 -1
- package/dist/frontend/lowering/lower-calls.d.ts +2 -27
- package/dist/frontend/lowering/lower-calls.js +47 -463
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-classes.js +11 -49
- package/dist/frontend/lowering/lower-classes.js.map +1 -1
- package/dist/frontend/lowering/lower-comptime.js +2 -3
- package/dist/frontend/lowering/lower-comptime.js.map +1 -1
- package/dist/frontend/lowering/lower-enums.js +5 -8
- package/dist/frontend/lowering/lower-enums.js.map +1 -1
- package/dist/frontend/lowering/lower-event-emitter.js +3 -4
- package/dist/frontend/lowering/lower-event-emitter.js.map +1 -1
- package/dist/frontend/lowering/lower-expando.js +3 -5
- package/dist/frontend/lowering/lower-expando.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.d.ts +0 -8
- package/dist/frontend/lowering/lower-exprs.js +50 -907
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-functions.js +2 -5
- package/dist/frontend/lowering/lower-functions.js.map +1 -1
- package/dist/frontend/lowering/lower-inspect.js +1 -50
- package/dist/frontend/lowering/lower-inspect.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.d.ts +0 -43
- package/dist/frontend/lowering/lower-modules.js +25 -329
- package/dist/frontend/lowering/lower-modules.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.test.js +5 -5
- package/dist/frontend/lowering/lower-modules.test.js.map +1 -1
- package/dist/frontend/lowering/lower-server.js +0 -30
- package/dist/frontend/lowering/lower-server.js.map +1 -1
- package/dist/frontend/lowering/lower-stdlib.d.ts +98 -0
- package/dist/frontend/lowering/{lower-island.js → lower-stdlib.js} +97 -1160
- package/dist/frontend/lowering/lower-stdlib.js.map +1 -0
- package/dist/frontend/lowering/lower-stmts.d.ts +0 -16
- package/dist/frontend/lowering/lower-stmts.js +58 -1016
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.test.js +1 -1
- package/dist/frontend/lowering/lower-stmts.test.js.map +1 -1
- package/dist/frontend/lowering/lower-stream.js +1 -3
- package/dist/frontend/lowering/lower-stream.js.map +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +17 -151
- package/dist/frontend/lowering/lowerer.js +73 -770
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/lowering/lowerer.test.js +4 -51
- package/dist/frontend/lowering/lowerer.test.js.map +1 -1
- package/dist/frontend/lowering/narrowing-stability.js +1 -1
- package/dist/frontend/lowering/narrowing-stability.js.map +1 -1
- package/dist/frontend/lowering/optional-arguments.js +0 -2
- package/dist/frontend/lowering/optional-arguments.js.map +1 -1
- package/dist/frontend/lowering/sanitize-class-types.test.js +2 -2
- package/dist/frontend/lowering/strict-equality.js +1 -1
- package/dist/frontend/lowering/strict-equality.js.map +1 -1
- package/dist/frontend/lowering/surfaces.d.ts +6 -45
- package/dist/frontend/lowering/surfaces.js +5 -65
- package/dist/frontend/lowering/surfaces.js.map +1 -1
- package/dist/frontend/module-syntax.d.ts +0 -3
- package/dist/frontend/module-syntax.js.map +1 -1
- package/dist/frontend/npm-node.d.ts +0 -7
- package/dist/frontend/npm-node.js +0 -7
- package/dist/frontend/npm-node.js.map +1 -1
- package/dist/frontend/npm-static-rewrite-syntax.d.ts +1 -1
- package/dist/frontend/npm-static-rewrite-syntax.js +6 -82
- package/dist/frontend/npm-static-rewrite-syntax.js.map +1 -1
- package/dist/frontend/npm-static.d.ts +1 -1
- package/dist/frontend/npm-static.js +6 -71
- package/dist/frontend/npm-static.js.map +1 -1
- package/dist/frontend/npm.d.ts +3 -319
- package/dist/frontend/npm.js +6 -1007
- package/dist/frontend/npm.js.map +1 -1
- package/dist/frontend/npm.test.js +2 -197
- package/dist/frontend/npm.test.js.map +1 -1
- package/dist/frontend/pipeline-native.js +1 -2
- package/dist/frontend/pipeline-native.js.map +1 -1
- package/dist/frontend/pipeline.d.ts +3 -11
- package/dist/frontend/pipeline.js +37 -56
- package/dist/frontend/pipeline.js.map +1 -1
- package/dist/frontend/pipeline.test.js +12 -6
- package/dist/frontend/pipeline.test.js.map +1 -1
- package/dist/frontend/program.d.ts +0 -34
- package/dist/frontend/program.js +12 -97
- package/dist/frontend/program.js.map +1 -1
- package/dist/frontend/provenance-core.d.ts +0 -4
- package/dist/frontend/provenance-core.js +4 -37
- package/dist/frontend/provenance-core.js.map +1 -1
- package/dist/frontend/provenance-registry.d.ts +0 -4
- package/dist/frontend/provenance-registry.js +0 -20
- package/dist/frontend/provenance-registry.js.map +1 -1
- package/dist/frontend/resolve.d.ts +0 -12
- package/dist/frontend/resolve.js +0 -34
- package/dist/frontend/resolve.js.map +1 -1
- package/dist/frontend/runtime-resolve.js +2 -2
- package/dist/frontend/runtime-resolve.js.map +1 -1
- package/dist/frontend/services-node.js +2 -3
- package/dist/frontend/services-node.js.map +1 -1
- package/dist/frontend/services.d.ts +1 -8
- package/dist/frontend/services.js +2 -22
- package/dist/frontend/services.js.map +1 -1
- package/dist/frontend/services.test.js +0 -38
- package/dist/frontend/services.test.js.map +1 -1
- package/dist/frontend/tsc-codes.js +0 -11
- package/dist/frontend/tsc-codes.js.map +1 -1
- package/dist/frontend/type-mapper.d.ts +2 -27
- package/dist/frontend/type-mapper.js +42 -153
- package/dist/frontend/type-mapper.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -10
- package/dist/index.js.map +1 -1
- package/dist/ir/api.d.ts +1 -1
- package/dist/ir/api.js +1 -1
- package/dist/ir/api.js.map +1 -1
- package/dist/ir/builtin-effects.js +0 -5
- package/dist/ir/builtin-effects.js.map +1 -1
- package/dist/ir/builtin-signatures.d.ts +1 -1
- package/dist/ir/builtin-signatures.js +1 -55
- package/dist/ir/builtin-signatures.js.map +1 -1
- package/dist/ir/constant-globals.test.js +1 -1
- package/dist/ir/constant-tables.test.js +1 -1
- package/dist/ir/final-fields.test.js +1 -1
- package/dist/ir/initializer-bindings.test.js +1 -1
- package/dist/ir/int32-slots.d.ts +3 -3
- package/dist/ir/int32-slots.js +5 -19
- package/dist/ir/int32-slots.js.map +1 -1
- package/dist/ir/int32-slots.test.js +1 -1
- package/dist/ir/ir.d.ts +12 -284
- package/dist/ir/ir.js +10 -259
- package/dist/ir/ir.js.map +1 -1
- package/dist/ir/ir.test.js +2 -7
- package/dist/ir/ir.test.js.map +1 -1
- package/dist/ir/runtime-features.d.ts +3 -30
- package/dist/ir/runtime-features.js +5 -41
- package/dist/ir/runtime-features.js.map +1 -1
- package/dist/ir/scalar-records.test.js +1 -1
- package/dist/ir/serialize.d.ts +1 -1
- package/dist/ir/serialize.js +3 -3
- package/dist/ir/serialize.js.map +1 -1
- package/dist/ir/traverse.js +0 -21
- package/dist/ir/traverse.js.map +1 -1
- package/dist/ir/unshare.test.js +1 -1
- package/dist/ir/validate.js +9 -207
- package/dist/ir/validate.js.map +1 -1
- package/dist/ir/validate.test.js +6 -6
- package/dist/library/fence-eval.test.js +1 -1
- package/dist/library/int-infer.test.js +4 -4
- package/dist/library/library-cache.test.js +5 -5
- package/dist/library/prepare.js +5 -20
- package/dist/library/prepare.js.map +1 -1
- package/dist/native/cli.js +0 -2
- package/dist/native/cli.js.map +1 -1
- package/dist/native/compiler.test.js +2 -4
- package/dist/native/compiler.test.js.map +1 -1
- package/dist/native/prepare.js +2 -4
- package/dist/native/prepare.js.map +1 -1
- package/dist/native/sanitizer.js +2 -16
- package/dist/native/sanitizer.js.map +1 -1
- package/dist/native/sanitizer.test.js +0 -3
- package/dist/native/sanitizer.test.js.map +1 -1
- package/dist/startup-cache.js +0 -2
- package/dist/startup-cache.js.map +1 -1
- package/package.json +20 -20
- package/surface-manifest.json +80 -88
- package/dist/backend/llvm/expr-island.d.ts +0 -15
- package/dist/backend/llvm/expr-island.js +0 -709
- package/dist/backend/llvm/expr-island.js.map +0 -1
- package/dist/frontend/lowering/coercions/island.d.ts +0 -37
- package/dist/frontend/lowering/coercions/island.js +0 -350
- package/dist/frontend/lowering/coercions/island.js.map +0 -1
- package/dist/frontend/lowering/lower-island.d.ts +0 -229
- package/dist/frontend/lowering/lower-island.js.map +0 -1
- package/dist/frontend/lowering/lower-island.test.d.ts +0 -1
- package/dist/frontend/lowering/lower-island.test.js +0 -56
- package/dist/frontend/lowering/lower-island.test.js.map +0 -1
- package/dist/frontend/npm-fetch-analysis.d.ts +0 -17
- package/dist/frontend/npm-fetch-analysis.js +0 -109
- package/dist/frontend/npm-fetch-analysis.js.map +0 -1
- package/dist/frontend/npm-fetch-analysis.test.d.ts +0 -1
- package/dist/frontend/npm-fetch-analysis.test.js +0 -130
- package/dist/frontend/npm-fetch-analysis.test.js.map +0 -1
- package/dist/frontend/npm-fetch-node.d.ts +0 -2
- package/dist/frontend/npm-fetch-node.js +0 -12
- package/dist/frontend/npm-fetch-node.js.map +0 -1
- package/dist/frontend/npm-fetch-syntax.d.ts +0 -6
- package/dist/frontend/npm-fetch-syntax.js +0 -202
- package/dist/frontend/npm-fetch-syntax.js.map +0 -1
- package/dist/native/runtime-typescript.d.ts +0 -4
- package/dist/native/runtime-typescript.js +0 -74
- package/dist/native/runtime-typescript.js.map +0 -1
- package/dist/native/runtime-typescript.test.d.ts +0 -1
- package/dist/native/runtime-typescript.test.js +0 -41
- package/dist/native/runtime-typescript.test.js.map +0 -1
|
@@ -429,8 +429,8 @@ export declare class LlEmitter {
|
|
|
429
429
|
* mentions (transitively), contains no suspension entry point. Such a
|
|
430
430
|
* body always completes before the call returns, which is exactly the
|
|
431
431
|
* behavior of a fiber that never suspends. Excluded conservatively:
|
|
432
|
-
* wasm32 (its coroutine lowering owns async bodies),
|
|
433
|
-
*
|
|
432
|
+
* wasm32 (its coroutine lowering owns async bodies), module-evaluation
|
|
433
|
+
* bodies (their promise caches),
|
|
434
434
|
* `dyn` results (resolution may adopt a thenable), and every program
|
|
435
435
|
* that uses node:test subtests — `t.test()` runs a subtest inline and
|
|
436
436
|
* awaits it on the CURRENT fiber even from synchronous code. Worker
|
|
@@ -852,7 +852,7 @@ export declare class LlEmitter {
|
|
|
852
852
|
emitContainerExpr(e: ExprOf<"arrayLit" | "arrayNewLen" | "arrayGet" | "arrayHas" | "arrayState" | "arrIntrinsic" | "bytesNew" | "bytesIntrinsic" | "mapNew" | "mapIntrinsic" | "setIntrinsic" | "setNew">): LlValue;
|
|
853
853
|
emitCallExpr(e: ExprOf<"call" | "ffiCall" | "closure" | "callValue" | "selfRef" | "new" | "classRef" | "newValue" | "instanceOfValue" | "promiseVoidWiden" | "upcast" | "downcast" | "instanceOf" | "virtualCall">): LlValue;
|
|
854
854
|
emitRecordExpr(e: ExprOf<"fieldGet" | "recordGet" | "recordLit" | "recordClone" | "recordKeyGet" | "recordOvfKeys" | "recordOvfHas" | "recordHas" | "fieldAbsent">): LlValue;
|
|
855
|
-
emitDynamicExpr(e: ExprOf<"dynFrom" | "
|
|
855
|
+
emitDynamicExpr(e: ExprOf<"dynFrom" | "dynCall" | "dynInvoke" | "dynArrLit" | "dynObjLit" | "unionWrap" | "unionNarrow" | "unionDisc" | "unionKeyGet" | "unionIsTag" | "dynKeyGet" | "dynHasKey" | "dynScalarEq" | "dynTest" | "unionEq" | "unionFuncEq" | "caughtTest" | "caughtCheck" | "caughtNarrow" | "caughtToDyn">): LlValue;
|
|
856
856
|
emitIntrinsicExpr(e: ExprOf<"intrinsic">): LlValue;
|
|
857
857
|
private publishWalkersCache;
|
|
858
858
|
/** Per-type publication walkers, created on the first publish. */
|
|
@@ -881,7 +881,6 @@ export declare class LlEmitter {
|
|
|
881
881
|
emitPublishedCollectionGuard(m: string, t: IrType): void;
|
|
882
882
|
emitSerializationExpr(e: ExprOf<"jsonStringify" | "dynCheck">): LlValue;
|
|
883
883
|
emitAsyncExpr(e: ExprOf<"yieldExpr" | "genResume" | "awaitExpr" | "awaitUnionExpr" | "newPromise" | "promiseWithResolvers">): LlValue;
|
|
884
|
-
emitJsInteropExpr(e: ExprOf<"jsMarshal" | "jsOp" | "jsExit" | "jsBridgePromise">): LlValue;
|
|
885
884
|
/** Read a receiver whose value is consumed immediately by a field or tag
|
|
886
885
|
* load. No user code may run between this read and its consumer. Locals
|
|
887
886
|
* and their projections already have an owner; other expressions keep
|
|
@@ -958,19 +957,6 @@ export declare class LlEmitter {
|
|
|
958
957
|
borrowableNullableWrap(e: IrExpr): "unit" | "ref" | null;
|
|
959
958
|
materializeSplitLocal(localId: string): void;
|
|
960
959
|
emitExpr(e: IrExpr): LlValue;
|
|
961
|
-
emitJsMarshal(e: IrExpr & {
|
|
962
|
-
kind: "jsMarshal";
|
|
963
|
-
}): LlValue;
|
|
964
|
-
emitJsOp(e: IrExpr & {
|
|
965
|
-
kind: "jsOp";
|
|
966
|
-
}): LlValue;
|
|
967
|
-
emitJsExit(e: IrExpr & {
|
|
968
|
-
kind: "jsExit";
|
|
969
|
-
}): LlValue;
|
|
970
|
-
islandAdapter(arity: number, retKind: "void" | "jsval" | "f64" | "bool" | "string"): string;
|
|
971
|
-
islandTypedAdapter(fn: IrType & {
|
|
972
|
-
kind: "func";
|
|
973
|
-
}): string;
|
|
974
960
|
dynKind(d: string): string;
|
|
975
961
|
raceAdapterFor(from: IrType, to: IrType): string;
|
|
976
962
|
genResultThunkFor(genT: IrType & {
|
|
@@ -2,30 +2,12 @@ import { emitLlvmLayouts } from "./layouts.js";
|
|
|
2
2
|
import { FIRST_EMITTED_CYC_KIND, inlineAllocSupported } from "./alloc.js";
|
|
3
3
|
import { llvmBytes as llBytes } from "../literals.js";
|
|
4
4
|
import { InternalCompilerError } from "../../errors.js";
|
|
5
|
-
/** Lower typed IR to LLVM, using the runtime's C ABI.
|
|
6
|
-
*
|
|
7
|
-
* Reference-counted temporaries own one reference. Declarations, assignments,
|
|
8
|
-
* returns and arguments move that ownership; frame and scope exits release
|
|
9
|
-
* everything remaining. Slot-backed entries release the slot's current value.
|
|
10
|
-
*
|
|
11
|
-
* Exceptions use a pending flag and explicit cleanup edges. Throwing calls
|
|
12
|
-
* test scr_exc_pending before consuming results, release the scopes crossed,
|
|
13
|
-
* and branch to the innermost handler or return to the caller. Catch bindings
|
|
14
|
-
* hold ScrCaught snapshots; finally runs on normal, throwing and returning
|
|
15
|
-
* paths. This keeps ownership cleanup intact without nonlocal jumps.
|
|
16
|
-
*
|
|
17
|
-
* Program objects are emitted by the packaged LLVM helper and linked with
|
|
18
|
-
* runtime packs. Sanitizer development builds use an external LLVM driver.
|
|
19
|
-
* Dynamic values and islands share the runtime ABI; embedded npm modules use
|
|
20
|
-
* compressed source tables that the runtime inflates on demand.
|
|
21
|
-
*/
|
|
22
5
|
import { createHash } from "node:crypto";
|
|
23
|
-
import { deflateRawSync } from "node:zlib";
|
|
24
6
|
import { endsWithJump, matchStringSelfConcat, streamTypedRefEligible, undefinedArmTag, } from "../../ir/analysis.js";
|
|
25
7
|
import { emitLibraryIdentityLines } from "../library-identity-markers.js";
|
|
26
8
|
import { loopTestsEveryIteration } from "../loop-polls.js";
|
|
27
9
|
import { CAUGHT, ffiCallbackType, isDynTypedRefType, isFfiContextParam, isRefCounted, isUnitType, POINTER_KINDS, RUNTIME_EMITTER_CLASS, RUNTIME_ERROR_CLASSES, RUNTIME_STREAM_CLASSES, typeEquals, typeKey, STRING, VOID, } from "../../ir/ir.js";
|
|
28
|
-
import { moduleRuntimeFeatures
|
|
10
|
+
import { moduleRuntimeFeatures } from "../../ir/runtime-features.js";
|
|
29
11
|
import { matchIntegerArrayForLoop, matchIntegerBytesForLoop, matchIntegerCountedForLoop, } from "../../ir/integer-loops.js";
|
|
30
12
|
import { emitCountedLoopLimit } from "./counted-loops.js";
|
|
31
13
|
import { emitLiteralSwitch } from "./switch-dispatch.js";
|
|
@@ -79,8 +61,7 @@ import { emitIntrinsicExpr, emitSerializationExpr, emitAsyncExpr } from "./expr-
|
|
|
79
61
|
import { PublishWalkers } from "./publish.js";
|
|
80
62
|
import { computeImmutableFields, stableGlobals } from "../immutability.js";
|
|
81
63
|
import { computePublishedTypes } from "../publication.js";
|
|
82
|
-
import {
|
|
83
|
-
import { emitJsMarshal, emitJsOp, emitJsExit, islandAdapter, islandTypedAdapter, } from "./expr-island.js";
|
|
64
|
+
import { emitExpr } from "./expr-dispatch.js";
|
|
84
65
|
import { dynKind, raceAdapterFor, genResultThunkFor, childExitThunkFor, childExitSignalThunkFor, childDataThunkFor, execFileThunkFor, ipcMessageThunkFor, ipcSendThunkFor, emitterFixedAdapter, wrapEmitterListener, unwrapNullableClosure, closeBindThunkFor, closeOverrideWrapFor, } from "./expr-callbacks.js";
|
|
85
66
|
import { streamDataAdapter, streamDoneFnFor, cryptoBytesThunkFor, fsRenameThunkFor, streamCbThunkFor, zlibBytesThunkFor, } from "./expr-stream-callbacks.js";
|
|
86
67
|
import { emitStableReceiver, resolveThunkFor, tagInSet, arrPush, emitArrayCopyLoop, emitStrIntrinsic, emitArrIntrinsic, emitDiscardedSplice, wrapNullable, emitMapNew, mapSet, emitMapLikeIntrinsic, emitSetNew, } from "./expr-containers.js";
|
|
@@ -1125,23 +1106,6 @@ export class LlEmitter {
|
|
|
1125
1106
|
const asyncDefs = this.emitAsyncScaffolding();
|
|
1126
1107
|
const ffiCallbacks = this.emitFfiCallbackDefs();
|
|
1127
1108
|
const hasNoInlineRecordClone = [...this.recordCloneShapes].some((shapeId) => (this.recordsById.get(shapeId)?.fields.length ?? 0) >= 16);
|
|
1128
|
-
const embedded = this.mod.embedded;
|
|
1129
|
-
const usesIsland = embedded !== undefined && embedded.modules.length > 0;
|
|
1130
|
-
const storeNpmText = (text) => {
|
|
1131
|
-
const plain = Buffer.from(text, "utf8");
|
|
1132
|
-
if (text.length < NPM_COMPRESS_MIN)
|
|
1133
|
-
return { bytes: plain, raw: 0 };
|
|
1134
|
-
const deflated = deflateRawSync(plain, { level: 9 });
|
|
1135
|
-
return deflated.length < plain.length
|
|
1136
|
-
? { bytes: deflated, raw: plain.length }
|
|
1137
|
-
: { bytes: plain, raw: 0 };
|
|
1138
|
-
};
|
|
1139
|
-
const npmStored = usesIsland
|
|
1140
|
-
? embedded.modules.map((m) => ({
|
|
1141
|
-
src: storeNpmText(m.source),
|
|
1142
|
-
esm: m.esm === undefined ? null : storeNpmText(m.esm),
|
|
1143
|
-
}))
|
|
1144
|
-
: [];
|
|
1145
1109
|
// Module globals, FIRST OCCURRENCE per id: a class-expression static
|
|
1146
1110
|
// instantiated through several mixin applications registers one global
|
|
1147
1111
|
// id several times (2041-mixin-values) — C's tentative definitions
|
|
@@ -1205,24 +1169,14 @@ export class LlEmitter {
|
|
|
1205
1169
|
const usesDgram = runtimeFeatures.dgram;
|
|
1206
1170
|
const usesHttp2 = runtimeFeatures.http2;
|
|
1207
1171
|
const usesHttp = runtimeFeatures.http;
|
|
1208
|
-
// Fetch-referencing programs register
|
|
1209
|
-
//
|
|
1210
|
-
// compiles scr_fetch.c on the same predicate.
|
|
1172
|
+
// Fetch-referencing programs register native fetch before main.
|
|
1173
|
+
// Runtime selection compiles scr_fetch.c on the same predicate.
|
|
1211
1174
|
const usesFetch = runtimeFeatures.fetch;
|
|
1212
|
-
const
|
|
1213
|
-
const embedsNet = moduleEmbedsBuiltin(this.mod, "node:http") ||
|
|
1214
|
-
moduleEmbedsBuiltin(this.mod, "node:https") ||
|
|
1215
|
-
moduleEmbedsBuiltin(this.mod, "node:net") ||
|
|
1216
|
-
moduleEmbedsBuiltin(this.mod, "node:tls");
|
|
1217
|
-
const snapshotsTlsCa = runtimeFeatures.tls ||
|
|
1218
|
-
runtimeFeatures.tlsCa ||
|
|
1219
|
-
moduleEmbedsBuiltin(this.mod, "node:https") ||
|
|
1220
|
-
moduleEmbedsBuiltin(this.mod, "node:tls");
|
|
1175
|
+
const snapshotsTlsCa = runtimeFeatures.tls || runtimeFeatures.tlsCa;
|
|
1221
1176
|
// The process verdict has the same precedence as the C reference
|
|
1222
1177
|
// emitter: node:test owns the final status when present; otherwise an
|
|
1223
1178
|
// embedded process.exitCode owns it; ordinary programs return zero.
|
|
1224
1179
|
const usesNodeTest = runtimeFeatures.nodeTest;
|
|
1225
|
-
const programExitUsesIsland = !usesNodeTest && usesIsland;
|
|
1226
1180
|
// Declared NOW — the extern block flushes before main assembles.
|
|
1227
1181
|
if (usesEvents)
|
|
1228
1182
|
this.declare(`declare void @scr_events_install()`);
|
|
@@ -1259,19 +1213,6 @@ export class LlEmitter {
|
|
|
1259
1213
|
this.declare(`declare void @scr_http_dyn_install()`);
|
|
1260
1214
|
if (usesFetch)
|
|
1261
1215
|
this.declare(`declare void @scr_fetch_install()`);
|
|
1262
|
-
if (embedsZlib)
|
|
1263
|
-
this.declare(`declare void @scr_zlib_island_install()`);
|
|
1264
|
-
if (embedsNet)
|
|
1265
|
-
this.declare(`declare void @scr_net_island_install()`);
|
|
1266
|
-
if (usesIsland) {
|
|
1267
|
-
this.declare(`declare void @scr_island_modules(ptr, ${this.sizeType}, ptr, ${this.sizeType})`);
|
|
1268
|
-
this.declare(`declare void @scr_island_entry_module(ptr)`);
|
|
1269
|
-
this.declare(`declare i32 @scr_island_exit_code()`);
|
|
1270
|
-
if (moduleEmbedsCompressedNpm(this.mod)) {
|
|
1271
|
-
this.declare(`declare void @scr_island_set_inflate(ptr)`);
|
|
1272
|
-
this.declare(`declare zeroext i1 @scr_zlib_inflate_exact(ptr, ${this.sizeType}, ptr, ${this.sizeType})`);
|
|
1273
|
-
}
|
|
1274
|
-
}
|
|
1275
1216
|
if (usesNodeTest)
|
|
1276
1217
|
this.declare(`declare i32 @scr_test_exit_code()`);
|
|
1277
1218
|
if (snapshotsTlsCa) {
|
|
@@ -1310,7 +1251,6 @@ export class LlEmitter {
|
|
|
1310
1251
|
// fibers as abandoned, so the RC audit downgrades exactly like the
|
|
1311
1252
|
// async loop-exhaustion story.
|
|
1312
1253
|
const runsLoop = this.usesTimers ||
|
|
1313
|
-
usesIsland ||
|
|
1314
1254
|
this.ffiHasForeignCallback ||
|
|
1315
1255
|
this.mod.functions.some((f) => f.async === true || f.generator !== undefined);
|
|
1316
1256
|
const uncaughtReleases = entryMayThrow && !asyncEntry ? globalReleaseLines("gu") : [];
|
|
@@ -1337,9 +1277,6 @@ export class LlEmitter {
|
|
|
1337
1277
|
this.declare(`declare void @scr_promise_rethrow_top_level(ptr)`);
|
|
1338
1278
|
this.declare(`declare void @scr_promise_release(ptr)`);
|
|
1339
1279
|
this.declare(`declare void @scr_exit_code_note(i32)`);
|
|
1340
|
-
if (programExitUsesIsland && inlineExitListeners) {
|
|
1341
|
-
this.declare(`declare ${this.sizeType} @scr_island_exit_code_version()`);
|
|
1342
|
-
}
|
|
1343
1280
|
}
|
|
1344
1281
|
const topPendingExitLines = () => {
|
|
1345
1282
|
if (!asyncEntry)
|
|
@@ -1348,28 +1285,18 @@ export class LlEmitter {
|
|
|
1348
1285
|
if (usesNodeTest) {
|
|
1349
1286
|
lines.push(` %tla_program_exit = call i32 @scr_test_exit_code()`);
|
|
1350
1287
|
}
|
|
1351
|
-
|
|
1352
|
-
lines.push(` %tla_program_exit = call i32 @scr_island_exit_code()`);
|
|
1353
|
-
}
|
|
1354
|
-
if (usesNodeTest || usesIsland) {
|
|
1288
|
+
if (usesNodeTest) {
|
|
1355
1289
|
lines.push(` %tla_program_exit_zero = icmp eq i32 %tla_program_exit, 0`, ` %tla_exit_status = select i1 %tla_program_exit_zero, i32 %tla_status, i32 %tla_program_exit`);
|
|
1356
1290
|
}
|
|
1357
|
-
const exitStatus = usesNodeTest
|
|
1358
|
-
const tracksIslandExit = programExitUsesIsland && inlineExitListeners;
|
|
1359
|
-
if (tracksIslandExit) {
|
|
1360
|
-
lines.push(` %tla_exit_version = call ${this.sizeType} @scr_island_exit_code_version()`);
|
|
1361
|
-
}
|
|
1291
|
+
const exitStatus = usesNodeTest ? "%tla_exit_status" : "%tla_status";
|
|
1362
1292
|
// finish_top_level initially notes 13. Replace that hint before exit
|
|
1363
1293
|
// listeners run when a higher-priority verdict was already selected.
|
|
1364
1294
|
lines.push(` call void @scr_exit_code_note(i32 ${exitStatus})`);
|
|
1365
1295
|
for (const line of exitListenerLines("xp"))
|
|
1366
1296
|
lines.push(line);
|
|
1367
|
-
if (tracksIslandExit) {
|
|
1368
|
-
lines.push(` %tla_exit_version_after = call ${this.sizeType} @scr_island_exit_code_version()`, ` %tla_exit_changed = icmp ne ${this.sizeType} %tla_exit_version_after, %tla_exit_version`, ` br i1 %tla_exit_changed, label %tla_exit_updated, label %tla_exit_unchanged`, `tla_exit_updated:`, ` %tla_listener_exit = call i32 @scr_island_exit_code()`, ` call void @scr_exit_code_note(i32 %tla_listener_exit)`, ` br label %tla_exit_done`, `tla_exit_unchanged:`, ` br label %tla_exit_done`, `tla_exit_done:`, ` %tla_final_exit = phi i32 [ %tla_listener_exit, %tla_exit_updated ], [ ${exitStatus}, %tla_exit_unchanged ]`);
|
|
1369
|
-
}
|
|
1370
1297
|
for (const line of topPendingReleases)
|
|
1371
1298
|
lines.push(line);
|
|
1372
|
-
lines.push(` ret i32 ${
|
|
1299
|
+
lines.push(` ret i32 ${exitStatus}`);
|
|
1373
1300
|
return lines;
|
|
1374
1301
|
};
|
|
1375
1302
|
// LIBRARY mode: the runtime entry points the generated library
|
|
@@ -1456,11 +1383,12 @@ export class LlEmitter {
|
|
|
1456
1383
|
? []
|
|
1457
1384
|
: [`%ScrMapRc = type { ${this.sizeType}, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr }`]),
|
|
1458
1385
|
// The complete ScrMap and its { key, val, hash } entry, read by the
|
|
1459
|
-
// inline number-key lookup (sc_map_entry_f64):
|
|
1460
|
-
//
|
|
1461
|
-
|
|
1386
|
+
// inline number-key lookup (sc_map_entry_f64): field 11 is the i64
|
|
1387
|
+
// absent-key filter, entries is field 13, the direct index and its
|
|
1388
|
+
// length fields 19 and 20.
|
|
1389
|
+
...(this.decls.has(NUMBER_MAP_ENTRY_DECL) || this.decls.has(STRING_MAP_ENTRY_DECL)
|
|
1462
1390
|
? [
|
|
1463
|
-
`%ScrMapIx = type { ${this.sizeType}, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ${this.sizeType}, ${this.sizeType}, ${this.sizeType}, ptr, ${this.sizeType}, ptr, ${this.sizeType}, ptr, ptr, ptr, ${this.sizeType} }`,
|
|
1391
|
+
`%ScrMapIx = type { ${this.sizeType}, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ${this.sizeType}, ${this.sizeType}, i64, ${this.sizeType}, ptr, ${this.sizeType}, ptr, ${this.sizeType}, ptr, ptr, ptr, ${this.sizeType} }`,
|
|
1464
1392
|
]
|
|
1465
1393
|
: []),
|
|
1466
1394
|
// String-keyed reference reads load the value slot of the entry
|
|
@@ -1599,52 +1527,12 @@ export class LlEmitter {
|
|
|
1599
1527
|
}
|
|
1600
1528
|
if (this.templateStringsInstances.size > 0)
|
|
1601
1529
|
out.push(``);
|
|
1602
|
-
const islandEntryPath = usesIsland ? this.cstr(this.mod.sourceFile) : null;
|
|
1603
1530
|
for (const [text, c] of this.cstrs) {
|
|
1604
1531
|
// NUL-terminated byte-array constants for scr_jb_puts and indentation.
|
|
1605
1532
|
out.push(`@${c.sym} = internal constant [${c.len + 1} x i8] c"${llStrBytes(text)}"`);
|
|
1606
1533
|
}
|
|
1607
1534
|
if (this.cstrs.size > 0)
|
|
1608
1535
|
out.push(``);
|
|
1609
|
-
if (usesIsland) {
|
|
1610
|
-
const fmt = { esm: 0, cjs: 1, json: 2 };
|
|
1611
|
-
const edgeKind = { any: 0, import: 1, require: 2 };
|
|
1612
|
-
embedded.modules.forEach((m, i) => {
|
|
1613
|
-
const stored = npmStored[i];
|
|
1614
|
-
const key = Buffer.from(m.key, "utf8");
|
|
1615
|
-
out.push(`@sc_npm_key_${i} = internal constant [${key.length + 1} x i8] c"${llBytes(key)}"`, `@sc_npm_src_${i} = internal constant [${stored.src.bytes.length + 1} x i8] c"${llBytes(stored.src.bytes)}"`);
|
|
1616
|
-
if (stored.esm !== null) {
|
|
1617
|
-
out.push(`@sc_npm_esm_${i} = internal constant [${stored.esm.bytes.length + 1} x i8] c"${llBytes(stored.esm.bytes)}"`);
|
|
1618
|
-
}
|
|
1619
|
-
});
|
|
1620
|
-
const moduleRows = embedded.modules.map((m, i) => {
|
|
1621
|
-
const stored = npmStored[i];
|
|
1622
|
-
const esm = stored.esm === null
|
|
1623
|
-
? `ptr null, ${this.sizeType} 0, ${this.sizeType} 0`
|
|
1624
|
-
: `ptr @sc_npm_esm_${i}, ${this.sizeType} ${stored.esm.bytes.length}, ${this.sizeType} ${stored.esm.raw}`;
|
|
1625
|
-
return (`%ScrIslandModule { ptr @sc_npm_key_${i}, ptr @sc_npm_src_${i}, ` +
|
|
1626
|
-
`${this.sizeType} ${stored.src.bytes.length}, ${this.sizeType} ${stored.src.raw}, ` +
|
|
1627
|
-
`i32 ${fmt[m.format]}, ${esm} }`);
|
|
1628
|
-
});
|
|
1629
|
-
out.push(`@sc_npm_modules = internal constant [${moduleRows.length} x %ScrIslandModule] [ ${moduleRows.join(", ")} ]`);
|
|
1630
|
-
embedded.edges.forEach((edge, i) => {
|
|
1631
|
-
const parts = [
|
|
1632
|
-
["from", edge.from],
|
|
1633
|
-
["spec", edge.specifier],
|
|
1634
|
-
["to", edge.to],
|
|
1635
|
-
];
|
|
1636
|
-
for (const [part, text] of parts) {
|
|
1637
|
-
const bytes = Buffer.from(text, "utf8");
|
|
1638
|
-
out.push(`@sc_npm_edge_${i}_${part} = internal constant [${bytes.length + 1} x i8] c"${llBytes(bytes)}"`);
|
|
1639
|
-
}
|
|
1640
|
-
});
|
|
1641
|
-
if (embedded.edges.length > 0) {
|
|
1642
|
-
const edgeRows = embedded.edges.map((edge, i) => `%ScrIslandEdge { ptr @sc_npm_edge_${i}_from, ptr @sc_npm_edge_${i}_spec, ` +
|
|
1643
|
-
`ptr @sc_npm_edge_${i}_to, i32 ${edgeKind[edge.kind]} }`);
|
|
1644
|
-
out.push(`@sc_npm_edges = internal constant [${edgeRows.length} x %ScrIslandEdge] [ ${edgeRows.join(", ")} ]`);
|
|
1645
|
-
}
|
|
1646
|
-
out.push(``);
|
|
1647
|
-
}
|
|
1648
1536
|
for (const line of ffiCallbacks.globals)
|
|
1649
1537
|
out.push(line);
|
|
1650
1538
|
if (ffiCallbacks.globals.length > 0)
|
|
@@ -1758,16 +1646,7 @@ export class LlEmitter {
|
|
|
1758
1646
|
: []),
|
|
1759
1647
|
// fs.watch programs fill the loop's watch hooks the same way —
|
|
1760
1648
|
// scr_watch.c links only when this line is emitted.
|
|
1761
|
-
...(usesFsWatch ? [` call void @scr_watch_install()`] : []), ...(this.ffiHasForeignCallback ? [` call void @scr_ffi_install()`] : []), ...(snapshotsTlsCa ? [` call void @scr_tls_ca_install()`] : []), ...(usesFetch ? [` call void @scr_fetch_install()`] : []), ...(
|
|
1762
|
-
? [
|
|
1763
|
-
` call void @scr_island_entry_module(ptr ${islandEntryPath})`,
|
|
1764
|
-
...(moduleEmbedsCompressedNpm(this.mod)
|
|
1765
|
-
? [` call void @scr_island_set_inflate(ptr @scr_zlib_inflate_exact)`]
|
|
1766
|
-
: []),
|
|
1767
|
-
` call void @scr_island_modules(ptr @sc_npm_modules, ${this.sizeType} ${embedded.modules.length}, ` +
|
|
1768
|
-
`ptr ${embedded.edges.length > 0 ? "@sc_npm_edges" : "null"}, ${this.sizeType} ${embedded.edges.length})`,
|
|
1769
|
-
]
|
|
1770
|
-
: []), ...(asyncEntry
|
|
1649
|
+
...(usesFsWatch ? [` call void @scr_watch_install()`] : []), ...(this.ffiHasForeignCallback ? [` call void @scr_ffi_install()`] : []), ...(snapshotsTlsCa ? [` call void @scr_tls_ca_install()`] : []), ...(usesFetch ? [` call void @scr_fetch_install()`] : []), ...(usesNet ? [` call void @scr_net_install()`, ` call void @scr_net_dyn_install()`] : []), ...(usesHttp ? [` call void @scr_http_dyn_install()`] : []), ...(usesDgram ? [` call void @scr_dgram_install()`] : []), ...(usesHttp2 ? [` call void @scr_http2_dyn_install()`] : []), ...(usesStream ? [` call void @scr_stream_install()`] : []), ` call void @scr_lib_init(i32 %argc, ptr %argv)`, ...(asyncEntry
|
|
1771
1650
|
? [` %top = call ptr @${mangleAsyncSpawn(this.mod.entry)}()`]
|
|
1772
1651
|
: [` call void @${mangleFunction(this.mod.entry)}()`]),
|
|
1773
1652
|
// Uncaught exception from top-level code: Node exits 1.
|
|
@@ -1854,9 +1733,7 @@ export class LlEmitter {
|
|
|
1854
1733
|
]
|
|
1855
1734
|
: []), ...exitListenerLines("xn"), ...globalReleases, ...(usesNodeTest
|
|
1856
1735
|
? [` %test_exit = call i32 @scr_test_exit_code()`, ` ret i32 %test_exit`]
|
|
1857
|
-
:
|
|
1858
|
-
? [` %island_exit = call i32 @scr_island_exit_code()`, ` ret i32 %island_exit`]
|
|
1859
|
-
: [` %native_exit = call i32 @scr_exit_code_hint_get()`, ` ret i32 %native_exit`]), `}`, ``, ...this.inlineRcTail(flushedDecls),
|
|
1736
|
+
: [` %native_exit = call i32 @scr_exit_code_hint_get()`, ` ret i32 %native_exit`]), `}`, ``, ...this.inlineRcTail(flushedDecls),
|
|
1860
1737
|
// sanitize_address is inert under the plain pipeline; the sanitized
|
|
1861
1738
|
// lane's -fsanitize=address link activates instrumentation over the
|
|
1862
1739
|
// emitted functions too (the runtime TUs get theirs from clang).
|
|
@@ -2122,11 +1999,44 @@ export class LlEmitter {
|
|
|
2122
1999
|
const sz = this.sizeType;
|
|
2123
2000
|
let mapTmp = 0;
|
|
2124
2001
|
const mapIndex = exactIndexLines("%k", "%nd", sz, () => `%ix${mapTmp++}`);
|
|
2125
|
-
defs.push(`define internal ptr @sc_map_entry_f64(ptr %m, double %k) ${FN_ATTRS} {`, `entry:`, ` %ndp = getelementptr inbounds %ScrMapIx, ptr %m, i32 0, i32
|
|
2002
|
+
defs.push(`define internal ptr @sc_map_entry_f64(ptr %m, double %k) ${FN_ATTRS} {`, `entry:`, ` %ndp = getelementptr inbounds %ScrMapIx, ptr %m, i32 0, i32 20`, ` %nd = load ${sz}, ptr %ndp`,
|
|
2126
2003
|
// A non-integral key inside the table is as absent as one outside it.
|
|
2127
2004
|
...mapIndex.lines.map((line) => ` ${line}`), ` br i1 ${mapIndex.ok}, label %slot, label %outside`, `slot:`, sz === "i64"
|
|
2128
2005
|
? ` %i = add i64 ${mapIndex.wide}, 0`
|
|
2129
|
-
: ` %i = trunc i64 ${mapIndex.wide} to ${sz}`, ` %dp = getelementptr inbounds %ScrMapIx, ptr %m, i32 0, i32
|
|
2006
|
+
: ` %i = trunc i64 ${mapIndex.wide} to ${sz}`, ` %dp = getelementptr inbounds %ScrMapIx, ptr %m, i32 0, i32 19`, ` %dense = load ptr, ptr %dp`, ` %sp = getelementptr inbounds i32, ptr %dense, ${sz} %i`, ` %s = load i32, ptr %sp`, ` %empty = icmp eq i32 %s, 0`, ` br i1 %empty, label %miss, label %hit`, `hit:`, ` %e32 = sub i32 %s, 1`, sz === "i32" ? ` %e = add i32 %e32, 0` : ` %e = zext i32 %e32 to ${sz}`, ` %ep = getelementptr inbounds %ScrMapIx, ptr %m, i32 0, i32 13`, ` %entries = load ptr, ptr %ep`, ` %found = getelementptr inbounds %ScrMapEntry, ptr %entries, ${sz} %e`, ` ret ptr %found`, `miss:`, ` ret ptr null`, `outside:`, ` %dense.any = icmp ne ${sz} %nd, 0`, ` br i1 %dense.any, label %miss, label %slow`, `slow:`, ` %r = call ptr @scr_map_entry_f64(ptr %m, double %k)`, ` ret ptr %r`, `}`, ``);
|
|
2007
|
+
}
|
|
2008
|
+
// String-key Map/Set lookups test the map's absent-key filter inline
|
|
2009
|
+
// (scr_map.c scr_map_filter_bits): a key whose two filter bits are not
|
|
2010
|
+
// both set is absent, so most misses on small and medium maps return
|
|
2011
|
+
// without a call. On 64-bit targets the key's cached hash h is the high
|
|
2012
|
+
// half of its capacity word, the runtime's widened hash is (h << 32) | h,
|
|
2013
|
+
// and the filter reads its bits 44..55, which are the capacity word's
|
|
2014
|
+
// own. A key without a cached hash, and every possible hit, take the
|
|
2015
|
+
// runtime lookup.
|
|
2016
|
+
if (this.decls.has(STRING_MAP_ENTRY_DECL)) {
|
|
2017
|
+
defs.push(`define internal ptr @sc_map_entry_str(ptr %m, ptr %k) ${FN_ATTRS} {`, `entry:`, ...(this.sizeType === "i64"
|
|
2018
|
+
? [
|
|
2019
|
+
` %fp = getelementptr inbounds %ScrMapIx, ptr %m, i32 0, i32 11`,
|
|
2020
|
+
` %filter = load i64, ptr %fp`,
|
|
2021
|
+
` %capp = getelementptr inbounds %ScrStr, ptr %k, i32 0, i32 2`,
|
|
2022
|
+
` %cap = load i64, ptr %capp`,
|
|
2023
|
+
` %cached = icmp uge i64 %cap, 4294967296`,
|
|
2024
|
+
` br i1 %cached, label %test, label %slow`,
|
|
2025
|
+
`test:`,
|
|
2026
|
+
` %s1 = lshr i64 %cap, 44`,
|
|
2027
|
+
` %i1 = and i64 %s1, 63`,
|
|
2028
|
+
` %b1 = shl i64 1, %i1`,
|
|
2029
|
+
` %s2 = lshr i64 %cap, 50`,
|
|
2030
|
+
` %i2 = and i64 %s2, 63`,
|
|
2031
|
+
` %b2 = shl i64 1, %i2`,
|
|
2032
|
+
` %bits = or i64 %b1, %b2`,
|
|
2033
|
+
` %have = and i64 %filter, %bits`,
|
|
2034
|
+
` %maybe = icmp eq i64 %have, %bits`,
|
|
2035
|
+
` br i1 %maybe, label %slow, label %absent`,
|
|
2036
|
+
`absent:`,
|
|
2037
|
+
` ret ptr null`,
|
|
2038
|
+
]
|
|
2039
|
+
: [` br label %slow`]), `slow:`, ` %r = call ptr @scr_map_entry_str(ptr %m, ptr %k)`, ` ret ptr %r`, `}`, ``);
|
|
2130
2040
|
}
|
|
2131
2041
|
// String comparisons enter through small internal wrappers that LLVM
|
|
2132
2042
|
// inlines at each site: interned literals and shared values compare by
|
|
@@ -2305,8 +2215,8 @@ export class LlEmitter {
|
|
|
2305
2215
|
* mentions (transitively), contains no suspension entry point. Such a
|
|
2306
2216
|
* body always completes before the call returns, which is exactly the
|
|
2307
2217
|
* behavior of a fiber that never suspends. Excluded conservatively:
|
|
2308
|
-
* wasm32 (its coroutine lowering owns async bodies),
|
|
2309
|
-
*
|
|
2218
|
+
* wasm32 (its coroutine lowering owns async bodies), module-evaluation
|
|
2219
|
+
* bodies (their promise caches),
|
|
2310
2220
|
* `dyn` results (resolution may adopt a thenable), and every program
|
|
2311
2221
|
* that uses node:test subtests — `t.test()` runs a subtest inline and
|
|
2312
2222
|
* awaits it on the CURRENT fiber even from synchronous code. Worker
|
|
@@ -2319,9 +2229,6 @@ export class LlEmitter {
|
|
|
2319
2229
|
const eligible = new Set();
|
|
2320
2230
|
if (this.wasi || this.mod.workers === true)
|
|
2321
2231
|
return eligible;
|
|
2322
|
-
const embedded = this.mod.embedded;
|
|
2323
|
-
if (embedded !== undefined && embedded.modules.length > 0)
|
|
2324
|
-
return eligible;
|
|
2325
2232
|
const suspends = /@scr_(?:await_|module_await\b|promise_await_settled\b|test_sub\b|gen_yield_|async_gen_|fiber_)/;
|
|
2326
2233
|
for (const decl of this.decls)
|
|
2327
2234
|
if (/@scr_test_sub\b/.test(decl))
|
|
@@ -3324,15 +3231,6 @@ export class LlEmitter {
|
|
|
3324
3231
|
this.declare(`declare void @scr_dyn_throw(ptr)`);
|
|
3325
3232
|
B.line(`call void @scr_dyn_throw(ptr ${v.name})`);
|
|
3326
3233
|
}
|
|
3327
|
-
else if (t.kind === "jsval") {
|
|
3328
|
-
const rc = vAdapters(this.shapeHost, t);
|
|
3329
|
-
const test = "scr_jsval_is_object";
|
|
3330
|
-
this.declare(`declare zeroext i1 @${test}(ptr)`);
|
|
3331
|
-
this.declare(`declare void @scr_throw_ref_classified(ptr, ptr, ptr, ptr, i1 zeroext)`);
|
|
3332
|
-
const object = B.tmp();
|
|
3333
|
-
B.line(`${object} = call zeroext i1 @${test}(ptr ${v.name})`);
|
|
3334
|
-
B.line(`call void @scr_throw_ref_classified(ptr ${v.name}, ptr ${rc.retain}, ptr ${rc.release}, ptr ${traceArg(this.shapeHost, t)}, i1 zeroext ${object})`);
|
|
3335
|
-
}
|
|
3336
3234
|
else {
|
|
3337
3235
|
const rc = vAdapters(this.shapeHost, t);
|
|
3338
3236
|
this.declare(`declare void @scr_throw_ref(ptr, ptr, ptr, ptr)`);
|
|
@@ -3370,7 +3268,7 @@ export class LlEmitter {
|
|
|
3370
3268
|
else if (arm.kind === "string") {
|
|
3371
3269
|
valueName = this.unionPeek(v.name, unionId);
|
|
3372
3270
|
}
|
|
3373
|
-
else if (arm.kind === "bigint" || arm.kind === "dyn"
|
|
3271
|
+
else if (arm.kind === "bigint" || arm.kind === "dyn") {
|
|
3374
3272
|
valueName = this.unionPeek(v.name, unionId);
|
|
3375
3273
|
}
|
|
3376
3274
|
const truthy = this.truthyOf(arm.kind, valueName, true);
|
|
@@ -3464,14 +3362,6 @@ export class LlEmitter {
|
|
|
3464
3362
|
B.line(`${truthy} = call zeroext i1 @scr_dyn_truthy(ptr ${valueName})`);
|
|
3465
3363
|
return truthy;
|
|
3466
3364
|
}
|
|
3467
|
-
case "jsval": {
|
|
3468
|
-
this.declare(`declare i32 @scr_jsval_truthy(ptr)`);
|
|
3469
|
-
const raw = B.tmp();
|
|
3470
|
-
const truthy = B.tmp();
|
|
3471
|
-
B.line(`${raw} = call i32 @scr_jsval_truthy(ptr ${valueName})`);
|
|
3472
|
-
B.line(`${truthy} = icmp ne i32 ${raw}, 0`);
|
|
3473
|
-
return truthy;
|
|
3474
|
-
}
|
|
3475
3365
|
default:
|
|
3476
3366
|
throw new LlvmUnsupportedError(`truthy:${unionArm ? "union:" : ""}${kind}`);
|
|
3477
3367
|
}
|
|
@@ -6518,9 +6408,6 @@ export class LlEmitter {
|
|
|
6518
6408
|
emitAsyncExpr(e) {
|
|
6519
6409
|
return emitAsyncExpr(this, e);
|
|
6520
6410
|
}
|
|
6521
|
-
emitJsInteropExpr(e) {
|
|
6522
|
-
return emitJsInteropExpr(this, e);
|
|
6523
|
-
}
|
|
6524
6411
|
/** Read a receiver whose value is consumed immediately by a field or tag
|
|
6525
6412
|
* load. No user code may run between this read and its consumer. Locals
|
|
6526
6413
|
* and their projections already have an owner; other expressions keep
|
|
@@ -7010,21 +6897,6 @@ export class LlEmitter {
|
|
|
7010
6897
|
emitExpr(e) {
|
|
7011
6898
|
return emitExpr(this, e);
|
|
7012
6899
|
}
|
|
7013
|
-
emitJsMarshal(e) {
|
|
7014
|
-
return emitJsMarshal(this, e);
|
|
7015
|
-
}
|
|
7016
|
-
emitJsOp(e) {
|
|
7017
|
-
return emitJsOp(this, e);
|
|
7018
|
-
}
|
|
7019
|
-
emitJsExit(e) {
|
|
7020
|
-
return emitJsExit(this, e);
|
|
7021
|
-
}
|
|
7022
|
-
islandAdapter(arity, retKind) {
|
|
7023
|
-
return islandAdapter(this, arity, retKind);
|
|
7024
|
-
}
|
|
7025
|
-
islandTypedAdapter(fn) {
|
|
7026
|
-
return islandTypedAdapter(this, fn);
|
|
7027
|
-
}
|
|
7028
6900
|
dynKind(d) {
|
|
7029
6901
|
return dynKind(this, d);
|
|
7030
6902
|
}
|