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


C# StackFrame.popOperand方法代码示例

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


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

示例1: execute

        public override void execute(StackFrame frame)
        {
            Object val2 = frame.popOperand();
            Object val1 = frame.popOperand();
            //Heap.HeapReference val2 = (Heap.HeapReference) frame.popOperand();
            //Heap.HeapReference val1 = (Heap.HeapReference) frame.popOperand();

            bool eval = false;
            switch (opval){
             case OP_EQ:{
                eval = (val1 == val2);

                break;
            }
            case OP_NE:{
                eval = (val1 != val2);
                break;
            }
            default: throw new ToyVMException("Not handling " + opval,frame);
            }

            if (eval){
                int pc = frame.getProgramCounter();
                frame.setProgramCounter(pc + branch - size);
            }
        }
开发者ID:jdewald,项目名称:toyvm,代码行数:26,代码来源:ByteCode_if_acmp.cs

示例2: execute

        public override void execute(StackFrame frame)
        {
            float val1 = (float) frame.popOperand();
            float val2 = (float) frame.popOperand();

            frame.pushOperand(val1 + val2);
        }
开发者ID:jdewald,项目名称:toyvm,代码行数:7,代码来源:ByteCode_fadd.cs

示例3: execute

        public override void execute(StackFrame frame)
        {
            double val1 = (double) frame.popOperand();
            double val2 = (double) frame.popOperand();

            frame.pushOperand(val2 - val1);
        }
开发者ID:jdewald,项目名称:toyvm,代码行数:7,代码来源:ByteCode_dsub.cs

示例4: execute

        public override void execute(StackFrame frame)
        {
            long val1 = (long) frame.popOperand();
            long val2 = (long) frame.popOperand();

            frame.pushOperand(val1 & val2);
        }
开发者ID:jdewald,项目名称:toyvm,代码行数:7,代码来源:ByteCode_land.cs

示例5: execute

 public override void execute(StackFrame frame)
 {
     frame.popOperand();
     if (count == 2){
         frame.popOperand();
     }
 }
开发者ID:jdewald,项目名称:toyvm,代码行数:7,代码来源:ByteCode_pop.cs

示例6: execute

        public override void execute(StackFrame frame)
        {
            int val1 = (int) frame.popOperand();
            int val2 = (int) frame.popOperand();

            frame.pushOperand(val1 & val2);
        }
开发者ID:jdewald,项目名称:toyvm,代码行数:7,代码来源:ByteCode_iand.cs

示例7: execute

        public override void execute(StackFrame frame)
        {
            if (depth > 0){
                throw new ToyVMException("Don't support dup2 with depth of " + depth,frame);
            }
            Object obj = frame.popOperand();
            Object obj2 = null;
            if (frame.hasMoreOperands()){
                obj2 = frame.popOperand();
            }

            /*System.Collections.Stack temp = new System.Collections.Stack();
            for (int i = 0; i < depth; i++){
                temp.Push(frame.popOperand());
            }
            frame.pushOperand(obj); // insert at depth depth

            while (temp.Count > 0){
                frame.pushOperand(temp.Pop());
            }
            */
            frame.pushOperand(obj); // put the duplicated one back on top
            if (obj2 != null){
                frame.pushOperand(obj2);
            }

            frame.pushOperand(obj); // put the duplicated one back on top
            if (obj2 != null){
                frame.pushOperand(obj2);
            }
        }
开发者ID:jdewald,项目名称:toyvm,代码行数:31,代码来源:ByteCode_dup2.cs

示例8: execute

        public override void execute(StackFrame frame)
        {
            Object val = frame.popOperand();
            int index = (int) frame.popOperand();
            Heap.HeapReference heapRef = (Heap.HeapReference) frame.popOperand();

            if (! heapRef.isArray){
                throw new ToyVMException("Expected array, got " + heapRef,frame);
            }

            if (! heapRef.isPrimitive){
                ArrayList arr = (ArrayList) heapRef.obj;

                arr[index] = val;
            }
            else if (heapRef.primitiveType.Equals(Type.GetType("System.Char[]"))){
                ArrayList arr = (ArrayList) heapRef.obj;

                arr[index] = val;
                //System.Char[][] arr = (System.Char[][]) heapRef.obj;
                //Heap.HeapReference arrVal = (Heap.HeapReference)val;
                //arr[index] = (System.Char[])arrVal.obj;
            }
            else {
                throw new ToyVMException("Can't handle " + heapRef,frame);
            }
            if (log.IsDebugEnabled) log.DebugFormat("Stored {0} at index {1}",val,index);
        }
开发者ID:jdewald,项目名称:toyvm,代码行数:28,代码来源:ByteCode_aastore.cs

示例9: execute

        // value1,value2 => ...
        public override void execute(StackFrame frame)
        {
            int value2 = (int) frame.popOperand();
            int value1 = (int) frame.popOperand();

            frame.pushOperand(value1 - (value1 / value2) * value2);
            // TODO: something is broken up higher
            //frame.pushOperand(0);
        }
开发者ID:jdewald,项目名称:toyvm,代码行数:10,代码来源:ByteCode_irem.cs

示例10: execute

        /**
         * Left shift val1 by amount in low 5 bits of val2
         */
        public override void execute(StackFrame frame)
        {
            long val2 = (long) frame.popOperand();
            long val1 = (long) frame.popOperand();

            val1 = (0xFFFFFFFF & ((val1 << (int)(val2 & 0x3F))));

            frame.pushOperand(val1);
        }
开发者ID:jdewald,项目名称:toyvm,代码行数:12,代码来源:ByteCode_lshl.cs

示例11: execute

        /**
         * Right shift val1 by amount in low 5 bits of val2
         */
        public override void execute(StackFrame frame)
        {
            int val2 = (int) frame.popOperand();
            int val1 = (int) frame.popOperand();

            val1 = (0xFFFF & ((val1 >> (val2 & 0x1F))));

            frame.pushOperand(val1);
        }
开发者ID:jdewald,项目名称:toyvm,代码行数:12,代码来源:ByteCode_ishr.cs

示例12: execute

        public override void execute(StackFrame frame)
        {
            float val1 = Single.Parse(frame.popOperand().ToString());
            float val2 = Single.Parse(frame.popOperand().ToString());

            //if (log.IsDebugEnabled) log.DebugFormat("val1 is {0}",val1.GetType());
            //if (log.IsDebugEnabled) log.DebugFormat("val2 is {0}",val2.GetType());

            frame.pushOperand((float)val1 * (float)val2);
        }
开发者ID:jdewald,项目名称:toyvm,代码行数:10,代码来源:ByteCode_fmul.cs

示例13: execute

        public override void execute(StackFrame frame)
        {
            float value2 = Single.Parse(frame.popOperand().ToString());
            float value1 = Single.Parse(frame.popOperand().ToString());

            // TODO: handle NaN
            if (value1 > value2) { frame.pushOperand(1); }
            else if (value1.Equals(value2)) { frame.pushOperand(0); }
            else { frame.pushOperand(-1); }
        }
开发者ID:jdewald,项目名称:toyvm,代码行数:10,代码来源:ByteCode_fcmp.cs

示例14: execute

        public override void execute(StackFrame frame)
        {
            double val1 = Double.Parse(frame.popOperand().ToString());
            double val2 = Double.Parse(frame.popOperand().ToString());

            //if (log.IsDebugEnabled) log.DebugFormat("val1 is {0}",val1.GetType());
            //if (log.IsDebugEnabled) log.DebugFormat("val2 is {0}",val2.GetType());

            frame.pushOperand(val1 * val2);
        }
开发者ID:jdewald,项目名称:toyvm,代码行数:10,代码来源:ByteCode_dmul.cs

示例15: execute

        /**
         * Grabs a character from the array and pushes onto stack as an integer
         */
        public override void execute(StackFrame frame)
        {
            int index = (int) frame.popOperand();
            Heap.HeapReference heapRef = (Heap.HeapReference) frame.popOperand();

            if (! heapRef.isArray){
                throw new ToyVMException("Expected array, got " + heapRef,frame);
            }

            System.Char[] arr = (System.Char[]) heapRef.obj;

            frame.pushOperand((int)arr[index]);
        }
开发者ID:jdewald,项目名称:toyvm,代码行数:16,代码来源:ByteCode_caload.cs


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