Correct TypedArray#byteOffset handling and fix TypedArray#subarray (#328)

This commit is contained in:
Max Graey 2018-11-09 00:19:41 +02:00 committed by Daniel Wirtz
parent 2ecec660d2
commit d93ca84aed
5 changed files with 362 additions and 419 deletions

View File

@ -32,15 +32,13 @@ export abstract class TypedArray<T,V> {
@inline @inline
get length(): i32 { get length(): i32 {
return (this.byteLength - this.byteOffset) >> alignof<T>(); return this.byteLength >>> alignof<T>();
} }
@operator("[]") @operator("[]")
protected __get(index: i32): T { protected __get(index: i32): T {
var byteOffset = this.byteOffset; if (<u32>index >= <u32>(this.byteLength >>> alignof<T>())) throw new Error("Index out of bounds");
var elementLength = (this.byteLength - byteOffset) >>> alignof<T>(); return loadUnsafeWithOffset<T,T>(this.buffer, index, this.byteOffset);
if (<u32>index >= <u32>elementLength) throw new Error("Index out of bounds");
return loadUnsafeWithOffset<T,T>(this.buffer, index, byteOffset);
} }
@inline @operator("{}") @inline @operator("{}")
@ -50,10 +48,8 @@ export abstract class TypedArray<T,V> {
@operator("[]=") @operator("[]=")
protected __set(index: i32, value: V): void { protected __set(index: i32, value: V): void {
var byteOffset = this.byteOffset; if (<u32>index >= <u32>(this.byteLength >>> alignof<T>())) throw new Error("Index out of bounds");
var elementLength = (this.byteLength - byteOffset) >>> alignof<T>(); storeUnsafeWithOffset<T,V>(this.buffer, index, value, this.byteOffset);
if (<u32>index >= <u32>elementLength) throw new Error("Index out of bounds");
storeUnsafeWithOffset<T,V>(this.buffer, index, value, byteOffset);
} }
@inline @operator("{}=") @inline @operator("{}=")
@ -95,7 +91,7 @@ export abstract class TypedArray<T,V> {
var slice = memory.allocate(offsetof<this>()); var slice = memory.allocate(offsetof<this>());
store<usize>(slice, this.buffer, offsetof<this>("buffer")); store<usize>(slice, this.buffer, offsetof<this>("buffer"));
store<i32>(slice, begin << alignof<T>(), offsetof<this>("byteOffset")); store<i32>(slice, begin << alignof<T>(), offsetof<this>("byteOffset"));
store<i32>(slice, end << alignof<T>(), offsetof<this>("byteLength")); store<i32>(slice, (end - begin) << alignof<T>(), offsetof<this>("byteLength"));
return changetype<this>(slice); return changetype<this>(slice);
} }

View File

@ -21,7 +21,7 @@ export class Uint8Array extends TypedArray<u8,u32> {
export class Uint8ClampedArray extends TypedArray<u8,u32> { export class Uint8ClampedArray extends TypedArray<u8,u32> {
static readonly BYTES_PER_ELEMENT: usize = sizeof<u8>(); static readonly BYTES_PER_ELEMENT: usize = sizeof<u8>();
@operator("[]=") @inline @operator("[]=")
protected __set(index: i32, value: i32): void { protected __set(index: i32, value: i32): void {
super.__set(index, max(min(value, 255), 0)); super.__set(index, max(min(value, 255), 0));
} }

View File

@ -604,9 +604,6 @@
end end
get_local $1 get_local $1
i32.load offset=8 i32.load offset=8
get_local $1
i32.load offset=4
i32.sub
get_local $0 get_local $0
i32.ne i32.ne
if if
@ -643,9 +640,6 @@
end end
get_local $1 get_local $1
i32.load offset=8 i32.load offset=8
get_local $1
i32.load offset=4
i32.sub
get_local $0 get_local $0
i32.ne i32.ne
if if
@ -682,9 +676,6 @@
end end
get_local $1 get_local $1
i32.load offset=8 i32.load offset=8
get_local $1
i32.load offset=4
i32.sub
get_local $0 get_local $0
i32.ne i32.ne
if if
@ -723,11 +714,8 @@
end end
get_local $1 get_local $1
i32.load offset=8 i32.load offset=8
get_local $1
i32.load offset=4
i32.sub
i32.const 1 i32.const 1
i32.shr_s i32.shr_u
get_local $0 get_local $0
i32.ne i32.ne
if if
@ -766,11 +754,8 @@
end end
get_local $1 get_local $1
i32.load offset=8 i32.load offset=8
get_local $1
i32.load offset=4
i32.sub
i32.const 1 i32.const 1
i32.shr_s i32.shr_u
get_local $0 get_local $0
i32.ne i32.ne
if if
@ -809,11 +794,8 @@
end end
get_local $1 get_local $1
i32.load offset=8 i32.load offset=8
get_local $1
i32.load offset=4
i32.sub
i32.const 2 i32.const 2
i32.shr_s i32.shr_u
get_local $0 get_local $0
i32.ne i32.ne
if if
@ -852,11 +834,8 @@
end end
get_local $1 get_local $1
i32.load offset=8 i32.load offset=8
get_local $1
i32.load offset=4
i32.sub
i32.const 2 i32.const 2
i32.shr_s i32.shr_u
get_local $0 get_local $0
i32.ne i32.ne
if if
@ -895,11 +874,8 @@
end end
get_local $1 get_local $1
i32.load offset=8 i32.load offset=8
get_local $1
i32.load offset=4
i32.sub
i32.const 3 i32.const 3
i32.shr_s i32.shr_u
get_local $0 get_local $0
i32.ne i32.ne
if if
@ -938,11 +914,8 @@
end end
get_local $1 get_local $1
i32.load offset=8 i32.load offset=8
get_local $1
i32.load offset=4
i32.sub
i32.const 3 i32.const 3
i32.shr_s i32.shr_u
get_local $0 get_local $0
i32.ne i32.ne
if if
@ -981,11 +954,8 @@
end end
get_local $1 get_local $1
i32.load offset=8 i32.load offset=8
get_local $1
i32.load offset=4
i32.sub
i32.const 2 i32.const 2
i32.shr_s i32.shr_u
get_local $0 get_local $0
i32.ne i32.ne
if if
@ -1024,11 +994,8 @@
end end
get_local $1 get_local $1
i32.load offset=8 i32.load offset=8
get_local $1
i32.load offset=4
i32.sub
i32.const 3 i32.const 3
i32.shr_s i32.shr_u
get_local $0 get_local $0
i32.ne i32.ne
if if
@ -1041,28 +1008,24 @@
end end
) )
(func $~lib/internal/typedarray/TypedArray<i32,i32>#__set (; 11 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (func $~lib/internal/typedarray/TypedArray<i32,i32>#__set (; 11 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
(local $3 i32)
get_local $1 get_local $1
get_local $0 get_local $0
i32.load offset=8 i32.load offset=8
get_local $0
i32.load offset=4
tee_local $3
i32.sub
i32.const 2 i32.const 2
i32.shr_u i32.shr_u
i32.ge_u i32.ge_u
if if
i32.const 0 i32.const 0
i32.const 48 i32.const 48
i32.const 55 i32.const 51
i32.const 42 i32.const 63
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
end end
get_local $0 get_local $0
i32.load i32.load
get_local $3 get_local $0
i32.load offset=4
i32.add i32.add
get_local $1 get_local $1
i32.const 2 i32.const 2
@ -1072,28 +1035,24 @@
i32.store offset=8 i32.store offset=8
) )
(func $~lib/internal/typedarray/TypedArray<i32,i32>#__get (; 12 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (func $~lib/internal/typedarray/TypedArray<i32,i32>#__get (; 12 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
get_local $1 get_local $1
get_local $0 get_local $0
i32.load offset=8 i32.load offset=8
get_local $0
i32.load offset=4
tee_local $2
i32.sub
i32.const 2 i32.const 2
i32.shr_u i32.shr_u
i32.ge_u i32.ge_u
if if
i32.const 0 i32.const 0
i32.const 48 i32.const 48
i32.const 42 i32.const 40
i32.const 42 i32.const 63
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
end end
get_local $0 get_local $0
i32.load i32.load
get_local $2 get_local $0
i32.load offset=4
i32.add i32.add
get_local $1 get_local $1
i32.const 2 i32.const 2
@ -1107,11 +1066,8 @@
i32.const 1 i32.const 1
get_local $0 get_local $0
i32.load offset=8 i32.load offset=8
get_local $0
i32.load offset=4
i32.sub
i32.const 2 i32.const 2
i32.shr_s i32.shr_u
tee_local $2 tee_local $2
i32.const 1 i32.const 1
get_local $2 get_local $2
@ -1159,34 +1115,32 @@
i32.store offset=4 i32.store offset=4
get_local $2 get_local $2
get_local $1 get_local $1
get_local $3
i32.sub
i32.const 2 i32.const 2
i32.shl i32.shl
i32.store offset=8 i32.store offset=8
get_local $2 get_local $2
) )
(func $~lib/internal/typedarray/TypedArray<f64,f64>#__set (; 14 ;) (type $iiFv) (param $0 i32) (param $1 i32) (param $2 f64) (func $~lib/internal/typedarray/TypedArray<f64,f64>#__set (; 14 ;) (type $iiFv) (param $0 i32) (param $1 i32) (param $2 f64)
(local $3 i32)
get_local $1 get_local $1
get_local $0 get_local $0
i32.load offset=8 i32.load offset=8
get_local $0
i32.load offset=4
tee_local $3
i32.sub
i32.const 3 i32.const 3
i32.shr_u i32.shr_u
i32.ge_u i32.ge_u
if if
i32.const 0 i32.const 0
i32.const 48 i32.const 48
i32.const 55 i32.const 51
i32.const 42 i32.const 63
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
end end
get_local $0 get_local $0
i32.load i32.load
get_local $3 get_local $0
i32.load offset=4
i32.add i32.add
get_local $1 get_local $1
i32.const 3 i32.const 3
@ -1202,11 +1156,8 @@
i32.const 2 i32.const 2
get_local $0 get_local $0
i32.load offset=8 i32.load offset=8
get_local $0
i32.load offset=4
i32.sub
i32.const 3 i32.const 3
i32.shr_s i32.shr_u
tee_local $1 tee_local $1
i32.const 2 i32.const 2
get_local $1 get_local $1
@ -1239,6 +1190,8 @@
i32.store offset=4 i32.store offset=4
get_local $1 get_local $1
get_local $3 get_local $3
get_local $2
i32.sub
i32.const 3 i32.const 3
i32.shl i32.shl
i32.store offset=8 i32.store offset=8
@ -1650,11 +1603,8 @@
set_local $2 set_local $2
get_local $0 get_local $0
i32.load offset=8 i32.load offset=8
get_local $0
i32.load offset=4
i32.sub
i32.const 3 i32.const 3
i32.shr_s i32.shr_u
tee_local $4 tee_local $4
i32.const 1 i32.const 1
i32.le_s i32.le_s
@ -1771,28 +1721,24 @@
call $~lib/internal/typedarray/TypedArray<f64,f64>#sort call $~lib/internal/typedarray/TypedArray<f64,f64>#sort
) )
(func $~lib/internal/typedarray/TypedArray<f64,f64>#__get (; 22 ;) (type $iiF) (param $0 i32) (param $1 i32) (result f64) (func $~lib/internal/typedarray/TypedArray<f64,f64>#__get (; 22 ;) (type $iiF) (param $0 i32) (param $1 i32) (result f64)
(local $2 i32)
get_local $1 get_local $1
get_local $0 get_local $0
i32.load offset=8 i32.load offset=8
get_local $0
i32.load offset=4
tee_local $2
i32.sub
i32.const 3 i32.const 3
i32.shr_u i32.shr_u
i32.ge_u i32.ge_u
if if
i32.const 0 i32.const 0
i32.const 48 i32.const 48
i32.const 42 i32.const 40
i32.const 42 i32.const 63
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
end end
get_local $0 get_local $0
i32.load i32.load
get_local $2 get_local $0
i32.load offset=4
i32.add i32.add
get_local $1 get_local $1
i32.const 3 i32.const 3
@ -1801,26 +1747,22 @@
f64.load offset=8 f64.load offset=8
) )
(func $~lib/internal/typedarray/TypedArray<u8,u32>#__set (; 23 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (func $~lib/internal/typedarray/TypedArray<u8,u32>#__set (; 23 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
(local $3 i32)
get_local $1 get_local $1
get_local $0 get_local $0
i32.load offset=8 i32.load offset=8
get_local $0
i32.load offset=4
tee_local $3
i32.sub
i32.ge_u i32.ge_u
if if
i32.const 0 i32.const 0
i32.const 48 i32.const 48
i32.const 55 i32.const 51
i32.const 42 i32.const 63
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
end end
get_local $0 get_local $0
i32.load i32.load
get_local $3 get_local $0
i32.load offset=4
i32.add i32.add
get_local $1 get_local $1
i32.add i32.add
@ -1846,26 +1788,22 @@
call $~lib/internal/typedarray/TypedArray<u8,u32>#__set call $~lib/internal/typedarray/TypedArray<u8,u32>#__set
) )
(func $~lib/internal/typedarray/TypedArray<u8,u32>#__get (; 25 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (func $~lib/internal/typedarray/TypedArray<u8,u32>#__get (; 25 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
get_local $1 get_local $1
get_local $0 get_local $0
i32.load offset=8 i32.load offset=8
get_local $0
i32.load offset=4
tee_local $2
i32.sub
i32.ge_u i32.ge_u
if if
i32.const 0 i32.const 0
i32.const 48 i32.const 48
i32.const 42 i32.const 40
i32.const 42 i32.const 63
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
end end
get_local $0 get_local $0
i32.load i32.load
get_local $2 get_local $0
i32.load offset=4
i32.add i32.add
get_local $1 get_local $1
i32.add i32.add
@ -1884,9 +1822,6 @@
set_local $7 set_local $7
get_local $0 get_local $0
i32.load offset=8 i32.load offset=8
get_local $0
i32.load offset=4
i32.sub
set_local $4 set_local $4
get_local $2 get_local $2
i32.const 0 i32.const 0
@ -1952,26 +1887,22 @@
get_local $0 get_local $0
) )
(func $~lib/internal/typedarray/TypedArray<i8,i32>#__get (; 27 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (func $~lib/internal/typedarray/TypedArray<i8,i32>#__get (; 27 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
get_local $1 get_local $1
get_local $0 get_local $0
i32.load offset=8 i32.load offset=8
get_local $0
i32.load offset=4
tee_local $2
i32.sub
i32.ge_u i32.ge_u
if if
i32.const 0 i32.const 0
i32.const 48 i32.const 48
i32.const 42 i32.const 40
i32.const 42 i32.const 63
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
end end
get_local $0 get_local $0
i32.load i32.load
get_local $2 get_local $0
i32.load offset=4
i32.add i32.add
get_local $1 get_local $1
i32.add i32.add
@ -2001,9 +1932,6 @@
(local $5 i32) (local $5 i32)
get_local $0 get_local $0
i32.load offset=8 i32.load offset=8
get_local $0
i32.load offset=4
i32.sub
get_local $1 get_local $1
i32.load offset=4 i32.load offset=4
i32.ne i32.ne
@ -2014,9 +1942,6 @@
block $break|0 block $break|0
get_local $0 get_local $0
i32.load offset=8 i32.load offset=8
get_local $0
i32.load offset=4
i32.sub
set_local $3 set_local $3
loop $repeat|0 loop $repeat|0
get_local $2 get_local $2
@ -2091,9 +2016,6 @@
i32.const 1 i32.const 1
get_local $0 get_local $0
i32.load offset=8 i32.load offset=8
get_local $0
i32.load offset=4
i32.sub
tee_local $1 tee_local $1
i32.const 1 i32.const 1
get_local $1 get_local $1
@ -2124,6 +2046,8 @@
i32.store offset=4 i32.store offset=4
get_local $1 get_local $1
get_local $3 get_local $3
get_local $2
i32.sub
i32.store offset=8 i32.store offset=8
get_local $1 get_local $1
) )
@ -2140,11 +2064,8 @@
set_local $7 set_local $7
get_local $0 get_local $0
i32.load offset=8 i32.load offset=8
get_local $0
i32.load offset=4
i32.sub
i32.const 2 i32.const 2
i32.shr_s i32.shr_u
set_local $4 set_local $4
get_local $2 get_local $2
i32.const 0 i32.const 0
@ -2246,11 +2167,8 @@
(local $5 i32) (local $5 i32)
get_local $0 get_local $0
i32.load offset=8 i32.load offset=8
get_local $0
i32.load offset=4
i32.sub
i32.const 2 i32.const 2
i32.shr_s i32.shr_u
get_local $1 get_local $1
i32.load offset=4 i32.load offset=4
i32.ne i32.ne
@ -2261,11 +2179,8 @@
block $break|0 block $break|0
get_local $0 get_local $0
i32.load offset=8 i32.load offset=8
get_local $0
i32.load offset=4
i32.sub
i32.const 2 i32.const 2
i32.shr_s i32.shr_u
set_local $3 set_local $3
loop $repeat|0 loop $repeat|0
get_local $2 get_local $2
@ -2351,13 +2266,9 @@
i32.const 3 i32.const 3
call $~lib/internal/typedarray/TypedArray<i32,i32>#__set call $~lib/internal/typedarray/TypedArray<i32,i32>#__set
get_global $std/typedarray/arr get_global $std/typedarray/arr
tee_local $0
i32.load offset=8 i32.load offset=8
get_local $0
i32.load offset=4
i32.sub
i32.const 2 i32.const 2
i32.shr_s i32.shr_u
i32.const 3 i32.const 3
i32.ne i32.ne
if if
@ -2434,13 +2345,9 @@
call $~lib/typedarray/Int32Array#subarray call $~lib/typedarray/Int32Array#subarray
set_global $std/typedarray/arr set_global $std/typedarray/arr
get_global $std/typedarray/arr get_global $std/typedarray/arr
tee_local $0
i32.load offset=8 i32.load offset=8
get_local $0
i32.load offset=4
i32.sub
i32.const 2 i32.const 2
i32.shr_s i32.shr_u
i32.const 1 i32.const 1
i32.ne i32.ne
if if
@ -2465,7 +2372,7 @@
end end
get_global $std/typedarray/arr get_global $std/typedarray/arr
i32.load offset=8 i32.load offset=8
i32.const 8 i32.const 4
i32.ne i32.ne
if if
i32.const 0 i32.const 0
@ -2527,13 +2434,9 @@
call $~lib/typedarray/Float64Array#subarray call $~lib/typedarray/Float64Array#subarray
set_global $std/typedarray/af64 set_global $std/typedarray/af64
get_global $std/typedarray/af64 get_global $std/typedarray/af64
tee_local $0
i32.load offset=8 i32.load offset=8
get_local $0
i32.load offset=4
i32.sub
i32.const 3 i32.const 3
i32.shr_s i32.shr_u
i32.const 4 i32.const 4
i32.ne i32.ne
if if
@ -2544,6 +2447,30 @@
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
end end
get_global $std/typedarray/af64
i32.load offset=4
i32.const 16
i32.ne
if
i32.const 0
i32.const 8
i32.const 123
i32.const 0
call $~lib/env/abort
unreachable
end
get_global $std/typedarray/af64
i32.load offset=8
i32.const 32
i32.ne
if
i32.const 0
i32.const 8
i32.const 124
i32.const 0
call $~lib/env/abort
unreachable
end
i32.const 0 i32.const 0
set_global $~argc set_global $~argc
get_global $std/typedarray/af64 get_global $std/typedarray/af64
@ -2586,7 +2513,7 @@
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 8
i32.const 124 i32.const 126
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
@ -2614,7 +2541,7 @@
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 8
i32.const 131 i32.const 133
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
@ -2629,7 +2556,7 @@
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 8
i32.const 132 i32.const 134
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
@ -2644,7 +2571,7 @@
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 8
i32.const 133 i32.const 135
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
@ -2685,7 +2612,7 @@
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 8
i32.const 143 i32.const 145
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
@ -2704,7 +2631,7 @@
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 8
i32.const 146 i32.const 148
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
@ -2722,7 +2649,7 @@
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 8
i32.const 149 i32.const 151
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
@ -2741,7 +2668,7 @@
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 8
i32.const 152 i32.const 154
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
@ -2759,7 +2686,7 @@
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 8
i32.const 155 i32.const 157
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
@ -2775,17 +2702,37 @@
call $~lib/internal/typedarray/TypedArray<i8,i32>#fill|trampoline call $~lib/internal/typedarray/TypedArray<i8,i32>#fill|trampoline
drop drop
get_global $std/typedarray/sub8 get_global $std/typedarray/sub8
tee_local $0
i32.load offset=8 i32.load offset=8
get_local $0
i32.load offset=4
i32.sub
i32.const 3 i32.const 3
i32.ne i32.ne
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 8
i32.const 159 i32.const 161
i32.const 0
call $~lib/env/abort
unreachable
end
get_global $std/typedarray/sub8
i32.load offset=4
i32.const 1
i32.ne
if
i32.const 0
i32.const 8
i32.const 162
i32.const 0
call $~lib/env/abort
unreachable
end
get_global $std/typedarray/sub8
i32.load offset=8
i32.const 3
i32.ne
if
i32.const 0
i32.const 8
i32.const 163
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
@ -2797,7 +2744,7 @@
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 8
i32.const 160 i32.const 164
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
@ -2809,7 +2756,7 @@
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 8
i32.const 161 i32.const 165
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
@ -2850,7 +2797,7 @@
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 8
i32.const 171 i32.const 175
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
@ -2869,7 +2816,7 @@
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 8
i32.const 174 i32.const 178
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
@ -2887,7 +2834,7 @@
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 8
i32.const 177 i32.const 181
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
@ -2906,7 +2853,7 @@
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 8
i32.const 180 i32.const 184
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
@ -2924,7 +2871,7 @@
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 8
i32.const 183 i32.const 187
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
@ -2941,19 +2888,39 @@
call $~lib/internal/typedarray/TypedArray<i32,i32>#fill|trampoline call $~lib/internal/typedarray/TypedArray<i32,i32>#fill|trampoline
drop drop
get_global $std/typedarray/sub32 get_global $std/typedarray/sub32
tee_local $0
i32.load offset=8 i32.load offset=8
get_local $0
i32.load offset=4
i32.sub
i32.const 2 i32.const 2
i32.shr_s i32.shr_u
i32.const 3 i32.const 3
i32.ne i32.ne
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 8
i32.const 187 i32.const 191
i32.const 0
call $~lib/env/abort
unreachable
end
get_global $std/typedarray/sub32
i32.load offset=4
i32.const 4
i32.ne
if
i32.const 0
i32.const 8
i32.const 192
i32.const 0
call $~lib/env/abort
unreachable
end
get_global $std/typedarray/sub32
i32.load offset=8
i32.const 12
i32.ne
if
i32.const 0
i32.const 8
i32.const 193
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
@ -2965,7 +2932,7 @@
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 8
i32.const 188 i32.const 194
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
@ -2977,7 +2944,7 @@
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 8
i32.const 189 i32.const 195
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable

