eliscript 0.0.1 → 0.0.3
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/README.md +61 -0
- package/bootstrap/README.md +26 -0
- package/bootstrap/backends/README.md +515 -0
- package/bootstrap/backends/async.eli +230 -0
- package/bootstrap/backends/binary.eli +173 -0
- package/bootstrap/backends/capabilities.eli +74 -0
- package/bootstrap/backends/elf.eli +246 -0
- package/bootstrap/backends/managed.eli +5976 -0
- package/bootstrap/backends/memory.eli +100 -0
- package/bootstrap/backends/native.eli +2000 -0
- package/bootstrap/backends/numeric.eli +1362 -0
- package/bootstrap/backends/optimize.eli +79 -0
- package/bootstrap/backends/regexp.eli +2263 -0
- package/bootstrap/backends/sha256.eli +138 -0
- package/bootstrap/backends/wasm.eli +1161 -0
- package/bootstrap/compiler/analyzer.eli +165 -77
- package/bootstrap/compiler/compiler.eli +43 -19
- package/bootstrap/compiler/emitter.eli +780 -170
- package/bootstrap/compiler/expander.eli +136 -45
- package/bootstrap/compiler/formatter.eli +8 -1
- package/bootstrap/compiler/ir.eli +148 -45
- package/bootstrap/compiler/lower.eli +29 -2
- package/bootstrap/compiler/project.eli +51 -21
- package/bootstrap/compiler/reader.eli +128 -36
- package/bootstrap/compiler/source-map.eli +46 -4
- package/bootstrap/compiler/symbol.eli +2 -1
- package/bootstrap/compiler/syntax.eli +47 -12
- package/bootstrap/compiler/transient-analysis.eli +40 -4
- package/bootstrap/host/check-cli-legacy.mjs +163 -0
- package/bootstrap/host/check-cli.mjs +59 -158
- package/bootstrap/host/check-cli.mjs.map +1 -0
- package/bootstrap/host/compiler-session.eli +1579 -0
- package/bootstrap/host/compiler-tools.eli +513 -0
- package/bootstrap/host/eliscript-cli.mjs +53 -33
- package/bootstrap/host/eliscript-cli.mjs.map +1 -0
- package/bootstrap/host/project-cli-legacy.mjs +295 -0
- package/bootstrap/host/project-cli.mjs +74 -289
- package/bootstrap/host/project-cli.mjs.map +1 -0
- package/bootstrap/host/project-legacy.mjs +1080 -0
- package/bootstrap/host/project.mjs +210 -1060
- package/bootstrap/host/project.mjs.map +1 -0
- package/bootstrap/runtime/UNICODE-LICENSE.txt +39 -0
- package/bootstrap/runtime/memory.eli +30379 -0
- package/browser/host.mjs +732 -11
- package/browser/worker.mjs +6 -3
- package/compiler/eliscript-analyzer.el +371 -4
- package/compiler/eliscript-cli.el +84 -1
- package/compiler/eliscript-emitter.el +1189 -256
- package/compiler/eliscript-expander.el +147 -10
- package/compiler/eliscript-ir-emitter.el +725 -208
- package/compiler/eliscript-lower.el +127 -1
- package/compiler/eliscript-portable.el +177 -51
- package/compiler/eliscript-project.el +20 -2
- package/compiler/eliscript-reader.el +141 -57
- package/compiler/eliscript-source-map.el +26 -12
- package/compiler/eliscript-transient-analysis.el +382 -19
- package/dist/backends/async.mjs +561 -0
- package/dist/backends/async.mjs.macro-origins.json +1 -0
- package/dist/backends/async.mjs.map +1 -0
- package/dist/backends/binary.mjs +381 -0
- package/dist/backends/binary.mjs.macro-origins.json +1 -0
- package/dist/backends/binary.mjs.map +1 -0
- package/dist/backends/capabilities.mjs +237 -0
- package/dist/backends/capabilities.mjs.macro-origins.json +1 -0
- package/dist/backends/capabilities.mjs.map +1 -0
- package/dist/backends/elf.mjs +540 -0
- package/dist/backends/elf.mjs.macro-origins.json +1 -0
- package/dist/backends/elf.mjs.map +1 -0
- package/dist/backends/managed.mjs +10616 -0
- package/dist/backends/managed.mjs.macro-origins.json +1 -0
- package/dist/backends/managed.mjs.map +1 -0
- package/dist/backends/memory.mjs +278 -0
- package/dist/backends/memory.mjs.macro-origins.json +1 -0
- package/dist/backends/memory.mjs.map +1 -0
- package/dist/backends/native.mjs +4099 -0
- package/dist/backends/native.mjs.macro-origins.json +1 -0
- package/dist/backends/native.mjs.map +1 -0
- package/dist/backends/numeric.mjs +2458 -0
- package/dist/backends/numeric.mjs.macro-origins.json +1 -0
- package/dist/backends/numeric.mjs.map +1 -0
- package/dist/backends/optimize.mjs +204 -0
- package/dist/backends/optimize.mjs.macro-origins.json +1 -0
- package/dist/backends/optimize.mjs.map +1 -0
- package/dist/backends/regexp.mjs +2033 -0
- package/dist/backends/regexp.mjs.macro-origins.json +1 -0
- package/dist/backends/regexp.mjs.map +1 -0
- package/dist/backends/sha256.mjs +310 -0
- package/dist/backends/sha256.mjs.macro-origins.json +1 -0
- package/dist/backends/sha256.mjs.map +1 -0
- package/dist/backends/wasm.mjs +2258 -0
- package/dist/backends/wasm.mjs.macro-origins.json +1 -0
- package/dist/backends/wasm.mjs.map +1 -0
- package/dist/bootstrap/analyzer.mjs +1908 -776
- package/dist/bootstrap/analyzer.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/analyzer.mjs.map +1 -1
- package/dist/bootstrap/compiler.mjs +450 -142
- package/dist/bootstrap/compiler.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/compiler.mjs.map +1 -1
- package/dist/bootstrap/emitter.mjs +3083 -909
- package/dist/bootstrap/emitter.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/emitter.mjs.map +1 -1
- package/dist/bootstrap/expander.mjs +2887 -1233
- package/dist/bootstrap/expander.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/expander.mjs.map +1 -1
- package/dist/bootstrap/formatter.mjs +582 -218
- package/dist/bootstrap/formatter.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/formatter.mjs.map +1 -1
- package/dist/bootstrap/ir.mjs +670 -116
- package/dist/bootstrap/ir.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/ir.mjs.map +1 -1
- package/dist/bootstrap/lower.mjs +866 -257
- package/dist/bootstrap/lower.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/lower.mjs.map +1 -1
- package/dist/bootstrap/package.json +1 -0
- package/dist/bootstrap/project.mjs +1168 -498
- package/dist/bootstrap/project.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/project.mjs.map +1 -1
- package/dist/bootstrap/reader.mjs +674 -175
- package/dist/bootstrap/reader.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/reader.mjs.map +1 -1
- package/dist/bootstrap/runtime/math.mjs +1117 -0
- package/dist/bootstrap/runtime/math.mjs.map +1 -0
- package/dist/bootstrap/runtime/unicode-case-data.mjs +10125 -0
- package/dist/bootstrap/runtime/unicode-case-data.mjs.map +1 -0
- package/dist/bootstrap/runtime/unicode-case.mjs +281 -0
- package/dist/bootstrap/runtime/unicode-case.mjs.map +1 -0
- package/dist/bootstrap/source-map.mjs +430 -119
- package/dist/bootstrap/source-map.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/source-map.mjs.map +1 -1
- package/dist/bootstrap/symbol.mjs +229 -53
- package/dist/bootstrap/symbol.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/symbol.mjs.map +1 -1
- package/dist/bootstrap/syntax.mjs +205 -7
- package/dist/bootstrap/syntax.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/syntax.mjs.map +1 -1
- package/dist/bootstrap/transient-analysis.mjs +1185 -489
- package/dist/bootstrap/transient-analysis.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/transient-analysis.mjs.map +1 -1
- package/dist/browser/compiler.js +199 -6478
- package/dist/browser/host.mjs +1078 -0
- package/dist/browser/loader.js +1 -0
- package/dist/browser/loader.mjs +231 -0
- package/dist/browser/worker.mjs +63 -0
- package/dist/compiler-artifact.json +1 -0
- package/dist/host/compiler-session.mjs +2980 -0
- package/dist/host/compiler-session.mjs.macro-origins.json +1 -0
- package/dist/host/compiler-session.mjs.map +1 -0
- package/dist/host/compiler-tools.mjs +1084 -0
- package/dist/host/compiler-tools.mjs.macro-origins.json +1 -0
- package/dist/host/compiler-tools.mjs.map +1 -0
- package/dist/literal-sources/runtime/core/collection-internals.eli +60 -0
- package/dist/literal-sources/runtime/core/collection.eli +639 -0
- package/dist/literal-sources/runtime/core/data-text.eli +290 -0
- package/dist/literal-sources/runtime/core/data.eli +22 -0
- package/dist/literal-sources/runtime/core/identifier.eli +44 -0
- package/dist/literal-sources/runtime/core/lazy-sequence.eli +131 -0
- package/dist/literal-sources/runtime/core/list.eli +19 -0
- package/dist/literal-sources/runtime/core/map.eli +9 -0
- package/dist/literal-sources/runtime/core/metadata-internals.eli +6 -0
- package/dist/literal-sources/runtime/core/metadata.eli +40 -0
- package/dist/literal-sources/runtime/core/object.eli +8 -0
- package/dist/literal-sources/runtime/core/order.eli +123 -0
- package/dist/literal-sources/runtime/core/persistent-kind.eli +28 -0
- package/dist/literal-sources/runtime/core/protocol-error.eli +32 -0
- package/dist/literal-sources/runtime/core/protocol.eli +28 -0
- package/dist/literal-sources/runtime/core/queue.eli +9 -0
- package/dist/literal-sources/runtime/core/record.eli +191 -0
- package/dist/literal-sources/runtime/core/regex.eli +158 -0
- package/dist/literal-sources/runtime/core/sequence.eli +305 -0
- package/dist/literal-sources/runtime/core/set-algebra.eli +28 -0
- package/dist/literal-sources/runtime/core/set.eli +9 -0
- package/dist/literal-sources/runtime/core/sorted.eli +408 -0
- package/dist/literal-sources/runtime/core/text.eli +14 -0
- package/dist/literal-sources/runtime/core/transducer.eli +268 -0
- package/dist/literal-sources/runtime/core/transient.eli +17 -0
- package/dist/literal-sources/runtime/core/truth.eli +4 -0
- package/dist/literal-sources/runtime/core/type.eli +232 -0
- package/dist/literal-sources/runtime/core/value-internals.eli +13 -0
- package/dist/literal-sources/runtime/core/value.eli +19 -0
- package/dist/literal-sources/runtime/core/vector.eli +25 -0
- package/dist/literal-sources/runtime/literals.eli +23 -0
- package/dist/literal-sources/runtime/testing/value.eli +6 -0
- package/dist/literal-sources/runtime/wire/http-rpc.eli +362 -0
- package/dist/literal-sources/runtime/wire/markdown.eli +275 -0
- package/dist/literal-sources/runtime/wire/schema.eli +193 -0
- package/dist/literal-sources/stdlib/bit.eli +36 -0
- package/dist/literal-sources/stdlib/core/data.eli +306 -0
- package/dist/literal-sources/stdlib/core/object.eli +89 -0
- package/dist/literal-sources/stdlib/core/protocol.eli +451 -0
- package/dist/literal-sources/stdlib/core/set.eli +312 -0
- package/dist/literal-sources/stdlib/core/text.eli +103 -0
- package/dist/literal-sources/stdlib/managed-literal-protocols.eli +494 -0
- package/dist/literal-sources/stdlib/managed-literals.eli +1469 -0
- package/dist/literal-sources/stdlib/managed-queue-state.eli +65 -0
- package/dist/literal-sources/stdlib/managed-sorted-state.eli +233 -0
- package/dist/literal-sources/stdlib/managed-transient-state.eli +348 -0
- package/dist/literal-sources/stdlib/managed-value-state.eli +153 -0
- package/dist/literal-sources/stdlib/managed-vector-view-state.eli +102 -0
- package/dist/literal-sources/stdlib/persistent-list.eli +145 -0
- package/dist/literal-sources/stdlib/persistent-map.eli +724 -0
- package/dist/literal-sources/stdlib/persistent-set.eli +236 -0
- package/dist/literal-sources/stdlib/persistent-vector.eli +359 -0
- package/dist/literal-sources/stdlib/value.eli +325 -0
- package/dist/package.json +10 -0
- package/dist/runtime/math.mjs +1116 -0
- package/dist/runtime/math.mjs.macro-origins.json +1 -0
- package/dist/runtime/math.mjs.map +1 -0
- package/dist/runtime/unicode-case-data.mjs +10124 -0
- package/dist/runtime/unicode-case-data.mjs.macro-origins.json +1 -0
- package/dist/runtime/unicode-case-data.mjs.map +1 -0
- package/dist/runtime/unicode-case.mjs +280 -0
- package/dist/runtime/unicode-case.mjs.macro-origins.json +1 -0
- package/dist/runtime/unicode-case.mjs.map +1 -0
- package/dist/runtime.eli +30379 -0
- package/dist/stage3-release.json +1 -0
- package/editor/README.md +1 -1
- package/editor/eliscript-mode.el +1 -1
- package/editor/eliscript-repl.el +1 -1
- package/package.json +106 -11
- package/platform/http.mjs +20 -0
- package/runtime/array-text.mjs +159 -0
- package/runtime/core/map-internals.mjs +27 -9
- package/runtime/core/object-impl.mjs +26 -17
- package/runtime/core/object-impl.mjs.map +1 -1
- package/runtime/core/protocol-impl.mjs +682 -255
- package/runtime/core/protocol-impl.mjs.map +1 -1
- package/runtime/core/protocol.mjs +4 -0
- package/runtime/core/record.mjs +23 -2
- package/runtime/core/regex.mjs +4 -0
- package/runtime/core/sorted.mjs +53 -0
- package/runtime/core/text-impl.mjs +167 -48
- package/runtime/core/text-impl.mjs.map +1 -1
- package/runtime/core/type.mjs +75 -3
- package/runtime/core/vector.mjs +6 -0
- package/runtime/math.eli +429 -0
- package/runtime/math.mjs +1116 -0
- package/runtime/math.mjs.map +1 -0
- package/runtime/number-radix.mjs +105 -0
- package/runtime/unicode-case-data.eli +29 -0
- package/runtime/unicode-case-data.mjs +10124 -0
- package/runtime/unicode-case-data.mjs.map +1 -0
- package/runtime/unicode-case.eli +100 -0
- package/runtime/unicode-case.mjs +280 -0
- package/runtime/unicode-case.mjs.map +1 -0
- package/runtime/wire/http-rpc.mjs +168 -0
- package/runtime/wire/markdown.mjs +196 -0
- package/runtime/wire/schema.mjs +109 -0
- package/stdlib/README.md +54 -0
- package/stdlib/core/protocol.eli +81 -17
- package/stdlib/core/seq.eli +1 -1
- package/stdlib/core/zipper.eli +172 -72
- package/stdlib/gepo.eli +12 -0
- package/stdlib/interop/js.eli +56 -15
- package/stdlib/managed-literal-protocols.eli +494 -0
- package/stdlib/managed-literals.eli +1469 -0
- package/stdlib/managed-protocol-error.eli +32 -0
- package/stdlib/managed-queue-state.eli +65 -0
- package/stdlib/managed-runtime-collection-internals.eli +60 -0
- package/stdlib/managed-runtime-collection.eli +639 -0
- package/stdlib/managed-runtime-data-text.eli +290 -0
- package/stdlib/managed-runtime-data.eli +22 -0
- package/stdlib/managed-runtime-identifier.eli +44 -0
- package/stdlib/managed-runtime-lazy-sequence.eli +131 -0
- package/stdlib/managed-runtime-list.eli +19 -0
- package/stdlib/managed-runtime-literals.eli +23 -0
- package/stdlib/managed-runtime-map.eli +9 -0
- package/stdlib/managed-runtime-metadata-internals.eli +6 -0
- package/stdlib/managed-runtime-metadata.eli +40 -0
- package/stdlib/managed-runtime-object.eli +8 -0
- package/stdlib/managed-runtime-order.eli +123 -0
- package/stdlib/managed-runtime-persistent-kind.eli +28 -0
- package/stdlib/managed-runtime-protocol.eli +28 -0
- package/stdlib/managed-runtime-queue.eli +9 -0
- package/stdlib/managed-runtime-record.eli +191 -0
- package/stdlib/managed-runtime-regex.eli +158 -0
- package/stdlib/managed-runtime-sequence.eli +305 -0
- package/stdlib/managed-runtime-set-algebra.eli +28 -0
- package/stdlib/managed-runtime-set.eli +9 -0
- package/stdlib/managed-runtime-sorted.eli +408 -0
- package/stdlib/managed-runtime-text.eli +14 -0
- package/stdlib/managed-runtime-transducer.eli +268 -0
- package/stdlib/managed-runtime-transient.eli +17 -0
- package/stdlib/managed-runtime-truth.eli +4 -0
- package/stdlib/managed-runtime-type.eli +232 -0
- package/stdlib/managed-runtime-value-internals.eli +13 -0
- package/stdlib/managed-runtime-value.eli +19 -0
- package/stdlib/managed-runtime-vector.eli +25 -0
- package/stdlib/managed-sorted-state.eli +233 -0
- package/stdlib/managed-testing-value.eli +6 -0
- package/stdlib/managed-transient-state.eli +348 -0
- package/stdlib/managed-value-state.eli +153 -0
- package/stdlib/managed-vector-view-state.eli +102 -0
- package/stdlib/managed-wire-http-rpc.eli +362 -0
- package/stdlib/managed-wire-markdown.eli +275 -0
- package/stdlib/managed-wire-schema.eli +193 -0
- package/stdlib/mdp.eli +7 -0
- package/stdlib/mds.eli +4 -0
- package/stdlib/persistent-vector.eli +23 -6
- package/tools/acceptance/check-legacy.mjs +687 -0
- package/tools/acceptance/check.eli +431 -0
- package/tools/acceptance/compile-evidence.el +49 -0
- package/tools/acceptance/finalize-legacy.mjs +498 -0
- package/tools/acceptance/finalize.eli +270 -0
- package/tools/backends/benchmark.mjs +175 -0
- package/tools/backends/build.mjs +135 -0
- package/tools/backends/compile.mjs +94 -0
- package/tools/backends/compiler-bootstrap.mjs +1001 -0
- package/tools/backends/compiler-browser.mjs +361 -0
- package/tools/backends/compiler-build.mjs +1628 -0
- package/tools/backends/compiler-cli-legacy.mjs +334 -0
- package/tools/backends/compiler-cli.mjs +29 -0
- package/tools/backends/compiler-corpus-bit.mjs +234 -0
- package/tools/backends/compiler-corpus-cli-adapters-legacy.mjs +362 -0
- package/tools/backends/compiler-corpus-cli-adapters.mjs +247 -0
- package/tools/backends/compiler-corpus-debugging.mjs +221 -0
- package/tools/backends/compiler-corpus-emitter.mjs +324 -0
- package/tools/backends/compiler-corpus-evaluation-adapters.mjs +65 -0
- package/tools/backends/compiler-corpus-execution-legacy.mjs +769 -0
- package/tools/backends/compiler-corpus-execution.mjs +3324 -0
- package/tools/backends/compiler-corpus-fuzz.mjs +229 -0
- package/tools/backends/compiler-corpus-generations.mjs +208 -0
- package/tools/backends/compiler-corpus-host-context-legacy.mjs +114 -0
- package/tools/backends/compiler-corpus-host-context.mjs +550 -0
- package/tools/backends/compiler-corpus-identity-host.mjs +553 -0
- package/tools/backends/compiler-corpus-identity-value-adapters-legacy.mjs +298 -0
- package/tools/backends/compiler-corpus-identity-value-adapters.mjs +69 -0
- package/tools/backends/compiler-corpus-isolated-exports.mjs +21 -0
- package/tools/backends/compiler-corpus-legacy.mjs +1155 -0
- package/tools/backends/compiler-corpus-literal-provider.mjs +282 -0
- package/tools/backends/compiler-corpus-managed-adapters-legacy.mjs +334 -0
- package/tools/backends/compiler-corpus-managed-adapters.mjs +937 -0
- package/tools/backends/compiler-corpus-managed-cases.mjs +179 -0
- package/tools/backends/compiler-corpus-managed-fixtures-legacy.mjs +879 -0
- package/tools/backends/compiler-corpus-managed-fixtures.mjs +1287 -0
- package/tools/backends/compiler-corpus-matchers.mjs +173 -0
- package/tools/backends/compiler-corpus-original-program.mjs +612 -0
- package/tools/backends/compiler-corpus-process.mjs +765 -0
- package/tools/backends/compiler-corpus-program-driver.mjs +306 -0
- package/tools/backends/compiler-corpus-project-adapters-legacy.mjs +497 -0
- package/tools/backends/compiler-corpus-project-adapters.mjs +340 -0
- package/tools/backends/compiler-corpus-project-entry-host.mjs +511 -0
- package/tools/backends/compiler-corpus-project-transport.mjs +151 -0
- package/tools/backends/compiler-corpus-raw-fixture-observer.mjs +1438 -0
- package/tools/backends/compiler-corpus-raw-language-fixtures.mjs +1456 -0
- package/tools/backends/compiler-corpus-raw-math-fixture.mjs +346 -0
- package/tools/backends/compiler-corpus-raw-special-fixtures.mjs +523 -0
- package/tools/backends/compiler-corpus-reference-legacy.mjs +263 -0
- package/tools/backends/compiler-corpus-reference.mjs +241 -0
- package/tools/backends/compiler-corpus-runtime-adapters-legacy.mjs +843 -0
- package/tools/backends/compiler-corpus-runtime-adapters.mjs +663 -0
- package/tools/backends/compiler-corpus-source-archive.mjs +206 -0
- package/tools/backends/compiler-corpus-tools-artifact-adapters.mjs +410 -0
- package/tools/backends/compiler-corpus-tools-cli.mjs +363 -0
- package/tools/backends/compiler-corpus-tools-reference.mjs +264 -0
- package/tools/backends/compiler-corpus.mjs +2054 -0
- package/tools/backends/compiler-debug.mjs +142 -0
- package/tools/backends/compiler-matrix.mjs +1955 -0
- package/tools/backends/compiler-metadata.mjs +203 -0
- package/tools/backends/compiler-package-browser.mjs +120 -0
- package/tools/backends/compiler-package-legacy.mjs +654 -0
- package/tools/backends/compiler-package.mjs +464 -0
- package/tools/backends/compiler-project.mjs +126 -0
- package/tools/backends/compiler-session.mjs +843 -0
- package/tools/backends/compiler-sha256.mjs +152 -0
- package/tools/backends/compiler-unicode-profile-host.mjs +196 -0
- package/tools/backends/compiler-worker.mjs +573 -0
- package/tools/backends/dist/bootstrap-js-stages.mjs +919 -0
- package/tools/backends/dist/bootstrap-js-stages.mjs.map +1 -0
- package/tools/backends/dist/managed-ir-inventory.mjs +488 -0
- package/tools/backends/dist/managed-ir-inventory.mjs.map +1 -0
- package/tools/backends/dist/record-grid.mjs +1256 -0
- package/tools/backends/dist/record-grid.mjs.map +1 -0
- package/tools/backends/dist/release-cli.mjs +462 -0
- package/tools/backends/dist/release-cli.mjs.map +1 -0
- package/tools/backends/dist/run-artifact.mjs +517 -0
- package/tools/backends/dist/run-artifact.mjs.map +1 -0
- package/tools/backends/eliscript/compiler-corpus-bit.eli +77 -0
- package/tools/backends/eliscript/compiler-corpus-debugging.eli +70 -0
- package/tools/backends/eliscript/compiler-corpus-project-entry-host.eli +256 -0
- package/tools/backends/managed-foreign-binding.mjs +497 -0
- package/tools/backends/managed-host-legacy.mjs +1181 -0
- package/tools/backends/managed-host-lifecycle.mjs +310 -0
- package/tools/backends/managed-host-object-provider.mjs +155 -0
- package/tools/backends/managed-host-object-realm.mjs +797 -0
- package/tools/backends/managed-host-proxy.mjs +71 -0
- package/tools/backends/managed-host-runtime.mjs +5868 -0
- package/tools/backends/managed-host.mjs +716 -0
- package/tools/backends/managed-module-graph-legacy.mjs +308 -0
- package/tools/backends/managed-module-graph.mjs +694 -0
- package/tools/backends/managed-runtime-host-legacy.mjs +195 -0
- package/tools/backends/managed-runtime.mjs +939 -0
- package/tools/backends/managed-source-view-legacy.mjs +332 -0
- package/tools/backends/managed-source-view.mjs +959 -0
- package/tools/backends/memory-runtime.mjs +100 -0
- package/tools/backends/native-benchmark.mjs +88 -0
- package/tools/backends/native-managed-runtime.mjs +677 -0
- package/tools/backends/native-memory.mjs +768 -0
- package/tools/backends/native-node-memory.mjs +142 -0
- package/tools/backends/native-node-runner.mjs +99 -0
- package/tools/backends/native-node-watchdog.mjs +19 -0
- package/tools/backends/native-node-worker.mjs +75 -0
- package/tools/backends/stage3-targets.mjs +493 -0
- package/tools/bootstrap-command.el +13 -0
- package/tools/bootstrap-runtime.el +101 -0
- package/tools/bootstrap-seed.el +55 -0
- package/tools/project/check-cli.eli +31 -0
- package/tools/project/project-cli.eli +42 -0
- package/tools/project/project.eli +122 -0
- package/tools/runtime/unicode-case-profiles.mjs +13 -0
- package/tools/runtime/unicode-case-runtime.el +57 -0
- package/tools/testing/source-debugging-corpus-host.eli +16 -0
- package/tools/testing/source-debugging.eli +139 -0
- package/tools/testing/stdlib-bit-corpus-host.eli +21 -0
- package/tools/testing/stdlib-bit-corpus-host.mjs +118 -0
- package/tools/testing/stdlib-bit.eli +104 -0
- package/tools/testing/stdlib-bit.mjs +255 -0
- package/bin/eliscript-bootstrap +0 -15
|
@@ -0,0 +1,768 @@
|
|
|
1
|
+
// Generated by Eliscript. Do not edit.
|
|
2
|
+
import "eliscript/runtime/unicode-case.mjs";
|
|
3
|
+
import "eliscript/runtime/math.mjs";
|
|
4
|
+
import { c as __eliscript_at, d as __eliscript_at_direct } from "data:text/javascript;base64,dmFyIG09UmVmbGVjdC5hcHBseSx0dD1OdW1iZXIucHJvdG90eXBlLnZhbHVlT2Ysaj1OdW1iZXIucHJvdG90eXBlLnRvU3RyaW5nLFU9TnVtYmVyLG50PU9iamVjdC5jcmVhdGUsaD1CaWdJbnQsZXQ9RGF0YVZpZXcsb3Q9QXJyYXlCdWZmZXIsaXQ9RGF0YVZpZXcucHJvdG90eXBlLnNldEZsb2F0NjQsSj1EYXRhVmlldy5wcm90b3R5cGUuZ2V0VWludDMyLHJ0PVJhbmdlRXJyb3I7ZnVuY3Rpb24gY3QodCxuKXtsZXQgZT1oKG4pLG89aCh0KSxpPSIiO2lmKG88MG4pbz0tbztkb3tsZXQgZj1vJWU7aT0iMDEyMzQ1Njc4OWFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6IltVKGYpXStpLG8vPWV9d2hpbGUobyE9PTBuKTtyZXR1cm4gdDwwPyItIitpOml9ZnVuY3Rpb24gc3QodCxuKXtsZXQgZT1uZXcgZXQobmV3IG90KDgpKTttKGl0LGUsWzAsdCwhMV0pO2xldCBvPW0oSixlLFswLCExXSksaT1tKEosZSxbNCwhMV0pLGY9bz4+PjIwJjIwNDcsYj1vJjEwNDg1NzUscD1vPj4+MzEscj1oKGIpPDwzMm58aChpKTtpZihmIT09MClyKz0xbjw8NTJuO3I8PD0ybjtsZXQgbD00bix1PWY+MSYmYj09PTAmJmk9PT0wPzFuOjJuLGs9Mm47aWYoZj49MTA3NSl7bGV0IGM9aChmLTEwNzUpO3I8PD1jLHU8PD1jLGs8PD1jfWVsc2UgbDw8PWgoZj09PTA/MTA3NDoxMDc1LWYpO2xldCBkPWgobiksZz1udChudWxsKSxhPTAsUz0wLEQ9MDt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YodD09PU4pe2lmKCFBKG4pKXJldHVybiBzKHQsbixlKTtsZXQgbz1uLGk9eShlLDApO2U9Wih5KGUsMSksITApLHQ9byxuPWk7Y29udGludWV9aWYodD09PXMpe2xldCBvPXkoZSwwKSxpPXkoZSwxKTtpZighQShvKSlyZXR1cm4gcyh0LG4sZSk7ZT1aKHkoZSwyKSwhMSksdD1vLG49aTtjb250aW51ZX1pZih0PT09RSl7bGV0IG89cyh0LG4sZSk7aWYobiE9PWomJm4hPT1LJiZuIT09eiYmbiE9PU0mJm4hPT1OJiZuIT09cyYmbiE9PUUpcmV0dXJuIG87bGV0IGk9bixmPXkoZSwwKSxiPVgoZSwxKSxwPSguLi51KT0+TChpLGYsU3QoYix1KSk7VChwLHB0LHt2YWx1ZToodSk9PnUgaW5zdGFuY2VvZiBpLGNvbmZpZ3VyYWJsZTohMH0pO2xldCByPXMoRSxwLFt2b2lkIDBdKTt1dChyLGZ0KG8pKTtsZXQgbD1hdChvKTtmb3IobGV0IHU9MDt1PGwubGVuZ3RoO3UrKylUKHIsbFt1XSxsdChvLGxbdV0pKTtyZXR1cm4gcn1yZXR1cm4gcyh0LG4sZSl9fWZ1bmN0aW9uIFJ0KHQsbil7bGV0IGU9dFtuXTtyZXR1cm4oLi4ubyk9PkwoZSx0LG8pfWZ1bmN0aW9uIEF0KHQsbiwuLi5lKXtsZXQgbz10W25dO3JldHVybiBMKG8sdCxlKX1leHBvcnR7UnQgYXMgYyxBdCBhcyBkfTs=";
|
|
5
|
+
const __eliscript_truthy = (value) => value !== false && value != null;
|
|
6
|
+
const __eliscript_number_intrinsic = globalThis.Number;
|
|
7
|
+
const __eliscript_bigint_intrinsic = globalThis.BigInt;
|
|
8
|
+
const __eliscript_numeric_apply = globalThis.Reflect.apply;
|
|
9
|
+
const __eliscript_numeric_symbol = globalThis.Symbol.toPrimitive;
|
|
10
|
+
const __eliscript_numeric_error = globalThis.TypeError;
|
|
11
|
+
const __eliscript_numeric_trim = globalThis.String.prototype.trim;
|
|
12
|
+
const __eliscript_numeric_slice = globalThis.String.prototype.slice;
|
|
13
|
+
const __eliscript_numeric_exec = globalThis.RegExp.prototype.exec;
|
|
14
|
+
const __eliscript_numeric_radix = /^(?:0[xX][0-9a-fA-F]+|0[oO][0-7]+|0[bB][01]+)$/;
|
|
15
|
+
const __eliscript_numeric_object = (value) => value !== null && (typeof value === "object" || typeof value === "function" || (typeof value === "undefined" && value !== void 0));
|
|
16
|
+
const __eliscript_numeric_primitive = (value) => {
|
|
17
|
+
if (!__eliscript_numeric_object(value)) return value;
|
|
18
|
+
const exotic = value[__eliscript_numeric_symbol];
|
|
19
|
+
if (exotic !== void 0 && exotic !== null) {
|
|
20
|
+
const result = __eliscript_numeric_apply(exotic, value, ["number"]);
|
|
21
|
+
if (!__eliscript_numeric_object(result)) return result;
|
|
22
|
+
throw new __eliscript_numeric_error("Cannot convert object to primitive value");
|
|
23
|
+
}
|
|
24
|
+
for (let index = 0; index < 2; index++) {
|
|
25
|
+
const method = value[index === 0 ? "valueOf" : "toString"];
|
|
26
|
+
if (typeof method === "function" || (typeof method === "undefined" && method !== void 0)) {
|
|
27
|
+
const result = __eliscript_numeric_apply(method, value, []);
|
|
28
|
+
if (!__eliscript_numeric_object(result)) return result;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
throw new __eliscript_numeric_error("Cannot convert object to primitive value");
|
|
32
|
+
};
|
|
33
|
+
const __eliscript_to_number = (value) => {
|
|
34
|
+
const primitive = __eliscript_numeric_primitive(value);
|
|
35
|
+
if (typeof primitive === "string") {
|
|
36
|
+
const text = __eliscript_numeric_apply(__eliscript_numeric_trim, primitive, []);
|
|
37
|
+
if (__eliscript_numeric_apply(__eliscript_numeric_exec, __eliscript_numeric_radix, [text]) !== null) {
|
|
38
|
+
let first = 2;
|
|
39
|
+
while (first < text.length && text[first] === "0") first++;
|
|
40
|
+
if (first === text.length) return 0;
|
|
41
|
+
const prefix = text[1];
|
|
42
|
+
const limit = prefix === "x" || prefix === "X" ? 256 : prefix === "b" || prefix === "B" ? 1024 : 342;
|
|
43
|
+
if (text.length - first > limit) return 1 / 0;
|
|
44
|
+
const token = __eliscript_numeric_apply(__eliscript_numeric_slice, text, [0, 2]) + __eliscript_numeric_apply(__eliscript_numeric_slice, text, [first]);
|
|
45
|
+
return __eliscript_number_intrinsic(__eliscript_bigint_intrinsic(token));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return __eliscript_number_intrinsic(primitive);
|
|
49
|
+
};
|
|
50
|
+
const __eliscript_numeric = (value) => {
|
|
51
|
+
if (typeof value === "number" || typeof value === "bigint") return value;
|
|
52
|
+
const primitive = __eliscript_numeric_primitive(value);
|
|
53
|
+
if (typeof primitive === "number" || typeof primitive === "bigint") return primitive;
|
|
54
|
+
return typeof primitive === "string" ? __eliscript_to_number(primitive) : +primitive;
|
|
55
|
+
};
|
|
56
|
+
const __eliscript_implicit_number = (value) => {
|
|
57
|
+
if (typeof value === "number") return value;
|
|
58
|
+
const primitive = __eliscript_numeric_primitive(value);
|
|
59
|
+
if (typeof primitive === "bigint") throw new __eliscript_numeric_error("Cannot convert a BigInt value to a number");
|
|
60
|
+
return typeof primitive === "string" ? __eliscript_to_number(primitive) : +primitive;
|
|
61
|
+
};
|
|
62
|
+
const __eliscript_numeric_decrement = (value) => __eliscript_implicit_number(value) - 1;
|
|
63
|
+
const __eliscript_numeric_sub = (a, b) => { if (typeof a === "number" && typeof b === "number") return a - b; return __eliscript_numeric(a) - __eliscript_numeric(b); };
|
|
64
|
+
const __eliscript_numeric_mul = (a, b) => { if (typeof a === "number" && typeof b === "number") return a * b; return __eliscript_numeric(a) * __eliscript_numeric(b); };
|
|
65
|
+
const __eliscript_numeric_div = (a, b) => { if (typeof a === "number" && typeof b === "number") return a / b; return __eliscript_numeric(a) / __eliscript_numeric(b); };
|
|
66
|
+
const __eliscript_numeric_rem = (a, b) => { if (typeof a === "number" && typeof b === "number") return a % b; return __eliscript_numeric(a) % __eliscript_numeric(b); };
|
|
67
|
+
const __eliscript_numeric_and = (a, b) => { if (typeof a === "number" && typeof b === "number") return a & b; return __eliscript_numeric(a) & __eliscript_numeric(b); };
|
|
68
|
+
const __eliscript_numeric_or = (a, b) => { if (typeof a === "number" && typeof b === "number") return a | b; return __eliscript_numeric(a) | __eliscript_numeric(b); };
|
|
69
|
+
const __eliscript_numeric_xor = (a, b) => { if (typeof a === "number" && typeof b === "number") return a ^ b; return __eliscript_numeric(a) ^ __eliscript_numeric(b); };
|
|
70
|
+
const __eliscript_numeric_shl = (a, b) => { if (typeof a === "number" && typeof b === "number") return a << b; return __eliscript_numeric(a) << __eliscript_numeric(b); };
|
|
71
|
+
const __eliscript_numeric_shr = (a, b) => { if (typeof a === "number" && typeof b === "number") return a >> b; return __eliscript_numeric(a) >> __eliscript_numeric(b); };
|
|
72
|
+
const __eliscript_numeric_ushr = (a, b) => { if (typeof a === "number" && typeof b === "number") return a >>> b; return __eliscript_numeric(a) >>> __eliscript_numeric(b); };
|
|
73
|
+
const __eliscript_numeric_neg = (a) => typeof a === "number" ? -a : -__eliscript_numeric(a);
|
|
74
|
+
const __eliscript_numeric_int32 = (a) => typeof a === "number" ? a | 0 : __eliscript_numeric(a) | 0;
|
|
75
|
+
const __eliscript_numeric_uint32 = (a) => typeof a === "number" ? a >>> 0 : __eliscript_numeric(a) >>> 0;
|
|
76
|
+
const __eliscript_numeric_not = (a) => typeof a === "number" ? ~a : ~__eliscript_numeric(a);
|
|
77
|
+
const __eliscript_numeric_relation = (operator, left, right) => {
|
|
78
|
+
if (typeof left === "number" && typeof right === "number") {
|
|
79
|
+
if (operator === "<") return left < right;
|
|
80
|
+
if (operator === "<=") return left <= right;
|
|
81
|
+
if (operator === ">") return left > right;
|
|
82
|
+
return left >= right;
|
|
83
|
+
}
|
|
84
|
+
let a = __eliscript_numeric_primitive(left);
|
|
85
|
+
let b = __eliscript_numeric_primitive(right);
|
|
86
|
+
const x = typeof a, y = typeof b;
|
|
87
|
+
if (!((x === "string" && y === "string") || (x === "bigint" && y === "string") || (x === "string" && y === "bigint"))) {
|
|
88
|
+
a = __eliscript_numeric(a);
|
|
89
|
+
b = __eliscript_numeric(b);
|
|
90
|
+
}
|
|
91
|
+
if (operator === "<") return a < b;
|
|
92
|
+
if (operator === "<=") return a <= b;
|
|
93
|
+
if (operator === ">") return a > b;
|
|
94
|
+
return a >= b;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
import {createRequire} from "node:module";
|
|
98
|
+
import {createCompilerDebugMap} from "./compiler-debug.mjs";
|
|
99
|
+
import {openNodeNativeMemory} from "./native-node-memory.mjs";
|
|
100
|
+
function memory_truth(value) {
|
|
101
|
+
return globalThis.Boolean(value);
|
|
102
|
+
}
|
|
103
|
+
function memory_default(value, fallback) {
|
|
104
|
+
if ((value === undefined)) {
|
|
105
|
+
return fallback;
|
|
106
|
+
} else {
|
|
107
|
+
return value;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function memory_copy(source) {
|
|
111
|
+
{
|
|
112
|
+
const __eliscript_value_1 = ({});
|
|
113
|
+
{
|
|
114
|
+
let result = __eliscript_value_1;
|
|
115
|
+
if ((!(source == null))) {
|
|
116
|
+
(Reflect.ownKeys(globalThis.Object(source)))["forEach"](((key) => {
|
|
117
|
+
{
|
|
118
|
+
const __eliscript_value_2 = Object.getOwnPropertyDescriptor(source, key);
|
|
119
|
+
{
|
|
120
|
+
let descriptor = __eliscript_value_2;
|
|
121
|
+
if (__eliscript_truthy((descriptor)["enumerable"])) {
|
|
122
|
+
return Object.defineProperty(result, key, ({"value": (source)[key], "writable": true, "enumerable": true, "configurable": true}));
|
|
123
|
+
} else {
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}));
|
|
129
|
+
}
|
|
130
|
+
return result;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
function nativePlatform(target) {
|
|
135
|
+
{
|
|
136
|
+
const __eliscript_value_3 = (((globalThis.process)["platform"] === "darwin") ? "arm64-macos" : (((globalThis.process)["platform"] === "linux") ? "arm64-linux" : null));
|
|
137
|
+
{
|
|
138
|
+
let actual = __eliscript_value_3;
|
|
139
|
+
if ((((__eliscript_value_4, __eliscript_value_5) => (__eliscript_value_4 !== __eliscript_value_5))((globalThis.process)["arch"], "arm64") || (actual === null) || ((!(target === undefined)) && (!(target === actual))))) {
|
|
140
|
+
((__eliscript_value_6) => { throw __eliscript_value_6; })(new (globalThis.Error)("native memory requires the matching arm64-macos or arm64-linux host"));
|
|
141
|
+
}
|
|
142
|
+
return actual;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
async function anonymousMapping(ffi, maximumBytes, libcLibrary, platform) {
|
|
147
|
+
{
|
|
148
|
+
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"})});
|
|
149
|
+
let mac = (platform === "arm64-macos");
|
|
150
|
+
let flags = (__eliscript_truthy(mac) ? 4098 : 34);
|
|
151
|
+
let names = (__eliscript_truthy(memory_truth(libcLibrary)) ? [libcLibrary] : (__eliscript_truthy(mac) ? ["libSystem.B.dylib"] : ["libc.so.6", "libc.musl-aarch64.so.1"]));
|
|
152
|
+
let libc = undefined;
|
|
153
|
+
let failure = undefined;
|
|
154
|
+
let index = 0;
|
|
155
|
+
let mapping = 0;
|
|
156
|
+
let mappingBytes = 0;
|
|
157
|
+
let released = false;
|
|
158
|
+
while ((__eliscript_numeric_relation("<", index, ((names) ?? []).length) && (!__eliscript_truthy(memory_truth(libc))))) {
|
|
159
|
+
(() => {
|
|
160
|
+
try {
|
|
161
|
+
return ((libc = (ffi)["dlopen"]((names)[index], signatures)));
|
|
162
|
+
} catch (error) {
|
|
163
|
+
return ((failure = error));
|
|
164
|
+
}
|
|
165
|
+
})();
|
|
166
|
+
((index = (index + 1)));
|
|
167
|
+
}
|
|
168
|
+
if ((!__eliscript_truthy(memory_truth(libc)))) {
|
|
169
|
+
((__eliscript_value_7) => { throw __eliscript_value_7; })(new (globalThis.Error)((__eliscript_truthy(mac) ? "unable to load macOS virtual memory functions" : "unable to load Linux virtual memory functions"), ({"cause": failure})));
|
|
170
|
+
}
|
|
171
|
+
return (() => {
|
|
172
|
+
try {
|
|
173
|
+
{
|
|
174
|
+
const __eliscript_value_8 = ((libc)["symbols"])["getpagesize"]();
|
|
175
|
+
{
|
|
176
|
+
let page = __eliscript_value_8;
|
|
177
|
+
if ((!__eliscript_truthy(((__eliscript_value_9) => (__eliscript_truthy(__eliscript_value_9) ? (__eliscript_numeric_relation(">", page, 0) && (__eliscript_numeric_and(page, __eliscript_numeric_decrement(page)) === 0)) : __eliscript_value_9))(Number.isSafeInteger(page))))) {
|
|
178
|
+
((__eliscript_value_10) => { throw __eliscript_value_10; })(new (globalThis.Error)((__eliscript_truthy(mac) ? "invalid macOS memory page size" : "invalid Linux memory page size")));
|
|
179
|
+
}
|
|
180
|
+
{
|
|
181
|
+
const __eliscript_value_11 = __eliscript_numeric_mul(Math.ceil(__eliscript_numeric_div(Math.max(1, maximumBytes), page)), page);
|
|
182
|
+
{
|
|
183
|
+
let usableBytes = __eliscript_value_11;
|
|
184
|
+
((mappingBytes = (usableBytes + __eliscript_numeric_mul(2, page))));
|
|
185
|
+
{
|
|
186
|
+
const __eliscript_value_12 = ((libc)["symbols"])["mmap"](null, globalThis.BigInt(mappingBytes), 0, flags, -1, globalThis.BigInt(0));
|
|
187
|
+
{
|
|
188
|
+
let address = __eliscript_value_12;
|
|
189
|
+
if ((!__eliscript_truthy(((__eliscript_value_13) => (__eliscript_truthy(__eliscript_value_13) ? __eliscript_numeric_relation(">", address, 0) : __eliscript_value_13))(Number.isSafeInteger(address))))) {
|
|
190
|
+
((__eliscript_value_14) => { throw __eliscript_value_14; })(new (globalThis.Error)("unable to reserve native linear memory"));
|
|
191
|
+
}
|
|
192
|
+
((mapping = address));
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
{
|
|
196
|
+
let base = (mapping + page);
|
|
197
|
+
let scratch = new (globalThis.Uint8Array)(8);
|
|
198
|
+
let scratchView = new (globalThis.DataView)((scratch)["buffer"]);
|
|
199
|
+
let scratch16 = new (globalThis.Uint8Array)((scratch)["buffer"], 0, 2);
|
|
200
|
+
let scratch32 = new (globalThis.Uint8Array)((scratch)["buffer"], 0, 4);
|
|
201
|
+
if ((!(((libc)["symbols"])["mprotect"](base, globalThis.BigInt(usableBytes), 3) === 0))) {
|
|
202
|
+
((__eliscript_value_15) => { throw __eliscript_value_15; })(new (globalThis.Error)("unable to enable native linear memory"));
|
|
203
|
+
}
|
|
204
|
+
{
|
|
205
|
+
const __eliscript_value_16 = null;
|
|
206
|
+
const __eliscript_value_17 = null;
|
|
207
|
+
const __eliscript_value_18 = null;
|
|
208
|
+
{
|
|
209
|
+
let rangeView = __eliscript_value_16;
|
|
210
|
+
let swap16 = __eliscript_value_17;
|
|
211
|
+
let swap32 = __eliscript_value_18;
|
|
212
|
+
(rangeView = ((offset, length) => {
|
|
213
|
+
return new (globalThis.Uint8Array)((ffi)["toArrayBuffer"]((base + offset), 0, length));
|
|
214
|
+
}));
|
|
215
|
+
(swap16 = ((word) => {
|
|
216
|
+
return __eliscript_numeric_or(__eliscript_numeric_shl(__eliscript_numeric_and(word, 255), 8), __eliscript_numeric_ushr(word, 8));
|
|
217
|
+
}));
|
|
218
|
+
(swap32 = ((word) => {
|
|
219
|
+
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);
|
|
220
|
+
}));
|
|
221
|
+
return ({"base": base, "getUint16": ((offset, endian) => {
|
|
222
|
+
{
|
|
223
|
+
const __eliscript_value_19 = ((ffi)["read"])["u16"](base, offset);
|
|
224
|
+
{
|
|
225
|
+
let word = __eliscript_value_19;
|
|
226
|
+
if (__eliscript_truthy(memory_truth(endian))) {
|
|
227
|
+
return word;
|
|
228
|
+
} else {
|
|
229
|
+
return swap16(word);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}), "getUint32": ((offset, endian) => {
|
|
234
|
+
{
|
|
235
|
+
const __eliscript_value_20 = ((ffi)["read"])["u32"](base, offset);
|
|
236
|
+
{
|
|
237
|
+
let word = __eliscript_value_20;
|
|
238
|
+
if (__eliscript_truthy(memory_truth(endian))) {
|
|
239
|
+
return word;
|
|
240
|
+
} else {
|
|
241
|
+
return swap32(word);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}), "getFloat64": ((offset, endian) => {
|
|
246
|
+
if (__eliscript_truthy(memory_truth(endian))) {
|
|
247
|
+
return ((ffi)["read"])["f64"](base, offset);
|
|
248
|
+
} else {
|
|
249
|
+
(scratchView)["setUint32"](0, ((ffi)["read"])["u32"](base, offset), true);
|
|
250
|
+
(scratchView)["setUint32"](4, ((ffi)["read"])["u32"](base, (offset + 4)), true);
|
|
251
|
+
return (scratchView)["getFloat64"](0, false);
|
|
252
|
+
}
|
|
253
|
+
}), "setUint16": ((offset, value, endian) => {
|
|
254
|
+
(scratchView)["setUint16"](0, value, endian);
|
|
255
|
+
return (rangeView(offset, 2))["set"](scratch16);
|
|
256
|
+
}), "setUint32": ((offset, value, endian) => {
|
|
257
|
+
(scratchView)["setUint32"](0, value, endian);
|
|
258
|
+
return (rangeView(offset, 4))["set"](scratch32);
|
|
259
|
+
}), "read": ((offset, length) => {
|
|
260
|
+
if ((length === 0)) {
|
|
261
|
+
return new (globalThis.Uint8Array)(0);
|
|
262
|
+
} else {
|
|
263
|
+
return (rangeView(offset, length))["slice"]();
|
|
264
|
+
}
|
|
265
|
+
}), "write": ((input, offset) => {
|
|
266
|
+
if (((__eliscript_value_21, __eliscript_value_22) => (__eliscript_value_21 !== __eliscript_value_22))((input)["byteLength"], 0)) {
|
|
267
|
+
(rangeView(offset, (input)["byteLength"]))["set"](input);
|
|
268
|
+
}
|
|
269
|
+
return undefined;
|
|
270
|
+
}), "close": (() => {
|
|
271
|
+
if ((!__eliscript_truthy(released))) {
|
|
272
|
+
((released = true));
|
|
273
|
+
{
|
|
274
|
+
const __eliscript_value_23 = false;
|
|
275
|
+
const __eliscript_value_24 = undefined;
|
|
276
|
+
{
|
|
277
|
+
let failed = __eliscript_value_23;
|
|
278
|
+
let first = __eliscript_value_24;
|
|
279
|
+
(() => {
|
|
280
|
+
try {
|
|
281
|
+
if ((!(((libc)["symbols"])["munmap"](mapping, globalThis.BigInt(mappingBytes)) === 0))) {
|
|
282
|
+
return ((__eliscript_value_25) => { throw __eliscript_value_25; })(new (globalThis.Error)("unable to release native linear memory"));
|
|
283
|
+
} else {
|
|
284
|
+
return null;
|
|
285
|
+
}
|
|
286
|
+
} catch (error) {
|
|
287
|
+
return ((failed = true), (first = error));
|
|
288
|
+
}
|
|
289
|
+
})();
|
|
290
|
+
(() => {
|
|
291
|
+
try {
|
|
292
|
+
return (libc)["close"]();
|
|
293
|
+
} catch (error) {
|
|
294
|
+
if ((!__eliscript_truthy(failed))) {
|
|
295
|
+
return ((failed = true), (first = error));
|
|
296
|
+
} else {
|
|
297
|
+
return null;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
})();
|
|
301
|
+
if (__eliscript_truthy(failed)) {
|
|
302
|
+
((__eliscript_value_26) => { throw __eliscript_value_26; })(first);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
return undefined;
|
|
308
|
+
})});
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
} catch (error) {
|
|
317
|
+
if (__eliscript_truthy(memory_truth(mapping))) {
|
|
318
|
+
(() => {
|
|
319
|
+
try {
|
|
320
|
+
return ((libc)["symbols"])["munmap"](mapping, globalThis.BigInt(mappingBytes));
|
|
321
|
+
} catch (ignored) {
|
|
322
|
+
return null;
|
|
323
|
+
}
|
|
324
|
+
})();
|
|
325
|
+
}
|
|
326
|
+
(() => {
|
|
327
|
+
try {
|
|
328
|
+
return (libc)["close"]();
|
|
329
|
+
} catch (ignored) {
|
|
330
|
+
return null;
|
|
331
|
+
}
|
|
332
|
+
})();
|
|
333
|
+
return ((__eliscript_value_27) => { throw __eliscript_value_27; })(error);
|
|
334
|
+
}
|
|
335
|
+
})();
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
async function openNativeMemory(path, signatures, ...arguments$) {
|
|
339
|
+
return (await (async (options) => {
|
|
340
|
+
return (await (async (_) => {
|
|
341
|
+
return (await (async (initialPages) => {
|
|
342
|
+
return (await (async (maximumPages) => {
|
|
343
|
+
return (await (async (nativeTarget) => {
|
|
344
|
+
return (await (async (libcLibrary) => {
|
|
345
|
+
return (await (async (hostCapabilities) => {
|
|
346
|
+
return (await (async (hostCall) => {
|
|
347
|
+
return (await (async (trapSites) => {
|
|
348
|
+
return (await (async (debug) => {
|
|
349
|
+
return (await (async (bunExecutable) => {
|
|
350
|
+
return (await (async (platform) => {
|
|
351
|
+
return (await (async (capabilities) => {
|
|
352
|
+
return (await (async (preciseSites) => {
|
|
353
|
+
return (await (async () => {
|
|
354
|
+
([initialPages, maximumPages])["forEach"](((pages) => {
|
|
355
|
+
if ((!__eliscript_truthy(((__eliscript_value_29) => (__eliscript_truthy(__eliscript_value_29) ? (__eliscript_numeric_relation(">=", pages, 0) && __eliscript_numeric_relation("<=", pages, 65536)) : __eliscript_value_29))(Number.isInteger(pages))))) {
|
|
356
|
+
return ((__eliscript_value_30) => { throw __eliscript_value_30; })(new (globalThis.RangeError)("invalid memory page count"));
|
|
357
|
+
} else {
|
|
358
|
+
return null;
|
|
359
|
+
}
|
|
360
|
+
}));
|
|
361
|
+
if (__eliscript_numeric_relation(">", initialPages, maximumPages)) {
|
|
362
|
+
((__eliscript_value_31) => { throw __eliscript_value_31; })(new (globalThis.RangeError)("initial memory exceeds maximum"));
|
|
363
|
+
}
|
|
364
|
+
if ((!__eliscript_truthy(Array.isArray(hostCapabilities)))) {
|
|
365
|
+
((__eliscript_value_32) => { throw __eliscript_value_32; })(new (globalThis.TypeError)("native host capabilities must be an array"));
|
|
366
|
+
}
|
|
367
|
+
((capabilities = (hostCapabilities)["map"](((capability) => {
|
|
368
|
+
if ((!__eliscript_truthy(((__eliscript_value_33) => (__eliscript_truthy(__eliscript_value_33) ? ((__eliscript_value_34) => (__eliscript_truthy(__eliscript_value_34) ? (((capability)["module"] === "eliscript.host") && ((capability)["arity"] === 2) && ((capability)["abi"] === "managed-host-call-v1")) : __eliscript_value_34))((["console-log", "console-log-capture", "source-operation"])["includes"]((capability)["name"])) : __eliscript_value_33))((!(capability == null)))))) {
|
|
369
|
+
((__eliscript_value_35) => { throw __eliscript_value_35; })(new (globalThis.TypeError)("native host capability is not supported"));
|
|
370
|
+
}
|
|
371
|
+
return Object.freeze(memory_copy(capability));
|
|
372
|
+
}))));
|
|
373
|
+
if ((!((new (globalThis.Set)((capabilities)["map"](((entry) => {
|
|
374
|
+
return (entry)["name"];
|
|
375
|
+
}))))["size"] === ((capabilities) ?? []).length))) {
|
|
376
|
+
((__eliscript_value_36) => { throw __eliscript_value_36; })(new (globalThis.TypeError)("duplicate native host capability"));
|
|
377
|
+
}
|
|
378
|
+
if ((__eliscript_numeric_relation(">", ((capabilities) ?? []).length, 0) && ((__eliscript_value_37, __eliscript_value_38) => (__eliscript_value_37 !== __eliscript_value_38))(((__eliscript_value) => { if (__eliscript_value === null) return "null"; const __eliscript_host_type = typeof __eliscript_value; if (__eliscript_host_type !== "object" && __eliscript_host_type !== "function") return __eliscript_host_type; try { const __eliscript_type = Object.getOwnPropertyDescriptor(__eliscript_value, Symbol.for("eliscript.value.type")); if (__eliscript_type && Object.prototype.hasOwnProperty.call(__eliscript_type, "value") && (__eliscript_type.value === "keyword" || __eliscript_type.value === "symbol")) return __eliscript_type.value; const __eliscript_kind = Object.getOwnPropertyDescriptor(__eliscript_value, "kind"); if (__eliscript_kind && Object.prototype.hasOwnProperty.call(__eliscript_kind, "value")) { if (__eliscript_kind.value === "eliscript/keyword") return "keyword"; if (__eliscript_kind.value === "eliscript/symbol") return "symbol"; } return __eliscript_host_type; } catch { return __eliscript_host_type; } })(hostCall), "function"))) {
|
|
379
|
+
((__eliscript_value_39) => { throw __eliscript_value_39; })(new (globalThis.TypeError)("native artifact requires an explicit host capability dispatcher"));
|
|
380
|
+
}
|
|
381
|
+
if ((!__eliscript_truthy(Array.isArray(trapSites)))) {
|
|
382
|
+
((__eliscript_value_40) => { throw __eliscript_value_40; })(new (globalThis.TypeError)("native trap sites must be an array"));
|
|
383
|
+
}
|
|
384
|
+
(trapSites)["forEach"](((site) => {
|
|
385
|
+
if ((!__eliscript_truthy(((__eliscript_value_41) => (__eliscript_truthy(__eliscript_value_41) ? ((__eliscript_value_42) => (__eliscript_truthy(__eliscript_value_42) ? ((__eliscript_value_43) => (__eliscript_truthy(__eliscript_value_43) ? ((__eliscript_value_44) => (__eliscript_truthy(__eliscript_value_44) ? ((__eliscript_value_45) => (__eliscript_truthy(__eliscript_value_45) ? ((__eliscript_value_46) => (__eliscript_truthy(__eliscript_value_46) ? ((__eliscript_value_47) => (__eliscript_truthy(__eliscript_value_47) ? ((__eliscript_value_48) => (__eliscript_truthy(__eliscript_value_48) ? ((__eliscript_value_49) => (__eliscript_truthy(__eliscript_value_49) ? ((__eliscript_value_50) => (__eliscript_truthy(__eliscript_value_50) ? ((__eliscript_value_51) => (__eliscript_truthy(__eliscript_value_51) ? ((__eliscript_value_52) => (__eliscript_truthy(__eliscript_value_52) ? ((__eliscript_value_53) => (__eliscript_truthy(__eliscript_value_53) ? (__eliscript_numeric_relation(">=", (site)["code"], 1) && __eliscript_numeric_relation("<=", (site)["code"], 6)) : __eliscript_value_53))(Number.isInteger((site)["code"])) : __eliscript_value_52))(((site)["returnAddress"] === false)) : __eliscript_value_51))(__eliscript_numeric_relation(">=", (site)["functionIndex"], 0)) : __eliscript_value_50))(Number.isSafeInteger((site)["functionIndex"])) : __eliscript_value_49))(((site)["offsetBase"] === "code-section")) : __eliscript_value_48))((__eliscript_numeric_rem((site)["address"], 4) === 0)) : __eliscript_value_47))(__eliscript_numeric_relation(">=", (site)["address"], 0)) : __eliscript_value_46))(Number.isSafeInteger((site)["address"])) : __eliscript_value_45))((!__eliscript_truthy((preciseSites)["has"]((site)["site"])))) : __eliscript_value_44))(__eliscript_numeric_relation("<=", (site)["site"], 4294967295)) : __eliscript_value_43))(__eliscript_numeric_relation(">", (site)["site"], 0)) : __eliscript_value_42))(Number.isSafeInteger((site)["site"])) : __eliscript_value_41))(memory_truth(site))))) {
|
|
386
|
+
((__eliscript_value_54) => { throw __eliscript_value_54; })(new (globalThis.TypeError)("invalid precise native trap site"));
|
|
387
|
+
}
|
|
388
|
+
return (preciseSites)["set"]((site)["site"], Object.freeze(memory_copy(site)));
|
|
389
|
+
}));
|
|
390
|
+
return (await (async (sourceMap) => {
|
|
391
|
+
return (await (async (entries) => {
|
|
392
|
+
return (await (async () => {
|
|
393
|
+
(entries)["forEach"](((entry) => {
|
|
394
|
+
if ((!__eliscript_truthy(((__eliscript_value_55) => (__eliscript_truthy(__eliscript_value_55) ? ((__eliscript_value_56) => (__eliscript_truthy(__eliscript_value_56) ? __eliscript_numeric_relation(">=", (entry)[1], 0) : __eliscript_value_56))(Number.isInteger((entry)[1])) : __eliscript_value_55))(memory_truth((entry)[0]))))) {
|
|
395
|
+
return ((__eliscript_value_57) => { throw __eliscript_value_57; })(new (globalThis.TypeError)("invalid native memory signature"));
|
|
396
|
+
} else {
|
|
397
|
+
return null;
|
|
398
|
+
}
|
|
399
|
+
}));
|
|
400
|
+
return (await (async (arities) => {
|
|
401
|
+
return ((!__eliscript_truthy(memory_truth(((globalThis.process)["versions"])["bun"]))) ? (await (async (forwarded) => {
|
|
402
|
+
if ((!(bunExecutable === undefined))) {
|
|
403
|
+
((forwarded)["bunExecutable"] = bunExecutable);
|
|
404
|
+
}
|
|
405
|
+
return await (openNodeNativeMemory(path, signatures, forwarded));
|
|
406
|
+
})(({"initialPages": initialPages, "maximumPages": maximumPages, "nativeTarget": platform, "libcLibrary": libcLibrary, "hostCapabilities": capabilities, "hostCall": hostCall, "trapSites": trapSites, "debug": debug}))) : (await (async (require) => {
|
|
407
|
+
return (await (async (ffi) => {
|
|
408
|
+
return (await (async (mapping) => {
|
|
409
|
+
return (await (async (context) => {
|
|
410
|
+
return (await (async (view) => {
|
|
411
|
+
return (await (async (library) => {
|
|
412
|
+
return (await (async (callback) => {
|
|
413
|
+
return (await (async (contextPointer) => {
|
|
414
|
+
return (await (async (closed) => {
|
|
415
|
+
return (await (async (disposed) => {
|
|
416
|
+
return (await (async (invocations) => {
|
|
417
|
+
return (await (async () => {
|
|
418
|
+
(await (async () => {
|
|
419
|
+
try {
|
|
420
|
+
return (await (async () => {
|
|
421
|
+
((mapping = await (anonymousMapping(ffi, __eliscript_numeric_mul(maximumPages, 65536), libcLibrary, platform))));
|
|
422
|
+
((context = new (globalThis.Uint8Array)((__eliscript_numeric_relation(">", ((capabilities) ?? []).length, 0) ? 48 : 32))));
|
|
423
|
+
((view = new (globalThis.DataView)((context)["buffer"])), (contextPointer = (ffi)["ptr"](context)));
|
|
424
|
+
(view)["setBigUint64"](0, globalThis.BigInt((mapping)["base"]), true);
|
|
425
|
+
(view)["setBigUint64"](8, globalThis.BigInt(__eliscript_numeric_mul(initialPages, 65536)), true);
|
|
426
|
+
(view)["setBigUint64"](16, globalThis.BigInt(__eliscript_numeric_mul(maximumPages, 65536)), true);
|
|
427
|
+
if (__eliscript_numeric_relation(">", ((capabilities) ?? []).length, 0)) {
|
|
428
|
+
((callback = new ((ffi)["JSCallback"])(((actualContext, index, heap, argv) => {
|
|
429
|
+
{
|
|
430
|
+
const __eliscript_value_58 = (invocations)["at"](-1);
|
|
431
|
+
{
|
|
432
|
+
let invocation = __eliscript_value_58;
|
|
433
|
+
return (() => {
|
|
434
|
+
try {
|
|
435
|
+
if (__eliscript_truthy(((__eliscript_value_59) => (__eliscript_truthy(__eliscript_value_59) ? __eliscript_value_59 : ((__eliscript_value_60) => (__eliscript_truthy(__eliscript_value_60) ? __eliscript_value_60 : closed))((!__eliscript_truthy(memory_truth(invocation))))))((!(actualContext === contextPointer))))) {
|
|
436
|
+
((__eliscript_value_61) => { throw __eliscript_value_61; })(new (globalThis.Error)("native host callback is outside its active invocation"));
|
|
437
|
+
}
|
|
438
|
+
if ((!__eliscript_truthy(((__eliscript_value_62) => (__eliscript_truthy(__eliscript_value_62) ? (__eliscript_numeric_relation(">=", index, 0) && __eliscript_numeric_relation("<", index, ((capabilities) ?? []).length)) : __eliscript_value_62))(Number.isInteger(index))))) {
|
|
439
|
+
((__eliscript_value_63) => { throw __eliscript_value_63; })(new (globalThis.TypeError)("native host capability index is not declared"));
|
|
440
|
+
}
|
|
441
|
+
{
|
|
442
|
+
const __eliscript_value_64 = hostCall(index, __eliscript_numeric_ushr(heap, 0), __eliscript_numeric_ushr(argv, 0));
|
|
443
|
+
{
|
|
444
|
+
let result = __eliscript_value_64;
|
|
445
|
+
if ((!__eliscript_truthy(((__eliscript_value_65) => (__eliscript_truthy(__eliscript_value_65) ? (__eliscript_numeric_relation(">=", result, 0) && __eliscript_numeric_relation("<=", result, 4294967295)) : __eliscript_value_65))(Number.isInteger(result))))) {
|
|
446
|
+
((__eliscript_value_66) => { throw __eliscript_value_66; })(new (globalThis.TypeError)("native host capability returned an invalid managed word"));
|
|
447
|
+
}
|
|
448
|
+
return result;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
} catch (error) {
|
|
452
|
+
if (__eliscript_truthy(((__eliscript_value_67) => (__eliscript_truthy(__eliscript_value_67) ? (!__eliscript_truthy((invocation)["hasHostError"])) : __eliscript_value_67))(memory_truth(invocation)))) {
|
|
453
|
+
((invocation)["hasHostError"] = true);
|
|
454
|
+
((invocation)["hostError"] = error);
|
|
455
|
+
}
|
|
456
|
+
(view)["setUint32"](24, 5, true);
|
|
457
|
+
return 0;
|
|
458
|
+
}
|
|
459
|
+
})();
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
}), ({"args": ["ptr", "u32", "u32", "u32"], "returns": "u32", "threadsafe": false}))));
|
|
463
|
+
if (((callback)["ptr"] === null)) {
|
|
464
|
+
((__eliscript_value_68) => { throw __eliscript_value_68; })(new (globalThis.Error)("unable to create native host callback"));
|
|
465
|
+
}
|
|
466
|
+
(view)["setBigUint64"](32, globalThis.BigInt((callback)["ptr"]), true);
|
|
467
|
+
}
|
|
468
|
+
return ((library = (ffi)["dlopen"](path, Object.fromEntries((entries)["map"](((entry) => {
|
|
469
|
+
return [(entry)[0], ({"args": (["ptr"])["concat"]((new (globalThis.Array)((entry)[1]))["fill"]("u32")), "returns": "u32"})];
|
|
470
|
+
}))))));
|
|
471
|
+
})());
|
|
472
|
+
} catch (error) {
|
|
473
|
+
(() => {
|
|
474
|
+
try {
|
|
475
|
+
if (__eliscript_truthy(memory_truth(library))) {
|
|
476
|
+
return (library)["close"]();
|
|
477
|
+
} else {
|
|
478
|
+
return null;
|
|
479
|
+
}
|
|
480
|
+
} catch (ignored) {
|
|
481
|
+
return null;
|
|
482
|
+
}
|
|
483
|
+
})();
|
|
484
|
+
(() => {
|
|
485
|
+
try {
|
|
486
|
+
if (__eliscript_truthy(memory_truth(callback))) {
|
|
487
|
+
return (callback)["close"]();
|
|
488
|
+
} else {
|
|
489
|
+
return null;
|
|
490
|
+
}
|
|
491
|
+
} catch (ignored) {
|
|
492
|
+
return null;
|
|
493
|
+
}
|
|
494
|
+
})();
|
|
495
|
+
(() => {
|
|
496
|
+
try {
|
|
497
|
+
if (__eliscript_truthy(memory_truth(mapping))) {
|
|
498
|
+
return (mapping)["close"]();
|
|
499
|
+
} else {
|
|
500
|
+
return null;
|
|
501
|
+
}
|
|
502
|
+
} catch (ignored) {
|
|
503
|
+
return null;
|
|
504
|
+
}
|
|
505
|
+
})();
|
|
506
|
+
return ((__eliscript_value_69) => { throw __eliscript_value_69; })(error);
|
|
507
|
+
}
|
|
508
|
+
})());
|
|
509
|
+
{
|
|
510
|
+
const __eliscript_value_70 = null;
|
|
511
|
+
const __eliscript_value_71 = null;
|
|
512
|
+
const __eliscript_value_72 = null;
|
|
513
|
+
const __eliscript_value_73 = null;
|
|
514
|
+
{
|
|
515
|
+
let dispose = __eliscript_value_70;
|
|
516
|
+
let active = __eliscript_value_71;
|
|
517
|
+
let size = __eliscript_value_72;
|
|
518
|
+
let range = __eliscript_value_73;
|
|
519
|
+
(dispose = (() => {
|
|
520
|
+
if ((!__eliscript_truthy(disposed))) {
|
|
521
|
+
((disposed = true));
|
|
522
|
+
{
|
|
523
|
+
const __eliscript_value_74 = false;
|
|
524
|
+
const __eliscript_value_75 = undefined;
|
|
525
|
+
{
|
|
526
|
+
let failed = __eliscript_value_74;
|
|
527
|
+
let first = __eliscript_value_75;
|
|
528
|
+
([library, callback, mapping])["forEach"](((owner) => {
|
|
529
|
+
return (() => {
|
|
530
|
+
try {
|
|
531
|
+
if (__eliscript_truthy(memory_truth(owner))) {
|
|
532
|
+
return (owner)["close"]();
|
|
533
|
+
} else {
|
|
534
|
+
return null;
|
|
535
|
+
}
|
|
536
|
+
} catch (error) {
|
|
537
|
+
if ((!__eliscript_truthy(failed))) {
|
|
538
|
+
return ((failed = true), (first = error));
|
|
539
|
+
} else {
|
|
540
|
+
return null;
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
})();
|
|
544
|
+
}));
|
|
545
|
+
((mapping = null), (context = null), (view = null), (library = null), (callback = null));
|
|
546
|
+
if (__eliscript_truthy(failed)) {
|
|
547
|
+
return ((__eliscript_value_76) => { throw __eliscript_value_76; })(first);
|
|
548
|
+
} else {
|
|
549
|
+
return null;
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
} else {
|
|
554
|
+
return null;
|
|
555
|
+
}
|
|
556
|
+
}));
|
|
557
|
+
(active = (() => {
|
|
558
|
+
if (__eliscript_truthy(closed)) {
|
|
559
|
+
return ((__eliscript_value_77) => { throw __eliscript_value_77; })(new (globalThis.Error)("native memory is closed"));
|
|
560
|
+
} else {
|
|
561
|
+
return null;
|
|
562
|
+
}
|
|
563
|
+
}));
|
|
564
|
+
(size = (() => {
|
|
565
|
+
return globalThis.Number((view)["getBigUint64"](8, true));
|
|
566
|
+
}));
|
|
567
|
+
(range = ((offset, length) => {
|
|
568
|
+
active();
|
|
569
|
+
if ((!__eliscript_truthy(((__eliscript_value_78) => (__eliscript_truthy(__eliscript_value_78) ? ((__eliscript_value_79) => (__eliscript_truthy(__eliscript_value_79) ? (__eliscript_numeric_relation(">=", offset, 0) && __eliscript_numeric_relation(">=", length, 0) && __eliscript_numeric_relation("<=", (offset + length), size())) : __eliscript_value_79))(Number.isSafeInteger(length)) : __eliscript_value_78))(Number.isSafeInteger(offset))))) {
|
|
570
|
+
return ((__eliscript_value_80) => { throw __eliscript_value_80; })(new (globalThis.RangeError)("memory access out of bounds"));
|
|
571
|
+
} else {
|
|
572
|
+
return null;
|
|
573
|
+
}
|
|
574
|
+
}));
|
|
575
|
+
{
|
|
576
|
+
const __eliscript_value_81 = ({"invoke": ((name, ...args) => {
|
|
577
|
+
active();
|
|
578
|
+
if ((!__eliscript_truthy((arities)["has"](name)))) {
|
|
579
|
+
((__eliscript_value_82) => { throw __eliscript_value_82; })(new (globalThis.TypeError)("unknown native memory export"));
|
|
580
|
+
}
|
|
581
|
+
if ((!(((args) ?? []).length === (arities)["get"](name)))) {
|
|
582
|
+
((__eliscript_value_83) => { throw __eliscript_value_83; })(new (globalThis.TypeError)("native memory argument count mismatch"));
|
|
583
|
+
}
|
|
584
|
+
(args)["forEach"](((value) => {
|
|
585
|
+
if ((!__eliscript_truthy(((__eliscript_value_84) => (__eliscript_truthy(__eliscript_value_84) ? (__eliscript_numeric_relation(">=", value, 0) && __eliscript_numeric_relation("<=", value, 4294967295)) : __eliscript_value_84))(Number.isInteger(value))))) {
|
|
586
|
+
return ((__eliscript_value_85) => { throw __eliscript_value_85; })(new (globalThis.RangeError)("memory32 arguments must be u32"));
|
|
587
|
+
} else {
|
|
588
|
+
return null;
|
|
589
|
+
}
|
|
590
|
+
}));
|
|
591
|
+
{
|
|
592
|
+
let invocation = ({"hasHostError": false, "hostError": undefined});
|
|
593
|
+
let previousTrap = (view)["getUint32"](24, true);
|
|
594
|
+
let previousSite = (view)["getUint32"](28, true);
|
|
595
|
+
let failed = false;
|
|
596
|
+
(invocations)["push"](invocation);
|
|
597
|
+
(view)["setUint32"](24, 0, true);
|
|
598
|
+
(view)["setUint32"](28, 0, true);
|
|
599
|
+
return (() => {
|
|
600
|
+
try {
|
|
601
|
+
{
|
|
602
|
+
const __eliscript_value_86 = __eliscript_numeric_ushr(__eliscript_at(Reflect, "apply")(((library)["symbols"])[name], (library)["symbols"], ([contextPointer])["concat"](args)), 0);
|
|
603
|
+
{
|
|
604
|
+
let result = __eliscript_value_86;
|
|
605
|
+
if (__eliscript_truthy((invocation)["hasHostError"])) {
|
|
606
|
+
((__eliscript_value_87) => { throw __eliscript_value_87; })((invocation)["hostError"]);
|
|
607
|
+
}
|
|
608
|
+
{
|
|
609
|
+
const __eliscript_value_88 = (view)["getUint32"](24, true);
|
|
610
|
+
{
|
|
611
|
+
let error = __eliscript_value_88;
|
|
612
|
+
if ((!(error === 0))) {
|
|
613
|
+
{
|
|
614
|
+
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"];
|
|
615
|
+
let failure = new (globalThis.WebAssembly.RuntimeError)((__eliscript_numeric_relation("<=", error, 6) ? (messages)[error] : "native memory trap"));
|
|
616
|
+
let site = (preciseSites)["get"]((view)["getUint32"](28, true));
|
|
617
|
+
if (__eliscript_truthy(((__eliscript_value_89) => (__eliscript_truthy(__eliscript_value_89) ? ((site)["code"] === error) : __eliscript_value_89))(memory_truth(site)))) {
|
|
618
|
+
{
|
|
619
|
+
const __eliscript_value_90 = Object.freeze([Object.freeze(({"address": (site)["address"], "offsetBase": "code-section", "functionIndex": (site)["functionIndex"], "returnAddress": false}))]);
|
|
620
|
+
{
|
|
621
|
+
let frames = __eliscript_value_90;
|
|
622
|
+
Object.defineProperty(failure, "eliscriptFrames", ({"value": frames, "enumerable": true, "configurable": true}));
|
|
623
|
+
if (__eliscript_truthy(memory_truth(sourceMap))) {
|
|
624
|
+
(() => {
|
|
625
|
+
try {
|
|
626
|
+
return Object.defineProperty(failure, "eliscriptSourceFrames", ({"value": (sourceMap)["mapFrames"](frames), "enumerable": true, "configurable": true}));
|
|
627
|
+
} catch (ignored) {
|
|
628
|
+
return null;
|
|
629
|
+
}
|
|
630
|
+
})();
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
((__eliscript_value_91) => { throw __eliscript_value_91; })(failure);
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
return result;
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
} catch (error) {
|
|
644
|
+
((failed = true));
|
|
645
|
+
return ((__eliscript_value_92) => { throw __eliscript_value_92; })(error);
|
|
646
|
+
} finally {
|
|
647
|
+
(invocations)["pop"]();
|
|
648
|
+
(view)["setUint32"](24, previousTrap, true);
|
|
649
|
+
(view)["setUint32"](28, previousSite, true);
|
|
650
|
+
if (__eliscript_truthy(((__eliscript_value_93) => (__eliscript_truthy(__eliscript_value_93) ? (((invocations) ?? []).length === 0) : __eliscript_value_93))(closed))) {
|
|
651
|
+
(() => {
|
|
652
|
+
try {
|
|
653
|
+
return dispose();
|
|
654
|
+
} catch (error) {
|
|
655
|
+
if ((!__eliscript_truthy(failed))) {
|
|
656
|
+
return ((__eliscript_value_94) => { throw __eliscript_value_94; })(error);
|
|
657
|
+
} else {
|
|
658
|
+
return null;
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
})();
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
})();
|
|
665
|
+
}
|
|
666
|
+
}), "getUint16": ((offset, endian) => {
|
|
667
|
+
range(offset, 2);
|
|
668
|
+
return (mapping)["getUint16"](offset, endian);
|
|
669
|
+
}), "getUint32": ((offset, endian) => {
|
|
670
|
+
range(offset, 4);
|
|
671
|
+
return (mapping)["getUint32"](offset, endian);
|
|
672
|
+
}), "getFloat64": ((offset, endian) => {
|
|
673
|
+
range(offset, 8);
|
|
674
|
+
return (mapping)["getFloat64"](offset, endian);
|
|
675
|
+
}), "setUint16": ((offset, value, endian) => {
|
|
676
|
+
{
|
|
677
|
+
const __eliscript_value_95 = Math.trunc(value);
|
|
678
|
+
{
|
|
679
|
+
let converted = __eliscript_value_95;
|
|
680
|
+
range(offset, 2);
|
|
681
|
+
return (mapping)["setUint16"](offset, converted, endian);
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
}), "setUint32": ((offset, value, endian) => {
|
|
685
|
+
{
|
|
686
|
+
const __eliscript_value_96 = Math.trunc(value);
|
|
687
|
+
{
|
|
688
|
+
let converted = __eliscript_value_96;
|
|
689
|
+
range(offset, 4);
|
|
690
|
+
return (mapping)["setUint32"](offset, converted, endian);
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
}), "read": ((offset, length) => {
|
|
694
|
+
range(offset, length);
|
|
695
|
+
return (mapping)["read"](offset, length);
|
|
696
|
+
}), "write": ((input, ...positions) => {
|
|
697
|
+
{
|
|
698
|
+
const __eliscript_value_97 = memory_default((positions)[0], 0);
|
|
699
|
+
{
|
|
700
|
+
let offset = __eliscript_value_97;
|
|
701
|
+
if ((!__eliscript_truthy(__eliscript_at(globalThis.Uint8Array, globalThis.Symbol.hasInstance)(input)))) {
|
|
702
|
+
((__eliscript_value_98) => { throw __eliscript_value_98; })(new (globalThis.TypeError)("memory write requires Uint8Array"));
|
|
703
|
+
}
|
|
704
|
+
{
|
|
705
|
+
const __eliscript_value_99 = new (globalThis.Uint8Array)(input);
|
|
706
|
+
{
|
|
707
|
+
let copy = __eliscript_value_99;
|
|
708
|
+
range(offset, (copy)["byteLength"]);
|
|
709
|
+
(mapping)["write"](copy, offset);
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
return undefined;
|
|
715
|
+
}), "close": (() => {
|
|
716
|
+
if ((!__eliscript_truthy(closed))) {
|
|
717
|
+
((closed = true));
|
|
718
|
+
if ((((invocations) ?? []).length === 0)) {
|
|
719
|
+
dispose();
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
return undefined;
|
|
723
|
+
})});
|
|
724
|
+
{
|
|
725
|
+
let owned = __eliscript_value_81;
|
|
726
|
+
Object.defineProperty(owned, "byteLength", ({"enumerable": true, "configurable": true, "get": (() => {
|
|
727
|
+
active();
|
|
728
|
+
return size();
|
|
729
|
+
})}));
|
|
730
|
+
return owned;
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
})());
|
|
736
|
+
})([]));
|
|
737
|
+
})(false));
|
|
738
|
+
})(false));
|
|
739
|
+
})(undefined));
|
|
740
|
+
})(undefined));
|
|
741
|
+
})(undefined));
|
|
742
|
+
})(undefined));
|
|
743
|
+
})(undefined));
|
|
744
|
+
})(undefined));
|
|
745
|
+
})(require("bun:ffi")));
|
|
746
|
+
})(createRequire((globalThis.process)["execPath"]))));
|
|
747
|
+
})(new (globalThis.Map)(entries)));
|
|
748
|
+
})());
|
|
749
|
+
})(Object.entries(signatures)));
|
|
750
|
+
})((((debug === undefined) || (debug === false)) ? null : createCompilerDebugMap(debug))));
|
|
751
|
+
})());
|
|
752
|
+
})(new (globalThis.Map)()));
|
|
753
|
+
})(undefined));
|
|
754
|
+
})(nativePlatform(nativeTarget)));
|
|
755
|
+
})((options)["bunExecutable"]));
|
|
756
|
+
})((options)["debug"]));
|
|
757
|
+
})(memory_default((options)["trapSites"], [])));
|
|
758
|
+
})((options)["hostCall"]));
|
|
759
|
+
})(memory_default((options)["hostCapabilities"], [])));
|
|
760
|
+
})((options)["libcLibrary"]));
|
|
761
|
+
})((options)["nativeTarget"]));
|
|
762
|
+
})(memory_default((options)["maximumPages"], initialPages)));
|
|
763
|
+
})(memory_default((options)["initialPages"], 1)));
|
|
764
|
+
})(((options === null) ? ((__eliscript_value_28) => { throw __eliscript_value_28; })(new (globalThis.TypeError)("native memory options cannot be null")) : null)));
|
|
765
|
+
})((((((arguments$) ?? []).length === 0) || ((arguments$)[0] === undefined)) ? ({}) : (arguments$)[0])));
|
|
766
|
+
}
|
|
767
|
+
export {openNativeMemory};
|
|
768
|
+
//# sourceMappingURL=native-memory.mjs.map
|