Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let compilable = action.op1;
if (context.program.mode === CompileMode.aot) {
let handle = compilable.compile(context);
// If the handle for the invoked component is not yet known (for example,
// because this is a recursive invocation and we're still compiling), push a
// function that will produce the correct handle when the heap is
// serialized.
if (handle === PLACEHOLDER_HANDLE) {
return op(MachineOp.InvokeStatic, () => compilable.compile(context));
} else {
return op(MachineOp.InvokeStatic, handle);
}
} else {
return [op(Op.Constant, other(action.op1)), op(Op.CompileBlock), op(MachineOp.InvokeVirtual)];
}
}
evaluateMachine(opcode: RuntimeOp) {
switch (opcode.type) {
case MachineOp.PushFrame:
return this.pushFrame();
case MachineOp.PopFrame:
return this.popFrame();
case MachineOp.InvokeStatic:
return this.call(opcode.op1);
case MachineOp.InvokeVirtual:
return this.call(this.stack.pop());
case MachineOp.Jump:
return this.goto(opcode.op1);
case MachineOp.Return:
return this.return();
case MachineOp.ReturnTo:
return this.returnTo(opcode.op1);
}
}
export function InvokeStaticBlock(block: CompilableBlock): StatementCompileActions {
return [
op(MachineOp.PushFrame),
op('PushCompilable', block),
op('JitCompileBlock'),
op(MachineOp.InvokeVirtual),
op(MachineOp.PopFrame),
];
}
ops: [],
operands: 0,
check: true,
};
MACHINE_METADATA[MachineOp.PopFrame] = {
name: 'PopFrame',
mnemonic: 'popf',
before: null,
stackChange: -2,
ops: [],
operands: 0,
check: false,
};
MACHINE_METADATA[MachineOp.InvokeVirtual] = {
name: 'InvokeVirtual',
mnemonic: 'vcall',
before: null,
stackChange: -1,
ops: [],
operands: 0,
check: true,
};
MACHINE_METADATA[MachineOp.InvokeStatic] = {
name: 'InvokeStatic',
mnemonic: 'scall',
before: null,
stackChange: 0,
ops: [
{