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


C# StackFrame.pushOperand方法代码示例

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


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

示例1: 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

示例2: execute

        public override void execute(StackFrame frame)
        {
            Object o = frame.popOperand();
            if (! (o is NullValue)){
                Heap.HeapReference heapRef = (Heap.HeapReference) o;

                // we only handle class right now
                ClassFile tClass = (ClassFile) heapRef.type;

                do {
                    if (tClass.GetName().Equals(className)){
                        frame.pushOperand(1);
                        return;
                    }

                    if (tClass.implements(className)){
                        frame.pushOperand(1);
                        return;
                    }
                    tClass = tClass.GetSuperClassFile();

                } while (tClass != null);

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

示例3: 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

示例4: execute

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

            string className = reference.getClassName();
            if (! className.StartsWith("[")){
                frame.pushOperand(Heap.GetInstance().newArray(ToyVMClassLoader.loadClass(className),count));
            }
            else {
                frame.pushOperand(Heap.GetInstance().new2DArray(className.Substring(1),count));
            }
        }
开发者ID:jdewald,项目名称:toyvm,代码行数:12,代码来源:ByteCode_anewarray.cs

示例5: 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

示例6: 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

示例7: 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

示例8: execute

        public override void execute(StackFrame frame)
        {
            Object obj = 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
        }
开发者ID:jdewald,项目名称:toyvm,代码行数:16,代码来源:ByteCode_dup.cs

示例9: 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

示例10: execute

        public override void execute(StackFrame frame)
        {
            //ToyVMObject obj = new ToyVMObject(classRef);
            Heap.HeapReference heapRef = Heap.GetInstance().newInstance(ToyVMClassLoader.loadClass(classRef.getClassName()));

            if (log.IsDebugEnabled) log.DebugFormat("executing new from {0}",frame);
            frame.pushOperand(heapRef);
        }
开发者ID:jdewald,项目名称:toyvm,代码行数:8,代码来源:ByteCode_new.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

        // 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

示例13: 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

示例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

        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


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