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
|
@@ -5,6 +5,16 @@ var __eliscript_tdz_ready_1;
|
|
|
5
5
|
var __eliscript_tdz_ready_2;
|
|
6
6
|
var __eliscript_tdz_ready_3;
|
|
7
7
|
var __eliscript_tdz_ready_4;
|
|
8
|
+
var __eliscript_tdz_ready_5;
|
|
9
|
+
var __eliscript_tdz_ready_6;
|
|
10
|
+
var __eliscript_tdz_ready_7;
|
|
11
|
+
var __eliscript_tdz_ready_8;
|
|
12
|
+
var __eliscript_tdz_ready_9;
|
|
13
|
+
var __eliscript_tdz_ready_10;
|
|
14
|
+
var __eliscript_tdz_ready_11;
|
|
15
|
+
function __eliscript_tdz_write_11(__eliscript_tdz_value_11) { if (__eliscript_tdz_ready_11 !== true) __eliscript_tdz_error("dlopen_staging_dir"); return (dlopen_staging_dir = __eliscript_tdz_value_11); }
|
|
16
|
+
var __eliscript_tdz_ready_12;
|
|
17
|
+
function __eliscript_tdz_write_12(__eliscript_tdz_value_12) { if (__eliscript_tdz_ready_12 !== true) __eliscript_tdz_error("dlopen_staging_serial"); return (dlopen_staging_serial = __eliscript_tdz_value_12); }
|
|
8
18
|
import "eliscript/runtime/unicode-case.mjs";
|
|
9
19
|
import "eliscript/runtime/math.mjs";
|
|
10
20
|
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";
|
|
@@ -13,10 +23,12 @@ const __eliscript_truthy = (value) => value !== false && value != null;
|
|
|
13
23
|
|
|
14
24
|
import {Buffer} from "node:buffer";
|
|
15
25
|
import {createHash} from "node:crypto";
|
|
16
|
-
import {closeSync, fstatSync, openSync, readSync} from "node:fs";
|
|
26
|
+
import {closeSync, copyFileSync, existsSync, fstatSync, mkdirSync, openSync, readSync, renameSync, rmSync} from "node:fs";
|
|
17
27
|
import {createRequire} from "node:module";
|
|
28
|
+
import {tmpdir} from "node:os";
|
|
18
29
|
import * as node_path from "node:path";
|
|
19
30
|
import {createCompilerDebugMap} from "./compiler-debug.mjs";
|
|
31
|
+
import {openNodeInProcessFFI} from "./native-node-ffi.mjs";
|
|
20
32
|
import {openNodeNativeMemory} from "./native-node-memory.mjs";
|
|
21
33
|
const default_libc_cache = new (globalThis.WeakMap)();
|
|
22
34
|
__eliscript_tdz_ready_0 = true;
|
|
@@ -24,10 +36,19 @@ const callback_pool_cache = new (globalThis.WeakMap)();
|
|
|
24
36
|
__eliscript_tdz_ready_1 = true;
|
|
25
37
|
const library_pool_cache = new (globalThis.WeakMap)();
|
|
26
38
|
__eliscript_tdz_ready_2 = true;
|
|
27
|
-
const
|
|
39
|
+
const owned_invoker_tables = new (globalThis.WeakMap)();
|
|
28
40
|
__eliscript_tdz_ready_3 = true;
|
|
29
|
-
|
|
41
|
+
function nativeMemoryInvokers(owned) {
|
|
42
|
+
return ((__eliscript_tdz_ready_3 === true ? owned_invoker_tables : __eliscript_tdz_error("owned_invoker_tables")))["get"](owned);
|
|
43
|
+
}
|
|
44
|
+
const max_cached_library_bytes = 67108864;
|
|
30
45
|
__eliscript_tdz_ready_4 = true;
|
|
46
|
+
const library_hash_chunk_bytes = 65536;
|
|
47
|
+
__eliscript_tdz_ready_5 = true;
|
|
48
|
+
const U64_ZERO = globalThis.BigInt(0);
|
|
49
|
+
__eliscript_tdz_ready_6 = true;
|
|
50
|
+
const U64_MAX = globalThis.BigInt("18446744073709551615");
|
|
51
|
+
__eliscript_tdz_ready_7 = true;
|
|
31
52
|
function bun_gc_sweep() {
|
|
32
53
|
{
|
|
33
54
|
let bun = globalThis.Bun;
|
|
@@ -69,8 +90,8 @@ function memory_copy(source) {
|
|
|
69
90
|
function nativePlatform(target) {
|
|
70
91
|
{
|
|
71
92
|
let actual = (((globalThis.process)["platform"] === "darwin") ? "arm64-macos" : (((globalThis.process)["platform"] === "linux") ? "arm64-linux" : null));
|
|
72
|
-
if ((((
|
|
73
|
-
((
|
|
93
|
+
if ((((globalThis.process)["arch"] !== "arm64") || (actual === null) || (!((target === undefined)) && !((target === actual))))) {
|
|
94
|
+
((__eliscript_value_1) => { throw __eliscript_value_1; })(new (globalThis.Error)("native memory requires the matching arm64-macos or arm64-linux host"));
|
|
74
95
|
}
|
|
75
96
|
return actual;
|
|
76
97
|
}
|
|
@@ -96,42 +117,36 @@ function openDefaultLibc(ffi, platform) {
|
|
|
96
117
|
let index = 0;
|
|
97
118
|
bun_gc_sweep();
|
|
98
119
|
while ((__eliscript_numeric_relation("<", index, ((names) ?? []).length) && !(__eliscript_truthy(memory_truth(libc))))) {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
})();
|
|
120
|
+
try {
|
|
121
|
+
((libc = (ffi)["dlopen"]((names)[index], signatures)));
|
|
122
|
+
} catch (error) {
|
|
123
|
+
((failure = error));
|
|
124
|
+
}
|
|
106
125
|
((index = (index + 1)));
|
|
107
126
|
}
|
|
108
127
|
if ((!__eliscript_truthy(memory_truth(libc)))) {
|
|
109
|
-
((
|
|
128
|
+
((__eliscript_value_2) => { throw __eliscript_value_2; })(new (globalThis.Error)((__eliscript_truthy(mac) ? "unable to load macOS virtual memory functions" : "unable to load Linux virtual memory functions"), ({"cause": failure})));
|
|
110
129
|
}
|
|
111
|
-
|
|
112
|
-
|
|
130
|
+
try {
|
|
131
|
+
{
|
|
132
|
+
let page = ((libc)["symbols"])["getpagesize"]();
|
|
133
|
+
if ((!(__eliscript_truthy(Number.isSafeInteger(page)) && __eliscript_numeric_relation(">", page, 0) && (__eliscript_numeric_and(page, __eliscript_numeric_decrement(page)) === 0)))) {
|
|
134
|
+
((__eliscript_value_3) => { throw __eliscript_value_3; })(new (globalThis.Error)((__eliscript_truthy(mac) ? "invalid macOS memory page size" : "invalid Linux memory page size")));
|
|
135
|
+
}
|
|
113
136
|
{
|
|
114
|
-
let
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
118
|
-
{
|
|
119
|
-
let entry = ({"libc": libc, "page": page});
|
|
120
|
-
(by_platform)["set"](platform, entry);
|
|
121
|
-
return entry;
|
|
122
|
-
}
|
|
137
|
+
let entry = ({"libc": libc, "page": page});
|
|
138
|
+
(by_platform)["set"](platform, entry);
|
|
139
|
+
return entry;
|
|
123
140
|
}
|
|
124
|
-
} catch (error) {
|
|
125
|
-
(() => {
|
|
126
|
-
try {
|
|
127
|
-
return (libc)["close"]();
|
|
128
|
-
} catch (ignored) {
|
|
129
|
-
return null;
|
|
130
|
-
}
|
|
131
|
-
})();
|
|
132
|
-
return ((__eliscript_value_6) => { throw __eliscript_value_6; })(error);
|
|
133
141
|
}
|
|
134
|
-
}
|
|
142
|
+
} catch (error) {
|
|
143
|
+
try {
|
|
144
|
+
(libc)["close"]();
|
|
145
|
+
} catch (ignored) {
|
|
146
|
+
null;
|
|
147
|
+
}
|
|
148
|
+
return ((__eliscript_value_4) => { throw __eliscript_value_4; })(error);
|
|
149
|
+
}
|
|
135
150
|
}
|
|
136
151
|
}
|
|
137
152
|
}
|
|
@@ -156,20 +171,18 @@ function acquireHostCallback(ffi, handler) {
|
|
|
156
171
|
let _ = bun_gc_sweep();
|
|
157
172
|
let raw = new ((ffi)["JSCallback"])(((actualContext, index, heap, argv) => {
|
|
158
173
|
if ((active_handler === null)) {
|
|
159
|
-
return ((
|
|
174
|
+
return ((__eliscript_value_5) => { throw __eliscript_value_5; })(new (globalThis.Error)("native host callback is outside its active invocation"));
|
|
160
175
|
} else {
|
|
161
176
|
return active_handler(actualContext, index, heap, argv);
|
|
162
177
|
}
|
|
163
178
|
}), ({"args": ["ptr", "u32", "u32", "u64"], "returns": "u64", "threadsafe": false}));
|
|
164
179
|
if (((raw)["ptr"] === null)) {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
})();
|
|
172
|
-
((__eliscript_value_8) => { throw __eliscript_value_8; })(new (globalThis.Error)("unable to create native host callback"));
|
|
180
|
+
try {
|
|
181
|
+
(raw)["close"]();
|
|
182
|
+
} catch (ignored) {
|
|
183
|
+
null;
|
|
184
|
+
}
|
|
185
|
+
((__eliscript_value_6) => { throw __eliscript_value_6; })(new (globalThis.Error)("unable to create native host callback"));
|
|
173
186
|
}
|
|
174
187
|
{
|
|
175
188
|
let released = false;
|
|
@@ -195,62 +208,56 @@ function acquireHostCallback(ffi, handler) {
|
|
|
195
208
|
}
|
|
196
209
|
}
|
|
197
210
|
function boundedFileIdentity(file_path) {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
211
|
+
try {
|
|
212
|
+
{
|
|
213
|
+
let fd = openSync(file_path, "r");
|
|
214
|
+
try {
|
|
215
|
+
{
|
|
216
|
+
let stat = fstatSync(fd);
|
|
217
|
+
if ((!(__eliscript_truthy((stat)["isFile"]())) || !(__eliscript_truthy(Number.isSafeInteger((stat)["size"]))) || __eliscript_numeric_relation("<", (stat)["size"], 0) || __eliscript_numeric_relation(">", (stat)["size"], (__eliscript_tdz_ready_4 === true ? max_cached_library_bytes : __eliscript_tdz_error("max_cached_library_bytes"))))) {
|
|
218
|
+
return null;
|
|
219
|
+
} else {
|
|
204
220
|
{
|
|
205
|
-
let
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
221
|
+
let chunk = Buffer.allocUnsafe((__eliscript_tdz_ready_5 === true ? library_hash_chunk_bytes : __eliscript_tdz_error("library_hash_chunk_bytes")));
|
|
222
|
+
let hash = createHash("sha256");
|
|
223
|
+
let total = 0;
|
|
224
|
+
let aborted = false;
|
|
225
|
+
let done = false;
|
|
226
|
+
while ((!(__eliscript_truthy(done)) && !(__eliscript_truthy(aborted)))) {
|
|
209
227
|
{
|
|
210
|
-
let
|
|
211
|
-
let
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
let done = false;
|
|
215
|
-
while ((!(__eliscript_truthy(done)) && !(__eliscript_truthy(aborted)))) {
|
|
216
|
-
{
|
|
217
|
-
let want = Math.min((__eliscript_tdz_ready_4 === true ? library_hash_chunk_bytes : __eliscript_tdz_error("library_hash_chunk_bytes")), (__eliscript_numeric_sub((__eliscript_tdz_ready_3 === true ? max_cached_library_bytes : __eliscript_tdz_error("max_cached_library_bytes")), total) + 1));
|
|
218
|
-
let count = readSync(fd, chunk, 0, want, total);
|
|
219
|
-
if (__eliscript_numeric_relation("<=", count, 0)) {
|
|
220
|
-
((done = true));
|
|
221
|
-
} else {
|
|
222
|
-
((total = (total + count)));
|
|
223
|
-
if (__eliscript_numeric_relation(">", total, (__eliscript_tdz_ready_3 === true ? max_cached_library_bytes : __eliscript_tdz_error("max_cached_library_bytes")))) {
|
|
224
|
-
((aborted = true));
|
|
225
|
-
} else {
|
|
226
|
-
(hash)["update"]((chunk)["subarray"](0, count));
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
if (__eliscript_truthy(aborted)) {
|
|
232
|
-
return null;
|
|
228
|
+
let want = Math.min((__eliscript_tdz_ready_5 === true ? library_hash_chunk_bytes : __eliscript_tdz_error("library_hash_chunk_bytes")), (__eliscript_numeric_sub((__eliscript_tdz_ready_4 === true ? max_cached_library_bytes : __eliscript_tdz_error("max_cached_library_bytes")), total) + 1));
|
|
229
|
+
let count = readSync(fd, chunk, 0, want, total);
|
|
230
|
+
if (__eliscript_numeric_relation("<=", count, 0)) {
|
|
231
|
+
((done = true));
|
|
233
232
|
} else {
|
|
234
|
-
|
|
233
|
+
((total = (total + count)));
|
|
234
|
+
if (__eliscript_numeric_relation(">", total, (__eliscript_tdz_ready_4 === true ? max_cached_library_bytes : __eliscript_tdz_error("max_cached_library_bytes")))) {
|
|
235
|
+
((aborted = true));
|
|
236
|
+
} else {
|
|
237
|
+
(hash)["update"]((chunk)["subarray"](0, count));
|
|
238
|
+
}
|
|
235
239
|
}
|
|
236
240
|
}
|
|
237
241
|
}
|
|
238
|
-
|
|
239
|
-
} finally {
|
|
240
|
-
(() => {
|
|
241
|
-
try {
|
|
242
|
-
return closeSync(fd);
|
|
243
|
-
} catch (ignored) {
|
|
242
|
+
if (__eliscript_truthy(aborted)) {
|
|
244
243
|
return null;
|
|
244
|
+
} else {
|
|
245
|
+
return (String(total) + String(":") + String((hash)["digest"]("hex")));
|
|
245
246
|
}
|
|
246
|
-
}
|
|
247
|
+
}
|
|
247
248
|
}
|
|
248
|
-
}
|
|
249
|
+
}
|
|
250
|
+
} finally {
|
|
251
|
+
try {
|
|
252
|
+
closeSync(fd);
|
|
253
|
+
} catch (ignored) {
|
|
254
|
+
null;
|
|
255
|
+
}
|
|
249
256
|
}
|
|
250
|
-
} catch (ignored) {
|
|
251
|
-
return null;
|
|
252
257
|
}
|
|
253
|
-
}
|
|
258
|
+
} catch (ignored) {
|
|
259
|
+
return null;
|
|
260
|
+
}
|
|
254
261
|
}
|
|
255
262
|
function native_ffi_type(type) {
|
|
256
263
|
if ((type === "u32")) {
|
|
@@ -262,7 +269,7 @@ function native_ffi_type(type) {
|
|
|
262
269
|
if (((type === "v64") || (type === "bits64"))) {
|
|
263
270
|
return "u64";
|
|
264
271
|
} else {
|
|
265
|
-
return ((
|
|
272
|
+
return ((__eliscript_value_7) => { throw __eliscript_value_7; })(new (globalThis.TypeError)("unknown native parameter type"));
|
|
266
273
|
}
|
|
267
274
|
}
|
|
268
275
|
}
|
|
@@ -272,66 +279,108 @@ function native_parameter_types(signature, expected_arity) {
|
|
|
272
279
|
let types = (signature)["parameterTypes"];
|
|
273
280
|
let result = (signature)["resultType"];
|
|
274
281
|
if ((!(__eliscript_truthy(Array.isArray(types)) && (((types) ?? []).length === expected_arity)))) {
|
|
275
|
-
((
|
|
282
|
+
((__eliscript_value_8) => { throw __eliscript_value_8; })(new (globalThis.TypeError)("native export requires exact parameterTypes"));
|
|
276
283
|
}
|
|
277
284
|
(types)["forEach"](((type) => {
|
|
278
285
|
if ((!__eliscript_truthy((["u32", "f64", "bits64", "v64"])["includes"](type)))) {
|
|
279
|
-
return ((
|
|
286
|
+
return ((__eliscript_value_9) => { throw __eliscript_value_9; })(new (globalThis.TypeError)("unknown native parameter type"));
|
|
280
287
|
} else {
|
|
281
288
|
return null;
|
|
282
289
|
}
|
|
283
290
|
}));
|
|
284
291
|
if ((!__eliscript_truthy((["u32", "f64", "bits64", "v64"])["includes"](result)))) {
|
|
285
|
-
((
|
|
292
|
+
((__eliscript_value_10) => { throw __eliscript_value_10; })(new (globalThis.TypeError)("native export requires exact resultType"));
|
|
286
293
|
}
|
|
287
294
|
return types;
|
|
288
295
|
}
|
|
289
296
|
}
|
|
290
|
-
|
|
297
|
+
const fast_u64_in_range = (v) => typeof v === 'bigint' && v >= 0n && v <= 0xffffffffffffffffn;
|
|
298
|
+
__eliscript_tdz_ready_8 = true;
|
|
299
|
+
const fast_u32_in_range = (v) => Number.isInteger(v) && v >= 0 && v <= 4294967295;
|
|
300
|
+
__eliscript_tdz_ready_9 = true;
|
|
301
|
+
const fast_safe_nonneg = (v) => Number.isSafeInteger(v) && v >= 0;
|
|
302
|
+
__eliscript_tdz_ready_10 = true;
|
|
303
|
+
function normalize_u32_result(value) {
|
|
304
|
+
return __eliscript_numeric_uint32(value);
|
|
305
|
+
}
|
|
306
|
+
function normalize_f64_result(value) {
|
|
307
|
+
return globalThis.Number(value);
|
|
308
|
+
}
|
|
309
|
+
function normalize_u64_result(value) {
|
|
310
|
+
if ((__eliscript_value_type(value) === "bigint")) {
|
|
311
|
+
if (__eliscript_truthy((__eliscript_tdz_ready_8 === true ? fast_u64_in_range : __eliscript_tdz_error("fast_u64_in_range"))(value))) {
|
|
312
|
+
return value;
|
|
313
|
+
} else {
|
|
314
|
+
return (globalThis.BigInt)["asUintN"](64, value);
|
|
315
|
+
}
|
|
316
|
+
} else {
|
|
317
|
+
if ((!__eliscript_truthy((__eliscript_tdz_ready_10 === true ? fast_safe_nonneg : __eliscript_tdz_error("fast_safe_nonneg"))(value)))) {
|
|
318
|
+
((__eliscript_value_11) => { throw __eliscript_value_11; })(new (globalThis.TypeError)("native u64 result is not exact"));
|
|
319
|
+
}
|
|
320
|
+
return globalThis.BigInt(value);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
function make_result_normalizer(type) {
|
|
291
324
|
if ((type === "u32")) {
|
|
292
|
-
return
|
|
325
|
+
return normalize_u32_result;
|
|
293
326
|
} else {
|
|
294
327
|
if ((type === "f64")) {
|
|
295
|
-
return
|
|
328
|
+
return normalize_f64_result;
|
|
296
329
|
} else {
|
|
297
330
|
if (((type === "v64") || (type === "bits64"))) {
|
|
298
|
-
|
|
299
|
-
((__eliscript_value_13) => { throw __eliscript_value_13; })(new (globalThis.TypeError)("native u64 result is not exact"));
|
|
300
|
-
}
|
|
301
|
-
return (globalThis.BigInt)["asUintN"](64, globalThis.BigInt(value));
|
|
331
|
+
return normalize_u64_result;
|
|
302
332
|
} else {
|
|
303
|
-
return ((
|
|
333
|
+
return ((__eliscript_value_12) => { throw __eliscript_value_12; })(new (globalThis.TypeError)("unknown native result type"));
|
|
304
334
|
}
|
|
305
335
|
}
|
|
306
336
|
}
|
|
307
337
|
}
|
|
308
|
-
function
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
338
|
+
function native_normalize_result(type, value) {
|
|
339
|
+
return (make_result_normalizer(type))(value);
|
|
340
|
+
}
|
|
341
|
+
function check_u32_argument(value) {
|
|
342
|
+
if ((!__eliscript_truthy((__eliscript_tdz_ready_9 === true ? fast_u32_in_range : __eliscript_tdz_error("fast_u32_in_range"))(value)))) {
|
|
343
|
+
((__eliscript_value_13) => { throw __eliscript_value_13; })(new (globalThis.RangeError)("native u32 argument is out of range"));
|
|
344
|
+
}
|
|
345
|
+
return value;
|
|
346
|
+
}
|
|
347
|
+
function check_f64_argument(value) {
|
|
348
|
+
if ((!(__eliscript_value_type(value) === "number"))) {
|
|
349
|
+
((__eliscript_value_14) => { throw __eliscript_value_14; })(new (globalThis.TypeError)("native f64 argument must be a number"));
|
|
350
|
+
}
|
|
351
|
+
return value;
|
|
352
|
+
}
|
|
353
|
+
function check_u64_argument(value) {
|
|
354
|
+
if ((!(__eliscript_value_type(value) === "bigint"))) {
|
|
355
|
+
((__eliscript_value_15) => { throw __eliscript_value_15; })(new (globalThis.TypeError)("native v64/bits64 argument must be a bigint"));
|
|
356
|
+
}
|
|
357
|
+
if (__eliscript_truthy((__eliscript_tdz_ready_8 === true ? fast_u64_in_range : __eliscript_tdz_error("fast_u64_in_range"))(value))) {
|
|
313
358
|
return value;
|
|
359
|
+
} else {
|
|
360
|
+
return (globalThis.BigInt)["asUintN"](64, value);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
function make_arg_checker(type) {
|
|
364
|
+
if ((type === "u32")) {
|
|
365
|
+
return check_u32_argument;
|
|
314
366
|
} else {
|
|
315
367
|
if ((type === "f64")) {
|
|
316
|
-
|
|
317
|
-
((__eliscript_value_16) => { throw __eliscript_value_16; })(new (globalThis.TypeError)("native f64 argument must be a number"));
|
|
318
|
-
}
|
|
319
|
-
return value;
|
|
368
|
+
return check_f64_argument;
|
|
320
369
|
} else {
|
|
321
370
|
if (((type === "v64") || (type === "bits64"))) {
|
|
322
|
-
|
|
323
|
-
((__eliscript_value_17) => { throw __eliscript_value_17; })(new (globalThis.TypeError)("native v64/bits64 argument must be a bigint"));
|
|
324
|
-
}
|
|
325
|
-
return (globalThis.BigInt)["asUintN"](64, value);
|
|
371
|
+
return check_u64_argument;
|
|
326
372
|
} else {
|
|
327
|
-
return ((
|
|
373
|
+
return ((__eliscript_value_16) => { throw __eliscript_value_16; })(new (globalThis.TypeError)("unknown native argument type"));
|
|
328
374
|
}
|
|
329
375
|
}
|
|
330
376
|
}
|
|
331
377
|
}
|
|
378
|
+
function native_check_argument(type, value) {
|
|
379
|
+
return (make_arg_checker(type))(value);
|
|
380
|
+
}
|
|
332
381
|
function native_read_exact(fd, offset, size, file_size) {
|
|
333
382
|
if ((!(__eliscript_truthy(Number.isSafeInteger(offset)) && __eliscript_truthy(Number.isSafeInteger(size)) && __eliscript_numeric_relation(">=", offset, 0) && __eliscript_numeric_relation(">=", size, 0) && __eliscript_numeric_relation("<=", (offset + size), file_size)))) {
|
|
334
|
-
((
|
|
383
|
+
((__eliscript_value_17) => { throw __eliscript_value_17; })(new (globalThis.TypeError)("native section is outside its image"));
|
|
335
384
|
}
|
|
336
385
|
{
|
|
337
386
|
let bytes = Buffer.allocUnsafe(size);
|
|
@@ -340,7 +389,7 @@ function native_read_exact(fd, offset, size, file_size) {
|
|
|
340
389
|
{
|
|
341
390
|
let count = readSync(fd, bytes, done, __eliscript_numeric_sub(size, done), (offset + done));
|
|
342
391
|
if ((count === 0)) {
|
|
343
|
-
((
|
|
392
|
+
((__eliscript_value_18) => { throw __eliscript_value_18; })(new (globalThis.TypeError)("native image is truncated"));
|
|
344
393
|
}
|
|
345
394
|
((done = (done + count)));
|
|
346
395
|
}
|
|
@@ -351,20 +400,18 @@ function native_read_exact(fd, offset, size, file_size) {
|
|
|
351
400
|
function read_native_section(path, offset, size) {
|
|
352
401
|
{
|
|
353
402
|
let fd = openSync(path, "r");
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
}
|
|
360
|
-
})();
|
|
403
|
+
try {
|
|
404
|
+
return native_read_exact(fd, offset, size, (fstatSync(fd))["size"]);
|
|
405
|
+
} finally {
|
|
406
|
+
closeSync(fd);
|
|
407
|
+
}
|
|
361
408
|
}
|
|
362
409
|
}
|
|
363
410
|
function native_file_u64(bytes, offset) {
|
|
364
411
|
{
|
|
365
412
|
let word = (bytes)["readBigUInt64LE"](offset);
|
|
366
413
|
if (__eliscript_numeric_relation(">", word, globalThis.BigInt(9007199254740991))) {
|
|
367
|
-
((
|
|
414
|
+
((__eliscript_value_19) => { throw __eliscript_value_19; })(new (globalThis.TypeError)("native file offset is not exact"));
|
|
368
415
|
}
|
|
369
416
|
return globalThis.Number(word);
|
|
370
417
|
}
|
|
@@ -375,131 +422,129 @@ function native_file_name_p(bytes, offset, length, name) {
|
|
|
375
422
|
function discover_native_rodata(path) {
|
|
376
423
|
{
|
|
377
424
|
let fd = openSync(path, "r");
|
|
378
|
-
|
|
379
|
-
|
|
425
|
+
try {
|
|
426
|
+
{
|
|
427
|
+
let file_size = (fstatSync(fd))["size"];
|
|
428
|
+
let header = native_read_exact(fd, 0, Math.min(64, file_size), file_size);
|
|
429
|
+
let result = null;
|
|
430
|
+
if ((!__eliscript_numeric_relation(">=", file_size, 32))) {
|
|
431
|
+
((__eliscript_value_20) => { throw __eliscript_value_20; })(new (globalThis.TypeError)("native image has no container header"));
|
|
432
|
+
}
|
|
380
433
|
{
|
|
381
|
-
let
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
434
|
+
let accept = null;
|
|
435
|
+
(accept = ((name, offset, size, alignment) => {
|
|
436
|
+
if ((!(!(__eliscript_truthy(result)) && __eliscript_truthy(Number.isSafeInteger(offset)) && __eliscript_numeric_relation(">=", offset, 0) && __eliscript_truthy(Number.isSafeInteger(size)) && __eliscript_numeric_relation(">=", size, 32) && __eliscript_numeric_relation("<=", (offset + size), file_size) && (__eliscript_numeric_rem(offset, 8) === 0) && __eliscript_numeric_relation(">=", alignment, 8)))) {
|
|
437
|
+
((__eliscript_value_21) => { throw __eliscript_value_21; })(new (globalThis.TypeError)("invalid or duplicate native readonly data section"));
|
|
438
|
+
}
|
|
439
|
+
return ((result = Object.freeze(({"name": name, "fileOffset": offset, "size": size, "align": 8}))));
|
|
440
|
+
}));
|
|
441
|
+
if (((header)["readUInt32LE"](0) === 4277009103)) {
|
|
442
|
+
{
|
|
443
|
+
let count = (header)["readUInt32LE"](16);
|
|
444
|
+
let command_end = (32 + (header)["readUInt32LE"](20));
|
|
445
|
+
let cursor = 32;
|
|
446
|
+
let index = 0;
|
|
447
|
+
if ((!(__eliscript_numeric_relation("<=", command_end, file_size) && __eliscript_numeric_relation("<=", count, __eliscript_numeric_div(__eliscript_numeric_sub(command_end, 32), 8))))) {
|
|
448
|
+
((__eliscript_value_22) => { throw __eliscript_value_22; })(new (globalThis.TypeError)("invalid Mach-O load command table"));
|
|
392
449
|
}
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
if ((!__eliscript_numeric_relation("<=", (72 + __eliscript_numeric_mul(sections, 80)), size))) {
|
|
418
|
-
((__eliscript_value_26) => { throw __eliscript_value_26; })(new (globalThis.TypeError)("invalid Mach-O section table"));
|
|
419
|
-
}
|
|
420
|
-
while (__eliscript_numeric_relation("<", slot, sections)) {
|
|
421
|
-
{
|
|
422
|
-
let section = native_read_exact(fd, (cursor + 72 + __eliscript_numeric_mul(slot, 80)), 80, command_end);
|
|
423
|
-
if ((__eliscript_truthy(native_file_name_p(section, 0, 16, "__const")) && __eliscript_truthy(native_file_name_p(section, 16, 16, "__TEXT")))) {
|
|
424
|
-
{
|
|
425
|
-
let exponent = (section)["readUInt32LE"](52);
|
|
426
|
-
if ((!(__eliscript_numeric_relation(">=", exponent, 3) && __eliscript_numeric_relation("<=", exponent, 31)))) {
|
|
427
|
-
((__eliscript_value_27) => { throw __eliscript_value_27; })(new (globalThis.TypeError)("invalid Mach-O readonly alignment"));
|
|
428
|
-
}
|
|
429
|
-
accept("__const", (section)["readUInt32LE"](48), native_file_u64(section, 40), Math.pow(2, exponent));
|
|
450
|
+
while (__eliscript_numeric_relation("<", index, count)) {
|
|
451
|
+
{
|
|
452
|
+
let prefix = native_read_exact(fd, cursor, 8, command_end);
|
|
453
|
+
let command = (prefix)["readUInt32LE"](0);
|
|
454
|
+
let size = (prefix)["readUInt32LE"](4);
|
|
455
|
+
if ((!(__eliscript_numeric_relation(">=", size, 8) && __eliscript_numeric_relation("<=", (cursor + size), command_end)))) {
|
|
456
|
+
((__eliscript_value_23) => { throw __eliscript_value_23; })(new (globalThis.TypeError)("invalid Mach-O load command size"));
|
|
457
|
+
}
|
|
458
|
+
if ((command === 25)) {
|
|
459
|
+
{
|
|
460
|
+
let segment = native_read_exact(fd, cursor, 72, command_end);
|
|
461
|
+
let sections = (segment)["readUInt32LE"](64);
|
|
462
|
+
let slot = 0;
|
|
463
|
+
if ((!__eliscript_numeric_relation("<=", (72 + __eliscript_numeric_mul(sections, 80)), size))) {
|
|
464
|
+
((__eliscript_value_24) => { throw __eliscript_value_24; })(new (globalThis.TypeError)("invalid Mach-O section table"));
|
|
465
|
+
}
|
|
466
|
+
while (__eliscript_numeric_relation("<", slot, sections)) {
|
|
467
|
+
{
|
|
468
|
+
let section = native_read_exact(fd, (cursor + 72 + __eliscript_numeric_mul(slot, 80)), 80, command_end);
|
|
469
|
+
if ((__eliscript_truthy(native_file_name_p(section, 0, 16, "__const")) && __eliscript_truthy(native_file_name_p(section, 16, 16, "__TEXT")))) {
|
|
470
|
+
{
|
|
471
|
+
let exponent = (section)["readUInt32LE"](52);
|
|
472
|
+
if ((!(__eliscript_numeric_relation(">=", exponent, 3) && __eliscript_numeric_relation("<=", exponent, 31)))) {
|
|
473
|
+
((__eliscript_value_25) => { throw __eliscript_value_25; })(new (globalThis.TypeError)("invalid Mach-O readonly alignment"));
|
|
430
474
|
}
|
|
475
|
+
accept("__const", (section)["readUInt32LE"](48), native_file_u64(section, 40), Math.pow(2, exponent));
|
|
431
476
|
}
|
|
432
477
|
}
|
|
433
|
-
((slot = (slot + 1)));
|
|
434
478
|
}
|
|
479
|
+
((slot = (slot + 1)));
|
|
435
480
|
}
|
|
436
481
|
}
|
|
437
|
-
((cursor = (cursor + size)));
|
|
438
482
|
}
|
|
439
|
-
((
|
|
440
|
-
}
|
|
441
|
-
if ((!(cursor === command_end))) {
|
|
442
|
-
((__eliscript_value_28) => { throw __eliscript_value_28; })(new (globalThis.TypeError)("Mach-O load command length mismatch"));
|
|
483
|
+
((cursor = (cursor + size)));
|
|
443
484
|
}
|
|
485
|
+
((index = (index + 1)));
|
|
444
486
|
}
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
487
|
+
if ((!(cursor === command_end))) {
|
|
488
|
+
((__eliscript_value_26) => { throw __eliscript_value_26; })(new (globalThis.TypeError)("Mach-O load command length mismatch"));
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
} else {
|
|
492
|
+
if (((header)["readUInt32LE"](0) === 1179403647)) {
|
|
493
|
+
if ((!(__eliscript_numeric_relation(">=", file_size, 64) && ((header)[4] === 2) && ((header)[5] === 1) && ((header)["readUInt16LE"](18) === 183)))) {
|
|
494
|
+
((__eliscript_value_27) => { throw __eliscript_value_27; })(new (globalThis.TypeError)("native image must be little-endian AArch64 ELF64"));
|
|
495
|
+
}
|
|
496
|
+
{
|
|
497
|
+
let table_offset = native_file_u64(header, 40);
|
|
498
|
+
let entry_size = (header)["readUInt16LE"](58);
|
|
499
|
+
let count = (header)["readUInt16LE"](60);
|
|
500
|
+
let names_index = (header)["readUInt16LE"](62);
|
|
501
|
+
if ((!(__eliscript_numeric_relation(">=", entry_size, 64) && __eliscript_numeric_relation(">", count, 0) && __eliscript_numeric_relation("<", names_index, count) && __eliscript_numeric_relation("<=", (table_offset + __eliscript_numeric_mul(entry_size, count)), file_size)))) {
|
|
502
|
+
((__eliscript_value_28) => { throw __eliscript_value_28; })(new (globalThis.TypeError)("invalid ELF section table"));
|
|
449
503
|
}
|
|
450
504
|
{
|
|
451
|
-
let
|
|
452
|
-
let
|
|
453
|
-
let
|
|
454
|
-
let
|
|
455
|
-
if ((!
|
|
456
|
-
((
|
|
505
|
+
let names_header = native_read_exact(fd, (table_offset + __eliscript_numeric_mul(entry_size, names_index)), 64, file_size);
|
|
506
|
+
let names_offset = native_file_u64(names_header, 24);
|
|
507
|
+
let names_size = native_file_u64(names_header, 32);
|
|
508
|
+
let index = 0;
|
|
509
|
+
if ((!__eliscript_numeric_relation("<=", (names_offset + names_size), file_size))) {
|
|
510
|
+
((__eliscript_value_29) => { throw __eliscript_value_29; })(new (globalThis.TypeError)("invalid ELF section names"));
|
|
457
511
|
}
|
|
458
|
-
{
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
let section = native_read_exact(fd, (table_offset + __eliscript_numeric_mul(entry_size, index)), 64, file_size);
|
|
469
|
-
let name_offset = (section)["readUInt32LE"](0);
|
|
470
|
-
if (__eliscript_numeric_relation("<", name_offset, names_size)) {
|
|
471
|
-
{
|
|
472
|
-
let name = native_read_exact(fd, (names_offset + name_offset), Math.min(8, __eliscript_numeric_sub(names_size, name_offset)), file_size);
|
|
473
|
-
if (__eliscript_truthy(native_file_name_p(name, 0, ((name) ?? []).length, ".rodata"))) {
|
|
474
|
-
if ((!(((section)["readUInt32LE"](4) === 1) && (__eliscript_numeric_and((section)["readUInt32LE"](8), 3) === 2)))) {
|
|
475
|
-
((__eliscript_value_32) => { throw __eliscript_value_32; })(new (globalThis.TypeError)("ELF readonly section has invalid flags"));
|
|
476
|
-
}
|
|
477
|
-
accept(".rodata", native_file_u64(section, 24), native_file_u64(section, 32), native_file_u64(section, 48));
|
|
512
|
+
while (__eliscript_numeric_relation("<", index, count)) {
|
|
513
|
+
{
|
|
514
|
+
let section = native_read_exact(fd, (table_offset + __eliscript_numeric_mul(entry_size, index)), 64, file_size);
|
|
515
|
+
let name_offset = (section)["readUInt32LE"](0);
|
|
516
|
+
if (__eliscript_numeric_relation("<", name_offset, names_size)) {
|
|
517
|
+
{
|
|
518
|
+
let name = native_read_exact(fd, (names_offset + name_offset), Math.min(8, __eliscript_numeric_sub(names_size, name_offset)), file_size);
|
|
519
|
+
if (__eliscript_truthy(native_file_name_p(name, 0, ((name) ?? []).length, ".rodata"))) {
|
|
520
|
+
if ((!(((section)["readUInt32LE"](4) === 1) && (__eliscript_numeric_and((section)["readUInt32LE"](8), 3) === 2)))) {
|
|
521
|
+
((__eliscript_value_30) => { throw __eliscript_value_30; })(new (globalThis.TypeError)("ELF readonly section has invalid flags"));
|
|
478
522
|
}
|
|
523
|
+
accept(".rodata", native_file_u64(section, 24), native_file_u64(section, 32), native_file_u64(section, 48));
|
|
479
524
|
}
|
|
480
525
|
}
|
|
481
526
|
}
|
|
482
|
-
((index = (index + 1)));
|
|
483
527
|
}
|
|
528
|
+
((index = (index + 1)));
|
|
484
529
|
}
|
|
485
530
|
}
|
|
486
|
-
} else {
|
|
487
|
-
((__eliscript_value_33) => { throw __eliscript_value_33; })(new (globalThis.TypeError)("unsupported native image container"));
|
|
488
531
|
}
|
|
532
|
+
} else {
|
|
533
|
+
((__eliscript_value_31) => { throw __eliscript_value_31; })(new (globalThis.TypeError)("unsupported native image container"));
|
|
489
534
|
}
|
|
490
535
|
}
|
|
491
|
-
return result;
|
|
492
536
|
}
|
|
493
|
-
|
|
494
|
-
closeSync(fd);
|
|
537
|
+
return result;
|
|
495
538
|
}
|
|
496
|
-
}
|
|
539
|
+
} finally {
|
|
540
|
+
closeSync(fd);
|
|
541
|
+
}
|
|
497
542
|
}
|
|
498
543
|
}
|
|
499
544
|
function native_rodata_header(path, section, declared) {
|
|
500
545
|
if (!(__eliscript_truthy(section))) {
|
|
501
546
|
if ((!(declared == null))) {
|
|
502
|
-
((
|
|
547
|
+
((__eliscript_value_32) => { throw __eliscript_value_32; })(new (globalThis.TypeError)("native ROData header has no readonly section"));
|
|
503
548
|
}
|
|
504
549
|
return null;
|
|
505
550
|
} else {
|
|
@@ -508,12 +553,12 @@ function native_rodata_header(path, section, declared) {
|
|
|
508
553
|
let header = ({"roBase": (bytes)["readUInt32LE"](0), "roDir": (bytes)["readUInt32LE"](4), "roCount": (bytes)["readUInt32LE"](8), "roImageSlot": (bytes)["readUInt32LE"](12), "imageDataEnd": (bytes)["readUInt32LE"](16), "metaDir": (bytes)["readUInt32LE"](20), "metaCount": (bytes)["readUInt32LE"](24)});
|
|
509
554
|
let end = (256 + (section)["size"]);
|
|
510
555
|
if ((!(((header)["roBase"] === 256) && ((header)["imageDataEnd"] === end) && (__eliscript_numeric_rem(end, 8) === 0) && ((bytes)["readUInt32LE"](28) === 0) && (__eliscript_numeric_relation(">", (header)["roCount"], 0) || __eliscript_numeric_relation(">", (header)["metaCount"], 0)) && __eliscript_numeric_relation(">", (header)["roImageSlot"], 0) && __eliscript_numeric_relation("<=", (header)["roImageSlot"], 65535) && (((header)["roCount"] === 0) || (__eliscript_numeric_relation(">=", (header)["roDir"], 288) && (__eliscript_numeric_rem((header)["roDir"], 8) === 0) && __eliscript_numeric_relation("<=", ((header)["roDir"] + __eliscript_numeric_mul((header)["roCount"], 4)), end))) && (((header)["metaCount"] === 0) || (__eliscript_numeric_relation(">=", (header)["metaDir"], 288) && (__eliscript_numeric_rem((header)["metaDir"], 8) === 0) && __eliscript_numeric_relation("<=", ((header)["metaDir"] + __eliscript_numeric_mul((header)["metaCount"], 24)), end)))))) {
|
|
511
|
-
((
|
|
556
|
+
((__eliscript_value_33) => { throw __eliscript_value_33; })(new (globalThis.TypeError)("invalid native ROData self-describing header"));
|
|
512
557
|
}
|
|
513
558
|
if ((!(declared == null))) {
|
|
514
559
|
(Object.keys(header))["forEach"](((key) => {
|
|
515
560
|
if ((!((declared)[key] === (header)[key]))) {
|
|
516
|
-
return ((
|
|
561
|
+
return ((__eliscript_value_34) => { throw __eliscript_value_34; })(new (globalThis.TypeError)("native ROData descriptor differs from its image"));
|
|
517
562
|
} else {
|
|
518
563
|
return null;
|
|
519
564
|
}
|
|
@@ -523,6 +568,58 @@ function native_rodata_header(path, section, declared) {
|
|
|
523
568
|
}
|
|
524
569
|
}
|
|
525
570
|
}
|
|
571
|
+
let dlopen_staging_dir = null;
|
|
572
|
+
__eliscript_tdz_ready_11 = true;
|
|
573
|
+
let dlopen_staging_serial = 0;
|
|
574
|
+
__eliscript_tdz_ready_12 = true;
|
|
575
|
+
function ensureDlopenStagingDir() {
|
|
576
|
+
if (((__eliscript_tdz_ready_11 === true ? dlopen_staging_dir : __eliscript_tdz_error("dlopen_staging_dir")) === null)) {
|
|
577
|
+
{
|
|
578
|
+
let dir = (node_path)["resolve"](tmpdir(), (String("eliscript-dlopen-") + String((globalThis.process)["pid"]) + String("-") + String(Math.floor(__eliscript_numeric_mul(Math.random(), 1000000000)))));
|
|
579
|
+
mkdirSync(dir, ({"recursive": true}));
|
|
580
|
+
(__eliscript_tdz_write_11(dir));
|
|
581
|
+
(globalThis.process)["once"]("exit", (() => {
|
|
582
|
+
try {
|
|
583
|
+
return rmSync(dir, ({"recursive": true, "force": true}));
|
|
584
|
+
} catch (ignored) {
|
|
585
|
+
return null;
|
|
586
|
+
}
|
|
587
|
+
}));
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
return (__eliscript_tdz_ready_11 === true ? dlopen_staging_dir : __eliscript_tdz_error("dlopen_staging_dir"));
|
|
591
|
+
}
|
|
592
|
+
function stageImmutableLibraryPath(resolved_path, file_identity) {
|
|
593
|
+
if ((((globalThis.process)["platform"] !== "darwin") || (file_identity === null))) {
|
|
594
|
+
return resolved_path;
|
|
595
|
+
} else {
|
|
596
|
+
{
|
|
597
|
+
let dir = ensureDlopenStagingDir();
|
|
598
|
+
let safe_key = (file_identity)["replace"](":", "-");
|
|
599
|
+
let staged = (node_path)["resolve"](dir, (String(safe_key) + String(".dylib")));
|
|
600
|
+
if ((!__eliscript_truthy(existsSync(staged)))) {
|
|
601
|
+
(__eliscript_tdz_write_12(((__eliscript_tdz_ready_12 === true ? dlopen_staging_serial : __eliscript_tdz_error("dlopen_staging_serial")) + 1)));
|
|
602
|
+
{
|
|
603
|
+
let tmp = (String(staged) + String(".tmp.") + String((__eliscript_tdz_ready_12 === true ? dlopen_staging_serial : __eliscript_tdz_error("dlopen_staging_serial"))));
|
|
604
|
+
try {
|
|
605
|
+
copyFileSync(resolved_path, tmp);
|
|
606
|
+
renameSync(tmp, staged);
|
|
607
|
+
} catch (error) {
|
|
608
|
+
try {
|
|
609
|
+
rmSync(tmp, ({"recursive": true, "force": true}));
|
|
610
|
+
} catch (ignored) {
|
|
611
|
+
null;
|
|
612
|
+
}
|
|
613
|
+
if ((!__eliscript_truthy(existsSync(staged)))) {
|
|
614
|
+
((__eliscript_value_35) => { throw __eliscript_value_35; })(error);
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
return staged;
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
}
|
|
526
623
|
function acquireNativeLibrary(ffi, path, entries) {
|
|
527
624
|
{
|
|
528
625
|
let ffi_signatures = Object.fromEntries((entries)["map"](((entry) => {
|
|
@@ -552,15 +649,13 @@ function acquireNativeLibrary(ffi, path, entries) {
|
|
|
552
649
|
while (__eliscript_numeric_relation("<", scan, ((pool) ?? []).length)) {
|
|
553
650
|
{
|
|
554
651
|
let candidate = (pool)[scan];
|
|
555
|
-
if ((((candidate)["path"] === resolved_path) && ((file_identity === null) || ((
|
|
652
|
+
if ((((candidate)["path"] === resolved_path) && ((file_identity === null) || ((candidate)["identity"] !== file_identity)))) {
|
|
556
653
|
(pool)["splice"](scan, 1);
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
}
|
|
563
|
-
})();
|
|
654
|
+
try {
|
|
655
|
+
((candidate)["raw"])["close"]();
|
|
656
|
+
} catch (ignored) {
|
|
657
|
+
null;
|
|
658
|
+
}
|
|
564
659
|
} else {
|
|
565
660
|
((scan = (scan + 1)));
|
|
566
661
|
}
|
|
@@ -600,7 +695,7 @@ function acquireNativeLibrary(ffi, path, entries) {
|
|
|
600
695
|
{
|
|
601
696
|
let raw = (!((reused === null)) ? reused : (() => {
|
|
602
697
|
bun_gc_sweep();
|
|
603
|
-
return (ffi)["dlopen"](
|
|
698
|
+
return (ffi)["dlopen"](stageImmutableLibraryPath(resolved_path, file_identity), ffi_signatures);
|
|
604
699
|
})());
|
|
605
700
|
let released = false;
|
|
606
701
|
return ({"symbols": (raw)["symbols"], "close": (() => {
|
|
@@ -643,249 +738,242 @@ async function anonymousMapping(ffi, maximumBytes, libcLibrary, platform) {
|
|
|
643
738
|
let signatures = ({"mmap": ({"args": ["ptr", "u64", "i32", "i32", "i32", "i64"], "returns": "ptr"}), "mprotect": ({"args": ["ptr", "u64", "i32"], "returns": "i32"}), "munmap": ({"args": ["ptr", "u64"], "returns": "i32"}), "getpagesize": ({"args": [], "returns": "i32"})});
|
|
644
739
|
let failure = undefined;
|
|
645
740
|
bun_gc_sweep();
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
}
|
|
652
|
-
})();
|
|
741
|
+
try {
|
|
742
|
+
((libc = (ffi)["dlopen"](libcLibrary, signatures)));
|
|
743
|
+
} catch (error) {
|
|
744
|
+
((failure = error));
|
|
745
|
+
}
|
|
653
746
|
if ((!__eliscript_truthy(memory_truth(libc)))) {
|
|
654
|
-
((
|
|
747
|
+
((__eliscript_value_36) => { throw __eliscript_value_36; })(new (globalThis.Error)((__eliscript_truthy(mac) ? "unable to load macOS virtual memory functions" : "unable to load Linux virtual memory functions"), ({"cause": failure})));
|
|
655
748
|
}
|
|
656
749
|
}
|
|
657
750
|
}
|
|
658
|
-
|
|
659
|
-
|
|
751
|
+
try {
|
|
752
|
+
{
|
|
753
|
+
const __eliscript_value_37 = (!(__eliscript_truthy(custom_libc)) ? cached_page : ((libc)["symbols"])["getpagesize"]());
|
|
660
754
|
{
|
|
661
|
-
|
|
755
|
+
let page = __eliscript_value_37;
|
|
756
|
+
if ((!(__eliscript_truthy(Number.isSafeInteger(page)) && __eliscript_numeric_relation(">", page, 0) && (__eliscript_numeric_and(page, __eliscript_numeric_decrement(page)) === 0)))) {
|
|
757
|
+
((__eliscript_value_38) => { throw __eliscript_value_38; })(new (globalThis.Error)((__eliscript_truthy(mac) ? "invalid macOS memory page size" : "invalid Linux memory page size")));
|
|
758
|
+
}
|
|
662
759
|
{
|
|
663
|
-
|
|
664
|
-
if ((!(__eliscript_truthy(Number.isSafeInteger(page)) && __eliscript_numeric_relation(">", page, 0) && (__eliscript_numeric_and(page, __eliscript_numeric_decrement(page)) === 0)))) {
|
|
665
|
-
((__eliscript_value_41) => { throw __eliscript_value_41; })(new (globalThis.Error)((__eliscript_truthy(mac) ? "invalid macOS memory page size" : "invalid Linux memory page size")));
|
|
666
|
-
}
|
|
760
|
+
const __eliscript_value_39 = __eliscript_numeric_mul(Math.ceil(__eliscript_numeric_div(Math.max(1, maximumBytes), page)), page);
|
|
667
761
|
{
|
|
668
|
-
|
|
762
|
+
let usableBytes = __eliscript_value_39;
|
|
763
|
+
((mappingBytes = (usableBytes + __eliscript_numeric_mul(2, page))));
|
|
669
764
|
{
|
|
670
|
-
let
|
|
671
|
-
((
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
765
|
+
let address = ((libc)["symbols"])["mmap"](null, globalThis.BigInt(mappingBytes), 0, flags, -1, globalThis.BigInt(0));
|
|
766
|
+
if ((!(__eliscript_truthy(Number.isSafeInteger(address)) && __eliscript_numeric_relation(">", address, 0)))) {
|
|
767
|
+
((__eliscript_value_40) => { throw __eliscript_value_40; })(new (globalThis.Error)("unable to reserve native linear memory"));
|
|
768
|
+
}
|
|
769
|
+
((mapping = address));
|
|
770
|
+
}
|
|
771
|
+
{
|
|
772
|
+
let base = (mapping + page);
|
|
773
|
+
let DataViewCtor = globalThis.DataView;
|
|
774
|
+
let scratch = new (globalThis.Uint8Array)(8);
|
|
775
|
+
let scratchView = new (DataViewCtor)((scratch)["buffer"]);
|
|
776
|
+
let scratch16 = new (globalThis.Uint8Array)((scratch)["buffer"], 0, 2);
|
|
777
|
+
let scratch32 = new (globalThis.Uint8Array)((scratch)["buffer"], 0, 4);
|
|
778
|
+
let pageViews = [];
|
|
779
|
+
let page0View = undefined;
|
|
780
|
+
let lastPageIndex = -1;
|
|
781
|
+
let lastPageView = undefined;
|
|
782
|
+
if ((!(((libc)["symbols"])["mprotect"](base, globalThis.BigInt(usableBytes), 3) === 0))) {
|
|
783
|
+
((__eliscript_value_41) => { throw __eliscript_value_41; })(new (globalThis.Error)("unable to enable native linear memory"));
|
|
678
784
|
}
|
|
679
785
|
{
|
|
680
|
-
let
|
|
681
|
-
let
|
|
682
|
-
let
|
|
683
|
-
let
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
let swap16 = null;
|
|
696
|
-
let swap32 = null;
|
|
697
|
-
(rangeView = ((offset, length) => {
|
|
698
|
-
return new (globalThis.Uint8Array)((ffi)["toArrayBuffer"]((base + offset), 0, length));
|
|
699
|
-
}));
|
|
700
|
-
(pageView = ((offset) => {
|
|
786
|
+
let rangeView = null;
|
|
787
|
+
let pageView = null;
|
|
788
|
+
let swap16 = null;
|
|
789
|
+
let swap32 = null;
|
|
790
|
+
(rangeView = ((offset, length) => {
|
|
791
|
+
return new (globalThis.Uint8Array)((ffi)["toArrayBuffer"]((base + offset), 0, length));
|
|
792
|
+
}));
|
|
793
|
+
(pageView = ((offset) => {
|
|
794
|
+
if ((__eliscript_numeric_relation(">=", offset, 0) && __eliscript_numeric_relation("<", offset, 65536))) {
|
|
795
|
+
return ((__eliscript_value_42) => (__eliscript_truthy(__eliscript_value_42) ? __eliscript_value_42 : (() => {
|
|
796
|
+
((page0View = new (DataViewCtor)((ffi)["toArrayBuffer"](base, 0, 65536))));
|
|
797
|
+
((pageViews)[0] = page0View);
|
|
798
|
+
return page0View;
|
|
799
|
+
})()))(page0View);
|
|
800
|
+
} else {
|
|
701
801
|
{
|
|
702
802
|
let pageIndex = __eliscript_numeric_ushr(offset, 16);
|
|
703
803
|
if ((pageIndex === lastPageIndex)) {
|
|
704
804
|
return lastPageView;
|
|
705
805
|
} else {
|
|
706
806
|
{
|
|
707
|
-
let existing = (pageViews)[
|
|
807
|
+
let existing = (pageViews)[pageIndex];
|
|
708
808
|
if ((!__eliscript_truthy(existing))) {
|
|
709
809
|
((existing = new (DataViewCtor)((ffi)["toArrayBuffer"]((base + __eliscript_numeric_mul(pageIndex, 65536)), 0, 65536))));
|
|
710
|
-
(pageViews)[
|
|
810
|
+
((pageViews)[pageIndex] = existing);
|
|
711
811
|
}
|
|
712
812
|
((lastPageIndex = pageIndex), (lastPageView = existing));
|
|
713
813
|
return existing;
|
|
714
814
|
}
|
|
715
815
|
}
|
|
716
816
|
}
|
|
717
|
-
}
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
}
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
}), "getUint32": ((offset, endian) => {
|
|
741
|
-
{
|
|
742
|
-
let pageOffset = __eliscript_numeric_and(offset, 65535);
|
|
743
|
-
if (__eliscript_numeric_relation("<=", (pageOffset + 4), 65536)) {
|
|
744
|
-
return (pageView(offset))["getUint32"](pageOffset, memory_truth(endian));
|
|
745
|
-
} else {
|
|
746
|
-
{
|
|
747
|
-
let word = ((ffi)["read"])["u32"](base, offset);
|
|
748
|
-
if (__eliscript_truthy(memory_truth(endian))) {
|
|
749
|
-
return word;
|
|
750
|
-
} else {
|
|
751
|
-
return swap32(word);
|
|
752
|
-
}
|
|
817
|
+
}
|
|
818
|
+
}));
|
|
819
|
+
(swap16 = ((word) => {
|
|
820
|
+
return __eliscript_numeric_or(__eliscript_numeric_shl(__eliscript_numeric_and(word, 255), 8), __eliscript_numeric_ushr(word, 8));
|
|
821
|
+
}));
|
|
822
|
+
(swap32 = ((word) => {
|
|
823
|
+
return __eliscript_numeric_ushr(__eliscript_numeric_or(__eliscript_numeric_or(__eliscript_numeric_shl(__eliscript_numeric_and(word, 255), 24), __eliscript_numeric_shl(__eliscript_numeric_and(__eliscript_numeric_ushr(word, 8), 255), 16)), __eliscript_numeric_or(__eliscript_numeric_shl(__eliscript_numeric_and(__eliscript_numeric_ushr(word, 16), 255), 8), __eliscript_numeric_ushr(word, 24))), 0);
|
|
824
|
+
}));
|
|
825
|
+
return ({"base": base, "getUint16": ((offset, endian) => {
|
|
826
|
+
{
|
|
827
|
+
let pageOffset = __eliscript_numeric_and(offset, 65535);
|
|
828
|
+
if (__eliscript_numeric_relation("<=", (pageOffset + 2), 65536)) {
|
|
829
|
+
return (pageView(offset))["getUint16"](pageOffset, memory_truth(endian));
|
|
830
|
+
} else {
|
|
831
|
+
{
|
|
832
|
+
let word = ((ffi)["read"])["u16"](base, offset);
|
|
833
|
+
if (__eliscript_truthy(memory_truth(endian))) {
|
|
834
|
+
return word;
|
|
835
|
+
} else {
|
|
836
|
+
return swap16(word);
|
|
753
837
|
}
|
|
754
838
|
}
|
|
755
839
|
}
|
|
756
|
-
}
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
840
|
+
}
|
|
841
|
+
}), "getUint32": ((offset, endian) => {
|
|
842
|
+
{
|
|
843
|
+
let pageOffset = __eliscript_numeric_and(offset, 65535);
|
|
844
|
+
if (__eliscript_numeric_relation("<=", (pageOffset + 4), 65536)) {
|
|
845
|
+
return (pageView(offset))["getUint32"](pageOffset, memory_truth(endian));
|
|
846
|
+
} else {
|
|
847
|
+
{
|
|
848
|
+
let word = ((ffi)["read"])["u32"](base, offset);
|
|
762
849
|
if (__eliscript_truthy(memory_truth(endian))) {
|
|
763
|
-
return
|
|
850
|
+
return word;
|
|
764
851
|
} else {
|
|
765
|
-
|
|
766
|
-
(scratchView)["setUint32"](4, ((ffi)["read"])["u32"](base, (offset + 4)), true);
|
|
767
|
-
return (scratchView)["getFloat64"](0, false);
|
|
852
|
+
return swap32(word);
|
|
768
853
|
}
|
|
769
854
|
}
|
|
770
855
|
}
|
|
771
|
-
}
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
}
|
|
781
|
-
}), "getBigUint64": ((offset, endian) => {
|
|
782
|
-
{
|
|
783
|
-
let pageOffset = __eliscript_numeric_and(offset, 65535);
|
|
784
|
-
if (__eliscript_numeric_relation("<=", (pageOffset + 8), 65536)) {
|
|
785
|
-
return (pageView(offset))["getBigUint64"](pageOffset, memory_truth(endian));
|
|
856
|
+
}
|
|
857
|
+
}), "getFloat64": ((offset, endian) => {
|
|
858
|
+
{
|
|
859
|
+
let pageOffset = __eliscript_numeric_and(offset, 65535);
|
|
860
|
+
if (__eliscript_numeric_relation("<=", (pageOffset + 8), 65536)) {
|
|
861
|
+
return (pageView(offset))["getFloat64"](pageOffset, memory_truth(endian));
|
|
862
|
+
} else {
|
|
863
|
+
if (__eliscript_truthy(memory_truth(endian))) {
|
|
864
|
+
return ((ffi)["read"])["f64"](base, offset);
|
|
786
865
|
} else {
|
|
787
866
|
(scratchView)["setUint32"](0, ((ffi)["read"])["u32"](base, offset), true);
|
|
788
867
|
(scratchView)["setUint32"](4, ((ffi)["read"])["u32"](base, (offset + 4)), true);
|
|
789
|
-
return (scratchView)["
|
|
868
|
+
return (scratchView)["getFloat64"](0, false);
|
|
790
869
|
}
|
|
791
870
|
}
|
|
792
|
-
}
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
871
|
+
}
|
|
872
|
+
}), "setUint16": ((offset, value, endian) => {
|
|
873
|
+
{
|
|
874
|
+
let pageOffset = __eliscript_numeric_and(offset, 65535);
|
|
875
|
+
if (__eliscript_numeric_relation("<=", (pageOffset + 2), 65536)) {
|
|
876
|
+
return (pageView(offset))["setUint16"](pageOffset, value, memory_truth(endian));
|
|
877
|
+
} else {
|
|
878
|
+
(scratchView)["setUint16"](0, value, endian);
|
|
879
|
+
return (rangeView(offset, 2))["set"](scratch16);
|
|
801
880
|
}
|
|
802
|
-
}
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
881
|
+
}
|
|
882
|
+
}), "getBigUint64": ((offset, endian) => {
|
|
883
|
+
{
|
|
884
|
+
let pageOffset = __eliscript_numeric_and(offset, 65535);
|
|
885
|
+
if (__eliscript_numeric_relation("<=", (pageOffset + 8), 65536)) {
|
|
886
|
+
return (pageView(offset))["getBigUint64"](pageOffset, memory_truth(endian));
|
|
887
|
+
} else {
|
|
888
|
+
(scratchView)["setUint32"](0, ((ffi)["read"])["u32"](base, offset), true);
|
|
889
|
+
(scratchView)["setUint32"](4, ((ffi)["read"])["u32"](base, (offset + 4)), true);
|
|
890
|
+
return (scratchView)["getBigUint64"](0, memory_truth(endian));
|
|
811
891
|
}
|
|
812
|
-
}
|
|
813
|
-
|
|
814
|
-
|
|
892
|
+
}
|
|
893
|
+
}), "setUint32": ((offset, value, endian) => {
|
|
894
|
+
{
|
|
895
|
+
let pageOffset = __eliscript_numeric_and(offset, 65535);
|
|
896
|
+
if (__eliscript_numeric_relation("<=", (pageOffset + 4), 65536)) {
|
|
897
|
+
return (pageView(offset))["setUint32"](pageOffset, value, memory_truth(endian));
|
|
815
898
|
} else {
|
|
816
|
-
|
|
899
|
+
(scratchView)["setUint32"](0, value, endian);
|
|
900
|
+
return (rangeView(offset, 4))["set"](scratch32);
|
|
817
901
|
}
|
|
818
|
-
}
|
|
819
|
-
|
|
820
|
-
|
|
902
|
+
}
|
|
903
|
+
}), "setBigUint64": ((offset, value, endian) => {
|
|
904
|
+
{
|
|
905
|
+
let pageOffset = __eliscript_numeric_and(offset, 65535);
|
|
906
|
+
if (__eliscript_numeric_relation("<=", (pageOffset + 8), 65536)) {
|
|
907
|
+
return (pageView(offset))["setBigUint64"](pageOffset, value, memory_truth(endian));
|
|
908
|
+
} else {
|
|
909
|
+
(scratchView)["setBigUint64"](0, value, endian);
|
|
910
|
+
return (rangeView(offset, 8))["set"](new (globalThis.Uint8Array)((scratch)["buffer"], 0, 8));
|
|
821
911
|
}
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
return (libc)["close"]();
|
|
845
|
-
} catch (error) {
|
|
846
|
-
if ((!__eliscript_truthy(failed))) {
|
|
847
|
-
return ((failed = true), (first = error));
|
|
848
|
-
} else {
|
|
849
|
-
return null;
|
|
850
|
-
}
|
|
851
|
-
}
|
|
852
|
-
})();
|
|
912
|
+
}
|
|
913
|
+
}), "read": ((offset, length) => {
|
|
914
|
+
if ((length === 0)) {
|
|
915
|
+
return new (globalThis.Uint8Array)(0);
|
|
916
|
+
} else {
|
|
917
|
+
return (rangeView(offset, length))["slice"]();
|
|
918
|
+
}
|
|
919
|
+
}), "write": ((input, offset) => {
|
|
920
|
+
if (((input)["byteLength"] !== 0)) {
|
|
921
|
+
(rangeView(offset, (input)["byteLength"]))["set"](input);
|
|
922
|
+
}
|
|
923
|
+
return undefined;
|
|
924
|
+
}), "close": (() => {
|
|
925
|
+
if ((!__eliscript_truthy(released))) {
|
|
926
|
+
((released = true), (lastPageIndex = -1), (lastPageView = undefined), (page0View = undefined));
|
|
927
|
+
((pageViews)["length"] = 0);
|
|
928
|
+
{
|
|
929
|
+
let failed = false;
|
|
930
|
+
let first = undefined;
|
|
931
|
+
try {
|
|
932
|
+
if ((!(((libc)["symbols"])["munmap"](mapping, globalThis.BigInt(mappingBytes)) === 0))) {
|
|
933
|
+
((__eliscript_value_43) => { throw __eliscript_value_43; })(new (globalThis.Error)("unable to release native linear memory"));
|
|
853
934
|
}
|
|
854
|
-
|
|
855
|
-
|
|
935
|
+
} catch (error) {
|
|
936
|
+
((failed = true), (first = error));
|
|
937
|
+
}
|
|
938
|
+
if (__eliscript_truthy(custom_libc)) {
|
|
939
|
+
try {
|
|
940
|
+
(libc)["close"]();
|
|
941
|
+
} catch (error) {
|
|
942
|
+
if ((!__eliscript_truthy(failed))) {
|
|
943
|
+
((failed = true), (first = error));
|
|
944
|
+
}
|
|
856
945
|
}
|
|
857
946
|
}
|
|
947
|
+
if (__eliscript_truthy(failed)) {
|
|
948
|
+
((__eliscript_value_44) => { throw __eliscript_value_44; })(first);
|
|
949
|
+
}
|
|
858
950
|
}
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
}
|
|
951
|
+
}
|
|
952
|
+
return undefined;
|
|
953
|
+
})});
|
|
862
954
|
}
|
|
863
955
|
}
|
|
864
956
|
}
|
|
865
957
|
}
|
|
866
958
|
}
|
|
867
|
-
}
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
}
|
|
875
|
-
})();
|
|
959
|
+
}
|
|
960
|
+
} catch (error) {
|
|
961
|
+
if (__eliscript_truthy(memory_truth(mapping))) {
|
|
962
|
+
try {
|
|
963
|
+
((libc)["symbols"])["munmap"](mapping, globalThis.BigInt(mappingBytes));
|
|
964
|
+
} catch (ignored) {
|
|
965
|
+
null;
|
|
876
966
|
}
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
}
|
|
884
|
-
})();
|
|
967
|
+
}
|
|
968
|
+
if (__eliscript_truthy(custom_libc)) {
|
|
969
|
+
try {
|
|
970
|
+
(libc)["close"]();
|
|
971
|
+
} catch (ignored) {
|
|
972
|
+
null;
|
|
885
973
|
}
|
|
886
|
-
return ((__eliscript_value_49) => { throw __eliscript_value_49; })(error);
|
|
887
974
|
}
|
|
888
|
-
|
|
975
|
+
return ((__eliscript_value_45) => { throw __eliscript_value_45; })(error);
|
|
976
|
+
}
|
|
889
977
|
}
|
|
890
978
|
}
|
|
891
979
|
async function openNativeMemory(path, signatures, ...arguments$) {
|
|
@@ -908,37 +996,37 @@ async function openNativeMemory(path, signatures, ...arguments$) {
|
|
|
908
996
|
return (await (async () => {
|
|
909
997
|
([initialPages, maximumPages])["forEach"](((pages) => {
|
|
910
998
|
if ((!(__eliscript_truthy(Number.isInteger(pages)) && __eliscript_numeric_relation(">=", pages, 0) && __eliscript_numeric_relation("<=", pages, 65536)))) {
|
|
911
|
-
return ((
|
|
999
|
+
return ((__eliscript_value_47) => { throw __eliscript_value_47; })(new (globalThis.RangeError)("invalid memory page count"));
|
|
912
1000
|
} else {
|
|
913
1001
|
return null;
|
|
914
1002
|
}
|
|
915
1003
|
}));
|
|
916
1004
|
if (__eliscript_numeric_relation(">", initialPages, maximumPages)) {
|
|
917
|
-
((
|
|
1005
|
+
((__eliscript_value_48) => { throw __eliscript_value_48; })(new (globalThis.RangeError)("initial memory exceeds maximum"));
|
|
918
1006
|
}
|
|
919
1007
|
if ((!__eliscript_truthy(Array.isArray(hostCapabilities)))) {
|
|
920
|
-
((
|
|
1008
|
+
((__eliscript_value_49) => { throw __eliscript_value_49; })(new (globalThis.TypeError)("native host capabilities must be an array"));
|
|
921
1009
|
}
|
|
922
1010
|
((capabilities = (hostCapabilities)["map"](((capability) => {
|
|
923
1011
|
if ((!(!((capability == null)) && __eliscript_truthy((["console-log", "console-log-capture", "source-operation"])["includes"]((capability)["name"])) && ((capability)["module"] === "eliscript.host") && ((capability)["arity"] === 2) && ((capability)["abi"] === "managed-host-call")))) {
|
|
924
|
-
((
|
|
1012
|
+
((__eliscript_value_50) => { throw __eliscript_value_50; })(new (globalThis.TypeError)("native host capability is not supported"));
|
|
925
1013
|
}
|
|
926
1014
|
return Object.freeze(memory_copy(capability));
|
|
927
1015
|
}))));
|
|
928
1016
|
if ((!((new (globalThis.Set)((capabilities)["map"](((entry) => {
|
|
929
1017
|
return (entry)["name"];
|
|
930
1018
|
}))))["size"] === ((capabilities) ?? []).length))) {
|
|
931
|
-
((
|
|
1019
|
+
((__eliscript_value_51) => { throw __eliscript_value_51; })(new (globalThis.TypeError)("duplicate native host capability"));
|
|
932
1020
|
}
|
|
933
|
-
if ((__eliscript_numeric_relation(">", ((capabilities) ?? []).length, 0) && ((
|
|
934
|
-
((
|
|
1021
|
+
if ((__eliscript_numeric_relation(">", ((capabilities) ?? []).length, 0) && (__eliscript_value_type(hostCall) !== "function"))) {
|
|
1022
|
+
((__eliscript_value_52) => { throw __eliscript_value_52; })(new (globalThis.TypeError)("native artifact requires an explicit host capability dispatcher"));
|
|
935
1023
|
}
|
|
936
1024
|
if ((!__eliscript_truthy(Array.isArray(trapSites)))) {
|
|
937
|
-
((
|
|
1025
|
+
((__eliscript_value_53) => { throw __eliscript_value_53; })(new (globalThis.TypeError)("native trap sites must be an array"));
|
|
938
1026
|
}
|
|
939
1027
|
(trapSites)["forEach"](((site) => {
|
|
940
1028
|
if ((!(__eliscript_truthy(memory_truth(site)) && __eliscript_truthy(Number.isSafeInteger((site)["site"])) && __eliscript_numeric_relation(">", (site)["site"], 0) && __eliscript_numeric_relation("<=", (site)["site"], 4294967295) && !(__eliscript_truthy((preciseSites)["has"]((site)["site"]))) && __eliscript_truthy(Number.isSafeInteger((site)["address"])) && __eliscript_numeric_relation(">=", (site)["address"], 0) && (__eliscript_numeric_rem((site)["address"], 4) === 0) && ((site)["offsetBase"] === "code-section") && __eliscript_truthy(Number.isSafeInteger((site)["functionIndex"])) && __eliscript_numeric_relation(">=", (site)["functionIndex"], 0) && ((site)["returnAddress"] === false) && __eliscript_truthy(Number.isInteger((site)["code"])) && __eliscript_numeric_relation(">=", (site)["code"], 1) && __eliscript_numeric_relation("<=", (site)["code"], 6)))) {
|
|
941
|
-
((
|
|
1029
|
+
((__eliscript_value_54) => { throw __eliscript_value_54; })(new (globalThis.TypeError)("invalid precise native trap site"));
|
|
942
1030
|
}
|
|
943
1031
|
return (preciseSites)["set"]((site)["site"], Object.freeze(memory_copy(site)));
|
|
944
1032
|
}));
|
|
@@ -946,7 +1034,7 @@ async function openNativeMemory(path, signatures, ...arguments$) {
|
|
|
946
1034
|
let actual_section = discover_native_rodata(path);
|
|
947
1035
|
if ((!(roDataSection == null))) {
|
|
948
1036
|
if ((!(__eliscript_truthy(actual_section) && ((roDataSection)["fileOffset"] === (actual_section)["fileOffset"]) && ((roDataSection)["size"] === (actual_section)["size"]) && ((roDataSection)["name"] === (actual_section)["name"])))) {
|
|
949
|
-
((
|
|
1037
|
+
((__eliscript_value_55) => { throw __eliscript_value_55; })(new (globalThis.TypeError)("native readonly section descriptor differs from its image"));
|
|
950
1038
|
}
|
|
951
1039
|
}
|
|
952
1040
|
((roDataSection = actual_section));
|
|
@@ -959,372 +1047,664 @@ async function openNativeMemory(path, signatures, ...arguments$) {
|
|
|
959
1047
|
{
|
|
960
1048
|
let signature = (entry)[1];
|
|
961
1049
|
if ((!(__eliscript_truthy(memory_truth((entry)[0])) && __eliscript_truthy(memory_truth(signature)) && __eliscript_truthy(Number.isInteger((signature)["arity"])) && __eliscript_numeric_relation(">=", (signature)["arity"], 0)))) {
|
|
962
|
-
((
|
|
1050
|
+
((__eliscript_value_57) => { throw __eliscript_value_57; })(new (globalThis.TypeError)("invalid native memory signature"));
|
|
963
1051
|
}
|
|
964
1052
|
return native_parameter_types(signature, (signature)["arity"]);
|
|
965
1053
|
}
|
|
966
1054
|
}));
|
|
967
1055
|
return (await (async (signature_table) => {
|
|
968
|
-
return (!(__eliscript_truthy(memory_truth(((globalThis.process)["versions"])["bun"])))
|
|
1056
|
+
return ((!(__eliscript_truthy(memory_truth(((globalThis.process)["versions"])["bun"]))) && (!((bunExecutable === undefined)) || (((envMap) => {
|
|
1057
|
+
return ((__eliscript_value_58) => (__eliscript_truthy(__eliscript_value_58) ? (envMap)["ELISCRIPT_NODE_NATIVE_TRANSPORT"] : __eliscript_value_58))(envMap);
|
|
1058
|
+
})((globalThis.process)["env"]) === "worker") || !(((platform === "arm64-macos") || (platform === "arm64-linux"))))) ? (await (async (forwarded) => {
|
|
969
1059
|
if ((!(bunExecutable === undefined))) {
|
|
970
1060
|
((forwarded)["bunExecutable"] = bunExecutable);
|
|
971
1061
|
}
|
|
972
1062
|
return await (openNodeNativeMemory(path, Object.fromEntries(entries), forwarded));
|
|
973
|
-
})(({"initialPages": initialPages, "maximumPages": maximumPages, "nativeTarget": platform, "libcLibrary": libcLibrary, "hostCapabilities": capabilities, "hostCall": hostCall, "trapSites": trapSites, "debug": debug, "roDataSection": roDataSection, "roDataHeader": roDataHeader}))) : (await (async (
|
|
974
|
-
return (await (async (
|
|
975
|
-
return (await (async (
|
|
976
|
-
return (await (async (
|
|
977
|
-
return (await (async (
|
|
978
|
-
return (await (async (
|
|
979
|
-
return (await (async (
|
|
980
|
-
return (await (async (
|
|
981
|
-
return (await (async (
|
|
982
|
-
return (await (async (
|
|
983
|
-
return (await (async (
|
|
984
|
-
return (await (async () => {
|
|
985
|
-
(await (async () => {
|
|
986
|
-
|
|
1063
|
+
})(({"initialPages": initialPages, "maximumPages": maximumPages, "nativeTarget": platform, "libcLibrary": libcLibrary, "hostCapabilities": capabilities, "hostCall": hostCall, "trapSites": trapSites, "debug": debug, "roDataSection": roDataSection, "roDataHeader": roDataHeader}))) : (await (async (is_bun) => {
|
|
1064
|
+
return (await (async (require) => {
|
|
1065
|
+
return (await (async (ffi) => {
|
|
1066
|
+
return (await (async (mapping) => {
|
|
1067
|
+
return (await (async (context) => {
|
|
1068
|
+
return (await (async (view) => {
|
|
1069
|
+
return (await (async (contextWords) => {
|
|
1070
|
+
return (await (async (library) => {
|
|
1071
|
+
return (await (async (callback) => {
|
|
1072
|
+
return (await (async (contextPointer) => {
|
|
1073
|
+
return (await (async (closed) => {
|
|
1074
|
+
return (await (async (disposed) => {
|
|
1075
|
+
return (await (async (invocations) => {
|
|
1076
|
+
return (await (async (depth0Invocation) => {
|
|
987
1077
|
return (await (async () => {
|
|
988
|
-
(
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
try {
|
|
1000
|
-
if ((!((actualContext === contextPointer)) || !(__eliscript_truthy(memory_truth(invocation))) || __eliscript_truthy(closed))) {
|
|
1001
|
-
((__eliscript_value_64) => { throw __eliscript_value_64; })(new (globalThis.Error)("native host callback is outside its active invocation"));
|
|
1002
|
-
}
|
|
1003
|
-
if ((!(__eliscript_truthy(Number.isInteger(index)) && __eliscript_numeric_relation(">=", index, 0) && __eliscript_numeric_relation("<", index, ((capabilities) ?? []).length)))) {
|
|
1004
|
-
((__eliscript_value_65) => { throw __eliscript_value_65; })(new (globalThis.TypeError)("native host capability index is not declared"));
|
|
1005
|
-
}
|
|
1078
|
+
(await (async () => {
|
|
1079
|
+
try {
|
|
1080
|
+
return (await (async () => {
|
|
1081
|
+
((mapping = await (anonymousMapping(ffi, __eliscript_numeric_mul(maximumPages, 65536), libcLibrary, platform))));
|
|
1082
|
+
((context = new (globalThis.Uint8Array)((__eliscript_numeric_relation(">", ((capabilities) ?? []).length, 0) ? 48 : 32))));
|
|
1083
|
+
((view = new (globalThis.DataView)((context)["buffer"])), (contextWords = new (globalThis.Uint32Array)((context)["buffer"])), (contextPointer = (ffi)["ptr"](context)));
|
|
1084
|
+
(view)["setBigUint64"](0, globalThis.BigInt((mapping)["base"]), true);
|
|
1085
|
+
(view)["setBigUint64"](8, globalThis.BigInt(__eliscript_numeric_mul(initialPages, 65536)), true);
|
|
1086
|
+
(view)["setBigUint64"](16, globalThis.BigInt(__eliscript_numeric_mul(maximumPages, 65536)), true);
|
|
1087
|
+
if (__eliscript_numeric_relation(">", ((capabilities) ?? []).length, 0)) {
|
|
1088
|
+
((callback = acquireHostCallback(ffi, ((actualContext, index, heap, argv) => {
|
|
1006
1089
|
{
|
|
1007
|
-
let
|
|
1008
|
-
|
|
1009
|
-
|
|
1090
|
+
let invLen = ((invocations) ?? []).length;
|
|
1091
|
+
let invocation = (__eliscript_numeric_relation(">", invLen, 0) ? (invocations)[__eliscript_numeric_decrement(invLen)] : undefined);
|
|
1092
|
+
try {
|
|
1093
|
+
if ((!((actualContext === contextPointer)) || !(__eliscript_truthy(memory_truth(invocation))) || __eliscript_truthy(closed))) {
|
|
1094
|
+
((__eliscript_value_59) => { throw __eliscript_value_59; })(new (globalThis.Error)("native host callback is outside its active invocation"));
|
|
1095
|
+
}
|
|
1096
|
+
if ((!(__eliscript_truthy(Number.isInteger(index)) && __eliscript_numeric_relation(">=", index, 0) && __eliscript_numeric_relation("<", index, ((capabilities) ?? []).length)))) {
|
|
1097
|
+
((__eliscript_value_60) => { throw __eliscript_value_60; })(new (globalThis.TypeError)("native host capability index is not declared"));
|
|
1098
|
+
}
|
|
1099
|
+
{
|
|
1100
|
+
let normArgv = (((__eliscript_value_type(argv) === "bigint") && __eliscript_numeric_relation(">=", argv, (__eliscript_tdz_ready_6 === true ? U64_ZERO : __eliscript_tdz_error("U64_ZERO"))) && __eliscript_numeric_relation("<=", argv, (__eliscript_tdz_ready_7 === true ? U64_MAX : __eliscript_tdz_error("U64_MAX")))) ? argv : native_normalize_result("v64", argv));
|
|
1101
|
+
let result = hostCall(index, __eliscript_numeric_ushr(heap, 0), normArgv);
|
|
1102
|
+
if ((!(__eliscript_value_type(result) === "bigint"))) {
|
|
1103
|
+
((__eliscript_value_61) => { throw __eliscript_value_61; })(new (globalThis.TypeError)("native host capability returned an invalid managed value"));
|
|
1104
|
+
}
|
|
1105
|
+
if ((__eliscript_numeric_relation(">=", result, (__eliscript_tdz_ready_6 === true ? U64_ZERO : __eliscript_tdz_error("U64_ZERO"))) && __eliscript_numeric_relation("<=", result, (__eliscript_tdz_ready_7 === true ? U64_MAX : __eliscript_tdz_error("U64_MAX"))))) {
|
|
1106
|
+
return result;
|
|
1107
|
+
} else {
|
|
1108
|
+
return (globalThis.BigInt)["asUintN"](64, result);
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
} catch (error) {
|
|
1112
|
+
if ((__eliscript_truthy(memory_truth(invocation)) && !(__eliscript_truthy((invocation)["hasHostError"])))) {
|
|
1113
|
+
((invocation)["hasHostError"] = true);
|
|
1114
|
+
((invocation)["hostError"] = error);
|
|
1115
|
+
}
|
|
1116
|
+
(view)["setUint32"](24, 5, true);
|
|
1117
|
+
return globalThis.BigInt(0);
|
|
1010
1118
|
}
|
|
1011
|
-
return (globalThis.BigInt)["asUintN"](64, result);
|
|
1012
1119
|
}
|
|
1013
|
-
}
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1120
|
+
}))));
|
|
1121
|
+
(view)["setBigUint64"](32, globalThis.BigInt((callback)["ptr"]), true);
|
|
1122
|
+
}
|
|
1123
|
+
if ((__eliscript_numeric_relation(">", initialPages, 0) && (__eliscript_truthy(roDataSection) || __eliscript_truthy((signature_table)["has"]("heap-new"))))) {
|
|
1124
|
+
(mapping)["setUint32"](4, 1, true);
|
|
1125
|
+
(mapping)["setUint32"](8, 0, true);
|
|
1126
|
+
(mapping)["setUint32"](12, 0, true);
|
|
1127
|
+
}
|
|
1128
|
+
if ((__eliscript_truthy(memory_truth(roDataSection)) && __eliscript_numeric_relation(">", (roDataSection)["size"], 0))) {
|
|
1129
|
+
{
|
|
1130
|
+
let ro_offset = (roDataSection)["fileOffset"];
|
|
1131
|
+
let ro_size = (roDataSection)["size"];
|
|
1132
|
+
let image_end = (roDataHeader)["imageDataEnd"];
|
|
1133
|
+
let required_pages = Math.max(1, Math.ceil(__eliscript_numeric_div(image_end, 65536)));
|
|
1134
|
+
if ((!(__eliscript_truthy(Number.isInteger(ro_offset)) && __eliscript_numeric_relation(">=", ro_offset, 0) && __eliscript_truthy(Number.isInteger(ro_size)) && __eliscript_numeric_relation(">=", ro_size, 0) && __eliscript_truthy(Number.isInteger(image_end)) && __eliscript_numeric_relation(">=", image_end, 256) && __eliscript_numeric_relation(">=", initialPages, required_pages)))) {
|
|
1135
|
+
((__eliscript_value_62) => { throw __eliscript_value_62; })(new (globalThis.TypeError)("native rodata section is invalid or exceeds initialPages"));
|
|
1136
|
+
}
|
|
1137
|
+
{
|
|
1138
|
+
let ro = read_native_section(path, ro_offset, ro_size);
|
|
1139
|
+
(mapping)["write"](ro, 256);
|
|
1140
|
+
(mapping)["setUint32"](72, (roDataHeader)["roBase"], true);
|
|
1141
|
+
(mapping)["setUint32"](76, (roDataHeader)["roDir"], true);
|
|
1142
|
+
(mapping)["setUint32"](80, (roDataHeader)["roCount"], true);
|
|
1143
|
+
(mapping)["setUint32"](84, (roDataHeader)["roImageSlot"], true);
|
|
1144
|
+
(mapping)["setUint32"](88, image_end, true);
|
|
1145
|
+
(mapping)["setUint32"](92, 0, true);
|
|
1146
|
+
(mapping)["setUint32"](96, (roDataHeader)["metaDir"], true);
|
|
1147
|
+
(mapping)["setUint32"](100, (roDataHeader)["metaCount"], true);
|
|
1148
|
+
(mapping)["setUint32"](0, image_end, true);
|
|
1017
1149
|
}
|
|
1018
|
-
(view)["setUint32"](24, 5, true);
|
|
1019
|
-
return globalThis.BigInt(0);
|
|
1020
1150
|
}
|
|
1021
|
-
}
|
|
1151
|
+
}
|
|
1152
|
+
if ((__eliscript_numeric_relation(">", initialPages, 0) && !(__eliscript_truthy(roDataSection)) && __eliscript_truthy((signature_table)["has"]("heap-new")))) {
|
|
1153
|
+
(mapping)["setUint32"](0, 256, true);
|
|
1154
|
+
}
|
|
1155
|
+
return ((library = acquireNativeLibrary(ffi, path, entries)));
|
|
1156
|
+
})());
|
|
1157
|
+
} catch (error) {
|
|
1158
|
+
try {
|
|
1159
|
+
if (__eliscript_truthy(memory_truth(library))) {
|
|
1160
|
+
(library)["close"]();
|
|
1161
|
+
}
|
|
1162
|
+
} catch (ignored) {
|
|
1163
|
+
null;
|
|
1022
1164
|
}
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
(mapping)["setUint32"](12, 0, true);
|
|
1030
|
-
}
|
|
1031
|
-
if ((__eliscript_truthy(memory_truth(roDataSection)) && __eliscript_numeric_relation(">", (roDataSection)["size"], 0))) {
|
|
1032
|
-
{
|
|
1033
|
-
let ro_offset = (roDataSection)["fileOffset"];
|
|
1034
|
-
let ro_size = (roDataSection)["size"];
|
|
1035
|
-
let image_end = (roDataHeader)["imageDataEnd"];
|
|
1036
|
-
let required_pages = Math.max(1, Math.ceil(__eliscript_numeric_div(image_end, 65536)));
|
|
1037
|
-
if ((!(__eliscript_truthy(Number.isInteger(ro_offset)) && __eliscript_numeric_relation(">=", ro_offset, 0) && __eliscript_truthy(Number.isInteger(ro_size)) && __eliscript_numeric_relation(">=", ro_size, 0) && __eliscript_truthy(Number.isInteger(image_end)) && __eliscript_numeric_relation(">=", image_end, 256) && __eliscript_numeric_relation(">=", initialPages, required_pages)))) {
|
|
1038
|
-
((__eliscript_value_67) => { throw __eliscript_value_67; })(new (globalThis.TypeError)("native rodata section is invalid or exceeds initialPages"));
|
|
1165
|
+
try {
|
|
1166
|
+
if (__eliscript_truthy(memory_truth(callback))) {
|
|
1167
|
+
(callback)["close"]();
|
|
1168
|
+
}
|
|
1169
|
+
} catch (ignored) {
|
|
1170
|
+
null;
|
|
1039
1171
|
}
|
|
1040
|
-
{
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
(mapping)["setUint32"](84, (roDataHeader)["roImageSlot"], true);
|
|
1047
|
-
(mapping)["setUint32"](88, image_end, true);
|
|
1048
|
-
(mapping)["setUint32"](92, 0, true);
|
|
1049
|
-
(mapping)["setUint32"](96, (roDataHeader)["metaDir"], true);
|
|
1050
|
-
(mapping)["setUint32"](100, (roDataHeader)["metaCount"], true);
|
|
1051
|
-
(mapping)["setUint32"](0, image_end, true);
|
|
1172
|
+
try {
|
|
1173
|
+
if (__eliscript_truthy(memory_truth(mapping))) {
|
|
1174
|
+
(mapping)["close"]();
|
|
1175
|
+
}
|
|
1176
|
+
} catch (ignored) {
|
|
1177
|
+
null;
|
|
1052
1178
|
}
|
|
1179
|
+
return ((__eliscript_value_63) => { throw __eliscript_value_63; })(error);
|
|
1053
1180
|
}
|
|
1054
|
-
}
|
|
1055
|
-
if ((__eliscript_numeric_relation(">", initialPages, 0) && !(__eliscript_truthy(roDataSection)) && __eliscript_truthy((signature_table)["has"]("heap-new")))) {
|
|
1056
|
-
(mapping)["setUint32"](0, 256, true);
|
|
1057
|
-
}
|
|
1058
|
-
return ((library = acquireNativeLibrary(ffi, path, entries)));
|
|
1059
|
-
})());
|
|
1060
|
-
} catch (error) {
|
|
1061
|
-
(() => {
|
|
1062
|
-
try {
|
|
1063
|
-
if (__eliscript_truthy(memory_truth(library))) {
|
|
1064
|
-
return (library)["close"]();
|
|
1065
|
-
} else {
|
|
1066
|
-
return null;
|
|
1067
|
-
}
|
|
1068
|
-
} catch (ignored) {
|
|
1069
|
-
return null;
|
|
1070
|
-
}
|
|
1071
|
-
})();
|
|
1072
|
-
(() => {
|
|
1073
|
-
try {
|
|
1074
|
-
if (__eliscript_truthy(memory_truth(callback))) {
|
|
1075
|
-
return (callback)["close"]();
|
|
1076
|
-
} else {
|
|
1077
|
-
return null;
|
|
1078
|
-
}
|
|
1079
|
-
} catch (ignored) {
|
|
1080
|
-
return null;
|
|
1081
|
-
}
|
|
1082
|
-
})();
|
|
1083
|
-
(() => {
|
|
1084
|
-
try {
|
|
1085
|
-
if (__eliscript_truthy(memory_truth(mapping))) {
|
|
1086
|
-
return (mapping)["close"]();
|
|
1087
|
-
} else {
|
|
1088
|
-
return null;
|
|
1089
|
-
}
|
|
1090
|
-
} catch (ignored) {
|
|
1091
|
-
return null;
|
|
1092
|
-
}
|
|
1093
|
-
})();
|
|
1094
|
-
return ((__eliscript_value_68) => { throw __eliscript_value_68; })(error);
|
|
1095
|
-
}
|
|
1096
|
-
})());
|
|
1097
|
-
{
|
|
1098
|
-
let dispose = null;
|
|
1099
|
-
let active = null;
|
|
1100
|
-
let size = null;
|
|
1101
|
-
let range = null;
|
|
1102
|
-
(dispose = (() => {
|
|
1103
|
-
if ((!__eliscript_truthy(disposed))) {
|
|
1104
|
-
((disposed = true));
|
|
1181
|
+
})());
|
|
1105
1182
|
{
|
|
1106
|
-
let
|
|
1107
|
-
let
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1183
|
+
let cachedDirectView = null;
|
|
1184
|
+
let cachedDirectSize = 0;
|
|
1185
|
+
{
|
|
1186
|
+
let dispose = null;
|
|
1187
|
+
let active = null;
|
|
1188
|
+
let size = null;
|
|
1189
|
+
let range = null;
|
|
1190
|
+
let beginInvocation = null;
|
|
1191
|
+
let finishInvocation = null;
|
|
1192
|
+
let endInvocation = null;
|
|
1193
|
+
let makeInvoker = null;
|
|
1194
|
+
(dispose = (() => {
|
|
1195
|
+
if ((!__eliscript_truthy(disposed))) {
|
|
1196
|
+
((disposed = true), (cachedDirectView = null), (cachedDirectSize = 0));
|
|
1197
|
+
{
|
|
1198
|
+
let failed = false;
|
|
1199
|
+
let first = undefined;
|
|
1200
|
+
([library, callback, mapping])["forEach"](((owner) => {
|
|
1201
|
+
try {
|
|
1202
|
+
if (__eliscript_truthy(memory_truth(owner))) {
|
|
1203
|
+
return (owner)["close"]();
|
|
1204
|
+
} else {
|
|
1205
|
+
return null;
|
|
1206
|
+
}
|
|
1207
|
+
} catch (error) {
|
|
1208
|
+
if ((!__eliscript_truthy(failed))) {
|
|
1209
|
+
return ((failed = true), (first = error));
|
|
1210
|
+
} else {
|
|
1211
|
+
return null;
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
}));
|
|
1215
|
+
((mapping = null), (context = null), (view = null), (library = null), (callback = null));
|
|
1216
|
+
if (__eliscript_truthy(failed)) {
|
|
1217
|
+
return ((__eliscript_value_64) => { throw __eliscript_value_64; })(first);
|
|
1218
|
+
} else {
|
|
1219
|
+
return null;
|
|
1220
|
+
}
|
|
1115
1221
|
}
|
|
1116
|
-
}
|
|
1117
|
-
|
|
1118
|
-
|
|
1222
|
+
} else {
|
|
1223
|
+
return null;
|
|
1224
|
+
}
|
|
1225
|
+
}));
|
|
1226
|
+
(active = (() => {
|
|
1227
|
+
if (__eliscript_truthy(closed)) {
|
|
1228
|
+
return ((__eliscript_value_65) => { throw __eliscript_value_65; })(new (globalThis.Error)("native memory is closed"));
|
|
1229
|
+
} else {
|
|
1230
|
+
return null;
|
|
1231
|
+
}
|
|
1232
|
+
}));
|
|
1233
|
+
(size = (() => {
|
|
1234
|
+
return ((contextWords)[2] + __eliscript_numeric_mul((contextWords)[3], 4294967296));
|
|
1235
|
+
}));
|
|
1236
|
+
(range = ((offset, length) => {
|
|
1237
|
+
active();
|
|
1238
|
+
if ((!(__eliscript_truthy(Number.isSafeInteger(offset)) && __eliscript_truthy(Number.isSafeInteger(length)) && __eliscript_numeric_relation(">=", offset, 0) && __eliscript_numeric_relation(">=", length, 0) && __eliscript_numeric_relation("<=", (offset + length), size())))) {
|
|
1239
|
+
return ((__eliscript_value_66) => { throw __eliscript_value_66; })(new (globalThis.RangeError)("memory access out of bounds"));
|
|
1240
|
+
} else {
|
|
1241
|
+
return null;
|
|
1242
|
+
}
|
|
1243
|
+
}));
|
|
1244
|
+
(beginInvocation = (() => {
|
|
1245
|
+
active();
|
|
1246
|
+
{
|
|
1247
|
+
let depth = ((invocations) ?? []).length;
|
|
1248
|
+
let invocation = depth0Invocation;
|
|
1249
|
+
if ((depth === 0)) {
|
|
1250
|
+
((invocation)["hasHostError"] = false);
|
|
1251
|
+
((invocation)["hostError"] = undefined);
|
|
1119
1252
|
} else {
|
|
1120
|
-
|
|
1253
|
+
((invocation = ({"hasHostError": false, "hostError": undefined, "prevTrap": 0, "prevSite": 0})));
|
|
1121
1254
|
}
|
|
1255
|
+
((invocation)["prevTrap"] = (contextWords)[6]);
|
|
1256
|
+
((invocation)["prevSite"] = (contextWords)[7]);
|
|
1257
|
+
(invocations)["push"](invocation);
|
|
1258
|
+
((contextWords)[6] = 0);
|
|
1259
|
+
((contextWords)[7] = 0);
|
|
1260
|
+
return invocation;
|
|
1122
1261
|
}
|
|
1123
|
-
})
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
}
|
|
1131
|
-
}
|
|
1132
|
-
} else {
|
|
1133
|
-
return null;
|
|
1134
|
-
}
|
|
1135
|
-
}));
|
|
1136
|
-
(active = (() => {
|
|
1137
|
-
if (__eliscript_truthy(closed)) {
|
|
1138
|
-
return ((__eliscript_value_70) => { throw __eliscript_value_70; })(new (globalThis.Error)("native memory is closed"));
|
|
1139
|
-
} else {
|
|
1140
|
-
return null;
|
|
1141
|
-
}
|
|
1142
|
-
}));
|
|
1143
|
-
(size = (() => {
|
|
1144
|
-
return ((view)["getUint32"](8, true) + __eliscript_numeric_mul((view)["getUint32"](12, true), 4294967296));
|
|
1145
|
-
}));
|
|
1146
|
-
(range = ((offset, length) => {
|
|
1147
|
-
active();
|
|
1148
|
-
if ((!(__eliscript_truthy(Number.isSafeInteger(offset)) && __eliscript_truthy(Number.isSafeInteger(length)) && __eliscript_numeric_relation(">=", offset, 0) && __eliscript_numeric_relation(">=", length, 0) && __eliscript_numeric_relation("<=", (offset + length), size())))) {
|
|
1149
|
-
return ((__eliscript_value_71) => { throw __eliscript_value_71; })(new (globalThis.RangeError)("memory access out of bounds"));
|
|
1150
|
-
} else {
|
|
1151
|
-
return null;
|
|
1152
|
-
}
|
|
1153
|
-
}));
|
|
1154
|
-
{
|
|
1155
|
-
let owned = ({"invoke": ((name, ...args) => {
|
|
1156
|
-
active();
|
|
1157
|
-
{
|
|
1158
|
-
let signature = (signature_table)["get"](name);
|
|
1159
|
-
let argCount = ((args) ?? []).length;
|
|
1160
|
-
let argIndex = 0;
|
|
1161
|
-
if ((signature === undefined)) {
|
|
1162
|
-
((__eliscript_value_72) => { throw __eliscript_value_72; })(new (globalThis.TypeError)("unknown native memory export"));
|
|
1163
|
-
}
|
|
1164
|
-
{
|
|
1165
|
-
let expectedArity = (signature)["arity"];
|
|
1166
|
-
let types = (signature)["parameterTypes"];
|
|
1167
|
-
if ((!(argCount === expectedArity))) {
|
|
1168
|
-
((__eliscript_value_73) => { throw __eliscript_value_73; })(new (globalThis.TypeError)("native memory argument count mismatch"));
|
|
1169
|
-
}
|
|
1170
|
-
while (__eliscript_numeric_relation("<", argIndex, argCount)) {
|
|
1171
|
-
((args)[argIndex] = native_check_argument((types)[argIndex], (args)[argIndex]));
|
|
1172
|
-
((argIndex = (argIndex + 1)));
|
|
1173
|
-
}
|
|
1174
|
-
}
|
|
1175
|
-
{
|
|
1176
|
-
let invocation = ({"hasHostError": false, "hostError": undefined});
|
|
1177
|
-
let previousTrap = (view)["getUint32"](24, true);
|
|
1178
|
-
let previousSite = (view)["getUint32"](28, true);
|
|
1179
|
-
let symbolFn = ((library)["symbols"])[name];
|
|
1180
|
-
let failed = false;
|
|
1181
|
-
(invocations)["push"](invocation);
|
|
1182
|
-
(view)["setUint32"](24, 0, true);
|
|
1183
|
-
(view)["setUint32"](28, 0, true);
|
|
1184
|
-
return (() => {
|
|
1185
|
-
try {
|
|
1262
|
+
}));
|
|
1263
|
+
(finishInvocation = ((invocation, resultNormalizer, rawResult) => {
|
|
1264
|
+
{
|
|
1265
|
+
let result = resultNormalizer(rawResult);
|
|
1266
|
+
if (__eliscript_truthy((invocation)["hasHostError"])) {
|
|
1267
|
+
((__eliscript_value_67) => { throw __eliscript_value_67; })((invocation)["hostError"]);
|
|
1268
|
+
}
|
|
1186
1269
|
{
|
|
1187
|
-
let
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1270
|
+
let error = (contextWords)[6];
|
|
1271
|
+
if ((!(error === 0))) {
|
|
1272
|
+
{
|
|
1273
|
+
let messages = ["native memory trap", "memory access out of bounds", "integer divide by zero", "indirect call index out of bounds", "indirect call signature mismatch", "native host capability failed", "native host capability is unavailable"];
|
|
1274
|
+
let failure = new (globalThis.WebAssembly.RuntimeError)((__eliscript_numeric_relation("<=", error, 6) ? (messages)[error] : "native memory trap"));
|
|
1275
|
+
let site = (preciseSites)["get"]((contextWords)[7]);
|
|
1276
|
+
if ((__eliscript_truthy(memory_truth(site)) && ((site)["code"] === error))) {
|
|
1277
|
+
{
|
|
1278
|
+
let frames = Object.freeze([Object.freeze(({"address": (site)["address"], "offsetBase": "code-section", "functionIndex": (site)["functionIndex"], "returnAddress": false}))]);
|
|
1279
|
+
Object.defineProperty(failure, "eliscriptFrames", ({"value": frames, "enumerable": true, "configurable": true}));
|
|
1280
|
+
if (__eliscript_truthy(memory_truth(sourceMap))) {
|
|
1281
|
+
try {
|
|
1282
|
+
Object.defineProperty(failure, "eliscriptSourceFrames", ({"value": (sourceMap)["mapFrames"](frames), "enumerable": true, "configurable": true}));
|
|
1283
|
+
} catch (ignored) {
|
|
1284
|
+
null;
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1289
|
+
((__eliscript_value_68) => { throw __eliscript_value_68; })(failure);
|
|
1290
|
+
}
|
|
1191
1291
|
}
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1292
|
+
}
|
|
1293
|
+
return result;
|
|
1294
|
+
}
|
|
1295
|
+
}));
|
|
1296
|
+
(endInvocation = ((invocation, failed) => {
|
|
1297
|
+
(invocations)["pop"]();
|
|
1298
|
+
((contextWords)[6] = (invocation)["prevTrap"]);
|
|
1299
|
+
((contextWords)[7] = (invocation)["prevSite"]);
|
|
1300
|
+
if ((invocation === depth0Invocation)) {
|
|
1301
|
+
((depth0Invocation)["hostError"] = undefined);
|
|
1302
|
+
}
|
|
1303
|
+
if ((__eliscript_truthy(closed) && (((invocations) ?? []).length === 0))) {
|
|
1304
|
+
try {
|
|
1305
|
+
return dispose();
|
|
1306
|
+
} catch (error) {
|
|
1307
|
+
if ((!__eliscript_truthy(failed))) {
|
|
1308
|
+
return ((__eliscript_value_69) => { throw __eliscript_value_69; })(error);
|
|
1309
|
+
} else {
|
|
1310
|
+
return null;
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
} else {
|
|
1314
|
+
return null;
|
|
1315
|
+
}
|
|
1316
|
+
}));
|
|
1317
|
+
(makeInvoker = ((signature, symbolFn) => {
|
|
1318
|
+
{
|
|
1319
|
+
let expectedArity = (signature)["arity"];
|
|
1320
|
+
let types = (signature)["parameterTypes"];
|
|
1321
|
+
let resultNormalizer = make_result_normalizer((signature)["resultType"]);
|
|
1322
|
+
if ((expectedArity === 0)) {
|
|
1323
|
+
return (() => {
|
|
1324
|
+
{
|
|
1325
|
+
let invocation = beginInvocation();
|
|
1326
|
+
let failed = false;
|
|
1327
|
+
try {
|
|
1328
|
+
return finishInvocation(invocation, resultNormalizer, symbolFn(contextPointer));
|
|
1329
|
+
} catch (error) {
|
|
1330
|
+
((failed = true));
|
|
1331
|
+
return ((__eliscript_value_70) => { throw __eliscript_value_70; })(error);
|
|
1332
|
+
} finally {
|
|
1333
|
+
endInvocation(invocation, failed);
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
});
|
|
1337
|
+
} else {
|
|
1338
|
+
if ((expectedArity === 1)) {
|
|
1339
|
+
{
|
|
1340
|
+
let c0 = make_arg_checker((types)[0]);
|
|
1341
|
+
return ((a0) => {
|
|
1342
|
+
{
|
|
1343
|
+
let v0 = c0(a0);
|
|
1344
|
+
let invocation = beginInvocation();
|
|
1345
|
+
let failed = false;
|
|
1346
|
+
try {
|
|
1347
|
+
return finishInvocation(invocation, resultNormalizer, symbolFn(contextPointer, v0));
|
|
1348
|
+
} catch (error) {
|
|
1349
|
+
((failed = true));
|
|
1350
|
+
return ((__eliscript_value_71) => { throw __eliscript_value_71; })(error);
|
|
1351
|
+
} finally {
|
|
1352
|
+
endInvocation(invocation, failed);
|
|
1353
|
+
}
|
|
1354
|
+
}
|
|
1355
|
+
});
|
|
1356
|
+
}
|
|
1357
|
+
} else {
|
|
1358
|
+
if ((expectedArity === 2)) {
|
|
1195
1359
|
{
|
|
1196
|
-
let
|
|
1197
|
-
let
|
|
1198
|
-
|
|
1199
|
-
if ((__eliscript_truthy(memory_truth(site)) && ((site)["code"] === error))) {
|
|
1360
|
+
let c0 = make_arg_checker((types)[0]);
|
|
1361
|
+
let c1 = make_arg_checker((types)[1]);
|
|
1362
|
+
return ((a0, a1) => {
|
|
1200
1363
|
{
|
|
1201
|
-
let
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1364
|
+
let v0 = c0(a0);
|
|
1365
|
+
let v1 = c1(a1);
|
|
1366
|
+
let invocation = beginInvocation();
|
|
1367
|
+
let failed = false;
|
|
1368
|
+
try {
|
|
1369
|
+
return finishInvocation(invocation, resultNormalizer, symbolFn(contextPointer, v0, v1));
|
|
1370
|
+
} catch (error) {
|
|
1371
|
+
((failed = true));
|
|
1372
|
+
return ((__eliscript_value_72) => { throw __eliscript_value_72; })(error);
|
|
1373
|
+
} finally {
|
|
1374
|
+
endInvocation(invocation, failed);
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
});
|
|
1378
|
+
}
|
|
1379
|
+
} else {
|
|
1380
|
+
if ((expectedArity === 3)) {
|
|
1381
|
+
{
|
|
1382
|
+
let c0 = make_arg_checker((types)[0]);
|
|
1383
|
+
let c1 = make_arg_checker((types)[1]);
|
|
1384
|
+
let c2 = make_arg_checker((types)[2]);
|
|
1385
|
+
return ((a0, a1, a2) => {
|
|
1386
|
+
{
|
|
1387
|
+
let v0 = c0(a0);
|
|
1388
|
+
let v1 = c1(a1);
|
|
1389
|
+
let v2 = c2(a2);
|
|
1390
|
+
let invocation = beginInvocation();
|
|
1391
|
+
let failed = false;
|
|
1392
|
+
try {
|
|
1393
|
+
return finishInvocation(invocation, resultNormalizer, symbolFn(contextPointer, v0, v1, v2));
|
|
1394
|
+
} catch (error) {
|
|
1395
|
+
((failed = true));
|
|
1396
|
+
return ((__eliscript_value_73) => { throw __eliscript_value_73; })(error);
|
|
1397
|
+
} finally {
|
|
1398
|
+
endInvocation(invocation, failed);
|
|
1399
|
+
}
|
|
1400
|
+
}
|
|
1401
|
+
});
|
|
1402
|
+
}
|
|
1403
|
+
} else {
|
|
1404
|
+
if ((expectedArity === 4)) {
|
|
1405
|
+
{
|
|
1406
|
+
let c0 = make_arg_checker((types)[0]);
|
|
1407
|
+
let c1 = make_arg_checker((types)[1]);
|
|
1408
|
+
let c2 = make_arg_checker((types)[2]);
|
|
1409
|
+
let c3 = make_arg_checker((types)[3]);
|
|
1410
|
+
return ((a0, a1, a2, a3) => {
|
|
1411
|
+
{
|
|
1412
|
+
let v0 = c0(a0);
|
|
1413
|
+
let v1 = c1(a1);
|
|
1414
|
+
let v2 = c2(a2);
|
|
1415
|
+
let v3 = c3(a3);
|
|
1416
|
+
let invocation = beginInvocation();
|
|
1417
|
+
let failed = false;
|
|
1205
1418
|
try {
|
|
1206
|
-
return
|
|
1207
|
-
} catch (
|
|
1208
|
-
|
|
1419
|
+
return finishInvocation(invocation, resultNormalizer, symbolFn(contextPointer, v0, v1, v2, v3));
|
|
1420
|
+
} catch (error) {
|
|
1421
|
+
((failed = true));
|
|
1422
|
+
return ((__eliscript_value_74) => { throw __eliscript_value_74; })(error);
|
|
1423
|
+
} finally {
|
|
1424
|
+
endInvocation(invocation, failed);
|
|
1209
1425
|
}
|
|
1210
|
-
}
|
|
1426
|
+
}
|
|
1427
|
+
});
|
|
1428
|
+
}
|
|
1429
|
+
} else {
|
|
1430
|
+
if ((expectedArity === 5)) {
|
|
1431
|
+
{
|
|
1432
|
+
let c0 = make_arg_checker((types)[0]);
|
|
1433
|
+
let c1 = make_arg_checker((types)[1]);
|
|
1434
|
+
let c2 = make_arg_checker((types)[2]);
|
|
1435
|
+
let c3 = make_arg_checker((types)[3]);
|
|
1436
|
+
let c4 = make_arg_checker((types)[4]);
|
|
1437
|
+
return ((a0, a1, a2, a3, a4) => {
|
|
1438
|
+
{
|
|
1439
|
+
let v0 = c0(a0);
|
|
1440
|
+
let v1 = c1(a1);
|
|
1441
|
+
let v2 = c2(a2);
|
|
1442
|
+
let v3 = c3(a3);
|
|
1443
|
+
let v4 = c4(a4);
|
|
1444
|
+
let invocation = beginInvocation();
|
|
1445
|
+
let failed = false;
|
|
1446
|
+
try {
|
|
1447
|
+
return finishInvocation(invocation, resultNormalizer, symbolFn(contextPointer, v0, v1, v2, v3, v4));
|
|
1448
|
+
} catch (error) {
|
|
1449
|
+
((failed = true));
|
|
1450
|
+
return ((__eliscript_value_75) => { throw __eliscript_value_75; })(error);
|
|
1451
|
+
} finally {
|
|
1452
|
+
endInvocation(invocation, failed);
|
|
1453
|
+
}
|
|
1454
|
+
}
|
|
1455
|
+
});
|
|
1456
|
+
}
|
|
1457
|
+
} else {
|
|
1458
|
+
if ((expectedArity === 7)) {
|
|
1459
|
+
{
|
|
1460
|
+
let c0 = make_arg_checker((types)[0]);
|
|
1461
|
+
let c1 = make_arg_checker((types)[1]);
|
|
1462
|
+
let c2 = make_arg_checker((types)[2]);
|
|
1463
|
+
let c3 = make_arg_checker((types)[3]);
|
|
1464
|
+
let c4 = make_arg_checker((types)[4]);
|
|
1465
|
+
let c5 = make_arg_checker((types)[5]);
|
|
1466
|
+
let c6 = make_arg_checker((types)[6]);
|
|
1467
|
+
return ((a0, a1, a2, a3, a4, a5, a6) => {
|
|
1468
|
+
{
|
|
1469
|
+
let v0 = c0(a0);
|
|
1470
|
+
let v1 = c1(a1);
|
|
1471
|
+
let v2 = c2(a2);
|
|
1472
|
+
let v3 = c3(a3);
|
|
1473
|
+
let v4 = c4(a4);
|
|
1474
|
+
let v5 = c5(a5);
|
|
1475
|
+
let v6 = c6(a6);
|
|
1476
|
+
let invocation = beginInvocation();
|
|
1477
|
+
let failed = false;
|
|
1478
|
+
try {
|
|
1479
|
+
return finishInvocation(invocation, resultNormalizer, symbolFn(contextPointer, v0, v1, v2, v3, v4, v5, v6));
|
|
1480
|
+
} catch (error) {
|
|
1481
|
+
((failed = true));
|
|
1482
|
+
return ((__eliscript_value_76) => { throw __eliscript_value_76; })(error);
|
|
1483
|
+
} finally {
|
|
1484
|
+
endInvocation(invocation, failed);
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
});
|
|
1488
|
+
}
|
|
1489
|
+
} else {
|
|
1490
|
+
{
|
|
1491
|
+
let checkers = (types)["map"](make_arg_checker);
|
|
1492
|
+
return ((...args) => {
|
|
1493
|
+
active();
|
|
1494
|
+
{
|
|
1495
|
+
let argCount = ((args) ?? []).length;
|
|
1496
|
+
if ((!(argCount === expectedArity))) {
|
|
1497
|
+
((__eliscript_value_77) => { throw __eliscript_value_77; })(new (globalThis.TypeError)("native memory argument count mismatch"));
|
|
1498
|
+
}
|
|
1499
|
+
{
|
|
1500
|
+
let argIndex = 0;
|
|
1501
|
+
while (__eliscript_numeric_relation("<", argIndex, argCount)) {
|
|
1502
|
+
((args)[argIndex] = ((checkers)[argIndex])((args)[argIndex]));
|
|
1503
|
+
((argIndex = (argIndex + 1)));
|
|
1504
|
+
}
|
|
1505
|
+
}
|
|
1506
|
+
{
|
|
1507
|
+
let invocation = beginInvocation();
|
|
1508
|
+
let failed = false;
|
|
1509
|
+
try {
|
|
1510
|
+
return finishInvocation(invocation, resultNormalizer, __eliscript_at(Reflect, "apply")(symbolFn, (library)["symbols"], ([contextPointer])["concat"](args)));
|
|
1511
|
+
} catch (error) {
|
|
1512
|
+
((failed = true));
|
|
1513
|
+
return ((__eliscript_value_78) => { throw __eliscript_value_78; })(error);
|
|
1514
|
+
} finally {
|
|
1515
|
+
endInvocation(invocation, failed);
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1518
|
+
}
|
|
1519
|
+
});
|
|
1520
|
+
}
|
|
1211
1521
|
}
|
|
1212
1522
|
}
|
|
1213
1523
|
}
|
|
1214
|
-
((__eliscript_value_75) => { throw __eliscript_value_75; })(failure);
|
|
1215
1524
|
}
|
|
1216
1525
|
}
|
|
1217
1526
|
}
|
|
1218
|
-
return result;
|
|
1219
1527
|
}
|
|
1220
|
-
}
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
(
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1528
|
+
}
|
|
1529
|
+
}));
|
|
1530
|
+
{
|
|
1531
|
+
let invokers = Object.create(null);
|
|
1532
|
+
let _build = ((idx) => {
|
|
1533
|
+
while (__eliscript_numeric_relation("<", idx, ((entries) ?? []).length)) {
|
|
1534
|
+
{
|
|
1535
|
+
let entry = (entries)[idx];
|
|
1536
|
+
let name = (entry)[0];
|
|
1537
|
+
let sig = (entry)[1];
|
|
1538
|
+
let sym = ((library)["symbols"])[name];
|
|
1539
|
+
((invokers)[name] = makeInvoker(sig, sym));
|
|
1540
|
+
}
|
|
1541
|
+
((idx = (idx + 1)));
|
|
1542
|
+
}
|
|
1543
|
+
return null;
|
|
1544
|
+
})(0);
|
|
1545
|
+
let owned = ({"invoke": ((name, ...args) => {
|
|
1546
|
+
active();
|
|
1547
|
+
{
|
|
1548
|
+
let invoker = (invokers)[name];
|
|
1549
|
+
let sig = (signature_table)["get"](name);
|
|
1550
|
+
if ((invoker === undefined)) {
|
|
1551
|
+
((__eliscript_value_79) => { throw __eliscript_value_79; })(new (globalThis.TypeError)("unknown native memory export"));
|
|
1552
|
+
}
|
|
1553
|
+
if ((!(((args) ?? []).length === (sig)["arity"]))) {
|
|
1554
|
+
((__eliscript_value_80) => { throw __eliscript_value_80; })(new (globalThis.TypeError)("native memory argument count mismatch"));
|
|
1555
|
+
}
|
|
1556
|
+
{
|
|
1557
|
+
let argCount = ((args) ?? []).length;
|
|
1558
|
+
if ((argCount === 0)) {
|
|
1559
|
+
return invoker();
|
|
1560
|
+
} else {
|
|
1561
|
+
if ((argCount === 1)) {
|
|
1562
|
+
return invoker((args)[0]);
|
|
1563
|
+
} else {
|
|
1564
|
+
if ((argCount === 2)) {
|
|
1565
|
+
return invoker((args)[0], (args)[1]);
|
|
1566
|
+
} else {
|
|
1567
|
+
if ((argCount === 3)) {
|
|
1568
|
+
return invoker((args)[0], (args)[1], (args)[2]);
|
|
1569
|
+
} else {
|
|
1570
|
+
if ((argCount === 4)) {
|
|
1571
|
+
return invoker((args)[0], (args)[1], (args)[2], (args)[3]);
|
|
1572
|
+
} else {
|
|
1573
|
+
if ((argCount === 5)) {
|
|
1574
|
+
return invoker((args)[0], (args)[1], (args)[2], (args)[3], (args)[4]);
|
|
1575
|
+
} else {
|
|
1576
|
+
if ((argCount === 7)) {
|
|
1577
|
+
return invoker((args)[0], (args)[1], (args)[2], (args)[3], (args)[4], (args)[5], (args)[6]);
|
|
1578
|
+
} else {
|
|
1579
|
+
return __eliscript_at(Reflect, "apply")(invoker, undefined, args);
|
|
1580
|
+
}
|
|
1581
|
+
}
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
}
|
|
1585
|
+
}
|
|
1586
|
+
}
|
|
1587
|
+
}
|
|
1588
|
+
}
|
|
1589
|
+
}), "getUint16": ((offset, endian) => {
|
|
1590
|
+
if ((!(!(__eliscript_truthy(closed)) && ((contextWords)[3] === 0) && __eliscript_numeric_relation(">=", offset, 0) && (__eliscript_numeric_or(offset, 0) === offset) && __eliscript_numeric_relation("<=", (offset + 2), (contextWords)[2])))) {
|
|
1591
|
+
range(offset, 2);
|
|
1592
|
+
}
|
|
1593
|
+
return (mapping)["getUint16"](offset, endian);
|
|
1594
|
+
}), "getUint32": ((offset, endian) => {
|
|
1595
|
+
if ((!(!(__eliscript_truthy(closed)) && ((contextWords)[3] === 0) && __eliscript_numeric_relation(">=", offset, 0) && (__eliscript_numeric_or(offset, 0) === offset) && __eliscript_numeric_relation("<=", (offset + 4), (contextWords)[2])))) {
|
|
1596
|
+
range(offset, 4);
|
|
1597
|
+
}
|
|
1598
|
+
return (mapping)["getUint32"](offset, endian);
|
|
1599
|
+
}), "getBigUint64": ((offset, endian) => {
|
|
1600
|
+
if ((!(!(__eliscript_truthy(closed)) && ((contextWords)[3] === 0) && __eliscript_numeric_relation(">=", offset, 0) && (__eliscript_numeric_or(offset, 0) === offset) && __eliscript_numeric_relation("<=", (offset + 8), (contextWords)[2])))) {
|
|
1601
|
+
range(offset, 8);
|
|
1602
|
+
}
|
|
1603
|
+
return (mapping)["getBigUint64"](offset, endian);
|
|
1604
|
+
}), "getFloat64": ((offset, endian) => {
|
|
1605
|
+
if ((!(!(__eliscript_truthy(closed)) && ((contextWords)[3] === 0) && __eliscript_numeric_relation(">=", offset, 0) && (__eliscript_numeric_or(offset, 0) === offset) && __eliscript_numeric_relation("<=", (offset + 8), (contextWords)[2])))) {
|
|
1606
|
+
range(offset, 8);
|
|
1607
|
+
}
|
|
1608
|
+
return (mapping)["getFloat64"](offset, endian);
|
|
1609
|
+
}), "setUint16": ((offset, value, endian) => {
|
|
1610
|
+
{
|
|
1611
|
+
let converted = Math.trunc(value);
|
|
1612
|
+
if ((!(!(__eliscript_truthy(closed)) && ((contextWords)[3] === 0) && __eliscript_numeric_relation(">=", offset, 0) && (__eliscript_numeric_or(offset, 0) === offset) && __eliscript_numeric_relation("<=", (offset + 2), (contextWords)[2])))) {
|
|
1613
|
+
range(offset, 2);
|
|
1614
|
+
}
|
|
1615
|
+
return (mapping)["setUint16"](offset, converted, endian);
|
|
1616
|
+
}
|
|
1617
|
+
}), "setUint32": ((offset, value, endian) => {
|
|
1618
|
+
{
|
|
1619
|
+
let converted = Math.trunc(value);
|
|
1620
|
+
if ((!(!(__eliscript_truthy(closed)) && ((contextWords)[3] === 0) && __eliscript_numeric_relation(">=", offset, 0) && (__eliscript_numeric_or(offset, 0) === offset) && __eliscript_numeric_relation("<=", (offset + 4), (contextWords)[2])))) {
|
|
1621
|
+
range(offset, 4);
|
|
1622
|
+
}
|
|
1623
|
+
return (mapping)["setUint32"](offset, converted, endian);
|
|
1624
|
+
}
|
|
1625
|
+
}), "setBigUint64": ((offset, value, endian) => {
|
|
1626
|
+
active();
|
|
1627
|
+
if ((!(__eliscript_truthy(Number.isSafeInteger(offset)) && __eliscript_numeric_relation(">=", offset, 0)))) {
|
|
1628
|
+
((__eliscript_value_81) => { throw __eliscript_value_81; })(new (globalThis.RangeError)("memory access out of bounds"));
|
|
1629
|
+
}
|
|
1630
|
+
if ((!(__eliscript_value_type(value) === "bigint"))) {
|
|
1631
|
+
((__eliscript_value_82) => { throw __eliscript_value_82; })(new (globalThis.TypeError)("native 64-bit scalar write requires a bigint"));
|
|
1632
|
+
}
|
|
1633
|
+
range(offset, 8);
|
|
1634
|
+
return (mapping)["setBigUint64"](offset, (globalThis.BigInt)["asUintN"](64, value), endian);
|
|
1635
|
+
}), "read": ((offset, length) => {
|
|
1636
|
+
range(offset, length);
|
|
1637
|
+
return (mapping)["read"](offset, length);
|
|
1638
|
+
}), "write": ((input, ...positions) => {
|
|
1639
|
+
{
|
|
1640
|
+
let offset = memory_default((positions)[0], 0);
|
|
1641
|
+
if ((!__eliscript_truthy(__eliscript_at(globalThis.Uint8Array, globalThis.Symbol.hasInstance)(input)))) {
|
|
1642
|
+
((__eliscript_value_83) => { throw __eliscript_value_83; })(new (globalThis.TypeError)("memory write requires Uint8Array"));
|
|
1643
|
+
}
|
|
1644
|
+
{
|
|
1645
|
+
let copy = new (globalThis.Uint8Array)(input);
|
|
1646
|
+
range(offset, (copy)["byteLength"]);
|
|
1647
|
+
(mapping)["write"](copy, offset);
|
|
1648
|
+
}
|
|
1649
|
+
}
|
|
1650
|
+
return undefined;
|
|
1651
|
+
}), "directView": (() => {
|
|
1652
|
+
if (__eliscript_truthy(closed)) {
|
|
1653
|
+
return null;
|
|
1654
|
+
} else {
|
|
1655
|
+
{
|
|
1656
|
+
let curSize = (((contextWords)[3] === 0) ? (contextWords)[2] : 0);
|
|
1657
|
+
if ((__eliscript_truthy(cachedDirectView) && (cachedDirectSize === curSize))) {
|
|
1658
|
+
return cachedDirectView;
|
|
1659
|
+
} else {
|
|
1660
|
+
if (__eliscript_numeric_relation(">", curSize, 0)) {
|
|
1661
|
+
((cachedDirectView = new (globalThis.DataView)((ffi)["toArrayBuffer"]((mapping)["base"], 0, curSize))), (cachedDirectSize = curSize));
|
|
1662
|
+
return cachedDirectView;
|
|
1234
1663
|
} else {
|
|
1235
1664
|
return null;
|
|
1236
1665
|
}
|
|
1237
1666
|
}
|
|
1238
|
-
}
|
|
1667
|
+
}
|
|
1239
1668
|
}
|
|
1240
|
-
}
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
}), "setUint16": ((offset, value, endian) => {
|
|
1257
|
-
{
|
|
1258
|
-
let converted = Math.trunc(value);
|
|
1259
|
-
range(offset, 2);
|
|
1260
|
-
return (mapping)["setUint16"](offset, converted, endian);
|
|
1261
|
-
}
|
|
1262
|
-
}), "setUint32": ((offset, value, endian) => {
|
|
1263
|
-
{
|
|
1264
|
-
let converted = Math.trunc(value);
|
|
1265
|
-
range(offset, 4);
|
|
1266
|
-
return (mapping)["setUint32"](offset, converted, endian);
|
|
1267
|
-
}
|
|
1268
|
-
}), "setBigUint64": ((offset, value, endian) => {
|
|
1269
|
-
active();
|
|
1270
|
-
if ((!(__eliscript_truthy(Number.isSafeInteger(offset)) && __eliscript_numeric_relation(">=", offset, 0)))) {
|
|
1271
|
-
((__eliscript_value_78) => { throw __eliscript_value_78; })(new (globalThis.RangeError)("memory access out of bounds"));
|
|
1272
|
-
}
|
|
1273
|
-
if ((!(__eliscript_value_type(value) === "bigint"))) {
|
|
1274
|
-
((__eliscript_value_79) => { throw __eliscript_value_79; })(new (globalThis.TypeError)("native 64-bit scalar write requires a bigint"));
|
|
1275
|
-
}
|
|
1276
|
-
range(offset, 8);
|
|
1277
|
-
return (mapping)["setBigUint64"](offset, (globalThis.BigInt)["asUintN"](64, value), endian);
|
|
1278
|
-
}), "read": ((offset, length) => {
|
|
1279
|
-
range(offset, length);
|
|
1280
|
-
return (mapping)["read"](offset, length);
|
|
1281
|
-
}), "write": ((input, ...positions) => {
|
|
1282
|
-
{
|
|
1283
|
-
let offset = memory_default((positions)[0], 0);
|
|
1284
|
-
if ((!__eliscript_truthy(__eliscript_at(globalThis.Uint8Array, globalThis.Symbol.hasInstance)(input)))) {
|
|
1285
|
-
((__eliscript_value_80) => { throw __eliscript_value_80; })(new (globalThis.TypeError)("memory write requires Uint8Array"));
|
|
1286
|
-
}
|
|
1287
|
-
{
|
|
1288
|
-
let copy = new (globalThis.Uint8Array)(input);
|
|
1289
|
-
range(offset, (copy)["byteLength"]);
|
|
1290
|
-
(mapping)["write"](copy, offset);
|
|
1291
|
-
}
|
|
1292
|
-
}
|
|
1293
|
-
return undefined;
|
|
1294
|
-
}), "close": (() => {
|
|
1295
|
-
if ((!__eliscript_truthy(closed))) {
|
|
1296
|
-
((closed = true));
|
|
1297
|
-
if ((((invocations) ?? []).length === 0)) {
|
|
1298
|
-
dispose();
|
|
1669
|
+
}), "close": (() => {
|
|
1670
|
+
if ((!__eliscript_truthy(closed))) {
|
|
1671
|
+
((closed = true), (cachedDirectView = null), (cachedDirectSize = 0));
|
|
1672
|
+
if ((((invocations) ?? []).length === 0)) {
|
|
1673
|
+
dispose();
|
|
1674
|
+
}
|
|
1675
|
+
}
|
|
1676
|
+
return undefined;
|
|
1677
|
+
})});
|
|
1678
|
+
((__eliscript_tdz_ready_3 === true ? owned_invoker_tables : __eliscript_tdz_error("owned_invoker_tables")))["set"](owned, invokers);
|
|
1679
|
+
Object.defineProperty(owned, "byteLength", ({"enumerable": true, "configurable": true, "get": (() => {
|
|
1680
|
+
active();
|
|
1681
|
+
return size();
|
|
1682
|
+
})}));
|
|
1683
|
+
return owned;
|
|
1684
|
+
}
|
|
1299
1685
|
}
|
|
1300
1686
|
}
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
}
|
|
1309
|
-
}
|
|
1310
|
-
})());
|
|
1311
|
-
})([]));
|
|
1312
|
-
})(false));
|
|
1313
|
-
})(false));
|
|
1687
|
+
})());
|
|
1688
|
+
})(({"hasHostError": false, "hostError": undefined, "prevTrap": 0, "prevSite": 0})));
|
|
1689
|
+
})([]));
|
|
1690
|
+
})(false));
|
|
1691
|
+
})(false));
|
|
1692
|
+
})(undefined));
|
|
1693
|
+
})(undefined));
|
|
1314
1694
|
})(undefined));
|
|
1315
1695
|
})(undefined));
|
|
1316
1696
|
})(undefined));
|
|
1317
1697
|
})(undefined));
|
|
1318
1698
|
})(undefined));
|
|
1319
|
-
})(
|
|
1320
|
-
})(
|
|
1321
|
-
})(
|
|
1699
|
+
})((__eliscript_truthy(is_bun) ? require("bun:ffi") : await (openNodeInProcessFFI(platform)))));
|
|
1700
|
+
})((__eliscript_truthy(is_bun) ? createRequire((globalThis.process)["execPath"]) : null)));
|
|
1701
|
+
})(memory_truth(((globalThis.process)["versions"])["bun"]))));
|
|
1322
1702
|
})(new (globalThis.Map)(entries)));
|
|
1323
1703
|
})());
|
|
1324
1704
|
})((Object.entries(signatures))["map"](((entry) => {
|
|
1325
1705
|
{
|
|
1326
1706
|
let signature = (entry)[1];
|
|
1327
|
-
let arity = ((__eliscript_truthy(memory_truth(signature)) && ((signature)["arity"] === undefined) && __eliscript_truthy(Array.isArray((signature)["parameterTypes"]))) ? (((signature)["parameterTypes"]) ?? []).length : ((
|
|
1707
|
+
let arity = ((__eliscript_truthy(memory_truth(signature)) && ((signature)["arity"] === undefined) && __eliscript_truthy(Array.isArray((signature)["parameterTypes"]))) ? (((signature)["parameterTypes"]) ?? []).length : ((__eliscript_value_56) => (__eliscript_truthy(__eliscript_value_56) ? (signature)["arity"] : __eliscript_value_56))(memory_truth(signature)));
|
|
1328
1708
|
let types = native_parameter_types(signature, arity);
|
|
1329
1709
|
return [(entry)[0], Object.freeze(({"arity": arity, "parameterTypes": Object.freeze((types)["slice"]()), "resultType": (signature)["resultType"]}))];
|
|
1330
1710
|
}
|
|
@@ -1345,8 +1725,8 @@ async function openNativeMemory(path, signatures, ...arguments$) {
|
|
|
1345
1725
|
})((options)["nativeTarget"]));
|
|
1346
1726
|
})(memory_default((options)["maximumPages"], initialPages)));
|
|
1347
1727
|
})(memory_default((options)["initialPages"], 1)));
|
|
1348
|
-
})(((options === null) ? ((
|
|
1728
|
+
})(((options === null) ? ((__eliscript_value_46) => { throw __eliscript_value_46; })(new (globalThis.TypeError)("native memory options cannot be null")) : null)));
|
|
1349
1729
|
})((((((arguments$) ?? []).length === 0) || ((arguments$)[0] === undefined)) ? ({}) : (arguments$)[0])));
|
|
1350
1730
|
}
|
|
1351
|
-
export {openNativeMemory};
|
|
1731
|
+
export {openNativeMemory, nativeMemoryInvokers};
|
|
1352
1732
|
//# sourceMappingURL=native-memory.mjs.map
|