private static void EmitBrkOrSync(EmitterContext context) { OpCodeBranchPop op = (OpCodeBranchPop)context.CurrOp; if (op.Targets.Count == 1) { // If we have only one target, then the SSY/PBK is basically // a branch, we can produce better codegen for this case. OpCodePush pushOp = op.Targets.Keys.First(); EmitBranch(context, pushOp.GetAbsoluteAddress()); } else { foreach (KeyValuePair <OpCodePush, int> kv in op.Targets) { OpCodePush pushOp = kv.Key; Operand label = context.GetLabel(pushOp.GetAbsoluteAddress()); Operand local = pushOp.PopOps[op]; int pushOpIndex = kv.Value; context.BranchIfTrue(label, context.ICompareEqual(local, Const(pushOpIndex))); } } }
private static void EmitPbkOrSsy(EmitterContext context) { OpCodePush op = (OpCodePush)context.CurrOp; foreach (KeyValuePair <OpCodeBranchPop, Operand> kv in op.PopOps) { OpCodeBranchPop opSync = kv.Key; Operand local = kv.Value; int pushOpIndex = opSync.Targets[op]; context.Copy(local, Const(pushOpIndex)); } }