mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-04-26 07:22:21 +00:00
Also lint stdlib
This commit is contained in:
parent
ae05006d21
commit
9ef8b162a9
18
.travis.yml
18
.travis.yml
@ -5,22 +5,18 @@ jobs:
|
|||||||
- stage: lint
|
- stage: lint
|
||||||
node_js: node
|
node_js: node
|
||||||
script: npm run lint
|
script: npm run lint
|
||||||
env: DESC="Checks the sources with TSLint"
|
env: Checks the sources with TSLint
|
||||||
|
|
||||||
- stage: test
|
- stage: test
|
||||||
node_js: lts/*
|
node_js: lts/*
|
||||||
script: npm run clean && node bin/asc -v && npm test
|
script: npm run clean && node bin/asc -v && npm test
|
||||||
env: DESC="Tests the sources on latest node.js LTS"
|
env: Tests the sources on latest node.js LTS
|
||||||
- stage: test
|
- node_js: node
|
||||||
node_js: node
|
env: Tests the sources on latest stable node.js
|
||||||
script: npm run clean && node bin/asc -v && npm test
|
|
||||||
env: DESC="Tests the sources on latest stable node.js"
|
|
||||||
|
|
||||||
- stage: build
|
- stage: build
|
||||||
node_js: lts/*
|
node_js: lts/*
|
||||||
script: npm run build && node bin/asc -v && npm test
|
script: npm run build && node bin/asc -v && npm test
|
||||||
env: DESC="Builds and tests the bundle on latest node.js LTS"
|
env: Builds and tests the bundle on latest node.js LTS
|
||||||
- stage: build
|
- node_js: node
|
||||||
node_js: node
|
env: Builds and tests the bundle on latest stable node.js
|
||||||
script: npm run build && node bin/asc -v && npm test
|
|
||||||
env: DESC="Builds and tests the bundle on latest stable node.js"
|
|
||||||
|
2
dist/asc.js
vendored
2
dist/asc.js
vendored
File diff suppressed because one or more lines are too long
2
dist/assemblyscript.js.map
vendored
2
dist/assemblyscript.js.map
vendored
File diff suppressed because one or more lines are too long
11
package.json
11
package.json
@ -40,13 +40,14 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "webpack",
|
"build": "webpack",
|
||||||
"clean": "node scripts/clean",
|
"clean": "node scripts/clean",
|
||||||
"lint": "tslint -c tslint.json --project src --formatters-dir lib/tslint --format as",
|
"lint": "npm run lint:compiler && npm run lint:library",
|
||||||
"test:config": "npm run test:config:portable --scripts-prepend-node-path && npm run test:config:src --scripts-prepend-node-path",
|
"lint:compiler": "tslint -c tslint.json --project src --formatters-dir lib/tslint --format as",
|
||||||
"test:config:portable": "tsc --noEmit -p std/portable --diagnostics --listFiles",
|
"lint:library": "tslint -c tslint.json --project std/assembly --formatters-dir lib/tslint --format as",
|
||||||
"test:config:src": "tsc --noEmit -p src --diagnostics --listFiles",
|
"test:config": "tsc --noEmit -p src --diagnostics --listFiles",
|
||||||
"test:parser": "node tests/parser",
|
"test:parser": "node tests/parser",
|
||||||
"test:compiler": "node tests/compiler",
|
"test:compiler": "node tests/compiler",
|
||||||
"test": "npm run test:config --scripts-prepend-node-path && npm run test:parser --scripts-prepend-node-path && npm run test:compiler --scripts-prepend-node-path"
|
"test": "npm run test:config --scripts-prepend-node-path && npm run test:parser --scripts-prepend-node-path && npm run test:compiler --scripts-prepend-node-path",
|
||||||
|
"all": "npm run lint && npm run clean && npm test && npm run build && npm test"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"bin/",
|
"bin/",
|
||||||
|
6
std/assembly.d.ts
vendored
6
std/assembly.d.ts
vendored
@ -155,7 +155,7 @@ declare function sqrt<T = f32 | f64>(value: T): T;
|
|||||||
/** Rounds to the nearest integer towards zero of a 32-bit or 64-bit float. */
|
/** Rounds to the nearest integer towards zero of a 32-bit or 64-bit float. */
|
||||||
declare function trunc<T = f32 | f64>(value: T): T;
|
declare function trunc<T = f32 | f64>(value: T): T;
|
||||||
/** Loads a value of the specified type from memory. Equivalent to dereferncing a pointer in other languages. */
|
/** Loads a value of the specified type from memory. Equivalent to dereferncing a pointer in other languages. */
|
||||||
declare function load<T>(ptr: usize, constantOffset?: usize): any;
|
declare function load<T>(ptr: usize, constantOffset?: usize): T;
|
||||||
/** Stores a value of the specified type to memory. Equivalent to dereferencing a pointer in other languages when assigning a value. */
|
/** Stores a value of the specified type to memory. Equivalent to dereferencing a pointer in other languages when assigning a value. */
|
||||||
declare function store<T>(ptr: usize, value: any, constantOffset?: usize): void;
|
declare function store<T>(ptr: usize, value: any, constantOffset?: usize): void;
|
||||||
/** Returns the current memory size in units of pages. One page is 64kb. */
|
/** Returns the current memory size in units of pages. One page is 64kb. */
|
||||||
@ -292,10 +292,10 @@ declare class Set<T> {
|
|||||||
// Internal decorators
|
// Internal decorators
|
||||||
|
|
||||||
/** Annotates an element as a program global. */
|
/** Annotates an element as a program global. */
|
||||||
declare function global(target: Function): any;
|
declare function global(target: Function, propertyKey: string, descriptor: any): void;
|
||||||
|
|
||||||
/** Annotates a method as an operator overload. */
|
/** Annotates a method as an operator overload. */
|
||||||
declare function operator(token: string): any;
|
declare function operator(token: string): (target: any, propertyKey: string, descriptor: any) => void;
|
||||||
|
|
||||||
/** Annotates a class as being unmanaged with limited capabilities. */
|
/** Annotates a class as being unmanaged with limited capabilities. */
|
||||||
declare function unmanaged(target: Function): any;
|
declare function unmanaged(target: Function): any;
|
||||||
|
@ -17,7 +17,6 @@ const SL_SIZE: usize = 1 << <usize>SL_BITS;
|
|||||||
|
|
||||||
const SB_BITS: usize = <usize>(SL_BITS + AL_BITS);
|
const SB_BITS: usize = <usize>(SL_BITS + AL_BITS);
|
||||||
const SB_SIZE: usize = 1 << <usize>SB_BITS;
|
const SB_SIZE: usize = 1 << <usize>SB_BITS;
|
||||||
const SB_MASK: usize = SB_SIZE - 1;
|
|
||||||
|
|
||||||
const FL_BITS: u32 = (sizeof<usize>() == sizeof<u32>()
|
const FL_BITS: u32 = (sizeof<usize>() == sizeof<u32>()
|
||||||
? 30 // ^= up to 1GB per block
|
? 30 // ^= up to 1GB per block
|
||||||
@ -267,10 +266,8 @@ class Root {
|
|||||||
// link previous and next free block
|
// link previous and next free block
|
||||||
var prev = block.prev;
|
var prev = block.prev;
|
||||||
var next = block.next;
|
var next = block.next;
|
||||||
if (prev)
|
if (prev) prev.next = next;
|
||||||
prev.next = next;
|
if (next) next.prev = prev;
|
||||||
if (next)
|
|
||||||
next.prev = prev;
|
|
||||||
|
|
||||||
// update head if we are removing it
|
// update head if we are removing it
|
||||||
if (block == this.getHead(fl, sl)) {
|
if (block == this.getHead(fl, sl)) {
|
||||||
@ -282,8 +279,7 @@ class Root {
|
|||||||
this.setSLMap(fl, slMap &= ~(1 << sl));
|
this.setSLMap(fl, slMap &= ~(1 << sl));
|
||||||
|
|
||||||
// clear first level map if second level is empty now
|
// clear first level map if second level is empty now
|
||||||
if (!slMap)
|
if (!slMap) this.flMap &= ~(1 << fl);
|
||||||
this.flMap &= ~(1 << fl);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -320,9 +316,9 @@ class Root {
|
|||||||
slMap = assert(this.getSLMap(fl)); // can't be zero if fl points here
|
slMap = assert(this.getSLMap(fl)); // can't be zero if fl points here
|
||||||
head = this.getHead(fl, ffs<u32>(slMap));
|
head = this.getHead(fl, ffs<u32>(slMap));
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
head = this.getHead(fl, ffs<u32>(slMap));
|
head = this.getHead(fl, ffs<u32>(slMap));
|
||||||
|
}
|
||||||
return head;
|
return head;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -386,13 +382,15 @@ class Root {
|
|||||||
tailInfo = changetype<Block>(tailRef).info;
|
tailInfo = changetype<Block>(tailRef).info;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else
|
} else {
|
||||||
assert(start >= changetype<usize>(this) + Root.SIZE); // starts after root
|
assert(start >= changetype<usize>(this) + Root.SIZE); // starts after root
|
||||||
|
}
|
||||||
|
|
||||||
// check if size is large enough for a free block and the tail block
|
// check if size is large enough for a free block and the tail block
|
||||||
var size = end - start;
|
var size = end - start;
|
||||||
if (size < Block.INFO + Block.MIN_SIZE + Block.INFO)
|
if (size < Block.INFO + Block.MIN_SIZE + Block.INFO) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// left size is total minus its own and the zero-length tail's header
|
// left size is total minus its own and the zero-length tail's header
|
||||||
var leftSize = size - 2 * Block.INFO;
|
var leftSize = size - 2 * Block.INFO;
|
||||||
@ -443,9 +441,10 @@ export function allocate_memory(size: usize): usize {
|
|||||||
root.flMap = 0;
|
root.flMap = 0;
|
||||||
for (var fl: usize = 0; fl < FL_BITS; ++fl) {
|
for (var fl: usize = 0; fl < FL_BITS; ++fl) {
|
||||||
root.setSLMap(fl, 0);
|
root.setSLMap(fl, 0);
|
||||||
for (var sl: u32 = 0; sl < SL_SIZE; ++sl)
|
for (var sl: u32 = 0; sl < SL_SIZE; ++sl) {
|
||||||
root.setHead(fl, sl, null);
|
root.setHead(fl, sl, null);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
root.addMemory(rootOffset + Root.SIZE, current_memory() << 16);
|
root.addMemory(rootOffset + Root.SIZE, current_memory() << 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -461,9 +460,11 @@ export function allocate_memory(size: usize): usize {
|
|||||||
var pagesBefore = current_memory();
|
var pagesBefore = current_memory();
|
||||||
var pagesNeeded = ((size + 0xffff) & ~0xffff) >>> 16;
|
var pagesNeeded = ((size + 0xffff) & ~0xffff) >>> 16;
|
||||||
var pagesWanted = max(pagesBefore, pagesNeeded); // double memory
|
var pagesWanted = max(pagesBefore, pagesNeeded); // double memory
|
||||||
if (grow_memory(pagesWanted) < 0)
|
if (grow_memory(pagesWanted) < 0) {
|
||||||
if (grow_memory(pagesNeeded) < 0)
|
if (grow_memory(pagesNeeded) < 0) {
|
||||||
unreachable(); // out of memory
|
unreachable(); // out of memory
|
||||||
|
}
|
||||||
|
}
|
||||||
var pagesAfter = current_memory();
|
var pagesAfter = current_memory();
|
||||||
root.addMemory(<usize>pagesBefore << 16, <usize>pagesAfter << 16);
|
root.addMemory(<usize>pagesBefore << 16, <usize>pagesAfter << 16);
|
||||||
block = assert(root.search(size)); // must be found now
|
block = assert(root.search(size)); // must be found now
|
||||||
|
@ -16,9 +16,12 @@ export class Array<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
constructor(capacity: i32 = 0) {
|
constructor(capacity: i32 = 0) {
|
||||||
if (capacity < 0)
|
if (capacity < 0) {
|
||||||
throw new RangeError("Invalid array length");
|
throw new RangeError("Invalid array length");
|
||||||
this.__memory = capacity ? allocate_memory(<usize>capacity * sizeof<T>()) : 0;
|
}
|
||||||
|
this.__memory = capacity
|
||||||
|
? allocate_memory(<usize>capacity * sizeof<T>())
|
||||||
|
: 0;
|
||||||
this.__capacity = this.__length = capacity;
|
this.__capacity = this.__length = capacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27,72 +30,92 @@ export class Array<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set length(length: i32) {
|
set length(length: i32) {
|
||||||
if (length < 0)
|
if (length < 0) {
|
||||||
throw new RangeError("Invalid array length");
|
throw new RangeError("Invalid array length");
|
||||||
if (length > this.__capacity)
|
}
|
||||||
|
if (length > this.__capacity) {
|
||||||
this.__grow(max(length, this.__capacity << 1));
|
this.__grow(max(length, this.__capacity << 1));
|
||||||
|
}
|
||||||
this.__length = length;
|
this.__length = length;
|
||||||
}
|
}
|
||||||
|
|
||||||
@operator("[]")
|
@operator("[]")
|
||||||
private __get(index: i32): T {
|
private __get(index: i32): T {
|
||||||
if (<u32>index >= this.__capacity)
|
if (<u32>index >= this.__capacity) {
|
||||||
throw new Error("Index out of bounds"); // return changetype<T>(0) ?
|
throw new Error("Index out of bounds"); // return changetype<T>(0) ?
|
||||||
|
}
|
||||||
return load<T>(this.__memory + <usize>index * sizeof<T>());
|
return load<T>(this.__memory + <usize>index * sizeof<T>());
|
||||||
}
|
}
|
||||||
|
|
||||||
@operator("[]=")
|
@operator("[]=")
|
||||||
private __set(index: i32, value: T): void {
|
private __set(index: i32, value: T): void {
|
||||||
if (index < 0)
|
if (index < 0) {
|
||||||
throw new Error("Index out of bounds");
|
throw new Error("Index out of bounds");
|
||||||
if (index >= this.__capacity)
|
}
|
||||||
|
if (index >= this.__capacity) {
|
||||||
this.__grow(max(index + 1, this.__capacity << 1));
|
this.__grow(max(index + 1, this.__capacity << 1));
|
||||||
|
}
|
||||||
store<T>(this.__memory + <usize>index * sizeof<T>(), value);
|
store<T>(this.__memory + <usize>index * sizeof<T>(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
indexOf(searchElement: T, fromIndex: i32 = 0): i32 {
|
indexOf(searchElement: T, fromIndex: i32 = 0): i32 {
|
||||||
if (fromIndex < 0)
|
if (fromIndex < 0) {
|
||||||
fromIndex = this.__length + fromIndex;
|
fromIndex = this.__length + fromIndex;
|
||||||
|
}
|
||||||
while (<u32>fromIndex < this.__length) {
|
while (<u32>fromIndex < this.__length) {
|
||||||
if (load<T>(this.__memory + fromIndex * sizeof<T>()) == searchElement)
|
if (load<T>(this.__memory + fromIndex * sizeof<T>()) == searchElement) {
|
||||||
return fromIndex;
|
return fromIndex;
|
||||||
|
}
|
||||||
++fromIndex;
|
++fromIndex;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
lastIndexOf(searchElement: T, fromIndex: i32 = 0): i32 {
|
lastIndexOf(searchElement: T, fromIndex: i32 = 0): i32 {
|
||||||
if (fromIndex < 0)
|
if (fromIndex < 0) {
|
||||||
fromIndex = this.__length + fromIndex;
|
fromIndex = this.__length + fromIndex;
|
||||||
else if (fromIndex >= this.__length)
|
} else if (fromIndex >= this.__length) {
|
||||||
fromIndex = this.__length - 1;
|
fromIndex = this.__length - 1;
|
||||||
|
}
|
||||||
while (fromIndex >= 0) {
|
while (fromIndex >= 0) {
|
||||||
if (load<T>(this.__memory + fromIndex * sizeof<T>()) == searchElement)
|
if (load<T>(this.__memory + fromIndex * sizeof<T>()) == searchElement) {
|
||||||
return fromIndex;
|
return fromIndex;
|
||||||
|
}
|
||||||
--fromIndex;
|
--fromIndex;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
push(element: T): i32 {
|
push(element: T): i32 {
|
||||||
if (this.__length == this.__capacity)
|
if (this.__length == this.__capacity) {
|
||||||
this.__grow(this.__capacity ? this.__capacity << 1 : 1);
|
this.__grow(this.__capacity ? this.__capacity << 1 : 1);
|
||||||
|
}
|
||||||
store<T>(this.__memory + this.__length * sizeof<T>(), element);
|
store<T>(this.__memory + this.__length * sizeof<T>(), element);
|
||||||
return ++this.__length;
|
return ++this.__length;
|
||||||
}
|
}
|
||||||
|
|
||||||
pop(): T {
|
pop(): T {
|
||||||
if (this.__length < 1)
|
if (this.__length < 1) {
|
||||||
throw new RangeError("Array is empty"); // return changetype<T>(0) ?
|
throw new RangeError("Array is empty"); // return changetype<T>(0) ?
|
||||||
|
}
|
||||||
return load<T>(this.__memory + --this.__length * sizeof<T>());
|
return load<T>(this.__memory + --this.__length * sizeof<T>());
|
||||||
}
|
}
|
||||||
|
|
||||||
shift(): T {
|
shift(): T {
|
||||||
if (this.__length < 1)
|
if (this.__length < 1) {
|
||||||
throw new RangeError("Array is empty"); // return changetype<T>(0) ?
|
throw new RangeError("Array is empty"); // return changetype<T>(0) ?
|
||||||
|
}
|
||||||
var element = load<T>(this.__memory);
|
var element = load<T>(this.__memory);
|
||||||
move_memory(this.__memory, this.__memory + sizeof<T>(), (this.__capacity - 1) * sizeof<T>());
|
move_memory(
|
||||||
set_memory(this.__memory + (this.__capacity - 1) * sizeof<T>(), 0, sizeof<T>());
|
this.__memory,
|
||||||
|
this.__memory + sizeof<T>(),
|
||||||
|
(this.__capacity - 1) * sizeof<T>()
|
||||||
|
);
|
||||||
|
set_memory(
|
||||||
|
this.__memory + (this.__capacity - 1) * sizeof<T>(),
|
||||||
|
0,
|
||||||
|
sizeof<T>()
|
||||||
|
);
|
||||||
--this.__length;
|
--this.__length;
|
||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
@ -105,13 +128,22 @@ export class Array<T> {
|
|||||||
assert(newCapacity > this.__capacity);
|
assert(newCapacity > this.__capacity);
|
||||||
var newMemory = allocate_memory(<usize>newCapacity * sizeof<T>());
|
var newMemory = allocate_memory(<usize>newCapacity * sizeof<T>());
|
||||||
if (this.__memory) {
|
if (this.__memory) {
|
||||||
move_memory(newMemory + sizeof<T>(), this.__memory, oldCapacity * sizeof<T>());
|
move_memory(
|
||||||
|
newMemory + sizeof<T>(),
|
||||||
|
this.__memory,
|
||||||
|
oldCapacity * sizeof<T>()
|
||||||
|
);
|
||||||
free_memory(this.__memory);
|
free_memory(this.__memory);
|
||||||
}
|
}
|
||||||
this.__memory = newMemory;
|
this.__memory = newMemory;
|
||||||
this.__capacity = newCapacity;
|
this.__capacity = newCapacity;
|
||||||
} else
|
} else {
|
||||||
move_memory(this.__memory + sizeof<T>(), this.__memory, oldCapacity * sizeof<T>());
|
move_memory(
|
||||||
|
this.__memory + sizeof<T>(),
|
||||||
|
this.__memory,
|
||||||
|
oldCapacity * sizeof<T>()
|
||||||
|
);
|
||||||
|
}
|
||||||
store<T>(this.__memory, element);
|
store<T>(this.__memory, element);
|
||||||
return ++this.__length;
|
return ++this.__length;
|
||||||
}
|
}
|
||||||
@ -119,37 +151,53 @@ export class Array<T> {
|
|||||||
slice(begin: i32 = 0, end: i32 = i32.MAX_VALUE): Array<T> {
|
slice(begin: i32 = 0, end: i32 = i32.MAX_VALUE): Array<T> {
|
||||||
if (begin < 0) {
|
if (begin < 0) {
|
||||||
begin = this.__length + begin;
|
begin = this.__length + begin;
|
||||||
if (begin < 0)
|
if (begin < 0) {
|
||||||
begin = 0;
|
begin = 0;
|
||||||
} else if (begin > this.__length)
|
}
|
||||||
|
} else if (begin > this.__length) {
|
||||||
begin = this.__length;
|
begin = this.__length;
|
||||||
if (end < 0)
|
}
|
||||||
|
if (end < 0) {
|
||||||
end = this.__length + end;
|
end = this.__length + end;
|
||||||
else if (end > this.__length)
|
} else if (end > this.__length) {
|
||||||
end = this.__length;
|
end = this.__length;
|
||||||
if (end < begin)
|
}
|
||||||
|
if (end < begin) {
|
||||||
end = begin;
|
end = begin;
|
||||||
|
}
|
||||||
var capacity = end - begin;
|
var capacity = end - begin;
|
||||||
assert(capacity >= 0);
|
assert(capacity >= 0);
|
||||||
var sliced = new Array<T>(capacity);
|
var sliced = new Array<T>(capacity);
|
||||||
if (capacity)
|
if (capacity) {
|
||||||
move_memory(sliced.__memory, this.__memory + <usize>begin * sizeof<T>(), <usize>capacity * sizeof<T>());
|
move_memory(
|
||||||
|
sliced.__memory,
|
||||||
|
this.__memory + <usize>begin * sizeof<T>(),
|
||||||
|
<usize>capacity * sizeof<T>()
|
||||||
|
);
|
||||||
|
}
|
||||||
return sliced;
|
return sliced;
|
||||||
}
|
}
|
||||||
|
|
||||||
splice(start: i32, deleteCount: i32 = i32.MAX_VALUE): void {
|
splice(start: i32, deleteCount: i32 = i32.MAX_VALUE): void {
|
||||||
if (deleteCount < 1)
|
if (deleteCount < 1) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
if (start < 0) {
|
if (start < 0) {
|
||||||
start = this.__length + start;
|
start = this.__length + start;
|
||||||
if (start < 0)
|
if (start < 0) {
|
||||||
start = 0;
|
start = 0;
|
||||||
else if (start >= this.__length)
|
} else if (start >= this.__length) {
|
||||||
return;
|
return;
|
||||||
} else if (start >= this.__length)
|
}
|
||||||
|
} else if (start >= this.__length) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
deleteCount = min(deleteCount, this.__length - start);
|
deleteCount = min(deleteCount, this.__length - start);
|
||||||
move_memory(this.__memory + <usize>start * sizeof<T>(), this.__memory + <usize>(start + deleteCount) * sizeof<T>(), deleteCount * sizeof<T>());
|
move_memory(
|
||||||
|
this.__memory + <usize>start * sizeof<T>(),
|
||||||
|
this.__memory + <usize>(start + deleteCount) * sizeof<T>(),
|
||||||
|
deleteCount * sizeof<T>()
|
||||||
|
);
|
||||||
this.__length -= deleteCount;
|
this.__length -= deleteCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,15 +218,17 @@ export class CArray<T> {
|
|||||||
|
|
||||||
@operator("[]")
|
@operator("[]")
|
||||||
private __get(index: i32): T {
|
private __get(index: i32): T {
|
||||||
if (index < 0)
|
if (index < 0) {
|
||||||
throw new RangeError("Index out of range");
|
throw new RangeError("Index out of range");
|
||||||
|
}
|
||||||
return load<T>(changetype<usize>(this) + <usize>index * sizeof<T>());
|
return load<T>(changetype<usize>(this) + <usize>index * sizeof<T>());
|
||||||
}
|
}
|
||||||
|
|
||||||
@operator("[]=")
|
@operator("[]=")
|
||||||
private __set(index: i32, value: T): void {
|
private __set(index: i32, value: T): void {
|
||||||
if (index < 0)
|
if (index < 0) {
|
||||||
throw new RangeError("Index out of range");
|
throw new RangeError("Index out of range");
|
||||||
|
}
|
||||||
store<T>(changetype<usize>(this) + <usize>index * sizeof<T>(), value);
|
store<T>(changetype<usize>(this) + <usize>index * sizeof<T>(), value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,12 @@ export declare function changetype<T>(value: void): T;
|
|||||||
export declare function assert<T>(isTrueish: T, message?: string): T;
|
export declare function assert<T>(isTrueish: T, message?: string): T;
|
||||||
|
|
||||||
@builtin
|
@builtin
|
||||||
export declare function abort(message?: string | null, fileName?: string | null, lineNumber?: u32, columnNumber?: u32): void;
|
export declare function abort(
|
||||||
|
message?: string | null,
|
||||||
|
fileName?: string | null,
|
||||||
|
lineNumber?: u32,
|
||||||
|
columnNumber?: u32
|
||||||
|
): void;
|
||||||
|
|
||||||
@builtin
|
@builtin
|
||||||
declare function i8(value: void): i8;
|
declare function i8(value: void): i8;
|
||||||
@ -126,8 +131,12 @@ export { i64 };
|
|||||||
@builtin
|
@builtin
|
||||||
declare function isize(value: void): isize;
|
declare function isize(value: void): isize;
|
||||||
namespace isize {
|
namespace isize {
|
||||||
export const MIN_VALUE: isize = sizeof<i32>() == sizeof<isize>() ? -2147483648 : <usize>-9223372036854775808;
|
export const MIN_VALUE: isize = sizeof<i32>() == sizeof<isize>()
|
||||||
export const MAX_VALUE: isize = sizeof<i32>() == sizeof<isize>() ? 2147483647 : <usize>9223372036854775807;
|
? -2147483648
|
||||||
|
: <usize>-9223372036854775808;
|
||||||
|
export const MAX_VALUE: isize = sizeof<i32>() == sizeof<isize>()
|
||||||
|
? 2147483647
|
||||||
|
: <usize>9223372036854775807;
|
||||||
}
|
}
|
||||||
export { isize };
|
export { isize };
|
||||||
|
|
||||||
@ -167,7 +176,9 @@ export { u64 };
|
|||||||
declare function usize(value: void): usize;
|
declare function usize(value: void): usize;
|
||||||
namespace usize {
|
namespace usize {
|
||||||
export const MIN_VALUE: usize = 0;
|
export const MIN_VALUE: usize = 0;
|
||||||
export const MAX_VALUE: usize = sizeof<u32>() == sizeof<usize>() ? 4294967295 : <usize>18446744073709551615;
|
export const MAX_VALUE: usize = sizeof<u32>() == sizeof<usize>()
|
||||||
|
? 4294967295
|
||||||
|
: <usize>18446744073709551615;
|
||||||
}
|
}
|
||||||
export { usize };
|
export { usize };
|
||||||
|
|
||||||
|
@ -11,17 +11,21 @@ export class Map<K,V> {
|
|||||||
|
|
||||||
get(key: K): V | null {
|
get(key: K): V | null {
|
||||||
var keys = this.__keys;
|
var keys = this.__keys;
|
||||||
for (var i = 0, k = keys.length; i < k; ++i)
|
for (var i = 0, k = keys.length; i < k; ++i) {
|
||||||
if (keys[i] == key)
|
if (keys[i] == key) {
|
||||||
return this.__values[i];
|
return this.__values[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
has(key: K): bool {
|
has(key: K): bool {
|
||||||
var keys = this.__keys;
|
var keys = this.__keys;
|
||||||
for (var i = 0, k = keys.length; i < k; ++i)
|
for (var i = 0, k = keys.length; i < k; ++i) {
|
||||||
if (keys[i] == key)
|
if (keys[i] == key) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,8 +145,7 @@ export function move_memory(dest: usize, src: usize, n: usize): void {
|
|||||||
// based on musl's implementation of memmove
|
// based on musl's implementation of memmove
|
||||||
// becomes obsolete once https://github.com/WebAssembly/bulk-memory-operations lands
|
// becomes obsolete once https://github.com/WebAssembly/bulk-memory-operations lands
|
||||||
|
|
||||||
if (dest == src)
|
if (dest == src) return;
|
||||||
return;
|
|
||||||
if (src + n <= dest || dest + n <= src) {
|
if (src + n <= dest || dest + n <= src) {
|
||||||
copy_memory(dest, src, n);
|
copy_memory(dest, src, n);
|
||||||
return;
|
return;
|
||||||
@ -154,8 +153,7 @@ export function move_memory(dest: usize, src: usize, n: usize): void {
|
|||||||
if (dest < src) {
|
if (dest < src) {
|
||||||
if ((src & 7) == (dest & 7)) {
|
if ((src & 7) == (dest & 7)) {
|
||||||
while (dest & 7) {
|
while (dest & 7) {
|
||||||
if (!n)
|
if (!n) return;
|
||||||
return;
|
|
||||||
--n;
|
--n;
|
||||||
store<u8>(dest++, load<u8>(src++));
|
store<u8>(dest++, load<u8>(src++));
|
||||||
}
|
}
|
||||||
@ -173,8 +171,7 @@ export function move_memory(dest: usize, src: usize, n: usize): void {
|
|||||||
} else {
|
} else {
|
||||||
if ((src & 7) == (dest & 7)) {
|
if ((src & 7) == (dest & 7)) {
|
||||||
while ((dest + n) & 7) {
|
while ((dest + n) & 7) {
|
||||||
if (!n)
|
if (!n) return;
|
||||||
return;
|
|
||||||
store<u8>(dest + --n, load<u8>(src + n));
|
store<u8>(dest + --n, load<u8>(src + n));
|
||||||
}
|
}
|
||||||
while (n >= 8) {
|
while (n >= 8) {
|
||||||
@ -193,23 +190,19 @@ export function set_memory(dest: usize, c: u8, n: usize): void {
|
|||||||
// becomes obsolete once https://github.com/WebAssembly/bulk-memory-operations lands
|
// becomes obsolete once https://github.com/WebAssembly/bulk-memory-operations lands
|
||||||
|
|
||||||
// fill head and tail with minimal branching
|
// fill head and tail with minimal branching
|
||||||
if (!n)
|
if (!n) return;
|
||||||
return;
|
|
||||||
store<u8>(dest, c);
|
store<u8>(dest, c);
|
||||||
store<u8>(dest + n - 1, c);
|
store<u8>(dest + n - 1, c);
|
||||||
if (n <= 2)
|
if (n <= 2) return;
|
||||||
return;
|
|
||||||
|
|
||||||
store<u8>(dest + 1, c);
|
store<u8>(dest + 1, c);
|
||||||
store<u8>(dest + 2, c);
|
store<u8>(dest + 2, c);
|
||||||
store<u8>(dest + n - 2, c);
|
store<u8>(dest + n - 2, c);
|
||||||
store<u8>(dest + n - 3, c);
|
store<u8>(dest + n - 3, c);
|
||||||
if (n <= 6)
|
if (n <= 6) return;
|
||||||
return;
|
|
||||||
store<u8>(dest + 3, c);
|
store<u8>(dest + 3, c);
|
||||||
store<u8>(dest + n - 4, c);
|
store<u8>(dest + n - 4, c);
|
||||||
if (n <= 8)
|
if (n <= 8) return;
|
||||||
return;
|
|
||||||
|
|
||||||
// advance pointer to align it at 4-byte boundary
|
// advance pointer to align it at 4-byte boundary
|
||||||
var k: usize = -dest & 3;
|
var k: usize = -dest & 3;
|
||||||
@ -222,14 +215,12 @@ export function set_memory(dest: usize, c: u8, n: usize): void {
|
|||||||
// fill head/tail up to 28 bytes each in preparation
|
// fill head/tail up to 28 bytes each in preparation
|
||||||
store<u32>(dest, c32);
|
store<u32>(dest, c32);
|
||||||
store<u32>(dest + n - 4, c32);
|
store<u32>(dest + n - 4, c32);
|
||||||
if (n <= 8)
|
if (n <= 8) return;
|
||||||
return;
|
|
||||||
store<u32>(dest + 4, c32);
|
store<u32>(dest + 4, c32);
|
||||||
store<u32>(dest + 8, c32);
|
store<u32>(dest + 8, c32);
|
||||||
store<u32>(dest + n - 12, c32);
|
store<u32>(dest + n - 12, c32);
|
||||||
store<u32>(dest + n - 8, c32);
|
store<u32>(dest + n - 8, c32);
|
||||||
if (n <= 24)
|
if (n <= 24) return;
|
||||||
return;
|
|
||||||
store<u32>(dest + 12, c32);
|
store<u32>(dest + 12, c32);
|
||||||
store<u32>(dest + 16, c32);
|
store<u32>(dest + 16, c32);
|
||||||
store<u32>(dest + 20, c32);
|
store<u32>(dest + 20, c32);
|
||||||
@ -259,8 +250,7 @@ export function set_memory(dest: usize, c: u8, n: usize): void {
|
|||||||
export function compare_memory(vl: usize, vr: usize, n: usize): i32 {
|
export function compare_memory(vl: usize, vr: usize, n: usize): i32 {
|
||||||
// based on musl's implementation of memcmp
|
// based on musl's implementation of memcmp
|
||||||
// provided because there's no proposed alternative
|
// provided because there's no proposed alternative
|
||||||
if (vl == vr)
|
if (vl == vr) return 0;
|
||||||
return 0;
|
|
||||||
while (n && load<u8>(vl) == load<u8>(vr)) {
|
while (n && load<u8>(vl) == load<u8>(vr)) {
|
||||||
n--;
|
n--;
|
||||||
vl++;
|
vl++;
|
||||||
|
@ -21,9 +21,11 @@ export class Set<T> {
|
|||||||
has(value: T): bool {
|
has(value: T): bool {
|
||||||
assert(this != null);
|
assert(this != null);
|
||||||
|
|
||||||
for (var index: usize = 0, limit: usize = this.__size; index < limit; ++index)
|
for (var index: usize = 0, limit: usize = this.__size; index < limit; ++index) {
|
||||||
if (load<T>(this.__memory + index * sizeof<T>()) == value)
|
if (load<T>(this.__memory + index * sizeof<T>()) == value) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,13 +50,19 @@ export class Set<T> {
|
|||||||
delete(value: T): bool {
|
delete(value: T): bool {
|
||||||
assert(this != null);
|
assert(this != null);
|
||||||
|
|
||||||
for (var index: usize = 0, limit: usize = this.__size; index < limit; ++index)
|
for (var index: usize = 0, limit: usize = this.__size; index < limit; ++index) {
|
||||||
if (load<T>(this.__memory + index * sizeof<T>()) == value) {
|
if (load<T>(this.__memory + index * sizeof<T>()) == value) {
|
||||||
if (index + 1 < this.__size)
|
if (index + 1 < this.__size) {
|
||||||
move_memory(this.__memory + index * sizeof<T>(), this.__memory + (index + 1) * sizeof<T>(), this.__size - index - 1);
|
move_memory(
|
||||||
|
this.__memory + index * sizeof<T>(),
|
||||||
|
this.__memory + (index + 1) * sizeof<T>(),
|
||||||
|
this.__size - index - 1
|
||||||
|
);
|
||||||
|
}
|
||||||
--this.__size;
|
--this.__size;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,8 +19,9 @@ export class String {
|
|||||||
charAt(pos: i32): String {
|
charAt(pos: i32): String {
|
||||||
assert(this != null);
|
assert(this != null);
|
||||||
|
|
||||||
if (<u32>pos >= this.length)
|
if (<u32>pos >= this.length) {
|
||||||
return EMPTY;
|
return EMPTY;
|
||||||
|
}
|
||||||
|
|
||||||
var out = allocate(1);
|
var out = allocate(1);
|
||||||
store<u16>(
|
store<u16>(
|
||||||
@ -36,10 +37,9 @@ export class String {
|
|||||||
|
|
||||||
charCodeAt(pos: i32): i32 {
|
charCodeAt(pos: i32): i32 {
|
||||||
assert(this != null);
|
assert(this != null);
|
||||||
|
if (<u32>pos >= this.length) {
|
||||||
if (<u32>pos >= this.length)
|
|
||||||
return -1; // (NaN)
|
return -1; // (NaN)
|
||||||
|
}
|
||||||
return load<u16>(
|
return load<u16>(
|
||||||
changetype<usize>(this) + (<usize>pos << 1),
|
changetype<usize>(this) + (<usize>pos << 1),
|
||||||
HEAD
|
HEAD
|
||||||
@ -48,43 +48,45 @@ export class String {
|
|||||||
|
|
||||||
codePointAt(pos: i32): i32 {
|
codePointAt(pos: i32): i32 {
|
||||||
assert(this != null);
|
assert(this != null);
|
||||||
|
if (<u32>pos >= this.length) {
|
||||||
if (<u32>pos >= this.length)
|
|
||||||
return -1; // (undefined)
|
return -1; // (undefined)
|
||||||
|
}
|
||||||
var first = <i32>load<u16>(
|
var first = <i32>load<u16>(
|
||||||
changetype<usize>(this) + (<usize>pos << 1),
|
changetype<usize>(this) + (<usize>pos << 1),
|
||||||
HEAD
|
HEAD
|
||||||
);
|
);
|
||||||
if (first < 0xD800 || first > 0xDBFF || pos + 1 == this.length)
|
if (first < 0xD800 || first > 0xDBFF || pos + 1 == this.length) {
|
||||||
return first;
|
return first;
|
||||||
|
}
|
||||||
var second = <i32>load<u16>(
|
var second = <i32>load<u16>(
|
||||||
changetype<usize>(this) + ((<usize>pos + 1) << 1),
|
changetype<usize>(this) + ((<usize>pos + 1) << 1),
|
||||||
HEAD
|
HEAD
|
||||||
);
|
);
|
||||||
if (second < 0xDC00 || second > 0xDFFF)
|
if (second < 0xDC00 || second > 0xDFFF) {
|
||||||
return first;
|
return first;
|
||||||
|
}
|
||||||
return ((first - 0xD800) << 10) + (second - 0xDC00) + 0x10000;
|
return ((first - 0xD800) << 10) + (second - 0xDC00) + 0x10000;
|
||||||
}
|
}
|
||||||
|
|
||||||
@operator("+")
|
@operator("+")
|
||||||
private static __concat(left: String, right: String): String {
|
private static __concat(left: String, right: String): String {
|
||||||
if (left == null)
|
if (left == null) {
|
||||||
left = changetype<String>("null");
|
left = changetype<String>("null");
|
||||||
|
}
|
||||||
return left.concat(right);
|
return left.concat(right);
|
||||||
}
|
}
|
||||||
|
|
||||||
concat(other: String): String {
|
concat(other: String): String {
|
||||||
assert(this != null);
|
assert(this != null);
|
||||||
|
if (other == null) {
|
||||||
if (other == null)
|
|
||||||
other = changetype<String>("null");
|
other = changetype<String>("null");
|
||||||
|
}
|
||||||
var thisLen: isize = this.length;
|
var thisLen: isize = this.length;
|
||||||
var otherLen: isize = other.length;
|
var otherLen: isize = other.length;
|
||||||
var outLen: usize = thisLen + otherLen;
|
var outLen: usize = thisLen + otherLen;
|
||||||
if (outLen == 0)
|
if (outLen == 0) {
|
||||||
return EMPTY;
|
return EMPTY;
|
||||||
|
}
|
||||||
var out = allocate(outLen);
|
var out = allocate(outLen);
|
||||||
move_memory(
|
move_memory(
|
||||||
changetype<usize>(out) + HEAD,
|
changetype<usize>(out) + HEAD,
|
||||||
@ -101,16 +103,15 @@ export class String {
|
|||||||
|
|
||||||
endsWith(searchString: String, endPosition: i32 = 0x7fffffff): bool {
|
endsWith(searchString: String, endPosition: i32 = 0x7fffffff): bool {
|
||||||
assert(this != null);
|
assert(this != null);
|
||||||
|
if (searchString == null) {
|
||||||
if (searchString == null)
|
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
var end: isize = <isize>min(max(endPosition, 0), this.length);
|
var end: isize = <isize>min(max(endPosition, 0), this.length);
|
||||||
var searchLength: isize = searchString.length;
|
var searchLength: isize = searchString.length;
|
||||||
var start: isize = end - searchLength;
|
var start: isize = end - searchLength;
|
||||||
if (start < 0)
|
if (start < 0) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
return !compare_memory(
|
return !compare_memory(
|
||||||
changetype<usize>(this) + HEAD + (start << 1),
|
changetype<usize>(this) + HEAD + (start << 1),
|
||||||
changetype<usize>(searchString) + HEAD,
|
changetype<usize>(searchString) + HEAD,
|
||||||
@ -120,15 +121,15 @@ export class String {
|
|||||||
|
|
||||||
@operator("==")
|
@operator("==")
|
||||||
private static __eq(left: String, right: String): bool {
|
private static __eq(left: String, right: String): bool {
|
||||||
if (left == null)
|
if (left == null) {
|
||||||
return right == null;
|
return right == null;
|
||||||
else if (right == null)
|
} else if (right == null) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
var leftLength = left.length;
|
var leftLength = left.length;
|
||||||
if (leftLength != right.length)
|
if (leftLength != right.length) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
return !compare_memory(
|
return !compare_memory(
|
||||||
changetype<usize>(left) + HEAD,
|
changetype<usize>(left) + HEAD,
|
||||||
changetype<usize>(right) + HEAD,
|
changetype<usize>(right) + HEAD,
|
||||||
@ -142,39 +143,39 @@ export class String {
|
|||||||
|
|
||||||
indexOf(searchString: String, position: i32 = 0): i32 {
|
indexOf(searchString: String, position: i32 = 0): i32 {
|
||||||
assert(this != null);
|
assert(this != null);
|
||||||
|
if (searchString == null) {
|
||||||
if (searchString == null)
|
|
||||||
searchString = changetype<String>("null");
|
searchString = changetype<String>("null");
|
||||||
|
}
|
||||||
var pos: isize = position;
|
var pos: isize = position;
|
||||||
var len: isize = this.length;
|
var len: isize = this.length;
|
||||||
var start: isize = min<isize>(max<isize>(pos, 0), len);
|
var start: isize = min<isize>(max<isize>(pos, 0), len);
|
||||||
var searchLen: isize = <isize>searchString.length;
|
var searchLen: isize = <isize>searchString.length;
|
||||||
|
|
||||||
// TODO: two-way, multiple char codes
|
// TODO: two-way, multiple char codes
|
||||||
for (var k: usize = start; <isize>k + searchLen <= len; ++k)
|
for (var k: usize = start; <isize>k + searchLen <= len; ++k) {
|
||||||
if (!compare_memory(
|
if (!compare_memory(
|
||||||
changetype<usize>(this) + HEAD + (k << 1),
|
changetype<usize>(this) + HEAD + (k << 1),
|
||||||
changetype<usize>(searchString) + HEAD,
|
changetype<usize>(searchString) + HEAD,
|
||||||
searchLen << 1)
|
searchLen << 1)
|
||||||
)
|
) {
|
||||||
return <i32>k;
|
return <i32>k;
|
||||||
|
}
|
||||||
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
startsWith(searchString: String, position: i32 = 0): bool {
|
startsWith(searchString: String, position: i32 = 0): bool {
|
||||||
assert(this != null);
|
assert(this != null);
|
||||||
|
if (searchString == null) {
|
||||||
if (searchString == null)
|
|
||||||
searchString = changetype<String>("null");
|
searchString = changetype<String>("null");
|
||||||
|
}
|
||||||
var pos: isize = position;
|
var pos: isize = position;
|
||||||
var len: isize = this.length;
|
var len: isize = this.length;
|
||||||
var start: isize = min<isize>(max<isize>(position, 0), len);
|
var start: isize = min<isize>(max<isize>(pos, 0), len);
|
||||||
var searchLength: isize = <isize>searchString.length;
|
var searchLength: isize = <isize>searchString.length;
|
||||||
if (searchLength + start > len)
|
if (searchLength + start > len) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
return !compare_memory(
|
return !compare_memory(
|
||||||
changetype<usize>(this) + HEAD + (start << 1),
|
changetype<usize>(this) + HEAD + (start << 1),
|
||||||
changetype<usize>(searchString) + HEAD,
|
changetype<usize>(searchString) + HEAD,
|
||||||
@ -184,17 +185,16 @@ export class String {
|
|||||||
|
|
||||||
substr(start: i32, length: i32 = i32.MAX_VALUE): String {
|
substr(start: i32, length: i32 = i32.MAX_VALUE): String {
|
||||||
assert(this != null);
|
assert(this != null);
|
||||||
|
|
||||||
var intStart: isize = start;
|
var intStart: isize = start;
|
||||||
var end: isize = length;
|
var end: isize = length;
|
||||||
var size: isize = this.length;
|
var size: isize = this.length;
|
||||||
if (intStart < 0)
|
if (intStart < 0) {
|
||||||
intStart = max<isize>(size + intStart, 0);
|
intStart = max<isize>(size + intStart, 0);
|
||||||
|
}
|
||||||
var resultLength: isize = min<isize>(max<isize>(end, 0), size - intStart);
|
var resultLength: isize = min<isize>(max<isize>(end, 0), size - intStart);
|
||||||
if (resultLength <= 0)
|
if (resultLength <= 0) {
|
||||||
return EMPTY;
|
return EMPTY;
|
||||||
|
}
|
||||||
var out = allocate(resultLength);
|
var out = allocate(resultLength);
|
||||||
move_memory(
|
move_memory(
|
||||||
changetype<usize>(out) + HEAD,
|
changetype<usize>(out) + HEAD,
|
||||||
@ -206,19 +206,18 @@ export class String {
|
|||||||
|
|
||||||
substring(start: i32, end: i32 = i32.MAX_VALUE): String {
|
substring(start: i32, end: i32 = i32.MAX_VALUE): String {
|
||||||
assert(this != null);
|
assert(this != null);
|
||||||
|
|
||||||
var len = this.length;
|
var len = this.length;
|
||||||
var finalStart = min<i32>(max<i32>(start, 0), len);
|
var finalStart = min<i32>(max<i32>(start, 0), len);
|
||||||
var finalEnd = min<i32>(max<i32>(end, 0), len);
|
var finalEnd = min<i32>(max<i32>(end, 0), len);
|
||||||
var from = min<i32>(finalStart, finalEnd);
|
var from = min<i32>(finalStart, finalEnd);
|
||||||
var to = max<i32>(finalStart, finalEnd);
|
var to = max<i32>(finalStart, finalEnd);
|
||||||
len = to - from;
|
len = to - from;
|
||||||
if (!len)
|
if (!len) {
|
||||||
return EMPTY;
|
return EMPTY;
|
||||||
|
}
|
||||||
if (!from && to == this.length)
|
if (!from && to == this.length) {
|
||||||
return this;
|
return this;
|
||||||
|
}
|
||||||
var out = allocate(len);
|
var out = allocate(len);
|
||||||
move_memory(
|
move_memory(
|
||||||
changetype<usize>(out) + HEAD,
|
changetype<usize>(out) + HEAD,
|
||||||
@ -230,21 +229,30 @@ export class String {
|
|||||||
|
|
||||||
trim(): String {
|
trim(): String {
|
||||||
assert(this != null);
|
assert(this != null);
|
||||||
|
|
||||||
var length: usize = this.length;
|
var length: usize = this.length;
|
||||||
while (length && isWhiteSpaceOrLineTerminator(load<u16>(changetype<usize>(this) + (length << 1), HEAD)))
|
while (
|
||||||
|
length &&
|
||||||
|
isWhiteSpaceOrLineTerminator(
|
||||||
|
load<u16>(changetype<usize>(this) + (length << 1), HEAD)
|
||||||
|
)
|
||||||
|
) {
|
||||||
--length;
|
--length;
|
||||||
|
}
|
||||||
var start: usize = 0;
|
var start: usize = 0;
|
||||||
while (start < length && isWhiteSpaceOrLineTerminator(load<u16>(changetype<usize>(this) + (start << 1), HEAD)))
|
while (
|
||||||
|
start < length &&
|
||||||
|
isWhiteSpaceOrLineTerminator(
|
||||||
|
load<u16>(changetype<usize>(this) + (start << 1), HEAD)
|
||||||
|
)
|
||||||
|
) {
|
||||||
++start, --length;
|
++start, --length;
|
||||||
|
}
|
||||||
if (!length)
|
if (!length) {
|
||||||
return EMPTY;
|
return EMPTY;
|
||||||
|
}
|
||||||
if (!start && length == this.length)
|
if (!start && length == this.length) {
|
||||||
return this;
|
return this;
|
||||||
|
}
|
||||||
var out = allocate(length);
|
var out = allocate(length);
|
||||||
move_memory(
|
move_memory(
|
||||||
changetype<usize>(out) + HEAD,
|
changetype<usize>(out) + HEAD,
|
||||||
@ -256,19 +264,23 @@ export class String {
|
|||||||
|
|
||||||
trimLeft(): String {
|
trimLeft(): String {
|
||||||
assert(this != null);
|
assert(this != null);
|
||||||
|
|
||||||
var start: isize = 0;
|
var start: isize = 0;
|
||||||
var len: isize = this.length;
|
var len: isize = this.length;
|
||||||
while (start < len && isWhiteSpaceOrLineTerminator(load<u16>(changetype<usize>(this) + (start << 1), HEAD)))
|
while (
|
||||||
|
start < len &&
|
||||||
|
isWhiteSpaceOrLineTerminator(
|
||||||
|
load<u16>(changetype<usize>(this) + (start << 1), HEAD)
|
||||||
|
)
|
||||||
|
) {
|
||||||
++start;
|
++start;
|
||||||
|
}
|
||||||
if (!start)
|
if (!start) {
|
||||||
return this;
|
return this;
|
||||||
|
}
|
||||||
var outLen = len - start;
|
var outLen = len - start;
|
||||||
if (!outLen)
|
if (!outLen) {
|
||||||
return EMPTY;
|
return EMPTY;
|
||||||
|
}
|
||||||
var out = allocate(outLen);
|
var out = allocate(outLen);
|
||||||
move_memory(
|
move_memory(
|
||||||
changetype<usize>(out) + HEAD,
|
changetype<usize>(out) + HEAD,
|
||||||
@ -280,17 +292,21 @@ export class String {
|
|||||||
|
|
||||||
trimRight(): String {
|
trimRight(): String {
|
||||||
assert(this != null);
|
assert(this != null);
|
||||||
|
|
||||||
var len: isize = this.length;
|
var len: isize = this.length;
|
||||||
while (len > 0 && isWhiteSpaceOrLineTerminator(load<u16>(changetype<usize>(this) + (len << 1), HEAD)))
|
while (
|
||||||
|
len > 0 &&
|
||||||
|
isWhiteSpaceOrLineTerminator(
|
||||||
|
load<u16>(changetype<usize>(this) + (len << 1), HEAD)
|
||||||
|
)
|
||||||
|
) {
|
||||||
--len;
|
--len;
|
||||||
|
}
|
||||||
if (len <= 0)
|
if (len <= 0) {
|
||||||
return EMPTY;
|
return EMPTY;
|
||||||
|
}
|
||||||
if (<i32>len == this.length)
|
if (<i32>len == this.length) {
|
||||||
return this;
|
return this;
|
||||||
|
}
|
||||||
var out = allocate(len);
|
var out = allocate(len);
|
||||||
move_memory(
|
move_memory(
|
||||||
changetype<usize>(out) + HEAD,
|
changetype<usize>(out) + HEAD,
|
||||||
@ -303,19 +319,16 @@ export class String {
|
|||||||
|
|
||||||
function isWhiteSpaceOrLineTerminator(c: u16): bool {
|
function isWhiteSpaceOrLineTerminator(c: u16): bool {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
|
|
||||||
case 10: // <LF>
|
case 10: // <LF>
|
||||||
case 13: // <CR>
|
case 13: // <CR>
|
||||||
case 8232: // <LS>
|
case 8232: // <LS>
|
||||||
case 8233: // <PS>
|
case 8233: // <PS>
|
||||||
|
|
||||||
case 9: // <TAB>
|
case 9: // <TAB>
|
||||||
case 11: // <VT>
|
case 11: // <VT>
|
||||||
case 12: // <FF>
|
case 12: // <FF>
|
||||||
case 32: // <SP>
|
case 32: // <SP>
|
||||||
case 160: // <NBSP>
|
case 160: // <NBSP>
|
||||||
case 65279: // <ZWNBSP>
|
case 65279: // <ZWNBSP>
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
@ -364,25 +377,29 @@ export function parseI64(str: String, radix: i32 = 0): i64 {
|
|||||||
|
|
||||||
function parse<T>(str: String, radix: i32 = 0): T {
|
function parse<T>(str: String, radix: i32 = 0): T {
|
||||||
var len: i32 = str.length;
|
var len: i32 = str.length;
|
||||||
if (!len)
|
if (!len) {
|
||||||
return <T>NaN;
|
return <T>NaN;
|
||||||
|
}
|
||||||
var ptr = changetype<usize>(str) /* + HEAD -> offset */;
|
var ptr = changetype<usize>(str) /* + HEAD -> offset */;
|
||||||
var code = <i32>load<u16>(ptr, HEAD);
|
var code = <i32>load<u16>(ptr, HEAD);
|
||||||
|
|
||||||
// determine sign
|
// determine sign
|
||||||
var sign: T;
|
var sign: T;
|
||||||
if (code == CharCode.MINUS) {
|
if (code == CharCode.MINUS) {
|
||||||
if (!--len)
|
if (!--len) {
|
||||||
return <T>NaN;
|
return <T>NaN;
|
||||||
|
}
|
||||||
code = <i32>load<u16>(ptr += 2, HEAD);
|
code = <i32>load<u16>(ptr += 2, HEAD);
|
||||||
sign = -1;
|
sign = -1;
|
||||||
} else if (code == CharCode.PLUS) {
|
} else if (code == CharCode.PLUS) {
|
||||||
if (!--len)
|
if (!--len) {
|
||||||
return <T>NaN;
|
return <T>NaN;
|
||||||
|
}
|
||||||
code = <i32>load<u16>(ptr += 2, HEAD);
|
code = <i32>load<u16>(ptr += 2, HEAD);
|
||||||
sign = 1;
|
sign = 1;
|
||||||
} else
|
} else {
|
||||||
sign = 1;
|
sign = 1;
|
||||||
|
}
|
||||||
|
|
||||||
// determine radix
|
// determine radix
|
||||||
if (!radix) {
|
if (!radix) {
|
||||||
@ -411,23 +428,26 @@ function parse<T>(str: String, radix: i32 = 0): T {
|
|||||||
radix = 10;
|
radix = 10;
|
||||||
}
|
}
|
||||||
} else radix = 10;
|
} else radix = 10;
|
||||||
} else if (radix < 2 || radix > 36)
|
} else if (radix < 2 || radix > 36) {
|
||||||
return <T>NaN;
|
return <T>NaN;
|
||||||
|
}
|
||||||
|
|
||||||
// calculate value
|
// calculate value
|
||||||
var num: T = 0;
|
var num: T = 0;
|
||||||
while (len--) {
|
while (len--) {
|
||||||
code = <i32>load<u16>(ptr, HEAD);
|
code = <i32>load<u16>(ptr, HEAD);
|
||||||
if (code >= CharCode._0 && code <= CharCode._9)
|
if (code >= CharCode._0 && code <= CharCode._9) {
|
||||||
code -= CharCode._0;
|
code -= CharCode._0;
|
||||||
else if (code >= CharCode.A && code <= CharCode.Z)
|
} else if (code >= CharCode.A && code <= CharCode.Z) {
|
||||||
code -= CharCode.A - 10;
|
code -= CharCode.A - 10;
|
||||||
else if (code >= CharCode.a && code <= CharCode.z)
|
} else if (code >= CharCode.a && code <= CharCode.z) {
|
||||||
code -= CharCode.a - 10;
|
code -= CharCode.a - 10;
|
||||||
else
|
} else {
|
||||||
break;
|
break;
|
||||||
if (code >= radix)
|
}
|
||||||
|
if (code >= radix) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
num = (num * radix) + code;
|
num = (num * radix) + code;
|
||||||
ptr += 2;
|
ptr += 2;
|
||||||
}
|
}
|
||||||
@ -436,25 +456,29 @@ function parse<T>(str: String, radix: i32 = 0): T {
|
|||||||
|
|
||||||
export function parseFloat(str: String): f64 {
|
export function parseFloat(str: String): f64 {
|
||||||
var len: i32 = str.length;
|
var len: i32 = str.length;
|
||||||
if (!len)
|
if (!len) {
|
||||||
return NaN;
|
return NaN;
|
||||||
|
}
|
||||||
var ptr = changetype<usize>(str) /* + HEAD -> offset */;
|
var ptr = changetype<usize>(str) /* + HEAD -> offset */;
|
||||||
var code = <i32>load<u16>(ptr, HEAD);
|
var code = <i32>load<u16>(ptr, HEAD);
|
||||||
|
|
||||||
// determine sign
|
// determine sign
|
||||||
var sign: f64;
|
var sign: f64;
|
||||||
if (code == CharCode.MINUS) {
|
if (code == CharCode.MINUS) {
|
||||||
if (!--len)
|
if (!--len) {
|
||||||
return NaN;
|
return NaN;
|
||||||
|
}
|
||||||
code = <i32>load<u16>(ptr += 2, HEAD);
|
code = <i32>load<u16>(ptr += 2, HEAD);
|
||||||
sign = -1;
|
sign = -1;
|
||||||
} else if (code == CharCode.PLUS) {
|
} else if (code == CharCode.PLUS) {
|
||||||
if (!--len)
|
if (!--len) {
|
||||||
return NaN;
|
return NaN;
|
||||||
|
}
|
||||||
code = <i32>load<u16>(ptr += 2, HEAD);
|
code = <i32>load<u16>(ptr += 2, HEAD);
|
||||||
sign = 1;
|
sign = 1;
|
||||||
} else
|
} else {
|
||||||
sign = 1;
|
sign = 1;
|
||||||
|
}
|
||||||
|
|
||||||
// calculate value
|
// calculate value
|
||||||
var num: f64 = 0;
|
var num: f64 = 0;
|
||||||
@ -465,11 +489,13 @@ export function parseFloat(str: String): f64 {
|
|||||||
var fac: f64 = 0.1; // precision :(
|
var fac: f64 = 0.1; // precision :(
|
||||||
while (len--) {
|
while (len--) {
|
||||||
code = <i32>load<u16>(ptr, HEAD);
|
code = <i32>load<u16>(ptr, HEAD);
|
||||||
if (code == CharCode.E || code == CharCode.e)
|
if (code == CharCode.E || code == CharCode.e) {
|
||||||
assert(false); // TODO
|
assert(false); // TODO
|
||||||
|
}
|
||||||
code -= CharCode._0;
|
code -= CharCode._0;
|
||||||
if (<u32>code > 9)
|
if (<u32>code > 9) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
num += <f64>code * fac;
|
num += <f64>code * fac;
|
||||||
fac *= 0.1;
|
fac *= 0.1;
|
||||||
ptr += 2;
|
ptr += 2;
|
||||||
@ -477,8 +503,9 @@ export function parseFloat(str: String): f64 {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
code -= CharCode._0;
|
code -= CharCode._0;
|
||||||
if (<u32>code >= 10)
|
if (<u32>code >= 10) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
num = (num * 10) + code;
|
num = (num * 10) + code;
|
||||||
ptr += 2;
|
ptr += 2;
|
||||||
}
|
}
|
||||||
|
@ -144,6 +144,7 @@ globalScope["parseI32"] = function parseI32(str, radix) {
|
|||||||
String["fromCharCodes"] = function fromCharCodes(arr) {
|
String["fromCharCodes"] = function fromCharCodes(arr) {
|
||||||
return String.fromCharCode.apply(String, arr);
|
return String.fromCharCode.apply(String, arr);
|
||||||
};
|
};
|
||||||
|
|
||||||
String["fromCodePoints"] = function fromCodePoints(arr) {
|
String["fromCodePoints"] = function fromCodePoints(arr) {
|
||||||
return String.fromCodePoint.apply(String, arr);
|
return String.fromCodePoint.apply(String, arr);
|
||||||
};
|
};
|
||||||
|
@ -15,6 +15,6 @@
|
|||||||
"files": [
|
"files": [
|
||||||
"./portable.d.ts",
|
"./portable.d.ts",
|
||||||
"./portable.js",
|
"./portable.js",
|
||||||
"./portable/heap.js"
|
"./portable/memory.js"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,7 @@ var globalScope = typeof window !== "undefined" && window || typeof global !== "
|
|||||||
var HEAP = new Uint8Array(0);
|
var HEAP = new Uint8Array(0);
|
||||||
var HEAP_OFFSET = 0;
|
var HEAP_OFFSET = 0;
|
||||||
|
|
||||||
globalScope["allocate_memory"] =
|
globalScope["allocate_memory"] = function allocate_memory(size) {
|
||||||
function allocate_memory(size) {
|
|
||||||
if (!(size >>>= 0))
|
if (!(size >>>= 0))
|
||||||
return 0;
|
return 0;
|
||||||
if (HEAP_OFFSET + size > HEAP.length) {
|
if (HEAP_OFFSET + size > HEAP.length) {
|
||||||
@ -18,25 +17,21 @@ function allocate_memory(size) {
|
|||||||
return ptr;
|
return ptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
globalScope["free_memory"] =
|
globalScope["free_memory"] = function free_memory(ptr) {
|
||||||
function free_memory(ptr) {
|
|
||||||
// TODO
|
// TODO
|
||||||
};
|
};
|
||||||
|
|
||||||
globalScope["move_memory"] =
|
globalScope["move_memory"] = function move_memory(dest, src, n) {
|
||||||
function move_memory(dest, src, n) {
|
|
||||||
HEAP.copyWithin(dest, src, src + n);
|
HEAP.copyWithin(dest, src, src + n);
|
||||||
};
|
};
|
||||||
|
|
||||||
globalScope["store"] =
|
globalScope["store"] = function store(ptr, val, off) {
|
||||||
function store(ptr, val, off) {
|
|
||||||
if (typeof off === "number")
|
if (typeof off === "number")
|
||||||
ptr += off;
|
ptr += off;
|
||||||
HEAP[ptr] = val;
|
HEAP[ptr] = val;
|
||||||
};
|
};
|
||||||
|
|
||||||
globalScope["load"] =
|
globalScope["load"] = function load(ptr) {
|
||||||
function load(ptr) {
|
|
||||||
if (typeof off === "number")
|
if (typeof off === "number")
|
||||||
ptr += off;
|
ptr += off;
|
||||||
return HEAP[ptr];
|
return HEAP[ptr];
|
@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "../portable.json",
|
|
||||||
"compilerOptions": {
|
|
||||||
"diagnostics": true
|
|
||||||
},
|
|
||||||
"include": [
|
|
||||||
"./**/*.ts"
|
|
||||||
]
|
|
||||||
}
|
|
@ -69,12 +69,6 @@
|
|||||||
(i32.const 1)
|
(i32.const 1)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(set_global $binary/i
|
|
||||||
(i32.mul
|
|
||||||
(get_global $binary/i)
|
|
||||||
(i32.const 1)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
(set_global $binary/i
|
(set_global $binary/i
|
||||||
(i32.div_s
|
(i32.div_s
|
||||||
(get_global $binary/i)
|
(get_global $binary/i)
|
||||||
@ -135,12 +129,6 @@
|
|||||||
(i32.const 1)
|
(i32.const 1)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(set_global $binary/i
|
|
||||||
(i32.mul
|
|
||||||
(get_global $binary/i)
|
|
||||||
(i32.const 1)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
(set_global $binary/i
|
(set_global $binary/i
|
||||||
(i32.rem_s
|
(i32.rem_s
|
||||||
(get_global $binary/i)
|
(get_global $binary/i)
|
||||||
|
@ -18,13 +18,13 @@
|
|||||||
)
|
)
|
||||||
(loop $continue|0
|
(loop $continue|0
|
||||||
(if
|
(if
|
||||||
(if (result i32)
|
(select
|
||||||
(get_local $2)
|
(i32.and
|
||||||
(i32.rem_u
|
|
||||||
(get_local $1)
|
(get_local $1)
|
||||||
(i32.const 4)
|
(i32.const 3)
|
||||||
)
|
)
|
||||||
(get_local $2)
|
(get_local $2)
|
||||||
|
(get_local $2)
|
||||||
)
|
)
|
||||||
(block
|
(block
|
||||||
(set_local $0
|
(set_local $0
|
||||||
@ -63,9 +63,9 @@
|
|||||||
)
|
)
|
||||||
(if
|
(if
|
||||||
(i32.eqz
|
(i32.eqz
|
||||||
(i32.rem_u
|
(i32.and
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
(i32.const 4)
|
(i32.const 3)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(block
|
(block
|
||||||
@ -269,9 +269,9 @@
|
|||||||
(block $tablify|0
|
(block $tablify|0
|
||||||
(br_table $case0|2 $case1|2 $case2|2 $tablify|0
|
(br_table $case0|2 $case1|2 $case2|2 $tablify|0
|
||||||
(i32.sub
|
(i32.sub
|
||||||
(i32.rem_u
|
(i32.and
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
(i32.const 4)
|
(i32.const 3)
|
||||||
)
|
)
|
||||||
(i32.const 1)
|
(i32.const 1)
|
||||||
)
|
)
|
||||||
|
@ -31,21 +31,21 @@
|
|||||||
(block
|
(block
|
||||||
(if
|
(if
|
||||||
(i32.eq
|
(i32.eq
|
||||||
(i32.rem_u
|
(i32.and
|
||||||
(get_local $1)
|
(get_local $1)
|
||||||
(i32.const 8)
|
(i32.const 7)
|
||||||
)
|
)
|
||||||
(i32.rem_u
|
(i32.and
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
(i32.const 8)
|
(i32.const 7)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(block
|
(block
|
||||||
(loop $continue|0
|
(loop $continue|0
|
||||||
(if
|
(if
|
||||||
(i32.rem_u
|
(i32.and
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
(i32.const 8)
|
(i32.const 7)
|
||||||
)
|
)
|
||||||
(block
|
(block
|
||||||
(if
|
(if
|
||||||
@ -169,24 +169,24 @@
|
|||||||
(block
|
(block
|
||||||
(if
|
(if
|
||||||
(i32.eq
|
(i32.eq
|
||||||
(i32.rem_u
|
(i32.and
|
||||||
(get_local $1)
|
(get_local $1)
|
||||||
(i32.const 8)
|
(i32.const 7)
|
||||||
)
|
)
|
||||||
(i32.rem_u
|
(i32.and
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
(i32.const 8)
|
(i32.const 7)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(block
|
(block
|
||||||
(loop $continue|3
|
(loop $continue|3
|
||||||
(if
|
(if
|
||||||
(i32.rem_u
|
(i32.and
|
||||||
(i32.add
|
(i32.add
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
(get_local $2)
|
(get_local $2)
|
||||||
)
|
)
|
||||||
(i32.const 8)
|
(i32.const 7)
|
||||||
)
|
)
|
||||||
(block
|
(block
|
||||||
(if
|
(if
|
||||||
|
@ -92,13 +92,13 @@
|
|||||||
)
|
)
|
||||||
(loop $continue|0
|
(loop $continue|0
|
||||||
(if
|
(if
|
||||||
(if (result i32)
|
(select
|
||||||
(get_local $2)
|
(i32.and
|
||||||
(i32.rem_u
|
|
||||||
(get_local $1)
|
(get_local $1)
|
||||||
(i32.const 4)
|
(i32.const 3)
|
||||||
)
|
)
|
||||||
(get_local $2)
|
(get_local $2)
|
||||||
|
(get_local $2)
|
||||||
)
|
)
|
||||||
(block
|
(block
|
||||||
(set_local $0
|
(set_local $0
|
||||||
@ -137,9 +137,9 @@
|
|||||||
)
|
)
|
||||||
(if
|
(if
|
||||||
(i32.eqz
|
(i32.eqz
|
||||||
(i32.rem_u
|
(i32.and
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
(i32.const 4)
|
(i32.const 3)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(block
|
(block
|
||||||
@ -343,9 +343,9 @@
|
|||||||
(block $tablify|0
|
(block $tablify|0
|
||||||
(br_table $case0|2 $case1|2 $case2|2 $tablify|0
|
(br_table $case0|2 $case1|2 $case2|2 $tablify|0
|
||||||
(i32.sub
|
(i32.sub
|
||||||
(i32.rem_u
|
(i32.and
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
(i32.const 4)
|
(i32.const 3)
|
||||||
)
|
)
|
||||||
(i32.const 1)
|
(i32.const 1)
|
||||||
)
|
)
|
||||||
@ -2858,12 +2858,6 @@
|
|||||||
(i32.const 1)
|
(i32.const 1)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(set_global $binary/i
|
|
||||||
(i32.mul
|
|
||||||
(get_global $binary/i)
|
|
||||||
(i32.const 1)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
(set_global $binary/i
|
(set_global $binary/i
|
||||||
(i32.div_s
|
(i32.div_s
|
||||||
(get_global $binary/i)
|
(get_global $binary/i)
|
||||||
@ -2924,12 +2918,6 @@
|
|||||||
(i32.const 1)
|
(i32.const 1)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(set_global $binary/i
|
|
||||||
(i32.mul
|
|
||||||
(get_global $binary/i)
|
|
||||||
(i32.const 1)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
(set_global $binary/i
|
(set_global $binary/i
|
||||||
(i32.rem_s
|
(i32.rem_s
|
||||||
(get_global $binary/i)
|
(get_global $binary/i)
|
||||||
|
@ -1994,9 +1994,9 @@
|
|||||||
)
|
)
|
||||||
(set_local $2
|
(set_local $2
|
||||||
(call "$(lib)/allocator/arena/allocate_memory"
|
(call "$(lib)/allocator/arena/allocate_memory"
|
||||||
(i32.mul
|
(i32.shl
|
||||||
(get_local $1)
|
(get_local $1)
|
||||||
(i32.const 4)
|
(i32.const 2)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -2010,11 +2010,11 @@
|
|||||||
(i32.load
|
(i32.load
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
)
|
)
|
||||||
(i32.mul
|
(i32.shl
|
||||||
(i32.load offset=4
|
(i32.load offset=4
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
)
|
)
|
||||||
(i32.const 4)
|
(i32.const 2)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(call "$(lib)/allocator/arena/free_memory"
|
(call "$(lib)/allocator/arena/free_memory"
|
||||||
@ -2065,11 +2065,11 @@
|
|||||||
(i32.load
|
(i32.load
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
)
|
)
|
||||||
(i32.mul
|
(i32.shl
|
||||||
(i32.load offset=8
|
(i32.load offset=8
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
)
|
)
|
||||||
(i32.const 4)
|
(i32.const 2)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(get_local $1)
|
(get_local $1)
|
||||||
@ -2102,9 +2102,9 @@
|
|||||||
(i32.load
|
(i32.load
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
)
|
)
|
||||||
(i32.mul
|
(i32.shl
|
||||||
(get_local $1)
|
(get_local $1)
|
||||||
(i32.const 4)
|
(i32.const 2)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -2137,9 +2137,9 @@
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(i32.mul
|
(i32.shl
|
||||||
(get_local $1)
|
(get_local $1)
|
||||||
(i32.const 4)
|
(i32.const 2)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -2181,7 +2181,7 @@
|
|||||||
(call $abort
|
(call $abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 32)
|
(i32.const 32)
|
||||||
(i32.const 105)
|
(i32.const 128)
|
||||||
(i32.const 6)
|
(i32.const 6)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -2189,9 +2189,9 @@
|
|||||||
)
|
)
|
||||||
(set_local $4
|
(set_local $4
|
||||||
(call "$(lib)/allocator/arena/allocate_memory"
|
(call "$(lib)/allocator/arena/allocate_memory"
|
||||||
(i32.mul
|
(i32.shl
|
||||||
(get_local $3)
|
(get_local $3)
|
||||||
(i32.const 4)
|
(i32.const 2)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -2208,9 +2208,9 @@
|
|||||||
(i32.load
|
(i32.load
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
)
|
)
|
||||||
(i32.mul
|
(i32.shl
|
||||||
(get_local $2)
|
(get_local $2)
|
||||||
(i32.const 4)
|
(i32.const 2)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(call "$(lib)/allocator/arena/free_memory"
|
(call "$(lib)/allocator/arena/free_memory"
|
||||||
@ -2239,9 +2239,9 @@
|
|||||||
(i32.load
|
(i32.load
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
)
|
)
|
||||||
(i32.mul
|
(i32.shl
|
||||||
(get_local $2)
|
(get_local $2)
|
||||||
(i32.const 4)
|
(i32.const 2)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -2625,14 +2625,14 @@
|
|||||||
)
|
)
|
||||||
(i32.const 4)
|
(i32.const 4)
|
||||||
)
|
)
|
||||||
(i32.mul
|
(i32.shl
|
||||||
(i32.sub
|
(i32.sub
|
||||||
(i32.load offset=4
|
(i32.load offset=4
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
)
|
)
|
||||||
(i32.const 1)
|
(i32.const 1)
|
||||||
)
|
)
|
||||||
(i32.const 4)
|
(i32.const 2)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(call "$(lib)/memory/set_memory"
|
(call "$(lib)/memory/set_memory"
|
||||||
@ -2640,14 +2640,14 @@
|
|||||||
(i32.load
|
(i32.load
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
)
|
)
|
||||||
(i32.mul
|
(i32.shl
|
||||||
(i32.sub
|
(i32.sub
|
||||||
(i32.load offset=4
|
(i32.load offset=4
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
)
|
)
|
||||||
(i32.const 1)
|
(i32.const 1)
|
||||||
)
|
)
|
||||||
(i32.const 4)
|
(i32.const 2)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
@ -2689,9 +2689,9 @@
|
|||||||
(i32.load
|
(i32.load
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
)
|
)
|
||||||
(i32.mul
|
(i32.shl
|
||||||
(get_local $1)
|
(get_local $1)
|
||||||
(i32.const 4)
|
(i32.const 2)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -2701,9 +2701,9 @@
|
|||||||
(i32.load
|
(i32.load
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
)
|
)
|
||||||
(i32.mul
|
(i32.shl
|
||||||
(get_local $1)
|
(get_local $1)
|
||||||
(i32.const 4)
|
(i32.const 2)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(i32.load
|
(i32.load
|
||||||
@ -2711,9 +2711,9 @@
|
|||||||
(i32.load
|
(i32.load
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
)
|
)
|
||||||
(i32.mul
|
(i32.shl
|
||||||
(get_local $2)
|
(get_local $2)
|
||||||
(i32.const 4)
|
(i32.const 2)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -2723,9 +2723,9 @@
|
|||||||
(i32.load
|
(i32.load
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
)
|
)
|
||||||
(i32.mul
|
(i32.shl
|
||||||
(get_local $2)
|
(get_local $2)
|
||||||
(i32.const 4)
|
(i32.const 2)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(get_local $3)
|
(get_local $3)
|
||||||
@ -2779,9 +2779,9 @@
|
|||||||
(i32.load
|
(i32.load
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
)
|
)
|
||||||
(i32.mul
|
(i32.shl
|
||||||
(get_local $2)
|
(get_local $2)
|
||||||
(i32.const 4)
|
(i32.const 2)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -2856,16 +2856,16 @@
|
|||||||
(i32.load
|
(i32.load
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
)
|
)
|
||||||
(i32.mul
|
(i32.shl
|
||||||
(get_local $1)
|
(get_local $1)
|
||||||
(i32.const 4)
|
(i32.const 2)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(i32.add
|
(i32.add
|
||||||
(i32.load
|
(i32.load
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
)
|
)
|
||||||
(i32.mul
|
(i32.shl
|
||||||
(i32.add
|
(i32.add
|
||||||
(get_local $1)
|
(get_local $1)
|
||||||
(tee_local $2
|
(tee_local $2
|
||||||
@ -2886,12 +2886,12 @@
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(i32.const 4)
|
(i32.const 2)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(i32.mul
|
(i32.shl
|
||||||
(get_local $2)
|
(get_local $2)
|
||||||
(i32.const 4)
|
(i32.const 2)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(i32.store offset=8
|
(i32.store offset=8
|
||||||
|
@ -2479,7 +2479,7 @@
|
|||||||
(call $abort
|
(call $abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 32)
|
(i32.const 32)
|
||||||
(i32.const 105)
|
(i32.const 128)
|
||||||
(i32.const 6)
|
(i32.const 6)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
|
@ -21,9 +21,9 @@
|
|||||||
(i32.load
|
(i32.load
|
||||||
(i32.add
|
(i32.add
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
(i32.mul
|
(i32.shl
|
||||||
(get_local $1)
|
(get_local $1)
|
||||||
(i32.const 4)
|
(i32.const 2)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -39,9 +39,9 @@
|
|||||||
(i32.store
|
(i32.store
|
||||||
(i32.add
|
(i32.add
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
(i32.mul
|
(i32.shl
|
||||||
(get_local $1)
|
(get_local $1)
|
||||||
(i32.const 4)
|
(i32.const 2)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(get_local $2)
|
(get_local $2)
|
||||||
|
@ -49,7 +49,6 @@
|
|||||||
(i32.const 1)
|
(i32.const 1)
|
||||||
)
|
)
|
||||||
(return
|
(return
|
||||||
(i32.or
|
|
||||||
(i32.or
|
(i32.or
|
||||||
(i32.and
|
(i32.and
|
||||||
(i32.shl
|
(i32.shl
|
||||||
@ -66,11 +65,6 @@
|
|||||||
(i32.const 255)
|
(i32.const 255)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(i32.and
|
|
||||||
(get_local $0)
|
|
||||||
(i32.const 0)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
@ -158,7 +152,6 @@
|
|||||||
(return
|
(return
|
||||||
(i32.shr_s
|
(i32.shr_s
|
||||||
(i32.shl
|
(i32.shl
|
||||||
(i32.or
|
|
||||||
(i32.or
|
(i32.or
|
||||||
(i32.shr_s
|
(i32.shr_s
|
||||||
(i32.shl
|
(i32.shl
|
||||||
@ -184,11 +177,6 @@
|
|||||||
(i32.const 255)
|
(i32.const 255)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(i32.and
|
|
||||||
(get_local $0)
|
|
||||||
(i32.const 0)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
(i32.const 16)
|
(i32.const 16)
|
||||||
)
|
)
|
||||||
(i32.const 16)
|
(i32.const 16)
|
||||||
|
@ -1981,7 +1981,7 @@
|
|||||||
(call $abort
|
(call $abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 28)
|
(i32.const 28)
|
||||||
(i32.const 31)
|
(i32.const 33)
|
||||||
(i32.const 4)
|
(i32.const 4)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -1999,7 +1999,7 @@
|
|||||||
(block
|
(block
|
||||||
(set_local $2
|
(set_local $2
|
||||||
(call "$(lib)/allocator/arena/allocate_memory"
|
(call "$(lib)/allocator/arena/allocate_memory"
|
||||||
(i32.mul
|
(i32.shl
|
||||||
(tee_local $3
|
(tee_local $3
|
||||||
(select
|
(select
|
||||||
(tee_local $2
|
(tee_local $2
|
||||||
@ -2019,7 +2019,7 @@
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(i32.const 4)
|
(i32.const 2)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -2033,11 +2033,11 @@
|
|||||||
(i32.load
|
(i32.load
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
)
|
)
|
||||||
(i32.mul
|
(i32.shl
|
||||||
(i32.load offset=4
|
(i32.load offset=4
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
)
|
)
|
||||||
(i32.const 4)
|
(i32.const 2)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(call "$(lib)/allocator/arena/free_memory"
|
(call "$(lib)/allocator/arena/free_memory"
|
||||||
@ -2062,11 +2062,11 @@
|
|||||||
(i32.load
|
(i32.load
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
)
|
)
|
||||||
(i32.mul
|
(i32.shl
|
||||||
(i32.load offset=8
|
(i32.load offset=8
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
)
|
)
|
||||||
(i32.const 4)
|
(i32.const 2)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(get_local $1)
|
(get_local $1)
|
||||||
@ -2118,9 +2118,9 @@
|
|||||||
(i32.load
|
(i32.load
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
)
|
)
|
||||||
(i32.mul
|
(i32.shl
|
||||||
(get_local $2)
|
(get_local $2)
|
||||||
(i32.const 4)
|
(i32.const 2)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -2153,7 +2153,7 @@
|
|||||||
(call $abort
|
(call $abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 28)
|
(i32.const 28)
|
||||||
(i32.const 49)
|
(i32.const 51)
|
||||||
(i32.const 4)
|
(i32.const 4)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -2178,9 +2178,9 @@
|
|||||||
(i32.load
|
(i32.load
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
)
|
)
|
||||||
(i32.mul
|
(i32.shl
|
||||||
(get_local $2)
|
(get_local $2)
|
||||||
(i32.const 4)
|
(i32.const 2)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -2202,21 +2202,21 @@
|
|||||||
(i32.load
|
(i32.load
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
)
|
)
|
||||||
(i32.mul
|
(i32.shl
|
||||||
(get_local $2)
|
(get_local $2)
|
||||||
(i32.const 4)
|
(i32.const 2)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(i32.add
|
(i32.add
|
||||||
(i32.load
|
(i32.load
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
)
|
)
|
||||||
(i32.mul
|
(i32.shl
|
||||||
(i32.add
|
(i32.add
|
||||||
(get_local $2)
|
(get_local $2)
|
||||||
(i32.const 1)
|
(i32.const 1)
|
||||||
)
|
)
|
||||||
(i32.const 4)
|
(i32.const 2)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(i32.sub
|
(i32.sub
|
||||||
@ -2265,7 +2265,7 @@
|
|||||||
(call $abort
|
(call $abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 28)
|
(i32.const 28)
|
||||||
(i32.const 62)
|
(i32.const 70)
|
||||||
(i32.const 4)
|
(i32.const 4)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
|
@ -2267,7 +2267,7 @@
|
|||||||
(call $abort
|
(call $abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 28)
|
(i32.const 28)
|
||||||
(i32.const 31)
|
(i32.const 33)
|
||||||
(i32.const 4)
|
(i32.const 4)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -2408,6 +2408,7 @@
|
|||||||
(get_local $2)
|
(get_local $2)
|
||||||
(get_local $3)
|
(get_local $3)
|
||||||
)
|
)
|
||||||
|
(block
|
||||||
(block
|
(block
|
||||||
(if
|
(if
|
||||||
(i32.eq
|
(i32.eq
|
||||||
@ -2428,6 +2429,7 @@
|
|||||||
(i32.const 1)
|
(i32.const 1)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
(set_local $2
|
(set_local $2
|
||||||
(i32.add
|
(i32.add
|
||||||
(get_local $2)
|
(get_local $2)
|
||||||
@ -2457,7 +2459,7 @@
|
|||||||
(call $abort
|
(call $abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 28)
|
(i32.const 28)
|
||||||
(i32.const 49)
|
(i32.const 51)
|
||||||
(i32.const 4)
|
(i32.const 4)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -2480,6 +2482,7 @@
|
|||||||
(get_local $2)
|
(get_local $2)
|
||||||
(get_local $3)
|
(get_local $3)
|
||||||
)
|
)
|
||||||
|
(block
|
||||||
(block
|
(block
|
||||||
(if
|
(if
|
||||||
(i32.eq
|
(i32.eq
|
||||||
@ -2554,6 +2557,7 @@
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
(set_local $2
|
(set_local $2
|
||||||
(i32.add
|
(i32.add
|
||||||
(get_local $2)
|
(get_local $2)
|
||||||
@ -2581,7 +2585,7 @@
|
|||||||
(call $abort
|
(call $abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 28)
|
(i32.const 28)
|
||||||
(i32.const 62)
|
(i32.const 70)
|
||||||
(i32.const 4)
|
(i32.const 4)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
(call $abort
|
(call $abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 72)
|
(i32.const 72)
|
||||||
(i32.const 38)
|
(i32.const 39)
|
||||||
(i32.const 4)
|
(i32.const 4)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -140,7 +140,7 @@
|
|||||||
(call $abort
|
(call $abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 72)
|
(i32.const 72)
|
||||||
(i32.const 166)
|
(i32.const 168)
|
||||||
(i32.const 4)
|
(i32.const 4)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -227,7 +227,7 @@
|
|||||||
(call $abort
|
(call $abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 72)
|
(i32.const 72)
|
||||||
(i32.const 103)
|
(i32.const 105)
|
||||||
(i32.const 4)
|
(i32.const 4)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -314,7 +314,7 @@
|
|||||||
(call $abort
|
(call $abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 72)
|
(i32.const 72)
|
||||||
(i32.const 144)
|
(i32.const 145)
|
||||||
(i32.const 4)
|
(i32.const 4)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -957,7 +957,7 @@
|
|||||||
(call $abort
|
(call $abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 72)
|
(i32.const 72)
|
||||||
(i32.const 469)
|
(i32.const 493)
|
||||||
(i32.const 10)
|
(i32.const 10)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
|
@ -71,7 +71,7 @@
|
|||||||
(call $abort
|
(call $abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 72)
|
(i32.const 72)
|
||||||
(i32.const 38)
|
(i32.const 39)
|
||||||
(i32.const 4)
|
(i32.const 4)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -187,7 +187,7 @@
|
|||||||
(call $abort
|
(call $abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 72)
|
(i32.const 72)
|
||||||
(i32.const 166)
|
(i32.const 168)
|
||||||
(i32.const 4)
|
(i32.const 4)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -215,7 +215,7 @@
|
|||||||
(tee_local $5
|
(tee_local $5
|
||||||
(select
|
(select
|
||||||
(tee_local $5
|
(tee_local $5
|
||||||
(get_local $2)
|
(get_local $3)
|
||||||
)
|
)
|
||||||
(tee_local $6
|
(tee_local $6
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
@ -294,7 +294,7 @@
|
|||||||
(call $abort
|
(call $abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 72)
|
(i32.const 72)
|
||||||
(i32.const 103)
|
(i32.const 105)
|
||||||
(i32.const 4)
|
(i32.const 4)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -400,7 +400,7 @@
|
|||||||
(call $abort
|
(call $abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 72)
|
(i32.const 72)
|
||||||
(i32.const 144)
|
(i32.const 145)
|
||||||
(i32.const 4)
|
(i32.const 4)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -466,6 +466,7 @@
|
|||||||
)
|
)
|
||||||
(get_local $4)
|
(get_local $4)
|
||||||
)
|
)
|
||||||
|
(block
|
||||||
(block
|
(block
|
||||||
(if
|
(if
|
||||||
(i32.eqz
|
(i32.eqz
|
||||||
@ -494,6 +495,7 @@
|
|||||||
(get_local $9)
|
(get_local $9)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
(set_local $9
|
(set_local $9
|
||||||
(i32.add
|
(i32.add
|
||||||
(get_local $9)
|
(get_local $9)
|
||||||
@ -1142,7 +1144,7 @@
|
|||||||
(call $abort
|
(call $abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 72)
|
(i32.const 72)
|
||||||
(i32.const 469)
|
(i32.const 493)
|
||||||
(i32.const 10)
|
(i32.const 10)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
|
@ -81,9 +81,9 @@
|
|||||||
(get_local $0)
|
(get_local $0)
|
||||||
(i32.const 20)
|
(i32.const 20)
|
||||||
)
|
)
|
||||||
(i32.mul
|
(i32.shl
|
||||||
(get_local $1)
|
(get_local $1)
|
||||||
(i32.const 4)
|
(i32.const 2)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(get_local $2)
|
(get_local $2)
|
||||||
@ -126,15 +126,15 @@
|
|||||||
(get_local $0)
|
(get_local $0)
|
||||||
(i32.const 112)
|
(i32.const 112)
|
||||||
)
|
)
|
||||||
(i32.mul
|
(i32.shl
|
||||||
(i32.add
|
(i32.add
|
||||||
(i32.mul
|
(i32.shl
|
||||||
(get_local $1)
|
(get_local $1)
|
||||||
(i32.const 32)
|
(i32.const 5)
|
||||||
)
|
)
|
||||||
(get_local $2)
|
(get_local $2)
|
||||||
)
|
)
|
||||||
(i32.const 4)
|
(i32.const 2)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(get_local $3)
|
(get_local $3)
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
"no-trailing-whitespace": true,
|
"no-trailing-whitespace": true,
|
||||||
"no-unbound-method": true,
|
"no-unbound-method": true,
|
||||||
"no-unsafe-any": true,
|
"no-unsafe-any": true,
|
||||||
"no-unused-variable": true,
|
"no-unused-variable": [true, {"ignore-pattern": "^_"}],
|
||||||
"no-void-expression": true,
|
"no-void-expression": true,
|
||||||
"object-literal-shorthand": [ true, "never" ],
|
"object-literal-shorthand": [ true, "never" ],
|
||||||
"prefer-method-signature": true,
|
"prefer-method-signature": true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user