├── .gitignore ├── .npmignore ├── LICENSE.md ├── README.md ├── bench └── index.html ├── package-lock.json ├── package.json ├── src ├── compile.ts ├── index.ts ├── instantiate.ts ├── library.ts ├── optimize.ts ├── parse.ts └── tsconfig.json └── test ├── README.md ├── core ├── address.wast.js ├── align.wast.js ├── binary-leb128.wast.js ├── binary.wast.js ├── block.wast.js ├── br.wast.js ├── br_if.wast.js ├── br_table.wast.js ├── bulk.wast.js ├── call.wast.js ├── call_indirect.wast.js ├── comments.wast.js ├── const.wast.js ├── conversions.wast.js ├── custom.wast.js ├── data.wast.js ├── elem.wast.js ├── endianness.wast.js ├── exports.wast.js ├── extended-const │ ├── data.wast.js │ └── elem.wast.js ├── f32.wast.js ├── f32_bitwise.wast.js ├── f32_cmp.wast.js ├── f64.wast.js ├── f64_bitwise.wast.js ├── f64_cmp.wast.js ├── fac.wast.js ├── float_exprs.wast.js ├── float_literals.wast.js ├── float_memory.wast.js ├── float_misc.wast.js ├── forward.wast.js ├── func.wast.js ├── func_ptrs.wast.js ├── global.wast.js ├── harness │ └── sync_index.js ├── i32.wast.js ├── i64.wast.js ├── if.wast.js ├── imports.wast.js ├── inline-module.wast.js ├── int_exprs.wast.js ├── int_literals.wast.js ├── labels.wast.js ├── left-to-right.wast.js ├── linking.wast.js ├── load.wast.js ├── local_get.wast.js ├── local_set.wast.js ├── local_tee.wast.js ├── loop.wast.js ├── memory.wast.js ├── memory_copy.wast.js ├── memory_fill.wast.js ├── memory_grow.wast.js ├── memory_init.wast.js ├── memory_redundancy.wast.js ├── memory_size.wast.js ├── memory_trap.wast.js ├── multi-memory │ ├── address0.wast.js │ ├── address1.wast.js │ ├── align0.wast.js │ ├── binary0.wast.js │ ├── data0.wast.js │ ├── data1.wast.js │ ├── data_drop0.wast.js │ ├── exports0.wast.js │ ├── float_exprs0.wast.js │ ├── float_exprs1.wast.js │ ├── float_memory0.wast.js │ ├── imports0.wast.js │ ├── imports1.wast.js │ ├── imports2.wast.js │ ├── imports3.wast.js │ ├── imports4.wast.js │ ├── linking0.wast.js │ ├── linking1.wast.js │ ├── linking2.wast.js │ ├── linking3.wast.js │ ├── load0.wast.js │ ├── load1.wast.js │ ├── load2.wast.js │ ├── memory_copy0.wast.js │ ├── memory_copy1.wast.js │ ├── memory_fill0.wast.js │ ├── memory_init0.wast.js │ ├── memory_size0.wast.js │ ├── memory_size1.wast.js │ ├── memory_size2.wast.js │ ├── memory_size3.wast.js │ ├── memory_trap0.wast.js │ ├── memory_trap1.wast.js │ ├── start0.wast.js │ ├── store0.wast.js │ ├── store1.wast.js │ └── traps0.wast.js ├── names.wast.js ├── nop.wast.js ├── obsolete-keywords.wast.js ├── ref_func.wast.js ├── ref_is_null.wast.js ├── ref_null.wast.js ├── return.wast.js ├── select.wast.js ├── skip-stack-guard-page.wast.js ├── stack.wast.js ├── start.wast.js ├── store.wast.js ├── switch.wast.js ├── table-sub.wast.js ├── table.wast.js ├── table_copy.wast.js ├── table_fill.wast.js ├── table_get.wast.js ├── table_grow.wast.js ├── table_init.wast.js ├── table_set.wast.js ├── table_size.wast.js ├── tail-call │ ├── return_call.wast.js │ └── return_call_indirect.wast.js ├── token.wast.js ├── traps.wast.js ├── type.wast.js ├── unreachable.wast.js ├── unreached-invalid.wast.js ├── unreached-valid.wast.js ├── unwind.wast.js ├── utf8-custom-section-id.wast.js ├── utf8-import-field.wast.js ├── utf8-import-module.wast.js └── utf8-invalid-encoding.wast.js └── run.js /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /index.min.js 3 | /index.js 4 | /node_modules/ 5 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | /bench/ 2 | /src/ 3 | /test/ 4 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2024 Evan Wallace 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /bench/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 35 | 36 | 37 | 38 |

Benchmark

39 |

40 | This page does an arbitrary WebAssembly task to measure the performance of this polyfill. 41 | It reloads the page a few times during the benchmark to capture multiple independent runs. 42 | Use it to compare the performance of the polyfill in different browsers and with different optimizations enabled. 43 | Note that this benchmark requires internet access to download the sample WebAssembly module. 44 |

45 |
46 |

Use npm run bench to serve this page if you want to run this benchmark.

47 |
48 |