View File

@ -104,7 +104,7 @@ assert(arr[2] == 3);
arr = arr.subarray(1, 2); arr = arr.subarray(1, 2);
assert(arr.length == 1); assert(arr.length == 1);
assert(arr.byteOffset == 1 * sizeof<i32>()); assert(arr.byteOffset == 1 * sizeof<i32>());
assert(arr.byteLength == 2 * sizeof<i32>()); assert(arr.byteLength == 1 * sizeof<i32>());
assert(arr[0] == 2); assert(arr[0] == 2);
var af64 = new Float64Array(8); var af64 = new Float64Array(8);
@ -120,6 +120,8 @@ af64[6] = 3;
af64[7] = 8; af64[7] = 8;
af64 = af64.subarray(2, 6); af64 = af64.subarray(2, 6);
assert(af64.length == 4); assert(af64.length == 4);
assert(af64.byteOffset == 2 * sizeof<f64>());
assert(af64.byteLength == 4 * sizeof<f64>());
af64.sort(); af64.sort();
assert(af64[0] == 4 && af64[1] == 5 && af64[2] == 6 && af64[3] == 7); assert(af64[0] == 4 && af64[1] == 5 && af64[2] == 6 && af64[3] == 7);
@ -157,6 +159,8 @@ assert(isInt8ArrayEqual(arr8, <i8[]>[1, 1, 0, 2, 2]));
var sub8 = arr8.subarray(1, 4); var sub8 = arr8.subarray(1, 4);
sub8.fill(0); sub8.fill(0);
assert(sub8.length == 3); assert(sub8.length == 3);
assert(sub8.byteOffset == 1);
assert(sub8.byteLength == 3);
assert(isInt8ArrayEqual(sub8, <i8[]>[0, 0, 0])); assert(isInt8ArrayEqual(sub8, <i8[]>[0, 0, 0]));
assert(isInt8ArrayEqual(arr8, <i8[]>[1, 0, 0, 0, 2])); assert(isInt8ArrayEqual(arr8, <i8[]>[1, 0, 0, 0, 2]));
@ -185,6 +189,8 @@ assert(isInt32ArrayEqual(arr32, <i32[]>[1, 1, 0, 2, 2]));
var sub32 = arr32.subarray(1, 4); var sub32 = arr32.subarray(1, 4);
sub32.fill(0); sub32.fill(0);
assert(sub32.length == 3); assert(sub32.length == 3);
assert(sub32.byteOffset == 1 * sizeof<i32>());
assert(sub32.byteLength == 3 * sizeof<i32>());
assert(isInt32ArrayEqual(sub32, <i32[]>[0, 0, 0])); assert(isInt32ArrayEqual(sub32, <i32[]>[0, 0, 0]));
assert(isInt32ArrayEqual(arr32, <i32[]>[1, 0, 0, 0, 2])); assert(isInt32ArrayEqual(arr32, <i32[]>[1, 0, 0, 0, 2]));

