loopStack.push(loop);
// End of iteration jumps here
s.addInstr(new LabelInstr(loop.loopStartLabel));
if (isLoopHeadCondition) {
Operand cv = build(conditionNode, s);
s.addInstr(BEQInstr.create(cv, isWhile ? manager.getFalse() : manager.getTrue(), setupResultLabel));
}
// Redo jumps here
s.addInstr(new LabelInstr(loop.iterStartLabel));
// Thread poll at start of iteration -- ensures that redos and nexts run one thread-poll per iteration
s.addInstr(new ThreadPollInstr(true));
// Build body
if (bodyNode != null) build(bodyNode, s);
// Next jumps here
s.addInstr(new LabelInstr(loop.iterEndLabel));
if (isLoopHeadCondition) {
s.addInstr(new JumpInstr(loop.loopStartLabel));
} else {
Operand cv = build(conditionNode, s);
s.addInstr(BEQInstr.create(cv, isWhile ? manager.getTrue() : manager.getFalse(), loop.iterStartLabel));
}
// Loop result -- nil always
s.addInstr(new LabelInstr(setupResultLabel));