eliscript 0.1.3 → 0.1.4
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/COPYING.RUNTIME +93 -0
- package/README.md +15 -3
- package/bin/eliscript-test +29 -0
- package/bootstrap/backends/README.md +5 -4
- package/bootstrap/backends/binary.eli +89 -22
- package/bootstrap/backends/capabilities.eli +9 -4
- package/bootstrap/backends/managed-layout.eli +93 -81
- package/bootstrap/backends/managed.eli +651 -125
- package/bootstrap/backends/native.eli +1791 -324
- package/bootstrap/backends/numeric.eli +71 -7
- package/bootstrap/backends/sha256.eli +165 -68
- package/bootstrap/backends/wasm.eli +461 -52
- package/bootstrap/compiler/analyzer.eli +692 -2
- package/bootstrap/compiler/compiler.eli +16 -3
- package/bootstrap/compiler/emitter.eli +80 -35
- package/bootstrap/compiler/project.eli +175 -1
- package/bootstrap/compiler/transient-analysis.eli +2 -2
- package/bootstrap/host/build.eli +1 -0
- package/bootstrap/host/build.mjs +1 -1
- package/bootstrap/host/build.mjs.map +1 -1
- package/bootstrap/host/bun.mjs +7 -9
- package/bootstrap/host/bun.mjs.map +1 -1
- package/bootstrap/host/check-cli-ground.eli +47 -5
- package/bootstrap/host/check-cli-ground.mjs +60 -19
- package/bootstrap/host/check-cli-ground.mjs.map +1 -1
- package/bootstrap/host/check-cli.mjs +41 -1
- package/bootstrap/host/check-cli.mjs.map +1 -1
- package/bootstrap/host/compiler-session.eli +136 -22
- package/bootstrap/host/eliscript-cli.mjs +1 -1
- package/bootstrap/host/eliscript-cli.mjs.map +1 -1
- package/bootstrap/host/evaluation-cli.eli +33 -1
- package/bootstrap/host/evaluation-cli.mjs +65 -28
- package/bootstrap/host/evaluation-cli.mjs.map +1 -1
- package/bootstrap/host/evaluation.eli +651 -42
- package/bootstrap/host/evaluation.mjs +884 -72
- package/bootstrap/host/evaluation.mjs.map +1 -1
- package/bootstrap/host/project-cli-ground.eli +6 -1
- package/bootstrap/host/project-cli-ground.mjs +33 -32
- package/bootstrap/host/project-cli-ground.mjs.map +1 -1
- package/bootstrap/host/project-cli.mjs +1 -1
- package/bootstrap/host/project-cli.mjs.map +1 -1
- package/bootstrap/host/project-ground.eli +266 -45
- package/bootstrap/host/project-ground.mjs +429 -159
- package/bootstrap/host/project-ground.mjs.map +1 -1
- package/bootstrap/host/project.mjs +30 -40
- package/bootstrap/host/project.mjs.map +1 -1
- package/bootstrap/host/test-cli.eli +379 -0
- package/bootstrap/host/test-cli.mjs +494 -0
- package/bootstrap/host/test-cli.mjs.map +1 -0
- package/browser/README.md +7 -0
- package/browser/host.mjs +21 -29
- package/browser/host.mjs.map +1 -1
- package/browser/worker.mjs +7 -9
- package/browser/worker.mjs.map +1 -1
- package/compiler/eliscript-analyzer.el +694 -0
- package/compiler/eliscript-cli.el +66 -22
- package/compiler/eliscript-emitter.el +67 -43
- package/compiler/eliscript-ir-emitter.el +71 -36
- package/compiler/eliscript-project.el +360 -80
- package/compiler/eliscript-transient-analysis.el +5 -5
- package/compiler/eliscript.el +6 -0
- package/dist/backends/binary.mjs +148 -26
- package/dist/backends/binary.mjs.map +1 -1
- package/dist/backends/capabilities.mjs +11 -4
- package/dist/backends/capabilities.mjs.map +1 -1
- package/dist/backends/elf.mjs +4 -4
- package/dist/backends/elf.mjs.map +1 -1
- package/dist/backends/managed-layout.mjs +53 -56
- package/dist/backends/managed-layout.mjs.map +1 -1
- package/dist/backends/managed.mjs +1116 -375
- package/dist/backends/managed.mjs.map +1 -1
- package/dist/backends/memory.mjs +24 -26
- package/dist/backends/memory.mjs.map +1 -1
- package/dist/backends/native.mjs +2529 -434
- package/dist/backends/native.mjs.map +1 -1
- package/dist/backends/numeric.mjs +140 -33
- package/dist/backends/numeric.mjs.map +1 -1
- package/dist/backends/optimize.mjs +2 -2
- package/dist/backends/optimize.mjs.map +1 -1
- package/dist/backends/regexp.mjs +33 -35
- package/dist/backends/regexp.mjs.map +1 -1
- package/dist/backends/sha256.mjs +159 -59
- package/dist/backends/sha256.mjs.map +1 -1
- package/dist/backends/wasm.mjs +609 -73
- package/dist/backends/wasm.mjs.map +1 -1
- package/dist/bootstrap/analyzer.mjs +1018 -2
- package/dist/bootstrap/analyzer.mjs.map +1 -1
- package/dist/bootstrap/compiler.mjs +30 -23
- package/dist/bootstrap/compiler.mjs.map +1 -1
- package/dist/bootstrap/emitter.mjs +206 -161
- package/dist/bootstrap/emitter.mjs.macro-origins.json +16 -16
- package/dist/bootstrap/emitter.mjs.map +1 -1
- package/dist/bootstrap/expander.mjs +27 -31
- package/dist/bootstrap/expander.mjs.map +1 -1
- package/dist/bootstrap/ir.mjs +22 -24
- package/dist/bootstrap/ir.mjs.map +1 -1
- package/dist/bootstrap/project.mjs +246 -1
- package/dist/bootstrap/project.mjs.map +1 -1
- package/dist/bootstrap/reader.mjs +2 -2
- package/dist/bootstrap/reader.mjs.map +1 -1
- package/dist/bootstrap/source-map.mjs +34 -48
- package/dist/bootstrap/source-map.mjs.map +1 -1
- package/dist/bootstrap/transient-analysis.mjs +2 -2
- package/dist/bootstrap/transient-analysis.mjs.map +1 -1
- package/dist/browser/compiler.js +106 -106
- package/dist/browser/host.mjs +21 -29
- package/dist/browser/loader.js +1 -1
- package/dist/browser/worker.mjs +95 -95
- package/dist/compiler-artifact.json +1 -1
- package/dist/host/compiler-session.mjs +405 -228
- package/dist/host/compiler-session.mjs.map +1 -1
- package/dist/host/compiler-tools.mjs +44 -46
- package/dist/host/compiler-tools.mjs.map +1 -1
- package/dist/literal-sources/runtime/core/array-map.eli +45 -0
- package/dist/literal-sources/runtime/core/collection-internals.eli +22 -2
- package/dist/literal-sources/runtime/core/collection.eli +282 -23
- package/dist/literal-sources/runtime/core/data-text.eli +196 -13
- package/dist/literal-sources/runtime/core/data.eli +1 -1
- package/dist/literal-sources/runtime/core/identifier.eli +1 -1
- package/dist/literal-sources/runtime/core/lazy-sequence.eli +822 -44
- package/dist/literal-sources/runtime/core/list.eli +1 -1
- package/dist/literal-sources/runtime/core/map.eli +1 -1
- package/dist/literal-sources/runtime/core/metadata-internals.eli +2 -2
- package/dist/literal-sources/runtime/core/metadata.eli +2 -2
- package/dist/literal-sources/{stdlib/core/object.eli → runtime/core/object-impl.eli} +6 -6
- package/dist/literal-sources/runtime/core/object.eli +1 -1
- package/dist/literal-sources/runtime/core/order.eli +3 -3
- package/dist/literal-sources/runtime/core/persistent-kind.eli +1 -1
- package/dist/literal-sources/{stdlib/core/protocol.eli → runtime/core/protocol-impl.eli} +2 -2
- package/dist/literal-sources/runtime/core/protocol.eli +5 -3
- package/dist/literal-sources/runtime/core/queue.eli +1 -1
- package/dist/literal-sources/runtime/core/record.eli +3 -3
- package/dist/literal-sources/runtime/core/regex.eli +2 -2
- package/dist/literal-sources/runtime/core/sequence.eli +1 -1
- package/dist/literal-sources/runtime/core/set-algebra.eli +1 -1
- package/dist/literal-sources/runtime/core/set.eli +1 -1
- package/dist/literal-sources/runtime/core/sorted.eli +4 -4
- package/dist/literal-sources/{stdlib/core/text.eli → runtime/core/text-impl.eli} +2 -2
- package/dist/literal-sources/runtime/core/text.eli +1 -1
- package/dist/literal-sources/runtime/core/transducer.eli +24 -2
- package/dist/literal-sources/runtime/core/transient.eli +7 -5
- package/dist/literal-sources/runtime/core/type.eli +1 -1
- package/dist/literal-sources/runtime/core/value-internals.eli +3 -3
- package/dist/literal-sources/runtime/core/value.eli +2 -2
- package/dist/literal-sources/runtime/core/vector.eli +5 -2
- package/dist/literal-sources/{stdlib → runtime/managed}/managed-literal-protocols.eli +100 -34
- package/dist/literal-sources/{stdlib → runtime/managed}/managed-literals.eli +406 -81
- package/{stdlib → dist/literal-sources/runtime/managed}/managed-queue-state.eli +1 -1
- package/{stdlib → dist/literal-sources/runtime/managed}/managed-sorted-state.eli +1 -1
- package/dist/literal-sources/runtime/managed/managed-transient-state.eli +1206 -0
- package/{stdlib → dist/literal-sources/runtime/managed}/managed-value-state.eli +30 -6
- package/dist/literal-sources/{stdlib → runtime/managed}/managed-vector-view-state.eli +1 -1
- package/dist/literal-sources/runtime/wire/http-rpc.eli +1 -1
- package/dist/literal-sources/runtime/wire/markdown.eli +1 -1
- package/dist/literal-sources/runtime/wire/schema.eli +1 -1
- package/dist/literal-sources/stdlib/bit.eli +89 -1
- package/dist/literal-sources/stdlib/data.eli +522 -0
- package/dist/literal-sources/stdlib/interop/object.eli +39 -0
- package/dist/literal-sources/stdlib/persistent-list.eli +60 -21
- package/dist/literal-sources/stdlib/persistent-map.eli +335 -324
- package/dist/literal-sources/stdlib/persistent-set.eli +8 -6
- package/dist/literal-sources/stdlib/persistent-vector.eli +18 -18
- package/dist/literal-sources/stdlib/protocol.eli +63 -0
- package/{stdlib/core → dist/literal-sources/stdlib}/set.eli +8 -8
- package/dist/literal-sources/stdlib/string.eli +362 -0
- package/dist/runtime/lisp/async-runtime.mjs +55 -59
- package/dist/runtime/lisp/async-runtime.mjs.map +1 -1
- package/dist/runtime/lisp/builtins.mjs +232 -280
- package/dist/runtime/lisp/builtins.mjs.map +1 -1
- package/dist/runtime/lisp/cli.mjs +159 -167
- package/dist/runtime/lisp/cli.mjs.map +1 -1
- package/dist/runtime/lisp/compiler.mjs +359 -419
- package/dist/runtime/lisp/compiler.mjs.map +1 -1
- package/dist/runtime/lisp/core.mjs +24 -24
- package/dist/runtime/lisp/core.mjs.map +1 -1
- package/dist/runtime/lisp/evaluator.mjs +315 -385
- package/dist/runtime/lisp/evaluator.mjs.map +1 -1
- package/dist/runtime/lisp/extensions.mjs +85 -103
- package/dist/runtime/lisp/extensions.mjs.map +1 -1
- package/dist/runtime/lisp/host-io.mjs +106 -122
- package/dist/runtime/lisp/host-io.mjs.map +1 -1
- package/dist/runtime/lisp/io-worker.mjs +117 -135
- package/dist/runtime/lisp/io-worker.mjs.map +1 -1
- package/dist/runtime/lisp/keymap.mjs +5 -5
- package/dist/runtime/lisp/keymap.mjs.map +1 -1
- package/dist/runtime/lisp/macros-forms.mjs +49 -51
- package/dist/runtime/lisp/macros-forms.mjs.map +1 -1
- package/dist/runtime/lisp/reader-format.mjs +31 -31
- package/dist/runtime/lisp/reader-format.mjs.map +1 -1
- package/dist/runtime/lisp/regexp-buffer.mjs +9 -9
- package/dist/runtime/lisp/regexp-buffer.mjs.map +1 -1
- package/dist/runtime/math.mjs +32 -38
- package/dist/runtime/math.mjs.map +1 -1
- package/dist/runtime/number-radix.mjs +5 -7
- package/dist/runtime/number-radix.mjs.map +1 -1
- package/dist/runtime/primitives.mjs +81 -46
- package/dist/runtime/primitives.mjs.macro-origins.json +294 -44
- package/dist/runtime/primitives.mjs.map +1 -1
- package/dist/runtime/unicode-case.mjs +6 -6
- package/dist/runtime/unicode-case.mjs.map +1 -1
- package/dist/runtime.eli +3068 -1882
- package/dist/stage3-release.json +1 -1
- package/dist/stdlib/async.mjs +1838 -0
- package/dist/stdlib/bit.mjs +116 -0
- package/dist/stdlib/collection.mjs +193 -0
- package/dist/stdlib/core.mjs +28 -0
- package/dist/stdlib/data-text.mjs +54 -0
- package/dist/stdlib/data.mjs +601 -0
- package/dist/stdlib/devtools.mjs +565 -0
- package/dist/stdlib/diff.mjs +180 -0
- package/dist/stdlib/fn.mjs +164 -0
- package/dist/stdlib/hierarchy.mjs +189 -0
- package/dist/stdlib/identifier.mjs +33 -0
- package/dist/stdlib/interop/js.mjs +706 -0
- package/dist/stdlib/interop/object.mjs +40 -0
- package/dist/stdlib/json.mjs +843 -0
- package/dist/stdlib/lazy-sequence.mjs +117 -0
- package/dist/stdlib/math.mjs +386 -0
- package/dist/stdlib/meta.mjs +21 -0
- package/dist/stdlib/multimethod.mjs +345 -0
- package/dist/stdlib/numeric.mjs +327 -0
- package/dist/stdlib/order.mjs +194 -0
- package/dist/stdlib/persistent-list.mjs +171 -0
- package/dist/stdlib/persistent-map.mjs +781 -0
- package/dist/stdlib/persistent-queue.mjs +44 -0
- package/dist/stdlib/persistent-set.mjs +225 -0
- package/dist/stdlib/persistent-vector.mjs +316 -0
- package/dist/stdlib/portable/data-text.mjs +1094 -0
- package/dist/stdlib/portable/data.mjs +62 -0
- package/dist/stdlib/portable/identifier.mjs +179 -0
- package/dist/stdlib/portable/metadata.mjs +63 -0
- package/dist/stdlib/portable/object.mjs +140 -0
- package/dist/stdlib/portable/sequence.mjs +142 -0
- package/dist/stdlib/portable/text.mjs +111 -0
- package/dist/stdlib/pprint.mjs +807 -0
- package/dist/stdlib/protocol.mjs +61 -0
- package/dist/stdlib/record.mjs +25 -0
- package/dist/stdlib/regex.mjs +115 -0
- package/dist/stdlib/result.mjs +198 -0
- package/dist/stdlib/schema.mjs +2828 -0
- package/dist/stdlib/seq.mjs +913 -0
- package/dist/stdlib/set.mjs +317 -0
- package/dist/stdlib/sorted.mjs +56 -0
- package/dist/stdlib/state.mjs +451 -0
- package/dist/stdlib/string.mjs +494 -0
- package/dist/stdlib/tap.mjs +187 -0
- package/dist/stdlib/test.mjs +669 -0
- package/dist/stdlib/time.mjs +522 -0
- package/dist/stdlib/transducer.mjs +85 -0
- package/dist/stdlib/transient.mjs +32 -0
- package/dist/stdlib/type.mjs +28 -0
- package/dist/stdlib/uuid.mjs +377 -0
- package/dist/stdlib/value.mjs +334 -0
- package/dist/stdlib/walk.mjs +243 -0
- package/dist/stdlib/wire/gepo.mjs +28 -0
- package/dist/stdlib/wire/mdp.mjs +13 -0
- package/dist/stdlib/wire/mds.mjs +10 -0
- package/dist/stdlib/zipper.mjs +1025 -0
- package/editor/README.md +15 -0
- package/editor/eliscript-data.el +221 -8
- package/editor/eliscript-mode.el +207 -48
- package/editor/eliscript-runtime.el +6 -3
- package/package.json +49 -15
- package/platform/README.md +6 -0
- package/platform/browser.mjs +10 -12
- package/platform/browser.mjs.map +1 -1
- package/runtime/README.md +12 -5
- package/runtime/core/array-map.eli +538 -0
- package/runtime/core/array-map.mjs +651 -0
- package/runtime/core/array-map.mjs.map +1 -0
- package/runtime/core/collection-internals.eli +85 -33
- package/runtime/core/collection-internals.mjs +245 -193
- package/runtime/core/collection-internals.mjs.map +1 -1
- package/runtime/core/collection.eli +105 -3
- package/runtime/core/collection.mjs +190 -53
- package/runtime/core/collection.mjs.map +1 -1
- package/runtime/core/data-text.eli +224 -16
- package/runtime/core/data-text.mjs +345 -83
- package/runtime/core/data-text.mjs.map +1 -1
- package/runtime/core/data.eli +50 -33
- package/runtime/core/data.mjs +72 -36
- package/runtime/core/data.mjs.map +1 -1
- package/runtime/core/identifier.mjs +15 -19
- package/runtime/core/identifier.mjs.map +1 -1
- package/runtime/core/lazy-sequence.eli +885 -15
- package/runtime/core/lazy-sequence.mjs +1265 -38
- package/runtime/core/lazy-sequence.mjs.map +1 -1
- package/runtime/core/map-internals.eli +209 -1
- package/runtime/core/map-internals.mjs +359 -71
- package/runtime/core/map-internals.mjs.map +1 -1
- package/runtime/core/map.eli +75 -7
- package/runtime/core/map.mjs +122 -47
- package/runtime/core/map.mjs.map +1 -1
- package/{stdlib/core/object.eli → runtime/core/object-impl.eli} +6 -6
- package/runtime/core/object-impl.mjs +5 -5
- package/runtime/core/object-impl.mjs.map +1 -1
- package/runtime/core/order.eli +15 -3
- package/runtime/core/order.mjs +23 -8
- package/runtime/core/order.mjs.map +1 -1
- package/runtime/core/persistent-kind.mjs +9 -13
- package/runtime/core/persistent-kind.mjs.map +1 -1
- package/runtime/core/protocol-error.mjs +9 -11
- package/runtime/core/protocol-error.mjs.map +1 -1
- package/{stdlib/core/protocol.eli → runtime/core/protocol-impl.eli} +2 -2
- package/runtime/core/protocol-impl.mjs +10 -10
- package/runtime/core/protocol-impl.mjs.map +1 -1
- package/runtime/core/queue.mjs +14 -16
- package/runtime/core/queue.mjs.map +1 -1
- package/runtime/core/record.eli +2 -2
- package/runtime/core/record.mjs +13 -17
- package/runtime/core/record.mjs.map +1 -1
- package/runtime/core/regex.mjs +18 -22
- package/runtime/core/regex.mjs.map +1 -1
- package/runtime/core/sequence.eli +33 -31
- package/runtime/core/sequence.mjs +60 -93
- package/runtime/core/sequence.mjs.map +1 -1
- package/runtime/core/set.eli +53 -27
- package/runtime/core/set.mjs +113 -82
- package/runtime/core/set.mjs.map +1 -1
- package/runtime/core/sorted.mjs +91 -108
- package/runtime/core/sorted.mjs.map +1 -1
- package/{stdlib/core/text.eli → runtime/core/text-impl.eli} +2 -2
- package/runtime/core/text-impl.mjs +1 -1
- package/runtime/core/text-impl.mjs.map +1 -1
- package/runtime/core/transducer.eli +24 -0
- package/runtime/core/transducer.mjs +27 -1
- package/runtime/core/transducer.mjs.map +1 -1
- package/runtime/core/transient-internals.eli +12 -4
- package/runtime/core/transient-internals.mjs +19 -6
- package/runtime/core/transient-internals.mjs.map +1 -1
- package/runtime/core/transient.eli +31 -0
- package/runtime/core/transient.mjs +33 -2
- package/runtime/core/transient.mjs.map +1 -1
- package/runtime/core/value-internals.mjs +29 -35
- package/runtime/core/value-internals.mjs.map +1 -1
- package/runtime/core/vector.eli +73 -20
- package/runtime/core/vector.mjs +159 -156
- package/runtime/core/vector.mjs.map +1 -1
- package/runtime/literals.eli +16 -9
- package/runtime/literals.mjs +25 -9
- package/runtime/literals.mjs.map +1 -1
- package/{stdlib → runtime/managed}/managed-literal-protocols.eli +100 -34
- package/{stdlib → runtime/managed}/managed-literals.eli +406 -81
- package/{dist/literal-sources/stdlib → runtime/managed}/managed-queue-state.eli +1 -1
- package/runtime/managed/managed-runtime-array-map.eli +45 -0
- package/{stdlib → runtime/managed}/managed-runtime-collection-internals.eli +22 -2
- package/{stdlib → runtime/managed}/managed-runtime-collection.eli +282 -23
- package/{stdlib → runtime/managed}/managed-runtime-data-text.eli +196 -13
- package/{stdlib → runtime/managed}/managed-runtime-data.eli +1 -1
- package/{stdlib → runtime/managed}/managed-runtime-identifier.eli +1 -1
- package/runtime/managed/managed-runtime-lazy-sequence.eli +935 -0
- package/{stdlib → runtime/managed}/managed-runtime-list.eli +1 -1
- package/{stdlib → runtime/managed}/managed-runtime-map.eli +1 -1
- package/{stdlib → runtime/managed}/managed-runtime-metadata-internals.eli +2 -2
- package/{stdlib → runtime/managed}/managed-runtime-metadata.eli +2 -2
- package/{stdlib → runtime/managed}/managed-runtime-object.eli +1 -1
- package/{stdlib → runtime/managed}/managed-runtime-order.eli +3 -3
- package/{stdlib → runtime/managed}/managed-runtime-persistent-kind.eli +1 -1
- package/{stdlib → runtime/managed}/managed-runtime-protocol.eli +5 -3
- package/{stdlib → runtime/managed}/managed-runtime-queue.eli +1 -1
- package/{stdlib → runtime/managed}/managed-runtime-record.eli +3 -3
- package/{stdlib → runtime/managed}/managed-runtime-regex.eli +2 -2
- package/{stdlib → runtime/managed}/managed-runtime-sequence.eli +1 -1
- package/{stdlib → runtime/managed}/managed-runtime-set-algebra.eli +1 -1
- package/{stdlib → runtime/managed}/managed-runtime-set.eli +1 -1
- package/{stdlib → runtime/managed}/managed-runtime-sorted.eli +4 -4
- package/{stdlib → runtime/managed}/managed-runtime-text.eli +1 -1
- package/{stdlib → runtime/managed}/managed-runtime-transducer.eli +24 -2
- package/{stdlib → runtime/managed}/managed-runtime-transient.eli +7 -5
- package/{stdlib → runtime/managed}/managed-runtime-type.eli +1 -1
- package/{stdlib → runtime/managed}/managed-runtime-value-internals.eli +3 -3
- package/{stdlib → runtime/managed}/managed-runtime-value.eli +2 -2
- package/{stdlib → runtime/managed}/managed-runtime-vector.eli +5 -2
- package/{dist/literal-sources/stdlib → runtime/managed}/managed-sorted-state.eli +1 -1
- package/runtime/managed/managed-transient-state.eli +1206 -0
- package/{dist/literal-sources/stdlib → runtime/managed}/managed-value-state.eli +30 -6
- package/{stdlib → runtime/managed}/managed-vector-view-state.eli +1 -1
- package/{stdlib → runtime/managed}/managed-wire-http-rpc.eli +1 -1
- package/{stdlib → runtime/managed}/managed-wire-markdown.eli +1 -1
- package/{stdlib → runtime/managed}/managed-wire-schema.eli +1 -1
- package/runtime/math.mjs +32 -38
- package/runtime/math.mjs.map +1 -1
- package/runtime/number-radix.mjs +5 -7
- package/runtime/number-radix.mjs.map +1 -1
- package/runtime/primitives.eli +19 -6
- package/runtime/primitives.mjs +81 -46
- package/runtime/primitives.mjs.map +1 -1
- package/runtime/source-mapping.mjs +17 -23
- package/runtime/source-mapping.mjs.map +1 -1
- package/runtime/testing/map.eli +70 -41
- package/runtime/testing/map.mjs +57 -34
- package/runtime/testing/map.mjs.map +1 -1
- package/runtime/unicode-case.mjs +6 -6
- package/runtime/unicode-case.mjs.map +1 -1
- package/runtime/wire/http-rpc.mjs +12 -18
- package/runtime/wire/http-rpc.mjs.map +1 -1
- package/runtime/wire/markdown.mjs +42 -42
- package/runtime/wire/markdown.mjs.map +1 -1
- package/runtime/wire/schema.mjs +13 -13
- package/runtime/wire/schema.mjs.map +1 -1
- package/runtime/worker-value-codec.mjs +5 -7
- package/runtime/worker-value-codec.mjs.map +1 -1
- package/runtime/worker-value-stream.mjs +128 -135
- package/runtime/worker-value-stream.mjs.map +1 -1
- package/runtime/worker.mjs +75 -89
- package/runtime/worker.mjs.map +1 -1
- package/stdlib/README.md +25 -18
- package/stdlib/async.eli +1245 -0
- package/stdlib/bit.eli +89 -1
- package/stdlib/bit.mjs +89 -2
- package/stdlib/bit.mjs.map +1 -1
- package/stdlib/{core/collection.eli → collection.eli} +39 -4
- package/stdlib/core.eli +956 -0
- package/stdlib/data-text.eli +62 -1091
- package/stdlib/data.eli +517 -37
- package/stdlib/devtools.eli +399 -0
- package/stdlib/diff.eli +134 -0
- package/stdlib/{function.eli → fn.eli} +1 -1
- package/stdlib/identifier.eli +21 -136
- package/stdlib/interop/object.eli +39 -0
- package/stdlib/{core/lazy-sequence.eli → lazy-sequence.eli} +28 -2
- package/stdlib/math.eli +267 -0
- package/stdlib/{core/metadata.eli → meta.eli} +2 -2
- package/stdlib/{core/order.eli → order.eli} +6 -6
- package/stdlib/persistent-list.eli +60 -21
- package/stdlib/persistent-map.eli +335 -324
- package/stdlib/persistent-set.eli +8 -6
- package/stdlib/persistent-vector.eli +18 -18
- package/stdlib/portable/data-text.eli +1092 -0
- package/stdlib/portable/data.eli +42 -0
- package/stdlib/portable/identifier.eli +147 -0
- package/stdlib/{metadata.eli → portable/metadata.eli} +5 -5
- package/stdlib/{object.eli → portable/object.eli} +1 -1
- package/stdlib/{sequence.eli → portable/sequence.eli} +1 -1
- package/stdlib/{text.eli → portable/text.eli} +1 -1
- package/stdlib/pprint.eli +588 -0
- package/stdlib/protocol.eli +63 -0
- package/stdlib/{core/record.eli → record.eli} +2 -2
- package/stdlib/regex.eli +70 -0
- package/stdlib/result.eli +53 -44
- package/stdlib/schema.eli +1886 -0
- package/stdlib/{core/seq.eli → seq.eli} +97 -90
- package/{dist/literal-sources/stdlib/core → stdlib}/set.eli +8 -8
- package/stdlib/{core/sorted.eli → sorted.eli} +2 -2
- package/stdlib/{state/atom.eli → state.eli} +137 -7
- package/stdlib/string.eli +362 -0
- package/stdlib/tap.eli +135 -0
- package/stdlib/test.eli +566 -0
- package/stdlib/time.eli +419 -0
- package/stdlib/{core/transducer.eli → transducer.eli} +4 -2
- package/stdlib/{core/transient.eli → transient.eli} +11 -5
- package/stdlib/{core/type.eli → type.eli} +2 -2
- package/stdlib/uuid.eli +288 -0
- package/stdlib/{core/walk.eli → walk.eli} +6 -6
- package/stdlib/{gepo.eli → wire/gepo.eli} +2 -2
- package/stdlib/{mdp.eli → wire/mdp.eli} +2 -2
- package/stdlib/{mds.eli → wire/mds.eli} +2 -2
- package/stdlib/{core/zipper.eli → zipper.eli} +179 -138
- package/tests/helpers/wasm-managed-math-node.mjs +495 -582
- package/tools/acceptance/check-ground.mjs +106 -132
- package/tools/acceptance/check.mjs +16 -16
- package/tools/acceptance/retained-performance-snapshot.mjs +265 -149
- package/tools/acceptance/retained-soak.mjs +5 -7
- package/tools/acceptance/retained-transient.mjs +5 -7
- package/tools/backends/build.mjs +373 -95
- package/tools/backends/compiler-bootstrap.mjs +271 -317
- package/tools/backends/compiler-browser.mjs +7 -9
- package/tools/backends/compiler-build.mjs +77 -97
- package/tools/backends/compiler-cli-ground.mjs +47 -47
- package/tools/backends/compiler-data-transport.mjs +27 -31
- package/tools/backends/compiler-host-iteration.mjs +13 -21
- package/tools/backends/compiler-host-record.mjs +28 -34
- package/tools/backends/compiler-metadata.mjs +145 -53
- package/tools/backends/compiler-package-ground.mjs +39 -47
- package/tools/backends/compiler-package-loader.mjs +164 -206
- package/tools/backends/compiler-session.mjs +432 -324
- package/tools/backends/compiler-worker.mjs +79 -89
- package/tools/backends/dist/bootstrap-js-stages.mjs +17 -19
- package/tools/backends/dist/bootstrap-js-stages.mjs.map +1 -1
- package/tools/backends/dist/managed-ir-inventory.mjs +1 -1
- package/tools/backends/dist/managed-ir-inventory.mjs.map +1 -1
- package/tools/backends/dist/release-cli.mjs +151 -22
- package/tools/backends/dist/release-cli.mjs.map +1 -1
- package/tools/backends/dist/run-artifact.mjs +54 -76
- package/tools/backends/dist/run-artifact.mjs.map +1 -1
- package/tools/backends/managed-foreign-binding.mjs +370 -114
- package/tools/backends/managed-host-ground.mjs +14 -17
- package/tools/backends/managed-host-lifecycle.mjs +42 -53
- package/tools/backends/managed-host-object-realm.mjs +121 -111
- package/tools/backends/managed-host-proxy.mjs +5 -7
- package/tools/backends/managed-host-runtime.mjs +6295 -4350
- package/tools/backends/managed-host.mjs +234 -188
- package/tools/backends/managed-layout.mjs +53 -56
- package/tools/backends/managed-module-graph-ground.mjs +488 -568
- package/tools/backends/managed-module-graph.mjs +62 -76
- package/tools/backends/managed-runtime-host-ground.mjs +352 -400
- package/tools/backends/managed-runtime.mjs +227 -266
- package/tools/backends/managed-source-view-ground.mjs +165 -161
- package/tools/backends/managed-source-view.mjs +415 -154
- package/tools/backends/native-managed-runtime.mjs +96 -138
- package/tools/backends/native-memory.mjs +1122 -742
- package/tools/backends/native-node-ffi.mjs +2439 -0
- package/tools/backends/native-node-memory.mjs +793 -383
- package/tools/backends/native-node-runner.mjs +1458 -579
- package/tools/backends/native-node-watchdog.mjs +12 -14
- package/tools/backends/native-node-worker.mjs +46 -50
- package/tools/backends/stage3-targets.mjs +2 -2
- package/tools/bootstrap-runtime.el +4 -4
- package/tools/collections/transient-builder-benchmark.mjs +17 -17
- package/tools/project/check-cli.eli +27 -3
- package/tools/project/project-cli.eli +1 -1
- package/tools/testing/maintained-suite-source.mjs +5 -7
- package/tools/testing/maintained-suite-source.mjs.map +1 -1
- package/dist/literal-sources/stdlib/core/data.eli +0 -306
- package/dist/literal-sources/stdlib/managed-transient-state.eli +0 -353
- package/stdlib/core/data-text.eli +0 -16
- package/stdlib/core/data.eli +0 -306
- package/stdlib/core/identifier.eli +0 -32
- package/stdlib/core/regex.eli +0 -17
- package/stdlib/deferred.eli +0 -70
- package/stdlib/managed-runtime-lazy-sequence.eli +0 -157
- package/stdlib/managed-transient-state.eli +0 -353
- /package/{stdlib → runtime/managed}/managed-protocol-error.eli +0 -0
- /package/{stdlib → runtime/managed}/managed-runtime-literals.eli +0 -0
- /package/{stdlib → runtime/managed}/managed-runtime-truth.eli +0 -0
- /package/{stdlib → runtime/managed}/managed-testing-value.eli +0 -0
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
import { tdz as __eliscript_tdz_error, immutable as __eliscript_const_error } from "eliscript/runtime/errors.mjs";
|
|
3
3
|
var __eliscript_tdz_ready_0;
|
|
4
4
|
var __eliscript_tdz_ready_1;
|
|
5
|
+
var __eliscript_tdz_ready_2;
|
|
6
|
+
var __eliscript_tdz_ready_3;
|
|
5
7
|
import "eliscript/runtime/unicode-case.mjs";
|
|
6
8
|
import "eliscript/runtime/math.mjs";
|
|
7
9
|
import { __eliscript_at, __eliscript_at_direct, __eliscript_to_number, __eliscript_numeric_decrement, __eliscript_numeric_relation, __eliscript_numeric_sub, __eliscript_numeric_mul, __eliscript_numeric_div, __eliscript_numeric_rem, __eliscript_numeric_and, __eliscript_numeric_or, __eliscript_numeric_xor, __eliscript_numeric_shl, __eliscript_numeric_shr, __eliscript_numeric_ushr, __eliscript_numeric_neg, __eliscript_numeric_int32, __eliscript_numeric_uint32, __eliscript_numeric_not } from "eliscript/runtime/prelude.mjs";
|
|
@@ -243,6 +245,164 @@ function node_decode_result(type, value) {
|
|
|
243
245
|
return value;
|
|
244
246
|
}
|
|
245
247
|
}
|
|
248
|
+
const readonly_native_invokes = new (globalThis.Set)(["last-error", "value-kind", "value-length", "value-data", "value-number-bits", "value-foreign-token", "heap-pin", "frame-current", "heap-collections", "heap-used", "heap-capacity", "heap-live", "frame-depth", "read"]);
|
|
249
|
+
__eliscript_tdz_ready_2 = true;
|
|
250
|
+
function compact_wire_encode_str(s) {
|
|
251
|
+
if ((((s)["indexOf"]("\t") === -1) && ((s)["indexOf"]("\n") === -1) && ((s)["indexOf"]("\r") === -1))) {
|
|
252
|
+
return (String("S") + String(s));
|
|
253
|
+
} else {
|
|
254
|
+
return (String("Q") + String(JSON.stringify(s)));
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
function compact_wire_decode_str(tok) {
|
|
258
|
+
if (__eliscript_truthy((tok)["startsWith"]("S"))) {
|
|
259
|
+
return (tok)["slice"](1);
|
|
260
|
+
} else {
|
|
261
|
+
return JSON.parse((tok)["slice"](1));
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
function compact_encode_apply_val(arg) {
|
|
265
|
+
{
|
|
266
|
+
let kind = (arg)["kind"];
|
|
267
|
+
if ((kind === "raw")) {
|
|
268
|
+
return (String("r") + String(normalize_u64((arg)["raw"])));
|
|
269
|
+
} else {
|
|
270
|
+
if ((kind === "number")) {
|
|
271
|
+
{
|
|
272
|
+
let v = (arg)["value"];
|
|
273
|
+
if (__eliscript_truthy(Number.isFinite(v))) {
|
|
274
|
+
if (__eliscript_truthy(Object.is(v, __eliscript_numeric_mul(-1, 0)))) {
|
|
275
|
+
return "m";
|
|
276
|
+
} else {
|
|
277
|
+
return (String("n") + String(v));
|
|
278
|
+
}
|
|
279
|
+
} else {
|
|
280
|
+
return null;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
} else {
|
|
284
|
+
if ((kind === "string")) {
|
|
285
|
+
return compact_wire_encode_str((arg)["text"]);
|
|
286
|
+
} else {
|
|
287
|
+
if ((kind === "foreign")) {
|
|
288
|
+
return (String("f") + String(__eliscript_numeric_ushr((arg)["token"], 0)) + String(":") + String(__eliscript_numeric_ushr((arg)["slot"], 0)) + String(":") + String((__eliscript_truthy((arg)["constructible"]) ? "1" : "0")));
|
|
289
|
+
} else {
|
|
290
|
+
return null;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
function compact_apply_request(id, spec) {
|
|
298
|
+
{
|
|
299
|
+
let args = (spec)["args"];
|
|
300
|
+
if ((!(((spec)["heap"] == null)) && !(((spec)["receiver"] == null)) && __eliscript_truthy(Array.isArray(args)) && __eliscript_numeric_relation("<=", ((args) ?? []).length, 4) && (!(((spec)["targetRaw"] === undefined)) || (!(((spec)["hoistedIndex"] === undefined)) && (__eliscript_value_type((spec)["invokeName"]) === "string"))))) {
|
|
301
|
+
{
|
|
302
|
+
let rec = compact_encode_apply_val((spec)["receiver"]);
|
|
303
|
+
if (__eliscript_truthy(rec)) {
|
|
304
|
+
{
|
|
305
|
+
let parts = [(String("A") + String(id)), __eliscript_numeric_ushr((spec)["heap"], 0)];
|
|
306
|
+
let ok = true;
|
|
307
|
+
let i = 0;
|
|
308
|
+
if (((spec)["hoistedIndex"] === undefined)) {
|
|
309
|
+
(parts)["push"]("R", (String(normalize_u64((spec)["targetRaw"]))));
|
|
310
|
+
} else {
|
|
311
|
+
(parts)["push"]("H", (spec)["hoistedIndex"], compact_wire_encode_str((spec)["invokeName"]));
|
|
312
|
+
}
|
|
313
|
+
(parts)["push"](rec, ((args) ?? []).length);
|
|
314
|
+
while ((__eliscript_truthy(ok) && __eliscript_numeric_relation("<", i, ((args) ?? []).length))) {
|
|
315
|
+
{
|
|
316
|
+
let enc = compact_encode_apply_val((args)[i]);
|
|
317
|
+
if (__eliscript_truthy(enc)) {
|
|
318
|
+
(parts)["push"](enc);
|
|
319
|
+
} else {
|
|
320
|
+
((ok = false));
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
((i = (i + 1)));
|
|
324
|
+
}
|
|
325
|
+
if (__eliscript_truthy(ok)) {
|
|
326
|
+
return __eliscript_at_direct(parts, "join", "\t");
|
|
327
|
+
} else {
|
|
328
|
+
return null;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
} else {
|
|
332
|
+
return null;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
} else {
|
|
336
|
+
return null;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
function decode_bundle_scalar(tok) {
|
|
341
|
+
{
|
|
342
|
+
let tag = (tok)["charAt"](0);
|
|
343
|
+
if ((tag === "z")) {
|
|
344
|
+
return ({"hit": true, "tag": "v", "value": null});
|
|
345
|
+
} else {
|
|
346
|
+
if ((tag === "u")) {
|
|
347
|
+
return ({"hit": true, "tag": "v", "value": undefined});
|
|
348
|
+
} else {
|
|
349
|
+
if ((tag === "t")) {
|
|
350
|
+
return ({"hit": true, "tag": "v", "value": true});
|
|
351
|
+
} else {
|
|
352
|
+
if ((tag === "f")) {
|
|
353
|
+
return ({"hit": true, "tag": "v", "value": false});
|
|
354
|
+
} else {
|
|
355
|
+
if ((tag === "m")) {
|
|
356
|
+
return ({"hit": true, "tag": "v", "value": __eliscript_numeric_mul(-1, 0)});
|
|
357
|
+
} else {
|
|
358
|
+
if ((tag === "P")) {
|
|
359
|
+
return ({"hit": true, "tag": "v", "value": globalThis.Number.POSITIVE_INFINITY});
|
|
360
|
+
} else {
|
|
361
|
+
if ((tag === "M")) {
|
|
362
|
+
return ({"hit": true, "tag": "v", "value": globalThis.Number.NEGATIVE_INFINITY});
|
|
363
|
+
} else {
|
|
364
|
+
if ((tag === "Z")) {
|
|
365
|
+
return ({"hit": true, "tag": "v", "value": globalThis.Number.NaN});
|
|
366
|
+
} else {
|
|
367
|
+
if ((tag === "n")) {
|
|
368
|
+
return ({"hit": true, "tag": "v", "value": globalThis.Number((tok)["slice"](1))});
|
|
369
|
+
} else {
|
|
370
|
+
if (((tag === "S") || (tag === "Q"))) {
|
|
371
|
+
return ({"hit": true, "tag": "v", "value": compact_wire_decode_str(tok)});
|
|
372
|
+
} else {
|
|
373
|
+
if ((tag === "x")) {
|
|
374
|
+
{
|
|
375
|
+
let sep = (tok)["indexOf"](":");
|
|
376
|
+
let raw = normalize_u64(globalThis.BigInt((tok)["slice"](1, sep)));
|
|
377
|
+
let token = globalThis.Number((tok)["slice"]((sep + 1)));
|
|
378
|
+
return ({"hit": true, "tag": "x", "raw": raw, "token": token});
|
|
379
|
+
}
|
|
380
|
+
} else {
|
|
381
|
+
if ((tag === "o")) {
|
|
382
|
+
{
|
|
383
|
+
let sep = (tok)["indexOf"](":");
|
|
384
|
+
let raw = normalize_u64(globalThis.BigInt((tok)["slice"](1, sep)));
|
|
385
|
+
let ek = globalThis.Number((tok)["slice"]((sep + 1)));
|
|
386
|
+
return ({"hit": true, "tag": "o", "raw": raw, "valueKind": ek});
|
|
387
|
+
}
|
|
388
|
+
} else {
|
|
389
|
+
return ((__eliscript_value_12) => { throw __eliscript_value_12; })(new (globalThis.TypeError)("invalid compact bundle value"));
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
const FAST_GET_MISS = Object.freeze(({"hit": false}));
|
|
405
|
+
__eliscript_tdz_ready_3 = true;
|
|
246
406
|
async function openNodeNativeMemory(path, signatures, ...rest) {
|
|
247
407
|
return (await (async (options) => {
|
|
248
408
|
return (await (async (host_call) => {
|
|
@@ -251,7 +411,7 @@ async function openNodeNativeMemory(path, signatures, ...rest) {
|
|
|
251
411
|
return (await (async (signature_snapshot) => {
|
|
252
412
|
return (await (async () => {
|
|
253
413
|
if ((!((__eliscript_value_type(bun_executable) === "string") && __eliscript_numeric_relation(">", ((bun_executable) ?? []).length, 0)))) {
|
|
254
|
-
((
|
|
414
|
+
((__eliscript_value_13) => { throw __eliscript_value_13; })(new (globalThis.TypeError)("native Node transport requires a Bun executable"));
|
|
255
415
|
}
|
|
256
416
|
return (await (async (native_signatures) => {
|
|
257
417
|
return (await (async (buffer) => {
|
|
@@ -266,437 +426,687 @@ async function openNodeNativeMemory(path, signatures, ...rest) {
|
|
|
266
426
|
return (await (async (cached_last_error) => {
|
|
267
427
|
return (await (async (cached_heap_stats) => {
|
|
268
428
|
return (await (async (host_failures) => {
|
|
269
|
-
return (await (async (
|
|
270
|
-
return (await (async (
|
|
271
|
-
return (await (async () => {
|
|
272
|
-
(await (async () => {
|
|
273
|
-
|
|
274
|
-
return await (
|
|
275
|
-
{
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
429
|
+
return (await (async (fast_get_cache) => {
|
|
430
|
+
return (await (async (unadopted_pins) => {
|
|
431
|
+
return (await (async (unadopted_pin_total) => {
|
|
432
|
+
return (await (async (last_pin_heap) => {
|
|
433
|
+
return (await (async (decoder) => {
|
|
434
|
+
return (await (async (worker) => {
|
|
435
|
+
return (await (async () => {
|
|
436
|
+
(await (async () => {
|
|
437
|
+
try {
|
|
438
|
+
return await (new (globalThis.Promise)(((resolve_ready, reject_ready) => {
|
|
439
|
+
{
|
|
440
|
+
let ready = undefined;
|
|
441
|
+
let fail = undefined;
|
|
442
|
+
let exit = undefined;
|
|
443
|
+
let cleanup = undefined;
|
|
444
|
+
((cleanup = (() => {
|
|
445
|
+
(worker)["off"]("message", ready);
|
|
446
|
+
(worker)["off"]("error", fail);
|
|
447
|
+
return (worker)["off"]("exit", exit);
|
|
448
|
+
})));
|
|
449
|
+
((ready = ((message) => {
|
|
450
|
+
if ((!((message == null)) && __eliscript_truthy((message)["ready"]))) {
|
|
451
|
+
cleanup();
|
|
452
|
+
return resolve_ready(undefined);
|
|
453
|
+
} else {
|
|
454
|
+
if ((!((message == null)) && __eliscript_truthy((message)["startupFailure"]))) {
|
|
455
|
+
cleanup();
|
|
456
|
+
return reject_ready(remoteFailure((message)["startupFailure"]));
|
|
457
|
+
} else {
|
|
458
|
+
return null;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
})));
|
|
462
|
+
((fail = ((error) => {
|
|
463
|
+
cleanup();
|
|
464
|
+
return reject_ready(error);
|
|
465
|
+
})));
|
|
466
|
+
((exit = ((code) => {
|
|
467
|
+
cleanup();
|
|
468
|
+
return reject_ready(new (globalThis.Error)(("native transport exited before initialization: " + code)));
|
|
469
|
+
})));
|
|
470
|
+
(worker)["on"]("message", ready);
|
|
471
|
+
(worker)["once"]("error", fail);
|
|
472
|
+
return (worker)["once"]("exit", exit);
|
|
473
|
+
}
|
|
474
|
+
})));
|
|
475
|
+
} catch (error) {
|
|
476
|
+
await ((worker)["terminate"]());
|
|
477
|
+
return ((__eliscript_value_14) => { throw __eliscript_value_14; })(error);
|
|
478
|
+
}
|
|
479
|
+
})());
|
|
480
|
+
(worker)["on"]("error", ((error) => {
|
|
481
|
+
if ((terminal === undefined)) {
|
|
482
|
+
return ((terminal = error));
|
|
289
483
|
} else {
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
484
|
+
return null;
|
|
485
|
+
}
|
|
486
|
+
}));
|
|
487
|
+
(worker)["unref"]();
|
|
488
|
+
{
|
|
489
|
+
let stop = (() => {
|
|
490
|
+
if ((!__eliscript_truthy(stopped))) {
|
|
491
|
+
((stopped = true));
|
|
492
|
+
return (worker)["postMessage"](({"shutdown": true}));
|
|
293
493
|
} else {
|
|
294
494
|
return null;
|
|
295
495
|
}
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
((exit = ((code) => {
|
|
303
|
-
cleanup();
|
|
304
|
-
return reject_ready(new (globalThis.Error)(("native transport exited before initialization: " + code)));
|
|
305
|
-
})));
|
|
306
|
-
(worker)["on"]("message", ready);
|
|
307
|
-
(worker)["once"]("error", fail);
|
|
308
|
-
return (worker)["once"]("exit", exit);
|
|
309
|
-
}
|
|
310
|
-
})));
|
|
311
|
-
} catch (error) {
|
|
312
|
-
await ((worker)["terminate"]());
|
|
313
|
-
return ((__eliscript_value_13) => { throw __eliscript_value_13; })(error);
|
|
314
|
-
}
|
|
315
|
-
})());
|
|
316
|
-
(worker)["on"]("error", ((error) => {
|
|
317
|
-
if ((terminal === undefined)) {
|
|
318
|
-
return ((terminal = error));
|
|
319
|
-
} else {
|
|
320
|
-
return null;
|
|
321
|
-
}
|
|
322
|
-
}));
|
|
323
|
-
(worker)["unref"]();
|
|
324
|
-
{
|
|
325
|
-
let stop = (() => {
|
|
326
|
-
if ((!__eliscript_truthy(stopped))) {
|
|
327
|
-
((stopped = true));
|
|
328
|
-
return (worker)["postMessage"](({"shutdown": true}));
|
|
329
|
-
} else {
|
|
330
|
-
return null;
|
|
331
|
-
}
|
|
332
|
-
});
|
|
333
|
-
let active = (() => {
|
|
334
|
-
if (__eliscript_truthy(closed)) {
|
|
335
|
-
return ((__eliscript_value_14) => { throw __eliscript_value_14; })(new (globalThis.Error)("native memory is closed"));
|
|
336
|
-
} else {
|
|
337
|
-
return null;
|
|
338
|
-
}
|
|
339
|
-
});
|
|
340
|
-
let receive = (() => {
|
|
341
|
-
{
|
|
342
|
-
let result = undefined;
|
|
343
|
-
let done = false;
|
|
344
|
-
while (!(__eliscript_truthy(done))) {
|
|
345
|
-
if (!((terminal === undefined))) {
|
|
346
|
-
((__eliscript_value_15) => { throw __eliscript_value_15; })(terminal);
|
|
347
|
-
}
|
|
348
|
-
{
|
|
349
|
-
let status = Atomics.load(control, 0);
|
|
350
|
-
while ((status === 0)) {
|
|
351
|
-
Atomics.wait(control, 0, 0);
|
|
352
|
-
((status = Atomics.load(control, 0)));
|
|
353
|
-
}
|
|
354
|
-
if ((status === 2)) {
|
|
355
|
-
{
|
|
356
|
-
let length = Atomics.load(control, 1);
|
|
357
|
-
if (__eliscript_numeric_relation("<", length, 1)) {
|
|
358
|
-
((__eliscript_value_16) => { throw __eliscript_value_16; })(new (globalThis.Error)("invalid native transport buffer request"));
|
|
359
|
-
}
|
|
360
|
-
((buffer = new (globalThis.SharedArrayBuffer)(Math.max(__eliscript_numeric_mul((buffer)["byteLength"], 2), (length + 16)))));
|
|
361
|
-
((control = new (globalThis.Int32Array)(buffer, 0, 4)));
|
|
362
|
-
((payload = new (globalThis.Uint8Array)(buffer, 16)));
|
|
363
|
-
(worker)["postMessage"](({"buffer": buffer}));
|
|
496
|
+
});
|
|
497
|
+
let active = (() => {
|
|
498
|
+
if (__eliscript_truthy(closed)) {
|
|
499
|
+
return ((__eliscript_value_15) => { throw __eliscript_value_15; })(new (globalThis.Error)("native memory is closed"));
|
|
500
|
+
} else {
|
|
501
|
+
return null;
|
|
364
502
|
}
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
|
|
503
|
+
});
|
|
504
|
+
let invalidate_get_cache = (() => {
|
|
505
|
+
if (__eliscript_numeric_relation(">", (fast_get_cache)["size"], 0)) {
|
|
506
|
+
return (fast_get_cache)["clear"]();
|
|
507
|
+
} else {
|
|
508
|
+
return null;
|
|
509
|
+
}
|
|
510
|
+
});
|
|
511
|
+
let record_unadopted_pin = ((raw) => {
|
|
512
|
+
{
|
|
513
|
+
let cur = (unadopted_pins)["get"](raw);
|
|
514
|
+
(unadopted_pins)["set"](raw, ((cur === undefined) ? 1 : (cur + 1)));
|
|
515
|
+
return ((unadopted_pin_total = (unadopted_pin_total + 1)));
|
|
368
516
|
}
|
|
517
|
+
});
|
|
518
|
+
let parse_compact_p_response = ((text) => {
|
|
369
519
|
{
|
|
370
|
-
let
|
|
371
|
-
|
|
372
|
-
|
|
520
|
+
let parts = (text)["split"]("\t");
|
|
521
|
+
let id = globalThis.Number(((parts)[0])["slice"](1));
|
|
522
|
+
let kind = (parts)[1];
|
|
523
|
+
if ((!(__eliscript_truthy(Number.isSafeInteger(id)) && __eliscript_numeric_relation(">=", id, 1)))) {
|
|
524
|
+
((__eliscript_value_16) => { throw __eliscript_value_16; })(new (globalThis.TypeError)("invalid native compact result"));
|
|
373
525
|
}
|
|
374
|
-
{
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
if ((
|
|
378
|
-
(
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
526
|
+
if ((kind === "U")) {
|
|
527
|
+
return ({"id": id, "result": true, "lastError": 0});
|
|
528
|
+
} else {
|
|
529
|
+
if ((kind === "M")) {
|
|
530
|
+
return ({"id": id, "result": false, "lastError": 0});
|
|
531
|
+
} else {
|
|
532
|
+
if ((kind === "A")) {
|
|
533
|
+
{
|
|
534
|
+
let col = globalThis.Number((parts)[2]);
|
|
535
|
+
let rk = (parts)[3];
|
|
536
|
+
let res = ((rk === "i") ? ({"kind": "immediate", "raw": normalize_u64(globalThis.BigInt((parts)[4])), "collections": col, "pendingForeign": undefined}) : ((rk === "n") ? ({"kind": "number", "value": (((parts)[4] === "m") ? __eliscript_numeric_mul(-1, 0) : globalThis.Number((parts)[4])), "collections": col, "pendingForeign": undefined}) : ((rk === "s") ? ({"kind": "string", "value": compact_wire_decode_str((parts)[4]), "collections": col, "pendingForeign": undefined}) : ((rk === "p") ? ({"kind": "pinned", "raw": normalize_u64(globalThis.BigInt((parts)[4])), "valueKind": globalThis.Number((parts)[5]), "token": globalThis.Number((parts)[6]), "collections": col, "pendingForeign": undefined}) : ((__eliscript_value_17) => { throw __eliscript_value_17; })(new (globalThis.TypeError)("invalid compact apply result"))))));
|
|
537
|
+
return ({"id": id, "result": res, "lastError": 0});
|
|
538
|
+
}
|
|
539
|
+
} else {
|
|
540
|
+
if ((kind === "G")) {
|
|
541
|
+
if (__eliscript_numeric_relation(">", (fast_get_cache)["size"], 32768)) {
|
|
542
|
+
(fast_get_cache)["clear"]();
|
|
543
|
+
}
|
|
544
|
+
{
|
|
545
|
+
let pi = 2;
|
|
546
|
+
let plen = ((parts) ?? []).length;
|
|
547
|
+
while (__eliscript_numeric_relation("<", pi, plen)) {
|
|
548
|
+
{
|
|
549
|
+
let btag = (parts)[pi];
|
|
550
|
+
if ((btag === "Y")) {
|
|
551
|
+
{
|
|
552
|
+
let blkRaw = normalize_u64(globalThis.BigInt((parts)[(pi + 1)]));
|
|
553
|
+
let len = globalThis.Number((parts)[(pi + 2)]);
|
|
554
|
+
let cnt = globalThis.Number((parts)[(pi + 3)]);
|
|
555
|
+
let fields = new (globalThis.Map)();
|
|
556
|
+
let ei = 0;
|
|
557
|
+
((pi = (pi + 4)));
|
|
558
|
+
while (__eliscript_numeric_relation("<", ei, cnt)) {
|
|
559
|
+
{
|
|
560
|
+
let k = (parts)[pi];
|
|
561
|
+
let dv = decode_bundle_scalar((parts)[(pi + 1)]);
|
|
562
|
+
if (((dv)["tag"] === "o")) {
|
|
563
|
+
record_unadopted_pin((dv)["raw"]);
|
|
564
|
+
}
|
|
565
|
+
(fields)["set"](k, dv);
|
|
566
|
+
}
|
|
567
|
+
((pi = (pi + 2)), (ei = (ei + 1)));
|
|
568
|
+
}
|
|
569
|
+
(fast_get_cache)["set"](blkRaw, ({"isArr": true, "length": len, "fields": fields}));
|
|
570
|
+
}
|
|
571
|
+
} else {
|
|
572
|
+
if ((btag === "O")) {
|
|
573
|
+
{
|
|
574
|
+
let blkRaw = normalize_u64(globalThis.BigInt((parts)[(pi + 1)]));
|
|
575
|
+
let cnt = globalThis.Number((parts)[(pi + 2)]);
|
|
576
|
+
let fields = new (globalThis.Map)();
|
|
577
|
+
let ei = 0;
|
|
578
|
+
((pi = (pi + 3)));
|
|
579
|
+
while (__eliscript_numeric_relation("<", ei, cnt)) {
|
|
580
|
+
{
|
|
581
|
+
let k = compact_wire_decode_str((parts)[pi]);
|
|
582
|
+
let dv = decode_bundle_scalar((parts)[(pi + 1)]);
|
|
583
|
+
if (((dv)["tag"] === "o")) {
|
|
584
|
+
record_unadopted_pin((dv)["raw"]);
|
|
585
|
+
}
|
|
586
|
+
(fields)["set"](k, dv);
|
|
587
|
+
}
|
|
588
|
+
((pi = (pi + 2)), (ei = (ei + 1)));
|
|
589
|
+
}
|
|
590
|
+
(fast_get_cache)["set"](blkRaw, ({"isArr": false, "length": 0, "fields": fields}));
|
|
591
|
+
}
|
|
592
|
+
} else {
|
|
593
|
+
((__eliscript_value_18) => { throw __eliscript_value_18; })(new (globalThis.TypeError)("invalid compact bundle block"));
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
return ({"id": id, "result": true, "lastError": 0});
|
|
600
|
+
} else {
|
|
601
|
+
return ((__eliscript_value_19) => { throw __eliscript_value_19; })(new (globalThis.TypeError)("invalid native compact response"));
|
|
602
|
+
}
|
|
385
603
|
}
|
|
386
|
-
((result = record));
|
|
387
|
-
((done = true));
|
|
388
604
|
}
|
|
389
605
|
}
|
|
390
606
|
}
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
}
|
|
394
|
-
return result;
|
|
395
|
-
}
|
|
396
|
-
});
|
|
397
|
-
let exchange = ((method, args_arg = null) => {
|
|
398
|
-
if (__eliscript_truthy(stopped)) {
|
|
399
|
-
((__eliscript_value_22) => { throw __eliscript_value_22; })(new (globalThis.Error)("native memory is closed"));
|
|
400
|
-
}
|
|
401
|
-
((cached_heap_stats = undefined));
|
|
402
|
-
if (((method === "invoke") || (method === "open") || (method === "close"))) {
|
|
403
|
-
((cached_last_error = undefined));
|
|
404
|
-
}
|
|
405
|
-
((sequence = (sequence + 1)));
|
|
406
|
-
{
|
|
407
|
-
let id = sequence;
|
|
408
|
-
let args = ((args_arg == null) ? [] : args_arg);
|
|
409
|
-
let done = false;
|
|
410
|
-
let response_result = undefined;
|
|
411
|
-
((depth = (depth + 1)));
|
|
412
|
-
return (() => {
|
|
413
|
-
try {
|
|
414
|
-
{
|
|
415
|
-
let fast = ((method === "invoke") ? fast_invoke_request(id, args) : null);
|
|
416
|
-
(worker)["postMessage"](({"request": (__eliscript_truthy(fast) ? fast : JSON.stringify(({"id": id, "method": method, "args": args}), wire_replacer))}));
|
|
417
|
-
}
|
|
418
|
-
while (!(__eliscript_truthy(done))) {
|
|
607
|
+
});
|
|
608
|
+
let receive = (() => {
|
|
419
609
|
{
|
|
420
|
-
let
|
|
421
|
-
|
|
610
|
+
let result = undefined;
|
|
611
|
+
let done = false;
|
|
612
|
+
while (!(__eliscript_truthy(done))) {
|
|
613
|
+
if (!((terminal === undefined))) {
|
|
614
|
+
((__eliscript_value_20) => { throw __eliscript_value_20; })(terminal);
|
|
615
|
+
}
|
|
422
616
|
{
|
|
423
|
-
let
|
|
424
|
-
((
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
617
|
+
let status = Atomics.load(control, 0);
|
|
618
|
+
while ((status === 0)) {
|
|
619
|
+
Atomics.wait(control, 0, 0);
|
|
620
|
+
((status = Atomics.load(control, 0)));
|
|
621
|
+
}
|
|
622
|
+
if ((status === 2)) {
|
|
623
|
+
{
|
|
624
|
+
let length = Atomics.load(control, 1);
|
|
625
|
+
if (__eliscript_numeric_relation("<", length, 1)) {
|
|
626
|
+
((__eliscript_value_21) => { throw __eliscript_value_21; })(new (globalThis.Error)("invalid native transport buffer request"));
|
|
627
|
+
}
|
|
628
|
+
((buffer = new (globalThis.SharedArrayBuffer)(Math.max(__eliscript_numeric_mul((buffer)["byteLength"], 2), (length + 16)))));
|
|
629
|
+
((control = new (globalThis.Int32Array)(buffer, 0, 4)));
|
|
630
|
+
((payload = new (globalThis.Uint8Array)(buffer, 16)));
|
|
631
|
+
(worker)["postMessage"](({"buffer": buffer}));
|
|
632
|
+
}
|
|
633
|
+
} else {
|
|
634
|
+
if ((!(status === 1))) {
|
|
635
|
+
((__eliscript_value_22) => { throw __eliscript_value_22; })(new (globalThis.Error)("invalid native transport response state"));
|
|
636
|
+
}
|
|
637
|
+
{
|
|
638
|
+
let length = Atomics.load(control, 1);
|
|
639
|
+
if ((__eliscript_numeric_relation("<", length, 0) || __eliscript_numeric_relation(">", length, ((payload) ?? []).length))) {
|
|
640
|
+
((__eliscript_value_23) => { throw __eliscript_value_23; })(new (globalThis.Error)("invalid native transport response length"));
|
|
430
641
|
}
|
|
431
642
|
{
|
|
432
|
-
let
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
|
|
643
|
+
let text = (decoder)["decode"]((payload)["subarray"](0, length));
|
|
644
|
+
Atomics.store(control, 0, 0);
|
|
645
|
+
if ((Atomics.load(control, 2) !== 0)) {
|
|
646
|
+
(worker)["postMessage"](({"consumed": true}));
|
|
647
|
+
}
|
|
648
|
+
{
|
|
649
|
+
let record = (__eliscript_truthy((text)["startsWith"]("P")) ? parse_compact_p_response(text) : (__eliscript_truthy((text)["startsWith"]("R")) ? parse_fast_result(text) : JSON.parse(text, wire_reviver)));
|
|
650
|
+
if ((!((record == null)) && __eliscript_truthy((record)["transportFailure"]))) {
|
|
651
|
+
((terminal = remoteFailure((record)["transportFailure"])));
|
|
652
|
+
((__eliscript_value_24) => { throw __eliscript_value_24; })(terminal);
|
|
439
653
|
}
|
|
440
|
-
((
|
|
441
|
-
((
|
|
442
|
-
return (worker)["postMessage"](({"request": JSON.stringify(({"callback": (callback)["id"], "result": value}), wire_replacer)}));
|
|
654
|
+
((result = record));
|
|
655
|
+
((done = true));
|
|
443
656
|
}
|
|
444
657
|
}
|
|
445
|
-
} catch (error) {
|
|
446
|
-
((cached_last_error = undefined));
|
|
447
|
-
((host_sequence = (host_sequence + 1)));
|
|
448
|
-
{
|
|
449
|
-
let token = host_sequence;
|
|
450
|
-
(host_failures)["set"](token, error);
|
|
451
|
-
return (worker)["postMessage"](({"request": JSON.stringify(({"callback": (callback)["id"], "hostError": token}), wire_replacer)}));
|
|
452
|
-
}
|
|
453
658
|
}
|
|
454
|
-
}
|
|
659
|
+
}
|
|
455
660
|
}
|
|
456
|
-
}
|
|
661
|
+
}
|
|
662
|
+
return result;
|
|
663
|
+
}
|
|
664
|
+
});
|
|
665
|
+
let send_raw_and_wait = ((id, line) => {
|
|
666
|
+
if (__eliscript_truthy(stopped)) {
|
|
667
|
+
((__eliscript_value_25) => { throw __eliscript_value_25; })(new (globalThis.Error)("native memory is closed"));
|
|
668
|
+
}
|
|
669
|
+
((depth = (depth + 1)));
|
|
670
|
+
try {
|
|
671
|
+
(worker)["postMessage"](({"request": line}));
|
|
672
|
+
{
|
|
673
|
+
let message = receive();
|
|
457
674
|
if ((!(!((message == null)) && ((message)["id"] === id)))) {
|
|
458
|
-
((
|
|
459
|
-
}
|
|
460
|
-
if (__eliscript_truthy(Object.hasOwn(message, "hostError"))) {
|
|
461
|
-
if ((!__eliscript_truthy((host_failures)["has"]((message)["hostError"])))) {
|
|
462
|
-
((__eliscript_value_26) => { throw __eliscript_value_26; })(new (globalThis.Error)("unknown native host exception identity"));
|
|
463
|
-
}
|
|
464
|
-
{
|
|
465
|
-
let error = (host_failures)["get"]((message)["hostError"]);
|
|
466
|
-
(host_failures)["delete"]((message)["hostError"]);
|
|
467
|
-
((__eliscript_value_27) => { throw __eliscript_value_27; })(error);
|
|
468
|
-
}
|
|
675
|
+
((__eliscript_value_26) => { throw __eliscript_value_26; })(new (globalThis.Error)("native transport response belongs to a different invocation"));
|
|
469
676
|
}
|
|
470
677
|
if (__eliscript_truthy((message)["error"])) {
|
|
471
|
-
((
|
|
678
|
+
((__eliscript_value_27) => { throw __eliscript_value_27; })(remoteFailure((message)["error"]));
|
|
472
679
|
}
|
|
473
680
|
if (!(((message)["lastError"] === undefined))) {
|
|
474
681
|
((cached_last_error = (message)["lastError"]));
|
|
475
682
|
}
|
|
476
|
-
|
|
477
|
-
|
|
683
|
+
return (message)["result"];
|
|
684
|
+
}
|
|
685
|
+
} finally {
|
|
686
|
+
((depth = __eliscript_numeric_decrement(depth)));
|
|
687
|
+
if ((__eliscript_truthy(closed) && (depth === 0))) {
|
|
688
|
+
(host_failures)["clear"]();
|
|
689
|
+
stop();
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
});
|
|
693
|
+
let flush_unadopted_pins = ((heap, force) => {
|
|
694
|
+
if ((!(__eliscript_truthy(stopped)) && __eliscript_numeric_relation(">", unadopted_pin_total, 0) && (__eliscript_truthy(force) || __eliscript_numeric_relation(">=", unadopted_pin_total, 512)))) {
|
|
695
|
+
{
|
|
696
|
+
let target_heap = ((__eliscript_truthy(Number.isFinite(heap)) && __eliscript_numeric_relation(">", heap, 0)) ? heap : last_pin_heap);
|
|
697
|
+
if (__eliscript_numeric_relation(">", target_heap, 0)) {
|
|
698
|
+
invalidate_get_cache();
|
|
699
|
+
{
|
|
700
|
+
let items = [];
|
|
701
|
+
(unadopted_pins)["forEach"](((cnt, raw) => {
|
|
702
|
+
return (items)["push"](((cnt === 1) ? (String(raw)) : (String(raw) + String(":") + String(cnt))));
|
|
703
|
+
}));
|
|
704
|
+
(unadopted_pins)["clear"]();
|
|
705
|
+
((unadopted_pin_total = 0));
|
|
706
|
+
{
|
|
707
|
+
let start = 0;
|
|
708
|
+
let total = ((items) ?? []).length;
|
|
709
|
+
while (__eliscript_numeric_relation("<", start, total)) {
|
|
710
|
+
{
|
|
711
|
+
let end = Math.min((start + 1024), total);
|
|
712
|
+
((sequence = (sequence + 1)));
|
|
713
|
+
send_raw_and_wait(sequence, (String("U") + String(sequence) + String("\t") + String(target_heap) + String("\t") + String(__eliscript_at_direct((items)["slice"](start, end), "join", ","))));
|
|
714
|
+
((start = end));
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
return null;
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
} else {
|
|
721
|
+
return null;
|
|
478
722
|
}
|
|
479
|
-
((response_result = (message)["result"]));
|
|
480
|
-
((done = true));
|
|
481
723
|
}
|
|
724
|
+
} else {
|
|
725
|
+
return null;
|
|
482
726
|
}
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
727
|
+
});
|
|
728
|
+
let exchange = ((method, args_arg = null) => {
|
|
729
|
+
if (__eliscript_truthy(stopped)) {
|
|
730
|
+
((__eliscript_value_28) => { throw __eliscript_value_28; })(new (globalThis.Error)("native memory is closed"));
|
|
731
|
+
}
|
|
732
|
+
{
|
|
733
|
+
let args = ((args_arg == null) ? [] : args_arg);
|
|
734
|
+
if (((method === "close") || ((method === "invoke") && __eliscript_numeric_relation(">", ((args) ?? []).length, 1) && (((args)[0] === "heap-collect") || ((args)[0] === "heap-live") || ((args)[0] === "heap-used"))))) {
|
|
735
|
+
{
|
|
736
|
+
let fheap = ((method === "close") ? last_pin_heap : __eliscript_numeric_ushr((args)[1], 0));
|
|
737
|
+
flush_unadopted_pins(fheap, true);
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
{
|
|
741
|
+
let is_ro = ((__eliscript_value_29) => (__eliscript_truthy(__eliscript_value_29) ? __eliscript_value_29 : ((__eliscript_value_30) => (__eliscript_truthy(__eliscript_value_30) ? __eliscript_value_30 : ((__eliscript_value_31) => (__eliscript_truthy(__eliscript_value_31) ? __eliscript_value_31 : ((__eliscript_value_32) => (__eliscript_truthy(__eliscript_value_32) ? __eliscript_value_32 : ((__eliscript_value_33) => (__eliscript_truthy(__eliscript_value_33) ? __eliscript_value_33 : ((__eliscript_value_34) => (__eliscript_truthy(__eliscript_value_34) ? __eliscript_value_34 : ((__eliscript_value_35) => (__eliscript_truthy(__eliscript_value_35) ? ((__eliscript_value_36) => (__eliscript_truthy(__eliscript_value_36) ? ((__eliscript_tdz_ready_2 === true ? readonly_native_invokes : __eliscript_tdz_error("readonly_native_invokes")))["has"]((args)[0]) : __eliscript_value_36))(__eliscript_numeric_relation(">", ((args) ?? []).length, 0)) : __eliscript_value_35))((method === "invoke"))))((method === "read"))))((method === "getBigUint64"))))((method === "getFloat64"))))((method === "getUint32"))))((method === "getUint16"))))((method === "size"));
|
|
742
|
+
if ((!__eliscript_truthy(is_ro))) {
|
|
743
|
+
invalidate_get_cache();
|
|
744
|
+
}
|
|
745
|
+
((cached_heap_stats = undefined));
|
|
746
|
+
if (((method === "invoke") || (method === "open") || (method === "close"))) {
|
|
747
|
+
((cached_last_error = undefined));
|
|
748
|
+
}
|
|
749
|
+
((sequence = (sequence + 1)));
|
|
750
|
+
{
|
|
751
|
+
let id = sequence;
|
|
752
|
+
let done = false;
|
|
753
|
+
let response_result = undefined;
|
|
754
|
+
((depth = (depth + 1)));
|
|
755
|
+
try {
|
|
756
|
+
{
|
|
757
|
+
let fast = ((method === "invoke") ? fast_invoke_request(id, args) : ((method === "fastApply") ? compact_apply_request(id, (args)[0]) : null));
|
|
758
|
+
(worker)["postMessage"](({"request": (__eliscript_truthy(fast) ? fast : JSON.stringify(({"id": id, "method": method, "args": args}), wire_replacer))}));
|
|
759
|
+
}
|
|
760
|
+
while (!(__eliscript_truthy(done))) {
|
|
761
|
+
{
|
|
762
|
+
let message = receive();
|
|
763
|
+
if ((!((message == null)) && !(((message)["callback"] === undefined)))) {
|
|
764
|
+
{
|
|
765
|
+
let callback = (message)["callback"];
|
|
766
|
+
invalidate_get_cache();
|
|
767
|
+
((cached_heap_stats = undefined));
|
|
768
|
+
((cached_last_error = (__eliscript_truthy((callback)["tuple"]) ? 0 : undefined)));
|
|
769
|
+
try {
|
|
770
|
+
if ((!(__eliscript_value_type(host_call) === "function"))) {
|
|
771
|
+
((__eliscript_value_37) => { throw __eliscript_value_37; })(new (globalThis.TypeError)("native artifact requires an explicit host capability dispatcher"));
|
|
772
|
+
}
|
|
773
|
+
{
|
|
774
|
+
let value = (!(((callback)["tuple"] === undefined)) ? host_call((callback)["index"], (callback)["heap"], (callback)["argv"], (callback)["tuple"]) : host_call((callback)["index"], (callback)["heap"], (callback)["argv"]));
|
|
775
|
+
if ((!(((callback)["tuple"] === undefined)) && !((value === null)) && (__eliscript_value_type(value) === "object") && (__eliscript_value_type((value)["fastOp"]) === "string"))) {
|
|
776
|
+
((cached_last_error = undefined));
|
|
777
|
+
(worker)["postMessage"](({"request": JSON.stringify(({"callback": (callback)["id"], "fastOp": value}), wire_replacer)}));
|
|
778
|
+
} else {
|
|
779
|
+
if ((!(__eliscript_value_type(value) === "bigint"))) {
|
|
780
|
+
((__eliscript_value_38) => { throw __eliscript_value_38; })(new (globalThis.TypeError)("native host capability returned an invalid Val64"));
|
|
781
|
+
}
|
|
782
|
+
((value = normalize_u64(value)));
|
|
783
|
+
((cached_last_error = undefined));
|
|
784
|
+
(worker)["postMessage"](({"request": JSON.stringify(({"callback": (callback)["id"], "result": value}), wire_replacer)}));
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
} catch (error) {
|
|
788
|
+
((cached_last_error = undefined));
|
|
789
|
+
((host_sequence = (host_sequence + 1)));
|
|
790
|
+
{
|
|
791
|
+
let token = host_sequence;
|
|
792
|
+
(host_failures)["set"](token, error);
|
|
793
|
+
(worker)["postMessage"](({"request": JSON.stringify(({"callback": (callback)["id"], "hostError": token}), wire_replacer)}));
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
invalidate_get_cache();
|
|
797
|
+
}
|
|
798
|
+
} else {
|
|
799
|
+
if ((!(!((message == null)) && ((message)["id"] === id)))) {
|
|
800
|
+
((__eliscript_value_39) => { throw __eliscript_value_39; })(new (globalThis.Error)("native transport response belongs to a different invocation"));
|
|
801
|
+
}
|
|
802
|
+
if (__eliscript_truthy(Object.hasOwn(message, "hostError"))) {
|
|
803
|
+
if ((!__eliscript_truthy((host_failures)["has"]((message)["hostError"])))) {
|
|
804
|
+
((__eliscript_value_40) => { throw __eliscript_value_40; })(new (globalThis.Error)("unknown native host exception identity"));
|
|
805
|
+
}
|
|
806
|
+
{
|
|
807
|
+
let error = (host_failures)["get"]((message)["hostError"]);
|
|
808
|
+
(host_failures)["delete"]((message)["hostError"]);
|
|
809
|
+
((__eliscript_value_41) => { throw __eliscript_value_41; })(error);
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
if (__eliscript_truthy((message)["error"])) {
|
|
813
|
+
((__eliscript_value_42) => { throw __eliscript_value_42; })(remoteFailure((message)["error"]));
|
|
814
|
+
}
|
|
815
|
+
if (!(((message)["lastError"] === undefined))) {
|
|
816
|
+
((cached_last_error = (message)["lastError"]));
|
|
817
|
+
}
|
|
818
|
+
if (__eliscript_truthy(Array.isArray((message)["heapStats"]))) {
|
|
819
|
+
((cached_heap_stats = (message)["heapStats"]));
|
|
820
|
+
}
|
|
821
|
+
((response_result = (message)["result"]));
|
|
822
|
+
((done = true));
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
if ((!__eliscript_truthy(is_ro))) {
|
|
827
|
+
invalidate_get_cache();
|
|
828
|
+
}
|
|
829
|
+
return response_result;
|
|
830
|
+
} finally {
|
|
831
|
+
((depth = __eliscript_numeric_decrement(depth)));
|
|
832
|
+
if ((__eliscript_truthy(closed) && (depth === 0))) {
|
|
833
|
+
(host_failures)["clear"]();
|
|
834
|
+
stop();
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
});
|
|
841
|
+
let scalar_offset = ((offset) => {
|
|
842
|
+
active();
|
|
843
|
+
if ((!(__eliscript_truthy(Number.isSafeInteger(offset)) && __eliscript_numeric_relation(">=", offset, 0)))) {
|
|
844
|
+
return ((__eliscript_value_43) => { throw __eliscript_value_43; })(new (globalThis.RangeError)("memory access out of bounds"));
|
|
845
|
+
} else {
|
|
846
|
+
return null;
|
|
847
|
+
}
|
|
848
|
+
});
|
|
849
|
+
let range = ((offset, length) => {
|
|
850
|
+
active();
|
|
851
|
+
if ((!(__eliscript_truthy(Number.isSafeInteger(offset)) && __eliscript_truthy(Number.isSafeInteger(length)) && __eliscript_numeric_relation(">=", offset, 0) && __eliscript_numeric_relation(">=", length, 0)))) {
|
|
852
|
+
((__eliscript_value_44) => { throw __eliscript_value_44; })(new (globalThis.RangeError)("memory access out of bounds"));
|
|
853
|
+
}
|
|
854
|
+
if (__eliscript_numeric_relation(">", (offset + length), exchange("size"))) {
|
|
855
|
+
return ((__eliscript_value_45) => { throw __eliscript_value_45; })(new (globalThis.RangeError)("memory access out of bounds"));
|
|
856
|
+
} else {
|
|
857
|
+
return null;
|
|
858
|
+
}
|
|
859
|
+
});
|
|
860
|
+
try {
|
|
861
|
+
exchange("open", [path, signature_snapshot, configuration]);
|
|
862
|
+
} catch (error) {
|
|
863
|
+
((closed = true));
|
|
489
864
|
stop();
|
|
865
|
+
((__eliscript_value_46) => { throw __eliscript_value_46; })(error);
|
|
490
866
|
}
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
return null;
|
|
501
|
-
}
|
|
502
|
-
});
|
|
503
|
-
let range = ((offset, length) => {
|
|
504
|
-
active();
|
|
505
|
-
if ((!(__eliscript_truthy(Number.isSafeInteger(offset)) && __eliscript_truthy(Number.isSafeInteger(length)) && __eliscript_numeric_relation(">=", offset, 0) && __eliscript_numeric_relation(">=", length, 0)))) {
|
|
506
|
-
((__eliscript_value_30) => { throw __eliscript_value_30; })(new (globalThis.RangeError)("memory access out of bounds"));
|
|
507
|
-
}
|
|
508
|
-
if (__eliscript_numeric_relation(">", (offset + length), exchange("size"))) {
|
|
509
|
-
return ((__eliscript_value_31) => { throw __eliscript_value_31; })(new (globalThis.RangeError)("memory access out of bounds"));
|
|
510
|
-
} else {
|
|
511
|
-
return null;
|
|
512
|
-
}
|
|
513
|
-
});
|
|
514
|
-
(() => {
|
|
515
|
-
try {
|
|
516
|
-
return exchange("open", [path, signature_snapshot, configuration]);
|
|
517
|
-
} catch (error) {
|
|
518
|
-
((closed = true));
|
|
519
|
-
stop();
|
|
520
|
-
return ((__eliscript_value_32) => { throw __eliscript_value_32; })(error);
|
|
521
|
-
}
|
|
522
|
-
})();
|
|
523
|
-
{
|
|
524
|
-
let handle = ({"invoke": ((name, ...args) => {
|
|
525
|
-
active();
|
|
526
|
-
{
|
|
527
|
-
let signature = node_signature(native_signatures, name);
|
|
528
|
-
let arity = (signature)["arity"];
|
|
529
|
-
let types = (signature)["parameterTypes"];
|
|
530
|
-
if ((!(((args) ?? []).length === arity))) {
|
|
531
|
-
((__eliscript_value_33) => { throw __eliscript_value_33; })(new (globalThis.TypeError)("native memory argument count mismatch"));
|
|
532
|
-
}
|
|
533
|
-
{
|
|
534
|
-
let index = 0;
|
|
535
|
-
while (__eliscript_numeric_relation("<", index, ((args) ?? []).length)) {
|
|
536
|
-
{
|
|
537
|
-
let type = (types)[index];
|
|
538
|
-
let value = (args)[index];
|
|
539
|
-
if ((type === "u32")) {
|
|
540
|
-
if ((!(__eliscript_truthy(Number.isInteger(value)) && __eliscript_numeric_relation(">=", value, 0) && __eliscript_numeric_relation("<=", value, 4294967295)))) {
|
|
541
|
-
((__eliscript_value_34) => { throw __eliscript_value_34; })(new (globalThis.RangeError)("memory32 arguments must be u32"));
|
|
867
|
+
{
|
|
868
|
+
let handle = ({"invoke": ((name, ...args) => {
|
|
869
|
+
active();
|
|
870
|
+
{
|
|
871
|
+
let signature = node_signature(native_signatures, name);
|
|
872
|
+
let arity = (signature)["arity"];
|
|
873
|
+
let types = (signature)["parameterTypes"];
|
|
874
|
+
if ((!(((args) ?? []).length === arity))) {
|
|
875
|
+
((__eliscript_value_47) => { throw __eliscript_value_47; })(new (globalThis.TypeError)("native memory argument count mismatch"));
|
|
542
876
|
}
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
877
|
+
{
|
|
878
|
+
let index = 0;
|
|
879
|
+
while (__eliscript_numeric_relation("<", index, ((args) ?? []).length)) {
|
|
880
|
+
{
|
|
881
|
+
let type = (types)[index];
|
|
882
|
+
let value = (args)[index];
|
|
883
|
+
if ((type === "u32")) {
|
|
884
|
+
if ((!(__eliscript_truthy(Number.isInteger(value)) && __eliscript_numeric_relation(">=", value, 0) && __eliscript_numeric_relation("<=", value, 4294967295)))) {
|
|
885
|
+
((__eliscript_value_48) => { throw __eliscript_value_48; })(new (globalThis.RangeError)("memory32 arguments must be u32"));
|
|
886
|
+
}
|
|
887
|
+
} else {
|
|
888
|
+
if ((type === "f64")) {
|
|
889
|
+
if ((!(__eliscript_value_type(value) === "number"))) {
|
|
890
|
+
((__eliscript_value_49) => { throw __eliscript_value_49; })(new (globalThis.TypeError)("native f64 argument must be a number"));
|
|
891
|
+
}
|
|
892
|
+
} else {
|
|
893
|
+
if (((type === "v64") || (type === "bits64"))) {
|
|
894
|
+
if ((!(__eliscript_value_type(value) === "bigint"))) {
|
|
895
|
+
((__eliscript_value_50) => { throw __eliscript_value_50; })(new (globalThis.TypeError)("native v64 argument must be a bigint"));
|
|
896
|
+
}
|
|
897
|
+
} else {
|
|
898
|
+
((__eliscript_value_51) => { throw __eliscript_value_51; })(new (globalThis.TypeError)("unknown native argument type"));
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
((index = (index + 1)));
|
|
547
904
|
}
|
|
905
|
+
}
|
|
906
|
+
if (((name === "last-error") && (((args) ?? []).length === 0) && !((cached_last_error === undefined)))) {
|
|
907
|
+
return cached_last_error;
|
|
548
908
|
} else {
|
|
549
|
-
if (((
|
|
550
|
-
|
|
551
|
-
|
|
909
|
+
if (((((args) ?? []).length === 1) && __eliscript_truthy(Array.isArray(cached_heap_stats)) && ((args)[0] === (cached_heap_stats)[0]) && __eliscript_truthy((["heap-used", "heap-capacity", "heap-live", "frame-depth", "heap-collections"])["includes"](name)))) {
|
|
910
|
+
((cached_last_error = 0));
|
|
911
|
+
if ((name === "heap-used")) {
|
|
912
|
+
return (cached_heap_stats)[1];
|
|
913
|
+
} else {
|
|
914
|
+
if ((name === "heap-capacity")) {
|
|
915
|
+
return (cached_heap_stats)[2];
|
|
916
|
+
} else {
|
|
917
|
+
if ((name === "heap-live")) {
|
|
918
|
+
return (cached_heap_stats)[3];
|
|
919
|
+
} else {
|
|
920
|
+
if ((name === "frame-depth")) {
|
|
921
|
+
return (cached_heap_stats)[4];
|
|
922
|
+
} else {
|
|
923
|
+
return (cached_heap_stats)[5];
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
}
|
|
552
927
|
}
|
|
553
928
|
} else {
|
|
554
|
-
((
|
|
929
|
+
return node_decode_result((signature)["resultType"], exchange("invoke", ([name])["concat"](node_encode_args(types, args))));
|
|
555
930
|
}
|
|
556
931
|
}
|
|
557
932
|
}
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
return (cached_heap_stats)[1];
|
|
569
|
-
} else {
|
|
570
|
-
if ((name === "heap-capacity")) {
|
|
571
|
-
return (cached_heap_stats)[2];
|
|
933
|
+
}), "fastApply": ((spec) => {
|
|
934
|
+
active();
|
|
935
|
+
((cached_last_error = 0));
|
|
936
|
+
((last_pin_heap = __eliscript_numeric_ushr((spec)["heap"], 0)));
|
|
937
|
+
flush_unadopted_pins(last_pin_heap, false);
|
|
938
|
+
return exchange("fastApply", [spec]);
|
|
939
|
+
}), "fastGet": ((heap, raw, key) => {
|
|
940
|
+
active();
|
|
941
|
+
if (((__eliscript_value_type(key) !== "string") || (key === "__proto__"))) {
|
|
942
|
+
return (__eliscript_tdz_ready_3 === true ? FAST_GET_MISS : __eliscript_tdz_error("FAST_GET_MISS"));
|
|
572
943
|
} else {
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
if ((
|
|
577
|
-
|
|
944
|
+
((last_pin_heap = __eliscript_numeric_ushr(heap, 0)));
|
|
945
|
+
{
|
|
946
|
+
let cached = (fast_get_cache)["get"](raw);
|
|
947
|
+
if ((cached === undefined)) {
|
|
948
|
+
flush_unadopted_pins(last_pin_heap, false);
|
|
949
|
+
((sequence = (sequence + 1)));
|
|
950
|
+
{
|
|
951
|
+
let ok = send_raw_and_wait(sequence, (String("G") + String(sequence) + String("\t") + String(last_pin_heap) + String("\t") + String(normalize_u64(raw)) + String("\t") + String(compact_wire_encode_str(key))));
|
|
952
|
+
if (__eliscript_truthy(ok)) {
|
|
953
|
+
((cached = (fast_get_cache)["get"](raw)));
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
if ((cached === undefined)) {
|
|
958
|
+
return (__eliscript_tdz_ready_3 === true ? FAST_GET_MISS : __eliscript_tdz_error("FAST_GET_MISS"));
|
|
578
959
|
} else {
|
|
579
|
-
|
|
960
|
+
if ((__eliscript_truthy((cached)["isArr"]) && (key === "length"))) {
|
|
961
|
+
return ({"hit": true, "tag": "v", "value": (cached)["length"]});
|
|
962
|
+
} else {
|
|
963
|
+
{
|
|
964
|
+
let v = ((cached)["fields"])["get"](key);
|
|
965
|
+
if ((v === undefined)) {
|
|
966
|
+
return (__eliscript_tdz_ready_3 === true ? FAST_GET_MISS : __eliscript_tdz_error("FAST_GET_MISS"));
|
|
967
|
+
} else {
|
|
968
|
+
return v;
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
}
|
|
580
972
|
}
|
|
581
973
|
}
|
|
582
974
|
}
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
}), "getUint16": ((offset, endian) => {
|
|
598
|
-
scalar_offset(offset);
|
|
599
|
-
return exchange("getUint16", [offset, globalThis.Boolean(endian)]);
|
|
600
|
-
}), "getUint32": ((offset, endian) => {
|
|
601
|
-
scalar_offset(offset);
|
|
602
|
-
return exchange("getUint32", [offset, globalThis.Boolean(endian)]);
|
|
603
|
-
}), "getBigUint64": ((offset, endian) => {
|
|
604
|
-
scalar_offset(offset);
|
|
605
|
-
return node_decode_result("bits64", exchange("getBigUint64", [offset, globalThis.Boolean(endian)]));
|
|
606
|
-
}), "setBigUint64": ((offset, value, endian) => {
|
|
607
|
-
scalar_offset(offset);
|
|
608
|
-
if ((!(__eliscript_value_type(value) === "bigint"))) {
|
|
609
|
-
((__eliscript_value_38) => { throw __eliscript_value_38; })(new (globalThis.TypeError)("native 64-bit scalar write requires a bigint"));
|
|
610
|
-
}
|
|
611
|
-
exchange("setBigUint64", [offset, normalize_u64(value), globalThis.Boolean(endian)]);
|
|
612
|
-
return undefined;
|
|
613
|
-
}), "getFloat64": ((offset, endian) => {
|
|
614
|
-
scalar_offset(offset);
|
|
615
|
-
return exchange("getFloat64", [offset, globalThis.Boolean(endian)]);
|
|
616
|
-
}), "setUint16": ((offset, value, endian) => {
|
|
617
|
-
{
|
|
618
|
-
let converted = Math.trunc(value);
|
|
619
|
-
scalar_offset(offset);
|
|
620
|
-
exchange("setUint16", [offset, (__eliscript_truthy(Number.isFinite(converted)) ? __eliscript_numeric_or(converted, 0) : 0), globalThis.Boolean(endian)]);
|
|
621
|
-
return undefined;
|
|
622
|
-
}
|
|
623
|
-
}), "setUint32": ((offset, value, endian) => {
|
|
624
|
-
{
|
|
625
|
-
let converted = Math.trunc(value);
|
|
626
|
-
scalar_offset(offset);
|
|
627
|
-
exchange("setUint32", [offset, (__eliscript_truthy(Number.isFinite(converted)) ? __eliscript_numeric_ushr(converted, 0) : 0), globalThis.Boolean(endian)]);
|
|
628
|
-
return undefined;
|
|
629
|
-
}
|
|
630
|
-
}), "read": ((offset, length) => {
|
|
631
|
-
range(offset, length);
|
|
632
|
-
{
|
|
633
|
-
let result = new (globalThis.Uint8Array)(length);
|
|
634
|
-
let start = 0;
|
|
635
|
-
while ((__eliscript_numeric_relation("<", start, length) || (start === 0))) {
|
|
636
|
-
{
|
|
637
|
-
let count = Math.min((__eliscript_tdz_ready_1 === true ? nativeMemoryBlockBytes : __eliscript_tdz_error("nativeMemoryBlockBytes")), __eliscript_numeric_sub(length, start));
|
|
638
|
-
let encoded = exchange("read", [(offset + start), count]);
|
|
639
|
-
if ((!((__eliscript_value_type(encoded) === "string") && (((encoded) ?? []).length === __eliscript_numeric_mul(Math.ceil(__eliscript_numeric_div(count, 3)), 4))))) {
|
|
640
|
-
((__eliscript_value_39) => { throw __eliscript_value_39; })(new (globalThis.Error)("native memory read returned an invalid byte count"));
|
|
641
|
-
}
|
|
642
|
-
{
|
|
643
|
-
let bytes = Buffer.from(encoded, "base64");
|
|
644
|
-
if ((!((bytes)["byteLength"] === count))) {
|
|
645
|
-
((__eliscript_value_40) => { throw __eliscript_value_40; })(new (globalThis.Error)("native memory read returned an invalid byte count"));
|
|
975
|
+
}), "adoptFastGetPin": ((raw) => {
|
|
976
|
+
{
|
|
977
|
+
let cur = (unadopted_pins)["get"](raw);
|
|
978
|
+
if ((!((cur === undefined)) && __eliscript_numeric_relation(">", cur, 0))) {
|
|
979
|
+
if ((cur === 1)) {
|
|
980
|
+
(unadopted_pins)["delete"](raw);
|
|
981
|
+
} else {
|
|
982
|
+
(unadopted_pins)["set"](raw, __eliscript_numeric_decrement(cur));
|
|
983
|
+
}
|
|
984
|
+
((unadopted_pin_total = __eliscript_numeric_decrement(unadopted_pin_total)));
|
|
985
|
+
return true;
|
|
986
|
+
} else {
|
|
987
|
+
return false;
|
|
988
|
+
}
|
|
646
989
|
}
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
990
|
+
}), "releaseBatch": ((heap, raws) => {
|
|
991
|
+
active();
|
|
992
|
+
if ((__eliscript_truthy(Array.isArray(raws)) && __eliscript_numeric_relation(">", ((raws) ?? []).length, 0))) {
|
|
993
|
+
((cached_last_error = 0));
|
|
994
|
+
{
|
|
995
|
+
let target_heap = __eliscript_numeric_ushr(heap, 0);
|
|
996
|
+
((sequence = (sequence + 1)));
|
|
997
|
+
send_raw_and_wait(sequence, (String("U") + String(sequence) + String("\t") + String(target_heap) + String("\t") + String(__eliscript_at_direct(raws, "join", ","))));
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
return undefined;
|
|
1001
|
+
}), "fastRaw": ((spec) => {
|
|
1002
|
+
active();
|
|
1003
|
+
((cached_last_error = 0));
|
|
1004
|
+
return exchange("fastRaw", [spec]);
|
|
1005
|
+
}), "getUint16": ((offset, endian) => {
|
|
1006
|
+
scalar_offset(offset);
|
|
1007
|
+
return exchange("getUint16", [offset, globalThis.Boolean(endian)]);
|
|
1008
|
+
}), "getUint32": ((offset, endian) => {
|
|
1009
|
+
scalar_offset(offset);
|
|
1010
|
+
return exchange("getUint32", [offset, globalThis.Boolean(endian)]);
|
|
1011
|
+
}), "getBigUint64": ((offset, endian) => {
|
|
1012
|
+
scalar_offset(offset);
|
|
1013
|
+
return node_decode_result("bits64", exchange("getBigUint64", [offset, globalThis.Boolean(endian)]));
|
|
1014
|
+
}), "setBigUint64": ((offset, value, endian) => {
|
|
1015
|
+
scalar_offset(offset);
|
|
1016
|
+
if ((!(__eliscript_value_type(value) === "bigint"))) {
|
|
1017
|
+
((__eliscript_value_52) => { throw __eliscript_value_52; })(new (globalThis.TypeError)("native 64-bit scalar write requires a bigint"));
|
|
1018
|
+
}
|
|
1019
|
+
exchange("setBigUint64", [offset, normalize_u64(value), globalThis.Boolean(endian)]);
|
|
1020
|
+
return undefined;
|
|
1021
|
+
}), "getFloat64": ((offset, endian) => {
|
|
1022
|
+
scalar_offset(offset);
|
|
1023
|
+
return exchange("getFloat64", [offset, globalThis.Boolean(endian)]);
|
|
1024
|
+
}), "setUint16": ((offset, value, endian) => {
|
|
1025
|
+
{
|
|
1026
|
+
let converted = Math.trunc(value);
|
|
1027
|
+
scalar_offset(offset);
|
|
1028
|
+
exchange("setUint16", [offset, (__eliscript_truthy(Number.isFinite(converted)) ? __eliscript_numeric_or(converted, 0) : 0), globalThis.Boolean(endian)]);
|
|
1029
|
+
return undefined;
|
|
1030
|
+
}
|
|
1031
|
+
}), "setUint32": ((offset, value, endian) => {
|
|
1032
|
+
{
|
|
1033
|
+
let converted = Math.trunc(value);
|
|
1034
|
+
scalar_offset(offset);
|
|
1035
|
+
exchange("setUint32", [offset, (__eliscript_truthy(Number.isFinite(converted)) ? __eliscript_numeric_ushr(converted, 0) : 0), globalThis.Boolean(endian)]);
|
|
1036
|
+
return undefined;
|
|
1037
|
+
}
|
|
1038
|
+
}), "read": ((offset, length) => {
|
|
1039
|
+
range(offset, length);
|
|
1040
|
+
{
|
|
1041
|
+
let result = new (globalThis.Uint8Array)(length);
|
|
1042
|
+
let start = 0;
|
|
1043
|
+
while ((__eliscript_numeric_relation("<", start, length) || (start === 0))) {
|
|
1044
|
+
{
|
|
1045
|
+
let count = Math.min((__eliscript_tdz_ready_1 === true ? nativeMemoryBlockBytes : __eliscript_tdz_error("nativeMemoryBlockBytes")), __eliscript_numeric_sub(length, start));
|
|
1046
|
+
let encoded = exchange("read", [(offset + start), count]);
|
|
1047
|
+
if ((!((__eliscript_value_type(encoded) === "string") && (((encoded) ?? []).length === __eliscript_numeric_mul(Math.ceil(__eliscript_numeric_div(count, 3)), 4))))) {
|
|
1048
|
+
((__eliscript_value_53) => { throw __eliscript_value_53; })(new (globalThis.Error)("native memory read returned an invalid byte count"));
|
|
1049
|
+
}
|
|
1050
|
+
{
|
|
1051
|
+
let bytes = Buffer.from(encoded, "base64");
|
|
1052
|
+
if ((!((bytes)["byteLength"] === count))) {
|
|
1053
|
+
((__eliscript_value_54) => { throw __eliscript_value_54; })(new (globalThis.Error)("native memory read returned an invalid byte count"));
|
|
1054
|
+
}
|
|
1055
|
+
(result)["set"](bytes, start);
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
((start = (start + (__eliscript_tdz_ready_1 === true ? nativeMemoryBlockBytes : __eliscript_tdz_error("nativeMemoryBlockBytes")))));
|
|
1059
|
+
}
|
|
1060
|
+
return result;
|
|
1061
|
+
}
|
|
1062
|
+
}), "write": ((input, ...write_rest) => {
|
|
1063
|
+
{
|
|
1064
|
+
let offset = (((((write_rest) ?? []).length === 0) || ((write_rest)[0] === undefined)) ? 0 : (write_rest)[0]);
|
|
1065
|
+
active();
|
|
1066
|
+
if ((!__eliscript_truthy(__eliscript_at(globalThis.Uint8Array, (globalThis.Symbol)["hasInstance"])(input)))) {
|
|
1067
|
+
((__eliscript_value_55) => { throw __eliscript_value_55; })(new (globalThis.TypeError)("memory write requires Uint8Array"));
|
|
1068
|
+
}
|
|
1069
|
+
{
|
|
1070
|
+
let bytes = Buffer.from(input);
|
|
1071
|
+
let start = 0;
|
|
1072
|
+
range(offset, (bytes)["byteLength"]);
|
|
1073
|
+
while ((__eliscript_numeric_relation("<", start, (bytes)["byteLength"]) || (start === 0))) {
|
|
1074
|
+
exchange("write", [__eliscript_at(bytes, "toString")("base64", start, Math.min((start + (__eliscript_tdz_ready_1 === true ? nativeMemoryBlockBytes : __eliscript_tdz_error("nativeMemoryBlockBytes"))), (bytes)["byteLength"])), (offset + start)]);
|
|
1075
|
+
((start = (start + (__eliscript_tdz_ready_1 === true ? nativeMemoryBlockBytes : __eliscript_tdz_error("nativeMemoryBlockBytes")))));
|
|
1076
|
+
}
|
|
1077
|
+
return undefined;
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
}), "close": (() => {
|
|
1081
|
+
if ((!__eliscript_truthy(closed))) {
|
|
1082
|
+
try {
|
|
1083
|
+
exchange("close");
|
|
1084
|
+
} finally {
|
|
1085
|
+
((closed = true));
|
|
1086
|
+
if ((depth === 0)) {
|
|
1087
|
+
(host_failures)["clear"]();
|
|
1088
|
+
stop();
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
return undefined;
|
|
1092
|
+
} else {
|
|
1093
|
+
return null;
|
|
1094
|
+
}
|
|
1095
|
+
})});
|
|
1096
|
+
Object.defineProperty(handle, "byteLength", ({"get": (() => {
|
|
1097
|
+
active();
|
|
1098
|
+
return exchange("size");
|
|
1099
|
+
}), "enumerable": true, "configurable": true}));
|
|
1100
|
+
return Object.freeze(handle);
|
|
668
1101
|
}
|
|
669
|
-
return undefined;
|
|
670
1102
|
}
|
|
671
|
-
}
|
|
672
|
-
}), "
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
((closed = true));
|
|
679
|
-
if ((depth === 0)) {
|
|
680
|
-
(host_failures)["clear"]();
|
|
681
|
-
stop();
|
|
682
|
-
}
|
|
683
|
-
}
|
|
684
|
-
})();
|
|
685
|
-
return undefined;
|
|
686
|
-
} else {
|
|
687
|
-
return null;
|
|
688
|
-
}
|
|
689
|
-
})});
|
|
690
|
-
Object.defineProperty(handle, "byteLength", ({"get": (() => {
|
|
691
|
-
active();
|
|
692
|
-
return exchange("size");
|
|
693
|
-
}), "enumerable": true, "configurable": true}));
|
|
694
|
-
return Object.freeze(handle);
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
})());
|
|
698
|
-
})(new (Worker)(new (globalThis.URL)("./native-node-worker.mjs", memory_module_url()), ({"workerData": ({"buffer": buffer, "bunExecutable": bun_executable}), "execArgv": [], "env": Object.assign(({}), (globalThis.process)["env"], ({"NODE_OPTIONS": ""}))}))));
|
|
699
|
-
})(new (globalThis.TextDecoder)()));
|
|
1103
|
+
})());
|
|
1104
|
+
})(new (Worker)(new (globalThis.URL)("./native-node-worker.mjs", memory_module_url()), ({"workerData": ({"buffer": buffer, "bunExecutable": bun_executable}), "execArgv": [], "env": Object.assign(({}), (globalThis.process)["env"], ({"NODE_OPTIONS": ""}))}))));
|
|
1105
|
+
})(new (globalThis.TextDecoder)()));
|
|
1106
|
+
})(0));
|
|
1107
|
+
})(0));
|
|
1108
|
+
})(new (globalThis.Map)()));
|
|
1109
|
+
})(new (globalThis.Map)()));
|
|
700
1110
|
})(new (globalThis.Map)()));
|
|
701
1111
|
})(undefined));
|
|
702
1112
|
})(undefined));
|