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

ComputeHeader() private method

private ComputeHeader ( ) : void
return void
        void ComputeHeader()
        {
            int offset = 0;
            var instructions = body.instructions;
            var items = instructions.items;
            var count = instructions.size;
            var stack_size = 0;
            var max_stack = 0;
            Dictionary<Instruction, int> stack_sizes = null;

            if (body.HasExceptionHandlers)
                ComputeExceptionHandlerStackSize (ref stack_sizes);

            for (int i = 0; i < count; i++) {
                var instruction = items [i];
                instruction.offset = offset;
                offset += instruction.GetSize ();

                ComputeStackSize (instruction, ref stack_sizes, ref stack_size, ref max_stack);
            }

            body.code_size = offset;
            body.max_stack_size = max_stack;
        }

Usage Example

Esempio n. 1
0
 public void ComputeHeader()
 {
     CodeWriter.ComputeHeader(this);
 }