当前位置: 首页>>代码示例>>C#>>正文


C# StackFrame.setMethod方法代码示例

本文整理汇总了C#中StackFrame.setMethod方法的典型用法代码示例。如果您正苦于以下问题:C# StackFrame.setMethod方法的具体用法?C# StackFrame.setMethod怎么用?C# StackFrame.setMethod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在StackFrame的用法示例。


在下文中一共展示了StackFrame.setMethod方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: execute

        /**
         *
         * Operand stack
         * ..., objectref, [arg1, [arg2 ...]]  ...
         */
        public override void execute(StackFrame frame)
        {
            ClassFile clazz = ToyVMClassLoader.loadClass(method.GetClassInfo().getClassName());

            ConstantPoolInfo_NameAndType nameAndType = method.GetMethodNameAndType();
            if (log.IsDebugEnabled) log.DebugFormat("Will be executing {0} on {1}",nameAndType,clazz.GetName());
            MethodInfo methodInfo = clazz.getMethod(nameAndType);
            StackFrame frame2 = new StackFrame(frame);
            int paramCount = method.getParameterCount();
            frame2.setMethod(clazz,methodInfo,paramCount);

            if (log.IsDebugEnabled) log.DebugFormat("Have {0} parameters",paramCount);
            if (log.IsDebugEnabled) log.DebugFormat("Max Locals: {0}",methodInfo.getMaxLocals());
            // push "this" as local variable 0

            //frame2.setThis((ToyVMObject)(frame2.getLocalVariables()[0]));

            // Store the parameters from the operand stack
            // into the local variables of the outgoing frame
            for (int i = paramCount;i >= 0; i--){
                frame2.getLocalVariables()[i]=frame.popOperand();
                if (log.IsDebugEnabled) log.DebugFormat("Set variable {0}={1}",(i),frame2.getLocalVariables()[i]);
            }

            clazz.execute(nameAndType,frame2);

            //Environment.Exit(0);
        }
开发者ID:jdewald,项目名称:toyvm,代码行数:33,代码来源:ByteCode_invokespecial.cs

示例2: execute

        public override void execute(StackFrame frame)
        {
            ClassFile clazz = ToyVMClassLoader.loadClass(method.GetClassInfo().getClassName());

            ConstantPoolInfo_NameAndType nameAndType = method.GetMethodNameAndType();
            if (log.IsDebugEnabled) log.DebugFormat("Will be executing {0} on {1}",nameAndType,clazz.GetName());
            MethodInfo methodInfo = clazz.getMethod(nameAndType);
            // TODO: Need better way of handling access to the method
            if (methodInfo == null){
                throw new ToyVMException("Unable to locate method " + nameAndType + " on " + clazz,frame);
            }
            StackFrame frame2 = new StackFrame(frame);

            int paramCount = method.getParameterCount();
            frame2.setMethod(clazz,methodInfo,paramCount);

            if (log.IsDebugEnabled) log.DebugFormat("Have {0} parameters",paramCount);
            // Store the parameters from the operand stack
            // into the local variables of the outgoing frame
            for (int i = paramCount; i > 0; i--){
                frame2.getLocalVariables()[i-1]=frame.popOperand();
                if (log.IsDebugEnabled) log.DebugFormat("Parameter {0} = {1}",i,frame2.getLocalVariables()[i-1]);
            }
            clazz.execute(nameAndType,frame2);
            /*methodInfo.execute(frame2);
            if (methodInfo != null){

            }
            else {
                throw new Exception("Unable to locate " + nameAndType.ToString());
            }
            */
        }
开发者ID:jdewald,项目名称:toyvm,代码行数:33,代码来源:ByteCode_invokestatic.cs

