Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// they are done. It is executed both during initial execution
// and during updating execution.
op('Label', 'FINALLY'),
// Finalize the DOM.
op(Op.Exit),
// In initial execution, this is a noop: it returns to the
// immediately following opcode. In updating execution, this
// exits the updating routine.
op(MachineOp.Return),
// Cleanup code for the block. Runs on initial execution
// but not on updating.
op('Label', 'ENDINITIAL'),
op(MachineOp.PopFrame),
op('StopLabels'),
] as T;
}
ifUnhandled: () => [
op(MachineOp.PushFrame),
op(HighLevelResolutionOpcode.Expr, value),
op(MachineOp.InvokeStatic, {
type: 'stdlib',
value: trusted ? 'trusting-append' : 'cautious-append',
}),
op(MachineOp.PopFrame),
],
});
ifTrue() {
return [
op(
Op.InvokePartial,
serializable(meta.referrer),
strArray(meta.evalSymbols!),
arr(evalInfo)
),
op(Op.PopScope),
op(MachineOp.PopFrame),
];
},
})
return value || null;
}
const METADATA: Option[] = fillNulls(Op.Size);
const MACHINE_METADATA: Option[] = fillNulls(MachineOp.Size);
MACHINE_METADATA[MachineOp.PushFrame] = {
name: 'PushFrame',
mnemonic: 'pushf',
before: null,
stackChange: 2,
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,
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);
}
}
out.push(
op(Op.RegisterComponentDestructor, $s0),
op(Op.GetComponentSelf, $s0),
op(Op.VirtualRootScope, $s0),
op(Op.SetVariable, 0),
op(Op.SetupForEval, $s0),
bindableAtNames ? op(Op.SetNamedVariables, $s0) : NONE,
bindableBlocks ? op(Op.SetBlocks, $s0) : NONE,
op(Op.Pop, 1),
op(Op.InvokeComponentLayout, $s0),
op(Op.DidRenderLayout, $s0),
op(MachineOp.PopFrame),
op(Op.PopScope),
op(Op.PopDynamicScope),
op(Op.CommitComponentTransaction)
);
return out as T;
}
let out: StatementCompileActions = [
op(Op.PutIterator),
op(Op.JumpUnless, label('ELSE')),
op(MachineOp.PushFrame),
op(Op.Dup, $fp, 1),
op(MachineOp.ReturnTo, label('ITER')),
op(Op.EnterList, label('BODY')),
op('Label', 'ITER'),
op(Op.Iterate, label('BREAK')),
op('Label', 'BODY'),
invokeStaticBlockWithStack(unwrap(blocks.get('default')), 2),
op(Op.Pop, 2),
op(MachineOp.Jump, label('FINALLY')),
op('Label', 'BREAK'),
op(Op.ExitList),
op(MachineOp.PopFrame),
op(MachineOp.Jump, label('FINALLY')),
op('Label', 'ELSE'),
];
if (blocks.has('else')) {
out.push(invokeStaticBlock(blocks.get('else')!));
}
return out;
},
});
export function InvokeStaticBlock(block: CompilableBlock): StatementCompileActions {
return [
op(MachineOp.PushFrame),
op('PushCompilable', block),
op('JitCompileBlock'),
op(MachineOp.InvokeVirtual),
op(MachineOp.PopFrame),
];
}
export function Call({ handle, params, hash }: CompileHelper): ExpressionCompileActions {
return [
op(MachineOp.PushFrame),
op('SimpleArgs', { params, hash, atNames: false }),
op(Op.Helper, handle),
op(MachineOp.PopFrame),
op(Op.Fetch, $v0),
];
}