View File

@ -1174,11 +1174,8 @@
block $~lib/internal/typedarray/TypedArray<i8,i32>#get:length|inlined.0 (result i32) block $~lib/internal/typedarray/TypedArray<i8,i32>#get:length|inlined.0 (result i32)
get_local $1 get_local $1
i32.load offset=8 i32.load offset=8
get_local $1
i32.load offset=4
i32.sub
i32.const 0 i32.const 0
i32.shr_s i32.shr_u
end end
get_local $0 get_local $0
i32.eq i32.eq
@ -1226,11 +1223,8 @@
block $~lib/internal/typedarray/TypedArray<u8,u32>#get:length|inlined.0 (result i32) block $~lib/internal/typedarray/TypedArray<u8,u32>#get:length|inlined.0 (result i32)
get_local $2 get_local $2
i32.load offset=8 i32.load offset=8
get_local $2
i32.load offset=4
i32.sub
i32.const 0 i32.const 0
i32.shr_s i32.shr_u
end end
get_local $0 get_local $0
i32.eq i32.eq
@ -1278,11 +1272,8 @@
block $~lib/internal/typedarray/TypedArray<u8,u32>#get:length|inlined.1 (result i32) block $~lib/internal/typedarray/TypedArray<u8,u32>#get:length|inlined.1 (result i32)
get_local $3 get_local $3
i32.load offset=8 i32.load offset=8
get_local $3
i32.load offset=4
i32.sub
i32.const 0 i32.const 0
i32.shr_s i32.shr_u
end end
get_local $0 get_local $0
i32.eq i32.eq
@ -1330,11 +1321,8 @@
block $~lib/internal/typedarray/TypedArray<i16,i32>#get:length|inlined.0 (result i32) block $~lib/internal/typedarray/TypedArray<i16,i32>#get:length|inlined.0 (result i32)
get_local $4 get_local $4
i32.load offset=8 i32.load offset=8
get_local $4
i32.load offset=4
i32.sub
i32.const 1 i32.const 1
i32.shr_s i32.shr_u
end end
get_local $0 get_local $0
i32.eq i32.eq
@ -1382,11 +1370,8 @@
block $~lib/internal/typedarray/TypedArray<u16,u32>#get:length|inlined.0 (result i32) block $~lib/internal/typedarray/TypedArray<u16,u32>#get:length|inlined.0 (result i32)
get_local $5 get_local $5
i32.load offset=8 i32.load offset=8
get_local $5
i32.load offset=4
i32.sub
i32.const 1 i32.const 1
i32.shr_s i32.shr_u
end end
get_local $0 get_local $0
i32.eq i32.eq
@ -1434,11 +1419,8 @@
block $~lib/internal/typedarray/TypedArray<i32,i32>#get:length|inlined.0 (result i32) block $~lib/internal/typedarray/TypedArray<i32,i32>#get:length|inlined.0 (result i32)
get_local $6 get_local $6
i32.load offset=8 i32.load offset=8
get_local $6
i32.load offset=4
i32.sub
i32.const 2 i32.const 2
i32.shr_s i32.shr_u
end end
get_local $0 get_local $0
i32.eq i32.eq
@ -1486,11 +1468,8 @@
block $~lib/internal/typedarray/TypedArray<u32,u32>#get:length|inlined.0 (result i32) block $~lib/internal/typedarray/TypedArray<u32,u32>#get:length|inlined.0 (result i32)
get_local $7 get_local $7
i32.load offset=8 i32.load offset=8
get_local $7
i32.load offset=4
i32.sub
i32.const 2 i32.const 2
i32.shr_s i32.shr_u
end end
get_local $0 get_local $0
i32.eq i32.eq
@ -1538,11 +1517,8 @@
block $~lib/internal/typedarray/TypedArray<i64,i64>#get:length|inlined.0 (result i32) block $~lib/internal/typedarray/TypedArray<i64,i64>#get:length|inlined.0 (result i32)
get_local $8 get_local $8
i32.load offset=8 i32.load offset=8
get_local $8
i32.load offset=4
i32.sub
i32.const 3 i32.const 3
i32.shr_s i32.shr_u
end end
get_local $0 get_local $0
i32.eq i32.eq
@ -1590,11 +1566,8 @@
block $~lib/internal/typedarray/TypedArray<u64,u64>#get:length|inlined.0 (result i32) block $~lib/internal/typedarray/TypedArray<u64,u64>#get:length|inlined.0 (result i32)
get_local $9 get_local $9
i32.load offset=8 i32.load offset=8
get_local $9
i32.load offset=4
i32.sub
i32.const 3 i32.const 3
i32.shr_s i32.shr_u
end end
get_local $0 get_local $0
i32.eq i32.eq
@ -1642,11 +1615,8 @@
block $~lib/internal/typedarray/TypedArray<f32,f32>#get:length|inlined.0 (result i32) block $~lib/internal/typedarray/TypedArray<f32,f32>#get:length|inlined.0 (result i32)
get_local $10 get_local $10
i32.load offset=8 i32.load offset=8
get_local $10
i32.load offset=4
i32.sub
i32.const 2 i32.const 2
i32.shr_s i32.shr_u
end end
get_local $0 get_local $0
i32.eq i32.eq
@ -1694,11 +1664,8 @@
block $~lib/internal/typedarray/TypedArray<f64,f64>#get:length|inlined.0 (result i32) block $~lib/internal/typedarray/TypedArray<f64,f64>#get:length|inlined.0 (result i32)
get_local $11 get_local $11
i32.load offset=8 i32.load offset=8
get_local $11
i32.load offset=4
i32.sub
i32.const 3 i32.const 3
i32.shr_s i32.shr_u
end end
get_local $0 get_local $0
i32.eq i32.eq
@ -1715,34 +1682,29 @@
(func $~lib/internal/typedarray/TypedArray<i32,i32>#__set (; 17 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (func $~lib/internal/typedarray/TypedArray<i32,i32>#__set (; 17 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
(local $3 i32) (local $3 i32)
(local $4 i32) (local $4 i32)
(local $5 i32) get_local $1
get_local $0
i32.load offset=4
set_local $3
get_local $0 get_local $0
i32.load offset=8 i32.load offset=8
get_local $3
i32.sub
i32.const 2 i32.const 2
i32.shr_u i32.shr_u
set_local $4
get_local $1
get_local $4
i32.ge_u i32.ge_u
if if
i32.const 0 i32.const 0
i32.const 48 i32.const 48
i32.const 55 i32.const 51
i32.const 42 i32.const 63
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
end end
block $~lib/internal/arraybuffer/storeUnsafeWithOffset<i32,i32>|inlined.0 block $~lib/internal/arraybuffer/storeUnsafeWithOffset<i32,i32>|inlined.0
get_local $0 get_local $0
i32.load i32.load
set_local $5 set_local $3
get_local $5 get_local $0
i32.load offset=4
set_local $4
get_local $3 get_local $3
get_local $4
i32.add i32.add
get_local $1 get_local $1
i32.const 2 i32.const 2
@ -1755,34 +1717,29 @@
(func $~lib/internal/typedarray/TypedArray<i32,i32>#__get (; 18 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (func $~lib/internal/typedarray/TypedArray<i32,i32>#__get (; 18 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32) (local $2 i32)
(local $3 i32) (local $3 i32)
(local $4 i32) get_local $1
get_local $0
i32.load offset=4
set_local $2
get_local $0 get_local $0
i32.load offset=8 i32.load offset=8
get_local $2
i32.sub
i32.const 2 i32.const 2
i32.shr_u i32.shr_u
set_local $3
get_local $1
get_local $3
i32.ge_u i32.ge_u
if if
i32.const 0 i32.const 0
i32.const 48 i32.const 48
i32.const 42 i32.const 40
i32.const 42 i32.const 63
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
end end
block $~lib/internal/arraybuffer/loadUnsafeWithOffset<i32,i32>|inlined.0 (result i32) block $~lib/internal/arraybuffer/loadUnsafeWithOffset<i32,i32>|inlined.0 (result i32)
get_local $0 get_local $0
i32.load i32.load
set_local $4 set_local $2
get_local $4 get_local $0
i32.load offset=4
set_local $3
get_local $2 get_local $2
get_local $3
i32.add i32.add
get_local $1 get_local $1
i32.const 2 i32.const 2
@ -1798,11 +1755,8 @@
block $~lib/internal/typedarray/TypedArray<i32,i32>#get:length|inlined.2 (result i32) block $~lib/internal/typedarray/TypedArray<i32,i32>#get:length|inlined.2 (result i32)
get_local $0 get_local $0
i32.load offset=8 i32.load offset=8
get_local $0
i32.load offset=4
i32.sub
i32.const 2 i32.const 2
i32.shr_s i32.shr_u
end end
set_local $3 set_local $3
get_local $1 get_local $1
@ -1883,6 +1837,8 @@
i32.store offset=4 i32.store offset=4
get_local $4 get_local $4
get_local $2 get_local $2
get_local $1
i32.sub
i32.const 2 i32.const 2
i32.shl i32.shl
i32.store offset=8 i32.store offset=8
@ -1891,34 +1847,29 @@
(func $~lib/internal/typedarray/TypedArray<f64,f64>#__set (; 20 ;) (type $iiFv) (param $0 i32) (param $1 i32) (param $2 f64) (func $~lib/internal/typedarray/TypedArray<f64,f64>#__set (; 20 ;) (type $iiFv) (param $0 i32) (param $1 i32) (param $2 f64)
(local $3 i32) (local $3 i32)
(local $4 i32) (local $4 i32)
(local $5 i32) get_local $1
get_local $0
i32.load offset=4
set_local $3
get_local $0 get_local $0
i32.load offset=8 i32.load offset=8
get_local $3
i32.sub
i32.const 3 i32.const 3
i32.shr_u i32.shr_u
set_local $4
get_local $1
get_local $4
i32.ge_u i32.ge_u
if if
i32.const 0 i32.const 0
i32.const 48 i32.const 48
i32.const 55 i32.const 51
i32.const 42 i32.const 63
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
end end
block $~lib/internal/arraybuffer/storeUnsafeWithOffset<f64,f64>|inlined.0 block $~lib/internal/arraybuffer/storeUnsafeWithOffset<f64,f64>|inlined.0
get_local $0 get_local $0
i32.load i32.load
set_local $5 set_local $3
get_local $5 get_local $0
i32.load offset=4
set_local $4
get_local $3 get_local $3
get_local $4
i32.add i32.add
get_local $1 get_local $1
i32.const 3 i32.const 3
@ -1935,11 +1886,8 @@
block $~lib/internal/typedarray/TypedArray<f64,f64>#get:length|inlined.1 (result i32) block $~lib/internal/typedarray/TypedArray<f64,f64>#get:length|inlined.1 (result i32)
get_local $0 get_local $0
i32.load offset=8 i32.load offset=8
get_local $0
i32.load offset=4
i32.sub
i32.const 3 i32.const 3
i32.shr_s i32.shr_u
end end
set_local $3 set_local $3
get_local $1 get_local $1
@ -2020,6 +1968,8 @@
i32.store offset=4 i32.store offset=4
get_local $4 get_local $4
get_local $2 get_local $2
get_local $1
i32.sub
i32.const 3 i32.const 3
i32.shl i32.shl
i32.store offset=8 i32.store offset=8
@ -2586,11 +2536,8 @@
block $~lib/internal/typedarray/TypedArray<f64,f64>#get:length|inlined.3 (result i32) block $~lib/internal/typedarray/TypedArray<f64,f64>#get:length|inlined.3 (result i32)
get_local $0 get_local $0
i32.load offset=8 i32.load offset=8
get_local $0
i32.load offset=4
i32.sub
i32.const 3 i32.const 3
i32.shr_s i32.shr_u
end end
set_local $3 set_local $3
get_local $3 get_local $3
@ -2748,34 +2695,29 @@
(func $~lib/internal/typedarray/TypedArray<f64,f64>#__get (; 28 ;) (type $iiF) (param $0 i32) (param $1 i32) (result f64) (func $~lib/internal/typedarray/TypedArray<f64,f64>#__get (; 28 ;) (type $iiF) (param $0 i32) (param $1 i32) (result f64)
(local $2 i32) (local $2 i32)
(local $3 i32) (local $3 i32)
(local $4 i32) get_local $1
get_local $0
i32.load offset=4
set_local $2
get_local $0 get_local $0
i32.load offset=8 i32.load offset=8
get_local $2
i32.sub
i32.const 3 i32.const 3
i32.shr_u i32.shr_u
set_local $3
get_local $1
get_local $3
i32.ge_u i32.ge_u
if if
i32.const 0 i32.const 0
i32.const 48 i32.const 48
i32.const 42 i32.const 40
i32.const 42 i32.const 63
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
end end
block $~lib/internal/arraybuffer/loadUnsafeWithOffset<f64,f64>|inlined.12 (result f64) block $~lib/internal/arraybuffer/loadUnsafeWithOffset<f64,f64>|inlined.12 (result f64)
get_local $0 get_local $0
i32.load i32.load
set_local $4 set_local $2
get_local $4 get_local $0
i32.load offset=4
set_local $3
get_local $2 get_local $2
get_local $3
i32.add i32.add
get_local $1 get_local $1
i32.const 3 i32.const 3
@ -2787,34 +2729,29 @@
(func $~lib/internal/typedarray/TypedArray<u8,u32>#__set (; 29 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (func $~lib/internal/typedarray/TypedArray<u8,u32>#__set (; 29 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
(local $3 i32) (local $3 i32)
(local $4 i32) (local $4 i32)
(local $5 i32) get_local $1
get_local $0
i32.load offset=4
set_local $3
get_local $0 get_local $0
i32.load offset=8 i32.load offset=8
get_local $3
i32.sub
i32.const 0 i32.const 0
i32.shr_u i32.shr_u
set_local $4
get_local $1
get_local $4
i32.ge_u i32.ge_u
if if
i32.const 0 i32.const 0
i32.const 48 i32.const 48
i32.const 55 i32.const 51
i32.const 42 i32.const 63
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
end end
block $~lib/internal/arraybuffer/storeUnsafeWithOffset<u8,u32>|inlined.0 block $~lib/internal/arraybuffer/storeUnsafeWithOffset<u8,u32>|inlined.0
get_local $0 get_local $0
i32.load i32.load
set_local $5 set_local $3
get_local $5 get_local $0
i32.load offset=4
set_local $4
get_local $3 get_local $3
get_local $4
i32.add i32.add
get_local $1 get_local $1
i32.const 0 i32.const 0
@ -2849,34 +2786,29 @@
(func $~lib/internal/typedarray/TypedArray<u8,u32>#__get (; 31 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (func $~lib/internal/typedarray/TypedArray<u8,u32>#__get (; 31 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32) (local $2 i32)
(local $3 i32) (local $3 i32)
(local $4 i32) get_local $1
get_local $0
i32.load offset=4
set_local $2
get_local $0 get_local $0
i32.load offset=8 i32.load offset=8
get_local $2
i32.sub
i32.const 0 i32.const 0
i32.shr_u i32.shr_u
set_local $3
get_local $1
get_local $3
i32.ge_u i32.ge_u
if if
i32.const 0 i32.const 0
i32.const 48 i32.const 48
i32.const 42 i32.const 40
i32.const 42 i32.const 63
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
end end
block $~lib/internal/arraybuffer/loadUnsafeWithOffset<u8,u8>|inlined.0 (result i32) block $~lib/internal/arraybuffer/loadUnsafeWithOffset<u8,u8>|inlined.0 (result i32)
get_local $0 get_local $0
i32.load i32.load
set_local $4 set_local $2
get_local $4 get_local $0
i32.load offset=4
set_local $3
get_local $2 get_local $2
get_local $3
i32.add i32.add
get_local $1 get_local $1
i32.const 0 i32.const 0
@ -2888,34 +2820,29 @@
(func $~lib/internal/typedarray/TypedArray<i8,i32>#__set (; 32 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (func $~lib/internal/typedarray/TypedArray<i8,i32>#__set (; 32 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
(local $3 i32) (local $3 i32)
(local $4 i32) (local $4 i32)
(local $5 i32) get_local $1
get_local $0
i32.load offset=4
set_local $3
get_local $0 get_local $0
i32.load offset=8 i32.load offset=8
get_local $3
i32.sub
i32.const 0 i32.const 0
i32.shr_u i32.shr_u
set_local $4
get_local $1
get_local $4
i32.ge_u i32.ge_u
if if
i32.const 0 i32.const 0
i32.const 48 i32.const 48
i32.const 55 i32.const 51
i32.const 42 i32.const 63
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
end end
block $~lib/internal/arraybuffer/storeUnsafeWithOffset<i8,i32>|inlined.0 block $~lib/internal/arraybuffer/storeUnsafeWithOffset<i8,i32>|inlined.0
get_local $0 get_local $0
i32.load i32.load
set_local $5 set_local $3
get_local $5 get_local $0
i32.load offset=4
set_local $4
get_local $3 get_local $3
get_local $4
i32.add i32.add
get_local $1 get_local $1
i32.const 0 i32.const 0
@ -2940,11 +2867,8 @@
block $~lib/internal/typedarray/TypedArray<i8,i32>#get:length|inlined.1 (result i32) block $~lib/internal/typedarray/TypedArray<i8,i32>#get:length|inlined.1 (result i32)
get_local $0 get_local $0
i32.load offset=8 i32.load offset=8
get_local $0
i32.load offset=4
i32.sub
i32.const 0 i32.const 0
i32.shr_s i32.shr_u
end end
set_local $6 set_local $6
get_local $2 get_local $2
@ -3023,34 +2947,29 @@
(func $~lib/internal/typedarray/TypedArray<i8,i32>#__get (; 34 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (func $~lib/internal/typedarray/TypedArray<i8,i32>#__get (; 34 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32) (local $2 i32)
(local $3 i32) (local $3 i32)
(local $4 i32) get_local $1
get_local $0
i32.load offset=4
set_local $2
get_local $0 get_local $0
i32.load offset=8 i32.load offset=8
get_local $2
i32.sub
i32.const 0 i32.const 0
i32.shr_u i32.shr_u
set_local $3
get_local $1
get_local $3
i32.ge_u i32.ge_u
if if
i32.const 0 i32.const 0
i32.const 48 i32.const 48
i32.const 42 i32.const 40
i32.const 42 i32.const 63
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
end end
block $~lib/internal/arraybuffer/loadUnsafeWithOffset<i8,i8>|inlined.0 (result i32) block $~lib/internal/arraybuffer/loadUnsafeWithOffset<i8,i8>|inlined.0 (result i32)
get_local $0 get_local $0
i32.load i32.load
set_local $4 set_local $2
get_local $4 get_local $0
i32.load offset=4
set_local $3
get_local $2 get_local $2
get_local $3
i32.add i32.add
get_local $1 get_local $1
i32.const 0 i32.const 0
@ -3087,11 +3006,8 @@
block $~lib/internal/typedarray/TypedArray<i8,i32>#get:length|inlined.3 (result i32) block $~lib/internal/typedarray/TypedArray<i8,i32>#get:length|inlined.3 (result i32)
get_local $0 get_local $0
i32.load offset=8 i32.load offset=8
get_local $0
i32.load offset=4
i32.sub
i32.const 0 i32.const 0
i32.shr_s i32.shr_u
end end
block $~lib/array/Array<i8>#get:length|inlined.1 (result i32) block $~lib/array/Array<i8>#get:length|inlined.1 (result i32)
get_local $1 get_local $1
@ -3109,11 +3025,8 @@
block $~lib/internal/typedarray/TypedArray<i8,i32>#get:length|inlined.4 (result i32) block $~lib/internal/typedarray/TypedArray<i8,i32>#get:length|inlined.4 (result i32)
get_local $0 get_local $0
i32.load offset=8 i32.load offset=8
get_local $0
i32.load offset=4
i32.sub
i32.const 0 i32.const 0
i32.shr_s i32.shr_u
end end
set_local $3 set_local $3
end end
@ -3184,11 +3097,8 @@
block $~lib/internal/typedarray/TypedArray<i8,i32>#get:length|inlined.5 (result i32) block $~lib/internal/typedarray/TypedArray<i8,i32>#get:length|inlined.5 (result i32)
get_local $0 get_local $0
i32.load offset=8 i32.load offset=8
get_local $0
i32.load offset=4
i32.sub
i32.const 0 i32.const 0
i32.shr_s i32.shr_u
end end
set_local $3 set_local $3
get_local $1 get_local $1
@ -3269,6 +3179,8 @@
i32.store offset=4 i32.store offset=4
get_local $4 get_local $4
get_local $2 get_local $2
get_local $1
i32.sub
i32.const 0 i32.const 0
i32.shl i32.shl
i32.store offset=8 i32.store offset=8
@ -3289,11 +3201,8 @@
block $~lib/internal/typedarray/TypedArray<i32,i32>#get:length|inlined.4 (result i32) block $~lib/internal/typedarray/TypedArray<i32,i32>#get:length|inlined.4 (result i32)
get_local $0 get_local $0
i32.load offset=8 i32.load offset=8
get_local $0
i32.load offset=4
i32.sub
i32.const 2 i32.const 2
i32.shr_s i32.shr_u
end end
set_local $6 set_local $6
get_local $2 get_local $2
@ -3403,11 +3312,8 @@
block $~lib/internal/typedarray/TypedArray<i32,i32>#get:length|inlined.6 (result i32) block $~lib/internal/typedarray/TypedArray<i32,i32>#get:length|inlined.6 (result i32)
get_local $0 get_local $0
i32.load offset=8 i32.load offset=8
get_local $0
i32.load offset=4
i32.sub
i32.const 2 i32.const 2
i32.shr_s i32.shr_u
end end
block $~lib/array/Array<i32>#get:length|inlined.1 (result i32) block $~lib/array/Array<i32>#get:length|inlined.1 (result i32)
get_local $1 get_local $1
@ -3425,11 +3331,8 @@
block $~lib/internal/typedarray/TypedArray<i32,i32>#get:length|inlined.7 (result i32) block $~lib/internal/typedarray/TypedArray<i32,i32>#get:length|inlined.7 (result i32)
get_local $0 get_local $0
i32.load offset=8 i32.load offset=8
get_local $0
i32.load offset=4
i32.sub
i32.const 2 i32.const 2
i32.shr_s i32.shr_u
end end
set_local $3 set_local $3
end end
@ -3654,11 +3557,8 @@
set_local $0 set_local $0
get_local $0 get_local $0
i32.load offset=8 i32.load offset=8
get_local $0
i32.load offset=4
i32.sub
i32.const 2 i32.const 2
i32.shr_s i32.shr_u
end end
i32.const 3 i32.const 3
i32.eq i32.eq
@ -3751,11 +3651,8 @@
set_local $0 set_local $0
get_local $0 get_local $0
i32.load offset=8 i32.load offset=8
get_local $0
i32.load offset=4
i32.sub
i32.const 2 i32.const 2
i32.shr_s i32.shr_u
end end
i32.const 1 i32.const 1
i32.eq i32.eq
@ -3785,7 +3682,7 @@
end end
get_global $std/typedarray/arr get_global $std/typedarray/arr
i32.load offset=8 i32.load offset=8
i32.const 2 i32.const 1
i32.const 4 i32.const 4
i32.mul i32.mul
i32.eq i32.eq
@ -3858,11 +3755,8 @@
set_local $0 set_local $0
get_local $0 get_local $0
i32.load offset=8 i32.load offset=8
get_local $0
i32.load offset=4
i32.sub
i32.const 3 i32.const 3
i32.shr_s i32.shr_u
end end
i32.const 4 i32.const 4
i32.eq i32.eq
@ -3875,6 +3769,36 @@
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
end end
get_global $std/typedarray/af64
i32.load offset=4
i32.const 2
i32.const 8
i32.mul
i32.eq
i32.eqz
if
i32.const 0
i32.const 8
i32.const 123
i32.const 0
call $~lib/env/abort
unreachable
end
get_global $std/typedarray/af64
i32.load offset=8
i32.const 4
i32.const 8
i32.mul
i32.eq
i32.eqz
if
i32.const 0
i32.const 8
i32.const 124
i32.const 0
call $~lib/env/abort
unreachable
end
block (result i32) block (result i32)
i32.const 0 i32.const 0
set_global $~argc set_global $~argc
@ -3922,7 +3846,7 @@
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 8
i32.const 124 i32.const 126
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
@ -3954,7 +3878,7 @@
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 8
i32.const 131 i32.const 133
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
@ -3970,7 +3894,7 @@
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 8
i32.const 132 i32.const 134
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
@ -3986,7 +3910,7 @@
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 8
i32.const 133 i32.const 135
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
@ -4028,7 +3952,7 @@
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 8
i32.const 143 i32.const 145
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
@ -4050,7 +3974,7 @@
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 8
i32.const 146 i32.const 148
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
@ -4068,7 +3992,7 @@
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 8
i32.const 149 i32.const 151
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
@ -4090,7 +4014,7 @@
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 8
i32.const 152 i32.const 154
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
@ -4108,7 +4032,7 @@
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 8
i32.const 155 i32.const 157
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
@ -4133,11 +4057,8 @@
set_local $0 set_local $0
get_local $0 get_local $0
i32.load offset=8 i32.load offset=8
get_local $0
i32.load offset=4
i32.sub
i32.const 0 i32.const 0
i32.shr_s i32.shr_u
end end
i32.const 3 i32.const 3
i32.eq i32.eq
@ -4145,7 +4066,33 @@
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 8
i32.const 159 i32.const 161
i32.const 0
call $~lib/env/abort
unreachable
end
get_global $std/typedarray/sub8
i32.load offset=4
i32.const 1
i32.eq
i32.eqz
if
i32.const 0
i32.const 8
i32.const 162
i32.const 0
call $~lib/env/abort
unreachable
end
get_global $std/typedarray/sub8
i32.load offset=8
i32.const 3
i32.eq
i32.eqz
if
i32.const 0
i32.const 8
i32.const 163
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
@ -4157,7 +4104,7 @@
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 8
i32.const 160 i32.const 164
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
@ -4169,7 +4116,7 @@
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 8
i32.const 161 i32.const 165
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
@ -4211,7 +4158,7 @@
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 8
i32.const 171 i32.const 175
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
@ -4233,7 +4180,7 @@
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 8
i32.const 174 i32.const 178
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
@ -4251,7 +4198,7 @@
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 8
i32.const 177 i32.const 181
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
@ -4273,7 +4220,7 @@
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 8
i32.const 180 i32.const 184
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
@ -4291,7 +4238,7 @@
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 8
i32.const 183 i32.const 187
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
@ -4316,11 +4263,8 @@
set_local $0 set_local $0
get_local $0 get_local $0
i32.load offset=8 i32.load offset=8
get_local $0
i32.load offset=4
i32.sub
i32.const 2 i32.const 2
i32.shr_s i32.shr_u
end end
i32.const 3 i32.const 3
i32.eq i32.eq
@ -4328,7 +4272,37 @@
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 8
i32.const 187 i32.const 191
i32.const 0
call $~lib/env/abort
unreachable
end
get_global $std/typedarray/sub32
i32.load offset=4
i32.const 1
i32.const 4
i32.mul
i32.eq
i32.eqz
if
i32.const 0
i32.const 8
i32.const 192
i32.const 0
call $~lib/env/abort
unreachable
end
get_global $std/typedarray/sub32
i32.load offset=8
i32.const 3
i32.const 4
i32.mul
i32.eq
i32.eqz
if
i32.const 0
i32.const 8
i32.const 193
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
@ -4340,7 +4314,7 @@
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 8
i32.const 188 i32.const 194
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
@ -4352,7 +4326,7 @@
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 8
i32.const 189 i32.const 195
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable