Skip to content

Minor post fix for #1841 #1845

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions std/assembly/array.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class Array<T> {

private buffer: ArrayBuffer;
@unsafe readonly dataStart: usize;
private byteLength: i32;
private byteLength: i32; // Uses here as capacity

// Also note that Array<T> with non-nullable T must guard against uninitialized null values
// whenever an element is accessed. Otherwise, the compiler wouldn't be able to guarantee
Expand All @@ -63,7 +63,7 @@ export class Array<T> {
constructor(length: i32 = 0) {
if (<u32>length > <u32>BLOCK_MAXSIZE >>> alignof<T>()) throw new RangeError(E_INVALIDLENGTH);
// reserve capacity for at least MIN_SIZE elements
var bufferSize = <usize>max(length, MIN_SIZE) << alignof<T>();
var bufferSize = max(<usize>length, MIN_SIZE) << alignof<T>();
var buffer = changetype<ArrayBuffer>(__new(bufferSize, idof<ArrayBuffer>()));
memory.fill(changetype<usize>(buffer), 0, bufferSize);
this.buffer = buffer; // links
Expand Down
2 changes: 1 addition & 1 deletion tests/compiler/class.untouched.wat
Original file line number Diff line number Diff line change
Expand Up @@ -2734,7 +2734,7 @@
local.tee $3
local.get $2
local.get $3
i32.gt_s
i32.gt_u
select
i32.const 2
i32.shl
Expand Down
2 changes: 1 addition & 1 deletion tests/compiler/issues/1699.untouched.wat
Original file line number Diff line number Diff line change
Expand Up @@ -4204,7 +4204,7 @@
local.tee $3
local.get $2
local.get $3
i32.gt_s
i32.gt_u
select
i32.const 2
i32.shl
Expand Down
2 changes: 1 addition & 1 deletion tests/compiler/std-wasi/process.optimized.wat
Original file line number Diff line number Diff line change
Expand Up @@ -4739,7 +4739,7 @@
i32.const 8
local.get $0
i32.const 8
i32.gt_s
i32.gt_u
select
i32.const 2
i32.shl
Expand Down
2 changes: 1 addition & 1 deletion tests/compiler/std-wasi/process.untouched.wat
Original file line number Diff line number Diff line change
Expand Up @@ -7723,7 +7723,7 @@
local.tee $3
local.get $2
local.get $3
i32.gt_s
i32.gt_u
select
i32.const 2
i32.shl
Expand Down
8 changes: 4 additions & 4 deletions tests/compiler/std/array.optimized.wat
Original file line number Diff line number Diff line change
Expand Up @@ -8559,7 +8559,7 @@
i32.const 8
local.get $1
i32.const 8
i32.gt_s
i32.gt_u
select
i32.const 2
i32.shl
Expand Down Expand Up @@ -8676,7 +8676,7 @@
i32.const 8
local.get $1
i32.const 8
i32.gt_s
i32.gt_u
select
local.tee $3
i32.const 0
Expand Down Expand Up @@ -18608,7 +18608,7 @@
i32.const 8
local.get $0
i32.const 8
i32.gt_s
i32.gt_u
select
i32.const 2
i32.shl
Expand Down Expand Up @@ -19666,7 +19666,7 @@
i32.const 8
local.get $1
i32.const 8
i32.gt_s
i32.gt_u
select
i32.const 2
i32.shl
Expand Down
12 changes: 6 additions & 6 deletions tests/compiler/std/array.untouched.wat
Original file line number Diff line number Diff line change
Expand Up @@ -27862,7 +27862,7 @@
local.tee $3
local.get $2
local.get $3
i32.gt_s
i32.gt_u
select
i32.const 2
i32.shl
Expand Down Expand Up @@ -29378,7 +29378,7 @@
local.tee $3
local.get $2
local.get $3
i32.gt_s
i32.gt_u
select
i32.const 2
i32.shl
Expand Down Expand Up @@ -29680,7 +29680,7 @@
local.tee $3
local.get $2
local.get $3
i32.gt_s
i32.gt_u
select
i32.const 2
i32.shl
Expand Down Expand Up @@ -30091,7 +30091,7 @@
local.tee $3
local.get $2
local.get $3
i32.gt_s
i32.gt_u
select
i32.const 2
i32.shl
Expand Down Expand Up @@ -33443,7 +33443,7 @@
local.tee $3
local.get $2
local.get $3
i32.gt_s
i32.gt_u
select
i32.const 2
i32.shl
Expand Down Expand Up @@ -33968,7 +33968,7 @@
local.tee $3
local.get $2
local.get $3
i32.gt_s
i32.gt_u
select
i32.const 0
i32.shl
Expand Down
20 changes: 10 additions & 10 deletions tests/compiler/std/map.optimized.wat
Original file line number Diff line number Diff line change
Expand Up @@ -3144,7 +3144,7 @@
i32.const 8
local.get $4
i32.const 8
i32.gt_s
i32.gt_u
select
local.tee $7
i32.const 0
Expand Down Expand Up @@ -4175,7 +4175,7 @@
i32.const 8
local.get $4
i32.const 8
i32.gt_s
i32.gt_u
select
local.tee $7
i32.const 0
Expand Down Expand Up @@ -5306,7 +5306,7 @@
i32.const 8
local.get $4
i32.const 8
i32.gt_s
i32.gt_u
select
i32.const 1
i32.shl
Expand Down Expand Up @@ -6341,7 +6341,7 @@
i32.const 8
local.get $4
i32.const 8
i32.gt_s
i32.gt_u
select
i32.const 1
i32.shl
Expand Down Expand Up @@ -7941,7 +7941,7 @@
i32.const 8
local.get $4
i32.const 8
i32.gt_s
i32.gt_u
select
i32.const 2
i32.shl
Expand Down Expand Up @@ -9078,7 +9078,7 @@
i32.const 8
local.get $4
i32.const 8
i32.gt_s
i32.gt_u
select
i32.const 3
i32.shl
Expand Down Expand Up @@ -10104,7 +10104,7 @@
i32.const 8
local.get $4
i32.const 8
i32.gt_s
i32.gt_u
select
i32.const 3
i32.shl
Expand Down Expand Up @@ -11162,7 +11162,7 @@
i32.const 8
local.get $5
i32.const 8
i32.gt_s
i32.gt_u
select
i32.const 2
i32.shl
Expand Down Expand Up @@ -12268,7 +12268,7 @@
i32.const 8
local.get $5
i32.const 8
i32.gt_s
i32.gt_u
select
i32.const 3
i32.shl
Expand Down Expand Up @@ -12979,7 +12979,7 @@
i32.const 8
local.get $0
i32.const 8
i32.gt_s
i32.gt_u
select
i32.const 2
i32.shl
Expand Down
20 changes: 10 additions & 10 deletions tests/compiler/std/map.untouched.wat
Original file line number Diff line number Diff line change
Expand Up @@ -17785,7 +17785,7 @@
local.tee $3
local.get $2
local.get $3
i32.gt_s
i32.gt_u
select
i32.const 0
i32.shl
Expand Down Expand Up @@ -17957,7 +17957,7 @@
local.tee $3
local.get $2
local.get $3
i32.gt_s
i32.gt_u
select
i32.const 2
i32.shl
Expand Down Expand Up @@ -18654,7 +18654,7 @@
local.tee $3
local.get $2
local.get $3
i32.gt_s
i32.gt_u
select
i32.const 0
i32.shl
Expand Down Expand Up @@ -19258,7 +19258,7 @@
local.tee $3
local.get $2
local.get $3
i32.gt_s
i32.gt_u
select
i32.const 1
i32.shl
Expand Down Expand Up @@ -19862,7 +19862,7 @@
local.tee $3
local.get $2
local.get $3
i32.gt_s
i32.gt_u
select
i32.const 1
i32.shl
Expand Down Expand Up @@ -20630,7 +20630,7 @@
local.tee $3
local.get $2
local.get $3
i32.gt_s
i32.gt_u
select
i32.const 2
i32.shl
Expand Down Expand Up @@ -21234,7 +21234,7 @@
local.tee $3
local.get $2
local.get $3
i32.gt_s
i32.gt_u
select
i32.const 3
i32.shl
Expand Down Expand Up @@ -21838,7 +21838,7 @@
local.tee $3
local.get $2
local.get $3
i32.gt_s
i32.gt_u
select
i32.const 3
i32.shl
Expand Down Expand Up @@ -22442,7 +22442,7 @@
local.tee $3
local.get $2
local.get $3
i32.gt_s
i32.gt_u
select
i32.const 2
i32.shl
Expand Down Expand Up @@ -23046,7 +23046,7 @@
local.tee $3
local.get $2
local.get $3
i32.gt_s
i32.gt_u
select
i32.const 3
i32.shl
Expand Down
Loading