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


C# StackBehaviour类代码示例

本文整理汇总了C#中StackBehaviour的典型用法代码示例。如果您正苦于以下问题:C# StackBehaviour类的具体用法?C# StackBehaviour怎么用?C# StackBehaviour使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: MSILOpCode

 internal MSILOpCode(string name, byte[] bytes, OperandType operandType, StackBehaviour stackBehaviour)
 {
     Name = name;
     Bytes = bytes;
     OperandType = operandType;
     StackBehaviour = stackBehaviour;
 }
开发者ID:Rex-Hays,项目名称:GNIDA2,代码行数:7,代码来源:MSILOpCode.cs

示例2: OpCode

		internal OpCode(string name, Code code, OperandType operandType, FlowControl flowControl, OpCodeType opCodeType, StackBehaviour push, StackBehaviour pop) {
			this.Name = name;
			this.Code = code;
			this.OperandType = operandType;
			this.FlowControl = flowControl;
			this.OpCodeType = opCodeType;
			this.StackBehaviourPush = push;
			this.StackBehaviourPop = pop;
			if (((ushort)code >> 8) == 0)
				OpCodes.OneByteOpCodes[(byte)code] = this;
			else if (((ushort)code >> 8) == 0xFE)
				OpCodes.TwoByteOpCodes[(byte)code] = this;
		}
开发者ID:EmilZhou,项目名称:dnlib,代码行数:13,代码来源:OpCode.cs

示例3: OpCode

 internal OpCode(string stringname, StackBehaviour pop, StackBehaviour push, System.Reflection.Emit.OperandType operand, System.Reflection.Emit.OpCodeType type, int size, byte s1, byte s2, System.Reflection.Emit.FlowControl ctrl, bool endsjmpblk, int stack)
 {
     this.m_stringname = stringname;
     this.m_pop = pop;
     this.m_push = push;
     this.m_operand = operand;
     this.m_type = type;
     this.m_size = size;
     this.m_s1 = s1;
     this.m_s2 = s2;
     this.m_ctrl = ctrl;
     this.m_endsUncondJmpBlk = endsjmpblk;
     this.m_stackChange = stack;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:14,代码来源:OpCode.cs

示例4: OpCode

        internal OpCode(int x, int y)
        {
            m_op1 = (byte)((x >> 0) & 0xff);
            m_op2 = (byte)((x >> 8) & 0xff);
            m_code = (Code)((x >> 16) & 0xff);
            m_flowControl = (FlowControl)((x >> 24) & 0xff);
            m_size = 0;
            m_name = "";

            m_opCodeType = (OpCodeType)((y >> 0) & 0xff);
            m_operandType = (OperandType)((y >> 8) & 0xff);
            m_stackBehaviourPop = (StackBehaviour)((y >> 16) & 0xff);
            m_stackBehaviourPush = (StackBehaviour)((y >> 24) & 0xff);
        }
开发者ID:KenMacD,项目名称:deconfuser,代码行数:14,代码来源:OpCode.cs

示例5: OpCode

 internal OpCode(string name, byte op1, byte op2, int size, FlowControl flowControl,
     OpCodeType opCodeType, OperandType operandType,
     StackBehaviour pop, StackBehaviour push)
 {
     m_name = name;
     m_op1 = op1;
     m_op2 = op2;
     m_size = size;
     m_flowControl = flowControl;
     m_opCodeType = opCodeType;
     m_operandType = operandType;
     m_stackBehaviourPop = pop;
     m_stackBehaviourPush = push;
 }
开发者ID:leftouterjoin,项目名称:loj-prj1,代码行数:14,代码来源:OpCode.cs

示例6: GetNumOperands

        /// <summary>
        /// Returns the number of elements being pushed or popped by a specific StackBehavior.
        /// </summary>
        /// <param name="sb">a StackBehavior</param>
        /// <returns>number of elements being pushed (i.e. positive number) or -(number of elements being popped) (i.e. negative number)</returns>
        public static int GetNumOperands(StackBehaviour sb)
        {
            switch (sb)
            {
                case StackBehaviour.Pop0:
                case StackBehaviour.Push0:
                case StackBehaviour.Varpop:
                case StackBehaviour.Varpush:
                    return 0;

                case StackBehaviour.Pop1:
                case StackBehaviour.Popi:
                case StackBehaviour.Popref:
                    return -1;

                case StackBehaviour.Pop1_pop1:
                case StackBehaviour.Popi_pop1:
                case StackBehaviour.Popi_popi:
                case StackBehaviour.Popi_popi8:
                case StackBehaviour.Popi_popr4:
                case StackBehaviour.Popi_popr8:
                case StackBehaviour.Popref_pop1:
                case StackBehaviour.Popref_popi:
                    return -2;

                case StackBehaviour.Popi_popi_popi:
                case StackBehaviour.Popref_popi_pop1:
                case StackBehaviour.Popref_popi_popi:
                case StackBehaviour.Popref_popi_popi8:
                case StackBehaviour.Popref_popi_popr4:
                case StackBehaviour.Popref_popi_popr8:
                case StackBehaviour.Popref_popi_popref:
                    return -3;

                case StackBehaviour.Push1:
                case StackBehaviour.Pushi:
                case StackBehaviour.Pushi8:
                case StackBehaviour.Pushr4:
                case StackBehaviour.Pushr8:
                case StackBehaviour.Pushref:
                    return 1;

                case StackBehaviour.Push1_push1:
                    return 2;

                default:
                    throw new NotImplementedException();
            }
        }
开发者ID:venusdharan,项目名称:systemsharp,代码行数:54,代码来源:StackInfluenceAnalyzer.cs

示例7: OpCode

	internal OpCode(String stringname, StackBehaviour pop, StackBehaviour push, OperandType operand, OpCodeType type, int size, byte s1, byte s2, FlowControl ctrl, bool endsjmpblk, int stack)
	{
		m_stringname = stringname;
		m_pop = pop;
		m_push = push;
		m_operand = operand;
		m_type = type;
		m_size = size;
		m_s1 = s1;
		m_s2 = s2;
		m_ctrl = ctrl;
		m_endsUncondJmpBlk = endsjmpblk;
		m_stackChange = stack;

	}
开发者ID:ArildF,项目名称:masters,代码行数:15,代码来源:opcode.cs

示例8: VerifyOpCodeStackBehaviourPush

    private bool VerifyOpCodeStackBehaviourPush(OpCode op1, StackBehaviour sb, string errNum)
    {
        bool retVal = true;

        try
        {
            if (op1.StackBehaviourPush != sb)
            {
                TestLibrary.TestFramework.LogError(errNum, "Result is not the value as expected,push behaviour is: " + op1.StackBehaviourPush + ",Expected is: " + sb);
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError(errNum, "Unexpected exception: " + e);
            retVal = false;
        }
        return retVal;
    }
开发者ID:CheneyWu,项目名称:coreclr,代码行数:19,代码来源:opcodestackbehaviourpush.cs

示例9: OpCode

	// Construct a new opcode.
	internal OpCode(String name, int value, FlowControl flowControl,
					OpCodeType opcodeType, OperandType operandType,
					StackBehaviour stackPop, StackBehaviour stackPush)
			{
				this.name = name;
				this.value = (short)value;
				this.flowControl = (byte)flowControl;
				this.opcodeType = (byte)opcodeType;
				this.operandType = (byte)operandType;
				if(value < 0x0100)
				{
					this.size = (byte)1;
				}
				else
				{
					this.size = (byte)2;
				}
				this.stackPop = (byte)stackPop;
				this.stackPush = (byte)stackPush;
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:21,代码来源:OpCode.cs

示例10: OpCode

        internal OpCode(string name, byte op1, byte op2, int size,
			Code code, FlowControl flowControl,
			OpCodeType opCodeType, OperandType operandType,
			StackBehaviour pop, StackBehaviour push)
        {
            m_name = name;
            m_op1 = op1;
            m_op2 = op2;
            m_size = size;
            m_code = code;
            m_flowControl = flowControl;
            m_opCodeType = opCodeType;
            m_operandType = operandType;
            m_stackBehaviourPop = pop;
            m_stackBehaviourPush = push;

            if (op1 == 0xff)
                OpCodes.OneByteOpCode [op2] = this;
            else
                OpCodes.TwoBytesOpCode [op2] = this;
        }
开发者ID:NALSS,项目名称:Telegraph,代码行数:21,代码来源:OpCode.cs

示例11: CompareOpCode

 //verify the opcode fields
 //if not equal,retun the field name which contains error. 
 private CompareResult CompareOpCode(
     OpCode opcode,
     String stringname,
     StackBehaviour pop,
     StackBehaviour push,
     OperandType operand,
     OpCodeType type,
     int size,
     byte s1,
     byte s2,
     FlowControl ctrl)
 {
     CompareResult returnValue = CompareResult.Equal;
     if (opcode.Name != stringname) returnValue = returnValue | CompareResult.Name;
     if (opcode.StackBehaviourPop != pop) returnValue = returnValue | CompareResult.Pop;
     if (opcode.StackBehaviourPush != push) returnValue = returnValue | CompareResult.Push;
     if (opcode.OperandType != operand) returnValue = returnValue | CompareResult.OpenrandType;
     if (opcode.OpCodeType != type) returnValue = returnValue | CompareResult.OpCodeType;
     if (opcode.Size != size) returnValue = returnValue | CompareResult.Size;
     if (size == 2)
     {
         if (opcode.Value != ((short)(s1 << 8 | s2)))
         {
             returnValue = returnValue | CompareResult.Value;
         }
     }
     else
     {
         if (opcode.Value != ((short)s2))
         {
             returnValue = returnValue | CompareResult.Value;
         }
     }
     if (opcode.FlowControl != ctrl)
     {
         returnValue = returnValue | CompareResult.FlowControl;
     }
     return returnValue;
 }
开发者ID:CheneyWu,项目名称:coreclr,代码行数:41,代码来源:opcodesstind_r4.cs

示例12: ComputePushDelta

		static void ComputePushDelta (StackBehaviour push_behaviour, ref int stack_size)
		{
			switch (push_behaviour) {
			case StackBehaviour.Push1:
			case StackBehaviour.Pushi:
			case StackBehaviour.Pushi8:
			case StackBehaviour.Pushr4:
			case StackBehaviour.Pushr8:
			case StackBehaviour.Pushref:
				stack_size++;
				break;
			case StackBehaviour.Push1_push1:
				stack_size += 2;
				break;
			}
		}
开发者ID:mayuki,项目名称:Inazuma,代码行数:16,代码来源:CodeWriter.cs

示例13: ComputePopDelta

		static void ComputePopDelta (StackBehaviour pop_behavior, ref int stack_size)
		{
			switch (pop_behavior) {
			case StackBehaviour.Popi:
			case StackBehaviour.Popref:
			case StackBehaviour.Pop1:
				stack_size--;
				break;
			case StackBehaviour.Pop1_pop1:
			case StackBehaviour.Popi_pop1:
			case StackBehaviour.Popi_popi:
			case StackBehaviour.Popi_popi8:
			case StackBehaviour.Popi_popr4:
			case StackBehaviour.Popi_popr8:
			case StackBehaviour.Popref_pop1:
			case StackBehaviour.Popref_popi:
				stack_size -= 2;
				break;
			case StackBehaviour.Popi_popi_popi:
			case StackBehaviour.Popref_popi_popi:
			case StackBehaviour.Popref_popi_popi8:
			case StackBehaviour.Popref_popi_popr4:
			case StackBehaviour.Popref_popi_popr8:
			case StackBehaviour.Popref_popi_popref:
				stack_size -= 3;
				break;
			case StackBehaviour.PopAll:
				stack_size = 0;
				break;
			}
		}
开发者ID:mayuki,项目名称:Inazuma,代码行数:31,代码来源:CodeWriter.cs

示例14: VerifyAllTheFileds

    private bool VerifyAllTheFileds(OpCode opCode, 
                                    String opCodeName, 
                                    StackBehaviour pop, 
                                    StackBehaviour push, 
                                    OperandType operandType, 
                                    OpCodeType type, 
                                    int size, 
                                    byte s1, byte s2, 
                                    FlowControl ctrl, 
                                    string errorNum)
    {
        bool retVal = true;
        string errorDesc;

        string actualName = opCode.Name;
        if (actualName != opCodeName)
        {
            errorDesc = "Actual name of the specified MSIL instruction: \"" + actualName +
                        "\" does not equal expected name: \"" + opCodeName + "\"";
            TestLibrary.TestFramework.LogError( errorNum + ".1", errorDesc);
            retVal = false;
        }

        StackBehaviour actualStackBehaviourPop = opCode.StackBehaviourPop;
        if (actualStackBehaviourPop != pop)
        {
            errorDesc = "Actual pop statck behaviour of the specified MSIL instruction: (" + actualStackBehaviourPop +
                        ") does not equal expected pop stack behaviour: (" + pop + ")";
            TestLibrary.TestFramework.LogError(errorNum + ".2", errorDesc);
            retVal = false;
        }

        StackBehaviour actualStackBehaviourPush = opCode.StackBehaviourPush;
        if (actualStackBehaviourPush != push)
        {
            errorDesc = "Actual push statck behaviour of the specified MSIL instruction: (" + actualStackBehaviourPush +
                        ") does not equal expected push stack behaviour: (" + push + ")";
            TestLibrary.TestFramework.LogError(errorNum + ".3", errorDesc);
            retVal = false;
        }


        OperandType actualOperandType = opCode.OperandType;
        if (actualOperandType != operandType)
        {
            errorDesc = "Actual operand type of the specified MSIL instruction: (" + actualOperandType +
                        ") does not equal expected operand type: (" + operandType + ")";
            TestLibrary.TestFramework.LogError(errorNum + ".4", errorDesc);
            retVal = false;
        }

        OpCodeType actualOpCodeType = opCode.OpCodeType;
        if (actualOpCodeType != type)
        {
            errorDesc = "Actual OpCode type of the specified MSIL instruction: (" + actualOpCodeType +
                        ") does not equal expected OpCode type: (" + type + ")";
            TestLibrary.TestFramework.LogError(errorNum + ".5", errorDesc);
            retVal = false;
        }

        int actualSize = opCode.Size;
        if (actualSize != size)
        {
            errorDesc = "Actual size of the specified MSIL instruction: (" + actualSize +
                        ") does not equal expected size: (" + size + ")";
            TestLibrary.TestFramework.LogError(errorNum + ".6", errorDesc);
            retVal = false;
        }

        short actualValue = opCode.Value;
        short expectedValue = (2 == size) ? (short)(s1 << 8 | s2) : s2;
        if (actualValue != expectedValue)
        {
            errorDesc = "Actual immediate operand value of the specified MSIL instruction: (" + actualValue +
                        ") does not equal expected immediate operand value: (" + expectedValue + ")";
            TestLibrary.TestFramework.LogError(errorNum + ".7", errorDesc);
            retVal = false;
        }

        FlowControl actualCtrl = opCode.FlowControl;
        if (actualCtrl != ctrl)
        {
            errorDesc = "Actual flow control of the specified MSIL instruction: (" + actualCtrl +
                        ") does not equal expected flow control: (" + ctrl + ")";
            TestLibrary.TestFramework.LogError(errorNum + ".8", errorDesc);
            retVal = false;
        }

        return retVal;
    }
开发者ID:l1183479157,项目名称:coreclr,代码行数:90,代码来源:opcodesclt.cs

示例15: DoGetStackCount

		private int DoGetStackCount(TypedInstruction instruction, StackBehaviour behavior)
		{
			int count = 0;
			
			switch (behavior)
			{
				case StackBehaviour.Pop0:
				case StackBehaviour.Push0:
					break;
					
				case StackBehaviour.Pop1:
				case StackBehaviour.Popi:
				case StackBehaviour.Popref:
				case StackBehaviour.Push1:
				case StackBehaviour.Pushi:
				case StackBehaviour.Pushi8:
				case StackBehaviour.Pushr4:
				case StackBehaviour.Pushr8:
				case StackBehaviour.Pushref:
					count = 1;
					break;
					
				case StackBehaviour.Pop1_pop1:
				case StackBehaviour.Popi_pop1:
				case StackBehaviour.Popi_popi:
				case StackBehaviour.Popi_popi8:
				case StackBehaviour.Popi_popr4:
				case StackBehaviour.Popi_popr8:
				case StackBehaviour.Popref_pop1:
				case StackBehaviour.Popref_popi:
				case StackBehaviour.Push1_push1:
					count = 2;
					break;
					
				case StackBehaviour.Popi_popi_popi:
				case StackBehaviour.Popref_popi_popi:
				case StackBehaviour.Popref_popi_popi8:
				case StackBehaviour.Popref_popi_popr4:
				case StackBehaviour.Popref_popi_popr8:
				case StackBehaviour.Popref_popi_popref:
					count = 3;
					break;
					
				case StackBehaviour.PopAll:				// leave
					count = int.MaxValue;
					break;
					
				case StackBehaviour.Varpop:				// call, newobj, ret
					Call call = instruction as Call;
					if (call != null)
					{
						count = call.Target.Parameters.Count + (call.Target.HasThis ? 1 : 0);
					}
					else if (instruction.Untyped.OpCode.Code == Code.Ret)
					{
						count = int.MaxValue;
					}
					else
					{
						NewObj no = instruction as NewObj;
						DBC.Assert(no != null, "Varpop opcode should be call, ret, or newobj");
						
						count = no.Ctor.Parameters.Count;
					}
					break;
				
				case StackBehaviour.Varpush:			// call
					Call call2 = instruction as Call;
					DBC.Assert(call2 != null, "Varpush opcode should be call");
					if (call2.Target.ReturnType.ReturnType.FullName != "System.Void")
						count = 1;
					break;

				default:
					DBC.Fail("Bad stack behavior: {0}", behavior);
					break;
			}
						
			return count;
		}
开发者ID:dbremner,项目名称:smokey,代码行数:80,代码来源:RedundantOperandRule.cs


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