Mono.Cecil.Cil.CodeWriter.CopyBranchStackSize C# (CSharp) Method

CopyBranchStackSize() static private method

static private CopyBranchStackSize ( int>.Dictionary &stack_sizes, Instruction target, int stack_size ) : void
stack_sizes int>.Dictionary
target Instruction
stack_size int
return void
        static void CopyBranchStackSize(ref Dictionary<Instruction, int> stack_sizes, Instruction target, int stack_size)
        {
            if (stack_sizes == null)
                stack_sizes = new Dictionary<Instruction, int> ();

            int branch_stack_size = stack_size;

            int computed_size;
            if (stack_sizes.TryGetValue (target, out computed_size))
                branch_stack_size = System.Math.Max (branch_stack_size, computed_size);

            stack_sizes [target] = branch_stack_size;
        }

Same methods

CodeWriter::CopyBranchStackSize ( Instruction instruction, int>.Dictionary &stack_sizes, int stack_size ) : void

Usage Example

        private static void CopyBranchStackSize(Instruction instruction, ref Dictionary <Instruction, int> stack_sizes, int stack_size)
        {
            if (stack_size == 0)
            {
                return;
            }
            OperandType operandType = instruction.opcode.OperandType;

            if (operandType != OperandType.InlineBrTarget)
            {
                if (operandType == OperandType.InlineSwitch)
                {
                    Instruction[] instructionArray = (Instruction[])instruction.operand;
                    for (int i = 0; i < (int)instructionArray.Length; i++)
                    {
                        CodeWriter.CopyBranchStackSize(ref stack_sizes, instructionArray[i], stack_size);
                    }
                }
                else if (operandType == OperandType.ShortInlineBrTarget)
                {
                    CodeWriter.CopyBranchStackSize(ref stack_sizes, (Instruction)instruction.operand, stack_size);
                    return;
                }
                return;
            }
            CodeWriter.CopyBranchStackSize(ref stack_sizes, (Instruction)instruction.operand, stack_size);
        }
All Usage Examples Of Mono.Cecil.Cil.CodeWriter::CopyBranchStackSize