@onda-lang/wasm-compiler 0.7.4 → 0.7.5
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.
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Synchronized from format-versions.json; do not edit this copy directly.
|
|
2
|
-
export const SUPPORTED_MIR_SCHEMA_VERSION =
|
|
2
|
+
export const SUPPORTED_MIR_SCHEMA_VERSION = 5;
|
package/dist/backend/index.js
CHANGED
|
@@ -5287,6 +5287,62 @@ class MirCompiler {
|
|
|
5287
5287
|
arg(0),
|
|
5288
5288
|
),
|
|
5289
5289
|
);
|
|
5290
|
+
case "range_wrap": { // Bounds are validator-required integer constants.
|
|
5291
|
+
const lowerLiteral = data.args[1]?.data;
|
|
5292
|
+
const upperLiteral = data.args[2]?.data;
|
|
5293
|
+
if (
|
|
5294
|
+
data.args[1]?.kind !== "constant"
|
|
5295
|
+
|| data.args[2]?.kind !== "constant"
|
|
5296
|
+
|| lowerLiteral?.type !== scalar
|
|
5297
|
+
|| upperLiteral?.type !== scalar
|
|
5298
|
+
) {
|
|
5299
|
+
this.fail("range_wrap requires constant bounds matching its integer operand");
|
|
5300
|
+
}
|
|
5301
|
+
const lower = scalar === "i64"
|
|
5302
|
+
? decodeI64Literal(lowerLiteral.value, this)
|
|
5303
|
+
: BigInt(lowerLiteral.value);
|
|
5304
|
+
const upper = scalar === "i64"
|
|
5305
|
+
? decodeI64Literal(upperLiteral.value, this)
|
|
5306
|
+
: BigInt(upperLiteral.value);
|
|
5307
|
+
const bits = scalar === "i64" ? 64n : 32n;
|
|
5308
|
+
const width = upper - lower + 1n;
|
|
5309
|
+
if (width === (1n << bits)) return arg(0);
|
|
5310
|
+
const encodedWidth = BigInt.asIntN(Number(bits), width);
|
|
5311
|
+
const widthValue = scalar === "i64"
|
|
5312
|
+
? this.module.i64.const(encodedWidth)
|
|
5313
|
+
: this.module.i32.const(Number(encodedWidth));
|
|
5314
|
+
const encodedSpan = BigInt.asIntN(Number(bits), width - 1n);
|
|
5315
|
+
const spanValue = scalar === "i64"
|
|
5316
|
+
? this.module.i64.const(encodedSpan)
|
|
5317
|
+
: this.module.i32.const(Number(encodedSpan));
|
|
5318
|
+
const one = scalar === "i64"
|
|
5319
|
+
? this.module.i64.const(1n)
|
|
5320
|
+
: this.module.i32.const(1);
|
|
5321
|
+
const distanceFromLower = lower === 0n
|
|
5322
|
+
? arg(0)
|
|
5323
|
+
: wasm.sub(arg(0), arg(1));
|
|
5324
|
+
return this.module.if(
|
|
5325
|
+
wasm.le_u(distanceFromLower, spanValue),
|
|
5326
|
+
arg(0),
|
|
5327
|
+
this.module.if(
|
|
5328
|
+
wasm.lt_s(arg(0), arg(1)),
|
|
5329
|
+
wasm.sub(
|
|
5330
|
+
arg(2),
|
|
5331
|
+
wasm.rem_u(
|
|
5332
|
+
wasm.sub(wasm.sub(arg(1), one), arg(0)),
|
|
5333
|
+
widthValue,
|
|
5334
|
+
),
|
|
5335
|
+
),
|
|
5336
|
+
wasm.add(
|
|
5337
|
+
arg(1),
|
|
5338
|
+
wasm.rem_u(
|
|
5339
|
+
wasm.sub(arg(0), wasm.add(arg(2), one)),
|
|
5340
|
+
widthValue,
|
|
5341
|
+
),
|
|
5342
|
+
),
|
|
5343
|
+
),
|
|
5344
|
+
);
|
|
5345
|
+
}
|
|
5290
5346
|
default:
|
|
5291
5347
|
this.fail(`intrinsic '${data.intrinsic}' requires f32 or f64 operands`);
|
|
5292
5348
|
}
|
|
@@ -5809,6 +5865,19 @@ class MirCompiler {
|
|
|
5809
5865
|
packed_snapshot_byte_offset: byteOffset,
|
|
5810
5866
|
physical_state_byte_offset: layout.offset,
|
|
5811
5867
|
byte_size: layout.size,
|
|
5868
|
+
integer_range: slot.integer_range === undefined || slot.integer_range === null
|
|
5869
|
+
? null
|
|
5870
|
+
: {
|
|
5871
|
+
min: {
|
|
5872
|
+
type: slot.integer_range.min.type,
|
|
5873
|
+
value: String(slot.integer_range.min.value),
|
|
5874
|
+
},
|
|
5875
|
+
max: {
|
|
5876
|
+
type: slot.integer_range.max.type,
|
|
5877
|
+
value: String(slot.integer_range.max.value),
|
|
5878
|
+
},
|
|
5879
|
+
mode: slot.integer_range.mode,
|
|
5880
|
+
},
|
|
5812
5881
|
});
|
|
5813
5882
|
byteOffset += layout.size;
|
|
5814
5883
|
}
|
package/dist/build.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"ondaVersion": "0.7.
|
|
2
|
+
"ondaVersion": "0.7.5",
|
|
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": 8245581,
|
|
10
|
+
"outputBytes": 6166708
|
|
11
11
|
}
|
|
12
12
|
}
|
|
Binary file
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const ONDA_VERSION = "0.7.
|
|
1
|
+
export const ONDA_VERSION = "0.7.5";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onda-lang/wasm-compiler",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Onda source-to-WebAssembly compiler for browsers and Node.js",
|
|
6
6
|
"license": "MIT",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"prepack": "npm run build"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@onda-lang/processor-abi": "0.7.
|
|
62
|
+
"@onda-lang/processor-abi": "0.7.5",
|
|
63
63
|
"binaryen": "130.0.0"
|
|
64
64
|
},
|
|
65
65
|
"publishConfig": {
|