49 | 214 | 215 | 216 | 217 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "polywasm", 3 | "version": "0.2.0", 4 | "type": "module", 5 | "main": "./index.js", 6 | "license": "MIT", 7 | "homepage": "https://github.com/evanw/polywasm", 8 | "repository": { 9 | "type": "git", 10 | "url": "git+https://github.com/evanw/polywasm.git" 11 | }, 12 | "scripts": { 13 | "build": "esbuild --bundle --target=es2020 src/index.ts \"--mangle-props=_$\" --minify --outfile=index.min.js --format=esm && esbuild --bundle --target=es2020 src/index.ts --outfile=index.js \"--mangle-props=_$\" --format=esm", 14 | "bench": "esbuild --bundle --target=es2020 src/index.ts \"--mangle-props=_$\" --minify --outfile=bench/polywasm.min.js --servedir=bench --global-name=polywasm", 15 | "check": "tsc -noEmit -p src", 16 | "test": "node test/run.js" 17 | }, 18 | "devDependencies": { 19 | "esbuild": "0.24.0", 20 | "typescript": "5.6.2" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | import { Global, Instance, Memory, Table } from './instantiate' 2 | import { Module, CompileError } from './parse' 3 | 4 | const compile = async (input: BufferSource): Promise => { 5 | return new Module(input) 6 | } 7 | 8 | const compileStreaming = async (source: Response | PromiseLike): Promise => { 9 | return new Module(await (await source).arrayBuffer()) 10 | } 11 | 12 | const instantiate = async (input: BufferSource | Module, importObject?: WebAssembly.Imports): Promise => { 13 | if (input instanceof Module) return new Instance(input, importObject) 14 | const module = new Module(input) 15 | return { module, instance: new Instance(module, importObject) } 16 | } 17 | 18 | const instantiateStreaming = async (source: Response | PromiseLike, importObject?: WebAssembly.Imports): Promise => { 19 | const module = new Module(await (await source).arrayBuffer()) 20 | return { module, instance: new Instance(module, importObject) } 21 | } 22 | 23 | const validate = (input: any): boolean => { 24 | if (!ArrayBuffer.isView(input) && !(input instanceof ArrayBuffer)) { 25 | throw TypeError('Invalid buffer source') 26 | } 27 | try { 28 | new Module(input) 29 | return true 30 | } catch { 31 | return false 32 | } 33 | } 34 | 35 | const wasmAPI: Partial = { 36 | Global, 37 | Instance, 38 | compile, 39 | compileStreaming, 40 | instantiate, 41 | instantiateStreaming, 42 | validate, 43 | Memory, 44 | Module, 45 | Table, 46 | 47 | // This cast ignores the lack of a call signature without "new", which we don't support 48 | CompileError: CompileError as typeof WebAssembly.CompileError, 49 | } 50 | 51 | export { wasmAPI as WebAssembly } 52 | -------------------------------------------------------------------------------- /src/library.ts: -------------------------------------------------------------------------------- 1 | import { castToJS, castToWASM } from './compile' 2 | import { InternalTable, LazyFunc } from './instantiate' 3 | 4 | const buffer = new ArrayBuffer(8) 5 | const f32 = new Float32Array(buffer) 6 | const f64 = new Float64Array(buffer) 7 | const i32 = new Int32Array(buffer) 8 | const i64 = new BigInt64Array(buffer) 9 | const u64 = new BigUint64Array(buffer) 10 | const exportedFuncs = new WeakMap() 11 | const emptyArray: never[] = [] 12 | 13 | class Trampoline { 14 | declare fn_: Function | null 15 | declare args_: any[] 16 | } 17 | 18 | export const library = { 19 | copysign_(x: number, y: number): number { 20 | return (x < 0 || (x === 0 && Object.is(x, -0))) !== (y < 0 || (y === 0 && Object.is(y, -0))) ? -x : x 21 | }, 22 | u64_to_s64_(x: bigint): bigint { 23 | u64[0] = x 24 | return i64[0] 25 | }, 26 | i32_reinterpret_f32_(x: number): number { 27 | f32[0] = x 28 | return i32[0] 29 | }, 30 | f32_reinterpret_i32_(x: number): number { 31 | i32[0] = x 32 | return f32[0] 33 | }, 34 | i64_reinterpret_f64_(x: number): bigint { 35 | f64[0] = x 36 | return u64[0] 37 | }, 38 | f64_reinterpret_i64_(x: bigint): number { 39 | u64[0] = x 40 | return f64[0] 41 | }, 42 | i32_rotl_(x: number, y: number) { 43 | return x << y | x >>> 32 - y 44 | }, 45 | i32_rotr_(x: number, y: number) { 46 | return x >>> y | x << 32 - y 47 | }, 48 | i64_rotl_(x: bigint, y: bigint) { 49 | // Note: "y" is already "y & 63n" from the caller 50 | return (x << y | x >> 64n - y) & 0xFFFF_FFFF_FFFF_FFFFn 51 | }, 52 | i64_rotr_(x: bigint, y: bigint) { 53 | // Note: "y" is already "y & 63n" from the caller 54 | return (x >> y | x << 64n - y) & 0xFFFF_FFFF_FFFF_FFFFn 55 | }, 56 | i32_ctz_(x: number): number { 57 | return x ? Math.clz32(x & -x) ^ 31 : 32 58 | }, 59 | i32_popcnt_(x: number): number { 60 | let count = 0 61 | while (x) { 62 | count++ 63 | x &= x - 1 64 | } 65 | return count 66 | }, 67 | i64_clz_(x: bigint): bigint { 68 | let count = Math.clz32(Number((x >> 32n) & 0xFFFF_FFFFn)) 69 | if (count === 32) count += Math.clz32(Number(x & 0xFFFF_FFFFn)) 70 | return BigInt(count) 71 | }, 72 | i64_ctz_(x: bigint): bigint { 73 | let y = Number(x & 0xFFFF_FFFFn) 74 | if (y) return BigInt(Math.clz32(y & -y) ^ 31) 75 | y = Number((x >> 32n) & 0xFFFF_FFFFn) 76 | return y ? BigInt(32 + Math.clz32(y & -y) ^ 31) : 64n 77 | }, 78 | i64_popcnt_(x: bigint): bigint { 79 | let count = 0n 80 | while (x) { 81 | count++ 82 | x &= x - 1n 83 | } 84 | return count 85 | }, 86 | i32_trunc_sat_s_(x: number): number { 87 | x = Math.trunc(x) 88 | return x >= 0x7FFF_FFFF ? 0x7FFF_FFFF : 89 | x <= -0x8000_0000 ? -0x8000_0000 : 90 | x | 0 91 | }, 92 | i32_trunc_sat_u_(x: number): number { 93 | x = Math.trunc(x) 94 | return x >= 0xFFFF_FFFF ? -1 : 95 | x <= 0 ? 0 : 96 | x | 0 97 | }, 98 | i64_trunc_sat_s_(x: number): bigint { 99 | x = Math.trunc(x) 100 | return x >= 0x7FFF_FFFF_FFFF_FFFF ? 0x7FFF_FFFF_FFFF_FFFFn : 101 | x <= -0x8000_0000_0000_0000 ? 0x8000_0000_0000_0000n : 102 | x === x ? 103 | BigInt(x) & 0xFFFF_FFFF_FFFF_FFFFn : 104 | 0n // NaN must become 0 105 | }, 106 | i64_trunc_sat_u_(x: number): bigint { 107 | x = Math.trunc(x) 108 | return x >= 0xFFFF_FFFF_FFFF_FFFF ? 0xFFFF_FFFF_FFFF_FFFFn : 109 | !(x > 0) ? 0n : // NaN must become 0 110 | BigInt(x) 111 | }, 112 | i64_extend8_s_(x: bigint): bigint { 113 | return x & 0x80n ? x | 0xFFFF_FFFF_FFFF_FF00n : x & 0xFFn 114 | }, 115 | i64_extend16_s_(x: bigint): bigint { 116 | return x & 0x8000n ? x | 0xFFFF_FFFF_FFFF_0000n : x & 0xFFFFn 117 | }, 118 | i64_extend32_s_(x: bigint): bigint { 119 | return x & 0x8000_0000n ? x | 0xFFFF_FFFF_0000_0000n : x & 0xFFFF_FFFFn 120 | }, 121 | memory_init_or_copy_(source: Uint8Array, destination: Uint8Array, target: number, start: number, count: number): void { 122 | if (source === destination) { 123 | destination.copyWithin(target, start, start + count) 124 | } else { 125 | destination.set(source.subarray(start, start + count), target) 126 | } 127 | }, 128 | table_init_or_copy_(x: InternalTable, y: (LazyFunc | null)[], d: number, s: number, n: number): void { 129 | d >>>= 0 130 | s >>>= 0 131 | n >>>= 0 132 | if (s + n > y.length || d + n > x.length) throw RangeError() 133 | if (d <= s) { 134 | for (let j = 0; j < n; j++) x[d + j] = y[s + j] 135 | } else { 136 | for (let j = n - 1; j >= 0; j--) x[d + j] = y[s + j] 137 | } 138 | }, 139 | table_grow_(x: InternalTable, val: LazyFunc | null, n: number): number { 140 | const sz = x.length 141 | n >>>= 0 142 | if (sz + n > x.limit_) return -1 143 | for (let i = 0; i < n; i++) x.push(val) 144 | return sz 145 | }, 146 | table_fill_(x: InternalTable, i: number, val: LazyFunc | null, n: number): void { 147 | i >>>= 0 148 | n >>>= 0 149 | if (i + n > x.length) throw RangeError() 150 | for (let j = 0; j < n; j++) x[i + j] = val 151 | }, 152 | return_call_(context: Trampoline, fn: Function, args: any[]): any { 153 | if (context instanceof Trampoline) { 154 | context.fn_ = fn 155 | context.args_ = args 156 | return emptyArray // Don't crash when destructuring multiple return values 157 | } 158 | 159 | // Technically this isn't a true tail call because the first call frame in a 160 | // chain of successive nested tail calls isn't collapsed, but it should help 161 | // to avoid stack overflow in common tail call usage, even with two or more 162 | // mutually tail-recursive functions. 163 | context = new Trampoline 164 | let result: any 165 | while ((result = fn.apply(context, args)), context.fn_) { 166 | fn = context.fn_ 167 | args = context.args_ 168 | context.fn_ = null 169 | } 170 | return result 171 | }, 172 | importLazyFunc_(fn: Function | null): LazyFunc | null { 173 | if (fn === null) return fn 174 | const obj = exportedFuncs.get(fn) 175 | if (obj) return obj 176 | throw Error('Unexpected foreign function object') 177 | }, 178 | exportLazyFunc_(obj: LazyFunc | null): Function | null { 179 | if (obj === null) return null 180 | if (!obj.exported_) { 181 | const [argTypes, returnTypes] = obj.type_ 182 | const argNames: string[] = [] 183 | const argExprs: string[] = [] 184 | for (let i = 0; i < argTypes.length; i++) { 185 | argNames.push('a' + i) 186 | argExprs.push(castToWASM('a' + i, argTypes[i])) 187 | } 188 | let result = `f.${/* @__KEY__ */ 'compiled_'}(${argExprs})` 189 | if (returnTypes.length === 1) { 190 | result = 'return ' + castToJS(result, returnTypes[0]) 191 | } else if (returnTypes.length > 1) { 192 | result = `let r=${result};` 193 | for (let i = 0; i < returnTypes.length; i++) result += `r[${i}]=${castToJS(`r[${i}]`, returnTypes[i])};` 194 | result += 'return r' 195 | } 196 | exportedFuncs.set(obj.exported_ = new Function('f', 'l', `return(${argNames})=>{${result}}`)(obj, this), obj) 197 | } 198 | return obj.exported_ 199 | }, 200 | } 201 | -------------------------------------------------------------------------------- /src/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ESNext", 4 | "module": "ESNext", 5 | "strict": true 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/README.md: -------------------------------------------------------------------------------- 1 | These tests were exported from various places, each by running `python build.py` in the `test` subdirectory: 2 | 3 | * `core` is from https://github.com/WebAssembly/spec/tree/15eb918814c0341da9c41501f3ea5d33c1e79b6f/test/core 4 | * `core/extended-const` is from https://github.com/WebAssembly/extended-const/tree/14f86b93f74ec908f9b7ba9865da3fae905c1d9e/test/core 5 | * `core/multi-memory` is from https://github.com/WebAssembly/multi-memory/tree/cf8b5aa27257311b8eac80ae83f4ba22ee308064/test/core/multi-memory 6 | * `core/tail-call` is from https://github.com/WebAssembly/tail-call/tree/6f44ca27af411a0f6bc4e07520807d7adfc0de88/test/core/multi-memory 7 | -------------------------------------------------------------------------------- /test/core/comments.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // comments.wast:9 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00"); 4 | 5 | // comments.wast:56 6 | let $2 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00"); 7 | 8 | // comments.wast:67 9 | let $3 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00"); 10 | 11 | // comments.wast:76 12 | let $4 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00"); 13 | 14 | // comments.wast:83 15 | let $5 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x85\x80\x80\x80\x00\x01\x60\x00\x01\x7f\x03\x84\x80\x80\x80\x00\x03\x00\x00\x00\x07\x90\x80\x80\x80\x00\x03\x02\x66\x31\x00\x00\x02\x66\x32\x00\x01\x02\x66\x33\x00\x02\x0a\xa5\x80\x80\x80\x00\x03\x87\x80\x80\x80\x00\x00\x41\x01\x41\x02\x0f\x0b\x87\x80\x80\x80\x00\x00\x41\x01\x41\x02\x0f\x0b\x87\x80\x80\x80\x00\x00\x41\x01\x41\x02\x0f\x0b"); 16 | 17 | // comments.wast:104 18 | assert_return(() => call($5, "f1", []), 2); 19 | 20 | // comments.wast:105 21 | assert_return(() => call($5, "f2", []), 2); 22 | 23 | // comments.wast:106 24 | assert_return(() => call($5, "f3", []), 2); 25 | -------------------------------------------------------------------------------- /test/core/custom.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // custom.wast:1 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x00\x24\x10\x61\x20\x63\x75\x73\x74\x6f\x6d\x20\x73\x65\x63\x74\x69\x6f\x6e\x74\x68\x69\x73\x20\x69\x73\x20\x74\x68\x65\x20\x70\x61\x79\x6c\x6f\x61\x64\x00\x20\x10\x61\x20\x63\x75\x73\x74\x6f\x6d\x20\x73\x65\x63\x74\x69\x6f\x6e\x74\x68\x69\x73\x20\x69\x73\x20\x70\x61\x79\x6c\x6f\x61\x64\x00\x11\x10\x61\x20\x63\x75\x73\x74\x6f\x6d\x20\x73\x65\x63\x74\x69\x6f\x6e\x00\x10\x00\x74\x68\x69\x73\x20\x69\x73\x20\x70\x61\x79\x6c\x6f\x61\x64\x00\x01\x00\x00\x24\x10\x00\x00\x63\x75\x73\x74\x6f\x6d\x20\x73\x65\x63\x74\x69\x6f\x00\x74\x68\x69\x73\x20\x69\x73\x20\x74\x68\x65\x20\x70\x61\x79\x6c\x6f\x61\x64\x00\x24\x10\xef\xbb\xbf\x61\x20\x63\x75\x73\x74\x6f\x6d\x20\x73\x65\x63\x74\x74\x68\x69\x73\x20\x69\x73\x20\x74\x68\x65\x20\x70\x61\x79\x6c\x6f\x61\x64\x00\x24\x10\x61\x20\x63\x75\x73\x74\x6f\x6d\x20\x73\x65\x63\x74\xe2\x8c\xa3\x74\x68\x69\x73\x20\x69\x73\x20\x74\x68\x65\x20\x70\x61\x79\x6c\x6f\x61\x64\x00\x1f\x16\x6d\x6f\x64\x75\x6c\x65\x20\x77\x69\x74\x68\x69\x6e\x20\x61\x20\x6d\x6f\x64\x75\x6c\x65\x00\x61\x73\x6d\x01\x00\x00\x00"); 4 | 5 | // custom.wast:14 6 | let $2 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x00\x0e\x06\x63\x75\x73\x74\x6f\x6d\x70\x61\x79\x6c\x6f\x61\x64\x00\x0e\x06\x63\x75\x73\x74\x6f\x6d\x70\x61\x79\x6c\x6f\x61\x64\x01\x01\x00\x00\x0e\x06\x63\x75\x73\x74\x6f\x6d\x70\x61\x79\x6c\x6f\x61\x64\x00\x0e\x06\x63\x75\x73\x74\x6f\x6d\x70\x61\x79\x6c\x6f\x61\x64\x02\x01\x00\x00\x0e\x06\x63\x75\x73\x74\x6f\x6d\x70\x61\x79\x6c\x6f\x61\x64\x00\x0e\x06\x63\x75\x73\x74\x6f\x6d\x70\x61\x79\x6c\x6f\x61\x64\x03\x01\x00\x00\x0e\x06\x63\x75\x73\x74\x6f\x6d\x70\x61\x79\x6c\x6f\x61\x64\x00\x0e\x06\x63\x75\x73\x74\x6f\x6d\x70\x61\x79\x6c\x6f\x61\x64\x04\x01\x00\x00\x0e\x06\x63\x75\x73\x74\x6f\x6d\x70\x61\x79\x6c\x6f\x61\x64\x00\x0e\x06\x63\x75\x73\x74\x6f\x6d\x70\x61\x79\x6c\x6f\x61\x64\x05\x01\x00\x00\x0e\x06\x63\x75\x73\x74\x6f\x6d\x70\x61\x79\x6c\x6f\x61\x64\x00\x0e\x06\x63\x75\x73\x74\x6f\x6d\x70\x61\x79\x6c\x6f\x61\x64\x06\x01\x00\x00\x0e\x06\x63\x75\x73\x74\x6f\x6d\x70\x61\x79\x6c\x6f\x61\x64\x00\x0e\x06\x63\x75\x73\x74\x6f\x6d\x70\x61\x79\x6c\x6f\x61\x64\x07\x01\x00\x00\x0e\x06\x63\x75\x73\x74\x6f\x6d\x70\x61\x79\x6c\x6f\x61\x64\x00\x0e\x06\x63\x75\x73\x74\x6f\x6d\x70\x61\x79\x6c\x6f\x61\x64\x09\x01\x00\x00\x0e\x06\x63\x75\x73\x74\x6f\x6d\x70\x61\x79\x6c\x6f\x61\x64\x00\x0e\x06\x63\x75\x73\x74\x6f\x6d\x70\x61\x79\x6c\x6f\x61\x64\x0a\x01\x00\x00\x0e\x06\x63\x75\x73\x74\x6f\x6d\x70\x61\x79\x6c\x6f\x61\x64\x00\x0e\x06\x63\x75\x73\x74\x6f\x6d\x70\x61\x79\x6c\x6f\x61\x64\x0b\x01\x00\x00\x0e\x06\x63\x75\x73\x74\x6f\x6d\x70\x61\x79\x6c\x6f\x61\x64\x00\x0e\x06\x63\x75\x73\x74\x6f\x6d\x70\x61\x79\x6c\x6f\x61\x64"); 7 | 8 | // custom.wast:50 9 | let $3 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x07\x01\x60\x02\x7f\x7f\x01\x7f\x00\x1a\x06\x63\x75\x73\x74\x6f\x6d\x74\x68\x69\x73\x20\x69\x73\x20\x74\x68\x65\x20\x70\x61\x79\x6c\x6f\x61\x64\x03\x02\x01\x00\x07\x0a\x01\x06\x61\x64\x64\x54\x77\x6f\x00\x00\x0a\x09\x01\x07\x00\x20\x00\x20\x01\x6a\x0b\x00\x1b\x07\x63\x75\x73\x74\x6f\x6d\x32\x74\x68\x69\x73\x20\x69\x73\x20\x74\x68\x65\x20\x70\x61\x79\x6c\x6f\x61\x64"); 10 | 11 | // custom.wast:60 12 | assert_malformed("\x00\x61\x73\x6d\x01\x00\x00\x00\x00"); 13 | 14 | // custom.wast:68 15 | assert_malformed("\x00\x61\x73\x6d\x01\x00\x00\x00\x00\x00"); 16 | 17 | // custom.wast:76 18 | assert_malformed("\x00\x61\x73\x6d\x01\x00\x00\x00\x00\x00\x00\x05\x01\x00\x07\x00\x00"); 19 | 20 | // custom.wast:84 21 | assert_malformed("\x00\x61\x73\x6d\x01\x00\x00\x00\x00\x26\x10\x61\x20\x63\x75\x73\x74\x6f\x6d\x20\x73\x65\x63\x74\x69\x6f\x6e\x74\x68\x69\x73\x20\x69\x73\x20\x74\x68\x65\x20\x70\x61\x79\x6c\x6f\x61\x64"); 22 | 23 | // custom.wast:92 24 | assert_malformed("\x00\x61\x73\x6d\x01\x00\x00\x00\x00\x25\x10\x61\x20\x63\x75\x73\x74\x6f\x6d\x20\x73\x65\x63\x74\x69\x6f\x6e\x74\x68\x69\x73\x20\x69\x73\x20\x74\x68\x65\x20\x70\x61\x79\x6c\x6f\x61\x64\x00\x24\x10\x61\x20\x63\x75\x73\x74\x6f\x6d\x20\x73\x65\x63\x74\x69\x6f\x6e\x74\x68\x69\x73\x20\x69\x73\x20\x74\x68\x65\x20\x70\x61\x79\x6c\x6f\x61\x64"); 25 | 26 | // custom.wast:101 27 | assert_malformed("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x07\x01\x60\x02\x7f\x7f\x01\x7f\x00\x25\x10\x61\x20\x63\x75\x73\x74\x6f\x6d\x20\x73\x65\x63\x74\x69\x6f\x6e\x74\x68\x69\x73\x20\x69\x73\x20\x74\x68\x65\x20\x70\x61\x79\x6c\x6f\x61\x64\x03\x02\x01\x00\x0a\x09\x01\x07\x00\x20\x00\x20\x01\x6a\x0b\x00\x1b\x07\x63\x75\x73\x74\x6f\x6d\x32\x74\x68\x69\x73\x20\x69\x73\x20\x74\x68\x65\x20\x70\x61\x79\x6c\x6f\x61\x64"); 28 | 29 | // custom.wast:114 30 | assert_malformed("\x00\x61\x73\x6d\x01\x00\x00\x00\x00\x61\x73\x6d\x01\x00\x00\x00"); 31 | 32 | // custom.wast:122 33 | assert_malformed("\x00\x61\x73\x6d\x01\x00\x00\x00\x05\x03\x01\x00\x01\x0c\x01\x02\x0b\x06\x01\x00\x41\x00\x0b\x00"); 34 | -------------------------------------------------------------------------------- /test/core/fac.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // fac.wast:1 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x9a\x80\x80\x80\x00\x04\x60\x01\x7e\x01\x7e\x60\x01\x7e\x02\x7e\x7e\x60\x02\x7e\x7e\x03\x7e\x7e\x7e\x60\x02\x7e\x7e\x01\x7e\x03\x89\x80\x80\x80\x00\x08\x00\x00\x00\x00\x00\x01\x02\x00\x07\xcb\x80\x80\x80\x00\x06\x07\x66\x61\x63\x2d\x72\x65\x63\x00\x00\x0d\x66\x61\x63\x2d\x72\x65\x63\x2d\x6e\x61\x6d\x65\x64\x00\x01\x08\x66\x61\x63\x2d\x69\x74\x65\x72\x00\x02\x0e\x66\x61\x63\x2d\x69\x74\x65\x72\x2d\x6e\x61\x6d\x65\x64\x00\x03\x07\x66\x61\x63\x2d\x6f\x70\x74\x00\x04\x07\x66\x61\x63\x2d\x73\x73\x61\x00\x07\x0a\x8b\x82\x80\x80\x00\x08\x97\x80\x80\x80\x00\x00\x20\x00\x42\x00\x51\x04\x7e\x42\x01\x05\x20\x00\x20\x00\x42\x01\x7d\x10\x00\x7e\x0b\x0b\x97\x80\x80\x80\x00\x00\x20\x00\x42\x00\x51\x04\x7e\x42\x01\x05\x20\x00\x20\x00\x42\x01\x7d\x10\x01\x7e\x0b\x0b\xaf\x80\x80\x80\x00\x01\x02\x7e\x20\x00\x21\x01\x42\x01\x21\x02\x02\x40\x03\x40\x20\x01\x42\x00\x51\x04\x40\x0c\x02\x05\x20\x01\x20\x02\x7e\x21\x02\x20\x01\x42\x01\x7d\x21\x01\x0b\x0c\x00\x0b\x0b\x20\x02\x0b\xaf\x80\x80\x80\x00\x01\x02\x7e\x20\x00\x21\x01\x42\x01\x21\x02\x02\x40\x03\x40\x20\x01\x42\x00\x51\x04\x40\x0c\x02\x05\x20\x01\x20\x02\x7e\x21\x02\x20\x01\x42\x01\x7d\x21\x01\x0b\x0c\x00\x0b\x0b\x20\x02\x0b\xac\x80\x80\x80\x00\x01\x01\x7e\x42\x01\x21\x01\x02\x40\x20\x00\x42\x02\x53\x0d\x00\x03\x40\x20\x01\x20\x00\x7e\x21\x01\x20\x00\x42\x7f\x7c\x21\x00\x20\x00\x42\x01\x55\x0d\x00\x0b\x0b\x20\x01\x0b\x86\x80\x80\x80\x00\x00\x20\x00\x20\x00\x0b\x88\x80\x80\x80\x00\x00\x20\x00\x20\x01\x20\x00\x0b\x9c\x80\x80\x80\x00\x00\x42\x01\x20\x00\x03\x03\x10\x06\x10\x06\x7e\x10\x06\x42\x01\x7d\x10\x05\x42\x00\x56\x0d\x00\x1a\x0f\x0b\x0b"); 4 | 5 | // fac.wast:102 6 | run(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\xa4\x80\x80\x80\x00\x07\x60\x00\x00\x60\x01\x7f\x01\x6f\x60\x01\x6f\x01\x7f\x60\x01\x70\x01\x7f\x60\x02\x6f\x6f\x01\x7f\x60\x02\x70\x70\x01\x7f\x60\x01\x7e\x01\x7e\x02\x83\x81\x80\x80\x00\x06\x06\x6d\x6f\x64\x75\x6c\x65\x07\x66\x61\x63\x2d\x72\x65\x63\x00\x06\x08\x73\x70\x65\x63\x74\x65\x73\x74\x09\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x69\x73\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x02\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x69\x73\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x03\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x65\x71\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x04\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x65\x71\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x05\x03\x82\x80\x80\x80\x00\x01\x00\x07\x87\x80\x80\x80\x00\x01\x03\x72\x75\x6e\x00\x06\x0a\xa2\x80\x80\x80\x00\x01\x9c\x80\x80\x80\x00\x00\x02\x40\x42\x19\x10\x00\x01\x42\x80\x80\x80\xde\x87\x92\xec\xcf\xe1\x00\x01\x51\x45\x0d\x00\x0f\x0b\x00\x0b", exports($1)), "run", [])); // assert_return(() => call($1, "fac-rec", [int64("25")]), int64("7_034_535_277_573_963_776")) 7 | 8 | // fac.wast:103 9 | run(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\xa4\x80\x80\x80\x00\x07\x60\x00\x00\x60\x01\x7f\x01\x6f\x60\x01\x6f\x01\x7f\x60\x01\x70\x01\x7f\x60\x02\x6f\x6f\x01\x7f\x60\x02\x70\x70\x01\x7f\x60\x01\x7e\x01\x7e\x02\x84\x81\x80\x80\x00\x06\x06\x6d\x6f\x64\x75\x6c\x65\x08\x66\x61\x63\x2d\x69\x74\x65\x72\x00\x06\x08\x73\x70\x65\x63\x74\x65\x73\x74\x09\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x69\x73\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x02\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x69\x73\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x03\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x65\x71\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x04\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x65\x71\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x05\x03\x82\x80\x80\x80\x00\x01\x00\x07\x87\x80\x80\x80\x00\x01\x03\x72\x75\x6e\x00\x06\x0a\xa2\x80\x80\x80\x00\x01\x9c\x80\x80\x80\x00\x00\x02\x40\x42\x19\x10\x00\x01\x42\x80\x80\x80\xde\x87\x92\xec\xcf\xe1\x00\x01\x51\x45\x0d\x00\x0f\x0b\x00\x0b", exports($1)), "run", [])); // assert_return(() => call($1, "fac-iter", [int64("25")]), int64("7_034_535_277_573_963_776")) 10 | 11 | // fac.wast:104 12 | run(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\xa4\x80\x80\x80\x00\x07\x60\x00\x00\x60\x01\x7f\x01\x6f\x60\x01\x6f\x01\x7f\x60\x01\x70\x01\x7f\x60\x02\x6f\x6f\x01\x7f\x60\x02\x70\x70\x01\x7f\x60\x01\x7e\x01\x7e\x02\x89\x81\x80\x80\x00\x06\x06\x6d\x6f\x64\x75\x6c\x65\x0d\x66\x61\x63\x2d\x72\x65\x63\x2d\x6e\x61\x6d\x65\x64\x00\x06\x08\x73\x70\x65\x63\x74\x65\x73\x74\x09\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x69\x73\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x02\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x69\x73\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x03\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x65\x71\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x04\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x65\x71\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x05\x03\x82\x80\x80\x80\x00\x01\x00\x07\x87\x80\x80\x80\x00\x01\x03\x72\x75\x6e\x00\x06\x0a\xa2\x80\x80\x80\x00\x01\x9c\x80\x80\x80\x00\x00\x02\x40\x42\x19\x10\x00\x01\x42\x80\x80\x80\xde\x87\x92\xec\xcf\xe1\x00\x01\x51\x45\x0d\x00\x0f\x0b\x00\x0b", exports($1)), "run", [])); // assert_return(() => call($1, "fac-rec-named", [int64("25")]), int64("7_034_535_277_573_963_776")) 13 | 14 | // fac.wast:105 15 | run(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\xa4\x80\x80\x80\x00\x07\x60\x00\x00\x60\x01\x7f\x01\x6f\x60\x01\x6f\x01\x7f\x60\x01\x70\x01\x7f\x60\x02\x6f\x6f\x01\x7f\x60\x02\x70\x70\x01\x7f\x60\x01\x7e\x01\x7e\x02\x8a\x81\x80\x80\x00\x06\x06\x6d\x6f\x64\x75\x6c\x65\x0e\x66\x61\x63\x2d\x69\x74\x65\x72\x2d\x6e\x61\x6d\x65\x64\x00\x06\x08\x73\x70\x65\x63\x74\x65\x73\x74\x09\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x69\x73\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x02\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x69\x73\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x03\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x65\x71\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x04\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x65\x71\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x05\x03\x82\x80\x80\x80\x00\x01\x00\x07\x87\x80\x80\x80\x00\x01\x03\x72\x75\x6e\x00\x06\x0a\xa2\x80\x80\x80\x00\x01\x9c\x80\x80\x80\x00\x00\x02\x40\x42\x19\x10\x00\x01\x42\x80\x80\x80\xde\x87\x92\xec\xcf\xe1\x00\x01\x51\x45\x0d\x00\x0f\x0b\x00\x0b", exports($1)), "run", [])); // assert_return(() => call($1, "fac-iter-named", [int64("25")]), int64("7_034_535_277_573_963_776")) 16 | 17 | // fac.wast:106 18 | run(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\xa4\x80\x80\x80\x00\x07\x60\x00\x00\x60\x01\x7f\x01\x6f\x60\x01\x6f\x01\x7f\x60\x01\x70\x01\x7f\x60\x02\x6f\x6f\x01\x7f\x60\x02\x70\x70\x01\x7f\x60\x01\x7e\x01\x7e\x02\x83\x81\x80\x80\x00\x06\x06\x6d\x6f\x64\x75\x6c\x65\x07\x66\x61\x63\x2d\x6f\x70\x74\x00\x06\x08\x73\x70\x65\x63\x74\x65\x73\x74\x09\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x69\x73\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x02\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x69\x73\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x03\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x65\x71\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x04\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x65\x71\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x05\x03\x82\x80\x80\x80\x00\x01\x00\x07\x87\x80\x80\x80\x00\x01\x03\x72\x75\x6e\x00\x06\x0a\xa2\x80\x80\x80\x00\x01\x9c\x80\x80\x80\x00\x00\x02\x40\x42\x19\x10\x00\x01\x42\x80\x80\x80\xde\x87\x92\xec\xcf\xe1\x00\x01\x51\x45\x0d\x00\x0f\x0b\x00\x0b", exports($1)), "run", [])); // assert_return(() => call($1, "fac-opt", [int64("25")]), int64("7_034_535_277_573_963_776")) 19 | 20 | // fac.wast:107 21 | run(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\xa4\x80\x80\x80\x00\x07\x60\x00\x00\x60\x01\x7f\x01\x6f\x60\x01\x6f\x01\x7f\x60\x01\x70\x01\x7f\x60\x02\x6f\x6f\x01\x7f\x60\x02\x70\x70\x01\x7f\x60\x01\x7e\x01\x7e\x02\x83\x81\x80\x80\x00\x06\x06\x6d\x6f\x64\x75\x6c\x65\x07\x66\x61\x63\x2d\x73\x73\x61\x00\x06\x08\x73\x70\x65\x63\x74\x65\x73\x74\x09\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x69\x73\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x02\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x69\x73\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x03\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x65\x71\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x04\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x65\x71\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x05\x03\x82\x80\x80\x80\x00\x01\x00\x07\x87\x80\x80\x80\x00\x01\x03\x72\x75\x6e\x00\x06\x0a\xa2\x80\x80\x80\x00\x01\x9c\x80\x80\x80\x00\x00\x02\x40\x42\x19\x10\x00\x01\x42\x80\x80\x80\xde\x87\x92\xec\xcf\xe1\x00\x01\x51\x45\x0d\x00\x0f\x0b\x00\x0b", exports($1)), "run", [])); // assert_return(() => call($1, "fac-ssa", [int64("25")]), int64("7_034_535_277_573_963_776")) 22 | 23 | // fac.wast:109 24 | assert_exhaustion(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\xa4\x80\x80\x80\x00\x07\x60\x00\x00\x60\x01\x7f\x01\x6f\x60\x01\x6f\x01\x7f\x60\x01\x70\x01\x7f\x60\x02\x6f\x6f\x01\x7f\x60\x02\x70\x70\x01\x7f\x60\x01\x7e\x01\x7e\x02\x83\x81\x80\x80\x00\x06\x06\x6d\x6f\x64\x75\x6c\x65\x07\x66\x61\x63\x2d\x72\x65\x63\x00\x06\x08\x73\x70\x65\x63\x74\x65\x73\x74\x09\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x69\x73\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x02\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x69\x73\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x03\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x65\x71\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x04\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x65\x71\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x05\x03\x82\x80\x80\x80\x00\x01\x00\x07\x87\x80\x80\x80\x00\x01\x03\x72\x75\x6e\x00\x06\x0a\x95\x80\x80\x80\x00\x01\x8f\x80\x80\x80\x00\x00\x02\x40\x42\x80\x80\x80\x80\x04\x10\x00\x0f\x0b\x00\x0b", exports($1)), "run", [])); // assert_exhaustion(() => call($1, "fac-rec", [int64("1_073_741_824")])) 25 | -------------------------------------------------------------------------------- /test/core/forward.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // forward.wast:1 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x86\x80\x80\x80\x00\x01\x60\x01\x7f\x01\x7f\x03\x83\x80\x80\x80\x00\x02\x00\x00\x07\x8e\x80\x80\x80\x00\x02\x04\x65\x76\x65\x6e\x00\x00\x03\x6f\x64\x64\x00\x01\x0a\xb3\x80\x80\x80\x00\x02\x94\x80\x80\x80\x00\x00\x20\x00\x41\x00\x46\x04\x7f\x41\x01\x05\x20\x00\x41\x01\x6b\x10\x01\x0b\x0b\x94\x80\x80\x80\x00\x00\x20\x00\x41\x00\x46\x04\x7f\x41\x00\x05\x20\x00\x41\x01\x6b\x10\x00\x0b\x0b"); 4 | 5 | // forward.wast:17 6 | assert_return(() => call($1, "even", [13]), 0); 7 | 8 | // forward.wast:18 9 | assert_return(() => call($1, "even", [20]), 1); 10 | 11 | // forward.wast:19 12 | assert_return(() => call($1, "odd", [13]), 1); 13 | 14 | // forward.wast:20 15 | assert_return(() => call($1, "odd", [20]), 0); 16 | -------------------------------------------------------------------------------- /test/core/func_ptrs.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // func_ptrs.wast:1 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x9b\x80\x80\x80\x00\x07\x60\x00\x00\x60\x00\x00\x60\x00\x00\x60\x00\x01\x7f\x60\x00\x01\x7f\x60\x01\x7f\x01\x7f\x60\x01\x7f\x00\x02\x96\x80\x80\x80\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x09\x70\x72\x69\x6e\x74\x5f\x69\x33\x32\x00\x06\x03\x87\x80\x80\x80\x00\x06\x00\x01\x04\x05\x05\x06\x07\x9c\x80\x80\x80\x00\x04\x03\x6f\x6e\x65\x00\x03\x03\x74\x77\x6f\x00\x04\x05\x74\x68\x72\x65\x65\x00\x05\x04\x66\x6f\x75\x72\x00\x06\x0a\xbb\x80\x80\x80\x00\x06\x82\x80\x80\x80\x00\x00\x0b\x82\x80\x80\x80\x00\x00\x0b\x84\x80\x80\x80\x00\x00\x41\x0d\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x41\x01\x6a\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x41\x02\x6b\x0b\x86\x80\x80\x80\x00\x00\x20\x00\x10\x00\x0b"); 4 | 5 | // func_ptrs.wast:27 6 | assert_return(() => call($1, "one", []), 13); 7 | 8 | // func_ptrs.wast:28 9 | assert_return(() => call($1, "two", [13]), 14); 10 | 11 | // func_ptrs.wast:29 12 | assert_return(() => call($1, "three", [13]), 11); 13 | 14 | // func_ptrs.wast:30 15 | run(() => call($1, "four", [83])); 16 | 17 | // func_ptrs.wast:32 18 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x09\x86\x80\x80\x80\x00\x01\x00\x41\x00\x0b\x00"); 19 | 20 | // func_ptrs.wast:33 21 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x09\x87\x80\x80\x80\x00\x01\x00\x41\x00\x0b\x01\x00\x0a\x88\x80\x80\x80\x00\x01\x82\x80\x80\x80\x00\x00\x0b"); 22 | 23 | // func_ptrs.wast:35 24 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x04\x84\x80\x80\x80\x00\x01\x70\x00\x01\x09\x86\x80\x80\x80\x00\x01\x00\x42\x00\x0b\x00"); 25 | 26 | // func_ptrs.wast:39 27 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x04\x84\x80\x80\x80\x00\x01\x70\x00\x01\x09\x87\x80\x80\x80\x00\x01\x00\x41\x00\x68\x0b\x00"); 28 | 29 | // func_ptrs.wast:43 30 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x04\x84\x80\x80\x80\x00\x01\x70\x00\x01\x09\x85\x80\x80\x80\x00\x01\x00\x01\x0b\x00"); 31 | 32 | // func_ptrs.wast:48 33 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x03\x82\x80\x80\x80\x00\x01\x2a\x0a\x88\x80\x80\x80\x00\x01\x82\x80\x80\x80\x00\x00\x0b"); 34 | 35 | // func_ptrs.wast:49 36 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x02\x96\x80\x80\x80\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x09\x70\x72\x69\x6e\x74\x5f\x69\x33\x32\x00\x2b"); 37 | 38 | // func_ptrs.wast:51 39 | let $2 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x8e\x80\x80\x80\x00\x03\x60\x00\x01\x7f\x60\x00\x01\x7f\x60\x01\x7f\x01\x7f\x03\x88\x80\x80\x80\x00\x07\x00\x00\x00\x01\x01\x02\x02\x04\x85\x80\x80\x80\x00\x01\x70\x01\x07\x07\x07\x91\x80\x80\x80\x00\x02\x05\x63\x61\x6c\x6c\x74\x00\x05\x05\x63\x61\x6c\x6c\x75\x00\x06\x09\x8d\x80\x80\x80\x00\x01\x00\x41\x00\x0b\x07\x00\x01\x02\x03\x04\x00\x02\x0a\xc6\x80\x80\x80\x00\x07\x84\x80\x80\x80\x00\x00\x41\x01\x0b\x84\x80\x80\x80\x00\x00\x41\x02\x0b\x84\x80\x80\x80\x00\x00\x41\x03\x0b\x84\x80\x80\x80\x00\x00\x41\x04\x0b\x84\x80\x80\x80\x00\x00\x41\x05\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x11\x00\x00\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x11\x01\x00\x0b"); 40 | 41 | // func_ptrs.wast:71 42 | assert_return(() => call($2, "callt", [0]), 1); 43 | 44 | // func_ptrs.wast:72 45 | assert_return(() => call($2, "callt", [1]), 2); 46 | 47 | // func_ptrs.wast:73 48 | assert_return(() => call($2, "callt", [2]), 3); 49 | 50 | // func_ptrs.wast:74 51 | assert_return(() => call($2, "callt", [3]), 4); 52 | 53 | // func_ptrs.wast:75 54 | assert_return(() => call($2, "callt", [4]), 5); 55 | 56 | // func_ptrs.wast:76 57 | assert_return(() => call($2, "callt", [5]), 1); 58 | 59 | // func_ptrs.wast:77 60 | assert_return(() => call($2, "callt", [6]), 3); 61 | 62 | // func_ptrs.wast:78 63 | assert_trap(() => call($2, "callt", [7])); 64 | 65 | // func_ptrs.wast:79 66 | assert_trap(() => call($2, "callt", [100])); 67 | 68 | // func_ptrs.wast:80 69 | assert_trap(() => call($2, "callt", [-1])); 70 | 71 | // func_ptrs.wast:82 72 | assert_return(() => call($2, "callu", [0]), 1); 73 | 74 | // func_ptrs.wast:83 75 | assert_return(() => call($2, "callu", [1]), 2); 76 | 77 | // func_ptrs.wast:84 78 | assert_return(() => call($2, "callu", [2]), 3); 79 | 80 | // func_ptrs.wast:85 81 | assert_return(() => call($2, "callu", [3]), 4); 82 | 83 | // func_ptrs.wast:86 84 | assert_return(() => call($2, "callu", [4]), 5); 85 | 86 | // func_ptrs.wast:87 87 | assert_return(() => call($2, "callu", [5]), 1); 88 | 89 | // func_ptrs.wast:88 90 | assert_return(() => call($2, "callu", [6]), 3); 91 | 92 | // func_ptrs.wast:89 93 | assert_trap(() => call($2, "callu", [7])); 94 | 95 | // func_ptrs.wast:90 96 | assert_trap(() => call($2, "callu", [100])); 97 | 98 | // func_ptrs.wast:91 99 | assert_trap(() => call($2, "callu", [-1])); 100 | 101 | // func_ptrs.wast:93 102 | let $3 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x8a\x80\x80\x80\x00\x02\x60\x00\x01\x7f\x60\x01\x7f\x01\x7f\x03\x84\x80\x80\x80\x00\x03\x00\x00\x01\x04\x85\x80\x80\x80\x00\x01\x70\x01\x02\x02\x07\x89\x80\x80\x80\x00\x01\x05\x63\x61\x6c\x6c\x74\x00\x02\x09\x88\x80\x80\x80\x00\x01\x00\x41\x00\x0b\x02\x00\x01\x0a\x9f\x80\x80\x80\x00\x03\x84\x80\x80\x80\x00\x00\x41\x01\x0b\x84\x80\x80\x80\x00\x00\x41\x02\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x11\x00\x00\x0b"); 103 | 104 | // func_ptrs.wast:105 105 | assert_return(() => call($3, "callt", [0]), 1); 106 | 107 | // func_ptrs.wast:106 108 | assert_return(() => call($3, "callt", [1]), 2); 109 | -------------------------------------------------------------------------------- /test/core/inline-module.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // inline-module.wast:1 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x83\x80\x80\x80\x00\x02\x00\x00\x05\x83\x80\x80\x80\x00\x01\x00\x00\x07\x85\x80\x80\x80\x00\x01\x01\x66\x00\x01\x0a\x8f\x80\x80\x80\x00\x02\x82\x80\x80\x80\x00\x00\x0b\x82\x80\x80\x80\x00\x00\x0b"); 4 | -------------------------------------------------------------------------------- /test/core/labels.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // labels.wast:1 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x8a\x80\x80\x80\x00\x02\x60\x00\x01\x7f\x60\x01\x7f\x01\x7f\x03\x93\x80\x80\x80\x00\x12\x00\x00\x00\x00\x01\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x07\x9a\x81\x80\x80\x00\x12\x05\x62\x6c\x6f\x63\x6b\x00\x00\x05\x6c\x6f\x6f\x70\x31\x00\x01\x05\x6c\x6f\x6f\x70\x32\x00\x02\x05\x6c\x6f\x6f\x70\x33\x00\x03\x05\x6c\x6f\x6f\x70\x34\x00\x04\x05\x6c\x6f\x6f\x70\x35\x00\x05\x05\x6c\x6f\x6f\x70\x36\x00\x06\x02\x69\x66\x00\x07\x03\x69\x66\x32\x00\x08\x06\x73\x77\x69\x74\x63\x68\x00\x09\x06\x72\x65\x74\x75\x72\x6e\x00\x0a\x06\x62\x72\x5f\x69\x66\x30\x00\x0b\x06\x62\x72\x5f\x69\x66\x31\x00\x0c\x06\x62\x72\x5f\x69\x66\x32\x00\x0d\x06\x62\x72\x5f\x69\x66\x33\x00\x0e\x02\x62\x72\x00\x0f\x09\x73\x68\x61\x64\x6f\x77\x69\x6e\x67\x00\x10\x0c\x72\x65\x64\x65\x66\x69\x6e\x69\x74\x69\x6f\x6e\x00\x11\x0a\xc9\x86\x80\x80\x00\x12\x8b\x80\x80\x80\x00\x00\x02\x7f\x41\x01\x0c\x00\x41\x00\x0b\x0b\xa3\x80\x80\x80\x00\x01\x01\x7f\x41\x00\x21\x00\x02\x7f\x03\x7f\x20\x00\x41\x01\x6a\x21\x00\x20\x00\x41\x05\x46\x04\x40\x20\x00\x0c\x02\x0b\x0c\x00\x0b\x0b\x0b\xb4\x80\x80\x80\x00\x01\x01\x7f\x41\x00\x21\x00\x02\x7f\x03\x7f\x20\x00\x41\x01\x6a\x21\x00\x20\x00\x41\x05\x46\x04\x40\x0c\x01\x0b\x20\x00\x41\x08\x46\x04\x40\x20\x00\x0c\x02\x0b\x20\x00\x41\x01\x6a\x21\x00\x0c\x00\x0b\x0b\x0b\xa3\x80\x80\x80\x00\x01\x01\x7f\x41\x00\x21\x00\x02\x7f\x03\x7f\x20\x00\x41\x01\x6a\x21\x00\x20\x00\x41\x05\x46\x04\x40\x20\x00\x0c\x02\x0b\x20\x00\x0b\x0b\x0b\xa3\x80\x80\x80\x00\x01\x01\x7f\x41\x01\x21\x01\x02\x7f\x03\x7f\x20\x01\x20\x01\x6a\x21\x01\x20\x01\x20\x00\x4b\x04\x40\x20\x01\x0c\x02\x0b\x0c\x00\x0b\x0b\x0b\x8a\x80\x80\x80\x00\x00\x03\x7f\x41\x01\x0b\x41\x01\x6a\x0b\x8b\x80\x80\x80\x00\x00\x03\x7f\x41\x00\x0d\x00\x41\x03\x0b\x0b\x84\x81\x80\x80\x00\x01\x01\x7f\x41\x00\x21\x00\x02\x40\x41\x01\x04\x40\x0c\x00\x41\x9a\x05\x21\x00\x0b\x20\x00\x41\x01\x6a\x21\x00\x41\x01\x04\x40\x0c\x00\x41\x9a\x05\x21\x00\x05\x41\xf8\x06\x21\x00\x0b\x20\x00\x41\x01\x6a\x21\x00\x41\x01\x04\x40\x0c\x00\x41\x9a\x05\x21\x00\x05\x41\xf8\x06\x21\x00\x0b\x20\x00\x41\x01\x6a\x21\x00\x41\x00\x04\x40\x41\xf8\x06\x21\x00\x05\x0c\x00\x41\x9a\x05\x21\x00\x0b\x20\x00\x41\x01\x6a\x21\x00\x41\x00\x04\x40\x41\xf8\x06\x21\x00\x05\x0c\x00\x41\x9a\x05\x21\x00\x0b\x20\x00\x41\x01\x6a\x21\x00\x0b\x20\x00\x0b\x84\x81\x80\x80\x00\x01\x01\x7f\x41\x00\x21\x00\x02\x40\x41\x01\x04\x40\x0c\x00\x41\x9a\x05\x21\x00\x0b\x20\x00\x41\x01\x6a\x21\x00\x41\x01\x04\x40\x0c\x00\x41\x9a\x05\x21\x00\x05\x41\xf8\x06\x21\x00\x0b\x20\x00\x41\x01\x6a\x21\x00\x41\x01\x04\x40\x0c\x00\x41\x9a\x05\x21\x00\x05\x41\xf8\x06\x21\x00\x0b\x20\x00\x41\x01\x6a\x21\x00\x41\x00\x04\x40\x41\xf8\x06\x21\x00\x05\x0c\x00\x41\x9a\x05\x21\x00\x0b\x20\x00\x41\x01\x6a\x21\x00\x41\x00\x04\x40\x41\xf8\x06\x21\x00\x05\x0c\x00\x41\x9a\x05\x21\x00\x0b\x20\x00\x41\x01\x6a\x21\x00\x0b\x20\x00\x0b\xad\x80\x80\x80\x00\x00\x02\x7f\x41\x0a\x02\x7f\x02\x40\x02\x40\x02\x40\x02\x40\x02\x40\x20\x00\x0e\x04\x04\x00\x01\x02\x03\x0b\x0b\x41\x02\x0c\x03\x0b\x41\x03\x0c\x03\x0b\x0b\x41\x05\x0b\x6c\x0b\x0b\x98\x80\x80\x80\x00\x00\x02\x40\x02\x40\x02\x40\x20\x00\x0e\x01\x00\x01\x0c\x02\x0b\x41\x00\x0f\x0b\x0b\x41\x02\x0b\xd6\x80\x80\x80\x00\x01\x01\x7f\x41\x00\x21\x00\x02\x7f\x02\x40\x41\x00\x0d\x00\x20\x00\x41\x01\x72\x21\x00\x41\x01\x0d\x00\x20\x00\x41\x02\x72\x21\x00\x0b\x02\x7f\x20\x00\x41\x04\x72\x21\x00\x20\x00\x0b\x41\x00\x0d\x00\x1a\x20\x00\x41\x08\x72\x21\x00\x02\x7f\x20\x00\x41\x10\x72\x21\x00\x20\x00\x0b\x41\x01\x0d\x00\x1a\x20\x00\x41\x20\x72\x21\x00\x20\x00\x0b\x0b\x93\x80\x80\x80\x00\x00\x02\x7f\x02\x7f\x41\x01\x0c\x00\x0b\x41\x01\x0d\x00\x1a\x41\x00\x0b\x0b\x98\x80\x80\x80\x00\x00\x02\x7f\x41\x01\x04\x40\x02\x7f\x41\x01\x0c\x00\x0b\x41\x01\x0d\x01\x1a\x0b\x41\x00\x0b\x0b\xa4\x80\x80\x80\x00\x01\x01\x7f\x02\x7f\x02\x7f\x41\x01\x21\x00\x20\x00\x0b\x02\x7f\x41\x02\x21\x00\x20\x00\x0b\x0d\x00\x1a\x41\x00\x0b\x41\x00\x6a\x1a\x20\x00\x0b\xa1\x80\x80\x80\x00\x00\x02\x7f\x41\x01\x04\x40\x02\x7f\x41\x01\x0c\x00\x0b\x0c\x01\x05\x02\x40\x02\x7f\x41\x01\x0c\x00\x0b\x1a\x0b\x0b\x41\x01\x0b\x0b\x8c\x80\x80\x80\x00\x00\x02\x7f\x41\x01\x0c\x00\x41\x02\x73\x0b\x0b\x92\x80\x80\x80\x00\x00\x02\x7f\x02\x7f\x41\x02\x0b\x02\x7f\x41\x03\x0c\x00\x0b\x6a\x0b\x0b"); 4 | 5 | // labels.wast:291 6 | assert_return(() => call($1, "block", []), 1); 7 | 8 | // labels.wast:292 9 | assert_return(() => call($1, "loop1", []), 5); 10 | 11 | // labels.wast:293 12 | assert_return(() => call($1, "loop2", []), 8); 13 | 14 | // labels.wast:294 15 | assert_return(() => call($1, "loop3", []), 1); 16 | 17 | // labels.wast:295 18 | assert_return(() => call($1, "loop4", [8]), 16); 19 | 20 | // labels.wast:296 21 | assert_return(() => call($1, "loop5", []), 2); 22 | 23 | // labels.wast:297 24 | assert_return(() => call($1, "loop6", []), 3); 25 | 26 | // labels.wast:298 27 | assert_return(() => call($1, "if", []), 5); 28 | 29 | // labels.wast:299 30 | assert_return(() => call($1, "if2", []), 5); 31 | 32 | // labels.wast:300 33 | assert_return(() => call($1, "switch", [0]), 50); 34 | 35 | // labels.wast:301 36 | assert_return(() => call($1, "switch", [1]), 20); 37 | 38 | // labels.wast:302 39 | assert_return(() => call($1, "switch", [2]), 20); 40 | 41 | // labels.wast:303 42 | assert_return(() => call($1, "switch", [3]), 3); 43 | 44 | // labels.wast:304 45 | assert_return(() => call($1, "switch", [4]), 50); 46 | 47 | // labels.wast:305 48 | assert_return(() => call($1, "switch", [5]), 50); 49 | 50 | // labels.wast:306 51 | assert_return(() => call($1, "return", [0]), 0); 52 | 53 | // labels.wast:307 54 | assert_return(() => call($1, "return", [1]), 2); 55 | 56 | // labels.wast:308 57 | assert_return(() => call($1, "return", [2]), 2); 58 | 59 | // labels.wast:309 60 | assert_return(() => call($1, "br_if0", []), 29); 61 | 62 | // labels.wast:310 63 | assert_return(() => call($1, "br_if1", []), 1); 64 | 65 | // labels.wast:311 66 | assert_return(() => call($1, "br_if2", []), 1); 67 | 68 | // labels.wast:312 69 | assert_return(() => call($1, "br_if3", []), 2); 70 | 71 | // labels.wast:313 72 | assert_return(() => call($1, "br", []), 1); 73 | 74 | // labels.wast:314 75 | assert_return(() => call($1, "shadowing", []), 1); 76 | 77 | // labels.wast:315 78 | assert_return(() => call($1, "redefinition", []), 5); 79 | 80 | // labels.wast:317 81 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x0a\x91\x80\x80\x80\x00\x01\x8b\x80\x80\x80\x00\x00\x02\x40\x41\x01\x0d\x00\x8c\x01\x0b\x0b"); 82 | 83 | // labels.wast:321 84 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x0a\x94\x80\x80\x80\x00\x01\x8e\x80\x80\x80\x00\x00\x02\x40\x43\x00\x00\x00\x00\x41\x01\x0d\x00\x0b\x0b"); 85 | 86 | // labels.wast:325 87 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x0a\x94\x80\x80\x80\x00\x01\x8e\x80\x80\x80\x00\x00\x02\x40\x43\x00\x00\x00\x00\x41\x01\x0d\x00\x0b\x0b"); 88 | -------------------------------------------------------------------------------- /test/core/memory_redundancy.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // memory_redundancy.wast:5 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x91\x80\x80\x80\x00\x04\x60\x00\x00\x60\x00\x01\x7f\x60\x00\x01\x7d\x60\x01\x7f\x01\x7f\x03\x87\x80\x80\x80\x00\x06\x00\x01\x01\x02\x03\x01\x05\x84\x80\x80\x80\x00\x01\x01\x01\x01\x07\xeb\x80\x80\x80\x00\x06\x0f\x7a\x65\x72\x6f\x5f\x65\x76\x65\x72\x79\x74\x68\x69\x6e\x67\x00\x00\x12\x74\x65\x73\x74\x5f\x73\x74\x6f\x72\x65\x5f\x74\x6f\x5f\x6c\x6f\x61\x64\x00\x01\x13\x74\x65\x73\x74\x5f\x72\x65\x64\x75\x6e\x64\x61\x6e\x74\x5f\x6c\x6f\x61\x64\x00\x02\x0f\x74\x65\x73\x74\x5f\x64\x65\x61\x64\x5f\x73\x74\x6f\x72\x65\x00\x03\x06\x6d\x61\x6c\x6c\x6f\x63\x00\x04\x0f\x6d\x61\x6c\x6c\x6f\x63\x5f\x61\x6c\x69\x61\x73\x69\x6e\x67\x00\x05\x0a\xbd\x81\x80\x80\x00\x06\x9e\x80\x80\x80\x00\x00\x41\x00\x41\x00\x36\x02\x00\x41\x04\x41\x00\x36\x02\x00\x41\x08\x41\x00\x36\x02\x00\x41\x0c\x41\x00\x36\x02\x00\x0b\x98\x80\x80\x80\x00\x00\x41\x08\x41\x00\x36\x02\x00\x41\x05\x43\x00\x00\x00\x80\x38\x02\x00\x41\x08\x28\x02\x00\x0b\xa2\x80\x80\x80\x00\x01\x02\x7f\x41\x08\x28\x02\x00\x21\x00\x41\x05\x41\x80\x80\x80\x80\x78\x36\x02\x00\x41\x08\x28\x02\x00\x21\x01\x20\x00\x20\x01\x6a\x0b\x9f\x80\x80\x80\x00\x01\x01\x7d\x41\x08\x41\xa3\xc6\x8c\x99\x02\x36\x02\x00\x41\x0b\x2a\x02\x00\x21\x00\x41\x08\x41\x00\x36\x02\x00\x20\x00\x0b\x84\x80\x80\x80\x00\x00\x41\x10\x0b\xa3\x80\x80\x80\x00\x01\x02\x7f\x41\x04\x10\x04\x21\x00\x41\x04\x10\x04\x21\x01\x20\x00\x41\x2a\x36\x02\x00\x20\x01\x41\x2b\x36\x02\x00\x20\x00\x28\x02\x00\x0b"); 4 | 5 | // memory_redundancy.wast:59 6 | assert_return(() => call($1, "test_store_to_load", []), 128); 7 | 8 | // memory_redundancy.wast:60 9 | run(() => call($1, "zero_everything", [])); 10 | 11 | // memory_redundancy.wast:61 12 | assert_return(() => call($1, "test_redundant_load", []), 128); 13 | 14 | // memory_redundancy.wast:62 15 | run(() => call($1, "zero_everything", [])); 16 | 17 | // memory_redundancy.wast:63 18 | run(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\xa3\x80\x80\x80\x00\x07\x60\x00\x00\x60\x01\x7f\x01\x6f\x60\x01\x6f\x01\x7f\x60\x01\x70\x01\x7f\x60\x02\x6f\x6f\x01\x7f\x60\x02\x70\x70\x01\x7f\x60\x00\x01\x7d\x02\x8b\x81\x80\x80\x00\x06\x06\x6d\x6f\x64\x75\x6c\x65\x0f\x74\x65\x73\x74\x5f\x64\x65\x61\x64\x5f\x73\x74\x6f\x72\x65\x00\x06\x08\x73\x70\x65\x63\x74\x65\x73\x74\x09\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x69\x73\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x02\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x69\x73\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x03\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x65\x71\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x04\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x65\x71\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x05\x03\x82\x80\x80\x80\x00\x01\x00\x07\x87\x80\x80\x80\x00\x01\x03\x72\x75\x6e\x00\x06\x0a\x9a\x80\x80\x80\x00\x01\x94\x80\x80\x80\x00\x00\x02\x40\x10\x00\xbc\x43\x23\x00\x00\x00\xbc\x46\x45\x0d\x00\x0f\x0b\x00\x0b", exports($1)), "run", [])); // assert_return(() => call($1, "test_dead_store", []), 4.90454462514e-44) 19 | 20 | // memory_redundancy.wast:64 21 | run(() => call($1, "zero_everything", [])); 22 | 23 | // memory_redundancy.wast:65 24 | assert_return(() => call($1, "malloc_aliasing", []), 43); 25 | -------------------------------------------------------------------------------- /test/core/memory_size.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // memory_size.wast:1 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x89\x80\x80\x80\x00\x02\x60\x00\x01\x7f\x60\x01\x7f\x00\x03\x83\x80\x80\x80\x00\x02\x00\x01\x05\x83\x80\x80\x80\x00\x01\x00\x00\x07\x8f\x80\x80\x80\x00\x02\x04\x73\x69\x7a\x65\x00\x00\x04\x67\x72\x6f\x77\x00\x01\x0a\x96\x80\x80\x80\x00\x02\x84\x80\x80\x80\x00\x00\x3f\x00\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x40\x00\x1a\x0b"); 4 | 5 | // memory_size.wast:7 6 | assert_return(() => call($1, "size", []), 0); 7 | 8 | // memory_size.wast:8 9 | assert_return(() => call($1, "grow", [1])); 10 | 11 | // memory_size.wast:9 12 | assert_return(() => call($1, "size", []), 1); 13 | 14 | // memory_size.wast:10 15 | assert_return(() => call($1, "grow", [4])); 16 | 17 | // memory_size.wast:11 18 | assert_return(() => call($1, "size", []), 5); 19 | 20 | // memory_size.wast:12 21 | assert_return(() => call($1, "grow", [0])); 22 | 23 | // memory_size.wast:13 24 | assert_return(() => call($1, "size", []), 5); 25 | 26 | // memory_size.wast:15 27 | let $2 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x89\x80\x80\x80\x00\x02\x60\x00\x01\x7f\x60\x01\x7f\x00\x03\x83\x80\x80\x80\x00\x02\x00\x01\x05\x83\x80\x80\x80\x00\x01\x00\x01\x07\x8f\x80\x80\x80\x00\x02\x04\x73\x69\x7a\x65\x00\x00\x04\x67\x72\x6f\x77\x00\x01\x0a\x96\x80\x80\x80\x00\x02\x84\x80\x80\x80\x00\x00\x3f\x00\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x40\x00\x1a\x0b"); 28 | 29 | // memory_size.wast:21 30 | assert_return(() => call($2, "size", []), 1); 31 | 32 | // memory_size.wast:22 33 | assert_return(() => call($2, "grow", [1])); 34 | 35 | // memory_size.wast:23 36 | assert_return(() => call($2, "size", []), 2); 37 | 38 | // memory_size.wast:24 39 | assert_return(() => call($2, "grow", [4])); 40 | 41 | // memory_size.wast:25 42 | assert_return(() => call($2, "size", []), 6); 43 | 44 | // memory_size.wast:26 45 | assert_return(() => call($2, "grow", [0])); 46 | 47 | // memory_size.wast:27 48 | assert_return(() => call($2, "size", []), 6); 49 | 50 | // memory_size.wast:29 51 | let $3 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x89\x80\x80\x80\x00\x02\x60\x00\x01\x7f\x60\x01\x7f\x00\x03\x83\x80\x80\x80\x00\x02\x00\x01\x05\x84\x80\x80\x80\x00\x01\x01\x00\x02\x07\x8f\x80\x80\x80\x00\x02\x04\x73\x69\x7a\x65\x00\x00\x04\x67\x72\x6f\x77\x00\x01\x0a\x96\x80\x80\x80\x00\x02\x84\x80\x80\x80\x00\x00\x3f\x00\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x40\x00\x1a\x0b"); 52 | 53 | // memory_size.wast:35 54 | assert_return(() => call($3, "size", []), 0); 55 | 56 | // memory_size.wast:36 57 | assert_return(() => call($3, "grow", [3])); 58 | 59 | // memory_size.wast:37 60 | assert_return(() => call($3, "size", []), 0); 61 | 62 | // memory_size.wast:38 63 | assert_return(() => call($3, "grow", [1])); 64 | 65 | // memory_size.wast:39 66 | assert_return(() => call($3, "size", []), 1); 67 | 68 | // memory_size.wast:40 69 | assert_return(() => call($3, "grow", [0])); 70 | 71 | // memory_size.wast:41 72 | assert_return(() => call($3, "size", []), 1); 73 | 74 | // memory_size.wast:42 75 | assert_return(() => call($3, "grow", [4])); 76 | 77 | // memory_size.wast:43 78 | assert_return(() => call($3, "size", []), 1); 79 | 80 | // memory_size.wast:44 81 | assert_return(() => call($3, "grow", [1])); 82 | 83 | // memory_size.wast:45 84 | assert_return(() => call($3, "size", []), 2); 85 | 86 | // memory_size.wast:47 87 | let $4 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x89\x80\x80\x80\x00\x02\x60\x00\x01\x7f\x60\x01\x7f\x00\x03\x83\x80\x80\x80\x00\x02\x00\x01\x05\x84\x80\x80\x80\x00\x01\x01\x03\x08\x07\x8f\x80\x80\x80\x00\x02\x04\x73\x69\x7a\x65\x00\x00\x04\x67\x72\x6f\x77\x00\x01\x0a\x96\x80\x80\x80\x00\x02\x84\x80\x80\x80\x00\x00\x3f\x00\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x40\x00\x1a\x0b"); 88 | 89 | // memory_size.wast:53 90 | assert_return(() => call($4, "size", []), 3); 91 | 92 | // memory_size.wast:54 93 | assert_return(() => call($4, "grow", [1])); 94 | 95 | // memory_size.wast:55 96 | assert_return(() => call($4, "size", []), 4); 97 | 98 | // memory_size.wast:56 99 | assert_return(() => call($4, "grow", [3])); 100 | 101 | // memory_size.wast:57 102 | assert_return(() => call($4, "size", []), 7); 103 | 104 | // memory_size.wast:58 105 | assert_return(() => call($4, "grow", [0])); 106 | 107 | // memory_size.wast:59 108 | assert_return(() => call($4, "size", []), 7); 109 | 110 | // memory_size.wast:60 111 | assert_return(() => call($4, "grow", [2])); 112 | 113 | // memory_size.wast:61 114 | assert_return(() => call($4, "size", []), 7); 115 | 116 | // memory_size.wast:62 117 | assert_return(() => call($4, "grow", [1])); 118 | 119 | // memory_size.wast:63 120 | assert_return(() => call($4, "size", []), 8); 121 | 122 | // memory_size.wast:68 123 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x05\x83\x80\x80\x80\x00\x01\x00\x01\x0a\x8a\x80\x80\x80\x00\x01\x84\x80\x80\x80\x00\x00\x3f\x00\x0b"); 124 | 125 | // memory_size.wast:77 126 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x85\x80\x80\x80\x00\x01\x60\x00\x01\x7d\x03\x82\x80\x80\x80\x00\x01\x00\x05\x83\x80\x80\x80\x00\x01\x00\x01\x0a\x8a\x80\x80\x80\x00\x01\x84\x80\x80\x80\x00\x00\x3f\x00\x0b"); 127 | -------------------------------------------------------------------------------- /test/core/multi-memory/align0.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // align0.wast:3 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x86\x80\x80\x80\x00\x01\x60\x01\x7f\x01\x7d\x03\x82\x80\x80\x80\x00\x01\x00\x05\x87\x80\x80\x80\x00\x03\x00\x00\x00\x01\x00\x00\x07\x94\x80\x80\x80\x00\x01\x10\x66\x33\x32\x5f\x61\x6c\x69\x67\x6e\x5f\x73\x77\x69\x74\x63\x68\x00\x00\x0a\xf1\x80\x80\x80\x00\x01\xeb\x80\x80\x80\x00\x01\x02\x7d\x43\x00\x00\x20\x41\x21\x01\x02\x40\x02\x40\x02\x40\x02\x40\x02\x40\x20\x00\x0e\x04\x00\x01\x02\x03\x04\x0b\x41\x00\x20\x01\x38\x42\x01\x00\x41\x00\x2a\x42\x01\x00\x21\x02\x0c\x03\x0b\x41\x00\x20\x01\x38\x40\x01\x00\x41\x00\x2a\x40\x01\x00\x21\x02\x0c\x02\x0b\x41\x00\x20\x01\x38\x41\x01\x00\x41\x00\x2a\x41\x01\x00\x21\x02\x0c\x01\x0b\x41\x00\x20\x01\x38\x42\x01\x00\x41\x00\x2a\x42\x01\x00\x21\x02\x0b\x20\x02\x0b"); 4 | 5 | // align0.wast:39 6 | run(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\xa4\x80\x80\x80\x00\x07\x60\x00\x00\x60\x01\x7f\x01\x6f\x60\x01\x6f\x01\x7f\x60\x01\x70\x01\x7f\x60\x02\x6f\x6f\x01\x7f\x60\x02\x70\x70\x01\x7f\x60\x01\x7f\x01\x7d\x02\x8c\x81\x80\x80\x00\x06\x06\x6d\x6f\x64\x75\x6c\x65\x10\x66\x33\x32\x5f\x61\x6c\x69\x67\x6e\x5f\x73\x77\x69\x74\x63\x68\x00\x06\x08\x73\x70\x65\x63\x74\x65\x73\x74\x09\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x69\x73\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x02\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x69\x73\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x03\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x65\x71\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x04\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x65\x71\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x05\x03\x82\x80\x80\x80\x00\x01\x00\x07\x87\x80\x80\x80\x00\x01\x03\x72\x75\x6e\x00\x06\x0a\x9c\x80\x80\x80\x00\x01\x96\x80\x80\x80\x00\x00\x02\x40\x41\x00\x10\x00\xbc\x43\x00\x00\x20\x41\xbc\x46\x45\x0d\x00\x0f\x0b\x00\x0b", exports($1)), "run", [])); // assert_return(() => call($1, "f32_align_switch", [0]), 10.) 7 | 8 | // align0.wast:40 9 | run(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\xa4\x80\x80\x80\x00\x07\x60\x00\x00\x60\x01\x7f\x01\x6f\x60\x01\x6f\x01\x7f\x60\x01\x70\x01\x7f\x60\x02\x6f\x6f\x01\x7f\x60\x02\x70\x70\x01\x7f\x60\x01\x7f\x01\x7d\x02\x8c\x81\x80\x80\x00\x06\x06\x6d\x6f\x64\x75\x6c\x65\x10\x66\x33\x32\x5f\x61\x6c\x69\x67\x6e\x5f\x73\x77\x69\x74\x63\x68\x00\x06\x08\x73\x70\x65\x63\x74\x65\x73\x74\x09\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x69\x73\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x02\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x69\x73\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x03\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x65\x71\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x04\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x65\x71\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x05\x03\x82\x80\x80\x80\x00\x01\x00\x07\x87\x80\x80\x80\x00\x01\x03\x72\x75\x6e\x00\x06\x0a\x9c\x80\x80\x80\x00\x01\x96\x80\x80\x80\x00\x00\x02\x40\x41\x01\x10\x00\xbc\x43\x00\x00\x20\x41\xbc\x46\x45\x0d\x00\x0f\x0b\x00\x0b", exports($1)), "run", [])); // assert_return(() => call($1, "f32_align_switch", [1]), 10.) 10 | 11 | // align0.wast:41 12 | run(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\xa4\x80\x80\x80\x00\x07\x60\x00\x00\x60\x01\x7f\x01\x6f\x60\x01\x6f\x01\x7f\x60\x01\x70\x01\x7f\x60\x02\x6f\x6f\x01\x7f\x60\x02\x70\x70\x01\x7f\x60\x01\x7f\x01\x7d\x02\x8c\x81\x80\x80\x00\x06\x06\x6d\x6f\x64\x75\x6c\x65\x10\x66\x33\x32\x5f\x61\x6c\x69\x67\x6e\x5f\x73\x77\x69\x74\x63\x68\x00\x06\x08\x73\x70\x65\x63\x74\x65\x73\x74\x09\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x69\x73\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x02\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x69\x73\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x03\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x65\x71\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x04\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x65\x71\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x05\x03\x82\x80\x80\x80\x00\x01\x00\x07\x87\x80\x80\x80\x00\x01\x03\x72\x75\x6e\x00\x06\x0a\x9c\x80\x80\x80\x00\x01\x96\x80\x80\x80\x00\x00\x02\x40\x41\x02\x10\x00\xbc\x43\x00\x00\x20\x41\xbc\x46\x45\x0d\x00\x0f\x0b\x00\x0b", exports($1)), "run", [])); // assert_return(() => call($1, "f32_align_switch", [2]), 10.) 13 | 14 | // align0.wast:42 15 | run(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\xa4\x80\x80\x80\x00\x07\x60\x00\x00\x60\x01\x7f\x01\x6f\x60\x01\x6f\x01\x7f\x60\x01\x70\x01\x7f\x60\x02\x6f\x6f\x01\x7f\x60\x02\x70\x70\x01\x7f\x60\x01\x7f\x01\x7d\x02\x8c\x81\x80\x80\x00\x06\x06\x6d\x6f\x64\x75\x6c\x65\x10\x66\x33\x32\x5f\x61\x6c\x69\x67\x6e\x5f\x73\x77\x69\x74\x63\x68\x00\x06\x08\x73\x70\x65\x63\x74\x65\x73\x74\x09\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x69\x73\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x02\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x69\x73\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x03\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x65\x71\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x04\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x65\x71\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x05\x03\x82\x80\x80\x80\x00\x01\x00\x07\x87\x80\x80\x80\x00\x01\x03\x72\x75\x6e\x00\x06\x0a\x9c\x80\x80\x80\x00\x01\x96\x80\x80\x80\x00\x00\x02\x40\x41\x03\x10\x00\xbc\x43\x00\x00\x20\x41\xbc\x46\x45\x0d\x00\x0f\x0b\x00\x0b", exports($1)), "run", [])); // assert_return(() => call($1, "f32_align_switch", [3]), 10.) 16 | -------------------------------------------------------------------------------- /test/core/multi-memory/binary0.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // binary0.wast:2 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x05\x07\x02\x00\x82\x00\x00\x82\x00"); 4 | 5 | // binary0.wast:8 6 | let $2 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x05\x13\x03\x00\x83\x80\x80\x80\x00\x00\x84\x80\x80\x80\x00\x00\x85\x80\x80\x80\x00"); 7 | 8 | // binary0.wast:16 9 | let $3 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x05\x05\x02\x00\x00\x00\x00\x0b\x06\x01\x00\x41\x00\x0b\x00"); 10 | 11 | // binary0.wast:26 12 | let $4 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x05\x05\x02\x00\x00\x00\x01\x0b\x07\x01\x02\x01\x41\x00\x0b\x00"); 13 | 14 | // binary0.wast:36 15 | let $5 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x05\x05\x02\x00\x00\x00\x01\x0b\x0a\x01\x02\x81\x80\x80\x00\x41\x00\x0b\x00"); 16 | 17 | // binary0.wast:47 18 | assert_malformed("\x00\x61\x73\x6d\x01\x00\x00\x00\x05\x0a\x02\x00\x01\x00\x82\x80\x80\x80\x80\x00"); 19 | 20 | // binary0.wast:58 21 | assert_malformed("\x00\x61\x73\x6d\x01\x00\x00\x00\x05\x03\x02\x00\x00"); 22 | -------------------------------------------------------------------------------- /test/core/multi-memory/data0.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // data0.wast:5 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x05\x87\x80\x80\x80\x00\x03\x00\x01\x00\x01\x00\x01\x0b\xa7\x81\x80\x80\x00\x18\x00\x41\x00\x0b\x00\x00\x41\x01\x0b\x04\x61\x62\x63\x64\x00\x41\x00\x0b\x00\x00\x41\x00\x0b\x03\x61\x62\x63\x00\x41\x00\x0b\x00\x00\x41\x01\x0b\x04\x61\x62\x63\x64\x00\x41\x00\x0b\x00\x00\x41\x00\x0b\x03\x61\x62\x63\x00\x41\x00\x0b\x00\x02\x01\x41\x01\x0b\x04\x61\x62\x63\x64\x02\x02\x41\x00\x0b\x00\x00\x41\x00\x0b\x03\x61\x62\x63\x00\x41\x00\x0b\x00\x00\x41\x01\x0b\x04\x61\x62\x63\x64\x00\x41\x00\x0b\x00\x00\x41\x00\x0b\x03\x61\x62\x63\x00\x41\x00\x0b\x00\x00\x41\x01\x0b\x04\x61\x62\x63\x64\x00\x41\x00\x0b\x00\x00\x41\x00\x0b\x03\x61\x62\x63\x00\x41\x00\x0b\x00\x02\x01\x41\x01\x0b\x04\x61\x62\x63\x64\x02\x02\x41\x00\x0b\x00\x00\x41\x00\x0b\x03\x61\x62\x63"); 4 | 5 | // data0.wast:39 6 | let $2 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x05\x83\x80\x80\x80\x00\x01\x00\x01\x0b\x87\x80\x80\x80\x00\x01\x00\x41\x00\x0b\x01\x61"); 7 | 8 | // data0.wast:43 9 | let $3 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x02\xba\x80\x80\x80\x00\x03\x08\x73\x70\x65\x63\x74\x65\x73\x74\x06\x6d\x65\x6d\x6f\x72\x79\x02\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x06\x6d\x65\x6d\x6f\x72\x79\x02\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x06\x6d\x65\x6d\x6f\x72\x79\x02\x00\x01\x0b\x95\x80\x80\x80\x00\x03\x00\x41\x00\x0b\x01\x61\x02\x01\x41\x00\x0b\x01\x61\x02\x02\x41\x00\x0b\x01\x61"); 10 | 11 | // data0.wast:52 12 | let $4 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x02\x98\x80\x80\x80\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x67\x6c\x6f\x62\x61\x6c\x5f\x69\x33\x32\x03\x7f\x00\x05\x83\x80\x80\x80\x00\x01\x00\x01\x0b\x87\x80\x80\x80\x00\x01\x00\x23\x00\x0b\x01\x61"); 13 | 14 | // data0.wast:57 15 | let $5 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x02\xab\x80\x80\x80\x00\x02\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x67\x6c\x6f\x62\x61\x6c\x5f\x69\x33\x32\x03\x7f\x00\x08\x73\x70\x65\x63\x74\x65\x73\x74\x06\x6d\x65\x6d\x6f\x72\x79\x02\x00\x01\x0b\x87\x80\x80\x80\x00\x01\x00\x23\x00\x0b\x01\x61"); 16 | 17 | // data0.wast:63 18 | let $6 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x02\x98\x80\x80\x80\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x67\x6c\x6f\x62\x61\x6c\x5f\x69\x33\x32\x03\x7f\x00\x05\x83\x80\x80\x80\x00\x01\x00\x01\x0b\x87\x80\x80\x80\x00\x01\x00\x23\x00\x0b\x01\x61"); 19 | 20 | // data0.wast:68 21 | let $7 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x02\xab\x80\x80\x80\x00\x02\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x67\x6c\x6f\x62\x61\x6c\x5f\x69\x33\x32\x03\x7f\x00\x08\x73\x70\x65\x63\x74\x65\x73\x74\x06\x6d\x65\x6d\x6f\x72\x79\x02\x00\x01\x0b\x87\x80\x80\x80\x00\x01\x00\x23\x00\x0b\x01\x61"); 22 | -------------------------------------------------------------------------------- /test/core/multi-memory/data1.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // data1.wast:3 3 | assert_uninstantiable("\x00\x61\x73\x6d\x01\x00\x00\x00\x05\x87\x80\x80\x80\x00\x03\x00\x01\x00\x00\x00\x02\x0b\x88\x80\x80\x80\x00\x01\x02\x01\x41\x00\x0b\x01\x61"); 4 | 5 | // data1.wast:13 6 | assert_uninstantiable("\x00\x61\x73\x6d\x01\x00\x00\x00\x05\x8a\x80\x80\x80\x00\x03\x01\x01\x01\x01\x01\x01\x01\x00\x00\x0b\x88\x80\x80\x80\x00\x01\x02\x02\x41\x00\x0b\x01\x61"); 7 | 8 | // data1.wast:23 9 | assert_uninstantiable("\x00\x61\x73\x6d\x01\x00\x00\x00\x05\x8a\x80\x80\x80\x00\x03\x01\x01\x01\x01\x00\x01\x01\x01\x01\x0b\x88\x80\x80\x80\x00\x01\x02\x01\x41\x00\x0b\x01\x61"); 10 | 11 | // data1.wast:32 12 | assert_uninstantiable("\x00\x61\x73\x6d\x01\x00\x00\x00\x05\x87\x80\x80\x80\x00\x03\x00\x01\x00\x01\x00\x00\x0b\x87\x80\x80\x80\x00\x01\x02\x02\x41\x01\x0b\x00"); 13 | 14 | // data1.wast:41 15 | assert_uninstantiable("\x00\x61\x73\x6d\x01\x00\x00\x00\x05\x8a\x80\x80\x80\x00\x03\x01\x01\x01\x01\x01\x01\x01\x00\x01\x0b\x87\x80\x80\x80\x00\x01\x02\x02\x41\x01\x0b\x00"); 16 | 17 | // data1.wast:60 18 | assert_uninstantiable("\x00\x61\x73\x6d\x01\x00\x00\x00\x02\x98\x80\x80\x80\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x67\x6c\x6f\x62\x61\x6c\x5f\x69\x33\x32\x03\x7f\x00\x05\x87\x80\x80\x80\x00\x03\x00\x03\x00\x00\x00\x03\x0b\x88\x80\x80\x80\x00\x01\x02\x01\x23\x00\x0b\x01\x61"); 19 | 20 | // data1.wast:71 21 | assert_uninstantiable("\x00\x61\x73\x6d\x01\x00\x00\x00\x05\x8a\x80\x80\x80\x00\x03\x01\x02\x02\x01\x01\x02\x01\x02\x02\x0b\x8a\x80\x80\x80\x00\x01\x02\x01\x41\x80\x80\x04\x0b\x01\x61"); 22 | 23 | // data1.wast:80 24 | assert_uninstantiable("\x00\x61\x73\x6d\x01\x00\x00\x00\x02\x94\x80\x80\x80\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x06\x6d\x65\x6d\x6f\x72\x79\x02\x00\x01\x0b\x89\x80\x80\x80\x00\x01\x00\x41\x80\x80\x04\x0b\x01\x61"); 25 | 26 | // data1.wast:88 27 | assert_uninstantiable("\x00\x61\x73\x6d\x01\x00\x00\x00\x05\x87\x80\x80\x80\x00\x03\x00\x03\x00\x03\x00\x02\x0b\x8a\x80\x80\x80\x00\x01\x02\x02\x41\x80\x80\x08\x0b\x01\x61"); 28 | 29 | // data1.wast:98 30 | assert_uninstantiable("\x00\x61\x73\x6d\x01\x00\x00\x00\x05\x8a\x80\x80\x80\x00\x03\x01\x03\x03\x01\x02\x03\x01\x03\x03\x0b\x8a\x80\x80\x80\x00\x01\x02\x01\x41\x80\x80\x08\x0b\x01\x61"); 31 | 32 | // data1.wast:108 33 | assert_uninstantiable("\x00\x61\x73\x6d\x01\x00\x00\x00\x05\x87\x80\x80\x80\x00\x03\x00\x00\x00\x00\x00\x01\x0b\x88\x80\x80\x80\x00\x01\x02\x02\x41\x7f\x0b\x01\x61"); 34 | 35 | // data1.wast:117 36 | assert_uninstantiable("\x00\x61\x73\x6d\x01\x00\x00\x00\x02\xba\x80\x80\x80\x00\x03\x08\x73\x70\x65\x63\x74\x65\x73\x74\x06\x6d\x65\x6d\x6f\x72\x79\x02\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x06\x6d\x65\x6d\x6f\x72\x79\x02\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x06\x6d\x65\x6d\x6f\x72\x79\x02\x00\x01\x0b\x88\x80\x80\x80\x00\x01\x02\x02\x41\x7f\x0b\x01\x61"); 37 | 38 | // data1.wast:127 39 | assert_uninstantiable("\x00\x61\x73\x6d\x01\x00\x00\x00\x05\x87\x80\x80\x80\x00\x03\x00\x02\x00\x02\x00\x02\x0b\x89\x80\x80\x80\x00\x01\x02\x02\x41\x9c\x7f\x0b\x01\x61"); 40 | 41 | // data1.wast:136 42 | assert_uninstantiable("\x00\x61\x73\x6d\x01\x00\x00\x00\x02\xcd\x80\x80\x80\x00\x04\x08\x73\x70\x65\x63\x74\x65\x73\x74\x06\x6d\x65\x6d\x6f\x72\x79\x02\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x06\x6d\x65\x6d\x6f\x72\x79\x02\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x06\x6d\x65\x6d\x6f\x72\x79\x02\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x06\x6d\x65\x6d\x6f\x72\x79\x02\x00\x01\x0b\x89\x80\x80\x80\x00\x01\x02\x03\x41\x9c\x7f\x0b\x01\x61"); 43 | -------------------------------------------------------------------------------- /test/core/multi-memory/data_drop0.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // data_drop0.wast:2 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x88\x80\x80\x80\x00\x02\x60\x00\x00\x60\x01\x7f\x00\x03\x85\x80\x80\x80\x00\x04\x00\x01\x00\x01\x05\x87\x80\x80\x80\x00\x03\x00\x00\x00\x01\x00\x00\x07\xbb\x80\x80\x80\x00\x04\x0c\x64\x72\x6f\x70\x5f\x70\x61\x73\x73\x69\x76\x65\x00\x00\x0c\x69\x6e\x69\x74\x5f\x70\x61\x73\x73\x69\x76\x65\x00\x01\x0b\x64\x72\x6f\x70\x5f\x61\x63\x74\x69\x76\x65\x00\x02\x0b\x69\x6e\x69\x74\x5f\x61\x63\x74\x69\x76\x65\x00\x03\x0c\x81\x80\x80\x80\x00\x02\x0a\xb7\x80\x80\x80\x00\x04\x85\x80\x80\x80\x00\x00\xfc\x09\x00\x0b\x8c\x80\x80\x80\x00\x00\x41\x00\x41\x00\x20\x00\xfc\x08\x00\x01\x0b\x85\x80\x80\x80\x00\x00\xfc\x09\x01\x0b\x8c\x80\x80\x80\x00\x00\x41\x00\x41\x00\x20\x00\xfc\x08\x01\x01\x0b\x0b\x8b\x80\x80\x80\x00\x02\x01\x01\x78\x02\x01\x41\x00\x0b\x01\x78"); 4 | 5 | // data_drop0.wast:18 6 | run(() => call($1, "init_passive", [1])); 7 | 8 | // data_drop0.wast:19 9 | run(() => call($1, "drop_passive", [])); 10 | 11 | // data_drop0.wast:20 12 | run(() => call($1, "drop_passive", [])); 13 | 14 | // data_drop0.wast:21 15 | assert_return(() => call($1, "init_passive", [0])); 16 | 17 | // data_drop0.wast:22 18 | assert_trap(() => call($1, "init_passive", [1])); 19 | 20 | // data_drop0.wast:23 21 | run(() => call($1, "init_passive", [0])); 22 | 23 | // data_drop0.wast:24 24 | run(() => call($1, "drop_active", [])); 25 | 26 | // data_drop0.wast:25 27 | assert_return(() => call($1, "init_active", [0])); 28 | 29 | // data_drop0.wast:26 30 | assert_trap(() => call($1, "init_active", [1])); 31 | 32 | // data_drop0.wast:27 33 | run(() => call($1, "init_active", [0])); 34 | -------------------------------------------------------------------------------- /test/core/multi-memory/exports0.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // exports0.wast:3 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x05\x83\x80\x80\x80\x00\x01\x00\x00\x07\x85\x80\x80\x80\x00\x01\x01\x61\x02\x00"); 4 | 5 | // exports0.wast:4 6 | let $2 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x05\x83\x80\x80\x80\x00\x01\x00\x00\x07\x89\x80\x80\x80\x00\x02\x01\x61\x02\x00\x01\x62\x02\x00"); 7 | 8 | // exports0.wast:5 9 | let $3 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x05\x85\x80\x80\x80\x00\x02\x00\x00\x00\x00\x07\x89\x80\x80\x80\x00\x02\x01\x61\x02\x00\x01\x62\x02\x01"); 10 | 11 | // exports0.wast:6 12 | let $4 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x05\x8f\x80\x80\x80\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07\xca\x80\x80\x80\x00\x0e\x01\x61\x02\x00\x01\x62\x02\x01\x02\x61\x63\x02\x02\x02\x62\x63\x02\x03\x02\x61\x64\x02\x04\x02\x62\x64\x02\x05\x02\x62\x65\x02\x06\x02\x7a\x61\x02\x00\x02\x7a\x62\x02\x01\x03\x7a\x61\x63\x02\x02\x03\x7a\x62\x63\x02\x03\x03\x7a\x61\x64\x02\x04\x03\x7a\x62\x64\x02\x05\x03\x7a\x62\x65\x02\x06"); 13 | 14 | // exports0.wast:32 15 | let $5 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x05\x85\x80\x80\x80\x00\x02\x00\x06\x00\x03\x07\x89\x80\x80\x80\x00\x02\x01\x61\x02\x00\x01\x62\x02\x01"); 16 | 17 | // exports0.wast:40 18 | let $6 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x05\x8d\x80\x80\x80\x00\x04\x01\x00\x01\x01\x00\x01\x01\x00\x01\x01\x00\x01\x07\x89\x80\x80\x80\x00\x02\x01\x61\x02\x00\x01\x62\x02\x03"); 19 | 20 | // exports0.wast:49 21 | let $7 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x05\x83\x80\x80\x80\x00\x01\x00\x00\x07\x85\x80\x80\x80\x00\x01\x01\x61\x02\x00"); 22 | 23 | // exports0.wast:50 24 | let $8 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x05\x84\x80\x80\x80\x00\x01\x01\x00\x01\x07\x85\x80\x80\x80\x00\x01\x01\x61\x02\x00"); 25 | -------------------------------------------------------------------------------- /test/core/multi-memory/float_exprs1.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // float_exprs1.wast:4 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x87\x80\x80\x80\x00\x01\x60\x02\x7f\x7f\x01\x7d\x03\x83\x80\x80\x80\x00\x02\x00\x00\x05\x9c\x80\x80\x80\x00\x09\x01\x00\x00\x01\x00\x00\x01\x00\x00\x01\x00\x00\x01\x00\x00\x01\x01\x01\x01\x00\x00\x01\x00\x00\x01\x00\x00\x07\xa1\x80\x80\x80\x00\x02\x0d\x66\x33\x32\x2e\x6b\x61\x68\x61\x6e\x5f\x73\x75\x6d\x00\x00\x0d\x66\x33\x32\x2e\x70\x6c\x61\x69\x6e\x5f\x73\x75\x6d\x00\x01\x0a\xec\x80\x80\x80\x00\x02\xb8\x80\x80\x80\x00\x01\x03\x7d\x02\x40\x03\x40\x20\x03\x20\x00\x2a\x42\x05\x00\x20\x04\x93\x22\x04\x92\x22\x02\x20\x03\x93\x20\x04\x93\x21\x04\x20\x00\x41\x04\x6a\x21\x00\x20\x02\x21\x03\x20\x01\x41\x7f\x6a\x22\x01\x0d\x00\x0b\x0b\x20\x02\x0b\xa9\x80\x80\x80\x00\x01\x01\x7d\x02\x40\x03\x40\x20\x02\x20\x00\x2a\x42\x05\x00\x92\x21\x02\x20\x00\x41\x04\x6a\x21\x00\x20\x01\x41\x7f\x6a\x21\x01\x20\x01\x0d\x00\x0b\x0b\x20\x02\x0b\x0b\x88\x88\x80\x80\x00\x01\x02\x05\x41\x00\x0b\x80\x08\xc4\xc5\x57\x24\xa5\x84\xc8\x0b\x6d\xb8\x4b\x2e\xf2\x76\x17\x1c\xca\x4a\x56\x1e\x1b\x6e\x71\x22\x5d\x17\x1e\x6e\xbf\xcd\x14\x5c\xc7\x21\x55\x51\x39\x9c\x1f\xb2\x51\xf0\xa3\x93\xd7\xc1\x2c\xae\x7e\xa8\x28\x3a\x01\x21\xf4\x0a\x58\x93\xf8\x42\x77\x9f\x83\x39\x6a\x5f\xba\xf7\x0a\xd8\x51\x6a\x34\xca\xad\xc6\x34\x0e\xd8\x26\xdc\x4c\x33\x1c\xed\x29\x90\xa8\x78\x0f\xd1\xce\x76\x31\x23\x83\xb8\x35\xe8\xf2\x44\xb0\xd3\xa1\xfc\xbb\x32\xe1\xb0\xba\x69\x44\x09\xd6\xd9\x7d\xff\x2e\xc0\x5a\x36\x14\x33\x14\x3e\xa9\xfa\x87\x6d\x8b\xbc\xce\x9d\xa7\xfd\xc4\xe9\x85\x3f\xdd\xd7\xe1\x18\xa6\x50\x26\x72\x6e\x3f\x73\x0f\xf8\x12\x93\x23\x34\x61\x76\x12\x48\xc0\x9b\x05\x93\xeb\xac\x86\xde\x94\x3e\x55\xe8\x8c\xe8\xdd\xe4\xfc\x95\x47\xbe\x56\x03\x21\x20\x4c\xe6\xbf\x7b\xf6\x7f\xd5\xba\x73\x1c\xc1\x14\x8f\xc4\x27\x96\xb3\xbd\x33\xff\x78\x41\x5f\xc0\x5a\xce\xf6\x67\x6e\x73\x9a\x17\x66\x70\x03\xf8\xce\x27\xa3\x52\xb2\x9f\x3b\xbf\xfb\xae\xed\xd3\x5a\xf8\x37\x57\xf0\xf5\x6e\xef\xb1\x4d\x70\x3d\x54\xa7\x01\x9a\x85\x08\x48\x91\xf5\x9d\x0c\x60\x87\x5b\xd9\x54\x1e\x51\x6d\x88\x8e\x08\x8c\xa5\x71\x3a\x56\x08\x67\x46\x8f\x8f\x13\x2a\x2c\xec\x2c\x1f\xb4\x62\x2b\x6f\x41\x0a\xc4\x65\x42\xa2\x31\x6b\x2c\x7d\x3e\xbb\x75\xac\x86\x97\x30\xd9\x48\xcd\x9a\x1f\x56\xc4\xc6\xe4\x12\xc0\x9d\xfb\xee\x02\x8c\xce\x1c\xf2\x1e\xa1\x78\x23\xdb\xc4\x1e\x49\x03\xd3\x71\xcc\x08\x50\xc5\xd8\x5c\xed\xd5\xb5\x65\xac\xb5\xc9\x21\xd2\xc9\x29\x76\xde\xf0\x30\x1a\x5b\x3c\xf2\x3b\xdb\x3a\x39\x82\x3a\x16\x08\x6f\xa8\xf1\xbe\x69\x69\x99\x71\xa6\x05\xd3\x14\x93\x2a\x16\xf2\x2f\x11\xc7\x7e\x20\xbb\x91\x44\xee\xf8\xe4\x01\x53\xc0\xb9\x7f\xf0\xbf\xf0\x03\x9c\x6d\xb1\xdf\xa2\x44\x01\x6d\x6b\x71\x2b\x5c\xb3\x21\x19\x46\x5e\x8f\xdb\x91\xd3\x7c\x78\x6b\xb7\x12\x00\x8f\xeb\xbd\x8a\xf5\xd4\x2e\xc4\xc1\x1e\xdf\x73\x63\x59\x47\x49\x03\x0a\xb7\xcf\x24\xcf\x9c\x0e\x44\x7a\x9e\x14\xfb\x42\xbf\x9d\x39\x30\x9e\xa0\xab\x2f\xd1\xae\x9e\x6a\x83\x43\xe3\x55\x7d\x85\xbf\x63\x8a\xf8\x96\x10\x1f\xfe\x6d\xe7\x22\x1b\xe1\x69\x46\x8a\x44\xc8\xc8\xf9\x0c\x2b\x19\x07\xa5\x02\x3e\xf2\x30\x10\x9a\x85\x8a\x5f\xef\x81\x45\xa0\x77\xb1\x03\x10\x73\x4b\xae\x98\x9d\x47\xbf\x9a\x2d\x3a\xd5\x0f\x03\x66\xe3\x3d\x53\xd9\x40\xce\x1f\x6f\x32\x2f\x21\x2b\x23\x21\x6c\x62\xd4\xa7\x3e\xa8\xce\x28\x31\x2d\x00\x3d\x67\x5e\xaf\xa0\xcf\x2e\xd2\xb9\x6b\x84\xeb\x69\x08\x3c\x62\x36\xbe\x12\xfd\x36\x7f\x88\x3e\xad\xbc\x0b\xc0\x41\xc4\x50\xb6\xe3\x50\x31\xe8\xce\xe2\x96\x65\x55\x9c\x16\x46\xe6\xb0\x2d\x3a\xe8\x81\x05\xb0\xbf\x34\xf7\xbc\x10\x1c\xfb\xcc\x3c\xf1\x85\x97\x42\x9f\xeb\x14\x8d\x3c\xbf\xd7\x17\x88\x49\x9d\x8b\x2b\xb2\x3a\x83\xd1\x4f\x04\x9e\xa1\x0f\xad\x08\x9d\x54\xaf\xd1\x82\xc3\xec\x32\x2f\x02\x8f\x05\x21\x2d\xa2\xb7\xe4\xf4\x6f\x2e\x81\x2b\x0b\x9c\xfc\xcb\xfe\x74\x02\xf9\xdb\xf4\xf3\xea\x00\xa8\xec\xd1\x99\x74\x26\xdd\xd6\x34\xd5\x25\xb1\x46\xdd\x9c\xaa\x71\xf5\x60\xb0\x88\xc8\xe0\x0b\x59\x5a\x25\x4f\x29\x66\xf9\xe3\x2e\xfe\xe9\xda\xe5\x18\x4f\x27\x62\xf4\xce\xa4\x21\x95\x74\xc7\x57\x64\x27\x9a\x4c\xfd\x54\x7d\x61\xce\xc3\xac\x87\x46\x9c\xfa\xff\x09\xca\x79\x97\x67\x24\x74\xca\xd4\x21\x83\x26\x25\x19\x12\x37\x64\x19\xe5\x65\xe0\x74\x75\x8e\xdd\xc8\xef\x74\xc7\xd8\x21\x2b\x79\x04\x51\x46\x65\x60\x03\x5d\xfa\xd8\xf4\x65\xa4\x9e\x5d\x23\xda\xd7\x8a\x92\x80\xa4\xde\x78\x3c\xf1\x57\x42\x6d\xcd\xc9\x2f\xd5\xa4\x9e\xab\x40\xf4\xcb\x1b\xd7\xa3\xca\xfc\xeb\xa7\x01\xb2\x9a\x69\x4e\x46\x9b\x18\x4e\xdd\x79\xa7\xaa\xa6\x52\x39\x1e\xef\x30\xcc\x9b\xbd\x5b\xee\x4c\x21\x6d\x30\x00\x72\xb0\x46\x5f\x08\xcf\xc5\xb9\xe0\x3e\xc2\xb3\x0c\xdc\x8e\x64\xde\x19\x42\x79\xcf\x43\xea\x43\x5d\x8e\x88\xf7\xab\x15\xdc\x3f\xc8\x67\x20\xdb\xb8\x64\xb1\x47\x1f\xde\xf2\xcb\x3f\x59\x9f\xd8\x46\x90\xdc\xae\x2f\x22\xf9\xe2\x31\x89\xd9\x9c\x1c\x4c\xd3\xa9\x4a\x57\x84\x9c\x9f\xea\x2c\x3c\xae\x3c\xc3\x1e\x8b\xe5\x4e\x17\x01\x25\xdb\x34\x46\x5f\x15\xea\x05\x0c\x7c\xd9\x45\x8c\x19\xd0\x73\x8a\x96\x16\xdd\x44\xf9\x05\xb7\x5b\x71\xb0\xe6\x21\x36\x5f\x75\x89\x91\x73\x75\xab\x7d\xae\xd3\x73\xec\x37\xc6\xea\x55\x75\xef\xea\xab\x8b\x7b\x11\xdc\x6d\x1a\xb2\x6a\xc4\x25\xcf\xaa\xe3\x9f\x49\x49\x89\xcb\x37\x9b\x0a\xa7\x01\x60\x70\xdc\xb7\xc8\x83\xe1\x42\xf5\xbe\xad\x62\x94\xad\x8d\xa1"); 4 | 5 | // float_exprs1.wast:103 6 | run(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\xa5\x80\x80\x80\x00\x07\x60\x00\x00\x60\x01\x7f\x01\x6f\x60\x01\x6f\x01\x7f\x60\x01\x70\x01\x7f\x60\x02\x6f\x6f\x01\x7f\x60\x02\x70\x70\x01\x7f\x60\x02\x7f\x7f\x01\x7d\x02\x89\x81\x80\x80\x00\x06\x06\x6d\x6f\x64\x75\x6c\x65\x0d\x66\x33\x32\x2e\x6b\x61\x68\x61\x6e\x5f\x73\x75\x6d\x00\x06\x08\x73\x70\x65\x63\x74\x65\x73\x74\x09\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x69\x73\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x02\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x69\x73\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x03\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x65\x71\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x04\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x65\x71\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x05\x03\x82\x80\x80\x80\x00\x01\x00\x07\x87\x80\x80\x80\x00\x01\x03\x72\x75\x6e\x00\x06\x0a\x9f\x80\x80\x80\x00\x01\x99\x80\x80\x80\x00\x00\x02\x40\x41\x00\x41\x80\x02\x10\x00\xbc\x43\x0d\x0d\x88\xf3\xbc\x46\x45\x0d\x00\x0f\x0b\x00\x0b", exports($1)), "run", [])); // assert_return(() => call($1, "f32.kahan_sum", [0, 256]), -2.15581382462e+31) 7 | 8 | // float_exprs1.wast:104 9 | run(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\xa5\x80\x80\x80\x00\x07\x60\x00\x00\x60\x01\x7f\x01\x6f\x60\x01\x6f\x01\x7f\x60\x01\x70\x01\x7f\x60\x02\x6f\x6f\x01\x7f\x60\x02\x70\x70\x01\x7f\x60\x02\x7f\x7f\x01\x7d\x02\x89\x81\x80\x80\x00\x06\x06\x6d\x6f\x64\x75\x6c\x65\x0d\x66\x33\x32\x2e\x70\x6c\x61\x69\x6e\x5f\x73\x75\x6d\x00\x06\x08\x73\x70\x65\x63\x74\x65\x73\x74\x09\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x69\x73\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x02\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x69\x73\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x03\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x65\x71\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x04\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x65\x71\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x05\x03\x82\x80\x80\x80\x00\x01\x00\x07\x87\x80\x80\x80\x00\x01\x03\x72\x75\x6e\x00\x06\x0a\x9f\x80\x80\x80\x00\x01\x99\x80\x80\x80\x00\x00\x02\x40\x41\x00\x41\x80\x02\x10\x00\xbc\x43\x1d\x1a\x50\xf3\xbc\x46\x45\x0d\x00\x0f\x0b\x00\x0b", exports($1)), "run", [])); // assert_return(() => call($1, "f32.plain_sum", [0, 256]), -1.64875394721e+31) 10 | -------------------------------------------------------------------------------- /test/core/multi-memory/imports0.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // imports0.wast:1 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x9e\x80\x80\x80\x00\x07\x60\x00\x00\x60\x01\x7f\x00\x60\x01\x7d\x00\x60\x00\x01\x7f\x60\x00\x01\x7d\x60\x01\x7f\x01\x7f\x60\x01\x7e\x01\x7e\x03\x88\x80\x80\x80\x00\x07\x00\x01\x02\x03\x04\x05\x06\x04\x88\x80\x80\x80\x00\x02\x70\x00\x0a\x70\x01\x0a\x14\x05\x86\x80\x80\x80\x00\x02\x00\x02\x01\x02\x04\x06\x94\x80\x80\x80\x00\x03\x7f\x00\x41\x37\x0b\x7d\x00\x43\x00\x00\x30\x42\x0b\x7e\x01\x42\xc2\x00\x0b\x07\xba\x81\x80\x80\x00\x0e\x04\x66\x75\x6e\x63\x00\x00\x08\x66\x75\x6e\x63\x2d\x69\x33\x32\x00\x01\x08\x66\x75\x6e\x63\x2d\x66\x33\x32\x00\x02\x09\x66\x75\x6e\x63\x2d\x3e\x69\x33\x32\x00\x03\x09\x66\x75\x6e\x63\x2d\x3e\x66\x33\x32\x00\x04\x0d\x66\x75\x6e\x63\x2d\x69\x33\x32\x2d\x3e\x69\x33\x32\x00\x05\x0d\x66\x75\x6e\x63\x2d\x69\x36\x34\x2d\x3e\x69\x36\x34\x00\x06\x0a\x67\x6c\x6f\x62\x61\x6c\x2d\x69\x33\x32\x03\x00\x0a\x67\x6c\x6f\x62\x61\x6c\x2d\x66\x33\x32\x03\x01\x0e\x67\x6c\x6f\x62\x61\x6c\x2d\x6d\x75\x74\x2d\x69\x36\x34\x03\x02\x0c\x74\x61\x62\x6c\x65\x2d\x31\x30\x2d\x69\x6e\x66\x01\x00\x0b\x74\x61\x62\x6c\x65\x2d\x31\x30\x2d\x32\x30\x01\x01\x0c\x6d\x65\x6d\x6f\x72\x79\x2d\x32\x2d\x69\x6e\x66\x02\x00\x0a\x6d\x65\x6d\x6f\x72\x79\x2d\x32\x2d\x34\x02\x01\x0a\xbd\x80\x80\x80\x00\x07\x82\x80\x80\x80\x00\x00\x0b\x82\x80\x80\x80\x00\x00\x0b\x82\x80\x80\x80\x00\x00\x0b\x84\x80\x80\x80\x00\x00\x41\x16\x0b\x87\x80\x80\x80\x00\x00\x43\x00\x00\x30\x41\x0b\x84\x80\x80\x80\x00\x00\x20\x00\x0b\x84\x80\x80\x80\x00\x00\x20\x00\x0b"); 4 | 5 | // imports0.wast:18 6 | register("test", $1) 7 | 8 | // imports0.wast:20 9 | assert_unlinkable("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x02\x95\x80\x80\x80\x00\x01\x04\x74\x65\x73\x74\x0c\x6d\x65\x6d\x6f\x72\x79\x2d\x32\x2d\x69\x6e\x66\x00\x00"); 10 | 11 | // imports0.wast:24 12 | assert_unlinkable("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x02\x93\x80\x80\x80\x00\x01\x04\x74\x65\x73\x74\x0a\x6d\x65\x6d\x6f\x72\x79\x2d\x32\x2d\x34\x00\x00"); 13 | 14 | // imports0.wast:29 15 | assert_unlinkable("\x00\x61\x73\x6d\x01\x00\x00\x00\x02\x96\x80\x80\x80\x00\x01\x04\x74\x65\x73\x74\x0c\x6d\x65\x6d\x6f\x72\x79\x2d\x32\x2d\x69\x6e\x66\x03\x7f\x00"); 16 | 17 | // imports0.wast:33 18 | assert_unlinkable("\x00\x61\x73\x6d\x01\x00\x00\x00\x02\x94\x80\x80\x80\x00\x01\x04\x74\x65\x73\x74\x0a\x6d\x65\x6d\x6f\x72\x79\x2d\x32\x2d\x34\x03\x7f\x00"); 19 | 20 | // imports0.wast:38 21 | assert_unlinkable("\x00\x61\x73\x6d\x01\x00\x00\x00\x02\x97\x80\x80\x80\x00\x01\x04\x74\x65\x73\x74\x0c\x6d\x65\x6d\x6f\x72\x79\x2d\x32\x2d\x69\x6e\x66\x01\x70\x00\x0a"); 22 | 23 | // imports0.wast:42 24 | assert_unlinkable("\x00\x61\x73\x6d\x01\x00\x00\x00\x02\x95\x80\x80\x80\x00\x01\x04\x74\x65\x73\x74\x0a\x6d\x65\x6d\x6f\x72\x79\x2d\x32\x2d\x34\x01\x70\x00\x0a"); 25 | -------------------------------------------------------------------------------- /test/core/multi-memory/imports1.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // imports1.wast:1 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x86\x80\x80\x80\x00\x01\x60\x01\x7f\x01\x7f\x02\xd1\x80\x80\x80\x00\x04\x08\x73\x70\x65\x63\x74\x65\x73\x74\x06\x6d\x65\x6d\x6f\x72\x79\x02\x01\x01\x02\x08\x73\x70\x65\x63\x74\x65\x73\x74\x06\x6d\x65\x6d\x6f\x72\x79\x02\x01\x01\x02\x08\x73\x70\x65\x63\x74\x65\x73\x74\x06\x6d\x65\x6d\x6f\x72\x79\x02\x01\x01\x02\x08\x73\x70\x65\x63\x74\x65\x73\x74\x06\x6d\x65\x6d\x6f\x72\x79\x02\x01\x01\x02\x03\x82\x80\x80\x80\x00\x01\x00\x07\x88\x80\x80\x80\x00\x01\x04\x6c\x6f\x61\x64\x00\x00\x0a\x8e\x80\x80\x80\x00\x01\x88\x80\x80\x80\x00\x00\x20\x00\x28\x42\x02\x00\x0b\x0b\x88\x80\x80\x80\x00\x01\x02\x02\x41\x0a\x0b\x01\x10"); 4 | 5 | // imports1.wast:12 6 | assert_return(() => call($1, "load", [0]), 0); 7 | 8 | // imports1.wast:13 9 | assert_return(() => call($1, "load", [10]), 16); 10 | 11 | // imports1.wast:14 12 | assert_return(() => call($1, "load", [8]), 1_048_576); 13 | 14 | // imports1.wast:15 15 | assert_trap(() => call($1, "load", [1_000_000])); 16 | -------------------------------------------------------------------------------- /test/core/multi-memory/imports2.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // imports2.wast:1 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x05\x89\x80\x80\x80\x00\x03\x01\x00\x00\x00\x02\x01\x02\x04\x07\xa1\x80\x80\x80\x00\x03\x01\x7a\x02\x00\x0c\x6d\x65\x6d\x6f\x72\x79\x2d\x32\x2d\x69\x6e\x66\x02\x01\x0a\x6d\x65\x6d\x6f\x72\x79\x2d\x32\x2d\x34\x02\x02"); 4 | 5 | // imports2.wast:7 6 | register("test", $1) 7 | 8 | // imports2.wast:9 9 | let $2 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x86\x80\x80\x80\x00\x01\x60\x01\x7f\x01\x7f\x02\x9f\x80\x80\x80\x00\x02\x04\x74\x65\x73\x74\x01\x7a\x02\x00\x00\x08\x73\x70\x65\x63\x74\x65\x73\x74\x06\x6d\x65\x6d\x6f\x72\x79\x02\x01\x01\x02\x03\x82\x80\x80\x80\x00\x01\x00\x07\x88\x80\x80\x80\x00\x01\x04\x6c\x6f\x61\x64\x00\x00\x0a\x8e\x80\x80\x80\x00\x01\x88\x80\x80\x80\x00\x00\x20\x00\x28\x42\x01\x00\x0b\x0b\x88\x80\x80\x80\x00\x01\x02\x01\x41\x0a\x0b\x01\x10"); 10 | 11 | // imports2.wast:17 12 | assert_return(() => call($2, "load", [0]), 0); 13 | 14 | // imports2.wast:18 15 | assert_return(() => call($2, "load", [10]), 16); 16 | 17 | // imports2.wast:19 18 | assert_return(() => call($2, "load", [8]), 1_048_576); 19 | 20 | // imports2.wast:20 21 | assert_trap(() => call($2, "load", [1_000_000])); 22 | 23 | // imports2.wast:22 24 | let $3 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x86\x80\x80\x80\x00\x01\x60\x01\x7f\x01\x7f\x02\x95\x80\x80\x80\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x06\x6d\x65\x6d\x6f\x72\x79\x02\x01\x01\x02\x03\x82\x80\x80\x80\x00\x01\x00\x07\x88\x80\x80\x80\x00\x01\x04\x6c\x6f\x61\x64\x00\x00\x0a\x8d\x80\x80\x80\x00\x01\x87\x80\x80\x80\x00\x00\x20\x00\x28\x02\x00\x0b\x0b\x87\x80\x80\x80\x00\x01\x00\x41\x0a\x0b\x01\x10"); 25 | 26 | // imports2.wast:28 27 | assert_return(() => call($3, "load", [0]), 0); 28 | 29 | // imports2.wast:29 30 | assert_return(() => call($3, "load", [10]), 16); 31 | 32 | // imports2.wast:30 33 | assert_return(() => call($3, "load", [8]), 1_048_576); 34 | 35 | // imports2.wast:31 36 | assert_trap(() => call($3, "load", [1_000_000])); 37 | 38 | // imports2.wast:33 39 | let $4 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x02\xc0\x80\x80\x80\x00\x03\x04\x74\x65\x73\x74\x0c\x6d\x65\x6d\x6f\x72\x79\x2d\x32\x2d\x69\x6e\x66\x02\x00\x02\x04\x74\x65\x73\x74\x0c\x6d\x65\x6d\x6f\x72\x79\x2d\x32\x2d\x69\x6e\x66\x02\x00\x01\x04\x74\x65\x73\x74\x0c\x6d\x65\x6d\x6f\x72\x79\x2d\x32\x2d\x69\x6e\x66\x02\x00\x00"); 40 | 41 | // imports2.wast:39 42 | let $5 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x02\xf7\x80\x80\x80\x00\x06\x08\x73\x70\x65\x63\x74\x65\x73\x74\x06\x6d\x65\x6d\x6f\x72\x79\x02\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x06\x6d\x65\x6d\x6f\x72\x79\x02\x00\x00\x08\x73\x70\x65\x63\x74\x65\x73\x74\x06\x6d\x65\x6d\x6f\x72\x79\x02\x01\x01\x02\x08\x73\x70\x65\x63\x74\x65\x73\x74\x06\x6d\x65\x6d\x6f\x72\x79\x02\x01\x00\x02\x08\x73\x70\x65\x63\x74\x65\x73\x74\x06\x6d\x65\x6d\x6f\x72\x79\x02\x01\x01\x03\x08\x73\x70\x65\x63\x74\x65\x73\x74\x06\x6d\x65\x6d\x6f\x72\x79\x02\x01\x00\x03"); 43 | 44 | // imports2.wast:48 45 | assert_unlinkable("\x00\x61\x73\x6d\x01\x00\x00\x00\x02\x91\x80\x80\x80\x00\x01\x04\x74\x65\x73\x74\x07\x75\x6e\x6b\x6e\x6f\x77\x6e\x02\x00\x01"); 46 | 47 | // imports2.wast:52 48 | assert_unlinkable("\x00\x61\x73\x6d\x01\x00\x00\x00\x02\x95\x80\x80\x80\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x07\x75\x6e\x6b\x6e\x6f\x77\x6e\x02\x00\x01"); 49 | 50 | // imports2.wast:57 51 | assert_unlinkable("\x00\x61\x73\x6d\x01\x00\x00\x00\x02\x96\x80\x80\x80\x00\x01\x04\x74\x65\x73\x74\x0c\x6d\x65\x6d\x6f\x72\x79\x2d\x32\x2d\x69\x6e\x66\x02\x00\x03"); 52 | 53 | // imports2.wast:61 54 | assert_unlinkable("\x00\x61\x73\x6d\x01\x00\x00\x00\x02\x97\x80\x80\x80\x00\x01\x04\x74\x65\x73\x74\x0c\x6d\x65\x6d\x6f\x72\x79\x2d\x32\x2d\x69\x6e\x66\x02\x01\x02\x03"); 55 | 56 | // imports2.wast:65 57 | assert_unlinkable("\x00\x61\x73\x6d\x01\x00\x00\x00\x02\x94\x80\x80\x80\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x06\x6d\x65\x6d\x6f\x72\x79\x02\x00\x02"); 58 | 59 | // imports2.wast:69 60 | assert_unlinkable("\x00\x61\x73\x6d\x01\x00\x00\x00\x02\x95\x80\x80\x80\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x06\x6d\x65\x6d\x6f\x72\x79\x02\x01\x01\x01"); 61 | -------------------------------------------------------------------------------- /test/core/multi-memory/imports3.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // imports3.wast:1 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x9e\x80\x80\x80\x00\x07\x60\x00\x00\x60\x01\x7f\x00\x60\x01\x7d\x00\x60\x00\x01\x7f\x60\x00\x01\x7d\x60\x01\x7f\x01\x7f\x60\x01\x7e\x01\x7e\x03\x88\x80\x80\x80\x00\x07\x00\x01\x02\x03\x04\x05\x06\x04\x88\x80\x80\x80\x00\x02\x70\x00\x0a\x70\x01\x0a\x14\x05\x86\x80\x80\x80\x00\x02\x00\x02\x01\x02\x04\x06\x94\x80\x80\x80\x00\x03\x7f\x00\x41\x37\x0b\x7d\x00\x43\x00\x00\x30\x42\x0b\x7e\x01\x42\xc2\x00\x0b\x07\xba\x81\x80\x80\x00\x0e\x04\x66\x75\x6e\x63\x00\x00\x08\x66\x75\x6e\x63\x2d\x69\x33\x32\x00\x01\x08\x66\x75\x6e\x63\x2d\x66\x33\x32\x00\x02\x09\x66\x75\x6e\x63\x2d\x3e\x69\x33\x32\x00\x03\x09\x66\x75\x6e\x63\x2d\x3e\x66\x33\x32\x00\x04\x0d\x66\x75\x6e\x63\x2d\x69\x33\x32\x2d\x3e\x69\x33\x32\x00\x05\x0d\x66\x75\x6e\x63\x2d\x69\x36\x34\x2d\x3e\x69\x36\x34\x00\x06\x0a\x67\x6c\x6f\x62\x61\x6c\x2d\x69\x33\x32\x03\x00\x0a\x67\x6c\x6f\x62\x61\x6c\x2d\x66\x33\x32\x03\x01\x0e\x67\x6c\x6f\x62\x61\x6c\x2d\x6d\x75\x74\x2d\x69\x36\x34\x03\x02\x0c\x74\x61\x62\x6c\x65\x2d\x31\x30\x2d\x69\x6e\x66\x01\x00\x0b\x74\x61\x62\x6c\x65\x2d\x31\x30\x2d\x32\x30\x01\x01\x0c\x6d\x65\x6d\x6f\x72\x79\x2d\x32\x2d\x69\x6e\x66\x02\x00\x0a\x6d\x65\x6d\x6f\x72\x79\x2d\x32\x2d\x34\x02\x01\x0a\xbd\x80\x80\x80\x00\x07\x82\x80\x80\x80\x00\x00\x0b\x82\x80\x80\x80\x00\x00\x0b\x82\x80\x80\x80\x00\x00\x0b\x84\x80\x80\x80\x00\x00\x41\x16\x0b\x87\x80\x80\x80\x00\x00\x43\x00\x00\x30\x41\x0b\x84\x80\x80\x80\x00\x00\x20\x00\x0b\x84\x80\x80\x80\x00\x00\x20\x00\x0b"); 4 | 5 | // imports3.wast:18 6 | register("test", $1) 7 | 8 | // imports3.wast:19 9 | assert_unlinkable("\x00\x61\x73\x6d\x01\x00\x00\x00\x02\xa5\x80\x80\x80\x00\x02\x04\x74\x65\x73\x74\x0a\x6d\x65\x6d\x6f\x72\x79\x2d\x32\x2d\x34\x02\x00\x01\x04\x74\x65\x73\x74\x08\x66\x75\x6e\x63\x2d\x69\x33\x32\x02\x00\x01"); 10 | 11 | // imports3.wast:26 12 | assert_unlinkable("\x00\x61\x73\x6d\x01\x00\x00\x00\x02\xa7\x80\x80\x80\x00\x02\x04\x74\x65\x73\x74\x0a\x6d\x65\x6d\x6f\x72\x79\x2d\x32\x2d\x34\x02\x00\x01\x04\x74\x65\x73\x74\x0a\x67\x6c\x6f\x62\x61\x6c\x2d\x69\x33\x32\x02\x00\x01"); 13 | 14 | // imports3.wast:33 15 | assert_unlinkable("\x00\x61\x73\x6d\x01\x00\x00\x00\x02\xa9\x80\x80\x80\x00\x02\x04\x74\x65\x73\x74\x0a\x6d\x65\x6d\x6f\x72\x79\x2d\x32\x2d\x34\x02\x00\x01\x04\x74\x65\x73\x74\x0c\x74\x61\x62\x6c\x65\x2d\x31\x30\x2d\x69\x6e\x66\x02\x00\x01"); 16 | 17 | // imports3.wast:40 18 | assert_unlinkable("\x00\x61\x73\x6d\x01\x00\x00\x00\x02\xaa\x80\x80\x80\x00\x02\x04\x74\x65\x73\x74\x0a\x6d\x65\x6d\x6f\x72\x79\x2d\x32\x2d\x34\x02\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x09\x70\x72\x69\x6e\x74\x5f\x69\x33\x32\x02\x00\x01"); 19 | 20 | // imports3.wast:47 21 | assert_unlinkable("\x00\x61\x73\x6d\x01\x00\x00\x00\x02\xab\x80\x80\x80\x00\x02\x04\x74\x65\x73\x74\x0a\x6d\x65\x6d\x6f\x72\x79\x2d\x32\x2d\x34\x02\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x67\x6c\x6f\x62\x61\x6c\x5f\x69\x33\x32\x02\x00\x01"); 22 | 23 | // imports3.wast:54 24 | assert_unlinkable("\x00\x61\x73\x6d\x01\x00\x00\x00\x02\xa6\x80\x80\x80\x00\x02\x04\x74\x65\x73\x74\x0a\x6d\x65\x6d\x6f\x72\x79\x2d\x32\x2d\x34\x02\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x05\x74\x61\x62\x6c\x65\x02\x00\x01"); 25 | 26 | // imports3.wast:62 27 | assert_unlinkable("\x00\x61\x73\x6d\x01\x00\x00\x00\x02\xa7\x80\x80\x80\x00\x02\x04\x74\x65\x73\x74\x0a\x6d\x65\x6d\x6f\x72\x79\x2d\x32\x2d\x34\x02\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x06\x6d\x65\x6d\x6f\x72\x79\x02\x00\x02"); 28 | 29 | // imports3.wast:69 30 | assert_unlinkable("\x00\x61\x73\x6d\x01\x00\x00\x00\x02\xa8\x80\x80\x80\x00\x02\x04\x74\x65\x73\x74\x0a\x6d\x65\x6d\x6f\x72\x79\x2d\x32\x2d\x34\x02\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x06\x6d\x65\x6d\x6f\x72\x79\x02\x01\x01\x01"); 31 | -------------------------------------------------------------------------------- /test/core/multi-memory/imports4.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // imports4.wast:1 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x05\x86\x80\x80\x80\x00\x02\x00\x02\x01\x02\x04\x07\x9d\x80\x80\x80\x00\x02\x0c\x6d\x65\x6d\x6f\x72\x79\x2d\x32\x2d\x69\x6e\x66\x02\x00\x0a\x6d\x65\x6d\x6f\x72\x79\x2d\x32\x2d\x34\x02\x01"); 4 | 5 | // imports4.wast:6 6 | register("test", $1) 7 | 8 | // imports4.wast:8 9 | let $2 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x86\x80\x80\x80\x00\x01\x60\x01\x7f\x01\x7f\x02\xa8\x80\x80\x80\x00\x02\x04\x74\x65\x73\x74\x0a\x6d\x65\x6d\x6f\x72\x79\x2d\x32\x2d\x34\x02\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x06\x6d\x65\x6d\x6f\x72\x79\x02\x01\x00\x03\x03\x82\x80\x80\x80\x00\x01\x00\x07\x88\x80\x80\x80\x00\x01\x04\x67\x72\x6f\x77\x00\x00\x0a\x8c\x80\x80\x80\x00\x01\x86\x80\x80\x80\x00\x00\x20\x00\x40\x01\x0b"); 10 | 11 | // imports4.wast:13 12 | assert_return(() => call($2, "grow", [0]), 1); 13 | 14 | // imports4.wast:14 15 | assert_return(() => call($2, "grow", [1]), 1); 16 | 17 | // imports4.wast:15 18 | assert_return(() => call($2, "grow", [0]), 2); 19 | 20 | // imports4.wast:16 21 | assert_return(() => call($2, "grow", [1]), -1); 22 | 23 | // imports4.wast:17 24 | assert_return(() => call($2, "grow", [0]), 2); 25 | 26 | // imports4.wast:19 27 | let $3 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x85\x80\x80\x80\x00\x01\x60\x00\x01\x7f\x03\x82\x80\x80\x80\x00\x01\x00\x05\x87\x80\x80\x80\x00\x03\x00\x00\x00\x00\x00\x01\x07\x91\x80\x80\x80\x00\x02\x06\x6d\x65\x6d\x6f\x72\x79\x02\x02\x04\x67\x72\x6f\x77\x00\x00\x0a\x8c\x80\x80\x80\x00\x01\x86\x80\x80\x80\x00\x00\x41\x01\x40\x02\x0b"); 28 | let $Mgm = $3; 29 | 30 | // imports4.wast:25 31 | register("grown-memory", $Mgm) 32 | 33 | // imports4.wast:26 34 | assert_return(() => call($Mgm, "grow", []), 1); 35 | 36 | // imports4.wast:28 37 | let $4 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x85\x80\x80\x80\x00\x01\x60\x00\x01\x7f\x02\xab\x80\x80\x80\x00\x02\x04\x74\x65\x73\x74\x0a\x6d\x65\x6d\x6f\x72\x79\x2d\x32\x2d\x34\x02\x00\x01\x0c\x67\x72\x6f\x77\x6e\x2d\x6d\x65\x6d\x6f\x72\x79\x06\x6d\x65\x6d\x6f\x72\x79\x02\x00\x02\x03\x82\x80\x80\x80\x00\x01\x00\x05\x85\x80\x80\x80\x00\x02\x00\x00\x00\x00\x07\x91\x80\x80\x80\x00\x02\x06\x6d\x65\x6d\x6f\x72\x79\x02\x01\x04\x67\x72\x6f\x77\x00\x00\x0a\x8c\x80\x80\x80\x00\x01\x86\x80\x80\x80\x00\x00\x41\x01\x40\x01\x0b"); 38 | let $Mgim1 = $4; 39 | 40 | // imports4.wast:36 41 | register("grown-imported-memory", $Mgim1) 42 | 43 | // imports4.wast:37 44 | assert_return(() => call($Mgim1, "grow", []), 2); 45 | 46 | // imports4.wast:39 47 | let $5 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x85\x80\x80\x80\x00\x01\x60\x00\x01\x7f\x02\xb4\x80\x80\x80\x00\x02\x04\x74\x65\x73\x74\x0a\x6d\x65\x6d\x6f\x72\x79\x2d\x32\x2d\x34\x02\x00\x01\x15\x67\x72\x6f\x77\x6e\x2d\x69\x6d\x70\x6f\x72\x74\x65\x64\x2d\x6d\x65\x6d\x6f\x72\x79\x06\x6d\x65\x6d\x6f\x72\x79\x02\x00\x03\x03\x82\x80\x80\x80\x00\x01\x00\x05\x85\x80\x80\x80\x00\x02\x00\x00\x00\x00\x07\x88\x80\x80\x80\x00\x01\x04\x73\x69\x7a\x65\x00\x00\x0a\x8a\x80\x80\x80\x00\x01\x84\x80\x80\x80\x00\x00\x3f\x01\x0b"); 48 | let $Mgim2 = $5; 49 | 50 | // imports4.wast:47 51 | assert_return(() => call($Mgim2, "size", []), 3); 52 | -------------------------------------------------------------------------------- /test/core/multi-memory/linking0.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // linking0.wast:1 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x8d\x80\x80\x80\x00\x03\x60\x00\x01\x7f\x60\x00\x00\x60\x01\x7f\x01\x7f\x03\x84\x80\x80\x80\x00\x03\x00\x00\x02\x04\x84\x80\x80\x80\x00\x01\x70\x00\x0a\x07\x92\x80\x80\x80\x00\x03\x03\x74\x61\x62\x01\x00\x01\x68\x00\x01\x04\x63\x61\x6c\x6c\x00\x02\x09\x8a\x80\x80\x80\x00\x01\x00\x41\x02\x0b\x04\x00\x00\x00\x00\x0a\x9f\x80\x80\x80\x00\x03\x84\x80\x80\x80\x00\x00\x41\x04\x0b\x84\x80\x80\x80\x00\x00\x41\x7c\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x11\x00\x00\x0b"); 4 | let $Mt = $1; 5 | 6 | // linking0.wast:14 7 | register("Mt", $Mt) 8 | 9 | // linking0.wast:16 10 | assert_unlinkable("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x85\x80\x80\x80\x00\x01\x60\x00\x01\x7f\x02\xa9\x80\x80\x80\x00\x03\x02\x4d\x74\x03\x74\x61\x62\x01\x70\x00\x0a\x08\x73\x70\x65\x63\x74\x65\x73\x74\x06\x6d\x65\x6d\x6f\x72\x79\x02\x00\x01\x02\x4d\x74\x03\x6d\x65\x6d\x02\x00\x01\x03\x82\x80\x80\x80\x00\x01\x00\x09\x8d\x80\x80\x80\x00\x02\x00\x41\x07\x0b\x01\x00\x00\x41\x09\x0b\x01\x00\x0a\x8a\x80\x80\x80\x00\x01\x84\x80\x80\x80\x00\x00\x41\x00\x0b"); 11 | 12 | // linking0.wast:27 13 | assert_trap(() => call($Mt, "call", [7])); 14 | 15 | // linking0.wast:30 16 | assert_uninstantiable("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x85\x80\x80\x80\x00\x01\x60\x00\x01\x7f\x02\x8c\x80\x80\x80\x00\x01\x02\x4d\x74\x03\x74\x61\x62\x01\x70\x00\x0a\x03\x82\x80\x80\x80\x00\x01\x00\x05\x87\x80\x80\x80\x00\x03\x00\x00\x00\x01\x00\x00\x09\x87\x80\x80\x80\x00\x01\x00\x41\x07\x0b\x01\x00\x0a\x8a\x80\x80\x80\x00\x01\x84\x80\x80\x80\x00\x00\x41\x00\x0b\x0b\x89\x80\x80\x80\x00\x01\x00\x41\x80\x80\x04\x0b\x01\x64"); 17 | 18 | // linking0.wast:42 19 | assert_return(() => call($Mt, "call", [7]), 0); 20 | -------------------------------------------------------------------------------- /test/core/multi-memory/linking1.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // linking1.wast:1 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x86\x80\x80\x80\x00\x01\x60\x01\x7f\x01\x7f\x03\x82\x80\x80\x80\x00\x01\x00\x05\x8a\x80\x80\x80\x00\x03\x01\x00\x00\x01\x01\x05\x01\x00\x00\x07\x9d\x80\x80\x80\x00\x04\x04\x6d\x65\x6d\x30\x02\x00\x04\x6d\x65\x6d\x31\x02\x01\x04\x6d\x65\x6d\x32\x02\x02\x04\x6c\x6f\x61\x64\x00\x00\x0a\x8e\x80\x80\x80\x00\x01\x88\x80\x80\x80\x00\x00\x20\x00\x2d\x40\x01\x00\x0b\x0b\x91\x80\x80\x80\x00\x01\x02\x01\x41\x0a\x0b\x0a\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09"); 4 | let $Mm = $1; 5 | 6 | // linking1.wast:12 7 | register("Mm", $Mm) 8 | 9 | // linking1.wast:14 10 | let $2 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x86\x80\x80\x80\x00\x01\x60\x01\x7f\x01\x7f\x02\x96\x80\x80\x80\x00\x02\x02\x4d\x6d\x04\x6c\x6f\x61\x64\x00\x00\x02\x4d\x6d\x04\x6d\x65\x6d\x30\x02\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x05\x83\x80\x80\x80\x00\x01\x00\x01\x07\x92\x80\x80\x80\x00\x02\x07\x4d\x6d\x2e\x6c\x6f\x61\x64\x00\x00\x04\x6c\x6f\x61\x64\x00\x01\x0a\x8e\x80\x80\x80\x00\x01\x88\x80\x80\x80\x00\x00\x20\x00\x2d\x40\x01\x00\x0b\x0b\x8d\x80\x80\x80\x00\x01\x02\x01\x41\x0a\x0b\x06\xf0\xf1\xf2\xf3\xf4\xf5"); 11 | let $Nm = $2; 12 | 13 | // linking1.wast:27 14 | assert_return(() => call($Mm, "load", [12]), 2); 15 | 16 | // linking1.wast:28 17 | assert_return(() => call($Nm, "Mm.load", [12]), 2); 18 | 19 | // linking1.wast:29 20 | assert_return(() => call($Nm, "load", [12]), 242); 21 | 22 | // linking1.wast:31 23 | let $3 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x86\x80\x80\x80\x00\x01\x60\x01\x7f\x01\x7f\x02\x8c\x80\x80\x80\x00\x01\x02\x4d\x6d\x04\x6d\x65\x6d\x31\x02\x00\x01\x03\x82\x80\x80\x80\x00\x01\x00\x07\x88\x80\x80\x80\x00\x01\x04\x6c\x6f\x61\x64\x00\x00\x0a\x8d\x80\x80\x80\x00\x01\x87\x80\x80\x80\x00\x00\x20\x00\x2d\x00\x00\x0b\x0b\x8e\x80\x80\x80\x00\x01\x00\x41\x05\x0b\x08\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7"); 24 | let $Om = $3; 25 | 26 | // linking1.wast:40 27 | assert_return(() => call($Mm, "load", [12]), 167); 28 | 29 | // linking1.wast:41 30 | assert_return(() => call($Nm, "Mm.load", [12]), 167); 31 | 32 | // linking1.wast:42 33 | assert_return(() => call($Nm, "load", [12]), 242); 34 | 35 | // linking1.wast:43 36 | assert_return(() => call($Om, "load", [12]), 167); 37 | 38 | // linking1.wast:45 39 | let $4 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x02\x8c\x80\x80\x80\x00\x01\x02\x4d\x6d\x04\x6d\x65\x6d\x31\x02\x00\x00\x0b\x89\x80\x80\x80\x00\x01\x00\x41\xff\xff\x03\x0b\x01\x61"); 40 | 41 | // linking1.wast:50 42 | assert_uninstantiable("\x00\x61\x73\x6d\x01\x00\x00\x00\x02\x8c\x80\x80\x80\x00\x01\x02\x4d\x6d\x04\x6d\x65\x6d\x30\x02\x00\x00\x0b\x89\x80\x80\x80\x00\x01\x00\x41\xff\xff\x03\x0b\x01\x61"); 43 | 44 | // linking1.wast:58 45 | assert_uninstantiable("\x00\x61\x73\x6d\x01\x00\x00\x00\x02\x8c\x80\x80\x80\x00\x01\x02\x4d\x6d\x04\x6d\x65\x6d\x31\x02\x00\x00\x0b\x89\x80\x80\x80\x00\x01\x00\x41\x80\x80\x04\x0b\x01\x61"); 46 | -------------------------------------------------------------------------------- /test/core/multi-memory/linking2.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // linking2.wast:1 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x86\x80\x80\x80\x00\x01\x60\x01\x7f\x01\x7f\x03\x82\x80\x80\x80\x00\x01\x00\x05\x8a\x80\x80\x80\x00\x03\x01\x00\x00\x01\x01\x05\x01\x00\x00\x07\x9d\x80\x80\x80\x00\x04\x04\x6d\x65\x6d\x30\x02\x00\x04\x6d\x65\x6d\x31\x02\x01\x04\x6d\x65\x6d\x32\x02\x02\x04\x6c\x6f\x61\x64\x00\x00\x0a\x8e\x80\x80\x80\x00\x01\x88\x80\x80\x80\x00\x00\x20\x00\x2d\x40\x01\x00\x0b\x0b\x91\x80\x80\x80\x00\x01\x02\x01\x41\x0a\x0b\x0a\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09"); 4 | let $Mm = $1; 5 | 6 | // linking2.wast:12 7 | register("Mm", $Mm) 8 | 9 | // linking2.wast:14 10 | let $2 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x86\x80\x80\x80\x00\x01\x60\x01\x7f\x01\x7f\x02\x8d\x80\x80\x80\x00\x01\x02\x4d\x6d\x04\x6d\x65\x6d\x31\x02\x01\x01\x08\x03\x82\x80\x80\x80\x00\x01\x00\x07\x88\x80\x80\x80\x00\x01\x04\x67\x72\x6f\x77\x00\x00\x0a\x8c\x80\x80\x80\x00\x01\x86\x80\x80\x80\x00\x00\x20\x00\x40\x00\x0b"); 11 | let $Pm = $2; 12 | 13 | // linking2.wast:22 14 | assert_return(() => call($Pm, "grow", [0]), 1); 15 | 16 | // linking2.wast:23 17 | assert_return(() => call($Pm, "grow", [2]), 1); 18 | 19 | // linking2.wast:24 20 | assert_return(() => call($Pm, "grow", [0]), 3); 21 | 22 | // linking2.wast:25 23 | assert_return(() => call($Pm, "grow", [1]), 3); 24 | 25 | // linking2.wast:26 26 | assert_return(() => call($Pm, "grow", [1]), 4); 27 | 28 | // linking2.wast:27 29 | assert_return(() => call($Pm, "grow", [0]), 5); 30 | 31 | // linking2.wast:28 32 | assert_return(() => call($Pm, "grow", [1]), -1); 33 | 34 | // linking2.wast:29 35 | assert_return(() => call($Pm, "grow", [0]), 5); 36 | -------------------------------------------------------------------------------- /test/core/multi-memory/linking3.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // linking3.wast:1 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x86\x80\x80\x80\x00\x01\x60\x01\x7f\x01\x7f\x03\x82\x80\x80\x80\x00\x01\x00\x05\x8a\x80\x80\x80\x00\x03\x01\x00\x00\x01\x05\x05\x01\x00\x00\x07\x9d\x80\x80\x80\x00\x04\x04\x6d\x65\x6d\x30\x02\x00\x04\x6d\x65\x6d\x31\x02\x01\x04\x6d\x65\x6d\x32\x02\x02\x04\x6c\x6f\x61\x64\x00\x00\x0a\x8e\x80\x80\x80\x00\x01\x88\x80\x80\x80\x00\x00\x20\x00\x2d\x40\x01\x00\x0b\x0b\x91\x80\x80\x80\x00\x01\x02\x01\x41\x0a\x0b\x0a\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09"); 4 | let $Mm = $1; 5 | 6 | // linking3.wast:12 7 | register("Mm", $Mm) 8 | 9 | // linking3.wast:14 10 | assert_unlinkable("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x02\xa8\x80\x80\x80\x00\x03\x08\x73\x70\x65\x63\x74\x65\x73\x74\x05\x70\x72\x69\x6e\x74\x00\x00\x02\x4d\x6d\x04\x6d\x65\x6d\x31\x02\x00\x01\x02\x4d\x6d\x03\x74\x61\x62\x01\x70\x00\x00\x0b\x89\x80\x80\x80\x00\x01\x00\x41\x00\x0b\x03\x61\x62\x63"); 11 | 12 | // linking3.wast:23 13 | assert_return(() => call($Mm, "load", [0]), 0); 14 | 15 | // linking3.wast:27 16 | assert_uninstantiable("\x00\x61\x73\x6d\x01\x00\x00\x00\x02\x8c\x80\x80\x80\x00\x01\x02\x4d\x6d\x04\x6d\x65\x6d\x31\x02\x00\x01\x0b\xa2\x80\x80\x80\x00\x02\x00\x41\x00\x0b\x03\x61\x62\x63\x00\x41\xf6\xff\x13\x0b\x12\x7a\x7a\x7a\x7a\x7a\x7a\x7a\x7a\x7a\x7a\x7a\x7a\x7a\x7a\x7a\x7a\x7a\x7a"); 17 | 18 | // linking3.wast:36 19 | assert_return(() => call($Mm, "load", [0]), 97); 20 | 21 | // linking3.wast:37 22 | assert_return(() => call($Mm, "load", [327_670]), 0); 23 | 24 | // linking3.wast:39 25 | assert_uninstantiable("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x02\x8c\x80\x80\x80\x00\x01\x02\x4d\x6d\x04\x6d\x65\x6d\x31\x02\x00\x01\x03\x82\x80\x80\x80\x00\x01\x00\x04\x84\x80\x80\x80\x00\x01\x70\x00\x00\x09\x87\x80\x80\x80\x00\x01\x00\x41\x00\x0b\x01\x00\x0a\x88\x80\x80\x80\x00\x01\x82\x80\x80\x80\x00\x00\x0b\x0b\x89\x80\x80\x80\x00\x01\x00\x41\x00\x0b\x03\x61\x62\x63"); 26 | 27 | // linking3.wast:49 28 | assert_return(() => call($Mm, "load", [0]), 97); 29 | 30 | // linking3.wast:52 31 | let $2 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x85\x80\x80\x80\x00\x01\x60\x00\x01\x7f\x03\x83\x80\x80\x80\x00\x02\x00\x00\x04\x84\x80\x80\x80\x00\x01\x70\x00\x01\x05\x83\x80\x80\x80\x00\x01\x00\x01\x07\xb1\x80\x80\x80\x00\x04\x06\x6d\x65\x6d\x6f\x72\x79\x02\x00\x05\x74\x61\x62\x6c\x65\x01\x00\x0d\x67\x65\x74\x20\x6d\x65\x6d\x6f\x72\x79\x5b\x30\x5d\x00\x00\x0c\x67\x65\x74\x20\x74\x61\x62\x6c\x65\x5b\x30\x5d\x00\x01\x0a\x99\x80\x80\x80\x00\x02\x87\x80\x80\x80\x00\x00\x41\x00\x2d\x00\x00\x0b\x87\x80\x80\x80\x00\x00\x41\x00\x11\x00\x00\x0b"); 32 | let $Ms = $2; 33 | 34 | // linking3.wast:63 35 | register("Ms", $Ms) 36 | 37 | // linking3.wast:65 38 | assert_uninstantiable("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x88\x80\x80\x80\x00\x02\x60\x00\x01\x7f\x60\x00\x00\x02\x9b\x80\x80\x80\x00\x02\x02\x4d\x73\x06\x6d\x65\x6d\x6f\x72\x79\x02\x00\x01\x02\x4d\x73\x05\x74\x61\x62\x6c\x65\x01\x70\x00\x01\x03\x83\x80\x80\x80\x00\x02\x00\x01\x08\x81\x80\x80\x80\x00\x01\x09\x87\x80\x80\x80\x00\x01\x00\x41\x00\x0b\x01\x00\x0a\x94\x80\x80\x80\x00\x02\x86\x80\x80\x80\x00\x00\x41\xad\xbd\x03\x0b\x83\x80\x80\x80\x00\x00\x00\x0b\x0b\x8b\x80\x80\x80\x00\x01\x00\x41\x00\x0b\x05\x68\x65\x6c\x6c\x6f"); 39 | 40 | // linking3.wast:82 41 | assert_return(() => call($Ms, "get memory[0]", []), 104); 42 | 43 | // linking3.wast:83 44 | assert_return(() => call($Ms, "get table[0]", []), 57_005); 45 | -------------------------------------------------------------------------------- /test/core/multi-memory/load0.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // load0.wast:3 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x86\x80\x80\x80\x00\x01\x60\x01\x7f\x01\x7e\x03\x83\x80\x80\x80\x00\x02\x00\x00\x05\x85\x80\x80\x80\x00\x02\x00\x01\x00\x01\x07\x91\x80\x80\x80\x00\x02\x05\x6c\x6f\x61\x64\x31\x00\x00\x05\x6c\x6f\x61\x64\x32\x00\x01\x0a\x9a\x80\x80\x80\x00\x02\x87\x80\x80\x80\x00\x00\x20\x00\x29\x03\x00\x0b\x88\x80\x80\x80\x00\x00\x20\x00\x29\x43\x01\x00\x0b\x0b\x8e\x80\x80\x80\x00\x02\x00\x41\x00\x0b\x01\x01\x02\x01\x41\x00\x0b\x01\x02"); 4 | 5 | // load0.wast:18 6 | run(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\xa4\x80\x80\x80\x00\x07\x60\x00\x00\x60\x01\x7f\x01\x6f\x60\x01\x6f\x01\x7f\x60\x01\x70\x01\x7f\x60\x02\x6f\x6f\x01\x7f\x60\x02\x70\x70\x01\x7f\x60\x01\x7f\x01\x7e\x02\x81\x81\x80\x80\x00\x06\x06\x6d\x6f\x64\x75\x6c\x65\x05\x6c\x6f\x61\x64\x31\x00\x06\x08\x73\x70\x65\x63\x74\x65\x73\x74\x09\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x69\x73\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x02\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x69\x73\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x03\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x65\x71\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x04\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x65\x71\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x05\x03\x82\x80\x80\x80\x00\x01\x00\x07\x87\x80\x80\x80\x00\x01\x03\x72\x75\x6e\x00\x06\x0a\x99\x80\x80\x80\x00\x01\x93\x80\x80\x80\x00\x00\x02\x40\x41\x00\x10\x00\x01\x42\x01\x01\x51\x45\x0d\x00\x0f\x0b\x00\x0b", exports($1)), "run", [])); // assert_return(() => call($1, "load1", [0]), int64("1")) 7 | 8 | // load0.wast:19 9 | run(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\xa4\x80\x80\x80\x00\x07\x60\x00\x00\x60\x01\x7f\x01\x6f\x60\x01\x6f\x01\x7f\x60\x01\x70\x01\x7f\x60\x02\x6f\x6f\x01\x7f\x60\x02\x70\x70\x01\x7f\x60\x01\x7f\x01\x7e\x02\x81\x81\x80\x80\x00\x06\x06\x6d\x6f\x64\x75\x6c\x65\x05\x6c\x6f\x61\x64\x32\x00\x06\x08\x73\x70\x65\x63\x74\x65\x73\x74\x09\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x69\x73\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x02\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x69\x73\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x03\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x65\x71\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x04\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x65\x71\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x05\x03\x82\x80\x80\x80\x00\x01\x00\x07\x87\x80\x80\x80\x00\x01\x03\x72\x75\x6e\x00\x06\x0a\x99\x80\x80\x80\x00\x01\x93\x80\x80\x80\x00\x00\x02\x40\x41\x00\x10\x00\x01\x42\x02\x01\x51\x45\x0d\x00\x0f\x0b\x00\x0b", exports($1)), "run", [])); // assert_return(() => call($1, "load2", [0]), int64("2")) 10 | -------------------------------------------------------------------------------- /test/core/multi-memory/load1.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // load1.wast:1 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x86\x80\x80\x80\x00\x01\x60\x01\x7f\x01\x7f\x03\x82\x80\x80\x80\x00\x01\x00\x05\x83\x80\x80\x80\x00\x01\x00\x02\x07\x8e\x80\x80\x80\x00\x02\x03\x6d\x65\x6d\x02\x00\x04\x72\x65\x61\x64\x00\x00\x0a\x8d\x80\x80\x80\x00\x01\x87\x80\x80\x80\x00\x00\x20\x00\x2d\x00\x00\x0b"); 4 | let $M = $1; 5 | 6 | // load1.wast:8 7 | register("M", $1) 8 | 9 | // load1.wast:10 10 | let $2 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x86\x80\x80\x80\x00\x01\x60\x01\x7f\x01\x7f\x02\x8a\x80\x80\x80\x00\x01\x01\x4d\x03\x6d\x65\x6d\x02\x00\x02\x03\x83\x80\x80\x80\x00\x02\x00\x00\x05\x83\x80\x80\x80\x00\x01\x00\x03\x07\x91\x80\x80\x80\x00\x02\x05\x72\x65\x61\x64\x31\x00\x00\x05\x72\x65\x61\x64\x32\x00\x01\x0a\x9a\x80\x80\x80\x00\x02\x87\x80\x80\x80\x00\x00\x20\x00\x2d\x00\x00\x0b\x88\x80\x80\x80\x00\x00\x20\x00\x2d\x40\x01\x00\x0b\x0b\x96\x80\x80\x80\x00\x02\x00\x41\x14\x0b\x05\x01\x02\x03\x04\x05\x02\x01\x41\x32\x0b\x05\x0a\x0b\x0c\x0d\x0e"); 11 | 12 | // load1.wast:25 13 | assert_return(() => call($M, "read", [20]), 1); 14 | 15 | // load1.wast:26 16 | assert_return(() => call($M, "read", [21]), 2); 17 | 18 | // load1.wast:27 19 | assert_return(() => call($M, "read", [22]), 3); 20 | 21 | // load1.wast:28 22 | assert_return(() => call($M, "read", [23]), 4); 23 | 24 | // load1.wast:29 25 | assert_return(() => call($M, "read", [24]), 5); 26 | 27 | // load1.wast:31 28 | assert_return(() => call($2, "read1", [20]), 1); 29 | 30 | // load1.wast:32 31 | assert_return(() => call($2, "read1", [21]), 2); 32 | 33 | // load1.wast:33 34 | assert_return(() => call($2, "read1", [22]), 3); 35 | 36 | // load1.wast:34 37 | assert_return(() => call($2, "read1", [23]), 4); 38 | 39 | // load1.wast:35 40 | assert_return(() => call($2, "read1", [24]), 5); 41 | 42 | // load1.wast:37 43 | assert_return(() => call($2, "read2", [50]), 10); 44 | 45 | // load1.wast:38 46 | assert_return(() => call($2, "read2", [51]), 11); 47 | 48 | // load1.wast:39 49 | assert_return(() => call($2, "read2", [52]), 12); 50 | 51 | // load1.wast:40 52 | assert_return(() => call($2, "read2", [53]), 13); 53 | 54 | // load1.wast:41 55 | assert_return(() => call($2, "read2", [54]), 14); 56 | -------------------------------------------------------------------------------- /test/core/multi-memory/load2.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // load2.wast:1 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x95\x80\x80\x80\x00\x04\x60\x03\x7f\x7f\x7f\x01\x7f\x60\x00\x01\x7f\x60\x00\x00\x60\x02\x7f\x7f\x01\x7f\x03\xa7\x80\x80\x80\x00\x26\x01\x02\x01\x01\x02\x01\x01\x01\x01\x01\x01\x03\x03\x01\x00\x01\x01\x01\x01\x01\x01\x01\x02\x01\x02\x01\x01\x02\x02\x02\x02\x01\x01\x01\x01\x01\x01\x01\x04\x85\x80\x80\x80\x00\x01\x70\x01\x01\x01\x05\x89\x80\x80\x80\x00\x04\x00\x00\x00\x00\x00\x00\x00\x01\x06\x86\x80\x80\x80\x00\x01\x7f\x01\x41\x00\x0b\x07\xb7\x85\x80\x80\x00\x25\x0b\x61\x73\x2d\x62\x72\x2d\x76\x61\x6c\x75\x65\x00\x00\x0d\x61\x73\x2d\x62\x72\x5f\x69\x66\x2d\x63\x6f\x6e\x64\x00\x01\x0e\x61\x73\x2d\x62\x72\x5f\x69\x66\x2d\x76\x61\x6c\x75\x65\x00\x02\x13\x61\x73\x2d\x62\x72\x5f\x69\x66\x2d\x76\x61\x6c\x75\x65\x2d\x63\x6f\x6e\x64\x00\x03\x11\x61\x73\x2d\x62\x72\x5f\x74\x61\x62\x6c\x65\x2d\x69\x6e\x64\x65\x78\x00\x04\x11\x61\x73\x2d\x62\x72\x5f\x74\x61\x62\x6c\x65\x2d\x76\x61\x6c\x75\x65\x00\x05\x17\x61\x73\x2d\x62\x72\x5f\x74\x61\x62\x6c\x65\x2d\x76\x61\x6c\x75\x65\x2d\x69\x6e\x64\x65\x78\x00\x06\x0f\x61\x73\x2d\x72\x65\x74\x75\x72\x6e\x2d\x76\x61\x6c\x75\x65\x00\x07\x0a\x61\x73\x2d\x69\x66\x2d\x63\x6f\x6e\x64\x00\x08\x0a\x61\x73\x2d\x69\x66\x2d\x74\x68\x65\x6e\x00\x09\x0a\x61\x73\x2d\x69\x66\x2d\x65\x6c\x73\x65\x00\x0a\x0f\x61\x73\x2d\x73\x65\x6c\x65\x63\x74\x2d\x66\x69\x72\x73\x74\x00\x0b\x10\x61\x73\x2d\x73\x65\x6c\x65\x63\x74\x2d\x73\x65\x63\x6f\x6e\x64\x00\x0c\x0e\x61\x73\x2d\x73\x65\x6c\x65\x63\x74\x2d\x63\x6f\x6e\x64\x00\x0d\x0d\x61\x73\x2d\x63\x61\x6c\x6c\x2d\x66\x69\x72\x73\x74\x00\x0f\x0b\x61\x73\x2d\x63\x61\x6c\x6c\x2d\x6d\x69\x64\x00\x10\x0c\x61\x73\x2d\x63\x61\x6c\x6c\x2d\x6c\x61\x73\x74\x00\x11\x16\x61\x73\x2d\x63\x61\x6c\x6c\x5f\x69\x6e\x64\x69\x72\x65\x63\x74\x2d\x66\x69\x72\x73\x74\x00\x12\x14\x61\x73\x2d\x63\x61\x6c\x6c\x5f\x69\x6e\x64\x69\x72\x65\x63\x74\x2d\x6d\x69\x64\x00\x13\x15\x61\x73\x2d\x63\x61\x6c\x6c\x5f\x69\x6e\x64\x69\x72\x65\x63\x74\x2d\x6c\x61\x73\x74\x00\x14\x16\x61\x73\x2d\x63\x61\x6c\x6c\x5f\x69\x6e\x64\x69\x72\x65\x63\x74\x2d\x69\x6e\x64\x65\x78\x00\x15\x12\x61\x73\x2d\x6c\x6f\x63\x61\x6c\x2e\x73\x65\x74\x2d\x76\x61\x6c\x75\x65\x00\x16\x12\x61\x73\x2d\x6c\x6f\x63\x61\x6c\x2e\x74\x65\x65\x2d\x76\x61\x6c\x75\x65\x00\x17\x13\x61\x73\x2d\x67\x6c\x6f\x62\x61\x6c\x2e\x73\x65\x74\x2d\x76\x61\x6c\x75\x65\x00\x18\x0f\x61\x73\x2d\x6c\x6f\x61\x64\x2d\x61\x64\x64\x72\x65\x73\x73\x00\x19\x10\x61\x73\x2d\x6c\x6f\x61\x64\x4e\x2d\x61\x64\x64\x72\x65\x73\x73\x00\x1a\x10\x61\x73\x2d\x73\x74\x6f\x72\x65\x2d\x61\x64\x64\x72\x65\x73\x73\x00\x1b\x0e\x61\x73\x2d\x73\x74\x6f\x72\x65\x2d\x76\x61\x6c\x75\x65\x00\x1c\x11\x61\x73\x2d\x73\x74\x6f\x72\x65\x4e\x2d\x61\x64\x64\x72\x65\x73\x73\x00\x1d\x0f\x61\x73\x2d\x73\x74\x6f\x72\x65\x4e\x2d\x76\x61\x6c\x75\x65\x00\x1e\x10\x61\x73\x2d\x75\x6e\x61\x72\x79\x2d\x6f\x70\x65\x72\x61\x6e\x64\x00\x1f\x0e\x61\x73\x2d\x62\x69\x6e\x61\x72\x79\x2d\x6c\x65\x66\x74\x00\x20\x0f\x61\x73\x2d\x62\x69\x6e\x61\x72\x79\x2d\x72\x69\x67\x68\x74\x00\x21\x0f\x61\x73\x2d\x74\x65\x73\x74\x2d\x6f\x70\x65\x72\x61\x6e\x64\x00\x22\x0f\x61\x73\x2d\x63\x6f\x6d\x70\x61\x72\x65\x2d\x6c\x65\x66\x74\x00\x23\x10\x61\x73\x2d\x63\x6f\x6d\x70\x61\x72\x65\x2d\x72\x69\x67\x68\x74\x00\x24\x13\x61\x73\x2d\x6d\x65\x6d\x6f\x72\x79\x2e\x67\x72\x6f\x77\x2d\x73\x69\x7a\x65\x00\x25\x09\x87\x80\x80\x80\x00\x01\x00\x41\x00\x0b\x01\x0e\x0a\xc9\x85\x80\x80\x00\x26\x8d\x80\x80\x80\x00\x00\x02\x7f\x41\x00\x28\x42\x03\x00\x0c\x00\x0b\x0b\x8d\x80\x80\x80\x00\x00\x02\x40\x41\x00\x28\x42\x03\x00\x0d\x00\x0b\x0b\x92\x80\x80\x80\x00\x00\x02\x7f\x41\x00\x28\x42\x03\x00\x41\x01\x0d\x00\x1a\x41\x07\x0b\x0b\x92\x80\x80\x80\x00\x00\x02\x7f\x41\x06\x41\x00\x28\x42\x03\x00\x0d\x00\x1a\x41\x07\x0b\x0b\x90\x80\x80\x80\x00\x00\x02\x40\x41\x00\x28\x42\x03\x00\x0e\x02\x00\x00\x00\x0b\x0b\x94\x80\x80\x80\x00\x00\x02\x7f\x41\x00\x28\x42\x03\x00\x41\x01\x0e\x02\x00\x00\x00\x41\x07\x0b\x0b\x93\x80\x80\x80\x00\x00\x02\x7f\x41\x06\x41\x00\x28\x42\x03\x00\x0e\x01\x00\x00\x41\x07\x0b\x0b\x89\x80\x80\x80\x00\x00\x41\x00\x28\x42\x03\x00\x0f\x0b\x90\x80\x80\x80\x00\x00\x41\x00\x28\x42\x03\x00\x04\x7f\x41\x00\x05\x41\x01\x0b\x0b\x90\x80\x80\x80\x00\x00\x41\x01\x04\x7f\x41\x00\x28\x42\x03\x00\x05\x41\x00\x0b\x0b\x90\x80\x80\x80\x00\x00\x41\x00\x04\x7f\x41\x00\x05\x41\x00\x28\x42\x03\x00\x0b\x0b\x8d\x80\x80\x80\x00\x00\x41\x00\x28\x42\x03\x00\x20\x00\x20\x01\x1b\x0b\x8d\x80\x80\x80\x00\x00\x20\x00\x41\x00\x28\x42\x03\x00\x20\x01\x1b\x0b\x8d\x80\x80\x80\x00\x00\x41\x00\x41\x01\x41\x00\x28\x42\x03\x00\x1b\x0b\x84\x80\x80\x80\x00\x00\x41\x7f\x0b\x8e\x80\x80\x80\x00\x00\x41\x00\x28\x42\x03\x00\x41\x02\x41\x03\x10\x0e\x0b\x8e\x80\x80\x80\x00\x00\x41\x01\x41\x00\x28\x42\x03\x00\x41\x03\x10\x0e\x0b\x8e\x80\x80\x80\x00\x00\x41\x01\x41\x02\x41\x00\x28\x42\x03\x00\x10\x0e\x0b\x91\x80\x80\x80\x00\x00\x41\x00\x28\x42\x03\x00\x41\x02\x41\x03\x41\x00\x11\x00\x00\x0b\x91\x80\x80\x80\x00\x00\x41\x01\x41\x00\x28\x42\x03\x00\x41\x03\x41\x00\x11\x00\x00\x0b\x91\x80\x80\x80\x00\x00\x41\x01\x41\x02\x41\x00\x28\x42\x03\x00\x41\x00\x11\x00\x00\x0b\x91\x80\x80\x80\x00\x00\x41\x01\x41\x02\x41\x03\x41\x00\x28\x42\x03\x00\x11\x00\x00\x0b\x8c\x80\x80\x80\x00\x01\x01\x7f\x41\x00\x28\x42\x03\x00\x21\x00\x0b\x8c\x80\x80\x80\x00\x01\x01\x7f\x41\x00\x28\x42\x03\x00\x22\x00\x0b\x8c\x80\x80\x80\x00\x01\x01\x7f\x41\x00\x28\x42\x03\x00\x24\x00\x0b\x8c\x80\x80\x80\x00\x00\x41\x00\x28\x42\x03\x00\x28\x42\x03\x00\x0b\x8c\x80\x80\x80\x00\x00\x41\x00\x28\x42\x03\x00\x2c\x40\x03\x00\x0b\x8e\x80\x80\x80\x00\x00\x41\x00\x28\x42\x03\x00\x41\x07\x36\x42\x03\x00\x0b\x8e\x80\x80\x80\x00\x00\x41\x02\x41\x00\x28\x42\x03\x00\x36\x42\x03\x00\x0b\x8e\x80\x80\x80\x00\x00\x41\x00\x2c\x40\x03\x00\x41\x07\x3a\x40\x03\x00\x0b\x8e\x80\x80\x80\x00\x00\x41\x02\x41\x00\x28\x42\x03\x00\x3b\x41\x03\x00\x0b\x8a\x80\x80\x80\x00\x00\x41\xe4\x00\x28\x42\x03\x00\x67\x0b\x8c\x80\x80\x80\x00\x00\x41\xe4\x00\x28\x42\x03\x00\x41\x0a\x6a\x0b\x8c\x80\x80\x80\x00\x00\x41\x0a\x41\xe4\x00\x28\x42\x03\x00\x6b\x0b\x8a\x80\x80\x80\x00\x00\x41\xe4\x00\x28\x42\x03\x00\x45\x0b\x8c\x80\x80\x80\x00\x00\x41\xe4\x00\x28\x42\x03\x00\x41\x0a\x4c\x0b\x8c\x80\x80\x80\x00\x00\x41\x0a\x41\xe4\x00\x28\x42\x03\x00\x47\x0b\x8b\x80\x80\x80\x00\x00\x41\xe4\x00\x28\x42\x03\x00\x40\x03\x0b"); 4 | 5 | // load2.wast:162 6 | assert_return(() => call($1, "as-br-value", []), 0); 7 | 8 | // load2.wast:164 9 | assert_return(() => call($1, "as-br_if-cond", [])); 10 | 11 | // load2.wast:165 12 | assert_return(() => call($1, "as-br_if-value", []), 0); 13 | 14 | // load2.wast:166 15 | assert_return(() => call($1, "as-br_if-value-cond", []), 7); 16 | 17 | // load2.wast:168 18 | assert_return(() => call($1, "as-br_table-index", [])); 19 | 20 | // load2.wast:169 21 | assert_return(() => call($1, "as-br_table-value", []), 0); 22 | 23 | // load2.wast:170 24 | assert_return(() => call($1, "as-br_table-value-index", []), 6); 25 | 26 | // load2.wast:172 27 | assert_return(() => call($1, "as-return-value", []), 0); 28 | 29 | // load2.wast:174 30 | assert_return(() => call($1, "as-if-cond", []), 1); 31 | 32 | // load2.wast:175 33 | assert_return(() => call($1, "as-if-then", []), 0); 34 | 35 | // load2.wast:176 36 | assert_return(() => call($1, "as-if-else", []), 0); 37 | 38 | // load2.wast:178 39 | assert_return(() => call($1, "as-select-first", [0, 1]), 0); 40 | 41 | // load2.wast:179 42 | assert_return(() => call($1, "as-select-second", [0, 0]), 0); 43 | 44 | // load2.wast:180 45 | assert_return(() => call($1, "as-select-cond", []), 1); 46 | 47 | // load2.wast:182 48 | assert_return(() => call($1, "as-call-first", []), -1); 49 | 50 | // load2.wast:183 51 | assert_return(() => call($1, "as-call-mid", []), -1); 52 | 53 | // load2.wast:184 54 | assert_return(() => call($1, "as-call-last", []), -1); 55 | 56 | // load2.wast:186 57 | assert_return(() => call($1, "as-call_indirect-first", []), -1); 58 | 59 | // load2.wast:187 60 | assert_return(() => call($1, "as-call_indirect-mid", []), -1); 61 | 62 | // load2.wast:188 63 | assert_return(() => call($1, "as-call_indirect-last", []), -1); 64 | 65 | // load2.wast:189 66 | assert_return(() => call($1, "as-call_indirect-index", []), -1); 67 | 68 | // load2.wast:191 69 | assert_return(() => call($1, "as-local.set-value", [])); 70 | 71 | // load2.wast:192 72 | assert_return(() => call($1, "as-local.tee-value", []), 0); 73 | 74 | // load2.wast:193 75 | assert_return(() => call($1, "as-global.set-value", [])); 76 | 77 | // load2.wast:195 78 | assert_return(() => call($1, "as-load-address", []), 0); 79 | 80 | // load2.wast:196 81 | assert_return(() => call($1, "as-loadN-address", []), 0); 82 | 83 | // load2.wast:197 84 | assert_return(() => call($1, "as-store-address", [])); 85 | 86 | // load2.wast:198 87 | assert_return(() => call($1, "as-store-value", [])); 88 | 89 | // load2.wast:199 90 | assert_return(() => call($1, "as-storeN-address", [])); 91 | 92 | // load2.wast:200 93 | assert_return(() => call($1, "as-storeN-value", [])); 94 | 95 | // load2.wast:202 96 | assert_return(() => call($1, "as-unary-operand", []), 32); 97 | 98 | // load2.wast:204 99 | assert_return(() => call($1, "as-binary-left", []), 10); 100 | 101 | // load2.wast:205 102 | assert_return(() => call($1, "as-binary-right", []), 10); 103 | 104 | // load2.wast:207 105 | assert_return(() => call($1, "as-test-operand", []), 1); 106 | 107 | // load2.wast:209 108 | assert_return(() => call($1, "as-compare-left", []), 1); 109 | 110 | // load2.wast:210 111 | assert_return(() => call($1, "as-compare-right", []), 1); 112 | 113 | // load2.wast:212 114 | assert_return(() => call($1, "as-memory.grow-size", []), 1); 115 | -------------------------------------------------------------------------------- /test/core/multi-memory/memory_copy0.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // memory_copy0.wast:2 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x8c\x80\x80\x80\x00\x02\x60\x03\x7f\x7f\x7f\x00\x60\x01\x7f\x01\x7f\x03\x83\x80\x80\x80\x00\x02\x00\x01\x05\x8d\x80\x80\x80\x00\x04\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x07\x92\x80\x80\x80\x00\x02\x04\x63\x6f\x70\x79\x00\x00\x07\x6c\x6f\x61\x64\x38\x5f\x75\x00\x01\x0a\x9f\x80\x80\x80\x00\x02\x8c\x80\x80\x80\x00\x00\x20\x00\x20\x01\x20\x02\xfc\x0a\x03\x03\x0b\x88\x80\x80\x80\x00\x00\x20\x00\x2d\x40\x03\x00\x0b\x0b\xa8\x80\x80\x80\x00\x04\x00\x41\x00\x0b\x04\xff\x11\x44\xee\x02\x01\x41\x00\x0b\x04\xee\x22\x55\xff\x02\x02\x41\x00\x0b\x04\xdd\x33\x66\x00\x02\x03\x41\x00\x0b\x04\xaa\xbb\xcc\xdd"); 4 | 5 | // memory_copy0.wast:19 6 | run(() => call($1, "copy", [10, 0, 4])); 7 | 8 | // memory_copy0.wast:21 9 | assert_return(() => call($1, "load8_u", [9]), 0); 10 | 11 | // memory_copy0.wast:22 12 | assert_return(() => call($1, "load8_u", [10]), 170); 13 | 14 | // memory_copy0.wast:23 15 | assert_return(() => call($1, "load8_u", [11]), 187); 16 | 17 | // memory_copy0.wast:24 18 | assert_return(() => call($1, "load8_u", [12]), 204); 19 | 20 | // memory_copy0.wast:25 21 | assert_return(() => call($1, "load8_u", [13]), 221); 22 | 23 | // memory_copy0.wast:26 24 | assert_return(() => call($1, "load8_u", [14]), 0); 25 | 26 | // memory_copy0.wast:29 27 | run(() => call($1, "copy", [8, 10, 4])); 28 | 29 | // memory_copy0.wast:30 30 | assert_return(() => call($1, "load8_u", [8]), 170); 31 | 32 | // memory_copy0.wast:31 33 | assert_return(() => call($1, "load8_u", [9]), 187); 34 | 35 | // memory_copy0.wast:32 36 | assert_return(() => call($1, "load8_u", [10]), 204); 37 | 38 | // memory_copy0.wast:33 39 | assert_return(() => call($1, "load8_u", [11]), 221); 40 | 41 | // memory_copy0.wast:34 42 | assert_return(() => call($1, "load8_u", [12]), 204); 43 | 44 | // memory_copy0.wast:35 45 | assert_return(() => call($1, "load8_u", [13]), 221); 46 | 47 | // memory_copy0.wast:38 48 | run(() => call($1, "copy", [10, 7, 6])); 49 | 50 | // memory_copy0.wast:39 51 | assert_return(() => call($1, "load8_u", [10]), 0); 52 | 53 | // memory_copy0.wast:40 54 | assert_return(() => call($1, "load8_u", [11]), 170); 55 | 56 | // memory_copy0.wast:41 57 | assert_return(() => call($1, "load8_u", [12]), 187); 58 | 59 | // memory_copy0.wast:42 60 | assert_return(() => call($1, "load8_u", [13]), 204); 61 | 62 | // memory_copy0.wast:43 63 | assert_return(() => call($1, "load8_u", [14]), 221); 64 | 65 | // memory_copy0.wast:44 66 | assert_return(() => call($1, "load8_u", [15]), 204); 67 | 68 | // memory_copy0.wast:45 69 | assert_return(() => call($1, "load8_u", [16]), 0); 70 | 71 | // memory_copy0.wast:48 72 | run(() => call($1, "copy", [65_280, 0, 256])); 73 | 74 | // memory_copy0.wast:49 75 | run(() => call($1, "copy", [65_024, 65_280, 256])); 76 | 77 | // memory_copy0.wast:52 78 | run(() => call($1, "copy", [65_536, 0, 0])); 79 | 80 | // memory_copy0.wast:53 81 | run(() => call($1, "copy", [0, 65_536, 0])); 82 | 83 | // memory_copy0.wast:56 84 | assert_trap(() => call($1, "copy", [65_537, 0, 0])); 85 | 86 | // memory_copy0.wast:58 87 | assert_trap(() => call($1, "copy", [0, 65_537, 0])); 88 | -------------------------------------------------------------------------------- /test/core/multi-memory/memory_copy1.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // memory_copy1.wast:2 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x8c\x80\x80\x80\x00\x02\x60\x03\x7f\x7f\x7f\x00\x60\x01\x7f\x01\x7f\x03\x83\x80\x80\x80\x00\x02\x00\x01\x05\x8d\x80\x80\x80\x00\x04\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x07\x92\x80\x80\x80\x00\x02\x04\x63\x6f\x70\x79\x00\x00\x07\x6c\x6f\x61\x64\x38\x5f\x75\x00\x01\x0a\x9e\x80\x80\x80\x00\x02\x8c\x80\x80\x80\x00\x00\x20\x00\x20\x01\x20\x02\xfc\x0a\x00\x03\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x2d\x00\x00\x0b\x0b\xa8\x80\x80\x80\x00\x04\x00\x41\x00\x0b\x04\xff\x11\x44\xee\x02\x01\x41\x00\x0b\x04\xee\x22\x55\xff\x02\x02\x41\x00\x0b\x04\xdd\x33\x66\x00\x02\x03\x41\x00\x0b\x04\xaa\xbb\xcc\xdd"); 4 | 5 | // memory_copy1.wast:19 6 | run(() => call($1, "copy", [10, 0, 4])); 7 | 8 | // memory_copy1.wast:21 9 | assert_return(() => call($1, "load8_u", [9]), 0); 10 | 11 | // memory_copy1.wast:22 12 | assert_return(() => call($1, "load8_u", [10]), 170); 13 | 14 | // memory_copy1.wast:23 15 | assert_return(() => call($1, "load8_u", [11]), 187); 16 | 17 | // memory_copy1.wast:24 18 | assert_return(() => call($1, "load8_u", [12]), 204); 19 | 20 | // memory_copy1.wast:25 21 | assert_return(() => call($1, "load8_u", [13]), 221); 22 | 23 | // memory_copy1.wast:26 24 | assert_return(() => call($1, "load8_u", [14]), 0); 25 | 26 | // memory_copy1.wast:29 27 | run(() => call($1, "copy", [65_280, 0, 256])); 28 | 29 | // memory_copy1.wast:30 30 | run(() => call($1, "copy", [65_024, 65_280, 256])); 31 | 32 | // memory_copy1.wast:33 33 | run(() => call($1, "copy", [65_536, 0, 0])); 34 | 35 | // memory_copy1.wast:34 36 | run(() => call($1, "copy", [0, 65_536, 0])); 37 | 38 | // memory_copy1.wast:37 39 | assert_trap(() => call($1, "copy", [65_537, 0, 0])); 40 | 41 | // memory_copy1.wast:39 42 | assert_trap(() => call($1, "copy", [0, 65_537, 0])); 43 | -------------------------------------------------------------------------------- /test/core/multi-memory/memory_fill0.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // memory_fill0.wast:2 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x8c\x80\x80\x80\x00\x02\x60\x03\x7f\x7f\x7f\x00\x60\x01\x7f\x01\x7f\x03\x83\x80\x80\x80\x00\x02\x00\x01\x05\x87\x80\x80\x80\x00\x03\x00\x00\x00\x00\x00\x01\x07\x92\x80\x80\x80\x00\x02\x04\x66\x69\x6c\x6c\x00\x00\x07\x6c\x6f\x61\x64\x38\x5f\x75\x00\x01\x0a\x9e\x80\x80\x80\x00\x02\x8b\x80\x80\x80\x00\x00\x20\x00\x20\x01\x20\x02\xfc\x0b\x02\x0b\x88\x80\x80\x80\x00\x00\x20\x00\x2d\x40\x02\x00\x0b"); 4 | 5 | // memory_fill0.wast:18 6 | run(() => call($1, "fill", [1, 255, 3])); 7 | 8 | // memory_fill0.wast:19 9 | assert_return(() => call($1, "load8_u", [0]), 0); 10 | 11 | // memory_fill0.wast:20 12 | assert_return(() => call($1, "load8_u", [1]), 255); 13 | 14 | // memory_fill0.wast:21 15 | assert_return(() => call($1, "load8_u", [2]), 255); 16 | 17 | // memory_fill0.wast:22 18 | assert_return(() => call($1, "load8_u", [3]), 255); 19 | 20 | // memory_fill0.wast:23 21 | assert_return(() => call($1, "load8_u", [4]), 0); 22 | 23 | // memory_fill0.wast:26 24 | run(() => call($1, "fill", [0, 48_042, 2])); 25 | 26 | // memory_fill0.wast:27 27 | assert_return(() => call($1, "load8_u", [0]), 170); 28 | 29 | // memory_fill0.wast:28 30 | assert_return(() => call($1, "load8_u", [1]), 170); 31 | 32 | // memory_fill0.wast:31 33 | run(() => call($1, "fill", [0, 0, 65_536])); 34 | 35 | // memory_fill0.wast:34 36 | assert_trap(() => call($1, "fill", [65_280, 1, 257])); 37 | 38 | // memory_fill0.wast:36 39 | assert_return(() => call($1, "load8_u", [65_280]), 0); 40 | 41 | // memory_fill0.wast:37 42 | assert_return(() => call($1, "load8_u", [65_535]), 0); 43 | 44 | // memory_fill0.wast:40 45 | run(() => call($1, "fill", [65_536, 0, 0])); 46 | 47 | // memory_fill0.wast:43 48 | assert_trap(() => call($1, "fill", [65_537, 0, 0])); 49 | -------------------------------------------------------------------------------- /test/core/multi-memory/memory_init0.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // memory_init0.wast:2 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x8c\x80\x80\x80\x00\x02\x60\x03\x7f\x7f\x7f\x00\x60\x01\x7f\x01\x7f\x03\x83\x80\x80\x80\x00\x02\x00\x01\x05\x89\x80\x80\x80\x00\x04\x00\x00\x00\x00\x00\x01\x00\x00\x07\x92\x80\x80\x80\x00\x02\x04\x69\x6e\x69\x74\x00\x00\x07\x6c\x6f\x61\x64\x38\x5f\x75\x00\x01\x0c\x81\x80\x80\x80\x00\x01\x0a\x9f\x80\x80\x80\x00\x02\x8c\x80\x80\x80\x00\x00\x20\x00\x20\x01\x20\x02\xfc\x08\x00\x02\x0b\x88\x80\x80\x80\x00\x00\x20\x00\x2d\x40\x02\x00\x0b\x0b\x87\x80\x80\x80\x00\x01\x01\x04\xaa\xbb\xcc\xdd"); 4 | 5 | // memory_init0.wast:19 6 | run(() => call($1, "init", [0, 1, 2])); 7 | 8 | // memory_init0.wast:20 9 | assert_return(() => call($1, "load8_u", [0]), 187); 10 | 11 | // memory_init0.wast:21 12 | assert_return(() => call($1, "load8_u", [1]), 204); 13 | 14 | // memory_init0.wast:22 15 | assert_return(() => call($1, "load8_u", [2]), 0); 16 | 17 | // memory_init0.wast:25 18 | run(() => call($1, "init", [65_532, 0, 4])); 19 | 20 | // memory_init0.wast:28 21 | assert_trap(() => call($1, "init", [65_534, 0, 3])); 22 | 23 | // memory_init0.wast:30 24 | assert_return(() => call($1, "load8_u", [65_534]), 204); 25 | 26 | // memory_init0.wast:31 27 | assert_return(() => call($1, "load8_u", [65_535]), 221); 28 | 29 | // memory_init0.wast:34 30 | run(() => call($1, "init", [65_536, 0, 0])); 31 | 32 | // memory_init0.wast:35 33 | run(() => call($1, "init", [0, 4, 0])); 34 | 35 | // memory_init0.wast:38 36 | assert_trap(() => call($1, "init", [65_537, 0, 0])); 37 | 38 | // memory_init0.wast:40 39 | assert_trap(() => call($1, "init", [0, 5, 0])); 40 | -------------------------------------------------------------------------------- /test/core/multi-memory/memory_size0.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // memory_size0.wast:1 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x89\x80\x80\x80\x00\x02\x60\x00\x01\x7f\x60\x01\x7f\x00\x03\x83\x80\x80\x80\x00\x02\x00\x01\x05\x8b\x80\x80\x80\x00\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07\x8f\x80\x80\x80\x00\x02\x04\x73\x69\x7a\x65\x00\x00\x04\x67\x72\x6f\x77\x00\x01\x0a\x96\x80\x80\x80\x00\x02\x84\x80\x80\x80\x00\x00\x3f\x04\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x40\x04\x1a\x0b"); 4 | 5 | // memory_size0.wast:12 6 | assert_return(() => call($1, "size", []), 0); 7 | 8 | // memory_size0.wast:13 9 | assert_return(() => call($1, "grow", [1])); 10 | 11 | // memory_size0.wast:14 12 | assert_return(() => call($1, "size", []), 1); 13 | 14 | // memory_size0.wast:15 15 | assert_return(() => call($1, "grow", [4])); 16 | 17 | // memory_size0.wast:16 18 | assert_return(() => call($1, "size", []), 5); 19 | 20 | // memory_size0.wast:17 21 | assert_return(() => call($1, "grow", [0])); 22 | 23 | // memory_size0.wast:18 24 | assert_return(() => call($1, "size", []), 5); 25 | -------------------------------------------------------------------------------- /test/core/multi-memory/memory_size1.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // memory_size1.wast:1 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x89\x80\x80\x80\x00\x02\x60\x00\x01\x7f\x60\x01\x7f\x00\x03\x85\x80\x80\x80\x00\x04\x00\x01\x00\x01\x05\x8b\x80\x80\x80\x00\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07\x9f\x80\x80\x80\x00\x04\x04\x73\x69\x7a\x65\x00\x00\x04\x67\x72\x6f\x77\x00\x01\x05\x73\x69\x7a\x65\x6e\x00\x02\x05\x67\x72\x6f\x77\x6e\x00\x03\x0a\xab\x80\x80\x80\x00\x04\x84\x80\x80\x80\x00\x00\x3f\x04\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x40\x04\x1a\x0b\x84\x80\x80\x80\x00\x00\x3f\x02\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x40\x02\x1a\x0b"); 4 | 5 | // memory_size1.wast:15 6 | assert_return(() => call($1, "size", []), 0); 7 | 8 | // memory_size1.wast:16 9 | assert_return(() => call($1, "sizen", []), 0); 10 | 11 | // memory_size1.wast:17 12 | assert_return(() => call($1, "grow", [1])); 13 | 14 | // memory_size1.wast:18 15 | assert_return(() => call($1, "size", []), 1); 16 | 17 | // memory_size1.wast:19 18 | assert_return(() => call($1, "sizen", []), 0); 19 | 20 | // memory_size1.wast:20 21 | assert_return(() => call($1, "grow", [4])); 22 | 23 | // memory_size1.wast:21 24 | assert_return(() => call($1, "size", []), 5); 25 | 26 | // memory_size1.wast:22 27 | assert_return(() => call($1, "sizen", []), 0); 28 | 29 | // memory_size1.wast:23 30 | assert_return(() => call($1, "grow", [0])); 31 | 32 | // memory_size1.wast:24 33 | assert_return(() => call($1, "size", []), 5); 34 | 35 | // memory_size1.wast:25 36 | assert_return(() => call($1, "sizen", []), 0); 37 | 38 | // memory_size1.wast:27 39 | assert_return(() => call($1, "grown", [1])); 40 | 41 | // memory_size1.wast:28 42 | assert_return(() => call($1, "size", []), 5); 43 | 44 | // memory_size1.wast:29 45 | assert_return(() => call($1, "sizen", []), 1); 46 | -------------------------------------------------------------------------------- /test/core/multi-memory/memory_size2.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // memory_size2.wast:1 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x89\x80\x80\x80\x00\x02\x60\x00\x01\x7f\x60\x01\x7f\x00\x03\x85\x80\x80\x80\x00\x04\x00\x01\x00\x01\x05\x8d\x80\x80\x80\x00\x04\x01\x00\x00\x01\x00\x00\x01\x00\x00\x01\x00\x02\x07\x9f\x80\x80\x80\x00\x04\x04\x73\x69\x7a\x65\x00\x00\x04\x67\x72\x6f\x77\x00\x01\x05\x73\x69\x7a\x65\x6e\x00\x02\x05\x67\x72\x6f\x77\x6e\x00\x03\x0a\xab\x80\x80\x80\x00\x04\x84\x80\x80\x80\x00\x00\x3f\x03\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x40\x03\x1a\x0b\x84\x80\x80\x80\x00\x00\x3f\x02\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x40\x02\x1a\x0b"); 4 | 5 | // memory_size2.wast:14 6 | assert_return(() => call($1, "size", []), 0); 7 | 8 | // memory_size2.wast:15 9 | assert_return(() => call($1, "sizen", []), 0); 10 | 11 | // memory_size2.wast:16 12 | assert_return(() => call($1, "grow", [3])); 13 | 14 | // memory_size2.wast:17 15 | assert_return(() => call($1, "sizen", []), 0); 16 | 17 | // memory_size2.wast:18 18 | assert_return(() => call($1, "size", []), 0); 19 | 20 | // memory_size2.wast:19 21 | assert_return(() => call($1, "grow", [1])); 22 | 23 | // memory_size2.wast:20 24 | assert_return(() => call($1, "sizen", []), 0); 25 | 26 | // memory_size2.wast:21 27 | assert_return(() => call($1, "size", []), 1); 28 | 29 | // memory_size2.wast:22 30 | assert_return(() => call($1, "grow", [0])); 31 | 32 | // memory_size2.wast:23 33 | assert_return(() => call($1, "sizen", []), 0); 34 | 35 | // memory_size2.wast:24 36 | assert_return(() => call($1, "size", []), 1); 37 | 38 | // memory_size2.wast:25 39 | assert_return(() => call($1, "grow", [4])); 40 | 41 | // memory_size2.wast:26 42 | assert_return(() => call($1, "sizen", []), 0); 43 | 44 | // memory_size2.wast:27 45 | assert_return(() => call($1, "size", []), 1); 46 | 47 | // memory_size2.wast:28 48 | assert_return(() => call($1, "grow", [1])); 49 | 50 | // memory_size2.wast:29 51 | assert_return(() => call($1, "sizen", []), 0); 52 | 53 | // memory_size2.wast:30 54 | assert_return(() => call($1, "size", []), 2); 55 | 56 | // memory_size2.wast:32 57 | assert_return(() => call($1, "grown", [1])); 58 | 59 | // memory_size2.wast:33 60 | assert_return(() => call($1, "sizen", []), 0); 61 | 62 | // memory_size2.wast:34 63 | assert_return(() => call($1, "size", []), 2); 64 | -------------------------------------------------------------------------------- /test/core/multi-memory/memory_size3.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // memory_size3.wast:3 3 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x05\x87\x80\x80\x80\x00\x03\x00\x00\x00\x01\x00\x00\x0a\x8a\x80\x80\x80\x00\x01\x84\x80\x80\x80\x00\x00\x3f\x01\x0b"); 4 | 5 | // memory_size3.wast:14 6 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x85\x80\x80\x80\x00\x01\x60\x00\x01\x7d\x03\x82\x80\x80\x80\x00\x01\x00\x05\x89\x80\x80\x80\x00\x04\x00\x00\x00\x00\x00\x00\x00\x01\x0a\x8a\x80\x80\x80\x00\x01\x84\x80\x80\x80\x00\x00\x3f\x03\x0b"); 7 | -------------------------------------------------------------------------------- /test/core/multi-memory/memory_trap0.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // memory_trap0.wast:1 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x8f\x80\x80\x80\x00\x03\x60\x00\x01\x7f\x60\x02\x7f\x7f\x00\x60\x01\x7f\x01\x7f\x03\x85\x80\x80\x80\x00\x04\x00\x01\x02\x02\x05\x87\x80\x80\x80\x00\x03\x00\x00\x00\x00\x00\x01\x07\x9e\x80\x80\x80\x00\x03\x05\x73\x74\x6f\x72\x65\x00\x01\x04\x6c\x6f\x61\x64\x00\x02\x0b\x6d\x65\x6d\x6f\x72\x79\x2e\x67\x72\x6f\x77\x00\x03\x0a\xbc\x80\x80\x80\x00\x04\x89\x80\x80\x80\x00\x00\x3f\x02\x41\x80\x80\x04\x6c\x0b\x8d\x80\x80\x80\x00\x00\x10\x00\x20\x00\x6a\x20\x01\x36\x42\x02\x00\x0b\x8b\x80\x80\x80\x00\x00\x10\x00\x20\x00\x6a\x28\x42\x02\x00\x0b\x86\x80\x80\x80\x00\x00\x20\x00\x40\x02\x0b"); 4 | 5 | // memory_trap0.wast:23 6 | assert_return(() => call($1, "store", [-4, 42])); 7 | 8 | // memory_trap0.wast:24 9 | assert_return(() => call($1, "load", [-4]), 42); 10 | 11 | // memory_trap0.wast:25 12 | assert_trap(() => call($1, "store", [-3, 305_419_896])); 13 | 14 | // memory_trap0.wast:26 15 | assert_trap(() => call($1, "load", [-3])); 16 | 17 | // memory_trap0.wast:27 18 | assert_trap(() => call($1, "store", [-2, 13])); 19 | 20 | // memory_trap0.wast:28 21 | assert_trap(() => call($1, "load", [-2])); 22 | 23 | // memory_trap0.wast:29 24 | assert_trap(() => call($1, "store", [-1, 13])); 25 | 26 | // memory_trap0.wast:30 27 | assert_trap(() => call($1, "load", [-1])); 28 | 29 | // memory_trap0.wast:31 30 | assert_trap(() => call($1, "store", [0, 13])); 31 | 32 | // memory_trap0.wast:32 33 | assert_trap(() => call($1, "load", [0])); 34 | 35 | // memory_trap0.wast:33 36 | assert_trap(() => call($1, "store", [-2_147_483_648, 13])); 37 | 38 | // memory_trap0.wast:34 39 | assert_trap(() => call($1, "load", [-2_147_483_648])); 40 | 41 | // memory_trap0.wast:35 42 | assert_return(() => call($1, "memory.grow", [65_537]), -1); 43 | -------------------------------------------------------------------------------- /test/core/multi-memory/start0.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // start0.wast:1 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x88\x80\x80\x80\x00\x02\x60\x00\x00\x60\x00\x01\x7f\x03\x85\x80\x80\x80\x00\x04\x00\x01\x01\x00\x05\x88\x80\x80\x80\x00\x03\x00\x00\x01\x01\x01\x00\x01\x07\x94\x80\x80\x80\x00\x03\x03\x69\x6e\x63\x00\x00\x03\x67\x65\x74\x00\x01\x04\x67\x65\x74\x6e\x00\x02\x08\x81\x80\x80\x80\x00\x03\x0a\xc0\x80\x80\x80\x00\x04\x91\x80\x80\x80\x00\x00\x41\x00\x41\x00\x2d\x40\x01\x00\x41\x01\x6a\x3a\x40\x01\x00\x0b\x89\x80\x80\x80\x00\x00\x41\x00\x2d\x40\x01\x00\x0f\x0b\x89\x80\x80\x80\x00\x00\x41\x00\x2d\x40\x02\x00\x0f\x0b\x88\x80\x80\x80\x00\x00\x10\x00\x10\x00\x10\x00\x0b\x0b\x88\x80\x80\x80\x00\x01\x02\x01\x41\x00\x0b\x01\x41"); 4 | 5 | // start0.wast:32 6 | assert_return(() => call($1, "get", []), 68); 7 | 8 | // start0.wast:33 9 | assert_return(() => call($1, "getn", []), 0); 10 | 11 | // start0.wast:35 12 | run(() => call($1, "inc", [])); 13 | 14 | // start0.wast:36 15 | assert_return(() => call($1, "get", []), 69); 16 | 17 | // start0.wast:37 18 | assert_return(() => call($1, "getn", []), 0); 19 | 20 | // start0.wast:39 21 | run(() => call($1, "inc", [])); 22 | 23 | // start0.wast:40 24 | assert_return(() => call($1, "get", []), 70); 25 | 26 | // start0.wast:41 27 | assert_return(() => call($1, "getn", []), 0); 28 | -------------------------------------------------------------------------------- /test/core/multi-memory/store0.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // store0.wast:3 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x8b\x80\x80\x80\x00\x02\x60\x01\x7f\x01\x7e\x60\x02\x7f\x7e\x00\x03\x85\x80\x80\x80\x00\x04\x00\x00\x01\x01\x05\x85\x80\x80\x80\x00\x02\x00\x01\x00\x01\x07\xa3\x80\x80\x80\x00\x04\x05\x6c\x6f\x61\x64\x31\x00\x00\x05\x6c\x6f\x61\x64\x32\x00\x01\x06\x73\x74\x6f\x72\x65\x31\x00\x02\x06\x73\x74\x6f\x72\x65\x32\x00\x03\x0a\xb7\x80\x80\x80\x00\x04\x87\x80\x80\x80\x00\x00\x20\x00\x29\x03\x00\x0b\x88\x80\x80\x80\x00\x00\x20\x00\x29\x43\x01\x00\x0b\x89\x80\x80\x80\x00\x00\x20\x00\x20\x01\x37\x03\x00\x0b\x8a\x80\x80\x80\x00\x00\x20\x00\x20\x01\x37\x43\x01\x00\x0b"); 4 | 5 | // store0.wast:22 6 | run(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\xa4\x80\x80\x80\x00\x07\x60\x00\x00\x60\x01\x7f\x01\x6f\x60\x01\x6f\x01\x7f\x60\x01\x70\x01\x7f\x60\x02\x6f\x6f\x01\x7f\x60\x02\x70\x70\x01\x7f\x60\x02\x7f\x7e\x00\x02\x82\x81\x80\x80\x00\x06\x06\x6d\x6f\x64\x75\x6c\x65\x06\x73\x74\x6f\x72\x65\x31\x00\x06\x08\x73\x70\x65\x63\x74\x65\x73\x74\x09\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x69\x73\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x02\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x69\x73\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x03\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x65\x71\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x04\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x65\x71\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x05\x03\x82\x80\x80\x80\x00\x01\x00\x07\x87\x80\x80\x80\x00\x01\x03\x72\x75\x6e\x00\x06\x0a\x93\x80\x80\x80\x00\x01\x8d\x80\x80\x80\x00\x00\x02\x40\x41\x00\x42\x01\x10\x00\x0f\x0b\x00\x0b", exports($1)), "run", [])); // run(() => call($1, "store1", [0, int64("1")])) 7 | 8 | // store0.wast:23 9 | run(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\xa4\x80\x80\x80\x00\x07\x60\x00\x00\x60\x01\x7f\x01\x6f\x60\x01\x6f\x01\x7f\x60\x01\x70\x01\x7f\x60\x02\x6f\x6f\x01\x7f\x60\x02\x70\x70\x01\x7f\x60\x02\x7f\x7e\x00\x02\x82\x81\x80\x80\x00\x06\x06\x6d\x6f\x64\x75\x6c\x65\x06\x73\x74\x6f\x72\x65\x32\x00\x06\x08\x73\x70\x65\x63\x74\x65\x73\x74\x09\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x69\x73\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x02\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x69\x73\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x03\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x65\x71\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x04\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x65\x71\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x05\x03\x82\x80\x80\x80\x00\x01\x00\x07\x87\x80\x80\x80\x00\x01\x03\x72\x75\x6e\x00\x06\x0a\x93\x80\x80\x80\x00\x01\x8d\x80\x80\x80\x00\x00\x02\x40\x41\x00\x42\x02\x10\x00\x0f\x0b\x00\x0b", exports($1)), "run", [])); // run(() => call($1, "store2", [0, int64("2")])) 10 | 11 | // store0.wast:24 12 | run(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\xa4\x80\x80\x80\x00\x07\x60\x00\x00\x60\x01\x7f\x01\x6f\x60\x01\x6f\x01\x7f\x60\x01\x70\x01\x7f\x60\x02\x6f\x6f\x01\x7f\x60\x02\x70\x70\x01\x7f\x60\x01\x7f\x01\x7e\x02\x81\x81\x80\x80\x00\x06\x06\x6d\x6f\x64\x75\x6c\x65\x05\x6c\x6f\x61\x64\x31\x00\x06\x08\x73\x70\x65\x63\x74\x65\x73\x74\x09\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x69\x73\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x02\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x69\x73\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x03\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x65\x71\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x04\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x65\x71\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x05\x03\x82\x80\x80\x80\x00\x01\x00\x07\x87\x80\x80\x80\x00\x01\x03\x72\x75\x6e\x00\x06\x0a\x99\x80\x80\x80\x00\x01\x93\x80\x80\x80\x00\x00\x02\x40\x41\x00\x10\x00\x01\x42\x01\x01\x51\x45\x0d\x00\x0f\x0b\x00\x0b", exports($1)), "run", [])); // assert_return(() => call($1, "load1", [0]), int64("1")) 13 | 14 | // store0.wast:25 15 | run(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\xa4\x80\x80\x80\x00\x07\x60\x00\x00\x60\x01\x7f\x01\x6f\x60\x01\x6f\x01\x7f\x60\x01\x70\x01\x7f\x60\x02\x6f\x6f\x01\x7f\x60\x02\x70\x70\x01\x7f\x60\x01\x7f\x01\x7e\x02\x81\x81\x80\x80\x00\x06\x06\x6d\x6f\x64\x75\x6c\x65\x05\x6c\x6f\x61\x64\x32\x00\x06\x08\x73\x70\x65\x63\x74\x65\x73\x74\x09\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x69\x73\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x02\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x69\x73\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x03\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x65\x71\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x04\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x65\x71\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x05\x03\x82\x80\x80\x80\x00\x01\x00\x07\x87\x80\x80\x80\x00\x01\x03\x72\x75\x6e\x00\x06\x0a\x99\x80\x80\x80\x00\x01\x93\x80\x80\x80\x00\x00\x02\x40\x41\x00\x10\x00\x01\x42\x02\x01\x51\x45\x0d\x00\x0f\x0b\x00\x0b", exports($1)), "run", [])); // assert_return(() => call($1, "load2", [0]), int64("2")) 16 | -------------------------------------------------------------------------------- /test/core/multi-memory/store1.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // store1.wast:1 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x8b\x80\x80\x80\x00\x02\x60\x01\x7f\x01\x7e\x60\x02\x7f\x7e\x00\x03\x83\x80\x80\x80\x00\x02\x00\x01\x05\x83\x80\x80\x80\x00\x01\x00\x01\x07\x96\x80\x80\x80\x00\x03\x03\x6d\x65\x6d\x02\x00\x04\x6c\x6f\x61\x64\x00\x00\x05\x73\x74\x6f\x72\x65\x00\x01\x0a\x9b\x80\x80\x80\x00\x02\x87\x80\x80\x80\x00\x00\x20\x00\x29\x03\x00\x0b\x89\x80\x80\x80\x00\x00\x20\x00\x20\x01\x37\x03\x00\x0b"); 4 | let $M1 = $1; 5 | 6 | // store1.wast:11 7 | register("M1", $1) 8 | 9 | // store1.wast:13 10 | let $2 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x8b\x80\x80\x80\x00\x02\x60\x01\x7f\x01\x7e\x60\x02\x7f\x7e\x00\x03\x83\x80\x80\x80\x00\x02\x00\x01\x05\x83\x80\x80\x80\x00\x01\x00\x01\x07\x96\x80\x80\x80\x00\x03\x03\x6d\x65\x6d\x02\x00\x04\x6c\x6f\x61\x64\x00\x00\x05\x73\x74\x6f\x72\x65\x00\x01\x0a\x9b\x80\x80\x80\x00\x02\x87\x80\x80\x80\x00\x00\x20\x00\x29\x03\x00\x0b\x89\x80\x80\x80\x00\x00\x20\x00\x20\x01\x37\x03\x00\x0b"); 11 | let $M2 = $2; 12 | 13 | // store1.wast:23 14 | register("M2", $2) 15 | 16 | // store1.wast:25 17 | run(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\xa4\x80\x80\x80\x00\x07\x60\x00\x00\x60\x01\x7f\x01\x6f\x60\x01\x6f\x01\x7f\x60\x01\x70\x01\x7f\x60\x02\x6f\x6f\x01\x7f\x60\x02\x70\x70\x01\x7f\x60\x02\x7f\x7e\x00\x02\x81\x81\x80\x80\x00\x06\x06\x6d\x6f\x64\x75\x6c\x65\x05\x73\x74\x6f\x72\x65\x00\x06\x08\x73\x70\x65\x63\x74\x65\x73\x74\x09\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x69\x73\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x02\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x69\x73\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x03\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x65\x71\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x04\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x65\x71\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x05\x03\x82\x80\x80\x80\x00\x01\x00\x07\x87\x80\x80\x80\x00\x01\x03\x72\x75\x6e\x00\x06\x0a\x93\x80\x80\x80\x00\x01\x8d\x80\x80\x80\x00\x00\x02\x40\x41\x00\x42\x01\x10\x00\x0f\x0b\x00\x0b", exports($M1)), "run", [])); // run(() => call($M1, "store", [0, int64("1")])) 18 | 19 | // store1.wast:26 20 | run(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\xa4\x80\x80\x80\x00\x07\x60\x00\x00\x60\x01\x7f\x01\x6f\x60\x01\x6f\x01\x7f\x60\x01\x70\x01\x7f\x60\x02\x6f\x6f\x01\x7f\x60\x02\x70\x70\x01\x7f\x60\x02\x7f\x7e\x00\x02\x81\x81\x80\x80\x00\x06\x06\x6d\x6f\x64\x75\x6c\x65\x05\x73\x74\x6f\x72\x65\x00\x06\x08\x73\x70\x65\x63\x74\x65\x73\x74\x09\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x69\x73\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x02\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x69\x73\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x03\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x65\x71\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x04\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x65\x71\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x05\x03\x82\x80\x80\x80\x00\x01\x00\x07\x87\x80\x80\x80\x00\x01\x03\x72\x75\x6e\x00\x06\x0a\x93\x80\x80\x80\x00\x01\x8d\x80\x80\x80\x00\x00\x02\x40\x41\x00\x42\x02\x10\x00\x0f\x0b\x00\x0b", exports($M2)), "run", [])); // run(() => call($M2, "store", [0, int64("2")])) 21 | 22 | // store1.wast:27 23 | run(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\xa4\x80\x80\x80\x00\x07\x60\x00\x00\x60\x01\x7f\x01\x6f\x60\x01\x6f\x01\x7f\x60\x01\x70\x01\x7f\x60\x02\x6f\x6f\x01\x7f\x60\x02\x70\x70\x01\x7f\x60\x01\x7f\x01\x7e\x02\x80\x81\x80\x80\x00\x06\x06\x6d\x6f\x64\x75\x6c\x65\x04\x6c\x6f\x61\x64\x00\x06\x08\x73\x70\x65\x63\x74\x65\x73\x74\x09\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x69\x73\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x02\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x69\x73\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x03\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x65\x71\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x04\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x65\x71\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x05\x03\x82\x80\x80\x80\x00\x01\x00\x07\x87\x80\x80\x80\x00\x01\x03\x72\x75\x6e\x00\x06\x0a\x99\x80\x80\x80\x00\x01\x93\x80\x80\x80\x00\x00\x02\x40\x41\x00\x10\x00\x01\x42\x01\x01\x51\x45\x0d\x00\x0f\x0b\x00\x0b", exports($M1)), "run", [])); // assert_return(() => call($M1, "load", [0]), int64("1")) 24 | 25 | // store1.wast:28 26 | run(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\xa4\x80\x80\x80\x00\x07\x60\x00\x00\x60\x01\x7f\x01\x6f\x60\x01\x6f\x01\x7f\x60\x01\x70\x01\x7f\x60\x02\x6f\x6f\x01\x7f\x60\x02\x70\x70\x01\x7f\x60\x01\x7f\x01\x7e\x02\x80\x81\x80\x80\x00\x06\x06\x6d\x6f\x64\x75\x6c\x65\x04\x6c\x6f\x61\x64\x00\x06\x08\x73\x70\x65\x63\x74\x65\x73\x74\x09\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x69\x73\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x02\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x69\x73\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x03\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x65\x71\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x04\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x65\x71\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x05\x03\x82\x80\x80\x80\x00\x01\x00\x07\x87\x80\x80\x80\x00\x01\x03\x72\x75\x6e\x00\x06\x0a\x99\x80\x80\x80\x00\x01\x93\x80\x80\x80\x00\x00\x02\x40\x41\x00\x10\x00\x01\x42\x02\x01\x51\x45\x0d\x00\x0f\x0b\x00\x0b", exports($M2)), "run", [])); // assert_return(() => call($M2, "load", [0]), int64("2")) 27 | 28 | // store1.wast:30 29 | let $3 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x8b\x80\x80\x80\x00\x02\x60\x01\x7f\x01\x7e\x60\x02\x7f\x7e\x00\x02\x95\x80\x80\x80\x00\x02\x02\x4d\x31\x03\x6d\x65\x6d\x02\x00\x01\x02\x4d\x32\x03\x6d\x65\x6d\x02\x00\x01\x03\x85\x80\x80\x80\x00\x04\x00\x00\x01\x01\x07\xa3\x80\x80\x80\x00\x04\x05\x6c\x6f\x61\x64\x31\x00\x00\x05\x6c\x6f\x61\x64\x32\x00\x01\x06\x73\x74\x6f\x72\x65\x31\x00\x02\x06\x73\x74\x6f\x72\x65\x32\x00\x03\x0a\xb7\x80\x80\x80\x00\x04\x87\x80\x80\x80\x00\x00\x20\x00\x29\x03\x00\x0b\x88\x80\x80\x80\x00\x00\x20\x00\x29\x43\x01\x00\x0b\x89\x80\x80\x80\x00\x00\x20\x00\x20\x01\x37\x03\x00\x0b\x8a\x80\x80\x80\x00\x00\x20\x00\x20\x01\x37\x43\x01\x00\x0b"); 30 | 31 | // store1.wast:49 32 | run(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\xa4\x80\x80\x80\x00\x07\x60\x00\x00\x60\x01\x7f\x01\x6f\x60\x01\x6f\x01\x7f\x60\x01\x70\x01\x7f\x60\x02\x6f\x6f\x01\x7f\x60\x02\x70\x70\x01\x7f\x60\x02\x7f\x7e\x00\x02\x82\x81\x80\x80\x00\x06\x06\x6d\x6f\x64\x75\x6c\x65\x06\x73\x74\x6f\x72\x65\x31\x00\x06\x08\x73\x70\x65\x63\x74\x65\x73\x74\x09\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x69\x73\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x02\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x69\x73\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x03\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x65\x71\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x04\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x65\x71\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x05\x03\x82\x80\x80\x80\x00\x01\x00\x07\x87\x80\x80\x80\x00\x01\x03\x72\x75\x6e\x00\x06\x0a\x93\x80\x80\x80\x00\x01\x8d\x80\x80\x80\x00\x00\x02\x40\x41\x00\x42\x01\x10\x00\x0f\x0b\x00\x0b", exports($3)), "run", [])); // run(() => call($3, "store1", [0, int64("1")])) 33 | 34 | // store1.wast:50 35 | run(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\xa4\x80\x80\x80\x00\x07\x60\x00\x00\x60\x01\x7f\x01\x6f\x60\x01\x6f\x01\x7f\x60\x01\x70\x01\x7f\x60\x02\x6f\x6f\x01\x7f\x60\x02\x70\x70\x01\x7f\x60\x02\x7f\x7e\x00\x02\x82\x81\x80\x80\x00\x06\x06\x6d\x6f\x64\x75\x6c\x65\x06\x73\x74\x6f\x72\x65\x32\x00\x06\x08\x73\x70\x65\x63\x74\x65\x73\x74\x09\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x69\x73\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x02\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x69\x73\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x03\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x65\x71\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x04\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x65\x71\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x05\x03\x82\x80\x80\x80\x00\x01\x00\x07\x87\x80\x80\x80\x00\x01\x03\x72\x75\x6e\x00\x06\x0a\x93\x80\x80\x80\x00\x01\x8d\x80\x80\x80\x00\x00\x02\x40\x41\x00\x42\x02\x10\x00\x0f\x0b\x00\x0b", exports($3)), "run", [])); // run(() => call($3, "store2", [0, int64("2")])) 36 | 37 | // store1.wast:51 38 | run(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\xa4\x80\x80\x80\x00\x07\x60\x00\x00\x60\x01\x7f\x01\x6f\x60\x01\x6f\x01\x7f\x60\x01\x70\x01\x7f\x60\x02\x6f\x6f\x01\x7f\x60\x02\x70\x70\x01\x7f\x60\x01\x7f\x01\x7e\x02\x81\x81\x80\x80\x00\x06\x06\x6d\x6f\x64\x75\x6c\x65\x05\x6c\x6f\x61\x64\x31\x00\x06\x08\x73\x70\x65\x63\x74\x65\x73\x74\x09\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x69\x73\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x02\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x69\x73\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x03\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x65\x71\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x04\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x65\x71\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x05\x03\x82\x80\x80\x80\x00\x01\x00\x07\x87\x80\x80\x80\x00\x01\x03\x72\x75\x6e\x00\x06\x0a\x99\x80\x80\x80\x00\x01\x93\x80\x80\x80\x00\x00\x02\x40\x41\x00\x10\x00\x01\x42\x01\x01\x51\x45\x0d\x00\x0f\x0b\x00\x0b", exports($3)), "run", [])); // assert_return(() => call($3, "load1", [0]), int64("1")) 39 | 40 | // store1.wast:52 41 | run(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\xa4\x80\x80\x80\x00\x07\x60\x00\x00\x60\x01\x7f\x01\x6f\x60\x01\x6f\x01\x7f\x60\x01\x70\x01\x7f\x60\x02\x6f\x6f\x01\x7f\x60\x02\x70\x70\x01\x7f\x60\x01\x7f\x01\x7e\x02\x81\x81\x80\x80\x00\x06\x06\x6d\x6f\x64\x75\x6c\x65\x05\x6c\x6f\x61\x64\x32\x00\x06\x08\x73\x70\x65\x63\x74\x65\x73\x74\x09\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x69\x73\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x02\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x69\x73\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x03\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x65\x71\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x04\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x65\x71\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x05\x03\x82\x80\x80\x80\x00\x01\x00\x07\x87\x80\x80\x80\x00\x01\x03\x72\x75\x6e\x00\x06\x0a\x99\x80\x80\x80\x00\x01\x93\x80\x80\x80\x00\x00\x02\x40\x41\x00\x10\x00\x01\x42\x02\x01\x51\x45\x0d\x00\x0f\x0b\x00\x0b", exports($3)), "run", [])); // assert_return(() => call($3, "load2", [0]), int64("2")) 42 | -------------------------------------------------------------------------------- /test/core/multi-memory/traps0.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // traps0.wast:1 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x85\x80\x80\x80\x00\x01\x60\x01\x7f\x00\x03\x8f\x80\x80\x80\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x87\x80\x80\x80\x00\x03\x00\x01\x00\x01\x00\x01\x07\xa1\x82\x80\x80\x00\x0e\x0f\x6e\x6f\x5f\x64\x63\x65\x2e\x69\x33\x32\x2e\x6c\x6f\x61\x64\x00\x00\x13\x6e\x6f\x5f\x64\x63\x65\x2e\x69\x33\x32\x2e\x6c\x6f\x61\x64\x31\x36\x5f\x73\x00\x01\x13\x6e\x6f\x5f\x64\x63\x65\x2e\x69\x33\x32\x2e\x6c\x6f\x61\x64\x31\x36\x5f\x75\x00\x02\x12\x6e\x6f\x5f\x64\x63\x65\x2e\x69\x33\x32\x2e\x6c\x6f\x61\x64\x38\x5f\x73\x00\x03\x12\x6e\x6f\x5f\x64\x63\x65\x2e\x69\x33\x32\x2e\x6c\x6f\x61\x64\x38\x5f\x75\x00\x04\x0f\x6e\x6f\x5f\x64\x63\x65\x2e\x69\x36\x34\x2e\x6c\x6f\x61\x64\x00\x05\x13\x6e\x6f\x5f\x64\x63\x65\x2e\x69\x36\x34\x2e\x6c\x6f\x61\x64\x33\x32\x5f\x73\x00\x06\x13\x6e\x6f\x5f\x64\x63\x65\x2e\x69\x36\x34\x2e\x6c\x6f\x61\x64\x33\x32\x5f\x75\x00\x07\x13\x6e\x6f\x5f\x64\x63\x65\x2e\x69\x36\x34\x2e\x6c\x6f\x61\x64\x31\x36\x5f\x73\x00\x08\x13\x6e\x6f\x5f\x64\x63\x65\x2e\x69\x36\x34\x2e\x6c\x6f\x61\x64\x31\x36\x5f\x75\x00\x09\x12\x6e\x6f\x5f\x64\x63\x65\x2e\x69\x36\x34\x2e\x6c\x6f\x61\x64\x38\x5f\x73\x00\x0a\x12\x6e\x6f\x5f\x64\x63\x65\x2e\x69\x36\x34\x2e\x6c\x6f\x61\x64\x38\x5f\x75\x00\x0b\x0f\x6e\x6f\x5f\x64\x63\x65\x2e\x66\x33\x32\x2e\x6c\x6f\x61\x64\x00\x0c\x0f\x6e\x6f\x5f\x64\x63\x65\x2e\x66\x36\x34\x2e\x6c\x6f\x61\x64\x00\x0d\x0a\xc5\x81\x80\x80\x00\x0e\x89\x80\x80\x80\x00\x00\x20\x00\x28\x42\x01\x00\x1a\x0b\x89\x80\x80\x80\x00\x00\x20\x00\x2e\x41\x01\x00\x1a\x0b\x89\x80\x80\x80\x00\x00\x20\x00\x2f\x41\x01\x00\x1a\x0b\x89\x80\x80\x80\x00\x00\x20\x00\x2c\x40\x01\x00\x1a\x0b\x89\x80\x80\x80\x00\x00\x20\x00\x2d\x40\x01\x00\x1a\x0b\x89\x80\x80\x80\x00\x00\x20\x00\x29\x43\x01\x00\x1a\x0b\x89\x80\x80\x80\x00\x00\x20\x00\x34\x42\x01\x00\x1a\x0b\x89\x80\x80\x80\x00\x00\x20\x00\x35\x42\x02\x00\x1a\x0b\x89\x80\x80\x80\x00\x00\x20\x00\x32\x41\x02\x00\x1a\x0b\x89\x80\x80\x80\x00\x00\x20\x00\x33\x41\x02\x00\x1a\x0b\x89\x80\x80\x80\x00\x00\x20\x00\x30\x40\x02\x00\x1a\x0b\x89\x80\x80\x80\x00\x00\x20\x00\x31\x40\x02\x00\x1a\x0b\x89\x80\x80\x80\x00\x00\x20\x00\x2a\x42\x02\x00\x1a\x0b\x89\x80\x80\x80\x00\x00\x20\x00\x2b\x43\x02\x00\x1a\x0b"); 4 | 5 | // traps0.wast:22 6 | assert_trap(() => call($1, "no_dce.i32.load", [65_536])); 7 | 8 | // traps0.wast:23 9 | assert_trap(() => call($1, "no_dce.i32.load16_s", [65_536])); 10 | 11 | // traps0.wast:24 12 | assert_trap(() => call($1, "no_dce.i32.load16_u", [65_536])); 13 | 14 | // traps0.wast:25 15 | assert_trap(() => call($1, "no_dce.i32.load8_s", [65_536])); 16 | 17 | // traps0.wast:26 18 | assert_trap(() => call($1, "no_dce.i32.load8_u", [65_536])); 19 | 20 | // traps0.wast:27 21 | assert_trap(() => call($1, "no_dce.i64.load", [65_536])); 22 | 23 | // traps0.wast:28 24 | assert_trap(() => call($1, "no_dce.i64.load32_s", [65_536])); 25 | 26 | // traps0.wast:29 27 | assert_trap(() => call($1, "no_dce.i64.load32_u", [65_536])); 28 | 29 | // traps0.wast:30 30 | assert_trap(() => call($1, "no_dce.i64.load16_s", [65_536])); 31 | 32 | // traps0.wast:31 33 | assert_trap(() => call($1, "no_dce.i64.load16_u", [65_536])); 34 | 35 | // traps0.wast:32 36 | assert_trap(() => call($1, "no_dce.i64.load8_s", [65_536])); 37 | 38 | // traps0.wast:33 39 | assert_trap(() => call($1, "no_dce.i64.load8_u", [65_536])); 40 | 41 | // traps0.wast:34 42 | assert_trap(() => call($1, "no_dce.f32.load", [65_536])); 43 | 44 | // traps0.wast:35 45 | assert_trap(() => call($1, "no_dce.f64.load", [65_536])); 46 | -------------------------------------------------------------------------------- /test/core/obsolete-keywords.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // obsolete-keywords.wast:2 3 | assert_malformed("\x3c\x6d\x61\x6c\x66\x6f\x72\x6d\x65\x64\x20\x71\x75\x6f\x74\x65\x3e"); 4 | 5 | // obsolete-keywords.wast:10 6 | assert_malformed("\x3c\x6d\x61\x6c\x66\x6f\x72\x6d\x65\x64\x20\x71\x75\x6f\x74\x65\x3e"); 7 | 8 | // obsolete-keywords.wast:19 9 | assert_malformed("\x3c\x6d\x61\x6c\x66\x6f\x72\x6d\x65\x64\x20\x71\x75\x6f\x74\x65\x3e"); 10 | 11 | // obsolete-keywords.wast:26 12 | assert_malformed("\x3c\x6d\x61\x6c\x66\x6f\x72\x6d\x65\x64\x20\x71\x75\x6f\x74\x65\x3e"); 13 | 14 | // obsolete-keywords.wast:33 15 | assert_malformed("\x3c\x6d\x61\x6c\x66\x6f\x72\x6d\x65\x64\x20\x71\x75\x6f\x74\x65\x3e"); 16 | 17 | // obsolete-keywords.wast:40 18 | assert_malformed("\x3c\x6d\x61\x6c\x66\x6f\x72\x6d\x65\x64\x20\x71\x75\x6f\x74\x65\x3e"); 19 | 20 | // obsolete-keywords.wast:47 21 | assert_malformed("\x3c\x6d\x61\x6c\x66\x6f\x72\x6d\x65\x64\x20\x71\x75\x6f\x74\x65\x3e"); 22 | 23 | // obsolete-keywords.wast:55 24 | assert_malformed("\x3c\x6d\x61\x6c\x66\x6f\x72\x6d\x65\x64\x20\x71\x75\x6f\x74\x65\x3e"); 25 | 26 | // obsolete-keywords.wast:63 27 | assert_malformed("\x3c\x6d\x61\x6c\x66\x6f\x72\x6d\x65\x64\x20\x71\x75\x6f\x74\x65\x3e"); 28 | 29 | // obsolete-keywords.wast:70 30 | assert_malformed("\x3c\x6d\x61\x6c\x66\x6f\x72\x6d\x65\x64\x20\x71\x75\x6f\x74\x65\x3e"); 31 | 32 | // obsolete-keywords.wast:77 33 | assert_malformed("\x3c\x6d\x61\x6c\x66\x6f\x72\x6d\x65\x64\x20\x71\x75\x6f\x74\x65\x3e"); 34 | -------------------------------------------------------------------------------- /test/core/ref_func.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // ref_func.wast:1 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x86\x80\x80\x80\x00\x01\x60\x01\x7f\x01\x7f\x03\x82\x80\x80\x80\x00\x01\x00\x07\x85\x80\x80\x80\x00\x01\x01\x66\x00\x00\x0a\x8a\x80\x80\x80\x00\x01\x84\x80\x80\x80\x00\x00\x20\x00\x0b"); 4 | 5 | // ref_func.wast:4 6 | register("M", $1) 7 | 8 | // ref_func.wast:6 9 | let $2 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x8d\x80\x80\x80\x00\x03\x60\x01\x7f\x01\x7f\x60\x00\x00\x60\x00\x01\x7f\x02\x87\x80\x80\x80\x00\x01\x01\x4d\x01\x66\x00\x00\x03\x8f\x80\x80\x80\x00\x0e\x00\x01\x01\x01\x01\x01\x02\x02\x02\x01\x01\x00\x00\x00\x04\x84\x80\x80\x80\x00\x01\x70\x00\x01\x06\x9a\x80\x80\x80\x00\x05\x70\x00\xd2\x00\x0b\x70\x00\xd2\x01\x0b\x70\x01\xd2\x00\x0b\x70\x00\xd2\x03\x0b\x70\x00\xd2\x04\x0b\x07\xd0\x80\x80\x80\x00\x08\x09\x69\x73\x5f\x6e\x75\x6c\x6c\x2d\x66\x00\x07\x09\x69\x73\x5f\x6e\x75\x6c\x6c\x2d\x67\x00\x08\x09\x69\x73\x5f\x6e\x75\x6c\x6c\x2d\x76\x00\x09\x05\x73\x65\x74\x2d\x66\x00\x0a\x05\x73\x65\x74\x2d\x67\x00\x0b\x06\x63\x61\x6c\x6c\x2d\x66\x00\x0c\x06\x63\x61\x6c\x6c\x2d\x67\x00\x0d\x06\x63\x61\x6c\x6c\x2d\x76\x00\x0e\x09\x90\x80\x80\x80\x00\x03\x03\x00\x02\x03\x05\x03\x00\x02\x04\x06\x03\x00\x02\x00\x01\x0a\xa6\x81\x80\x80\x00\x0e\x87\x80\x80\x80\x00\x00\x20\x00\x41\x01\x6a\x0b\x88\x80\x80\x80\x00\x00\xd2\x05\x1a\xd2\x06\x1a\x0b\x82\x80\x80\x80\x00\x00\x0b\x82\x80\x80\x80\x00\x00\x0b\x82\x80\x80\x80\x00\x00\x0b\x82\x80\x80\x80\x00\x00\x0b\x85\x80\x80\x80\x00\x00\xd2\x00\xd1\x0b\x85\x80\x80\x80\x00\x00\xd2\x01\xd1\x0b\x85\x80\x80\x80\x00\x00\x23\x02\xd1\x0b\x86\x80\x80\x80\x00\x00\xd2\x00\x24\x02\x0b\x86\x80\x80\x80\x00\x00\xd2\x01\x24\x02\x0b\x8f\x80\x80\x80\x00\x00\x41\x00\xd2\x00\x26\x00\x20\x00\x41\x00\x11\x00\x00\x0b\x8f\x80\x80\x80\x00\x00\x41\x00\xd2\x01\x26\x00\x20\x00\x41\x00\x11\x00\x00\x0b\x8f\x80\x80\x80\x00\x00\x41\x00\x23\x02\x26\x00\x20\x00\x41\x00\x11\x00\x00\x0b"); 10 | 11 | // ref_func.wast:56 12 | assert_return(() => call($2, "is_null-f", []), 0); 13 | 14 | // ref_func.wast:57 15 | assert_return(() => call($2, "is_null-g", []), 0); 16 | 17 | // ref_func.wast:58 18 | assert_return(() => call($2, "is_null-v", []), 0); 19 | 20 | // ref_func.wast:60 21 | assert_return(() => call($2, "call-f", [4]), 4); 22 | 23 | // ref_func.wast:61 24 | assert_return(() => call($2, "call-g", [4]), 5); 25 | 26 | // ref_func.wast:62 27 | assert_return(() => call($2, "call-v", [4]), 4); 28 | 29 | // ref_func.wast:63 30 | run(() => call($2, "set-g", [])); 31 | 32 | // ref_func.wast:64 33 | assert_return(() => call($2, "call-v", [4]), 5); 34 | 35 | // ref_func.wast:65 36 | run(() => call($2, "set-f", [])); 37 | 38 | // ref_func.wast:66 39 | assert_return(() => call($2, "call-v", [4]), 4); 40 | 41 | // ref_func.wast:68 42 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x86\x80\x80\x80\x00\x01\x60\x01\x7f\x01\x7f\x02\x8d\x80\x80\x80\x00\x02\x01\x4d\x01\x66\x00\x00\x01\x4d\x01\x67\x00\x00\x06\x86\x80\x80\x80\x00\x01\x70\x00\xd2\x07\x0b"); 43 | 44 | // ref_func.wast:80 45 | let $3 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x88\x80\x80\x80\x00\x07\x00\x00\x00\x00\x00\x00\x00\x04\x84\x80\x80\x80\x00\x01\x70\x00\x01\x06\x86\x80\x80\x80\x00\x01\x70\x00\xd2\x00\x0b\x07\x85\x80\x80\x80\x00\x01\x01\x66\x00\x01\x09\x95\x80\x80\x80\x00\x04\x00\x41\x00\x0b\x01\x02\x00\x41\x00\x0b\x01\x03\x01\x00\x01\x04\x01\x00\x01\x05\x0a\xbf\x80\x80\x80\x00\x07\x82\x80\x80\x80\x00\x00\x0b\x82\x80\x80\x80\x00\x00\x0b\x82\x80\x80\x80\x00\x00\x0b\x82\x80\x80\x80\x00\x00\x0b\x82\x80\x80\x80\x00\x00\x0b\x82\x80\x80\x80\x00\x00\x0b\x8f\x80\x80\x80\x00\x00\xd2\x00\xd2\x01\xd2\x02\xd2\x03\xd2\x04\xd2\x05\x0f\x0b"); 46 | 47 | // ref_func.wast:108 48 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x0a\x8b\x80\x80\x80\x00\x01\x85\x80\x80\x80\x00\x00\xd2\x00\x1a\x0b"); 49 | 50 | // ref_func.wast:112 51 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x08\x81\x80\x80\x80\x00\x00\x0a\x8b\x80\x80\x80\x00\x01\x85\x80\x80\x80\x00\x00\xd2\x00\x1a\x0b"); 52 | -------------------------------------------------------------------------------- /test/core/ref_is_null.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // ref_is_null.wast:1 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x97\x80\x80\x80\x00\x05\x60\x01\x70\x01\x7f\x60\x01\x6f\x01\x7f\x60\x00\x00\x60\x01\x6f\x00\x60\x01\x7f\x01\x7f\x03\x88\x80\x80\x80\x00\x07\x00\x01\x02\x03\x02\x04\x04\x04\x87\x80\x80\x80\x00\x02\x70\x00\x02\x6f\x00\x02\x07\xc7\x80\x80\x80\x00\x06\x07\x66\x75\x6e\x63\x72\x65\x66\x00\x00\x09\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x01\x04\x69\x6e\x69\x74\x00\x03\x06\x64\x65\x69\x6e\x69\x74\x00\x04\x0c\x66\x75\x6e\x63\x72\x65\x66\x2d\x65\x6c\x65\x6d\x00\x05\x0e\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x2d\x65\x6c\x65\x6d\x00\x06\x09\x87\x80\x80\x80\x00\x01\x00\x41\x01\x0b\x01\x02\x0a\xd6\x80\x80\x80\x00\x07\x85\x80\x80\x80\x00\x00\x20\x00\xd1\x0b\x85\x80\x80\x80\x00\x00\x20\x00\xd1\x0b\x82\x80\x80\x80\x00\x00\x0b\x88\x80\x80\x80\x00\x00\x41\x01\x20\x00\x26\x01\x0b\x8e\x80\x80\x80\x00\x00\x41\x01\xd0\x70\x26\x00\x41\x01\xd0\x6f\x26\x01\x0b\x88\x80\x80\x80\x00\x00\x20\x00\x25\x00\x10\x00\x0b\x88\x80\x80\x80\x00\x00\x20\x00\x25\x01\x10\x01\x0b"); 4 | 5 | // ref_is_null.wast:30 6 | assert_return(() => call($1, "funcref", [null]), 1); 7 | 8 | // ref_is_null.wast:31 9 | assert_return(() => call($1, "externref", [null]), 1); 10 | 11 | // ref_is_null.wast:33 12 | assert_return(() => call($1, "externref", [externref(1)]), 0); 13 | 14 | // ref_is_null.wast:35 15 | run(() => call($1, "init", [externref(0)])); 16 | 17 | // ref_is_null.wast:37 18 | assert_return(() => call($1, "funcref-elem", [0]), 1); 19 | 20 | // ref_is_null.wast:38 21 | assert_return(() => call($1, "externref-elem", [0]), 1); 22 | 23 | // ref_is_null.wast:40 24 | assert_return(() => call($1, "funcref-elem", [1]), 0); 25 | 26 | // ref_is_null.wast:41 27 | assert_return(() => call($1, "externref-elem", [1]), 0); 28 | 29 | // ref_is_null.wast:43 30 | run(() => call($1, "deinit", [])); 31 | 32 | // ref_is_null.wast:45 33 | assert_return(() => call($1, "funcref-elem", [0]), 1); 34 | 35 | // ref_is_null.wast:46 36 | assert_return(() => call($1, "externref-elem", [0]), 1); 37 | 38 | // ref_is_null.wast:48 39 | assert_return(() => call($1, "funcref-elem", [1]), 1); 40 | 41 | // ref_is_null.wast:49 42 | assert_return(() => call($1, "externref-elem", [1]), 1); 43 | 44 | // ref_is_null.wast:51 45 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x85\x80\x80\x80\x00\x01\x60\x01\x7f\x00\x03\x82\x80\x80\x80\x00\x01\x00\x0a\x8b\x80\x80\x80\x00\x01\x85\x80\x80\x80\x00\x00\x20\x00\xd1\x0b"); 46 | 47 | // ref_is_null.wast:55 48 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x0a\x89\x80\x80\x80\x00\x01\x83\x80\x80\x80\x00\x00\xd1\x0b"); 49 | -------------------------------------------------------------------------------- /test/core/ref_null.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // ref_null.wast:1 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x89\x80\x80\x80\x00\x02\x60\x00\x01\x6f\x60\x00\x01\x70\x03\x83\x80\x80\x80\x00\x02\x00\x01\x06\x8b\x80\x80\x80\x00\x02\x6f\x00\xd0\x6f\x0b\x70\x00\xd0\x70\x0b\x07\x97\x80\x80\x80\x00\x02\x09\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x00\x07\x66\x75\x6e\x63\x72\x65\x66\x00\x01\x0a\x93\x80\x80\x80\x00\x02\x84\x80\x80\x80\x00\x00\xd0\x6f\x0b\x84\x80\x80\x80\x00\x00\xd0\x70\x0b"); 4 | 5 | // ref_null.wast:9 6 | assert_return(() => call($1, "externref", []), null); 7 | 8 | // ref_null.wast:10 9 | assert_return(() => call($1, "funcref", []), null); 10 | -------------------------------------------------------------------------------- /test/core/stack.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // stack.wast:1 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x8d\x80\x80\x80\x00\x03\x60\x01\x7e\x01\x7e\x60\x00\x01\x7f\x60\x00\x00\x03\x89\x80\x80\x80\x00\x08\x00\x00\x00\x00\x00\x01\x02\x01\x06\x86\x80\x80\x80\x00\x01\x7f\x01\x41\x00\x0b\x07\xd7\x80\x80\x80\x00\x06\x08\x66\x61\x63\x2d\x65\x78\x70\x72\x00\x00\x09\x66\x61\x63\x2d\x73\x74\x61\x63\x6b\x00\x01\x0d\x66\x61\x63\x2d\x73\x74\x61\x63\x6b\x2d\x72\x61\x77\x00\x02\x09\x66\x61\x63\x2d\x6d\x69\x78\x65\x64\x00\x03\x0d\x66\x61\x63\x2d\x6d\x69\x78\x65\x64\x2d\x72\x61\x77\x00\x04\x10\x6e\x6f\x74\x2d\x71\x75\x69\x74\x65\x2d\x61\x2d\x74\x72\x65\x65\x00\x07\x0a\xaf\x82\x80\x80\x00\x08\xaf\x80\x80\x80\x00\x01\x02\x7e\x20\x00\x21\x01\x42\x01\x21\x02\x02\x40\x03\x40\x20\x01\x42\x00\x51\x04\x40\x0c\x02\x05\x20\x01\x20\x02\x7e\x21\x02\x20\x01\x42\x01\x7d\x21\x01\x0b\x0c\x00\x0b\x0b\x20\x02\x0b\xaf\x80\x80\x80\x00\x01\x02\x7e\x20\x00\x21\x01\x42\x01\x21\x02\x02\x40\x03\x40\x20\x01\x42\x00\x51\x04\x40\x0c\x02\x05\x20\x01\x20\x02\x7e\x21\x02\x20\x01\x42\x01\x7d\x21\x01\x0b\x0c\x00\x0b\x0b\x20\x02\x0b\xaf\x80\x80\x80\x00\x01\x02\x7e\x20\x00\x21\x01\x42\x01\x21\x02\x02\x40\x03\x40\x20\x01\x42\x00\x51\x04\x40\x0c\x02\x05\x20\x01\x20\x02\x7e\x21\x02\x20\x01\x42\x01\x7d\x21\x01\x0b\x0c\x00\x0b\x0b\x20\x02\x0b\xaf\x80\x80\x80\x00\x01\x02\x7e\x20\x00\x21\x01\x42\x01\x21\x02\x02\x40\x03\x40\x20\x01\x42\x00\x51\x04\x40\x0c\x02\x05\x20\x01\x20\x02\x7e\x21\x02\x20\x01\x42\x01\x7d\x21\x01\x0b\x0c\x00\x0b\x0b\x20\x02\x0b\xaf\x80\x80\x80\x00\x01\x02\x7e\x20\x00\x21\x01\x42\x01\x21\x02\x02\x40\x03\x40\x20\x01\x42\x00\x51\x04\x40\x0c\x02\x05\x20\x01\x20\x02\x7e\x21\x02\x20\x01\x42\x01\x7d\x21\x01\x0b\x0c\x00\x0b\x0b\x20\x02\x0b\x8d\x80\x80\x80\x00\x01\x01\x7f\x41\x01\x23\x00\x6a\x24\x00\x23\x00\x0b\x85\x80\x80\x80\x00\x00\x10\x05\x1a\x0b\x89\x80\x80\x80\x00\x00\x10\x05\x10\x05\x10\x06\x6a\x0b"); 4 | 5 | // stack.wast:146 6 | run(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\xa4\x80\x80\x80\x00\x07\x60\x00\x00\x60\x01\x7f\x01\x6f\x60\x01\x6f\x01\x7f\x60\x01\x70\x01\x7f\x60\x02\x6f\x6f\x01\x7f\x60\x02\x70\x70\x01\x7f\x60\x01\x7e\x01\x7e\x02\x84\x81\x80\x80\x00\x06\x06\x6d\x6f\x64\x75\x6c\x65\x08\x66\x61\x63\x2d\x65\x78\x70\x72\x00\x06\x08\x73\x70\x65\x63\x74\x65\x73\x74\x09\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x69\x73\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x02\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x69\x73\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x03\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x65\x71\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x04\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x65\x71\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x05\x03\x82\x80\x80\x80\x00\x01\x00\x07\x87\x80\x80\x80\x00\x01\x03\x72\x75\x6e\x00\x06\x0a\xa2\x80\x80\x80\x00\x01\x9c\x80\x80\x80\x00\x00\x02\x40\x42\x19\x10\x00\x01\x42\x80\x80\x80\xde\x87\x92\xec\xcf\xe1\x00\x01\x51\x45\x0d\x00\x0f\x0b\x00\x0b", exports($1)), "run", [])); // assert_return(() => call($1, "fac-expr", [int64("25")]), int64("7_034_535_277_573_963_776")) 7 | 8 | // stack.wast:147 9 | run(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\xa4\x80\x80\x80\x00\x07\x60\x00\x00\x60\x01\x7f\x01\x6f\x60\x01\x6f\x01\x7f\x60\x01\x70\x01\x7f\x60\x02\x6f\x6f\x01\x7f\x60\x02\x70\x70\x01\x7f\x60\x01\x7e\x01\x7e\x02\x85\x81\x80\x80\x00\x06\x06\x6d\x6f\x64\x75\x6c\x65\x09\x66\x61\x63\x2d\x73\x74\x61\x63\x6b\x00\x06\x08\x73\x70\x65\x63\x74\x65\x73\x74\x09\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x69\x73\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x02\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x69\x73\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x03\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x65\x71\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x04\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x65\x71\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x05\x03\x82\x80\x80\x80\x00\x01\x00\x07\x87\x80\x80\x80\x00\x01\x03\x72\x75\x6e\x00\x06\x0a\xa2\x80\x80\x80\x00\x01\x9c\x80\x80\x80\x00\x00\x02\x40\x42\x19\x10\x00\x01\x42\x80\x80\x80\xde\x87\x92\xec\xcf\xe1\x00\x01\x51\x45\x0d\x00\x0f\x0b\x00\x0b", exports($1)), "run", [])); // assert_return(() => call($1, "fac-stack", [int64("25")]), int64("7_034_535_277_573_963_776")) 10 | 11 | // stack.wast:148 12 | run(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\xa4\x80\x80\x80\x00\x07\x60\x00\x00\x60\x01\x7f\x01\x6f\x60\x01\x6f\x01\x7f\x60\x01\x70\x01\x7f\x60\x02\x6f\x6f\x01\x7f\x60\x02\x70\x70\x01\x7f\x60\x01\x7e\x01\x7e\x02\x85\x81\x80\x80\x00\x06\x06\x6d\x6f\x64\x75\x6c\x65\x09\x66\x61\x63\x2d\x6d\x69\x78\x65\x64\x00\x06\x08\x73\x70\x65\x63\x74\x65\x73\x74\x09\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x69\x73\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x02\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x69\x73\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x03\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0c\x65\x71\x5f\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x04\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x65\x71\x5f\x66\x75\x6e\x63\x72\x65\x66\x00\x05\x03\x82\x80\x80\x80\x00\x01\x00\x07\x87\x80\x80\x80\x00\x01\x03\x72\x75\x6e\x00\x06\x0a\xa2\x80\x80\x80\x00\x01\x9c\x80\x80\x80\x00\x00\x02\x40\x42\x19\x10\x00\x01\x42\x80\x80\x80\xde\x87\x92\xec\xcf\xe1\x00\x01\x51\x45\x0d\x00\x0f\x0b\x00\x0b", exports($1)), "run", [])); // assert_return(() => call($1, "fac-mixed", [int64("25")]), int64("7_034_535_277_573_963_776")) 13 | 14 | // stack.wast:150 15 | assert_return(() => call($1, "not-quite-a-tree", []), 3); 16 | 17 | // stack.wast:151 18 | assert_return(() => call($1, "not-quite-a-tree", []), 9); 19 | 20 | // stack.wast:156 21 | let $2 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x8c\x80\x80\x80\x00\x03\x60\x00\x00\x60\x00\x01\x7f\x60\x01\x7f\x00\x03\x82\x80\x80\x80\x00\x01\x00\x04\x84\x80\x80\x80\x00\x01\x70\x00\x01\x0a\xb7\x83\x80\x80\x00\x01\xb1\x83\x80\x80\x00\x00\x02\x40\x41\x00\x11\x00\x00\x0b\x03\x40\x41\x00\x11\x00\x00\x0b\x41\x00\x04\x40\x41\x00\x11\x00\x00\x0b\x41\x00\x04\x40\x41\x00\x11\x00\x00\x05\x41\x00\x11\x00\x00\x0b\x02\x40\x41\x00\x11\x00\x00\x0b\x03\x40\x41\x00\x11\x00\x00\x0b\x41\x00\x04\x40\x41\x00\x11\x00\x00\x0b\x41\x00\x04\x40\x41\x00\x11\x00\x00\x05\x41\x00\x11\x00\x00\x0b\x02\x40\x41\x00\x41\x00\x11\x02\x00\x0b\x03\x40\x41\x00\x41\x00\x11\x02\x00\x0b\x41\x00\x04\x40\x41\x00\x41\x00\x11\x02\x00\x0b\x41\x00\x04\x40\x41\x00\x41\x00\x11\x02\x00\x05\x41\x00\x41\x00\x11\x02\x00\x0b\x02\x7f\x41\x00\x11\x01\x00\x0b\x1a\x03\x7f\x41\x00\x11\x01\x00\x0b\x1a\x41\x00\x04\x7f\x41\x00\x11\x01\x00\x05\x41\x00\x11\x01\x00\x0b\x1a\x02\x40\x41\x00\x11\x00\x00\x0b\x03\x40\x41\x00\x11\x00\x00\x0b\x41\x00\x04\x40\x41\x00\x11\x00\x00\x0b\x41\x00\x04\x40\x41\x00\x11\x00\x00\x05\x41\x00\x11\x00\x00\x0b\x02\x40\x41\x00\x11\x00\x00\x0b\x03\x40\x41\x00\x11\x00\x00\x0b\x41\x00\x04\x40\x41\x00\x11\x00\x00\x0b\x41\x00\x04\x40\x41\x00\x11\x00\x00\x05\x41\x00\x11\x00\x00\x0b\x02\x40\x41\x00\x11\x00\x00\x0b\x03\x40\x41\x00\x11\x00\x00\x0b\x41\x00\x04\x40\x41\x00\x11\x00\x00\x0b\x41\x00\x04\x40\x41\x00\x11\x00\x00\x05\x41\x00\x11\x00\x00\x0b\x02\x40\x41\x00\x41\x00\x11\x02\x00\x0b\x03\x40\x41\x00\x41\x00\x11\x02\x00\x0b\x41\x00\x04\x40\x41\x00\x41\x00\x11\x02\x00\x0b\x41\x00\x04\x40\x41\x00\x41\x00\x11\x02\x00\x05\x41\x00\x41\x00\x11\x02\x00\x0b\x02\x7f\x41\x00\x11\x01\x00\x0b\x1a\x03\x7f\x41\x00\x11\x01\x00\x0b\x1a\x41\x00\x04\x7f\x41\x00\x11\x01\x00\x05\x41\x00\x11\x01\x00\x0b\x1a\x02\x40\x41\x00\x11\x00\x00\x0b\x03\x40\x41\x00\x11\x00\x00\x0b\x41\x00\x04\x40\x41\x00\x11\x00\x00\x0b\x41\x00\x04\x40\x41\x00\x11\x00\x00\x05\x41\x00\x11\x00\x00\x0b\x41\x00\x11\x00\x00\x0b"); 22 | -------------------------------------------------------------------------------- /test/core/start.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // start.wast:1 3 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x08\x81\x80\x80\x80\x00\x01\x0a\x88\x80\x80\x80\x00\x01\x82\x80\x80\x80\x00\x00\x0b"); 4 | 5 | // start.wast:6 6 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x85\x80\x80\x80\x00\x01\x60\x00\x01\x7f\x03\x82\x80\x80\x80\x00\x01\x00\x08\x81\x80\x80\x80\x00\x00\x0a\x8b\x80\x80\x80\x00\x01\x85\x80\x80\x80\x00\x00\x41\x00\x0f\x0b"); 7 | 8 | // start.wast:13 9 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x85\x80\x80\x80\x00\x01\x60\x01\x7f\x00\x03\x82\x80\x80\x80\x00\x01\x00\x08\x81\x80\x80\x80\x00\x00\x0a\x88\x80\x80\x80\x00\x01\x82\x80\x80\x80\x00\x00\x0b"); 10 | 11 | // start.wast:21 12 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x88\x80\x80\x80\x00\x02\x60\x00\x00\x60\x00\x01\x7f\x03\x84\x80\x80\x80\x00\x03\x00\x01\x00\x05\x84\x80\x80\x80\x00\x01\x01\x01\x01\x07\x8d\x80\x80\x80\x00\x02\x03\x69\x6e\x63\x00\x00\x03\x67\x65\x74\x00\x01\x08\x81\x80\x80\x80\x00\x02\x0a\xaf\x80\x80\x80\x00\x03\x8f\x80\x80\x80\x00\x00\x41\x00\x41\x00\x2d\x00\x00\x41\x01\x6a\x3a\x00\x00\x0b\x88\x80\x80\x80\x00\x00\x41\x00\x2d\x00\x00\x0f\x0b\x88\x80\x80\x80\x00\x00\x10\x00\x10\x00\x10\x00\x0b\x0b\x87\x80\x80\x80\x00\x01\x00\x41\x00\x0b\x01\x41"); 13 | 14 | // start.wast:45 15 | assert_return(() => call($1, "get", []), 68); 16 | 17 | // start.wast:46 18 | run(() => call($1, "inc", [])); 19 | 20 | // start.wast:47 21 | assert_return(() => call($1, "get", []), 69); 22 | 23 | // start.wast:48 24 | run(() => call($1, "inc", [])); 25 | 26 | // start.wast:49 27 | assert_return(() => call($1, "get", []), 70); 28 | 29 | // start.wast:51 30 | let $2 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x88\x80\x80\x80\x00\x02\x60\x00\x00\x60\x00\x01\x7f\x03\x84\x80\x80\x80\x00\x03\x00\x01\x00\x05\x84\x80\x80\x80\x00\x01\x01\x01\x01\x07\x8d\x80\x80\x80\x00\x02\x03\x69\x6e\x63\x00\x00\x03\x67\x65\x74\x00\x01\x08\x81\x80\x80\x80\x00\x02\x0a\xaf\x80\x80\x80\x00\x03\x8f\x80\x80\x80\x00\x00\x41\x00\x41\x00\x2d\x00\x00\x41\x01\x6a\x3a\x00\x00\x0b\x88\x80\x80\x80\x00\x00\x41\x00\x2d\x00\x00\x0f\x0b\x88\x80\x80\x80\x00\x00\x10\x00\x10\x00\x10\x00\x0b\x0b\x87\x80\x80\x80\x00\x01\x00\x41\x00\x0b\x01\x41"); 31 | 32 | // start.wast:74 33 | assert_return(() => call($2, "get", []), 68); 34 | 35 | // start.wast:75 36 | run(() => call($2, "inc", [])); 37 | 38 | // start.wast:76 39 | assert_return(() => call($2, "get", []), 69); 40 | 41 | // start.wast:77 42 | run(() => call($2, "inc", [])); 43 | 44 | // start.wast:78 45 | assert_return(() => call($2, "get", []), 70); 46 | 47 | // start.wast:80 48 | let $3 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x88\x80\x80\x80\x00\x02\x60\x01\x7f\x00\x60\x00\x00\x02\x96\x80\x80\x80\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x09\x70\x72\x69\x6e\x74\x5f\x69\x33\x32\x00\x00\x03\x82\x80\x80\x80\x00\x01\x01\x08\x81\x80\x80\x80\x00\x01\x0a\x8c\x80\x80\x80\x00\x01\x86\x80\x80\x80\x00\x00\x41\x01\x10\x00\x0b"); 49 | 50 | // start.wast:86 51 | let $4 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x88\x80\x80\x80\x00\x02\x60\x01\x7f\x00\x60\x00\x00\x02\x96\x80\x80\x80\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x09\x70\x72\x69\x6e\x74\x5f\x69\x33\x32\x00\x00\x03\x82\x80\x80\x80\x00\x01\x01\x08\x81\x80\x80\x80\x00\x01\x0a\x8c\x80\x80\x80\x00\x01\x86\x80\x80\x80\x00\x00\x41\x02\x10\x00\x0b"); 52 | 53 | // start.wast:92 54 | let $5 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x02\x92\x80\x80\x80\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x05\x70\x72\x69\x6e\x74\x00\x00\x08\x81\x80\x80\x80\x00\x00"); 55 | 56 | // start.wast:97 57 | assert_uninstantiable("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x08\x81\x80\x80\x80\x00\x00\x0a\x89\x80\x80\x80\x00\x01\x83\x80\x80\x80\x00\x00\x00\x0b"); 58 | 59 | // start.wast:102 60 | assert_malformed("\x3c\x6d\x61\x6c\x66\x6f\x72\x6d\x65\x64\x20\x71\x75\x6f\x74\x65\x3e"); 61 | -------------------------------------------------------------------------------- /test/core/table-sub.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // table-sub.wast:1 3 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x04\x87\x80\x80\x80\x00\x02\x70\x00\x0a\x6f\x00\x0a\x0a\x92\x80\x80\x80\x00\x01\x8c\x80\x80\x80\x00\x00\x41\x00\x41\x01\x41\x02\xfc\x0e\x00\x01\x0b"); 4 | 5 | // table-sub.wast:12 6 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x04\x84\x80\x80\x80\x00\x01\x70\x00\x0a\x09\x84\x80\x80\x80\x00\x01\x05\x6f\x00\x0a\x92\x80\x80\x80\x00\x01\x8c\x80\x80\x80\x00\x00\x41\x00\x41\x01\x41\x02\xfc\x0c\x00\x00\x0b"); 7 | -------------------------------------------------------------------------------- /test/core/table.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // table.wast:3 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x04\x84\x80\x80\x80\x00\x01\x70\x00\x00"); 4 | 5 | // table.wast:4 6 | let $2 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x04\x84\x80\x80\x80\x00\x01\x70\x00\x01"); 7 | 8 | // table.wast:5 9 | let $3 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x04\x85\x80\x80\x80\x00\x01\x70\x01\x00\x00"); 10 | 11 | // table.wast:6 12 | let $4 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x04\x85\x80\x80\x80\x00\x01\x70\x01\x00\x01"); 13 | 14 | // table.wast:7 15 | let $5 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x04\x86\x80\x80\x80\x00\x01\x70\x01\x01\x80\x02"); 16 | 17 | // table.wast:8 18 | let $6 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x04\x87\x80\x80\x80\x00\x01\x70\x01\x00\x80\x80\x04"); 19 | 20 | // table.wast:9 21 | let $7 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x04\x89\x80\x80\x80\x00\x01\x70\x01\x00\xff\xff\xff\xff\x0f"); 22 | 23 | // table.wast:11 24 | let $8 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x04\x87\x80\x80\x80\x00\x02\x70\x00\x00\x70\x00\x00"); 25 | 26 | // table.wast:12 27 | let $9 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x02\x94\x80\x80\x80\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x05\x74\x61\x62\x6c\x65\x01\x70\x00\x00\x04\x84\x80\x80\x80\x00\x01\x70\x00\x00"); 28 | 29 | // table.wast:14 30 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x09\x86\x80\x80\x80\x00\x01\x00\x41\x00\x0b\x00"); 31 | 32 | // table.wast:15 33 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x09\x87\x80\x80\x80\x00\x01\x00\x41\x00\x0b\x01\x00\x0a\x88\x80\x80\x80\x00\x01\x82\x80\x80\x80\x00\x00\x0b"); 34 | 35 | // table.wast:18 36 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x04\x85\x80\x80\x80\x00\x01\x70\x01\x01\x00"); 37 | 38 | // table.wast:22 39 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x04\x89\x80\x80\x80\x00\x01\x70\x01\xff\xff\xff\xff\x0f\x00"); 40 | 41 | // table.wast:27 42 | assert_malformed("\x3c\x6d\x61\x6c\x66\x6f\x72\x6d\x65\x64\x20\x71\x75\x6f\x74\x65\x3e"); 43 | 44 | // table.wast:31 45 | assert_malformed("\x3c\x6d\x61\x6c\x66\x6f\x72\x6d\x65\x64\x20\x71\x75\x6f\x74\x65\x3e"); 46 | 47 | // table.wast:35 48 | assert_malformed("\x3c\x6d\x61\x6c\x66\x6f\x72\x6d\x65\x64\x20\x71\x75\x6f\x74\x65\x3e"); 49 | 50 | // table.wast:43 51 | assert_malformed("\x3c\x6d\x61\x6c\x66\x6f\x72\x6d\x65\x64\x20\x71\x75\x6f\x74\x65\x3e"); 52 | 53 | // table.wast:47 54 | assert_malformed("\x3c\x6d\x61\x6c\x66\x6f\x72\x6d\x65\x64\x20\x71\x75\x6f\x74\x65\x3e"); 55 | 56 | // table.wast:51 57 | assert_malformed("\x3c\x6d\x61\x6c\x66\x6f\x72\x6d\x65\x64\x20\x71\x75\x6f\x74\x65\x3e"); 58 | -------------------------------------------------------------------------------- /test/core/table_fill.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // table_fill.wast:1 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x8c\x80\x80\x80\x00\x02\x60\x03\x7f\x6f\x7f\x00\x60\x01\x7f\x01\x6f\x03\x84\x80\x80\x80\x00\x03\x00\x00\x01\x04\x84\x80\x80\x80\x00\x01\x6f\x00\x0a\x07\x9c\x80\x80\x80\x00\x03\x04\x66\x69\x6c\x6c\x00\x00\x0b\x66\x69\x6c\x6c\x2d\x61\x62\x62\x72\x65\x76\x00\x01\x03\x67\x65\x74\x00\x02\x0a\xac\x80\x80\x80\x00\x03\x8b\x80\x80\x80\x00\x00\x20\x00\x20\x01\x20\x02\xfc\x11\x00\x0b\x8b\x80\x80\x80\x00\x00\x20\x00\x20\x01\x20\x02\xfc\x11\x00\x0b\x86\x80\x80\x80\x00\x00\x20\x00\x25\x00\x0b"); 4 | 5 | // table_fill.wast:17 6 | assert_return(() => call($1, "get", [1]), null); 7 | 8 | // table_fill.wast:18 9 | assert_return(() => call($1, "get", [2]), null); 10 | 11 | // table_fill.wast:19 12 | assert_return(() => call($1, "get", [3]), null); 13 | 14 | // table_fill.wast:20 15 | assert_return(() => call($1, "get", [4]), null); 16 | 17 | // table_fill.wast:21 18 | assert_return(() => call($1, "get", [5]), null); 19 | 20 | // table_fill.wast:23 21 | assert_return(() => call($1, "fill", [2, externref(1), 3])); 22 | 23 | // table_fill.wast:24 24 | assert_return(() => call($1, "get", [1]), null); 25 | 26 | // table_fill.wast:25 27 | assert_return(() => call($1, "get", [2]), externref(1)); 28 | 29 | // table_fill.wast:26 30 | assert_return(() => call($1, "get", [3]), externref(1)); 31 | 32 | // table_fill.wast:27 33 | assert_return(() => call($1, "get", [4]), externref(1)); 34 | 35 | // table_fill.wast:28 36 | assert_return(() => call($1, "get", [5]), null); 37 | 38 | // table_fill.wast:30 39 | assert_return(() => call($1, "fill", [4, externref(2), 2])); 40 | 41 | // table_fill.wast:31 42 | assert_return(() => call($1, "get", [3]), externref(1)); 43 | 44 | // table_fill.wast:32 45 | assert_return(() => call($1, "get", [4]), externref(2)); 46 | 47 | // table_fill.wast:33 48 | assert_return(() => call($1, "get", [5]), externref(2)); 49 | 50 | // table_fill.wast:34 51 | assert_return(() => call($1, "get", [6]), null); 52 | 53 | // table_fill.wast:36 54 | assert_return(() => call($1, "fill", [4, externref(3), 0])); 55 | 56 | // table_fill.wast:37 57 | assert_return(() => call($1, "get", [3]), externref(1)); 58 | 59 | // table_fill.wast:38 60 | assert_return(() => call($1, "get", [4]), externref(2)); 61 | 62 | // table_fill.wast:39 63 | assert_return(() => call($1, "get", [5]), externref(2)); 64 | 65 | // table_fill.wast:41 66 | assert_return(() => call($1, "fill", [8, externref(4), 2])); 67 | 68 | // table_fill.wast:42 69 | assert_return(() => call($1, "get", [7]), null); 70 | 71 | // table_fill.wast:43 72 | assert_return(() => call($1, "get", [8]), externref(4)); 73 | 74 | // table_fill.wast:44 75 | assert_return(() => call($1, "get", [9]), externref(4)); 76 | 77 | // table_fill.wast:46 78 | assert_return(() => call($1, "fill-abbrev", [9, null, 1])); 79 | 80 | // table_fill.wast:47 81 | assert_return(() => call($1, "get", [8]), externref(4)); 82 | 83 | // table_fill.wast:48 84 | assert_return(() => call($1, "get", [9]), null); 85 | 86 | // table_fill.wast:50 87 | assert_return(() => call($1, "fill", [10, externref(5), 0])); 88 | 89 | // table_fill.wast:51 90 | assert_return(() => call($1, "get", [9]), null); 91 | 92 | // table_fill.wast:53 93 | assert_trap(() => call($1, "fill", [8, externref(6), 3])); 94 | 95 | // table_fill.wast:57 96 | assert_return(() => call($1, "get", [7]), null); 97 | 98 | // table_fill.wast:58 99 | assert_return(() => call($1, "get", [8]), externref(4)); 100 | 101 | // table_fill.wast:59 102 | assert_return(() => call($1, "get", [9]), null); 103 | 104 | // table_fill.wast:61 105 | assert_trap(() => call($1, "fill", [11, null, 0])); 106 | 107 | // table_fill.wast:66 108 | assert_trap(() => call($1, "fill", [11, null, 10])); 109 | 110 | // table_fill.wast:74 111 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x04\x84\x80\x80\x80\x00\x01\x6f\x00\x0a\x0a\x8b\x80\x80\x80\x00\x01\x85\x80\x80\x80\x00\x00\xfc\x11\x00\x0b"); 112 | 113 | // table_fill.wast:83 114 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x04\x84\x80\x80\x80\x00\x01\x6f\x00\x0a\x0a\x8f\x80\x80\x80\x00\x01\x89\x80\x80\x80\x00\x00\xd0\x6f\x41\x01\xfc\x11\x00\x0b"); 115 | 116 | // table_fill.wast:92 117 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x04\x84\x80\x80\x80\x00\x01\x6f\x00\x0a\x0a\x8f\x80\x80\x80\x00\x01\x89\x80\x80\x80\x00\x00\x41\x01\x41\x01\xfc\x11\x00\x0b"); 118 | 119 | // table_fill.wast:101 120 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x04\x84\x80\x80\x80\x00\x01\x6f\x00\x0a\x0a\x8f\x80\x80\x80\x00\x01\x89\x80\x80\x80\x00\x00\x41\x01\xd0\x6f\xfc\x11\x00\x0b"); 121 | 122 | // table_fill.wast:110 123 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x04\x84\x80\x80\x80\x00\x01\x6f\x00\x00\x0a\x94\x80\x80\x80\x00\x01\x8e\x80\x80\x80\x00\x00\x43\x00\x00\x80\x3f\xd0\x6f\x41\x01\xfc\x11\x00\x0b"); 124 | 125 | // table_fill.wast:119 126 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x85\x80\x80\x80\x00\x01\x60\x01\x6f\x00\x03\x82\x80\x80\x80\x00\x01\x00\x04\x84\x80\x80\x80\x00\x01\x70\x00\x00\x0a\x91\x80\x80\x80\x00\x01\x8b\x80\x80\x80\x00\x00\x41\x01\x20\x00\x41\x01\xfc\x11\x00\x0b"); 127 | 128 | // table_fill.wast:128 129 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x04\x84\x80\x80\x80\x00\x01\x6f\x00\x00\x0a\x94\x80\x80\x80\x00\x01\x8e\x80\x80\x80\x00\x00\x41\x01\xd0\x6f\x43\x00\x00\x80\x3f\xfc\x11\x00\x0b"); 130 | 131 | // table_fill.wast:138 132 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x85\x80\x80\x80\x00\x01\x60\x01\x6f\x00\x03\x82\x80\x80\x80\x00\x01\x00\x04\x87\x80\x80\x80\x00\x02\x6f\x00\x01\x70\x00\x01\x0a\x91\x80\x80\x80\x00\x01\x8b\x80\x80\x80\x00\x00\x41\x00\x20\x00\x41\x01\xfc\x11\x01\x0b"); 133 | 134 | // table_fill.wast:149 135 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x85\x80\x80\x80\x00\x01\x60\x00\x01\x7f\x03\x82\x80\x80\x80\x00\x01\x00\x04\x84\x80\x80\x80\x00\x01\x6f\x00\x01\x0a\x91\x80\x80\x80\x00\x01\x8b\x80\x80\x80\x00\x00\x41\x00\xd0\x6f\x41\x01\xfc\x11\x00\x0b"); 136 | -------------------------------------------------------------------------------- /test/core/table_get.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // table_get.wast:1 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x97\x80\x80\x80\x00\x05\x60\x00\x00\x60\x01\x6f\x00\x60\x01\x7f\x01\x6f\x60\x01\x7f\x01\x70\x60\x01\x7f\x01\x7f\x03\x86\x80\x80\x80\x00\x05\x00\x01\x02\x03\x04\x04\x87\x80\x80\x80\x00\x02\x6f\x00\x02\x70\x00\x03\x07\xb8\x80\x80\x80\x00\x04\x04\x69\x6e\x69\x74\x00\x01\x0d\x67\x65\x74\x2d\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x02\x0b\x67\x65\x74\x2d\x66\x75\x6e\x63\x72\x65\x66\x00\x03\x0f\x69\x73\x5f\x6e\x75\x6c\x6c\x2d\x66\x75\x6e\x63\x72\x65\x66\x00\x04\x09\x89\x80\x80\x80\x00\x01\x02\x01\x41\x01\x0b\x00\x01\x00\x0a\xbf\x80\x80\x80\x00\x05\x82\x80\x80\x80\x00\x00\x0b\x90\x80\x80\x80\x00\x00\x41\x01\x20\x00\x26\x00\x41\x02\x41\x01\x25\x01\x26\x01\x0b\x86\x80\x80\x80\x00\x00\x20\x00\x25\x00\x0b\x86\x80\x80\x80\x00\x00\x20\x00\x25\x01\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x10\x03\xd1\x0b"); 4 | 5 | // table_get.wast:24 6 | run(() => call($1, "init", [externref(1)])); 7 | 8 | // table_get.wast:26 9 | assert_return(() => call($1, "get-externref", [0]), null); 10 | 11 | // table_get.wast:27 12 | assert_return(() => call($1, "get-externref", [1]), externref(1)); 13 | 14 | // table_get.wast:29 15 | assert_return(() => call($1, "get-funcref", [0]), null); 16 | 17 | // table_get.wast:30 18 | assert_return(() => call($1, "is_null-funcref", [1]), 0); 19 | 20 | // table_get.wast:31 21 | assert_return(() => call($1, "is_null-funcref", [2]), 0); 22 | 23 | // table_get.wast:33 24 | assert_trap(() => call($1, "get-externref", [2])); 25 | 26 | // table_get.wast:34 27 | assert_trap(() => call($1, "get-funcref", [3])); 28 | 29 | // table_get.wast:35 30 | assert_trap(() => call($1, "get-externref", [-1])); 31 | 32 | // table_get.wast:36 33 | assert_trap(() => call($1, "get-funcref", [-1])); 34 | 35 | // table_get.wast:41 36 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x85\x80\x80\x80\x00\x01\x60\x00\x01\x6f\x03\x82\x80\x80\x80\x00\x01\x00\x04\x84\x80\x80\x80\x00\x01\x6f\x00\x0a\x0a\x8a\x80\x80\x80\x00\x01\x84\x80\x80\x80\x00\x00\x25\x00\x0b"); 37 | 38 | // table_get.wast:50 39 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x85\x80\x80\x80\x00\x01\x60\x00\x01\x6f\x03\x82\x80\x80\x80\x00\x01\x00\x04\x84\x80\x80\x80\x00\x01\x6f\x00\x0a\x0a\x8f\x80\x80\x80\x00\x01\x89\x80\x80\x80\x00\x00\x43\x00\x00\x80\x3f\x25\x00\x0b"); 40 | 41 | // table_get.wast:60 42 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x04\x84\x80\x80\x80\x00\x01\x6f\x00\x0a\x0a\x8c\x80\x80\x80\x00\x01\x86\x80\x80\x80\x00\x00\x41\x00\x25\x00\x0b"); 43 | 44 | // table_get.wast:69 45 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x85\x80\x80\x80\x00\x01\x60\x00\x01\x70\x03\x82\x80\x80\x80\x00\x01\x00\x04\x84\x80\x80\x80\x00\x01\x6f\x00\x0a\x0a\x8c\x80\x80\x80\x00\x01\x86\x80\x80\x80\x00\x00\x41\x01\x25\x00\x0b"); 46 | 47 | // table_get.wast:79 48 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x85\x80\x80\x80\x00\x01\x60\x00\x01\x70\x03\x82\x80\x80\x80\x00\x01\x00\x04\x87\x80\x80\x80\x00\x02\x70\x00\x01\x6f\x00\x01\x0a\x8c\x80\x80\x80\x00\x01\x86\x80\x80\x80\x00\x00\x41\x00\x25\x01\x0b"); 49 | -------------------------------------------------------------------------------- /test/core/table_grow.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // table_grow.wast:1 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x95\x80\x80\x80\x00\x04\x60\x01\x7f\x01\x6f\x60\x02\x7f\x6f\x00\x60\x02\x7f\x6f\x01\x7f\x60\x00\x01\x7f\x03\x86\x80\x80\x80\x00\x05\x00\x01\x02\x02\x03\x04\x84\x80\x80\x80\x00\x01\x6f\x00\x00\x07\xa9\x80\x80\x80\x00\x05\x03\x67\x65\x74\x00\x00\x03\x73\x65\x74\x00\x01\x04\x67\x72\x6f\x77\x00\x02\x0b\x67\x72\x6f\x77\x2d\x61\x62\x62\x72\x65\x76\x00\x03\x04\x73\x69\x7a\x65\x00\x04\x0a\xbf\x80\x80\x80\x00\x05\x86\x80\x80\x80\x00\x00\x20\x00\x25\x00\x0b\x88\x80\x80\x80\x00\x00\x20\x00\x20\x01\x26\x00\x0b\x89\x80\x80\x80\x00\x00\x20\x01\x20\x00\xfc\x0f\x00\x0b\x89\x80\x80\x80\x00\x00\x20\x01\x20\x00\xfc\x0f\x00\x0b\x85\x80\x80\x80\x00\x00\xfc\x10\x00\x0b"); 4 | 5 | // table_grow.wast:16 6 | assert_return(() => call($1, "size", []), 0); 7 | 8 | // table_grow.wast:17 9 | assert_trap(() => call($1, "set", [0, externref(2)])); 10 | 11 | // table_grow.wast:18 12 | assert_trap(() => call($1, "get", [0])); 13 | 14 | // table_grow.wast:20 15 | assert_return(() => call($1, "grow", [1, null]), 0); 16 | 17 | // table_grow.wast:21 18 | assert_return(() => call($1, "size", []), 1); 19 | 20 | // table_grow.wast:22 21 | assert_return(() => call($1, "get", [0]), null); 22 | 23 | // table_grow.wast:23 24 | assert_return(() => call($1, "set", [0, externref(2)])); 25 | 26 | // table_grow.wast:24 27 | assert_return(() => call($1, "get", [0]), externref(2)); 28 | 29 | // table_grow.wast:25 30 | assert_trap(() => call($1, "set", [1, externref(2)])); 31 | 32 | // table_grow.wast:26 33 | assert_trap(() => call($1, "get", [1])); 34 | 35 | // table_grow.wast:28 36 | assert_return(() => call($1, "grow-abbrev", [4, externref(3)]), 1); 37 | 38 | // table_grow.wast:29 39 | assert_return(() => call($1, "size", []), 5); 40 | 41 | // table_grow.wast:30 42 | assert_return(() => call($1, "get", [0]), externref(2)); 43 | 44 | // table_grow.wast:31 45 | assert_return(() => call($1, "set", [0, externref(2)])); 46 | 47 | // table_grow.wast:32 48 | assert_return(() => call($1, "get", [0]), externref(2)); 49 | 50 | // table_grow.wast:33 51 | assert_return(() => call($1, "get", [1]), externref(3)); 52 | 53 | // table_grow.wast:34 54 | assert_return(() => call($1, "get", [4]), externref(3)); 55 | 56 | // table_grow.wast:35 57 | assert_return(() => call($1, "set", [4, externref(4)])); 58 | 59 | // table_grow.wast:36 60 | assert_return(() => call($1, "get", [4]), externref(4)); 61 | 62 | // table_grow.wast:37 63 | assert_trap(() => call($1, "set", [5, externref(2)])); 64 | 65 | // table_grow.wast:38 66 | assert_trap(() => call($1, "get", [5])); 67 | 68 | // table_grow.wast:42 69 | let $2 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x85\x80\x80\x80\x00\x01\x60\x00\x01\x7f\x03\x82\x80\x80\x80\x00\x01\x00\x04\x84\x80\x80\x80\x00\x01\x70\x00\x10\x07\x88\x80\x80\x80\x00\x01\x04\x67\x72\x6f\x77\x00\x00\x09\x85\x80\x80\x80\x00\x01\x03\x00\x01\x00\x0a\x8f\x80\x80\x80\x00\x01\x89\x80\x80\x80\x00\x00\xd2\x00\x41\x70\xfc\x0f\x00\x0b"); 70 | 71 | // table_grow.wast:50 72 | assert_return(() => call($2, "grow", []), -1); 73 | 74 | // table_grow.wast:53 75 | let $3 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x86\x80\x80\x80\x00\x01\x60\x01\x7f\x01\x7f\x03\x82\x80\x80\x80\x00\x01\x00\x04\x84\x80\x80\x80\x00\x01\x6f\x00\x00\x07\x88\x80\x80\x80\x00\x01\x04\x67\x72\x6f\x77\x00\x00\x0a\x8f\x80\x80\x80\x00\x01\x89\x80\x80\x80\x00\x00\xd0\x6f\x20\x00\xfc\x0f\x00\x0b"); 76 | 77 | // table_grow.wast:60 78 | assert_return(() => call($3, "grow", [0]), 0); 79 | 80 | // table_grow.wast:61 81 | assert_return(() => call($3, "grow", [1]), 0); 82 | 83 | // table_grow.wast:62 84 | assert_return(() => call($3, "grow", [0]), 1); 85 | 86 | // table_grow.wast:63 87 | assert_return(() => call($3, "grow", [2]), 1); 88 | 89 | // table_grow.wast:64 90 | assert_return(() => call($3, "grow", [800]), 3); 91 | 92 | // table_grow.wast:67 93 | let $4 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x86\x80\x80\x80\x00\x01\x60\x01\x7f\x01\x7f\x03\x82\x80\x80\x80\x00\x01\x00\x04\x85\x80\x80\x80\x00\x01\x6f\x01\x00\x0a\x07\x88\x80\x80\x80\x00\x01\x04\x67\x72\x6f\x77\x00\x00\x0a\x8f\x80\x80\x80\x00\x01\x89\x80\x80\x80\x00\x00\xd0\x6f\x20\x00\xfc\x0f\x00\x0b"); 94 | 95 | // table_grow.wast:74 96 | assert_return(() => call($4, "grow", [0]), 0); 97 | 98 | // table_grow.wast:75 99 | assert_return(() => call($4, "grow", [1]), 0); 100 | 101 | // table_grow.wast:76 102 | assert_return(() => call($4, "grow", [1]), 1); 103 | 104 | // table_grow.wast:77 105 | assert_return(() => call($4, "grow", [2]), 2); 106 | 107 | // table_grow.wast:78 108 | assert_return(() => call($4, "grow", [6]), 4); 109 | 110 | // table_grow.wast:79 111 | assert_return(() => call($4, "grow", [0]), 10); 112 | 113 | // table_grow.wast:80 114 | assert_return(() => call($4, "grow", [1]), -1); 115 | 116 | // table_grow.wast:81 117 | assert_return(() => call($4, "grow", [65_536]), -1); 118 | 119 | // table_grow.wast:84 120 | let $5 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x8c\x80\x80\x80\x00\x02\x60\x01\x7f\x01\x7f\x60\x02\x7f\x7f\x01\x70\x03\x83\x80\x80\x80\x00\x02\x00\x01\x04\x84\x80\x80\x80\x00\x01\x70\x00\x0a\x07\x9b\x80\x80\x80\x00\x02\x04\x67\x72\x6f\x77\x00\x00\x10\x63\x68\x65\x63\x6b\x2d\x74\x61\x62\x6c\x65\x2d\x6e\x75\x6c\x6c\x00\x01\x09\x85\x80\x80\x80\x00\x01\x03\x00\x01\x01\x0a\xc5\x80\x80\x80\x00\x02\x89\x80\x80\x80\x00\x00\xd0\x70\x20\x00\xfc\x0f\x00\x0b\xb1\x80\x80\x80\x00\x01\x01\x70\xd2\x01\x21\x02\x02\x40\x03\x40\x20\x00\x25\x00\x21\x02\x20\x02\xd1\x45\x0d\x01\x20\x00\x20\x01\x4f\x0d\x01\x20\x00\x41\x01\x6a\x21\x00\x20\x00\x20\x01\x4d\x0d\x00\x0b\x0b\x20\x02\x0b"); 121 | 122 | // table_grow.wast:106 123 | assert_return(() => call($5, "check-table-null", [0, 9]), null); 124 | 125 | // table_grow.wast:107 126 | assert_return(() => call($5, "grow", [10]), 10); 127 | 128 | // table_grow.wast:108 129 | assert_return(() => call($5, "check-table-null", [0, 19]), null); 130 | 131 | // table_grow.wast:111 132 | let $6 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x85\x80\x80\x80\x00\x01\x60\x00\x01\x7f\x03\x82\x80\x80\x80\x00\x01\x00\x04\x84\x80\x80\x80\x00\x01\x70\x00\x01\x07\x90\x80\x80\x80\x00\x02\x05\x74\x61\x62\x6c\x65\x01\x00\x04\x67\x72\x6f\x77\x00\x00\x0a\x8f\x80\x80\x80\x00\x01\x89\x80\x80\x80\x00\x00\xd0\x70\x41\x01\xfc\x0f\x00\x0b"); 133 | let $Tgt = $6; 134 | 135 | // table_grow.wast:115 136 | register("grown-table", $Tgt) 137 | 138 | // table_grow.wast:116 139 | assert_return(() => call($Tgt, "grow", []), 1); 140 | 141 | // table_grow.wast:117 142 | let $7 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x85\x80\x80\x80\x00\x01\x60\x00\x01\x7f\x02\x97\x80\x80\x80\x00\x01\x0b\x67\x72\x6f\x77\x6e\x2d\x74\x61\x62\x6c\x65\x05\x74\x61\x62\x6c\x65\x01\x70\x00\x02\x03\x82\x80\x80\x80\x00\x01\x00\x07\x90\x80\x80\x80\x00\x02\x05\x74\x61\x62\x6c\x65\x01\x00\x04\x67\x72\x6f\x77\x00\x00\x0a\x8f\x80\x80\x80\x00\x01\x89\x80\x80\x80\x00\x00\xd0\x70\x41\x01\xfc\x0f\x00\x0b"); 143 | let $Tgit1 = $7; 144 | 145 | // table_grow.wast:122 146 | register("grown-imported-table", $Tgit1) 147 | 148 | // table_grow.wast:123 149 | assert_return(() => call($Tgit1, "grow", []), 2); 150 | 151 | // table_grow.wast:124 152 | let $8 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x85\x80\x80\x80\x00\x01\x60\x00\x01\x7f\x02\xa0\x80\x80\x80\x00\x01\x14\x67\x72\x6f\x77\x6e\x2d\x69\x6d\x70\x6f\x72\x74\x65\x64\x2d\x74\x61\x62\x6c\x65\x05\x74\x61\x62\x6c\x65\x01\x70\x00\x03\x03\x82\x80\x80\x80\x00\x01\x00\x07\x88\x80\x80\x80\x00\x01\x04\x73\x69\x7a\x65\x00\x00\x0a\x8b\x80\x80\x80\x00\x01\x85\x80\x80\x80\x00\x00\xfc\x10\x00\x0b"); 153 | let $Tgit2 = $8; 154 | 155 | // table_grow.wast:129 156 | assert_return(() => call($Tgit2, "size", []), 3); 157 | 158 | // table_grow.wast:134 159 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x85\x80\x80\x80\x00\x01\x60\x00\x01\x7f\x03\x82\x80\x80\x80\x00\x01\x00\x04\x84\x80\x80\x80\x00\x01\x6f\x00\x00\x0a\x8b\x80\x80\x80\x00\x01\x85\x80\x80\x80\x00\x00\xfc\x0f\x00\x0b"); 160 | 161 | // table_grow.wast:143 162 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x85\x80\x80\x80\x00\x01\x60\x00\x01\x7f\x03\x82\x80\x80\x80\x00\x01\x00\x04\x84\x80\x80\x80\x00\x01\x6f\x00\x00\x0a\x8d\x80\x80\x80\x00\x01\x87\x80\x80\x80\x00\x00\xd0\x6f\xfc\x0f\x00\x0b"); 163 | 164 | // table_grow.wast:152 165 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x85\x80\x80\x80\x00\x01\x60\x00\x01\x7f\x03\x82\x80\x80\x80\x00\x01\x00\x04\x84\x80\x80\x80\x00\x01\x6f\x00\x00\x0a\x8d\x80\x80\x80\x00\x01\x87\x80\x80\x80\x00\x00\x41\x01\xfc\x0f\x00\x0b"); 166 | 167 | // table_grow.wast:161 168 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x85\x80\x80\x80\x00\x01\x60\x00\x01\x7f\x03\x82\x80\x80\x80\x00\x01\x00\x04\x84\x80\x80\x80\x00\x01\x6f\x00\x00\x0a\x92\x80\x80\x80\x00\x01\x8c\x80\x80\x80\x00\x00\xd0\x6f\x43\x00\x00\x80\x3f\xfc\x0f\x00\x0b"); 169 | 170 | // table_grow.wast:170 171 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x86\x80\x80\x80\x00\x01\x60\x01\x6f\x01\x7f\x03\x82\x80\x80\x80\x00\x01\x00\x04\x84\x80\x80\x80\x00\x01\x70\x00\x00\x0a\x8f\x80\x80\x80\x00\x01\x89\x80\x80\x80\x00\x00\x20\x00\x41\x01\xfc\x0f\x00\x0b"); 172 | 173 | // table_grow.wast:180 174 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x04\x84\x80\x80\x80\x00\x01\x6f\x00\x01\x0a\x8f\x80\x80\x80\x00\x01\x89\x80\x80\x80\x00\x00\xd0\x6f\x41\x00\xfc\x0f\x00\x0b"); 175 | 176 | // table_grow.wast:189 177 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x85\x80\x80\x80\x00\x01\x60\x00\x01\x7d\x03\x82\x80\x80\x80\x00\x01\x00\x04\x84\x80\x80\x80\x00\x01\x6f\x00\x01\x0a\x8f\x80\x80\x80\x00\x01\x89\x80\x80\x80\x00\x00\xd0\x6f\x41\x00\xfc\x0f\x00\x0b"); 178 | -------------------------------------------------------------------------------- /test/core/table_set.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // table_set.wast:1 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\xa2\x80\x80\x80\x00\x07\x60\x00\x00\x60\x01\x7f\x01\x6f\x60\x01\x7f\x01\x70\x60\x02\x7f\x6f\x00\x60\x02\x7f\x70\x00\x60\x02\x7f\x7f\x00\x60\x01\x7f\x01\x7f\x03\x88\x80\x80\x80\x00\x07\x00\x01\x02\x03\x04\x05\x06\x04\x87\x80\x80\x80\x00\x02\x6f\x00\x01\x70\x00\x02\x07\xe2\x80\x80\x80\x00\x06\x0d\x67\x65\x74\x2d\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x01\x0b\x67\x65\x74\x2d\x66\x75\x6e\x63\x72\x65\x66\x00\x02\x0d\x73\x65\x74\x2d\x65\x78\x74\x65\x72\x6e\x72\x65\x66\x00\x03\x0b\x73\x65\x74\x2d\x66\x75\x6e\x63\x72\x65\x66\x00\x04\x10\x73\x65\x74\x2d\x66\x75\x6e\x63\x72\x65\x66\x2d\x66\x72\x6f\x6d\x00\x05\x0f\x69\x73\x5f\x6e\x75\x6c\x6c\x2d\x66\x75\x6e\x63\x72\x65\x66\x00\x06\x09\x89\x80\x80\x80\x00\x01\x02\x01\x41\x01\x0b\x00\x01\x00\x0a\xd3\x80\x80\x80\x00\x07\x82\x80\x80\x80\x00\x00\x0b\x86\x80\x80\x80\x00\x00\x20\x00\x25\x00\x0b\x86\x80\x80\x80\x00\x00\x20\x00\x25\x01\x0b\x88\x80\x80\x80\x00\x00\x20\x00\x20\x01\x26\x00\x0b\x88\x80\x80\x80\x00\x00\x20\x00\x20\x01\x26\x01\x0b\x8a\x80\x80\x80\x00\x00\x20\x00\x20\x01\x25\x01\x26\x01\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x10\x02\xd1\x0b"); 4 | 5 | // table_set.wast:29 6 | assert_return(() => call($1, "get-externref", [0]), null); 7 | 8 | // table_set.wast:30 9 | assert_return(() => call($1, "set-externref", [0, externref(1)])); 10 | 11 | // table_set.wast:31 12 | assert_return(() => call($1, "get-externref", [0]), externref(1)); 13 | 14 | // table_set.wast:32 15 | assert_return(() => call($1, "set-externref", [0, null])); 16 | 17 | // table_set.wast:33 18 | assert_return(() => call($1, "get-externref", [0]), null); 19 | 20 | // table_set.wast:35 21 | assert_return(() => call($1, "get-funcref", [0]), null); 22 | 23 | // table_set.wast:36 24 | assert_return(() => call($1, "set-funcref-from", [0, 1])); 25 | 26 | // table_set.wast:37 27 | assert_return(() => call($1, "is_null-funcref", [0]), 0); 28 | 29 | // table_set.wast:38 30 | assert_return(() => call($1, "set-funcref", [0, null])); 31 | 32 | // table_set.wast:39 33 | assert_return(() => call($1, "get-funcref", [0]), null); 34 | 35 | // table_set.wast:41 36 | assert_trap(() => call($1, "set-externref", [2, null])); 37 | 38 | // table_set.wast:42 39 | assert_trap(() => call($1, "set-funcref", [3, null])); 40 | 41 | // table_set.wast:43 42 | assert_trap(() => call($1, "set-externref", [-1, null])); 43 | 44 | // table_set.wast:44 45 | assert_trap(() => call($1, "set-funcref", [-1, null])); 46 | 47 | // table_set.wast:46 48 | assert_trap(() => call($1, "set-externref", [2, externref(0)])); 49 | 50 | // table_set.wast:47 51 | assert_trap(() => call($1, "set-funcref-from", [3, 1])); 52 | 53 | // table_set.wast:48 54 | assert_trap(() => call($1, "set-externref", [-1, externref(0)])); 55 | 56 | // table_set.wast:49 57 | assert_trap(() => call($1, "set-funcref-from", [-1, 1])); 58 | 59 | // table_set.wast:54 60 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x04\x84\x80\x80\x80\x00\x01\x6f\x00\x0a\x0a\x8a\x80\x80\x80\x00\x01\x84\x80\x80\x80\x00\x00\x26\x00\x0b"); 61 | 62 | // table_set.wast:63 63 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x04\x84\x80\x80\x80\x00\x01\x6f\x00\x0a\x0a\x8c\x80\x80\x80\x00\x01\x86\x80\x80\x80\x00\x00\xd0\x6f\x26\x00\x0b"); 64 | 65 | // table_set.wast:72 66 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x04\x84\x80\x80\x80\x00\x01\x6f\x00\x0a\x0a\x8c\x80\x80\x80\x00\x01\x86\x80\x80\x80\x00\x00\x41\x01\x26\x00\x0b"); 67 | 68 | // table_set.wast:81 69 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x04\x84\x80\x80\x80\x00\x01\x6f\x00\x0a\x0a\x91\x80\x80\x80\x00\x01\x8b\x80\x80\x80\x00\x00\x43\x00\x00\x80\x3f\xd0\x6f\x26\x00\x0b"); 70 | 71 | // table_set.wast:90 72 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x85\x80\x80\x80\x00\x01\x60\x01\x6f\x00\x03\x82\x80\x80\x80\x00\x01\x00\x04\x84\x80\x80\x80\x00\x01\x70\x00\x0a\x0a\x8e\x80\x80\x80\x00\x01\x88\x80\x80\x80\x00\x00\x41\x01\x20\x00\x26\x00\x0b"); 73 | 74 | // table_set.wast:100 75 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x85\x80\x80\x80\x00\x01\x60\x01\x6f\x00\x03\x82\x80\x80\x80\x00\x01\x00\x04\x87\x80\x80\x80\x00\x02\x6f\x00\x01\x70\x00\x01\x0a\x8e\x80\x80\x80\x00\x01\x88\x80\x80\x80\x00\x00\x41\x00\x20\x00\x26\x01\x0b"); 76 | 77 | // table_set.wast:111 78 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x85\x80\x80\x80\x00\x01\x60\x00\x01\x7f\x03\x82\x80\x80\x80\x00\x01\x00\x04\x84\x80\x80\x80\x00\x01\x6f\x00\x0a\x0a\x8e\x80\x80\x80\x00\x01\x88\x80\x80\x80\x00\x00\x41\x00\xd0\x6f\x26\x00\x0b"); 79 | -------------------------------------------------------------------------------- /test/core/table_size.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // table_size.wast:1 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x89\x80\x80\x80\x00\x02\x60\x00\x01\x7f\x60\x01\x7f\x00\x03\x89\x80\x80\x80\x00\x08\x00\x00\x00\x00\x01\x01\x01\x01\x04\x8f\x80\x80\x80\x00\x04\x6f\x00\x00\x6f\x00\x01\x6f\x01\x00\x02\x6f\x01\x03\x08\x07\xd1\x80\x80\x80\x00\x08\x07\x73\x69\x7a\x65\x2d\x74\x30\x00\x00\x07\x73\x69\x7a\x65\x2d\x74\x31\x00\x01\x07\x73\x69\x7a\x65\x2d\x74\x32\x00\x02\x07\x73\x69\x7a\x65\x2d\x74\x33\x00\x03\x07\x67\x72\x6f\x77\x2d\x74\x30\x00\x04\x07\x67\x72\x6f\x77\x2d\x74\x31\x00\x05\x07\x67\x72\x6f\x77\x2d\x74\x32\x00\x06\x07\x67\x72\x6f\x77\x2d\x74\x33\x00\x07\x0a\xe5\x80\x80\x80\x00\x08\x85\x80\x80\x80\x00\x00\xfc\x10\x00\x0b\x85\x80\x80\x80\x00\x00\xfc\x10\x01\x0b\x85\x80\x80\x80\x00\x00\xfc\x10\x02\x0b\x85\x80\x80\x80\x00\x00\xfc\x10\x03\x0b\x8a\x80\x80\x80\x00\x00\xd0\x6f\x20\x00\xfc\x0f\x00\x1a\x0b\x8a\x80\x80\x80\x00\x00\xd0\x6f\x20\x00\xfc\x0f\x01\x1a\x0b\x8a\x80\x80\x80\x00\x00\xd0\x6f\x20\x00\xfc\x0f\x02\x1a\x0b\x8a\x80\x80\x80\x00\x00\xd0\x6f\x20\x00\xfc\x0f\x03\x1a\x0b"); 4 | 5 | // table_size.wast:26 6 | assert_return(() => call($1, "size-t0", []), 0); 7 | 8 | // table_size.wast:27 9 | assert_return(() => call($1, "grow-t0", [1])); 10 | 11 | // table_size.wast:28 12 | assert_return(() => call($1, "size-t0", []), 1); 13 | 14 | // table_size.wast:29 15 | assert_return(() => call($1, "grow-t0", [4])); 16 | 17 | // table_size.wast:30 18 | assert_return(() => call($1, "size-t0", []), 5); 19 | 20 | // table_size.wast:31 21 | assert_return(() => call($1, "grow-t0", [0])); 22 | 23 | // table_size.wast:32 24 | assert_return(() => call($1, "size-t0", []), 5); 25 | 26 | // table_size.wast:34 27 | assert_return(() => call($1, "size-t1", []), 1); 28 | 29 | // table_size.wast:35 30 | assert_return(() => call($1, "grow-t1", [1])); 31 | 32 | // table_size.wast:36 33 | assert_return(() => call($1, "size-t1", []), 2); 34 | 35 | // table_size.wast:37 36 | assert_return(() => call($1, "grow-t1", [4])); 37 | 38 | // table_size.wast:38 39 | assert_return(() => call($1, "size-t1", []), 6); 40 | 41 | // table_size.wast:39 42 | assert_return(() => call($1, "grow-t1", [0])); 43 | 44 | // table_size.wast:40 45 | assert_return(() => call($1, "size-t1", []), 6); 46 | 47 | // table_size.wast:42 48 | assert_return(() => call($1, "size-t2", []), 0); 49 | 50 | // table_size.wast:43 51 | assert_return(() => call($1, "grow-t2", [3])); 52 | 53 | // table_size.wast:44 54 | assert_return(() => call($1, "size-t2", []), 0); 55 | 56 | // table_size.wast:45 57 | assert_return(() => call($1, "grow-t2", [1])); 58 | 59 | // table_size.wast:46 60 | assert_return(() => call($1, "size-t2", []), 1); 61 | 62 | // table_size.wast:47 63 | assert_return(() => call($1, "grow-t2", [0])); 64 | 65 | // table_size.wast:48 66 | assert_return(() => call($1, "size-t2", []), 1); 67 | 68 | // table_size.wast:49 69 | assert_return(() => call($1, "grow-t2", [4])); 70 | 71 | // table_size.wast:50 72 | assert_return(() => call($1, "size-t2", []), 1); 73 | 74 | // table_size.wast:51 75 | assert_return(() => call($1, "grow-t2", [1])); 76 | 77 | // table_size.wast:52 78 | assert_return(() => call($1, "size-t2", []), 2); 79 | 80 | // table_size.wast:54 81 | assert_return(() => call($1, "size-t3", []), 3); 82 | 83 | // table_size.wast:55 84 | assert_return(() => call($1, "grow-t3", [1])); 85 | 86 | // table_size.wast:56 87 | assert_return(() => call($1, "size-t3", []), 4); 88 | 89 | // table_size.wast:57 90 | assert_return(() => call($1, "grow-t3", [3])); 91 | 92 | // table_size.wast:58 93 | assert_return(() => call($1, "size-t3", []), 7); 94 | 95 | // table_size.wast:59 96 | assert_return(() => call($1, "grow-t3", [0])); 97 | 98 | // table_size.wast:60 99 | assert_return(() => call($1, "size-t3", []), 7); 100 | 101 | // table_size.wast:61 102 | assert_return(() => call($1, "grow-t3", [2])); 103 | 104 | // table_size.wast:62 105 | assert_return(() => call($1, "size-t3", []), 7); 106 | 107 | // table_size.wast:63 108 | assert_return(() => call($1, "grow-t3", [1])); 109 | 110 | // table_size.wast:64 111 | assert_return(() => call($1, "size-t3", []), 8); 112 | 113 | // table_size.wast:69 114 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x04\x84\x80\x80\x80\x00\x01\x6f\x00\x01\x0a\x8b\x80\x80\x80\x00\x01\x85\x80\x80\x80\x00\x00\xfc\x10\x00\x0b"); 115 | 116 | // table_size.wast:78 117 | assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x85\x80\x80\x80\x00\x01\x60\x00\x01\x7d\x03\x82\x80\x80\x80\x00\x01\x00\x04\x84\x80\x80\x80\x00\x01\x6f\x00\x01\x0a\x8b\x80\x80\x80\x00\x01\x85\x80\x80\x80\x00\x00\xfc\x10\x00\x0b"); 118 | -------------------------------------------------------------------------------- /test/core/token.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // token.wast:3 3 | assert_malformed("\x3c\x6d\x61\x6c\x66\x6f\x72\x6d\x65\x64\x20\x71\x75\x6f\x74\x65\x3e"); 4 | 5 | // token.wast:7 6 | assert_malformed("\x3c\x6d\x61\x6c\x66\x6f\x72\x6d\x65\x64\x20\x71\x75\x6f\x74\x65\x3e"); 7 | 8 | // token.wast:15 9 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x0a\x89\x80\x80\x80\x00\x01\x83\x80\x80\x80\x00\x00\x01\x0b"); 10 | 11 | // token.wast:18 12 | let $2 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x0a\x8a\x80\x80\x80\x00\x01\x84\x80\x80\x80\x00\x00\x01\x01\x0b"); 13 | 14 | // token.wast:21 15 | let $3 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x0a\x8a\x80\x80\x80\x00\x01\x84\x80\x80\x80\x00\x00\x01\x01\x0b"); 16 | 17 | // token.wast:24 18 | let $4 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x0a\x8a\x80\x80\x80\x00\x01\x84\x80\x80\x80\x00\x00\x01\x01\x0b"); 19 | 20 | // token.wast:27 21 | let $5 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x0a\x89\x80\x80\x80\x00\x01\x83\x80\x80\x80\x00\x00\x01\x0b"); 22 | 23 | // token.wast:30 24 | let $6 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x0a\x8b\x80\x80\x80\x00\x01\x85\x80\x80\x80\x00\x00\x0c\x00\x01\x0b"); 25 | 26 | // token.wast:33 27 | let $7 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x04\x84\x80\x80\x80\x00\x01\x70\x00\x01\x09\x87\x80\x80\x80\x00\x01\x00\x41\x00\x0b\x01\x00\x0a\x88\x80\x80\x80\x00\x01\x82\x80\x80\x80\x00\x00\x0b"); 28 | 29 | // token.wast:38 30 | let $8 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x04\x84\x80\x80\x80\x00\x01\x70\x00\x01\x09\x87\x80\x80\x80\x00\x01\x00\x41\x00\x0b\x01\x00\x0a\x88\x80\x80\x80\x00\x01\x82\x80\x80\x80\x00\x00\x0b"); 31 | 32 | // token.wast:43 33 | let $9 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x05\x83\x80\x80\x80\x00\x01\x00\x01\x0b\x87\x80\x80\x80\x00\x01\x00\x41\x00\x0b\x01\x61"); 34 | 35 | // token.wast:47 36 | let $10 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x02\x92\x80\x80\x80\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x05\x70\x72\x69\x6e\x74\x00\x00"); 37 | 38 | // token.wast:54 39 | let $11 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x0a\x88\x80\x80\x80\x00\x01\x82\x80\x80\x80\x00\x00\x0b"); 40 | 41 | // token.wast:58 42 | let $12 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x0a\x89\x80\x80\x80\x00\x01\x83\x80\x80\x80\x00\x00\x01\x0b"); 43 | 44 | // token.wast:62 45 | let $13 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x0a\x89\x80\x80\x80\x00\x01\x83\x80\x80\x80\x00\x00\x01\x0b"); 46 | 47 | // token.wast:66 48 | let $14 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x0a\x88\x80\x80\x80\x00\x01\x82\x80\x80\x80\x00\x00\x0b"); 49 | 50 | // token.wast:70 51 | let $15 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x0a\x8a\x80\x80\x80\x00\x01\x84\x80\x80\x80\x00\x00\x0c\x00\x0b"); 52 | 53 | // token.wast:74 54 | let $16 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x0b\x84\x80\x80\x80\x00\x01\x01\x01\x61"); 55 | 56 | // token.wast:82 57 | let $17 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x0a\x91\x80\x80\x80\x00\x01\x8b\x80\x80\x80\x00\x00\x02\x40\x41\x00\x0e\x01\x00\x00\x0b\x0b"); 58 | 59 | // token.wast:85 60 | assert_malformed("\x3c\x6d\x61\x6c\x66\x6f\x72\x6d\x65\x64\x20\x71\x75\x6f\x74\x65\x3e"); 61 | 62 | // token.wast:92 63 | let $18 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x0a\x91\x80\x80\x80\x00\x01\x8b\x80\x80\x80\x00\x00\x02\x40\x41\x00\x0e\x01\x00\x00\x0b\x0b"); 64 | 65 | // token.wast:95 66 | assert_malformed("\x3c\x6d\x61\x6c\x66\x6f\x72\x6d\x65\x64\x20\x71\x75\x6f\x74\x65\x3e"); 67 | 68 | // token.wast:102 69 | let $19 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x0a\x91\x80\x80\x80\x00\x01\x8b\x80\x80\x80\x00\x00\x02\x40\x41\x00\x0e\x01\x00\x00\x0b\x0b"); 70 | 71 | // token.wast:105 72 | assert_malformed("\x3c\x6d\x61\x6c\x66\x6f\x72\x6d\x65\x64\x20\x71\x75\x6f\x74\x65\x3e"); 73 | 74 | // token.wast:112 75 | let $20 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x0a\x90\x80\x80\x80\x00\x01\x8a\x80\x80\x80\x00\x00\x02\x40\x41\x00\x0e\x00\x00\x0b\x0b"); 76 | 77 | // token.wast:115 78 | let $21 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x0a\x90\x80\x80\x80\x00\x01\x8a\x80\x80\x80\x00\x00\x02\x40\x41\x00\x0e\x00\x00\x0b\x0b"); 79 | 80 | // token.wast:122 81 | let $22 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x0b\x84\x80\x80\x80\x00\x01\x01\x01\x61"); 82 | 83 | // token.wast:125 84 | assert_malformed("\x3c\x6d\x61\x6c\x66\x6f\x72\x6d\x65\x64\x20\x71\x75\x6f\x74\x65\x3e"); 85 | 86 | // token.wast:132 87 | let $23 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x0b\x84\x80\x80\x80\x00\x01\x01\x01\x61"); 88 | 89 | // token.wast:135 90 | assert_malformed("\x3c\x6d\x61\x6c\x66\x6f\x72\x6d\x65\x64\x20\x71\x75\x6f\x74\x65\x3e"); 91 | 92 | // token.wast:142 93 | let $24 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x0b\x85\x80\x80\x80\x00\x01\x01\x02\x20\x61"); 94 | 95 | // token.wast:145 96 | assert_malformed("\x3c\x6d\x61\x6c\x66\x6f\x72\x6d\x65\x64\x20\x71\x75\x6f\x74\x65\x3e"); 97 | 98 | // token.wast:152 99 | let $25 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x0b\x85\x80\x80\x80\x00\x01\x01\x02\x61\x20"); 100 | 101 | // token.wast:155 102 | assert_malformed("\x3c\x6d\x61\x6c\x66\x6f\x72\x6d\x65\x64\x20\x71\x75\x6f\x74\x65\x3e"); 103 | 104 | // token.wast:162 105 | let $26 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x0b\x86\x80\x80\x80\x00\x01\x01\x03\x61\x20\x62"); 106 | 107 | // token.wast:165 108 | assert_malformed("\x3c\x6d\x61\x6c\x66\x6f\x72\x6d\x65\x64\x20\x71\x75\x6f\x74\x65\x3e"); 109 | 110 | // token.wast:172 111 | let $27 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x0b\x89\x80\x80\x80\x00\x01\x01\x06\xef\x98\x9a\xef\x92\xa9"); 112 | 113 | // token.wast:175 114 | assert_malformed("\x3c\x6d\x61\x6c\x66\x6f\x72\x6d\x65\x64\x20\x71\x75\x6f\x74\x65\x3e"); 115 | 116 | // token.wast:182 117 | let $28 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x0b\x8a\x80\x80\x80\x00\x01\x01\x07\x20\xef\x98\x9a\xef\x92\xa9"); 118 | 119 | // token.wast:185 120 | assert_malformed("\x3c\x6d\x61\x6c\x66\x6f\x72\x6d\x65\x64\x20\x71\x75\x6f\x74\x65\x3e"); 121 | 122 | // token.wast:192 123 | let $29 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x0b\x8a\x80\x80\x80\x00\x01\x01\x07\xef\x98\x9a\xef\x92\xa9\x20"); 124 | 125 | // token.wast:195 126 | assert_malformed("\x3c\x6d\x61\x6c\x66\x6f\x72\x6d\x65\x64\x20\x71\x75\x6f\x74\x65\x3e"); 127 | 128 | // token.wast:202 129 | let $30 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x0b\x85\x80\x80\x80\x00\x01\x01\x02\x61\x62"); 130 | 131 | // token.wast:205 132 | assert_malformed("\x3c\x6d\x61\x6c\x66\x6f\x72\x6d\x65\x64\x20\x71\x75\x6f\x74\x65\x3e"); 133 | 134 | // token.wast:212 135 | let $31 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x0b\x86\x80\x80\x80\x00\x01\x01\x03\x61\x20\x62"); 136 | 137 | // token.wast:215 138 | assert_malformed("\x3c\x6d\x61\x6c\x66\x6f\x72\x6d\x65\x64\x20\x71\x75\x6f\x74\x65\x3e"); 139 | 140 | // token.wast:222 141 | let $32 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x0b\x86\x80\x80\x80\x00\x01\x01\x03\x61\x20\x62"); 142 | 143 | // token.wast:225 144 | assert_malformed("\x3c\x6d\x61\x6c\x66\x6f\x72\x6d\x65\x64\x20\x71\x75\x6f\x74\x65\x3e"); 145 | 146 | // token.wast:232 147 | let $33 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x0b\x8f\x80\x80\x80\x00\x01\x01\x0c\xef\x98\x9a\xef\x92\xa9\xef\x98\x9a\xef\x92\xa9"); 148 | 149 | // token.wast:235 150 | assert_malformed("\x3c\x6d\x61\x6c\x66\x6f\x72\x6d\x65\x64\x20\x71\x75\x6f\x74\x65\x3e"); 151 | 152 | // token.wast:242 153 | let $34 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x0b\x90\x80\x80\x80\x00\x01\x01\x0d\xef\x98\x9a\xef\x92\xa9\x20\xef\x98\x9a\xef\x92\xa9"); 154 | 155 | // token.wast:245 156 | assert_malformed("\x3c\x6d\x61\x6c\x66\x6f\x72\x6d\x65\x64\x20\x71\x75\x6f\x74\x65\x3e"); 157 | 158 | // token.wast:252 159 | let $35 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x0b\x90\x80\x80\x80\x00\x01\x01\x0d\xef\x98\x9a\xef\x92\xa9\x20\xef\x98\x9a\xef\x92\xa9"); 160 | 161 | // token.wast:255 162 | assert_malformed("\x3c\x6d\x61\x6c\x66\x6f\x72\x6d\x65\x64\x20\x71\x75\x6f\x74\x65\x3e"); 163 | 164 | // token.wast:263 165 | assert_malformed("\x3c\x6d\x61\x6c\x66\x6f\x72\x6d\x65\x64\x20\x71\x75\x6f\x74\x65\x3e"); 166 | 167 | // token.wast:269 168 | assert_malformed("\x3c\x6d\x61\x6c\x66\x6f\x72\x6d\x65\x64\x20\x71\x75\x6f\x74\x65\x3e"); 169 | 170 | // token.wast:275 171 | assert_malformed("\x3c\x6d\x61\x6c\x66\x6f\x72\x6d\x65\x64\x20\x71\x75\x6f\x74\x65\x3e"); 172 | 173 | // token.wast:281 174 | assert_malformed("\x3c\x6d\x61\x6c\x66\x6f\x72\x6d\x65\x64\x20\x71\x75\x6f\x74\x65\x3e"); 175 | -------------------------------------------------------------------------------- /test/core/type.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // type.wast:3 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x89\x81\x80\x80\x00\x17\x60\x00\x00\x60\x00\x00\x60\x01\x7f\x00\x60\x01\x7f\x00\x60\x00\x01\x7f\x60\x01\x7f\x01\x7f\x60\x01\x7f\x01\x7f\x60\x02\x7d\x7c\x00\x60\x00\x02\x7e\x7d\x60\x02\x7f\x7e\x02\x7d\x7c\x60\x02\x7d\x7c\x00\x60\x02\x7d\x7c\x00\x60\x02\x7d\x7c\x00\x60\x02\x7d\x7c\x00\x60\x00\x02\x7e\x7d\x60\x02\x7f\x7e\x02\x7d\x7c\x60\x02\x7f\x7e\x02\x7d\x7c\x60\x06\x7d\x7c\x7f\x7c\x7f\x7f\x00\x60\x00\x05\x7e\x7e\x7d\x7d\x7f\x60\x04\x7f\x7f\x7e\x7f\x04\x7d\x7c\x7c\x7f\x60\x03\x7d\x7c\x7f\x00\x60\x00\x03\x7e\x7e\x7d\x60\x05\x7f\x7f\x7e\x7f\x7f\x04\x7d\x7c\x7c\x7f"); 4 | 5 | // type.wast:43 6 | assert_malformed("\x3c\x6d\x61\x6c\x66\x6f\x72\x6d\x65\x64\x20\x71\x75\x6f\x74\x65\x3e"); 7 | 8 | // type.wast:47 9 | assert_malformed("\x3c\x6d\x61\x6c\x66\x6f\x72\x6d\x65\x64\x20\x71\x75\x6f\x74\x65\x3e"); 10 | -------------------------------------------------------------------------------- /test/core/unreached-valid.wast.js: -------------------------------------------------------------------------------- 1 | 2 | // unreached-valid.wast:1 3 | let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x91\x80\x80\x80\x00\x04\x60\x01\x7f\x01\x7f\x60\x00\x00\x60\x00\x01\x7f\x60\x00\x01\x7e\x03\x88\x80\x80\x80\x00\x07\x00\x00\x01\x02\x03\x01\x01\x07\x97\x81\x80\x80\x00\x07\x10\x73\x65\x6c\x65\x63\x74\x2d\x74\x72\x61\x70\x2d\x6c\x65\x66\x74\x00\x00\x11\x73\x65\x6c\x65\x63\x74\x2d\x74\x72\x61\x70\x2d\x72\x69\x67\x68\x74\x00\x01\x10\x73\x65\x6c\x65\x63\x74\x2d\x75\x6e\x72\x65\x61\x63\x68\x65\x64\x00\x02\x19\x73\x65\x6c\x65\x63\x74\x5f\x75\x6e\x72\x65\x61\x63\x68\x65\x64\x5f\x72\x65\x73\x75\x6c\x74\x5f\x31\x00\x03\x19\x73\x65\x6c\x65\x63\x74\x5f\x75\x6e\x72\x65\x61\x63\x68\x65\x64\x5f\x72\x65\x73\x75\x6c\x74\x5f\x32\x00\x04\x0f\x75\x6e\x72\x65\x61\x63\x68\x61\x62\x6c\x65\x2d\x6e\x75\x6d\x00\x05\x0f\x75\x6e\x72\x65\x61\x63\x68\x61\x62\x6c\x65\x2d\x72\x65\x66\x00\x06\x0a\xee\x80\x80\x80\x00\x07\x88\x80\x80\x80\x00\x00\x00\x41\x00\x20\x00\x1b\x0b\x88\x80\x80\x80\x00\x00\x41\x00\x00\x20\x00\x1b\x0b\xa0\x80\x80\x80\x00\x00\x00\x1b\x00\x41\x00\x1b\x00\x41\x00\x41\x00\x1b\x00\x41\x00\x41\x00\x41\x00\x1b\x00\x43\x00\x00\x00\x00\x41\x00\x1b\x00\x0b\x85\x80\x80\x80\x00\x00\x00\x1b\x6a\x0b\x89\x80\x80\x80\x00\x00\x00\x42\x00\x41\x00\x1b\x7c\x0b\x86\x80\x80\x80\x00\x00\x00\x1b\x45\x1a\x0b\x86\x80\x80\x80\x00\x00\x00\x1b\xd1\x1a\x0b"); 4 | 5 | // unreached-valid.wast:42 6 | assert_trap(() => call($1, "select-trap-left", [1])); 7 | 8 | // unreached-valid.wast:43 9 | assert_trap(() => call($1, "select-trap-left", [0])); 10 | 11 | // unreached-valid.wast:44 12 | assert_trap(() => call($1, "select-trap-right", [1])); 13 | 14 | // unreached-valid.wast:45 15 | assert_trap(() => call($1, "select-trap-right", [0])); 16 | 17 | // unreached-valid.wast:49 18 | let $2 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x07\x8f\x80\x80\x80\x00\x01\x0b\x6d\x65\x65\x74\x2d\x62\x6f\x74\x74\x6f\x6d\x00\x00\x0a\xa1\x80\x80\x80\x00\x01\x9b\x80\x80\x80\x00\x00\x02\x7c\x02\x7d\x00\x41\x01\x0e\x02\x00\x01\x01\x0b\x1a\x44\x00\x00\x00\x00\x00\x00\x00\x00\x0b\x1a\x0b"); 19 | 20 | // unreached-valid.wast:63 21 | assert_trap(() => call($2, "meet-bottom", [])); 22 | -------------------------------------------------------------------------------- /test/run.js: -------------------------------------------------------------------------------- 1 | // This runs some tests from the WebAssembly specification in the "../test/core" 2 | // directory. 3 | // 4 | // THESE TESTS ARE NOT ALL SUPPOSED TO PASS. The tests related to NaN bit 5 | // patterns are pretty much impossible to pass with a JavaScript-based shim 6 | // because JavaScript VMs canonicalize NaNs (unless you represent numbers as 7 | // objects with metadata, but that's too much overhead). These tests are useful 8 | // as a guide but are not useful for continuous integration. 9 | 10 | import fs from 'fs' 11 | import url from 'url' 12 | import path from 'path' 13 | 14 | const coreTestDir = path.join(url.fileURLToPath(import.meta.url), '..', 'core') 15 | const extendedConstTestDir = path.join(coreTestDir, 'extended-const') 16 | const multiMemoryTestDir = path.join(coreTestDir, 'multi-memory') 17 | const tailCallTestDir = path.join(coreTestDir, 'tail-call') 18 | const testHarness = fs.readFileSync(path.join(coreTestDir, 'harness', 'sync_index.js'), 'utf8') 19 | .replace(/\$\{e\.stack\}(\\n)?/g, '') 20 | 21 | const tests = [] 22 | for (const name of fs.readdirSync(coreTestDir)) tests.push(path.join(coreTestDir, name)) 23 | for (const name of fs.readdirSync(extendedConstTestDir)) tests.push(path.join(extendedConstTestDir, name)) 24 | for (const name of fs.readdirSync(multiMemoryTestDir)) tests.push(path.join(multiMemoryTestDir, name)) 25 | for (const name of fs.readdirSync(tailCallTestDir)) tests.push(path.join(tailCallTestDir, name)) 26 | 27 | function runTests(wasm) { 28 | const counters = { 29 | passed: 0, 30 | failed: 0, 31 | } 32 | 33 | for (const file of tests) { 34 | if (!file.endsWith('.js')) continue 35 | console.log(`🔹 ${path.relative(coreTestDir, file)}`) 36 | const js = fs.readFileSync(file, 'utf8') 37 | 38 | const fn = new Function('counters', 'WebAssembly', ` 39 | ${testHarness} 40 | 41 | registry.spectest.print = () => {} 42 | registry.spectest.print_i32 = () => {} 43 | registry.spectest.print_i64 = () => {} 44 | registry.spectest.print_i32_f32 = () => {} 45 | registry.spectest.print_f64_f64 = () => {} 46 | registry.spectest.print_f32 = () => {} 47 | registry.spectest.print_f64 = () => {} 48 | 49 | function test(fn, name) { 50 | try { 51 | fn() 52 | counters.passed++ 53 | } catch (error) { 54 | counters.failed++ 55 | console.log(' ❌ ' + name + ': ' + error) 56 | } 57 | } 58 | 59 | function assert_true(actual, description) { 60 | if (actual !== true) { 61 | throw new Error(description) 62 | } 63 | } 64 | 65 | function assert_equals(actual, expected, description) { 66 | if (actual !== expected) { 67 | throw new Error(description || 'expected ' + expected + ', got: ' + actual) 68 | } 69 | } 70 | 71 | // These are ignored... 72 | function assert_exhaustion() {} 73 | function assert_invalid() {} 74 | function assert_trap() {} 75 | function assert_uninstantiable() {} 76 | function assert_unlinkable() {} 77 | 78 | ${js} 79 | `) 80 | 81 | fn(counters, wasm) 82 | } 83 | 84 | const total = counters.passed + counters.failed 85 | console.log(` 86 | Passed: ${counters.passed} (${(100 * counters.passed / total).toFixed(1)}%) 87 | Failed: ${counters.failed} (${(100 * counters.failed / total).toFixed(1)}%) 88 | Total: ${total} 89 | `) 90 | } 91 | 92 | console.log('\n===== Native =====') 93 | runTests(WebAssembly) 94 | 95 | console.log('\n===== Shim =====') 96 | import('../index.js').then(({ WebAssembly }) => runTests(WebAssembly)) 97 | 98 | .then(() => { 99 | console.log('\n===== Minified Shim =====') 100 | import('../index.min.js').then(({ WebAssembly }) => runTests(WebAssembly)) 101 | }) 102 | --------------------------------------------------------------------------------