Exemplo n.º 1
0
        public void Dump()
        {
            int args = _arguments.Len;
            int locs = _locals.Len;

            System.Console.Write("[args");
            for (int i = 0; i < args; ++i)
            {
                System.Console.Write(" " + _stack[i]);
            }
            System.Console.Write("]");
            System.Console.Write("[locs");
            for (int i = 0; i < locs; ++i)
            {
                System.Console.Write(" " + _stack[args + i]);
            }
            System.Console.Write("]");
            for (int i = args + locs; i < _stack.Size(); ++i)
            {
                System.Console.Write(" " + _stack[i]);
            }
            System.Console.WriteLine();
        }
Exemplo n.º 2
0
        public State(Mono.Cecil.MethodDefinition md, int level)
        {
            int args = 0;

            if (md.HasThis)
            {
                args++;
            }
            args += md.Parameters.Count;
            int locals = md.Body.Variables.Count;

            // Create a stack with variables, which will be
            // bound to phi functions.
            _stack = new StackQueue <SSA.Value>();
            // Allocate parameters, even though we don't what they may be.
            _arguments = _stack.Section(_stack.Count, args);
            for (int i = 0; i < args; ++i)
            {
                _stack.Push(new SSA.Variable());
            }

            // Allocate local variables.
            _locals = _stack.Section(_stack.Count, locals);
            for (int i = 0; i < locals; ++i)
            {
                _stack.Push(new SSA.Variable());
            }

            for (int i = _stack.Size(); i < level; ++i)
            {
                _stack.Push(new SSA.Variable());
            }

            _bindings = new List <Nesting>();
            _bindings.Add(new Nesting());
        }