Exemplo n.º 1
0
        public static void Sync(EmitterContext context)
        {
            OpCodeSync op = (OpCodeSync)context.CurrOp;

            if (op.Targets.Count == 1)
            {
                //If we have only one target, then the SSY is basically
                //a branch, we can produce better codegen for this case.
                OpCodeSsy opSsy = op.Targets.Keys.First();

                EmitBranch(context, opSsy.GetAbsoluteAddress());
            }
            else
            {
                foreach (KeyValuePair <OpCodeSsy, int> kv in op.Targets)
                {
                    OpCodeSsy opSsy = kv.Key;

                    Operand label = context.GetLabel(opSsy.GetAbsoluteAddress());

                    Operand local = opSsy.Syncs[op];

                    int ssyIndex = kv.Value;

                    context.BranchIfTrue(label, context.ICompareEqual(local, Const(ssyIndex)));
                }
            }
        }
Exemplo n.º 2
0
        public static void Ssy(EmitterContext context)
        {
            OpCodeSsy op = (OpCodeSsy)context.CurrOp;

            foreach (KeyValuePair <OpCodeSync, Operand> kv in op.Syncs)
            {
                OpCodeSync opSync = kv.Key;

                Operand local = kv.Value;

                int ssyIndex = opSync.Targets[op];

                context.Copy(local, Const(ssyIndex));
            }
        }