mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-04-26 15:32:16 +00:00
Add a more convenient tracing utility for debugging; Fix basic GC test
This commit is contained in:
parent
f56face188
commit
41ad2f8a70
@ -414,7 +414,8 @@ exports.main = function main(argv, options, callback) {
|
|||||||
// Initialize default aliases
|
// Initialize default aliases
|
||||||
assemblyscript.setGlobalAlias(compilerOptions, "Math", "NativeMath");
|
assemblyscript.setGlobalAlias(compilerOptions, "Math", "NativeMath");
|
||||||
assemblyscript.setGlobalAlias(compilerOptions, "Mathf", "NativeMathf");
|
assemblyscript.setGlobalAlias(compilerOptions, "Mathf", "NativeMathf");
|
||||||
assemblyscript.setGlobalAlias(compilerOptions, "abort", "~lib/env/abort"); // to disable: --use abort=
|
assemblyscript.setGlobalAlias(compilerOptions, "abort", "~lib/env/abort");
|
||||||
|
assemblyscript.setGlobalAlias(compilerOptions, "trace", "~lib/env/trace");
|
||||||
|
|
||||||
// Add or override aliases if specified
|
// Add or override aliases if specified
|
||||||
if (args.use) {
|
if (args.use) {
|
||||||
|
@ -2700,6 +2700,7 @@ export function compileCall(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
compiler.currentType = Type.void;
|
||||||
return exprs.length
|
return exprs.length
|
||||||
? module.createBlock(null, exprs)
|
? module.createBlock(null, exprs)
|
||||||
: module.createNop();
|
: module.createNop();
|
||||||
|
@ -626,8 +626,8 @@ export class Program extends DiagnosticEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// register 'main' if present
|
// register 'main' if present
|
||||||
if (this.elementsLookup.has("main")) {
|
if (this.moduleLevelExports.has("main")) {
|
||||||
let element = <Element>this.elementsLookup.get("main");
|
let element = (<ModuleExport>this.moduleLevelExports.get("main")).element;
|
||||||
if (
|
if (
|
||||||
element.kind == ElementKind.FUNCTION_PROTOTYPE &&
|
element.kind == ElementKind.FUNCTION_PROTOTYPE &&
|
||||||
!(<FunctionPrototype>element).isAny(CommonFlags.GENERIC | CommonFlags.AMBIENT)
|
!(<FunctionPrototype>element).isAny(CommonFlags.GENERIC | CommonFlags.AMBIENT)
|
||||||
|
@ -4,122 +4,15 @@
|
|||||||
* @module std/assembly/collector/itcm
|
* @module std/assembly/collector/itcm
|
||||||
*//***/
|
*//***/
|
||||||
|
|
||||||
// Based on the concepts of Bach Le's μgc, see: https://github.com/bullno1/ugc
|
// Largely based on the Bach Le's μgc, see: https://github.com/bullno1/ugc
|
||||||
|
|
||||||
|
const TRACE = true;
|
||||||
|
|
||||||
import {
|
import {
|
||||||
AL_MASK,
|
AL_MASK,
|
||||||
MAX_SIZE_32
|
MAX_SIZE_32
|
||||||
} from "../internal/allocator";
|
} from "../internal/allocator";
|
||||||
|
|
||||||
// ╒═══════════════ Managed object layout (32-bit) ════════════════╕
|
|
||||||
// 3 2 1
|
|
||||||
// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 bits
|
|
||||||
// ├─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┼─┴─┴─┤ ┐
|
|
||||||
// │ next │ F │ ◄─┐ = nextWithFlags
|
|
||||||
// ├─────────────────────────────────────────────────────────┴─────┤ │ usize
|
|
||||||
// │ prev │ ◄─┘
|
|
||||||
// ╞═══════════════════════════════════════════════════════════════╡ SIZE ┘
|
|
||||||
// │ ... data ... │
|
|
||||||
// └───────────────────────────────────────────────────────────────┘
|
|
||||||
// F: flags
|
|
||||||
|
|
||||||
/** Managed object flags. */
|
|
||||||
namespace Flags {
|
|
||||||
/** Object is unreachable (so far). */
|
|
||||||
export var WHITE = 0;
|
|
||||||
/** Object is reachable. */
|
|
||||||
export var BLACK = 1;
|
|
||||||
/** Object is reachable but its children have not yet been scanned. */
|
|
||||||
export const GRAY = 2;
|
|
||||||
/** Mask to obtain just the flag bits. */
|
|
||||||
export const MASK = AL_MASK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Represents a managed object in memory, consisting of a header followed by the object's data. */
|
|
||||||
@unmanaged
|
|
||||||
class ManagedObject {
|
|
||||||
|
|
||||||
/** Pointer to the next object with additional flags stored in the alignment bits. */
|
|
||||||
nextWithFlags: usize;
|
|
||||||
|
|
||||||
/** Pointer to the previous object. */
|
|
||||||
prev: ManagedObject;
|
|
||||||
|
|
||||||
/** Visitor function called with the data pointer (excl. header). */
|
|
||||||
visitFn: (obj: usize) => void;
|
|
||||||
|
|
||||||
/** Size of a managed object after alignment. */
|
|
||||||
static readonly SIZE: usize = (offsetof<ManagedObject>() + AL_MASK) & ~AL_MASK;
|
|
||||||
|
|
||||||
/** Gets the pointer to the next object in the list. */
|
|
||||||
get next(): ManagedObject {
|
|
||||||
return changetype<ManagedObject>(this.nextWithFlags & ~Flags.MASK);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Sets the pointer to the next object in the list. */
|
|
||||||
set next(obj: ManagedObject) {
|
|
||||||
this.nextWithFlags = changetype<usize>(obj) | (this.nextWithFlags & Flags.MASK);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Inserts an object to this list. */
|
|
||||||
insert(obj: ManagedObject): void {
|
|
||||||
var prev = this.prev;
|
|
||||||
obj.next = this;
|
|
||||||
obj.prev = prev;
|
|
||||||
prev.next = obj;
|
|
||||||
this.prev = obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Removes this object from its list. */
|
|
||||||
remove(): void {
|
|
||||||
var next = this.next;
|
|
||||||
var prev = this.prev;
|
|
||||||
next.prev = prev;
|
|
||||||
prev.next = next;
|
|
||||||
}
|
|
||||||
|
|
||||||
clear(): void {
|
|
||||||
this.nextWithFlags = changetype<usize>(this);
|
|
||||||
this.prev = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Tests if this object is white, that is unreachable (so far). */
|
|
||||||
get isWhite(): bool {
|
|
||||||
return (this.nextWithFlags & Flags.MASK) == Flags.WHITE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Marks this object as white, that is unreachable (so far). */
|
|
||||||
makeWhite(): void {
|
|
||||||
this.nextWithFlags = (this.nextWithFlags & ~Flags.MASK) | Flags.WHITE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Tests if this object is black, that is reachable. Root objects are always reachable. */
|
|
||||||
get isBlack(): bool {
|
|
||||||
return (this.nextWithFlags & Flags.MASK) == Flags.BLACK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Marks this object as black, that is reachable. */
|
|
||||||
makeBlack(): void {
|
|
||||||
this.nextWithFlags = (this.nextWithFlags & ~Flags.MASK) | Flags.BLACK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Tests if this object is gray, that is reachable with unscanned children. */
|
|
||||||
get isGray(): bool {
|
|
||||||
return (this.nextWithFlags & Flags.MASK) == Flags.GRAY;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Marks this object as gray, that is reachable with unscanned children. */
|
|
||||||
makeGray(): void {
|
|
||||||
if (this != iter) {
|
|
||||||
this.remove();
|
|
||||||
set2.insert(this);
|
|
||||||
} else {
|
|
||||||
iter = iter.prev;
|
|
||||||
}
|
|
||||||
this.nextWithFlags = (this.nextWithFlags & ~Flags.MASK) | Flags.GRAY;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Collector states. */
|
/** Collector states. */
|
||||||
const enum State {
|
const enum State {
|
||||||
/** Not yet initialized. */
|
/** Not yet initialized. */
|
||||||
@ -134,64 +27,164 @@ const enum State {
|
|||||||
|
|
||||||
/** Current collector state. */
|
/** Current collector state. */
|
||||||
var state = State.INIT;
|
var state = State.INIT;
|
||||||
|
/** Current white color value. */
|
||||||
|
var white = 0;
|
||||||
|
|
||||||
// From and to spaces
|
// From and to spaces
|
||||||
var set1: ManagedObject;
|
var from: ManagedObject;
|
||||||
var set2: ManagedObject;
|
var to: ManagedObject;
|
||||||
var iter: ManagedObject;
|
var iter: ManagedObject;
|
||||||
|
|
||||||
|
// ╒═══════════════ Managed object layout (32-bit) ════════════════╕
|
||||||
|
// 3 2 1
|
||||||
|
// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 bits
|
||||||
|
// ├─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┼─┴─┴─┤ ┐
|
||||||
|
// │ next │ F │ ◄─┐ = nextWithFlags
|
||||||
|
// ├─────────────────────────────────────────────────────────┴─────┤ │ usize
|
||||||
|
// │ prev │ ◄─┘
|
||||||
|
// ╞═══════════════════════════════════════════════════════════════╡ SIZE ┘
|
||||||
|
// │ ... data ... │
|
||||||
|
// └───────────────────────────────────────────────────────────────┘
|
||||||
|
// F: flags
|
||||||
|
|
||||||
|
/** Represents a managed object in memory, consisting of a header followed by the object's data. */
|
||||||
|
@unmanaged
|
||||||
|
class ManagedObject {
|
||||||
|
|
||||||
|
/** Pointer to the next object with color flags stored in the alignment bits. */
|
||||||
|
nextWithColor: usize;
|
||||||
|
|
||||||
|
/** Pointer to the previous object. */
|
||||||
|
prev: ManagedObject;
|
||||||
|
|
||||||
|
/** Visitor function called with the payload reference. */
|
||||||
|
visitFn: (ref: usize) => void;
|
||||||
|
|
||||||
|
/** Size of a managed object after alignment. */
|
||||||
|
static readonly SIZE: usize = (offsetof<ManagedObject>() + AL_MASK) & ~AL_MASK;
|
||||||
|
|
||||||
|
/** Gets the pointer to the next object in the list. */
|
||||||
|
get next(): ManagedObject {
|
||||||
|
return changetype<ManagedObject>(this.nextWithColor & ~3);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Sets the pointer to the next object in the list. */
|
||||||
|
set next(obj: ManagedObject) {
|
||||||
|
this.nextWithColor = changetype<usize>(obj) | (this.nextWithColor & 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Gets this object's color. */
|
||||||
|
get color(): i32 {
|
||||||
|
return this.nextWithColor & 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Sets this object's color. */
|
||||||
|
set color(color: i32) {
|
||||||
|
this.nextWithColor = (this.nextWithColor & ~3) | color;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Inserts an object to this list. */
|
||||||
|
push(obj: ManagedObject): void {
|
||||||
|
var prev = this.prev;
|
||||||
|
trace(" push", 3, objToRef(prev), objToRef(obj), objToRef(this));
|
||||||
|
obj.next = this;
|
||||||
|
obj.prev = prev;
|
||||||
|
prev.next = obj;
|
||||||
|
this.prev = obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Unlinks this object from its list. */
|
||||||
|
unlink(): void {
|
||||||
|
var next = this.next;
|
||||||
|
var prev = this.prev;
|
||||||
|
if (TRACE) trace(" unlink", 3, objToRef(prev), objToRef(this), objToRef(next));
|
||||||
|
next.prev = prev;
|
||||||
|
prev.next = next;
|
||||||
|
}
|
||||||
|
|
||||||
|
clear(): void {
|
||||||
|
if (TRACE) trace(" clear", 1, objToRef(this));
|
||||||
|
this.nextWithColor = changetype<usize>(this);
|
||||||
|
this.prev = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Marks this object as gray, that is reachable with unscanned children. */
|
||||||
|
makeGray(): void {
|
||||||
|
if (TRACE) trace(" makeGray", 1, objToRef(this));
|
||||||
|
const gray = 2;
|
||||||
|
if (this == iter) iter = this.prev;
|
||||||
|
this.unlink();
|
||||||
|
to.push(this);
|
||||||
|
this.nextWithColor = (this.nextWithColor & ~3) | gray;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function markRoots(): void {
|
||||||
|
if (TRACE) trace(" markRoots");
|
||||||
|
gc.iterateRoots(function markRoot(ref: usize): void {
|
||||||
|
if (TRACE) trace(" markRoot", 1, ref);
|
||||||
|
if (ref) __gc_mark(ref);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/** Performs a single step according to the current state. */
|
/** Performs a single step according to the current state. */
|
||||||
function step(): void {
|
function step(): void {
|
||||||
var obj: ManagedObject;
|
var obj: ManagedObject;
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case State.INIT: {
|
case State.INIT: {
|
||||||
set1 = changetype<ManagedObject>(memory.allocate(ManagedObject.SIZE));
|
if (TRACE) trace("gc~step/INIT");
|
||||||
set1.clear();
|
from = changetype<ManagedObject>(memory.allocate(ManagedObject.SIZE));
|
||||||
set2 = changetype<ManagedObject>(memory.allocate(ManagedObject.SIZE));
|
from.visitFn = changetype<(ref: usize) => void>(<u32>-1); // would error
|
||||||
set2.clear();
|
from.clear();
|
||||||
iter = set2;
|
to = changetype<ManagedObject>(memory.allocate(ManagedObject.SIZE));
|
||||||
|
to.visitFn = changetype<(ref: usize) => void>(<u32>-1); // would error
|
||||||
|
to.clear();
|
||||||
|
iter = to;
|
||||||
|
state = State.IDLE;
|
||||||
|
if (TRACE) trace("gc~state = IDLE");
|
||||||
// fall-through
|
// fall-through
|
||||||
}
|
}
|
||||||
case State.IDLE: {
|
case State.IDLE: {
|
||||||
// start by marking roots
|
if (TRACE) trace("gc~step/IDLE");
|
||||||
gc.iterateRoots(function mark_root(ref: usize): void {
|
markRoots();
|
||||||
if (ref) {
|
|
||||||
let obj = changetype<ManagedObject>(ref - ManagedObject.SIZE);
|
|
||||||
obj.makeBlack();
|
|
||||||
obj.visitFn(ref);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
state = State.MARK;
|
state = State.MARK;
|
||||||
|
if (TRACE) trace("gc~state = MARK");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case State.MARK: {
|
case State.MARK: {
|
||||||
obj = iter.next;
|
obj = iter.next;
|
||||||
if (obj != set2) {
|
if (obj !== to) {
|
||||||
|
if (TRACE) trace("gc~step/MARK iterate", 1, objToRef(obj));
|
||||||
iter = obj;
|
iter = obj;
|
||||||
obj.makeBlack();
|
obj.color = <i32>!white;
|
||||||
obj.visitFn(changetype<usize>(obj) + ManagedObject.SIZE);
|
obj.visitFn(objToRef(obj));
|
||||||
} else {
|
} else {
|
||||||
|
if (TRACE) trace("gc~step/MARK finish");
|
||||||
|
markRoots();
|
||||||
obj = iter.next;
|
obj = iter.next;
|
||||||
if (obj == set2) {
|
if (obj === to) {
|
||||||
let set1_ = set1;
|
let prevFrom = from;
|
||||||
set1 = set2;
|
from = to;
|
||||||
set2 = set1_;
|
to = prevFrom;
|
||||||
Flags.WHITE ^= 1;
|
white = <i32>!white;
|
||||||
Flags.BLACK ^= 1;
|
iter = prevFrom.next;
|
||||||
iter = set1.next;
|
|
||||||
state = State.SWEEP;
|
state = State.SWEEP;
|
||||||
|
if (TRACE) trace("gc~state = SWEEP");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case State.SWEEP: {
|
case State.SWEEP: {
|
||||||
obj = iter;
|
obj = iter;
|
||||||
if (obj !== set2) {
|
if (obj !== to) {
|
||||||
|
if (TRACE) trace("gc~step/SWEEP free", 1, objToRef(obj));
|
||||||
iter = obj.next;
|
iter = obj.next;
|
||||||
memory.free(changetype<usize>(obj));
|
memory.free(changetype<usize>(obj));
|
||||||
} else {
|
} else {
|
||||||
set2.clear();
|
if (TRACE) trace("gc~step/SWEEP finish");
|
||||||
|
to.clear();
|
||||||
state = State.IDLE;
|
state = State.IDLE;
|
||||||
|
if (TRACE) trace("gc~state = IDLE");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -213,30 +206,33 @@ function step(): void {
|
|||||||
size: usize,
|
size: usize,
|
||||||
visitFn: (ref: usize) => void
|
visitFn: (ref: usize) => void
|
||||||
): usize {
|
): usize {
|
||||||
assert(size <= MAX_SIZE_32 - ManagedObject.SIZE);
|
if (TRACE) trace("gc.allocate", 1, size);
|
||||||
|
if (size > MAX_SIZE_32 - ManagedObject.SIZE) unreachable();
|
||||||
|
step(); // also makes sure it's initialized
|
||||||
var obj = changetype<ManagedObject>(memory.allocate(ManagedObject.SIZE + size));
|
var obj = changetype<ManagedObject>(memory.allocate(ManagedObject.SIZE + size));
|
||||||
obj.makeWhite();
|
|
||||||
obj.visitFn = visitFn;
|
obj.visitFn = visitFn;
|
||||||
set1.insert(obj);
|
obj.color = white;
|
||||||
|
from.push(obj);
|
||||||
return objToRef(obj);
|
return objToRef(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Marks a reachable object. Called from the visitFn functions. */
|
/** Marks a reachable object. Called from the visitFn functions. */
|
||||||
@global export function __gc_mark(ref: usize): void {
|
@global export function __gc_mark(ref: usize): void {
|
||||||
|
if (TRACE) trace("gc.mark", 1, ref);
|
||||||
var obj = refToObj(ref);
|
var obj = refToObj(ref);
|
||||||
if (state == State.SWEEP) return;
|
if (obj.color == white) obj.makeGray();
|
||||||
if (obj.isWhite) obj.makeGray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Links a managed child object to its parent object. */
|
/** Links a managed child object to its parent object. */
|
||||||
@global export function __gc_link(parentRef: usize, childRef: usize): void {
|
@global export function __gc_link(parentRef: usize, childRef: usize): void {
|
||||||
|
if (TRACE) trace("gc.link", 2, parentRef, childRef);
|
||||||
var parent = refToObj(parentRef);
|
var parent = refToObj(parentRef);
|
||||||
var child = refToObj(childRef);
|
if (parent.color == <i32>!white && refToObj(childRef).color == white) parent.makeGray();
|
||||||
if (parent.isBlack && child.isWhite) parent.makeGray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Performs a full garbage collection cycle. */
|
/** Performs a full garbage collection cycle. */
|
||||||
@global export function __gc_collect(): void {
|
@global export function __gc_collect(): void {
|
||||||
|
if (TRACE) trace("gc.collect");
|
||||||
// begin collecting if not yet collecting
|
// begin collecting if not yet collecting
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case State.INIT:
|
case State.INIT:
|
||||||
|
@ -1,7 +1,16 @@
|
|||||||
/** Environment abort function called where assertions evaluate to false / on throw. */
|
|
||||||
declare function abort(
|
declare function abort(
|
||||||
message?: string | null,
|
message?: string | null,
|
||||||
fileName?: string | null,
|
fileName?: string | null,
|
||||||
lineNumber?: u32,
|
lineNumber?: u32,
|
||||||
columnNumber?: u32
|
columnNumber?: u32
|
||||||
): void;
|
): void;
|
||||||
|
|
||||||
|
declare function trace(
|
||||||
|
message: string,
|
||||||
|
n?: i32,
|
||||||
|
a0?: f64,
|
||||||
|
a1?: f64,
|
||||||
|
a2?: f64,
|
||||||
|
a3?: f64,
|
||||||
|
a4?: f64
|
||||||
|
): void;
|
||||||
|
@ -9,19 +9,19 @@ export namespace gc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function mark(ref: usize): void {
|
export function mark(ref: usize): void {
|
||||||
if (isDefined(__gc_mark)) return __gc_mark(ref); // tslint:disable-line
|
if (isDefined(__gc_mark)) { __gc_mark(ref); return; } // tslint:disable-line
|
||||||
WARNING("Calling 'gc.mark' requires a garbage collector to be present.");
|
WARNING("Calling 'gc.mark' requires a garbage collector to be present.");
|
||||||
unreachable();
|
unreachable();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function link(parentRef: usize, childRef: usize): void {
|
export function link(parentRef: usize, childRef: usize): void {
|
||||||
if (isDefined(__gc_link)) return __gc_link(parentRef, childRef); // tslint:disable-line
|
if (isDefined(__gc_link)) { __gc_link(parentRef, childRef); return; } // tslint:disable-line
|
||||||
WARNING("Calling 'gc.link' requires a garbage collector to be present.");
|
WARNING("Calling 'gc.link' requires a garbage collector to be present.");
|
||||||
unreachable();
|
unreachable();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function collect(): void {
|
export function collect(): void {
|
||||||
if (isDefined(__gc_collect)) return __gc_collect(); // tslint:disable-line
|
if (isDefined(__gc_collect)) { __gc_collect(); return; } // tslint:disable-line
|
||||||
WARNING("Calling 'gc.collect' requires a garbage collector to be present.");
|
WARNING("Calling 'gc.collect' requires a garbage collector to be present.");
|
||||||
unreachable();
|
unreachable();
|
||||||
}
|
}
|
||||||
|
3
std/assembly/index.d.ts
vendored
3
std/assembly/index.d.ts
vendored
@ -654,6 +654,9 @@ declare const Math: IMath<f64>;
|
|||||||
/** Alias of {@link NativeMathf} or {@link JSMath} respectively. Defaults to `NativeMathf`. */
|
/** Alias of {@link NativeMathf} or {@link JSMath} respectively. Defaults to `NativeMathf`. */
|
||||||
declare const Mathf: IMath<f32>;
|
declare const Mathf: IMath<f32>;
|
||||||
|
|
||||||
|
/** Environmental tracing function for debugging purposes. */
|
||||||
|
declare function trace(msg: string, n?: i32, a0?: f64, a1?: f64, a2?: f64, a3?: f64, a4?: f64): void;
|
||||||
|
|
||||||
// Decorators
|
// Decorators
|
||||||
|
|
||||||
/** Annotates an element as a program global. */
|
/** Annotates an element as a program global. */
|
||||||
|
@ -153,16 +153,40 @@ tests.forEach(filename => {
|
|||||||
|
|
||||||
// Instantiate
|
// Instantiate
|
||||||
try {
|
try {
|
||||||
|
let memory = new WebAssembly.Memory({ initial: 10 });
|
||||||
|
let exports = {};
|
||||||
|
|
||||||
|
function getString(ptr) {
|
||||||
|
if (!ptr) return "null";
|
||||||
|
var U32 = new Uint32Array(exports.memory ? exports.memory.buffer : memory.buffer);
|
||||||
|
var U16 = new Uint16Array(exports.memory ? exports.memory.buffer : memory.buffer);
|
||||||
|
var dataLength = U32[ptr >>> 2];
|
||||||
|
var dataOffset = (ptr + 4) >>> 1;
|
||||||
|
var dataRemain = dataLength;
|
||||||
|
var parts = [];
|
||||||
|
const chunkSize = 1024;
|
||||||
|
while (dataRemain > chunkSize) {
|
||||||
|
let last = U16[dataOffset + chunkSize - 1];
|
||||||
|
let size = last >= 0xD800 && last < 0xDC00 ? chunkSize - 1 : chunkSize;
|
||||||
|
let part = U16.subarray(dataOffset, dataOffset += size);
|
||||||
|
parts.push(String.fromCharCode.apply(String, part));
|
||||||
|
dataRemain -= size;
|
||||||
|
}
|
||||||
|
return parts.join("") + String.fromCharCode.apply(String, U16.subarray(dataOffset, dataOffset + dataRemain));
|
||||||
|
}
|
||||||
|
|
||||||
let runTime = asc.measure(() => {
|
let runTime = asc.measure(() => {
|
||||||
let exports = new WebAssembly.Instance(new WebAssembly.Module(stdout.toBuffer()), {
|
exports = new WebAssembly.Instance(new WebAssembly.Module(stdout.toBuffer()), {
|
||||||
env: {
|
env: {
|
||||||
|
memory,
|
||||||
abort: function(msg, file, line, column) {
|
abort: function(msg, file, line, column) {
|
||||||
console.log("abort called at " + line + ":" + column);
|
console.log(colorsUtil.red(" abort: " + getString(msg) + " at " + getString(file) + ":" + line + ":" + column));
|
||||||
|
},
|
||||||
|
trace: function(msg, n) {
|
||||||
|
console.log(" " + getString(msg) + (n ? " " : "") + Array.prototype.slice.call(arguments, 2, 2 + n).join(", "));
|
||||||
},
|
},
|
||||||
externalFunction: function() { },
|
externalFunction: function() { },
|
||||||
externalConstant: 1,
|
externalConstant: 1
|
||||||
logi: function(i) { console.log("logi: " + i); },
|
|
||||||
logf: function(f) { console.log("logf: " + f); }
|
|
||||||
},
|
},
|
||||||
JSOp: {
|
JSOp: {
|
||||||
mod: function(a, b) { return a % b; }
|
mod: function(a, b) { return a % b; }
|
||||||
@ -188,10 +212,16 @@ tests.forEach(filename => {
|
|||||||
bar: function() {},
|
bar: function() {},
|
||||||
baz: function() {},
|
baz: function() {},
|
||||||
"var": 3
|
"var": 3
|
||||||
},
|
}
|
||||||
});
|
}).exports;
|
||||||
|
if (exports.main) {
|
||||||
|
console.log(colorsUtil.white(" [main]"));
|
||||||
|
var code = exports.main();
|
||||||
|
console.log(colorsUtil.white(" [exit " + code + "]\n"));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
console.log("- " + colorsUtil.green("instantiate OK") + " (" + asc.formatTime(runTime) + ")");
|
console.log("- " + colorsUtil.green("instantiate OK") + " (" + asc.formatTime(runTime) + ")");
|
||||||
|
console.log("\n " + Object.keys(exports).map(key => "[" + (typeof exports[key]).substring(0, 3) + "] " + key).join("\n "));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log("- " + colorsUtil.red("instantiate ERROR: ") + e.stack);
|
console.log("- " + colorsUtil.red("instantiate ERROR: ") + e.stack);
|
||||||
failed = true;
|
failed = true;
|
||||||
|
@ -2,11 +2,22 @@
|
|||||||
(type $iii (func (param i32 i32) (result i32)))
|
(type $iii (func (param i32 i32) (result i32)))
|
||||||
(type $v (func))
|
(type $v (func))
|
||||||
(global $main/code (mut i32) (i32.const 0))
|
(global $main/code (mut i32) (i32.const 0))
|
||||||
|
(global $~started (mut i32) (i32.const 0))
|
||||||
(memory $0 0)
|
(memory $0 0)
|
||||||
(export "memory" (memory $0))
|
(export "memory" (memory $0))
|
||||||
(export "main" (func $main/main))
|
(export "main" (func $main/main))
|
||||||
(start $start)
|
|
||||||
(func $main/main (; 0 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
(func $main/main (; 0 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||||
|
(if
|
||||||
|
(i32.eqz
|
||||||
|
(get_global $~started)
|
||||||
|
)
|
||||||
|
(block
|
||||||
|
(call $start)
|
||||||
|
(set_global $~started
|
||||||
|
(i32.const 1)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
(get_global $main/code)
|
(get_global $main/code)
|
||||||
)
|
)
|
||||||
(func $start (; 1 ;) (type $v)
|
(func $start (; 1 ;) (type $v)
|
||||||
|
@ -2,12 +2,23 @@
|
|||||||
(type $iii (func (param i32 i32) (result i32)))
|
(type $iii (func (param i32 i32) (result i32)))
|
||||||
(type $v (func))
|
(type $v (func))
|
||||||
(global $main/code (mut i32) (i32.const 0))
|
(global $main/code (mut i32) (i32.const 0))
|
||||||
|
(global $~started (mut i32) (i32.const 0))
|
||||||
(global $HEAP_BASE i32 (i32.const 8))
|
(global $HEAP_BASE i32 (i32.const 8))
|
||||||
(memory $0 0)
|
(memory $0 0)
|
||||||
(export "memory" (memory $0))
|
(export "memory" (memory $0))
|
||||||
(export "main" (func $main/main))
|
(export "main" (func $main/main))
|
||||||
(start $start)
|
|
||||||
(func $main/main (; 0 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
(func $main/main (; 0 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||||
|
(if
|
||||||
|
(i32.eqz
|
||||||
|
(get_global $~started)
|
||||||
|
)
|
||||||
|
(block
|
||||||
|
(call $start)
|
||||||
|
(set_global $~started
|
||||||
|
(i32.const 1)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
(get_global $main/code)
|
(get_global $main/code)
|
||||||
)
|
)
|
||||||
(func $start (; 1 ;) (type $v)
|
(func $start (; 1 ;) (type $v)
|
||||||
|
@ -1,30 +1,54 @@
|
|||||||
(module
|
(module
|
||||||
(type $iv (func (param i32)))
|
(type $iv (func (param i32)))
|
||||||
(type $iii (func (param i32 i32) (result i32)))
|
(type $iii (func (param i32 i32) (result i32)))
|
||||||
(type $iiiiv (func (param i32 i32 i32 i32)))
|
(type $iiFFFFFv (func (param i32 i32 f64 f64 f64 f64 f64)))
|
||||||
|
(type $v (func))
|
||||||
(type $ii (func (param i32) (result i32)))
|
(type $ii (func (param i32) (result i32)))
|
||||||
(type $iiv (func (param i32 i32)))
|
(type $iiv (func (param i32 i32)))
|
||||||
(type $v (func))
|
(type $iiiiv (func (param i32 i32 i32 i32)))
|
||||||
|
(type $i (func (result i32)))
|
||||||
|
(import "env" "trace" (func $~lib/env/trace (param i32 i32 f64 f64 f64 f64 f64)))
|
||||||
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
|
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
|
||||||
(global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0))
|
(global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0))
|
||||||
(global $~lib/allocator/arena/offset (mut i32) (i32.const 0))
|
(global $~lib/allocator/arena/offset (mut i32) (i32.const 0))
|
||||||
(global $~lib/collector/itcm/state (mut i32) (i32.const 0))
|
(global $~lib/collector/itcm/state (mut i32) (i32.const 0))
|
||||||
(global $~lib/collector/itcm/set1 (mut i32) (i32.const 0))
|
(global $~lib/collector/itcm/white (mut i32) (i32.const 0))
|
||||||
(global $~lib/collector/itcm/Flags.WHITE (mut i32) (i32.const 0))
|
(global $~lib/collector/itcm/from (mut i32) (i32.const 0))
|
||||||
|
(global $~lib/collector/itcm/to (mut i32) (i32.const 0))
|
||||||
|
(global $~lib/collector/itcm/iter (mut i32) (i32.const 0))
|
||||||
|
(global $~argc (mut i32) (i32.const 0))
|
||||||
(global $std/gc/obj (mut i32) (i32.const 0))
|
(global $std/gc/obj (mut i32) (i32.const 0))
|
||||||
(global $std/gc/head (mut i32) (i32.const 0))
|
(global $std/gc/head (mut i32) (i32.const 0))
|
||||||
(table 1 1 anyfunc)
|
(global $~started (mut i32) (i32.const 0))
|
||||||
(elem (i32.const 0) $std/gc/MyObject_visit)
|
(table 2 2 anyfunc)
|
||||||
|
(elem (i32.const 0) $std/gc/MyObject_visit $~lib/collector/itcm/markRoots~markRoot|1)
|
||||||
(memory $0 1)
|
(memory $0 1)
|
||||||
(data (i32.const 8) "\16\00\00\00~\00l\00i\00b\00/\00c\00o\00l\00l\00e\00c\00t\00o\00r\00/\00i\00t\00c\00m\00.\00t\00s")
|
(data (i32.const 8) "\0b\00\00\00g\00c\00.\00a\00l\00l\00o\00c\00a\00t\00e")
|
||||||
(data (i32.const 56) "\t\00\00\00s\00t\00d\00/\00g\00c\00.\00t\00s")
|
(data (i32.const 36) "\0c\00\00\00g\00c\00~\00s\00t\00e\00p\00/\00I\00N\00I\00T")
|
||||||
|
(data (i32.const 64) "\08\00\00\00 \00 \00 \00c\00l\00e\00a\00r")
|
||||||
|
(data (i32.const 84) "\0f\00\00\00g\00c\00~\00s\00t\00a\00t\00e\00 \00=\00 \00I\00D\00L\00E")
|
||||||
|
(data (i32.const 120) "\0c\00\00\00g\00c\00~\00s\00t\00e\00p\00/\00I\00D\00L\00E")
|
||||||
|
(data (i32.const 148) "\0c\00\00\00 \00 \00 \00m\00a\00r\00k\00R\00o\00o\00t\00s")
|
||||||
|
(data (i32.const 176) "\0b\00\00\00 \00 \00 \00m\00a\00r\00k\00R\00o\00o\00t")
|
||||||
|
(data (i32.const 204) "\07\00\00\00g\00c\00.\00m\00a\00r\00k")
|
||||||
|
(data (i32.const 224) "\0b\00\00\00 \00 \00 \00m\00a\00k\00e\00G\00r\00a\00y")
|
||||||
|
(data (i32.const 252) "\t\00\00\00 \00 \00 \00u\00n\00l\00i\00n\00k")
|
||||||
|
(data (i32.const 276) "\07\00\00\00 \00 \00 \00p\00u\00s\00h")
|
||||||
|
(data (i32.const 296) "\0f\00\00\00g\00c\00~\00s\00t\00a\00t\00e\00 \00=\00 \00M\00A\00R\00K")
|
||||||
|
(data (i32.const 332) "\14\00\00\00g\00c\00~\00s\00t\00e\00p\00/\00M\00A\00R\00K\00 \00i\00t\00e\00r\00a\00t\00e")
|
||||||
|
(data (i32.const 376) "\13\00\00\00g\00c\00~\00s\00t\00e\00p\00/\00M\00A\00R\00K\00 \00f\00i\00n\00i\00s\00h")
|
||||||
|
(data (i32.const 420) "\10\00\00\00g\00c\00~\00s\00t\00a\00t\00e\00 \00=\00 \00S\00W\00E\00E\00P")
|
||||||
|
(data (i32.const 456) "\12\00\00\00g\00c\00~\00s\00t\00e\00p\00/\00S\00W\00E\00E\00P\00 \00f\00r\00e\00e")
|
||||||
|
(data (i32.const 496) "\14\00\00\00g\00c\00~\00s\00t\00e\00p\00/\00S\00W\00E\00E\00P\00 \00f\00i\00n\00i\00s\00h")
|
||||||
|
(data (i32.const 540) "\t\00\00\00s\00t\00d\00/\00g\00c\00.\00t\00s")
|
||||||
|
(data (i32.const 564) "\n\00\00\00g\00c\00.\00c\00o\00l\00l\00e\00c\00t")
|
||||||
(export "memory" (memory $0))
|
(export "memory" (memory $0))
|
||||||
(export "table" (table $0))
|
(export "table" (table $0))
|
||||||
(start $start)
|
(export "main" (func $std/gc/main))
|
||||||
(func $std/gc/MyObject_visit (; 1 ;) (type $iv) (param $0 i32)
|
(func $std/gc/MyObject_visit (; 2 ;) (type $iv) (param $0 i32)
|
||||||
(nop)
|
(nop)
|
||||||
)
|
)
|
||||||
(func $~lib/allocator/arena/__memory_allocate (; 2 ;) (type $ii) (param $0 i32) (result i32)
|
(func $~lib/allocator/arena/__memory_allocate (; 3 ;) (type $ii) (param $0 i32) (result i32)
|
||||||
(local $1 i32)
|
(local $1 i32)
|
||||||
(local $2 i32)
|
(local $2 i32)
|
||||||
(local $3 i32)
|
(local $3 i32)
|
||||||
@ -110,26 +134,52 @@
|
|||||||
)
|
)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(func $~lib/memory/memory.allocate (; 3 ;) (type $ii) (param $0 i32) (result i32)
|
(func $~lib/memory/memory.allocate (; 4 ;) (type $ii) (param $0 i32) (result i32)
|
||||||
(call $~lib/allocator/arena/__memory_allocate
|
(call $~lib/allocator/arena/__memory_allocate
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(func $~lib/collector/itcm/ManagedObject#makeWhite (; 4 ;) (type $iv) (param $0 i32)
|
(func $~lib/collector/itcm/ManagedObject#clear (; 5 ;) (type $iv) (param $0 i32)
|
||||||
|
(call $~lib/env/trace
|
||||||
|
(i32.const 64)
|
||||||
|
(i32.const 1)
|
||||||
|
(f64.convert_u/i32
|
||||||
|
(i32.add
|
||||||
|
(get_local $0)
|
||||||
|
(i32.const 16)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
)
|
||||||
(i32.store
|
(i32.store
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
(i32.or
|
(get_local $0)
|
||||||
|
)
|
||||||
|
(i32.store offset=4
|
||||||
|
(get_local $0)
|
||||||
|
(get_local $0)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(func $~lib/collector/itcm/ManagedObject#get:color (; 6 ;) (type $ii) (param $0 i32) (result i32)
|
||||||
(i32.and
|
(i32.and
|
||||||
(i32.load
|
(i32.load
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
)
|
)
|
||||||
(i32.const -8)
|
(i32.const 3)
|
||||||
)
|
|
||||||
(get_global $~lib/collector/itcm/Flags.WHITE)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
(func $~lib/collector/itcm/ManagedObject#get:next (; 7 ;) (type $ii) (param $0 i32) (result i32)
|
||||||
|
(i32.and
|
||||||
|
(i32.load
|
||||||
|
(get_local $0)
|
||||||
)
|
)
|
||||||
(func $~lib/collector/itcm/ManagedObject#set:next (; 5 ;) (type $iiv) (param $0 i32) (param $1 i32)
|
(i32.const -4)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(func $~lib/collector/itcm/ManagedObject#set:next (; 8 ;) (type $iiv) (param $0 i32) (param $1 i32)
|
||||||
(i32.store
|
(i32.store
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
(i32.or
|
(i32.or
|
||||||
@ -138,21 +188,46 @@
|
|||||||
(i32.load
|
(i32.load
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
)
|
)
|
||||||
(i32.const 7)
|
(i32.const 3)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(func $~lib/collector/itcm/ManagedObject#insert (; 6 ;) (type $iiv) (param $0 i32) (param $1 i32)
|
(func $~lib/collector/itcm/ManagedObject#unlink (; 9 ;) (type $iv) (param $0 i32)
|
||||||
|
(local $1 i32)
|
||||||
(local $2 i32)
|
(local $2 i32)
|
||||||
(set_local $2
|
(set_local $1
|
||||||
|
(call $~lib/collector/itcm/ManagedObject#get:next
|
||||||
|
(get_local $0)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(call $~lib/env/trace
|
||||||
|
(i32.const 252)
|
||||||
|
(i32.const 3)
|
||||||
|
(f64.convert_u/i32
|
||||||
|
(i32.add
|
||||||
|
(tee_local $2
|
||||||
(i32.load offset=4
|
(i32.load offset=4
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(call $~lib/collector/itcm/ManagedObject#set:next
|
(i32.const 16)
|
||||||
(get_local $1)
|
)
|
||||||
|
)
|
||||||
|
(f64.convert_u/i32
|
||||||
|
(i32.add
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
|
(i32.const 16)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(f64.convert_u/i32
|
||||||
|
(i32.add
|
||||||
|
(get_local $1)
|
||||||
|
(i32.const 16)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
)
|
)
|
||||||
(i32.store offset=4
|
(i32.store offset=4
|
||||||
(get_local $1)
|
(get_local $1)
|
||||||
@ -162,29 +237,462 @@
|
|||||||
(get_local $2)
|
(get_local $2)
|
||||||
(get_local $1)
|
(get_local $1)
|
||||||
)
|
)
|
||||||
(i32.store offset=4
|
|
||||||
(get_local $0)
|
|
||||||
(get_local $1)
|
|
||||||
)
|
)
|
||||||
)
|
(func $~lib/collector/itcm/ManagedObject#push (; 10 ;) (type $iiv) (param $0 i32) (param $1 i32)
|
||||||
(func $~lib/collector/itcm/__gc_allocate (; 7 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
|
||||||
(local $2 i32)
|
(local $2 i32)
|
||||||
|
(call $~lib/env/trace
|
||||||
|
(i32.const 276)
|
||||||
|
(i32.const 3)
|
||||||
|
(f64.convert_u/i32
|
||||||
|
(i32.add
|
||||||
|
(tee_local $2
|
||||||
|
(i32.load offset=4
|
||||||
|
(get_local $0)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(i32.const 16)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(f64.convert_u/i32
|
||||||
|
(i32.add
|
||||||
|
(get_local $1)
|
||||||
|
(i32.const 16)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(f64.convert_u/i32
|
||||||
|
(i32.add
|
||||||
|
(get_local $0)
|
||||||
|
(i32.const 16)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
)
|
||||||
|
(call $~lib/collector/itcm/ManagedObject#set:next
|
||||||
|
(get_local $1)
|
||||||
|
(get_local $0)
|
||||||
|
)
|
||||||
|
(i32.store offset=4
|
||||||
|
(get_local $1)
|
||||||
|
(get_local $2)
|
||||||
|
)
|
||||||
|
(call $~lib/collector/itcm/ManagedObject#set:next
|
||||||
|
(get_local $2)
|
||||||
|
(get_local $1)
|
||||||
|
)
|
||||||
|
(i32.store offset=4
|
||||||
|
(get_local $0)
|
||||||
|
(get_local $1)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(func $~lib/collector/itcm/ManagedObject#makeGray (; 11 ;) (type $iv) (param $0 i32)
|
||||||
|
(call $~lib/env/trace
|
||||||
|
(i32.const 224)
|
||||||
|
(i32.const 1)
|
||||||
|
(f64.convert_u/i32
|
||||||
|
(i32.add
|
||||||
|
(get_local $0)
|
||||||
|
(i32.const 16)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
)
|
||||||
|
(if
|
||||||
|
(i32.eq
|
||||||
|
(get_local $0)
|
||||||
|
(get_global $~lib/collector/itcm/iter)
|
||||||
|
)
|
||||||
|
(set_global $~lib/collector/itcm/iter
|
||||||
|
(i32.load offset=4
|
||||||
|
(get_local $0)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(call $~lib/collector/itcm/ManagedObject#unlink
|
||||||
|
(get_local $0)
|
||||||
|
)
|
||||||
|
(call $~lib/collector/itcm/ManagedObject#push
|
||||||
|
(get_global $~lib/collector/itcm/to)
|
||||||
|
(get_local $0)
|
||||||
|
)
|
||||||
|
(i32.store
|
||||||
|
(get_local $0)
|
||||||
|
(i32.or
|
||||||
|
(i32.and
|
||||||
|
(i32.load
|
||||||
|
(get_local $0)
|
||||||
|
)
|
||||||
|
(i32.const -4)
|
||||||
|
)
|
||||||
|
(i32.const 2)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(func $~lib/collector/itcm/__gc_mark (; 12 ;) (type $iv) (param $0 i32)
|
||||||
|
(local $1 i32)
|
||||||
|
(call $~lib/env/trace
|
||||||
|
(i32.const 204)
|
||||||
|
(i32.const 1)
|
||||||
|
(f64.convert_u/i32
|
||||||
|
(get_local $0)
|
||||||
|
)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
)
|
||||||
|
(if
|
||||||
|
(i32.eq
|
||||||
|
(call $~lib/collector/itcm/ManagedObject#get:color
|
||||||
|
(tee_local $1
|
||||||
|
(i32.sub
|
||||||
|
(get_local $0)
|
||||||
|
(i32.const 16)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(get_global $~lib/collector/itcm/white)
|
||||||
|
)
|
||||||
|
(call $~lib/collector/itcm/ManagedObject#makeGray
|
||||||
|
(get_local $1)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(func $~lib/collector/itcm/markRoots~markRoot|1 (; 13 ;) (type $iv) (param $0 i32)
|
||||||
|
(call $~lib/env/trace
|
||||||
|
(i32.const 176)
|
||||||
|
(i32.const 1)
|
||||||
|
(f64.convert_u/i32
|
||||||
|
(get_local $0)
|
||||||
|
)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
)
|
||||||
|
(if
|
||||||
|
(get_local $0)
|
||||||
|
(call $~lib/collector/itcm/__gc_mark
|
||||||
|
(get_local $0)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(func $~lib/collector/itcm/markRoots (; 14 ;) (type $v)
|
||||||
|
(call $~lib/env/trace
|
||||||
|
(i32.const 148)
|
||||||
|
(i32.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
)
|
||||||
|
(call_indirect (type $iv)
|
||||||
|
(get_global $std/gc/obj)
|
||||||
|
(i32.const 1)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(func $~lib/collector/itcm/ManagedObject#set:color (; 15 ;) (type $iiv) (param $0 i32) (param $1 i32)
|
||||||
|
(i32.store
|
||||||
|
(get_local $0)
|
||||||
|
(i32.or
|
||||||
|
(i32.and
|
||||||
|
(i32.load
|
||||||
|
(get_local $0)
|
||||||
|
)
|
||||||
|
(i32.const -4)
|
||||||
|
)
|
||||||
|
(get_local $1)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(func $~lib/memory/memory.free (; 16 ;) (type $iv) (param $0 i32)
|
||||||
|
(call $std/gc/MyObject_visit
|
||||||
|
(get_local $0)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(func $~lib/collector/itcm/step (; 17 ;) (type $v)
|
||||||
|
(local $0 i32)
|
||||||
|
(block $break|0
|
||||||
|
(block $case3|0
|
||||||
|
(block $case2|0
|
||||||
|
(block $case1|0
|
||||||
|
(if
|
||||||
|
(tee_local $0
|
||||||
|
(get_global $~lib/collector/itcm/state)
|
||||||
|
)
|
||||||
|
(block
|
||||||
|
(block $tablify|0
|
||||||
|
(br_table $case1|0 $case2|0 $case3|0 $tablify|0
|
||||||
|
(i32.sub
|
||||||
|
(get_local $0)
|
||||||
|
(i32.const 1)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(br $break|0)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(call $~lib/env/trace
|
||||||
|
(i32.const 36)
|
||||||
|
(i32.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
)
|
||||||
|
(set_global $~lib/collector/itcm/from
|
||||||
|
(call $~lib/memory/memory.allocate
|
||||||
|
(i32.const 16)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(i32.store offset=8
|
||||||
|
(get_global $~lib/collector/itcm/from)
|
||||||
|
(i32.const -1)
|
||||||
|
)
|
||||||
|
(call $~lib/collector/itcm/ManagedObject#clear
|
||||||
|
(get_global $~lib/collector/itcm/from)
|
||||||
|
)
|
||||||
|
(set_global $~lib/collector/itcm/to
|
||||||
|
(call $~lib/memory/memory.allocate
|
||||||
|
(i32.const 16)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(i32.store offset=8
|
||||||
|
(get_global $~lib/collector/itcm/to)
|
||||||
|
(i32.const -1)
|
||||||
|
)
|
||||||
|
(call $~lib/collector/itcm/ManagedObject#clear
|
||||||
|
(get_global $~lib/collector/itcm/to)
|
||||||
|
)
|
||||||
|
(set_global $~lib/collector/itcm/iter
|
||||||
|
(get_global $~lib/collector/itcm/to)
|
||||||
|
)
|
||||||
|
(set_global $~lib/collector/itcm/state
|
||||||
|
(i32.const 1)
|
||||||
|
)
|
||||||
|
(call $~lib/env/trace
|
||||||
|
(i32.const 84)
|
||||||
|
(i32.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(call $~lib/env/trace
|
||||||
|
(i32.const 120)
|
||||||
|
(i32.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
)
|
||||||
|
(call $~lib/collector/itcm/markRoots)
|
||||||
|
(set_global $~lib/collector/itcm/state
|
||||||
|
(i32.const 2)
|
||||||
|
)
|
||||||
|
(call $~lib/env/trace
|
||||||
|
(i32.const 296)
|
||||||
|
(i32.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
)
|
||||||
|
(br $break|0)
|
||||||
|
)
|
||||||
|
(if
|
||||||
|
(i32.ne
|
||||||
|
(tee_local $0
|
||||||
|
(call $~lib/collector/itcm/ManagedObject#get:next
|
||||||
|
(get_global $~lib/collector/itcm/iter)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(get_global $~lib/collector/itcm/to)
|
||||||
|
)
|
||||||
|
(block
|
||||||
|
(call $~lib/env/trace
|
||||||
|
(i32.const 332)
|
||||||
|
(i32.const 1)
|
||||||
|
(f64.convert_u/i32
|
||||||
|
(i32.add
|
||||||
|
(get_local $0)
|
||||||
|
(i32.const 16)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
)
|
||||||
|
(set_global $~lib/collector/itcm/iter
|
||||||
|
(get_local $0)
|
||||||
|
)
|
||||||
|
(call $~lib/collector/itcm/ManagedObject#set:color
|
||||||
|
(get_local $0)
|
||||||
|
(i32.eqz
|
||||||
|
(get_global $~lib/collector/itcm/white)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(set_global $~argc
|
||||||
|
(i32.const 1)
|
||||||
|
)
|
||||||
|
(call_indirect (type $iv)
|
||||||
|
(i32.add
|
||||||
|
(get_local $0)
|
||||||
|
(i32.const 16)
|
||||||
|
)
|
||||||
|
(i32.load offset=8
|
||||||
|
(get_local $0)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(block
|
||||||
|
(call $~lib/env/trace
|
||||||
|
(i32.const 376)
|
||||||
|
(i32.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
)
|
||||||
|
(call $~lib/collector/itcm/markRoots)
|
||||||
|
(if
|
||||||
|
(i32.eq
|
||||||
|
(call $~lib/collector/itcm/ManagedObject#get:next
|
||||||
|
(get_global $~lib/collector/itcm/iter)
|
||||||
|
)
|
||||||
|
(get_global $~lib/collector/itcm/to)
|
||||||
|
)
|
||||||
|
(block
|
||||||
|
(set_local $0
|
||||||
|
(get_global $~lib/collector/itcm/from)
|
||||||
|
)
|
||||||
|
(set_global $~lib/collector/itcm/from
|
||||||
|
(get_global $~lib/collector/itcm/to)
|
||||||
|
)
|
||||||
|
(set_global $~lib/collector/itcm/to
|
||||||
|
(get_local $0)
|
||||||
|
)
|
||||||
|
(set_global $~lib/collector/itcm/white
|
||||||
|
(i32.eqz
|
||||||
|
(get_global $~lib/collector/itcm/white)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(set_global $~lib/collector/itcm/iter
|
||||||
|
(call $~lib/collector/itcm/ManagedObject#get:next
|
||||||
|
(get_local $0)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(set_global $~lib/collector/itcm/state
|
||||||
|
(i32.const 3)
|
||||||
|
)
|
||||||
|
(call $~lib/env/trace
|
||||||
|
(i32.const 420)
|
||||||
|
(i32.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(br $break|0)
|
||||||
|
)
|
||||||
|
(if
|
||||||
|
(i32.ne
|
||||||
|
(tee_local $0
|
||||||
|
(get_global $~lib/collector/itcm/iter)
|
||||||
|
)
|
||||||
|
(get_global $~lib/collector/itcm/to)
|
||||||
|
)
|
||||||
|
(block
|
||||||
|
(call $~lib/env/trace
|
||||||
|
(i32.const 456)
|
||||||
|
(i32.const 1)
|
||||||
|
(f64.convert_u/i32
|
||||||
|
(i32.add
|
||||||
|
(get_local $0)
|
||||||
|
(i32.const 16)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
)
|
||||||
|
(set_global $~lib/collector/itcm/iter
|
||||||
|
(call $~lib/collector/itcm/ManagedObject#get:next
|
||||||
|
(get_local $0)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(call $~lib/memory/memory.free
|
||||||
|
(get_local $0)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(block
|
||||||
|
(call $~lib/env/trace
|
||||||
|
(i32.const 496)
|
||||||
|
(i32.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
)
|
||||||
|
(call $~lib/collector/itcm/ManagedObject#clear
|
||||||
|
(get_global $~lib/collector/itcm/to)
|
||||||
|
)
|
||||||
|
(set_global $~lib/collector/itcm/state
|
||||||
|
(i32.const 1)
|
||||||
|
)
|
||||||
|
(call $~lib/env/trace
|
||||||
|
(i32.const 84)
|
||||||
|
(i32.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(func $~lib/collector/itcm/__gc_allocate (; 18 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||||
|
(local $2 i32)
|
||||||
|
(call $~lib/env/trace
|
||||||
|
(i32.const 8)
|
||||||
|
(i32.const 1)
|
||||||
|
(f64.convert_u/i32
|
||||||
|
(get_local $0)
|
||||||
|
)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
)
|
||||||
(if
|
(if
|
||||||
(i32.gt_u
|
(i32.gt_u
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
(i32.const 1073741808)
|
(i32.const 1073741808)
|
||||||
)
|
)
|
||||||
(block
|
|
||||||
(call $~lib/env/abort
|
|
||||||
(i32.const 0)
|
|
||||||
(i32.const 8)
|
|
||||||
(i32.const 216)
|
|
||||||
(i32.const 2)
|
|
||||||
)
|
|
||||||
(unreachable)
|
(unreachable)
|
||||||
)
|
)
|
||||||
)
|
(call $~lib/collector/itcm/step)
|
||||||
(call $~lib/collector/itcm/ManagedObject#makeWhite
|
(i32.store offset=8
|
||||||
(tee_local $2
|
(tee_local $2
|
||||||
(call $~lib/memory/memory.allocate
|
(call $~lib/memory/memory.allocate
|
||||||
(i32.add
|
(i32.add
|
||||||
@ -193,13 +701,14 @@
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
(i32.store offset=8
|
|
||||||
(get_local $2)
|
|
||||||
(get_local $1)
|
(get_local $1)
|
||||||
)
|
)
|
||||||
(call $~lib/collector/itcm/ManagedObject#insert
|
(call $~lib/collector/itcm/ManagedObject#set:color
|
||||||
(get_global $~lib/collector/itcm/set1)
|
(get_local $2)
|
||||||
|
(get_global $~lib/collector/itcm/white)
|
||||||
|
)
|
||||||
|
(call $~lib/collector/itcm/ManagedObject#push
|
||||||
|
(get_global $~lib/collector/itcm/from)
|
||||||
(get_local $2)
|
(get_local $2)
|
||||||
)
|
)
|
||||||
(i32.add
|
(i32.add
|
||||||
@ -207,15 +716,78 @@
|
|||||||
(i32.const 16)
|
(i32.const 16)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(func $~lib/gc/gc.allocate (; 8 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
(func $~lib/gc/gc.allocate (; 19 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||||
(call $~lib/collector/itcm/__gc_allocate
|
(call $~lib/collector/itcm/__gc_allocate
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
(get_local $1)
|
(get_local $1)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(func $start (; 9 ;) (type $v)
|
(func $~lib/collector/itcm/__gc_collect (; 20 ;) (type $v)
|
||||||
|
(local $0 i32)
|
||||||
|
(call $~lib/env/trace
|
||||||
|
(i32.const 564)
|
||||||
|
(i32.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
)
|
||||||
|
(block $break|0
|
||||||
|
(block $case1|0
|
||||||
|
(br_if $case1|0
|
||||||
|
(i32.eqz
|
||||||
|
(tee_local $0
|
||||||
|
(get_global $~lib/collector/itcm/state)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(br_if $case1|0
|
||||||
|
(i32.eq
|
||||||
|
(get_local $0)
|
||||||
|
(i32.const 1)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(br $break|0)
|
||||||
|
)
|
||||||
|
(call $~lib/collector/itcm/step)
|
||||||
|
)
|
||||||
|
(loop $continue|1
|
||||||
|
(if
|
||||||
|
(i32.ne
|
||||||
|
(get_global $~lib/collector/itcm/state)
|
||||||
|
(i32.const 1)
|
||||||
|
)
|
||||||
|
(block
|
||||||
|
(call $~lib/collector/itcm/step)
|
||||||
|
(br $continue|1)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(func $~lib/gc/gc.collect (; 21 ;) (type $v)
|
||||||
|
(call $~lib/collector/itcm/__gc_collect)
|
||||||
|
)
|
||||||
|
(func $std/gc/main (; 22 ;) (type $i) (result i32)
|
||||||
|
(if
|
||||||
|
(i32.eqz
|
||||||
|
(get_global $~started)
|
||||||
|
)
|
||||||
|
(block
|
||||||
|
(call $start)
|
||||||
|
(set_global $~started
|
||||||
|
(i32.const 1)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(i32.const 0)
|
||||||
|
)
|
||||||
|
(func $start (; 23 ;) (type $v)
|
||||||
|
(local $0 i32)
|
||||||
|
(local $1 i32)
|
||||||
|
(local $2 i32)
|
||||||
(set_global $~lib/allocator/arena/startOffset
|
(set_global $~lib/allocator/arena/startOffset
|
||||||
(i32.const 80)
|
(i32.const 592)
|
||||||
)
|
)
|
||||||
(set_global $~lib/allocator/arena/offset
|
(set_global $~lib/allocator/arena/offset
|
||||||
(get_global $~lib/allocator/arena/startOffset)
|
(get_global $~lib/allocator/arena/startOffset)
|
||||||
@ -239,30 +811,51 @@
|
|||||||
(i32.const 16)
|
(i32.const 16)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(if
|
(set_local $1
|
||||||
(i32.load
|
|
||||||
(get_global $std/gc/head)
|
|
||||||
)
|
|
||||||
(block
|
|
||||||
(call $~lib/env/abort
|
|
||||||
(i32.const 0)
|
|
||||||
(i32.const 56)
|
|
||||||
(i32.const 16)
|
|
||||||
(i32.const 0)
|
|
||||||
)
|
|
||||||
(unreachable)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
(if
|
|
||||||
(i32.load offset=4
|
(i32.load offset=4
|
||||||
(get_global $std/gc/head)
|
(get_global $std/gc/head)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
(if
|
||||||
|
(tee_local $0
|
||||||
|
(i32.ne
|
||||||
|
(tee_local $2
|
||||||
|
(i32.and
|
||||||
|
(i32.load
|
||||||
|
(get_global $std/gc/head)
|
||||||
|
)
|
||||||
|
(i32.const -4)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(i32.const 0)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(set_local $0
|
||||||
|
(i32.ne
|
||||||
|
(get_local $1)
|
||||||
|
(i32.const 0)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(if
|
||||||
|
(get_local $0)
|
||||||
|
(set_local $0
|
||||||
|
(i32.eq
|
||||||
|
(get_local $2)
|
||||||
|
(get_local $1)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(if
|
||||||
|
(i32.eqz
|
||||||
|
(get_local $0)
|
||||||
|
)
|
||||||
(block
|
(block
|
||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 56)
|
(i32.const 540)
|
||||||
(i32.const 17)
|
(i32.const 19)
|
||||||
(i32.const 0)
|
(i32.const 2)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
)
|
)
|
||||||
@ -274,9 +867,9 @@
|
|||||||
(block
|
(block
|
||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 56)
|
(i32.const 540)
|
||||||
(i32.const 18)
|
(i32.const 21)
|
||||||
(i32.const 0)
|
(i32.const 2)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
)
|
)
|
||||||
@ -288,9 +881,9 @@
|
|||||||
(block
|
(block
|
||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 56)
|
(i32.const 540)
|
||||||
(i32.const 19)
|
(i32.const 23)
|
||||||
(i32.const 0)
|
(i32.const 2)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
)
|
)
|
||||||
@ -305,12 +898,17 @@
|
|||||||
(block
|
(block
|
||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 56)
|
(i32.const 540)
|
||||||
(i32.const 21)
|
(i32.const 25)
|
||||||
(i32.const 0)
|
(i32.const 2)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
(call $~lib/gc/gc.collect)
|
||||||
|
(set_global $std/gc/obj
|
||||||
|
(i32.const 0)
|
||||||
|
)
|
||||||
|
(call $~lib/gc/gc.collect)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -5,19 +5,31 @@ import "collector/itcm";
|
|||||||
class MyObject {
|
class MyObject {
|
||||||
a: u32;
|
a: u32;
|
||||||
}
|
}
|
||||||
function MyObject_visit(ref: usize): void { }
|
function MyObject_visit(ref: usize): void {} // function table index == classId ?
|
||||||
|
|
||||||
// allocate a managed instance
|
// allocate a managed instance
|
||||||
var obj = changetype<MyObject>(gc.allocate(offsetof<MyObject>(), MyObject_visit));
|
var obj: MyObject | null = changetype<MyObject>(gc.allocate(offsetof<MyObject>(), MyObject_visit));
|
||||||
obj.a = 123;
|
obj.a = 123;
|
||||||
var head = changetype<usize>(obj) - 16;
|
var head = changetype<usize>(obj) - 16;
|
||||||
|
|
||||||
// header
|
// check header
|
||||||
assert(load<u32>(head, 0) == 0); // nextWithFlags
|
{
|
||||||
assert(load<u32>(head, 4) == 0); // prev
|
let next = load<u32>(head, 0) & ~3;
|
||||||
assert(load<u32>(head, 8) == changetype<u32>(MyObject_visit)); // visitFn
|
let prev = load<u32>(head, 4);
|
||||||
assert(load<u32>(head, 12) == 0); // unused
|
assert(next != 0 && prev != 0 && next == prev);
|
||||||
// contents
|
let visitFn = load<u32>(head, 8);
|
||||||
assert(load<u32>(head, 16) == 123); // Obj#a
|
assert(visitFn == changetype<u32>(MyObject_visit));
|
||||||
|
let unused = load<u32>(head, 12);
|
||||||
|
assert(unused == 0);
|
||||||
|
let a = load<u32>(head, 16);
|
||||||
|
assert(a == 123);
|
||||||
|
}
|
||||||
|
|
||||||
// gc.collect(); // FIXME: endless loop
|
gc.collect(); // should keep 'obj' because it's a referenced root (see trace output)
|
||||||
|
obj = null;
|
||||||
|
gc.collect(); // should free 'obj' because it isn't referenced anymore (see trace output)
|
||||||
|
|
||||||
|
export function main(): i32 { return 0; }
|
||||||
|
|
||||||
|
// BEWARE: The compiler does not emit any integrations except gc.iterateRoots yet, hence trying to
|
||||||
|
// use the GC with a 'normally' allocated object will break it, as it has no managed header!
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -4376,7 +4376,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 13)
|
(i32.const 11)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -4393,7 +4393,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 15)
|
(i32.const 13)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -4411,7 +4411,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 16)
|
(i32.const 14)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -4429,7 +4429,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 17)
|
(i32.const 15)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -4450,7 +4450,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 18)
|
(i32.const 16)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -4468,7 +4468,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 19)
|
(i32.const 17)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -4484,7 +4484,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 21)
|
(i32.const 19)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -4503,7 +4503,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 22)
|
(i32.const 20)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -4519,7 +4519,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 23)
|
(i32.const 21)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -4538,7 +4538,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 24)
|
(i32.const 22)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -4557,7 +4557,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 25)
|
(i32.const 23)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -4576,7 +4576,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 26)
|
(i32.const 24)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -4595,7 +4595,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 27)
|
(i32.const 25)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -4614,7 +4614,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 28)
|
(i32.const 26)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -4633,7 +4633,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 30)
|
(i32.const 28)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -4655,7 +4655,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 31)
|
(i32.const 29)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -4679,7 +4679,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 32)
|
(i32.const 30)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -4701,7 +4701,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 33)
|
(i32.const 31)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -4723,7 +4723,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 34)
|
(i32.const 32)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -4745,7 +4745,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 35)
|
(i32.const 33)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -4764,7 +4764,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 36)
|
(i32.const 34)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -4783,7 +4783,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 37)
|
(i32.const 35)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -4802,7 +4802,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 38)
|
(i32.const 36)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -4821,7 +4821,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 39)
|
(i32.const 37)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -4837,7 +4837,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 40)
|
(i32.const 38)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -4855,7 +4855,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 46)
|
(i32.const 44)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -4873,7 +4873,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 47)
|
(i32.const 45)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -4891,7 +4891,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 48)
|
(i32.const 46)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -4909,7 +4909,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 49)
|
(i32.const 47)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -4927,7 +4927,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 50)
|
(i32.const 48)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -4945,7 +4945,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 51)
|
(i32.const 49)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -4963,7 +4963,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 52)
|
(i32.const 50)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -4981,7 +4981,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 53)
|
(i32.const 51)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -4998,7 +4998,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 55)
|
(i32.const 53)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -5015,7 +5015,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 56)
|
(i32.const 54)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -5032,7 +5032,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 57)
|
(i32.const 55)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -5049,7 +5049,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 58)
|
(i32.const 56)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -5066,7 +5066,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 59)
|
(i32.const 57)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -5089,7 +5089,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 62)
|
(i32.const 60)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -5106,7 +5106,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 63)
|
(i32.const 61)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -5123,7 +5123,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 64)
|
(i32.const 62)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -5140,7 +5140,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 65)
|
(i32.const 63)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -5157,7 +5157,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 67)
|
(i32.const 65)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -5174,7 +5174,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 68)
|
(i32.const 66)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -5191,7 +5191,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 69)
|
(i32.const 67)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -5208,7 +5208,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 70)
|
(i32.const 68)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -5219,6 +5219,21 @@
|
|||||||
(i32.const 428)
|
(i32.const 428)
|
||||||
(i32.const 420)
|
(i32.const 420)
|
||||||
)
|
)
|
||||||
|
(block
|
||||||
|
(call $~lib/env/abort
|
||||||
|
(i32.const 0)
|
||||||
|
(i32.const 48)
|
||||||
|
(i32.const 69)
|
||||||
|
(i32.const 0)
|
||||||
|
)
|
||||||
|
(unreachable)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(if
|
||||||
|
(call $~lib/string/String.__lt
|
||||||
|
(i32.const 360)
|
||||||
|
(get_global $std/string/nullStr)
|
||||||
|
)
|
||||||
(block
|
(block
|
||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
@ -5231,23 +5246,25 @@
|
|||||||
)
|
)
|
||||||
(if
|
(if
|
||||||
(call $~lib/string/String.__lt
|
(call $~lib/string/String.__lt
|
||||||
(i32.const 360)
|
|
||||||
(get_global $std/string/nullStr)
|
(get_global $std/string/nullStr)
|
||||||
|
(i32.const 360)
|
||||||
)
|
)
|
||||||
(block
|
(block
|
||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 73)
|
(i32.const 72)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(if
|
(if
|
||||||
(call $~lib/string/String.__lt
|
(i32.eqz
|
||||||
(get_global $std/string/nullStr)
|
(call $~lib/string/String.__gt
|
||||||
(i32.const 360)
|
(i32.const 444)
|
||||||
|
(i32.const 8)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
(block
|
(block
|
||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
@ -5261,7 +5278,24 @@
|
|||||||
)
|
)
|
||||||
(if
|
(if
|
||||||
(i32.eqz
|
(i32.eqz
|
||||||
(call $~lib/string/String.__gt
|
(call $~lib/string/String.__lt
|
||||||
|
(i32.const 8)
|
||||||
|
(i32.const 444)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(block
|
||||||
|
(call $~lib/env/abort
|
||||||
|
(i32.const 0)
|
||||||
|
(i32.const 48)
|
||||||
|
(i32.const 75)
|
||||||
|
(i32.const 0)
|
||||||
|
)
|
||||||
|
(unreachable)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(if
|
||||||
|
(i32.eqz
|
||||||
|
(call $~lib/string/String.__gte
|
||||||
(i32.const 444)
|
(i32.const 444)
|
||||||
(i32.const 8)
|
(i32.const 8)
|
||||||
)
|
)
|
||||||
@ -5278,7 +5312,7 @@
|
|||||||
)
|
)
|
||||||
(if
|
(if
|
||||||
(i32.eqz
|
(i32.eqz
|
||||||
(call $~lib/string/String.__lt
|
(call $~lib/string/String.__lte
|
||||||
(i32.const 8)
|
(i32.const 8)
|
||||||
(i32.const 444)
|
(i32.const 444)
|
||||||
)
|
)
|
||||||
@ -5294,12 +5328,10 @@
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
(if
|
(if
|
||||||
(i32.eqz
|
(call $~lib/string/String.__lt
|
||||||
(call $~lib/string/String.__gte
|
|
||||||
(i32.const 444)
|
(i32.const 444)
|
||||||
(i32.const 8)
|
(i32.const 8)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
(block
|
(block
|
||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
@ -5311,12 +5343,10 @@
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
(if
|
(if
|
||||||
(i32.eqz
|
(call $~lib/string/String.__gt
|
||||||
(call $~lib/string/String.__lte
|
|
||||||
(i32.const 8)
|
(i32.const 8)
|
||||||
(i32.const 444)
|
(i32.const 444)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
(block
|
(block
|
||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
@ -5329,7 +5359,7 @@
|
|||||||
)
|
)
|
||||||
(if
|
(if
|
||||||
(call $~lib/string/String.__lt
|
(call $~lib/string/String.__lt
|
||||||
(i32.const 444)
|
(i32.const 8)
|
||||||
(i32.const 8)
|
(i32.const 8)
|
||||||
)
|
)
|
||||||
(block
|
(block
|
||||||
@ -5345,7 +5375,7 @@
|
|||||||
(if
|
(if
|
||||||
(call $~lib/string/String.__gt
|
(call $~lib/string/String.__gt
|
||||||
(i32.const 8)
|
(i32.const 8)
|
||||||
(i32.const 444)
|
(i32.const 8)
|
||||||
)
|
)
|
||||||
(block
|
(block
|
||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
@ -5357,36 +5387,6 @@
|
|||||||
(unreachable)
|
(unreachable)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(if
|
|
||||||
(call $~lib/string/String.__lt
|
|
||||||
(i32.const 8)
|
|
||||||
(i32.const 8)
|
|
||||||
)
|
|
||||||
(block
|
|
||||||
(call $~lib/env/abort
|
|
||||||
(i32.const 0)
|
|
||||||
(i32.const 48)
|
|
||||||
(i32.const 82)
|
|
||||||
(i32.const 0)
|
|
||||||
)
|
|
||||||
(unreachable)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
(if
|
|
||||||
(call $~lib/string/String.__gt
|
|
||||||
(i32.const 8)
|
|
||||||
(i32.const 8)
|
|
||||||
)
|
|
||||||
(block
|
|
||||||
(call $~lib/env/abort
|
|
||||||
(i32.const 0)
|
|
||||||
(i32.const 48)
|
|
||||||
(i32.const 83)
|
|
||||||
(i32.const 0)
|
|
||||||
)
|
|
||||||
(unreachable)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
(if
|
(if
|
||||||
(i32.eqz
|
(i32.eqz
|
||||||
(call $~lib/string/String.__gte
|
(call $~lib/string/String.__gte
|
||||||
@ -5398,7 +5398,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 84)
|
(i32.const 82)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -5415,7 +5415,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 85)
|
(i32.const 83)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -5432,7 +5432,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 87)
|
(i32.const 85)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -5452,7 +5452,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 89)
|
(i32.const 87)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -5472,7 +5472,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 90)
|
(i32.const 88)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -5492,7 +5492,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 91)
|
(i32.const 89)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -5512,7 +5512,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 92)
|
(i32.const 90)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -5532,7 +5532,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 93)
|
(i32.const 91)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -5552,7 +5552,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 94)
|
(i32.const 92)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -5572,7 +5572,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 95)
|
(i32.const 93)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -5592,7 +5592,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 96)
|
(i32.const 94)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -5612,7 +5612,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 97)
|
(i32.const 95)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -5631,7 +5631,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 99)
|
(i32.const 97)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -5650,7 +5650,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 100)
|
(i32.const 98)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -5669,7 +5669,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 101)
|
(i32.const 99)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -5688,7 +5688,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 102)
|
(i32.const 100)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -5707,7 +5707,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 103)
|
(i32.const 101)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -5726,7 +5726,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 104)
|
(i32.const 102)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -5745,7 +5745,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 105)
|
(i32.const 103)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -5764,7 +5764,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 106)
|
(i32.const 104)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -5783,7 +5783,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 107)
|
(i32.const 105)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -5802,7 +5802,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 108)
|
(i32.const 106)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -5821,7 +5821,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 109)
|
(i32.const 107)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -5840,7 +5840,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 110)
|
(i32.const 108)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -5859,7 +5859,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 111)
|
(i32.const 109)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -5878,7 +5878,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 112)
|
(i32.const 110)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -5897,7 +5897,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 114)
|
(i32.const 112)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -5916,7 +5916,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 115)
|
(i32.const 113)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -5935,7 +5935,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 116)
|
(i32.const 114)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -5954,7 +5954,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 117)
|
(i32.const 115)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -5973,7 +5973,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 118)
|
(i32.const 116)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -5992,7 +5992,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 120)
|
(i32.const 118)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -6011,7 +6011,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 121)
|
(i32.const 119)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -6030,7 +6030,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 122)
|
(i32.const 120)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -6049,7 +6049,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 123)
|
(i32.const 121)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -6068,7 +6068,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 124)
|
(i32.const 122)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -6087,7 +6087,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 125)
|
(i32.const 123)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -6106,7 +6106,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 126)
|
(i32.const 124)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -6125,7 +6125,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 127)
|
(i32.const 125)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -6144,7 +6144,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 128)
|
(i32.const 126)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -6163,7 +6163,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 129)
|
(i32.const 127)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -6182,7 +6182,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 130)
|
(i32.const 128)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -6201,7 +6201,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 132)
|
(i32.const 130)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -6220,7 +6220,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 133)
|
(i32.const 131)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -6239,7 +6239,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 134)
|
(i32.const 132)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -6258,7 +6258,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 135)
|
(i32.const 133)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -6277,7 +6277,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 136)
|
(i32.const 134)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -6296,7 +6296,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 137)
|
(i32.const 135)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -6315,7 +6315,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 138)
|
(i32.const 136)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -6334,7 +6334,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 139)
|
(i32.const 137)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -6353,7 +6353,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 140)
|
(i32.const 138)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -6372,7 +6372,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 141)
|
(i32.const 139)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
@ -6391,7 +6391,7 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 48)
|
(i32.const 48)
|
||||||
(i32.const 142)
|
(i32.const 140)
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
|
@ -2,8 +2,6 @@ import "allocator/arena";
|
|||||||
|
|
||||||
import { utoa32, itoa32, utoa64, itoa64 } from "internal/itoa";
|
import { utoa32, itoa32, utoa64, itoa64 } from "internal/itoa";
|
||||||
|
|
||||||
// declare function logi(i: i32): void;
|
|
||||||
|
|
||||||
// preliminary
|
// preliminary
|
||||||
|
|
||||||
var str: string = "hi, I'm a string";
|
var str: string = "hi, I'm a string";
|
||||||
|
File diff suppressed because it is too large
Load Diff
104
tests/compiler/std/trace.optimized.wat
Normal file
104
tests/compiler/std/trace.optimized.wat
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
(module
|
||||||
|
(type $iiFFFFFv (func (param i32 i32 f64 f64 f64 f64 f64)))
|
||||||
|
(type $v (func))
|
||||||
|
(import "env" "trace" (func $~lib/env/trace (param i32 i32 f64 f64 f64 f64 f64)))
|
||||||
|
(global $~started (mut i32) (i32.const 0))
|
||||||
|
(memory $0 1)
|
||||||
|
(data (i32.const 8) "\0d\00\00\00z\00e\00r\00o\00_\00i\00m\00p\00l\00i\00c\00i\00t")
|
||||||
|
(data (i32.const 40) "\0d\00\00\00z\00e\00r\00o\00_\00e\00x\00p\00l\00i\00c\00i\00t")
|
||||||
|
(data (i32.const 72) "\07\00\00\00o\00n\00e\00_\00i\00n\00t")
|
||||||
|
(data (i32.const 92) "\07\00\00\00t\00w\00o\00_\00i\00n\00t")
|
||||||
|
(data (i32.const 112) "\t\00\00\00t\00h\00r\00e\00e\00_\00i\00n\00t")
|
||||||
|
(data (i32.const 136) "\08\00\00\00f\00o\00u\00r\00_\00i\00n\00t")
|
||||||
|
(data (i32.const 156) "\08\00\00\00f\00i\00v\00e\00_\00i\00n\00t")
|
||||||
|
(data (i32.const 176) "\08\00\00\00f\00i\00v\00e\00_\00d\00b\00l")
|
||||||
|
(export "memory" (memory $0))
|
||||||
|
(export "main" (func $std/trace/main))
|
||||||
|
(func $std/trace/main (; 1 ;) (type $v)
|
||||||
|
(if
|
||||||
|
(i32.eqz
|
||||||
|
(get_global $~started)
|
||||||
|
)
|
||||||
|
(block
|
||||||
|
(call $start)
|
||||||
|
(set_global $~started
|
||||||
|
(i32.const 1)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(func $start (; 2 ;) (type $v)
|
||||||
|
(call $~lib/env/trace
|
||||||
|
(i32.const 8)
|
||||||
|
(i32.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
)
|
||||||
|
(call $~lib/env/trace
|
||||||
|
(i32.const 40)
|
||||||
|
(i32.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
)
|
||||||
|
(call $~lib/env/trace
|
||||||
|
(i32.const 72)
|
||||||
|
(i32.const 1)
|
||||||
|
(f64.const 1)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
)
|
||||||
|
(call $~lib/env/trace
|
||||||
|
(i32.const 92)
|
||||||
|
(i32.const 2)
|
||||||
|
(f64.const 1)
|
||||||
|
(f64.const 2)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
)
|
||||||
|
(call $~lib/env/trace
|
||||||
|
(i32.const 112)
|
||||||
|
(i32.const 3)
|
||||||
|
(f64.const 1)
|
||||||
|
(f64.const 2)
|
||||||
|
(f64.const 3)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
)
|
||||||
|
(call $~lib/env/trace
|
||||||
|
(i32.const 136)
|
||||||
|
(i32.const 4)
|
||||||
|
(f64.const 1)
|
||||||
|
(f64.const 2)
|
||||||
|
(f64.const 3)
|
||||||
|
(f64.const 4)
|
||||||
|
(f64.const 0)
|
||||||
|
)
|
||||||
|
(call $~lib/env/trace
|
||||||
|
(i32.const 156)
|
||||||
|
(i32.const 5)
|
||||||
|
(f64.const 1)
|
||||||
|
(f64.const 2)
|
||||||
|
(f64.const 3)
|
||||||
|
(f64.const 4)
|
||||||
|
(f64.const 5)
|
||||||
|
)
|
||||||
|
(call $~lib/env/trace
|
||||||
|
(i32.const 176)
|
||||||
|
(i32.const 5)
|
||||||
|
(f64.const 1.1)
|
||||||
|
(f64.const 2.2)
|
||||||
|
(f64.const 3.3)
|
||||||
|
(f64.const 4.4)
|
||||||
|
(f64.const 5.5)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
10
tests/compiler/std/trace.ts
Normal file
10
tests/compiler/std/trace.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
trace("zero_implicit");
|
||||||
|
trace("zero_explicit", 0);
|
||||||
|
trace("one_int", 1, 1);
|
||||||
|
trace("two_int", 2, 1, 2);
|
||||||
|
trace("three_int", 3, 1, 2, 3);
|
||||||
|
trace("four_int", 4, 1, 2, 3, 4);
|
||||||
|
trace("five_int", 5, 1, 2, 3, 4, 5);
|
||||||
|
trace("five_dbl", 5, 1.1, 2.2, 3.3, 4.4, 5.5);
|
||||||
|
|
||||||
|
export function main(): void {}
|
105
tests/compiler/std/trace.untouched.wat
Normal file
105
tests/compiler/std/trace.untouched.wat
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
(module
|
||||||
|
(type $iiFFFFFv (func (param i32 i32 f64 f64 f64 f64 f64)))
|
||||||
|
(type $v (func))
|
||||||
|
(import "env" "trace" (func $~lib/env/trace (param i32 i32 f64 f64 f64 f64 f64)))
|
||||||
|
(global $~started (mut i32) (i32.const 0))
|
||||||
|
(global $HEAP_BASE i32 (i32.const 196))
|
||||||
|
(memory $0 1)
|
||||||
|
(data (i32.const 8) "\0d\00\00\00z\00e\00r\00o\00_\00i\00m\00p\00l\00i\00c\00i\00t\00")
|
||||||
|
(data (i32.const 40) "\0d\00\00\00z\00e\00r\00o\00_\00e\00x\00p\00l\00i\00c\00i\00t\00")
|
||||||
|
(data (i32.const 72) "\07\00\00\00o\00n\00e\00_\00i\00n\00t\00")
|
||||||
|
(data (i32.const 92) "\07\00\00\00t\00w\00o\00_\00i\00n\00t\00")
|
||||||
|
(data (i32.const 112) "\t\00\00\00t\00h\00r\00e\00e\00_\00i\00n\00t\00")
|
||||||
|
(data (i32.const 136) "\08\00\00\00f\00o\00u\00r\00_\00i\00n\00t\00")
|
||||||
|
(data (i32.const 156) "\08\00\00\00f\00i\00v\00e\00_\00i\00n\00t\00")
|
||||||
|
(data (i32.const 176) "\08\00\00\00f\00i\00v\00e\00_\00d\00b\00l\00")
|
||||||
|
(export "memory" (memory $0))
|
||||||
|
(export "main" (func $std/trace/main))
|
||||||
|
(func $std/trace/main (; 1 ;) (type $v)
|
||||||
|
(if
|
||||||
|
(i32.eqz
|
||||||
|
(get_global $~started)
|
||||||
|
)
|
||||||
|
(block
|
||||||
|
(call $start)
|
||||||
|
(set_global $~started
|
||||||
|
(i32.const 1)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(func $start (; 2 ;) (type $v)
|
||||||
|
(call $~lib/env/trace
|
||||||
|
(i32.const 8)
|
||||||
|
(i32.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
)
|
||||||
|
(call $~lib/env/trace
|
||||||
|
(i32.const 40)
|
||||||
|
(i32.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
)
|
||||||
|
(call $~lib/env/trace
|
||||||
|
(i32.const 72)
|
||||||
|
(i32.const 1)
|
||||||
|
(f64.const 1)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
)
|
||||||
|
(call $~lib/env/trace
|
||||||
|
(i32.const 92)
|
||||||
|
(i32.const 2)
|
||||||
|
(f64.const 1)
|
||||||
|
(f64.const 2)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
)
|
||||||
|
(call $~lib/env/trace
|
||||||
|
(i32.const 112)
|
||||||
|
(i32.const 3)
|
||||||
|
(f64.const 1)
|
||||||
|
(f64.const 2)
|
||||||
|
(f64.const 3)
|
||||||
|
(f64.const 0)
|
||||||
|
(f64.const 0)
|
||||||
|
)
|
||||||
|
(call $~lib/env/trace
|
||||||
|
(i32.const 136)
|
||||||
|
(i32.const 4)
|
||||||
|
(f64.const 1)
|
||||||
|
(f64.const 2)
|
||||||
|
(f64.const 3)
|
||||||
|
(f64.const 4)
|
||||||
|
(f64.const 0)
|
||||||
|
)
|
||||||
|
(call $~lib/env/trace
|
||||||
|
(i32.const 156)
|
||||||
|
(i32.const 5)
|
||||||
|
(f64.const 1)
|
||||||
|
(f64.const 2)
|
||||||
|
(f64.const 3)
|
||||||
|
(f64.const 4)
|
||||||
|
(f64.const 5)
|
||||||
|
)
|
||||||
|
(call $~lib/env/trace
|
||||||
|
(i32.const 176)
|
||||||
|
(i32.const 5)
|
||||||
|
(f64.const 1.1)
|
||||||
|
(f64.const 2.2)
|
||||||
|
(f64.const 3.3)
|
||||||
|
(f64.const 4.4)
|
||||||
|
(f64.const 5.5)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
Loading…
x
Reference in New Issue
Block a user