diff --git a/lib/loader/README.md b/lib/loader/README.md
index c05025ae..83b06d24 100644
--- a/lib/loader/README.md
+++ b/lib/loader/README.md
@@ -28,7 +28,7 @@ API
**Note** that `T` above can either be omitted if the structure of the module is unknown, or can reference a `.d.ts` (i.e. `typeof MyModule`) as produced by the compiler with the `-d` option.
-Instances are automatically populated with useful utility:
+Besides demangling classes exported from your entry file to a handy object structure one can use like JS objects, instances are automatically populated with useful utility:
* **I8**: `Int8Array`
An 8-bit signed integer view on the memory.
@@ -162,7 +162,7 @@ Instances are automatically populated with useful utility:
**Note** that the allocation and ownership features above require the `full` (this is the default) or the `stub` runtime to be present in your module. Other runtime variations do not export this functionality without further ado (so the compiler can eliminate what's dead code).
-**Note** that references returned from exported functions have already been retained for you and the runtime expects that you release them once not needed anymore.
+**Note** that references returned from exported functions have already been retained for you and the runtime expects that you release them once not needed anymore. This is also true for constructors and getters.
Examples
--------
diff --git a/lib/loader/index.js b/lib/loader/index.js
index 726d5d94..014d1f39 100644
--- a/lib/loader/index.js
+++ b/lib/loader/index.js
@@ -10,25 +10,28 @@ const STRING_ID = 1;
const ARRAYBUFFERVIEW_ID = 2;
// Runtime type information
-const ARRAY = 1 << 0;
-const SET = 1 << 1;
-const MAP = 1 << 2;
-const VAL_ALIGN = 1 << 4;
-const VAL_SIGNED = 1 << 9;
-const VAL_FLOAT = 1 << 10;
-const VAL_NULLABLE = 1 << 11;
-const VAL_MANAGED = 1 << 12;
-const KEY_ALIGN = 1 << 13;
-const KEY_SIGNED = 1 << 18;
-const KEY_FLOAT = 1 << 19;
-const KEY_NULLABLE = 1 << 20;
-const KEY_MANAGED = 1 << 21;
+const ARRAYBUFFERVIEW = 1 << 0;
+const ARRAY = 1 << 1;
+const SET = 1 << 2;
+const MAP = 1 << 3;
+const VAL_ALIGN = 1 << 5;
+const VAL_SIGNED = 1 << 10;
+const VAL_FLOAT = 1 << 11;
+const VAL_NULLABLE = 1 << 12;
+const VAL_MANAGED = 1 << 13;
+const KEY_ALIGN = 1 << 14;
+const KEY_SIGNED = 1 << 19;
+const KEY_FLOAT = 1 << 20;
+const KEY_NULLABLE = 1 << 21;
+const KEY_MANAGED = 1 << 22;
-// ArrayBufferView layout
-const ABV_BUFFER_OFFSET = 0;
-const ABV_DATASTART_OFFSET = 4;
-const ABV_DATALENGTH_OFFSET = 8;
-const ABV_SIZE = 12;
+// Array(BufferView) layout
+const ARRAYBUFFERVIEW_BUFFER_OFFSET = 0;
+const ARRAYBUFFERVIEW_DATASTART_OFFSET = 4;
+const ARRAYBUFFERVIEW_DATALENGTH_OFFSET = 8;
+const ARRAYBUFFERVIEW_SIZE = 12;
+const ARRAY_LENGTH_OFFSET = 12;
+const ARRAY_SIZE = 16;
const BIGINT = typeof BigUint64Array !== "undefined";
const THIS = Symbol();
@@ -169,15 +172,16 @@ function postInstantiate(baseModule, instance) {
/** Allocates a new array in the module's memory and returns its retained pointer. */
function __allocArray(id, values) {
const info = getInfo(id);
- if (!(info & ARRAY)) throw Error("not an array: " + id + " @ " + info);
+ if (!(info & (ARRAYBUFFERVIEW | ARRAY))) throw Error("not an array: " + id + " @ " + info);
const align = getAlign(VAL_ALIGN, info);
const length = values.length;
const buf = alloc(length << align, ARRAYBUFFER_ID);
- const arr = alloc(ABV_SIZE, id);
+ const arr = alloc(ARRAYBUFFERVIEW_SIZE, id);
checkMem();
- U32[arr + ABV_BUFFER_OFFSET >>> 2] = retain(buf);
- U32[arr + ABV_DATASTART_OFFSET >>> 2] = buf;
- U32[arr + ABV_DATALENGTH_OFFSET >>> 2] = length << align;
+ U32[arr + ARRAYBUFFERVIEW_BUFFER_OFFSET >>> 2] = retain(buf);
+ U32[arr + ARRAYBUFFERVIEW_DATASTART_OFFSET >>> 2] = buf;
+ U32[arr + ARRAYBUFFERVIEW_DATALENGTH_OFFSET >>> 2] = length << align;
+ if (info & ARRAY) U32[arr + ARRAY_LENGTH_OFFSET >>> 2] = length;
const view = getView(align, info & VAL_SIGNED, info & VAL_FLOAT);
for (let i = 0; i < length; ++i) view[(buf >> align) + i] = values[i];
if (info & VAL_MANAGED) for (let i = 0; i < length; ++i) retain(values[i]);
@@ -191,10 +195,12 @@ function postInstantiate(baseModule, instance) {
checkMem();
const id = U32[arr + ID_OFFSET >>> 2];
const info = getInfo(id);
- if (!(info & ARRAY)) throw Error("not an array: " + id);
+ if (!(info & (ARRAYBUFFERVIEW | ARRAY))) throw Error("not an array: " + id);
const align = getAlign(VAL_ALIGN, info);
- var buf = U32[arr + ABV_DATASTART_OFFSET >>> 2];
- const length = U32[buf + SIZE_OFFSET >>> 2] >>> align;
+ var buf = U32[arr + ARRAYBUFFERVIEW_DATASTART_OFFSET >>> 2];
+ const length = info & ARRAY
+ ? U32[arr + ARRAY_LENGTH_OFFSET >>> 2]
+ : U32[buf + SIZE_OFFSET >>> 2] >>> align;
const view = getView(align, info & VAL_SIGNED, info & VAL_FLOAT);
return Array.from(view.slice(buf >>>= align, buf + length));
}
diff --git a/lib/loader/tests/assembly/index.ts b/lib/loader/tests/assembly/index.ts
index 9e0471db..3b68e105 100644
--- a/lib/loader/tests/assembly/index.ts
+++ b/lib/loader/tests/assembly/index.ts
@@ -45,6 +45,10 @@ export function sum(arr: Int32Array): i32 {
return v;
}
+export function changeLength(arr: Array, length: i32): void {
+ arr.length = length;
+}
+
export function varadd(a: i32 = 1, b: i32 = 2): i32 {
return a + b;
}
@@ -62,3 +66,4 @@ export function dotrace(num: f64): void {
export const INT32ARRAY_ID = idof();
export const UINT32ARRAY_ID = idof();
export const FLOAT32ARRAY_ID = idof();
+export const ARRAYI32_ID = idof>();
diff --git a/lib/loader/tests/build/untouched.wasm b/lib/loader/tests/build/untouched.wasm
index 090a2961..d799d459 100644
Binary files a/lib/loader/tests/build/untouched.wasm and b/lib/loader/tests/build/untouched.wasm differ
diff --git a/lib/loader/tests/index.js b/lib/loader/tests/index.js
index e542eeb7..30d86a7e 100644
--- a/lib/loader/tests/index.js
+++ b/lib/loader/tests/index.js
@@ -72,6 +72,17 @@ assert.strictEqual(module.__getString(module.COLOR), "red");
try { module.__release(ref); assert(false); } catch (e) {};
}
+// should be able to work with normal arrays
+{
+ let arr = [1, 2, 3, 4, 5];
+ let ref = module.__retain(module.__allocArray(module.ARRAYI32_ID, arr));
+ assert(module.__instanceof(ref, module.ARRAYI32_ID));
+ module.changeLength(ref, 3);
+ assert.deepEqual(module.__getArray(ref), [1, 2, 3]);
+ module.__release(ref);
+ try { module.__release(ref); assert(false); } catch (e) {};
+}
+
// should be able to correctly call a function with variable arguments
assert.strictEqual(module.varadd(), 3);
assert.strictEqual(module.varadd(2, 3), 5);
diff --git a/src/builtins.ts b/src/builtins.ts
index 899f5e35..7d7f1f27 100644
--- a/src/builtins.ts
+++ b/src/builtins.ts
@@ -4164,6 +4164,7 @@ export function compileRTTI(compiler: Compiler): void {
var off = 4;
var abvInstance = program.arrayBufferViewInstance;
var abvPrototype = abvInstance.prototype;
+ var arrayPrototype = program.arrayPrototype;
var setPrototype = program.setPrototype;
var mapPrototype = program.mapPrototype;
var lastId = 0;
@@ -4173,7 +4174,9 @@ export function compileRTTI(compiler: Compiler): void {
if (instance.isAcyclic) flags |= TypeinfoFlags.ACYCLIC;
if (instance !== abvInstance && instance.extends(abvPrototype)) {
let valueType = instance.getArrayValueType();
- flags |= TypeinfoFlags.ARRAY;
+ flags |= instance.extends(arrayPrototype)
+ ? TypeinfoFlags.ARRAY
+ : TypeinfoFlags.ARRAYBUFFERVIEW;
flags |= TypeinfoFlags.VALUE_ALIGN_0 * typeToRuntimeFlags(valueType);
} else if (instance.extends(setPrototype)) {
let typeArguments = assert(instance.getTypeArgumentsTo(setPrototype));
diff --git a/std/assembly/shared/typeinfo.ts b/std/assembly/shared/typeinfo.ts
index a55f61e0..e20e8ff7 100644
--- a/std/assembly/shared/typeinfo.ts
+++ b/std/assembly/shared/typeinfo.ts
@@ -25,48 +25,50 @@ export class Typeinfo {
export const enum TypeinfoFlags {
/** No specific flags. */
NONE = 0,
+ /** Type is an `ArrayBufferView`. */
+ ARRAYBUFFERVIEW = 1 << 0,
/** Type is an `Array`. */
- ARRAY = 1 << 0,
+ ARRAY = 1 << 1,
/** Type is a `Set`. */
- SET = 1 << 1,
+ SET = 1 << 2,
/** Type is a `Map`. */
- MAP = 1 << 2,
+ MAP = 1 << 3,
/** Type is inherently acyclic. */
- ACYCLIC = 1 << 3,
+ ACYCLIC = 1 << 4,
/** Value alignment of 1 byte. */
- VALUE_ALIGN_0 = 1 << 4,
+ VALUE_ALIGN_0 = 1 << 5,
/** Value alignment of 2 bytes. */
- VALUE_ALIGN_1 = 1 << 5,
+ VALUE_ALIGN_1 = 1 << 6,
/** Value alignment of 4 bytes. */
- VALUE_ALIGN_2 = 1 << 6,
+ VALUE_ALIGN_2 = 1 << 7,
/** Value alignment of 8 bytes. */
- VALUE_ALIGN_3 = 1 << 7,
+ VALUE_ALIGN_3 = 1 << 8,
/** Value alignment of 16 bytes. */
- VALUE_ALIGN_4 = 1 << 8,
+ VALUE_ALIGN_4 = 1 << 9,
/** Value is a signed type. */
- VALUE_SIGNED = 1 << 9,
+ VALUE_SIGNED = 1 << 10,
/** Value is a float type. */
- VALUE_FLOAT = 1 << 10,
+ VALUE_FLOAT = 1 << 11,
/** Value type is nullable. */
- VALUE_NULLABLE = 1 << 11,
+ VALUE_NULLABLE = 1 << 12,
/** Value type is managed. */
- VALUE_MANAGED = 1 << 12,
+ VALUE_MANAGED = 1 << 13,
/** Key alignment of 1 byte. */
- KEY_ALIGN_0 = 1 << 13,
+ KEY_ALIGN_0 = 1 << 14,
/** Key alignment of 2 bytes. */
- KEY_ALIGN_1 = 1 << 14,
+ KEY_ALIGN_1 = 1 << 15,
/** Key alignment of 4 bytes. */
- KEY_ALIGN_2 = 1 << 15,
+ KEY_ALIGN_2 = 1 << 16,
/** Key alignment of 8 bytes. */
- KEY_ALIGN_3 = 1 << 16,
+ KEY_ALIGN_3 = 1 << 17,
/** Key alignment of 16 bytes. */
- KEY_ALIGN_4 = 1 << 17,
+ KEY_ALIGN_4 = 1 << 18,
/** Value is a signed type. */
- KEY_SIGNED = 1 << 18,
+ KEY_SIGNED = 1 << 19,
/** Value is a float type. */
- KEY_FLOAT = 1 << 19,
+ KEY_FLOAT = 1 << 20,
/** Key type is nullable. */
- KEY_NULLABLE = 1 << 20,
+ KEY_NULLABLE = 1 << 21,
/** Key type is managed. */
- KEY_MANAGED = 1 << 21
+ KEY_MANAGED = 1 << 22
}
diff --git a/tests/compiler/rc/global-init.optimized.wat b/tests/compiler/rc/global-init.optimized.wat
index 82f610ab..ebc6ed25 100644
--- a/tests/compiler/rc/global-init.optimized.wat
+++ b/tests/compiler/rc/global-init.optimized.wat
@@ -17,7 +17,7 @@
(data (i32.const 120) "$\00\00\00\01\00\00\00\01\00\00\00$\00\00\00I\00n\00d\00e\00x\00 \00o\00u\00t\00 \00o\00f\00 \00r\00a\00n\00g\00e")
(data (i32.const 176) "\14\00\00\00\01\00\00\00\01\00\00\00\14\00\00\00~\00l\00i\00b\00/\00r\00t\00.\00t\00s")
(data (i32.const 216) "(\00\00\00\01\00\00\00\01\00\00\00(\00\00\00a\00l\00l\00o\00c\00a\00t\00i\00o\00n\00 \00t\00o\00o\00 \00l\00a\00r\00g\00e")
- (data (i32.const 272) "\03\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08")
+ (data (i32.const 272) "\03\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00\10")
(global $rc/global-init/a (mut i32) (i32.const 0))
(global $rc/global-init/b (mut i32) (i32.const 0))
(global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0))
@@ -1353,7 +1353,7 @@
local.get $0
i32.load offset=8
call $~lib/rt/__typeinfo
- i32.const 8
+ i32.const 16
i32.and
if
local.get $0
diff --git a/tests/compiler/rc/global-init.untouched.wat b/tests/compiler/rc/global-init.untouched.wat
index 07fc96b0..e01ae19a 100644
--- a/tests/compiler/rc/global-init.untouched.wat
+++ b/tests/compiler/rc/global-init.untouched.wat
@@ -20,7 +20,7 @@
(data (i32.const 120) "$\00\00\00\01\00\00\00\01\00\00\00$\00\00\00I\00n\00d\00e\00x\00 \00o\00u\00t\00 \00o\00f\00 \00r\00a\00n\00g\00e\00")
(data (i32.const 176) "\14\00\00\00\01\00\00\00\01\00\00\00\14\00\00\00~\00l\00i\00b\00/\00r\00t\00.\00t\00s\00")
(data (i32.const 216) "(\00\00\00\01\00\00\00\01\00\00\00(\00\00\00a\00l\00l\00o\00c\00a\00t\00i\00o\00n\00 \00t\00o\00o\00 \00l\00a\00r\00g\00e\00")
- (data (i32.const 272) "\03\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00")
+ (data (i32.const 272) "\03\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00")
(table $0 1 funcref)
(elem (i32.const 0) $null)
(global $rc/global-init/a (mut i32) (i32.const 0))
@@ -3051,7 +3051,7 @@
local.get $0
i32.load offset=8
call $~lib/rt/__typeinfo
- i32.const 8
+ i32.const 16
i32.and
i32.eqz
if
diff --git a/tests/compiler/rc/local-init.optimized.wat b/tests/compiler/rc/local-init.optimized.wat
index c7042cc5..c2468659 100644
--- a/tests/compiler/rc/local-init.optimized.wat
+++ b/tests/compiler/rc/local-init.optimized.wat
@@ -18,7 +18,7 @@
(data (i32.const 120) "$\00\00\00\01\00\00\00\01\00\00\00$\00\00\00I\00n\00d\00e\00x\00 \00o\00u\00t\00 \00o\00f\00 \00r\00a\00n\00g\00e")
(data (i32.const 176) "\14\00\00\00\01\00\00\00\01\00\00\00\14\00\00\00~\00l\00i\00b\00/\00r\00t\00.\00t\00s")
(data (i32.const 216) "(\00\00\00\01\00\00\00\01\00\00\00(\00\00\00a\00l\00l\00o\00c\00a\00t\00i\00o\00n\00 \00t\00o\00o\00 \00l\00a\00r\00g\00e")
- (data (i32.const 272) "\04\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08")
+ (data (i32.const 272) "\04\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00\10")
(global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0))
(global $~lib/rt/pure/CUR (mut i32) (i32.const 0))
(global $~lib/rt/pure/END (mut i32) (i32.const 0))
@@ -1405,7 +1405,7 @@
local.get $0
i32.load offset=8
call $~lib/rt/__typeinfo
- i32.const 8
+ i32.const 16
i32.and
if
local.get $0
diff --git a/tests/compiler/rc/local-init.untouched.wat b/tests/compiler/rc/local-init.untouched.wat
index 09130261..ffcb8161 100644
--- a/tests/compiler/rc/local-init.untouched.wat
+++ b/tests/compiler/rc/local-init.untouched.wat
@@ -20,7 +20,7 @@
(data (i32.const 120) "$\00\00\00\01\00\00\00\01\00\00\00$\00\00\00I\00n\00d\00e\00x\00 \00o\00u\00t\00 \00o\00f\00 \00r\00a\00n\00g\00e\00")
(data (i32.const 176) "\14\00\00\00\01\00\00\00\01\00\00\00\14\00\00\00~\00l\00i\00b\00/\00r\00t\00.\00t\00s\00")
(data (i32.const 216) "(\00\00\00\01\00\00\00\01\00\00\00(\00\00\00a\00l\00l\00o\00c\00a\00t\00i\00o\00n\00 \00t\00o\00o\00 \00l\00a\00r\00g\00e\00")
- (data (i32.const 272) "\04\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00")
+ (data (i32.const 272) "\04\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00")
(table $0 1 funcref)
(elem (i32.const 0) $null)
(global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0))
@@ -3045,7 +3045,7 @@
local.get $0
i32.load offset=8
call $~lib/rt/__typeinfo
- i32.const 8
+ i32.const 16
i32.and
i32.eqz
if
diff --git a/tests/compiler/rc/logical-and-mismatch.optimized.wat b/tests/compiler/rc/logical-and-mismatch.optimized.wat
index 2e84f3cf..dff60234 100644
--- a/tests/compiler/rc/logical-and-mismatch.optimized.wat
+++ b/tests/compiler/rc/logical-and-mismatch.optimized.wat
@@ -18,7 +18,7 @@
(data (i32.const 112) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00p\00u\00r\00e\00.\00t\00s")
(data (i32.const 160) "$\00\00\00\01\00\00\00\01\00\00\00$\00\00\00I\00n\00d\00e\00x\00 \00o\00u\00t\00 \00o\00f\00 \00r\00a\00n\00g\00e")
(data (i32.const 216) "\14\00\00\00\01\00\00\00\01\00\00\00\14\00\00\00~\00l\00i\00b\00/\00r\00t\00.\00t\00s")
- (data (i32.const 256) "\04\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08")
+ (data (i32.const 256) "\04\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00\10")
(global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0))
(global $rc/logical-and-mismatch/gloRef (mut i32) (i32.const 0))
(global $~lib/rt/pure/CUR (mut i32) (i32.const 0))
@@ -1412,7 +1412,7 @@
local.get $0
i32.load offset=8
call $~lib/rt/__typeinfo
- i32.const 8
+ i32.const 16
i32.and
if
local.get $0
diff --git a/tests/compiler/rc/logical-and-mismatch.untouched.wat b/tests/compiler/rc/logical-and-mismatch.untouched.wat
index bb3e66b5..42c1ff37 100644
--- a/tests/compiler/rc/logical-and-mismatch.untouched.wat
+++ b/tests/compiler/rc/logical-and-mismatch.untouched.wat
@@ -19,7 +19,7 @@
(data (i32.const 112) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00p\00u\00r\00e\00.\00t\00s\00")
(data (i32.const 160) "$\00\00\00\01\00\00\00\01\00\00\00$\00\00\00I\00n\00d\00e\00x\00 \00o\00u\00t\00 \00o\00f\00 \00r\00a\00n\00g\00e\00")
(data (i32.const 216) "\14\00\00\00\01\00\00\00\01\00\00\00\14\00\00\00~\00l\00i\00b\00/\00r\00t\00.\00t\00s\00")
- (data (i32.const 256) "\04\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00")
+ (data (i32.const 256) "\04\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00")
(table $0 1 funcref)
(elem (i32.const 0) $null)
(global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0))
@@ -3061,7 +3061,7 @@
local.get $0
i32.load offset=8
call $~lib/rt/__typeinfo
- i32.const 8
+ i32.const 16
i32.and
i32.eqz
if
diff --git a/tests/compiler/rc/logical-or-mismatch.optimized.wat b/tests/compiler/rc/logical-or-mismatch.optimized.wat
index 9442df9d..0d101ecd 100644
--- a/tests/compiler/rc/logical-or-mismatch.optimized.wat
+++ b/tests/compiler/rc/logical-or-mismatch.optimized.wat
@@ -18,7 +18,7 @@
(data (i32.const 112) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00p\00u\00r\00e\00.\00t\00s")
(data (i32.const 160) "$\00\00\00\01\00\00\00\01\00\00\00$\00\00\00I\00n\00d\00e\00x\00 \00o\00u\00t\00 \00o\00f\00 \00r\00a\00n\00g\00e")
(data (i32.const 216) "\14\00\00\00\01\00\00\00\01\00\00\00\14\00\00\00~\00l\00i\00b\00/\00r\00t\00.\00t\00s")
- (data (i32.const 256) "\04\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08")
+ (data (i32.const 256) "\04\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00\10")
(global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0))
(global $rc/logical-or-mismatch/gloRef (mut i32) (i32.const 0))
(global $~lib/rt/pure/CUR (mut i32) (i32.const 0))
@@ -1412,7 +1412,7 @@
local.get $0
i32.load offset=8
call $~lib/rt/__typeinfo
- i32.const 8
+ i32.const 16
i32.and
if
local.get $0
diff --git a/tests/compiler/rc/logical-or-mismatch.untouched.wat b/tests/compiler/rc/logical-or-mismatch.untouched.wat
index f7589a88..e01e4715 100644
--- a/tests/compiler/rc/logical-or-mismatch.untouched.wat
+++ b/tests/compiler/rc/logical-or-mismatch.untouched.wat
@@ -19,7 +19,7 @@
(data (i32.const 112) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00p\00u\00r\00e\00.\00t\00s\00")
(data (i32.const 160) "$\00\00\00\01\00\00\00\01\00\00\00$\00\00\00I\00n\00d\00e\00x\00 \00o\00u\00t\00 \00o\00f\00 \00r\00a\00n\00g\00e\00")
(data (i32.const 216) "\14\00\00\00\01\00\00\00\01\00\00\00\14\00\00\00~\00l\00i\00b\00/\00r\00t\00.\00t\00s\00")
- (data (i32.const 256) "\04\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00")
+ (data (i32.const 256) "\04\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00")
(table $0 1 funcref)
(elem (i32.const 0) $null)
(global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0))
@@ -3061,7 +3061,7 @@
local.get $0
i32.load offset=8
call $~lib/rt/__typeinfo
- i32.const 8
+ i32.const 16
i32.and
i32.eqz
if
diff --git a/tests/compiler/rc/rereturn.optimized.wat b/tests/compiler/rc/rereturn.optimized.wat
index 7d616276..76b464cb 100644
--- a/tests/compiler/rc/rereturn.optimized.wat
+++ b/tests/compiler/rc/rereturn.optimized.wat
@@ -13,7 +13,7 @@
(data (i32.const 112) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00p\00u\00r\00e\00.\00t\00s")
(data (i32.const 160) "$\00\00\00\01\00\00\00\01\00\00\00$\00\00\00I\00n\00d\00e\00x\00 \00o\00u\00t\00 \00o\00f\00 \00r\00a\00n\00g\00e")
(data (i32.const 216) "\14\00\00\00\01\00\00\00\01\00\00\00\14\00\00\00~\00l\00i\00b\00/\00r\00t\00.\00t\00s")
- (data (i32.const 256) "\04\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08")
+ (data (i32.const 256) "\04\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00\10")
(global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0))
(global $~lib/rt/pure/CUR (mut i32) (i32.const 0))
(global $~lib/rt/pure/END (mut i32) (i32.const 0))
@@ -1398,7 +1398,7 @@
local.get $0
i32.load offset=8
call $~lib/rt/__typeinfo
- i32.const 8
+ i32.const 16
i32.and
if
local.get $0
diff --git a/tests/compiler/rc/rereturn.untouched.wat b/tests/compiler/rc/rereturn.untouched.wat
index 65a50376..ddacffc6 100644
--- a/tests/compiler/rc/rereturn.untouched.wat
+++ b/tests/compiler/rc/rereturn.untouched.wat
@@ -15,7 +15,7 @@
(data (i32.const 112) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00p\00u\00r\00e\00.\00t\00s\00")
(data (i32.const 160) "$\00\00\00\01\00\00\00\01\00\00\00$\00\00\00I\00n\00d\00e\00x\00 \00o\00u\00t\00 \00o\00f\00 \00r\00a\00n\00g\00e\00")
(data (i32.const 216) "\14\00\00\00\01\00\00\00\01\00\00\00\14\00\00\00~\00l\00i\00b\00/\00r\00t\00.\00t\00s\00")
- (data (i32.const 256) "\04\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00")
+ (data (i32.const 256) "\04\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00")
(table $0 1 funcref)
(elem (i32.const 0) $null)
(global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0))
@@ -3037,7 +3037,7 @@
local.get $0
i32.load offset=8
call $~lib/rt/__typeinfo
- i32.const 8
+ i32.const 16
i32.and
i32.eqz
if
diff --git a/tests/compiler/rc/ternary-mismatch.optimized.wat b/tests/compiler/rc/ternary-mismatch.optimized.wat
index 4d39eb82..954cecc3 100644
--- a/tests/compiler/rc/ternary-mismatch.optimized.wat
+++ b/tests/compiler/rc/ternary-mismatch.optimized.wat
@@ -18,7 +18,7 @@
(data (i32.const 112) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00p\00u\00r\00e\00.\00t\00s")
(data (i32.const 160) "$\00\00\00\01\00\00\00\01\00\00\00$\00\00\00I\00n\00d\00e\00x\00 \00o\00u\00t\00 \00o\00f\00 \00r\00a\00n\00g\00e")
(data (i32.const 216) "\14\00\00\00\01\00\00\00\01\00\00\00\14\00\00\00~\00l\00i\00b\00/\00r\00t\00.\00t\00s")
- (data (i32.const 256) "\04\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08")
+ (data (i32.const 256) "\04\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00\10")
(global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0))
(global $rc/ternary-mismatch/gloRef (mut i32) (i32.const 0))
(global $~lib/rt/pure/CUR (mut i32) (i32.const 0))
@@ -1423,7 +1423,7 @@
local.get $0
i32.load offset=8
call $~lib/rt/__typeinfo
- i32.const 8
+ i32.const 16
i32.and
if
local.get $0
diff --git a/tests/compiler/rc/ternary-mismatch.untouched.wat b/tests/compiler/rc/ternary-mismatch.untouched.wat
index 6de2aa63..5e8aa091 100644
--- a/tests/compiler/rc/ternary-mismatch.untouched.wat
+++ b/tests/compiler/rc/ternary-mismatch.untouched.wat
@@ -19,7 +19,7 @@
(data (i32.const 112) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00p\00u\00r\00e\00.\00t\00s\00")
(data (i32.const 160) "$\00\00\00\01\00\00\00\01\00\00\00$\00\00\00I\00n\00d\00e\00x\00 \00o\00u\00t\00 \00o\00f\00 \00r\00a\00n\00g\00e\00")
(data (i32.const 216) "\14\00\00\00\01\00\00\00\01\00\00\00\14\00\00\00~\00l\00i\00b\00/\00r\00t\00.\00t\00s\00")
- (data (i32.const 256) "\04\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00")
+ (data (i32.const 256) "\04\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00")
(table $0 1 funcref)
(elem (i32.const 0) $null)
(global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0))
@@ -3072,7 +3072,7 @@
local.get $0
i32.load offset=8
call $~lib/rt/__typeinfo
- i32.const 8
+ i32.const 16
i32.and
i32.eqz
if
diff --git a/tests/compiler/retain-release-sanity.optimized.wat b/tests/compiler/retain-release-sanity.optimized.wat
index 2243de44..89c26788 100644
--- a/tests/compiler/retain-release-sanity.optimized.wat
+++ b/tests/compiler/retain-release-sanity.optimized.wat
@@ -28,7 +28,7 @@
(data (i32.const 608) "\02\00\00\00\01\00\00\00\01\00\00\00\02\00\00\00b")
(data (i32.const 632) "\08\00\00\00\01\00\00\00\01\00\00\00\08\00\00\00n\00u\00l\00l")
(data (i32.const 656) "\02\00\00\00\01\00\00\00\01\00\00\00\02\00\00\00d")
- (data (i32.const 680) "\05\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00I\02\00\00\02\00\00\00I\10\00\00\02")
+ (data (i32.const 680) "\05\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00\92\04\00\00\02\00\00\00\92 \00\00\02")
(global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0))
(global $~lib/rt/pure/CUR (mut i32) (i32.const 0))
(global $~lib/rt/pure/END (mut i32) (i32.const 0))
@@ -1416,7 +1416,7 @@
local.get $0
i32.load offset=8
call $~lib/rt/__typeinfo
- i32.const 8
+ i32.const 16
i32.and
if
local.get $0
diff --git a/tests/compiler/retain-release-sanity.untouched.wat b/tests/compiler/retain-release-sanity.untouched.wat
index 5e2c8412..7a83f96e 100644
--- a/tests/compiler/retain-release-sanity.untouched.wat
+++ b/tests/compiler/retain-release-sanity.untouched.wat
@@ -28,7 +28,7 @@
(data (i32.const 608) "\02\00\00\00\01\00\00\00\01\00\00\00\02\00\00\00b\00")
(data (i32.const 632) "\08\00\00\00\01\00\00\00\01\00\00\00\08\00\00\00n\00u\00l\00l\00")
(data (i32.const 656) "\02\00\00\00\01\00\00\00\01\00\00\00\02\00\00\00d\00")
- (data (i32.const 680) "\05\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00I\02\00\00\02\00\00\00I\10\00\00\02\00\00\00")
+ (data (i32.const 680) "\05\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00\92\04\00\00\02\00\00\00\92 \00\00\02\00\00\00")
(table $0 1 funcref)
(elem (i32.const 0) $null)
(global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0))
@@ -3054,7 +3054,7 @@
local.get $0
i32.load offset=8
call $~lib/rt/__typeinfo
- i32.const 8
+ i32.const 16
i32.and
i32.eqz
if
diff --git a/tests/compiler/rt/flags.optimized.wat b/tests/compiler/rt/flags.optimized.wat
index cd420b81..6c2d1878 100644
--- a/tests/compiler/rt/flags.optimized.wat
+++ b/tests/compiler/rt/flags.optimized.wat
@@ -7,11 +7,11 @@
(data (i32.const 8) "$\00\00\00\01\00\00\00\01\00\00\00$\00\00\00I\00n\00d\00e\00x\00 \00o\00u\00t\00 \00o\00f\00 \00r\00a\00n\00g\00e")
(data (i32.const 64) "\14\00\00\00\01\00\00\00\01\00\00\00\14\00\00\00~\00l\00i\00b\00/\00r\00t\00.\00t\00s")
(data (i32.const 104) "\16\00\00\00\01\00\00\00\01\00\00\00\16\00\00\00r\00t\00/\00f\00l\00a\00g\00s\00.\00t\00s")
- (data (i32.const 144) ":\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\19\02\00\00\02\00\00\00\19\00\00\00\02\00\00\00)\02\00\00\02\00\00\00)\00\00\00\02\00\00\00I\02\00\00\02\00\00\00I\00\00\00\02\00\00\00\89\02\00\00\02\00\00\00\89\00\00\00\02\00\00\00I\06\00\00\02\00\00\00\89\06\00\00\02\00\00\00\t\01\00\00\02\00\00\00\08\00\00\00\00\00\00\00I\10\00\00\02\00\00\00I\18\00\00\02\00\00\00\1a\02\00\00\00\00\00\00\1a\00\00\00\00\00\00\00*\02\00\00\00\00\00\00*\00\00\00\00\00\00\00J\02\00\00\00\00\00\00J\00\00\00\00\00\00\00\8a\02\00\00\00\00\00\00\8a\00\00\00\00\00\00\00J\06\00\00\00\00\00\00\8a\06\00\00\00\00\00\00\n\01\00\00\00\00\00\00J\10\00\00\00\00\00\00J\18\00\00\00\00\00\00\1c\02\02\00\00\00\00\00,\02\05\00\00\00\00\00L\82\04\00\00\00\00\00\8cB\04\00\00\00\00\00\0c!\04\00\00\00\00\00\1c\82 \00\00\00\00\00\1c\820\00\00\00\00\00L0\04\00\00\00\00\00L8\04\00\00\00\00\00L\980\00\00\00\00\00L\82\0c\00\00\00\00\00\08")
- (data (i32.const 524) "A\10\00\00\02\00\00\00\08")
- (data (i32.const 548) "B\10\00\00\00\00\00\00\08")
- (data (i32.const 572) "D\82 ")
- (data (i32.const 588) "D\90\04\00\00\00\00\00\08\00\00\00\00\00\00\00\08")
+ (data (i32.const 144) "E\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\001\04\00\00\02\00\00\001\00\00\00\02\00\00\001\00\00\00\02\00\00\00Q\04\00\00\02\00\00\00Q\00\00\00\02\00\00\00\91\04\00\00\02\00\00\00\91\00\00\00\02\00\00\00\11\05\00\00\02\00\00\00\11\01\00\00\02\00\00\00\91\0c\00\00\02\00\00\00\11\0d\00\00\02\00\00\002\04\00\00\02\00\00\002\00\00\00\02\00\00\00R\04\00\00\02\00\00\00R\00\00\00\02\00\00\00\92\04\00\00\02\00\00\00\92\00\00\00\02\00\00\00\12\05\00\00\02\00\00\00\12\01\00\00\02\00\00\00\92\0c\00\00\02\00\00\00\12\0d\00\00\02\00\00\00\12\02\00\00\02\00\00\00\10\00\00\00\00\00\00\00\92 \00\00\02\00\00\00\920\00\00\02\00\00\004\04\00\00\00\00\00\004\00\00\00\00\00\00\00T\04\00\00\00\00\00\00T\00\00\00\00\00\00\00\94\04\00\00\00\00\00\00\94\00\00\00\00\00\00\00\14\05\00\00\00\00\00\00\14\01\00\00\00\00\00\00\94\0c\00\00\00\00\00\00\14\0d\00\00\00\00\00\00\14\02\00\00\00\00\00\00\94 \00\00\00\00\00\00\940\00\00\00\00\00\008\04\04\00\00\00\00\00X\04\n\00\00\00\00\00\98\04\t\00\00\00\00\00\18\85\08\00\00\00\00\00\18B\08\00\00\00\00\008\04A\00\00\00\00\008\04a\00\00\00\00\00\98`\08\00\00\00\00\00\98p\08\00\00\00\00\00\980a\00\00\00\00\00\98\04\19\00\00\00\00\00\10")
+ (data (i32.const 612) "\82 \00\00\02\00\00\00\10")
+ (data (i32.const 636) "\84 \00\00\00\00\00\00\10")
+ (data (i32.const 660) "\88\04A")
+ (data (i32.const 676) "\88 \t\00\00\00\00\00\10\00\00\00\00\00\00\00\10")
(export "memory" (memory $0))
(start $start)
(func $~lib/rt/__typeinfo (; 1 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
@@ -38,306 +38,344 @@
block $folding-inner0
i32.const 4
call $~lib/rt/__typeinfo
- i32.const 537
+ i32.const 1073
i32.ne
if
br $folding-inner0
end
i32.const 5
call $~lib/rt/__typeinfo
- i32.const 25
+ i32.const 49
i32.ne
if
br $folding-inner0
end
i32.const 6
call $~lib/rt/__typeinfo
- i32.const 553
+ i32.const 49
i32.ne
if
br $folding-inner0
end
i32.const 7
call $~lib/rt/__typeinfo
- i32.const 41
+ i32.const 1105
i32.ne
if
br $folding-inner0
end
i32.const 8
call $~lib/rt/__typeinfo
- i32.const 585
+ i32.const 81
i32.ne
if
br $folding-inner0
end
i32.const 9
call $~lib/rt/__typeinfo
- i32.const 73
+ i32.const 1169
i32.ne
if
br $folding-inner0
end
i32.const 10
call $~lib/rt/__typeinfo
- i32.const 649
+ i32.const 145
i32.ne
if
br $folding-inner0
end
i32.const 11
call $~lib/rt/__typeinfo
- i32.const 137
+ i32.const 1297
i32.ne
if
br $folding-inner0
end
i32.const 12
call $~lib/rt/__typeinfo
- i32.const 1609
+ i32.const 273
i32.ne
if
br $folding-inner0
end
i32.const 13
call $~lib/rt/__typeinfo
- i32.const 1673
+ i32.const 3217
i32.ne
if
br $folding-inner0
end
i32.const 14
call $~lib/rt/__typeinfo
- i32.const 265
+ i32.const 3345
+ i32.ne
+ if
+ br $folding-inner0
+ end
+ i32.const 15
+ call $~lib/rt/__typeinfo
+ i32.const 1074
i32.ne
if
br $folding-inner0
end
i32.const 16
call $~lib/rt/__typeinfo
- i32.const 4169
+ i32.const 50
i32.ne
if
br $folding-inner0
end
i32.const 17
call $~lib/rt/__typeinfo
- i32.const 6217
+ i32.const 1106
i32.ne
if
br $folding-inner0
end
i32.const 18
call $~lib/rt/__typeinfo
- i32.const 538
+ i32.const 82
i32.ne
if
br $folding-inner0
end
i32.const 19
call $~lib/rt/__typeinfo
- i32.const 26
+ i32.const 1170
i32.ne
if
br $folding-inner0
end
i32.const 20
call $~lib/rt/__typeinfo
- i32.const 554
+ i32.const 146
i32.ne
if
br $folding-inner0
end
i32.const 21
call $~lib/rt/__typeinfo
- i32.const 42
+ i32.const 1298
i32.ne
if
br $folding-inner0
end
i32.const 22
call $~lib/rt/__typeinfo
- i32.const 586
+ i32.const 274
i32.ne
if
br $folding-inner0
end
i32.const 23
call $~lib/rt/__typeinfo
- i32.const 74
+ i32.const 3218
i32.ne
if
br $folding-inner0
end
i32.const 24
call $~lib/rt/__typeinfo
- i32.const 650
+ i32.const 3346
i32.ne
if
br $folding-inner0
end
i32.const 25
call $~lib/rt/__typeinfo
- i32.const 138
- i32.ne
- if
- br $folding-inner0
- end
- i32.const 26
- call $~lib/rt/__typeinfo
- i32.const 1610
+ i32.const 530
i32.ne
if
br $folding-inner0
end
i32.const 27
call $~lib/rt/__typeinfo
- i32.const 1674
+ i32.const 8338
i32.ne
if
br $folding-inner0
end
i32.const 28
call $~lib/rt/__typeinfo
- i32.const 266
+ i32.const 12434
i32.ne
if
br $folding-inner0
end
i32.const 29
call $~lib/rt/__typeinfo
- i32.const 4170
+ i32.const 1076
i32.ne
if
br $folding-inner0
end
i32.const 30
call $~lib/rt/__typeinfo
- i32.const 6218
+ i32.const 52
i32.ne
if
br $folding-inner0
end
i32.const 31
call $~lib/rt/__typeinfo
- i32.const 131612
+ i32.const 1108
i32.ne
if
br $folding-inner0
end
i32.const 32
call $~lib/rt/__typeinfo
- i32.const 328236
+ i32.const 84
i32.ne
if
br $folding-inner0
end
i32.const 33
call $~lib/rt/__typeinfo
- i32.const 295500
+ i32.const 1172
i32.ne
if
br $folding-inner0
end
i32.const 34
call $~lib/rt/__typeinfo
- i32.const 279180
+ i32.const 148
i32.ne
if
br $folding-inner0
end
i32.const 35
call $~lib/rt/__typeinfo
- i32.const 270604
+ i32.const 1300
i32.ne
if
br $folding-inner0
end
i32.const 36
call $~lib/rt/__typeinfo
- i32.const 2130460
+ i32.const 276
i32.ne
if
br $folding-inner0
end
i32.const 37
call $~lib/rt/__typeinfo
- i32.const 3179036
+ i32.const 3220
i32.ne
if
br $folding-inner0
end
i32.const 38
call $~lib/rt/__typeinfo
- i32.const 274508
+ i32.const 3348
i32.ne
if
br $folding-inner0
end
i32.const 39
call $~lib/rt/__typeinfo
- i32.const 276556
+ i32.const 532
i32.ne
if
br $folding-inner0
end
i32.const 40
call $~lib/rt/__typeinfo
- i32.const 3184716
+ i32.const 8340
i32.ne
if
br $folding-inner0
end
i32.const 41
call $~lib/rt/__typeinfo
- i32.const 819788
+ i32.const 12436
i32.ne
if
br $folding-inner0
end
i32.const 42
call $~lib/rt/__typeinfo
- i32.const 8
+ i32.const 263224
i32.ne
if
br $folding-inner0
end
i32.const 43
call $~lib/rt/__typeinfo
+ i32.const 656472
+ i32.ne
if
br $folding-inner0
end
i32.const 44
call $~lib/rt/__typeinfo
+ i32.const 591000
+ i32.ne
+ if
+ br $folding-inner0
+ end
+ i32.const 45
+ call $~lib/rt/__typeinfo
+ i32.const 558360
+ i32.ne
if
br $folding-inner0
end
i32.const 46
call $~lib/rt/__typeinfo
+ i32.const 541208
+ i32.ne
+ if
+ br $folding-inner0
+ end
+ i32.const 47
+ call $~lib/rt/__typeinfo
+ i32.const 4260920
+ i32.ne
if
br $folding-inner0
end
i32.const 48
call $~lib/rt/__typeinfo
- i32.const 8
+ i32.const 6358072
i32.ne
if
br $folding-inner0
end
i32.const 49
call $~lib/rt/__typeinfo
+ i32.const 549016
+ i32.ne
+ if
+ br $folding-inner0
+ end
+ i32.const 50
+ call $~lib/rt/__typeinfo
+ i32.const 553112
+ i32.ne
if
br $folding-inner0
end
i32.const 51
call $~lib/rt/__typeinfo
- i32.const 8
+ i32.const 6369432
i32.ne
if
br $folding-inner0
end
i32.const 52
call $~lib/rt/__typeinfo
+ i32.const 1639576
+ i32.ne
+ if
+ br $folding-inner0
+ end
+ i32.const 53
+ call $~lib/rt/__typeinfo
+ i32.const 16
+ i32.ne
if
br $folding-inner0
end
@@ -346,16 +384,55 @@
if
br $folding-inner0
end
- i32.const 56
+ i32.const 55
call $~lib/rt/__typeinfo
- i32.const 8
- i32.ne
if
br $folding-inner0
end
i32.const 57
call $~lib/rt/__typeinfo
- i32.const 8
+ if
+ br $folding-inner0
+ end
+ i32.const 59
+ call $~lib/rt/__typeinfo
+ i32.const 16
+ i32.ne
+ if
+ br $folding-inner0
+ end
+ i32.const 60
+ call $~lib/rt/__typeinfo
+ if
+ br $folding-inner0
+ end
+ i32.const 62
+ call $~lib/rt/__typeinfo
+ i32.const 16
+ i32.ne
+ if
+ br $folding-inner0
+ end
+ i32.const 63
+ call $~lib/rt/__typeinfo
+ if
+ br $folding-inner0
+ end
+ i32.const 65
+ call $~lib/rt/__typeinfo
+ if
+ br $folding-inner0
+ end
+ i32.const 67
+ call $~lib/rt/__typeinfo
+ i32.const 16
+ i32.ne
+ if
+ br $folding-inner0
+ end
+ i32.const 68
+ call $~lib/rt/__typeinfo
+ i32.const 16
i32.ne
if
br $folding-inner0
diff --git a/tests/compiler/rt/flags.ts b/tests/compiler/rt/flags.ts
index d42b0728..9777acf8 100644
--- a/tests/compiler/rt/flags.ts
+++ b/tests/compiler/rt/flags.ts
@@ -12,6 +12,18 @@ function test(flags: TypeinfoFlags): void {
// structure flags
+test(TypeinfoFlags.ARRAYBUFFERVIEW | TypeinfoFlags.ACYCLIC | TypeinfoFlags.VALUE_ALIGN_0 | TypeinfoFlags.VALUE_SIGNED);
+test(TypeinfoFlags.ARRAYBUFFERVIEW | TypeinfoFlags.ACYCLIC | TypeinfoFlags.VALUE_ALIGN_0);
+test(TypeinfoFlags.ARRAYBUFFERVIEW | TypeinfoFlags.ACYCLIC | TypeinfoFlags.VALUE_ALIGN_0);
+test(TypeinfoFlags.ARRAYBUFFERVIEW | TypeinfoFlags.ACYCLIC | TypeinfoFlags.VALUE_ALIGN_1 | TypeinfoFlags.VALUE_SIGNED);
+test(TypeinfoFlags.ARRAYBUFFERVIEW | TypeinfoFlags.ACYCLIC | TypeinfoFlags.VALUE_ALIGN_1);
+test(TypeinfoFlags.ARRAYBUFFERVIEW | TypeinfoFlags.ACYCLIC | TypeinfoFlags.VALUE_ALIGN_2 | TypeinfoFlags.VALUE_SIGNED);
+test(TypeinfoFlags.ARRAYBUFFERVIEW | TypeinfoFlags.ACYCLIC | TypeinfoFlags.VALUE_ALIGN_2);
+test(TypeinfoFlags.ARRAYBUFFERVIEW | TypeinfoFlags.ACYCLIC | TypeinfoFlags.VALUE_ALIGN_3 | TypeinfoFlags.VALUE_SIGNED);
+test(TypeinfoFlags.ARRAYBUFFERVIEW | TypeinfoFlags.ACYCLIC | TypeinfoFlags.VALUE_ALIGN_3);
+test(TypeinfoFlags.ARRAYBUFFERVIEW | TypeinfoFlags.ACYCLIC | TypeinfoFlags.VALUE_ALIGN_2 | TypeinfoFlags.VALUE_SIGNED | TypeinfoFlags.VALUE_FLOAT);
+test(TypeinfoFlags.ARRAYBUFFERVIEW | TypeinfoFlags.ACYCLIC | TypeinfoFlags.VALUE_ALIGN_3 | TypeinfoFlags.VALUE_SIGNED | TypeinfoFlags.VALUE_FLOAT);
+
class Ref {}
const VALUE_ALIGN_REF = sizeof() == 4 ? TypeinfoFlags.VALUE_ALIGN_2 : TypeinfoFlags.VALUE_ALIGN_3;
diff --git a/tests/compiler/rt/flags.untouched.wat b/tests/compiler/rt/flags.untouched.wat
index 0b944445..94918cd7 100644
--- a/tests/compiler/rt/flags.untouched.wat
+++ b/tests/compiler/rt/flags.untouched.wat
@@ -8,11 +8,11 @@
(data (i32.const 8) "$\00\00\00\01\00\00\00\01\00\00\00$\00\00\00I\00n\00d\00e\00x\00 \00o\00u\00t\00 \00o\00f\00 \00r\00a\00n\00g\00e\00")
(data (i32.const 64) "\14\00\00\00\01\00\00\00\01\00\00\00\14\00\00\00~\00l\00i\00b\00/\00r\00t\00.\00t\00s\00")
(data (i32.const 104) "\16\00\00\00\01\00\00\00\01\00\00\00\16\00\00\00r\00t\00/\00f\00l\00a\00g\00s\00.\00t\00s\00")
- (data (i32.const 144) ":\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\19\02\00\00\02\00\00\00\19\00\00\00\02\00\00\00)\02\00\00\02\00\00\00)\00\00\00\02\00\00\00I\02\00\00\02\00\00\00I\00\00\00\02\00\00\00\89\02\00\00\02\00\00\00\89\00\00\00\02\00\00\00I\06\00\00\02\00\00\00\89\06\00\00\02\00\00\00\t\01\00\00\02\00\00\00\08\00\00\00\00\00\00\00I\10\00\00\02\00\00\00I\18\00\00\02\00\00\00\1a\02\00\00\00\00\00\00\1a\00\00\00\00\00\00\00*\02\00\00\00\00\00\00*\00\00\00\00\00\00\00J\02\00\00\00\00\00\00J\00\00\00\00\00\00\00\8a\02\00\00\00\00\00\00\8a\00\00\00\00\00\00\00J\06\00\00\00\00\00\00\8a\06\00\00\00\00\00\00\n\01\00\00\00\00\00\00J\10\00\00\00\00\00\00J\18\00\00\00\00\00\00\1c\02\02\00\00\00\00\00,\02\05\00\00\00\00\00L\82\04\00\00\00\00\00\8cB\04\00\00\00\00\00\0c!\04\00\00\00\00\00\1c\82 \00\00\00\00\00\1c\820\00\00\00\00\00L0\04\00\00\00\00\00L8\04\00\00\00\00\00L\980\00\00\00\00\00L\82\0c\00\00\00\00\00\08\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00A\10\00\00\02\00\00\00\08\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00B\10\00\00\00\00\00\00\08\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00D\82 \00\00\00\00\00\00\00\00\00\00\00\00\00D\90\04\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00")
+ (data (i32.const 144) "E\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\001\04\00\00\02\00\00\001\00\00\00\02\00\00\001\00\00\00\02\00\00\00Q\04\00\00\02\00\00\00Q\00\00\00\02\00\00\00\91\04\00\00\02\00\00\00\91\00\00\00\02\00\00\00\11\05\00\00\02\00\00\00\11\01\00\00\02\00\00\00\91\0c\00\00\02\00\00\00\11\0d\00\00\02\00\00\002\04\00\00\02\00\00\002\00\00\00\02\00\00\00R\04\00\00\02\00\00\00R\00\00\00\02\00\00\00\92\04\00\00\02\00\00\00\92\00\00\00\02\00\00\00\12\05\00\00\02\00\00\00\12\01\00\00\02\00\00\00\92\0c\00\00\02\00\00\00\12\0d\00\00\02\00\00\00\12\02\00\00\02\00\00\00\10\00\00\00\00\00\00\00\92 \00\00\02\00\00\00\920\00\00\02\00\00\004\04\00\00\00\00\00\004\00\00\00\00\00\00\00T\04\00\00\00\00\00\00T\00\00\00\00\00\00\00\94\04\00\00\00\00\00\00\94\00\00\00\00\00\00\00\14\05\00\00\00\00\00\00\14\01\00\00\00\00\00\00\94\0c\00\00\00\00\00\00\14\0d\00\00\00\00\00\00\14\02\00\00\00\00\00\00\94 \00\00\00\00\00\00\940\00\00\00\00\00\008\04\04\00\00\00\00\00X\04\n\00\00\00\00\00\98\04\t\00\00\00\00\00\18\85\08\00\00\00\00\00\18B\08\00\00\00\00\008\04A\00\00\00\00\008\04a\00\00\00\00\00\98`\08\00\00\00\00\00\98p\08\00\00\00\00\00\980a\00\00\00\00\00\98\04\19\00\00\00\00\00\10\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\82 \00\00\02\00\00\00\10\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\84 \00\00\00\00\00\00\10\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\88\04A\00\00\00\00\00\00\00\00\00\00\00\00\00\88 \t\00\00\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00")
(table $0 1 funcref)
(elem (i32.const 0) $null)
- (global $rt/flags/VALUE_ALIGN_REF i32 (i32.const 64))
- (global $rt/flags/KEY_ALIGN_REF i32 (i32.const 32768))
+ (global $rt/flags/VALUE_ALIGN_REF i32 (i32.const 128))
+ (global $rt/flags/KEY_ALIGN_REF i32 (i32.const 65536))
(global $~lib/rt/RTTI_BASE i32 (i32.const 144))
(export "memory" (memory $0))
(start $start)
@@ -41,7 +41,7 @@
i32.add
i32.load
)
- (func $rt/flags/test<~lib/array/Array> (; 2 ;) (type $FUNCSIG$vi) (param $0 i32)
+ (func $rt/flags/test<~lib/typedarray/Int8Array> (; 2 ;) (type $FUNCSIG$vi) (param $0 i32)
i32.const 4
call $~lib/rt/__typeinfo
local.get $0
@@ -56,7 +56,7 @@
unreachable
end
)
- (func $rt/flags/test<~lib/array/Array> (; 3 ;) (type $FUNCSIG$vi) (param $0 i32)
+ (func $rt/flags/test<~lib/typedarray/Uint8Array> (; 3 ;) (type $FUNCSIG$vi) (param $0 i32)
i32.const 5
call $~lib/rt/__typeinfo
local.get $0
@@ -71,7 +71,7 @@
unreachable
end
)
- (func $rt/flags/test<~lib/array/Array> (; 4 ;) (type $FUNCSIG$vi) (param $0 i32)
+ (func $rt/flags/test<~lib/typedarray/Uint8ClampedArray> (; 4 ;) (type $FUNCSIG$vi) (param $0 i32)
i32.const 6
call $~lib/rt/__typeinfo
local.get $0
@@ -86,7 +86,7 @@
unreachable
end
)
- (func $rt/flags/test<~lib/array/Array> (; 5 ;) (type $FUNCSIG$vi) (param $0 i32)
+ (func $rt/flags/test<~lib/typedarray/Int16Array> (; 5 ;) (type $FUNCSIG$vi) (param $0 i32)
i32.const 7
call $~lib/rt/__typeinfo
local.get $0
@@ -101,7 +101,7 @@
unreachable
end
)
- (func $rt/flags/test<~lib/array/Array> (; 6 ;) (type $FUNCSIG$vi) (param $0 i32)
+ (func $rt/flags/test<~lib/typedarray/Uint16Array> (; 6 ;) (type $FUNCSIG$vi) (param $0 i32)
i32.const 8
call $~lib/rt/__typeinfo
local.get $0
@@ -116,7 +116,7 @@
unreachable
end
)
- (func $rt/flags/test<~lib/array/Array> (; 7 ;) (type $FUNCSIG$vi) (param $0 i32)
+ (func $rt/flags/test<~lib/typedarray/Int32Array> (; 7 ;) (type $FUNCSIG$vi) (param $0 i32)
i32.const 9
call $~lib/rt/__typeinfo
local.get $0
@@ -131,7 +131,7 @@
unreachable
end
)
- (func $rt/flags/test<~lib/array/Array> (; 8 ;) (type $FUNCSIG$vi) (param $0 i32)
+ (func $rt/flags/test<~lib/typedarray/Uint32Array> (; 8 ;) (type $FUNCSIG$vi) (param $0 i32)
i32.const 10
call $~lib/rt/__typeinfo
local.get $0
@@ -146,7 +146,7 @@
unreachable
end
)
- (func $rt/flags/test<~lib/array/Array> (; 9 ;) (type $FUNCSIG$vi) (param $0 i32)
+ (func $rt/flags/test<~lib/typedarray/Int64Array> (; 9 ;) (type $FUNCSIG$vi) (param $0 i32)
i32.const 11
call $~lib/rt/__typeinfo
local.get $0
@@ -161,7 +161,7 @@
unreachable
end
)
- (func $rt/flags/test<~lib/array/Array> (; 10 ;) (type $FUNCSIG$vi) (param $0 i32)
+ (func $rt/flags/test<~lib/typedarray/Uint64Array> (; 10 ;) (type $FUNCSIG$vi) (param $0 i32)
i32.const 12
call $~lib/rt/__typeinfo
local.get $0
@@ -176,7 +176,7 @@
unreachable
end
)
- (func $rt/flags/test<~lib/array/Array> (; 11 ;) (type $FUNCSIG$vi) (param $0 i32)
+ (func $rt/flags/test<~lib/typedarray/Float32Array> (; 11 ;) (type $FUNCSIG$vi) (param $0 i32)
i32.const 13
call $~lib/rt/__typeinfo
local.get $0
@@ -191,7 +191,7 @@
unreachable
end
)
- (func $rt/flags/test<~lib/array/Array> (; 12 ;) (type $FUNCSIG$vi) (param $0 i32)
+ (func $rt/flags/test<~lib/typedarray/Float64Array> (; 12 ;) (type $FUNCSIG$vi) (param $0 i32)
i32.const 14
call $~lib/rt/__typeinfo
local.get $0
@@ -206,7 +206,22 @@
unreachable
end
)
- (func $rt/flags/test<~lib/array/Array