Add a more convenient tracing utility for debugging; Fix basic GC test

This commit is contained in:
dcodeIO 2018-07-20 16:49:27 +02:00
parent f56face188
commit 41ad2f8a70
19 changed files with 2264 additions and 703 deletions

View File

@ -414,7 +414,8 @@ exports.main = function main(argv, options, callback) {
// Initialize default aliases
assemblyscript.setGlobalAlias(compilerOptions, "Math", "NativeMath");
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
if (args.use) {

View File

@ -2700,6 +2700,7 @@ export function compileCall(
}
}
}
compiler.currentType = Type.void;
return exprs.length
? module.createBlock(null, exprs)
: module.createNop();

View File

@ -626,8 +626,8 @@ export class Program extends DiagnosticEmitter {
}
// register 'main' if present
if (this.elementsLookup.has("main")) {
let element = <Element>this.elementsLookup.get("main");
if (this.moduleLevelExports.has("main")) {
let element = (<ModuleExport>this.moduleLevelExports.get("main")).element;
if (
element.kind == ElementKind.FUNCTION_PROTOTYPE &&
!(<FunctionPrototype>element).isAny(CommonFlags.GENERIC | CommonFlags.AMBIENT)

View File

@ -4,122 +4,15 @@
* @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 {
AL_MASK,
MAX_SIZE_32
} 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. */
const enum State {
/** Not yet initialized. */
@ -134,64 +27,164 @@ const enum State {
/** Current collector state. */
var state = State.INIT;
/** Current white color value. */
var white = 0;
// From and to spaces
var set1: ManagedObject;
var set2: ManagedObject;
var from: ManagedObject;
var to: 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. */
function step(): void {
var obj: ManagedObject;
switch (state) {
case State.INIT: {
set1 = changetype<ManagedObject>(memory.allocate(ManagedObject.SIZE));
set1.clear();
set2 = changetype<ManagedObject>(memory.allocate(ManagedObject.SIZE));
set2.clear();
iter = set2;
if (TRACE) trace("gc~step/INIT");
from = changetype<ManagedObject>(memory.allocate(ManagedObject.SIZE));
from.visitFn = changetype<(ref: usize) => void>(<u32>-1); // would error
from.clear();
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
}
case State.IDLE: {
// start by marking roots
gc.iterateRoots(function mark_root(ref: usize): void {
if (ref) {
let obj = changetype<ManagedObject>(ref - ManagedObject.SIZE);
obj.makeBlack();
obj.visitFn(ref);
}
});
if (TRACE) trace("gc~step/IDLE");
markRoots();
state = State.MARK;
if (TRACE) trace("gc~state = MARK");
break;
}
case State.MARK: {
obj = iter.next;
if (obj != set2) {
if (obj !== to) {
if (TRACE) trace("gc~step/MARK iterate", 1, objToRef(obj));
iter = obj;
obj.makeBlack();
obj.visitFn(changetype<usize>(obj) + ManagedObject.SIZE);
obj.color = <i32>!white;
obj.visitFn(objToRef(obj));
} else {
if (TRACE) trace("gc~step/MARK finish");
markRoots();
obj = iter.next;
if (obj == set2) {
let set1_ = set1;
set1 = set2;
set2 = set1_;
Flags.WHITE ^= 1;
Flags.BLACK ^= 1;
iter = set1.next;
if (obj === to) {
let prevFrom = from;
from = to;
to = prevFrom;
white = <i32>!white;
iter = prevFrom.next;
state = State.SWEEP;
if (TRACE) trace("gc~state = SWEEP");
}
}
break;
}
case State.SWEEP: {
obj = iter;
if (obj !== set2) {
if (obj !== to) {
if (TRACE) trace("gc~step/SWEEP free", 1, objToRef(obj));
iter = obj.next;
memory.free(changetype<usize>(obj));
} else {
set2.clear();
if (TRACE) trace("gc~step/SWEEP finish");
to.clear();
state = State.IDLE;
if (TRACE) trace("gc~state = IDLE");
}
break;
}
@ -213,30 +206,33 @@ function step(): void {
size: usize,
visitFn: (ref: usize) => void
): 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));
obj.makeWhite();
obj.visitFn = visitFn;
set1.insert(obj);
obj.color = white;
from.push(obj);
return objToRef(obj);
}
/** Marks a reachable object. Called from the visitFn functions. */
@global export function __gc_mark(ref: usize): void {
if (TRACE) trace("gc.mark", 1, ref);
var obj = refToObj(ref);
if (state == State.SWEEP) return;
if (obj.isWhite) obj.makeGray();
if (obj.color == white) obj.makeGray();
}
/** Links a managed child object to its parent object. */
@global export function __gc_link(parentRef: usize, childRef: usize): void {
if (TRACE) trace("gc.link", 2, parentRef, childRef);
var parent = refToObj(parentRef);
var child = refToObj(childRef);
if (parent.isBlack && child.isWhite) parent.makeGray();
if (parent.color == <i32>!white && refToObj(childRef).color == white) parent.makeGray();
}
/** Performs a full garbage collection cycle. */
@global export function __gc_collect(): void {
if (TRACE) trace("gc.collect");
// begin collecting if not yet collecting
switch (state) {
case State.INIT:

View File

@ -1,7 +1,16 @@
/** Environment abort function called where assertions evaluate to false / on throw. */
declare function abort(
message?: string | null,
fileName?: string | null,
lineNumber?: u32,
columnNumber?: u32
): void;
declare function trace(
message: string,
n?: i32,
a0?: f64,
a1?: f64,
a2?: f64,
a3?: f64,
a4?: f64
): void;

View File

@ -9,19 +9,19 @@ export namespace gc {
}
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.");
unreachable();
}
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.");
unreachable();
}
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.");
unreachable();
}

View File

@ -654,6 +654,9 @@ declare const Math: IMath<f64>;
/** Alias of {@link NativeMathf} or {@link JSMath} respectively. Defaults to `NativeMathf`. */
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
/** Annotates an element as a program global. */

View File

@ -153,16 +153,40 @@ tests.forEach(filename => {
// Instantiate
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 exports = new WebAssembly.Instance(new WebAssembly.Module(stdout.toBuffer()), {
exports = new WebAssembly.Instance(new WebAssembly.Module(stdout.toBuffer()), {
env: {
memory,
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() { },
externalConstant: 1,
logi: function(i) { console.log("logi: " + i); },
logf: function(f) { console.log("logf: " + f); }
externalConstant: 1
},
JSOp: {
mod: function(a, b) { return a % b; }
@ -188,10 +212,16 @@ tests.forEach(filename => {
bar: function() {},
baz: function() {},
"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("\n " + Object.keys(exports).map(key => "[" + (typeof exports[key]).substring(0, 3) + "] " + key).join("\n "));
} catch (e) {
console.log("- " + colorsUtil.red("instantiate ERROR: ") + e.stack);
failed = true;

View File

@ -2,11 +2,22 @@
(type $iii (func (param i32 i32) (result i32)))
(type $v (func))
(global $main/code (mut i32) (i32.const 0))
(global $~started (mut i32) (i32.const 0))
(memory $0 0)
(export "memory" (memory $0))
(export "main" (func $main/main))
(start $start)
(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)
)
(func $start (; 1 ;) (type $v)

View File

@ -2,12 +2,23 @@
(type $iii (func (param i32 i32) (result i32)))
(type $v (func))
(global $main/code (mut i32) (i32.const 0))
(global $~started (mut i32) (i32.const 0))
(global $HEAP_BASE i32 (i32.const 8))
(memory $0 0)
(export "memory" (memory $0))
(export "main" (func $main/main))
(start $start)
(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)
)
(func $start (; 1 ;) (type $v)

View File

@ -1,30 +1,54 @@
(module
(type $iv (func (param 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 $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)))
(global $~lib/allocator/arena/startOffset (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/set1 (mut i32) (i32.const 0))
(global $~lib/collector/itcm/Flags.WHITE (mut i32) (i32.const 0))
(global $~lib/collector/itcm/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/head (mut i32) (i32.const 0))
(table 1 1 anyfunc)
(elem (i32.const 0) $std/gc/MyObject_visit)
(global $~started (mut i32) (i32.const 0))
(table 2 2 anyfunc)
(elem (i32.const 0) $std/gc/MyObject_visit $~lib/collector/itcm/markRoots~markRoot|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 56) "\t\00\00\00s\00t\00d\00/\00g\00c\00.\00t\00s")
(data (i32.const 8) "\0b\00\00\00g\00c\00.\00a\00l\00l\00o\00c\00a\00t\00e")
(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 "table" (table $0))
(start $start)
(func $std/gc/MyObject_visit (; 1 ;) (type $iv) (param $0 i32)
(export "main" (func $std/gc/main))
(func $std/gc/MyObject_visit (; 2 ;) (type $iv) (param $0 i32)
(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 $2 i32)
(local $3 i32)
@ -110,26 +134,52 @@
)
(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
(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
(get_local $0)
(i32.or
(i32.and
(i32.load
(get_local $0)
)
(i32.const -8)
)
(get_global $~lib/collector/itcm/Flags.WHITE)
)
(get_local $0)
)
(i32.store offset=4
(get_local $0)
(get_local $0)
)
)
(func $~lib/collector/itcm/ManagedObject#set:next (; 5 ;) (type $iiv) (param $0 i32) (param $1 i32)
(func $~lib/collector/itcm/ManagedObject#get:color (; 6 ;) (type $ii) (param $0 i32) (result i32)
(i32.and
(i32.load
(get_local $0)
)
(i32.const 3)
)
)
(func $~lib/collector/itcm/ManagedObject#get:next (; 7 ;) (type $ii) (param $0 i32) (result i32)
(i32.and
(i32.load
(get_local $0)
)
(i32.const -4)
)
)
(func $~lib/collector/itcm/ManagedObject#set:next (; 8 ;) (type $iiv) (param $0 i32) (param $1 i32)
(i32.store
(get_local $0)
(i32.or
@ -138,18 +188,86 @@
(i32.load
(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)
(set_local $2
(i32.load offset=4
(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
(get_local $0)
)
)
(i32.const 16)
)
)
(f64.convert_u/i32
(i32.add
(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
(get_local $1)
(get_local $2)
)
(call $~lib/collector/itcm/ManagedObject#set:next
(get_local $2)
(get_local $1)
)
)
(func $~lib/collector/itcm/ManagedObject#push (; 10 ;) (type $iiv) (param $0 i32) (param $1 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)
@ -167,24 +285,414 @@
(get_local $1)
)
)
(func $~lib/collector/itcm/__gc_allocate (; 7 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(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
(i32.gt_u
(get_local $0)
(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/ManagedObject#makeWhite
(call $~lib/collector/itcm/step)
(i32.store offset=8
(tee_local $2
(call $~lib/memory/memory.allocate
(i32.add
@ -193,13 +701,14 @@
)
)
)
)
(i32.store offset=8
(get_local $2)
(get_local $1)
)
(call $~lib/collector/itcm/ManagedObject#insert
(get_global $~lib/collector/itcm/set1)
(call $~lib/collector/itcm/ManagedObject#set:color
(get_local $2)
(get_global $~lib/collector/itcm/white)
)
(call $~lib/collector/itcm/ManagedObject#push
(get_global $~lib/collector/itcm/from)
(get_local $2)
)
(i32.add
@ -207,15 +716,78 @@
(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
(get_local $0)
(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
(i32.const 80)
(i32.const 592)
)
(set_global $~lib/allocator/arena/offset
(get_global $~lib/allocator/arena/startOffset)
@ -239,30 +811,51 @@
(i32.const 16)
)
)
(if
(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
(set_local $1
(i32.load offset=4
(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
(call $~lib/env/abort
(i32.const 0)
(i32.const 56)
(i32.const 17)
(i32.const 0)
(i32.const 540)
(i32.const 19)
(i32.const 2)
)
(unreachable)
)
@ -274,9 +867,9 @@
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 56)
(i32.const 18)
(i32.const 0)
(i32.const 540)
(i32.const 21)
(i32.const 2)
)
(unreachable)
)
@ -288,9 +881,9 @@
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 56)
(i32.const 19)
(i32.const 0)
(i32.const 540)
(i32.const 23)
(i32.const 2)
)
(unreachable)
)
@ -305,12 +898,17 @@
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 56)
(i32.const 21)
(i32.const 0)
(i32.const 540)
(i32.const 25)
(i32.const 2)
)
(unreachable)
)
)
(call $~lib/gc/gc.collect)
(set_global $std/gc/obj
(i32.const 0)
)
(call $~lib/gc/gc.collect)
)
)

View File

@ -5,19 +5,31 @@ import "collector/itcm";
class MyObject {
a: u32;
}
function MyObject_visit(ref: usize): void { }
function MyObject_visit(ref: usize): void {} // function table index == classId ?
// 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;
var head = changetype<usize>(obj) - 16;
// header
assert(load<u32>(head, 0) == 0); // nextWithFlags
assert(load<u32>(head, 4) == 0); // prev
assert(load<u32>(head, 8) == changetype<u32>(MyObject_visit)); // visitFn
assert(load<u32>(head, 12) == 0); // unused
// contents
assert(load<u32>(head, 16) == 123); // Obj#a
// check header
{
let next = load<u32>(head, 0) & ~3;
let prev = load<u32>(head, 4);
assert(next != 0 && prev != 0 && next == prev);
let visitFn = load<u32>(head, 8);
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

View File

@ -4376,7 +4376,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 13)
(i32.const 11)
(i32.const 0)
)
(unreachable)
@ -4393,7 +4393,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 15)
(i32.const 13)
(i32.const 0)
)
(unreachable)
@ -4411,7 +4411,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 16)
(i32.const 14)
(i32.const 0)
)
(unreachable)
@ -4429,7 +4429,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 17)
(i32.const 15)
(i32.const 0)
)
(unreachable)
@ -4450,7 +4450,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 18)
(i32.const 16)
(i32.const 0)
)
(unreachable)
@ -4468,7 +4468,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 19)
(i32.const 17)
(i32.const 0)
)
(unreachable)
@ -4484,7 +4484,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 21)
(i32.const 19)
(i32.const 0)
)
(unreachable)
@ -4503,7 +4503,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 22)
(i32.const 20)
(i32.const 0)
)
(unreachable)
@ -4519,7 +4519,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 23)
(i32.const 21)
(i32.const 0)
)
(unreachable)
@ -4538,7 +4538,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 24)
(i32.const 22)
(i32.const 0)
)
(unreachable)
@ -4557,7 +4557,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 25)
(i32.const 23)
(i32.const 0)
)
(unreachable)
@ -4576,7 +4576,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 26)
(i32.const 24)
(i32.const 0)
)
(unreachable)
@ -4595,7 +4595,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 27)
(i32.const 25)
(i32.const 0)
)
(unreachable)
@ -4614,7 +4614,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 28)
(i32.const 26)
(i32.const 0)
)
(unreachable)
@ -4633,7 +4633,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 30)
(i32.const 28)
(i32.const 0)
)
(unreachable)
@ -4655,7 +4655,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 31)
(i32.const 29)
(i32.const 0)
)
(unreachable)
@ -4679,7 +4679,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 32)
(i32.const 30)
(i32.const 0)
)
(unreachable)
@ -4701,7 +4701,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 33)
(i32.const 31)
(i32.const 0)
)
(unreachable)
@ -4723,7 +4723,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 34)
(i32.const 32)
(i32.const 0)
)
(unreachable)
@ -4745,7 +4745,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 35)
(i32.const 33)
(i32.const 0)
)
(unreachable)
@ -4764,7 +4764,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 36)
(i32.const 34)
(i32.const 0)
)
(unreachable)
@ -4783,7 +4783,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 37)
(i32.const 35)
(i32.const 0)
)
(unreachable)
@ -4802,7 +4802,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 38)
(i32.const 36)
(i32.const 0)
)
(unreachable)
@ -4821,7 +4821,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 39)
(i32.const 37)
(i32.const 0)
)
(unreachable)
@ -4837,7 +4837,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 40)
(i32.const 38)
(i32.const 0)
)
(unreachable)
@ -4855,7 +4855,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 46)
(i32.const 44)
(i32.const 0)
)
(unreachable)
@ -4873,7 +4873,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 47)
(i32.const 45)
(i32.const 0)
)
(unreachable)
@ -4891,7 +4891,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 48)
(i32.const 46)
(i32.const 0)
)
(unreachable)
@ -4909,7 +4909,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 49)
(i32.const 47)
(i32.const 0)
)
(unreachable)
@ -4927,7 +4927,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 50)
(i32.const 48)
(i32.const 0)
)
(unreachable)
@ -4945,7 +4945,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 51)
(i32.const 49)
(i32.const 0)
)
(unreachable)
@ -4963,7 +4963,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 52)
(i32.const 50)
(i32.const 0)
)
(unreachable)
@ -4981,7 +4981,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 53)
(i32.const 51)
(i32.const 0)
)
(unreachable)
@ -4998,7 +4998,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 55)
(i32.const 53)
(i32.const 0)
)
(unreachable)
@ -5015,7 +5015,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 56)
(i32.const 54)
(i32.const 0)
)
(unreachable)
@ -5032,7 +5032,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 57)
(i32.const 55)
(i32.const 0)
)
(unreachable)
@ -5049,7 +5049,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 58)
(i32.const 56)
(i32.const 0)
)
(unreachable)
@ -5066,7 +5066,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 59)
(i32.const 57)
(i32.const 0)
)
(unreachable)
@ -5089,7 +5089,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 62)
(i32.const 60)
(i32.const 0)
)
(unreachable)
@ -5106,7 +5106,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 63)
(i32.const 61)
(i32.const 0)
)
(unreachable)
@ -5123,7 +5123,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 64)
(i32.const 62)
(i32.const 0)
)
(unreachable)
@ -5140,7 +5140,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 65)
(i32.const 63)
(i32.const 0)
)
(unreachable)
@ -5157,7 +5157,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 67)
(i32.const 65)
(i32.const 0)
)
(unreachable)
@ -5174,7 +5174,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 68)
(i32.const 66)
(i32.const 0)
)
(unreachable)
@ -5191,7 +5191,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 69)
(i32.const 67)
(i32.const 0)
)
(unreachable)
@ -5208,7 +5208,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 70)
(i32.const 68)
(i32.const 0)
)
(unreachable)
@ -5219,6 +5219,21 @@
(i32.const 428)
(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
(call $~lib/env/abort
(i32.const 0)
@ -5229,21 +5244,6 @@
(unreachable)
)
)
(if
(call $~lib/string/String.__lt
(i32.const 360)
(get_global $std/string/nullStr)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 73)
(i32.const 0)
)
(unreachable)
)
)
(if
(call $~lib/string/String.__lt
(get_global $std/string/nullStr)
@ -5253,7 +5253,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 74)
(i32.const 72)
(i32.const 0)
)
(unreachable)
@ -5270,7 +5270,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 76)
(i32.const 74)
(i32.const 0)
)
(unreachable)
@ -5287,7 +5287,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 77)
(i32.const 75)
(i32.const 0)
)
(unreachable)
@ -5304,7 +5304,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 78)
(i32.const 76)
(i32.const 0)
)
(unreachable)
@ -5321,7 +5321,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 79)
(i32.const 77)
(i32.const 0)
)
(unreachable)
@ -5332,6 +5332,36 @@
(i32.const 444)
(i32.const 8)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 78)
(i32.const 0)
)
(unreachable)
)
)
(if
(call $~lib/string/String.__gt
(i32.const 8)
(i32.const 444)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 79)
(i32.const 0)
)
(unreachable)
)
)
(if
(call $~lib/string/String.__lt
(i32.const 8)
(i32.const 8)
)
(block
(call $~lib/env/abort
(i32.const 0)
@ -5345,7 +5375,7 @@
(if
(call $~lib/string/String.__gt
(i32.const 8)
(i32.const 444)
(i32.const 8)
)
(block
(call $~lib/env/abort
@ -5357,36 +5387,6 @@
(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
(i32.eqz
(call $~lib/string/String.__gte
@ -5398,7 +5398,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 84)
(i32.const 82)
(i32.const 0)
)
(unreachable)
@ -5415,7 +5415,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 85)
(i32.const 83)
(i32.const 0)
)
(unreachable)
@ -5432,7 +5432,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 87)
(i32.const 85)
(i32.const 0)
)
(unreachable)
@ -5452,7 +5452,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 89)
(i32.const 87)
(i32.const 0)
)
(unreachable)
@ -5472,7 +5472,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 90)
(i32.const 88)
(i32.const 0)
)
(unreachable)
@ -5492,7 +5492,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 91)
(i32.const 89)
(i32.const 0)
)
(unreachable)
@ -5512,7 +5512,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 92)
(i32.const 90)
(i32.const 0)
)
(unreachable)
@ -5532,7 +5532,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 93)
(i32.const 91)
(i32.const 0)
)
(unreachable)
@ -5552,7 +5552,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 94)
(i32.const 92)
(i32.const 0)
)
(unreachable)
@ -5572,7 +5572,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 95)
(i32.const 93)
(i32.const 0)
)
(unreachable)
@ -5592,7 +5592,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 96)
(i32.const 94)
(i32.const 0)
)
(unreachable)
@ -5612,7 +5612,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 97)
(i32.const 95)
(i32.const 0)
)
(unreachable)
@ -5631,7 +5631,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 99)
(i32.const 97)
(i32.const 0)
)
(unreachable)
@ -5650,7 +5650,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 100)
(i32.const 98)
(i32.const 0)
)
(unreachable)
@ -5669,7 +5669,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 101)
(i32.const 99)
(i32.const 0)
)
(unreachable)
@ -5688,7 +5688,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 102)
(i32.const 100)
(i32.const 0)
)
(unreachable)
@ -5707,7 +5707,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 103)
(i32.const 101)
(i32.const 0)
)
(unreachable)
@ -5726,7 +5726,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 104)
(i32.const 102)
(i32.const 0)
)
(unreachable)
@ -5745,7 +5745,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 105)
(i32.const 103)
(i32.const 0)
)
(unreachable)
@ -5764,7 +5764,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 106)
(i32.const 104)
(i32.const 0)
)
(unreachable)
@ -5783,7 +5783,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 107)
(i32.const 105)
(i32.const 0)
)
(unreachable)
@ -5802,7 +5802,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 108)
(i32.const 106)
(i32.const 0)
)
(unreachable)
@ -5821,7 +5821,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 109)
(i32.const 107)
(i32.const 0)
)
(unreachable)
@ -5840,7 +5840,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 110)
(i32.const 108)
(i32.const 0)
)
(unreachable)
@ -5859,7 +5859,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 111)
(i32.const 109)
(i32.const 0)
)
(unreachable)
@ -5878,7 +5878,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 112)
(i32.const 110)
(i32.const 0)
)
(unreachable)
@ -5897,7 +5897,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 114)
(i32.const 112)
(i32.const 0)
)
(unreachable)
@ -5916,7 +5916,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 115)
(i32.const 113)
(i32.const 0)
)
(unreachable)
@ -5935,7 +5935,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 116)
(i32.const 114)
(i32.const 0)
)
(unreachable)
@ -5954,7 +5954,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 117)
(i32.const 115)
(i32.const 0)
)
(unreachable)
@ -5973,7 +5973,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 118)
(i32.const 116)
(i32.const 0)
)
(unreachable)
@ -5992,7 +5992,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 120)
(i32.const 118)
(i32.const 0)
)
(unreachable)
@ -6011,7 +6011,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 121)
(i32.const 119)
(i32.const 0)
)
(unreachable)
@ -6030,7 +6030,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 122)
(i32.const 120)
(i32.const 0)
)
(unreachable)
@ -6049,7 +6049,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 123)
(i32.const 121)
(i32.const 0)
)
(unreachable)
@ -6068,7 +6068,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 124)
(i32.const 122)
(i32.const 0)
)
(unreachable)
@ -6087,7 +6087,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 125)
(i32.const 123)
(i32.const 0)
)
(unreachable)
@ -6106,7 +6106,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 126)
(i32.const 124)
(i32.const 0)
)
(unreachable)
@ -6125,7 +6125,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 127)
(i32.const 125)
(i32.const 0)
)
(unreachable)
@ -6144,7 +6144,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 128)
(i32.const 126)
(i32.const 0)
)
(unreachable)
@ -6163,7 +6163,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 129)
(i32.const 127)
(i32.const 0)
)
(unreachable)
@ -6182,7 +6182,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 130)
(i32.const 128)
(i32.const 0)
)
(unreachable)
@ -6201,7 +6201,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 132)
(i32.const 130)
(i32.const 0)
)
(unreachable)
@ -6220,7 +6220,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 133)
(i32.const 131)
(i32.const 0)
)
(unreachable)
@ -6239,7 +6239,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 134)
(i32.const 132)
(i32.const 0)
)
(unreachable)
@ -6258,7 +6258,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 135)
(i32.const 133)
(i32.const 0)
)
(unreachable)
@ -6277,7 +6277,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 136)
(i32.const 134)
(i32.const 0)
)
(unreachable)
@ -6296,7 +6296,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 137)
(i32.const 135)
(i32.const 0)
)
(unreachable)
@ -6315,7 +6315,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 138)
(i32.const 136)
(i32.const 0)
)
(unreachable)
@ -6334,7 +6334,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 139)
(i32.const 137)
(i32.const 0)
)
(unreachable)
@ -6353,7 +6353,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 140)
(i32.const 138)
(i32.const 0)
)
(unreachable)
@ -6372,7 +6372,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 141)
(i32.const 139)
(i32.const 0)
)
(unreachable)
@ -6391,7 +6391,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 142)
(i32.const 140)
(i32.const 0)
)
(unreachable)

