Rework constructor handling (#446)

This commit is contained in:
Daniel Wirtz 2019-02-02 16:03:21 +01:00 committed by GitHub
parent 75328f3feb
commit 2131c51932
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 3308 additions and 2809 deletions

View File

@ -2933,58 +2933,6 @@ function evaluateConstantOffset(compiler: Compiler, expression: Expression): i32
return value;
}
/** Compiles a memory allocation for an instance of the specified class. */
export function compileAllocate(
compiler: Compiler,
classInstance: Class,
reportNode: Node
): ExpressionRef {
var program = compiler.program;
assert(classInstance.program == program);
var module = compiler.module;
var options = compiler.options;
// __gc_allocate(size, markFn)
if (program.hasGC && classInstance.type.isManaged(program)) {
let allocateInstance = assert(program.gcAllocateInstance);
if (!compiler.compileFunction(allocateInstance)) return module.createUnreachable();
compiler.currentType = classInstance.type;
return module.createCall(
allocateInstance.internalName, [
options.isWasm64
? module.createI64(classInstance.currentMemoryOffset)
: module.createI32(classInstance.currentMemoryOffset),
module.createI32(
ensureGCHook(compiler, classInstance)
)
],
options.nativeSizeType
);
// memory.allocate(size)
} else {
let allocateInstance = program.memoryAllocateInstance;
if (!allocateInstance) {
program.error(
DiagnosticCode.Cannot_find_name_0,
reportNode.range, "memory.allocate"
);
return module.createUnreachable();
}
if (!compiler.compileFunction(allocateInstance)) return module.createUnreachable();
compiler.currentType = classInstance.type;
return module.createCall(
allocateInstance.internalName, [
options.isWasm64
? module.createI64(classInstance.currentMemoryOffset)
: module.createI32(classInstance.currentMemoryOffset)
],
options.nativeSizeType
);
}
}
/** Compiles an abort wired to the conditionally imported 'abort' function. */
export function compileAbort(
compiler: Compiler,

View File

@ -5,7 +5,6 @@
import {
compileCall as compileBuiltinCall,
compileAllocate,
compileAbort,
compileIterateRoots,
ensureGCHook
@ -1023,128 +1022,56 @@ export class Compiler extends DiagnosticEmitter {
return typeRef;
}
/** Compiles just the body of a function in whatever is the current context. */
private compileFunctionBody(instance: Function): ExpressionRef[] {
var declaration = instance.prototype.declaration;
var body = assert(declaration.body);
if (body.kind == NodeKind.BLOCK) {
return this.compileStatements((<BlockStatement>body).statements);
} else {
assert(body.kind == NodeKind.EXPRESSION);
assert(instance.is(CommonFlags.ARROW));
assert(!instance.isAny(CommonFlags.CONSTRUCTOR | CommonFlags.GET | CommonFlags.SET | CommonFlags.MAIN));
let returnType = instance.signature.returnType;
let flow = instance.flow;
let stmt = this.compileExpression(
(<ExpressionStatement>body).expression,
returnType,
ConversionKind.IMPLICIT,
WrapMode.NONE
);
flow.set(FlowFlags.RETURNS);
if (!flow.canOverflow(stmt, returnType)) flow.set(FlowFlags.RETURNS_WRAPPED);
return [ stmt ];
}
}
/** Compiles a readily resolved function instance. */
compileFunction(instance: Function): bool {
if (instance.is(CommonFlags.COMPILED)) return true;
assert(!(instance.is(CommonFlags.AMBIENT) && instance.hasDecorator(DecoratorFlags.BUILTIN)));
instance.set(CommonFlags.COMPILED);
// check that modifiers are matching
var module = this.module;
var signature = instance.signature;
var declaration = instance.prototype.declaration;
var body = declaration.body;
var typeRef = this.ensureFunctionType(signature.parameterTypes, signature.returnType, signature.thisType);
var funcRef: FunctionRef;
// concrete function
if (body) {
// must not be ambient
if (instance.is(CommonFlags.AMBIENT)) {
this.error(
DiagnosticCode.An_implementation_cannot_be_declared_in_ambient_contexts,
declaration.name.range
);
}
} else {
if (!instance.is(CommonFlags.AMBIENT)) {
this.error(
DiagnosticCode.Function_implementation_is_missing_or_not_immediately_following_the_declaration,
declaration.name.range
);
}
}
var ref: FunctionRef;
var signature = instance.signature;
var typeRef = this.ensureFunctionType(signature.parameterTypes, signature.returnType, signature.thisType);
var module = this.module;
if (body) {
let isConstructor = instance.is(CommonFlags.CONSTRUCTOR);
let returnType = instance.signature.returnType;
// compile body
let previousFunction = this.currentFunction;
this.currentFunction = instance;
let flow = instance.flow;
let stmt: ExpressionRef;
if (body.kind == NodeKind.EXPRESSION) { // () => expression
assert(!instance.isAny(CommonFlags.CONSTRUCTOR | CommonFlags.GET | CommonFlags.SET | CommonFlags.MAIN));
assert(instance.is(CommonFlags.ARROW));
stmt = this.compileExpression(
(<ExpressionStatement>body).expression,
returnType,
ConversionKind.IMPLICIT,
WrapMode.NONE
);
flow.set(FlowFlags.RETURNS);
if (!flow.canOverflow(stmt, returnType)) flow.set(FlowFlags.RETURNS_WRAPPED);
flow.finalize();
} else {
assert(body.kind == NodeKind.BLOCK);
let stmts = this.compileStatements((<BlockStatement>body).statements);
if (instance.is(CommonFlags.MAIN)) {
module.addGlobal("~started", NativeType.I32, true, module.createI32(0));
stmts.unshift(
module.createIf(
module.createUnary(
UnaryOp.EqzI32,
module.createGetGlobal("~started", NativeType.I32)
),
module.createBlock(null, [
module.createCall("start", null, NativeType.None),
module.createSetGlobal("~started", module.createI32(1))
])
)
);
}
flow.finalize();
if (isConstructor) {
let nativeSizeType = this.options.nativeSizeType;
assert(instance.is(CommonFlags.INSTANCE));
let parent = assert(instance.parent);
assert(parent.kind == ElementKind.CLASS);
// implicitly return `this` if the constructor doesn't always return on its own
if (!flow.is(FlowFlags.RETURNS)) {
// if all branches are guaranteed to allocate, skip the final conditional allocation
if (flow.is(FlowFlags.ALLOCATES)) {
stmts.push(module.createGetLocal(0, nativeSizeType));
// if not all branches are guaranteed to allocate, also append a conditional allocation
} else {
stmts.push(module.createTeeLocal(0,
this.makeConditionalAllocate(<Class>parent, declaration.name)
));
}
}
// check that super has been called if this is a derived class
if ((<Class>parent).base && !flow.is(FlowFlags.CALLS_SUPER)) {
this.error(
DiagnosticCode.Constructors_for_derived_classes_must_contain_a_super_call,
instance.prototype.declaration.range
);
}
// make sure all branches return
} else if (returnType != Type.void && !flow.is(FlowFlags.RETURNS)) {
this.error(
DiagnosticCode.A_function_whose_declared_type_is_not_void_must_return_a_value,
declaration.signature.returnType.range
);
}
stmt = !stmts.length
? module.createNop()
: stmts.length == 1
? stmts[0]
: module.createBlock(null, stmts, returnType.toNativeType());
}
this.currentFunction = previousFunction;
// create the function
ref = module.addFunction(
instance.internalName,
typeRef,
typesToNativeTypes(instance.additionalLocals),
stmt
);
// concrete functions cannot have an annotated external name
// cannot have an annotated external name
if (instance.hasDecorator(DecoratorFlags.EXTERNAL)) {
let decorator = assert(findDecorator(DecoratorKind.EXTERNAL, declaration.decorators));
this.error(
@ -1153,12 +1080,109 @@ export class Compiler extends DiagnosticEmitter {
);
}
// compile body in this function's context
let previousFunction = this.currentFunction;
this.currentFunction = instance;
let flow = instance.flow;
let returnType = instance.signature.returnType;
let stmts = this.compileFunctionBody(instance);
flow.finalize();
// make the main function call `start` implicitly once
if (instance.is(CommonFlags.MAIN)) {
module.addGlobal("~started", NativeType.I32, true, module.createI32(0));
stmts.unshift(
module.createIf(
module.createUnary(
UnaryOp.EqzI32,
module.createGetGlobal("~started", NativeType.I32)
),
module.createBlock(null, [
module.createCall("start", null, NativeType.None),
module.createSetGlobal("~started", module.createI32(1))
])
)
);
}
// make constructors return their instance pointer
if (instance.is(CommonFlags.CONSTRUCTOR)) {
let nativeSizeType = this.options.nativeSizeType;
assert(instance.is(CommonFlags.INSTANCE));
let classInstance = assert(instance.parent); assert(classInstance.kind == ElementKind.CLASS);
if (!flow.isAny(FlowFlags.ANY_TERMINATING)) {
// if `this` wasn't accessed before, allocate if necessary and initialize `this`
if (!flow.is(FlowFlags.ALLOCATES)) {
// {
// if (!this) this = <ALLOC>
// this.a = X
// this.b = Y
// }
stmts.push(
module.createIf(
module.createUnary(nativeSizeType == NativeType.I64 ? UnaryOp.EqzI64 : UnaryOp.EqzI32,
module.createGetLocal(0, nativeSizeType)
),
module.createSetLocal(0,
this.makeAllocation(<Class>classInstance)
)
)
);
this.makeFieldInitialization(<Class>classInstance, stmts);
}
// implicitly return `this`
stmts.push(
module.createGetLocal(0, nativeSizeType)
);
}
// check that super has been called if this is a derived class
if ((<Class>classInstance).base && !flow.is(FlowFlags.CALLS_SUPER)) {
this.error(
DiagnosticCode.Constructors_for_derived_classes_must_contain_a_super_call,
instance.prototype.declaration.range
);
}
// if this is a normal function, make sure that all branches return
} else if (returnType != Type.void && !flow.is(FlowFlags.RETURNS)) {
this.error(
DiagnosticCode.A_function_whose_declared_type_is_not_void_must_return_a_value,
declaration.signature.returnType.range
);
}
this.currentFunction = previousFunction;
// create the function
funcRef = module.addFunction(
instance.internalName,
typeRef,
typesToNativeTypes(instance.additionalLocals),
stmts.length
? stmts.length == 1
? stmts[0]
: module.createBlock(null, stmts, returnType.toNativeType())
: module.createNop()
);
// imported function
} else {
if (!instance.is(CommonFlags.AMBIENT)) {
this.error(
DiagnosticCode.Function_implementation_is_missing_or_not_immediately_following_the_declaration,
declaration.name.range
);
}
instance.set(CommonFlags.MODULE_IMPORT);
mangleImportName(instance, declaration); // TODO: check for duplicates
// create the function import
ref = module.addFunctionImport(
// create the import
funcRef = module.addFunctionImport(
instance.internalName,
mangleImportName_moduleName,
mangleImportName_elementName,
@ -1166,7 +1190,7 @@ export class Compiler extends DiagnosticEmitter {
);
}
instance.finalize(module, ref);
instance.finalize(module, funcRef);
return true;
}
@ -4675,8 +4699,7 @@ export class Compiler extends DiagnosticEmitter {
var argumentExpressions: Expression[];
var thisArg: ExpressionRef = 0;
if (operatorInstance.is(CommonFlags.INSTANCE)) {
let parent = assert(operatorInstance.parent);
assert(parent.kind == ElementKind.CLASS);
let classInstance = assert(operatorInstance.parent); assert(classInstance.kind == ElementKind.CLASS);
thisArg = leftExpr; // can reuse the previously evaluated leftExpr as the this value here
argumentExpressions = [ right ];
} else {
@ -5250,12 +5273,33 @@ export class Compiler extends DiagnosticEmitter {
return module.createUnreachable();
}
let classInstance = assert(currentFunction.parent);
assert(classInstance.kind == ElementKind.CLASS);
let expr = this.compileSuperInstantiate(<Class>classInstance, expression.arguments, expression);
this.currentType = Type.void;
let classInstance = assert(currentFunction.parent); assert(classInstance.kind == ElementKind.CLASS);
let baseClassInstance = assert((<Class>classInstance).base);
let thisLocal = assert(currentFunction.flow.getScopedLocal("this"));
let nativeSizeType = this.options.nativeSizeType;
// check that super() is called before allocation is performed (incl. in super arguments)
// {
// this = super(this || <ALLOC>, ...args)
// this.a = X
// this.b = Y
// }
let stmts: ExpressionRef[] = [
module.createSetLocal(thisLocal.index,
this.compileCallDirect(
this.ensureConstructor(baseClassInstance, expression),
expression.arguments,
expression,
module.createIf(
module.createGetLocal(thisLocal.index, nativeSizeType),
module.createGetLocal(thisLocal.index, nativeSizeType),
this.makeAllocation(<Class>classInstance)
)
)
)
];
this.makeFieldInitialization(<Class>classInstance, stmts);
// check that super had been called before accessing allocating `this`
let flow = currentFunction.flow;
if (flow.isAny(
FlowFlags.ALLOCATES |
@ -5268,9 +5312,8 @@ export class Compiler extends DiagnosticEmitter {
return module.createUnreachable();
}
flow.set(FlowFlags.ALLOCATES | FlowFlags.CALLS_SUPER);
let thisLocal = assert(this.currentFunction.flow.getScopedLocal("this"));
return module.createSetLocal(thisLocal.index, expr);
this.currentType = Type.void;
return module.createBlock(null, stmts);
}
// otherwise fall-through
}
@ -5477,8 +5520,7 @@ export class Compiler extends DiagnosticEmitter {
// here, with their respective locals being blocked. There is no 'makeCallInline'.
var body = [];
if (thisArg) {
let parent = assert(instance.parent);
assert(parent.kind == ElementKind.CLASS);
let classInstance = assert(instance.parent); assert(classInstance.kind == ElementKind.CLASS);
let thisType = assert(instance.signature.thisType);
let classType = thisType.classReference;
let superType = classType
@ -6041,26 +6083,45 @@ export class Compiler extends DiagnosticEmitter {
case NodeKind.THIS: {
let flow = currentFunction.flow;
if (flow.is(FlowFlags.INLINE_CONTEXT)) {
let scopedThis = flow.getScopedLocal("this");
if (scopedThis) {
this.currentType = scopedThis.type;
return module.createGetLocal(scopedThis.index, scopedThis.type.toNativeType());
let thisLocal = assert(flow.getScopedLocal("this"));
if (thisLocal) {
this.currentType = thisLocal.type;
return module.createGetLocal(thisLocal.index, thisLocal.type.toNativeType());
}
}
if (currentFunction.is(CommonFlags.INSTANCE)) {
let parent = assert(currentFunction.parent);
assert(parent.kind == ElementKind.CLASS);
let thisType = assert(currentFunction.signature.thisType);
let thisLocal = assert(flow.getScopedLocal("this"));
let classInstance = assert(currentFunction.parent); assert(classInstance.kind == ElementKind.CLASS);
let nativeSizeType = this.options.nativeSizeType;
if (currentFunction.is(CommonFlags.CONSTRUCTOR)) {
if (!flow.is(FlowFlags.ALLOCATES)) {
flow.set(FlowFlags.ALLOCATES);
// must be conditional because `this` could have been provided by a derived class
this.currentType = thisType;
return module.createTeeLocal(0,
this.makeConditionalAllocate(<Class>parent, expression)
// {
// if (!this) this = <ALLOC>
// this.a = X
// this.b = Y
// return this
// }
let stmts: ExpressionRef[] = [
module.createIf(
module.createUnary(nativeSizeType == NativeType.I64 ? UnaryOp.EqzI64 : UnaryOp.EqzI32,
module.createGetLocal(thisLocal.index, nativeSizeType)
),
module.createSetLocal(thisLocal.index,
this.makeAllocation(<Class>classInstance)
)
)
];
this.makeFieldInitialization(<Class>classInstance, stmts);
stmts.push(
module.createGetLocal(thisLocal.index, nativeSizeType)
);
this.currentType = thisLocal.type;
return module.createBlock(null, stmts, nativeSizeType);
}
}
// if not a constructor, `this` type can differ
let thisType = assert(currentFunction.signature.thisType);
this.currentType = thisType;
return module.createGetLocal(0, thisType.toNativeType());
}
@ -6094,11 +6155,10 @@ export class Compiler extends DiagnosticEmitter {
}
}
if (currentFunction.is(CommonFlags.INSTANCE)) {
let parent = assert(currentFunction.parent);
assert(parent.kind == ElementKind.CLASS);
let base = (<Class>parent).base;
if (base) {
let superType = base.type;
let classInstance = assert(currentFunction.parent); assert(classInstance.kind == ElementKind.CLASS);
let baseClassInstance = (<Class>classInstance).base;
if (baseClassInstance) {
let superType = baseClassInstance.type;
this.currentType = superType;
return module.createGetLocal(0, superType.toNativeType());
}
@ -6628,7 +6688,7 @@ export class Compiler extends DiagnosticEmitter {
// allocate a new instance first and assign 'this' to the temp. local
exprs[0] = module.createSetLocal(
tempLocal.index,
compileAllocate(this, classReference, expression)
this.makeAllocation(classReference)
);
// once all field values have been set, return 'this'
@ -6681,64 +6741,101 @@ export class Compiler extends DiagnosticEmitter {
return this.compileInstantiate(classInstance, expression.arguments, expression);
}
compileInstantiate(classInstance: Class, argumentExpressions: Expression[], reportNode: Node): ExpressionRef {
// traverse to the top-most visible constructor
var currentClassInstance: Class | null = classInstance;
var constructorInstance: Function | null = null;
do {
constructorInstance = currentClassInstance.constructorInstance;
if (constructorInstance) break; // TODO: check visibility
} while (currentClassInstance = currentClassInstance.base);
// if a constructor is present, call it with a zero `this`
var expr: ExpressionRef;
if (constructorInstance) {
expr = this.compileCallDirect(constructorInstance, argumentExpressions, reportNode,
this.options.usizeType.toNativeZero(this.module)
);
// otherwise simply allocate a new instance and initialize its fields
} else {
if (argumentExpressions.length) {
this.error(
DiagnosticCode.Expected_0_arguments_but_got_1,
reportNode.range, "0", argumentExpressions.length.toString(10)
);
}
expr = this.makeAllocate(classInstance, reportNode);
/** Gets the compiled constructor of the specified class or generates one if none is present. */
ensureConstructor(classInstance: Class, reportNode: Node): Function {
var ctorInstance = classInstance.constructorInstance;
if (ctorInstance) {
this.compileFunction(ctorInstance);
return ctorInstance;
}
this.currentType = classInstance.type;
return expr;
// use the signature of the parent constructor if a derived class
var baseClass = classInstance.base;
var signature = baseClass
? this.ensureConstructor(baseClass, reportNode).signature
: new Signature(null, classInstance.type, classInstance.type);
var internalName = classInstance.internalName + INSTANCE_DELIMITER + "constructor";
var nativeDummy = assert(this.program.elementsLookup.get("NATIVE_CODE"));
assert(nativeDummy.kind == ElementKind.FUNCTION_PROTOTYPE);
ctorInstance = new Function(
<FunctionPrototype>nativeDummy,
internalName,
signature,
classInstance,
null
);
ctorInstance.set(CommonFlags.INSTANCE | CommonFlags.CONSTRUCTOR | CommonFlags.COMPILED);
classInstance.constructorInstance = ctorInstance;
var previousFunction = this.currentFunction;
this.currentFunction = ctorInstance;
// generate body
var module = this.module;
var nativeSizeType = this.options.nativeSizeType;
var stmts = new Array<ExpressionRef>();
// {
// if (!this) this = <ALLOC>
// IF_DERIVED: this = super(this, ...args)
// this.a = X
// this.b = Y
// return this
// }
stmts.push(
module.createIf(
module.createUnary(nativeSizeType == NativeType.I64 ? UnaryOp.EqzI64 : UnaryOp.EqzI32,
module.createGetLocal(0, nativeSizeType)
),
module.createSetLocal(0,
this.makeAllocation(classInstance)
)
)
);
if (baseClass) {
let parameterTypes = signature.parameterTypes;
let numParameters = parameterTypes.length;
let operands = new Array<ExpressionRef>(1 + numParameters);
operands[0] = module.createGetLocal(0, nativeSizeType);
for (let i = 0; i < numParameters; ++i) {
operands[i + 1] = module.createGetLocal(i + 1, parameterTypes[i].toNativeType());
}
// TODO: base constructor might be inlined, but makeCallDirect can't do this
stmts.push(
module.createSetLocal(0,
this.makeCallDirect(assert(baseClass.constructorInstance), operands)
)
);
}
this.makeFieldInitialization(classInstance, stmts);
stmts.push(
module.createGetLocal(0, nativeSizeType)
);
// make the function
var typeRef = this.ensureFunctionType(signature.parameterTypes, signature.returnType, signature.thisType);
var funcRef = module.addFunction(ctorInstance.internalName, typeRef, null,
stmts.length == 1
? stmts[0]
: module.createBlock(null, stmts, nativeSizeType)
);
ctorInstance.finalize(module, funcRef);
this.currentFunction = previousFunction;
return ctorInstance;
}
compileSuperInstantiate(classInstance: Class, argumentExpressions: Expression[], reportNode: Node): ExpressionRef {
// traverse to the top-most visible constructor (except the current one)
var currentClassInstance: Class | null = classInstance.base;
var constructorInstance: Function | null = null;
while (currentClassInstance) {
constructorInstance = currentClassInstance.constructorInstance;
if (constructorInstance) break; // TODO: check visibility
currentClassInstance = currentClassInstance.base;
}
// if a constructor is present, allocate the necessary memory for `this` and call it
var expr: ExpressionRef;
if (constructorInstance) {
expr = this.compileCallDirect(constructorInstance, argumentExpressions, reportNode,
this.makeAllocate(classInstance, reportNode)
);
// otherwise simply allocate a new instance and initialize its fields
} else {
if (argumentExpressions.length) {
this.error(
DiagnosticCode.Expected_0_arguments_but_got_1,
reportNode.range, "0", argumentExpressions.length.toString(10)
);
}
expr = this.makeAllocate(classInstance, reportNode);
}
compileInstantiate(classInstance: Class, argumentExpressions: Expression[], reportNode: Node): ExpressionRef {
var ctor = this.ensureConstructor(classInstance, reportNode);
var expr = this.compileCallDirect(
ctor,
argumentExpressions,
reportNode,
this.options.usizeType.toNativeZero(this.module),
ctor.hasDecorator(DecoratorFlags.INLINE)
// FIXME: trying to inline a constructor that doesn't return a custom value doesn't work
);
this.currentType = classInstance.type;
return expr;
}
@ -6785,9 +6882,8 @@ export class Compiler extends DiagnosticEmitter {
return module.createGetGlobal((<Global>target).internalName, globalType.toNativeType());
}
case ElementKind.ENUMVALUE: { // enum value
let parent = (<EnumValue>target).parent;
assert(parent !== null && parent.kind == ElementKind.ENUM);
if (!this.compileEnum(<Enum>parent)) {
let theEnum = assert((<EnumValue>target).parent); assert(theEnum.kind == ElementKind.ENUM);
if (!this.compileEnum(<Enum>theEnum)) {
this.currentType = Type.i32;
return this.module.createUnreachable();
}
@ -6848,8 +6944,7 @@ export class Compiler extends DiagnosticEmitter {
}
let inline = (instance.decoratorFlags & DecoratorFlags.INLINE) != 0;
if (instance.is(CommonFlags.INSTANCE)) {
let parent = assert(instance.parent);
assert(parent.kind == ElementKind.CLASS);
let classInstance = assert(instance.parent); assert(classInstance.kind == ElementKind.CLASS);
let thisExpression = assert(this.resolver.currentThisExpression); //!!!
let thisExpr = this.compileExpressionRetainType(
thisExpression,
@ -7679,24 +7774,57 @@ export class Compiler extends DiagnosticEmitter {
}
}
/** Makes an allocation expression for an instance of the specified class. */
makeAllocate(classInstance: Class, reportNode: Node): ExpressionRef {
/** Makes an allocation suitable to hold the data of an instance of the given class. */
makeAllocation(classInstance: Class): ExpressionRef {
var program = this.program;
assert(classInstance.program == program);
var module = this.module;
var currentFunction = this.currentFunction;
var nativeSizeType = this.options.nativeSizeType;
var options = this.options;
// allocate the necessary memory and tee the pointer to a temp. local for reuse
var tempLocal = currentFunction.getTempLocal(classInstance.type, false);
var initializers = new Array<ExpressionRef>();
initializers.push(
module.createSetLocal(tempLocal.index,
compileAllocate(this, classInstance, reportNode)
)
);
// __gc_allocate(size, markFn)
if (program.hasGC && classInstance.type.isManaged(program)) {
let allocateInstance = assert(program.gcAllocateInstance);
if (!this.compileFunction(allocateInstance)) return module.createUnreachable();
this.currentType = classInstance.type;
return module.createCall(
allocateInstance.internalName, [
options.isWasm64
? module.createI64(classInstance.currentMemoryOffset)
: module.createI32(classInstance.currentMemoryOffset),
module.createI32(
ensureGCHook(this, classInstance)
)
],
options.nativeSizeType
);
// memory.allocate(size)
} else {
let allocateInstance = program.memoryAllocateInstance;
if (!allocateInstance || !this.compileFunction(allocateInstance)) return module.createUnreachable();
this.currentType = classInstance.type;
return module.createCall(
allocateInstance.internalName, [
options.isWasm64
? module.createI64(classInstance.currentMemoryOffset)
: module.createI32(classInstance.currentMemoryOffset)
],
options.nativeSizeType
);
}
}
/** Makes the initializers for a class's fields. */
makeFieldInitialization(classInstance: Class, stmts: ExpressionRef[] = []): ExpressionRef[] {
// must not be used in an inline context as it makes assumptions about local indexes
assert(!this.currentFunction.flow.is(FlowFlags.INLINE_CONTEXT));
// apply field initializers
if (classInstance.members) {
let module = this.module;
let nativeSizeType = this.options.nativeSizeType;
for (let member of classInstance.members.values()) {
if (member.parent != classInstance) continue;
if (member.kind == ElementKind.FIELD) {
let field = <Field>member;
let fieldType = field.type;
@ -7704,8 +7832,8 @@ export class Compiler extends DiagnosticEmitter {
let fieldDeclaration = field.prototype.declaration;
assert(!field.isAny(CommonFlags.CONST));
if (fieldDeclaration.initializer) { // use initializer
initializers.push(module.createStore(fieldType.byteSize,
module.createGetLocal(tempLocal.index, nativeSizeType),
stmts.push(module.createStore(fieldType.byteSize,
module.createGetLocal(0, nativeSizeType),
this.compileExpression( // reports
fieldDeclaration.initializer,
fieldType,
@ -7715,11 +7843,12 @@ export class Compiler extends DiagnosticEmitter {
nativeFieldType,
field.memoryOffset
));
} else { // initialize with zero
// TODO: might be unnecessary if the ctor initializes the field
} else {
// NOTE: if all fields have initializers then this way is best, but if they don't,
// it would be more efficient to categorically zero memory on allocation.
let parameterIndex = (<FieldDeclaration>field.prototype.declaration).parameterIndex;
initializers.push(module.createStore(fieldType.byteSize,
module.createGetLocal(tempLocal.index, nativeSizeType),
stmts.push(module.createStore(fieldType.byteSize,
module.createGetLocal(0, nativeSizeType),
parameterIndex >= 0 // initialized via parameter
? module.createGetLocal(1 + parameterIndex, nativeFieldType)
: fieldType.toNativeZero(module),
@ -7730,36 +7859,7 @@ export class Compiler extends DiagnosticEmitter {
}
}
}
// return `this`
initializers.push(
module.createGetLocal(tempLocal.index, nativeSizeType)
);
currentFunction.freeTempLocal(tempLocal);
this.currentType = classInstance.type;
return module.createBlock(null, initializers, nativeSizeType);
}
/** Makes a conditional allocation expression inside of the constructor of the specified class. */
makeConditionalAllocate(classInstance: Class, reportNode: Node): ExpressionRef {
// requires that `this` is the first local
var module = this.module;
var nativeSizeType = this.options.nativeSizeType;
this.currentType = classInstance.type;
return module.createIf(
nativeSizeType == NativeType.I64
? module.createBinary(
BinaryOp.NeI64,
module.createGetLocal(0, NativeType.I64),
module.createI64(0)
)
: module.createGetLocal(0, NativeType.I32),
module.createGetLocal(0, nativeSizeType),
module.createTeeLocal(0,
this.makeAllocate(classInstance, reportNode)
)
);
return stmts;
}
/** Adds the debug location of the specified expression at the specified range to the source map. */

View File

@ -2509,43 +2509,45 @@ export class Function extends Element {
this.flags = prototype.flags;
this.decoratorFlags = prototype.decoratorFlags;
this.contextualTypeArguments = contextualTypeArguments;
if (!(prototype.is(CommonFlags.AMBIENT))) {
let localIndex = 0;
if (parent && parent.kind == ElementKind.CLASS) {
assert(this.is(CommonFlags.INSTANCE));
let local = new Local(
prototype.program,
"this",
localIndex++,
assert(signature.thisType)
);
this.localsByName.set("this", local);
this.localsByIndex[local.index] = local;
let inheritedTypeArguments = (<Class>parent).contextualTypeArguments;
if (inheritedTypeArguments) {
if (!this.contextualTypeArguments) this.contextualTypeArguments = new Map();
for (let [inheritedName, inheritedType] of inheritedTypeArguments) {
if (!this.contextualTypeArguments.has(inheritedName)) {
this.contextualTypeArguments.set(inheritedName, inheritedType);
if (prototype.internalName != "NATIVE_CODE") { // e.g. generated constructor without a real prototype
if (!(prototype.is(CommonFlags.AMBIENT))) {
let localIndex = 0;
if (parent && parent.kind == ElementKind.CLASS) {
assert(this.is(CommonFlags.INSTANCE));
let local = new Local(
prototype.program,
"this",
localIndex++,
assert(signature.thisType)
);
this.localsByName.set("this", local);
this.localsByIndex[local.index] = local;
let inheritedTypeArguments = (<Class>parent).contextualTypeArguments;
if (inheritedTypeArguments) {
if (!this.contextualTypeArguments) this.contextualTypeArguments = new Map();
for (let [inheritedName, inheritedType] of inheritedTypeArguments) {
if (!this.contextualTypeArguments.has(inheritedName)) {
this.contextualTypeArguments.set(inheritedName, inheritedType);
}
}
}
} else {
assert(!this.is(CommonFlags.INSTANCE)); // internal error
}
let parameterTypes = signature.parameterTypes;
for (let i = 0, k = parameterTypes.length; i < k; ++i) {
let parameterType = parameterTypes[i];
let parameterName = signature.getParameterName(i);
let local = new Local(
prototype.program,
parameterName,
localIndex++,
parameterType
// FIXME: declaration?
);
this.localsByName.set(parameterName, local);
this.localsByIndex[local.index] = local;
}
} else {
assert(!this.is(CommonFlags.INSTANCE)); // internal error
}
let parameterTypes = signature.parameterTypes;
for (let i = 0, k = parameterTypes.length; i < k; ++i) {
let parameterType = parameterTypes[i];
let parameterName = signature.getParameterName(i);
let local = new Local(
prototype.program,
parameterName,
localIndex++,
parameterType
// FIXME: declaration?
);
this.localsByName.set(parameterName, local);
this.localsByIndex[local.index] = local;
}
}
this.flow = Flow.create(this);

View File

@ -191,3 +191,5 @@ export namespace f64 {
}
@builtin export declare function start(): void;
@builtin export function NATIVE_CODE(): void { unreachable(); }

View File

@ -81,18 +81,19 @@
if
i32.const 4
call $~lib/allocator/arena/__memory_allocate
tee_local $0
i32.const 1
i32.store
set_local $0
end
get_local $0
i32.const 1
i32.store
get_local $0
i32.load
i32.const 1
i32.ne
if
i32.const 0
i32.const 8
i32.const 6
i32.const 8
i32.const 4
call $~lib/env/abort
unreachable
@ -103,22 +104,18 @@
(local $0 i32)
i32.const 8
call $~lib/allocator/arena/__memory_allocate
call $call-super/A#constructor
tee_local $0
i32.const 1
i32.store
get_local $0
i32.const 2
i32.store offset=4
get_local $0
call $call-super/A#constructor
tee_local $0
i32.load
i32.const 1
i32.ne
if
i32.const 0
i32.const 8
i32.const 15
i32.const 17
i32.const 4
call $~lib/env/abort
unreachable
@ -130,7 +127,7 @@
if
i32.const 0
i32.const 8
i32.const 16
i32.const 18
i32.const 4
call $~lib/env/abort
unreachable
@ -147,7 +144,7 @@
if
i32.const 0
i32.const 8
i32.const 22
i32.const 24
i32.const 2
call $~lib/env/abort
unreachable
@ -159,20 +156,31 @@
if
i32.const 0
i32.const 8
i32.const 23
i32.const 25
i32.const 2
call $~lib/env/abort
unreachable
end
)
(func $call-super/D#constructor (; 5 ;) (type $FUNCSIG$i) (result i32)
(local $0 i32)
i32.const 8
call $~lib/allocator/arena/__memory_allocate
tee_local $0
(func $call-super/C#constructor (; 5 ;) (type $ii) (param $0 i32) (result i32)
get_local $0
i32.eqz
if
i32.const 4
call $~lib/allocator/arena/__memory_allocate
set_local $0
end
get_local $0
i32.const 1
i32.store
get_local $0
)
(func $call-super/D#constructor (; 6 ;) (type $FUNCSIG$i) (result i32)
(local $0 i32)
i32.const 8
call $~lib/allocator/arena/__memory_allocate
call $call-super/C#constructor
tee_local $0
i32.const 2
i32.store offset=4
get_local $0
@ -182,7 +190,7 @@
if
i32.const 0
i32.const 8
i32.const 36
i32.const 40
i32.const 4
call $~lib/env/abort
unreachable
@ -194,14 +202,14 @@
if
i32.const 0
i32.const 8
i32.const 37
i32.const 41
i32.const 4
call $~lib/env/abort
unreachable
end
get_local $0
)
(func $call-super/test2 (; 6 ;) (type $v)
(func $call-super/test2 (; 7 ;) (type $v)
(local $0 i32)
call $call-super/D#constructor
tee_local $0
@ -211,7 +219,7 @@
if
i32.const 0
i32.const 8
i32.const 43
i32.const 47
i32.const 2
call $~lib/env/abort
unreachable
@ -223,17 +231,21 @@
if
i32.const 0
i32.const 8
i32.const 44
i32.const 48
i32.const 2
call $~lib/env/abort
unreachable
end
)
(func $call-super/E#constructor (; 7 ;) (type $FUNCSIG$i) (result i32)
(local $0 i32)
i32.const 4
call $~lib/allocator/arena/__memory_allocate
tee_local $0
(func $call-super/E#constructor (; 8 ;) (type $ii) (param $0 i32) (result i32)
get_local $0
i32.eqz
if
i32.const 4
call $~lib/allocator/arena/__memory_allocate
set_local $0
end
get_local $0
i32.const 1
i32.store
get_local $0
@ -243,34 +255,124 @@
if
i32.const 0
i32.const 8
i32.const 52
i32.const 58
i32.const 4
call $~lib/env/abort
unreachable
end
get_local $0
)
(func $start (; 8 ;) (type $v)
i32.const 40
set_global $~lib/allocator/arena/startOffset
get_global $~lib/allocator/arena/startOffset
set_global $~lib/allocator/arena/offset
call $call-super/test1
call $call-super/test2
(func $call-super/test3 (; 9 ;) (type $v)
(local $0 i32)
i32.const 8
call $~lib/allocator/arena/__memory_allocate
call $call-super/E#constructor
tee_local $0
i32.const 2
i32.store offset=4
get_local $0
i32.load
i32.const 1
i32.ne
if
i32.const 0
i32.const 8
i32.const 62
i32.const 68
i32.const 2
call $~lib/env/abort
unreachable
end
get_local $0
i32.load offset=4
i32.const 2
i32.ne
if
i32.const 0
i32.const 8
i32.const 69
i32.const 2
call $~lib/env/abort
unreachable
end
)
(func $null (; 9 ;) (type $v)
(func $call-super/H#constructor (; 10 ;) (type $FUNCSIG$i) (result i32)
(local $0 i32)
i32.const 8
call $~lib/allocator/arena/__memory_allocate
call $call-super/C#constructor
tee_local $0
i32.const 2
i32.store offset=4
get_local $0
)
(func $call-super/test4 (; 11 ;) (type $v)
(local $0 i32)
call $call-super/H#constructor
tee_local $0
i32.load
i32.const 1
i32.ne
if
i32.const 0
i32.const 8
i32.const 86
i32.const 2
call $~lib/env/abort
unreachable
end
get_local $0
i32.load offset=4
i32.const 2
i32.ne
if
i32.const 0
i32.const 8
i32.const 87
i32.const 2
call $~lib/env/abort
unreachable
end
)
(func $call-super/test5 (; 12 ;) (type $v)
(local $0 i32)
call $call-super/H#constructor
tee_local $0
i32.load
i32.const 1
i32.ne
if
i32.const 0
i32.const 8
i32.const 106
i32.const 2
call $~lib/env/abort
unreachable
end
get_local $0
i32.load offset=4
i32.const 2
i32.ne
if
i32.const 0
i32.const 8
i32.const 107
i32.const 2
call $~lib/env/abort
unreachable
end
)
(func $start (; 13 ;) (type $v)
i32.const 40
set_global $~lib/allocator/arena/startOffset
get_global $~lib/allocator/arena/startOffset
set_global $~lib/allocator/arena/offset
call $call-super/test1
call $call-super/test2
call $call-super/test3
call $call-super/test4
call $call-super/test5
)
(func $null (; 14 ;) (type $v)
nop
)
)

View File

@ -1,5 +1,7 @@
import "allocator/arena";
// both constructors present
class A {
a: i32 = 1;
constructor() {
@ -25,6 +27,8 @@ function test1(): void {
test1();
// this constructor present
class C {
a: i32 = 1;
}
@ -46,6 +50,8 @@ function test2(): void {
test2();
// super constructor present
class E {
a: i32 = 1;
constructor() {
@ -60,7 +66,45 @@ class F extends E {
function test3(): void {
var f = new F();
assert(f.a == 1);
// assert(f.b == 2); // FIXME: uses E#constructor, not initializing fields
assert(f.b == 2);
}
test3();
// no constructor present
class G {
a: i32 = 1;
}
class H extends G {
b: i32 = 2;
}
function test4(): void {
var h = new H();
assert(h.a == 1);
assert(h.b == 2);
}
test4();
// this constructor present with fallback allocation (`this` is not accessed)
class I {
a: i32 = 1;
constructor() {
}
}
class J extends I {
b: i32 = 2;
}
function test5(): void {
var h = new J();
assert(h.a == 1);
assert(h.b == 2);
}
test5();

View File

@ -102,23 +102,19 @@
return
)
(func $call-super/A#constructor (; 3 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
get_local $0
if (result i32)
block (result i32)
get_local $0
else
block (result i32)
i32.eqz
if
i32.const 4
call $~lib/memory/memory.allocate
set_local $1
get_local $1
i32.const 1
i32.store
get_local $1
set_local $0
end
tee_local $0
get_local $0
i32.const 1
i32.store
get_local $0
end
tee_local $0
i32.load
i32.const 1
i32.eq
@ -126,7 +122,7 @@
if
i32.const 0
i32.const 8
i32.const 6
i32.const 8
i32.const 4
call $~lib/env/abort
unreachable
@ -134,22 +130,19 @@
get_local $0
)
(func $call-super/B#constructor (; 4 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
block (result i32)
get_local $0
if (result i32)
get_local $0
else
i32.const 8
call $~lib/memory/memory.allocate
set_local $1
get_local $1
i32.const 1
i32.store
get_local $1
i32.const 2
i32.store offset=4
get_local $1
end
call $call-super/A#constructor
set_local $0
get_local $0
i32.const 2
i32.store offset=4
get_local $0
i32.load
i32.const 1
i32.eq
@ -157,7 +150,7 @@
if
i32.const 0
i32.const 8
i32.const 15
i32.const 17
i32.const 4
call $~lib/env/abort
unreachable
@ -170,7 +163,7 @@
if
i32.const 0
i32.const 8
i32.const 16
i32.const 18
i32.const 4
call $~lib/env/abort
unreachable
@ -190,7 +183,7 @@
if
i32.const 0
i32.const 8
i32.const 22
i32.const 24
i32.const 2
call $~lib/env/abort
unreachable
@ -203,28 +196,39 @@
if
i32.const 0
i32.const 8
i32.const 23
i32.const 25
i32.const 2
call $~lib/env/abort
unreachable
end
)
(func $call-super/D#constructor (; 6 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
block (result i32)
(func $call-super/C#constructor (; 6 ;) (type $ii) (param $0 i32) (result i32)
get_local $0
i32.eqz
if
i32.const 4
call $~lib/memory/memory.allocate
set_local $0
end
get_local $0
i32.const 1
i32.store
get_local $0
)
(func $call-super/D#constructor (; 7 ;) (type $ii) (param $0 i32) (result i32)
get_local $0
if (result i32)
get_local $0
else
i32.const 8
call $~lib/memory/memory.allocate
set_local $1
get_local $1
i32.const 1
i32.store
get_local $1
i32.const 2
i32.store offset=4
get_local $1
end
call $call-super/C#constructor
set_local $0
get_local $0
i32.const 2
i32.store offset=4
get_local $0
i32.load
i32.const 1
i32.eq
@ -232,7 +236,7 @@
if
i32.const 0
i32.const 8
i32.const 36
i32.const 40
i32.const 4
call $~lib/env/abort
unreachable
@ -245,14 +249,14 @@
if
i32.const 0
i32.const 8
i32.const 37
i32.const 41
i32.const 4
call $~lib/env/abort
unreachable
end
get_local $0
)
(func $call-super/test2 (; 7 ;) (type $v)
(func $call-super/test2 (; 8 ;) (type $v)
(local $0 i32)
i32.const 0
call $call-super/D#constructor
@ -265,7 +269,7 @@
if
i32.const 0
i32.const 8
i32.const 43
i32.const 47
i32.const 2
call $~lib/env/abort
unreachable
@ -278,30 +282,26 @@
if
i32.const 0
i32.const 8
i32.const 44
i32.const 48
i32.const 2
call $~lib/env/abort
unreachable
end
)
(func $call-super/E#constructor (; 8 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
get_local $0
if (result i32)
(func $call-super/E#constructor (; 9 ;) (type $ii) (param $0 i32) (result i32)
block (result i32)
get_local $0
else
block (result i32)
i32.eqz
if
i32.const 4
call $~lib/memory/memory.allocate
set_local $1
get_local $1
i32.const 1
i32.store
get_local $1
set_local $0
end
tee_local $0
get_local $0
i32.const 1
i32.store
get_local $0
end
tee_local $0
i32.load
i32.const 1
i32.eq
@ -309,17 +309,33 @@
if
i32.const 0
i32.const 8
i32.const 52
i32.const 58
i32.const 4
call $~lib/env/abort
unreachable
end
get_local $0
)
(func $call-super/test3 (; 9 ;) (type $v)
(func $call-super/F#constructor (; 10 ;) (type $ii) (param $0 i32) (result i32)
get_local $0
i32.eqz
if
i32.const 8
call $~lib/memory/memory.allocate
set_local $0
end
get_local $0
call $call-super/E#constructor
set_local $0
get_local $0
i32.const 2
i32.store offset=4
get_local $0
)
(func $call-super/test3 (; 11 ;) (type $v)
(local $0 i32)
i32.const 0
call $call-super/E#constructor
call $call-super/F#constructor
set_local $0
get_local $0
i32.load
@ -329,13 +345,148 @@
if
i32.const 0
i32.const 8
i32.const 62
i32.const 68
i32.const 2
call $~lib/env/abort
unreachable
end
get_local $0
i32.load offset=4
i32.const 2
i32.eq
i32.eqz
if
i32.const 0
i32.const 8
i32.const 69
i32.const 2
call $~lib/env/abort
unreachable
end
)
(func $start (; 10 ;) (type $v)
(func $call-super/G#constructor (; 12 ;) (type $ii) (param $0 i32) (result i32)
get_local $0
i32.eqz
if
i32.const 4
call $~lib/memory/memory.allocate
set_local $0
end
get_local $0
i32.const 1
i32.store
get_local $0
)
(func $call-super/H#constructor (; 13 ;) (type $ii) (param $0 i32) (result i32)
get_local $0
i32.eqz
if
i32.const 8
call $~lib/memory/memory.allocate
set_local $0
end
get_local $0
call $call-super/G#constructor
set_local $0
get_local $0
i32.const 2
i32.store offset=4
get_local $0
)
(func $call-super/test4 (; 14 ;) (type $v)
(local $0 i32)
i32.const 0
call $call-super/H#constructor
set_local $0
get_local $0
i32.load
i32.const 1
i32.eq
i32.eqz
if
i32.const 0
i32.const 8
i32.const 86
i32.const 2
call $~lib/env/abort
unreachable
end
get_local $0
i32.load offset=4
i32.const 2
i32.eq
i32.eqz
if
i32.const 0
i32.const 8
i32.const 87
i32.const 2
call $~lib/env/abort
unreachable
end
)
(func $call-super/I#constructor (; 15 ;) (type $ii) (param $0 i32) (result i32)
get_local $0
i32.eqz
if
i32.const 4
call $~lib/memory/memory.allocate
set_local $0
end
get_local $0
i32.const 1
i32.store
get_local $0
)
(func $call-super/J#constructor (; 16 ;) (type $ii) (param $0 i32) (result i32)
get_local $0
i32.eqz
if
i32.const 8
call $~lib/memory/memory.allocate
set_local $0
end
get_local $0
call $call-super/I#constructor
set_local $0
get_local $0
i32.const 2
i32.store offset=4
get_local $0
)
(func $call-super/test5 (; 17 ;) (type $v)
(local $0 i32)
i32.const 0
call $call-super/J#constructor
set_local $0
get_local $0
i32.load
i32.const 1
i32.eq
i32.eqz
if
i32.const 0
i32.const 8
i32.const 106
i32.const 2
call $~lib/env/abort
unreachable
end
get_local $0
i32.load offset=4
i32.const 2
i32.eq
i32.eqz
if
i32.const 0
i32.const 8
i32.const 107
i32.const 2
call $~lib/env/abort
unreachable
end
)
(func $start (; 18 ;) (type $v)
get_global $HEAP_BASE
get_global $~lib/internal/allocator/AL_MASK
i32.add
@ -349,7 +500,9 @@
call $call-super/test1
call $call-super/test2
call $call-super/test3
call $call-super/test4
call $call-super/test5
)
(func $null (; 11 ;) (type $v)
(func $null (; 19 ;) (type $v)
)
)

View File

@ -181,13 +181,14 @@
if
i32.const 4
call $~lib/allocator/arena/__memory_allocate
tee_local $0
get_local $1
i32.store
set_local $0
end
get_local $0
get_local $1
i32.store
get_local $0
get_local $1
i32.store
get_local $0
)
)

View File

@ -154,23 +154,19 @@
return
)
(func $exports/Car#constructor (; 6 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
get_local $0
if (result i32)
block (result i32)
get_local $0
else
block (result i32)
i32.eqz
if
i32.const 4
call $~lib/memory/memory.allocate
set_local $2
get_local $2
get_local $1
i32.store
get_local $2
set_local $0
end
tee_local $0
get_local $0
get_local $1
i32.store
get_local $0
end
tee_local $0
get_local $1
i32.store
get_local $0
@ -191,23 +187,19 @@
get_global $exports/vehicles.Car.TIRES
)
(func $exports/vehicles.Car#constructor (; 11 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
get_local $0
if (result i32)
block (result i32)
get_local $0
else
block (result i32)
i32.eqz
if
i32.const 4
call $~lib/memory/memory.allocate
set_local $2
get_local $2
get_local $1
i32.store
get_local $2
set_local $0
end
tee_local $0
get_local $0
get_local $1
i32.store
get_local $0
end
tee_local $0
get_local $1
i32.store
get_local $0

View File

@ -101,20 +101,26 @@
call $~lib/allocator/arena/__memory_allocate
return
)
(func $getter-call/C#get:x~anonymous|1 (; 2 ;) (type $i) (result i32)
i32.const 42
)
(func $getter-call/C#get:x (; 3 ;) (type $ii) (param $0 i32) (result i32)
i32.const 1
)
(func $getter-call/test (; 4 ;) (type $i) (result i32)
(local $0 i32)
block (result i32)
(func $getter-call/C#constructor (; 2 ;) (type $ii) (param $0 i32) (result i32)
get_local $0
i32.eqz
if
i32.const 0
call $~lib/memory/memory.allocate
set_local $0
get_local $0
end
get_local $0
)
(func $getter-call/C#get:x~anonymous|1 (; 3 ;) (type $i) (result i32)
i32.const 42
)
(func $getter-call/C#get:x (; 4 ;) (type $ii) (param $0 i32) (result i32)
i32.const 1
)
(func $getter-call/test (; 5 ;) (type $i) (result i32)
(local $0 i32)
i32.const 0
call $getter-call/C#constructor
set_local $0
i32.const 0
set_global $~argc
@ -122,7 +128,7 @@
call $getter-call/C#get:x
call_indirect (type $i)
)
(func $start (; 5 ;) (type $v)
(func $start (; 6 ;) (type $v)
get_global $HEAP_BASE
get_global $~lib/internal/allocator/AL_MASK
i32.add
@ -134,6 +140,6 @@
get_global $~lib/allocator/arena/startOffset
set_global $~lib/allocator/arena/offset
)
(func $null (; 6 ;) (type $v)
(func $null (; 7 ;) (type $v)
)
)

View File

@ -12,18 +12,23 @@
(func $~lib/memory/memory.allocate (; 0 ;) (type $ii) (param $0 i32) (result i32)
unreachable
)
(func $new-without-allocator/test (; 1 ;) (type $i) (result i32)
(local $0 i32)
(local $1 i32)
block (result i32)
(func $new-without-allocator/A#constructor (; 1 ;) (type $ii) (param $0 i32) (result i32)
get_local $0
i32.eqz
if
i32.const 0
call $~lib/memory/memory.allocate
set_local $0
get_local $0
end
set_local $1
get_local $0
)
(func $new-without-allocator/test (; 2 ;) (type $i) (result i32)
(local $0 i32)
i32.const 0
call $new-without-allocator/A#constructor
set_local $0
i32.const 3
)
(func $null (; 2 ;) (type $v)
(func $null (; 3 ;) (type $v)
)
)

View File

@ -108,18 +108,37 @@
call $~lib/allocator/arena/__memory_allocate
return
)
(func $optional-typeparameters/TestConcrete<i32,i32>#test<i32> (; 4 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(func $optional-typeparameters/TestConcrete<i32,i32>#constructor (; 4 ;) (type $ii) (param $0 i32) (result i32)
get_local $0
i32.eqz
if
i32.const 0
call $~lib/memory/memory.allocate
set_local $0
end
get_local $0
)
(func $optional-typeparameters/TestConcrete<i32,i32>#test<i32> (; 5 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
get_local $1
get_local $2
i32.add
)
(func $optional-typeparameters/TestDerived<f64,f64>#test<f64> (; 5 ;) (type $iFFF) (param $0 i32) (param $1 f64) (param $2 f64) (result f64)
(func $optional-typeparameters/TestDerived<f64,f64>#constructor (; 6 ;) (type $ii) (param $0 i32) (result i32)
get_local $0
i32.eqz
if
i32.const 0
call $~lib/memory/memory.allocate
set_local $0
end
get_local $0
)
(func $optional-typeparameters/TestDerived<f64,f64>#test<f64> (; 7 ;) (type $iFFF) (param $0 i32) (param $1 f64) (param $2 f64) (result f64)
get_local $1
get_local $2
f64.add
)
(func $start (; 6 ;) (type $v)
(local $0 i32)
(func $start (; 8 ;) (type $v)
i32.const 1
call $optional-typeparameters/testConcrete<i32,i32>
drop
@ -136,24 +155,16 @@
set_global $~lib/allocator/arena/startOffset
get_global $~lib/allocator/arena/startOffset
set_global $~lib/allocator/arena/offset
block (result i32)
i32.const 0
call $~lib/memory/memory.allocate
set_local $0
get_local $0
end
i32.const 0
call $optional-typeparameters/TestConcrete<i32,i32>#constructor
set_global $optional-typeparameters/tConcrete
get_global $optional-typeparameters/tConcrete
i32.const 1
i32.const 2
call $optional-typeparameters/TestConcrete<i32,i32>#test<i32>
drop
block (result i32)
i32.const 0
call $~lib/memory/memory.allocate
set_local $0
get_local $0
end
i32.const 0
call $optional-typeparameters/TestDerived<f64,f64>#constructor
set_global $optional-typeparameters/tDerived
get_global $optional-typeparameters/tDerived
f64.const 1
@ -161,6 +172,6 @@
call $optional-typeparameters/TestDerived<f64,f64>#test<f64>
drop
)
(func $null (; 7 ;) (type $v)
(func $null (; 9 ;) (type $v)
)
)

View File

@ -493,25 +493,22 @@
get_local $2
call $~lib/internal/arraybuffer/allocateUnsafe
set_local $3
get_local $0
if (result i32)
block (result i32)
get_local $0
else
block (result i32)
i32.eqz
if
i32.const 8
call $~lib/memory/memory.allocate
set_local $4
get_local $4
i32.const 0
i32.store
get_local $4
i32.const 0
i32.store offset=4
get_local $4
set_local $0
end
tee_local $0
get_local $0
i32.const 0
i32.store
get_local $0
i32.const 0
i32.store offset=4
get_local $0
end
tee_local $0
get_local $3
i32.store
get_local $0
@ -570,25 +567,22 @@
get_local $2
call $~lib/internal/arraybuffer/allocateUnsafe
set_local $3
get_local $0
if (result i32)
block (result i32)
get_local $0
else
block (result i32)
i32.eqz
if
i32.const 8
call $~lib/memory/memory.allocate
set_local $4
get_local $4
i32.const 0
i32.store
get_local $4
i32.const 0
i32.store offset=4
get_local $4
set_local $0
end
tee_local $0
get_local $0
i32.const 0
i32.store
get_local $0
i32.const 0
i32.store offset=4
get_local $0
end
tee_local $0
get_local $3
i32.store
get_local $0
@ -624,7 +618,17 @@
get_local $2
i32.store offset=8
)
(func $~lib/array/Array<Ref>#constructor (; 12 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(func $std/array-literal/Ref#constructor (; 12 ;) (type $ii) (param $0 i32) (result i32)
get_local $0
i32.eqz
if
i32.const 0
call $~lib/memory/memory.allocate
set_local $0
end
get_local $0
)
(func $~lib/array/Array<Ref>#constructor (; 13 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(local $3 i32)
(local $4 i32)
@ -647,25 +651,22 @@
get_local $2
call $~lib/internal/arraybuffer/allocateUnsafe
set_local $3
get_local $0
if (result i32)
block (result i32)
get_local $0
else
block (result i32)
i32.eqz
if
i32.const 8
call $~lib/memory/memory.allocate
set_local $4
get_local $4
i32.const 0
i32.store
get_local $4
i32.const 0
i32.store offset=4
get_local $4
set_local $0
end
tee_local $0
get_local $0
i32.const 0
i32.store
get_local $0
i32.const 0
i32.store offset=4
get_local $0
end
tee_local $0
get_local $3
i32.store
get_local $0
@ -683,7 +684,7 @@
call $~lib/internal/memory/memset
get_local $0
)
(func $~lib/array/Array<Ref>#__unchecked_set (; 13 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
(func $~lib/array/Array<Ref>#__unchecked_set (; 14 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
(local $3 i32)
(local $4 i32)
get_local $0
@ -701,23 +702,17 @@
get_local $2
i32.store offset=8
)
(func $std/array-literal/RefWithCtor#constructor (; 14 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
(func $std/array-literal/RefWithCtor#constructor (; 15 ;) (type $ii) (param $0 i32) (result i32)
get_local $0
if (result i32)
get_local $0
else
block (result i32)
i32.const 0
call $~lib/memory/memory.allocate
set_local $1
get_local $1
end
tee_local $0
i32.eqz
if
i32.const 0
call $~lib/memory/memory.allocate
set_local $0
end
tee_local $0
get_local $0
)
(func $~lib/array/Array<RefWithCtor>#constructor (; 15 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(func $~lib/array/Array<RefWithCtor>#constructor (; 16 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(local $3 i32)
(local $4 i32)
@ -740,25 +735,22 @@
get_local $2
call $~lib/internal/arraybuffer/allocateUnsafe
set_local $3
get_local $0
if (result i32)
block (result i32)
get_local $0
else
block (result i32)
i32.eqz
if
i32.const 8
call $~lib/memory/memory.allocate
set_local $4
get_local $4
i32.const 0
i32.store
get_local $4
i32.const 0
i32.store offset=4
get_local $4
set_local $0
end
tee_local $0
get_local $0
i32.const 0
i32.store
get_local $0
i32.const 0
i32.store offset=4
get_local $0
end
tee_local $0
get_local $3
i32.store
get_local $0
@ -776,7 +768,7 @@
call $~lib/internal/memory/memset
get_local $0
)
(func $~lib/array/Array<RefWithCtor>#__unchecked_set (; 16 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
(func $~lib/array/Array<RefWithCtor>#__unchecked_set (; 17 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
(local $3 i32)
(local $4 i32)
get_local $0
@ -794,7 +786,7 @@
get_local $2
i32.store offset=8
)
(func $start (; 17 ;) (type $v)
(func $start (; 18 ;) (type $v)
(local $0 i32)
(local $1 i32)
(local $2 i32)
@ -1160,30 +1152,18 @@
set_local $3
get_local $3
i32.const 0
block (result i32)
i32.const 0
call $~lib/memory/memory.allocate
set_local $2
get_local $2
end
i32.const 0
call $std/array-literal/Ref#constructor
call $~lib/array/Array<Ref>#__unchecked_set
get_local $3
i32.const 1
block (result i32)
i32.const 0
call $~lib/memory/memory.allocate
set_local $2
get_local $2
end
i32.const 0
call $std/array-literal/Ref#constructor
call $~lib/array/Array<Ref>#__unchecked_set
get_local $3
i32.const 2
block (result i32)
i32.const 0
call $~lib/memory/memory.allocate
set_local $2
get_local $2
end
i32.const 0
call $std/array-literal/Ref#constructor
call $~lib/array/Array<Ref>#__unchecked_set
get_local $3
end
@ -1246,6 +1226,6 @@
unreachable
end
)
(func $null (; 18 ;) (type $v)
(func $null (; 19 ;) (type $v)
)
)

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,7 @@
(module
(type $ii (func (param i32) (result i32)))
(type $v (func))
(type $FUNCSIG$i (func (result i32)))
(memory $0 0)
(table $0 1 anyfunc)
(elem (i32.const 0) $null)
@ -82,7 +83,25 @@
set_global $~lib/allocator/arena/offset
get_local $1
)
(func $start (; 1 ;) (type $v)
(func $std/constructor/EmptyCtorWithFieldInit#constructor (; 1 ;) (type $FUNCSIG$i) (result i32)
(local $0 i32)
i32.const 4
call $~lib/allocator/arena/__memory_allocate
tee_local $0
i32.const 1
i32.store
get_local $0
)
(func $std/constructor/EmptyCtorWithFieldNoInit#constructor (; 2 ;) (type $FUNCSIG$i) (result i32)
(local $0 i32)
i32.const 4
call $~lib/allocator/arena/__memory_allocate
tee_local $0
i32.const 0
i32.store
get_local $0
)
(func $start (; 3 ;) (type $v)
(local $0 i32)
i32.const 8
set_global $~lib/allocator/arena/startOffset
@ -91,36 +110,16 @@
i32.const 0
call $~lib/allocator/arena/__memory_allocate
set_global $std/constructor/emptyCtor
i32.const 4
call $~lib/allocator/arena/__memory_allocate
tee_local $0
i32.const 1
i32.store
get_local $0
call $std/constructor/EmptyCtorWithFieldInit#constructor
set_global $std/constructor/emptyCtorWithFieldInit
i32.const 4
call $~lib/allocator/arena/__memory_allocate
tee_local $0
i32.const 0
i32.store
get_local $0
call $std/constructor/EmptyCtorWithFieldNoInit#constructor
set_global $std/constructor/emptyCtorWithFieldNoInit
i32.const 0
call $~lib/allocator/arena/__memory_allocate
set_global $std/constructor/none
i32.const 4
call $~lib/allocator/arena/__memory_allocate
tee_local $0
i32.const 1
i32.store
get_local $0
call $std/constructor/EmptyCtorWithFieldInit#constructor
set_global $std/constructor/justFieldInit
i32.const 4
call $~lib/allocator/arena/__memory_allocate
tee_local $0
i32.const 0
i32.store
get_local $0
call $std/constructor/EmptyCtorWithFieldNoInit#constructor
set_global $std/constructor/justFieldNoInit
i32.const 0
call $~lib/allocator/arena/__memory_allocate
@ -139,8 +138,6 @@
i32.const 0
call $~lib/allocator/arena/__memory_allocate
set_global $std/constructor/ctorAllocates
i32.const 0
set_local $0
block (result i32)
get_global $std/constructor/b
if
@ -151,15 +148,15 @@
get_local $0
i32.eqz
end
if (result i32)
if
i32.const 0
call $~lib/allocator/arena/__memory_allocate
else
get_local $0
set_local $0
end
get_local $0
set_global $std/constructor/ctorConditionallyAllocates
)
(func $null (; 2 ;) (type $v)
(func $null (; 4 ;) (type $v)
nop
)
)

View File

@ -110,60 +110,78 @@
return
)
(func $std/constructor/EmptyCtor#constructor (; 2 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
get_local $0
if (result i32)
get_local $0
else
block (result i32)
i32.const 0
call $~lib/memory/memory.allocate
set_local $1
get_local $1
end
tee_local $0
i32.eqz
if
i32.const 0
call $~lib/memory/memory.allocate
set_local $0
end
tee_local $0
get_local $0
)
(func $std/constructor/EmptyCtorWithFieldInit#constructor (; 3 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
get_local $0
if (result i32)
get_local $0
else
block (result i32)
i32.const 4
call $~lib/memory/memory.allocate
set_local $1
get_local $1
i32.const 1
i32.store
get_local $1
end
tee_local $0
i32.eqz
if
i32.const 4
call $~lib/memory/memory.allocate
set_local $0
end
tee_local $0
get_local $0
i32.const 1
i32.store
get_local $0
)
(func $std/constructor/EmptyCtorWithFieldNoInit#constructor (; 4 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
get_local $0
if (result i32)
get_local $0
else
block (result i32)
i32.const 4
call $~lib/memory/memory.allocate
set_local $1
get_local $1
i32.const 0
i32.store
get_local $1
end
tee_local $0
i32.eqz
if
i32.const 4
call $~lib/memory/memory.allocate
set_local $0
end
tee_local $0
get_local $0
i32.const 0
i32.store
get_local $0
)
(func $std/constructor/CtorReturns#constructor (; 5 ;) (type $ii) (param $0 i32) (result i32)
(func $std/constructor/None#constructor (; 5 ;) (type $ii) (param $0 i32) (result i32)
get_local $0
i32.eqz
if
i32.const 0
call $~lib/memory/memory.allocate
set_local $0
end
get_local $0
)
(func $std/constructor/JustFieldInit#constructor (; 6 ;) (type $ii) (param $0 i32) (result i32)
get_local $0
i32.eqz
if
i32.const 4
call $~lib/memory/memory.allocate
set_local $0
end
get_local $0
i32.const 1
i32.store
get_local $0
)
(func $std/constructor/JustFieldNoInit#constructor (; 7 ;) (type $ii) (param $0 i32) (result i32)
get_local $0
i32.eqz
if
i32.const 4
call $~lib/memory/memory.allocate
set_local $0
end
get_local $0
i32.const 0
i32.store
get_local $0
)
(func $std/constructor/CtorReturns#constructor (; 8 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
block $~lib/memory/memory.allocate|inlined.0 (result i32)
i32.const 0
@ -173,7 +191,7 @@
br $~lib/memory/memory.allocate|inlined.0
end
)
(func $std/constructor/CtorConditionallyReturns#constructor (; 6 ;) (type $ii) (param $0 i32) (result i32)
(func $std/constructor/CtorConditionallyReturns#constructor (; 9 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
get_global $std/constructor/b
if
@ -187,72 +205,53 @@
return
end
get_local $0
if (result i32)
get_local $0
else
block (result i32)
i32.const 0
call $~lib/memory/memory.allocate
set_local $1
get_local $1
end
tee_local $0
i32.eqz
if
i32.const 0
call $~lib/memory/memory.allocate
set_local $0
end
tee_local $0
)
(func $std/constructor/CtorAllocates#constructor (; 7 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
get_local $0
if (result i32)
)
(func $std/constructor/CtorAllocates#constructor (; 10 ;) (type $ii) (param $0 i32) (result i32)
block (result i32)
get_local $0
else
block (result i32)
i32.eqz
if
i32.const 0
call $~lib/memory/memory.allocate
set_local $1
get_local $1
set_local $0
end
tee_local $0
get_local $0
end
tee_local $0
drop
get_local $0
)
(func $std/constructor/CtorConditionallyAllocates#constructor (; 8 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
(func $std/constructor/CtorConditionallyAllocates#constructor (; 11 ;) (type $ii) (param $0 i32) (result i32)
get_global $std/constructor/b
if
get_local $0
if (result i32)
block (result i32)
get_local $0
else
block (result i32)
i32.eqz
if
i32.const 0
call $~lib/memory/memory.allocate
set_local $1
get_local $1
set_local $0
end
tee_local $0
get_local $0
end
tee_local $0
drop
end
get_local $0
if (result i32)
get_local $0
else
block (result i32)
i32.const 0
call $~lib/memory/memory.allocate
set_local $1
get_local $1
end
tee_local $0
i32.eqz
if
i32.const 0
call $~lib/memory/memory.allocate
set_local $0
end
tee_local $0
get_local $0
)
(func $start (; 9 ;) (type $v)
(local $0 i32)
(func $start (; 12 ;) (type $v)
get_global $HEAP_BASE
get_global $~lib/internal/allocator/AL_MASK
i32.add
@ -272,32 +271,14 @@
i32.const 0
call $std/constructor/EmptyCtorWithFieldNoInit#constructor
set_global $std/constructor/emptyCtorWithFieldNoInit
block (result i32)
i32.const 0
call $~lib/memory/memory.allocate
set_local $0
get_local $0
end
i32.const 0
call $std/constructor/None#constructor
set_global $std/constructor/none
block (result i32)
i32.const 4
call $~lib/memory/memory.allocate
set_local $0
get_local $0
i32.const 1
i32.store
get_local $0
end
i32.const 0
call $std/constructor/JustFieldInit#constructor
set_global $std/constructor/justFieldInit
block (result i32)
i32.const 4
call $~lib/memory/memory.allocate
set_local $0
get_local $0
i32.const 0
i32.store
get_local $0
end
i32.const 0
call $std/constructor/JustFieldNoInit#constructor
set_global $std/constructor/justFieldNoInit
i32.const 0
call $std/constructor/CtorReturns#constructor
@ -312,6 +293,6 @@
call $std/constructor/CtorConditionallyAllocates#constructor
set_global $std/constructor/ctorConditionallyAllocates
)
(func $null (; 10 ;) (type $v)
(func $null (; 13 ;) (type $v)
)
)

View File

@ -8,7 +8,6 @@
(type $iiii (func (param i32 i32 i32) (result i32)))
(type $v (func))
(type $FUNCSIG$vii (func (param i32 i32)))
(type $FUNCSIG$i (func (result i32)))
(type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32)))
(type $FUNCSIG$dii (func (param i32 i32) (result f64)))
(type $FUNCSIG$jii (func (param i32 i32) (result i64)))
@ -339,19 +338,34 @@
end
end
)
(func $~lib/internal/typedarray/TypedArray<u8>#constructor (; 4 ;) (type $FUNCSIG$i) (result i32)
(local $0 i32)
(local $1 i32)
i32.const 8
(func $~lib/internal/typedarray/TypedArray<u8>#constructor (; 4 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
get_local $1
i32.const 1073741816
i32.gt_u
if
i32.const 0
i32.const 8
i32.const 23
i32.const 34
call $~lib/env/abort
unreachable
end
get_local $1
call $~lib/internal/arraybuffer/allocateUnsafe
tee_local $1
tee_local $2
i32.const 8
i32.add
i32.const 8
get_local $1
call $~lib/internal/memory/memset
i32.const 12
call $~lib/allocator/arena/__memory_allocate
tee_local $0
get_local $0
i32.eqz
if
i32.const 12
call $~lib/allocator/arena/__memory_allocate
set_local $0
end
get_local $0
i32.const 0
i32.store
get_local $0
@ -361,13 +375,13 @@
i32.const 0
i32.store offset=8
get_local $0
get_local $1
get_local $2
i32.store
get_local $0
i32.const 0
i32.store offset=4
get_local $0
i32.const 8
get_local $1
i32.store offset=8
get_local $0
)
@ -1082,6 +1096,9 @@
set_global $~lib/allocator/arena/startOffset
get_global $~lib/allocator/arena/startOffset
set_global $~lib/allocator/arena/offset
i32.const 12
call $~lib/allocator/arena/__memory_allocate
i32.const 8
call $~lib/internal/typedarray/TypedArray<u8>#constructor
set_global $std/dataview/array
get_global $std/dataview/array

View File

@ -448,28 +448,25 @@
get_local $5
get_local $2
call $~lib/internal/memory/memset
get_local $0
if (result i32)
block (result i32)
get_local $0
else
block (result i32)
i32.eqz
if
i32.const 12
call $~lib/memory/memory.allocate
set_local $5
get_local $5
i32.const 0
i32.store
get_local $5
i32.const 0
i32.store offset=4
get_local $5
i32.const 0
i32.store offset=8
get_local $5
set_local $0
end
tee_local $0
get_local $0
i32.const 0
i32.store
get_local $0
i32.const 0
i32.store offset=4
get_local $0
i32.const 0
i32.store offset=8
get_local $0
end
tee_local $0
get_local $3
i32.store
get_local $0
@ -480,7 +477,21 @@
i32.store offset=8
get_local $0
)
(func $~lib/internal/typedarray/TypedArray<u8>#__set (; 7 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
(func $~lib/typedarray/Uint8Array#constructor (; 7 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
get_local $0
i32.eqz
if
i32.const 12
call $~lib/memory/memory.allocate
set_local $0
end
get_local $0
get_local $1
call $~lib/internal/typedarray/TypedArray<u8>#constructor
set_local $0
get_local $0
)
(func $~lib/internal/typedarray/TypedArray<u8>#__set (; 8 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
(local $3 i32)
(local $4 i32)
get_local $1
@ -513,8 +524,7 @@
get_local $2
i32.store8 offset=8
)
(func $~lib/dataview/DataView#constructor (; 8 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32)
(local $4 i32)
(func $~lib/dataview/DataView#constructor (; 9 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32)
get_local $3
get_global $~lib/builtins/i32.MIN_VALUE
i32.eq
@ -562,29 +572,24 @@
unreachable
end
get_local $0
if (result i32)
get_local $0
else
block (result i32)
i32.const 12
call $~lib/memory/memory.allocate
set_local $4
get_local $4
get_local $1
i32.store
get_local $4
get_local $2
i32.store offset=4
get_local $4
get_local $3
i32.store offset=8
get_local $4
end
tee_local $0
i32.eqz
if
i32.const 12
call $~lib/memory/memory.allocate
set_local $0
end
tee_local $0
get_local $0
get_local $1
i32.store
get_local $0
get_local $2
i32.store offset=4
get_local $0
get_local $3
i32.store offset=8
get_local $0
)
(func $~lib/polyfills/bswap<u32> (; 9 ;) (type $ii) (param $0 i32) (result i32)
(func $~lib/polyfills/bswap<u32> (; 10 ;) (type $ii) (param $0 i32) (result i32)
get_local $0
i32.const -16711936
i32.and
@ -598,7 +603,7 @@
i32.or
return
)
(func $~lib/dataview/DataView#getFloat32 (; 10 ;) (type $iiif) (param $0 i32) (param $1 i32) (param $2 i32) (result f32)
(func $~lib/dataview/DataView#getFloat32 (; 11 ;) (type $iiif) (param $0 i32) (param $1 i32) (param $2 i32) (result f32)
(local $3 i32)
(local $4 i32)
(local $5 i32)
@ -653,7 +658,7 @@
f32.reinterpret/i32
end
)
(func $~lib/polyfills/bswap<u64> (; 11 ;) (type $II) (param $0 i64) (result i64)
(func $~lib/polyfills/bswap<u64> (; 12 ;) (type $II) (param $0 i64) (result i64)
(local $1 i64)
(local $2 i64)
(local $3 i64)
@ -692,7 +697,7 @@
i64.rotr
return
)
(func $~lib/dataview/DataView#getFloat64 (; 12 ;) (type $iiiF) (param $0 i32) (param $1 i32) (param $2 i32) (result f64)
(func $~lib/dataview/DataView#getFloat64 (; 13 ;) (type $iiiF) (param $0 i32) (param $1 i32) (param $2 i32) (result f64)
(local $3 i32)
(local $4 i32)
(local $5 i32)
@ -747,7 +752,7 @@
f64.reinterpret/i64
end
)
(func $~lib/dataview/DataView#getInt8 (; 13 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(func $~lib/dataview/DataView#getInt8 (; 14 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(local $3 i32)
(local $4 i32)
@ -786,7 +791,7 @@
i32.add
i32.load8_s offset=8
)
(func $~lib/polyfills/bswap<i16> (; 14 ;) (type $ii) (param $0 i32) (result i32)
(func $~lib/polyfills/bswap<i16> (; 15 ;) (type $ii) (param $0 i32) (result i32)
get_local $0
i32.const 8
i32.shl
@ -802,7 +807,7 @@
i32.or
return
)
(func $~lib/dataview/DataView#getInt16 (; 15 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(func $~lib/dataview/DataView#getInt16 (; 16 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(local $3 i32)
(local $4 i32)
(local $5 i32)
@ -852,7 +857,7 @@
call $~lib/polyfills/bswap<i16>
end
)
(func $~lib/polyfills/bswap<i32> (; 16 ;) (type $ii) (param $0 i32) (result i32)
(func $~lib/polyfills/bswap<i32> (; 17 ;) (type $ii) (param $0 i32) (result i32)
get_local $0
i32.const -16711936
i32.and
@ -866,7 +871,7 @@
i32.or
return
)
(func $~lib/dataview/DataView#getInt32 (; 17 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(func $~lib/dataview/DataView#getInt32 (; 18 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(local $3 i32)
(local $4 i32)
(local $5 i32)
@ -916,7 +921,7 @@
call $~lib/polyfills/bswap<i32>
end
)
(func $~lib/polyfills/bswap<i64> (; 18 ;) (type $II) (param $0 i64) (result i64)
(func $~lib/polyfills/bswap<i64> (; 19 ;) (type $II) (param $0 i64) (result i64)
(local $1 i64)
(local $2 i64)
(local $3 i64)
@ -955,7 +960,7 @@
i64.rotr
return
)
(func $~lib/dataview/DataView#getInt64 (; 19 ;) (type $iiiI) (param $0 i32) (param $1 i32) (param $2 i32) (result i64)
(func $~lib/dataview/DataView#getInt64 (; 20 ;) (type $iiiI) (param $0 i32) (param $1 i32) (param $2 i32) (result i64)
(local $3 i32)
(local $4 i32)
(local $5 i32)
@ -1005,7 +1010,7 @@
call $~lib/polyfills/bswap<i64>
end
)
(func $~lib/dataview/DataView#getUint8 (; 20 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(func $~lib/dataview/DataView#getUint8 (; 21 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(local $3 i32)
(local $4 i32)
@ -1044,7 +1049,7 @@
i32.add
i32.load8_u offset=8
)
(func $~lib/polyfills/bswap<u16> (; 21 ;) (type $ii) (param $0 i32) (result i32)
(func $~lib/polyfills/bswap<u16> (; 22 ;) (type $ii) (param $0 i32) (result i32)
get_local $0
i32.const 8
i32.shl
@ -1058,7 +1063,7 @@
i32.or
return
)
(func $~lib/dataview/DataView#getUint16 (; 22 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(func $~lib/dataview/DataView#getUint16 (; 23 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(local $3 i32)
(local $4 i32)
(local $5 i32)
@ -1108,7 +1113,7 @@
call $~lib/polyfills/bswap<u16>
end
)
(func $~lib/dataview/DataView#getUint32 (; 23 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(func $~lib/dataview/DataView#getUint32 (; 24 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(local $3 i32)
(local $4 i32)
(local $5 i32)
@ -1158,7 +1163,7 @@
call $~lib/polyfills/bswap<u32>
end
)
(func $~lib/dataview/DataView#getUint64 (; 24 ;) (type $iiiI) (param $0 i32) (param $1 i32) (param $2 i32) (result i64)
(func $~lib/dataview/DataView#getUint64 (; 25 ;) (type $iiiI) (param $0 i32) (param $1 i32) (param $2 i32) (result i64)
(local $3 i32)
(local $4 i32)
(local $5 i32)
@ -1208,7 +1213,7 @@
call $~lib/polyfills/bswap<u64>
end
)
(func $~lib/dataview/DataView#setFloat32 (; 25 ;) (type $iifiv) (param $0 i32) (param $1 i32) (param $2 f32) (param $3 i32)
(func $~lib/dataview/DataView#setFloat32 (; 26 ;) (type $iifiv) (param $0 i32) (param $1 i32) (param $2 f32) (param $3 i32)
(local $4 i32)
(local $5 i32)
(local $6 i32)
@ -1265,7 +1270,7 @@
i32.store offset=8
end
)
(func $~lib/dataview/DataView#setFloat64 (; 26 ;) (type $iiFiv) (param $0 i32) (param $1 i32) (param $2 f64) (param $3 i32)
(func $~lib/dataview/DataView#setFloat64 (; 27 ;) (type $iiFiv) (param $0 i32) (param $1 i32) (param $2 f64) (param $3 i32)
(local $4 i32)
(local $5 i32)
(local $6 i32)
@ -1322,7 +1327,7 @@
i64.store offset=8
end
)
(func $~lib/dataview/DataView#setInt8 (; 27 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
(func $~lib/dataview/DataView#setInt8 (; 28 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
(local $3 i32)
(local $4 i32)
(local $5 i32)
@ -1362,7 +1367,7 @@
get_local $2
i32.store8 offset=8
)
(func $~lib/dataview/DataView#setInt16 (; 28 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
(func $~lib/dataview/DataView#setInt16 (; 29 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
(local $4 i32)
(local $5 i32)
(local $6 i32)
@ -1410,7 +1415,7 @@
end
i32.store16 offset=8
)
(func $~lib/dataview/DataView#setInt32 (; 29 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
(func $~lib/dataview/DataView#setInt32 (; 30 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
(local $4 i32)
(local $5 i32)
(local $6 i32)
@ -1458,7 +1463,7 @@
end
i32.store offset=8
)
(func $~lib/dataview/DataView#setInt64 (; 30 ;) (type $iiIiv) (param $0 i32) (param $1 i32) (param $2 i64) (param $3 i32)
(func $~lib/dataview/DataView#setInt64 (; 31 ;) (type $iiIiv) (param $0 i32) (param $1 i32) (param $2 i64) (param $3 i32)
(local $4 i32)
(local $5 i32)
(local $6 i32)
@ -1506,7 +1511,7 @@
end
i64.store offset=8
)
(func $~lib/dataview/DataView#setUint8 (; 31 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
(func $~lib/dataview/DataView#setUint8 (; 32 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
(local $3 i32)
(local $4 i32)
(local $5 i32)
@ -1546,7 +1551,7 @@
get_local $2
i32.store8 offset=8
)
(func $~lib/dataview/DataView#setUint16 (; 32 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
(func $~lib/dataview/DataView#setUint16 (; 33 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
(local $4 i32)
(local $5 i32)
(local $6 i32)
@ -1594,7 +1599,7 @@
end
i32.store16 offset=8
)
(func $~lib/dataview/DataView#setUint32 (; 33 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
(func $~lib/dataview/DataView#setUint32 (; 34 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
(local $4 i32)
(local $5 i32)
(local $6 i32)
@ -1642,7 +1647,7 @@
end
i32.store offset=8
)
(func $~lib/dataview/DataView#setUint64 (; 34 ;) (type $iiIiv) (param $0 i32) (param $1 i32) (param $2 i64) (param $3 i32)
(func $~lib/dataview/DataView#setUint64 (; 35 ;) (type $iiIiv) (param $0 i32) (param $1 i32) (param $2 i64) (param $3 i32)
(local $4 i32)
(local $5 i32)
(local $6 i32)
@ -1690,7 +1695,7 @@
end
i64.store offset=8
)
(func $start (; 35 ;) (type $v)
(func $start (; 36 ;) (type $v)
get_global $HEAP_BASE
get_global $~lib/internal/allocator/AL_MASK
i32.add
@ -1703,7 +1708,7 @@
set_global $~lib/allocator/arena/offset
i32.const 0
i32.const 8
call $~lib/internal/typedarray/TypedArray<u8>#constructor
call $~lib/typedarray/Uint8Array#constructor
set_global $std/dataview/array
get_global $std/dataview/array
i32.const 0
@ -3383,6 +3388,6 @@
unreachable
end
)
(func $null (; 36 ;) (type $v)
(func $null (; 37 ;) (type $v)
)
)

View File

@ -111,23 +111,19 @@
return
)
(func $~lib/date/Date#constructor (; 5 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32)
(local $2 i32)
get_local $0
if (result i32)
block (result i32)
get_local $0
else
block (result i32)
i32.eqz
if
i32.const 8
call $~lib/memory/memory.allocate
set_local $2
get_local $2
i64.const 0
i64.store
get_local $2
set_local $0
end
tee_local $0
get_local $0
i64.const 0
i64.store
get_local $0
end
tee_local $0
get_local $1
i64.store
get_local $0

View File

@ -1,4 +1,5 @@
(module
(type $iii (func (param i32 i32) (result i32)))
(type $v (func))
(type $ii (func (param i32) (result i32)))
(type $iv (func (param i32)))
@ -6,7 +7,7 @@
(type $FUNCSIG$i (func (result i32)))
(memory $0 0)
(table $0 4 anyfunc)
(elem (i32.const 0) $null $~lib/collector/itcm/__gc_mark $std/gc-object/Custom~gc $std/gc-object/Base~gc)
(elem (i32.const 0) $null $~lib/collector/itcm/__gc_mark $std/gc-object/Base~gc $std/gc-object/Custom~gc)
(global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0))
(global $~lib/allocator/arena/offset (mut i32) (i32.const 0))
(global $~lib/collector/itcm/state (mut i32) (i32.const 0))
@ -302,26 +303,34 @@
end
end
)
(func $~lib/collector/itcm/__gc_allocate (; 5 ;) (type $FUNCSIG$i) (result i32)
(local $0 i32)
(func $~lib/collector/itcm/__gc_allocate (; 5 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
get_local $0
i32.const 1073741808
i32.gt_u
if
unreachable
end
call $~lib/collector/itcm/step
i32.const 24
get_local $0
i32.const 16
i32.add
call $~lib/allocator/arena/__memory_allocate
tee_local $0
i32.const 2
tee_local $2
get_local $1
i32.store offset=8
get_local $0
get_local $2
get_global $~lib/collector/itcm/white
get_local $0
get_local $2
i32.load
i32.const -4
i32.and
i32.or
i32.store
get_global $~lib/collector/itcm/fromSpace
get_local $0
get_local $2
call $~lib/collector/itcm/ManagedObjectList#push
get_local $0
get_local $2
i32.const 16
i32.add
)
@ -341,7 +350,7 @@
return
end
get_local $0
i32.const 3
i32.const 2
call_indirect (type $iv)
get_local $0
i32.load
@ -350,7 +359,28 @@
i32.load offset=4
call $~lib/collector/itcm/__gc_mark
)
(func $~lib/collector/itcm/__gc_collect (; 8 ;) (type $v)
(func $std/gc-object/Custom#constructor (; 8 ;) (type $FUNCSIG$i) (result i32)
(local $0 i32)
i32.const 8
i32.const 3
call $~lib/collector/itcm/__gc_allocate
tee_local $0
i32.eqz
if
i32.const 0
i32.const 2
call $~lib/collector/itcm/__gc_allocate
set_local $0
end
get_local $0
i32.const 0
i32.store
get_local $0
i32.const 0
i32.store offset=4
get_local $0
)
(func $~lib/collector/itcm/__gc_collect (; 9 ;) (type $v)
(local $0 i32)
block $break|0
block $case1|0
@ -376,7 +406,7 @@
end
end
)
(func $std/gc-object/main (; 9 ;) (type $v)
(func $std/gc-object/main (; 10 ;) (type $v)
get_global $~started
i32.eqz
if
@ -385,7 +415,7 @@
set_global $~started
end
)
(func $start (; 10 ;) (type $v)
(func $start (; 11 ;) (type $v)
(local $0 i32)
i32.const 8
set_global $~lib/allocator/arena/startOffset
@ -393,14 +423,7 @@
set_global $~lib/allocator/arena/offset
i32.const 0
set_global $~lib/collector/itcm/state
call $~lib/collector/itcm/__gc_allocate
tee_local $0
i32.const 0
i32.store
get_local $0
i32.const 0
i32.store offset=4
get_local $0
call $std/gc-object/Custom#constructor
set_global $std/gc-object/obj
call $~lib/collector/itcm/__gc_collect
get_global $std/gc-object/obj
@ -412,7 +435,7 @@
set_global $std/gc-object/obj
call $~lib/collector/itcm/__gc_collect
)
(func $null (; 11 ;) (type $v)
(func $null (; 12 ;) (type $v)
nop
)
)

View File

@ -6,7 +6,7 @@
(type $iiv (func (param i32 i32)))
(memory $0 0)
(table $0 4 anyfunc)
(elem (i32.const 0) $null $~lib/collector/itcm/__gc_mark $std/gc-object/Custom~gc $std/gc-object/Base~gc)
(elem (i32.const 0) $null $~lib/collector/itcm/__gc_mark $std/gc-object/Base~gc $std/gc-object/Custom~gc)
(global $~lib/internal/allocator/AL_BITS i32 (i32.const 3))
(global $~lib/internal/allocator/AL_SIZE i32 (i32.const 8))
(global $~lib/internal/allocator/AL_MASK i32 (i32.const 7))
@ -444,14 +444,25 @@
get_local $0
call $~lib/collector/itcm/__gc_mark
)
(func $std/gc-object/Custom~gc (; 14 ;) (type $iv) (param $0 i32)
(func $std/gc-object/Base#constructor (; 14 ;) (type $ii) (param $0 i32) (result i32)
get_local $0
i32.eqz
if
i32.const 0
i32.const 2
call $~lib/collector/itcm/__gc_allocate
set_local $0
end
get_local $0
)
(func $std/gc-object/Custom~gc (; 15 ;) (type $iv) (param $0 i32)
get_local $0
i32.eqz
if
return
end
get_local $0
i32.const 3
i32.const 2
call_indirect (type $iv)
get_local $0
i32.load
@ -460,7 +471,27 @@
i32.load offset=4
call $~lib/collector/itcm/__gc_mark
)
(func $~lib/collector/itcm/__gc_collect (; 15 ;) (type $v)
(func $std/gc-object/Custom#constructor (; 16 ;) (type $ii) (param $0 i32) (result i32)
get_local $0
i32.eqz
if
i32.const 8
i32.const 3
call $~lib/collector/itcm/__gc_allocate
set_local $0
end
get_local $0
call $std/gc-object/Base#constructor
set_local $0
get_local $0
i32.const 0
i32.store
get_local $0
i32.const 0
i32.store offset=4
get_local $0
)
(func $~lib/collector/itcm/__gc_collect (; 17 ;) (type $v)
(local $0 i32)
block $break|0
block $case1|0
@ -492,11 +523,11 @@
end
end
)
(func $~lib/gc/gc.collect (; 16 ;) (type $v)
(func $~lib/gc/gc.collect (; 18 ;) (type $v)
call $~lib/collector/itcm/__gc_collect
return
)
(func $std/gc-object/main (; 17 ;) (type $v)
(func $std/gc-object/main (; 19 ;) (type $v)
get_global $~started
i32.eqz
if
@ -505,8 +536,7 @@
set_global $~started
end
)
(func $start (; 18 ;) (type $v)
(local $0 i32)
(func $start (; 20 ;) (type $v)
get_global $HEAP_BASE
get_global $~lib/internal/allocator/AL_MASK
i32.add
@ -519,19 +549,8 @@
set_global $~lib/allocator/arena/offset
get_global $~lib/collector/itcm/State.INIT
set_global $~lib/collector/itcm/state
block (result i32)
i32.const 8
i32.const 2
call $~lib/collector/itcm/__gc_allocate
set_local $0
get_local $0
i32.const 0
i32.store
get_local $0
i32.const 0
i32.store offset=4
get_local $0
end
i32.const 0
call $std/gc-object/Custom#constructor
set_global $std/gc-object/obj
call $~lib/gc/gc.collect
get_global $std/gc-object/obj
@ -542,9 +561,9 @@
set_global $std/gc-object/obj
call $~lib/gc/gc.collect
)
(func $null (; 19 ;) (type $v)
(func $null (; 21 ;) (type $v)
)
(func $~iterateRoots (; 20 ;) (type $iv) (param $0 i32)
(func $~iterateRoots (; 22 ;) (type $iv) (param $0 i32)
get_global $std/gc-object/obj
get_local $0
call_indirect (type $iv)

View File

@ -487,38 +487,34 @@
i32.store offset=20
)
(func $~lib/map/Map<i8,i32>#constructor (; 8 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
get_local $0
if (result i32)
block (result i32)
get_local $0
else
block (result i32)
i32.eqz
if
i32.const 24
call $~lib/memory/memory.allocate
set_local $1
get_local $1
i32.const 0
i32.store
get_local $1
i32.const 0
i32.store offset=4
get_local $1
i32.const 0
i32.store offset=8
get_local $1
i32.const 0
i32.store offset=12
get_local $1
i32.const 0
i32.store offset=16
get_local $1
i32.const 0
i32.store offset=20
get_local $1
set_local $0
end
tee_local $0
get_local $0
i32.const 0
i32.store
get_local $0
i32.const 0
i32.store offset=4
get_local $0
i32.const 0
i32.store offset=8
get_local $0
i32.const 0
i32.store offset=12
get_local $0
i32.const 0
i32.store offset=16
get_local $0
i32.const 0
i32.store offset=20
get_local $0
end
tee_local $0
call $~lib/map/Map<i8,i32>#clear
get_local $0
)
@ -1363,38 +1359,34 @@
i32.store offset=20
)
(func $~lib/map/Map<u8,i32>#constructor (; 19 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
get_local $0
if (result i32)
block (result i32)
get_local $0
else
block (result i32)
i32.eqz
if
i32.const 24
call $~lib/memory/memory.allocate
set_local $1
get_local $1
i32.const 0
i32.store
get_local $1
i32.const 0
i32.store offset=4
get_local $1
i32.const 0
i32.store offset=8
get_local $1
i32.const 0
i32.store offset=12
get_local $1
i32.const 0
i32.store offset=16
get_local $1
i32.const 0
i32.store offset=20
get_local $1
set_local $0
end
tee_local $0
get_local $0
i32.const 0
i32.store
get_local $0
i32.const 0
i32.store offset=4
get_local $0
i32.const 0
i32.store offset=8
get_local $0
i32.const 0
i32.store offset=12
get_local $0
i32.const 0
i32.store offset=16
get_local $0
i32.const 0
i32.store offset=20
get_local $0
end
tee_local $0
call $~lib/map/Map<u8,i32>#clear
get_local $0
)
@ -2208,38 +2200,34 @@
i32.store offset=20
)
(func $~lib/map/Map<i16,i32>#constructor (; 29 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
get_local $0
if (result i32)
block (result i32)
get_local $0
else
block (result i32)
i32.eqz
if
i32.const 24
call $~lib/memory/memory.allocate
set_local $1
get_local $1
i32.const 0
i32.store
get_local $1
i32.const 0
i32.store offset=4
get_local $1
i32.const 0
i32.store offset=8
get_local $1
i32.const 0
i32.store offset=12
get_local $1
i32.const 0
i32.store offset=16
get_local $1
i32.const 0
i32.store offset=20
get_local $1
set_local $0
end
tee_local $0
get_local $0
i32.const 0
i32.store
get_local $0
i32.const 0
i32.store offset=4
get_local $0
i32.const 0
i32.store offset=8
get_local $0
i32.const 0
i32.store offset=12
get_local $0
i32.const 0
i32.store offset=16
get_local $0
i32.const 0
i32.store offset=20
get_local $0
end
tee_local $0
call $~lib/map/Map<i16,i32>#clear
get_local $0
)
@ -3099,38 +3087,34 @@
i32.store offset=20
)
(func $~lib/map/Map<u16,i32>#constructor (; 40 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
get_local $0
if (result i32)
block (result i32)
get_local $0
else
block (result i32)
i32.eqz
if
i32.const 24
call $~lib/memory/memory.allocate
set_local $1
get_local $1
i32.const 0
i32.store
get_local $1
i32.const 0
i32.store offset=4
get_local $1
i32.const 0
i32.store offset=8
get_local $1
i32.const 0
i32.store offset=12
get_local $1
i32.const 0
i32.store offset=16
get_local $1
i32.const 0
i32.store offset=20
get_local $1
set_local $0
end
tee_local $0
get_local $0
i32.const 0
i32.store
get_local $0
i32.const 0
i32.store offset=4
get_local $0
i32.const 0
i32.store offset=8
get_local $0
i32.const 0
i32.store offset=12
get_local $0
i32.const 0
i32.store offset=16
get_local $0
i32.const 0
i32.store offset=20
get_local $0
end
tee_local $0
call $~lib/map/Map<u16,i32>#clear
get_local $0
)
@ -3944,38 +3928,34 @@
i32.store offset=20
)
(func $~lib/map/Map<i32,i32>#constructor (; 50 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
get_local $0
if (result i32)
block (result i32)
get_local $0
else
block (result i32)
i32.eqz
if
i32.const 24
call $~lib/memory/memory.allocate
set_local $1
get_local $1
i32.const 0
i32.store
get_local $1
i32.const 0
i32.store offset=4
get_local $1
i32.const 0
i32.store offset=8
get_local $1
i32.const 0
i32.store offset=12
get_local $1
i32.const 0
i32.store offset=16
get_local $1
i32.const 0
i32.store offset=20
get_local $1
set_local $0
end
tee_local $0
get_local $0
i32.const 0
i32.store
get_local $0
i32.const 0
i32.store offset=4
get_local $0
i32.const 0
i32.store offset=8
get_local $0
i32.const 0
i32.store offset=12
get_local $0
i32.const 0
i32.store offset=16
get_local $0
i32.const 0
i32.store offset=20
get_local $0
end
tee_local $0
call $~lib/map/Map<i32,i32>#clear
get_local $0
)
@ -4807,38 +4787,34 @@
i32.store offset=20
)
(func $~lib/map/Map<u32,i32>#constructor (; 61 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
get_local $0
if (result i32)
block (result i32)
get_local $0
else
block (result i32)
i32.eqz
if
i32.const 24
call $~lib/memory/memory.allocate
set_local $1
get_local $1
i32.const 0
i32.store
get_local $1
i32.const 0
i32.store offset=4
get_local $1
i32.const 0
i32.store offset=8
get_local $1
i32.const 0
i32.store offset=12
get_local $1
i32.const 0
i32.store offset=16
get_local $1
i32.const 0
i32.store offset=20
get_local $1
set_local $0
end
tee_local $0
get_local $0
i32.const 0
i32.store
get_local $0
i32.const 0
i32.store offset=4
get_local $0
i32.const 0
i32.store offset=8
get_local $0
i32.const 0
i32.store offset=12
get_local $0
i32.const 0
i32.store offset=16
get_local $0
i32.const 0
i32.store offset=20
get_local $0
end
tee_local $0
call $~lib/map/Map<u32,i32>#clear
get_local $0
)
@ -5628,38 +5604,34 @@
i32.store offset=20
)
(func $~lib/map/Map<i64,i32>#constructor (; 71 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
get_local $0
if (result i32)
block (result i32)
get_local $0
else
block (result i32)
i32.eqz
if
i32.const 24
call $~lib/memory/memory.allocate
set_local $1
get_local $1
i32.const 0
i32.store
get_local $1
i32.const 0
i32.store offset=4
get_local $1
i32.const 0
i32.store offset=8
get_local $1
i32.const 0
i32.store offset=12
get_local $1
i32.const 0
i32.store offset=16
get_local $1
i32.const 0
i32.store offset=20
get_local $1
set_local $0
end
tee_local $0
get_local $0
i32.const 0
i32.store
get_local $0
i32.const 0
i32.store offset=4
get_local $0
i32.const 0
i32.store offset=8
get_local $0
i32.const 0
i32.store offset=12
get_local $0
i32.const 0
i32.store offset=16
get_local $0
i32.const 0
i32.store offset=20
get_local $0
end
tee_local $0
call $~lib/map/Map<i64,i32>#clear
get_local $0
)
@ -6545,38 +6517,34 @@
i32.store offset=20
)
(func $~lib/map/Map<u64,i32>#constructor (; 82 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
get_local $0
if (result i32)
block (result i32)
get_local $0
else
block (result i32)
i32.eqz
if
i32.const 24
call $~lib/memory/memory.allocate
set_local $1
get_local $1
i32.const 0
i32.store
get_local $1
i32.const 0
i32.store offset=4
get_local $1
i32.const 0
i32.store offset=8
get_local $1
i32.const 0
i32.store offset=12
get_local $1
i32.const 0
i32.store offset=16
get_local $1
i32.const 0
i32.store offset=20
get_local $1
set_local $0
end
tee_local $0
get_local $0
i32.const 0
i32.store
get_local $0
i32.const 0
i32.store offset=4
get_local $0
i32.const 0
i32.store offset=8
get_local $0
i32.const 0
i32.store offset=12
get_local $0
i32.const 0
i32.store offset=16
get_local $0
i32.const 0
i32.store offset=20
get_local $0
end
tee_local $0
call $~lib/map/Map<u64,i32>#clear
get_local $0
)
@ -7374,38 +7342,34 @@
i32.store offset=20
)
(func $~lib/map/Map<f32,i32>#constructor (; 92 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
get_local $0
if (result i32)
block (result i32)
get_local $0
else
block (result i32)
i32.eqz
if
i32.const 24
call $~lib/memory/memory.allocate
set_local $1
get_local $1
i32.const 0
i32.store
get_local $1
i32.const 0
i32.store offset=4
get_local $1
i32.const 0
i32.store offset=8
get_local $1
i32.const 0
i32.store offset=12
get_local $1
i32.const 0
i32.store offset=16
get_local $1
i32.const 0
i32.store offset=20
get_local $1
set_local $0
end
tee_local $0
get_local $0
i32.const 0
i32.store
get_local $0
i32.const 0
i32.store offset=4
get_local $0
i32.const 0
i32.store offset=8
get_local $0
i32.const 0
i32.store offset=12
get_local $0
i32.const 0
i32.store offset=16
get_local $0
i32.const 0
i32.store offset=20
get_local $0
end
tee_local $0
call $~lib/map/Map<f32,i32>#clear
get_local $0
)
@ -8208,38 +8172,34 @@
i32.store offset=20
)
(func $~lib/map/Map<f64,i32>#constructor (; 102 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
get_local $0
if (result i32)
block (result i32)
get_local $0
else
block (result i32)
i32.eqz
if
i32.const 24
call $~lib/memory/memory.allocate
set_local $1
get_local $1
i32.const 0
i32.store
get_local $1
i32.const 0
i32.store offset=4
get_local $1
i32.const 0
i32.store offset=8
get_local $1
i32.const 0
i32.store offset=12
get_local $1
i32.const 0
i32.store offset=16
get_local $1
i32.const 0
i32.store offset=20
get_local $1
set_local $0
end
tee_local $0
get_local $0
i32.const 0
i32.store
get_local $0
i32.const 0
i32.store offset=4
get_local $0
i32.const 0
i32.store offset=8
get_local $0
i32.const 0
i32.store offset=12
get_local $0
i32.const 0
i32.store offset=16
get_local $0
i32.const 0
i32.store offset=20
get_local $0
end
tee_local $0
call $~lib/map/Map<f64,i32>#clear
get_local $0
)

View File

@ -101,27 +101,23 @@
return
)
(func $std/new/AClass#constructor (; 2 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32)
(local $2 i32)
get_local $0
get_local $0
if (result i32)
block (result i32)
get_local $0
else
block (result i32)
i32.eqz
if
i32.const 8
call $~lib/memory/memory.allocate
set_local $2
get_local $2
i32.const 1
i32.store
get_local $2
f32.const 2
f32.store offset=4
get_local $2
set_local $0
end
tee_local $0
get_local $0
i32.const 1
i32.store
get_local $0
f32.const 2
f32.store offset=4
get_local $0
end
tee_local $0
i32.load
i32.const 1
i32.add

View File

@ -174,26 +174,20 @@
return
)
(func $std/operator-overloading/Tester#constructor (; 3 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(local $3 i32)
get_local $0
if (result i32)
get_local $0
else
block (result i32)
i32.const 8
call $~lib/memory/memory.allocate
set_local $3
get_local $3
get_local $1
i32.store
get_local $3
get_local $2
i32.store offset=4
get_local $3
end
tee_local $0
i32.eqz
if
i32.const 8
call $~lib/memory/memory.allocate
set_local $0
end
tee_local $0
get_local $0
get_local $1
i32.store
get_local $0
get_local $2
i32.store offset=4
get_local $0
)
(func $std/operator-overloading/Tester.add (; 4 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
i32.const 0
@ -1751,48 +1745,36 @@
call $std/operator-overloading/Tester#constructor
)
(func $std/operator-overloading/TesterInlineStatic#constructor (; 32 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(local $3 i32)
get_local $0
if (result i32)
get_local $0
else
block (result i32)
i32.const 8
call $~lib/memory/memory.allocate
set_local $3
get_local $3
get_local $1
i32.store
get_local $3
get_local $2
i32.store offset=4
get_local $3
end
tee_local $0
i32.eqz
if
i32.const 8
call $~lib/memory/memory.allocate
set_local $0
end
tee_local $0
get_local $0
get_local $1
i32.store
get_local $0
get_local $2
i32.store offset=4
get_local $0
)
(func $std/operator-overloading/TesterInlineInstance#constructor (; 33 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(local $3 i32)
get_local $0
if (result i32)
get_local $0
else
block (result i32)
i32.const 8
call $~lib/memory/memory.allocate
set_local $3
get_local $3
get_local $1
i32.store
get_local $3
get_local $2
i32.store offset=4
get_local $3
end
tee_local $0
i32.eqz
if
i32.const 8
call $~lib/memory/memory.allocate
set_local $0
end
tee_local $0
get_local $0
get_local $1
i32.store
get_local $0
get_local $2
i32.store offset=4
get_local $0
)
(func $start (; 34 ;) (type $v)
(local $0 i32)

View File

@ -1760,13 +1760,21 @@
(local $0 i32)
(local $1 i32)
(local $2 f32)
i32.const 0
i32.const 8
call $std/pointer/Pointer<Entry>#constructor
block $std/pointer/Pointer<Entry>#constructor|inlined.0 (result i32)
i32.const 0
set_local $0
i32.const 8
set_local $1
get_local $1
end
set_global $std/pointer/one
i32.const 0
i32.const 24
call $std/pointer/Pointer<Entry>#constructor
block $std/pointer/Pointer<Entry>#constructor|inlined.1 (result i32)
i32.const 0
set_local $1
i32.const 24
set_local $0
get_local $0
end
set_global $std/pointer/two
block $std/pointer/Pointer<Entry>#get:offset|inlined.0 (result i32)
get_global $std/pointer/one
@ -2108,9 +2116,13 @@
call $~lib/env/abort
unreachable
end
i32.const 0
i32.const 0
call $std/pointer/Pointer<f32>#constructor
block $std/pointer/Pointer<f32>#constructor|inlined.0 (result i32)
i32.const 0
set_local $0
i32.const 0
set_local $1
get_local $1
end
set_global $std/pointer/buf
get_global $std/pointer/buf
i32.const 0
@ -2150,11 +2162,11 @@
end
block $std/pointer/Pointer<f32>#get|inlined.0 (result f32)
get_global $std/pointer/buf
set_local $0
i32.const 0
set_local $1
get_local $0
i32.const 0
set_local $0
get_local $1
get_local $0
i32.const 4
i32.mul
i32.add
@ -2173,11 +2185,11 @@
end
block $std/pointer/Pointer<f32>#get|inlined.1 (result f32)
get_global $std/pointer/buf
set_local $1
i32.const 1
set_local $0
get_local $1
i32.const 1
set_local $1
get_local $0
get_local $1
i32.const 4
i32.mul
i32.add
@ -2222,13 +2234,13 @@
end
block
get_global $std/pointer/buf
set_local $0
i32.const 2
set_local $1
i32.const 2
set_local $0
f32.const 1.2999999523162842
set_local $2
get_local $0
get_local $1
get_local $0
i32.const 4
i32.mul
i32.add
@ -2251,11 +2263,11 @@
end
block $std/pointer/Pointer<f32>#get|inlined.2 (result f32)
get_global $std/pointer/buf
set_local $1
i32.const 2
set_local $0
get_local $1
i32.const 2
set_local $1
get_local $0
get_local $1
i32.const 4
i32.mul
i32.add
@ -2290,8 +2302,8 @@
call $std/pointer/Pointer<f32>#set:value
block $std/pointer/Pointer<f32>#get:value|inlined.0 (result f32)
get_global $std/pointer/buf
set_local $0
get_local $0
set_local $1
get_local $1
f32.load
br $std/pointer/Pointer<f32>#get:value|inlined.0
end

View File

@ -489,38 +489,34 @@
i32.store offset=20
)
(func $~lib/set/Set<i8>#constructor (; 8 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
get_local $0
if (result i32)
block (result i32)
get_local $0
else
block (result i32)
i32.eqz
if
i32.const 24
call $~lib/memory/memory.allocate
set_local $1
get_local $1
i32.const 0
i32.store
get_local $1
i32.const 0
i32.store offset=4
get_local $1
i32.const 0
i32.store offset=8
get_local $1
i32.const 0
i32.store offset=12
get_local $1
i32.const 0
i32.store offset=16
get_local $1
i32.const 0
i32.store offset=20
get_local $1
set_local $0
end
tee_local $0
get_local $0
i32.const 0
i32.store
get_local $0
i32.const 0
i32.store offset=4
get_local $0
i32.const 0
i32.store offset=8
get_local $0
i32.const 0
i32.store offset=12
get_local $0
i32.const 0
i32.store offset=16
get_local $0
i32.const 0
i32.store offset=20
get_local $0
end
tee_local $0
call $~lib/set/Set<i8>#clear
get_local $0
)
@ -1226,38 +1222,34 @@
i32.store offset=20
)
(func $~lib/set/Set<u8>#constructor (; 19 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
get_local $0
if (result i32)
block (result i32)
get_local $0
else
block (result i32)
i32.eqz
if
i32.const 24
call $~lib/memory/memory.allocate
set_local $1
get_local $1
i32.const 0
i32.store
get_local $1
i32.const 0
i32.store offset=4
get_local $1
i32.const 0
i32.store offset=8
get_local $1
i32.const 0
i32.store offset=12
get_local $1
i32.const 0
i32.store offset=16
get_local $1
i32.const 0
i32.store offset=20
get_local $1
set_local $0
end
tee_local $0
get_local $0
i32.const 0
i32.store
get_local $0
i32.const 0
i32.store offset=4
get_local $0
i32.const 0
i32.store offset=8
get_local $0
i32.const 0
i32.store offset=12
get_local $0
i32.const 0
i32.store offset=16
get_local $0
i32.const 0
i32.store offset=20
get_local $0
end
tee_local $0
call $~lib/set/Set<u8>#clear
get_local $0
)
@ -1950,38 +1942,34 @@
i32.store offset=20
)
(func $~lib/set/Set<i16>#constructor (; 29 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
get_local $0
if (result i32)
block (result i32)
get_local $0
else
block (result i32)
i32.eqz
if
i32.const 24
call $~lib/memory/memory.allocate
set_local $1
get_local $1
i32.const 0
i32.store
get_local $1
i32.const 0
i32.store offset=4
get_local $1
i32.const 0
i32.store offset=8
get_local $1
i32.const 0
i32.store offset=12
get_local $1
i32.const 0
i32.store offset=16
get_local $1
i32.const 0
i32.store offset=20
get_local $1
set_local $0
end
tee_local $0
get_local $0
i32.const 0
i32.store
get_local $0
i32.const 0
i32.store offset=4
get_local $0
i32.const 0
i32.store offset=8
get_local $0
i32.const 0
i32.store offset=12
get_local $0
i32.const 0
i32.store offset=16
get_local $0
i32.const 0
i32.store offset=20
get_local $0
end
tee_local $0
call $~lib/set/Set<i16>#clear
get_local $0
)
@ -2702,38 +2690,34 @@
i32.store offset=20
)
(func $~lib/set/Set<u16>#constructor (; 40 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
get_local $0
if (result i32)
block (result i32)
get_local $0
else
block (result i32)
i32.eqz
if
i32.const 24
call $~lib/memory/memory.allocate
set_local $1
get_local $1
i32.const 0
i32.store
get_local $1
i32.const 0
i32.store offset=4
get_local $1
i32.const 0
i32.store offset=8
get_local $1
i32.const 0
i32.store offset=12
get_local $1
i32.const 0
i32.store offset=16
get_local $1
i32.const 0
i32.store offset=20
get_local $1
set_local $0
end
tee_local $0
get_local $0
i32.const 0
i32.store
get_local $0
i32.const 0
i32.store offset=4
get_local $0
i32.const 0
i32.store offset=8
get_local $0
i32.const 0
i32.store offset=12
get_local $0
i32.const 0
i32.store offset=16
get_local $0
i32.const 0
i32.store offset=20
get_local $0
end
tee_local $0
call $~lib/set/Set<u16>#clear
get_local $0
)
@ -3426,38 +3410,34 @@
i32.store offset=20
)
(func $~lib/set/Set<i32>#constructor (; 50 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
get_local $0
if (result i32)
block (result i32)
get_local $0
else
block (result i32)
i32.eqz
if
i32.const 24
call $~lib/memory/memory.allocate
set_local $1
get_local $1
i32.const 0
i32.store
get_local $1
i32.const 0
i32.store offset=4
get_local $1
i32.const 0
i32.store offset=8
get_local $1
i32.const 0
i32.store offset=12
get_local $1
i32.const 0
i32.store offset=16
get_local $1
i32.const 0
i32.store offset=20
get_local $1
set_local $0
end
tee_local $0
get_local $0
i32.const 0
i32.store
get_local $0
i32.const 0
i32.store offset=4
get_local $0
i32.const 0
i32.store offset=8
get_local $0
i32.const 0
i32.store offset=12
get_local $0
i32.const 0
i32.store offset=16
get_local $0
i32.const 0
i32.store offset=20
get_local $0
end
tee_local $0
call $~lib/set/Set<i32>#clear
get_local $0
)
@ -4186,38 +4166,34 @@
i32.store offset=20
)
(func $~lib/set/Set<u32>#constructor (; 61 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
get_local $0
if (result i32)
block (result i32)
get_local $0
else
block (result i32)
i32.eqz
if
i32.const 24
call $~lib/memory/memory.allocate
set_local $1
get_local $1
i32.const 0
i32.store
get_local $1
i32.const 0
i32.store offset=4
get_local $1
i32.const 0
i32.store offset=8
get_local $1
i32.const 0
i32.store offset=12
get_local $1
i32.const 0
i32.store offset=16
get_local $1
i32.const 0
i32.store offset=20
get_local $1
set_local $0
end
tee_local $0
get_local $0
i32.const 0
i32.store
get_local $0
i32.const 0
i32.store offset=4
get_local $0
i32.const 0
i32.store offset=8
get_local $0
i32.const 0
i32.store offset=12
get_local $0
i32.const 0
i32.store offset=16
get_local $0
i32.const 0
i32.store offset=20
get_local $0
end
tee_local $0
call $~lib/set/Set<u32>#clear
get_local $0
)
@ -4904,38 +4880,34 @@
i32.store offset=20
)
(func $~lib/set/Set<i64>#constructor (; 71 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
get_local $0
if (result i32)
block (result i32)
get_local $0
else
block (result i32)
i32.eqz
if
i32.const 24
call $~lib/memory/memory.allocate
set_local $1
get_local $1
i32.const 0
i32.store
get_local $1
i32.const 0
i32.store offset=4
get_local $1
i32.const 0
i32.store offset=8
get_local $1
i32.const 0
i32.store offset=12
get_local $1
i32.const 0
i32.store offset=16
get_local $1
i32.const 0
i32.store offset=20
get_local $1
set_local $0
end
tee_local $0
get_local $0
i32.const 0
i32.store
get_local $0
i32.const 0
i32.store offset=4
get_local $0
i32.const 0
i32.store offset=8
get_local $0
i32.const 0
i32.store offset=12
get_local $0
i32.const 0
i32.store offset=16
get_local $0
i32.const 0
i32.store offset=20
get_local $0
end
tee_local $0
call $~lib/set/Set<i64>#clear
get_local $0
)
@ -5711,38 +5683,34 @@
i32.store offset=20
)
(func $~lib/set/Set<u64>#constructor (; 82 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
get_local $0
if (result i32)
block (result i32)
get_local $0
else
block (result i32)
i32.eqz
if
i32.const 24
call $~lib/memory/memory.allocate
set_local $1
get_local $1
i32.const 0
i32.store
get_local $1
i32.const 0
i32.store offset=4
get_local $1
i32.const 0
i32.store offset=8
get_local $1
i32.const 0
i32.store offset=12
get_local $1
i32.const 0
i32.store offset=16
get_local $1
i32.const 0
i32.store offset=20
get_local $1
set_local $0
end
tee_local $0
get_local $0
i32.const 0
i32.store
get_local $0
i32.const 0
i32.store offset=4
get_local $0
i32.const 0
i32.store offset=8
get_local $0
i32.const 0
i32.store offset=12
get_local $0
i32.const 0
i32.store offset=16
get_local $0
i32.const 0
i32.store offset=20
get_local $0
end
tee_local $0
call $~lib/set/Set<u64>#clear
get_local $0
)
@ -6430,38 +6398,34 @@
i32.store offset=20
)
(func $~lib/set/Set<f32>#constructor (; 92 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
get_local $0
if (result i32)
block (result i32)
get_local $0
else
block (result i32)
i32.eqz
if
i32.const 24
call $~lib/memory/memory.allocate
set_local $1
get_local $1
i32.const 0
i32.store
get_local $1
i32.const 0
i32.store offset=4
get_local $1
i32.const 0
i32.store offset=8
get_local $1
i32.const 0
i32.store offset=12
get_local $1
i32.const 0
i32.store offset=16
get_local $1
i32.const 0
i32.store offset=20
get_local $1
set_local $0
end
tee_local $0
get_local $0
i32.const 0
i32.store
get_local $0
i32.const 0
i32.store offset=4
get_local $0
i32.const 0
i32.store offset=8
get_local $0
i32.const 0
i32.store offset=12
get_local $0
i32.const 0
i32.store offset=16
get_local $0
i32.const 0
i32.store offset=20
get_local $0
end
tee_local $0
call $~lib/set/Set<f32>#clear
get_local $0
)
@ -7152,38 +7116,34 @@
i32.store offset=20
)
(func $~lib/set/Set<f64>#constructor (; 102 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
get_local $0
if (result i32)
block (result i32)
get_local $0
else
block (result i32)
i32.eqz
if
i32.const 24
call $~lib/memory/memory.allocate
set_local $1
get_local $1
i32.const 0
i32.store
get_local $1
i32.const 0
i32.store offset=4
get_local $1
i32.const 0
i32.store offset=8
get_local $1
i32.const 0
i32.store offset=12
get_local $1
i32.const 0
i32.store offset=16
get_local $1
i32.const 0
i32.store offset=20
get_local $1
set_local $0
end
tee_local $0
get_local $0
i32.const 0
i32.store
get_local $0
i32.const 0
i32.store offset=4
get_local $0
i32.const 0
i32.store offset=8
get_local $0
i32.const 0
i32.store offset=12
get_local $0
i32.const 0
i32.store offset=16
get_local $0
i32.const 0
i32.store offset=20
get_local $0
end
tee_local $0
call $~lib/set/Set<f64>#clear
get_local $0
)

View File

@ -4221,25 +4221,22 @@
get_local $2
call $~lib/internal/arraybuffer/allocateUnsafe
set_local $3
get_local $0
if (result i32)
block (result i32)
get_local $0
else
block (result i32)
i32.eqz
if
i32.const 8
call $~lib/memory/memory.allocate
set_local $4
get_local $4
i32.const 0
i32.store
get_local $4
i32.const 0
i32.store offset=4
get_local $4
set_local $0
end
tee_local $0
get_local $0
i32.const 0
i32.store
get_local $0
i32.const 0
i32.store offset=4
get_local $0
end
tee_local $0
get_local $3
i32.store
get_local $0

View File

@ -537,38 +537,34 @@
i32.store offset=20
)
(func $~lib/map/Map<String,usize>#constructor (; 9 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
get_local $0
if (result i32)
block (result i32)
get_local $0
else
block (result i32)
i32.eqz
if
i32.const 24
call $~lib/memory/memory.allocate
set_local $1
get_local $1
i32.const 0
i32.store
get_local $1
i32.const 0
i32.store offset=4
get_local $1
i32.const 0
i32.store offset=8
get_local $1
i32.const 0
i32.store offset=12
get_local $1
i32.const 0
i32.store offset=16
get_local $1
i32.const 0
i32.store offset=20
get_local $1
set_local $0
end
tee_local $0
get_local $0
i32.const 0
i32.store
get_local $0
i32.const 0
i32.store offset=4
get_local $0
i32.const 0
i32.store offset=8
get_local $0
i32.const 0
i32.store offset=12
get_local $0
i32.const 0
i32.store offset=16
get_local $0
i32.const 0
i32.store offset=20
get_local $0
end
tee_local $0
call $~lib/map/Map<String,usize>#clear
get_local $0
)
@ -601,38 +597,34 @@
i32.store offset=20
)
(func $~lib/map/Map<usize,String>#constructor (; 11 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
get_local $0
if (result i32)
block (result i32)
get_local $0
else
block (result i32)
i32.eqz
if
i32.const 24
call $~lib/memory/memory.allocate
set_local $1
get_local $1
i32.const 0
i32.store
get_local $1
i32.const 0
i32.store offset=4
get_local $1
i32.const 0
i32.store offset=8
get_local $1
i32.const 0
i32.store offset=12
get_local $1
i32.const 0
i32.store offset=16
get_local $1
i32.const 0
i32.store offset=20
get_local $1
set_local $0
end
tee_local $0
get_local $0
i32.const 0
i32.store
get_local $0
i32.const 0
i32.store offset=4
get_local $0
i32.const 0
i32.store offset=8
get_local $0
i32.const 0
i32.store offset=12
get_local $0
i32.const 0
i32.store offset=16
get_local $0
i32.const 0
i32.store offset=20
get_local $0
end
tee_local $0
call $~lib/map/Map<usize,String>#clear
get_local $0
)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff