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


C# VirtualMachine.AddInstructions方法代码示例

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


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

示例1: Emit

        public override void Emit(VirtualMachine.InstructionList into, OperationDestination Destination)
        {
            into.SetPendingAnnotation(this.ToString());

            into.AddInstructions("ALLOC_RSO NEXT PUSH", ResultType.Size);
            into.AddInstructions("STORE_RSO_M NEXT PEEK NEXT", ResultType.ID, 0); //Store type id

            if (Constructor != null)
            {
                if (Constructor.OwnerContextID == Scope.EnvironmentContext.ID && Constructor.OwnerContextID != 0)
                {
                    into.AddInstructions("CALL NEXT #" + Constructor.DescriptiveHeader, 0);
                    Constructor.Body.CallPoints.Add(into.Count - 1);
                }
                else
                {
                    into.AddInstructions("STACK_INVOKE NEXT", Constructor.MakeInvokableFunction());
                }
            }

            if (Initializers != null)
            {
                foreach (var initializer in Initializers)
                    initializer.Emit(into, OperationDestination.Discard);

            }

            if (Destination != OperationDestination.Stack)
                into.AddInstructions("MOVE POP " + WriteOperand(Destination));
        }
开发者ID:Blecki,项目名称:EtcScript,代码行数:30,代码来源:New.cs

示例2: Emit

            public override void Emit(VirtualMachine.InstructionList into, Ast.OperationDestination Destination)
            {
                //Prepare loop control variables
                List.Emit(into, Ast.OperationDestination.Stack);	//[email protected]
                LengthFunc.Emit(into, Ast.OperationDestination.Stack); //[email protected]
                into.AddInstructions("MOVE NEXT PUSH # SET [email protected]", 0);			//[email protected]

                var LoopStart = into.Count;

                into.AddInstructions(
                    "LOAD_PARAMETER NEXT R #" + TotalVariable.Name, TotalVariable.Offset,
                    "GREATER_EQUAL PEEK R R #PEEK = [email protected]",
                    "IF_TRUE R",
                    "JUMP NEXT", 0);

                var BreakPoint = into.Count - 1;

                Indexer.Emit(into, Ast.OperationDestination.Stack);
                Body.Emit(into, Ast.OperationDestination.Discard);

                into.AddInstructions(
                    "MOVE POP #REMOVE [email protected]",
                    "INCREMENT PEEK PEEK",
                    "JUMP NEXT", LoopStart);

                into[BreakPoint] = into.Count;

                into.AddInstructions("CLEANUP NEXT #REMOVE [email protected], [email protected], [email protected]", 3);
            }
开发者ID:Blecki,项目名称:EtcScript,代码行数:29,代码来源:ForeachXInList.cs

示例3: Emit

            public override void Emit(VirtualMachine.InstructionList into, Ast.OperationDestination Destination)
            {
                Max.Emit(into, Ast.OperationDestination.Stack);
                Min.Emit(into, Ast.OperationDestination.Stack);

                var LoopStart = into.Count;

                into.AddInstructions(
                    "LOAD_PARAMETER NEXT R", TotalVariable.Offset,
                    "GREATER PEEK R R",
                    "IF_TRUE R",
                    "JUMP NEXT", 0);

                var BreakPoint = into.Count - 1;

                into.AddInstructions("MOVE PEEK PUSH");

                Body.Emit(into, Ast.OperationDestination.Discard);

                into.AddInstructions(
                    "MOVE POP",
                    "INCREMENT PEEK PEEK",
                    "JUMP NEXT", LoopStart);

                into[BreakPoint] = into.Count;

                into.AddInstructions(
                    "MOVE POP",
                    "MOVE POP");
            }
开发者ID:Blecki,项目名称:EtcScript,代码行数:30,代码来源:ForeachXFromMinToMax.cs

示例4: Emit

 public override void Emit(VirtualMachine.InstructionList into, OperationDestination Destination)
 {
     Value.Emit(into, OperationDestination.R);
     into.AddInstructions("ALLOC_RSO NEXT PUSH", 3,
         "STORE_RSO_M NEXT PEEK NEXT", ResultType.ID, 0,
         "STORE_RSO_M NEXT PEEK NEXT", Value.ResultType.ID, 1,
         "STORE_RSO_M R PEEK NEXT", 2);
     if (Destination != OperationDestination.Stack)
         into.AddInstructions("MOVE POP " + WriteOperand(Destination));
 }
开发者ID:Blecki,项目名称:EtcScript,代码行数:10,代码来源:Box.cs

示例5: Emit

        public override void Emit(VirtualMachine.InstructionList into, OperationDestination Destination)
        {
            into.SetPendingAnnotation(this.ToString());

            foreach (var n in Parameters)
                n.Emit(into, OperationDestination.Stack);
            into.AddInstructions("COMPAT_INVOKE NEXT", Parameters.Count);
            if (Destination != OperationDestination.R && Destination != OperationDestination.Discard)
                into.AddInstructions("MOVE R " + Node.WriteOperand(Destination));
        }
开发者ID:Blecki,项目名称:EtcScript,代码行数:10,代码来源:CompatibleCall.cs

示例6: Emit

        public override void Emit(VirtualMachine.InstructionList into, OperationDestination Destination)
        {
            into.SetPendingAnnotation(this.ToString());

            foreach (var arg in Arguments)
                arg.Emit(into, OperationDestination.Stack);
            into.AddInstructions("STACK_INVOKE NEXT", Function.MakeInvokableFunction());
            if (Arguments.Count > 0) into.AddInstructions("CLEANUP NEXT", Arguments.Count);
            if (Destination != OperationDestination.R && Destination != OperationDestination.Discard)
                into.AddInstructions("MOVE R " + Node.WriteOperand(Destination));
        }
开发者ID:Blecki,项目名称:EtcScript,代码行数:11,代码来源:StackCall.cs

示例7: Emit

        public override void Emit(VirtualMachine.InstructionList into, OperationDestination Destination)
        {
            into.SetPendingAnnotation(this.ToString());

            if (Value != null)
                Value.Emit(into, OperationDestination.R);
            else
                into.AddInstructions("MOVE NEXT R", 0);

            into.AddInstructions("JUMP NEXT", 0);
            DeclarationScope.RecordReturnJumpSource(into.Count - 1);
        }
开发者ID:Blecki,项目名称:EtcScript,代码行数:12,代码来源:Return.cs

示例8: EmitAssignment

 public void EmitAssignment(VirtualMachine.InstructionList into)
 {
     if (Name.Type == TokenType.Identifier)
     {
         if (MatchedVariable.StorageMethod == VariableStorageMethod.Local)
             into.AddInstructions("STORE_PARAMETER POP NEXT", MatchedVariable.Offset);
         else if (MatchedVariable.StorageMethod == VariableStorageMethod.Static)
             into.AddInstructions("STORE_STATIC POP NEXT", MatchedVariable.Offset);
         else
             throw new NotImplementedException();
     }
     else
         throw new InvalidOperationException();
 }
开发者ID:Blecki,项目名称:EtcScript,代码行数:14,代码来源:Identifier.cs

示例9: Emit

        public override void Emit(VirtualMachine.InstructionList Instructions, OperationDestination Destination)
        {
            Instructions.AddInstructions("EMPTY_LIST PUSH");

            foreach (var member in Members)
            {
                member.Emit(Instructions, OperationDestination.R);
                Instructions.AddInstructions("APPEND R PEEK PEEK");
            }

            if (Destination == OperationDestination.Discard)
                Instructions.AddInstructions("MOVE POP");
            else if (Destination != OperationDestination.Top)
                Instructions.AddInstructions("MOVE POP " + WriteOperand(Destination));
        }
开发者ID:Blecki,项目名称:EtcScript,代码行数:15,代码来源:AssembleList.cs

示例10: EmitUnbox

        public static void EmitUnbox(
			VirtualMachine.InstructionList into, 
			OperationDestination Source, 
			OperationDestination Destination)
        {
            into.AddInstructions("LOAD_RSO_M " + ReadOperand(Source) + " NEXT " + WriteOperand(Destination), 2);
        }
开发者ID:Blecki,项目名称:EtcScript,代码行数:7,代码来源:Box.cs

示例11: EmitInstructions

        public virtual void EmitInstructions(ParseScope DeclarationScope, VirtualMachine.InstructionList Into)
        {
            if (Instructions != null) throw new InvalidOperationException("Instructions should not be emitted twice");

            CleanupPoint = Into.Count;

            if (CleanupCall >= 0)
                Into[CleanupCall] = CleanupPoint;

            Into.AddInstructions("CLEANUP NEXT #Cleanup " + Name, DeclarationScope.Owner.ActualParameterCount, "RETURN POP");

            Instructions = Into;
            EntryPoint = Into.Count;
            Instructions.AddInstructions("MOVE F PUSH #Enter " + Name, "MARK_STACK F");
            Body.Emit(Instructions, Ast.OperationDestination.Discard);
            //Instructions.AddInstructions("MOVE NEXT R", 0); //If a function has no return statement, it returns 0.
            var returnJumpPoint = Instructions.Count;
            Instructions.AddInstructions(
                "RESTORE_STACK F",
                "MOVE POP F",
                "RETURN POP");

            System.Diagnostics.Debug.Assert(DeclarationScope.Type == ScopeType.Function);
            System.Diagnostics.Debug.Assert(DeclarationScope.ReturnJumpSources != null);

            foreach (var point in DeclarationScope.ReturnJumpSources)
                Instructions[point] = returnJumpPoint;
        }
开发者ID:Blecki,项目名称:EtcScript,代码行数:28,代码来源:LambdaBlock.cs

示例12: Emit

        public override void Emit(VirtualMachine.InstructionList into, OperationDestination Destination)
        {
            into.SetPendingAnnotation(this.ToString());

            Header.Emit(into, OperationDestination.R);
            into.AddInstructions("IF_FALSE R", "JUMP NEXT", 0);
            var jumpFrom = into.Count - 1;
            ThenBlock.Emit(into, OperationDestination.Discard);
            if (ElseBlock != null)
            {
                into.AddInstructions("JUMP NEXT", 0);
                into[jumpFrom] = into.Count;
                jumpFrom = into.Count - 1;
                ElseBlock.Emit(into, OperationDestination.Discard);
            }
            into[jumpFrom] = into.Count;
        }
开发者ID:Blecki,项目名称:EtcScript,代码行数:17,代码来源:If.cs

示例13: Emit

        public override void Emit(VirtualMachine.InstructionList into, OperationDestination Destination)
        {
            into.SetPendingAnnotation(this.ToString());

            //Assumes the RSO is on the top of the stack.
            Value.Emit(into, OperationDestination.R);
            into.AddInstructions("STORE_RSO_M R PEEK NEXT", Member.Offset);
        }
开发者ID:Blecki,项目名称:EtcScript,代码行数:8,代码来源:Initializer.cs

示例14: Emit

            public override void Emit(VirtualMachine.InstructionList into, Ast.OperationDestination Destination)
            {
                var LoopStart = into.Count;

                Condition.Emit(into, Ast.OperationDestination.R);

                into.AddInstructions(
                    "IF_FALSE R",
                    "JUMP NEXT", 0);

                var BreakPoint = into.Count - 1;

                Body.Emit(into, Ast.OperationDestination.Discard);

                into.AddInstructions("JUMP NEXT", LoopStart);

                into[BreakPoint] = into.Count;
            }
开发者ID:Blecki,项目名称:EtcScript,代码行数:18,代码来源:WhileCondition.cs

示例15: EmitInstructions

        public override void EmitInstructions(ParseScope DeclarationScope, VirtualMachine.InstructionList Into)
        {
            if (Instructions != null) throw new InvalidOperationException("Instructions should not be emitted twice");

            CleanupPoint = Into.Count;

            if (CleanupCall >= 0)
                Into[CleanupCall] = CleanupPoint;

            Into.AddInstructions("CLEANUP NEXT #Cleanup when clause for " + Name,
                DeclarationScope.Owner.ActualParameterCount, "RETURN POP");

            Instructions = Into;
            EntryPoint = Into.Count;
            Instructions.AddInstructions("MOVE F PUSH #Enter " + Name, "MARK_STACK F");
            Body.Emit(Instructions, Ast.OperationDestination.R);
            Instructions.AddInstructions(
                "RESTORE_STACK F",
                "MOVE POP F",
                "RETURN POP");
        }
开发者ID:Blecki,项目名称:EtcScript,代码行数:21,代码来源:WhenClause.cs


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