mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-05-02 10:22:15 +00:00
Fix lifetime issues in field inits/ctors and refactor inlining
This commit is contained in:
parent
fa667386d9
commit
bf597a06c6
153
src/compiler.ts
153
src/compiler.ts
@ -1173,9 +1173,7 @@ export class Compiler extends DiagnosticEmitter {
|
||||
let classInstance = assert(instance.parent); assert(classInstance.kind == ElementKind.CLASS);
|
||||
|
||||
if (!flow.isAny(FlowFlags.ANY_TERMINATING)) {
|
||||
let thisLocalIndex = flow.is(FlowFlags.INLINE_CONTEXT)
|
||||
? assert(flow.lookupLocal(CommonSymbols.this_)).index
|
||||
: 0;
|
||||
let thisLocal = assert(flow.lookupLocal(CommonSymbols.this_));
|
||||
|
||||
// if `this` wasn't accessed before, allocate if necessary and initialize `this`
|
||||
if (!flow.is(FlowFlags.ALLOCATES)) {
|
||||
@ -1187,9 +1185,9 @@ export class Compiler extends DiagnosticEmitter {
|
||||
stmts.push(
|
||||
module.if(
|
||||
module.unary(nativeSizeType == NativeType.I64 ? UnaryOp.EqzI64 : UnaryOp.EqzI32,
|
||||
module.local_get(thisLocalIndex, nativeSizeType)
|
||||
module.local_get(thisLocal.index, nativeSizeType)
|
||||
),
|
||||
module.local_set(thisLocalIndex,
|
||||
module.local_set(thisLocal.index,
|
||||
this.makeRetain(
|
||||
this.makeAllocation(<Class>classInstance)
|
||||
),
|
||||
@ -1198,13 +1196,10 @@ export class Compiler extends DiagnosticEmitter {
|
||||
);
|
||||
this.makeFieldInitialization(<Class>classInstance, stmts);
|
||||
}
|
||||
|
||||
// implicitly return `this`. unlike for normal functions, retaining the value isn't
|
||||
// necessary because the allocation (constructor call) already did (RC=1)
|
||||
stmts.push(
|
||||
module.local_get(thisLocalIndex, nativeSizeType)
|
||||
);
|
||||
flow.set(FlowFlags.RETURNS);
|
||||
this.performAutoreleases(flow, stmts); // `this` is excluded anyway
|
||||
this.finishAutoreleases(flow, stmts);
|
||||
stmts.push(module.local_get(thisLocal.index, this.options.nativeSizeType));
|
||||
flow.set(FlowFlags.RETURNS | FlowFlags.RETURNS_NONNULL);
|
||||
}
|
||||
|
||||
// check that super has been called if this is a derived class
|
||||
@ -5735,25 +5730,26 @@ export class Compiler extends DiagnosticEmitter {
|
||||
// this.a = X
|
||||
// this.b = Y
|
||||
// }
|
||||
let stmts: ExpressionRef[] = [
|
||||
module.local_set(thisLocal.index,
|
||||
this.compileCallDirect(
|
||||
this.ensureConstructor(baseClassInstance, expression),
|
||||
expression.arguments,
|
||||
expression,
|
||||
module.if(
|
||||
module.local_get(thisLocal.index, nativeSizeType),
|
||||
module.local_get(thisLocal.index, nativeSizeType),
|
||||
this.makeRetain(
|
||||
this.makeAllocation(<Class>classInstance)
|
||||
)
|
||||
)
|
||||
let theCall = this.compileCallDirect(
|
||||
this.ensureConstructor(baseClassInstance, expression),
|
||||
expression.arguments,
|
||||
expression,
|
||||
module.if(
|
||||
module.local_get(thisLocal.index, nativeSizeType),
|
||||
module.local_get(thisLocal.index, nativeSizeType),
|
||||
this.makeRetain(
|
||||
this.makeAllocation(<Class>classInstance)
|
||||
)
|
||||
)
|
||||
),
|
||||
ContextualFlags.SKIP_AUTORELEASE
|
||||
);
|
||||
assert(this.skippedAutoreleases.has(theCall)); // guaranteed
|
||||
let stmts: ExpressionRef[] = [
|
||||
module.local_set(thisLocal.index, theCall)
|
||||
];
|
||||
this.makeFieldInitialization(<Class>classInstance, stmts);
|
||||
|
||||
// check that super had been called before accessing allocating `this`
|
||||
// check that super had been called before accessing `this`
|
||||
if (flow.isAny(
|
||||
FlowFlags.ALLOCATES |
|
||||
FlowFlags.CONDITIONALLY_ALLOCATES
|
||||
@ -6151,7 +6147,24 @@ export class Compiler extends DiagnosticEmitter {
|
||||
);
|
||||
} else {
|
||||
this.currentInlineFunctions.push(instance);
|
||||
let expr = this.compileCallInlinePrechecked(instance, argumentExpressions, thisArg, (contextualFlags & ContextualFlags.WILL_DROP) != 0);
|
||||
let parameterTypes = signature.parameterTypes;
|
||||
assert(numArguments <= parameterTypes.length);
|
||||
// compile argument expressions
|
||||
let args = new Array<ExpressionRef>(numArguments);
|
||||
for (let i = 0; i < numArguments; ++i) {
|
||||
args[i] = this.compileExpression(argumentExpressions[i], parameterTypes[i],
|
||||
ContextualFlags.IMPLICIT | ContextualFlags.SKIP_AUTORELEASE
|
||||
);
|
||||
}
|
||||
// make the inlined call (is aware of autoreleases)
|
||||
let expr = this.makeCallInline(instance, args, thisArg, (contextualFlags & ContextualFlags.WILL_DROP) != 0);
|
||||
if (this.currentType.isManaged) {
|
||||
if (!(contextualFlags & ContextualFlags.SKIP_AUTORELEASE)) {
|
||||
expr = this.makeAutorelease(expr, this.currentFlow);
|
||||
} else {
|
||||
this.skippedAutoreleases.add(expr);
|
||||
}
|
||||
}
|
||||
this.currentInlineFunctions.pop();
|
||||
return expr;
|
||||
}
|
||||
@ -6190,47 +6203,7 @@ export class Compiler extends DiagnosticEmitter {
|
||||
);
|
||||
}
|
||||
|
||||
compileCallInline(
|
||||
instance: Function,
|
||||
argumentExpressions: Expression[],
|
||||
thisArg: ExpressionRef,
|
||||
reportNode: Node,
|
||||
canAlias: bool = false
|
||||
): ExpressionRef {
|
||||
var numArguments = argumentExpressions.length;
|
||||
var signature = instance.signature;
|
||||
if (!this.checkCallSignature( // reports
|
||||
signature,
|
||||
numArguments,
|
||||
thisArg != 0,
|
||||
reportNode
|
||||
)) {
|
||||
this.currentType = instance.signature.returnType;
|
||||
return this.module.unreachable();
|
||||
}
|
||||
return this.compileCallInlinePrechecked(instance, argumentExpressions, thisArg, canAlias);
|
||||
}
|
||||
|
||||
private compileCallInlinePrechecked(
|
||||
instance: Function,
|
||||
argumentExpressions: Expression[],
|
||||
thisArg: ExpressionRef = 0,
|
||||
immediatelyDropped: bool = false
|
||||
): ExpressionRef {
|
||||
var numArguments = argumentExpressions.length;
|
||||
var signature = instance.signature;
|
||||
var parameterTypes = signature.parameterTypes;
|
||||
assert(numArguments <= parameterTypes.length);
|
||||
var args = new Array<ExpressionRef>(numArguments);
|
||||
for (let i = 0; i < numArguments; ++i) {
|
||||
args[i] = this.compileExpression(argumentExpressions[i], parameterTypes[i],
|
||||
ContextualFlags.IMPLICIT
|
||||
);
|
||||
}
|
||||
return this.makeCallInlinePrechecked(instance, args, thisArg, immediatelyDropped);
|
||||
}
|
||||
|
||||
makeCallInlinePrechecked(
|
||||
makeCallInline(
|
||||
instance: Function,
|
||||
operands: ExpressionRef[] | null,
|
||||
thisArg: ExpressionRef = 0,
|
||||
@ -6259,21 +6232,17 @@ export class Compiler extends DiagnosticEmitter {
|
||||
let paramType = parameterTypes[i];
|
||||
let argumentLocal = flow.addScopedLocal(signature.getParameterName(i), paramType, usedLocals);
|
||||
findUsedLocals(paramExpr, usedLocals);
|
||||
// Normal function wouldn't know about wrap/nonnull states, but inlining does:
|
||||
// inlining is aware of wrap/nonnull states:
|
||||
if (!previousFlow.canOverflow(paramExpr, paramType)) flow.setLocalFlag(argumentLocal.index, LocalFlags.WRAPPED);
|
||||
if (flow.isNonnull(paramExpr, paramType)) flow.setLocalFlag(argumentLocal.index, LocalFlags.NONNULL);
|
||||
// inlining is aware of skipped autoreleases:
|
||||
if (paramType.isManaged) {
|
||||
if (!this.skippedAutoreleases.has(paramExpr)) paramExpr = this.makeRetain(paramExpr);
|
||||
flow.setLocalFlag(argumentLocal.index, LocalFlags.RETAINED);
|
||||
body.unshift(
|
||||
module.local_set(argumentLocal.index,
|
||||
this.makeRetain(paramExpr)
|
||||
)
|
||||
);
|
||||
} else {
|
||||
body.unshift(
|
||||
module.local_set(argumentLocal.index, paramExpr)
|
||||
);
|
||||
}
|
||||
body.unshift(
|
||||
module.local_set(argumentLocal.index, paramExpr)
|
||||
);
|
||||
}
|
||||
if (thisArg) {
|
||||
let classInstance = assert(instance.parent); assert(classInstance.kind == ElementKind.CLASS);
|
||||
@ -6335,8 +6304,6 @@ export class Compiler extends DiagnosticEmitter {
|
||||
if (immediatelyDropped) {
|
||||
expr = this.makeRelease(expr);
|
||||
this.currentType = Type.void;
|
||||
} else {
|
||||
expr = this.makeAutorelease(expr);
|
||||
}
|
||||
}
|
||||
return expr;
|
||||
@ -7845,7 +7812,8 @@ export class Compiler extends DiagnosticEmitter {
|
||||
instance.prototype.setResolvedInstance("", instance);
|
||||
classInstance.constructorInstance = instance;
|
||||
var previousFlow = this.currentFlow;
|
||||
this.currentFlow = instance.flow;
|
||||
var flow = instance.flow;
|
||||
this.currentFlow = flow;
|
||||
|
||||
// generate body
|
||||
var signature = instance.signature;
|
||||
@ -7888,9 +7856,9 @@ export class Compiler extends DiagnosticEmitter {
|
||||
);
|
||||
}
|
||||
this.makeFieldInitialization(classInstance, stmts);
|
||||
stmts.push(
|
||||
module.local_get(0, nativeSizeType)
|
||||
);
|
||||
var body = this.performAutoreleasesWithValue(flow, module.local_get(0, nativeSizeType), classInstance.type, stmts);
|
||||
flow.freeScopedLocals();
|
||||
this.currentFlow = previousFlow;
|
||||
|
||||
// make the function
|
||||
var typeRef = this.ensureFunctionType(signature.parameterTypes, signature.returnType, signature.thisType);
|
||||
@ -7901,11 +7869,8 @@ export class Compiler extends DiagnosticEmitter {
|
||||
if (numLocals > numOperands) {
|
||||
for (let i = numOperands; i < numLocals; ++i) varTypes.push(locals[i].type.toNativeType());
|
||||
}
|
||||
var funcRef = module.addFunction(instance.internalName, typeRef, varTypes,
|
||||
flatten(module, stmts, nativeSizeType)
|
||||
);
|
||||
var funcRef = module.addFunction(instance.internalName, typeRef, varTypes, body);
|
||||
instance.finalize(module, funcRef);
|
||||
this.currentFlow = previousFlow;
|
||||
return instance;
|
||||
}
|
||||
|
||||
@ -8926,12 +8891,16 @@ export class Compiler extends DiagnosticEmitter {
|
||||
let nativeFieldType = fieldType.toNativeType();
|
||||
let initializerNode = field.prototype.initializerNode;
|
||||
if (initializerNode) { // use initializer
|
||||
let initExpr = this.compileExpression(initializerNode, fieldType, // reports
|
||||
ContextualFlags.IMPLICIT | ContextualFlags.SKIP_AUTORELEASE
|
||||
);
|
||||
if (fieldType.isManaged && !this.skippedAutoreleases.has(initExpr)) {
|
||||
initExpr = this.makeRetain(initExpr);
|
||||
}
|
||||
stmts.push(
|
||||
module.store(fieldType.byteSize,
|
||||
module.local_get(thisLocalIndex, nativeSizeType),
|
||||
this.compileExpression(initializerNode, fieldType, // reports
|
||||
ContextualFlags.IMPLICIT
|
||||
),
|
||||
initExpr,
|
||||
nativeFieldType,
|
||||
field.memoryOffset
|
||||
)
|
||||
|
@ -140,7 +140,6 @@
|
||||
local.get $0
|
||||
)
|
||||
(func $call-super/B#constructor (; 4 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
(local $1 i32)
|
||||
local.get $0
|
||||
if (result i32)
|
||||
local.get $0
|
||||
@ -151,7 +150,6 @@
|
||||
call $~lib/rt/stub/__retain
|
||||
end
|
||||
call $call-super/A#constructor
|
||||
local.tee $1
|
||||
local.set $0
|
||||
local.get $0
|
||||
i32.const 2
|
||||
@ -237,7 +235,6 @@
|
||||
local.get $0
|
||||
)
|
||||
(func $call-super/D#constructor (; 8 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
(local $1 i32)
|
||||
local.get $0
|
||||
if (result i32)
|
||||
local.get $0
|
||||
@ -248,7 +245,6 @@
|
||||
call $~lib/rt/stub/__retain
|
||||
end
|
||||
call $call-super/C#constructor
|
||||
local.tee $1
|
||||
local.set $0
|
||||
local.get $0
|
||||
i32.const 2
|
||||
@ -347,6 +343,7 @@
|
||||
)
|
||||
(func $call-super/F#constructor (; 11 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
(local $1 i32)
|
||||
(local $2 i32)
|
||||
local.get $0
|
||||
i32.eqz
|
||||
if
|
||||
@ -364,6 +361,10 @@
|
||||
i32.const 2
|
||||
i32.store offset=4
|
||||
local.get $0
|
||||
local.set $2
|
||||
local.get $1
|
||||
call $~lib/rt/stub/__release
|
||||
local.get $2
|
||||
)
|
||||
(func $call-super/test3 (; 12 ;) (type $FUNCSIG$v)
|
||||
(local $0 i32)
|
||||
@ -416,6 +417,7 @@
|
||||
)
|
||||
(func $call-super/H#constructor (; 14 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
(local $1 i32)
|
||||
(local $2 i32)
|
||||
local.get $0
|
||||
i32.eqz
|
||||
if
|
||||
@ -433,6 +435,10 @@
|
||||
i32.const 2
|
||||
i32.store offset=4
|
||||
local.get $0
|
||||
local.set $2
|
||||
local.get $1
|
||||
call $~lib/rt/stub/__release
|
||||
local.get $2
|
||||
)
|
||||
(func $call-super/test4 (; 15 ;) (type $FUNCSIG$v)
|
||||
(local $0 i32)
|
||||
@ -485,6 +491,7 @@
|
||||
)
|
||||
(func $call-super/J#constructor (; 17 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
(local $1 i32)
|
||||
(local $2 i32)
|
||||
local.get $0
|
||||
i32.eqz
|
||||
if
|
||||
@ -502,6 +509,10 @@
|
||||
i32.const 2
|
||||
i32.store offset=4
|
||||
local.get $0
|
||||
local.set $2
|
||||
local.get $1
|
||||
call $~lib/rt/stub/__release
|
||||
local.get $2
|
||||
)
|
||||
(func $call-super/test5 (; 18 ;) (type $FUNCSIG$v)
|
||||
(local $0 i32)
|
||||
|
@ -431,7 +431,6 @@
|
||||
i32.store offset=4
|
||||
local.get $3
|
||||
end
|
||||
local.tee $3
|
||||
local.set $1
|
||||
local.get $1
|
||||
i32.const 3
|
||||
@ -444,8 +443,6 @@
|
||||
i32.store offset=12
|
||||
local.get $1
|
||||
end
|
||||
local.tee $3
|
||||
call $~lib/rt/stub/__retain
|
||||
local.set $4
|
||||
local.get $4
|
||||
i32.load
|
||||
@ -499,8 +496,6 @@
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
end
|
||||
local.get $3
|
||||
call $~lib/rt/stub/__release
|
||||
local.get $4
|
||||
call $~lib/rt/stub/__release
|
||||
)
|
||||
|
@ -3223,7 +3223,6 @@
|
||||
local.get $0
|
||||
)
|
||||
(func $~lib/array/Array<i32>#constructor (; 27 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(local $2 i32)
|
||||
local.get $0
|
||||
if (result i32)
|
||||
local.get $0
|
||||
@ -3236,7 +3235,6 @@
|
||||
local.get $1
|
||||
i32.const 2
|
||||
call $~lib/arraybuffer/ArrayBufferView#constructor
|
||||
local.tee $2
|
||||
local.set $0
|
||||
local.get $0
|
||||
i32.const 0
|
||||
@ -3806,7 +3804,6 @@
|
||||
local.get $2
|
||||
)
|
||||
(func $~lib/array/Array<~lib/array/Array<~lib/string/String>>#constructor (; 34 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(local $2 i32)
|
||||
local.get $0
|
||||
if (result i32)
|
||||
local.get $0
|
||||
@ -3819,24 +3816,17 @@
|
||||
local.get $1
|
||||
i32.const 2
|
||||
call $~lib/arraybuffer/ArrayBufferView#constructor
|
||||
local.tee $2
|
||||
local.set $0
|
||||
local.get $0
|
||||
i32.const 0
|
||||
i32.store offset=12
|
||||
local.get $1
|
||||
if
|
||||
local.get $2
|
||||
call $~lib/rt/pure/__release
|
||||
block
|
||||
i32.const 472
|
||||
i32.const 376
|
||||
i32.const 56
|
||||
i32.const 20
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
unreachable
|
||||
end
|
||||
i32.const 472
|
||||
i32.const 376
|
||||
i32.const 56
|
||||
i32.const 20
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
end
|
||||
local.get $0
|
||||
@ -3845,7 +3835,6 @@
|
||||
local.get $0
|
||||
)
|
||||
(func $~lib/array/Array<~lib/string/String>#constructor (; 35 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(local $2 i32)
|
||||
local.get $0
|
||||
if (result i32)
|
||||
local.get $0
|
||||
@ -3858,24 +3847,17 @@
|
||||
local.get $1
|
||||
i32.const 2
|
||||
call $~lib/arraybuffer/ArrayBufferView#constructor
|
||||
local.tee $2
|
||||
local.set $0
|
||||
local.get $0
|
||||
i32.const 0
|
||||
i32.store offset=12
|
||||
local.get $1
|
||||
if
|
||||
local.get $2
|
||||
call $~lib/rt/pure/__release
|
||||
block
|
||||
i32.const 472
|
||||
i32.const 376
|
||||
i32.const 56
|
||||
i32.const 20
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
unreachable
|
||||
end
|
||||
i32.const 472
|
||||
i32.const 376
|
||||
i32.const 56
|
||||
i32.const 20
|
||||
call $~lib/builtins/abort
|
||||
unreachable
|
||||
end
|
||||
local.get $0
|
||||
|
@ -1,6 +1,7 @@
|
||||
(module
|
||||
(type $FUNCSIG$iii (func (param i32 i32) (result i32)))
|
||||
(type $FUNCSIG$ii (func (param i32) (result i32)))
|
||||
(type $FUNCSIG$vi (func (param i32)))
|
||||
(type $FUNCSIG$viiii (func (param i32 i32 i32 i32)))
|
||||
(type $FUNCSIG$v (func))
|
||||
(import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32)))
|
||||
@ -132,8 +133,12 @@
|
||||
end
|
||||
local.get $0
|
||||
)
|
||||
(func $rt/instanceof/Cat#constructor (; 4 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
(func $~lib/rt/stub/__release (; 4 ;) (type $FUNCSIG$vi) (param $0 i32)
|
||||
nop
|
||||
)
|
||||
(func $rt/instanceof/Cat#constructor (; 5 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
(local $1 i32)
|
||||
(local $2 i32)
|
||||
local.get $0
|
||||
i32.eqz
|
||||
if
|
||||
@ -148,9 +153,14 @@
|
||||
local.tee $1
|
||||
local.set $0
|
||||
local.get $0
|
||||
local.set $2
|
||||
local.get $1
|
||||
call $~lib/rt/stub/__release
|
||||
local.get $2
|
||||
)
|
||||
(func $rt/instanceof/BlackCat#constructor (; 5 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
(func $rt/instanceof/BlackCat#constructor (; 6 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
(local $1 i32)
|
||||
(local $2 i32)
|
||||
local.get $0
|
||||
i32.eqz
|
||||
if
|
||||
@ -165,8 +175,12 @@
|
||||
local.tee $1
|
||||
local.set $0
|
||||
local.get $0
|
||||
local.set $2
|
||||
local.get $1
|
||||
call $~lib/rt/stub/__release
|
||||
local.get $2
|
||||
)
|
||||
(func $~lib/rt/__instanceof (; 6 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(func $~lib/rt/__instanceof (; 7 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
local.get $0
|
||||
@ -203,7 +217,7 @@
|
||||
end
|
||||
i32.const 0
|
||||
)
|
||||
(func $start:rt/instanceof (; 7 ;) (type $FUNCSIG$v)
|
||||
(func $start:rt/instanceof (; 8 ;) (type $FUNCSIG$v)
|
||||
(local $0 i32)
|
||||
global.get $~lib/heap/__heap_base
|
||||
i32.const 15
|
||||
@ -705,7 +719,7 @@
|
||||
unreachable
|
||||
end
|
||||
)
|
||||
(func $rt/instanceof/main (; 8 ;) (type $FUNCSIG$v)
|
||||
(func $rt/instanceof/main (; 9 ;) (type $FUNCSIG$v)
|
||||
global.get $~lib/started
|
||||
i32.eqz
|
||||
if
|
||||
@ -714,9 +728,9 @@
|
||||
global.set $~lib/started
|
||||
end
|
||||
)
|
||||
(func $start (; 9 ;) (type $FUNCSIG$v)
|
||||
(func $start (; 10 ;) (type $FUNCSIG$v)
|
||||
call $start:rt/instanceof
|
||||
)
|
||||
(func $null (; 10 ;) (type $FUNCSIG$v)
|
||||
(func $null (; 11 ;) (type $FUNCSIG$v)
|
||||
)
|
||||
)
|
||||
|
@ -3693,7 +3693,6 @@
|
||||
local.get $0
|
||||
)
|
||||
(func $~lib/array/Array<i32>#constructor (; 33 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(local $2 i32)
|
||||
local.get $0
|
||||
if (result i32)
|
||||
local.get $0
|
||||
@ -3706,7 +3705,6 @@
|
||||
local.get $1
|
||||
i32.const 2
|
||||
call $~lib/arraybuffer/ArrayBufferView#constructor
|
||||
local.tee $2
|
||||
local.set $0
|
||||
local.get $0
|
||||
i32.const 0
|
||||
@ -3783,7 +3781,6 @@
|
||||
local.get $1
|
||||
)
|
||||
(func $~lib/typedarray/Uint8Array#constructor (; 38 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(local $2 i32)
|
||||
local.get $0
|
||||
if (result i32)
|
||||
local.get $0
|
||||
@ -3796,7 +3793,6 @@
|
||||
local.get $1
|
||||
i32.const 0
|
||||
call $~lib/arraybuffer/ArrayBufferView#constructor
|
||||
local.tee $2
|
||||
local.set $0
|
||||
local.get $0
|
||||
)
|
||||
|
@ -2784,7 +2784,6 @@
|
||||
local.get $0
|
||||
)
|
||||
(func $~lib/typedarray/Uint8Array#constructor (; 16 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(local $2 i32)
|
||||
local.get $0
|
||||
if (result i32)
|
||||
local.get $0
|
||||
@ -2797,7 +2796,6 @@
|
||||
local.get $1
|
||||
i32.const 0
|
||||
call $~lib/arraybuffer/ArrayBufferView#constructor
|
||||
local.tee $2
|
||||
local.set $0
|
||||
local.get $0
|
||||
)
|
||||
@ -2840,7 +2838,6 @@
|
||||
local.get $4
|
||||
)
|
||||
(func $~lib/typedarray/Int32Array#constructor (; 18 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(local $2 i32)
|
||||
local.get $0
|
||||
if (result i32)
|
||||
local.get $0
|
||||
@ -2853,7 +2850,6 @@
|
||||
local.get $1
|
||||
i32.const 2
|
||||
call $~lib/arraybuffer/ArrayBufferView#constructor
|
||||
local.tee $2
|
||||
local.set $0
|
||||
local.get $0
|
||||
)
|
||||
@ -2937,6 +2933,8 @@
|
||||
local.get $0
|
||||
local.get $3
|
||||
i32.store offset=8
|
||||
local.get $1
|
||||
call $~lib/rt/stub/__release
|
||||
local.get $0
|
||||
)
|
||||
(func $~lib/typedarray/Uint8Array#get:buffer (; 20 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
|
@ -202,7 +202,6 @@
|
||||
local.get $0
|
||||
)
|
||||
(func $~lib/typedarray/Uint8Array#constructor (; 5 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(local $2 i32)
|
||||
local.get $0
|
||||
if (result i32)
|
||||
local.get $0
|
||||
@ -215,7 +214,6 @@
|
||||
local.get $1
|
||||
i32.const 0
|
||||
call $~lib/arraybuffer/ArrayBufferView#constructor
|
||||
local.tee $2
|
||||
local.set $0
|
||||
local.get $0
|
||||
)
|
||||
@ -325,6 +323,8 @@
|
||||
local.get $0
|
||||
local.get $3
|
||||
i32.store offset=8
|
||||
local.get $1
|
||||
call $~lib/rt/stub/__release
|
||||
local.get $0
|
||||
)
|
||||
(func $~lib/typedarray/Uint8Array#get:buffer (; 9 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
|
@ -1787,10 +1787,7 @@
|
||||
(local $4 i32)
|
||||
(local $5 i32)
|
||||
(local $6 i32)
|
||||
(local $7 i32)
|
||||
(local $8 i32)
|
||||
(local $9 i32)
|
||||
(local $10 f32)
|
||||
(local $7 f32)
|
||||
block $std/pointer/Pointer<std/pointer/Entry>#constructor|inlined.0 (result i32)
|
||||
i32.const 0
|
||||
local.set $1
|
||||
@ -1799,19 +1796,15 @@
|
||||
local.get $0
|
||||
call $~lib/rt/stub/__retain
|
||||
end
|
||||
local.tee $1
|
||||
call $~lib/rt/stub/__retain
|
||||
global.set $std/pointer/one
|
||||
block $std/pointer/Pointer<std/pointer/Entry>#constructor|inlined.1 (result i32)
|
||||
i32.const 0
|
||||
local.set $2
|
||||
local.set $1
|
||||
i32.const 24
|
||||
local.set $0
|
||||
local.get $0
|
||||
call $~lib/rt/stub/__retain
|
||||
end
|
||||
local.tee $2
|
||||
call $~lib/rt/stub/__retain
|
||||
global.set $std/pointer/two
|
||||
block $std/pointer/Pointer<std/pointer/Entry>#get:offset|inlined.0 (result i32)
|
||||
global.get $std/pointer/one
|
||||
@ -1831,8 +1824,8 @@
|
||||
end
|
||||
block $std/pointer/Pointer<std/pointer/Entry>#get:offset|inlined.1 (result i32)
|
||||
global.get $std/pointer/two
|
||||
local.set $0
|
||||
local.get $0
|
||||
local.set $1
|
||||
local.get $1
|
||||
end
|
||||
i32.const 24
|
||||
i32.eq
|
||||
@ -1855,8 +1848,8 @@
|
||||
i32.store
|
||||
block $std/pointer/Pointer<std/pointer/Entry>#get:value|inlined.1 (result i32)
|
||||
global.get $std/pointer/one
|
||||
local.set $0
|
||||
local.get $0
|
||||
local.set $1
|
||||
local.get $1
|
||||
br $std/pointer/Pointer<std/pointer/Entry>#get:value|inlined.1
|
||||
end
|
||||
i32.const 2
|
||||
@ -1881,8 +1874,8 @@
|
||||
end
|
||||
block $std/pointer/Pointer<std/pointer/Entry>#get:value|inlined.3 (result i32)
|
||||
global.get $std/pointer/one
|
||||
local.set $0
|
||||
local.get $0
|
||||
local.set $1
|
||||
local.get $1
|
||||
br $std/pointer/Pointer<std/pointer/Entry>#get:value|inlined.3
|
||||
end
|
||||
i32.load offset=4
|
||||
@ -1900,13 +1893,13 @@
|
||||
global.get $std/pointer/one
|
||||
global.get $std/pointer/two
|
||||
call $std/pointer/Pointer<std/pointer/Entry>#add
|
||||
local.tee $0
|
||||
local.tee $1
|
||||
call $~lib/rt/stub/__retain
|
||||
global.set $std/pointer/add
|
||||
block $std/pointer/Pointer<std/pointer/Entry>#get:offset|inlined.2 (result i32)
|
||||
global.get $std/pointer/add
|
||||
local.set $3
|
||||
local.get $3
|
||||
local.set $0
|
||||
local.get $0
|
||||
end
|
||||
i32.const 32
|
||||
i32.eq
|
||||
@ -1922,13 +1915,13 @@
|
||||
global.get $std/pointer/two
|
||||
global.get $std/pointer/one
|
||||
call $std/pointer/Pointer<std/pointer/Entry>#sub
|
||||
local.tee $3
|
||||
local.tee $0
|
||||
call $~lib/rt/stub/__retain
|
||||
global.set $std/pointer/sub
|
||||
block $std/pointer/Pointer<std/pointer/Entry>#get:offset|inlined.3 (result i32)
|
||||
global.get $std/pointer/sub
|
||||
local.set $4
|
||||
local.get $4
|
||||
local.set $2
|
||||
local.get $2
|
||||
end
|
||||
i32.const 16
|
||||
i32.eq
|
||||
@ -1943,8 +1936,8 @@
|
||||
end
|
||||
block $std/pointer/Pointer<std/pointer/Entry>#get:offset|inlined.4 (result i32)
|
||||
global.get $std/pointer/one
|
||||
local.set $4
|
||||
local.get $4
|
||||
local.set $2
|
||||
local.get $2
|
||||
end
|
||||
i32.const 8
|
||||
i32.eq
|
||||
@ -1961,19 +1954,19 @@
|
||||
block (result i32)
|
||||
global.get $std/pointer/one
|
||||
call $std/pointer/Pointer<std/pointer/Entry>#inc
|
||||
local.tee $4
|
||||
local.tee $5
|
||||
local.tee $2
|
||||
local.tee $3
|
||||
global.get $std/pointer/one
|
||||
local.tee $6
|
||||
local.tee $4
|
||||
i32.ne
|
||||
if
|
||||
local.get $5
|
||||
local.get $3
|
||||
call $~lib/rt/stub/__retain
|
||||
drop
|
||||
local.get $6
|
||||
local.get $4
|
||||
call $~lib/rt/stub/__release
|
||||
end
|
||||
local.get $5
|
||||
local.get $3
|
||||
end
|
||||
global.set $std/pointer/one
|
||||
global.get $std/pointer/one
|
||||
@ -1994,8 +1987,8 @@
|
||||
end
|
||||
block $std/pointer/Pointer<std/pointer/Entry>#get:offset|inlined.5 (result i32)
|
||||
global.get $std/pointer/one
|
||||
local.set $6
|
||||
local.get $6
|
||||
local.set $4
|
||||
local.get $4
|
||||
end
|
||||
i32.const 16
|
||||
i32.eq
|
||||
@ -2010,8 +2003,8 @@
|
||||
end
|
||||
block $std/pointer/Pointer<std/pointer/Entry>#get:offset|inlined.6 (result i32)
|
||||
global.get $std/pointer/two
|
||||
local.set $5
|
||||
local.get $5
|
||||
local.set $3
|
||||
local.get $3
|
||||
end
|
||||
i32.const 24
|
||||
i32.eq
|
||||
@ -2027,43 +2020,43 @@
|
||||
block (result i32)
|
||||
global.get $std/pointer/two
|
||||
call $std/pointer/Pointer<std/pointer/Entry>#dec
|
||||
local.tee $5
|
||||
local.tee $6
|
||||
local.tee $3
|
||||
local.tee $4
|
||||
global.get $std/pointer/two
|
||||
local.tee $7
|
||||
local.tee $5
|
||||
i32.ne
|
||||
if
|
||||
local.get $6
|
||||
local.get $4
|
||||
call $~lib/rt/stub/__retain
|
||||
drop
|
||||
local.get $7
|
||||
local.get $5
|
||||
call $~lib/rt/stub/__release
|
||||
end
|
||||
local.get $6
|
||||
local.get $4
|
||||
end
|
||||
global.set $std/pointer/two
|
||||
block (result i32)
|
||||
global.get $std/pointer/two
|
||||
call $std/pointer/Pointer<std/pointer/Entry>#dec
|
||||
local.tee $6
|
||||
local.tee $7
|
||||
local.tee $4
|
||||
local.tee $5
|
||||
global.get $std/pointer/two
|
||||
local.tee $8
|
||||
local.tee $6
|
||||
i32.ne
|
||||
if
|
||||
local.get $7
|
||||
local.get $5
|
||||
call $~lib/rt/stub/__retain
|
||||
drop
|
||||
local.get $8
|
||||
local.get $6
|
||||
call $~lib/rt/stub/__release
|
||||
end
|
||||
local.get $7
|
||||
local.get $5
|
||||
end
|
||||
global.set $std/pointer/two
|
||||
block $std/pointer/Pointer<std/pointer/Entry>#get:offset|inlined.7 (result i32)
|
||||
global.get $std/pointer/two
|
||||
local.set $8
|
||||
local.get $8
|
||||
local.set $6
|
||||
local.get $6
|
||||
end
|
||||
i32.const 8
|
||||
i32.eq
|
||||
@ -2078,8 +2071,8 @@
|
||||
end
|
||||
block $std/pointer/Pointer<std/pointer/Entry>#get:value|inlined.4 (result i32)
|
||||
global.get $std/pointer/two
|
||||
local.set $7
|
||||
local.get $7
|
||||
local.set $5
|
||||
local.get $5
|
||||
br $std/pointer/Pointer<std/pointer/Entry>#get:value|inlined.4
|
||||
end
|
||||
i32.load
|
||||
@ -2096,8 +2089,8 @@
|
||||
end
|
||||
block $std/pointer/Pointer<std/pointer/Entry>#get:value|inlined.5 (result i32)
|
||||
global.get $std/pointer/two
|
||||
local.set $8
|
||||
local.get $8
|
||||
local.set $6
|
||||
local.get $6
|
||||
br $std/pointer/Pointer<std/pointer/Entry>#get:value|inlined.5
|
||||
end
|
||||
i32.load offset=4
|
||||
@ -2115,20 +2108,20 @@
|
||||
global.get $std/pointer/one
|
||||
block $std/pointer/Pointer<std/pointer/Entry>#get:value|inlined.6 (result i32)
|
||||
global.get $std/pointer/two
|
||||
local.set $7
|
||||
local.get $7
|
||||
local.set $5
|
||||
local.get $5
|
||||
br $std/pointer/Pointer<std/pointer/Entry>#get:value|inlined.6
|
||||
end
|
||||
call $std/pointer/Pointer<std/pointer/Entry>#set:value
|
||||
block $std/pointer/Pointer<std/pointer/Entry>#get:offset|inlined.8 (result i32)
|
||||
global.get $std/pointer/one
|
||||
local.set $8
|
||||
local.get $8
|
||||
local.set $6
|
||||
local.get $6
|
||||
end
|
||||
block $std/pointer/Pointer<std/pointer/Entry>#get:offset|inlined.9 (result i32)
|
||||
global.get $std/pointer/two
|
||||
local.set $7
|
||||
local.get $7
|
||||
local.set $5
|
||||
local.get $5
|
||||
end
|
||||
i32.ne
|
||||
i32.eqz
|
||||
@ -2142,8 +2135,8 @@
|
||||
end
|
||||
block $std/pointer/Pointer<std/pointer/Entry>#get:value|inlined.7 (result i32)
|
||||
global.get $std/pointer/one
|
||||
local.set $8
|
||||
local.get $8
|
||||
local.set $6
|
||||
local.get $6
|
||||
br $std/pointer/Pointer<std/pointer/Entry>#get:value|inlined.7
|
||||
end
|
||||
i32.load
|
||||
@ -2160,8 +2153,8 @@
|
||||
end
|
||||
block $std/pointer/Pointer<std/pointer/Entry>#get:value|inlined.8 (result i32)
|
||||
global.get $std/pointer/one
|
||||
local.set $7
|
||||
local.get $7
|
||||
local.set $5
|
||||
local.get $5
|
||||
br $std/pointer/Pointer<std/pointer/Entry>#get:value|inlined.8
|
||||
end
|
||||
i32.load offset=4
|
||||
@ -2178,14 +2171,12 @@
|
||||
end
|
||||
block $std/pointer/Pointer<f32>#constructor|inlined.0 (result i32)
|
||||
i32.const 0
|
||||
local.set $7
|
||||
local.set $5
|
||||
i32.const 0
|
||||
local.set $8
|
||||
local.get $8
|
||||
local.set $6
|
||||
local.get $6
|
||||
call $~lib/rt/stub/__retain
|
||||
end
|
||||
local.tee $7
|
||||
call $~lib/rt/stub/__retain
|
||||
global.set $std/pointer/buf
|
||||
global.get $std/pointer/buf
|
||||
i32.const 0
|
||||
@ -2197,11 +2188,11 @@
|
||||
call $std/pointer/Pointer<f32>#set
|
||||
block $std/pointer/Pointer<f32>#get|inlined.0 (result f32)
|
||||
global.get $std/pointer/buf
|
||||
local.set $9
|
||||
local.set $5
|
||||
i32.const 0
|
||||
local.set $8
|
||||
local.get $9
|
||||
local.get $8
|
||||
local.set $6
|
||||
local.get $5
|
||||
local.get $6
|
||||
i32.const 4
|
||||
i32.mul
|
||||
i32.add
|
||||
@ -2220,11 +2211,11 @@
|
||||
end
|
||||
block $std/pointer/Pointer<f32>#get|inlined.1 (result f32)
|
||||
global.get $std/pointer/buf
|
||||
local.set $9
|
||||
local.set $5
|
||||
i32.const 1
|
||||
local.set $8
|
||||
local.get $9
|
||||
local.get $8
|
||||
local.set $6
|
||||
local.get $5
|
||||
local.get $6
|
||||
i32.const 4
|
||||
i32.mul
|
||||
i32.add
|
||||
@ -2243,11 +2234,11 @@
|
||||
end
|
||||
block $std/pointer/Pointer<f32>#get|inlined.2 (result f32)
|
||||
global.get $std/pointer/buf
|
||||
local.set $9
|
||||
local.set $5
|
||||
i32.const 0
|
||||
local.set $8
|
||||
local.get $9
|
||||
local.get $8
|
||||
local.set $6
|
||||
local.get $5
|
||||
local.get $6
|
||||
i32.const 4
|
||||
i32.mul
|
||||
i32.add
|
||||
@ -2266,11 +2257,11 @@
|
||||
end
|
||||
block $std/pointer/Pointer<f32>#get|inlined.3 (result f32)
|
||||
global.get $std/pointer/buf
|
||||
local.set $9
|
||||
local.set $5
|
||||
i32.const 1
|
||||
local.set $8
|
||||
local.get $9
|
||||
local.get $8
|
||||
local.set $6
|
||||
local.get $5
|
||||
local.get $6
|
||||
i32.const 4
|
||||
i32.mul
|
||||
i32.add
|
||||
@ -2315,26 +2306,26 @@
|
||||
end
|
||||
block $std/pointer/Pointer<f32>#set|inlined.0
|
||||
global.get $std/pointer/buf
|
||||
local.set $9
|
||||
local.set $5
|
||||
i32.const 2
|
||||
local.set $8
|
||||
local.set $6
|
||||
f32.const 1.2999999523162842
|
||||
local.set $10
|
||||
local.get $9
|
||||
local.get $8
|
||||
local.set $7
|
||||
local.get $5
|
||||
local.get $6
|
||||
i32.const 4
|
||||
i32.mul
|
||||
i32.add
|
||||
local.get $10
|
||||
local.get $7
|
||||
f32.store
|
||||
end
|
||||
block $std/pointer/Pointer<f32>#get|inlined.4 (result f32)
|
||||
global.get $std/pointer/buf
|
||||
local.set $9
|
||||
local.set $5
|
||||
i32.const 2
|
||||
local.set $8
|
||||
local.get $9
|
||||
local.get $8
|
||||
local.set $6
|
||||
local.get $5
|
||||
local.get $6
|
||||
i32.const 4
|
||||
i32.mul
|
||||
i32.add
|
||||
@ -2353,11 +2344,11 @@
|
||||
end
|
||||
block $std/pointer/Pointer<f32>#get|inlined.5 (result f32)
|
||||
global.get $std/pointer/buf
|
||||
local.set $9
|
||||
local.set $5
|
||||
i32.const 2
|
||||
local.set $8
|
||||
local.get $9
|
||||
local.get $8
|
||||
local.set $6
|
||||
local.get $5
|
||||
local.get $6
|
||||
i32.const 4
|
||||
i32.mul
|
||||
i32.add
|
||||
@ -2392,8 +2383,8 @@
|
||||
call $std/pointer/Pointer<f32>#set:value
|
||||
block $std/pointer/Pointer<f32>#get:value|inlined.0 (result f32)
|
||||
global.get $std/pointer/buf
|
||||
local.set $8
|
||||
local.get $8
|
||||
local.set $6
|
||||
local.get $6
|
||||
f32.load
|
||||
br $std/pointer/Pointer<f32>#get:value|inlined.0
|
||||
end
|
||||
@ -2431,12 +2422,6 @@
|
||||
call $~lib/rt/stub/__release
|
||||
local.get $4
|
||||
call $~lib/rt/stub/__release
|
||||
local.get $5
|
||||
call $~lib/rt/stub/__release
|
||||
local.get $6
|
||||
call $~lib/rt/stub/__release
|
||||
local.get $7
|
||||
call $~lib/rt/stub/__release
|
||||
)
|
||||
(func $start (; 14 ;) (type $FUNCSIG$v)
|
||||
call $start:std/pointer
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user