Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
375 changes: 0 additions & 375 deletions lib/binaryen.js

This file was deleted.

8 changes: 4 additions & 4 deletions std/assembly/array.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export class Array<T> {

@operator("[]") private __get(index: i32): T {
if (<u32>index >= <u32>this.length_) throw new RangeError(E_INDEXOUTOFRANGE);
var value = this.__unchecked_get(index);
var value = this.__uget(index);
if (isReference<T>()) {
if (!isNullable<T>()) {
if (!changetype<usize>(value)) throw new Error(E_HOLEYARRAY);
Expand All @@ -111,7 +111,7 @@ export class Array<T> {
return value;
}

@unsafe @operator("{}") private __unchecked_get(index: i32): T {
@unsafe @operator("{}") private __uget(index: i32): T {
return load<T>(this.dataStart + (<usize>index << alignof<T>()));
}

Expand All @@ -121,10 +121,10 @@ export class Array<T> {
ensureSize(changetype<usize>(this), index + 1, alignof<T>());
this.length_ = index + 1;
}
this.__unchecked_set(index, value);
this.__uset(index, value);
}

@unsafe @operator("{}=") private __unchecked_set(index: i32, value: T): void {
@unsafe @operator("{}=") private __uset(index: i32, value: T): void {
if (isManaged<T>()) {
let offset = this.dataStart + (<usize>index << alignof<T>());
let oldRef = load<usize>(offset);
Expand Down
8 changes: 4 additions & 4 deletions std/assembly/staticarray.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export class StaticArray<T> {

@operator("[]") private __get(index: i32): T {
if (<u32>index >= <u32>this.length) throw new RangeError(E_INDEXOUTOFRANGE);
var value = this.__unchecked_get(index);
var value = this.__uget(index);
if (isReference<T>()) {
if (!isNullable<T>()) {
if (!changetype<usize>(value)) throw new Error(E_HOLEYARRAY);
Expand All @@ -102,16 +102,16 @@ export class StaticArray<T> {
return value;
}

@unsafe @operator("{}") private __unchecked_get(index: i32): T {
@unsafe @operator("{}") private __uget(index: i32): T {
return load<T>(changetype<usize>(this) + (<usize>index << alignof<T>()));
}

@operator("[]=") private __set(index: i32, value: T): void {
if (<u32>index >= <u32>this.length) throw new RangeError(E_INDEXOUTOFRANGE);
this.__unchecked_set(index, value);
this.__uset(index, value);
}

@unsafe @operator("{}=") private __unchecked_set(index: i32, value: T): void {
@unsafe @operator("{}=") private __uset(index: i32, value: T): void {
if (isManaged<T>()) {
let offset = changetype<usize>(this) + (<usize>index << alignof<T>());
let oldRef = load<usize>(offset);
Expand Down
8 changes: 4 additions & 4 deletions tests/compiler/assert-nonnull.untouched.wat
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
call $~lib/rt/stub/__release
local.get $1
)
(func $~lib/array/Array<assert-nonnull/Foo>#__unchecked_get (param $0 i32) (param $1 i32) (result i32)
(func $~lib/array/Array<assert-nonnull/Foo>#__uget (param $0 i32) (param $1 i32) (result i32)
local.get $0
i32.load offset=4
local.get $1
Expand All @@ -129,7 +129,7 @@
end
local.get $0
local.get $1
call $~lib/array/Array<assert-nonnull/Foo>#__unchecked_get
call $~lib/array/Array<assert-nonnull/Foo>#__uget
local.set $2
i32.const 1
drop
Expand Down Expand Up @@ -174,7 +174,7 @@
call $~lib/rt/stub/__release
local.get $1
)
(func $~lib/array/Array<assert-nonnull/Foo | null>#__unchecked_get (param $0 i32) (param $1 i32) (result i32)
(func $~lib/array/Array<assert-nonnull/Foo | null>#__uget (param $0 i32) (param $1 i32) (result i32)
local.get $0
i32.load offset=4
local.get $1
Expand All @@ -200,7 +200,7 @@
end
local.get $0
local.get $1
call $~lib/array/Array<assert-nonnull/Foo | null>#__unchecked_get
call $~lib/array/Array<assert-nonnull/Foo | null>#__uget
local.set $2
i32.const 1
drop
Expand Down
32 changes: 16 additions & 16 deletions tests/compiler/infer-array.untouched.wat
Original file line number Diff line number Diff line change
Expand Up @@ -1450,7 +1450,7 @@
i32.store offset=12
local.get $4
)
(func $~lib/array/Array<i32>#__unchecked_get (param $0 i32) (param $1 i32) (result i32)
(func $~lib/array/Array<i32>#__uget (param $0 i32) (param $1 i32) (result i32)
local.get $0
i32.load offset=4
local.get $1
Expand All @@ -1475,7 +1475,7 @@
end
local.get $0
local.get $1
call $~lib/array/Array<i32>#__unchecked_get
call $~lib/array/Array<i32>#__uget
local.set $2
i32.const 0
drop
Expand All @@ -1484,7 +1484,7 @@
(func $~lib/rt/stub/__release (param $0 i32)
nop
)
(func $~lib/array/Array<f64>#__unchecked_get (param $0 i32) (param $1 i32) (result f64)
(func $~lib/array/Array<f64>#__uget (param $0 i32) (param $1 i32) (result f64)
local.get $0
i32.load offset=4
local.get $1
Expand All @@ -1509,13 +1509,13 @@
end
local.get $0
local.get $1
call $~lib/array/Array<f64>#__unchecked_get
call $~lib/array/Array<f64>#__uget
local.set $2
i32.const 0
drop
local.get $2
)
(func $~lib/array/Array<u32>#__unchecked_get (param $0 i32) (param $1 i32) (result i32)
(func $~lib/array/Array<u32>#__uget (param $0 i32) (param $1 i32) (result i32)
local.get $0
i32.load offset=4
local.get $1
Expand All @@ -1540,13 +1540,13 @@
end
local.get $0
local.get $1
call $~lib/array/Array<u32>#__unchecked_get
call $~lib/array/Array<u32>#__uget
local.set $2
i32.const 0
drop
local.get $2
)
(func $~lib/array/Array<f32>#__unchecked_get (param $0 i32) (param $1 i32) (result f32)
(func $~lib/array/Array<f32>#__uget (param $0 i32) (param $1 i32) (result f32)
local.get $0
i32.load offset=4
local.get $1
Expand All @@ -1571,7 +1571,7 @@
end
local.get $0
local.get $1
call $~lib/array/Array<f32>#__unchecked_get
call $~lib/array/Array<f32>#__uget
local.set $2
i32.const 0
drop
Expand All @@ -1589,7 +1589,7 @@
end
local.get $0
)
(func $~lib/array/Array<infer-array/Ref | null>#__unchecked_get (param $0 i32) (param $1 i32) (result i32)
(func $~lib/array/Array<infer-array/Ref | null>#__uget (param $0 i32) (param $1 i32) (result i32)
local.get $0
i32.load offset=4
local.get $1
Expand All @@ -1615,7 +1615,7 @@
end
local.get $0
local.get $1
call $~lib/array/Array<infer-array/Ref | null>#__unchecked_get
call $~lib/array/Array<infer-array/Ref | null>#__uget
local.set $2
i32.const 1
drop
Expand All @@ -1624,7 +1624,7 @@
drop
local.get $2
)
(func $~lib/array/Array<~lib/string/String | null>#__unchecked_get (param $0 i32) (param $1 i32) (result i32)
(func $~lib/array/Array<~lib/string/String | null>#__uget (param $0 i32) (param $1 i32) (result i32)
local.get $0
i32.load offset=4
local.get $1
Expand All @@ -1650,7 +1650,7 @@
end
local.get $0
local.get $1
call $~lib/array/Array<~lib/string/String | null>#__unchecked_get
call $~lib/array/Array<~lib/string/String | null>#__uget
local.set $2
i32.const 1
drop
Expand All @@ -1659,7 +1659,7 @@
drop
local.get $2
)
(func $~lib/array/Array<usize>#__unchecked_get (param $0 i32) (param $1 i32) (result i32)
(func $~lib/array/Array<usize>#__uget (param $0 i32) (param $1 i32) (result i32)
local.get $0
i32.load offset=4
local.get $1
Expand All @@ -1684,13 +1684,13 @@
end
local.get $0
local.get $1
call $~lib/array/Array<usize>#__unchecked_get
call $~lib/array/Array<usize>#__uget
local.set $2
i32.const 0
drop
local.get $2
)
(func $~lib/array/Array<~lib/array/Array<i32>>#__unchecked_get (param $0 i32) (param $1 i32) (result i32)
(func $~lib/array/Array<~lib/array/Array<i32>>#__uget (param $0 i32) (param $1 i32) (result i32)
local.get $0
i32.load offset=4
local.get $1
Expand All @@ -1716,7 +1716,7 @@
end
local.get $0
local.get $1
call $~lib/array/Array<~lib/array/Array<i32>>#__unchecked_get
call $~lib/array/Array<~lib/array/Array<i32>>#__uget
local.set $2
i32.const 1
drop
Expand Down
4 changes: 2 additions & 2 deletions tests/compiler/resolve-access.untouched.wat
Original file line number Diff line number Diff line change
Expand Up @@ -1444,7 +1444,7 @@
i32.store offset=12
local.get $4
)
(func $~lib/array/Array<u64>#__unchecked_get (param $0 i32) (param $1 i32) (result i64)
(func $~lib/array/Array<u64>#__uget (param $0 i32) (param $1 i32) (result i64)
local.get $0
i32.load offset=4
local.get $1
Expand All @@ -1469,7 +1469,7 @@
end
local.get $0
local.get $1
call $~lib/array/Array<u64>#__unchecked_get
call $~lib/array/Array<u64>#__uget
local.set $2
i32.const 0
drop
Expand Down
16 changes: 8 additions & 8 deletions tests/compiler/std/array-access.untouched.wat
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
(func $~lib/rt/stub/__retain (param $0 i32) (result i32)
local.get $0
)
(func $~lib/array/Array<~lib/array/Array<i32>>#__unchecked_get (param $0 i32) (param $1 i32) (result i32)
(func $~lib/array/Array<~lib/array/Array<i32>>#__uget (param $0 i32) (param $1 i32) (result i32)
local.get $0
i32.load offset=4
local.get $1
Expand Down Expand Up @@ -52,7 +52,7 @@
end
local.get $0
local.get $1
call $~lib/array/Array<~lib/array/Array<i32>>#__unchecked_get
call $~lib/array/Array<~lib/array/Array<i32>>#__uget
local.set $2
i32.const 1
drop
Expand All @@ -73,7 +73,7 @@
end
local.get $2
)
(func $~lib/array/Array<i32>#__unchecked_get (param $0 i32) (param $1 i32) (result i32)
(func $~lib/array/Array<i32>#__uget (param $0 i32) (param $1 i32) (result i32)
local.get $0
i32.load offset=4
local.get $1
Expand All @@ -98,7 +98,7 @@
end
local.get $0
local.get $1
call $~lib/array/Array<i32>#__unchecked_get
call $~lib/array/Array<i32>#__uget
local.set $2
i32.const 0
drop
Expand All @@ -123,7 +123,7 @@
call $~lib/rt/stub/__release
local.get $2
)
(func $~lib/array/Array<~lib/string/String>#__unchecked_get (param $0 i32) (param $1 i32) (result i32)
(func $~lib/array/Array<~lib/string/String>#__uget (param $0 i32) (param $1 i32) (result i32)
local.get $0
i32.load offset=4
local.get $1
Expand All @@ -149,7 +149,7 @@
end
local.get $0
local.get $1
call $~lib/array/Array<~lib/string/String>#__unchecked_get
call $~lib/array/Array<~lib/string/String>#__uget
local.set $2
i32.const 1
drop
Expand Down Expand Up @@ -417,7 +417,7 @@
call $~lib/rt/stub/__release
local.get $2
)
(func $~lib/array/Array<~lib/array/Array<~lib/string/String>>#__unchecked_get (param $0 i32) (param $1 i32) (result i32)
(func $~lib/array/Array<~lib/array/Array<~lib/string/String>>#__uget (param $0 i32) (param $1 i32) (result i32)
local.get $0
i32.load offset=4
local.get $1
Expand All @@ -443,7 +443,7 @@
end
local.get $0
local.get $1
call $~lib/array/Array<~lib/array/Array<~lib/string/String>>#__unchecked_get
call $~lib/array/Array<~lib/array/Array<~lib/string/String>>#__uget
local.set $2
i32.const 1
drop
Expand Down
8 changes: 4 additions & 4 deletions tests/compiler/std/array-literal.untouched.wat
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
local.get $0
i32.load offset=12
)
(func $~lib/array/Array<i8>#__unchecked_get (param $0 i32) (param $1 i32) (result i32)
(func $~lib/array/Array<i8>#__uget (param $0 i32) (param $1 i32) (result i32)
local.get $0
i32.load offset=4
local.get $1
Expand All @@ -73,7 +73,7 @@
end
local.get $0
local.get $1
call $~lib/array/Array<i8>#__unchecked_get
call $~lib/array/Array<i8>#__uget
local.set $2
i32.const 0
drop
Expand All @@ -83,7 +83,7 @@
local.get $0
i32.load offset=12
)
(func $~lib/array/Array<i32>#__unchecked_get (param $0 i32) (param $1 i32) (result i32)
(func $~lib/array/Array<i32>#__uget (param $0 i32) (param $1 i32) (result i32)
local.get $0
i32.load offset=4
local.get $1
Expand All @@ -108,7 +108,7 @@
end
local.get $0
local.get $1
call $~lib/array/Array<i32>#__unchecked_get
call $~lib/array/Array<i32>#__uget
local.set $2
i32.const 0
drop
Expand Down
6 changes: 3 additions & 3 deletions tests/compiler/std/array.optimized.wat
Original file line number Diff line number Diff line change
Expand Up @@ -2787,7 +2787,7 @@
i32.store offset=12
local.get $4
)
(func $~lib/array/Array<std/array/Ref>#__unchecked_get (param $0 i32) (param $1 i32) (result i32)
(func $~lib/array/Array<std/array/Ref>#__uget (param $0 i32) (param $1 i32) (result i32)
local.get $0
i32.load offset=4
local.get $1
Expand All @@ -2812,7 +2812,7 @@
end
local.get $0
local.get $1
call $~lib/array/Array<std/array/Ref>#__unchecked_get
call $~lib/array/Array<std/array/Ref>#__uget
local.tee $0
i32.eqz
if
Expand Down Expand Up @@ -2920,7 +2920,7 @@
end
local.get $0
local.get $1
call $~lib/array/Array<std/array/Ref>#__unchecked_get
call $~lib/array/Array<std/array/Ref>#__uget
)
(func $~lib/array/Array<i32>#__set (param $0 i32) (param $1 i32) (param $2 i32)
(local $3 i32)
Expand Down
Loading