View File

@ -2,8 +2,6 @@ import "allocator/arena";
import { utoa32, itoa32, utoa64, itoa64 } from "internal/itoa";
// declare function logi(i: i32): void;
// preliminary
var str: string = "hi, I'm a string";

View File

@ -5290,7 +5290,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 13)
(i32.const 11)
(i32.const 0)
)
(unreachable)
@ -5309,7 +5309,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 15)
(i32.const 13)
(i32.const 0)
)
(unreachable)
@ -5329,7 +5329,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 16)
(i32.const 14)
(i32.const 0)
)
(unreachable)
@ -5347,7 +5347,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 17)
(i32.const 15)
(i32.const 0)
)
(unreachable)
@ -5370,7 +5370,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 18)
(i32.const 16)
(i32.const 0)
)
(unreachable)
@ -5388,7 +5388,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 19)
(i32.const 17)
(i32.const 0)
)
(unreachable)
@ -5409,7 +5409,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 21)
(i32.const 19)
(i32.const 0)
)
(unreachable)
@ -5430,7 +5430,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 22)
(i32.const 20)
(i32.const 0)
)
(unreachable)
@ -5451,7 +5451,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 23)
(i32.const 21)
(i32.const 0)
)
(unreachable)
@ -5472,7 +5472,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 24)
(i32.const 22)
(i32.const 0)
)
(unreachable)
@ -5493,7 +5493,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 25)
(i32.const 23)
(i32.const 0)
)
(unreachable)
@ -5514,7 +5514,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 26)
(i32.const 24)
(i32.const 0)
)
(unreachable)
@ -5535,7 +5535,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 27)
(i32.const 25)
(i32.const 0)
)
(unreachable)
@ -5556,7 +5556,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 28)
(i32.const 26)
(i32.const 0)
)
(unreachable)
@ -5582,7 +5582,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 30)
(i32.const 28)
(i32.const 0)
)
(unreachable)
@ -5608,7 +5608,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 31)
(i32.const 29)
(i32.const 0)
)
(unreachable)
@ -5636,7 +5636,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 32)
(i32.const 30)
(i32.const 0)
)
(unreachable)
@ -5662,7 +5662,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 33)
(i32.const 31)
(i32.const 0)
)
(unreachable)
@ -5688,7 +5688,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 34)
(i32.const 32)
(i32.const 0)
)
(unreachable)
@ -5714,7 +5714,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 35)
(i32.const 33)
(i32.const 0)
)
(unreachable)
@ -5735,7 +5735,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 36)
(i32.const 34)
(i32.const 0)
)
(unreachable)
@ -5756,7 +5756,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 37)
(i32.const 35)
(i32.const 0)
)
(unreachable)
@ -5777,7 +5777,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 38)
(i32.const 36)
(i32.const 0)
)
(unreachable)
@ -5798,7 +5798,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 39)
(i32.const 37)
(i32.const 0)
)
(unreachable)
@ -5819,7 +5819,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 40)
(i32.const 38)
(i32.const 0)
)
(unreachable)
@ -5839,7 +5839,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 46)
(i32.const 44)
(i32.const 0)
)
(unreachable)
@ -5859,7 +5859,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 47)
(i32.const 45)
(i32.const 0)
)
(unreachable)
@ -5879,7 +5879,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 48)
(i32.const 46)
(i32.const 0)
)
(unreachable)
@ -5899,7 +5899,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 49)
(i32.const 47)
(i32.const 0)
)
(unreachable)
@ -5919,7 +5919,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 50)
(i32.const 48)
(i32.const 0)
)
(unreachable)
@ -5939,7 +5939,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 51)
(i32.const 49)
(i32.const 0)
)
(unreachable)
@ -5959,7 +5959,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 52)
(i32.const 50)
(i32.const 0)
)
(unreachable)
@ -5979,7 +5979,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 53)
(i32.const 51)
(i32.const 0)
)
(unreachable)
@ -5998,7 +5998,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 55)
(i32.const 53)
(i32.const 0)
)
(unreachable)
@ -6017,7 +6017,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 56)
(i32.const 54)
(i32.const 0)
)
(unreachable)
@ -6036,7 +6036,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 57)
(i32.const 55)
(i32.const 0)
)
(unreachable)
@ -6055,7 +6055,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 58)
(i32.const 56)
(i32.const 0)
)
(unreachable)
@ -6074,7 +6074,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 59)
(i32.const 57)
(i32.const 0)
)
(unreachable)
@ -6097,7 +6097,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 62)
(i32.const 60)
(i32.const 0)
)
(unreachable)
@ -6114,7 +6114,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 63)
(i32.const 61)
(i32.const 0)
)
(unreachable)
@ -6131,7 +6131,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 64)
(i32.const 62)
(i32.const 0)
)
(unreachable)
@ -6148,7 +6148,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 65)
(i32.const 63)
(i32.const 0)
)
(unreachable)
@ -6165,7 +6165,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 67)
(i32.const 65)
(i32.const 0)
)
(unreachable)
@ -6182,7 +6182,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 68)
(i32.const 66)
(i32.const 0)
)
(unreachable)
@ -6199,7 +6199,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 69)
(i32.const 67)
(i32.const 0)
)
(unreachable)
@ -6216,7 +6216,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 70)
(i32.const 68)
(i32.const 0)
)
(unreachable)
@ -6231,6 +6231,25 @@
)
)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 69)
(i32.const 0)
)
(unreachable)
)
)
(if
(i32.eqz
(i32.eqz
(call $~lib/string/String.__lt
(i32.const 360)
(get_global $std/string/nullStr)
)
)
)
(block
(call $~lib/env/abort
(i32.const 0)
@ -6241,25 +6260,6 @@
(unreachable)
)
)
(if
(i32.eqz
(i32.eqz
(call $~lib/string/String.__lt
(i32.const 360)
(get_global $std/string/nullStr)
)
)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 73)
(i32.const 0)
)
(unreachable)
)
)
(if
(i32.eqz
(i32.eqz
@ -6273,7 +6273,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 74)
(i32.const 72)
(i32.const 0)
)
(unreachable)
@ -6290,7 +6290,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 76)
(i32.const 74)
(i32.const 0)
)
(unreachable)
@ -6307,7 +6307,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 77)
(i32.const 75)
(i32.const 0)
)
(unreachable)
@ -6324,7 +6324,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 78)
(i32.const 76)
(i32.const 0)
)
(unreachable)
@ -6341,7 +6341,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 79)
(i32.const 77)
(i32.const 0)
)
(unreachable)
@ -6356,6 +6356,44 @@
)
)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 78)
(i32.const 0)
)
(unreachable)
)
)
(if
(i32.eqz
(i32.eqz
(call $~lib/string/String.__gt
(i32.const 8)
(i32.const 444)
)
)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 79)
(i32.const 0)
)
(unreachable)
)
)
(if
(i32.eqz
(i32.eqz
(call $~lib/string/String.__lt
(i32.const 8)
(i32.const 8)
)
)
)
(block
(call $~lib/env/abort
(i32.const 0)
@ -6371,7 +6409,7 @@
(i32.eqz
(call $~lib/string/String.__gt
(i32.const 8)
(i32.const 444)
(i32.const 8)
)
)
)
@ -6385,44 +6423,6 @@
(unreachable)
)
)
(if
(i32.eqz
(i32.eqz
(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
(i32.eqz
(i32.eqz
(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
(i32.eqz
(call $~lib/string/String.__gte
@ -6434,7 +6434,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 84)
(i32.const 82)
(i32.const 0)
)
(unreachable)
@ -6451,7 +6451,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 85)
(i32.const 83)
(i32.const 0)
)
(unreachable)
@ -6470,7 +6470,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 87)
(i32.const 85)
(i32.const 0)
)
(unreachable)
@ -6490,7 +6490,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 89)
(i32.const 87)
(i32.const 0)
)
(unreachable)
@ -6510,7 +6510,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 90)
(i32.const 88)
(i32.const 0)
)
(unreachable)
@ -6530,7 +6530,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 91)
(i32.const 89)
(i32.const 0)
)
(unreachable)
@ -6550,7 +6550,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 92)
(i32.const 90)
(i32.const 0)
)
(unreachable)
@ -6570,7 +6570,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 93)
(i32.const 91)
(i32.const 0)
)
(unreachable)
@ -6590,7 +6590,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 94)
(i32.const 92)
(i32.const 0)
)
(unreachable)
@ -6610,7 +6610,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 95)
(i32.const 93)
(i32.const 0)
)
(unreachable)
@ -6630,7 +6630,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 96)
(i32.const 94)
(i32.const 0)
)
(unreachable)
@ -6650,7 +6650,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 97)
(i32.const 95)
(i32.const 0)
)
(unreachable)
@ -6669,7 +6669,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 99)
(i32.const 97)
(i32.const 0)
)
(unreachable)
@ -6688,7 +6688,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 100)
(i32.const 98)
(i32.const 0)
)
(unreachable)
@ -6707,7 +6707,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 101)
(i32.const 99)
(i32.const 0)
)
(unreachable)
@ -6726,7 +6726,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 102)
(i32.const 100)
(i32.const 0)
)
(unreachable)
@ -6745,7 +6745,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 103)
(i32.const 101)
(i32.const 0)
)
(unreachable)
@ -6764,7 +6764,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 104)
(i32.const 102)
(i32.const 0)
)
(unreachable)
@ -6783,7 +6783,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 105)
(i32.const 103)
(i32.const 0)
)
(unreachable)
@ -6802,7 +6802,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 106)
(i32.const 104)
(i32.const 0)
)
(unreachable)
@ -6821,7 +6821,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 107)
(i32.const 105)
(i32.const 0)
)
(unreachable)
@ -6840,7 +6840,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 108)
(i32.const 106)
(i32.const 0)
)
(unreachable)
@ -6859,7 +6859,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 109)
(i32.const 107)
(i32.const 0)
)
(unreachable)
@ -6878,7 +6878,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 110)
(i32.const 108)
(i32.const 0)
)
(unreachable)
@ -6897,7 +6897,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 111)
(i32.const 109)
(i32.const 0)
)
(unreachable)
@ -6916,7 +6916,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 112)
(i32.const 110)
(i32.const 0)
)
(unreachable)
@ -6935,7 +6935,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 114)
(i32.const 112)
(i32.const 0)
)
(unreachable)
@ -6954,7 +6954,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 115)
(i32.const 113)
(i32.const 0)
)
(unreachable)
@ -6973,7 +6973,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 116)
(i32.const 114)
(i32.const 0)
)
(unreachable)
@ -6992,7 +6992,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 117)
(i32.const 115)
(i32.const 0)
)
(unreachable)
@ -7011,7 +7011,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 118)
(i32.const 116)
(i32.const 0)
)
(unreachable)
@ -7030,7 +7030,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 120)
(i32.const 118)
(i32.const 0)
)
(unreachable)
@ -7049,7 +7049,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 121)
(i32.const 119)
(i32.const 0)
)
(unreachable)
@ -7068,7 +7068,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 122)
(i32.const 120)
(i32.const 0)
)
(unreachable)
@ -7087,7 +7087,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 123)
(i32.const 121)
(i32.const 0)
)
(unreachable)
@ -7106,7 +7106,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 124)
(i32.const 122)
(i32.const 0)
)
(unreachable)
@ -7125,7 +7125,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 125)
(i32.const 123)
(i32.const 0)
)
(unreachable)
@ -7144,7 +7144,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 126)
(i32.const 124)
(i32.const 0)
)
(unreachable)
@ -7163,7 +7163,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 127)
(i32.const 125)
(i32.const 0)
)
(unreachable)
@ -7182,7 +7182,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 128)
(i32.const 126)
(i32.const 0)
)
(unreachable)
@ -7201,7 +7201,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 129)
(i32.const 127)
(i32.const 0)
)
(unreachable)
@ -7220,7 +7220,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 130)
(i32.const 128)
(i32.const 0)
)
(unreachable)
@ -7239,7 +7239,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 132)
(i32.const 130)
(i32.const 0)
)
(unreachable)
@ -7258,7 +7258,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 133)
(i32.const 131)
(i32.const 0)
)
(unreachable)
@ -7277,7 +7277,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 134)
(i32.const 132)
(i32.const 0)
)
(unreachable)
@ -7296,7 +7296,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 135)
(i32.const 133)
(i32.const 0)
)
(unreachable)
@ -7315,7 +7315,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 136)
(i32.const 134)
(i32.const 0)
)
(unreachable)
@ -7334,7 +7334,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 137)
(i32.const 135)
(i32.const 0)
)
(unreachable)
@ -7353,7 +7353,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 138)
(i32.const 136)
(i32.const 0)
)
(unreachable)
@ -7372,7 +7372,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 139)
(i32.const 137)
(i32.const 0)
)
(unreachable)
@ -7391,7 +7391,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 140)
(i32.const 138)
(i32.const 0)
)
(unreachable)
@ -7410,7 +7410,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 141)
(i32.const 139)
(i32.const 0)
)
(unreachable)
@ -7429,7 +7429,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 48)
(i32.const 142)
(i32.const 140)
(i32.const 0)
)
(unreachable)

View 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)
)
)
)

View 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 {}

View 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)
)
)
)