@scriptc/compiler 0.4.7 → 0.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ambient/node-fallback/child_process.d.ts +71 -22
- package/ambient/node-fallback/crypto.d.ts +15 -7
- package/ambient/node-fallback/events.d.ts +23 -5
- package/ambient/node-fallback/fs.d.ts +3 -2
- package/ambient/node-fallback/http.d.ts +23 -17
- package/ambient/node-fallback/https.d.ts +5 -2
- package/ambient/node-fallback/net.d.ts +6 -0
- package/ambient/node-fallback/os.d.ts +11 -1
- package/ambient/node-fallback/path-posix.d.ts +6 -0
- package/ambient/node-fallback/path-win32.d.ts +5 -0
- package/ambient/node-fallback/path.d.ts +2 -0
- package/ambient/node-fallback/zlib.d.ts +31 -2
- package/ambient/scriptc-node-fallback.d.ts +37 -7
- package/ambient/scriptc.d.ts +7 -2
- package/dist/backend/executable-features.js +11 -3
- package/dist/backend/executable-features.js.map +1 -1
- package/dist/backend/library-pack.d.ts +6 -0
- package/dist/backend/library-pack.js +17 -6
- package/dist/backend/library-pack.js.map +1 -1
- package/dist/backend/library-pack.test.d.ts +1 -0
- package/dist/backend/library-pack.test.js +28 -0
- package/dist/backend/library-pack.test.js.map +1 -0
- package/dist/backend/linker.d.ts +9 -2
- package/dist/backend/linker.js +190 -32
- package/dist/backend/linker.js.map +1 -1
- package/dist/backend/lld.d.ts +8 -4
- package/dist/backend/lld.js +19 -13
- package/dist/backend/lld.js.map +1 -1
- package/dist/backend/lld.test.js +3 -1
- package/dist/backend/lld.test.js.map +1 -1
- package/dist/backend/llvm/alloc.d.ts +15 -2
- package/dist/backend/llvm/alloc.js +172 -36
- package/dist/backend/llvm/alloc.js.map +1 -1
- package/dist/backend/llvm/alloc.test.js +69 -1
- package/dist/backend/llvm/alloc.test.js.map +1 -1
- package/dist/backend/llvm/arenas.d.ts +17 -4
- package/dist/backend/llvm/arenas.js +105 -10
- package/dist/backend/llvm/arenas.js.map +1 -1
- package/dist/backend/llvm/arenas.test.js +229 -0
- package/dist/backend/llvm/arenas.test.js.map +1 -1
- package/dist/backend/llvm/bytes-alias.js +10 -1
- package/dist/backend/llvm/bytes-alias.js.map +1 -1
- package/dist/backend/llvm/bytes-headers.js +6 -0
- package/dist/backend/llvm/bytes-headers.js.map +1 -1
- package/dist/backend/llvm/bytes-loop-versions.test.js +25 -0
- package/dist/backend/llvm/bytes-loop-versions.test.js.map +1 -1
- package/dist/backend/llvm/call-lifetimes.js +10 -0
- package/dist/backend/llvm/call-lifetimes.js.map +1 -1
- package/dist/backend/llvm/classes.d.ts +16 -9
- package/dist/backend/llvm/classes.js +142 -37
- package/dist/backend/llvm/classes.js.map +1 -1
- package/dist/backend/llvm/classes.test.js +42 -0
- package/dist/backend/llvm/classes.test.js.map +1 -1
- package/dist/backend/llvm/cpu-dispatch.d.ts +15 -5
- package/dist/backend/llvm/cpu-dispatch.js +31 -7
- package/dist/backend/llvm/cpu-dispatch.js.map +1 -1
- package/dist/backend/llvm/dyn.d.ts +12 -3
- package/dist/backend/llvm/dyn.js +31 -7
- package/dist/backend/llvm/dyn.js.map +1 -1
- package/dist/backend/llvm/emit-function.js +67 -4
- package/dist/backend/llvm/emit-function.js.map +1 -1
- package/dist/backend/llvm/emit-module.js +90 -39
- package/dist/backend/llvm/emit-module.js.map +1 -1
- package/dist/backend/llvm/emit-module.test.d.ts +1 -0
- package/dist/backend/llvm/emit-module.test.js +52 -0
- package/dist/backend/llvm/emit-module.test.js.map +1 -0
- package/dist/backend/llvm/emit-statements.js +99 -15
- package/dist/backend/llvm/emit-statements.js.map +1 -1
- package/dist/backend/llvm/emitter.d.ts +113 -8
- package/dist/backend/llvm/emitter.js +438 -67
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/backend/llvm/emitter.test.js +31 -3
- package/dist/backend/llvm/emitter.test.js.map +1 -1
- package/dist/backend/llvm/expr-async.js +19 -1
- package/dist/backend/llvm/expr-async.js.map +1 -1
- package/dist/backend/llvm/expr-bytes.js +16 -1
- package/dist/backend/llvm/expr-bytes.js.map +1 -1
- package/dist/backend/llvm/expr-calls.js +18 -2
- package/dist/backend/llvm/expr-calls.js.map +1 -1
- package/dist/backend/llvm/expr-dynamic.js +31 -10
- package/dist/backend/llvm/expr-dynamic.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.js +31 -3
- package/dist/backend/llvm/expr-primitives.js.map +1 -1
- package/dist/backend/llvm/expr-records.d.ts +1 -1
- package/dist/backend/llvm/expr-records.js +124 -56
- package/dist/backend/llvm/expr-records.js.map +1 -1
- package/dist/backend/llvm/expr-stream-bridges.js +17 -0
- package/dist/backend/llvm/expr-stream-bridges.js.map +1 -1
- package/dist/backend/llvm/js-groups.d.ts +21 -0
- package/dist/backend/llvm/js-groups.js +277 -0
- package/dist/backend/llvm/js-groups.js.map +1 -0
- package/dist/backend/llvm/js-ic.d.ts +19 -1
- package/dist/backend/llvm/js-ic.js +96 -23
- package/dist/backend/llvm/js-ic.js.map +1 -1
- package/dist/backend/llvm/lib-dispatch.js +132 -1
- package/dist/backend/llvm/lib-dispatch.js.map +1 -1
- package/dist/backend/llvm/lib-network.js +33 -6
- package/dist/backend/llvm/lib-network.js.map +1 -1
- package/dist/backend/llvm/lib-process.js +44 -3
- package/dist/backend/llvm/lib-process.js.map +1 -1
- package/dist/backend/llvm/lib-shared.js +69 -2
- package/dist/backend/llvm/lib-shared.js.map +1 -1
- package/dist/backend/llvm/local-union-storage.test.js +32 -0
- package/dist/backend/llvm/local-union-storage.test.js.map +1 -1
- package/dist/backend/llvm/loop-state.js +7 -2
- package/dist/backend/llvm/loop-state.js.map +1 -1
- package/dist/backend/llvm/map-entry-fusion.d.ts +8 -0
- package/dist/backend/llvm/map-entry-fusion.js +3 -3
- package/dist/backend/llvm/map-entry-fusion.js.map +1 -1
- package/dist/backend/llvm/map-number-lookup.test.js +6 -6
- package/dist/backend/llvm/map-number-lookup.test.js.map +1 -1
- package/dist/backend/llvm/nullable-unions.js +7 -6
- package/dist/backend/llvm/nullable-unions.js.map +1 -1
- package/dist/backend/llvm/nullable-unions.test.js +4 -1
- package/dist/backend/llvm/nullable-unions.test.js.map +1 -1
- package/dist/backend/llvm/receivers.js +3 -0
- package/dist/backend/llvm/receivers.js.map +1 -1
- package/dist/backend/llvm/record-entry-fusion.d.ts +32 -0
- package/dist/backend/llvm/record-entry-fusion.js +217 -0
- package/dist/backend/llvm/record-entry-fusion.js.map +1 -0
- package/dist/backend/llvm/record-results.d.ts +5 -2
- package/dist/backend/llvm/record-results.js +13 -12
- package/dist/backend/llvm/record-results.js.map +1 -1
- package/dist/backend/llvm/record-views.js +12 -6
- package/dist/backend/llvm/record-views.js.map +1 -1
- package/dist/backend/llvm/reference-effects.js +1 -0
- package/dist/backend/llvm/reference-effects.js.map +1 -1
- package/dist/backend/llvm/reference-writes.js +3 -0
- package/dist/backend/llvm/reference-writes.js.map +1 -1
- package/dist/backend/llvm/region-ir.js +1 -0
- package/dist/backend/llvm/region-ir.js.map +1 -1
- package/dist/backend/llvm/region-sites.d.ts +18 -0
- package/dist/backend/llvm/region-sites.js +79 -1
- package/dist/backend/llvm/region-sites.js.map +1 -1
- package/dist/backend/llvm/runtime-registries.test.js +53 -6
- package/dist/backend/llvm/runtime-registries.test.js.map +1 -1
- package/dist/backend/llvm/serialized-ir-emission.test.js +3 -1
- package/dist/backend/llvm/serialized-ir-emission.test.js.map +1 -1
- package/dist/backend/llvm/shapes.d.ts +33 -3
- package/dist/backend/llvm/shapes.js +183 -13
- package/dist/backend/llvm/shapes.js.map +1 -1
- package/dist/backend/llvm/stack-objects.d.ts +1 -2
- package/dist/backend/llvm/stack-objects.js +8 -5
- package/dist/backend/llvm/stack-objects.js.map +1 -1
- package/dist/backend/llvm/walkers.d.ts +12 -0
- package/dist/backend/llvm/walkers.js +46 -2
- package/dist/backend/llvm/walkers.js.map +1 -1
- package/dist/backend/may-throw.js +12 -2
- package/dist/backend/may-throw.js.map +1 -1
- package/dist/backend/may-throw.test.js +13 -0
- package/dist/backend/may-throw.test.js.map +1 -1
- package/dist/backend/native/contracts.d.ts +48 -8
- package/dist/backend/native/executable.js +55 -13
- package/dist/backend/native/executable.js.map +1 -1
- package/dist/backend/native/helper-identity-record.d.ts +11 -0
- package/dist/backend/native/helper-identity-record.js +76 -0
- package/dist/backend/native/helper-identity-record.js.map +1 -0
- package/dist/backend/native/helper-identity-record.test.d.ts +1 -0
- package/dist/backend/native/helper-identity-record.test.js +101 -0
- package/dist/backend/native/helper-identity-record.test.js.map +1 -0
- package/dist/backend/native/library.js +9 -1
- package/dist/backend/native/library.js.map +1 -1
- package/dist/backend/native/runtime-inputs.js +4 -1
- package/dist/backend/native/runtime-inputs.js.map +1 -1
- package/dist/backend/native/vendor.d.ts +1 -1
- package/dist/backend/native/vendor.js +1 -1
- package/dist/backend/native/vendor.js.map +1 -1
- package/dist/backend/native-codegen-core.d.ts +13 -10
- package/dist/backend/native-codegen-core.js +26 -13
- package/dist/backend/native-codegen-core.js.map +1 -1
- package/dist/backend/native-codegen.js +27 -8
- package/dist/backend/native-codegen.js.map +1 -1
- package/dist/backend/native-codegen.test.js +110 -14
- package/dist/backend/native-codegen.test.js.map +1 -1
- package/dist/backend/native-link-info-core.d.ts +37 -8
- package/dist/backend/native-link-info-core.js.map +1 -1
- package/dist/backend/runtime-pack-core.d.ts +17 -2
- package/dist/backend/runtime-pack-core.js +18 -3
- package/dist/backend/runtime-pack-core.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 +211 -2
- package/dist/backend/runtime-pack.test.js.map +1 -1
- package/dist/backend/tree-classes.d.ts +42 -0
- package/dist/backend/tree-classes.js +723 -0
- package/dist/backend/tree-classes.js.map +1 -0
- package/dist/backend/tree-classes.test.d.ts +1 -0
- package/dist/backend/tree-classes.test.js +338 -0
- package/dist/backend/tree-classes.test.js.map +1 -0
- package/dist/backend/vendor-archives.d.ts +5 -1
- package/dist/backend/vendor-archives.js +51 -7
- package/dist/backend/vendor-archives.js.map +1 -1
- package/dist/backend/vendor-inputs.d.ts +25 -4
- package/dist/backend/vendor-inputs.js +68 -4
- package/dist/backend/vendor-inputs.js.map +1 -1
- package/dist/backend/vendor-inputs.test.js +35 -1
- package/dist/backend/vendor-inputs.test.js.map +1 -1
- package/dist/backend/warm-cache.js +1 -1
- package/dist/backend/warm-cache.js.map +1 -1
- package/dist/compat/fetch-profile.js +2 -2
- package/dist/coverage/report.js +47 -0
- package/dist/coverage/report.js.map +1 -1
- package/dist/coverage/surface-manifest.js +1 -1
- package/dist/diagnostics/codes.d.ts +8 -0
- package/dist/diagnostics/codes.js +8 -0
- package/dist/diagnostics/codes.js.map +1 -1
- package/dist/diagnostics/diagnostic.d.ts +27 -9
- package/dist/diagnostics/diagnostic.js +60 -19
- package/dist/diagnostics/diagnostic.js.map +1 -1
- package/dist/diagnostics/envelope.d.ts +18 -0
- package/dist/diagnostics/envelope.js.map +1 -1
- package/dist/executable/executable-cache.d.ts +21 -2
- package/dist/executable/executable-cache.js +21 -1
- package/dist/executable/executable-cache.js.map +1 -1
- package/dist/executable/executable-cache.test.js +123 -1
- package/dist/executable/executable-cache.test.js.map +1 -1
- package/dist/executable/prepare.js +199 -248
- package/dist/executable/prepare.js.map +1 -1
- package/dist/frontend/analysis.js +200 -18
- package/dist/frontend/analysis.js.map +1 -1
- package/dist/frontend/builtin-modules.d.ts +4 -0
- package/dist/frontend/builtin-modules.js +10 -0
- package/dist/frontend/builtin-modules.js.map +1 -1
- package/dist/frontend/early-errors.d.ts +12 -2
- package/dist/frontend/early-errors.js +535 -4
- package/dist/frontend/early-errors.js.map +1 -1
- package/dist/frontend/early-errors.test.js +165 -0
- package/dist/frontend/early-errors.test.js.map +1 -1
- package/dist/frontend/inferred-js-diagnostics.test.js +65 -0
- package/dist/frontend/inferred-js-diagnostics.test.js.map +1 -1
- package/dist/frontend/jsx-opinion-sites.test.d.ts +1 -0
- package/dist/frontend/jsx-opinion-sites.test.js +86 -0
- package/dist/frontend/jsx-opinion-sites.test.js.map +1 -0
- package/dist/frontend/lib-exports.d.ts +23 -4
- package/dist/frontend/lib-exports.js +98 -26
- package/dist/frontend/lib-exports.js.map +1 -1
- package/dist/frontend/lowering/binding-analysis.js +21 -3
- package/dist/frontend/lowering/binding-analysis.js.map +1 -1
- package/dist/frontend/lowering/buffers.d.ts +8 -0
- package/dist/frontend/lowering/buffers.js +43 -0
- package/dist/frontend/lowering/buffers.js.map +1 -0
- package/dist/frontend/lowering/builtin-calls.js +4 -0
- package/dist/frontend/lowering/builtin-calls.js.map +1 -1
- package/dist/frontend/lowering/builtin-namespaces.d.ts +3 -2
- package/dist/frontend/lowering/builtin-namespaces.js +24 -3
- package/dist/frontend/lowering/builtin-namespaces.js.map +1 -1
- package/dist/frontend/lowering/builtin-statics.d.ts +24 -0
- package/dist/frontend/lowering/builtin-statics.js +407 -0
- package/dist/frontend/lowering/builtin-statics.js.map +1 -0
- package/dist/frontend/lowering/builtins/arguments.d.ts +4 -0
- package/dist/frontend/lowering/builtins/arguments.js +12 -0
- package/dist/frontend/lowering/builtins/arguments.js.map +1 -1
- package/dist/frontend/lowering/builtins/atomics.d.ts +6 -1
- package/dist/frontend/lowering/builtins/atomics.js +87 -1
- package/dist/frontend/lowering/builtins/atomics.js.map +1 -1
- package/dist/frontend/lowering/builtins/child-process-methods.js +2 -2
- package/dist/frontend/lowering/builtins/child-process-methods.js.map +1 -1
- package/dist/frontend/lowering/builtins/child-process-sync.d.ts +13 -0
- package/dist/frontend/lowering/builtins/child-process-sync.js +1 -13
- package/dist/frontend/lowering/builtins/child-process-sync.js.map +1 -1
- package/dist/frontend/lowering/builtins/child-process.d.ts +10 -4
- package/dist/frontend/lowering/builtins/child-process.js +560 -27
- package/dist/frontend/lowering/builtins/child-process.js.map +1 -1
- package/dist/frontend/lowering/builtins/compression.d.ts +2 -2
- package/dist/frontend/lowering/builtins/compression.js +41 -21
- package/dist/frontend/lowering/builtins/compression.js.map +1 -1
- package/dist/frontend/lowering/builtins/constants.js +7 -2
- package/dist/frontend/lowering/builtins/constants.js.map +1 -1
- package/dist/frontend/lowering/builtins/filesystem-calls.d.ts +1 -0
- package/dist/frontend/lowering/builtins/filesystem-calls.js +28 -2
- package/dist/frontend/lowering/builtins/filesystem-calls.js.map +1 -1
- package/dist/frontend/lowering/builtins/json.js +4 -0
- package/dist/frontend/lowering/builtins/json.js.map +1 -1
- package/dist/frontend/lowering/builtins/module-calls.js +3 -1
- package/dist/frontend/lowering/builtins/module-calls.js.map +1 -1
- package/dist/frontend/lowering/builtins/numbers.d.ts +4 -1
- package/dist/frontend/lowering/builtins/numbers.js +10 -2
- package/dist/frontend/lowering/builtins/numbers.js.map +1 -1
- package/dist/frontend/lowering/builtins/operating-system.d.ts +6 -3
- package/dist/frontend/lowering/builtins/operating-system.js +96 -16
- package/dist/frontend/lowering/builtins/operating-system.js.map +1 -1
- package/dist/frontend/lowering/builtins/process.d.ts +2 -2
- package/dist/frontend/lowering/builtins/process.js +103 -8
- package/dist/frontend/lowering/builtins/process.js.map +1 -1
- package/dist/frontend/lowering/builtins/promises.js +169 -8
- package/dist/frontend/lowering/builtins/promises.js.map +1 -1
- package/dist/frontend/lowering/builtins/properties.js +6 -2
- package/dist/frontend/lowering/builtins/properties.js.map +1 -1
- package/dist/frontend/lowering/builtins/readline.d.ts +6 -4
- package/dist/frontend/lowering/builtins/readline.js +180 -36
- package/dist/frontend/lowering/builtins/readline.js.map +1 -1
- package/dist/frontend/lowering/builtins/url.js +35 -12
- package/dist/frontend/lowering/builtins/url.js.map +1 -1
- package/dist/frontend/lowering/builtins/webassembly.js +2 -0
- package/dist/frontend/lowering/builtins/webassembly.js.map +1 -1
- package/dist/frontend/lowering/call-arguments.d.ts +10 -0
- package/dist/frontend/lowering/call-arguments.js +37 -2
- package/dist/frontend/lowering/call-arguments.js.map +1 -1
- package/dist/frontend/lowering/call-signatures.d.ts +10 -0
- package/dist/frontend/lowering/call-signatures.js +103 -0
- package/dist/frontend/lowering/call-signatures.js.map +1 -1
- package/dist/frontend/lowering/class-construction.d.ts +14 -2
- package/dist/frontend/lowering/class-construction.js +99 -5
- package/dist/frontend/lowering/class-construction.js.map +1 -1
- package/dist/frontend/lowering/class-dynamic-dispatch.d.ts +9 -0
- package/dist/frontend/lowering/class-dynamic-dispatch.js +1283 -1030
- package/dist/frontend/lowering/class-dynamic-dispatch.js.map +1 -1
- package/dist/frontend/lowering/class-dynamic-dispatch.test.js +158 -0
- package/dist/frontend/lowering/class-dynamic-dispatch.test.js.map +1 -1
- package/dist/frontend/lowering/class-prototypes.js +20 -15
- package/dist/frontend/lowering/class-prototypes.js.map +1 -1
- package/dist/frontend/lowering/class-runtime-statics.d.ts +8 -0
- package/dist/frontend/lowering/class-runtime-statics.js +20 -1
- package/dist/frontend/lowering/class-runtime-statics.js.map +1 -1
- package/dist/frontend/lowering/class-unions.js +21 -4
- package/dist/frontend/lowering/class-unions.js.map +1 -1
- package/dist/frontend/lowering/coercions/function-adapters.js +9 -0
- package/dist/frontend/lowering/coercions/function-adapters.js.map +1 -1
- package/dist/frontend/lowering/coercions/state.d.ts +8 -0
- package/dist/frontend/lowering/coercions/state.js +17 -0
- package/dist/frontend/lowering/coercions/state.js.map +1 -1
- package/dist/frontend/lowering/coercions/structural-plans.js +20 -5
- package/dist/frontend/lowering/coercions/structural-plans.js.map +1 -1
- package/dist/frontend/lowering/coercions/structural.js +10 -1
- package/dist/frontend/lowering/coercions/structural.js.map +1 -1
- package/dist/frontend/lowering/coercions/unions.d.ts +2 -1
- package/dist/frontend/lowering/coercions/unions.js +54 -10
- package/dist/frontend/lowering/coercions/unions.js.map +1 -1
- package/dist/frontend/lowering/constructor-returns.d.ts +23 -2
- package/dist/frontend/lowering/constructor-returns.js +284 -58
- package/dist/frontend/lowering/constructor-returns.js.map +1 -1
- package/dist/frontend/lowering/containers/array-callbacks.js +156 -62
- package/dist/frontend/lowering/containers/array-callbacks.js.map +1 -1
- package/dist/frontend/lowering/containers/array-construction.js +21 -3
- package/dist/frontend/lowering/containers/array-construction.js.map +1 -1
- package/dist/frontend/lowering/containers/array-from-async.js +139 -3
- package/dist/frontend/lowering/containers/array-from-async.js.map +1 -1
- package/dist/frontend/lowering/containers/array-iteration.d.ts +14 -4
- package/dist/frontend/lowering/containers/array-iteration.js +24 -7
- package/dist/frontend/lowering/containers/array-iteration.js.map +1 -1
- package/dist/frontend/lowering/containers/array-methods.js +14 -11
- package/dist/frontend/lowering/containers/array-methods.js.map +1 -1
- package/dist/frontend/lowering/containers/bytes.d.ts +6 -0
- package/dist/frontend/lowering/containers/bytes.js +446 -86
- package/dist/frontend/lowering/containers/bytes.js.map +1 -1
- package/dist/frontend/lowering/containers/callback-arguments.d.ts +5 -0
- package/dist/frontend/lowering/containers/callback-arguments.js +21 -12
- package/dist/frontend/lowering/containers/callback-arguments.js.map +1 -1
- package/dist/frontend/lowering/containers/collection-grouping.js +421 -2
- package/dist/frontend/lowering/containers/collection-grouping.js.map +1 -1
- package/dist/frontend/lowering/containers/collection-methods.js +52 -17
- package/dist/frontend/lowering/containers/collection-methods.js.map +1 -1
- package/dist/frontend/lowering/containers/iterator-helpers.d.ts +23 -0
- package/dist/frontend/lowering/containers/iterator-helpers.js +176 -10
- package/dist/frontend/lowering/containers/iterator-helpers.js.map +1 -1
- package/dist/frontend/lowering/containers/string-and-regexp.d.ts +5 -2
- package/dist/frontend/lowering/containers/string-and-regexp.js +45 -11
- package/dist/frontend/lowering/containers/string-and-regexp.js.map +1 -1
- package/dist/frontend/lowering/crypto-tables.d.ts +3 -3
- package/dist/frontend/lowering/crypto-tables.js +5 -5
- package/dist/frontend/lowering/dispatch-sites.js +3 -0
- package/dist/frontend/lowering/dispatch-sites.js.map +1 -1
- package/dist/frontend/lowering/divergences.d.ts +40 -0
- package/dist/frontend/lowering/divergences.js +239 -20
- package/dist/frontend/lowering/divergences.js.map +1 -1
- package/dist/frontend/lowering/effect-free.d.ts +12 -0
- package/dist/frontend/lowering/effect-free.js +44 -0
- package/dist/frontend/lowering/effect-free.js.map +1 -0
- package/dist/frontend/lowering/expressions/array-literals.d.ts +10 -0
- package/dist/frontend/lowering/expressions/array-literals.js +62 -0
- package/dist/frontend/lowering/expressions/array-literals.js.map +1 -1
- package/dist/frontend/lowering/expressions/binary.js +115 -5
- package/dist/frontend/lowering/expressions/binary.js.map +1 -1
- package/dist/frontend/lowering/expressions/element-access.js +151 -7
- package/dist/frontend/lowering/expressions/element-access.js.map +1 -1
- package/dist/frontend/lowering/expressions/hosted-narrowing.d.ts +15 -0
- package/dist/frontend/lowering/expressions/hosted-narrowing.js +54 -1
- package/dist/frontend/lowering/expressions/hosted-narrowing.js.map +1 -1
- package/dist/frontend/lowering/expressions/identifiers.js +31 -2
- package/dist/frontend/lowering/expressions/identifiers.js.map +1 -1
- package/dist/frontend/lowering/expressions/narrowing.d.ts +3 -0
- package/dist/frontend/lowering/expressions/narrowing.js +175 -22
- package/dist/frontend/lowering/expressions/narrowing.js.map +1 -1
- package/dist/frontend/lowering/expressions/object-literals.js +173 -11
- package/dist/frontend/lowering/expressions/object-literals.js.map +1 -1
- package/dist/frontend/lowering/expressions/optional-chains.js +5 -1
- package/dist/frontend/lowering/expressions/optional-chains.js.map +1 -1
- package/dist/frontend/lowering/expressions/property-access.d.ts +8 -0
- package/dist/frontend/lowering/expressions/property-access.js +379 -109
- package/dist/frontend/lowering/expressions/property-access.js.map +1 -1
- package/dist/frontend/lowering/expressions/relational.js +237 -7
- package/dist/frontend/lowering/expressions/relational.js.map +1 -1
- package/dist/frontend/lowering/expressions/typeof.js +8 -0
- package/dist/frontend/lowering/expressions/typeof.js.map +1 -1
- package/dist/frontend/lowering/expressions/union-fields.d.ts +20 -1
- package/dist/frontend/lowering/expressions/union-fields.js +103 -13
- package/dist/frontend/lowering/expressions/union-fields.js.map +1 -1
- package/dist/frontend/lowering/expressions/updates.js +74 -55
- package/dist/frontend/lowering/expressions/updates.js.map +1 -1
- package/dist/frontend/lowering/function-returns.js +37 -10
- package/dist/frontend/lowering/function-returns.js.map +1 -1
- package/dist/frontend/lowering/general-streams.js +5 -0
- package/dist/frontend/lowering/general-streams.js.map +1 -1
- package/dist/frontend/lowering/generator-delegation.d.ts +15 -7
- package/dist/frontend/lowering/generator-delegation.js +301 -118
- package/dist/frontend/lowering/generator-delegation.js.map +1 -1
- package/dist/frontend/lowering/generic-functions.d.ts +27 -1
- package/dist/frontend/lowering/generic-functions.js +432 -18
- package/dist/frontend/lowering/generic-functions.js.map +1 -1
- package/dist/frontend/lowering/global-function-values.d.ts +25 -0
- package/dist/frontend/lowering/global-function-values.js +193 -0
- package/dist/frontend/lowering/global-function-values.js.map +1 -0
- package/dist/frontend/lowering/global-values.d.ts +6 -4
- package/dist/frontend/lowering/global-values.js +24 -10
- package/dist/frontend/lowering/global-values.js.map +1 -1
- package/dist/frontend/lowering/host-global-values.d.ts +31 -0
- package/dist/frontend/lowering/host-global-values.js +121 -0
- package/dist/frontend/lowering/host-global-values.js.map +1 -0
- package/dist/frontend/lowering/host-globals.d.ts +74 -0
- package/dist/frontend/lowering/host-globals.js +344 -0
- package/dist/frontend/lowering/host-globals.js.map +1 -0
- package/dist/frontend/lowering/http2-constants.js +1 -1
- package/dist/frontend/lowering/iterator-adapters.js +46 -17
- package/dist/frontend/lowering/iterator-adapters.js.map +1 -1
- package/dist/frontend/lowering/iterator-prototype.d.ts +30 -0
- package/dist/frontend/lowering/iterator-prototype.js +160 -0
- package/dist/frontend/lowering/iterator-prototype.js.map +1 -0
- package/dist/frontend/lowering/key-order-witness.js +43 -22
- package/dist/frontend/lowering/key-order-witness.js.map +1 -1
- package/dist/frontend/lowering/key-order-witness.test.js +1 -0
- package/dist/frontend/lowering/key-order-witness.test.js.map +1 -1
- package/dist/frontend/lowering/lib-boundary.js +11 -3
- package/dist/frontend/lowering/lib-boundary.js.map +1 -1
- package/dist/frontend/lowering/lower-assert.js +30 -15
- package/dist/frontend/lowering/lower-assert.js.map +1 -1
- package/dist/frontend/lowering/lower-async-iteration.d.ts +11 -0
- package/dist/frontend/lowering/lower-async-iteration.js +15 -0
- package/dist/frontend/lowering/lower-async-iteration.js.map +1 -1
- package/dist/frontend/lowering/lower-builtin-values.js +11 -1
- package/dist/frontend/lowering/lower-builtin-values.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.d.ts +25 -0
- package/dist/frontend/lowering/lower-calls.js +929 -227
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.test.js +59 -16
- package/dist/frontend/lowering/lower-calls.test.js.map +1 -1
- package/dist/frontend/lowering/lower-classes.d.ts +20 -0
- package/dist/frontend/lowering/lower-classes.js +468 -44
- package/dist/frontend/lowering/lower-classes.js.map +1 -1
- package/dist/frontend/lowering/lower-event-emitter.d.ts +6 -2
- package/dist/frontend/lowering/lower-event-emitter.js +253 -83
- package/dist/frontend/lowering/lower-event-emitter.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.d.ts +1 -1
- package/dist/frontend/lowering/lower-exprs.js +71 -20
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-functions.js +25 -6
- package/dist/frontend/lowering/lower-functions.js.map +1 -1
- package/dist/frontend/lowering/lower-generators.js +57 -10
- package/dist/frontend/lowering/lower-generators.js.map +1 -1
- package/dist/frontend/lowering/lower-global-value.d.ts +6 -0
- package/dist/frontend/lowering/lower-global-value.js +14 -5
- package/dist/frontend/lowering/lower-global-value.js.map +1 -1
- package/dist/frontend/lowering/lower-inspect.d.ts +4 -0
- package/dist/frontend/lowering/lower-inspect.js +638 -64
- package/dist/frontend/lowering/lower-inspect.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.js +48 -2
- package/dist/frontend/lowering/lower-modules.js.map +1 -1
- package/dist/frontend/lowering/lower-namespaces.js +18 -0
- package/dist/frontend/lowering/lower-namespaces.js.map +1 -1
- package/dist/frontend/lowering/lower-node-island.js +16 -6
- package/dist/frontend/lowering/lower-node-island.js.map +1 -1
- package/dist/frontend/lowering/lower-server.js +303 -87
- package/dist/frontend/lowering/lower-server.js.map +1 -1
- package/dist/frontend/lowering/lower-stdlib.js +45 -0
- package/dist/frontend/lowering/lower-stdlib.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.d.ts +14 -11
- package/dist/frontend/lowering/lower-stmts.js +270 -52
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lower-timers.js +110 -27
- package/dist/frontend/lowering/lower-timers.js.map +1 -1
- package/dist/frontend/lowering/lower-url.js +6 -3
- package/dist/frontend/lowering/lower-url.js.map +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +227 -21
- package/dist/frontend/lowering/lowerer.js +651 -92
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/lowering/lowerer.test.js +18 -0
- package/dist/frontend/lowering/lowerer.test.js.map +1 -1
- package/dist/frontend/lowering/lowering-facts.d.ts +110 -0
- package/dist/frontend/lowering/lowering-facts.js +323 -0
- package/dist/frontend/lowering/lowering-facts.js.map +1 -0
- package/dist/frontend/lowering/lowering-facts.test.d.ts +1 -0
- package/dist/frontend/lowering/lowering-facts.test.js +100 -0
- package/dist/frontend/lowering/lowering-facts.test.js.map +1 -0
- package/dist/frontend/lowering/nan-coded-reads.d.ts +27 -4
- package/dist/frontend/lowering/nan-coded-reads.js +112 -9
- package/dist/frontend/lowering/nan-coded-reads.js.map +1 -1
- package/dist/frontend/lowering/optional-arguments.d.ts +4 -0
- package/dist/frontend/lowering/optional-arguments.js +26 -2
- package/dist/frontend/lowering/optional-arguments.js.map +1 -1
- package/dist/frontend/lowering/partial-assertions.d.ts +0 -3
- package/dist/frontend/lowering/partial-assertions.js +9 -15
- package/dist/frontend/lowering/partial-assertions.js.map +1 -1
- package/dist/frontend/lowering/primitive-throws.d.ts +100 -0
- package/dist/frontend/lowering/primitive-throws.js +241 -0
- package/dist/frontend/lowering/primitive-throws.js.map +1 -0
- package/dist/frontend/lowering/primitive-wrappers.js +1 -0
- package/dist/frontend/lowering/primitive-wrappers.js.map +1 -1
- package/dist/frontend/lowering/record-inherited.d.ts +17 -1
- package/dist/frontend/lowering/record-inherited.js +16 -2
- package/dist/frontend/lowering/record-inherited.js.map +1 -1
- package/dist/frontend/lowering/record-links.d.ts +73 -0
- package/dist/frontend/lowering/record-links.js +797 -0
- package/dist/frontend/lowering/record-links.js.map +1 -0
- package/dist/frontend/lowering/runtime-optional-provenance.d.ts +27 -7
- package/dist/frontend/lowering/runtime-optional-provenance.js +25 -11
- package/dist/frontend/lowering/runtime-optional-provenance.js.map +1 -1
- package/dist/frontend/lowering/runtime-optional-report.d.ts +40 -0
- package/dist/frontend/lowering/runtime-optional-report.js +300 -0
- package/dist/frontend/lowering/runtime-optional-report.js.map +1 -0
- package/dist/frontend/lowering/scoped-type-memo.test.d.ts +1 -0
- package/dist/frontend/lowering/scoped-type-memo.test.js +86 -0
- package/dist/frontend/lowering/scoped-type-memo.test.js.map +1 -0
- package/dist/frontend/lowering/static-typeof.d.ts +3 -1
- package/dist/frontend/lowering/static-typeof.js +6 -1
- package/dist/frontend/lowering/static-typeof.js.map +1 -1
- package/dist/frontend/lowering/strict-mode.d.ts +1 -5
- package/dist/frontend/lowering/strict-mode.js +4 -30
- package/dist/frontend/lowering/strict-mode.js.map +1 -1
- package/dist/frontend/lowering/structural-instances.d.ts +7 -0
- package/dist/frontend/lowering/structural-instances.js +23 -0
- package/dist/frontend/lowering/structural-instances.js.map +1 -1
- package/dist/frontend/lowering/surfaces.d.ts +15 -1
- package/dist/frontend/lowering/surfaces.js +78 -10
- package/dist/frontend/lowering/surfaces.js.map +1 -1
- package/dist/frontend/lowering/union-retag.d.ts +13 -1
- package/dist/frontend/lowering/union-retag.js +55 -1
- package/dist/frontend/lowering/union-retag.js.map +1 -1
- package/dist/frontend/lowering/union-retag.test.js +51 -0
- package/dist/frontend/lowering/union-retag.test.js.map +1 -1
- package/dist/frontend/lowering/unit-journal.d.ts +8 -0
- package/dist/frontend/lowering/unit-journal.js +14 -0
- package/dist/frontend/lowering/unit-journal.js.map +1 -1
- package/dist/frontend/lowering/unit-journal.test.js +36 -1
- package/dist/frontend/lowering/unit-journal.test.js.map +1 -1
- package/dist/frontend/lowering/zlib-constants.js +3 -2
- package/dist/frontend/lowering/zlib-constants.js.map +1 -1
- package/dist/frontend/npm-static.js +78 -9
- package/dist/frontend/npm-static.js.map +1 -1
- package/dist/frontend/npm-static.test.js +95 -2
- package/dist/frontend/npm-static.test.js.map +1 -1
- package/dist/frontend/pipeline.d.ts +5 -4
- package/dist/frontend/pipeline.js +94 -31
- package/dist/frontend/pipeline.js.map +1 -1
- package/dist/frontend/pipeline.test.js +68 -11
- package/dist/frontend/pipeline.test.js.map +1 -1
- package/dist/frontend/program.d.ts +62 -2
- package/dist/frontend/program.js +695 -422
- package/dist/frontend/program.js.map +1 -1
- package/dist/frontend/program.test.js +37 -1
- package/dist/frontend/program.test.js.map +1 -1
- package/dist/frontend/services-node.d.ts +7 -0
- package/dist/frontend/services-node.js +32 -1
- package/dist/frontend/services-node.js.map +1 -1
- package/dist/frontend/services-node.test.js +51 -0
- package/dist/frontend/services-node.test.js.map +1 -1
- package/dist/frontend/shape-inference/overlay.js +68 -2
- package/dist/frontend/shape-inference/overlay.js.map +1 -1
- package/dist/frontend/tier-analysis.d.ts +9 -0
- package/dist/frontend/tier-analysis.js +1 -0
- package/dist/frontend/tier-analysis.js.map +1 -1
- package/dist/frontend/tsc-codes.d.ts +57 -3
- package/dist/frontend/tsc-codes.js +935 -150
- package/dist/frontend/tsc-codes.js.map +1 -1
- package/dist/frontend/tsc-codes.test.js +221 -12
- package/dist/frontend/tsc-codes.test.js.map +1 -1
- package/dist/frontend/type-mapper.d.ts +91 -9
- package/dist/frontend/type-mapper.js +622 -181
- package/dist/frontend/type-mapper.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +80 -15
- package/dist/index.js.map +1 -1
- package/dist/index.test.d.ts +1 -0
- package/dist/index.test.js +60 -0
- package/dist/index.test.js.map +1 -0
- package/dist/ir/builtin-effects.js +43 -0
- package/dist/ir/builtin-effects.js.map +1 -1
- package/dist/ir/builtin-signatures.d.ts +1 -1
- package/dist/ir/builtin-signatures.js +242 -16
- package/dist/ir/builtin-signatures.js.map +1 -1
- package/dist/ir/callback-specialization.d.ts +3 -2
- package/dist/ir/callback-specialization.js +35 -25
- package/dist/ir/callback-specialization.js.map +1 -1
- package/dist/ir/capture-values.d.ts +8 -4
- package/dist/ir/capture-values.js +9 -6
- package/dist/ir/capture-values.js.map +1 -1
- package/dist/ir/char-unit-locals.d.ts +6 -2
- package/dist/ir/char-unit-locals.js +11 -2
- package/dist/ir/char-unit-locals.js.map +1 -1
- package/dist/ir/class-key-index.d.ts +18 -0
- package/dist/ir/class-key-index.js +29 -0
- package/dist/ir/class-key-index.js.map +1 -0
- package/dist/ir/class-key-index.test.d.ts +1 -0
- package/dist/ir/class-key-index.test.js +25 -0
- package/dist/ir/class-key-index.test.js.map +1 -0
- package/dist/ir/codec.generated.d.ts +1 -1
- package/dist/ir/codec.generated.js +724 -648
- package/dist/ir/codec.generated.js.map +1 -1
- package/dist/ir/constant-globals.d.ts +5 -2
- package/dist/ir/constant-globals.js +25 -27
- package/dist/ir/constant-globals.js.map +1 -1
- package/dist/ir/expression-inlining.d.ts +4 -2
- package/dist/ir/expression-inlining.js +8 -2
- package/dist/ir/expression-inlining.js.map +1 -1
- package/dist/ir/field-values.d.ts +5 -2
- package/dist/ir/field-values.js +32 -21
- package/dist/ir/field-values.js.map +1 -1
- package/dist/ir/fields.generated.d.ts +11 -2
- package/dist/ir/fields.generated.js +8 -0
- package/dist/ir/fields.generated.js.map +1 -1
- package/dist/ir/final-fields.js +1 -1
- package/dist/ir/final-fields.js.map +1 -1
- package/dist/ir/function-references.d.ts +5 -4
- package/dist/ir/function-references.js +7 -4
- package/dist/ir/function-references.js.map +1 -1
- package/dist/ir/function-references.test.js +7 -0
- package/dist/ir/function-references.test.js.map +1 -1
- package/dist/ir/init-only-globals.d.ts +4 -2
- package/dist/ir/init-only-globals.js +17 -18
- package/dist/ir/init-only-globals.js.map +1 -1
- package/dist/ir/inline-array-views.js +1 -0
- package/dist/ir/inline-array-views.js.map +1 -1
- package/dist/ir/int32-slots.js +7 -0
- package/dist/ir/int32-slots.js.map +1 -1
- package/dist/ir/ir.d.ts +59 -4
- package/dist/ir/ir.js +7 -0
- package/dist/ir/ir.js.map +1 -1
- package/dist/ir/js-groups.d.ts +51 -0
- package/dist/ir/js-groups.js +394 -0
- package/dist/ir/js-groups.js.map +1 -0
- package/dist/ir/js-groups.test.d.ts +1 -0
- package/dist/ir/js-groups.test.js +555 -0
- package/dist/ir/js-groups.test.js.map +1 -0
- package/dist/ir/js-ic.js +30 -5
- package/dist/ir/js-ic.js.map +1 -1
- package/dist/ir/js-ic.test.js +27 -1
- package/dist/ir/js-ic.test.js.map +1 -1
- package/dist/ir/node-index.d.ts +23 -6
- package/dist/ir/node-index.js +126 -49
- package/dist/ir/node-index.js.map +1 -1
- package/dist/ir/numeric-call-specialization.d.ts +4 -2
- package/dist/ir/numeric-call-specialization.js +40 -26
- package/dist/ir/numeric-call-specialization.js.map +1 -1
- package/dist/ir/paired-while-loops.d.ts +4 -2
- package/dist/ir/paired-while-loops.js +8 -2
- package/dist/ir/paired-while-loops.js.map +1 -1
- package/dist/ir/parameter-versions.d.ts +13 -4
- package/dist/ir/parameter-versions.js +63 -42
- package/dist/ir/parameter-versions.js.map +1 -1
- package/dist/ir/property-bags.d.ts +4 -2
- package/dist/ir/property-bags.js +22 -17
- package/dist/ir/property-bags.js.map +1 -1
- package/dist/ir/row-pairs.d.ts +4 -2
- package/dist/ir/row-pairs.js +12 -11
- package/dist/ir/row-pairs.js.map +1 -1
- package/dist/ir/runtime-features.d.ts +87 -12
- package/dist/ir/runtime-features.js +263 -160
- package/dist/ir/runtime-features.js.map +1 -1
- package/dist/ir/runtime-features.test.js +109 -139
- package/dist/ir/runtime-features.test.js.map +1 -1
- package/dist/ir/runtime-jam-loops.d.ts +35 -0
- package/dist/ir/runtime-jam-loops.js +604 -0
- package/dist/ir/runtime-jam-loops.js.map +1 -0
- package/dist/ir/runtime-jam-loops.test.d.ts +1 -0
- package/dist/ir/runtime-jam-loops.test.js +565 -0
- package/dist/ir/runtime-jam-loops.test.js.map +1 -0
- package/dist/ir/saturating-loop-jams.d.ts +4 -2
- package/dist/ir/saturating-loop-jams.js +11 -10
- package/dist/ir/saturating-loop-jams.js.map +1 -1
- package/dist/ir/scalar-records.d.ts +5 -2
- package/dist/ir/scalar-records.js +12 -2
- package/dist/ir/scalar-records.js.map +1 -1
- package/dist/ir/self-captures.d.ts +4 -2
- package/dist/ir/self-captures.js +32 -27
- package/dist/ir/self-captures.js.map +1 -1
- package/dist/ir/serialize.d.ts +6 -1
- package/dist/ir/serialize.js +87 -23
- package/dist/ir/serialize.js.map +1 -1
- package/dist/ir/serialize.test.js +26 -0
- package/dist/ir/serialize.test.js.map +1 -1
- package/dist/ir/tiers.js +1 -0
- package/dist/ir/tiers.js.map +1 -1
- package/dist/ir/traverse.js +4 -0
- package/dist/ir/traverse.js.map +1 -1
- package/dist/ir/typed-argument-clones.d.ts +30 -0
- package/dist/ir/typed-argument-clones.js +789 -0
- package/dist/ir/typed-argument-clones.js.map +1 -0
- package/dist/ir/union-arm-loops.d.ts +3 -0
- package/dist/ir/union-arm-loops.js +373 -0
- package/dist/ir/union-arm-loops.js.map +1 -0
- package/dist/ir/union-arm-loops.test.d.ts +1 -0
- package/dist/ir/union-arm-loops.test.js +230 -0
- package/dist/ir/union-arm-loops.test.js.map +1 -0
- package/dist/ir/validate.js +88 -18
- package/dist/ir/validate.js.map +1 -1
- package/dist/library/compiler-self-identity.d.ts +8 -2
- package/dist/library/compiler-self-identity.js +92 -18
- package/dist/library/compiler-self-identity.js.map +1 -1
- package/dist/library/compiler-self-identity.test.js +150 -3
- package/dist/library/compiler-self-identity.test.js.map +1 -1
- package/dist/library/int-infer.d.ts +5 -0
- package/dist/library/int-infer.js +15 -3
- package/dist/library/int-infer.js.map +1 -1
- package/dist/library/ir-policy.js +1 -0
- package/dist/library/ir-policy.js.map +1 -1
- package/dist/library/library-cache.d.ts +4 -0
- package/dist/library/library-cache.js +2 -0
- package/dist/library/library-cache.js.map +1 -1
- package/dist/library/library-cache.test.js +26 -0
- package/dist/library/library-cache.test.js.map +1 -1
- package/dist/library/prepare.js +99 -31
- package/dist/library/prepare.js.map +1 -1
- package/dist/native/cache.d.ts +7 -0
- package/dist/native/cache.js +47 -0
- package/dist/native/cache.js.map +1 -1
- package/dist/native/cache.test.js +13 -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.js +18 -3
- package/dist/native/compiler.js.map +1 -1
- package/dist/native/executable-cache-open.test.js +31 -5
- package/dist/native/executable-cache-open.test.js.map +1 -1
- package/dist/native/executable-cache.d.ts +6 -1
- package/dist/native/executable-cache.js +7 -1
- package/dist/native/executable-cache.js.map +1 -1
- package/dist/native/prepare.d.ts +3 -0
- package/dist/native/prepare.js +43 -26
- package/dist/native/prepare.js.map +1 -1
- package/dist/native/prepare.test.js +25 -3
- package/dist/native/prepare.test.js.map +1 -1
- package/dist/native/sanitizer.js +10 -1
- package/dist/native/sanitizer.js.map +1 -1
- package/dist/native/sanitizer.test.js +7 -2
- package/dist/native/sanitizer.test.js.map +1 -1
- package/dist/node-islands/boundary.d.ts +12 -0
- package/dist/node-islands/boundary.js +38 -6
- package/dist/node-islands/boundary.js.map +1 -1
- package/dist/node-islands/boundary.test.d.ts +1 -0
- package/dist/node-islands/boundary.test.js +76 -0
- package/dist/node-islands/boundary.test.js.map +1 -0
- package/dist/node-islands/detect.d.ts +9 -0
- package/dist/node-islands/detect.js +110 -0
- package/dist/node-islands/detect.js.map +1 -1
- package/dist/node-islands/detect.test.js +24 -0
- package/dist/node-islands/detect.test.js.map +1 -1
- package/dist/node-islands/graph-islands.d.ts +40 -0
- package/dist/node-islands/graph-islands.js +128 -0
- package/dist/node-islands/graph-islands.js.map +1 -0
- package/dist/node-islands/growth.d.ts +57 -0
- package/dist/node-islands/growth.js +205 -0
- package/dist/node-islands/growth.js.map +1 -0
- package/dist/node-islands/report.d.ts +12 -0
- package/dist/node-islands/report.js +28 -0
- package/dist/node-islands/report.js.map +1 -1
- package/dist/node-islands/report.test.js +2 -0
- package/dist/node-islands/report.test.js.map +1 -1
- package/dist/node-islands/rules.js +5 -0
- package/dist/node-islands/rules.js.map +1 -1
- package/dist/node-islands/scan.d.ts +11 -2
- package/dist/node-islands/scan.js +61 -9
- package/dist/node-islands/scan.js.map +1 -1
- package/dist/wasm/translate.js +11 -5
- package/dist/wasm/translate.js.map +1 -1
- package/dist/wasm/translate.test.js +35 -0
- package/dist/wasm/translate.test.js.map +1 -1
- package/package.json +20 -20
- package/surface-manifest.json +184 -117
|
@@ -7,7 +7,7 @@ import { JsIcSites } from "../../ir/js-ic.js";
|
|
|
7
7
|
import {} from "./array-search.js";
|
|
8
8
|
import { emitStringInputs } from "./string-lifetimes.js";
|
|
9
9
|
import { emitThreadSlotsIntrinsic } from "./thread-slots.js";
|
|
10
|
-
import { CYC_BUF, CYC_HDR, FIRST_EMITTED_CYC_KIND, inlineAllocSupported, RECORD_SOURCES_GATE, WEAK_KEYS_GATE, } from "./alloc.js";
|
|
10
|
+
import { CYC_BUF, CYC_HDR, FIRST_EMITTED_CYC_KIND, inlineAllocSupported, RECORD_KEPT_GATE, RECORD_SOURCES_GATE, WEAK_KEYS_GATE, } from "./alloc.js";
|
|
11
11
|
import { youngNurseryRequested } from "../young-nursery.js";
|
|
12
12
|
import { llvmBytes as llBytes, wtf8Bytes } from "../literals.js";
|
|
13
13
|
import { InternalCompilerError } from "../../errors.js";
|
|
@@ -27,12 +27,14 @@ import { addRecordResultEntries, resultEntryName } from "./record-results.js";
|
|
|
27
27
|
import { specializeCallbackCalls } from "../../ir/callback-specialization.js";
|
|
28
28
|
import { EmitJournal, registerReplay, renameChunk, replayJournal, } from "./emit-journal.js";
|
|
29
29
|
import { specializeNumericCalls } from "../../ir/numeric-call-specialization.js";
|
|
30
|
+
import { specializeTypedArguments } from "../../ir/typed-argument-clones.js";
|
|
30
31
|
import { versionLoopBoundParameters } from "../../ir/parameter-versions.js";
|
|
31
32
|
import { inlineExpressionFunctions } from "../../ir/expression-inlining.js";
|
|
32
33
|
import { inlineArrayReads, NO_INLINE_ARRAYS, planInlineArrays, } from "../../ir/inline-arrays.js";
|
|
33
34
|
import { inlineArraysApply, programLifetimeClassOf } from "./inline-arrays.js";
|
|
34
35
|
import { pairRowSums } from "../../ir/row-pairs.js";
|
|
35
36
|
import { jamSaturatingLoops } from "../../ir/saturating-loop-jams.js";
|
|
37
|
+
import { jamRuntimeCountLoops } from "../../ir/runtime-jam-loops.js";
|
|
36
38
|
import { allocatedLiteral, fillAllocationLength, int32ArrayKey, selectInt32Arrays, } from "../../ir/int32-arrays.js";
|
|
37
39
|
import { everyExpr, everyExprChild, everyStmtChild, everyStmtList } from "../../ir/traverse.js";
|
|
38
40
|
import { INT32_RANGE, withinInt32, } from "../../ir/integer-ranges.js";
|
|
@@ -47,6 +49,7 @@ import { dropUnwrittenPropertyBags } from "../../ir/property-bags.js";
|
|
|
47
49
|
import { freezeInitOnlyGlobals } from "../../ir/init-only-globals.js";
|
|
48
50
|
import { hoistFinalFieldReads } from "../../ir/field-values.js";
|
|
49
51
|
import { holdCharLocalsAsUnits } from "../../ir/char-unit-locals.js";
|
|
52
|
+
import { versionUnionArmLoops } from "../../ir/union-arm-loops.js";
|
|
50
53
|
import { unitSafeFunctions } from "./string-unit-versions.js";
|
|
51
54
|
import { stringScanInline } from "./string-reads.js";
|
|
52
55
|
import { findInt32Abis, INT32_ABI_SUFFIX, SCALAR_UNION_DUMMY, SCALAR_UNION_RESULT, } from "./int32-abi.js";
|
|
@@ -73,6 +76,7 @@ import { borrowsCheckedNarrow, CheckedNarrows } from "./checked-narrows.js";
|
|
|
73
76
|
import { emitDenseArraySet, emitDenseSlotUnlink, SCR_ELEM_I32, } from "./dense-array-access.js";
|
|
74
77
|
import { matchMapRead, pointerMapGet } from "./map-read-lifetimes.js";
|
|
75
78
|
import {} from "./map-entry-fusion.js";
|
|
79
|
+
import {} from "./record-entry-fusion.js";
|
|
76
80
|
import { emitBorrowedFieldSequence, guardedValue } from "./borrowed-receivers.js";
|
|
77
81
|
import { emitBorrowedInputs } from "./borrowed-inputs.js";
|
|
78
82
|
import { findWalkBorrows } from "./walk-borrows.js";
|
|
@@ -114,11 +118,12 @@ import { emitNetworkHttpLibCall } from "./lib-network.js";
|
|
|
114
118
|
import { emitAssertInspectLibCall, emitIoLibCall, emitGenericLibCall, emitLibCall, } from "./lib-dispatch.js";
|
|
115
119
|
import { assignCompactLayouts, buildClassGraph, classFieldTypes, classMembershipIntervals, classFieldIndex, compactRefLoadLines, compactRefStoreLines, classPreLines, classStructSym, programLifetimeClass, } from "./classes.js";
|
|
116
120
|
import { LifetimeRegions, REGION_TYPES } from "./regions.js";
|
|
121
|
+
import { planTreeClasses } from "../tree-classes.js";
|
|
117
122
|
import { arenaAware, arenaCurrentAddress, arenaNewSym, arenasRequested, planArenas, } from "./arenas.js";
|
|
118
123
|
import { children } from "./region-ir.js";
|
|
119
124
|
import { LlDyn, recordDynKeepsIdentity } from "./dyn.js";
|
|
120
125
|
import { VirtualBorrows } from "./virtual-borrows.js";
|
|
121
|
-
import { planRecordViews, recordViewFieldPtr } from "./record-views.js";
|
|
126
|
+
import { absentTrapLines, planRecordViews, recordViewFieldPtr, recordViewTestLines, } from "./record-views.js";
|
|
122
127
|
import { LlvmUnsupportedError } from "./unsupported.js";
|
|
123
128
|
import { LlWalkers } from "./walkers.js";
|
|
124
129
|
import { isObjectArm, isPayloadTag, NULLABLE_ABSENT, NULLABLE_NULL, NullableUnions, pointerTagFn, } from "./nullable-unions.js";
|
|
@@ -171,16 +176,18 @@ export function lowRegionTarget(platform, sanitize) {
|
|
|
171
176
|
/** Function versions on loop-bounding number parameters
|
|
172
177
|
* (ir/parameter-versions.ts). Library builds have no int32 entries, and a
|
|
173
178
|
* module that observes call stacks could see the version's frame. */
|
|
174
|
-
function versionParameters(mod) {
|
|
175
|
-
if (mod.lib !== undefined || observesStacks(mod))
|
|
179
|
+
function versionParameters(mod, nodes) {
|
|
180
|
+
if (mod.lib !== undefined || observesStacks(mod, nodes))
|
|
176
181
|
return mod;
|
|
177
|
-
return versionLoopBoundParameters(mod, mangleFunction);
|
|
182
|
+
return versionLoopBoundParameters(mod, mangleFunction, nodes);
|
|
178
183
|
}
|
|
179
184
|
/** The int32 slot analysis of `mod`, with the inputs LlEmitter gives it.
|
|
180
185
|
* With `revise`, the analysis revises the functions of candidates that drop
|
|
181
|
-
* (Int32SlotInputs.revise), and `mod` is the module it started from.
|
|
182
|
-
|
|
183
|
-
|
|
186
|
+
* (Int32SlotInputs.revise), and `mod` is the module it started from. The
|
|
187
|
+
* node index of `mod` takes the nodes `previous` recorded for the functions
|
|
188
|
+
* both hold. */
|
|
189
|
+
function analyzeModuleInt32Slots(mod, previous, revise) {
|
|
190
|
+
const nodeIndex = new IrNodeIndex(mod, previous);
|
|
184
191
|
const initializerBindings = findInitializerBindings(mod, nodeIndex);
|
|
185
192
|
const dynamicStores = dynamicFieldStores(mod, undefined, undefined, nodeIndex);
|
|
186
193
|
const slots = analyzeInt32Slots(mod, {
|
|
@@ -200,7 +207,7 @@ function keptInt32Arrays(analysis) {
|
|
|
200
207
|
* node index of `mod`, and its initializer bindings and dynamic stores,
|
|
201
208
|
* which must be the ones the analysis read. Null when they differ. */
|
|
202
209
|
function revisedAnalysis(analysis, mod) {
|
|
203
|
-
const nodeIndex = new IrNodeIndex(mod);
|
|
210
|
+
const nodeIndex = new IrNodeIndex(mod, analysis.nodeIndex);
|
|
204
211
|
const initializerBindings = findInitializerBindings(mod, nodeIndex);
|
|
205
212
|
const dynamicStores = dynamicFieldStores(mod, undefined, undefined, nodeIndex);
|
|
206
213
|
const read = analysis.initializerBindings;
|
|
@@ -249,16 +256,19 @@ function moduleEmitter(input, options) {
|
|
|
249
256
|
// Each proof selectInt32Arrays asks for analyzes a marked module; the
|
|
250
257
|
// emitter of the module it returns reuses the last one. A proof that
|
|
251
258
|
// revised functions analyzed the module of the functions it ended with.
|
|
252
|
-
|
|
259
|
+
// Each round's node index takes the recorded nodes of the functions it
|
|
260
|
+
// shares with the latest index (`nodes`).
|
|
261
|
+
const rounds = { last: null, functions: null, revising: true, nodes: undefined };
|
|
253
262
|
const proven = (marked, revise) => {
|
|
254
263
|
rounds.functions = null;
|
|
255
264
|
if (revise === null || !rounds.revising) {
|
|
256
|
-
rounds.last = analyzeModuleInt32Slots(marked);
|
|
265
|
+
rounds.last = analyzeModuleInt32Slots(marked, rounds.nodes);
|
|
266
|
+
rounds.nodes = rounds.last.nodeIndex;
|
|
257
267
|
return { kept: keptInt32Arrays(rounds.last), functions: null };
|
|
258
268
|
}
|
|
259
269
|
const latest = new Map();
|
|
260
270
|
try {
|
|
261
|
-
rounds.last = analyzeModuleInt32Slots(marked, (fnName, dropped) => {
|
|
271
|
+
rounds.last = analyzeModuleInt32Slots(marked, rounds.nodes, (fnName, dropped) => {
|
|
262
272
|
const fn = revise(fnName, dropped);
|
|
263
273
|
latest.set(fnName, fn);
|
|
264
274
|
return fn;
|
|
@@ -270,6 +280,7 @@ function moduleEmitter(input, options) {
|
|
|
270
280
|
rounds.last = null;
|
|
271
281
|
return null;
|
|
272
282
|
}
|
|
283
|
+
rounds.nodes = rounds.last.nodeIndex;
|
|
273
284
|
if (latest.size === 0)
|
|
274
285
|
return { kept: keptInt32Arrays(rounds.last), functions: null };
|
|
275
286
|
rounds.functions = marked.functions.map((fn) => latest.get(fn.name) ?? fn);
|
|
@@ -279,7 +290,13 @@ function moduleEmitter(input, options) {
|
|
|
279
290
|
if (options.debugSources !== undefined)
|
|
280
291
|
return new LlEmitter(mod, options, null, null);
|
|
281
292
|
const timing = options.timing ?? (() => { });
|
|
282
|
-
|
|
293
|
+
// One index of the module the passes start from. Each pass skips the
|
|
294
|
+
// functions the index records without the node kinds it rewrites, and
|
|
295
|
+
// reads its scans of whole bodies from the index; it walks the functions
|
|
296
|
+
// an earlier pass rewrote, which the index does not record.
|
|
297
|
+
const nodes = new IrNodeIndex(mod);
|
|
298
|
+
rounds.nodes = nodes;
|
|
299
|
+
const passed = versionUnionArmLoops(versionParameters(addRecordResultEntries(scalarizeLiteralResults(scalarizeNumericRecords(specializeCallbackCalls(specializeNumericCalls(specializeTypedArguments(pairRowSums(jamRuntimeCountLoops(jamSaturatingLoops(inlineArraysPass(options, inlineExpressionFunctions(foldConstantGlobals(copyStableCaptures(resolveSelfCaptures(hoistFinalFieldReads(freezeInitOnlyGlobals(holdCharLocalsAsUnits(dropUnwrittenPropertyBags(runPairedWhileLoopsAsFor(mod, nodes), nodes), nodes), nodes), nodes), nodes), nodes), nodes), nodes)), nodes), nodes), nodes), mangleFunction, nodes), mangleFunction, nodes), mangleFunction, nodes)), nodes), nodes), nodes), nodes);
|
|
283
300
|
timing("llvm-emit-rewrites");
|
|
284
301
|
let emitted = selectInt32Arrays(passed, proven, resultEntryTargets);
|
|
285
302
|
let prepared = rounds.last;
|
|
@@ -303,7 +320,7 @@ function moduleEmitter(input, options) {
|
|
|
303
320
|
if (process.env["SCRIPTC_INT32_VERIFY"] === "1")
|
|
304
321
|
verifyInt32Selection(passed, emitted, prepared?.mod === emitted ? prepared : null);
|
|
305
322
|
timing("llvm-emit-int32");
|
|
306
|
-
const emitter = new LlEmitter(emitted, options, null, prepared?.mod === emitted ? prepared : null);
|
|
323
|
+
const emitter = new LlEmitter(emitted, options, null, prepared?.mod === emitted ? prepared : null, rounds.nodes);
|
|
307
324
|
timing("llvm-emit-analyses");
|
|
308
325
|
return emitter;
|
|
309
326
|
}
|
|
@@ -313,13 +330,13 @@ function moduleEmitter(input, options) {
|
|
|
313
330
|
function verifyInt32Selection(passed, emitted, analysis) {
|
|
314
331
|
let last = null;
|
|
315
332
|
const reference = selectInt32Arrays(passed, (marked) => {
|
|
316
|
-
last = analyzeModuleInt32Slots(marked);
|
|
333
|
+
last = analyzeModuleInt32Slots(marked, undefined);
|
|
317
334
|
return { kept: keptInt32Arrays(last), functions: null };
|
|
318
335
|
}, resultEntryTargets);
|
|
319
336
|
const text = (mod) => serializeModuleParts(mod).join("");
|
|
320
337
|
if (text(reference) !== text(emitted))
|
|
321
338
|
throw new InternalCompilerError("int32 selection: the revised module differs from the rounds'");
|
|
322
|
-
const facts = (mod, prepared) => (prepared?.mod === mod ? prepared : analyzeModuleInt32Slots(mod)).slots.summary(mod);
|
|
339
|
+
const facts = (mod, prepared) => (prepared?.mod === mod ? prepared : analyzeModuleInt32Slots(mod, undefined)).slots.summary(mod);
|
|
323
340
|
const expected = facts(reference, last);
|
|
324
341
|
const actual = facts(emitted, analysis);
|
|
325
342
|
if (expected !== actual) {
|
|
@@ -396,6 +413,25 @@ function isIdentifierByte(code) {
|
|
|
396
413
|
* to its next suspension, which returns to the caller, and the body's own
|
|
397
414
|
* bookkeeping calls do not suspend it. */
|
|
398
415
|
export const SUSPENDS = /@(?:scr_(?:await_|module_await\b|promise_await_settled\b|test_sub\b|gen_yield_|async_gen_(?!new\b|next_|return_|throw\b|hop_done\b)|fiber_)|sc_a[wd]_)/;
|
|
416
|
+
/** The literal text each SUSPENDS alternative starts with. The `@scr_` prefix
|
|
417
|
+
* is joined to each suffix here so that a prefix is not read as an emitted
|
|
418
|
+
* symbol name by the runtime ABI scan. */
|
|
419
|
+
const SUSPEND_PREFIXES = [
|
|
420
|
+
"await_",
|
|
421
|
+
"module_await",
|
|
422
|
+
"promise_await_settled",
|
|
423
|
+
"test_sub",
|
|
424
|
+
"gen_yield_",
|
|
425
|
+
"async_gen_",
|
|
426
|
+
"fiber_",
|
|
427
|
+
]
|
|
428
|
+
.map((suffix) => `@scr_${suffix}`)
|
|
429
|
+
.concat("@sc_aw_", "@sc_ad_");
|
|
430
|
+
/** Whether `text` mentions a SUSPENDS entry point. The regex runs only on
|
|
431
|
+
* text that holds one of its prefixes, which most function bodies do not. */
|
|
432
|
+
export function mentionsSuspension(text) {
|
|
433
|
+
return SUSPEND_PREFIXES.some((prefix) => text.includes(prefix)) && SUSPENDS.test(text);
|
|
434
|
+
}
|
|
399
435
|
/** The suspensions of a fiber body's own awaits, which its stackless
|
|
400
436
|
* coroutine form suspends itself at instead. */
|
|
401
437
|
const AWAIT_SUSPENSIONS = /@(?:scr_await_(?:void|f64|bool|str|ref|hop|dyn_value)\b|sc_a[wd]_[A-Za-z0-9_]+)/g;
|
|
@@ -504,6 +540,10 @@ export class LlEmitter {
|
|
|
504
540
|
mod;
|
|
505
541
|
/** Per-feature state (emitter-state.ts), indexed by each key's slot. */
|
|
506
542
|
moduleStates = [];
|
|
543
|
+
/** The names of the functions that `versionLoopBoundParameters` versions
|
|
544
|
+
* for int32 loop bounds: the ones that keep their name and call the copy
|
|
545
|
+
* and the fallback. Computed on first use. */
|
|
546
|
+
int32Versioned = null;
|
|
507
547
|
localArrayReads = new Map();
|
|
508
548
|
loopArrayBorrows = new Set();
|
|
509
549
|
scalarStringSlices = new Map();
|
|
@@ -527,7 +567,7 @@ export class LlEmitter {
|
|
|
527
567
|
fieldAliasTags = new Map();
|
|
528
568
|
fieldPointerTags = new Map();
|
|
529
569
|
/** The field pointers (classFieldPtr) of this function whose fields hold
|
|
530
|
-
* 32-bit references
|
|
570
|
+
* 32-bit references (LlClassMeta.compressed):
|
|
531
571
|
* loadField/loadRef decode them and storeField/storeRef encode them. */
|
|
532
572
|
compressedFieldPtrs = new Set();
|
|
533
573
|
/** Compact class instances live in the program-lifetime region below
|
|
@@ -535,6 +575,12 @@ export class LlEmitter {
|
|
|
535
575
|
* classes): main reserves it before compiled code runs (scr_plr_init), and
|
|
536
576
|
* fields and arrays of compactRefType hold 32-bit references. */
|
|
537
577
|
compactRegion = false;
|
|
578
|
+
/** A compact class has a field holding an array, a map, a set or a heap
|
|
579
|
+
* instance (windowRefType), so a reference to it is a 32-bit address of
|
|
580
|
+
* the allocator's window: main requires the window to serve every
|
|
581
|
+
* reference block (scr_sa_require_window), and ends the process when it
|
|
582
|
+
* cannot, rather than hand out an address a field would truncate. */
|
|
583
|
+
windowRefs = false;
|
|
538
584
|
/** Native class fields with different property names cannot occupy the
|
|
539
585
|
* same slot of one object. Inherited views of the same property share a
|
|
540
586
|
* tag. Array storage has its own disjoint categories; untagged runtime
|
|
@@ -839,6 +885,9 @@ export class LlEmitter {
|
|
|
839
885
|
sanitizeAttributes;
|
|
840
886
|
/** LlvmTargetOptions.cpuDispatch, where it applies. */
|
|
841
887
|
cpuDispatch;
|
|
888
|
+
/** How the program's functions are copied (cpu-dispatch.ts): for runtime
|
|
889
|
+
* dispatch, for an x86-64-v3 `targetCpu` ("target"), or not at all. */
|
|
890
|
+
cpuCopies;
|
|
842
891
|
wasmBoundsChecks;
|
|
843
892
|
/** Interned string literals: UTF-8 text → { symbol, byte length } —
|
|
844
893
|
* first-use order, the runtime ABI’s determinism discipline. */
|
|
@@ -944,6 +993,8 @@ export class LlEmitter {
|
|
|
944
993
|
numberMapKeyIntegers = new Map();
|
|
945
994
|
/** The current function's fused string-key Map get-then-set pairs (map-entry-fusion.ts). */
|
|
946
995
|
mapEntryFusion = null;
|
|
996
|
+
/** The current function's fused record get-then-set pairs (record-entry-fusion.ts). */
|
|
997
|
+
recordEntryFusion = null;
|
|
947
998
|
callLifetimes;
|
|
948
999
|
/** The locals whose value never leaves its frame (frame-escapes.ts), for
|
|
949
1000
|
* class instances with reference fields in frame storage. */
|
|
@@ -1105,6 +1156,11 @@ export class LlEmitter {
|
|
|
1105
1156
|
arraySearchKinds = new Set();
|
|
1106
1157
|
/** Typed-ref recipe constants by type key (lazy receivers). */
|
|
1107
1158
|
typedRefRecipes = new Map();
|
|
1159
|
+
/** The module links narrowed record copies to their sources
|
|
1160
|
+
* (IrModule.recordLinks). */
|
|
1161
|
+
hasRecordLinks() {
|
|
1162
|
+
return (this.mod.recordLinks?.length ?? 0) > 0;
|
|
1163
|
+
}
|
|
1108
1164
|
/** ReadableStream.from adapters keep typed arrays by reference and box
|
|
1109
1165
|
* one current element per pull. */
|
|
1110
1166
|
streamFromArrayAdapters = new Map();
|
|
@@ -1140,6 +1196,18 @@ export class LlEmitter {
|
|
|
1140
1196
|
* zero-initialized ScrJsIc per site (scr_js.h). */
|
|
1141
1197
|
jsIcSiteCount = 0;
|
|
1142
1198
|
jsIcSitesMemo;
|
|
1199
|
+
/** Guard-group records of dynamic-tier functions (js-groups.ts): one
|
|
1200
|
+
* zero-initialized ScrJsGroup per group, and the key arrays the probes
|
|
1201
|
+
* read (scr_js.h). */
|
|
1202
|
+
jsGroupCount = 0;
|
|
1203
|
+
jsGroupKeysCount = 0;
|
|
1204
|
+
jsGroupKeysByName = new Map();
|
|
1205
|
+
jsGroupKeysByText = new Map();
|
|
1206
|
+
/** The guard of each group the function being emitted has entered: the
|
|
1207
|
+
* entry value, and the position of the member that comes next. */
|
|
1208
|
+
groupRuns = new Map();
|
|
1209
|
+
/** The guard groups of the function being emitted (ir/js-groups.ts). */
|
|
1210
|
+
jsGroupPlan = null;
|
|
1143
1211
|
/** The tier of the function being emitted. */
|
|
1144
1212
|
currentTier = undefined;
|
|
1145
1213
|
/** The class graph (buildClassGraph): preorder numbering, hierarchy
|
|
@@ -1413,7 +1481,7 @@ export class LlEmitter {
|
|
|
1413
1481
|
journaled;
|
|
1414
1482
|
/** Stack-trace mode: functions no capture can include (no frame push). */
|
|
1415
1483
|
unframedFunctions;
|
|
1416
|
-
constructor(mod, options, journal = null, int32Analysis = null) {
|
|
1484
|
+
constructor(mod, options, journal = null, int32Analysis = null, previousIndex) {
|
|
1417
1485
|
this.mod = mod;
|
|
1418
1486
|
this.targetOptions = options;
|
|
1419
1487
|
this.journal = journal;
|
|
@@ -1421,8 +1489,9 @@ export class LlEmitter {
|
|
|
1421
1489
|
journal !== null ||
|
|
1422
1490
|
((options.functionWorkers ?? 1) > 1 && options.forkPrimitives !== undefined);
|
|
1423
1491
|
// One walk of every body, which the analyses below read instead of
|
|
1424
|
-
// walking the bodies themselves.
|
|
1425
|
-
|
|
1492
|
+
// walking the bodies themselves. The functions `previousIndex` (an index
|
|
1493
|
+
// of an earlier module) recorded are not walked again.
|
|
1494
|
+
this.nodeIndex = int32Analysis?.nodeIndex ?? new IrNodeIndex(mod, previousIndex);
|
|
1426
1495
|
this.initializerBindings =
|
|
1427
1496
|
int32Analysis?.initializerBindings ?? findInitializerBindings(mod, this.nodeIndex);
|
|
1428
1497
|
// One walk finds the dynamic field stores every analysis below consults.
|
|
@@ -1490,13 +1559,16 @@ export class LlEmitter {
|
|
|
1490
1559
|
this.nodeIslandModuleData = options.nodeIslandModuleData ?? null;
|
|
1491
1560
|
this.targetCpu = options.targetCpu;
|
|
1492
1561
|
this.sanitizeAttributes = options.sanitizeAttributes !== false;
|
|
1493
|
-
this.
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1562
|
+
const copyable = !this.wasi &&
|
|
1563
|
+
mod.lib === undefined &&
|
|
1564
|
+
this.debug === null &&
|
|
1565
|
+
/^(x86_64|amd64|x64)\b/.test(options.targetTriple || process.arch);
|
|
1566
|
+
this.cpuDispatch = options.cpuDispatch === true && options.targetCpu === undefined && copyable;
|
|
1567
|
+
this.cpuCopies = this.cpuDispatch
|
|
1568
|
+
? "dispatch"
|
|
1569
|
+
: options.targetCpu === "x86-64-v3" && copyable
|
|
1570
|
+
? "target"
|
|
1571
|
+
: null;
|
|
1500
1572
|
this.wasmBoundsChecks =
|
|
1501
1573
|
options.wasmBoundsChecks === true ||
|
|
1502
1574
|
wasmBoundsChecks({
|
|
@@ -1687,6 +1759,9 @@ export class LlEmitter {
|
|
|
1687
1759
|
// The same holds for a class union's arms (class-unions.ts).
|
|
1688
1760
|
classUnionHeaders(mod, this.nullableUnions.allClassUnions(), this.tracedShapes, this.tracedUnions);
|
|
1689
1761
|
this.shapeHost = {
|
|
1762
|
+
...((mod.recordLinks?.length ?? 0) > 0
|
|
1763
|
+
? { recordSourcesGate: RECORD_KEPT_GATE, recordLinks: mod.recordLinks }
|
|
1764
|
+
: {}),
|
|
1690
1765
|
// Journal hooks only on emitters that can emit ranges (chunk
|
|
1691
1766
|
// emitters, and emitters whose workers take a journal after the
|
|
1692
1767
|
// fork), so the host's optional calls cost nothing otherwise.
|
|
@@ -1723,6 +1798,8 @@ export class LlEmitter {
|
|
|
1723
1798
|
// Worker programs keep one allocator per script thread: the inline
|
|
1724
1799
|
// paths address its thread-local state.
|
|
1725
1800
|
threadLocalAlloc: mod.workers === true,
|
|
1801
|
+
// Linux executables find a block's owner in the chunk map.
|
|
1802
|
+
windowMap: options.lowRegion === true,
|
|
1726
1803
|
rcHelpers: this.rcHelpers,
|
|
1727
1804
|
...(this.rcMode !== undefined ? { rcMode: this.rcMode } : {}),
|
|
1728
1805
|
...(this.rcHelpersNoinline ? { rcHelpersNoinline: true } : {}),
|
|
@@ -1886,12 +1963,14 @@ export class LlEmitter {
|
|
|
1886
1963
|
// except where regions count them or a slot word follows the header.
|
|
1887
1964
|
if (this.sizeType === "i64" && mod.lifetimeRegions !== true)
|
|
1888
1965
|
assignCompactLayouts(this.classMeta, (root) => programLifetimeClass(this.shapeHost, root) && !root.threadSlot, (cls) => classFieldTypes(this.shapeHost, cls, this.int32Slots),
|
|
1889
|
-
// Executables whose
|
|
1890
|
-
// instances there (scr_plr_alloc),
|
|
1891
|
-
//
|
|
1892
|
-
//
|
|
1893
|
-
//
|
|
1894
|
-
//
|
|
1966
|
+
// Executables whose window lies below 32 GiB hold compact class
|
|
1967
|
+
// instances there (scr_plr_alloc), and arrays, maps, sets and other
|
|
1968
|
+
// class instances too, so fields referring to one store a 32-bit
|
|
1969
|
+
// reference: the field's type, the class of a `C | undefined` or
|
|
1970
|
+
// `C | null` pointer, or the reference arm of a nullable pointer
|
|
1971
|
+
// field, is a compact class, or windowRefType holds. `C | null |
|
|
1972
|
+
// undefined` keeps the pointer: its null is a sentinel outside the
|
|
1973
|
+
// region.
|
|
1895
1974
|
mod.lib === undefined && options.lowRegion === true
|
|
1896
1975
|
? (cls, i, isCompact) => {
|
|
1897
1976
|
const f = cls.fields[i];
|
|
@@ -1899,6 +1978,10 @@ export class LlEmitter {
|
|
|
1899
1978
|
return false;
|
|
1900
1979
|
if (this.compactRefType(f.type, isCompact))
|
|
1901
1980
|
return true;
|
|
1981
|
+
if (this.windowRefType(f.type, isCompact)) {
|
|
1982
|
+
this.windowRefs = true;
|
|
1983
|
+
return true;
|
|
1984
|
+
}
|
|
1902
1985
|
const nullable = f.type.kind === "union" && this.nullableUnions.single(f.type.unionId) === null
|
|
1903
1986
|
? this.nullableFields.get(cls.name, f.name)
|
|
1904
1987
|
: null;
|
|
@@ -1909,8 +1992,53 @@ export class LlEmitter {
|
|
|
1909
1992
|
mod.lib === undefined &&
|
|
1910
1993
|
options.lowRegion === true &&
|
|
1911
1994
|
[...this.classMeta.values()].some((m) => m.compact);
|
|
1995
|
+
for (const [name, rec] of RUNTIME_ERROR_CLASSES) {
|
|
1996
|
+
const meta = this.classMeta.get(name);
|
|
1997
|
+
if (!meta)
|
|
1998
|
+
break; // hand-written IR without the builtin defs: no stamps
|
|
1999
|
+
this.errorIntervals.push({ kind: rec.kind, pre: meta.pre, post: meta.post, lib: rec.lib });
|
|
2000
|
+
}
|
|
2001
|
+
const emMeta = this.classMeta.get(RUNTIME_EMITTER_CLASS);
|
|
2002
|
+
if (emMeta)
|
|
2003
|
+
this.emitterInterval = { pre: emMeta.pre, post: emMeta.post };
|
|
2004
|
+
for (const [name, rec] of RUNTIME_STREAM_CLASSES) {
|
|
2005
|
+
const meta = this.classMeta.get(name);
|
|
2006
|
+
if (!meta)
|
|
2007
|
+
continue;
|
|
2008
|
+
this.streamIntervals.push({
|
|
2009
|
+
vt: `scr_${rec.lib.toLowerCase()}_vt`,
|
|
2010
|
+
pre: meta.pre,
|
|
2011
|
+
post: meta.post,
|
|
2012
|
+
lib: rec.lib,
|
|
2013
|
+
});
|
|
2014
|
+
}
|
|
2015
|
+
this.virtualBorrows = new VirtualBorrows(mod, this.classMeta, this.fnByName, this.callLifetimes.borrowed);
|
|
2016
|
+
// After the vtable slots: borrowing slots exclude their implementations.
|
|
2017
|
+
if (this.debug === null)
|
|
2018
|
+
this.analyzeBorrowedReturns();
|
|
2019
|
+
// Which classes drop their count word: a node of a graph the program
|
|
2020
|
+
// proves acyclic, singly owned and unobserved (backend/tree-classes.ts,
|
|
2021
|
+
// out/unique-ownership/DESIGN.md). The linear-use analysis agrees with
|
|
2022
|
+
// the emitter's own ownership discipline, so it reads the facts above
|
|
2023
|
+
// and nothing else. A debug build skips the borrowed-return analysis
|
|
2024
|
+
// this needs; it keeps every class counted.
|
|
2025
|
+
if (this.debug === null && mod.lib === undefined && mod.lifetimeRegions !== true) {
|
|
2026
|
+
const plan = planTreeClasses(mod, {
|
|
2027
|
+
borrowed: this.callLifetimes.borrowed,
|
|
2028
|
+
borrowedReturns: this.borrowedReturns,
|
|
2029
|
+
traced: { shapes: this.tracedShapes, unions: this.tracedUnions },
|
|
2030
|
+
immutable: this.immutableFields,
|
|
2031
|
+
published: this.publishedTypes,
|
|
2032
|
+
});
|
|
2033
|
+
for (const name of plan.classes)
|
|
2034
|
+
this.classMeta.get(name).tree = true;
|
|
2035
|
+
this.treeMoves = plan.classes.size > 0 ? new Set(plan.moves) : null;
|
|
2036
|
+
}
|
|
1912
2037
|
// Group arenas: off with lifetime regions, which own their classes'
|
|
1913
2038
|
// allocation, and in libraries, whose exports any host code calls.
|
|
2039
|
+
// Planned after the tree classes, which keep the general allocator:
|
|
2040
|
+
// their teardown is a plain free, and an arena block's disposal runs
|
|
2041
|
+
// the counted path.
|
|
1914
2042
|
if (arenasRequested() && mod.lifetimeRegions !== true && mod.lib === undefined) {
|
|
1915
2043
|
this.arenas = planArenas(mod, {
|
|
1916
2044
|
shape: (id) => {
|
|
@@ -1924,6 +2052,7 @@ export class LlEmitter {
|
|
|
1924
2052
|
const meta = this.classMeta.get(def.name);
|
|
1925
2053
|
return (meta !== undefined &&
|
|
1926
2054
|
!meta.compact &&
|
|
2055
|
+
!meta.tree &&
|
|
1927
2056
|
!meta.threadSlot &&
|
|
1928
2057
|
// An Array subclass's instance is an array (the runtime's header).
|
|
1929
2058
|
def.arrayElem === undefined &&
|
|
@@ -1933,6 +2062,7 @@ export class LlEmitter {
|
|
|
1933
2062
|
},
|
|
1934
2063
|
nullableArm: (unionId) => this.nullableUnions.single(unionId)?.arm ?? null,
|
|
1935
2064
|
traced: (t) => traceAdapter(this.shapeHost, t) !== null,
|
|
2065
|
+
tree: (def) => this.classMeta.get(def.name)?.tree === true,
|
|
1936
2066
|
});
|
|
1937
2067
|
if (this.arenas !== null) {
|
|
1938
2068
|
this.shapeHost.arenaShapes = this.arenas.shapes;
|
|
@@ -1948,30 +2078,6 @@ export class LlEmitter {
|
|
|
1948
2078
|
if (arenaShapes !== undefined && viewTargets !== null)
|
|
1949
2079
|
for (const id of arenaShapes)
|
|
1950
2080
|
viewTargets.delete(id);
|
|
1951
|
-
for (const [name, rec] of RUNTIME_ERROR_CLASSES) {
|
|
1952
|
-
const meta = this.classMeta.get(name);
|
|
1953
|
-
if (!meta)
|
|
1954
|
-
break; // hand-written IR without the builtin defs: no stamps
|
|
1955
|
-
this.errorIntervals.push({ kind: rec.kind, pre: meta.pre, post: meta.post, lib: rec.lib });
|
|
1956
|
-
}
|
|
1957
|
-
const emMeta = this.classMeta.get(RUNTIME_EMITTER_CLASS);
|
|
1958
|
-
if (emMeta)
|
|
1959
|
-
this.emitterInterval = { pre: emMeta.pre, post: emMeta.post };
|
|
1960
|
-
for (const [name, rec] of RUNTIME_STREAM_CLASSES) {
|
|
1961
|
-
const meta = this.classMeta.get(name);
|
|
1962
|
-
if (!meta)
|
|
1963
|
-
continue;
|
|
1964
|
-
this.streamIntervals.push({
|
|
1965
|
-
vt: `scr_${rec.lib.toLowerCase()}_vt`,
|
|
1966
|
-
pre: meta.pre,
|
|
1967
|
-
post: meta.post,
|
|
1968
|
-
lib: rec.lib,
|
|
1969
|
-
});
|
|
1970
|
-
}
|
|
1971
|
-
this.virtualBorrows = new VirtualBorrows(mod, this.classMeta, this.fnByName, this.callLifetimes.borrowed);
|
|
1972
|
-
// After the vtable slots: borrowing slots exclude their implementations.
|
|
1973
|
-
if (this.debug === null)
|
|
1974
|
-
this.analyzeBorrowedReturns();
|
|
1975
2081
|
this.int32SlotsValue ??= this.joinInt32Slots();
|
|
1976
2082
|
}
|
|
1977
2083
|
/** Computes the int32 slot analysis, or starts it on a forked process.
|
|
@@ -2056,7 +2162,7 @@ export class LlEmitter {
|
|
|
2056
2162
|
emitParts() {
|
|
2057
2163
|
const parts = emitParts(this);
|
|
2058
2164
|
const bridged = this.unwindAbi.size > 0 ? bridgePlainUnwindCalls(parts) : parts;
|
|
2059
|
-
const out = this.
|
|
2165
|
+
const out = this.cpuCopies === null ? bridged : cloneForCpuDispatch(bridged, this.cpuCopies);
|
|
2060
2166
|
return this.heapCensus === null ? out : [...out, this.heapCensus.definitions().join("\n")];
|
|
2061
2167
|
}
|
|
2062
2168
|
/** The entry point and JavaScript name of each named function the
|
|
@@ -2065,10 +2171,18 @@ export class LlEmitter {
|
|
|
2065
2171
|
* displayName, else its sourceName. Function boxes without a static name
|
|
2066
2172
|
* look the closure's entry up in this table. */
|
|
2067
2173
|
closureNameEntries;
|
|
2174
|
+
closureNameByEntry;
|
|
2175
|
+
/** The declared functions `closureNames` lists by their wrapper. A scan
|
|
2176
|
+
* sees closures in statements the emitter never reaches (a statement
|
|
2177
|
+
* after a runtimeFence: the fence always jumps), so some of these names
|
|
2178
|
+
* never enter `fnValues`; emitFnValueDefs defines their wrapper anyway,
|
|
2179
|
+
* because the table's entry has to resolve. */
|
|
2180
|
+
closureWrapperNames = new Set();
|
|
2068
2181
|
closureNames() {
|
|
2069
2182
|
if (this.closureNameEntries !== undefined)
|
|
2070
2183
|
return this.closureNameEntries;
|
|
2071
2184
|
const entries = new Map();
|
|
2185
|
+
this.closureNameByEntry = entries;
|
|
2072
2186
|
const scan = this.nodeIndex.scan(CLOSURE_KINDS);
|
|
2073
2187
|
for (const fn of this.mod.functions) {
|
|
2074
2188
|
eachNodeOfKinds(fn, scan, (node) => {
|
|
@@ -2079,7 +2193,9 @@ export class LlEmitter {
|
|
|
2079
2193
|
(target?.sourceName !== "<anonymous>" ? target?.sourceName : undefined);
|
|
2080
2194
|
if (target === undefined || name === undefined || name === "")
|
|
2081
2195
|
return true;
|
|
2082
|
-
const entry =
|
|
2196
|
+
const entry = this.closureEntry(node.fnName, target);
|
|
2197
|
+
if (target.captures === undefined)
|
|
2198
|
+
this.closureWrapperNames.add(node.fnName);
|
|
2083
2199
|
if (!entries.has(entry))
|
|
2084
2200
|
entries.set(entry, name);
|
|
2085
2201
|
return true;
|
|
@@ -2087,6 +2203,21 @@ export class LlEmitter {
|
|
|
2087
2203
|
}
|
|
2088
2204
|
return (this.closureNameEntries = [...entries].map(([entry, name]) => ({ entry, name })));
|
|
2089
2205
|
}
|
|
2206
|
+
/** The entry point of a closure of `fnName` (closureNames). */
|
|
2207
|
+
closureEntry(fnName, target) {
|
|
2208
|
+
return target.captures === undefined ? mangleWrapper(fnName) : this.callTarget(fnName);
|
|
2209
|
+
}
|
|
2210
|
+
/** The name the closure-name table gives a closure made of `fnName`
|
|
2211
|
+
* (null when it has none), which lets a box of a closure made at the site
|
|
2212
|
+
* skip the table lookup; undefined for a function the module does not
|
|
2213
|
+
* define. */
|
|
2214
|
+
closureNameOf(fnName) {
|
|
2215
|
+
const target = this.fnByName.get(fnName);
|
|
2216
|
+
if (target === undefined)
|
|
2217
|
+
return undefined;
|
|
2218
|
+
this.closureNames();
|
|
2219
|
+
return this.closureNameByEntry.get(this.closureEntry(fnName, target)) ?? null;
|
|
2220
|
+
}
|
|
2090
2221
|
/** The dispose-observer gates the emitted frees and record writers test
|
|
2091
2222
|
* (alloc.ts): defined after every helper is emitted, because dynCheck
|
|
2092
2223
|
* builders, JSON schemas and weak collection constructors are requested
|
|
@@ -2095,7 +2226,10 @@ export class LlEmitter {
|
|
|
2095
2226
|
const weak = [...this.decls].some((d) => d.includes("@scr_weak_map_new(") || d.includes("@scr_weak_set_new("));
|
|
2096
2227
|
return [
|
|
2097
2228
|
`${WEAK_KEYS_GATE} = internal constant i1 ${weak}`,
|
|
2098
|
-
`${RECORD_SOURCES_GATE} = internal constant i1 ${this.dyn.keepsRecordSources}`,
|
|
2229
|
+
`${RECORD_SOURCES_GATE} = internal constant i1 ${this.dyn.keepsRecordSources || this.hasRecordLinks()}`,
|
|
2230
|
+
...(this.hasRecordLinks()
|
|
2231
|
+
? [`${RECORD_KEPT_GATE} = internal constant i1 ${this.dyn.keepsRecordSources}`]
|
|
2232
|
+
: []),
|
|
2099
2233
|
``,
|
|
2100
2234
|
];
|
|
2101
2235
|
}
|
|
@@ -2131,10 +2265,15 @@ export class LlEmitter {
|
|
|
2131
2265
|
}
|
|
2132
2266
|
/** Env-signature wrappers + interned immortal closures for declared
|
|
2133
2267
|
* functions used as values (the runtime ABI’s sc_w_/sc_fc_ pair): every
|
|
2134
|
-
* mention of `f` yields the same pointer, so `f === f` holds.
|
|
2268
|
+
* mention of `f` yields the same pointer, so `f === f` holds. The
|
|
2269
|
+
* closure-name table's wrapper entries are included even when their
|
|
2270
|
+
* closure was never emitted (see closureWrapperNames). */
|
|
2135
2271
|
emitFnValueDefs() {
|
|
2136
2272
|
const out = [];
|
|
2137
|
-
|
|
2273
|
+
const names = new Set(this.fnValues);
|
|
2274
|
+
for (const name of this.closureWrapperNames)
|
|
2275
|
+
names.add(name);
|
|
2276
|
+
for (const name of names) {
|
|
2138
2277
|
const fn = this.fnByName.get(name);
|
|
2139
2278
|
const params = fn.params.map((p, i) => `${this.llType(p.type)} %a${i}`);
|
|
2140
2279
|
const args = fn.params.map((p, i) => `${this.llType(p.type)} %a${i}`).join(", ");
|
|
@@ -3010,11 +3149,27 @@ export class LlEmitter {
|
|
|
3010
3149
|
toFrame(v) {
|
|
3011
3150
|
this.disownTemp(v);
|
|
3012
3151
|
}
|
|
3152
|
+
/** Whether a value of `type` is an instance of a tree class, whose retain
|
|
3153
|
+
* is a no-op and whose release destroys the subtree: it has exactly one
|
|
3154
|
+
* owner, so it may only be moved. */
|
|
3155
|
+
isTreeValue(type) {
|
|
3156
|
+
if (this.treeMoves === null)
|
|
3157
|
+
return false;
|
|
3158
|
+
const nullable = this.shapeHost.nullableUnions.of(type);
|
|
3159
|
+
const arm = nullable === null ? type : nullable.repr === "single" ? nullable.arm : null;
|
|
3160
|
+
return (arm !== null && arm.kind === "object" && this.classMeta.get(arm.className)?.tree === true);
|
|
3161
|
+
}
|
|
3013
3162
|
/** The retained (+1) read of a refcounted value — type-directed through
|
|
3014
3163
|
* the `_v` table (immortals skip, exactly the C retain calls). */
|
|
3015
3164
|
retainCall(name, type) {
|
|
3016
3165
|
if (this.isImmortal(name))
|
|
3017
3166
|
return name;
|
|
3167
|
+
// A copy of a tree value would be a second owner, and the two would
|
|
3168
|
+
// destroy the same nodes. Every accepted read of one is a move
|
|
3169
|
+
// (takeLastUseMove), so a retain means the plan and the emitter
|
|
3170
|
+
// disagree: fail here rather than corrupt the heap.
|
|
3171
|
+
if (this.isTreeValue(type))
|
|
3172
|
+
throw new InternalCompilerError(`llvm emitter bug: tree value ${name} is copied instead of moved`);
|
|
3018
3173
|
const t = this.B.tmp();
|
|
3019
3174
|
this.B.line(`${t} = call ptr ${retainSym(this.shapeHost, type)}(ptr ${name})`);
|
|
3020
3175
|
return t;
|
|
@@ -4070,6 +4225,29 @@ export class LlEmitter {
|
|
|
4070
4225
|
single.arm.kind === "object" &&
|
|
4071
4226
|
isCompact(single.arm.className));
|
|
4072
4227
|
}
|
|
4228
|
+
/** Whether values of `t` are NULL or a refcounted object that lies in the
|
|
4229
|
+
* allocator's window below 32 GiB, so that a compact class field of type
|
|
4230
|
+
* `t` can store it as a 32-bit reference: an array, map or set, or an
|
|
4231
|
+
* instance of a class that is not compact and that the program allocates
|
|
4232
|
+
* (not the runtime's Error hierarchy, whose instances the runtime
|
|
4233
|
+
* allocates), or one of these or `undefined`/`null` (NULL). Strings keep
|
|
4234
|
+
* 8-byte pointers: literals lie in the executable's image. */
|
|
4235
|
+
windowRefType(t, isCompact) {
|
|
4236
|
+
const target = (u) => {
|
|
4237
|
+
if (u.kind === "array" || u.kind === "map" || u.kind === "set")
|
|
4238
|
+
return true;
|
|
4239
|
+
if (u.kind !== "object" || isCompact(u.className))
|
|
4240
|
+
return false;
|
|
4241
|
+
const meta = this.classMeta.get(u.className);
|
|
4242
|
+
return meta !== undefined && meta.root.def.runtime !== true;
|
|
4243
|
+
};
|
|
4244
|
+
if (target(t))
|
|
4245
|
+
return true;
|
|
4246
|
+
if (t.kind !== "union")
|
|
4247
|
+
return false;
|
|
4248
|
+
const single = this.nullableUnions.single(t.unionId);
|
|
4249
|
+
return single !== null && single.nullTag < 0 && target(single.arm);
|
|
4250
|
+
}
|
|
4073
4251
|
/** Whether arrays of `elem` hold 32-bit references (SCR_ELEM_CREF). */
|
|
4074
4252
|
compactArrayElem(elem) {
|
|
4075
4253
|
return this.compactRegion && this.compactRefType(elem);
|
|
@@ -4240,6 +4418,155 @@ export class LlEmitter {
|
|
|
4240
4418
|
const type = shape.fields[idx].type;
|
|
4241
4419
|
return { ptr: p, type, inline: this.inlineUnions.record(type) };
|
|
4242
4420
|
}
|
|
4421
|
+
/** Whether a value of `shapeId` may lack field `field`: a PARTIAL record
|
|
4422
|
+
* view (record-views.ts) whose viewed record does not declare it. A field
|
|
4423
|
+
* with no value representation (a unit type) keeps its slot lookup. */
|
|
4424
|
+
partialFieldMissing(shapeId, field) {
|
|
4425
|
+
if (this.shapeHost.recordViews?.partialMissing(shapeId, field) !== true)
|
|
4426
|
+
return false;
|
|
4427
|
+
const type = this.recordShape(shapeId).fields.find((f) => f.name === field)?.type;
|
|
4428
|
+
return type !== undefined && !isUnitType(type);
|
|
4429
|
+
}
|
|
4430
|
+
/** The viewed record's slot for `field` of a partial view, or NULL when
|
|
4431
|
+
* that record does not declare the field. The caller has established that
|
|
4432
|
+
* `obj` is a view. */
|
|
4433
|
+
partialViewSlot(objName, shapeId, field) {
|
|
4434
|
+
const position = this.recordShape(shapeId).fields.findIndex((f) => f.name === field);
|
|
4435
|
+
this.declare(`declare ptr @scr_record_view_slot(ptr, ${this.sizeType})`);
|
|
4436
|
+
const slot = this.B.tmp();
|
|
4437
|
+
this.B.line(`${slot} = call ptr @scr_record_view_slot(ptr ${objName}, ${this.sizeType} ${position})`);
|
|
4438
|
+
return slot;
|
|
4439
|
+
}
|
|
4440
|
+
/** The boxed property a partial view keeps for a field its viewed record
|
|
4441
|
+
* does not declare (NULL until something writes it). */
|
|
4442
|
+
partialViewExtra(objName, field) {
|
|
4443
|
+
this.declare(`declare ptr @scr_record_view_extra(ptr, ptr, ${this.sizeType})`);
|
|
4444
|
+
const extra = this.B.tmp();
|
|
4445
|
+
this.B.line(`${extra} = call ptr @scr_record_view_extra(ptr ${objName}, ptr ${this.cstr(field)}, ${this.sizeType} ${Buffer.byteLength(field, "utf8")})`);
|
|
4446
|
+
return extra;
|
|
4447
|
+
}
|
|
4448
|
+
/** Reads field `field` of `obj` (shape `shapeId`) where a PARTIAL view may
|
|
4449
|
+
* lack it. A view's present field reads through the viewed record's slot;
|
|
4450
|
+
* a field that record does not declare reads the property a write left in
|
|
4451
|
+
* the view's extra store, converted back to the field type; a field
|
|
4452
|
+
* nothing wrote stops the program (the frontend's checked read throws its
|
|
4453
|
+
* TypeError first). The answer is owned, like a checked conversion's. */
|
|
4454
|
+
readPartialField(objName, shapeId, field, type) {
|
|
4455
|
+
const B = this.B;
|
|
4456
|
+
const idx = this.recordShape(shapeId).fields.findIndex((f) => f.name === field);
|
|
4457
|
+
const inline = this.inlineUnions.record(type);
|
|
4458
|
+
const isView = B.tmp();
|
|
4459
|
+
const view = B.newLabel("pf.view");
|
|
4460
|
+
const notView = B.newLabel("pf.slot");
|
|
4461
|
+
const slots = B.newLabel("pf.slots");
|
|
4462
|
+
const extra = B.newLabel("pf.extra");
|
|
4463
|
+
const answer = B.newLabel("pf.answer");
|
|
4464
|
+
for (const line of recordViewTestLines(this.sizeType, objName, isView))
|
|
4465
|
+
B.line(line.trimStart());
|
|
4466
|
+
B.condBr(isView, view, notView);
|
|
4467
|
+
// Not a view: the field's own slot.
|
|
4468
|
+
B.startBlock(notView);
|
|
4469
|
+
const own = B.tmp();
|
|
4470
|
+
B.line(`${own} = getelementptr inbounds %${mangleRecordStruct(shapeId)}, ptr ${objName}, i64 0, i32 ${idx + this.nullableUnions.fieldBase(shapeId)}`);
|
|
4471
|
+
const ownFrom = B.currentLabel();
|
|
4472
|
+
B.br(slots);
|
|
4473
|
+
B.startBlock(view);
|
|
4474
|
+
const slot = this.partialViewSlot(objName, shapeId, field);
|
|
4475
|
+
const present = B.tmp();
|
|
4476
|
+
B.line(`${present} = icmp ne ptr ${slot}, null`);
|
|
4477
|
+
const slotFrom = B.currentLabel();
|
|
4478
|
+
B.condBr(present, slots, extra);
|
|
4479
|
+
B.startBlock(slots);
|
|
4480
|
+
const addr = B.tmp();
|
|
4481
|
+
B.line(`${addr} = phi ptr [ ${own}, %${ownFrom} ], [ ${slot}, %${slotFrom} ]`);
|
|
4482
|
+
// An inline union field answers a private stack box, as a plain read does.
|
|
4483
|
+
const loaded = inline
|
|
4484
|
+
? this.inlineFieldUnion(addr, type)
|
|
4485
|
+
: this.loadRecordField(addr, type, false);
|
|
4486
|
+
const hit = isRefCounted(type) ? this.retainFrame(loaded, type) : loaded;
|
|
4487
|
+
const hitFrom = B.currentLabel();
|
|
4488
|
+
B.br(answer);
|
|
4489
|
+
B.startBlock(extra);
|
|
4490
|
+
const stored = this.partialViewExtra(objName, field);
|
|
4491
|
+
const absent = B.tmp();
|
|
4492
|
+
B.line(`${absent} = icmp eq ptr ${stored}, null`);
|
|
4493
|
+
const trap = B.newLabel("pf.absent");
|
|
4494
|
+
const convert = B.newLabel("pf.convert");
|
|
4495
|
+
B.condBr(absent, trap, convert);
|
|
4496
|
+
B.startBlock(trap);
|
|
4497
|
+
absentTrapLines(B, (text) => this.cstr(text), (decl) => this.declare(decl));
|
|
4498
|
+
B.startBlock(convert);
|
|
4499
|
+
const path = B.slot();
|
|
4500
|
+
B.entryAllocas.push(`${path} = alloca %ScrDynPath`);
|
|
4501
|
+
const parentPtr = B.tmp();
|
|
4502
|
+
const keyPtr = B.tmp();
|
|
4503
|
+
const indexPtr = B.tmp();
|
|
4504
|
+
B.line(`${parentPtr} = getelementptr inbounds %ScrDynPath, ptr ${path}, i64 0, i32 0`);
|
|
4505
|
+
B.line(`store ptr null, ptr ${parentPtr}`);
|
|
4506
|
+
B.line(`${keyPtr} = getelementptr inbounds %ScrDynPath, ptr ${path}, i64 0, i32 1`);
|
|
4507
|
+
B.line(`store ptr ${this.cstr(field)}, ptr ${keyPtr}`);
|
|
4508
|
+
B.line(`${indexPtr} = getelementptr inbounds %ScrDynPath, ptr ${path}, i64 0, i32 2`);
|
|
4509
|
+
B.line(`store ${this.sizeType} 0, ptr ${indexPtr}`);
|
|
4510
|
+
const helper = this.dyn.dynCheckHelper(type);
|
|
4511
|
+
const ty = this.llType(type);
|
|
4512
|
+
const checked = B.tmp();
|
|
4513
|
+
B.line(`${checked} = call ${ty === "i1" ? "zeroext i1" : ty} @${helper}(ptr ${stored}, ptr ${path})`);
|
|
4514
|
+
const convertFrom = B.currentLabel();
|
|
4515
|
+
B.br(answer);
|
|
4516
|
+
B.startBlock(answer);
|
|
4517
|
+
const value = B.tmp();
|
|
4518
|
+
B.line(`${value} = phi ${ty} [ ${hit}, %${hitFrom} ], [ ${checked}, %${convertFrom} ]`);
|
|
4519
|
+
return { name: value, type };
|
|
4520
|
+
}
|
|
4521
|
+
/** Stores `value` into field `field` of `obj` (shape `shapeId`) where a
|
|
4522
|
+
* PARTIAL view may lack it, calling `storeAt` with the address to write.
|
|
4523
|
+
* A field the viewed record does not declare is kept as a boxed property
|
|
4524
|
+
* in the view's extra store, where reflection and a later read see it;
|
|
4525
|
+
* `released` gives up a caller reference the frame does not own. */
|
|
4526
|
+
storePartialField(objName, shapeId, field, type, value, storeAt, released) {
|
|
4527
|
+
const B = this.B;
|
|
4528
|
+
const idx = this.recordShape(shapeId).fields.findIndex((f) => f.name === field);
|
|
4529
|
+
const isView = B.tmp();
|
|
4530
|
+
const notView = B.newLabel("ps.slot");
|
|
4531
|
+
const view = B.newLabel("ps.view");
|
|
4532
|
+
const present = B.newLabel("ps.present");
|
|
4533
|
+
const store = B.newLabel("ps.store");
|
|
4534
|
+
const extra = B.newLabel("ps.extra");
|
|
4535
|
+
const done = B.newLabel("ps.done");
|
|
4536
|
+
for (const line of recordViewTestLines(this.sizeType, objName, isView))
|
|
4537
|
+
B.line(line.trimStart());
|
|
4538
|
+
B.condBr(isView, view, notView);
|
|
4539
|
+
B.startBlock(notView);
|
|
4540
|
+
const own = B.tmp();
|
|
4541
|
+
B.line(`${own} = getelementptr inbounds %${mangleRecordStruct(shapeId)}, ptr ${objName}, i64 0, i32 ${idx + this.nullableUnions.fieldBase(shapeId)}`);
|
|
4542
|
+
const ownFrom = B.currentLabel();
|
|
4543
|
+
B.br(store);
|
|
4544
|
+
B.startBlock(view);
|
|
4545
|
+
const slot = this.partialViewSlot(objName, shapeId, field);
|
|
4546
|
+
const hasSlot = B.tmp();
|
|
4547
|
+
B.line(`${hasSlot} = icmp ne ptr ${slot}, null`);
|
|
4548
|
+
B.condBr(hasSlot, present, extra);
|
|
4549
|
+
B.startBlock(present);
|
|
4550
|
+
const presentFrom = B.currentLabel();
|
|
4551
|
+
B.br(store);
|
|
4552
|
+
// One store site whichever slot answers: the value's frame ownership
|
|
4553
|
+
// ends in one place, whether the write runs on this program's path or
|
|
4554
|
+
// on the other branch of the test.
|
|
4555
|
+
B.startBlock(store);
|
|
4556
|
+
const addr = B.tmp();
|
|
4557
|
+
B.line(`${addr} = phi ptr [ ${own}, %${ownFrom} ], [ ${slot}, %${presentFrom} ]`);
|
|
4558
|
+
storeAt(addr);
|
|
4559
|
+
B.br(done);
|
|
4560
|
+
B.startBlock(extra);
|
|
4561
|
+
const boxed = B.tmp();
|
|
4562
|
+
const box = this.dyn.toDynHelper(type);
|
|
4563
|
+
B.line(`${boxed} = call ptr @${box}(${this.llType(type)} ${value.name})`);
|
|
4564
|
+
this.declare(`declare void @scr_record_view_extra_set(ptr, ptr, ${this.sizeType}, ptr)`);
|
|
4565
|
+
B.line(`call void @scr_record_view_extra_set(ptr ${objName}, ptr ${this.cstr(field)}, ${this.sizeType} ${Buffer.byteLength(field, "utf8")}, ptr ${boxed})`);
|
|
4566
|
+
released?.();
|
|
4567
|
+
B.br(done);
|
|
4568
|
+
B.startBlock(done);
|
|
4569
|
+
}
|
|
4243
4570
|
/** The overflow map's slot pointer on an index-signature shape. */
|
|
4244
4571
|
recordOvfPtr(objName, shapeId) {
|
|
4245
4572
|
const shape = this.recordShape(shapeId);
|
|
@@ -5041,7 +5368,7 @@ export class LlEmitter {
|
|
|
5041
5368
|
/** An emitter for a range of this module's functions: the same facts,
|
|
5042
5369
|
* empty module-level tables, and a journal of what the range adds. */
|
|
5043
5370
|
chunkEmitter() {
|
|
5044
|
-
const chunk = new LlEmitter(this.mod, { ...this.targetOptions, functionChunks: 1 }, new EmitJournal());
|
|
5371
|
+
const chunk = new LlEmitter(this.mod, { ...this.targetOptions, functionChunks: 1 }, new EmitJournal(), null, this.nodeIndex);
|
|
5045
5372
|
chunk.debug?.record();
|
|
5046
5373
|
return chunk;
|
|
5047
5374
|
}
|
|
@@ -5217,7 +5544,8 @@ export class LlEmitter {
|
|
|
5217
5544
|
const exception = B.tmp();
|
|
5218
5545
|
B.line(`${exception} = landingpad { ptr, i32 } cleanup`);
|
|
5219
5546
|
for (const index of borrowed)
|
|
5220
|
-
this.
|
|
5547
|
+
if (!this.isTreeValue(fn.params[index].type))
|
|
5548
|
+
this.releaseFrame(`%p${index}`, fn.params[index].type);
|
|
5221
5549
|
this.declare(UNWIND_RESUME_DECLARATION);
|
|
5222
5550
|
B.resumeUnwind(exception);
|
|
5223
5551
|
B.startBlock(ok);
|
|
@@ -5244,8 +5572,10 @@ export class LlEmitter {
|
|
|
5244
5572
|
result = B.tmp();
|
|
5245
5573
|
B.line(`${result} = load ptr, ptr ${slot}`);
|
|
5246
5574
|
}
|
|
5575
|
+
// A tree value is passed by reference to its owner and never counted,
|
|
5576
|
+
// so the wrapper has nothing to drop for it.
|
|
5247
5577
|
for (const index of borrowed)
|
|
5248
|
-
if (!kept.has(index))
|
|
5578
|
+
if (!kept.has(index) && !this.isTreeValue(fn.params[index].type))
|
|
5249
5579
|
this.releaseFrame(`%p${index}`, fn.params[index].type);
|
|
5250
5580
|
B.terminate(ret === "void" ? "ret void" : `ret ${ret} ${result}`);
|
|
5251
5581
|
const symbol = kept.size > 0 ? `${mangleBorrowedFunction(fn.name)}.virtual` : mangleFunction(fn.name);
|
|
@@ -5486,6 +5816,17 @@ export class LlEmitter {
|
|
|
5486
5816
|
/** Emits the move of a noted last read: the slot is cleared, so scope
|
|
5487
5817
|
* exits release nothing and the read's owned temp carries the reference. */
|
|
5488
5818
|
takeLastUseMove(e, slot, type) {
|
|
5819
|
+
if (this.isTreeValue(e.type)) {
|
|
5820
|
+
// A tree value has one owner and no count: every read of it that the
|
|
5821
|
+
// plan accepted IS its transfer (backend/tree-classes.ts records the
|
|
5822
|
+
// expression), so the read takes the reference exactly as a last-use
|
|
5823
|
+
// move does. A read the plan did not record would copy the node,
|
|
5824
|
+
// which retainCall refuses.
|
|
5825
|
+
if (this.treeMoves?.delete(e) !== true)
|
|
5826
|
+
return false;
|
|
5827
|
+
this.B.line(`store ptr null, ptr ${slot}`);
|
|
5828
|
+
return true;
|
|
5829
|
+
}
|
|
5489
5830
|
if (this.lastUseMoves.get(e) !== slot || !typeEquals(type, e.type))
|
|
5490
5831
|
return false;
|
|
5491
5832
|
this.lastUseMoves.delete(e);
|
|
@@ -6771,6 +7112,11 @@ export class LlEmitter {
|
|
|
6771
7112
|
/** Group arenas (arenas.ts): the plan, the list slot of each root and
|
|
6772
7113
|
* call region, and which locals' scopes drop which roots' arenas. */
|
|
6773
7114
|
arenas = null;
|
|
7115
|
+
/** The varRef reads the tree-class plan proved move a node out of its
|
|
7116
|
+
* local (backend/tree-classes.ts). Each one emits its own last-use move:
|
|
7117
|
+
* the source slot is nulled and the value taken without a retain, since
|
|
7118
|
+
* a tree instance has no count to raise. */
|
|
7119
|
+
treeMoves = null;
|
|
6774
7120
|
arenaSlots = new Map();
|
|
6775
7121
|
/** The frames emitStmtBody opens for whole statements (arenas only). */
|
|
6776
7122
|
statementFrames = new Set();
|
|
@@ -6919,6 +7265,29 @@ export class LlEmitter {
|
|
|
6919
7265
|
this.journal?.site(name, "jsIcSite");
|
|
6920
7266
|
return name;
|
|
6921
7267
|
}
|
|
7268
|
+
/** A fresh guard-group record (js-groups.ts). */
|
|
7269
|
+
jsGroup() {
|
|
7270
|
+
const name = `@sc_js_group_${this.jsGroupCount++}`;
|
|
7271
|
+
this.journal?.site(name, "jsGroup");
|
|
7272
|
+
return name;
|
|
7273
|
+
}
|
|
7274
|
+
/** The constant key array `keys` (string literal symbols) that a group's
|
|
7275
|
+
* probe reads, shared by every group with the same keys. */
|
|
7276
|
+
jsGroupKeys(keys) {
|
|
7277
|
+
const text = keys.join("\u0000");
|
|
7278
|
+
let name = this.jsGroupKeysByText.get(text);
|
|
7279
|
+
if (name !== undefined)
|
|
7280
|
+
return name;
|
|
7281
|
+
name = `@sc_gkeys_${this.jsGroupKeysCount++}`;
|
|
7282
|
+
this.jsGroupKeysByText.set(text, name);
|
|
7283
|
+
this.jsGroupKeysByName.set(name, keys);
|
|
7284
|
+
this.journal?.site(name, "jsGroupKeys", [keys]);
|
|
7285
|
+
return name;
|
|
7286
|
+
}
|
|
7287
|
+
/** The key array of each of this module's guard groups, by name. */
|
|
7288
|
+
get jsGroupKeysTable() {
|
|
7289
|
+
return this.jsGroupKeysByName;
|
|
7290
|
+
}
|
|
6922
7291
|
/** A fresh read-site cache for one constant-key dyn read. */
|
|
6923
7292
|
dynReadIcSite() {
|
|
6924
7293
|
const name = `@sc_dyn_read_ic_${this.dynReadIcSites++}`;
|
|
@@ -7144,8 +7513,8 @@ export class LlEmitter {
|
|
|
7144
7513
|
emitRecordKeyGet(e) {
|
|
7145
7514
|
return emitRecordKeyGet(this, e);
|
|
7146
7515
|
}
|
|
7147
|
-
keyedRecordReadInto(slot, join, objName, keyName, shapeId, resultType, overflowOnly, loc, missNaN = false) {
|
|
7148
|
-
return keyedRecordReadInto(this, slot, join, objName, keyName, shapeId, resultType, overflowOnly, loc, missNaN);
|
|
7516
|
+
keyedRecordReadInto(slot, join, objName, keyName, shapeId, resultType, overflowOnly, loc, missNaN = false, missInto = null, read = null) {
|
|
7517
|
+
return keyedRecordReadInto(this, slot, join, objName, keyName, shapeId, resultType, overflowOnly, loc, missNaN, missInto, read);
|
|
7149
7518
|
}
|
|
7150
7519
|
dynPromiseAdapter(inner) {
|
|
7151
7520
|
return dynPromiseAdapter(this, inner);
|
|
@@ -7262,6 +7631,8 @@ function addNumberedSymbol(into, key, entry, prefix, names) {
|
|
|
7262
7631
|
names.set(entry.sym, own.sym);
|
|
7263
7632
|
}
|
|
7264
7633
|
registerReplay("jsIcSite", (emitter) => emitter.jsIcSite());
|
|
7634
|
+
registerReplay("jsGroup", (emitter) => emitter.jsGroup());
|
|
7635
|
+
registerReplay("jsGroupKeys", (emitter, args) => emitter.jsGroupKeys(args[0]));
|
|
7265
7636
|
registerReplay("dynReadIcSite", (emitter) => emitter.dynReadIcSite());
|
|
7266
7637
|
registerReplay("speculativeLoopSite", (emitter) => emitter.speculativeLoopSite());
|
|
7267
7638
|
for (const op of [
|