From 5b2d5296960f52582da179f4cd1d55f585ecf51d Mon Sep 17 00:00:00 2001 From: Daniel Wirtz Date: Tue, 6 Oct 2020 21:27:50 +0200 Subject: [PATCH] Add RTrace shadow memory and instrumentation (#1476) BREAKING CHANGE: RTrace is now a class and the onrealloc callback has been split into onresize and onmove. --- lib/rtrace/README.md | 27 +- lib/rtrace/index.d.ts | 90 ++-- lib/rtrace/index.js | 404 ++++++++++++++---- lib/rtrace/package.json | 2 +- package.json | 3 +- src/definitions.ts | 4 + std/assembly/map.ts | 2 +- std/assembly/rt/pure.ts | 8 +- std/assembly/rt/rtrace.ts | 3 +- std/assembly/rt/tlsf.ts | 17 +- tests/bootstrap/index.ts | 31 +- tests/compiler.js | 98 ++++- tests/compiler/do.json | 7 +- tests/compiler/do.optimized.wat | 36 +- tests/compiler/do.untouched.wat | 34 +- .../extends-baseaggregate.optimized.wat | 12 +- .../extends-baseaggregate.untouched.wat | 55 ++- tests/compiler/for.json | 7 +- tests/compiler/for.optimized.wat | 36 +- tests/compiler/for.untouched.wat | 34 +- tests/compiler/implicit-getter-setter.json | 6 +- .../implicit-getter-setter.optimized.wat | 14 +- .../implicit-getter-setter.untouched.wat | 24 +- tests/compiler/issues/1095.json | 6 +- tests/compiler/issues/1095.optimized.wat | 14 +- tests/compiler/issues/1095.untouched.wat | 24 +- tests/compiler/issues/1225.json | 6 +- tests/compiler/issues/1225.optimized.wat | 14 +- tests/compiler/issues/1225.untouched.wat | 24 +- tests/compiler/logical.json | 6 +- tests/compiler/logical.optimized.wat | 14 +- tests/compiler/logical.untouched.wat | 24 +- tests/compiler/managed-cast.json | 7 +- tests/compiler/managed-cast.optimized.wat | 24 +- tests/compiler/managed-cast.untouched.wat | 32 +- tests/compiler/object-literal.json | 7 +- tests/compiler/object-literal.optimized.wat | 24 +- tests/compiler/object-literal.untouched.wat | 34 +- tests/compiler/rc/global-init.json | 6 +- tests/compiler/rc/global-init.untouched.wat | 19 +- tests/compiler/rc/local-init.json | 6 +- tests/compiler/rc/local-init.optimized.wat | 14 +- tests/compiler/rc/local-init.untouched.wat | 24 +- tests/compiler/rc/logical-and-mismatch.json | 6 +- .../rc/logical-and-mismatch.optimized.wat | 14 +- .../rc/logical-and-mismatch.untouched.wat | 24 +- tests/compiler/rc/logical-or-mismatch.json | 6 +- .../rc/logical-or-mismatch.optimized.wat | 14 +- .../rc/logical-or-mismatch.untouched.wat | 24 +- tests/compiler/rc/optimize.json | 6 +- tests/compiler/rc/optimize.optimized.wat | 14 +- tests/compiler/rc/optimize.untouched.wat | 24 +- tests/compiler/rc/rereturn.untouched.wat | 4 +- tests/compiler/rc/ternary-mismatch.json | 6 +- .../rc/ternary-mismatch.optimized.wat | 14 +- .../rc/ternary-mismatch.untouched.wat | 24 +- tests/compiler/resolve-ternary.optimized.wat | 2 +- tests/compiler/resolve-ternary.untouched.wat | 6 +- tests/compiler/retain-release-sanity.json | 6 +- .../retain-release-sanity.optimized.wat | 38 +- .../retain-release-sanity.untouched.wat | 89 ++-- tests/compiler/retain-return.untouched.wat | 4 +- tests/compiler/rt/finalize.optimized.wat | 2 +- tests/compiler/rt/finalize.untouched.wat | 10 +- tests/compiler/runtime-full.untouched.wat | 4 +- tests/compiler/std/array-literal.json | 6 +- .../compiler/std/array-literal.optimized.wat | 12 - .../compiler/std/array-literal.untouched.wat | 24 +- tests/compiler/std/array.json | 7 +- tests/compiler/std/array.optimized.wat | 38 +- tests/compiler/std/array.untouched.wat | 85 ++-- tests/compiler/std/arraybuffer.json | 6 +- tests/compiler/std/arraybuffer.optimized.wat | 12 - tests/compiler/std/arraybuffer.untouched.wat | 24 +- tests/compiler/std/dataview.json | 6 +- tests/compiler/std/dataview.optimized.wat | 14 +- tests/compiler/std/dataview.untouched.wat | 24 +- tests/compiler/std/map.json | 6 +- tests/compiler/std/map.optimized.wat | 30 +- tests/compiler/std/map.untouched.wat | 77 ++-- tests/compiler/std/set.json | 6 +- tests/compiler/std/set.optimized.wat | 30 +- tests/compiler/std/set.untouched.wat | 77 ++-- tests/compiler/std/staticarray.json | 7 +- tests/compiler/std/staticarray.optimized.wat | 22 +- tests/compiler/std/staticarray.untouched.wat | 34 +- tests/compiler/std/string-casemapping.json | 4 +- .../std/string-casemapping.optimized.wat | 40 +- .../std/string-casemapping.untouched.wat | 87 ++-- tests/compiler/std/string-encoding.json | 6 +- .../std/string-encoding.optimized.wat | 32 +- .../std/string-encoding.untouched.wat | 77 ++-- tests/compiler/std/string.json | 7 +- tests/compiler/std/string.optimized.wat | 40 +- tests/compiler/std/string.untouched.wat | 87 ++-- tests/compiler/std/typedarray.json | 7 +- tests/compiler/std/typedarray.optimized.wat | 38 +- tests/compiler/std/typedarray.untouched.wat | 87 ++-- tests/compiler/throw.json | 6 +- tests/compiler/throw.untouched.wat | 12 +- tests/compiler/while.json | 7 +- tests/compiler/while.optimized.wat | 36 +- tests/compiler/while.untouched.wat | 34 +- 103 files changed, 1114 insertions(+), 1664 deletions(-) diff --git a/lib/rtrace/README.md b/lib/rtrace/README.md index 326fbbe4be..a6b0f18622 100644 --- a/lib/rtrace/README.md +++ b/lib/rtrace/README.md @@ -5,17 +5,34 @@ A tiny utility that records allocations, retains, releases and frees performed b Instructions ------------ -Compile your module that uses the full or half runtime with `-use ASC_RTRACE=1` and include an instance of this module as the import named `rtrace`. +Compile your module that uses the full or half runtime with `-use ASC_RTRACE=1 --explicitStart` and include an instance of this module as the import named `rtrace`. ```js -var rtr = rtrace(e => { - // handle error +var rtrace = new Rtrace({ + onerror(err, info) { + // handle error + }, + oninfo(msg) { + // print message, optional + }, + getMemory() { + // obtain the module's memory, + // e.g. with --explicitStart: + return instance.exports.memory; + } }); -WebAssembly.instantiate(..., { rtrace: rtr, ... }); +var { module, instance } = await WebAssembly.instantiate(..., { + rtrace, + env: Object.assign({ // + ... // only required when instrumenting memory + }, rtrace.env), // + ... +}); +instance.exports._start(); ... -if (rtr.active) { +if (rtrace.active) { let leakCount = rtr.check(); if (leakCount) { // handle error diff --git a/lib/rtrace/index.d.ts b/lib/rtrace/index.d.ts index ddcc282a81..59b2e54a95 100644 --- a/lib/rtrace/index.d.ts +++ b/lib/rtrace/index.d.ts @@ -1,63 +1,41 @@ -/** Creates a new `RTrace` instance, tracking allocations, frees and reference counts. */ -declare function rtrace( +/** Block information. */ +export declare interface BlockInfo { + /** Pointer to the block. */ + ptr: number, + /** Block size. */ + size: number, + /** Runtime header. */ + header: { + /** Memory manager info bits. */ + mmInfo: number, + /** Garbage collector info bits. */ + gcInfo: number, + /** Runtime id. */ + rtId: number, + /** Runtime size. */ + rtSize: number + }, + toString(): string +} + +export declare interface RtraceOptions { /** Function being called when a problem is detected. */ - onerror?: (error: Error) => void, + onerror?: (error: Error, info: BlockInfo) => void, /** Function being called with information messages. */ - oninfo?: (info: string) => void -): rtrace.RTrace; - -declare namespace rtrace { - /** The rtrace instance used as the `rtrace` import to the Wasm module. */ - export interface RTrace { - /** Number of allocations so far. */ - allocCount: number; - /** Number of reallocations so far. */ - reallocCount: number; - /** Number of frees so far. */ - freeCount: number; - /** Number of RC increments (retains) so far. */ - incrementCount: number; - /** Number of RC decrements (releases) so far. */ - decrementCount: number; - - /** Called when a new block is allocated. */ - onalloc( - /** New block being allocated. */ - block: number - ): void; - - /** Called when a block is reallocated and must be moved. */ - onrealloc( - /** Block being moved. */ - oldBlock: number, - /** New block used from now on. */ - newBlock: number - ): void; - - /** Called when a block is freed, implicitly or explicitly. */ - onfree( - /** Block being freed. */ - block: number - ): void; + oninfo?: (msg: string) => void, + /** Obtains the module's memory instance. */ + getMemory() +} - /** Called when a reference to a block is retained (RC incremented by one). */ - onincrement( - /** Block a reference to is being retained. */ - block: number - ): void; +export declare class Rtrace { + [key: string]: unknown; // can be used as a Wasm import - /** Called when a reference to a block is released (RC decremented by one). */ - ondecrement( - /** Block a reference to is being released. */ - block: number - ): void; + /** Creates a new `RTrace` instance. */ + constructor(options: RtraceOptions); - /** Checks if rtrace is active, i.e. at least one event has occurred. */ - readonly active: boolean; + /** Checks if rtrace is active, i.e. at least one event has occurred. */ + readonly active: boolean; - /** Checks if there are any leaks and emits them via `oninfo`. Returns the number of live blocks. */ - check(): number; - } + /** Checks if there are any leaks and emits them via `oninfo`. Returns the number of live blocks. */ + check(): number; } - -export = rtrace; diff --git a/lib/rtrace/index.js b/lib/rtrace/index.js index 0cd2c05a13..4815afa12c 100644 --- a/lib/rtrace/index.js +++ b/lib/rtrace/index.js @@ -1,94 +1,344 @@ -function rtrace(onerror, oninfo) { - if (!onerror) onerror = function() { /* nop */ }; - if (!oninfo) oninfo = function() { /* nop */ }; - var blocks = new Map(); - var rtrace = { - - allocCount: 0, - reallocCount: 0, - freeCount: 0, - incrementCount: 0, - decrementCount: 0, - - onalloc: function(block) { - ++rtrace.allocCount; - if (blocks.has(block)) { - onerror(Error("duplicate alloc: " + block)); - } else { - oninfo("ALLOC " + block); - blocks.set(block, 0); +// WebAssembly pages are 65536 kb +const PAGE_SIZE_BITS = 16; +const PAGE_SIZE = 1 << PAGE_SIZE_BITS; +const PAGE_MASK = PAGE_SIZE - 1; + +// Wasm32 pointer size is 4 bytes +const PTR_SIZE_BITS = 2; +const PTR_SIZE = 1 << PTR_SIZE_BITS; +const PTR_MASK = PTR_SIZE - 1; +const PTR_VIEW = Uint32Array; + +const BLOCK_OVERHEAD = 16; + +function assert(x) { + if (!x) throw Error("assertion failed"); + return x; +} + +Error.stackTraceLimit = 50; + +function trimStacktrace(stack, levels) { + return stack.split(/\r?\n/).slice(1 + levels); +} + +function isTLSF(stack) { + return stack[0].startsWith(" at ~lib/rt/tlsf/"); +} + +class Rtrace { + + constructor(options) { + this.options = options || {}; + this.onerror = this.options.onerror || function() { /* nop */ }; + this.oninfo = this.options.oninfo || function() { /* nop */ }; + this.memory = null; + this.shadow = null; + this.shadowStart = 0x100000000; + this.refCounts = new Map(); + this.blocks = new Map(); + this.allocSites = new Map(); + this.allocCount = 0; + this.resizeCount = 0; + this.moveCount = 0; + this.freeCount = 0; + this.incrementCount = 0; + this.decrementCount = 0; + + // The following hooks cannot just be on the prototype but must be + // bound so the Rtrace instance can be used as a WebAssembly import. + this.onalloc = this.onalloc.bind(this); + this.onresize = this.onresize.bind(this); + this.onmove = this.onmove.bind(this); + this.onfree = this.onfree.bind(this); + this.onincrement = this.onincrement.bind(this); + this.ondecrement = this.ondecrement.bind(this); + this.env = { + load_ptr: this.load_ptr.bind(this), + load_val_i32: this.load_val_i32.bind(this), + load_val_i64: this.load_val_i64.bind(this), + load_val_f32: this.load_val_f32.bind(this), + load_val_f64: this.load_val_f64.bind(this), + store_ptr: this.store_ptr.bind(this), + store_val_i32: this.store_val_i32.bind(this), + store_val_i64: this.store_val_i64.bind(this), + store_val_f32: this.store_val_f32.bind(this), + store_val_f64: this.store_val_f64.bind(this) + }; + } + + /** Synchronizes the shadow memory with the module's memory. */ + syncShadow() { + if (!this.memory) { + this.memory = assert(this.options.getMemory()); + this.shadow = new WebAssembly.Memory({ + initial: ((this.memory.buffer.byteLength + PAGE_MASK) & ~PAGE_MASK) >>> PAGE_SIZE_BITS + }); + } else { + var diff = this.memory.buffer.byteLength - this.shadow.buffer.byteLength; + if (diff > 0) this.shadow.grow(diff >>> 16); + } + } + + /** Marks a block's presence in shadow memory. */ + markShadow(info, oldSize = 0) { + assert(this.shadow && this.shadow.byteLength == this.memory.byteLength); + assert((info.size & PTR_MASK) == 0); + if (info.ptr < this.shadowStart) { + this.shadowStart = info.ptr; + } + var len = info.size >>> PTR_SIZE_BITS; + var view = new PTR_VIEW(this.shadow.buffer, info.ptr, len); + var errored = false; + var start = oldSize >>> PTR_SIZE_BITS; + for (let i = 0; i < start; ++i) { + if (view[i] != info.ptr && !errored) { + this.onerror(Error("shadow region mismatch: " + view[i] + " != " + info.ptr), info); + errored = true; } - }, + } + errored = false; + for (let i = start; i < len; ++i) { + if (view[i] != 0 && !errored) { + this.onerror(Error("shadow region already in use: " + view[i] + " != 0"), info); + errored = true; + } + view[i] = info.ptr; + } + } - onrealloc: function(oldBlock, newBlock) { - ++rtrace.reallocCount; - if (!blocks.has(oldBlock)) { - onerror(Error("orphaned realloc (old): " + oldBlock)); - } else { - if (!blocks.has(newBlock)) { - onerror(Error("orphaned realloc (new): " + newBlock)); - } else { - let newRc = blocks.get(newBlock); - if (newRc != 0) { - onerror(Error("invalid realloc: " + oldBlock + " -> " + newBlock + " @ " + newRc)); - } else { - let oldRc = blocks.get(oldBlock); - oninfo("REALLOC " + oldBlock + " @ " + oldRc + " -> " + newBlock); - blocks.set(newBlock, oldRc); - } - } + /** Unmarks a block's presence in shadow memory. */ + unmarkShadow(info, oldSize = info.size) { + assert(this.shadow && this.shadow.byteLength == this.memory.byteLength); + var len = oldSize >>> PTR_SIZE_BITS; + var view = new PTR_VIEW(this.shadow.buffer, info.ptr, len); + var errored = false; + var start = 0; + if (oldSize != info.size) { + assert(oldSize > info.size); + start = info.size >>> PTR_SIZE_BITS; + } + for (let i = 0; i < len; ++i) { + if (view[i] != info.ptr && !errored) { + this.onerror(Error("shadow region mismatch: " + view[i] + " != " + info.ptr), info); + errored = true; } - }, + if (i >= start) view[i] = 0; + } + } - onfree: function(block) { - ++rtrace.freeCount; - if (!blocks.has(block)) { - onerror(Error("orphaned free: " + block)); - } else { - oninfo("FREE " + block + " @ " + blocks.get(block)); - blocks.delete(block); + /** Performs an access to shadow memory. */ + accessShadow(ptr, size, isLoad) { + this.syncShadow(); + if (ptr < this.shadowStart) return; + var value = new Uint32Array(this.shadow.buffer, ptr & ~PTR_MASK, 1)[0]; + if (value != 0) return; + // FIXME: this is extremely slow + let stack = trimStacktrace(new Error().stack, 2); + if (!isTLSF(stack)) { + this.onerror(new Error("OOB " + (isLoad ? "load" : "store") + (8 * size) + " at address " + ptr + "\n" + stack.join("\n"))); + } + } + + /** Obtains information about a block. */ + getBlockInfo(ptr) { + var header = new Uint32Array(this.memory.buffer, ptr, 4); + var mmInfo = header[0]; + var gcInfo = header[1]; + const mmTags = [ // 0│L│F + [], + ["FREE"], + ["LEFTFREE"], + ["FREE", "LEFTFREE"] + ]; + const gcColor = [ + "BLACK", + "GRAY", + "WHITE", + "PURPLE" + ]; + var size = mmInfo & ~3; + return { + ptr, + size: BLOCK_OVERHEAD + size, // block size + header: { + mmInfo: { + tags: mmTags[mmInfo & 3], + size: size + }, + gcInfo: { + buffered: (gcInfo >>> 31) === 1, + color: gcColor[gcInfo << 1 >>> 29], + rc: gcInfo << 4 >>> 4 + }, + rtId: header[2], + rtSize: header[3] } - }, + }; + } - onincrement: function(block) { - ++rtrace.incrementCount; - if (!blocks.has(block)) { - onerror(Error("orphaned increment: " + block)); - } else { - let rc = blocks.get(block); - oninfo("++ " + block + " @ " + rc + "->" + (rc + 1)); - blocks.set(block, rc + 1); + /** Checks if rtrace is active, i.e. at least one event has occurred. */ + get active() { + return Boolean(this.allocCount || this.moveCount || this.freeCount || this.incrementCount || this.decrementCount); + } + + /** Checks if there are any leaks and emits them via `oninfo`. Returns the number of live blocks. */ + check() { + if (this.refCounts.size == 1) return 0; // purerc roots + if (this.oninfo) { + for (let [ptr, rc] of this.refCounts) { + this.oninfo("LEAKING " + ptr + " @ " + rc); + } + } + return this.refCounts.size; + } + + // Runtime instrumentation + + onalloc(ptr) { + this.syncShadow(); + ++this.allocCount; + var info = this.getBlockInfo(ptr); + if (this.refCounts.has(ptr)) { + this.onerror(Error("duplicate alloc: " + ptr), info); + } else { + this.oninfo("ALLOC " + ptr + ".." + (ptr + info.size)); + this.markShadow(info); + this.refCounts.set(ptr, 0); + this.blocks.set(ptr, Object.assign(info, { + allocStack: trimStacktrace(new Error().stack, /* onalloc */ 1) + })); + } + } + + onresize(ptr, oldSize) { + this.syncShadow(); + ++this.resizeCount; + var info = this.getBlockInfo(ptr); + if (!this.refCounts.has(ptr)) { + this.onerror(Error("orphaned resize: " + ptr), info); + } else { + this.oninfo("RESIZE " + ptr + ".." + (ptr + info.size) + " (" + oldSize + "->" + info.size + ")"); + if (info.size > oldSize) { + this.markShadow(info, BLOCK_OVERHEAD + oldSize); + } else if (info.size < oldSize) { + this.unmarkShadow(info, BLOCK_OVERHEAD + oldSize); } - }, + } + } - ondecrement: function(block) { - ++rtrace.decrementCount; - if (!blocks.has(block)) { - onerror(Error("orphaned decrement: " + block)); + onmove(oldPtr, newPtr) { + this.syncShadow(); + ++this.moveCount; + var oldInfo = this.getBlockInfo(oldPtr); + var newInfo = this.getBlockInfo(newPtr); + if (!this.refCounts.has(oldPtr)) { + this.onerror(Error("orphaned move (old): " + oldPtr), oldInfo); + } else { + if (!this.refCounts.has(newPtr)) { + this.onerror(Error("orphaned move (new): " + newPtr), newInfo); } else { - let rc = blocks.get(block); - if (rc < 1) { - onerror(Error("invalid decrement: " + block + " @ " + rc)); + let newRc = this.refCounts.get(newPtr); + if (newRc != 0) { + this.onerror(Error("invalid realloc: " + oldPtr + " -> " + newPtr + " @ " + newRc), oldInfo); } else { - oninfo("-- " + block + " @ " + rc + "->" + (rc - 1)); - blocks.set(block, rc - 1); + let oldRc = this.refCounts.get(oldPtr); + this.oninfo("MOVE " + oldPtr + ".." + (oldPtr + oldInfo.size) + " @ " + oldRc + " -> " + newPtr + ".." + (newPtr + newInfo.size)); + this.refCounts.set(newPtr, oldRc); + // calls new alloc before and old free after } } - }, + } + } - get active() { - return Boolean(rtrace.allocCount || rtrace.reallocCount || rtrace.freeCount || rtrace.incrementCount || rtrace.decrementCount); - }, + onfree(ptr) { + this.syncShadow(); + ++this.freeCount; + var info = this.getBlockInfo(ptr); + if (!this.refCounts.has(ptr)) { + this.onerror(Error("orphaned free: " + ptr), info); + } else { + this.oninfo("FREE " + ptr + ".." + (ptr + info.size) + " @ " + this.refCounts.get(ptr)); + this.refCounts.delete(ptr); + this.unmarkShadow(info); + let block = this.blocks.get(ptr); + block.freeStack = trimStacktrace(new Error().stack, /* onfree */ 1); + } + } - check() { - if (oninfo) { - for (let [block, rc ] of blocks) { - oninfo("LEAKING " + block + " @ " + rc); - } + onincrement(ptr) { + this.syncShadow(); + ++this.incrementCount; + var info = this.getBlockInfo(ptr); + if (!this.refCounts.has(ptr)) { + this.onerror(Error("orphaned increment: " + ptr), info); + } else { + let rc = this.refCounts.get(ptr); + this.oninfo("++ " + ptr + " @ " + rc + "->" + (rc + 1)); + this.refCounts.set(ptr, rc + 1); + } + } + + ondecrement(ptr) { + this.syncShadow(); + ++this.decrementCount; + var info = this.getBlockInfo(ptr); + if (!this.refCounts.has(ptr)) { + this.onerror(Error("orphaned decrement: " + ptr), info); + } else { + let rc = this.refCounts.get(ptr); + if (rc < 1) { + this.onerror(Error("invalid decrement: " + ptr + " @ " + rc), info); + } else { + this.oninfo("-- " + ptr + " @ " + rc + "->" + (rc - 1)); + this.refCounts.set(ptr, rc - 1); } - return blocks.size; } - }; - return rtrace; + } + + // Memory instrumentation + + load_ptr(id, bytes, offset, address) { + this.accessShadow(address + offset, bytes, true); + return address; + } + + load_val_i32(id, value) { + return value; + } + + load_val_i64(id, value) { + return value; + } + + load_val_f32(id, value) { + return value; + } + + load_val_f64(id, value) { + return value; + } + + store_ptr(id, bytes, offset, address) { + this.accessShadow(address + offset, bytes, false); + return address; + } + + store_val_i32(id, value) { + return value; + } + + store_val_i64(id, value) { + return value; + } + + store_val_f32(id, value) { + return value; + } + + store_val_f64(id, value) { + return value; + } } -module.exports = rtrace; + +exports.Rtrace = Rtrace; diff --git a/lib/rtrace/package.json b/lib/rtrace/package.json index ad80262306..c46bf3c052 100644 --- a/lib/rtrace/package.json +++ b/lib/rtrace/package.json @@ -1,7 +1,7 @@ { "name": "@assemblyscript/rtrace", "types": "index.d.ts", - "version": "0.1.0", + "version": "0.2.0", "license": "Apache-2.0", "main": "index.js" } diff --git a/package.json b/package.json index ae2e6c45e1..40a1feaac6 100644 --- a/package.json +++ b/package.json @@ -71,8 +71,9 @@ "prepublishOnly": "node scripts/prepublish", "postpublish": "node scripts/postpublish", "asbuild": "npm run asbuild:untouched && npm run asbuild:optimized", - "asbuild:untouched": "node bin/asc src/glue/wasm/index.ts src/index.ts -t out/assemblyscript.untouched.wat -b out/assemblyscript.untouched.wasm -d out/assemblyscript.d.ts --debug --measure --runtime stub", + "asbuild:untouched": "node bin/asc src/glue/wasm/index.ts src/index.ts -t out/assemblyscript.untouched.wat -b out/assemblyscript.untouched.wasm -d out/assemblyscript.d.ts --debug --measure --runtime stub --explicitStart", "asbuild:optimized": "node bin/asc src/glue/wasm/index.ts src/index.ts -t out/assemblyscript.optimized.wat -b out/assemblyscript.optimized.wasm -O3 --measure --runtime stub", + "asbuild:rtraced": "node bin/asc src/glue/wasm/index.ts src/index.ts -t out/assemblyscript.rtraced.wat -b out/assemblyscript.rtraced.wasm --debug --measure --runtime full --explicitStart --use ASC_RTRACE=1 --runPasses instrument-memory", "astest": "ts-node tests/bootstrap" }, "releaseFiles": [ diff --git a/src/definitions.ts b/src/definitions.ts index 90b5b56f3e..82cae89ca5 100644 --- a/src/definitions.ts +++ b/src/definitions.ts @@ -582,6 +582,10 @@ export class TSDBuilder extends ExportsWalker { case TypeKind.F64: return "f64"; case TypeKind.V128: return "v128"; case TypeKind.VOID: return "void"; + case TypeKind.FUNCREF: return "funcref"; + case TypeKind.EXTERNREF: return "externref"; + case TypeKind.EXNREF: return "exnref"; + case TypeKind.ANYREF: return "anyref"; default: { assert(false); return "any"; diff --git a/std/assembly/map.ts b/std/assembly/map.ts index 2a193773f3..0239295c56 100644 --- a/std/assembly/map.ts +++ b/std/assembly/map.ts @@ -1,7 +1,7 @@ /// import { HASH } from "./util/hash"; -import { E_KEYNOTFOUND } from "util/error"; +import { E_KEYNOTFOUND } from "./util/error"; // A deterministic hash map based on CloseTable from https://github.com/jorendorff/dht diff --git a/std/assembly/rt/pure.ts b/std/assembly/rt/pure.ts index 9b7955fb06..1c81d38ad9 100644 --- a/std/assembly/rt/pure.ts +++ b/std/assembly/rt/pure.ts @@ -1,7 +1,7 @@ import { DEBUG, BLOCK_OVERHEAD } from "rt/common"; import { Block, freeBlock, ROOT } from "rt/tlsf"; import { TypeinfoFlags } from "shared/typeinfo"; -import { onincrement, ondecrement, onfree, onalloc } from "./rtrace"; +import { onincrement, ondecrement } from "./rtrace"; // === A Pure Reference Counting Garbage Collector === // see: https://researcher.watson.ibm.com/researcher/files/us-bacon/Bacon03Pure.pdf @@ -184,12 +184,8 @@ function growRoots(): void { var oldSize = CUR - oldRoots; var newSize = max(oldSize * 2, 64 << alignof()); var newRoots = __alloc(newSize, 0); - if (isDefined(ASC_RTRACE)) onfree(changetype(newRoots - BLOCK_OVERHEAD)); // neglect unmanaged memory.copy(newRoots, oldRoots, oldSize); - if (oldRoots) { - if (isDefined(ASC_RTRACE)) onalloc(changetype(oldRoots - BLOCK_OVERHEAD)); // neglect unmanaged - __free(oldRoots); - } + if (oldRoots) __free(oldRoots); ROOTS = newRoots; CUR = newRoots + oldSize; END = newRoots + newSize; diff --git a/std/assembly/rt/rtrace.ts b/std/assembly/rt/rtrace.ts index 384ff4a1e4..9b0cc8b5ac 100644 --- a/std/assembly/rt/rtrace.ts +++ b/std/assembly/rt/rtrace.ts @@ -1,7 +1,8 @@ import { BLOCK } from "./common"; export declare function onalloc(s: BLOCK): void; -export declare function onrealloc(sOld: BLOCK, sNew: BLOCK): void; +export declare function onresize(s: BLOCK, oldSize: usize): void; +export declare function onmove(sOld: BLOCK, sNew: BLOCK): void; export declare function onincrement(s: BLOCK): void; export declare function ondecrement(s: BLOCK): void; export declare function onfree(s: BLOCK): void; diff --git a/std/assembly/rt/tlsf.ts b/std/assembly/rt/tlsf.ts index 2b4ab8a251..c74ae995a2 100644 --- a/std/assembly/rt/tlsf.ts +++ b/std/assembly/rt/tlsf.ts @@ -1,5 +1,5 @@ import { AL_BITS, AL_MASK, DEBUG, BLOCK, BLOCK_OVERHEAD, BLOCK_MAXSIZE } from "rt/common"; -import { onfree, onalloc, onrealloc } from "./rtrace"; +import { onalloc, onresize, onmove, onfree } from "./rtrace"; import { REFCOUNT_MASK } from "./pure"; // === The TLSF (Two-Level Segregate Fit) memory allocator === @@ -523,7 +523,7 @@ export function allocateBlock(root: Root, size: usize, id: u32): Block { block.rtSize = size; removeBlock(root, block); prepareBlock(root, block, payloadSize); - if (isDefined(ASC_RTRACE)) onalloc(block); + if (isDefined(ASC_RTRACE)) onalloc(block); return block; } @@ -531,11 +531,15 @@ export function allocateBlock(root: Root, size: usize, id: u32): Block { export function reallocateBlock(root: Root, block: Block, size: usize): Block { var payloadSize = prepareSize(size); var blockInfo = block.mmInfo; + var currentSize = blockInfo & ~TAGS_MASK; // possibly split and update runtime size if it still fits - if (payloadSize <= (blockInfo & ~TAGS_MASK)) { + if (payloadSize <= currentSize) { prepareBlock(root, block, payloadSize); block.rtSize = size; + if (isDefined(ASC_RTRACE)) { + if (payloadSize != currentSize) onresize(block, currentSize); + } return block; } @@ -543,7 +547,7 @@ export function reallocateBlock(root: Root, block: Block, size: usize): Block { var right = GETRIGHT(block); var rightInfo = right.mmInfo; if (rightInfo & FREE) { - let mergeSize = (blockInfo & ~TAGS_MASK) + BLOCK_OVERHEAD + (rightInfo & ~TAGS_MASK); + let mergeSize = currentSize + BLOCK_OVERHEAD + (rightInfo & ~TAGS_MASK); if (mergeSize >= payloadSize) { removeBlock(root, right); // TODO: this can yield an intermediate block larger than BLOCK_MAXSIZE, which @@ -551,6 +555,7 @@ export function reallocateBlock(root: Root, block: Block, size: usize): Block { block.mmInfo = (blockInfo & TAGS_MASK) | mergeSize; block.rtSize = size; prepareBlock(root, block, payloadSize); + if (isDefined(ASC_RTRACE)) onresize(block, currentSize); return block; } } @@ -560,7 +565,7 @@ export function reallocateBlock(root: Root, block: Block, size: usize): Block { newBlock.gcInfo = block.gcInfo; // keep RC memory.copy(changetype(newBlock) + BLOCK_OVERHEAD, changetype(block) + BLOCK_OVERHEAD, size); if (changetype(block) >= __heap_base) { - if (isDefined(ASC_RTRACE)) onrealloc(block, newBlock); + if (isDefined(ASC_RTRACE)) onmove(block, newBlock); freeBlock(root, block); } return newBlock; @@ -570,8 +575,8 @@ export function reallocateBlock(root: Root, block: Block, size: usize): Block { export function freeBlock(root: Root, block: Block): void { var blockInfo = block.mmInfo; block.mmInfo = blockInfo | FREE; - insertBlock(root, block); if (isDefined(ASC_RTRACE)) onfree(block); + insertBlock(root, block); } /** Checks that a used block is valid to be freed or reallocated. */ diff --git a/tests/bootstrap/index.ts b/tests/bootstrap/index.ts index 098b8c0dd6..d0f23f8acb 100644 --- a/tests/bootstrap/index.ts +++ b/tests/bootstrap/index.ts @@ -1,12 +1,13 @@ import * as fs from "fs"; import * as path from "path"; +import * as v8 from "v8"; import * as binaryen from "binaryen"; -import * as util from "util"; import * as loader from "../../lib/loader"; +import { Rtrace } from "../../lib/rtrace"; import * as find from "../../cli/util/find"; import AssemblyScript from "../../out/assemblyscript"; -Error.stackTraceLimit = Infinity; +v8.setFlagsFromString("--experimental-wasm-bigint"); // Load stdlib const libDir = path.join(__dirname, "..", "..", "std", "assembly"); @@ -18,11 +19,27 @@ find.files(libDir, /^(?!.*\.d\.ts$).*\.ts$/).forEach((file: string) => { async function test(build: string): Promise { await binaryen.ready; + const rtrace = new Rtrace({ + onerror(err, info) { + console.log(err, info); + }, + oninfo(msg) { + // console.log(msg); + }, + getMemory() { + return asc.memory; + } + }); + const { exports: asc } = await loader.instantiate( fs.promises.readFile(`${ __dirname }/../../out/assemblyscript.${ build }.wasm`), - { binaryen } + { + binaryen, + rtrace, + env: rtrace.env + } ); - console.log(util.inspect(asc, true)); + if (asc._start) asc._start(); const cachedStrings = new Map(); function cachedString(text: string): number { @@ -59,8 +76,10 @@ async function test(build: string): Promise { console.log("\nParsing backlog ..."); var nextFilePtr = asc.nextFile(programPtr); while (nextFilePtr) { - const nextFile = asc.__getString(nextFilePtr); - if (!nextFile.startsWith("~lib/")) throw Error("unexpected file: " + nextFile); + let nextFile = asc.__getString(nextFilePtr); + if (!nextFile.startsWith("~lib/")) { // e.g. "rt/something" + nextFile = "~lib/" + nextFile; + } const text = libraryFiles[nextFile.substring(5)]; if (text == null) throw Error("missing file: " + nextFile); const textPtr = cachedString(libraryFiles[nextFile.substring(5)]); diff --git a/tests/compiler.js b/tests/compiler.js index c1de4130af..06692621e1 100644 --- a/tests/compiler.js +++ b/tests/compiler.js @@ -8,7 +8,7 @@ const colorsUtil = require("../cli/util/colors"); const optionsUtil = require("../cli/util/options"); const diff = require("./util/diff"); const asc = require("../cli/asc.js"); -const rtrace = require("../lib/rtrace"); +const { Rtrace } = require("../lib/rtrace"); const cluster = require("cluster"); const coreCount = require("physical-cpu-count"); @@ -121,6 +121,7 @@ function runTest(basename) { stderr.isTTY = true; var asc_flags = []; + var asc_rtrace = !!config.asc_rtrace; var v8_flags = ""; var v8_no_flags = ""; var missing_features = []; @@ -302,6 +303,54 @@ function runTest(basename) { } else { instantiateUntouched.end(SKIPPED); } + + if (!asc_rtrace) return; + + stdout.length = 0; + stderr.length = 0; + + // Build rtraced + var cmd = [ + basename + ".ts", + "--baseDir", basedir, + "--binaryFile", // -> stdout + "--debug", + "--use", "ASC_RTRACE=1", + "--explicitStart", + // "--runPasses", "instrument-memory" + ]; + if (asc_flags) { + Array.prototype.push.apply(cmd, asc_flags); + } + const compileRtraced = section("compile rtraced"); + asc.main(cmd, { + stdout: stdout, + stderr: stderr + }, err => { + if (err) { + stderr.write("---\n"); + stderr.write(err.stack); + stderr.write("\n---\n"); + failed = true; + failedMessages.set(basename, err.message); + failedTests.add(basename); + compileRtraced.end(FAILURE); + return 1; + } else { + compileRtraced.end(SUCCESS); + } + let rtracedBuffer = stdout.toBuffer(); + const instantiateRtrace = section("instantiate rtrace"); + v8.setFlagsFromString("--experimental-wasm-bigint"); + if (!testInstantiate(basename, rtracedBuffer, glue, stderr)) { + failed = true; + failedTests.add(basename); + instantiateRtrace.end(FAILURE); + } else { + instantiateRtrace.end(SUCCESS); + } + v8.setFlagsFromString("--no-experimental-wasm-bigint"); + }); }); if (failed) return 1; }); @@ -327,21 +376,23 @@ function testInstantiate(basename, binaryBuffer, glue, stderr) { return String.fromCharCode.apply(String, U16.subarray(ptr16, ptr16 + len16)); } - function onerror(e) { - console.log(" ERROR: " + e); - failed = true; - failedMessages.set(basename, e.message); - } - - function oninfo(i) { - console.log(" " + i); - } - - let rtr = rtrace(onerror, args.rtraceVerbose ? oninfo : null); + let rtrace = new Rtrace({ + onerror(err, info) { + console.log(" ERROR: " + err.stack); + failed = true; + failedMessages.set(basename, err.message); + }, + oninfo(msg, info) { + if (!args.rtraceVerbose) return; + console.log(" " + msg); + }, + getMemory() { + return instance.exports.memory; + } + }); var imports = { - rtrace: rtr, - env: { + env: Object.assign({ memory, abort: function(msg, file, line, column) { console.log(colorsUtil.red(" abort: " + getString(msg) + " in " + getString(file) + "(" + line + ":" + column + ")")); @@ -352,10 +403,11 @@ function testInstantiate(basename, binaryBuffer, glue, stderr) { seed: function() { return 0xA5534817; // make tests deterministic } - }, + }, rtrace.env), Math, Date, - Reflect + Reflect, + rtrace }; if (glue.preInstantiate) { console.log(" [call preInstantiate]"); @@ -375,7 +427,7 @@ function testInstantiate(basename, binaryBuffer, glue, stderr) { console.log(" [call postStart]"); glue.postStart(instance); } - let leakCount = rtr.check(); + let leakCount = rtrace.check(); if (leakCount) { let msg = "memory leak detected: " + leakCount + " leaking"; failed = true; @@ -383,12 +435,14 @@ function testInstantiate(basename, binaryBuffer, glue, stderr) { console.log(" " + msg); } if (!failed) { - if (rtr.active) { + if (rtrace.active) { console.log(" " + - rtr.allocCount + " allocs, " + - rtr.freeCount + " frees, " + - rtr.incrementCount + " increments, " + - rtr.decrementCount + " decrements" + rtrace.allocCount + " allocs, " + + rtrace.resizeCount + " resizes, " + + rtrace.moveCount + " moves, " + + rtrace.freeCount + " frees, " + + rtrace.incrementCount + " increments, " + + rtrace.decrementCount + " decrements" ); } return true; diff --git a/tests/compiler/do.json b/tests/compiler/do.json index 59c251c705..d8f53d9b42 100644 --- a/tests/compiler/do.json +++ b/tests/compiler/do.json @@ -1,7 +1,6 @@ { "asc_flags": [ - "--runtime half", - "--explicitStart", - "--use ASC_RTRACE=1" - ] + "--runtime half" + ], + "asc_rtrace": true } \ No newline at end of file diff --git a/tests/compiler/do.optimized.wat b/tests/compiler/do.optimized.wat index 9ce607790f..0d5b20aeb9 100644 --- a/tests/compiler/do.optimized.wat +++ b/tests/compiler/do.optimized.wat @@ -1,16 +1,12 @@ (module - (type $i32_=>_none (func (param i32))) (type $none_=>_none (func)) + (type $i32_=>_none (func (param i32))) (type $i32_i32_=>_none (func (param i32 i32))) (type $none_=>_i32 (func (result i32))) (type $i32_=>_i32 (func (param i32) (result i32))) (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) (memory $0 1) (data (i32.const 1024) "\n\00\00\00\01\00\00\00\01\00\00\00\n\00\00\00d\00o\00.\00t\00s") (data (i32.const 1056) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s") @@ -19,9 +15,8 @@ (global $do/ran (mut i32) (i32.const 0)) (global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0)) (global $~lib/rt/tlsf/collectLock (mut i32) (i32.const 0)) - (global $~started (mut i32) (i32.const 0)) - (export "_start" (func $~start)) (export "memory" (memory $0)) + (start $~start) (func $do/testNested (local $0 i32) (local $1 i32) @@ -968,8 +963,6 @@ i32.store end local.get $1 - call $~lib/rt/rtrace/onalloc - local.get $1 ) (func $do/Ref#constructor (result i32) (local $0 i32) @@ -979,14 +972,14 @@ call $~lib/rt/tlsf/allocateBlock i32.const 16 i32.add - local.tee $1 + local.tee $0 i32.const 1216 i32.gt_u if - local.get $1 + local.get $0 i32.const 16 i32.sub - local.tee $0 + local.tee $1 i32.load offset=4 local.tee $2 i32.const -268435456 @@ -1005,14 +998,12 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 local.get $2 i32.const 1 i32.add i32.store offset=4 - local.get $0 - call $~lib/rt/rtrace/onincrement - local.get $0 + local.get $1 i32.load i32.const 1 i32.and @@ -1025,7 +1016,7 @@ unreachable end end - local.get $1 + local.get $0 ) (func $~lib/rt/pure/__release (param $0 i32) local.get $0 @@ -1384,13 +1375,6 @@ end ) (func $~start - global.get $~started - if - return - else - i32.const 1 - global.set $~started - end call $start:do ) (func $~lib/rt/pure/decrement (param $0 i32) @@ -1403,8 +1387,6 @@ i32.and local.set $1 local.get $0 - call $~lib/rt/rtrace/ondecrement - local.get $0 i32.load i32.const 1 i32.and @@ -1467,8 +1449,6 @@ global.get $~lib/rt/tlsf/ROOT local.get $0 call $~lib/rt/tlsf/insertBlock - local.get $0 - call $~lib/rt/rtrace/onfree else local.get $1 i32.const 0 diff --git a/tests/compiler/do.untouched.wat b/tests/compiler/do.untouched.wat index eacfebc0d4..99dcddf54e 100644 --- a/tests/compiler/do.untouched.wat +++ b/tests/compiler/do.untouched.wat @@ -1,7 +1,7 @@ (module (type $none_=>_none (func)) - (type $i32_=>_none (func (param i32))) (type $i32_i32_=>_none (func (param i32 i32))) + (type $i32_=>_none (func (param i32))) (type $none_=>_i32 (func (result i32))) (type $i32_=>_i32 (func (param i32) (result i32))) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) @@ -9,10 +9,6 @@ (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) (memory $0 1) (data (i32.const 16) "\n\00\00\00\01\00\00\00\01\00\00\00\n\00\00\00d\00o\00.\00t\00s\00") (data (i32.const 48) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s\00") @@ -24,10 +20,9 @@ (global $~lib/ASC_LOW_MEMORY_LIMIT i32 (i32.const 0)) (global $~lib/rt/tlsf/collectLock (mut i32) (i32.const 0)) (global $~lib/gc/gc.auto (mut i32) (i32.const 1)) - (global $~started (mut i32) (i32.const 0)) (global $~lib/heap/__heap_base i32 (i32.const 208)) - (export "_start" (func $~start)) (export "memory" (memory $0)) + (start $~start) (func $do/testSimple (local $0 i32) (local $1 i32) @@ -1854,11 +1849,9 @@ local.get $4 local.get $3 call $~lib/rt/tlsf/prepareBlock - i32.const 1 + i32.const 0 drop local.get $4 - call $~lib/rt/rtrace/onalloc - local.get $4 ) (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -1900,10 +1893,8 @@ i32.const 1 i32.add i32.store offset=4 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/onincrement i32.const 1 drop local.get $0 @@ -2264,13 +2255,6 @@ end ) (func $~start - global.get $~started - if - return - else - i32.const 1 - global.set $~started - end call $start:do ) (func $~lib/rt/pure/__collect @@ -2288,13 +2272,11 @@ i32.const 1 i32.or i32.store + i32.const 0 + drop local.get $0 local.get $1 call $~lib/rt/tlsf/insertBlock - i32.const 1 - drop - local.get $1 - call $~lib/rt/rtrace/onfree ) (func $~lib/rt/pure/finalize (param $0 i32) i32.const 0 @@ -2313,10 +2295,8 @@ i32.const 268435455 i32.and local.set $2 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/ondecrement i32.const 1 drop local.get $0 diff --git a/tests/compiler/extends-baseaggregate.optimized.wat b/tests/compiler/extends-baseaggregate.optimized.wat index 1e44aeff87..4c3377a28d 100644 --- a/tests/compiler/extends-baseaggregate.optimized.wat +++ b/tests/compiler/extends-baseaggregate.optimized.wat @@ -1126,7 +1126,7 @@ if i32.const 0 i32.const 1136 - i32.const 580 + i32.const 585 i32.const 3 call $~lib/builtins/abort unreachable @@ -1322,6 +1322,7 @@ (local $4 i32) (local $5 i32) (local $6 i32) + (local $7 i32) local.get $2 call $~lib/rt/tlsf/prepareSize local.tee $3 @@ -1330,6 +1331,7 @@ local.tee $5 i32.const -4 i32.and + local.tee $4 i32.le_u if local.get $0 @@ -1352,16 +1354,14 @@ i32.add local.tee $6 i32.load - local.tee $4 + local.tee $7 i32.const 1 i32.and if - local.get $5 - i32.const -4 - i32.and + local.get $4 i32.const 16 i32.add - local.get $4 + local.get $7 i32.const -4 i32.and i32.add diff --git a/tests/compiler/extends-baseaggregate.untouched.wat b/tests/compiler/extends-baseaggregate.untouched.wat index 664c7a63fa..512df0215d 100644 --- a/tests/compiler/extends-baseaggregate.untouched.wat +++ b/tests/compiler/extends-baseaggregate.untouched.wat @@ -1603,7 +1603,7 @@ if i32.const 0 i32.const 128 - i32.const 580 + i32.const 585 i32.const 3 call $~lib/builtins/abort unreachable @@ -2873,11 +2873,11 @@ i32.const 1 i32.or i32.store + i32.const 0 + drop local.get $0 local.get $1 call $~lib/rt/tlsf/insertBlock - i32.const 0 - drop ) (func $~lib/rt/tlsf/reallocateBlock (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) @@ -2886,18 +2886,21 @@ (local $6 i32) (local $7 i32) (local $8 i32) + (local $9 i32) local.get $2 call $~lib/rt/tlsf/prepareSize local.set $3 local.get $1 i32.load local.set $4 - local.get $3 local.get $4 i32.const 3 i32.const -1 i32.xor i32.and + local.set $5 + local.get $3 + local.get $5 i32.le_u if local.get $0 @@ -2907,55 +2910,53 @@ local.get $1 local.get $2 i32.store offset=12 + i32.const 0 + drop local.get $1 return end local.get $1 - local.set $5 - local.get $5 + local.set $6 + local.get $6 i32.const 16 i32.add - local.get $5 + local.get $6 i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $6 - local.get $6 - i32.load local.set $7 local.get $7 + i32.load + local.set $8 + local.get $8 i32.const 1 i32.and if - local.get $4 - i32.const 3 - i32.const -1 - i32.xor - i32.and + local.get $5 i32.const 16 i32.add - local.get $7 + local.get $8 i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $5 - local.get $5 + local.set $6 + local.get $6 local.get $3 i32.ge_u if local.get $0 - local.get $6 + local.get $7 call $~lib/rt/tlsf/removeBlock local.get $1 local.get $4 i32.const 3 i32.and - local.get $5 + local.get $6 i32.or i32.store local.get $1 @@ -2965,6 +2966,8 @@ local.get $1 local.get $3 call $~lib/rt/tlsf/prepareBlock + i32.const 0 + drop local.get $1 return end @@ -2974,12 +2977,12 @@ local.get $1 i32.load offset=8 call $~lib/rt/tlsf/allocateBlock - local.set $8 - local.get $8 + local.set $9 + local.get $9 local.get $1 i32.load offset=4 i32.store offset=4 - local.get $8 + local.get $9 i32.const 16 i32.add local.get $1 @@ -2997,7 +3000,7 @@ local.get $1 call $~lib/rt/tlsf/freeBlock end - local.get $8 + local.get $9 ) (func $~lib/rt/tlsf/__realloc (param $0 i32) (param $1 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -3675,16 +3678,12 @@ i32.const 0 call $~lib/rt/tlsf/__alloc local.set $5 - i32.const 0 - drop local.get $5 local.get $0 local.get $1 call $~lib/memory/memory.copy local.get $0 if - i32.const 0 - drop local.get $0 call $~lib/rt/tlsf/__free end diff --git a/tests/compiler/for.json b/tests/compiler/for.json index 59c251c705..d8f53d9b42 100644 --- a/tests/compiler/for.json +++ b/tests/compiler/for.json @@ -1,7 +1,6 @@ { "asc_flags": [ - "--runtime half", - "--explicitStart", - "--use ASC_RTRACE=1" - ] + "--runtime half" + ], + "asc_rtrace": true } \ No newline at end of file diff --git a/tests/compiler/for.optimized.wat b/tests/compiler/for.optimized.wat index 39526bcc54..17a007bcaa 100644 --- a/tests/compiler/for.optimized.wat +++ b/tests/compiler/for.optimized.wat @@ -1,16 +1,12 @@ (module - (type $i32_=>_none (func (param i32))) (type $none_=>_none (func)) + (type $i32_=>_none (func (param i32))) (type $i32_i32_=>_none (func (param i32 i32))) (type $none_=>_i32 (func (result i32))) (type $i32_=>_i32 (func (param i32) (result i32))) (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) (memory $0 1) (data (i32.const 1024) "\0c\00\00\00\01\00\00\00\01\00\00\00\0c\00\00\00f\00o\00r\00.\00t\00s") (data (i32.const 1056) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s") @@ -19,9 +15,8 @@ (global $for/ran (mut i32) (i32.const 0)) (global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0)) (global $~lib/rt/tlsf/collectLock (mut i32) (i32.const 0)) - (global $~started (mut i32) (i32.const 0)) - (export "_start" (func $~start)) (export "memory" (memory $0)) + (start $~start) (func $for/testNestedContinue (local $0 i32) (local $1 i32) @@ -965,8 +960,6 @@ i32.store end local.get $1 - call $~lib/rt/rtrace/onalloc - local.get $1 ) (func $for/Ref#constructor (result i32) (local $0 i32) @@ -976,14 +969,14 @@ call $~lib/rt/tlsf/allocateBlock i32.const 16 i32.add - local.tee $1 + local.tee $0 i32.const 1216 i32.gt_u if - local.get $1 + local.get $0 i32.const 16 i32.sub - local.tee $0 + local.tee $1 i32.load offset=4 local.tee $2 i32.const -268435456 @@ -1002,14 +995,12 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 local.get $2 i32.const 1 i32.add i32.store offset=4 - local.get $0 - call $~lib/rt/rtrace/onincrement - local.get $0 + local.get $1 i32.load i32.const 1 i32.and @@ -1022,7 +1013,7 @@ unreachable end end - local.get $1 + local.get $0 ) (func $~lib/rt/pure/__release (param $0 i32) local.get $0 @@ -1394,13 +1385,6 @@ end ) (func $~start - global.get $~started - if - return - else - i32.const 1 - global.set $~started - end call $start:for ) (func $~lib/rt/pure/decrement (param $0 i32) @@ -1413,8 +1397,6 @@ i32.and local.set $1 local.get $0 - call $~lib/rt/rtrace/ondecrement - local.get $0 i32.load i32.const 1 i32.and @@ -1477,8 +1459,6 @@ global.get $~lib/rt/tlsf/ROOT local.get $0 call $~lib/rt/tlsf/insertBlock - local.get $0 - call $~lib/rt/rtrace/onfree else local.get $1 i32.const 0 diff --git a/tests/compiler/for.untouched.wat b/tests/compiler/for.untouched.wat index 3ea1d01e04..9247f271a1 100644 --- a/tests/compiler/for.untouched.wat +++ b/tests/compiler/for.untouched.wat @@ -1,7 +1,7 @@ (module (type $none_=>_none (func)) - (type $i32_=>_none (func (param i32))) (type $i32_i32_=>_none (func (param i32 i32))) + (type $i32_=>_none (func (param i32))) (type $i32_=>_i32 (func (param i32) (result i32))) (type $none_=>_i32 (func (result i32))) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) @@ -9,10 +9,6 @@ (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) (memory $0 1) (data (i32.const 16) "\0c\00\00\00\01\00\00\00\01\00\00\00\0c\00\00\00f\00o\00r\00.\00t\00s\00") (data (i32.const 48) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s\00") @@ -24,10 +20,9 @@ (global $~lib/ASC_LOW_MEMORY_LIMIT i32 (i32.const 0)) (global $~lib/rt/tlsf/collectLock (mut i32) (i32.const 0)) (global $~lib/gc/gc.auto (mut i32) (i32.const 1)) - (global $~started (mut i32) (i32.const 0)) (global $~lib/heap/__heap_base i32 (i32.const 208)) - (export "_start" (func $~start)) (export "memory" (memory $0)) + (start $~start) (func $for/testInitExpression (local $0 i32) (local $1 i32) @@ -1867,11 +1862,9 @@ local.get $4 local.get $3 call $~lib/rt/tlsf/prepareBlock - i32.const 1 + i32.const 0 drop local.get $4 - call $~lib/rt/rtrace/onalloc - local.get $4 ) (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -1913,10 +1906,8 @@ i32.const 1 i32.add i32.store offset=4 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/onincrement i32.const 1 drop local.get $0 @@ -2309,13 +2300,6 @@ end ) (func $~start - global.get $~started - if - return - else - i32.const 1 - global.set $~started - end call $start:for ) (func $~lib/rt/pure/__collect @@ -2333,13 +2317,11 @@ i32.const 1 i32.or i32.store + i32.const 0 + drop local.get $0 local.get $1 call $~lib/rt/tlsf/insertBlock - i32.const 1 - drop - local.get $1 - call $~lib/rt/rtrace/onfree ) (func $~lib/rt/pure/finalize (param $0 i32) i32.const 0 @@ -2358,10 +2340,8 @@ i32.const 268435455 i32.and local.set $2 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/ondecrement i32.const 1 drop local.get $0 diff --git a/tests/compiler/implicit-getter-setter.json b/tests/compiler/implicit-getter-setter.json index 0c036aee46..b2ec062017 100644 --- a/tests/compiler/implicit-getter-setter.json +++ b/tests/compiler/implicit-getter-setter.json @@ -1,6 +1,6 @@ { "asc_flags": [ - "--runtime full", - "--use ASC_RTRACE=1" - ] + "--runtime full" + ], + "asc_rtrace": true } \ No newline at end of file diff --git a/tests/compiler/implicit-getter-setter.optimized.wat b/tests/compiler/implicit-getter-setter.optimized.wat index 2a041ed9ba..92346840ab 100644 --- a/tests/compiler/implicit-getter-setter.optimized.wat +++ b/tests/compiler/implicit-getter-setter.optimized.wat @@ -1,18 +1,14 @@ (module - (type $i32_=>_none (func (param i32))) (type $i32_i32_=>_none (func (param i32 i32))) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) (type $i32_=>_i32 (func (param i32) (result i32))) + (type $i32_=>_none (func (param i32))) (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) (type $none_=>_none (func)) (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) (type $none_=>_i32 (func (result i32))) (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) (memory $0 1) (data (i32.const 1024) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s") (data (i32.const 1072) "(\00\00\00\01\00\00\00\01\00\00\00(\00\00\00a\00l\00l\00o\00c\00a\00t\00i\00o\00n\00 \00t\00o\00o\00 \00l\00a\00r\00g\00e") @@ -1035,8 +1031,6 @@ local.get $4 call $~lib/rt/tlsf/prepareBlock local.get $3 - call $~lib/rt/rtrace/onalloc - local.get $3 ) (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -1081,8 +1075,6 @@ i32.add i32.store offset=4 local.get $1 - call $~lib/rt/rtrace/onincrement - local.get $1 i32.load i32.const 1 i32.and @@ -1184,8 +1176,6 @@ i32.and local.set $1 local.get $0 - call $~lib/rt/rtrace/ondecrement - local.get $0 i32.load i32.const 1 i32.and @@ -1248,8 +1238,6 @@ global.get $~lib/rt/tlsf/ROOT local.get $0 call $~lib/rt/tlsf/insertBlock - local.get $0 - call $~lib/rt/rtrace/onfree else local.get $1 i32.const 0 diff --git a/tests/compiler/implicit-getter-setter.untouched.wat b/tests/compiler/implicit-getter-setter.untouched.wat index 906a0165ec..548a58a958 100644 --- a/tests/compiler/implicit-getter-setter.untouched.wat +++ b/tests/compiler/implicit-getter-setter.untouched.wat @@ -1,6 +1,6 @@ (module - (type $i32_=>_none (func (param i32))) (type $i32_i32_=>_none (func (param i32 i32))) + (type $i32_=>_none (func (param i32))) (type $i32_=>_i32 (func (param i32) (result i32))) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) @@ -9,10 +9,6 @@ (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) (type $none_=>_i32 (func (result i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) (memory $0 1) (data (i32.const 16) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s\00") (data (i32.const 64) "(\00\00\00\01\00\00\00\01\00\00\00(\00\00\00a\00l\00l\00o\00c\00a\00t\00i\00o\00n\00 \00t\00o\00o\00 \00l\00a\00r\00g\00e\00") @@ -1455,11 +1451,9 @@ local.get $4 local.get $3 call $~lib/rt/tlsf/prepareBlock - i32.const 1 + i32.const 0 drop local.get $4 - call $~lib/rt/rtrace/onalloc - local.get $4 ) (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -1501,10 +1495,8 @@ i32.const 1 i32.add i32.store offset=4 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/onincrement i32.const 1 drop local.get $0 @@ -1628,13 +1620,11 @@ i32.const 1 i32.or i32.store + i32.const 0 + drop local.get $0 local.get $1 call $~lib/rt/tlsf/insertBlock - i32.const 1 - drop - local.get $1 - call $~lib/rt/rtrace/onfree ) (func $~lib/rt/pure/finalize (param $0 i32) i32.const 0 @@ -1653,10 +1643,8 @@ i32.const 268435455 i32.and local.set $2 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/ondecrement i32.const 1 drop local.get $0 diff --git a/tests/compiler/issues/1095.json b/tests/compiler/issues/1095.json index 9f7878d475..d8f53d9b42 100644 --- a/tests/compiler/issues/1095.json +++ b/tests/compiler/issues/1095.json @@ -1,6 +1,6 @@ { "asc_flags": [ - "--runtime half", - "--use ASC_RTRACE=1" - ] + "--runtime half" + ], + "asc_rtrace": true } \ No newline at end of file diff --git a/tests/compiler/issues/1095.optimized.wat b/tests/compiler/issues/1095.optimized.wat index dc9d165cbc..b1142a3589 100644 --- a/tests/compiler/issues/1095.optimized.wat +++ b/tests/compiler/issues/1095.optimized.wat @@ -1,16 +1,12 @@ (module - (type $i32_=>_none (func (param i32))) (type $i32_=>_i32 (func (param i32) (result i32))) + (type $i32_=>_none (func (param i32))) (type $i32_i32_=>_none (func (param i32 i32))) (type $none_=>_none (func)) (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) (type $none_=>_i32 (func (result i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) (memory $0 1) (data (i32.const 1024) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s") (data (i32.const 1072) "(\00\00\00\01\00\00\00\01\00\00\00(\00\00\00a\00l\00l\00o\00c\00a\00t\00i\00o\00n\00 \00t\00o\00o\00 \00l\00a\00r\00g\00e") @@ -885,8 +881,6 @@ i32.store end local.get $1 - call $~lib/rt/rtrace/onalloc - local.get $1 ) (func $~lib/rt/pure/__retain (param $0 i32) (result i32) (local $1 i32) @@ -923,8 +917,6 @@ i32.add i32.store offset=4 local.get $1 - call $~lib/rt/rtrace/onincrement - local.get $1 i32.load i32.const 1 i32.and @@ -1009,8 +1001,6 @@ i32.and local.set $1 local.get $0 - call $~lib/rt/rtrace/ondecrement - local.get $0 i32.load i32.const 1 i32.and @@ -1073,8 +1063,6 @@ global.get $~lib/rt/tlsf/ROOT local.get $0 call $~lib/rt/tlsf/insertBlock - local.get $0 - call $~lib/rt/rtrace/onfree else local.get $1 i32.const 0 diff --git a/tests/compiler/issues/1095.untouched.wat b/tests/compiler/issues/1095.untouched.wat index 63f4eb361c..74338f71c3 100644 --- a/tests/compiler/issues/1095.untouched.wat +++ b/tests/compiler/issues/1095.untouched.wat @@ -1,6 +1,6 @@ (module - (type $i32_=>_none (func (param i32))) (type $i32_i32_=>_none (func (param i32 i32))) + (type $i32_=>_none (func (param i32))) (type $none_=>_none (func)) (type $i32_=>_i32 (func (param i32) (result i32))) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) @@ -9,10 +9,6 @@ (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) (type $none_=>_i32 (func (result i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) (memory $0 1) (data (i32.const 16) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s\00") (data (i32.const 64) "(\00\00\00\01\00\00\00\01\00\00\00(\00\00\00a\00l\00l\00o\00c\00a\00t\00i\00o\00n\00 \00t\00o\00o\00 \00l\00a\00r\00g\00e\00") @@ -1442,11 +1438,9 @@ local.get $4 local.get $3 call $~lib/rt/tlsf/prepareBlock - i32.const 1 + i32.const 0 drop local.get $4 - call $~lib/rt/rtrace/onalloc - local.get $4 ) (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -1488,10 +1482,8 @@ i32.const 1 i32.add i32.store offset=4 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/onincrement i32.const 1 drop local.get $0 @@ -1613,13 +1605,11 @@ i32.const 1 i32.or i32.store + i32.const 0 + drop local.get $0 local.get $1 call $~lib/rt/tlsf/insertBlock - i32.const 1 - drop - local.get $1 - call $~lib/rt/rtrace/onfree ) (func $~lib/rt/pure/finalize (param $0 i32) i32.const 0 @@ -1638,10 +1628,8 @@ i32.const 268435455 i32.and local.set $2 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/ondecrement i32.const 1 drop local.get $0 diff --git a/tests/compiler/issues/1225.json b/tests/compiler/issues/1225.json index 9f7878d475..d8f53d9b42 100644 --- a/tests/compiler/issues/1225.json +++ b/tests/compiler/issues/1225.json @@ -1,6 +1,6 @@ { "asc_flags": [ - "--runtime half", - "--use ASC_RTRACE=1" - ] + "--runtime half" + ], + "asc_rtrace": true } \ No newline at end of file diff --git a/tests/compiler/issues/1225.optimized.wat b/tests/compiler/issues/1225.optimized.wat index fca8fc6fdd..08a0477c45 100644 --- a/tests/compiler/issues/1225.optimized.wat +++ b/tests/compiler/issues/1225.optimized.wat @@ -1,16 +1,12 @@ (module - (type $i32_=>_none (func (param i32))) (type $none_=>_i32 (func (result i32))) (type $i32_i32_=>_none (func (param i32 i32))) (type $i32_=>_i32 (func (param i32) (result i32))) (type $none_=>_none (func)) + (type $i32_=>_none (func (param i32))) (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) (memory $0 1) (data (i32.const 1024) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s") (data (i32.const 1072) "(\00\00\00\01\00\00\00\01\00\00\00(\00\00\00a\00l\00l\00o\00c\00a\00t\00i\00o\00n\00 \00t\00o\00o\00 \00l\00a\00r\00g\00e") @@ -886,8 +882,6 @@ i32.store end local.get $1 - call $~lib/rt/rtrace/onalloc - local.get $1 ) (func $issues/1225/normal (result i32) global.get $issues/1225/x @@ -937,8 +931,6 @@ i32.add i32.store offset=4 local.get $1 - call $~lib/rt/rtrace/onincrement - local.get $1 i32.load i32.const 1 i32.and @@ -1019,8 +1011,6 @@ i32.and local.set $1 local.get $0 - call $~lib/rt/rtrace/ondecrement - local.get $0 i32.load i32.const 1 i32.and @@ -1083,8 +1073,6 @@ global.get $~lib/rt/tlsf/ROOT local.get $0 call $~lib/rt/tlsf/insertBlock - local.get $0 - call $~lib/rt/rtrace/onfree else local.get $1 i32.const 0 diff --git a/tests/compiler/issues/1225.untouched.wat b/tests/compiler/issues/1225.untouched.wat index ee99447b69..3dbaf70b6b 100644 --- a/tests/compiler/issues/1225.untouched.wat +++ b/tests/compiler/issues/1225.untouched.wat @@ -1,6 +1,6 @@ (module - (type $i32_=>_none (func (param i32))) (type $i32_i32_=>_none (func (param i32 i32))) + (type $i32_=>_none (func (param i32))) (type $none_=>_none (func)) (type $none_=>_i32 (func (result i32))) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) @@ -9,10 +9,6 @@ (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) (memory $0 1) (data (i32.const 16) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s\00") (data (i32.const 64) "(\00\00\00\01\00\00\00\01\00\00\00(\00\00\00a\00l\00l\00o\00c\00a\00t\00i\00o\00n\00 \00t\00o\00o\00 \00l\00a\00r\00g\00e\00") @@ -1443,11 +1439,9 @@ local.get $4 local.get $3 call $~lib/rt/tlsf/prepareBlock - i32.const 1 + i32.const 0 drop local.get $4 - call $~lib/rt/rtrace/onalloc - local.get $4 ) (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -1489,10 +1483,8 @@ i32.const 1 i32.add i32.store offset=4 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/onincrement i32.const 1 drop local.get $0 @@ -1633,13 +1625,11 @@ i32.const 1 i32.or i32.store + i32.const 0 + drop local.get $0 local.get $1 call $~lib/rt/tlsf/insertBlock - i32.const 1 - drop - local.get $1 - call $~lib/rt/rtrace/onfree ) (func $~lib/rt/pure/finalize (param $0 i32) i32.const 0 @@ -1658,10 +1648,8 @@ i32.const 268435455 i32.and local.set $2 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/ondecrement i32.const 1 drop local.get $0 diff --git a/tests/compiler/logical.json b/tests/compiler/logical.json index 9f7878d475..d8f53d9b42 100644 --- a/tests/compiler/logical.json +++ b/tests/compiler/logical.json @@ -1,6 +1,6 @@ { "asc_flags": [ - "--runtime half", - "--use ASC_RTRACE=1" - ] + "--runtime half" + ], + "asc_rtrace": true } \ No newline at end of file diff --git a/tests/compiler/logical.optimized.wat b/tests/compiler/logical.optimized.wat index 05199f8f24..49496f7073 100644 --- a/tests/compiler/logical.optimized.wat +++ b/tests/compiler/logical.optimized.wat @@ -1,16 +1,12 @@ (module - (type $i32_=>_none (func (param i32))) (type $i32_=>_i32 (func (param i32) (result i32))) + (type $i32_=>_none (func (param i32))) (type $i32_i32_=>_none (func (param i32 i32))) (type $none_=>_i32 (func (result i32))) (type $none_=>_none (func)) (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) (memory $0 1) (data (i32.const 1024) "\14\00\00\00\01\00\00\00\01\00\00\00\14\00\00\00l\00o\00g\00i\00c\00a\00l\00.\00t\00s") (data (i32.const 1072) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s") @@ -883,8 +879,6 @@ i32.store end local.get $1 - call $~lib/rt/rtrace/onalloc - local.get $1 ) (func $~lib/rt/pure/__retain (param $0 i32) (result i32) (local $1 i32) @@ -921,8 +915,6 @@ i32.add i32.store offset=4 local.get $1 - call $~lib/rt/rtrace/onincrement - local.get $1 i32.load i32.const 1 i32.and @@ -1004,8 +996,6 @@ i32.and local.set $1 local.get $0 - call $~lib/rt/rtrace/ondecrement - local.get $0 i32.load i32.const 1 i32.and @@ -1068,8 +1058,6 @@ global.get $~lib/rt/tlsf/ROOT local.get $0 call $~lib/rt/tlsf/insertBlock - local.get $0 - call $~lib/rt/rtrace/onfree else local.get $1 i32.const 0 diff --git a/tests/compiler/logical.untouched.wat b/tests/compiler/logical.untouched.wat index 5ce7daa94c..95b590c2cb 100644 --- a/tests/compiler/logical.untouched.wat +++ b/tests/compiler/logical.untouched.wat @@ -1,6 +1,6 @@ (module - (type $i32_=>_none (func (param i32))) (type $i32_i32_=>_none (func (param i32 i32))) + (type $i32_=>_none (func (param i32))) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) (type $none_=>_none (func)) (type $i32_=>_i32 (func (param i32) (result i32))) @@ -10,10 +10,6 @@ (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) (type $none_=>_i32 (func (result i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) (memory $0 1) (data (i32.const 16) "\14\00\00\00\01\00\00\00\01\00\00\00\14\00\00\00l\00o\00g\00i\00c\00a\00l\00.\00t\00s\00") (data (i32.const 64) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s\00") @@ -1465,11 +1461,9 @@ local.get $4 local.get $3 call $~lib/rt/tlsf/prepareBlock - i32.const 1 + i32.const 0 drop local.get $4 - call $~lib/rt/rtrace/onalloc - local.get $4 ) (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -1511,10 +1505,8 @@ i32.const 1 i32.add i32.store offset=4 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/onincrement i32.const 1 drop local.get $0 @@ -2163,13 +2155,11 @@ i32.const 1 i32.or i32.store + i32.const 0 + drop local.get $0 local.get $1 call $~lib/rt/tlsf/insertBlock - i32.const 1 - drop - local.get $1 - call $~lib/rt/rtrace/onfree ) (func $~lib/rt/pure/finalize (param $0 i32) i32.const 0 @@ -2188,10 +2178,8 @@ i32.const 268435455 i32.and local.set $2 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/ondecrement i32.const 1 drop local.get $0 diff --git a/tests/compiler/managed-cast.json b/tests/compiler/managed-cast.json index 59c251c705..d8f53d9b42 100644 --- a/tests/compiler/managed-cast.json +++ b/tests/compiler/managed-cast.json @@ -1,7 +1,6 @@ { "asc_flags": [ - "--runtime half", - "--explicitStart", - "--use ASC_RTRACE=1" - ] + "--runtime half" + ], + "asc_rtrace": true } \ No newline at end of file diff --git a/tests/compiler/managed-cast.optimized.wat b/tests/compiler/managed-cast.optimized.wat index 0653a40882..2749bc68db 100644 --- a/tests/compiler/managed-cast.optimized.wat +++ b/tests/compiler/managed-cast.optimized.wat @@ -1,6 +1,6 @@ (module - (type $i32_=>_none (func (param i32))) (type $i32_=>_i32 (func (param i32) (result i32))) + (type $i32_=>_none (func (param i32))) (type $none_=>_none (func)) (type $i32_i32_=>_none (func (param i32 i32))) (type $none_=>_i32 (func (result i32))) @@ -8,10 +8,6 @@ (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) (memory $0 1) (data (i32.const 1024) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s") (data (i32.const 1072) "(\00\00\00\01\00\00\00\01\00\00\00(\00\00\00a\00l\00l\00o\00c\00a\00t\00i\00o\00n\00 \00t\00o\00o\00 \00l\00a\00r\00g\00e") @@ -22,9 +18,8 @@ (data (i32.const 1344) "\05\00\00\00 \00\00\00\00\00\00\00 \00\00\00\00\00\00\00 \00\00\00\00\00\00\00 \00\00\00\04\00\00\00 ") (global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0)) (global $~lib/rt/tlsf/collectLock (mut i32) (i32.const 0)) - (global $~started (mut i32) (i32.const 0)) - (export "_start" (func $~start)) (export "memory" (memory $0)) + (start $~start) (func $~lib/rt/tlsf/removeBlock (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) @@ -887,8 +882,6 @@ i32.store end local.get $2 - call $~lib/rt/rtrace/onalloc - local.get $2 ) (func $~lib/rt/tlsf/__alloc (param $0 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -932,8 +925,6 @@ i32.add i32.store offset=4 local.get $1 - call $~lib/rt/rtrace/onincrement - local.get $1 i32.load i32.const 1 i32.and @@ -1143,13 +1134,6 @@ call $~lib/rt/pure/__release ) (func $~start - global.get $~started - if - return - else - i32.const 1 - global.set $~started - end call $start:managed-cast ) (func $~lib/rt/pure/decrement (param $0 i32) @@ -1162,8 +1146,6 @@ i32.and local.set $1 local.get $0 - call $~lib/rt/rtrace/ondecrement - local.get $0 i32.load i32.const 1 i32.and @@ -1226,8 +1208,6 @@ global.get $~lib/rt/tlsf/ROOT local.get $0 call $~lib/rt/tlsf/insertBlock - local.get $0 - call $~lib/rt/rtrace/onfree else local.get $1 i32.const 0 diff --git a/tests/compiler/managed-cast.untouched.wat b/tests/compiler/managed-cast.untouched.wat index 5f6f58c1b2..51305a0397 100644 --- a/tests/compiler/managed-cast.untouched.wat +++ b/tests/compiler/managed-cast.untouched.wat @@ -9,10 +9,6 @@ (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) (type $none_=>_i32 (func (result i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) (memory $0 1) (data (i32.const 16) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s\00") (data (i32.const 64) "(\00\00\00\01\00\00\00\01\00\00\00(\00\00\00a\00l\00l\00o\00c\00a\00t\00i\00o\00n\00 \00t\00o\00o\00 \00l\00a\00r\00g\00e\00") @@ -26,11 +22,10 @@ (global $~lib/ASC_LOW_MEMORY_LIMIT i32 (i32.const 0)) (global $~lib/rt/tlsf/collectLock (mut i32) (i32.const 0)) (global $~lib/gc/gc.auto (mut i32) (i32.const 1)) - (global $~started (mut i32) (i32.const 0)) (global $~lib/rt/__rtti_base i32 (i32.const 336)) (global $~lib/heap/__heap_base i32 (i32.const 380)) - (export "_start" (func $~start)) (export "memory" (memory $0)) + (start $~start) (func $~lib/rt/tlsf/removeBlock (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) @@ -1445,11 +1440,9 @@ local.get $4 local.get $3 call $~lib/rt/tlsf/prepareBlock - i32.const 1 + i32.const 0 drop local.get $4 - call $~lib/rt/rtrace/onalloc - local.get $4 ) (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -1491,10 +1484,8 @@ i32.const 1 i32.add i32.store offset=4 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/onincrement i32.const 1 drop local.get $0 @@ -1854,13 +1845,6 @@ call $~lib/rt/pure/__release ) (func $~start - global.get $~started - if - return - else - i32.const 1 - global.set $~started - end call $start:managed-cast ) (func $~lib/rt/pure/__collect @@ -1878,13 +1862,11 @@ i32.const 1 i32.or i32.store + i32.const 0 + drop local.get $0 local.get $1 call $~lib/rt/tlsf/insertBlock - i32.const 1 - drop - local.get $1 - call $~lib/rt/rtrace/onfree ) (func $~lib/rt/pure/finalize (param $0 i32) i32.const 0 @@ -1903,10 +1885,8 @@ i32.const 268435455 i32.and local.set $2 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/ondecrement i32.const 1 drop local.get $0 diff --git a/tests/compiler/object-literal.json b/tests/compiler/object-literal.json index 59c251c705..d8f53d9b42 100644 --- a/tests/compiler/object-literal.json +++ b/tests/compiler/object-literal.json @@ -1,7 +1,6 @@ { "asc_flags": [ - "--runtime half", - "--explicitStart", - "--use ASC_RTRACE=1" - ] + "--runtime half" + ], + "asc_rtrace": true } \ No newline at end of file diff --git a/tests/compiler/object-literal.optimized.wat b/tests/compiler/object-literal.optimized.wat index 576afcd3f7..36159d2e66 100644 --- a/tests/compiler/object-literal.optimized.wat +++ b/tests/compiler/object-literal.optimized.wat @@ -9,10 +9,6 @@ (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) (type $none_=>_i32 (func (result i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) (memory $0 1) (data (i32.const 1024) "\16\00\00\00\01\00\00\00\01\00\00\00\16\00\00\00h\00e\00l\00l\00o\00 \00w\00o\00r\00l\00d") (data (i32.const 1072) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s") @@ -26,9 +22,8 @@ (data (i32.const 1408) "\06\00\00\00\01\00\00\00\01\00\00\00\06\00\00\00b\00a\00z") (global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0)) (global $~lib/rt/tlsf/collectLock (mut i32) (i32.const 0)) - (global $~started (mut i32) (i32.const 0)) - (export "_start" (func $~start)) (export "memory" (memory $0)) + (start $~start) (func $~lib/rt/tlsf/removeBlock (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) @@ -1027,8 +1022,6 @@ local.get $4 call $~lib/rt/tlsf/prepareBlock local.get $3 - call $~lib/rt/rtrace/onalloc - local.get $3 ) (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -1073,8 +1066,6 @@ i32.add i32.store offset=4 local.get $1 - call $~lib/rt/rtrace/onincrement - local.get $1 i32.load i32.const 1 i32.and @@ -1431,8 +1422,6 @@ local.get $0 local.get $1 call $~lib/rt/tlsf/insertBlock - local.get $1 - call $~lib/rt/rtrace/onfree ) (func $object-literal/testUnmanaged (param $0 i32) (local $1 i32) @@ -1499,7 +1488,7 @@ if i32.const 0 i32.const 1088 - i32.const 580 + i32.const 585 i32.const 3 call $~lib/builtins/abort unreachable @@ -2144,13 +2133,6 @@ call $~lib/rt/pure/__release ) (func $~start - global.get $~started - if - return - else - i32.const 1 - global.set $~started - end call $start:object-literal ) (func $~lib/rt/pure/decrement (param $0 i32) @@ -2163,8 +2145,6 @@ i32.and local.set $1 local.get $0 - call $~lib/rt/rtrace/ondecrement - local.get $0 i32.load i32.const 1 i32.and diff --git a/tests/compiler/object-literal.untouched.wat b/tests/compiler/object-literal.untouched.wat index 770147500f..c61d4e8a6e 100644 --- a/tests/compiler/object-literal.untouched.wat +++ b/tests/compiler/object-literal.untouched.wat @@ -10,10 +10,6 @@ (type $none_=>_i32 (func (result i32))) (type $i32_i32_i32_i32_i32_=>_i32 (func (param i32 i32 i32 i32 i32) (result i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) (memory $0 1) (data (i32.const 16) "\16\00\00\00\01\00\00\00\01\00\00\00\16\00\00\00h\00e\00l\00l\00o\00 \00w\00o\00r\00l\00d\00") (data (i32.const 64) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s\00") @@ -31,10 +27,9 @@ (global $~lib/rt/tlsf/collectLock (mut i32) (i32.const 0)) (global $~lib/gc/gc.auto (mut i32) (i32.const 1)) (global $~lib/ASC_SHRINK_LEVEL i32 (i32.const 0)) - (global $~started (mut i32) (i32.const 0)) (global $~lib/heap/__heap_base i32 (i32.const 424)) - (export "_start" (func $~start)) (export "memory" (memory $0)) + (start $~start) (func $~lib/rt/tlsf/removeBlock (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) @@ -1449,11 +1444,9 @@ local.get $4 local.get $3 call $~lib/rt/tlsf/prepareBlock - i32.const 1 + i32.const 0 drop local.get $4 - call $~lib/rt/rtrace/onalloc - local.get $4 ) (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -1495,10 +1488,8 @@ i32.const 1 i32.add i32.store offset=4 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/onincrement i32.const 1 drop local.get $0 @@ -3215,7 +3206,7 @@ if i32.const 0 i32.const 80 - i32.const 580 + i32.const 585 i32.const 3 call $~lib/builtins/abort unreachable @@ -3232,13 +3223,11 @@ i32.const 1 i32.or i32.store + i32.const 0 + drop local.get $0 local.get $1 call $~lib/rt/tlsf/insertBlock - i32.const 1 - drop - local.get $1 - call $~lib/rt/rtrace/onfree ) (func $~lib/rt/tlsf/__free (param $0 i32) call $~lib/rt/tlsf/maybeInitialize @@ -3897,13 +3886,6 @@ call $~lib/rt/pure/__release ) (func $~start - global.get $~started - if - return - else - i32.const 1 - global.set $~started - end call $start:object-literal ) (func $~lib/rt/pure/__collect @@ -3928,10 +3910,8 @@ i32.const 268435455 i32.and local.set $2 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/ondecrement i32.const 1 drop local.get $0 diff --git a/tests/compiler/rc/global-init.json b/tests/compiler/rc/global-init.json index 9f7878d475..d8f53d9b42 100644 --- a/tests/compiler/rc/global-init.json +++ b/tests/compiler/rc/global-init.json @@ -1,6 +1,6 @@ { "asc_flags": [ - "--runtime half", - "--use ASC_RTRACE=1" - ] + "--runtime half" + ], + "asc_rtrace": true } \ No newline at end of file diff --git a/tests/compiler/rc/global-init.untouched.wat b/tests/compiler/rc/global-init.untouched.wat index bcb9c93bde..b507c5b548 100644 --- a/tests/compiler/rc/global-init.untouched.wat +++ b/tests/compiler/rc/global-init.untouched.wat @@ -1,14 +1,11 @@ (module - (type $i32_=>_none (func (param i32))) (type $i32_i32_=>_none (func (param i32 i32))) + (type $i32_=>_none (func (param i32))) (type $none_=>_none (func)) (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) (type $none_=>_i32 (func (result i32))) (type $i32_=>_i32 (func (param i32) (result i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) (memory $0 1) (data (i32.const 16) "\00\00\00\00\01\00\00\00\01\00\00\00\00\00\00\00") (data (i32.const 32) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00p\00u\00r\00e\00.\00t\00s\00") @@ -55,10 +52,8 @@ i32.const 1 i32.add i32.store offset=4 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/onincrement i32.const 1 drop local.get $0 @@ -726,13 +721,11 @@ i32.const 1 i32.or i32.store + i32.const 0 + drop local.get $0 local.get $1 call $~lib/rt/tlsf/insertBlock - i32.const 1 - drop - local.get $1 - call $~lib/rt/rtrace/onfree ) (func $~lib/rt/pure/finalize (param $0 i32) i32.const 0 @@ -751,10 +744,8 @@ i32.const 268435455 i32.and local.set $2 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/ondecrement i32.const 1 drop local.get $0 diff --git a/tests/compiler/rc/local-init.json b/tests/compiler/rc/local-init.json index 9f7878d475..d8f53d9b42 100644 --- a/tests/compiler/rc/local-init.json +++ b/tests/compiler/rc/local-init.json @@ -1,6 +1,6 @@ { "asc_flags": [ - "--runtime half", - "--use ASC_RTRACE=1" - ] + "--runtime half" + ], + "asc_rtrace": true } \ No newline at end of file diff --git a/tests/compiler/rc/local-init.optimized.wat b/tests/compiler/rc/local-init.optimized.wat index 9f089cdb6d..5e6c0bef61 100644 --- a/tests/compiler/rc/local-init.optimized.wat +++ b/tests/compiler/rc/local-init.optimized.wat @@ -1,16 +1,12 @@ (module - (type $i32_=>_none (func (param i32))) (type $i32_i32_=>_none (func (param i32 i32))) (type $i32_=>_i32 (func (param i32) (result i32))) (type $none_=>_none (func)) + (type $i32_=>_none (func (param i32))) (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) (type $none_=>_i32 (func (result i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) (memory $0 1) (data (i32.const 1028) "\01\00\00\00\01") (data (i32.const 1040) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s") @@ -883,8 +879,6 @@ i32.store end local.get $1 - call $~lib/rt/rtrace/onalloc - local.get $1 ) (func $~start (local $0 i32) @@ -926,8 +920,6 @@ i32.add i32.store offset=4 local.get $1 - call $~lib/rt/rtrace/onincrement - local.get $1 i32.load i32.const 1 i32.and @@ -960,8 +952,6 @@ i32.and local.set $1 local.get $0 - call $~lib/rt/rtrace/ondecrement - local.get $0 i32.load i32.const 1 i32.and @@ -1024,8 +1014,6 @@ global.get $~lib/rt/tlsf/ROOT local.get $0 call $~lib/rt/tlsf/insertBlock - local.get $0 - call $~lib/rt/rtrace/onfree else local.get $1 i32.const 0 diff --git a/tests/compiler/rc/local-init.untouched.wat b/tests/compiler/rc/local-init.untouched.wat index 05fbb2d944..cbee7aac41 100644 --- a/tests/compiler/rc/local-init.untouched.wat +++ b/tests/compiler/rc/local-init.untouched.wat @@ -1,6 +1,6 @@ (module - (type $i32_=>_none (func (param i32))) (type $i32_i32_=>_none (func (param i32 i32))) + (type $i32_=>_none (func (param i32))) (type $none_=>_none (func)) (type $i32_=>_i32 (func (param i32) (result i32))) (type $none_=>_i32 (func (result i32))) @@ -9,10 +9,6 @@ (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) (memory $0 1) (data (i32.const 16) "\00\00\00\00\01\00\00\00\01\00\00\00\00\00\00\00") (data (i32.const 32) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s\00") @@ -1454,11 +1450,9 @@ local.get $4 local.get $3 call $~lib/rt/tlsf/prepareBlock - i32.const 1 + i32.const 0 drop local.get $4 - call $~lib/rt/rtrace/onalloc - local.get $4 ) (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -1500,10 +1494,8 @@ i32.const 1 i32.add i32.store offset=4 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/onincrement i32.const 1 drop local.get $0 @@ -1574,13 +1566,11 @@ i32.const 1 i32.or i32.store + i32.const 0 + drop local.get $0 local.get $1 call $~lib/rt/tlsf/insertBlock - i32.const 1 - drop - local.get $1 - call $~lib/rt/rtrace/onfree ) (func $~lib/rt/pure/finalize (param $0 i32) i32.const 0 @@ -1599,10 +1589,8 @@ i32.const 268435455 i32.and local.set $2 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/ondecrement i32.const 1 drop local.get $0 diff --git a/tests/compiler/rc/logical-and-mismatch.json b/tests/compiler/rc/logical-and-mismatch.json index 9f7878d475..d8f53d9b42 100644 --- a/tests/compiler/rc/logical-and-mismatch.json +++ b/tests/compiler/rc/logical-and-mismatch.json @@ -1,6 +1,6 @@ { "asc_flags": [ - "--runtime half", - "--use ASC_RTRACE=1" - ] + "--runtime half" + ], + "asc_rtrace": true } \ No newline at end of file diff --git a/tests/compiler/rc/logical-and-mismatch.optimized.wat b/tests/compiler/rc/logical-and-mismatch.optimized.wat index 436a592b73..b3afce4f86 100644 --- a/tests/compiler/rc/logical-and-mismatch.optimized.wat +++ b/tests/compiler/rc/logical-and-mismatch.optimized.wat @@ -1,16 +1,12 @@ (module - (type $i32_=>_none (func (param i32))) (type $i32_=>_i32 (func (param i32) (result i32))) + (type $i32_=>_none (func (param i32))) (type $i32_i32_=>_none (func (param i32 i32))) (type $none_=>_i32 (func (result i32))) (type $none_=>_none (func)) (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) (memory $0 1) (data (i32.const 1024) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s") (data (i32.const 1072) "(\00\00\00\01\00\00\00\01\00\00\00(\00\00\00a\00l\00l\00o\00c\00a\00t\00i\00o\00n\00 \00t\00o\00o\00 \00l\00a\00r\00g\00e") @@ -883,8 +879,6 @@ i32.store end local.get $1 - call $~lib/rt/rtrace/onalloc - local.get $1 ) (func $~lib/rt/pure/__retain (param $0 i32) (result i32) (local $1 i32) @@ -921,8 +915,6 @@ i32.add i32.store offset=4 local.get $1 - call $~lib/rt/rtrace/onincrement - local.get $1 i32.load i32.const 1 i32.and @@ -1002,8 +994,6 @@ i32.and local.set $1 local.get $0 - call $~lib/rt/rtrace/ondecrement - local.get $0 i32.load i32.const 1 i32.and @@ -1066,8 +1056,6 @@ global.get $~lib/rt/tlsf/ROOT local.get $0 call $~lib/rt/tlsf/insertBlock - local.get $0 - call $~lib/rt/rtrace/onfree else local.get $1 i32.const 0 diff --git a/tests/compiler/rc/logical-and-mismatch.untouched.wat b/tests/compiler/rc/logical-and-mismatch.untouched.wat index 8bc73c87c9..ac0e28a637 100644 --- a/tests/compiler/rc/logical-and-mismatch.untouched.wat +++ b/tests/compiler/rc/logical-and-mismatch.untouched.wat @@ -1,6 +1,6 @@ (module - (type $i32_=>_none (func (param i32))) (type $i32_i32_=>_none (func (param i32 i32))) + (type $i32_=>_none (func (param i32))) (type $none_=>_none (func)) (type $i32_=>_i32 (func (param i32) (result i32))) (type $none_=>_i32 (func (result i32))) @@ -9,10 +9,6 @@ (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) (memory $0 1) (data (i32.const 16) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s\00") (data (i32.const 64) "(\00\00\00\01\00\00\00\01\00\00\00(\00\00\00a\00l\00l\00o\00c\00a\00t\00i\00o\00n\00 \00t\00o\00o\00 \00l\00a\00r\00g\00e\00") @@ -1440,11 +1436,9 @@ local.get $4 local.get $3 call $~lib/rt/tlsf/prepareBlock - i32.const 1 + i32.const 0 drop local.get $4 - call $~lib/rt/rtrace/onalloc - local.get $4 ) (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -1486,10 +1480,8 @@ i32.const 1 i32.add i32.store offset=4 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/onincrement i32.const 1 drop local.get $0 @@ -1619,13 +1611,11 @@ i32.const 1 i32.or i32.store + i32.const 0 + drop local.get $0 local.get $1 call $~lib/rt/tlsf/insertBlock - i32.const 1 - drop - local.get $1 - call $~lib/rt/rtrace/onfree ) (func $~lib/rt/pure/finalize (param $0 i32) i32.const 0 @@ -1644,10 +1634,8 @@ i32.const 268435455 i32.and local.set $2 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/ondecrement i32.const 1 drop local.get $0 diff --git a/tests/compiler/rc/logical-or-mismatch.json b/tests/compiler/rc/logical-or-mismatch.json index 9f7878d475..d8f53d9b42 100644 --- a/tests/compiler/rc/logical-or-mismatch.json +++ b/tests/compiler/rc/logical-or-mismatch.json @@ -1,6 +1,6 @@ { "asc_flags": [ - "--runtime half", - "--use ASC_RTRACE=1" - ] + "--runtime half" + ], + "asc_rtrace": true } \ No newline at end of file diff --git a/tests/compiler/rc/logical-or-mismatch.optimized.wat b/tests/compiler/rc/logical-or-mismatch.optimized.wat index 89c3ad7ac7..2fe7c5f98b 100644 --- a/tests/compiler/rc/logical-or-mismatch.optimized.wat +++ b/tests/compiler/rc/logical-or-mismatch.optimized.wat @@ -1,16 +1,12 @@ (module - (type $i32_=>_none (func (param i32))) (type $i32_=>_i32 (func (param i32) (result i32))) + (type $i32_=>_none (func (param i32))) (type $i32_i32_=>_none (func (param i32 i32))) (type $none_=>_i32 (func (result i32))) (type $none_=>_none (func)) (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) (memory $0 1) (data (i32.const 1024) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s") (data (i32.const 1072) "(\00\00\00\01\00\00\00\01\00\00\00(\00\00\00a\00l\00l\00o\00c\00a\00t\00i\00o\00n\00 \00t\00o\00o\00 \00l\00a\00r\00g\00e") @@ -883,8 +879,6 @@ i32.store end local.get $1 - call $~lib/rt/rtrace/onalloc - local.get $1 ) (func $~lib/rt/pure/__retain (param $0 i32) (result i32) (local $1 i32) @@ -921,8 +915,6 @@ i32.add i32.store offset=4 local.get $1 - call $~lib/rt/rtrace/onincrement - local.get $1 i32.load i32.const 1 i32.and @@ -1002,8 +994,6 @@ i32.and local.set $1 local.get $0 - call $~lib/rt/rtrace/ondecrement - local.get $0 i32.load i32.const 1 i32.and @@ -1066,8 +1056,6 @@ global.get $~lib/rt/tlsf/ROOT local.get $0 call $~lib/rt/tlsf/insertBlock - local.get $0 - call $~lib/rt/rtrace/onfree else local.get $1 i32.const 0 diff --git a/tests/compiler/rc/logical-or-mismatch.untouched.wat b/tests/compiler/rc/logical-or-mismatch.untouched.wat index 16b203f1d7..3454170010 100644 --- a/tests/compiler/rc/logical-or-mismatch.untouched.wat +++ b/tests/compiler/rc/logical-or-mismatch.untouched.wat @@ -1,6 +1,6 @@ (module - (type $i32_=>_none (func (param i32))) (type $i32_i32_=>_none (func (param i32 i32))) + (type $i32_=>_none (func (param i32))) (type $none_=>_none (func)) (type $i32_=>_i32 (func (param i32) (result i32))) (type $none_=>_i32 (func (result i32))) @@ -9,10 +9,6 @@ (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) (memory $0 1) (data (i32.const 16) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s\00") (data (i32.const 64) "(\00\00\00\01\00\00\00\01\00\00\00(\00\00\00a\00l\00l\00o\00c\00a\00t\00i\00o\00n\00 \00t\00o\00o\00 \00l\00a\00r\00g\00e\00") @@ -1440,11 +1436,9 @@ local.get $4 local.get $3 call $~lib/rt/tlsf/prepareBlock - i32.const 1 + i32.const 0 drop local.get $4 - call $~lib/rt/rtrace/onalloc - local.get $4 ) (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -1486,10 +1480,8 @@ i32.const 1 i32.add i32.store offset=4 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/onincrement i32.const 1 drop local.get $0 @@ -1619,13 +1611,11 @@ i32.const 1 i32.or i32.store + i32.const 0 + drop local.get $0 local.get $1 call $~lib/rt/tlsf/insertBlock - i32.const 1 - drop - local.get $1 - call $~lib/rt/rtrace/onfree ) (func $~lib/rt/pure/finalize (param $0 i32) i32.const 0 @@ -1644,10 +1634,8 @@ i32.const 268435455 i32.and local.set $2 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/ondecrement i32.const 1 drop local.get $0 diff --git a/tests/compiler/rc/optimize.json b/tests/compiler/rc/optimize.json index 8ee35e6e7f..48125f096d 100644 --- a/tests/compiler/rc/optimize.json +++ b/tests/compiler/rc/optimize.json @@ -1,6 +1,6 @@ { "asc_flags": [ - "--runtime half", - "--use ASC_RTRACE=1" - ] + "--runtime half" + ], + "asc_rtrace": true } diff --git a/tests/compiler/rc/optimize.optimized.wat b/tests/compiler/rc/optimize.optimized.wat index de0e4a8c39..17cde00d78 100644 --- a/tests/compiler/rc/optimize.optimized.wat +++ b/tests/compiler/rc/optimize.optimized.wat @@ -1,6 +1,6 @@ (module - (type $i32_=>_none (func (param i32))) (type $i32_i32_=>_none (func (param i32 i32))) + (type $i32_=>_none (func (param i32))) (type $i32_=>_i32 (func (param i32) (result i32))) (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) (type $none_=>_i32 (func (result i32))) @@ -8,10 +8,6 @@ (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) (memory $0 1) (data (i32.const 1024) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00p\00u\00r\00e\00.\00t\00s") (data (i32.const 1072) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s") @@ -94,8 +90,6 @@ i32.add i32.store offset=4 local.get $1 - call $~lib/rt/rtrace/onincrement - local.get $1 i32.load i32.const 1 i32.and @@ -973,8 +967,6 @@ i32.store end local.get $1 - call $~lib/rt/rtrace/onalloc - local.get $1 ) (func $rc/optimize/getRef (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -1144,8 +1136,6 @@ i32.and local.set $1 local.get $0 - call $~lib/rt/rtrace/ondecrement - local.get $0 i32.load i32.const 1 i32.and @@ -1208,8 +1198,6 @@ global.get $~lib/rt/tlsf/ROOT local.get $0 call $~lib/rt/tlsf/insertBlock - local.get $0 - call $~lib/rt/rtrace/onfree else local.get $1 i32.const 0 diff --git a/tests/compiler/rc/optimize.untouched.wat b/tests/compiler/rc/optimize.untouched.wat index a7367ce91f..4e66388ec1 100644 --- a/tests/compiler/rc/optimize.untouched.wat +++ b/tests/compiler/rc/optimize.untouched.wat @@ -1,6 +1,6 @@ (module - (type $i32_=>_none (func (param i32))) (type $i32_i32_=>_none (func (param i32 i32))) + (type $i32_=>_none (func (param i32))) (type $none_=>_none (func)) (type $i32_=>_i32 (func (param i32) (result i32))) (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) @@ -9,10 +9,6 @@ (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) (memory $0 1) (data (i32.const 16) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00p\00u\00r\00e\00.\00t\00s\00") (data (i32.const 64) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s\00") @@ -96,10 +92,8 @@ i32.const 1 i32.add i32.store offset=4 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/onincrement i32.const 1 drop local.get $0 @@ -1543,11 +1537,9 @@ local.get $4 local.get $3 call $~lib/rt/tlsf/prepareBlock - i32.const 1 + i32.const 0 drop local.get $4 - call $~lib/rt/rtrace/onalloc - local.get $4 ) (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -1871,13 +1863,11 @@ i32.const 1 i32.or i32.store + i32.const 0 + drop local.get $0 local.get $1 call $~lib/rt/tlsf/insertBlock - i32.const 1 - drop - local.get $1 - call $~lib/rt/rtrace/onfree ) (func $~lib/rt/pure/finalize (param $0 i32) i32.const 0 @@ -1896,10 +1886,8 @@ i32.const 268435455 i32.and local.set $2 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/ondecrement i32.const 1 drop local.get $0 diff --git a/tests/compiler/rc/rereturn.untouched.wat b/tests/compiler/rc/rereturn.untouched.wat index 46ec808478..792691b5ec 100644 --- a/tests/compiler/rc/rereturn.untouched.wat +++ b/tests/compiler/rc/rereturn.untouched.wat @@ -1569,11 +1569,11 @@ i32.const 1 i32.or i32.store + i32.const 0 + drop local.get $0 local.get $1 call $~lib/rt/tlsf/insertBlock - i32.const 0 - drop ) (func $~lib/rt/pure/finalize (param $0 i32) i32.const 0 diff --git a/tests/compiler/rc/ternary-mismatch.json b/tests/compiler/rc/ternary-mismatch.json index 9f7878d475..d8f53d9b42 100644 --- a/tests/compiler/rc/ternary-mismatch.json +++ b/tests/compiler/rc/ternary-mismatch.json @@ -1,6 +1,6 @@ { "asc_flags": [ - "--runtime half", - "--use ASC_RTRACE=1" - ] + "--runtime half" + ], + "asc_rtrace": true } \ No newline at end of file diff --git a/tests/compiler/rc/ternary-mismatch.optimized.wat b/tests/compiler/rc/ternary-mismatch.optimized.wat index 920591da7e..5d952dae01 100644 --- a/tests/compiler/rc/ternary-mismatch.optimized.wat +++ b/tests/compiler/rc/ternary-mismatch.optimized.wat @@ -1,16 +1,12 @@ (module - (type $i32_=>_none (func (param i32))) (type $i32_=>_i32 (func (param i32) (result i32))) + (type $i32_=>_none (func (param i32))) (type $i32_i32_=>_none (func (param i32 i32))) (type $none_=>_i32 (func (result i32))) (type $none_=>_none (func)) (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) (memory $0 1) (data (i32.const 1024) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s") (data (i32.const 1072) "(\00\00\00\01\00\00\00\01\00\00\00(\00\00\00a\00l\00l\00o\00c\00a\00t\00i\00o\00n\00 \00t\00o\00o\00 \00l\00a\00r\00g\00e") @@ -885,8 +881,6 @@ i32.store end local.get $1 - call $~lib/rt/rtrace/onalloc - local.get $1 ) (func $~lib/rt/pure/__retain (param $0 i32) (result i32) (local $1 i32) @@ -923,8 +917,6 @@ i32.add i32.store offset=4 local.get $1 - call $~lib/rt/rtrace/onincrement - local.get $1 i32.load i32.const 1 i32.and @@ -1003,8 +995,6 @@ i32.and local.set $1 local.get $0 - call $~lib/rt/rtrace/ondecrement - local.get $0 i32.load i32.const 1 i32.and @@ -1067,8 +1057,6 @@ global.get $~lib/rt/tlsf/ROOT local.get $0 call $~lib/rt/tlsf/insertBlock - local.get $0 - call $~lib/rt/rtrace/onfree else local.get $1 i32.const 0 diff --git a/tests/compiler/rc/ternary-mismatch.untouched.wat b/tests/compiler/rc/ternary-mismatch.untouched.wat index 6dffb7d72d..67e3a4f118 100644 --- a/tests/compiler/rc/ternary-mismatch.untouched.wat +++ b/tests/compiler/rc/ternary-mismatch.untouched.wat @@ -1,7 +1,7 @@ (module - (type $i32_=>_none (func (param i32))) (type $i32_i32_=>_none (func (param i32 i32))) (type $i32_=>_i32 (func (param i32) (result i32))) + (type $i32_=>_none (func (param i32))) (type $none_=>_none (func)) (type $none_=>_i32 (func (result i32))) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) @@ -9,10 +9,6 @@ (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) (memory $0 1) (data (i32.const 16) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s\00") (data (i32.const 64) "(\00\00\00\01\00\00\00\01\00\00\00(\00\00\00a\00l\00l\00o\00c\00a\00t\00i\00o\00n\00 \00t\00o\00o\00 \00l\00a\00r\00g\00e\00") @@ -1442,11 +1438,9 @@ local.get $4 local.get $3 call $~lib/rt/tlsf/prepareBlock - i32.const 1 + i32.const 0 drop local.get $4 - call $~lib/rt/rtrace/onalloc - local.get $4 ) (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -1488,10 +1482,8 @@ i32.const 1 i32.add i32.store offset=4 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/onincrement i32.const 1 drop local.get $0 @@ -1603,13 +1595,11 @@ i32.const 1 i32.or i32.store + i32.const 0 + drop local.get $0 local.get $1 call $~lib/rt/tlsf/insertBlock - i32.const 1 - drop - local.get $1 - call $~lib/rt/rtrace/onfree ) (func $~lib/rt/pure/finalize (param $0 i32) i32.const 0 @@ -1628,10 +1618,8 @@ i32.const 268435455 i32.and local.set $2 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/ondecrement i32.const 1 drop local.get $0 diff --git a/tests/compiler/resolve-ternary.optimized.wat b/tests/compiler/resolve-ternary.optimized.wat index 70b31956b7..e786c45d4f 100644 --- a/tests/compiler/resolve-ternary.optimized.wat +++ b/tests/compiler/resolve-ternary.optimized.wat @@ -2445,7 +2445,7 @@ if i32.const 0 i32.const 1040 - i32.const 580 + i32.const 585 i32.const 3 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/resolve-ternary.untouched.wat b/tests/compiler/resolve-ternary.untouched.wat index 6ad2258385..29f6f6c51d 100644 --- a/tests/compiler/resolve-ternary.untouched.wat +++ b/tests/compiler/resolve-ternary.untouched.wat @@ -4993,7 +4993,7 @@ if i32.const 0 i32.const 32 - i32.const 580 + i32.const 585 i32.const 3 call $~lib/builtins/abort unreachable @@ -5010,11 +5010,11 @@ i32.const 1 i32.or i32.store + i32.const 0 + drop local.get $0 local.get $1 call $~lib/rt/tlsf/insertBlock - i32.const 0 - drop ) (func $~lib/rt/tlsf/__free (param $0 i32) call $~lib/rt/tlsf/maybeInitialize diff --git a/tests/compiler/retain-release-sanity.json b/tests/compiler/retain-release-sanity.json index 9f7878d475..d8f53d9b42 100644 --- a/tests/compiler/retain-release-sanity.json +++ b/tests/compiler/retain-release-sanity.json @@ -1,6 +1,6 @@ { "asc_flags": [ - "--runtime half", - "--use ASC_RTRACE=1" - ] + "--runtime half" + ], + "asc_rtrace": true } \ No newline at end of file diff --git a/tests/compiler/retain-release-sanity.optimized.wat b/tests/compiler/retain-release-sanity.optimized.wat index d159108b58..d8e26b16c3 100644 --- a/tests/compiler/retain-release-sanity.optimized.wat +++ b/tests/compiler/retain-release-sanity.optimized.wat @@ -1,6 +1,6 @@ (module - (type $i32_=>_none (func (param i32))) (type $i32_i32_=>_none (func (param i32 i32))) + (type $i32_=>_none (func (param i32))) (type $i32_=>_i32 (func (param i32) (result i32))) (type $none_=>_none (func)) (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) @@ -9,11 +9,6 @@ (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) (type $none_=>_i32 (func (result i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "onrealloc" (func $~lib/rt/rtrace/onrealloc (param i32 i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) (memory $0 1) (data (i32.const 1024) "\1c\00\00\00\01\00\00\00\01\00\00\00\1c\00\00\00I\00n\00v\00a\00l\00i\00d\00 \00l\00e\00n\00g\00t\00h") (data (i32.const 1072) "\1a\00\00\00\01\00\00\00\01\00\00\00\1a\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00.\00t\00s") @@ -1050,8 +1045,6 @@ local.get $4 call $~lib/rt/tlsf/prepareBlock local.get $3 - call $~lib/rt/rtrace/onalloc - local.get $3 ) (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -1254,8 +1247,6 @@ i32.add i32.store offset=4 local.get $1 - call $~lib/rt/rtrace/onincrement - local.get $1 i32.load i32.const 1 i32.and @@ -1305,7 +1296,7 @@ if i32.const 0 i32.const 1136 - i32.const 580 + i32.const 585 i32.const 3 call $~lib/builtins/abort unreachable @@ -1495,14 +1486,13 @@ local.get $0 local.get $1 call $~lib/rt/tlsf/insertBlock - local.get $1 - call $~lib/rt/rtrace/onfree ) (func $~lib/rt/tlsf/reallocateBlock (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) (local $6 i32) + (local $7 i32) local.get $2 call $~lib/rt/tlsf/prepareSize local.tee $3 @@ -1511,6 +1501,7 @@ local.tee $5 i32.const -4 i32.and + local.tee $4 i32.le_u if local.get $0 @@ -1533,16 +1524,14 @@ i32.add local.tee $6 i32.load - local.tee $4 + local.tee $7 i32.const 1 i32.and if - local.get $5 - i32.const -4 - i32.and + local.get $4 i32.const 16 i32.add - local.get $4 + local.get $7 i32.const -4 i32.and i32.add @@ -1592,9 +1581,6 @@ i32.const 1652 i32.ge_u if - local.get $1 - local.get $3 - call $~lib/rt/rtrace/onrealloc local.get $0 local.get $1 call $~lib/rt/tlsf/freeBlock @@ -2149,8 +2135,6 @@ i32.and local.set $1 local.get $0 - call $~lib/rt/rtrace/ondecrement - local.get $0 i32.load i32.const 1 i32.and @@ -2262,19 +2246,11 @@ i32.const 0 call $~lib/rt/tlsf/__alloc local.tee $2 - i32.const 16 - i32.sub - call $~lib/rt/rtrace/onfree - local.get $2 local.get $1 local.get $3 call $~lib/memory/memory.copy local.get $1 if - local.get $1 - i32.const 16 - i32.sub - call $~lib/rt/rtrace/onalloc call $~lib/rt/tlsf/maybeInitialize local.get $1 call $~lib/rt/tlsf/checkUsedBlock diff --git a/tests/compiler/retain-release-sanity.untouched.wat b/tests/compiler/retain-release-sanity.untouched.wat index 917fefc811..f3c525a152 100644 --- a/tests/compiler/retain-release-sanity.untouched.wat +++ b/tests/compiler/retain-release-sanity.untouched.wat @@ -1,7 +1,7 @@ (module (type $i32_=>_none (func (param i32))) - (type $i32_i32_=>_none (func (param i32 i32))) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) + (type $i32_i32_=>_none (func (param i32 i32))) (type $i32_=>_i32 (func (param i32) (result i32))) (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) (type $none_=>_none (func)) @@ -9,11 +9,6 @@ (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) (type $none_=>_i32 (func (result i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "onrealloc" (func $~lib/rt/rtrace/onrealloc (param i32 i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) (memory $0 1) (data (i32.const 16) "\1c\00\00\00\01\00\00\00\01\00\00\00\1c\00\00\00I\00n\00v\00a\00l\00i\00d\00 \00l\00e\00n\00g\00t\00h\00") (data (i32.const 64) "\1a\00\00\00\01\00\00\00\01\00\00\00\1a\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00.\00t\00s\00") @@ -1467,11 +1462,9 @@ local.get $4 local.get $3 call $~lib/rt/tlsf/prepareBlock - i32.const 1 + i32.const 0 drop local.get $4 - call $~lib/rt/rtrace/onalloc - local.get $4 ) (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -1726,10 +1719,8 @@ i32.const 1 i32.add i32.store offset=4 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/onincrement i32.const 1 drop local.get $0 @@ -1880,7 +1871,7 @@ if i32.const 0 i32.const 128 - i32.const 580 + i32.const 585 i32.const 3 call $~lib/builtins/abort unreachable @@ -3150,13 +3141,11 @@ i32.const 1 i32.or i32.store + i32.const 0 + drop local.get $0 local.get $1 call $~lib/rt/tlsf/insertBlock - i32.const 1 - drop - local.get $1 - call $~lib/rt/rtrace/onfree ) (func $~lib/rt/tlsf/reallocateBlock (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) @@ -3165,18 +3154,21 @@ (local $6 i32) (local $7 i32) (local $8 i32) + (local $9 i32) local.get $2 call $~lib/rt/tlsf/prepareSize local.set $3 local.get $1 i32.load local.set $4 - local.get $3 local.get $4 i32.const 3 i32.const -1 i32.xor i32.and + local.set $5 + local.get $3 + local.get $5 i32.le_u if local.get $0 @@ -3186,55 +3178,53 @@ local.get $1 local.get $2 i32.store offset=12 + i32.const 0 + drop local.get $1 return end local.get $1 - local.set $5 - local.get $5 + local.set $6 + local.get $6 i32.const 16 i32.add - local.get $5 + local.get $6 i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $6 - local.get $6 - i32.load local.set $7 local.get $7 + i32.load + local.set $8 + local.get $8 i32.const 1 i32.and if - local.get $4 - i32.const 3 - i32.const -1 - i32.xor - i32.and + local.get $5 i32.const 16 i32.add - local.get $7 + local.get $8 i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $5 - local.get $5 + local.set $6 + local.get $6 local.get $3 i32.ge_u if local.get $0 - local.get $6 + local.get $7 call $~lib/rt/tlsf/removeBlock local.get $1 local.get $4 i32.const 3 i32.and - local.get $5 + local.get $6 i32.or i32.store local.get $1 @@ -3244,6 +3234,8 @@ local.get $1 local.get $3 call $~lib/rt/tlsf/prepareBlock + i32.const 0 + drop local.get $1 return end @@ -3253,12 +3245,12 @@ local.get $1 i32.load offset=8 call $~lib/rt/tlsf/allocateBlock - local.set $8 - local.get $8 + local.set $9 + local.get $9 local.get $1 i32.load offset=4 i32.store offset=4 - local.get $8 + local.get $9 i32.const 16 i32.add local.get $1 @@ -3270,16 +3262,13 @@ global.get $~lib/heap/__heap_base i32.ge_u if - i32.const 1 + i32.const 0 drop - local.get $1 - local.get $8 - call $~lib/rt/rtrace/onrealloc local.get $0 local.get $1 call $~lib/rt/tlsf/freeBlock end - local.get $8 + local.get $9 ) (func $~lib/rt/tlsf/__realloc (param $0 i32) (param $1 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -4027,24 +4016,12 @@ i32.const 0 call $~lib/rt/tlsf/__alloc local.set $5 - i32.const 1 - drop - local.get $5 - i32.const 16 - i32.sub - call $~lib/rt/rtrace/onfree local.get $5 local.get $0 local.get $1 call $~lib/memory/memory.copy local.get $0 if - i32.const 1 - drop - local.get $0 - i32.const 16 - i32.sub - call $~lib/rt/rtrace/onalloc local.get $0 call $~lib/rt/tlsf/__free end @@ -4089,10 +4066,8 @@ i32.const 268435455 i32.and local.set $2 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/ondecrement i32.const 1 drop local.get $0 diff --git a/tests/compiler/retain-return.untouched.wat b/tests/compiler/retain-return.untouched.wat index 60f06964d6..6cc0324898 100644 --- a/tests/compiler/retain-return.untouched.wat +++ b/tests/compiler/retain-return.untouched.wat @@ -1725,11 +1725,11 @@ i32.const 1 i32.or i32.store + i32.const 0 + drop local.get $0 local.get $1 call $~lib/rt/tlsf/insertBlock - i32.const 0 - drop ) (func $~lib/rt/pure/finalize (param $0 i32) i32.const 0 diff --git a/tests/compiler/rt/finalize.optimized.wat b/tests/compiler/rt/finalize.optimized.wat index 8ab51d3213..661c45fba2 100644 --- a/tests/compiler/rt/finalize.optimized.wat +++ b/tests/compiler/rt/finalize.optimized.wat @@ -1809,7 +1809,7 @@ if i32.const 0 i32.const 1152 - i32.const 580 + i32.const 585 i32.const 3 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/rt/finalize.untouched.wat b/tests/compiler/rt/finalize.untouched.wat index 5819deea71..1153cec7d9 100644 --- a/tests/compiler/rt/finalize.untouched.wat +++ b/tests/compiler/rt/finalize.untouched.wat @@ -2188,11 +2188,11 @@ i32.const 1 i32.or i32.store + i32.const 0 + drop local.get $0 local.get $1 call $~lib/rt/tlsf/insertBlock - i32.const 0 - drop ) (func $~lib/rt/pure/finalize (param $0 i32) i32.const 1 @@ -3524,7 +3524,7 @@ if i32.const 0 i32.const 144 - i32.const 580 + i32.const 585 i32.const 3 call $~lib/builtins/abort unreachable @@ -3567,16 +3567,12 @@ i32.const 0 call $~lib/rt/tlsf/__alloc local.set $5 - i32.const 0 - drop local.get $5 local.get $0 local.get $1 call $~lib/memory/memory.copy local.get $0 if - i32.const 0 - drop local.get $0 call $~lib/rt/tlsf/__free end diff --git a/tests/compiler/runtime-full.untouched.wat b/tests/compiler/runtime-full.untouched.wat index 982cc205cd..d4c081a667 100644 --- a/tests/compiler/runtime-full.untouched.wat +++ b/tests/compiler/runtime-full.untouched.wat @@ -1542,11 +1542,11 @@ i32.const 1 i32.or i32.store + i32.const 0 + drop local.get $0 local.get $1 call $~lib/rt/tlsf/insertBlock - i32.const 0 - drop ) (func $~lib/rt/pure/finalize (param $0 i32) i32.const 0 diff --git a/tests/compiler/std/array-literal.json b/tests/compiler/std/array-literal.json index 9f7878d475..d8f53d9b42 100644 --- a/tests/compiler/std/array-literal.json +++ b/tests/compiler/std/array-literal.json @@ -1,6 +1,6 @@ { "asc_flags": [ - "--runtime half", - "--use ASC_RTRACE=1" - ] + "--runtime half" + ], + "asc_rtrace": true } \ No newline at end of file diff --git a/tests/compiler/std/array-literal.optimized.wat b/tests/compiler/std/array-literal.optimized.wat index 5f6c400c9a..e786053e2f 100644 --- a/tests/compiler/std/array-literal.optimized.wat +++ b/tests/compiler/std/array-literal.optimized.wat @@ -9,10 +9,6 @@ (type $none_=>_i32 (func (result i32))) (type $i32_=>_i32 (func (param i32) (result i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) (memory $0 1) (data (i32.const 1024) "\03\00\00\00\01\00\00\00\00\00\00\00\03\00\00\00\00\01\02") (data (i32.const 1056) "\10\00\00\00\01\00\00\00\03\00\00\00\10\00\00\00\10\04\00\00\10\04\00\00\03\00\00\00\03") @@ -1073,8 +1069,6 @@ local.get $4 call $~lib/rt/tlsf/prepareBlock local.get $3 - call $~lib/rt/rtrace/onalloc - local.get $3 ) (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -1119,8 +1113,6 @@ i32.add i32.store offset=4 local.get $1 - call $~lib/rt/rtrace/onincrement - local.get $1 i32.load i32.const 1 i32.and @@ -1549,8 +1541,6 @@ i32.and local.set $1 local.get $0 - call $~lib/rt/rtrace/ondecrement - local.get $0 i32.load i32.const 1 i32.and @@ -1631,8 +1621,6 @@ global.get $~lib/rt/tlsf/ROOT local.get $0 call $~lib/rt/tlsf/insertBlock - local.get $0 - call $~lib/rt/rtrace/onfree else local.get $1 i32.const 0 diff --git a/tests/compiler/std/array-literal.untouched.wat b/tests/compiler/std/array-literal.untouched.wat index 3e64393f57..b619fce832 100644 --- a/tests/compiler/std/array-literal.untouched.wat +++ b/tests/compiler/std/array-literal.untouched.wat @@ -1,8 +1,8 @@ (module (type $i32_i32_=>_none (func (param i32 i32))) - (type $i32_=>_none (func (param i32))) (type $i32_=>_i32 (func (param i32) (result i32))) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) + (type $i32_=>_none (func (param i32))) (type $none_=>_none (func)) (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) @@ -10,10 +10,6 @@ (type $none_=>_i32 (func (result i32))) (type $i32_i32_i32_i32_=>_i32 (func (param i32 i32 i32 i32) (result i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) (memory $0 1) (data (i32.const 16) "\03\00\00\00\01\00\00\00\00\00\00\00\03\00\00\00\00\01\02") (data (i32.const 48) "\10\00\00\00\01\00\00\00\03\00\00\00\10\00\00\00 \00\00\00 \00\00\00\03\00\00\00\03\00\00\00") @@ -1528,11 +1524,9 @@ local.get $4 local.get $3 call $~lib/rt/tlsf/prepareBlock - i32.const 1 + i32.const 0 drop local.get $4 - call $~lib/rt/rtrace/onalloc - local.get $4 ) (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -2842,10 +2836,8 @@ i32.const 1 i32.add i32.store offset=4 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/onincrement i32.const 1 drop local.get $0 @@ -3375,13 +3367,11 @@ i32.const 1 i32.or i32.store + i32.const 0 + drop local.get $0 local.get $1 call $~lib/rt/tlsf/insertBlock - i32.const 1 - drop - local.get $1 - call $~lib/rt/rtrace/onfree ) (func $~lib/rt/pure/finalize (param $0 i32) i32.const 0 @@ -3400,10 +3390,8 @@ i32.const 268435455 i32.and local.set $2 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/ondecrement i32.const 1 drop local.get $0 diff --git a/tests/compiler/std/array.json b/tests/compiler/std/array.json index 59c251c705..d8f53d9b42 100644 --- a/tests/compiler/std/array.json +++ b/tests/compiler/std/array.json @@ -1,7 +1,6 @@ { "asc_flags": [ - "--runtime half", - "--explicitStart", - "--use ASC_RTRACE=1" - ] + "--runtime half" + ], + "asc_rtrace": true } \ No newline at end of file diff --git a/tests/compiler/std/array.optimized.wat b/tests/compiler/std/array.optimized.wat index bac30e3e1e..4ab7f33740 100644 --- a/tests/compiler/std/array.optimized.wat +++ b/tests/compiler/std/array.optimized.wat @@ -23,13 +23,8 @@ (type $i32_i32_=>_f32 (func (param i32 i32) (result f32))) (type $i32_i32_=>_f64 (func (param i32 i32) (result f64))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "onrealloc" (func $~lib/rt/rtrace/onrealloc (param i32 i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) (import "Math" "random" (func $~lib/bindings/Math/random (result f64))) (import "env" "seed" (func $~lib/builtins/seed (result f64))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) (memory $0 1) (data (i32.const 1024) "\1c\00\00\00\01\00\00\00\01\00\00\00\1c\00\00\00I\00n\00v\00a\00l\00i\00d\00 \00l\00e\00n\00g\00t\00h") (data (i32.const 1072) "\1a\00\00\00\01\00\00\00\01\00\00\00\1a\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00.\00t\00s") @@ -310,11 +305,9 @@ (global $~lib/util/number/_K (mut i32) (i32.const 0)) (global $~lib/util/number/_frc_pow (mut i64) (i64.const 0)) (global $~lib/util/number/_exp_pow (mut i32) (i32.const 0)) - (global $~started (mut i32) (i32.const 0)) (global $std/array/ArrayU32 i32 (i32.const 40)) (global $std/array/ArrayU8 i32 (i32.const 41)) (global $std/array/ArrayStr i32 (i32.const 42)) - (export "_start" (func $~start)) (export "memory" (memory $0)) (export "ArrayU32" (global $std/array/ArrayU32)) (export "ArrayU32#constructor" (func $~lib/array/Array#constructor@varargs)) @@ -395,6 +388,7 @@ (export "ArrayStr#flat" (func $~lib/array/Array#flat)) (export "ArrayStr#toString" (func $~lib/array/Array<~lib/string/String|null>#toString)) (export "__setArgumentsLength" (func $~setArgumentsLength)) + (start $~start) (func $~lib/rt/pure/__release (param $0 i32) local.get $0 i32.const 11928 @@ -1408,8 +1402,6 @@ local.get $4 call $~lib/rt/tlsf/prepareBlock local.get $3 - call $~lib/rt/rtrace/onalloc - local.get $3 ) (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -1627,8 +1619,6 @@ i32.add i32.store offset=4 local.get $1 - call $~lib/rt/rtrace/onincrement - local.get $1 i32.load i32.const 1 i32.and @@ -2302,7 +2292,7 @@ if i32.const 0 i32.const 1136 - i32.const 580 + i32.const 585 i32.const 3 call $~lib/builtins/abort unreachable @@ -2319,14 +2309,13 @@ local.get $0 local.get $1 call $~lib/rt/tlsf/insertBlock - local.get $1 - call $~lib/rt/rtrace/onfree ) (func $~lib/rt/tlsf/reallocateBlock (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) (local $6 i32) + (local $7 i32) local.get $2 call $~lib/rt/tlsf/prepareSize local.tee $3 @@ -2335,6 +2324,7 @@ local.tee $5 i32.const -4 i32.and + local.tee $4 i32.le_u if local.get $0 @@ -2357,16 +2347,14 @@ i32.add local.tee $6 i32.load - local.tee $4 + local.tee $7 i32.const 1 i32.and if - local.get $5 - i32.const -4 - i32.and + local.get $4 i32.const 16 i32.add - local.get $4 + local.get $7 i32.const -4 i32.and i32.add @@ -2416,9 +2404,6 @@ i32.const 11928 i32.ge_u if - local.get $1 - local.get $3 - call $~lib/rt/rtrace/onrealloc local.get $0 local.get $1 call $~lib/rt/tlsf/freeBlock @@ -19897,13 +19882,6 @@ call $~lib/rt/pure/__retain ) (func $~start - global.get $~started - if - return - else - i32.const 1 - global.set $~started - end call $start:std/array ) (func $~lib/rt/pure/decrement (param $0 i32) @@ -19918,8 +19896,6 @@ i32.and local.set $1 local.get $0 - call $~lib/rt/rtrace/ondecrement - local.get $0 i32.load i32.const 1 i32.and diff --git a/tests/compiler/std/array.untouched.wat b/tests/compiler/std/array.untouched.wat index 347bea9cff..66887d78a3 100644 --- a/tests/compiler/std/array.untouched.wat +++ b/tests/compiler/std/array.untouched.wat @@ -29,13 +29,8 @@ (type $f64_=>_i32 (func (param f64) (result i32))) (type $i64_=>_i64 (func (param i64) (result i64))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "onrealloc" (func $~lib/rt/rtrace/onrealloc (param i32 i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) (import "Math" "random" (func $~lib/bindings/Math/random (result f64))) (import "env" "seed" (func $~lib/builtins/seed (result f64))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) (memory $0 1) (data (i32.const 16) "\1c\00\00\00\01\00\00\00\01\00\00\00\1c\00\00\00I\00n\00v\00a\00l\00i\00d\00 \00l\00e\00n\00g\00t\00h\00") (data (i32.const 64) "\1a\00\00\00\01\00\00\00\01\00\00\00\1a\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00.\00t\00s\00") @@ -319,12 +314,10 @@ (global $~lib/util/number/_exp_pow (mut i32) (i32.const 0)) (global $~lib/builtins/u32.MAX_VALUE i32 (i32.const -1)) (global $~lib/builtins/i64.MAX_VALUE i64 (i64.const 9223372036854775807)) - (global $~started (mut i32) (i32.const 0)) (global $~lib/heap/__heap_base i32 (i32.const 12360)) (global $std/array/ArrayU32 i32 (i32.const 40)) (global $std/array/ArrayU8 i32 (i32.const 41)) (global $std/array/ArrayStr i32 (i32.const 42)) - (export "_start" (func $~start)) (export "memory" (memory $0)) (export "ArrayU32" (global $std/array/ArrayU32)) (export "ArrayU32#constructor" (func $~lib/array/Array#constructor@varargs)) @@ -405,6 +398,7 @@ (export "ArrayStr#flat" (func $~lib/array/Array<~lib/string/String>#flat)) (export "ArrayStr#toString" (func $~lib/array/Array<~lib/string/String>#toString)) (export "__setArgumentsLength" (func $~setArgumentsLength)) + (start $~start) (func $~lib/rt/pure/__release (param $0 i32) local.get $0 global.get $~lib/heap/__heap_base @@ -1830,11 +1824,9 @@ local.get $4 local.get $3 call $~lib/rt/tlsf/prepareBlock - i32.const 1 + i32.const 0 drop local.get $4 - call $~lib/rt/rtrace/onalloc - local.get $4 ) (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -2089,10 +2081,8 @@ i32.const 1 i32.add i32.store offset=4 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/onincrement i32.const 1 drop local.get $0 @@ -4189,7 +4179,7 @@ if i32.const 0 i32.const 128 - i32.const 580 + i32.const 585 i32.const 3 call $~lib/builtins/abort unreachable @@ -4206,13 +4196,11 @@ i32.const 1 i32.or i32.store + i32.const 0 + drop local.get $0 local.get $1 call $~lib/rt/tlsf/insertBlock - i32.const 1 - drop - local.get $1 - call $~lib/rt/rtrace/onfree ) (func $~lib/rt/tlsf/reallocateBlock (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) @@ -4221,18 +4209,21 @@ (local $6 i32) (local $7 i32) (local $8 i32) + (local $9 i32) local.get $2 call $~lib/rt/tlsf/prepareSize local.set $3 local.get $1 i32.load local.set $4 - local.get $3 local.get $4 i32.const 3 i32.const -1 i32.xor i32.and + local.set $5 + local.get $3 + local.get $5 i32.le_u if local.get $0 @@ -4242,55 +4233,53 @@ local.get $1 local.get $2 i32.store offset=12 + i32.const 0 + drop local.get $1 return end local.get $1 - local.set $5 - local.get $5 + local.set $6 + local.get $6 i32.const 16 i32.add - local.get $5 + local.get $6 i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $6 - local.get $6 - i32.load local.set $7 local.get $7 + i32.load + local.set $8 + local.get $8 i32.const 1 i32.and if - local.get $4 - i32.const 3 - i32.const -1 - i32.xor - i32.and + local.get $5 i32.const 16 i32.add - local.get $7 + local.get $8 i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $5 - local.get $5 + local.set $6 + local.get $6 local.get $3 i32.ge_u if local.get $0 - local.get $6 + local.get $7 call $~lib/rt/tlsf/removeBlock local.get $1 local.get $4 i32.const 3 i32.and - local.get $5 + local.get $6 i32.or i32.store local.get $1 @@ -4300,6 +4289,8 @@ local.get $1 local.get $3 call $~lib/rt/tlsf/prepareBlock + i32.const 0 + drop local.get $1 return end @@ -4309,12 +4300,12 @@ local.get $1 i32.load offset=8 call $~lib/rt/tlsf/allocateBlock - local.set $8 - local.get $8 + local.set $9 + local.get $9 local.get $1 i32.load offset=4 i32.store offset=4 - local.get $8 + local.get $9 i32.const 16 i32.add local.get $1 @@ -4326,16 +4317,13 @@ global.get $~lib/heap/__heap_base i32.ge_u if - i32.const 1 + i32.const 0 drop - local.get $1 - local.get $8 - call $~lib/rt/rtrace/onrealloc local.get $0 local.get $1 call $~lib/rt/tlsf/freeBlock end - local.get $8 + local.get $9 ) (func $~lib/rt/tlsf/__realloc (param $0 i32) (param $1 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -30834,13 +30822,6 @@ call $~lib/rt/pure/__visit ) (func $~start - global.get $~started - if - return - else - i32.const 1 - global.set $~started - end call $start:std/array ) (func $~lib/rt/pure/finalize (param $0 i32) @@ -30860,10 +30841,8 @@ i32.const 268435455 i32.and local.set $2 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/ondecrement i32.const 1 drop local.get $0 diff --git a/tests/compiler/std/arraybuffer.json b/tests/compiler/std/arraybuffer.json index 9f7878d475..d8f53d9b42 100644 --- a/tests/compiler/std/arraybuffer.json +++ b/tests/compiler/std/arraybuffer.json @@ -1,6 +1,6 @@ { "asc_flags": [ - "--runtime half", - "--use ASC_RTRACE=1" - ] + "--runtime half" + ], + "asc_rtrace": true } \ No newline at end of file diff --git a/tests/compiler/std/arraybuffer.optimized.wat b/tests/compiler/std/arraybuffer.optimized.wat index d760e617c4..871090b217 100644 --- a/tests/compiler/std/arraybuffer.optimized.wat +++ b/tests/compiler/std/arraybuffer.optimized.wat @@ -9,10 +9,6 @@ (type $none_=>_i32 (func (result i32))) (type $i32_=>_i32 (func (param i32) (result i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) (memory $0 1) (data (i32.const 1024) "\1c\00\00\00\01\00\00\00\01\00\00\00\1c\00\00\00I\00n\00v\00a\00l\00i\00d\00 \00l\00e\00n\00g\00t\00h") (data (i32.const 1072) "&\00\00\00\01\00\00\00\01\00\00\00&\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s") @@ -1035,8 +1031,6 @@ local.get $4 call $~lib/rt/tlsf/prepareBlock local.get $3 - call $~lib/rt/rtrace/onalloc - local.get $3 ) (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -1239,8 +1233,6 @@ i32.add i32.store offset=4 local.get $1 - call $~lib/rt/rtrace/onincrement - local.get $1 i32.load i32.const 1 i32.and @@ -1943,8 +1935,6 @@ i32.and local.set $1 local.get $0 - call $~lib/rt/rtrace/ondecrement - local.get $0 i32.load i32.const 1 i32.and @@ -2006,8 +1996,6 @@ global.get $~lib/rt/tlsf/ROOT local.get $0 call $~lib/rt/tlsf/insertBlock - local.get $0 - call $~lib/rt/rtrace/onfree else local.get $1 i32.const 0 diff --git a/tests/compiler/std/arraybuffer.untouched.wat b/tests/compiler/std/arraybuffer.untouched.wat index 36a60407d6..f92ad73c2a 100644 --- a/tests/compiler/std/arraybuffer.untouched.wat +++ b/tests/compiler/std/arraybuffer.untouched.wat @@ -1,19 +1,15 @@ (module (type $i32_=>_i32 (func (param i32) (result i32))) - (type $i32_=>_none (func (param i32))) (type $i32_i32_=>_none (func (param i32 i32))) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) + (type $i32_=>_none (func (param i32))) (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) (type $none_=>_none (func)) (type $i32_i32_i32_i32_=>_i32 (func (param i32 i32 i32 i32) (result i32))) (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) (type $none_=>_i32 (func (result i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) (memory $0 1) (data (i32.const 16) "\1c\00\00\00\01\00\00\00\01\00\00\00\1c\00\00\00I\00n\00v\00a\00l\00i\00d\00 \00l\00e\00n\00g\00t\00h\00") (data (i32.const 64) "&\00\00\00\01\00\00\00\01\00\00\00&\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s\00") @@ -1458,11 +1454,9 @@ local.get $4 local.get $3 call $~lib/rt/tlsf/prepareBlock - i32.const 1 + i32.const 0 drop local.get $4 - call $~lib/rt/rtrace/onalloc - local.get $4 ) (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -1717,10 +1711,8 @@ i32.const 1 i32.add i32.store offset=4 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/onincrement i32.const 1 drop local.get $0 @@ -4069,13 +4061,11 @@ i32.const 1 i32.or i32.store + i32.const 0 + drop local.get $0 local.get $1 call $~lib/rt/tlsf/insertBlock - i32.const 1 - drop - local.get $1 - call $~lib/rt/rtrace/onfree ) (func $~lib/rt/pure/finalize (param $0 i32) i32.const 0 @@ -4094,10 +4084,8 @@ i32.const 268435455 i32.and local.set $2 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/ondecrement i32.const 1 drop local.get $0 diff --git a/tests/compiler/std/dataview.json b/tests/compiler/std/dataview.json index 9f7878d475..d8f53d9b42 100644 --- a/tests/compiler/std/dataview.json +++ b/tests/compiler/std/dataview.json @@ -1,6 +1,6 @@ { "asc_flags": [ - "--runtime half", - "--use ASC_RTRACE=1" - ] + "--runtime half" + ], + "asc_rtrace": true } \ No newline at end of file diff --git a/tests/compiler/std/dataview.optimized.wat b/tests/compiler/std/dataview.optimized.wat index bb449b2557..5076b6a957 100644 --- a/tests/compiler/std/dataview.optimized.wat +++ b/tests/compiler/std/dataview.optimized.wat @@ -1,10 +1,10 @@ (module (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) - (type $i32_=>_none (func (param i32))) (type $i32_=>_i32 (func (param i32) (result i32))) (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) (type $none_=>_none (func)) + (type $i32_=>_none (func (param i32))) (type $i32_i32_=>_none (func (param i32 i32))) (type $i32_i64_i32_=>_none (func (param i32 i64 i32))) (type $i32_i32_=>_i64 (func (param i32 i32) (result i64))) @@ -16,10 +16,6 @@ (type $i32_i32_i32_=>_f32 (func (param i32 i32 i32) (result f32))) (type $i32_i32_=>_f64 (func (param i32 i32) (result f64))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) (memory $0 1) (data (i32.const 1024) "\1c\00\00\00\01\00\00\00\01\00\00\00\1c\00\00\00I\00n\00v\00a\00l\00i\00d\00 \00l\00e\00n\00g\00t\00h") (data (i32.const 1072) "&\00\00\00\01\00\00\00\01\00\00\00&\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s") @@ -1043,8 +1039,6 @@ local.get $4 call $~lib/rt/tlsf/prepareBlock local.get $3 - call $~lib/rt/rtrace/onalloc - local.get $3 ) (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -1089,8 +1083,6 @@ i32.add i32.store offset=4 local.get $1 - call $~lib/rt/rtrace/onincrement - local.get $1 i32.load i32.const 1 i32.and @@ -3427,8 +3419,6 @@ i32.and local.set $1 local.get $0 - call $~lib/rt/rtrace/ondecrement - local.get $0 i32.load i32.const 1 i32.and @@ -3491,8 +3481,6 @@ global.get $~lib/rt/tlsf/ROOT local.get $0 call $~lib/rt/tlsf/insertBlock - local.get $0 - call $~lib/rt/rtrace/onfree else local.get $1 i32.const 0 diff --git a/tests/compiler/std/dataview.untouched.wat b/tests/compiler/std/dataview.untouched.wat index d0b78e568f..cf9f905ef2 100644 --- a/tests/compiler/std/dataview.untouched.wat +++ b/tests/compiler/std/dataview.untouched.wat @@ -1,11 +1,11 @@ (module (type $i32_=>_i32 (func (param i32) (result i32))) - (type $i32_=>_none (func (param i32))) (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) (type $i32_i32_=>_none (func (param i32 i32))) (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) + (type $i32_=>_none (func (param i32))) (type $none_=>_none (func)) (type $i32_i32_i64_i32_=>_none (func (param i32 i32 i64 i32))) (type $i32_i32_i32_i32_=>_i32 (func (param i32 i32 i32 i32) (result i32))) @@ -17,10 +17,6 @@ (type $i32_i32_i32_=>_f32 (func (param i32 i32 i32) (result f32))) (type $i32_i32_i32_=>_f64 (func (param i32 i32 i32) (result f64))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) (memory $0 1) (data (i32.const 16) "\1c\00\00\00\01\00\00\00\01\00\00\00\1c\00\00\00I\00n\00v\00a\00l\00i\00d\00 \00l\00e\00n\00g\00t\00h\00") (data (i32.const 64) "&\00\00\00\01\00\00\00\01\00\00\00&\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s\00") @@ -1466,11 +1462,9 @@ local.get $4 local.get $3 call $~lib/rt/tlsf/prepareBlock - i32.const 1 + i32.const 0 drop local.get $4 - call $~lib/rt/rtrace/onalloc - local.get $4 ) (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -1725,10 +1719,8 @@ i32.const 1 i32.add i32.store offset=4 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/onincrement i32.const 1 drop local.get $0 @@ -4547,13 +4539,11 @@ i32.const 1 i32.or i32.store + i32.const 0 + drop local.get $0 local.get $1 call $~lib/rt/tlsf/insertBlock - i32.const 1 - drop - local.get $1 - call $~lib/rt/rtrace/onfree ) (func $~lib/rt/pure/finalize (param $0 i32) i32.const 0 @@ -4572,10 +4562,8 @@ i32.const 268435455 i32.and local.set $2 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/ondecrement i32.const 1 drop local.get $0 diff --git a/tests/compiler/std/map.json b/tests/compiler/std/map.json index 9f7878d475..d8f53d9b42 100644 --- a/tests/compiler/std/map.json +++ b/tests/compiler/std/map.json @@ -1,6 +1,6 @@ { "asc_flags": [ - "--runtime half", - "--use ASC_RTRACE=1" - ] + "--runtime half" + ], + "asc_rtrace": true } \ No newline at end of file diff --git a/tests/compiler/std/map.optimized.wat b/tests/compiler/std/map.optimized.wat index edf3789bad..67c9dd1483 100644 --- a/tests/compiler/std/map.optimized.wat +++ b/tests/compiler/std/map.optimized.wat @@ -4,8 +4,8 @@ (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) (type $none_=>_none (func)) - (type $i32_=>_none (func (param i32))) (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) + (type $i32_=>_none (func (param i32))) (type $none_=>_i32 (func (result i32))) (type $i32_i64_=>_i32 (func (param i32 i64) (result i32))) (type $i32_i64_i32_=>_i32 (func (param i32 i64 i32) (result i32))) @@ -24,11 +24,6 @@ (type $i64_=>_i32 (func (param i64) (result i32))) (type $i32_i32_=>_i64 (func (param i32 i32) (result i64))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "onrealloc" (func $~lib/rt/rtrace/onrealloc (param i32 i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) (memory $0 1) (data (i32.const 1024) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s") (data (i32.const 1072) "(\00\00\00\01\00\00\00\01\00\00\00(\00\00\00a\00l\00l\00o\00c\00a\00t\00i\00o\00n\00 \00t\00o\00o\00 \00l\00a\00r\00g\00e") @@ -1046,8 +1041,6 @@ local.get $4 call $~lib/rt/tlsf/prepareBlock local.get $3 - call $~lib/rt/rtrace/onalloc - local.get $3 ) (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -1092,8 +1085,6 @@ i32.add i32.store offset=4 local.get $1 - call $~lib/rt/rtrace/onincrement - local.get $1 i32.load i32.const 1 i32.and @@ -1800,14 +1791,13 @@ local.get $0 local.get $1 call $~lib/rt/tlsf/insertBlock - local.get $1 - call $~lib/rt/rtrace/onfree ) (func $~lib/rt/tlsf/reallocateBlock (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) (local $6 i32) + (local $7 i32) local.get $2 call $~lib/rt/tlsf/prepareSize local.tee $3 @@ -1816,6 +1806,7 @@ local.tee $5 i32.const -4 i32.and + local.tee $4 i32.le_u if local.get $0 @@ -1838,16 +1829,14 @@ i32.add local.tee $6 i32.load - local.tee $4 + local.tee $7 i32.const 1 i32.and if - local.get $5 - i32.const -4 - i32.and + local.get $4 i32.const 16 i32.add - local.get $4 + local.get $7 i32.const -4 i32.and i32.add @@ -1897,9 +1886,6 @@ i32.const 1556 i32.ge_u if - local.get $1 - local.get $3 - call $~lib/rt/rtrace/onrealloc local.get $0 local.get $1 call $~lib/rt/tlsf/freeBlock @@ -1969,7 +1955,7 @@ if i32.const 0 i32.const 1040 - i32.const 580 + i32.const 585 i32.const 3 call $~lib/builtins/abort unreachable @@ -13023,8 +13009,6 @@ i32.and local.set $1 local.get $0 - call $~lib/rt/rtrace/ondecrement - local.get $0 i32.load i32.const 1 i32.and diff --git a/tests/compiler/std/map.untouched.wat b/tests/compiler/std/map.untouched.wat index 0d84e733ec..556bda1fe6 100644 --- a/tests/compiler/std/map.untouched.wat +++ b/tests/compiler/std/map.untouched.wat @@ -3,8 +3,8 @@ (type $i32_i32_=>_none (func (param i32 i32))) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) - (type $i32_=>_none (func (param i32))) (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) + (type $i32_=>_none (func (param i32))) (type $none_=>_none (func)) (type $i32_i64_=>_i32 (func (param i32 i64) (result i32))) (type $i32_i64_i32_=>_i32 (func (param i32 i64 i32) (result i32))) @@ -25,11 +25,6 @@ (type $i32_f64_f64_=>_i32 (func (param i32 f64 f64) (result i32))) (type $i64_=>_i32 (func (param i64) (result i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "onrealloc" (func $~lib/rt/rtrace/onrealloc (param i32 i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) (memory $0 1) (data (i32.const 16) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s\00") (data (i32.const 64) "(\00\00\00\01\00\00\00\01\00\00\00(\00\00\00a\00l\00l\00o\00c\00a\00t\00i\00o\00n\00 \00t\00o\00o\00 \00l\00a\00r\00g\00e\00") @@ -1464,11 +1459,9 @@ local.get $4 local.get $3 call $~lib/rt/tlsf/prepareBlock - i32.const 1 + i32.const 0 drop local.get $4 - call $~lib/rt/rtrace/onalloc - local.get $4 ) (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -1510,10 +1503,8 @@ i32.const 1 i32.add i32.store offset=4 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/onincrement i32.const 1 drop local.get $0 @@ -2378,7 +2369,7 @@ if i32.const 0 i32.const 32 - i32.const 580 + i32.const 585 i32.const 3 call $~lib/builtins/abort unreachable @@ -3648,13 +3639,11 @@ i32.const 1 i32.or i32.store + i32.const 0 + drop local.get $0 local.get $1 call $~lib/rt/tlsf/insertBlock - i32.const 1 - drop - local.get $1 - call $~lib/rt/rtrace/onfree ) (func $~lib/rt/tlsf/reallocateBlock (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) @@ -3663,18 +3652,21 @@ (local $6 i32) (local $7 i32) (local $8 i32) + (local $9 i32) local.get $2 call $~lib/rt/tlsf/prepareSize local.set $3 local.get $1 i32.load local.set $4 - local.get $3 local.get $4 i32.const 3 i32.const -1 i32.xor i32.and + local.set $5 + local.get $3 + local.get $5 i32.le_u if local.get $0 @@ -3684,55 +3676,53 @@ local.get $1 local.get $2 i32.store offset=12 + i32.const 0 + drop local.get $1 return end local.get $1 - local.set $5 - local.get $5 + local.set $6 + local.get $6 i32.const 16 i32.add - local.get $5 + local.get $6 i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $6 - local.get $6 - i32.load local.set $7 local.get $7 + i32.load + local.set $8 + local.get $8 i32.const 1 i32.and if - local.get $4 - i32.const 3 - i32.const -1 - i32.xor - i32.and + local.get $5 i32.const 16 i32.add - local.get $7 + local.get $8 i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $5 - local.get $5 + local.set $6 + local.get $6 local.get $3 i32.ge_u if local.get $0 - local.get $6 + local.get $7 call $~lib/rt/tlsf/removeBlock local.get $1 local.get $4 i32.const 3 i32.and - local.get $5 + local.get $6 i32.or i32.store local.get $1 @@ -3742,6 +3732,8 @@ local.get $1 local.get $3 call $~lib/rt/tlsf/prepareBlock + i32.const 0 + drop local.get $1 return end @@ -3751,12 +3743,12 @@ local.get $1 i32.load offset=8 call $~lib/rt/tlsf/allocateBlock - local.set $8 - local.get $8 + local.set $9 + local.get $9 local.get $1 i32.load offset=4 i32.store offset=4 - local.get $8 + local.get $9 i32.const 16 i32.add local.get $1 @@ -3768,16 +3760,13 @@ global.get $~lib/heap/__heap_base i32.ge_u if - i32.const 1 + i32.const 0 drop - local.get $1 - local.get $8 - call $~lib/rt/rtrace/onrealloc local.get $0 local.get $1 call $~lib/rt/tlsf/freeBlock end - local.get $8 + local.get $9 ) (func $~lib/rt/tlsf/__realloc (param $0 i32) (param $1 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -20897,10 +20886,8 @@ i32.const 268435455 i32.and local.set $2 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/ondecrement i32.const 1 drop local.get $0 diff --git a/tests/compiler/std/set.json b/tests/compiler/std/set.json index 9f7878d475..d8f53d9b42 100644 --- a/tests/compiler/std/set.json +++ b/tests/compiler/std/set.json @@ -1,6 +1,6 @@ { "asc_flags": [ - "--runtime half", - "--use ASC_RTRACE=1" - ] + "--runtime half" + ], + "asc_rtrace": true } \ No newline at end of file diff --git a/tests/compiler/std/set.optimized.wat b/tests/compiler/std/set.optimized.wat index 949c44df9b..2e7cb28584 100644 --- a/tests/compiler/std/set.optimized.wat +++ b/tests/compiler/std/set.optimized.wat @@ -4,8 +4,8 @@ (type $i32_=>_i32 (func (param i32) (result i32))) (type $none_=>_none (func)) (type $none_=>_i32 (func (result i32))) - (type $i32_=>_none (func (param i32))) (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) + (type $i32_=>_none (func (param i32))) (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) (type $i32_i64_=>_i32 (func (param i32 i64) (result i32))) (type $i32_f32_=>_i32 (func (param i32 f32) (result i32))) @@ -23,11 +23,6 @@ (type $i32_i32_=>_f32 (func (param i32 i32) (result f32))) (type $i32_i32_=>_f64 (func (param i32 i32) (result f64))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "onrealloc" (func $~lib/rt/rtrace/onrealloc (param i32 i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) (memory $0 1) (data (i32.const 1024) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s") (data (i32.const 1072) "(\00\00\00\01\00\00\00\01\00\00\00(\00\00\00a\00l\00l\00o\00c\00a\00t\00i\00o\00n\00 \00t\00o\00o\00 \00l\00a\00r\00g\00e") @@ -1043,8 +1038,6 @@ local.get $4 call $~lib/rt/tlsf/prepareBlock local.get $3 - call $~lib/rt/rtrace/onalloc - local.get $3 ) (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -1089,8 +1082,6 @@ i32.add i32.store offset=4 local.get $1 - call $~lib/rt/rtrace/onincrement - local.get $1 i32.load i32.const 1 i32.and @@ -1785,14 +1776,13 @@ local.get $0 local.get $1 call $~lib/rt/tlsf/insertBlock - local.get $1 - call $~lib/rt/rtrace/onfree ) (func $~lib/rt/tlsf/reallocateBlock (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) (local $6 i32) + (local $7 i32) local.get $2 call $~lib/rt/tlsf/prepareSize local.tee $3 @@ -1801,6 +1791,7 @@ local.tee $5 i32.const -4 i32.and + local.tee $4 i32.le_u if local.get $0 @@ -1823,16 +1814,14 @@ i32.add local.tee $6 i32.load - local.tee $4 + local.tee $7 i32.const 1 i32.and if - local.get $5 - i32.const -4 - i32.and + local.get $4 i32.const 16 i32.add - local.get $4 + local.get $7 i32.const -4 i32.and i32.add @@ -1882,9 +1871,6 @@ i32.const 1444 i32.ge_u if - local.get $1 - local.get $3 - call $~lib/rt/rtrace/onrealloc local.get $0 local.get $1 call $~lib/rt/tlsf/freeBlock @@ -1954,7 +1940,7 @@ if i32.const 0 i32.const 1040 - i32.const 580 + i32.const 585 i32.const 3 call $~lib/builtins/abort unreachable @@ -9354,8 +9340,6 @@ i32.and local.set $1 local.get $0 - call $~lib/rt/rtrace/ondecrement - local.get $0 i32.load i32.const 1 i32.and diff --git a/tests/compiler/std/set.untouched.wat b/tests/compiler/std/set.untouched.wat index b867f31859..6099a47675 100644 --- a/tests/compiler/std/set.untouched.wat +++ b/tests/compiler/std/set.untouched.wat @@ -2,8 +2,8 @@ (type $i32_i32_=>_none (func (param i32 i32))) (type $i32_=>_i32 (func (param i32) (result i32))) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) - (type $i32_=>_none (func (param i32))) (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) + (type $i32_=>_none (func (param i32))) (type $none_=>_none (func)) (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) (type $i32_i64_=>_i32 (func (param i32 i64) (result i32))) @@ -22,11 +22,6 @@ (type $i32_f64_i32_=>_i32 (func (param i32 f64 i32) (result i32))) (type $i64_=>_i32 (func (param i64) (result i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "onrealloc" (func $~lib/rt/rtrace/onrealloc (param i32 i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) (memory $0 1) (data (i32.const 16) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s\00") (data (i32.const 64) "(\00\00\00\01\00\00\00\01\00\00\00(\00\00\00a\00l\00l\00o\00c\00a\00t\00i\00o\00n\00 \00t\00o\00o\00 \00l\00a\00r\00g\00e\00") @@ -1459,11 +1454,9 @@ local.get $4 local.get $3 call $~lib/rt/tlsf/prepareBlock - i32.const 1 + i32.const 0 drop local.get $4 - call $~lib/rt/rtrace/onalloc - local.get $4 ) (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -1505,10 +1498,8 @@ i32.const 1 i32.add i32.store offset=4 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/onincrement i32.const 1 drop local.get $0 @@ -2314,7 +2305,7 @@ if i32.const 0 i32.const 32 - i32.const 580 + i32.const 585 i32.const 3 call $~lib/builtins/abort unreachable @@ -3584,13 +3575,11 @@ i32.const 1 i32.or i32.store + i32.const 0 + drop local.get $0 local.get $1 call $~lib/rt/tlsf/insertBlock - i32.const 1 - drop - local.get $1 - call $~lib/rt/rtrace/onfree ) (func $~lib/rt/tlsf/reallocateBlock (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) @@ -3599,18 +3588,21 @@ (local $6 i32) (local $7 i32) (local $8 i32) + (local $9 i32) local.get $2 call $~lib/rt/tlsf/prepareSize local.set $3 local.get $1 i32.load local.set $4 - local.get $3 local.get $4 i32.const 3 i32.const -1 i32.xor i32.and + local.set $5 + local.get $3 + local.get $5 i32.le_u if local.get $0 @@ -3620,55 +3612,53 @@ local.get $1 local.get $2 i32.store offset=12 + i32.const 0 + drop local.get $1 return end local.get $1 - local.set $5 - local.get $5 + local.set $6 + local.get $6 i32.const 16 i32.add - local.get $5 + local.get $6 i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $6 - local.get $6 - i32.load local.set $7 local.get $7 + i32.load + local.set $8 + local.get $8 i32.const 1 i32.and if - local.get $4 - i32.const 3 - i32.const -1 - i32.xor - i32.and + local.get $5 i32.const 16 i32.add - local.get $7 + local.get $8 i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $5 - local.get $5 + local.set $6 + local.get $6 local.get $3 i32.ge_u if local.get $0 - local.get $6 + local.get $7 call $~lib/rt/tlsf/removeBlock local.get $1 local.get $4 i32.const 3 i32.and - local.get $5 + local.get $6 i32.or i32.store local.get $1 @@ -3678,6 +3668,8 @@ local.get $1 local.get $3 call $~lib/rt/tlsf/prepareBlock + i32.const 0 + drop local.get $1 return end @@ -3687,12 +3679,12 @@ local.get $1 i32.load offset=8 call $~lib/rt/tlsf/allocateBlock - local.set $8 - local.get $8 + local.set $9 + local.get $9 local.get $1 i32.load offset=4 i32.store offset=4 - local.get $8 + local.get $9 i32.const 16 i32.add local.get $1 @@ -3704,16 +3696,13 @@ global.get $~lib/heap/__heap_base i32.ge_u if - i32.const 1 + i32.const 0 drop - local.get $1 - local.get $8 - call $~lib/rt/rtrace/onrealloc local.get $0 local.get $1 call $~lib/rt/tlsf/freeBlock end - local.get $8 + local.get $9 ) (func $~lib/rt/tlsf/__realloc (param $0 i32) (param $1 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -14724,10 +14713,8 @@ i32.const 268435455 i32.and local.set $2 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/ondecrement i32.const 1 drop local.get $0 diff --git a/tests/compiler/std/staticarray.json b/tests/compiler/std/staticarray.json index 59c251c705..d8f53d9b42 100644 --- a/tests/compiler/std/staticarray.json +++ b/tests/compiler/std/staticarray.json @@ -1,7 +1,6 @@ { "asc_flags": [ - "--runtime half", - "--explicitStart", - "--use ASC_RTRACE=1" - ] + "--runtime half" + ], + "asc_rtrace": true } \ No newline at end of file diff --git a/tests/compiler/std/staticarray.optimized.wat b/tests/compiler/std/staticarray.optimized.wat index 36ac1dd593..e3d158eb71 100644 --- a/tests/compiler/std/staticarray.optimized.wat +++ b/tests/compiler/std/staticarray.optimized.wat @@ -9,10 +9,6 @@ (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) (memory $0 1) (data (i32.const 1024) "\0c\00\00\00\01\00\00\00\03\00\00\00\0c\00\00\00\01\00\00\00\02\00\00\00\03") (data (i32.const 1056) "$\00\00\00\01\00\00\00\01\00\00\00$\00\00\00I\00n\00d\00e\00x\00 \00o\00u\00t\00 \00o\00f\00 \00r\00a\00n\00g\00e") @@ -27,9 +23,8 @@ (global $~lib/rt/tlsf/collectLock (mut i32) (i32.const 0)) (global $std/staticarray/arr3 (mut i32) (i32.const 0)) (global $std/staticarray/arr4 (mut i32) (i32.const 0)) - (global $~started (mut i32) (i32.const 0)) - (export "_start" (func $~start)) (export "memory" (memory $0)) + (start $~start) (func $~lib/staticarray/StaticArray#get:length (param $0 i32) (result i32) local.get $0 i32.const 16 @@ -1073,8 +1068,6 @@ local.get $4 call $~lib/rt/tlsf/prepareBlock local.get $3 - call $~lib/rt/rtrace/onalloc - local.get $3 ) (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -1306,8 +1299,6 @@ i32.add i32.store offset=4 local.get $1 - call $~lib/rt/rtrace/onincrement - local.get $1 i32.load i32.const 1 i32.and @@ -1559,13 +1550,6 @@ global.set $std/staticarray/arr4 ) (func $~start - global.get $~started - if - return - else - i32.const 1 - global.set $~started - end call $start:std/staticarray ) (func $~lib/rt/pure/decrement (param $0 i32) @@ -1580,8 +1564,6 @@ i32.and local.set $1 local.get $0 - call $~lib/rt/rtrace/ondecrement - local.get $0 i32.load i32.const 1 i32.and @@ -1670,8 +1652,6 @@ global.get $~lib/rt/tlsf/ROOT local.get $0 call $~lib/rt/tlsf/insertBlock - local.get $0 - call $~lib/rt/rtrace/onfree else local.get $1 i32.const 0 diff --git a/tests/compiler/std/staticarray.untouched.wat b/tests/compiler/std/staticarray.untouched.wat index b74ba95635..c78d2bd2dc 100644 --- a/tests/compiler/std/staticarray.untouched.wat +++ b/tests/compiler/std/staticarray.untouched.wat @@ -1,7 +1,7 @@ (module - (type $i32_=>_none (func (param i32))) (type $i32_i32_=>_none (func (param i32 i32))) (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) + (type $i32_=>_none (func (param i32))) (type $i32_=>_i32 (func (param i32) (result i32))) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) (type $none_=>_none (func)) @@ -9,10 +9,6 @@ (type $none_=>_i32 (func (result i32))) (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) (memory $0 1) (data (i32.const 16) "\0c\00\00\00\01\00\00\00\03\00\00\00\0c\00\00\00\01\00\00\00\02\00\00\00\03\00\00\00") (data (i32.const 48) "$\00\00\00\01\00\00\00\01\00\00\00$\00\00\00I\00n\00d\00e\00x\00 \00o\00u\00t\00 \00o\00f\00 \00r\00a\00n\00g\00e\00") @@ -33,10 +29,9 @@ (global $~lib/ASC_SHRINK_LEVEL i32 (i32.const 0)) (global $std/staticarray/arr3 (mut i32) (i32.const 0)) (global $std/staticarray/arr4 (mut i32) (i32.const 0)) - (global $~started (mut i32) (i32.const 0)) (global $~lib/heap/__heap_base i32 (i32.const 464)) - (export "_start" (func $~start)) (export "memory" (memory $0)) + (start $~start) (func $~lib/staticarray/StaticArray#get:length (param $0 i32) (result i32) local.get $0 i32.const 16 @@ -1518,11 +1513,9 @@ local.get $4 local.get $3 call $~lib/rt/tlsf/prepareBlock - i32.const 1 + i32.const 0 drop local.get $4 - call $~lib/rt/rtrace/onalloc - local.get $4 ) (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -2832,10 +2825,8 @@ i32.const 1 i32.add i32.store offset=4 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/onincrement i32.const 1 drop local.get $0 @@ -3145,13 +3136,6 @@ global.set $std/staticarray/arr4 ) (func $~start - global.get $~started - if - return - else - i32.const 1 - global.set $~started - end call $start:std/staticarray ) (func $~lib/rt/pure/__collect @@ -3169,13 +3153,11 @@ i32.const 1 i32.or i32.store + i32.const 0 + drop local.get $0 local.get $1 call $~lib/rt/tlsf/insertBlock - i32.const 1 - drop - local.get $1 - call $~lib/rt/rtrace/onfree ) (func $~lib/rt/pure/finalize (param $0 i32) i32.const 0 @@ -3194,10 +3176,8 @@ i32.const 268435455 i32.and local.set $2 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/ondecrement i32.const 1 drop local.get $0 diff --git a/tests/compiler/std/string-casemapping.json b/tests/compiler/std/string-casemapping.json index 59c251c705..11b43d4296 100644 --- a/tests/compiler/std/string-casemapping.json +++ b/tests/compiler/std/string-casemapping.json @@ -1,7 +1,5 @@ { "asc_flags": [ - "--runtime half", - "--explicitStart", - "--use ASC_RTRACE=1" + "--runtime half" ] } \ No newline at end of file diff --git a/tests/compiler/std/string-casemapping.optimized.wat b/tests/compiler/std/string-casemapping.optimized.wat index 1fec3cc790..877130baff 100644 --- a/tests/compiler/std/string-casemapping.optimized.wat +++ b/tests/compiler/std/string-casemapping.optimized.wat @@ -1,24 +1,19 @@ (module (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) (type $i32_=>_i32 (func (param i32) (result i32))) - (type $i32_=>_none (func (param i32))) (type $i32_i32_=>_none (func (param i32 i32))) (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) (type $none_=>_none (func)) + (type $i32_=>_none (func (param i32))) (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) (type $i32_i32_f64_f64_f64_f64_f64_=>_none (func (param i32 i32 f64 f64 f64 f64 f64))) (type $none_=>_i32 (func (result i32))) (type $i64_=>_i32 (func (param i64) (result i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onrealloc" (func $~lib/rt/rtrace/onrealloc (param i32 i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) (import "string_casemapping" "toLowerCaseFromIndex" (func $std/string-casemapping/toLowerCaseFromIndex (param i32 i32) (result i32))) (import "string_casemapping" "toUpperCaseFromIndex" (func $std/string-casemapping/toUpperCaseFromIndex (param i32 i32) (result i32))) (import "env" "trace" (func $~lib/builtins/trace (param i32 i32 f64 f64 f64 f64 f64))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) (memory $0 1) (data (i32.const 1028) "\01\00\00\00\01") (data (i32.const 1040) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00p\00u\00r\00e\00.\00t\00s") @@ -305,9 +300,8 @@ (data (i32.const 18848) "&\00\00\00\01\00\00\00\01\00\00\00&\00\00\00 \00e\00x\00p\00e\00c\00t\00U\00p\00p\00e\00r\00C\00o\00d\00e\00 \00=\00 ") (global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0)) (global $~lib/rt/tlsf/collectLock (mut i32) (i32.const 0)) - (global $~started (mut i32) (i32.const 0)) - (export "_start" (func $~start)) (export "memory" (memory $0)) + (start $~start) (func $~lib/string/String#get:length (param $0 i32) (result i32) local.get $0 i32.const 16 @@ -351,8 +345,6 @@ i32.add i32.store offset=4 local.get $1 - call $~lib/rt/rtrace/onincrement - local.get $1 i32.load i32.const 1 i32.and @@ -1369,8 +1361,6 @@ local.get $4 call $~lib/rt/tlsf/prepareBlock local.get $3 - call $~lib/rt/rtrace/onalloc - local.get $3 ) (func $~lib/rt/tlsf/__alloc (param $0 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -1714,14 +1704,13 @@ local.get $0 local.get $1 call $~lib/rt/tlsf/insertBlock - local.get $1 - call $~lib/rt/rtrace/onfree ) (func $~lib/rt/tlsf/reallocateBlock (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) (local $6 i32) + (local $7 i32) local.get $2 call $~lib/rt/tlsf/prepareSize local.tee $3 @@ -1730,6 +1719,7 @@ local.tee $5 i32.const -4 i32.and + local.tee $4 i32.le_u if local.get $0 @@ -1752,16 +1742,14 @@ i32.add local.tee $6 i32.load - local.tee $4 + local.tee $7 i32.const 1 i32.and if - local.get $5 - i32.const -4 - i32.and + local.get $4 i32.const 16 i32.add - local.get $4 + local.get $7 i32.const -4 i32.and i32.add @@ -1811,9 +1799,6 @@ i32.const 18904 i32.ge_u if - local.get $1 - local.get $3 - call $~lib/rt/rtrace/onrealloc local.get $0 local.get $1 call $~lib/rt/tlsf/freeBlock @@ -1857,7 +1842,7 @@ if i32.const 0 i32.const 1104 - i32.const 580 + i32.const 585 i32.const 3 call $~lib/builtins/abort unreachable @@ -4859,13 +4844,6 @@ call $~lib/rt/pure/__release ) (func $~start - global.get $~started - if - return - else - i32.const 1 - global.set $~started - end call $start:std/string-casemapping ) (func $~lib/rt/pure/decrement (param $0 i32) @@ -4878,8 +4856,6 @@ i32.and local.set $1 local.get $0 - call $~lib/rt/rtrace/ondecrement - local.get $0 i32.load i32.const 1 i32.and diff --git a/tests/compiler/std/string-casemapping.untouched.wat b/tests/compiler/std/string-casemapping.untouched.wat index 00768c8b28..0a14d7d023 100644 --- a/tests/compiler/std/string-casemapping.untouched.wat +++ b/tests/compiler/std/string-casemapping.untouched.wat @@ -1,8 +1,8 @@ (module (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) (type $i32_=>_i32 (func (param i32) (result i32))) - (type $i32_=>_none (func (param i32))) (type $i32_i32_=>_none (func (param i32 i32))) + (type $i32_=>_none (func (param i32))) (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) (type $none_=>_none (func)) (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) @@ -15,14 +15,9 @@ (type $i32_i32_i32_i32_i32_=>_i32 (func (param i32 i32 i32 i32 i32) (result i32))) (type $i64_=>_i32 (func (param i64) (result i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onrealloc" (func $~lib/rt/rtrace/onrealloc (param i32 i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) (import "string_casemapping" "toLowerCaseFromIndex" (func $std/string-casemapping/toLowerCaseFromIndex (param i32 i32) (result i32))) (import "string_casemapping" "toUpperCaseFromIndex" (func $std/string-casemapping/toUpperCaseFromIndex (param i32 i32) (result i32))) (import "env" "trace" (func $~lib/builtins/trace (param i32 i32 f64 f64 f64 f64 f64))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) (memory $0 1) (data (i32.const 16) "\00\00\00\00\01\00\00\00\01\00\00\00\00\00\00\00") (data (i32.const 32) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00p\00u\00r\00e\00.\00t\00s\00") @@ -206,10 +201,9 @@ (global $~lib/util/casemap/SPECIALS_UPPER i32 (i32.const 208)) (global $~lib/ASC_SHRINK_LEVEL i32 (i32.const 0)) (global $~lib/builtins/u32.MAX_VALUE i32 (i32.const -1)) - (global $~started (mut i32) (i32.const 0)) (global $~lib/heap/__heap_base i32 (i32.const 19592)) - (export "_start" (func $~start)) (export "memory" (memory $0)) + (start $~start) (func $~lib/string/String#get:length (param $0 i32) (result i32) local.get $0 i32.const 16 @@ -250,10 +244,8 @@ i32.const 1 i32.add i32.store offset=4 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/onincrement i32.const 1 drop local.get $0 @@ -1697,11 +1689,9 @@ local.get $4 local.get $3 call $~lib/rt/tlsf/prepareBlock - i32.const 1 + i32.const 0 drop local.get $4 - call $~lib/rt/rtrace/onalloc - local.get $4 ) (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -1950,7 +1940,7 @@ if i32.const 0 i32.const 96 - i32.const 580 + i32.const 585 i32.const 3 call $~lib/builtins/abort unreachable @@ -3220,13 +3210,11 @@ i32.const 1 i32.or i32.store + i32.const 0 + drop local.get $0 local.get $1 call $~lib/rt/tlsf/insertBlock - i32.const 1 - drop - local.get $1 - call $~lib/rt/rtrace/onfree ) (func $~lib/rt/tlsf/reallocateBlock (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) @@ -3235,18 +3223,21 @@ (local $6 i32) (local $7 i32) (local $8 i32) + (local $9 i32) local.get $2 call $~lib/rt/tlsf/prepareSize local.set $3 local.get $1 i32.load local.set $4 - local.get $3 local.get $4 i32.const 3 i32.const -1 i32.xor i32.and + local.set $5 + local.get $3 + local.get $5 i32.le_u if local.get $0 @@ -3256,55 +3247,53 @@ local.get $1 local.get $2 i32.store offset=12 + i32.const 0 + drop local.get $1 return end local.get $1 - local.set $5 - local.get $5 + local.set $6 + local.get $6 i32.const 16 i32.add - local.get $5 + local.get $6 i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $6 - local.get $6 - i32.load local.set $7 local.get $7 + i32.load + local.set $8 + local.get $8 i32.const 1 i32.and if - local.get $4 - i32.const 3 - i32.const -1 - i32.xor - i32.and + local.get $5 i32.const 16 i32.add - local.get $7 + local.get $8 i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $5 - local.get $5 + local.set $6 + local.get $6 local.get $3 i32.ge_u if local.get $0 - local.get $6 + local.get $7 call $~lib/rt/tlsf/removeBlock local.get $1 local.get $4 i32.const 3 i32.and - local.get $5 + local.get $6 i32.or i32.store local.get $1 @@ -3314,6 +3303,8 @@ local.get $1 local.get $3 call $~lib/rt/tlsf/prepareBlock + i32.const 0 + drop local.get $1 return end @@ -3323,12 +3314,12 @@ local.get $1 i32.load offset=8 call $~lib/rt/tlsf/allocateBlock - local.set $8 - local.get $8 + local.set $9 + local.get $9 local.get $1 i32.load offset=4 i32.store offset=4 - local.get $8 + local.get $9 i32.const 16 i32.add local.get $1 @@ -3340,16 +3331,13 @@ global.get $~lib/heap/__heap_base i32.ge_u if - i32.const 1 + i32.const 0 drop - local.get $1 - local.get $8 - call $~lib/rt/rtrace/onrealloc local.get $0 local.get $1 call $~lib/rt/tlsf/freeBlock end - local.get $8 + local.get $9 ) (func $~lib/rt/tlsf/__realloc (param $0 i32) (param $1 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -7191,13 +7179,6 @@ call $~lib/rt/pure/__release ) (func $~start - global.get $~started - if - return - else - i32.const 1 - global.set $~started - end call $start:std/string-casemapping ) (func $~lib/rt/pure/__collect @@ -7222,10 +7203,8 @@ i32.const 268435455 i32.and local.set $2 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/ondecrement i32.const 1 drop local.get $0 diff --git a/tests/compiler/std/string-encoding.json b/tests/compiler/std/string-encoding.json index 9f7878d475..d8f53d9b42 100644 --- a/tests/compiler/std/string-encoding.json +++ b/tests/compiler/std/string-encoding.json @@ -1,6 +1,6 @@ { "asc_flags": [ - "--runtime half", - "--use ASC_RTRACE=1" - ] + "--runtime half" + ], + "asc_rtrace": true } \ No newline at end of file diff --git a/tests/compiler/std/string-encoding.optimized.wat b/tests/compiler/std/string-encoding.optimized.wat index f31db14354..d1a1b654c7 100644 --- a/tests/compiler/std/string-encoding.optimized.wat +++ b/tests/compiler/std/string-encoding.optimized.wat @@ -1,19 +1,14 @@ (module (type $none_=>_none (func)) - (type $i32_=>_none (func (param i32))) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) (type $i32_=>_i32 (func (param i32) (result i32))) - (type $i32_i32_=>_none (func (param i32 i32))) (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) + (type $i32_=>_none (func (param i32))) + (type $i32_i32_=>_none (func (param i32 i32))) (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) (type $none_=>_i32 (func (result i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onrealloc" (func $~lib/rt/rtrace/onrealloc (param i32 i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) (memory $0 1) (data (i32.const 1024) "\0c\00\00\00\01\00\00\00\01\00\00\00\0c\00\00\00\01\d87\dch\00i\00R\d8b\df") (data (i32.const 1056) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00p\00u\00r\00e\00.\00t\00s") @@ -70,8 +65,6 @@ i32.add i32.store offset=4 local.get $1 - call $~lib/rt/rtrace/onincrement - local.get $1 i32.load i32.const 1 i32.and @@ -1110,8 +1103,6 @@ local.get $4 call $~lib/rt/tlsf/prepareBlock local.get $3 - call $~lib/rt/rtrace/onalloc - local.get $3 ) (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -2401,14 +2392,13 @@ local.get $0 local.get $1 call $~lib/rt/tlsf/insertBlock - local.get $1 - call $~lib/rt/rtrace/onfree ) (func $~lib/rt/tlsf/reallocateBlock (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) (local $6 i32) + (local $7 i32) local.get $2 call $~lib/rt/tlsf/prepareSize local.tee $3 @@ -2417,6 +2407,7 @@ local.tee $5 i32.const -4 i32.and + local.tee $4 i32.le_u if local.get $0 @@ -2439,16 +2430,14 @@ i32.add local.tee $6 i32.load - local.tee $4 + local.tee $7 i32.const 1 i32.and if - local.get $5 - i32.const -4 - i32.and + local.get $4 i32.const 16 i32.add - local.get $4 + local.get $7 i32.const -4 i32.and i32.add @@ -2498,9 +2487,6 @@ i32.const 22060 i32.ge_u if - local.get $1 - local.get $3 - call $~lib/rt/rtrace/onrealloc local.get $0 local.get $1 call $~lib/rt/tlsf/freeBlock @@ -2724,7 +2710,7 @@ if i32.const 0 i32.const 1184 - i32.const 580 + i32.const 585 i32.const 3 call $~lib/builtins/abort unreachable @@ -3224,8 +3210,6 @@ i32.and local.set $1 local.get $0 - call $~lib/rt/rtrace/ondecrement - local.get $0 i32.load i32.const 1 i32.and diff --git a/tests/compiler/std/string-encoding.untouched.wat b/tests/compiler/std/string-encoding.untouched.wat index 1fe5cf554d..947afbc32b 100644 --- a/tests/compiler/std/string-encoding.untouched.wat +++ b/tests/compiler/std/string-encoding.untouched.wat @@ -1,9 +1,9 @@ (module (type $none_=>_none (func)) - (type $i32_=>_none (func (param i32))) (type $i32_=>_i32 (func (param i32) (result i32))) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) (type $i32_i32_=>_none (func (param i32 i32))) + (type $i32_=>_none (func (param i32))) (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) @@ -11,11 +11,6 @@ (type $i32_i32_i32_i32_=>_i32 (func (param i32 i32 i32 i32) (result i32))) (type $i32_i32_i32_i32_i32_=>_i32 (func (param i32 i32 i32 i32 i32) (result i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onrealloc" (func $~lib/rt/rtrace/onrealloc (param i32 i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) (memory $0 1) (data (i32.const 16) "\0c\00\00\00\01\00\00\00\01\00\00\00\0c\00\00\00\01\d87\dch\00i\00R\d8b\df") (data (i32.const 48) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00p\00u\00r\00e\00.\00t\00s\00") @@ -75,10 +70,8 @@ i32.const 1 i32.add i32.store offset=4 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/onincrement i32.const 1 drop local.get $0 @@ -1562,11 +1555,9 @@ local.get $4 local.get $3 call $~lib/rt/tlsf/prepareBlock - i32.const 1 + i32.const 0 drop local.get $4 - call $~lib/rt/rtrace/onalloc - local.get $4 ) (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -4211,7 +4202,7 @@ if i32.const 0 i32.const 176 - i32.const 580 + i32.const 585 i32.const 3 call $~lib/builtins/abort unreachable @@ -4228,13 +4219,11 @@ i32.const 1 i32.or i32.store + i32.const 0 + drop local.get $0 local.get $1 call $~lib/rt/tlsf/insertBlock - i32.const 1 - drop - local.get $1 - call $~lib/rt/rtrace/onfree ) (func $~lib/rt/tlsf/reallocateBlock (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) @@ -4243,18 +4232,21 @@ (local $6 i32) (local $7 i32) (local $8 i32) + (local $9 i32) local.get $2 call $~lib/rt/tlsf/prepareSize local.set $3 local.get $1 i32.load local.set $4 - local.get $3 local.get $4 i32.const 3 i32.const -1 i32.xor i32.and + local.set $5 + local.get $3 + local.get $5 i32.le_u if local.get $0 @@ -4264,55 +4256,53 @@ local.get $1 local.get $2 i32.store offset=12 + i32.const 0 + drop local.get $1 return end local.get $1 - local.set $5 - local.get $5 + local.set $6 + local.get $6 i32.const 16 i32.add - local.get $5 + local.get $6 i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $6 - local.get $6 - i32.load local.set $7 local.get $7 + i32.load + local.set $8 + local.get $8 i32.const 1 i32.and if - local.get $4 - i32.const 3 - i32.const -1 - i32.xor - i32.and + local.get $5 i32.const 16 i32.add - local.get $7 + local.get $8 i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $5 - local.get $5 + local.set $6 + local.get $6 local.get $3 i32.ge_u if local.get $0 - local.get $6 + local.get $7 call $~lib/rt/tlsf/removeBlock local.get $1 local.get $4 i32.const 3 i32.and - local.get $5 + local.get $6 i32.or i32.store local.get $1 @@ -4322,6 +4312,8 @@ local.get $1 local.get $3 call $~lib/rt/tlsf/prepareBlock + i32.const 0 + drop local.get $1 return end @@ -4331,12 +4323,12 @@ local.get $1 i32.load offset=8 call $~lib/rt/tlsf/allocateBlock - local.set $8 - local.get $8 + local.set $9 + local.get $9 local.get $1 i32.load offset=4 i32.store offset=4 - local.get $8 + local.get $9 i32.const 16 i32.add local.get $1 @@ -4348,16 +4340,13 @@ global.get $~lib/heap/__heap_base i32.ge_u if - i32.const 1 + i32.const 0 drop - local.get $1 - local.get $8 - call $~lib/rt/rtrace/onrealloc local.get $0 local.get $1 call $~lib/rt/tlsf/freeBlock end - local.get $8 + local.get $9 ) (func $~lib/rt/tlsf/__realloc (param $0 i32) (param $1 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -5045,10 +5034,8 @@ i32.const 268435455 i32.and local.set $2 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/ondecrement i32.const 1 drop local.get $0 diff --git a/tests/compiler/std/string.json b/tests/compiler/std/string.json index 59c251c705..d8f53d9b42 100644 --- a/tests/compiler/std/string.json +++ b/tests/compiler/std/string.json @@ -1,7 +1,6 @@ { "asc_flags": [ - "--runtime half", - "--explicitStart", - "--use ASC_RTRACE=1" - ] + "--runtime half" + ], + "asc_rtrace": true } \ No newline at end of file diff --git a/tests/compiler/std/string.optimized.wat b/tests/compiler/std/string.optimized.wat index 2f254f57b9..258a9fc2f4 100644 --- a/tests/compiler/std/string.optimized.wat +++ b/tests/compiler/std/string.optimized.wat @@ -2,9 +2,9 @@ (type $i32_=>_i32 (func (param i32) (result i32))) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) - (type $i32_=>_none (func (param i32))) (type $i32_i32_=>_none (func (param i32 i32))) (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) + (type $i32_=>_none (func (param i32))) (type $i64_i32_=>_i32 (func (param i64 i32) (result i32))) (type $none_=>_none (func)) (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) @@ -21,11 +21,6 @@ (type $i32_=>_i64 (func (param i32) (result i64))) (type $f64_i32_=>_f64 (func (param f64 i32) (result f64))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onrealloc" (func $~lib/rt/rtrace/onrealloc (param i32 i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) (memory $0 1) (data (i32.const 1024) " \00\00\00\01\00\00\00\01\00\00\00 \00\00\00h\00i\00,\00 \00I\00\'\00m\00 \00a\00 \00s\00t\00r\00i\00n\00g") (data (i32.const 1072) "\1a\00\00\00\01\00\00\00\01\00\00\00\1a\00\00\00s\00t\00d\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s") @@ -462,10 +457,9 @@ (global $~lib/util/number/_K (mut i32) (i32.const 0)) (global $~lib/util/number/_frc_pow (mut i64) (i64.const 0)) (global $~lib/util/number/_exp_pow (mut i32) (i32.const 0)) - (global $~started (mut i32) (i32.const 0)) - (export "_start" (func $~start)) (export "memory" (memory $0)) (export "getString" (func $std/string/getString)) + (start $~start) (func $~lib/rt/pure/__retain (param $0 i32) (result i32) (local $1 i32) (local $2 i32) @@ -501,8 +495,6 @@ i32.add i32.store offset=4 local.get $1 - call $~lib/rt/rtrace/onincrement - local.get $1 i32.load i32.const 1 i32.and @@ -1697,8 +1689,6 @@ local.get $4 call $~lib/rt/tlsf/prepareBlock local.get $3 - call $~lib/rt/rtrace/onalloc - local.get $3 ) (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -4644,7 +4634,7 @@ if i32.const 0 i32.const 1360 - i32.const 580 + i32.const 585 i32.const 3 call $~lib/builtins/abort unreachable @@ -4661,14 +4651,13 @@ local.get $0 local.get $1 call $~lib/rt/tlsf/insertBlock - local.get $1 - call $~lib/rt/rtrace/onfree ) (func $~lib/rt/tlsf/reallocateBlock (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) (local $6 i32) + (local $7 i32) local.get $2 call $~lib/rt/tlsf/prepareSize local.tee $3 @@ -4677,6 +4666,7 @@ local.tee $5 i32.const -4 i32.and + local.tee $4 i32.le_u if local.get $0 @@ -4699,16 +4689,14 @@ i32.add local.tee $6 i32.load - local.tee $4 + local.tee $7 i32.const 1 i32.and if - local.get $5 - i32.const -4 - i32.and + local.get $4 i32.const 16 i32.add - local.get $4 + local.get $7 i32.const -4 i32.and i32.add @@ -4758,9 +4746,6 @@ i32.const 21992 i32.ge_u if - local.get $1 - local.get $3 - call $~lib/rt/rtrace/onrealloc local.get $0 local.get $1 call $~lib/rt/tlsf/freeBlock @@ -17087,13 +17072,6 @@ call $~lib/rt/pure/__retain ) (func $~start - global.get $~started - if - return - else - i32.const 1 - global.set $~started - end call $start:std/string ) (func $~lib/rt/pure/decrement (param $0 i32) @@ -17108,8 +17086,6 @@ i32.and local.set $1 local.get $0 - call $~lib/rt/rtrace/ondecrement - local.get $0 i32.load i32.const 1 i32.and diff --git a/tests/compiler/std/string.untouched.wat b/tests/compiler/std/string.untouched.wat index 55ead31450..9fa5d15a03 100644 --- a/tests/compiler/std/string.untouched.wat +++ b/tests/compiler/std/string.untouched.wat @@ -2,9 +2,9 @@ (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) (type $i32_=>_i32 (func (param i32) (result i32))) - (type $i32_=>_none (func (param i32))) (type $i32_i32_=>_none (func (param i32 i32))) (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) + (type $i32_=>_none (func (param i32))) (type $none_=>_none (func)) (type $i64_i32_=>_i32 (func (param i64 i32) (result i32))) (type $i32_i32_=>_f64 (func (param i32 i32) (result f64))) @@ -23,11 +23,6 @@ (type $i32_i32_=>_f32 (func (param i32 i32) (result f32))) (type $f64_i32_=>_f64 (func (param f64 i32) (result f64))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onrealloc" (func $~lib/rt/rtrace/onrealloc (param i32 i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) (memory $0 1) (data (i32.const 16) " \00\00\00\01\00\00\00\01\00\00\00 \00\00\00h\00i\00,\00 \00I\00\'\00m\00 \00a\00 \00s\00t\00r\00i\00n\00g\00") (data (i32.const 64) "\1a\00\00\00\01\00\00\00\01\00\00\00\1a\00\00\00s\00t\00d\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s\00") @@ -484,11 +479,10 @@ (global $~lib/util/number/_K (mut i32) (i32.const 0)) (global $~lib/util/number/_frc_pow (mut i64) (i64.const 0)) (global $~lib/util/number/_exp_pow (mut i32) (i32.const 0)) - (global $~started (mut i32) (i32.const 0)) (global $~lib/heap/__heap_base i32 (i32.const 22424)) - (export "_start" (func $~start)) (export "memory" (memory $0)) (export "getString" (func $std/string/getString)) + (start $~start) (func $~lib/rt/pure/increment (param $0 i32) (local $1 i32) local.get $0 @@ -521,10 +515,8 @@ i32.const 1 i32.add i32.store offset=4 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/onincrement i32.const 1 drop local.get $0 @@ -2222,11 +2214,9 @@ local.get $4 local.get $3 call $~lib/rt/tlsf/prepareBlock - i32.const 1 + i32.const 0 drop local.get $4 - call $~lib/rt/rtrace/onalloc - local.get $4 ) (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -7449,7 +7439,7 @@ if i32.const 0 i32.const 352 - i32.const 580 + i32.const 585 i32.const 3 call $~lib/builtins/abort unreachable @@ -7466,13 +7456,11 @@ i32.const 1 i32.or i32.store + i32.const 0 + drop local.get $0 local.get $1 call $~lib/rt/tlsf/insertBlock - i32.const 1 - drop - local.get $1 - call $~lib/rt/rtrace/onfree ) (func $~lib/rt/tlsf/reallocateBlock (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) @@ -7481,18 +7469,21 @@ (local $6 i32) (local $7 i32) (local $8 i32) + (local $9 i32) local.get $2 call $~lib/rt/tlsf/prepareSize local.set $3 local.get $1 i32.load local.set $4 - local.get $3 local.get $4 i32.const 3 i32.const -1 i32.xor i32.and + local.set $5 + local.get $3 + local.get $5 i32.le_u if local.get $0 @@ -7502,55 +7493,53 @@ local.get $1 local.get $2 i32.store offset=12 + i32.const 0 + drop local.get $1 return end local.get $1 - local.set $5 - local.get $5 + local.set $6 + local.get $6 i32.const 16 i32.add - local.get $5 + local.get $6 i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $6 - local.get $6 - i32.load local.set $7 local.get $7 + i32.load + local.set $8 + local.get $8 i32.const 1 i32.and if - local.get $4 - i32.const 3 - i32.const -1 - i32.xor - i32.and + local.get $5 i32.const 16 i32.add - local.get $7 + local.get $8 i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $5 - local.get $5 + local.set $6 + local.get $6 local.get $3 i32.ge_u if local.get $0 - local.get $6 + local.get $7 call $~lib/rt/tlsf/removeBlock local.get $1 local.get $4 i32.const 3 i32.and - local.get $5 + local.get $6 i32.or i32.store local.get $1 @@ -7560,6 +7549,8 @@ local.get $1 local.get $3 call $~lib/rt/tlsf/prepareBlock + i32.const 0 + drop local.get $1 return end @@ -7569,12 +7560,12 @@ local.get $1 i32.load offset=8 call $~lib/rt/tlsf/allocateBlock - local.set $8 - local.get $8 + local.set $9 + local.get $9 local.get $1 i32.load offset=4 i32.store offset=4 - local.get $8 + local.get $9 i32.const 16 i32.add local.get $1 @@ -7586,16 +7577,13 @@ global.get $~lib/heap/__heap_base i32.ge_u if - i32.const 1 + i32.const 0 drop - local.get $1 - local.get $8 - call $~lib/rt/rtrace/onrealloc local.get $0 local.get $1 call $~lib/rt/tlsf/freeBlock end - local.get $8 + local.get $9 ) (func $~lib/rt/tlsf/__realloc (param $0 i32) (param $1 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -21274,13 +21262,6 @@ call $~lib/rt/pure/__retain ) (func $~start - global.get $~started - if - return - else - i32.const 1 - global.set $~started - end call $start:std/string ) (func $~lib/rt/pure/finalize (param $0 i32) @@ -21300,10 +21281,8 @@ i32.const 268435455 i32.and local.set $2 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/ondecrement i32.const 1 drop local.get $0 diff --git a/tests/compiler/std/typedarray.json b/tests/compiler/std/typedarray.json index 59c251c705..d8f53d9b42 100644 --- a/tests/compiler/std/typedarray.json +++ b/tests/compiler/std/typedarray.json @@ -1,7 +1,6 @@ { "asc_flags": [ - "--runtime half", - "--explicitStart", - "--use ASC_RTRACE=1" - ] + "--runtime half" + ], + "asc_rtrace": true } \ No newline at end of file diff --git a/tests/compiler/std/typedarray.optimized.wat b/tests/compiler/std/typedarray.optimized.wat index 0ca0c1d2d2..26d19565b6 100644 --- a/tests/compiler/std/typedarray.optimized.wat +++ b/tests/compiler/std/typedarray.optimized.wat @@ -42,12 +42,7 @@ (type $f32_=>_f32 (func (param f32) (result f32))) (type $f64_=>_f64 (func (param f64) (result f64))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) - (import "rtrace" "onrealloc" (func $~lib/rt/rtrace/onrealloc (param i32 i32))) (import "env" "trace" (func $~lib/builtins/trace (param i32 i32 f64 f64 f64 f64 f64))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) (memory $0 1) (data (i32.const 1024) "\1c\00\00\00\01\00\00\00\01\00\00\00\1c\00\00\00I\00n\00v\00a\00l\00i\00d\00 \00l\00e\00n\00g\00t\00h") (data (i32.const 1072) "&\00\00\00\01\00\00\00\01\00\00\00&\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s") @@ -326,9 +321,8 @@ (global $~lib/util/number/_K (mut i32) (i32.const 0)) (global $~lib/util/number/_frc_pow (mut i64) (i64.const 0)) (global $~lib/util/number/_exp_pow (mut i32) (i32.const 0)) - (global $~started (mut i32) (i32.const 0)) - (export "_start" (func $~start)) (export "memory" (memory $0)) + (start $~start) (func $~lib/rt/pure/__release (param $0 i32) local.get $0 i32.const 12524 @@ -1342,8 +1336,6 @@ local.get $4 call $~lib/rt/tlsf/prepareBlock local.get $3 - call $~lib/rt/rtrace/onalloc - local.get $3 ) (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -1561,8 +1553,6 @@ i32.add i32.store offset=4 local.get $1 - call $~lib/rt/rtrace/onincrement - local.get $1 i32.load i32.const 1 i32.and @@ -2580,7 +2570,7 @@ if i32.const 0 i32.const 1152 - i32.const 580 + i32.const 585 i32.const 3 call $~lib/builtins/abort unreachable @@ -2597,8 +2587,6 @@ local.get $0 local.get $1 call $~lib/rt/tlsf/insertBlock - local.get $1 - call $~lib/rt/rtrace/onfree ) (func $~lib/util/sort/weakHeapSort (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) @@ -5533,6 +5521,7 @@ (local $4 i32) (local $5 i32) (local $6 i32) + (local $7 i32) local.get $2 call $~lib/rt/tlsf/prepareSize local.tee $3 @@ -5541,6 +5530,7 @@ local.tee $5 i32.const -4 i32.and + local.tee $4 i32.le_u if local.get $0 @@ -5563,16 +5553,14 @@ i32.add local.tee $6 i32.load - local.tee $4 + local.tee $7 i32.const 1 i32.and if - local.get $5 - i32.const -4 - i32.and + local.get $4 i32.const 16 i32.add - local.get $4 + local.get $7 i32.const -4 i32.and i32.add @@ -5622,9 +5610,6 @@ i32.const 12524 i32.ge_u if - local.get $1 - local.get $3 - call $~lib/rt/rtrace/onrealloc local.get $0 local.get $1 call $~lib/rt/tlsf/freeBlock @@ -36048,13 +36033,6 @@ unreachable ) (func $~start - global.get $~started - if - return - else - i32.const 1 - global.set $~started - end call $start:std/typedarray ) (func $~lib/rt/pure/decrement (param $0 i32) @@ -36067,8 +36045,6 @@ i32.and local.set $1 local.get $0 - call $~lib/rt/rtrace/ondecrement - local.get $0 i32.load i32.const 1 i32.and diff --git a/tests/compiler/std/typedarray.untouched.wat b/tests/compiler/std/typedarray.untouched.wat index 09e9e6da94..db7d0a8c7a 100644 --- a/tests/compiler/std/typedarray.untouched.wat +++ b/tests/compiler/std/typedarray.untouched.wat @@ -9,8 +9,8 @@ (type $i64_i32_i32_=>_i32 (func (param i64 i32 i32) (result i32))) (type $f32_i32_i32_=>_i32 (func (param f32 i32 i32) (result i32))) (type $f64_i32_i32_=>_i32 (func (param f64 i32 i32) (result i32))) - (type $i32_=>_none (func (param i32))) (type $i64_i64_i32_i32_=>_i64 (func (param i64 i64 i32 i32) (result i64))) + (type $i32_=>_none (func (param i32))) (type $i32_i64_i32_=>_i32 (func (param i32 i64 i32) (result i32))) (type $i32_i32_=>_i64 (func (param i32 i32) (result i64))) (type $f64_f64_=>_i32 (func (param f64 f64) (result i32))) @@ -47,12 +47,7 @@ (type $f32_f32_=>_f32 (func (param f32 f32) (result f32))) (type $f64_f64_=>_f64 (func (param f64 f64) (result f64))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) - (import "rtrace" "onrealloc" (func $~lib/rt/rtrace/onrealloc (param i32 i32))) (import "env" "trace" (func $~lib/builtins/trace (param i32 i32 f64 f64 f64 f64 f64))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) (memory $0 1) (data (i32.const 16) "\1c\00\00\00\01\00\00\00\01\00\00\00\1c\00\00\00I\00n\00v\00a\00l\00i\00d\00 \00l\00e\00n\00g\00t\00h\00") (data (i32.const 64) "&\00\00\00\01\00\00\00\01\00\00\00&\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s\00") @@ -347,10 +342,9 @@ (global $std/typedarray/setSource2 (mut i32) (i32.const 8992)) (global $std/typedarray/setSource3 (mut i32) (i32.const 9072)) (global $std/typedarray/setSource7 (mut i32) (i32.const 9136)) - (global $~started (mut i32) (i32.const 0)) (global $~lib/heap/__heap_base i32 (i32.const 12956)) - (export "_start" (func $~start)) (export "memory" (memory $0)) + (start $~start) (func $~lib/rt/pure/__release (param $0 i32) local.get $0 global.get $~lib/heap/__heap_base @@ -1776,11 +1770,9 @@ local.get $4 local.get $3 call $~lib/rt/tlsf/prepareBlock - i32.const 1 + i32.const 0 drop local.get $4 - call $~lib/rt/rtrace/onalloc - local.get $4 ) (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -2035,10 +2027,8 @@ i32.const 1 i32.add i32.store offset=4 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/onincrement i32.const 1 drop local.get $0 @@ -3346,7 +3336,7 @@ if i32.const 0 i32.const 144 - i32.const 580 + i32.const 585 i32.const 3 call $~lib/builtins/abort unreachable @@ -3363,13 +3353,11 @@ i32.const 1 i32.or i32.store + i32.const 0 + drop local.get $0 local.get $1 call $~lib/rt/tlsf/insertBlock - i32.const 1 - drop - local.get $1 - call $~lib/rt/rtrace/onfree ) (func $~lib/rt/tlsf/__free (param $0 i32) call $~lib/rt/tlsf/maybeInitialize @@ -11150,18 +11138,21 @@ (local $6 i32) (local $7 i32) (local $8 i32) + (local $9 i32) local.get $2 call $~lib/rt/tlsf/prepareSize local.set $3 local.get $1 i32.load local.set $4 - local.get $3 local.get $4 i32.const 3 i32.const -1 i32.xor i32.and + local.set $5 + local.get $3 + local.get $5 i32.le_u if local.get $0 @@ -11171,55 +11162,53 @@ local.get $1 local.get $2 i32.store offset=12 + i32.const 0 + drop local.get $1 return end local.get $1 - local.set $5 - local.get $5 + local.set $6 + local.get $6 i32.const 16 i32.add - local.get $5 + local.get $6 i32.load i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $6 - local.get $6 - i32.load local.set $7 local.get $7 + i32.load + local.set $8 + local.get $8 i32.const 1 i32.and if - local.get $4 - i32.const 3 - i32.const -1 - i32.xor - i32.and + local.get $5 i32.const 16 i32.add - local.get $7 + local.get $8 i32.const 3 i32.const -1 i32.xor i32.and i32.add - local.set $5 - local.get $5 + local.set $6 + local.get $6 local.get $3 i32.ge_u if local.get $0 - local.get $6 + local.get $7 call $~lib/rt/tlsf/removeBlock local.get $1 local.get $4 i32.const 3 i32.and - local.get $5 + local.get $6 i32.or i32.store local.get $1 @@ -11229,6 +11218,8 @@ local.get $1 local.get $3 call $~lib/rt/tlsf/prepareBlock + i32.const 0 + drop local.get $1 return end @@ -11238,12 +11229,12 @@ local.get $1 i32.load offset=8 call $~lib/rt/tlsf/allocateBlock - local.set $8 - local.get $8 + local.set $9 + local.get $9 local.get $1 i32.load offset=4 i32.store offset=4 - local.get $8 + local.get $9 i32.const 16 i32.add local.get $1 @@ -11255,16 +11246,13 @@ global.get $~lib/heap/__heap_base i32.ge_u if - i32.const 1 + i32.const 0 drop - local.get $1 - local.get $8 - call $~lib/rt/rtrace/onrealloc local.get $0 local.get $1 call $~lib/rt/tlsf/freeBlock end - local.get $8 + local.get $9 ) (func $~lib/rt/tlsf/__realloc (param $0 i32) (param $1 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -57472,13 +57460,6 @@ call $~lib/rt/pure/__release ) (func $~start - global.get $~started - if - return - else - i32.const 1 - global.set $~started - end call $start:std/typedarray ) (func $~lib/rt/pure/finalize (param $0 i32) @@ -57498,10 +57479,8 @@ i32.const 268435455 i32.and local.set $2 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/ondecrement i32.const 1 drop local.get $0 diff --git a/tests/compiler/throw.json b/tests/compiler/throw.json index 9f7878d475..d8f53d9b42 100644 --- a/tests/compiler/throw.json +++ b/tests/compiler/throw.json @@ -1,6 +1,6 @@ { "asc_flags": [ - "--runtime half", - "--use ASC_RTRACE=1" - ] + "--runtime half" + ], + "asc_rtrace": true } \ No newline at end of file diff --git a/tests/compiler/throw.untouched.wat b/tests/compiler/throw.untouched.wat index 383394d55d..65d079b038 100644 --- a/tests/compiler/throw.untouched.wat +++ b/tests/compiler/throw.untouched.wat @@ -4,8 +4,6 @@ (type $none_=>_none (func)) (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) (memory $0 1) (data (i32.const 16) "\06\00\00\00\01\00\00\00\01\00\00\00\06\00\00\001\002\003\00") (data (i32.const 48) "\06\00\00\00\01\00\00\00\01\00\00\00\06\00\00\002\003\004\00") @@ -719,13 +717,11 @@ i32.const 1 i32.or i32.store + i32.const 0 + drop local.get $0 local.get $1 call $~lib/rt/tlsf/insertBlock - i32.const 1 - drop - local.get $1 - call $~lib/rt/rtrace/onfree ) (func $~lib/rt/pure/finalize (param $0 i32) i32.const 0 @@ -744,10 +740,8 @@ i32.const 268435455 i32.and local.set $2 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/ondecrement i32.const 1 drop local.get $0 diff --git a/tests/compiler/while.json b/tests/compiler/while.json index 59c251c705..d8f53d9b42 100644 --- a/tests/compiler/while.json +++ b/tests/compiler/while.json @@ -1,7 +1,6 @@ { "asc_flags": [ - "--runtime half", - "--explicitStart", - "--use ASC_RTRACE=1" - ] + "--runtime half" + ], + "asc_rtrace": true } \ No newline at end of file diff --git a/tests/compiler/while.optimized.wat b/tests/compiler/while.optimized.wat index 971454d569..1dd4489829 100644 --- a/tests/compiler/while.optimized.wat +++ b/tests/compiler/while.optimized.wat @@ -1,16 +1,12 @@ (module - (type $i32_=>_none (func (param i32))) (type $none_=>_none (func)) + (type $i32_=>_none (func (param i32))) (type $i32_i32_=>_none (func (param i32 i32))) (type $none_=>_i32 (func (result i32))) (type $i32_=>_i32 (func (param i32) (result i32))) (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) (memory $0 1) (data (i32.const 1024) "\10\00\00\00\01\00\00\00\01\00\00\00\10\00\00\00w\00h\00i\00l\00e\00.\00t\00s") (data (i32.const 1056) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s") @@ -19,9 +15,8 @@ (global $while/ran (mut i32) (i32.const 0)) (global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0)) (global $~lib/rt/tlsf/collectLock (mut i32) (i32.const 0)) - (global $~started (mut i32) (i32.const 0)) - (export "_start" (func $~start)) (export "memory" (memory $0)) + (start $~start) (func $while/testNested (local $0 i32) (local $1 i32) @@ -973,8 +968,6 @@ i32.store end local.get $1 - call $~lib/rt/rtrace/onalloc - local.get $1 ) (func $while/Ref#constructor (result i32) (local $0 i32) @@ -984,14 +977,14 @@ call $~lib/rt/tlsf/allocateBlock i32.const 16 i32.add - local.tee $1 + local.tee $0 i32.const 1216 i32.gt_u if - local.get $1 + local.get $0 i32.const 16 i32.sub - local.tee $0 + local.tee $1 i32.load offset=4 local.tee $2 i32.const -268435456 @@ -1010,14 +1003,12 @@ call $~lib/builtins/abort unreachable end - local.get $0 + local.get $1 local.get $2 i32.const 1 i32.add i32.store offset=4 - local.get $0 - call $~lib/rt/rtrace/onincrement - local.get $0 + local.get $1 i32.load i32.const 1 i32.and @@ -1030,7 +1021,7 @@ unreachable end end - local.get $1 + local.get $0 ) (func $~lib/rt/pure/__release (param $0 i32) local.get $0 @@ -1442,13 +1433,6 @@ global.set $while/ran ) (func $~start - global.get $~started - if - return - else - i32.const 1 - global.set $~started - end call $start:while ) (func $~lib/rt/pure/decrement (param $0 i32) @@ -1461,8 +1445,6 @@ i32.and local.set $1 local.get $0 - call $~lib/rt/rtrace/ondecrement - local.get $0 i32.load i32.const 1 i32.and @@ -1525,8 +1507,6 @@ global.get $~lib/rt/tlsf/ROOT local.get $0 call $~lib/rt/tlsf/insertBlock - local.get $0 - call $~lib/rt/rtrace/onfree else local.get $1 i32.const 0 diff --git a/tests/compiler/while.untouched.wat b/tests/compiler/while.untouched.wat index 4886d25300..3a4ab62ee3 100644 --- a/tests/compiler/while.untouched.wat +++ b/tests/compiler/while.untouched.wat @@ -1,7 +1,7 @@ (module (type $none_=>_none (func)) - (type $i32_=>_none (func (param i32))) (type $i32_i32_=>_none (func (param i32 i32))) + (type $i32_=>_none (func (param i32))) (type $none_=>_i32 (func (result i32))) (type $i32_=>_i32 (func (param i32) (result i32))) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) @@ -9,10 +9,6 @@ (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) - (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) - (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) - (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) (memory $0 1) (data (i32.const 16) "\10\00\00\00\01\00\00\00\01\00\00\00\10\00\00\00w\00h\00i\00l\00e\00.\00t\00s\00") (data (i32.const 48) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s\00") @@ -24,10 +20,9 @@ (global $~lib/ASC_LOW_MEMORY_LIMIT i32 (i32.const 0)) (global $~lib/rt/tlsf/collectLock (mut i32) (i32.const 0)) (global $~lib/gc/gc.auto (mut i32) (i32.const 1)) - (global $~started (mut i32) (i32.const 0)) (global $~lib/heap/__heap_base i32 (i32.const 208)) - (export "_start" (func $~start)) (export "memory" (memory $0)) + (start $~start) (func $while/testSimple (local $0 i32) (local $1 i32) @@ -1896,11 +1891,9 @@ local.get $4 local.get $3 call $~lib/rt/tlsf/prepareBlock - i32.const 1 + i32.const 0 drop local.get $4 - call $~lib/rt/rtrace/onalloc - local.get $4 ) (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) call $~lib/rt/tlsf/maybeInitialize @@ -1942,10 +1935,8 @@ i32.const 1 i32.add i32.store offset=4 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/onincrement i32.const 1 drop local.get $0 @@ -2398,13 +2389,6 @@ end ) (func $~start - global.get $~started - if - return - else - i32.const 1 - global.set $~started - end call $start:while ) (func $~lib/rt/pure/__collect @@ -2422,13 +2406,11 @@ i32.const 1 i32.or i32.store + i32.const 0 + drop local.get $0 local.get $1 call $~lib/rt/tlsf/insertBlock - i32.const 1 - drop - local.get $1 - call $~lib/rt/rtrace/onfree ) (func $~lib/rt/pure/finalize (param $0 i32) i32.const 0 @@ -2447,10 +2429,8 @@ i32.const 268435455 i32.and local.set $2 - i32.const 1 + i32.const 0 drop - local.get $0 - call $~lib/rt/rtrace/ondecrement i32.const 1 drop local.get $0