@onda-lang/wasm-compiler 0.8.5 → 0.8.6
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/api.md +16 -3
- package/dist/backend/compiler/core.js +1 -1
- package/dist/backend/compiler/event-input.js +3 -2
- package/dist/backend/compiler/lowering.js +15 -2
- package/dist/build.json +3 -3
- package/dist/frontend/onda_compiler_web_bg.wasm +0 -0
- package/dist/frontend/package.json +1 -1
- package/dist/licenses/RUST-DEPENDENCIES.txt +8 -8
- package/dist/version.js +1 -1
- package/package.json +2 -2
package/api.md
CHANGED
|
@@ -135,12 +135,14 @@ endpoints, apply linear, logarithmic, or curved scale, and clamp and snap to the
|
|
|
135
135
|
|
|
136
136
|
Complete wasm32 processor exports receive an optional execution-output descriptor containing
|
|
137
137
|
independently nullable delegate and print batches. Allocate all descriptors and storage before
|
|
138
|
-
real-time execution.
|
|
138
|
+
real-time execution. Their linear-memory regions must be mutually disjoint and must not overlap any
|
|
139
|
+
other region accessed by the processor call, matching the processor ABI's execution-output
|
|
140
|
+
contract.
|
|
139
141
|
|
|
140
142
|
`writeDelegateBatch` and `writePrintBatch` initialize reusable batch descriptors.
|
|
141
143
|
`writeExecutionOutput` connects their addresses. Call `resetExecutionOutput` immediately before
|
|
142
|
-
every generated init or process entry. Generated event entries reset
|
|
143
|
-
|
|
144
|
+
every generated init or process entry. Generated event entries reset before input preflight, so
|
|
145
|
+
rejected input returns empty batches. After a successful generated call,
|
|
144
146
|
`readDelegateBatch` or `readPrintBatch` validates the result counters.
|
|
145
147
|
`decodeDelegateRecords` converts delegate payloads using `metadata.delegates`.
|
|
146
148
|
`decodePrintRecords` preserves primitive types and source sites; `formatPrintRecords` and
|
|
@@ -303,6 +305,7 @@ OndaPayloadSchema
|
|
|
303
305
|
OndaPayloadDefault
|
|
304
306
|
OndaPayloadValue
|
|
305
307
|
OndaPayloadSizes
|
|
308
|
+
OndaPayloadTensorMetadata
|
|
306
309
|
PayloadPlan
|
|
307
310
|
canonicalF32Number
|
|
308
311
|
EVENT_INPUT_SIZE_BYTES
|
|
@@ -432,11 +435,21 @@ are rejected. Missing event arguments use declared constant defaults.
|
|
|
432
435
|
Supply `i64` as `bigint`, an exact safe integer, or a decimal string. `decode(bytes)` returns named
|
|
433
436
|
nested values with `bigint` for `i64`. Plans own immutable schema snapshots.
|
|
434
437
|
|
|
438
|
+
`tensorMetadata` exposes the schema's flattened SoA contract without reparsing JSON. Each immutable
|
|
439
|
+
record contains `path`, `encoding`, fixed `shape`, `parameterIndex`, `isSlice`, and
|
|
440
|
+
`fixedElementCount`. Tuple path components use `__0`, `__1`, and so on. A slice's runtime tensor
|
|
441
|
+
length is its logical length times `fixedElementCount`; the dynamic outer axis is therefore not
|
|
442
|
+
repeated in `shape`.
|
|
443
|
+
|
|
435
444
|
`requiredWorkspace(bytes)` preflights packed little-endian input. `sizes(lengths)` reports wire
|
|
436
445
|
and aligned workspace sizes without allocating payload storage. Low-level wasm hosts provision
|
|
437
446
|
both regions and a 16-byte descriptor, then call `writeEventInput` before invoking the event.
|
|
438
447
|
Rejected input returns `PROCESSOR_EXECUTION_INPUT_REJECTED` (2) and leaves processor state usable.
|
|
439
448
|
`OndaAudioProcessor.trigger` performs logical encoding before transferring bytes to the worklet.
|
|
449
|
+
Web hosts intentionally have no unchecked tensor-view event entry: JavaScript values must cross the
|
|
450
|
+
main-thread/worklet and Wasm linear-memory boundaries, so native borrowed addresses cannot be
|
|
451
|
+
preserved end to end. Web event dispatch remains the packed, checked `onda_event_N` path and uses
|
|
452
|
+
its preallocated workspace.
|
|
440
453
|
Decoded `f32` leaves use `canonicalF32Number(value)`: the returned JavaScript number has the
|
|
441
454
|
shortest decimal representation that round-trips to the same `f32`, so JSON and controls do not
|
|
442
455
|
expose an irrelevant widened binary tail.
|
|
@@ -2534,7 +2534,6 @@ export class MirCompilerCore {
|
|
|
2534
2534
|
const wrapperName = `$onda.abi.event.${eventId}`;
|
|
2535
2535
|
const prepared = prepareEventInput(this, this.eventPlans[eventId]);
|
|
2536
2536
|
const body = this.module.block(null, [
|
|
2537
|
-
...prepared.statements,
|
|
2538
2537
|
this.module.global.set(
|
|
2539
2538
|
POINTER_GLOBALS.delegateBatch,
|
|
2540
2539
|
this.executionOutputBatch(7, EXECUTION_OUTPUT_DELEGATE_BATCH_OFFSET),
|
|
@@ -2548,6 +2547,7 @@ export class MirCompilerCore {
|
|
|
2548
2547
|
this.executionOutputSequence(7),
|
|
2549
2548
|
),
|
|
2550
2549
|
...this.resetExecutionOutput(),
|
|
2550
|
+
...prepared.statements,
|
|
2551
2551
|
...this.resetRuntimeFailure(event.handler),
|
|
2552
2552
|
this.module.global.set(
|
|
2553
2553
|
POINTER_GLOBALS.eventPayload,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import binaryen from "binaryen";
|
|
2
2
|
import { PROCESSOR_EXECUTION_INPUT_REJECTED } from "@onda-lang/processor-abi";
|
|
3
3
|
|
|
4
|
-
// Emit preflight separately from transfer so rejection cannot change workspace
|
|
5
|
-
//
|
|
4
|
+
// Emit preflight separately from transfer so rejection cannot change workspace
|
|
5
|
+
// or processor state. The event entry resets its call-scoped output first. All
|
|
6
|
+
// generated metadata is per tensor.
|
|
6
7
|
export function prepareEventInput(compiler, plan) {
|
|
7
8
|
const m = compiler.module;
|
|
8
9
|
const locals = [];
|
|
@@ -793,6 +793,7 @@ export class MirCompilerLowering extends MirCompilerCore {
|
|
|
793
793
|
}
|
|
794
794
|
|
|
795
795
|
compilePackedSliceCopy(slice, count, scalar, destination, counterLocal) {
|
|
796
|
+
const elementSize = this.scalarSize(scalar);
|
|
796
797
|
const loopLabel = `$onda.delegate.copy.${this.nextLabel++}`;
|
|
797
798
|
const counter = () => this.module.local.get(counterLocal, binaryen.i32);
|
|
798
799
|
const sourceAddress = () =>
|
|
@@ -805,10 +806,10 @@ export class MirCompilerLowering extends MirCompilerCore {
|
|
|
805
806
|
destination(),
|
|
806
807
|
this.module.i32.mul(
|
|
807
808
|
counter(),
|
|
808
|
-
this.module.i32.const(
|
|
809
|
+
this.module.i32.const(elementSize),
|
|
809
810
|
),
|
|
810
811
|
);
|
|
811
|
-
|
|
812
|
+
const elementwise = this.module.block(null, [
|
|
812
813
|
this.module.local.set(counterLocal, this.module.i32.const(0)),
|
|
813
814
|
this.module.loop(
|
|
814
815
|
loopLabel,
|
|
@@ -829,6 +830,18 @@ export class MirCompilerLowering extends MirCompilerCore {
|
|
|
829
830
|
),
|
|
830
831
|
),
|
|
831
832
|
]);
|
|
833
|
+
return this.module.if(
|
|
834
|
+
this.module.i32.ne(count(), this.module.i32.const(0)),
|
|
835
|
+
this.module.if(
|
|
836
|
+
this.module.i32.eq(slice()[3], this.module.i32.const(elementSize)),
|
|
837
|
+
this.module.memory.copy(
|
|
838
|
+
destination(),
|
|
839
|
+
slice()[0],
|
|
840
|
+
this.module.i32.mul(count(), this.module.i32.const(elementSize)),
|
|
841
|
+
),
|
|
842
|
+
elementwise,
|
|
843
|
+
),
|
|
844
|
+
);
|
|
832
845
|
}
|
|
833
846
|
|
|
834
847
|
compileOutputStore(data, context) {
|
package/dist/build.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"ondaVersion": "0.8.
|
|
2
|
+
"ondaVersion": "0.8.6",
|
|
3
3
|
"binaryenVersion": "130.0.0",
|
|
4
4
|
"frontendPackage": "onda_compiler_web",
|
|
5
5
|
"frontendOptimization": {
|
|
6
6
|
"tool": "wasm-opt",
|
|
7
7
|
"binaryenVersion": "130.0.0",
|
|
8
8
|
"optimizeLevel": 4,
|
|
9
|
-
"inputBytes":
|
|
10
|
-
"outputBytes":
|
|
9
|
+
"inputBytes": 10639608,
|
|
10
|
+
"outputBytes": 7802146
|
|
11
11
|
}
|
|
12
12
|
}
|
|
Binary file
|
|
@@ -675,7 +675,7 @@ SOFTWARE.
|
|
|
675
675
|
MIT License (MIT)
|
|
676
676
|
|
|
677
677
|
Used by:
|
|
678
|
-
- onda_compiler_web 0.8.
|
|
678
|
+
- onda_compiler_web 0.8.6 (https://github.com/onda-lang/onda)
|
|
679
679
|
|
|
680
680
|
MIT License
|
|
681
681
|
|
|
@@ -704,13 +704,13 @@ SOFTWARE.
|
|
|
704
704
|
MIT License (MIT)
|
|
705
705
|
|
|
706
706
|
Used by:
|
|
707
|
-
- onda_frontend 0.8.
|
|
708
|
-
- onda_host_protocol 0.8.
|
|
709
|
-
- onda_lsp 0.8.
|
|
710
|
-
- onda_mir 0.8.
|
|
711
|
-
- onda_processor_abi 0.8.
|
|
712
|
-
- onda_project 0.8.
|
|
713
|
-
- onda_semantics 0.8.
|
|
707
|
+
- onda_frontend 0.8.6
|
|
708
|
+
- onda_host_protocol 0.8.6
|
|
709
|
+
- onda_lsp 0.8.6
|
|
710
|
+
- onda_mir 0.8.6
|
|
711
|
+
- onda_processor_abi 0.8.6
|
|
712
|
+
- onda_project 0.8.6
|
|
713
|
+
- onda_semantics 0.8.6
|
|
714
714
|
|
|
715
715
|
MIT License
|
|
716
716
|
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const ONDA_VERSION = "0.8.
|
|
1
|
+
export const ONDA_VERSION = "0.8.6";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onda-lang/wasm-compiler",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Onda source-to-WebAssembly compiler for browsers and Node.js",
|
|
6
6
|
"license": "MIT",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"prepack": "npm run build && node ../../scripts/stage-web-api-docs.mjs"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@onda-lang/processor-abi": "0.8.
|
|
63
|
+
"@onda-lang/processor-abi": "0.8.6",
|
|
64
64
|
"binaryen": "130.0.0"
|
|
65
65
|
},
|
|
66
66
|
"publishConfig": {
|