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
Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        private static void ComputeStackSize(Instruction instruction, ref Dictionary <Instruction, int> stack_sizes, ref int stack_size, ref int max_stack)
        {
            int num;

            if (stack_sizes != null && stack_sizes.TryGetValue(instruction, out num))
            {
                stack_size = num;
            }
            max_stack = System.Math.Max(max_stack, stack_size);
            CodeWriter.ComputeStackDelta(instruction, ref stack_size);
            max_stack = System.Math.Max(max_stack, stack_size);
            CodeWriter.CopyBranchStackSize(instruction, ref stack_sizes, stack_size);
            CodeWriter.ComputeStackSize(instruction, ref stack_size);
        }