示例3: execute

        /**
         *
         * Operand stack
         * ..., objectref, [arg1, [arg2 ...]]  ...
         */
        public override void execute(StackFrame frame)
        {
            //ClassFile clazz = ToyVMClassLoader.loadClass(method.GetClassInfo().getClassName());

            ConstantPoolInfo_NameAndType nameAndType = method.GetMethodNameAndType();
            if (log.IsDebugEnabled) log.DebugFormat("Will be executing {0} on interface {1}",nameAndType,method.GetClassInfo().getClassName());

            int paramCount = method.getParameterCount();

            ArrayList locals = new ArrayList();
            for (int i = 0; i <= paramCount; i++){
                locals.Add(0);
            }

            // create temp version of the variables
            // so that we can get to the object
            // on the stack
            for (int i = paramCount; i >= 0; i--){
                locals[i] = frame.popOperand();
            }

            ClassFile clazz = ((Heap.HeapReference)locals[0]).type;

            StackFrame frame2 = new StackFrame(frame);

            frame2.setMethod(clazz,clazz.getMethod(nameAndType));

            if (log.IsDebugEnabled) log.DebugFormat("Have {0} parameters",paramCount);

            for (int i = 0;i <= paramCount; i++){
                frame2.getLocalVariables()[i] = locals[i];

            }

            clazz.execute(nameAndType,frame2);

            //Environment.Exit(0);
        }
开发者ID:jdewald,项目名称:toyvm,代码行数:43,代码来源:ByteCode_invokeinterface.cs

示例4: execute

        /**
         *
         * Operand stack
         * ..., objectref, [arg1, [arg2 ...]]  ...
         */
        public override void execute(StackFrame frame)
        {
            ConstantPoolInfo_NameAndType nameAndType = method.GetMethodNameAndType();
            if (log.IsDebugEnabled) log.DebugFormat("Will be executing {0} on class {1}",nameAndType,method.GetClassInfo().getClassName());

            int paramCount = method.getParameterCount();

            ArrayList locals = new ArrayList();
            for (int i = 0; i <= paramCount; i++){
                locals.Add(0);
            }

            // create temp version of the variables
            // so that we can get to the object
            // on the stack
            for (int i = paramCount; i >= 0; i--){
                locals[i] = frame.popOperand();
                if (log.IsDebugEnabled) log.DebugFormat("Parameter {0} is {1}",i,locals[i]);
            }

            ClassFile clazz = null;
            // for Object::getClass we actually
            // push the ClassFile onto the stack
            if (locals[0] is Heap.HeapReference){
                clazz = ((Heap.HeapReference)locals[0]).type;
            }
            else if (locals[0] is ClassFile){
                clazz = (ClassFile) locals[0];
            }
            StackFrame frame2 = new StackFrame(frame);

            frame2.setMethod(clazz,clazz.getMethod(nameAndType));

            if (log.IsDebugEnabled) log.DebugFormat("Have {0} parameters",paramCount);

            for (int i = 0;i <= paramCount; i++){
                frame2.getLocalVariables()[i] = locals[i];

            }

            clazz.execute(nameAndType,frame2);

            /*
            ClassFile clazz = ToyVMClassLoader.loadClass(method.GetClassInfo().getClassName());

            ConstantPoolInfo_NameAndType nameAndType = method.GetMethodNameAndType();
            if (log.IsDebugEnabled) log.DebugFormat("Will be executing {0} on {1}",nameAndType,clazz.GetName());

            StackFrame frame2 = new StackFrame(frame);
            frame2.setMethod(clazz,clazz.getMethod(nameAndType));
            int paramCount = method.getParameterCount();
            if (log.IsDebugEnabled) log.DebugFormat("Have {0} parameters",paramCount);
            // push "this" as local variable 0

            // Store the parameters from the operand stack
            // into the local variables of the outgoing frame
            for (int i = paramCount;i >= 0; i--){
                frame2.getLocalVariables()[i]=frame.popOperand();
                if (log.IsDebugEnabled) log.DebugFormat("Set variable {0}={1}",(i),frame2.getLocalVariables()[i]);
            }
            //frame2.getLocalVariables().Insert(0,frame.popOperand());

            clazz.execute(nameAndType,frame2);

            */
            //Environment.Exit(0);
        }
开发者ID:jdewald,项目名称:toyvm,代码行数:72,代码来源:ByteCode_invokevirtual.cs


注:本文中的StackFrame.setMethod方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。