alias locals when inlining a tail call

This commit is contained in:
dcode 2019-03-17 00:11:16 +01:00
parent 0c388ca4c6
commit 2d76da9465
14 changed files with 1342 additions and 1402 deletions

View File

@ -56,18 +56,17 @@ import {
import {
ElementKind,
OperatorKind,
FunctionPrototype,
Class,
Field,
Global,
DecoratorFlags,
ClassPrototype,
Local
} from "./program";
import {
FlowFlags, Flow
FlowFlags,
Flow
} from "./flow";
import {

View File

@ -75,6 +75,7 @@ export enum CommonFlags {
// Other
/** Is quoted. */
QUOTED = 1 << 28
}

View File

@ -39,7 +39,8 @@ import {
getBlockChildCount,
getBlockChild,
getBlockName,
needsExplicitUnreachable
needsExplicitUnreachable,
getGetLocalIndex
} from "./module";
import {
@ -1467,7 +1468,10 @@ export class Compiler extends DiagnosticEmitter {
}
}
compileStatement(statement: Statement, isLastStatementInBody: bool = false): ExpressionRef {
compileStatement(
statement: Statement,
isLastStatementInBody: bool = false
): ExpressionRef {
var module = this.module;
var stmt: ExpressionRef;
switch (statement.kind) {
@ -1492,7 +1496,7 @@ export class Compiler extends DiagnosticEmitter {
break;
}
case NodeKind.EXPRESSION: {
stmt = this.compileExpressionStatement(<ExpressionStatement>statement);
stmt = this.compileExpressionStatement(<ExpressionStatement>statement, isLastStatementInBody);
break;
}
case NodeKind.FOR: {
@ -1691,8 +1695,15 @@ export class Compiler extends DiagnosticEmitter {
return this.module.createNop();
}
compileExpressionStatement(statement: ExpressionStatement): ExpressionRef {
var expr = this.compileExpression(statement.expression, Type.void, ConversionKind.NONE, WrapMode.NONE);
compileExpressionStatement(statement: ExpressionStatement, isLastStatementInBody: bool = false): ExpressionRef {
var expr = this.compileExpression(
statement.expression,
Type.void,
ConversionKind.NONE,
WrapMode.NONE,
null,
isLastStatementInBody
);
if (this.currentType != Type.void) {
expr = this.module.createDrop(expr);
this.currentType = Type.void;
@ -2342,7 +2353,8 @@ export class Compiler extends DiagnosticEmitter {
contextualType: Type,
conversionKind: ConversionKind,
wrapMode: WrapMode,
context: Element | null = null
context: Element | null = null,
isLastStatementInBody: bool = false
): ExpressionRef {
this.currentType = contextualType;
var expr: ExpressionRef;
@ -2356,7 +2368,7 @@ export class Compiler extends DiagnosticEmitter {
break;
}
case NodeKind.CALL: {
expr = this.compileCallExpression(<CallExpression>expression, contextualType);
expr = this.compileCallExpression(<CallExpression>expression, contextualType, isLastStatementInBody);
break;
}
case NodeKind.COMMA: {
@ -4988,7 +5000,11 @@ export class Compiler extends DiagnosticEmitter {
return module.createUnreachable();
}
compileCallExpression(expression: CallExpression, contextualType: Type): ExpressionRef {
compileCallExpression(
expression: CallExpression,
contextualType: Type,
isLastStatementInBody: bool = false
): ExpressionRef {
var module = this.module;
var flow = this.currentFlow;
@ -5184,7 +5200,8 @@ export class Compiler extends DiagnosticEmitter {
instance,
expression.arguments,
expression,
thisExpr
thisExpr,
isLastStatementInBody
);
}
@ -5413,7 +5430,8 @@ export class Compiler extends DiagnosticEmitter {
instance: Function,
argumentExpressions: Expression[],
reportNode: Node,
thisArg: ExpressionRef = 0
thisArg: ExpressionRef = 0,
inlineCanAlias: bool = false
): ExpressionRef {
var numArguments = argumentExpressions.length;
var signature = instance.signature;
@ -5437,7 +5455,7 @@ export class Compiler extends DiagnosticEmitter {
);
} else {
this.currentInlineFunctions.push(instance);
let expr = this.compileCallInlinePrechecked(instance, argumentExpressions, thisArg);
let expr = this.compileCallInlinePrechecked(instance, argumentExpressions, thisArg, inlineCanAlias);
this.currentInlineFunctions.pop();
return expr;
}
@ -5468,7 +5486,8 @@ export class Compiler extends DiagnosticEmitter {
private compileCallInlinePrechecked(
instance: Function,
argumentExpressions: Expression[],
thisArg: ExpressionRef = 0
thisArg: ExpressionRef = 0,
canAlias: bool = false
): ExpressionRef {
var module = this.module;
@ -5483,12 +5502,18 @@ export class Compiler extends DiagnosticEmitter {
if (thisArg) {
let classInstance = assert(instance.parent); assert(classInstance.kind == ElementKind.CLASS);
let thisType = assert(instance.signature.thisType);
let thisLocal = flow.addScopedLocal(CommonSymbols.this_, thisType, false);
body.push(
module.createSetLocal(thisLocal.index, thisArg)
);
let baseInstance = (<Class>classInstance).base;
if (baseInstance) flow.addScopedAlias(CommonSymbols.super_, baseInstance.type, thisLocal.index);
if (canAlias && getExpressionId(thisArg) == ExpressionId.GetLocal) {
flow.addScopedAlias(CommonSymbols.this_, thisType, getGetLocalIndex(thisArg));
let baseInstance = (<Class>classInstance).base;
if (baseInstance) flow.addScopedAlias(CommonSymbols.super_, baseInstance.type, getGetLocalIndex(thisArg));
} else {
let thisLocal = flow.addScopedLocal(CommonSymbols.this_, thisType, false);
body.push(
module.createSetLocal(thisLocal.index, thisArg)
);
let baseInstance = (<Class>classInstance).base;
if (baseInstance) flow.addScopedAlias(CommonSymbols.super_, baseInstance.type, thisLocal.index);
}
}
var numArguments = argumentExpressions.length;
@ -5501,14 +5526,18 @@ export class Compiler extends DiagnosticEmitter {
ConversionKind.IMPLICIT,
WrapMode.NONE
);
let argumentLocal = flow.addScopedLocal(
signature.getParameterName(i),
parameterTypes[i],
!previousFlow.canOverflow(paramExpr, parameterTypes[i])
);
body.push(
module.createSetLocal(argumentLocal.index, paramExpr)
);
if (canAlias && getExpressionId(paramExpr) == ExpressionId.GetLocal) {
flow.addScopedAlias(signature.getParameterName(i), parameterTypes[i], getGetLocalIndex(paramExpr));
} else {
let argumentLocal = flow.addScopedLocal(
signature.getParameterName(i),
parameterTypes[i],
!previousFlow.canOverflow(paramExpr, parameterTypes[i])
);
body.push(
module.createSetLocal(argumentLocal.index, paramExpr)
);
}
}
// Compile optional parameter initializers in the scope of the inlined flow
@ -5521,14 +5550,18 @@ export class Compiler extends DiagnosticEmitter {
ConversionKind.IMPLICIT,
WrapMode.WRAP
);
let argumentLocal = flow.addScopedLocal(
signature.getParameterName(i),
parameterTypes[i],
!flow.canOverflow(initExpr, parameterTypes[i])
);
body.push(
module.createSetLocal(argumentLocal.index, initExpr)
);
if (canAlias && getExpressionId(initExpr) == ExpressionId.GetLocal) {
flow.addScopedAlias(signature.getParameterName(i), parameterTypes[i], getGetLocalIndex(initExpr));
} else {
let argumentLocal = flow.addScopedLocal(
signature.getParameterName(i),
parameterTypes[i],
!flow.canOverflow(initExpr, parameterTypes[i])
);
body.push(
module.createSetLocal(argumentLocal.index, initExpr)
);
}
}
// Compile the called function's body in the scope of the inlined flow

View File

@ -84,7 +84,12 @@ import {
} from "./module";
import {
CharCode, writeI32, writeI8, writeI16, writeF32, writeF64
CharCode,
writeI8,
writeI16,
writeI32,
writeF32,
writeF64
} from "./util";
import {

View File

@ -40,7 +40,7 @@ export declare function CLASSID<T>(): u32;
export declare function ITERATEROOTS(fn: (ref: usize) => void): void;
/** Adjusts an allocation to actual block size. Primarily targets TLSF. */
function adjustToBlock(payloadSize: usize): usize {
export function ADJUSTOBLOCK(payloadSize: usize): usize {
// round up to power of 2, e.g. with HEADER_SIZE=8:
// 0 -> 2^3 = 8
// 1..8 -> 2^4 = 16
@ -58,7 +58,7 @@ export function ALLOCATE(payloadSize: usize): usize {
}
function doAllocate(payloadSize: usize): usize {
var header = changetype<HEADER>(memory.allocate(adjustToBlock(payloadSize)));
var header = changetype<HEADER>(memory.allocate(ADJUSTOBLOCK(payloadSize)));
header.classId = HEADER_MAGIC;
header.payloadSize = payloadSize;
if (GC_IMPLEMENTED) {
@ -83,8 +83,8 @@ function doReallocate(ref: usize, newPayloadSize: usize): usize {
var header = changetype<HEADER>(ref - HEADER_SIZE);
var payloadSize = header.payloadSize;
if (payloadSize < newPayloadSize) {
let newAdjustedSize = adjustToBlock(newPayloadSize);
if (select(adjustToBlock(payloadSize), 0, ref > HEAP_BASE) < newAdjustedSize) {
let newAdjustedSize = ADJUSTOBLOCK(newPayloadSize);
if (select(ADJUSTOBLOCK(payloadSize), 0, ref > HEAP_BASE) < newAdjustedSize) {
// move if the allocation isn't large enough or not a heap object
let newHeader = changetype<HEADER>(memory.allocate(newAdjustedSize));
newHeader.classId = header.classId;

View File

@ -35,7 +35,7 @@
(export "memory" (memory $0))
(export "table" (table $0))
(start $start)
(func $~lib/runtime/adjustToBlock (; 1 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(func $~lib/runtime/ADJUSTOBLOCK (; 1 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
i32.const 1
i32.const 32
local.get $0
@ -135,7 +135,7 @@
(func $~lib/runtime/doAllocate (; 3 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
local.get $0
call $~lib/runtime/adjustToBlock
call $~lib/runtime/ADJUSTOBLOCK
call $~lib/memory/memory.allocate
local.set $1
local.get $1
@ -194,261 +194,252 @@
(func $~lib/memory/memory.fill (; 7 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32)
(local $3 i32)
(local $4 i32)
(local $5 i32)
(local $6 i32)
(local $7 i32)
(local $8 i64)
(local $5 i64)
block $~lib/util/memory/memset|inlined.0
local.get $0
local.set $3
local.get $1
local.set $4
local.get $2
local.set $5
local.get $5
i32.eqz
if
br $~lib/util/memory/memset|inlined.0
end
local.get $3
local.get $4
local.get $0
local.get $1
i32.store8
local.get $3
local.get $5
local.get $0
local.get $2
i32.add
i32.const 1
i32.sub
local.get $4
local.get $1
i32.store8
local.get $5
local.get $2
i32.const 2
i32.le_u
if
br $~lib/util/memory/memset|inlined.0
end
local.get $3
local.get $0
i32.const 1
i32.add
local.get $4
local.get $1
i32.store8
local.get $3
local.get $0
i32.const 2
i32.add
local.get $4
local.get $1
i32.store8
local.get $3
local.get $5
local.get $0
local.get $2
i32.add
i32.const 2
i32.sub
local.get $4
local.get $1
i32.store8
local.get $3
local.get $5
local.get $0
local.get $2
i32.add
i32.const 3
i32.sub
local.get $4
local.get $1
i32.store8
local.get $5
local.get $2
i32.const 6
i32.le_u
if
br $~lib/util/memory/memset|inlined.0
end
local.get $3
local.get $0
i32.const 3
i32.add
local.get $4
local.get $1
i32.store8
local.get $3
local.get $5
local.get $0
local.get $2
i32.add
i32.const 4
i32.sub
local.get $4
local.get $1
i32.store8
local.get $5
local.get $2
i32.const 8
i32.le_u
if
br $~lib/util/memory/memset|inlined.0
end
i32.const 0
local.get $3
local.get $0
i32.sub
i32.const 3
i32.and
local.set $6
local.get $3
local.get $6
i32.add
local.set $3
local.get $5
local.get $6
local.get $0
local.get $3
i32.add
local.set $0
local.get $2
local.get $3
i32.sub
local.set $5
local.get $5
local.set $2
local.get $2
i32.const -4
i32.and
local.set $5
local.set $2
i32.const -1
i32.const 255
i32.div_u
local.get $4
local.get $1
i32.const 255
i32.and
i32.mul
local.set $7
local.get $3
local.get $7
local.set $4
local.get $0
local.get $4
i32.store
local.get $3
local.get $5
local.get $0
local.get $2
i32.add
i32.const 4
i32.sub
local.get $7
local.get $4
i32.store
local.get $5
local.get $2
i32.const 8
i32.le_u
if
br $~lib/util/memory/memset|inlined.0
end
local.get $3
local.get $0
i32.const 4
i32.add
local.get $7
local.get $4
i32.store
local.get $3
local.get $0
i32.const 8
i32.add
local.get $7
local.get $4
i32.store
local.get $3
local.get $5
local.get $0
local.get $2
i32.add
i32.const 12
i32.sub
local.get $7
local.get $4
i32.store
local.get $3
local.get $5
local.get $0
local.get $2
i32.add
i32.const 8
i32.sub
local.get $7
local.get $4
i32.store
local.get $5
local.get $2
i32.const 24
i32.le_u
if
br $~lib/util/memory/memset|inlined.0
end
local.get $3
local.get $0
i32.const 12
i32.add
local.get $7
local.get $4
i32.store
local.get $3
local.get $0
i32.const 16
i32.add
local.get $7
local.get $4
i32.store
local.get $3
local.get $0
i32.const 20
i32.add
local.get $7
local.get $4
i32.store
local.get $3
local.get $0
i32.const 24
i32.add
local.get $7
local.get $4
i32.store
local.get $3
local.get $5
local.get $0
local.get $2
i32.add
i32.const 28
i32.sub
local.get $7
local.get $4
i32.store
local.get $3
local.get $5
local.get $0
local.get $2
i32.add
i32.const 24
i32.sub
local.get $7
local.get $4
i32.store
local.get $3
local.get $5
local.get $0
local.get $2
i32.add
i32.const 20
i32.sub
local.get $7
local.get $4
i32.store
local.get $3
local.get $5
local.get $0
local.get $2
i32.add
i32.const 16
i32.sub
local.get $7
local.get $4
i32.store
i32.const 24
local.get $3
local.get $0
i32.const 4
i32.and
i32.add
local.set $6
local.get $3
local.get $6
i32.add
local.set $3
local.get $5
local.get $6
local.get $0
local.get $3
i32.add
local.set $0
local.get $2
local.get $3
i32.sub
local.set $5
local.get $7
local.set $2
local.get $4
i64.extend_i32_u
local.get $7
local.get $4
i64.extend_i32_u
i64.const 32
i64.shl
i64.or
local.set $8
local.set $5
block $break|0
loop $continue|0
local.get $5
local.get $2
i32.const 32
i32.ge_u
if
block
local.get $3
local.get $8
local.get $0
local.get $5
i64.store
local.get $3
local.get $0
i32.const 8
i32.add
local.get $8
local.get $5
i64.store
local.get $3
local.get $0
i32.const 16
i32.add
local.get $8
local.get $5
i64.store
local.get $3
local.get $0
i32.const 24
i32.add
local.get $8
i64.store
local.get $5
i64.store
local.get $2
i32.const 32
i32.sub
local.set $5
local.get $3
local.set $2
local.get $0
i32.const 32
i32.add
local.set $3
local.set $0
end
br $continue|0
end

View File

@ -11,12 +11,18 @@
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
(import "env" "trace" (func $~lib/env/trace (param i32 i32 f64 f64 f64 f64 f64)))
(memory $0 1)
(data (i32.const 8) "\01\00\00\00,\00\00\00~\00l\00i\00b\00/\00a\00l\00l\00o\00c\00a\00t\00o\00r\00/\00t\00l\00s\00f\00.\00t\00s")
(data (i32.const 64) "\01\00\00\00\1c\00\00\00s\00t\00d\00/\00r\00u\00n\00t\00i\00m\00e\00.\00t\00s")
(data (i32.const 104) "\01\00\00\00\10\00\00\00b\00a\00r\00r\00i\00e\00r\001")
(data (i32.const 128) "\01\00\00\00\10\00\00\00b\00a\00r\00r\00i\00e\00r\002")
(data (i32.const 152) "\01\00\00\00\10\00\00\00b\00a\00r\00r\00i\00e\00r\003")
(data (i32.const 176) "\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00u\00n\00t\00i\00m\00e\00.\00t\00s")
(data (i32.const 8) "\01\00\00\00,")
(data (i32.const 24) "~\00l\00i\00b\00/\00a\00l\00l\00o\00c\00a\00t\00o\00r\00/\00t\00l\00s\00f\00.\00t\00s")
(data (i32.const 72) "\01\00\00\00\1c")
(data (i32.const 88) "s\00t\00d\00/\00r\00u\00n\00t\00i\00m\00e\00.\00t\00s")
(data (i32.const 120) "\01\00\00\00\10")
(data (i32.const 136) "b\00a\00r\00r\00i\00e\00r\001")
(data (i32.const 152) "\01\00\00\00\10")
(data (i32.const 168) "b\00a\00r\00r\00i\00e\00r\002")
(data (i32.const 184) "\01\00\00\00\10")
(data (i32.const 200) "b\00a\00r\00r\00i\00e\00r\003")
(data (i32.const 216) "\01\00\00\00\1e")
(data (i32.const 232) "~\00l\00i\00b\00/\00r\00u\00n\00t\00i\00m\00e\00.\00t\00s")
(table $0 1 funcref)
(elem (i32.const 0) $null)
(global $~lib/allocator/tlsf/ROOT (mut i32) (i32.const 0))
@ -41,7 +47,7 @@
i32.ge_u
if
i32.const 0
i32.const 16
i32.const 24
i32.const 130
i32.const 4
call $~lib/env/abort
@ -61,7 +67,7 @@
i32.ge_u
if
i32.const 0
i32.const 16
i32.const 24
i32.const 153
i32.const 4
call $~lib/env/abort
@ -72,7 +78,7 @@
i32.ge_u
if
i32.const 0
i32.const 16
i32.const 24
i32.const 154
i32.const 4
call $~lib/env/abort
@ -98,7 +104,7 @@
i32.eqz
if
i32.const 0
i32.const 16
i32.const 24
i32.const 76
i32.const 4
call $~lib/env/abort
@ -116,7 +122,7 @@
i32.eqz
if
i32.const 0
i32.const 16
i32.const 24
i32.const 77
i32.const 11
call $~lib/env/abort
@ -129,7 +135,7 @@
i32.eqz
if
i32.const 0
i32.const 16
i32.const 24
i32.const 414
i32.const 2
call $~lib/env/abort
@ -146,7 +152,7 @@
i32.ge_u
if
i32.const 0
i32.const 16
i32.const 24
i32.const 144
i32.const 4
call $~lib/env/abort
@ -157,7 +163,7 @@
i32.ge_u
if
i32.const 0
i32.const 16
i32.const 24
i32.const 145
i32.const 4
call $~lib/env/abort
@ -180,7 +186,7 @@
i32.ge_u
if
i32.const 0
i32.const 16
i32.const 24
i32.const 124
i32.const 4
call $~lib/env/abort
@ -206,7 +212,7 @@
i32.eqz
if
i32.const 0
i32.const 16
i32.const 24
i32.const 244
i32.const 4
call $~lib/env/abort
@ -229,7 +235,7 @@
i32.eqz
if
i32.const 0
i32.const 16
i32.const 24
i32.const 246
i32.const 4
call $~lib/env/abort
@ -330,7 +336,7 @@
i32.eqz
if
i32.const 0
i32.const 16
i32.const 24
i32.const 68
i32.const 4
call $~lib/env/abort
@ -344,7 +350,7 @@
i32.eqz
if
i32.const 0
i32.const 16
i32.const 24
i32.const 69
i32.const 11
call $~lib/env/abort
@ -360,7 +366,7 @@
i32.eqz
if
i32.const 0
i32.const 16
i32.const 24
i32.const 320
i32.const 4
call $~lib/env/abort
@ -372,7 +378,7 @@
i32.ne
if
i32.const 0
i32.const 16
i32.const 24
i32.const 321
i32.const 4
call $~lib/env/abort
@ -385,7 +391,7 @@
i32.eqz
if
i32.const 0
i32.const 16
i32.const 24
i32.const 322
i32.const 4
call $~lib/env/abort
@ -407,7 +413,7 @@
i32.eqz
if
i32.const 0
i32.const 16
i32.const 24
i32.const 175
i32.const 4
call $~lib/env/abort
@ -421,7 +427,7 @@
i32.eqz
if
i32.const 0
i32.const 16
i32.const 24
i32.const 177
i32.const 4
call $~lib/env/abort
@ -445,7 +451,7 @@
i32.eqz
if
i32.const 0
i32.const 16
i32.const 24
i32.const 179
i32.const 4
call $~lib/env/abort
@ -457,7 +463,7 @@
i32.eqz
if
i32.const 0
i32.const 16
i32.const 24
i32.const 183
i32.const 23
call $~lib/env/abort
@ -499,7 +505,7 @@
i32.eqz
if
i32.const 0
i32.const 16
i32.const 24
i32.const 197
i32.const 24
call $~lib/env/abort
@ -513,7 +519,7 @@
i32.eqz
if
i32.const 0
i32.const 16
i32.const 24
i32.const 199
i32.const 6
call $~lib/env/abort
@ -562,7 +568,7 @@
i32.eqz
if
i32.const 0
i32.const 16
i32.const 24
i32.const 212
i32.const 4
call $~lib/env/abort
@ -641,7 +647,7 @@
i32.gt_u
if
i32.const 0
i32.const 16
i32.const 24
i32.const 363
i32.const 4
call $~lib/env/abort
@ -652,7 +658,7 @@
i32.and
if
i32.const 0
i32.const 16
i32.const 24
i32.const 364
i32.const 4
call $~lib/env/abort
@ -663,7 +669,7 @@
i32.and
if
i32.const 0
i32.const 16
i32.const 24
i32.const 365
i32.const 4
call $~lib/env/abort
@ -680,7 +686,7 @@
i32.lt_u
if
i32.const 0
i32.const 16
i32.const 24
i32.const 370
i32.const 6
call $~lib/env/abort
@ -708,7 +714,7 @@
i32.lt_u
if
i32.const 0
i32.const 16
i32.const 24
i32.const 379
i32.const 6
call $~lib/env/abort
@ -761,7 +767,7 @@
i32.eqz
if
i32.const 0
i32.const 16
i32.const 24
i32.const 408
i32.const 2
call $~lib/env/abort
@ -786,7 +792,7 @@
i32.eqz
if
i32.const 0
i32.const 16
i32.const 24
i32.const 282
i32.const 4
call $~lib/env/abort
@ -866,7 +872,7 @@
i32.eqz
if
i32.const 0
i32.const 16
i32.const 24
i32.const 309
i32.const 16
call $~lib/env/abort
@ -894,7 +900,7 @@
i32.eqz
if
i32.const 0
i32.const 16
i32.const 24
i32.const 334
i32.const 4
call $~lib/env/abort
@ -914,7 +920,7 @@
i32.eqz
if
i32.const 0
i32.const 16
i32.const 24
i32.const 335
i32.const 4
call $~lib/env/abort
@ -925,7 +931,7 @@
i32.and
if
i32.const 0
i32.const 16
i32.const 24
i32.const 336
i32.const 4
call $~lib/env/abort
@ -977,7 +983,7 @@
i32.eqz
if
i32.const 0
i32.const 16
i32.const 24
i32.const 354
i32.const 25
call $~lib/env/abort
@ -1022,14 +1028,14 @@
if
unreachable
end
i32.const 216
i32.const 264
local.set $3
i32.const 216
i32.const 264
global.set $~lib/allocator/tlsf/ROOT
i32.const 2912
i32.const 0
i32.store
i32.const 216
i32.const 264
i32.const 0
i32.store
i32.const 0
@ -1039,7 +1045,7 @@
i32.const 22
i32.lt_u
if
i32.const 216
i32.const 264
local.get $0
i32.const 0
call $~lib/allocator/tlsf/Root#setSLMap
@ -1050,7 +1056,7 @@
i32.const 32
i32.lt_u
if
i32.const 216
i32.const 264
local.get $0
local.get $1
i32.const 0
@ -1069,8 +1075,8 @@
br $repeat|0
end
end
i32.const 216
i32.const 3136
i32.const 264
i32.const 3184
current_memory
i32.const 16
i32.shl
@ -1140,7 +1146,7 @@
i32.eqz
if
i32.const 0
i32.const 16
i32.const 24
i32.const 467
i32.const 12
call $~lib/env/abort
@ -1155,7 +1161,7 @@
i32.lt_u
if
i32.const 0
i32.const 16
i32.const 24
i32.const 470
i32.const 2
call $~lib/env/abort
@ -1166,7 +1172,7 @@
local.get $2
call $~lib/allocator/tlsf/Root#use
)
(func $~lib/runtime/ALLOCATE (; 17 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(func $~lib/runtime/doAllocate (; 17 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
i32.const 1
i32.const 32
@ -2094,94 +2100,91 @@
(local $3 i32)
(local $4 i32)
block $~lib/util/memory/memmove|inlined.0
local.get $2
local.set $3
local.get $1
local.get $0
local.tee $2
local.get $1
i32.eq
br_if $~lib/util/memory/memmove|inlined.0
local.get $1
local.get $3
i32.add
local.get $2
i32.add
local.get $0
i32.le_u
local.tee $0
local.tee $3
i32.eqz
if
local.get $0
local.get $2
local.get $3
i32.add
local.get $1
i32.le_u
local.set $0
local.set $3
end
local.get $0
local.get $3
if
local.get $2
local.get $0
local.get $1
local.get $3
local.get $2
call $~lib/util/memory/memcpy
br $~lib/util/memory/memmove|inlined.0
end
local.get $2
local.get $0
local.get $1
i32.lt_u
if
local.get $1
i32.const 7
i32.and
local.get $2
local.get $0
i32.const 7
i32.and
i32.eq
if
loop $continue|0
local.get $2
local.get $0
i32.const 7
i32.and
if
local.get $3
local.get $2
i32.eqz
br_if $~lib/util/memory/memmove|inlined.0
local.get $3
local.get $2
i32.const 1
i32.sub
local.set $3
local.get $2
local.set $2
local.get $0
local.tee $4
i32.const 1
i32.add
local.set $2
local.set $0
local.get $1
local.tee $0
local.tee $3
i32.const 1
i32.add
local.set $1
local.get $4
local.get $0
local.get $3
i32.load8_u
i32.store8
br $continue|0
end
end
loop $continue|1
local.get $3
local.get $2
i32.const 8
i32.ge_u
if
local.get $2
local.get $0
local.get $1
i64.load
i64.store
local.get $3
i32.const 8
i32.sub
local.set $3
local.get $2
i32.const 8
i32.add
i32.sub
local.set $2
local.get $0
i32.const 8
i32.add
local.set $0
local.get $1
i32.const 8
i32.add
@ -2191,26 +2194,26 @@
end
end
loop $continue|2
local.get $3
local.get $2
if
local.get $2
local.get $0
local.tee $4
i32.const 1
i32.add
local.set $2
local.set $0
local.get $1
local.tee $0
local.tee $3
i32.const 1
i32.add
local.set $1
local.get $4
local.get $0
local.get $3
i32.load8_u
i32.store8
local.get $3
local.get $2
i32.const 1
i32.sub
local.set $3
local.set $2
br $continue|2
end
end
@ -2218,29 +2221,29 @@
local.get $1
i32.const 7
i32.and
local.get $2
local.get $0
i32.const 7
i32.and
i32.eq
if
loop $continue|3
local.get $0
local.get $2
local.get $3
i32.add
i32.const 7
i32.and
if
local.get $3
local.get $2
i32.eqz
br_if $~lib/util/memory/memmove|inlined.0
local.get $3
local.get $2
i32.const 1
i32.sub
local.tee $3
local.get $2
local.tee $2
local.get $0
i32.add
local.get $1
local.get $3
local.get $2
i32.add
i32.load8_u
i32.store8
@ -2248,18 +2251,18 @@
end
end
loop $continue|4
local.get $3
local.get $2
i32.const 8
i32.ge_u
if
local.get $3
local.get $2
i32.const 8
i32.sub
local.tee $3
local.get $2
local.tee $2
local.get $0
i32.add
local.get $1
local.get $3
local.get $2
i32.add
i64.load
i64.store
@ -2268,16 +2271,16 @@
end
end
loop $continue|5
local.get $3
local.get $2
if
local.get $3
local.get $2
i32.const 1
i32.sub
local.tee $3
local.get $2
local.tee $2
local.get $0
i32.add
local.get $1
local.get $3
local.get $2
i32.add
i32.load8_u
i32.store8
@ -2517,7 +2520,7 @@
i32.and
if
i32.const 0
i32.const 16
i32.const 24
i32.const 483
i32.const 6
call $~lib/env/abort
@ -2536,7 +2539,7 @@
end
end
)
(func $~lib/runtime/REALLOCATE (; 22 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(func $~lib/runtime/doReallocate (; 22 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(local $3 i32)
(local $4 i32)
@ -2560,7 +2563,7 @@
i32.shl
i32.const 0
local.get $0
i32.const 216
i32.const 264
i32.gt_u
select
i32.const 1
@ -2606,12 +2609,12 @@
i32.eq
if
local.get $0
i32.const 216
i32.const 264
i32.le_u
if
i32.const 0
i32.const 184
i32.const 92
i32.const 232
i32.const 100
i32.const 8
call $~lib/env/abort
unreachable
@ -2641,14 +2644,14 @@
i32.store offset=4
local.get $0
)
(func $~lib/runtime/ASSERT_UNREGISTERED (; 23 ;) (type $FUNCSIG$vi) (param $0 i32)
(func $~lib/runtime/assertUnregistered (; 23 ;) (type $FUNCSIG$vi) (param $0 i32)
local.get $0
i32.const 216
i32.const 264
i32.le_u
if
i32.const 0
i32.const 184
i32.const 145
i32.const 232
i32.const 188
i32.const 2
call $~lib/env/abort
unreachable
@ -2661,8 +2664,8 @@
i32.ne
if
i32.const 0
i32.const 184
i32.const 146
i32.const 232
i32.const 189
i32.const 2
call $~lib/env/abort
unreachable
@ -2673,41 +2676,41 @@
(local $1 i32)
(local $2 i32)
loop $repeat|0
local.get $0
local.get $1
i32.const 9000
i32.lt_s
if
i32.const 1
i32.const 32
local.get $0
local.get $1
i32.const 15
i32.add
i32.clz
i32.sub
i32.shl
local.tee $1
local.tee $2
i32.const 0
i32.ne
local.tee $2
if (result i32)
local.get $1
local.tee $0
if
local.get $2
i32.const 1
i32.sub
local.get $1
local.get $2
i32.and
i32.eqz
else
local.get $2
local.set $0
end
local.get $0
if
local.get $0
local.get $1
i32.const 1
i32.add
local.set $0
local.set $1
br $repeat|0
else
i32.const 0
i32.const 72
i32.const 88
i32.const 31
i32.const 2
call $~lib/env/abort
@ -2726,6 +2729,7 @@
i32.const 1
i32.const 32
global.get $std/runtime/barrier2
local.tee $0
i32.const 16
i32.add
i32.clz
@ -2733,7 +2737,7 @@
i32.shl
i32.const 1
i32.const 32
global.get $std/runtime/barrier2
local.get $0
i32.const 15
i32.add
i32.clz
@ -2756,6 +2760,7 @@
i32.const 1
i32.const 32
global.get $std/runtime/barrier3
local.tee $0
i32.const 16
i32.add
i32.clz
@ -2763,7 +2768,7 @@
i32.shl
i32.const 1
i32.const 32
global.get $std/runtime/barrier3
local.get $0
i32.const 15
i32.add
i32.clz
@ -2778,7 +2783,7 @@
br $continue|2
end
end
i32.const 112
i32.const 136
i32.const 1
global.get $std/runtime/barrier1
f64.convert_i32_u
@ -2787,7 +2792,7 @@
f64.const 0
f64.const 0
call $~lib/env/trace
i32.const 136
i32.const 168
i32.const 1
global.get $std/runtime/barrier2
f64.convert_i32_u
@ -2796,7 +2801,7 @@
f64.const 0
f64.const 0
call $~lib/env/trace
i32.const 160
i32.const 200
i32.const 1
global.get $std/runtime/barrier3
f64.convert_i32_u
@ -2806,7 +2811,7 @@
f64.const 0
call $~lib/env/trace
i32.const 1
call $~lib/runtime/ALLOCATE
call $~lib/runtime/doAllocate
global.set $std/runtime/ref1
global.get $std/runtime/ref1
i32.const 16
@ -2818,7 +2823,7 @@
i32.ne
if
i32.const 0
i32.const 72
i32.const 88
i32.const 46
i32.const 0
call $~lib/env/abort
@ -2830,21 +2835,23 @@
i32.ne
if
i32.const 0
i32.const 72
i32.const 88
i32.const 47
i32.const 0
call $~lib/env/abort
unreachable
end
global.get $std/runtime/ref1
local.tee $0
local.get $0
local.tee $1
global.get $std/runtime/barrier1
call $~lib/runtime/REALLOCATE
call $~lib/runtime/doReallocate
local.set $2
local.get $1
local.get $2
i32.ne
if
i32.const 0
i32.const 72
i32.const 88
i32.const 48
i32.const 0
call $~lib/env/abort
@ -2856,7 +2863,7 @@
i32.ne
if
i32.const 0
i32.const 72
i32.const 88
i32.const 49
i32.const 0
call $~lib/env/abort
@ -2864,14 +2871,14 @@
end
global.get $std/runtime/ref1
global.get $std/runtime/barrier2
call $~lib/runtime/REALLOCATE
call $~lib/runtime/doReallocate
global.set $std/runtime/ref2
global.get $std/runtime/ref1
global.get $std/runtime/ref2
i32.eq
if
i32.const 0
i32.const 72
i32.const 88
i32.const 51
i32.const 0
call $~lib/env/abort
@ -2887,39 +2894,39 @@
i32.ne
if
i32.const 0
i32.const 72
i32.const 88
i32.const 53
i32.const 0
call $~lib/env/abort
unreachable
end
global.get $std/runtime/ref2
local.tee $0
call $~lib/runtime/ASSERT_UNREGISTERED
local.get $0
local.tee $1
call $~lib/runtime/assertUnregistered
local.get $1
i32.const 16
i32.sub
call $~lib/memory/memory.free
global.get $std/runtime/barrier2
call $~lib/runtime/ALLOCATE
call $~lib/runtime/doAllocate
global.set $std/runtime/ref3
global.get $std/runtime/ref1
global.get $std/runtime/ref3
i32.ne
if
i32.const 0
i32.const 72
i32.const 88
i32.const 56
i32.const 0
call $~lib/env/abort
unreachable
end
global.get $std/runtime/barrier1
call $~lib/runtime/ALLOCATE
call $~lib/runtime/doAllocate
global.set $std/runtime/ref4
global.get $std/runtime/ref4
local.tee $0
call $~lib/runtime/ASSERT_UNREGISTERED
call $~lib/runtime/assertUnregistered
local.get $0
i32.const 16
i32.sub
@ -2932,7 +2939,7 @@
i32.ne
if
i32.const 0
i32.const 72
i32.const 88
i32.const 60
i32.const 0
call $~lib/env/abort
@ -2948,7 +2955,7 @@
i32.ne
if
i32.const 0
i32.const 72
i32.const 88
i32.const 62
i32.const 0
call $~lib/env/abort
@ -2960,14 +2967,14 @@
i32.ne
if
i32.const 0
i32.const 72
i32.const 88
i32.const 63
i32.const 0
call $~lib/env/abort
unreachable
end
i32.const 10
call $~lib/runtime/ALLOCATE
call $~lib/runtime/doAllocate
global.set $std/runtime/ref5
global.get $std/runtime/ref5
i32.const 16
@ -2977,7 +2984,7 @@
i32.ne
if
i32.const 0
i32.const 72
i32.const 88
i32.const 66
i32.const 0
call $~lib/env/abort
@ -2993,7 +3000,7 @@
i32.ne
if
i32.const 0
i32.const 72
i32.const 88
i32.const 67
i32.const 0
call $~lib/env/abort

View File

@ -1,5 +1,5 @@
import "allocator/tlsf";
import { CLASSID, ADJUST, ALLOCATE, REALLOCATE, REGISTER, DISCARD, HEADER, HEADER_SIZE, HEADER_MAGIC } from "runtime";
import { CLASSID, ADJUSTOBLOCK, ALLOCATE, REALLOCATE, REGISTER, DISCARD, HEADER, HEADER_SIZE, HEADER_MAGIC } from "runtime";
var register_ref: usize = 0;
@ -26,16 +26,16 @@ function isPowerOf2(x: i32): bool {
return x != 0 && (x & (x - 1)) == 0;
}
assert(ADJUST(0) > 0);
assert(ADJUSTOBLOCK(0) > 0);
for (let i = 0; i < 9000; ++i) {
assert(isPowerOf2(ADJUST(i)));
assert(isPowerOf2(ADJUSTOBLOCK(i)));
}
var barrier1 = ADJUST(0);
var barrier1 = ADJUSTOBLOCK(0);
var barrier2 = barrier1 + 1;
while (ADJUST(barrier2 + 1) == ADJUST(barrier2)) ++barrier2;
while (ADJUSTOBLOCK(barrier2 + 1) == ADJUSTOBLOCK(barrier2)) ++barrier2;
var barrier3 = barrier2 + 1;
while (ADJUST(barrier3 + 1) == ADJUST(barrier3)) ++barrier3;
while (ADJUSTOBLOCK(barrier3 + 1) == ADJUSTOBLOCK(barrier3)) ++barrier3;
trace("barrier1", 1, barrier1);
trace("barrier2", 1, barrier2);

File diff suppressed because it is too large Load Diff

View File

@ -37,7 +37,7 @@
(export "memory" (memory $0))
(export "table" (table $0))
(start $start)
(func $~lib/runtime/adjustToBlock (; 1 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(func $~lib/runtime/ADJUSTOBLOCK (; 1 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
i32.const 1
i32.const 32
local.get $0
@ -137,7 +137,7 @@
(func $~lib/runtime/doAllocate (; 3 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
local.get $0
call $~lib/runtime/adjustToBlock
call $~lib/runtime/ADJUSTOBLOCK
call $~lib/memory/memory.allocate
local.set $1
local.get $1
@ -196,261 +196,252 @@
(func $~lib/memory/memory.fill (; 7 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32)
(local $3 i32)
(local $4 i32)
(local $5 i32)
(local $6 i32)
(local $7 i32)
(local $8 i64)
(local $5 i64)
block $~lib/util/memory/memset|inlined.0
local.get $0
local.set $3
local.get $1
local.set $4
local.get $2
local.set $5
local.get $5
i32.eqz
if
br $~lib/util/memory/memset|inlined.0
end
local.get $3
local.get $4
local.get $0
local.get $1
i32.store8
local.get $3
local.get $5
local.get $0
local.get $2
i32.add
i32.const 1
i32.sub
local.get $4
local.get $1
i32.store8
local.get $5
local.get $2
i32.const 2
i32.le_u
if
br $~lib/util/memory/memset|inlined.0
end
local.get $3
local.get $0
i32.const 1
i32.add
local.get $4
local.get $1
i32.store8
local.get $3
local.get $0
i32.const 2
i32.add
local.get $4
local.get $1
i32.store8
local.get $3
local.get $5
local.get $0
local.get $2
i32.add
i32.const 2
i32.sub
local.get $4
local.get $1
i32.store8
local.get $3
local.get $5
local.get $0
local.get $2
i32.add
i32.const 3
i32.sub
local.get $4
local.get $1
i32.store8
local.get $5
local.get $2
i32.const 6
i32.le_u
if
br $~lib/util/memory/memset|inlined.0
end
local.get $3
local.get $0
i32.const 3
i32.add
local.get $4
local.get $1
i32.store8
local.get $3
local.get $5
local.get $0
local.get $2
i32.add
i32.const 4
i32.sub
local.get $4
local.get $1
i32.store8
local.get $5
local.get $2
i32.const 8
i32.le_u
if
br $~lib/util/memory/memset|inlined.0
end
i32.const 0
local.get $3
local.get $0
i32.sub
i32.const 3
i32.and
local.set $6
local.get $3
local.get $6
i32.add
local.set $3
local.get $5
local.get $6
local.get $0
local.get $3
i32.add
local.set $0
local.get $2
local.get $3
i32.sub
local.set $5
local.get $5
local.set $2
local.get $2
i32.const -4
i32.and
local.set $5
local.set $2
i32.const -1
i32.const 255
i32.div_u
local.get $4
local.get $1
i32.const 255
i32.and
i32.mul
local.set $7
local.get $3
local.get $7
local.set $4
local.get $0
local.get $4
i32.store
local.get $3
local.get $5
local.get $0
local.get $2
i32.add
i32.const 4
i32.sub
local.get $7
local.get $4
i32.store
local.get $5
local.get $2
i32.const 8
i32.le_u
if
br $~lib/util/memory/memset|inlined.0
end
local.get $3
local.get $0
i32.const 4
i32.add
local.get $7
local.get $4
i32.store
local.get $3
local.get $0
i32.const 8
i32.add
local.get $7
local.get $4
i32.store
local.get $3
local.get $5
local.get $0
local.get $2
i32.add
i32.const 12
i32.sub
local.get $7
local.get $4
i32.store
local.get $3
local.get $5
local.get $0
local.get $2
i32.add
i32.const 8
i32.sub
local.get $7
local.get $4
i32.store
local.get $5
local.get $2
i32.const 24
i32.le_u
if
br $~lib/util/memory/memset|inlined.0
end
local.get $3
local.get $0
i32.const 12
i32.add
local.get $7
local.get $4
i32.store
local.get $3
local.get $0
i32.const 16
i32.add
local.get $7
local.get $4
i32.store
local.get $3
local.get $0
i32.const 20
i32.add
local.get $7
local.get $4
i32.store
local.get $3
local.get $0
i32.const 24
i32.add
local.get $7
local.get $4
i32.store
local.get $3
local.get $5
local.get $0
local.get $2
i32.add
i32.const 28
i32.sub
local.get $7
local.get $4
i32.store
local.get $3
local.get $5
local.get $0
local.get $2
i32.add
i32.const 24
i32.sub
local.get $7
local.get $4
i32.store
local.get $3
local.get $5
local.get $0
local.get $2
i32.add
i32.const 20
i32.sub
local.get $7
local.get $4
i32.store
local.get $3
local.get $5
local.get $0
local.get $2
i32.add
i32.const 16
i32.sub
local.get $7
local.get $4
i32.store
i32.const 24
local.get $3
local.get $0
i32.const 4
i32.and
i32.add
local.set $6
local.get $3
local.get $6
i32.add
local.set $3
local.get $5
local.get $6
local.get $0
local.get $3
i32.add
local.set $0
local.get $2
local.get $3
i32.sub
local.set $5
local.get $7
local.set $2
local.get $4
i64.extend_i32_u
local.get $7
local.get $4
i64.extend_i32_u
i64.const 32
i64.shl
i64.or
local.set $8
local.set $5
block $break|0
loop $continue|0
local.get $5
local.get $2
i32.const 32
i32.ge_u
if
block
local.get $3
local.get $8
local.get $0
local.get $5
i64.store
local.get $3
local.get $0
i32.const 8
i32.add
local.get $8
local.get $5
i64.store
local.get $3
local.get $0
i32.const 16
i32.add
local.get $8
local.get $5
i64.store
local.get $3
local.get $0
i32.const 24
i32.add
local.get $8
i64.store
local.get $5
i64.store
local.get $2
i32.const 32
i32.sub
local.set $5
local.get $3
local.set $2
local.get $0
i32.const 32
i32.add
local.set $3
local.set $0
end
br $continue|0
end

View File

@ -1571,94 +1571,91 @@
(local $3 i32)
(local $4 i32)
block $~lib/util/memory/memmove|inlined.0
local.get $2
local.set $3
local.get $1
local.get $0
local.tee $2
local.get $1
i32.eq
br_if $~lib/util/memory/memmove|inlined.0
local.get $1
local.get $3
i32.add
local.get $2
i32.add
local.get $0
i32.le_u
local.tee $0
local.tee $3
i32.eqz
if
local.get $0
local.get $2
local.get $3
i32.add
local.get $1
i32.le_u
local.set $0
local.set $3
end
local.get $0
local.get $3
if
local.get $2
local.get $0
local.get $1
local.get $3
local.get $2
call $~lib/util/memory/memcpy
br $~lib/util/memory/memmove|inlined.0
end
local.get $2
local.get $0
local.get $1
i32.lt_u
if
local.get $1
i32.const 7
i32.and
local.get $2
local.get $0
i32.const 7
i32.and
i32.eq
if
loop $continue|0
local.get $2
local.get $0
i32.const 7
i32.and
if
local.get $3
local.get $2
i32.eqz
br_if $~lib/util/memory/memmove|inlined.0
local.get $3
local.get $2
i32.const 1
i32.sub
local.set $3
local.get $2
local.set $2
local.get $0
local.tee $4
i32.const 1
i32.add
local.set $2
local.set $0
local.get $1
local.tee $0
local.tee $3
i32.const 1
i32.add
local.set $1
local.get $4
local.get $0
local.get $3
i32.load8_u
i32.store8
br $continue|0
end
end
loop $continue|1
local.get $3
local.get $2
i32.const 8
i32.ge_u
if
local.get $2
local.get $0
local.get $1
i64.load
i64.store
local.get $3
i32.const 8
i32.sub
local.set $3
local.get $2
i32.const 8
i32.add
i32.sub
local.set $2
local.get $0
i32.const 8
i32.add
local.set $0
local.get $1
i32.const 8
i32.add
@ -1668,26 +1665,26 @@
end
end
loop $continue|2
local.get $3
local.get $2
if
local.get $2
local.get $0
local.tee $4
i32.const 1
i32.add
local.set $2
local.set $0
local.get $1
local.tee $0
local.tee $3
i32.const 1
i32.add
local.set $1
local.get $4
local.get $0
local.get $3
i32.load8_u
i32.store8
local.get $3
local.get $2
i32.const 1
i32.sub
local.set $3
local.set $2
br $continue|2
end
end
@ -1695,29 +1692,29 @@
local.get $1
i32.const 7
i32.and
local.get $2
local.get $0
i32.const 7
i32.and
i32.eq
if
loop $continue|3
local.get $0
local.get $2
local.get $3
i32.add
i32.const 7
i32.and
if
local.get $3
local.get $2
i32.eqz
br_if $~lib/util/memory/memmove|inlined.0
local.get $3
local.get $2
i32.const 1
i32.sub
local.tee $3
local.get $2
local.tee $2
local.get $0
i32.add
local.get $1
local.get $3
local.get $2
i32.add
i32.load8_u
i32.store8
@ -1725,18 +1722,18 @@
end
end
loop $continue|4
local.get $3
local.get $2
i32.const 8
i32.ge_u
if
local.get $3
local.get $2
i32.const 8
i32.sub
local.tee $3
local.get $2
local.tee $2
local.get $0
i32.add
local.get $1
local.get $3
local.get $2
i32.add
i64.load
i64.store
@ -1745,16 +1742,16 @@
end
end
loop $continue|5
local.get $3
local.get $2
if
local.get $3
local.get $2
i32.const 1
i32.sub
local.tee $3
local.get $2
local.tee $2
local.get $0
i32.add
local.get $1
local.get $3
local.get $2
i32.add
i32.load8_u
i32.store8

View File

@ -245,7 +245,7 @@
i32.add
i32.load16_u
)
(func $~lib/runtime/adjustToBlock (; 3 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(func $~lib/runtime/ADJUSTOBLOCK (; 3 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
i32.const 1
i32.const 32
local.get $0
@ -345,7 +345,7 @@
(func $~lib/runtime/doAllocate (; 5 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
local.get $0
call $~lib/runtime/adjustToBlock
call $~lib/runtime/ADJUSTOBLOCK
call $~lib/memory/memory.allocate
local.set $1
local.get $1
@ -2014,87 +2014,78 @@
)
(func $~lib/memory/memory.copy (; 16 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32)
(local $3 i32)
(local $4 i32)
(local $5 i32)
(local $6 i32)
block $~lib/util/memory/memmove|inlined.0
local.get $0
local.set $3
local.get $1
local.set $4
local.get $2
local.set $5
local.get $3
local.get $4
i32.eq
if
br $~lib/util/memory/memmove|inlined.0
end
local.get $4
local.get $5
local.get $1
local.get $2
i32.add
local.get $3
local.get $0
i32.le_u
local.tee $6
local.tee $3
if (result i32)
local.get $6
else
local.get $3
local.get $5
else
local.get $0
local.get $2
i32.add
local.get $4
local.get $1
i32.le_u
end
if
local.get $3
local.get $4
local.get $5
local.get $0
local.get $1
local.get $2
call $~lib/util/memory/memcpy
br $~lib/util/memory/memmove|inlined.0
end
local.get $3
local.get $4
local.get $0
local.get $1
i32.lt_u
if
local.get $4
local.get $1
i32.const 7
i32.and
local.get $3
local.get $0
i32.const 7
i32.and
i32.eq
if
block $break|0
loop $continue|0
local.get $3
local.get $0
i32.const 7
i32.and
if
block
local.get $5
local.get $2
i32.eqz
if
br $~lib/util/memory/memmove|inlined.0
end
local.get $5
local.get $2
i32.const 1
i32.sub
local.set $5
local.set $2
block (result i32)
local.get $3
local.tee $6
local.get $0
local.tee $3
i32.const 1
i32.add
local.set $3
local.get $6
local.set $0
local.get $3
end
block (result i32)
local.get $4
local.tee $6
local.get $1
local.tee $3
i32.const 1
i32.add
local.set $4
local.get $6
local.set $1
local.get $3
end
i32.load8_u
i32.store8
@ -2105,27 +2096,27 @@
end
block $break|1
loop $continue|1
local.get $5
local.get $2
i32.const 8
i32.ge_u
if
block
local.get $3
local.get $4
local.get $0
local.get $1
i64.load
i64.store
local.get $5
local.get $2
i32.const 8
i32.sub
local.set $5
local.get $3
local.set $2
local.get $0
i32.const 8
i32.add
local.set $3
local.get $4
local.set $0
local.get $1
i32.const 8
i32.add
local.set $4
local.set $1
end
br $continue|1
end
@ -2134,67 +2125,67 @@
end
block $break|2
loop $continue|2
local.get $5
local.get $2
if
block
block (result i32)
local.get $3
local.tee $6
local.get $0
local.tee $3
i32.const 1
i32.add
local.set $3
local.get $6
local.set $0
local.get $3
end
block (result i32)
local.get $4
local.tee $6
local.get $1
local.tee $3
i32.const 1
i32.add
local.set $4
local.get $6
local.set $1
local.get $3
end
i32.load8_u
i32.store8
local.get $5
local.get $2
i32.const 1
i32.sub
local.set $5
local.set $2
end
br $continue|2
end
end
end
else
local.get $4
local.get $1
i32.const 7
i32.and
local.get $3
local.get $0
i32.const 7
i32.and
i32.eq
if
block $break|3
loop $continue|3
local.get $3
local.get $5
local.get $0
local.get $2
i32.add
i32.const 7
i32.and
if
block
local.get $5
local.get $2
i32.eqz
if
br $~lib/util/memory/memmove|inlined.0
end
local.get $3
local.get $5
local.get $0
local.get $2
i32.const 1
i32.sub
local.tee $5
local.tee $2
i32.add
local.get $4
local.get $5
local.get $1
local.get $2
i32.add
i32.load8_u
i32.store8
@ -2205,20 +2196,20 @@
end
block $break|4
loop $continue|4
local.get $5
local.get $2
i32.const 8
i32.ge_u
if
block
local.get $5
local.get $2
i32.const 8
i32.sub
local.set $5
local.get $3
local.get $5
local.set $2
local.get $0
local.get $2
i32.add
local.get $4
local.get $5
local.get $1
local.get $2
i32.add
i64.load
i64.store
@ -2230,16 +2221,16 @@
end
block $break|5
loop $continue|5
local.get $5
local.get $2
if
local.get $3
local.get $5
local.get $0
local.get $2
i32.const 1
i32.sub
local.tee $5
local.tee $2
i32.add
local.get $4
local.get $5
local.get $1
local.get $2
i32.add
i32.load8_u
i32.store8
@ -3515,261 +3506,252 @@
(func $~lib/memory/memory.fill (; 33 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32)
(local $3 i32)
(local $4 i32)
(local $5 i32)
(local $6 i32)
(local $7 i32)
(local $8 i64)
(local $5 i64)
block $~lib/util/memory/memset|inlined.0
local.get $0
local.set $3
local.get $1
local.set $4
local.get $2
local.set $5
local.get $5
i32.eqz
if
br $~lib/util/memory/memset|inlined.0
end
local.get $3
local.get $4
local.get $0
local.get $1
i32.store8
local.get $3
local.get $5
local.get $0
local.get $2
i32.add
i32.const 1
i32.sub
local.get $4
local.get $1
i32.store8
local.get $5
local.get $2
i32.const 2
i32.le_u
if
br $~lib/util/memory/memset|inlined.0
end
local.get $3
local.get $0
i32.const 1
i32.add
local.get $4
local.get $1
i32.store8
local.get $3
local.get $0
i32.const 2
i32.add
local.get $4
local.get $1
i32.store8
local.get $3
local.get $5
local.get $0
local.get $2
i32.add
i32.const 2
i32.sub
local.get $4
local.get $1
i32.store8
local.get $3
local.get $5
local.get $0
local.get $2
i32.add
i32.const 3
i32.sub
local.get $4
local.get $1
i32.store8
local.get $5
local.get $2
i32.const 6
i32.le_u
if
br $~lib/util/memory/memset|inlined.0
end
local.get $3
local.get $0
i32.const 3
i32.add
local.get $4
local.get $1
i32.store8
local.get $3
local.get $5
local.get $0
local.get $2
i32.add
i32.const 4
i32.sub
local.get $4
local.get $1
i32.store8
local.get $5
local.get $2
i32.const 8
i32.le_u
if
br $~lib/util/memory/memset|inlined.0
end
i32.const 0
local.get $3
local.get $0
i32.sub
i32.const 3
i32.and
local.set $6
local.get $3
local.get $6
i32.add
local.set $3
local.get $5
local.get $6
local.get $0
local.get $3
i32.add
local.set $0
local.get $2
local.get $3
i32.sub
local.set $5
local.get $5
local.set $2
local.get $2
i32.const -4
i32.and
local.set $5
local.set $2
i32.const -1
i32.const 255
i32.div_u
local.get $4
local.get $1
i32.const 255
i32.and
i32.mul
local.set $7
local.get $3
local.get $7
local.set $4
local.get $0
local.get $4
i32.store
local.get $3
local.get $5
local.get $0
local.get $2
i32.add
i32.const 4
i32.sub
local.get $7
local.get $4
i32.store
local.get $5
local.get $2
i32.const 8
i32.le_u
if
br $~lib/util/memory/memset|inlined.0
end
local.get $3
local.get $0
i32.const 4
i32.add
local.get $7
local.get $4
i32.store
local.get $3
local.get $0
i32.const 8
i32.add
local.get $7
local.get $4
i32.store
local.get $3
local.get $5
local.get $0
local.get $2
i32.add
i32.const 12
i32.sub
local.get $7
local.get $4
i32.store
local.get $3
local.get $5
local.get $0
local.get $2
i32.add
i32.const 8
i32.sub
local.get $7
local.get $4
i32.store
local.get $5
local.get $2
i32.const 24
i32.le_u
if
br $~lib/util/memory/memset|inlined.0
end
local.get $3
local.get $0
i32.const 12
i32.add
local.get $7
local.get $4
i32.store
local.get $3
local.get $0
i32.const 16
i32.add
local.get $7
local.get $4
i32.store
local.get $3
local.get $0
i32.const 20
i32.add
local.get $7
local.get $4
i32.store
local.get $3
local.get $0
i32.const 24
i32.add
local.get $7
local.get $4
i32.store
local.get $3
local.get $5
local.get $0
local.get $2
i32.add
i32.const 28
i32.sub
local.get $7
local.get $4
i32.store
local.get $3
local.get $5
local.get $0
local.get $2
i32.add
i32.const 24
i32.sub
local.get $7
local.get $4
i32.store
local.get $3
local.get $5
local.get $0
local.get $2
i32.add
i32.const 20
i32.sub
local.get $7
local.get $4
i32.store
local.get $3
local.get $5
local.get $0
local.get $2
i32.add
i32.const 16
i32.sub
local.get $7
local.get $4
i32.store
i32.const 24
local.get $3
local.get $0
i32.const 4
i32.and
i32.add
local.set $6
local.get $3
local.get $6
i32.add
local.set $3
local.get $5
local.get $6
local.get $0
local.get $3
i32.add
local.set $0
local.get $2
local.get $3
i32.sub
local.set $5
local.get $7
local.set $2
local.get $4
i64.extend_i32_u
local.get $7
local.get $4
i64.extend_i32_u
i64.const 32
i64.shl
i64.or
local.set $8
local.set $5
block $break|0
loop $continue|0
local.get $5
local.get $2
i32.const 32
i32.ge_u
if
block
local.get $3
local.get $8
local.get $0
local.get $5
i64.store
local.get $3
local.get $0
i32.const 8
i32.add
local.get $8
local.get $5
i64.store
local.get $3
local.get $0
i32.const 16
i32.add
local.get $8
local.get $5
i64.store
local.get $3
local.get $0
i32.const 24
i32.add
local.get $8
i64.store
local.get $5
i64.store
local.get $2
i32.const 32
i32.sub
local.set $5
local.get $3
local.set $2
local.get $0
i32.const 32
i32.add
local.set $3
local.set $0
end
br $continue|0
end
@ -3928,10 +3910,10 @@
i32.lt_u
if
local.get $1
call $~lib/runtime/adjustToBlock
call $~lib/runtime/ADJUSTOBLOCK
local.set $4
local.get $3
call $~lib/runtime/adjustToBlock
call $~lib/runtime/ADJUSTOBLOCK
i32.const 0
local.get $0
global.get $~lib/memory/HEAP_BASE

View File

@ -2717,94 +2717,91 @@
(local $3 i32)
(local $4 i32)
block $~lib/util/memory/memmove|inlined.0
local.get $2
local.set $3
local.get $1
local.get $0
local.tee $2
local.get $1
i32.eq
br_if $~lib/util/memory/memmove|inlined.0
local.get $1
local.get $3
i32.add
local.get $2
i32.add
local.get $0
i32.le_u
local.tee $0
local.tee $3
i32.eqz
if
local.get $0
local.get $2
local.get $3
i32.add
local.get $1
i32.le_u
local.set $0
local.set $3
end
local.get $0
local.get $3
if
local.get $2
local.get $0
local.get $1
local.get $3
local.get $2
call $~lib/util/memory/memcpy
br $~lib/util/memory/memmove|inlined.0
end
local.get $2
local.get $0
local.get $1
i32.lt_u
if
local.get $1
i32.const 7
i32.and
local.get $2
local.get $0
i32.const 7
i32.and
i32.eq
if
loop $continue|0
local.get $2
local.get $0
i32.const 7
i32.and
if
local.get $3
local.get $2
i32.eqz
br_if $~lib/util/memory/memmove|inlined.0
local.get $3
local.get $2
i32.const 1
i32.sub
local.set $3
local.get $2
local.set $2
local.get $0
local.tee $4
i32.const 1
i32.add
local.set $2
local.set $0
local.get $1
local.tee $0
local.tee $3
i32.const 1
i32.add
local.set $1
local.get $4
local.get $0
local.get $3
i32.load8_u
i32.store8
br $continue|0
end
end
loop $continue|1
local.get $3
local.get $2
i32.const 8
i32.ge_u
if
local.get $2
local.get $0
local.get $1
i64.load
i64.store
local.get $3
i32.const 8
i32.sub
local.set $3
local.get $2
i32.const 8
i32.add
i32.sub
local.set $2
local.get $0
i32.const 8
i32.add
local.set $0
local.get $1
i32.const 8
i32.add
@ -2814,26 +2811,26 @@
end
end
loop $continue|2
local.get $3
local.get $2
if
local.get $2
local.get $0
local.tee $4
i32.const 1
i32.add
local.set $2
local.set $0
local.get $1
local.tee $0
local.tee $3
i32.const 1
i32.add
local.set $1
local.get $4
local.get $0
local.get $3
i32.load8_u
i32.store8
local.get $3
local.get $2
i32.const 1
i32.sub
local.set $3
local.set $2
br $continue|2
end
end
@ -2841,29 +2838,29 @@
local.get $1
i32.const 7
i32.and
local.get $2
local.get $0
i32.const 7
i32.and
i32.eq
if
loop $continue|3
local.get $0
local.get $2
local.get $3
i32.add
i32.const 7
i32.and
if
local.get $3
local.get $2
i32.eqz
br_if $~lib/util/memory/memmove|inlined.0
local.get $3
local.get $2
i32.const 1
i32.sub
local.tee $3
local.get $2
local.tee $2
local.get $0
i32.add
local.get $1
local.get $3
local.get $2
i32.add
i32.load8_u
i32.store8
@ -2871,18 +2868,18 @@
end
end
loop $continue|4
local.get $3
local.get $2
i32.const 8
i32.ge_u
if
local.get $3
local.get $2
i32.const 8
i32.sub
local.tee $3
local.get $2
local.tee $2
local.get $0
i32.add
local.get $1
local.get $3
local.get $2
i32.add
i64.load
i64.store
@ -2891,16 +2888,16 @@
end
end
loop $continue|5
local.get $3
local.get $2
if
local.get $3
local.get $2
i32.const 1
i32.sub
local.tee $3
local.get $2
local.tee $2
local.get $0
i32.add
local.get $1
local.get $3
local.get $2
i32.add
i32.load8_u
i32.store8

File diff suppressed because it is too large Load Diff