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


C# ILOpCode类代码示例

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


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

示例1: Execute

 public override void Execute( MethodInfo aMethod, ILOpCode aOpCode )
 {
     DoNullReferenceCheck(Assembler, DebugEnabled, 0);
     new CPUx86.Pop { DestinationReg = CPUx86.Registers.EAX };
     new CPUx86.Add { DestinationReg = CPUx86.Registers.EAX, SourceValue = 8 };
     new CPUx86.Push { DestinationReg = CPUx86.Registers.EAX, DestinationIsIndirect = true };
 }
开发者ID:iSalva,项目名称:Cosmos,代码行数:7,代码来源:Ldlen.cs

示例2: Execute

    public override void Execute(MethodInfo aMethod, ILOpCode aOpCode) {
        var xSource = aOpCode.StackPopTypes[0];
        var xSourceSize = SizeOfType(xSource);
        switch (xSourceSize)
        {
            case 1:
            case 2:
            case 4:
				if (TypeIsFloat(xSource))
				{
					XS.SSE.ConvertSS2SD(XMM0, ESP, sourceIsIndirect: true);
				}
				else
				{
					XS.SSE2.ConvertSI2SD(XMM0, ESP, sourceIsIndirect: true);
				}
				// expand stack, that moved data is valid stack
				XS.Sub(XSRegisters.ESP, 4);
				XS.SSE2.MoveSD(ESP, XMM0, destinationIsIndirect: true);
				break;
            case 8:
                {
					if (!TypeIsFloat(xSource))
					{
						XS.FPU.IntLoad(ESP, isIndirect: true, size: RegisterSize.Long64);
						XS.FPU.FloatStoreAndPop(ESP, isIndirect: true, size: RegisterSize.Long64);
					}
                    break;
                }
            default:
                //EmitNotImplementedException( Assembler, GetServiceProvider(), "Conv_U8: SourceSize " + xSource + " not supported!", mCurLabel, mMethodInformation, mCurOffset, mNextLabel );
                throw new NotImplementedException();
		}
    }
开发者ID:Zino2201,项目名称:Cosmos,代码行数:34,代码来源:Conv_R8.cs

示例3: Execute

 public override void Execute( MethodInfo aMethod, ILOpCode aOpCode )
 {
     DoNullReferenceCheck(Assembler, DebugEnabled, 0);
     XS.Pop(XSRegisters.EAX);
     new CPUx86.Push { DestinationReg = CPUx86.RegistersEnum.EAX, DestinationIsIndirect = true, DestinationDisplacement = 4 };
     XS.Push(XSRegisters.EAX, isIndirect: true);
 }
开发者ID:Zino2201,项目名称:Cosmos,代码行数:7,代码来源:Ldind_R8.cs

示例4: Execute

    public override void Execute(MethodInfo aMethod, ILOpCode aOpCode)
    {
      var xOpString = aOpCode as OpString;
      string xDataName = GetContentsArrayName(xOpString.Value);
      new Comment(Assembler, "String Value: " + xOpString.Value.Replace("\r", "\\r").Replace("\n", "\\n"));
      var xRefName = GetFakeHandleForLiteralArray(xDataName);
      new Mov { DestinationReg = RegistersEnum.EAX, SourceRef = Cosmos.Assembler.ElementReference.New(xRefName) };
      new Push { DestinationReg = RegistersEnum.EAX };
      // DEBUG VERIFICATION: leave it here for now. we have issues with fields ordering.
      // if that changes, we need to change the code below!
      // We also need to change the debugstub to fix this then.
      #region Debug verification

      var xFields = GetFieldsInfo(typeof(string), false).Where(i => !i.IsStatic).ToArray();
      if (xFields[0].Id != "System.Int32 System.String.m_stringLength"
        || xFields[0].Offset != 0)
      {
        throw new Exception("Fields changed!");
      }
      if (xFields[1].Id != "System.Char System.String.m_firstChar"
        || xFields[1].Offset != 4)
      {
        throw new Exception("Fields changed!");
      }
      #endregion
    }
开发者ID:Orvid,项目名称:Cosmos,代码行数:26,代码来源:Ldstr.cs

示例5: Execute

        public override void Execute( MethodInfo aMethod, ILOpCode aOpCode )
        {
            var xStackContent = aOpCode.StackPopTypes[0];
            var xStackContentSecond = aOpCode.StackPopTypes[1];
            var xStackContentSize = SizeOfType(xStackContent);
            var xStackContentSecondSize = SizeOfType(xStackContentSecond);
			var xSize = Math.Max(xStackContentSize, xStackContentSecondSize);
            if (ILOp.Align(xStackContentSize, 4u) != ILOp.Align(xStackContentSecondSize, 4u))
            {
                throw new NotSupportedException("Operands have different size!");
            }
            if (xSize > 8)
            {
                throw new NotImplementedException("StackSize>8 not supported");
            }

            if (xSize > 4)
			{
				// [ESP] is low part
				// [ESP + 4] is high part
				// [ESP + 8] is low part
				// [ESP + 12] is high part
				new CPUx86.Pop { DestinationReg = CPUx86.Registers.EAX };
				new CPUx86.Pop { DestinationReg = CPUx86.Registers.EDX };
				// [ESP] is low part
				// [ESP + 4] is high part
				new CPUx86.Or { DestinationReg = CPUx86.Registers.ESP, DestinationIsIndirect = true, SourceReg = CPUx86.Registers.EAX };
				new CPUx86.Or { DestinationReg = CPUx86.Registers.ESP, DestinationIsIndirect = true, DestinationDisplacement = 4, SourceReg = CPUx86.Registers.EDX };
			}
			else
			{
				new CPUx86.Pop { DestinationReg = CPUx86.Registers.EAX };
				new CPUx86.Or { DestinationReg = CPUx86.Registers.ESP, DestinationIsIndirect = true, SourceReg = CPUx86.Registers.EAX };
			}
        }
开发者ID:Orvid,项目名称:Cosmos,代码行数:35,代码来源:Or.cs

示例6: Execute

        public override void Execute( MethodInfo aMethod, ILOpCode aOpCode )
        {
          var xOpType = (OpType)aOpCode;
          var xSize = SizeOfType(xOpType.Value);

          Stelem_Ref.Assemble(Assembler, (uint)xSize, aMethod, aOpCode, DebugEnabled);
        }
开发者ID:Orvid,项目名称:Cosmos,代码行数:7,代码来源:Stelem.cs

示例7: Execute

    public override void Execute(MethodInfo aMethod, ILOpCode aOpCode) {
        var xSource = aOpCode.StackPopTypes[0];
        var xSourceSize = SizeOfType(xSource);
        switch (xSourceSize)
        {
            case 1:
            case 2:
            case 4:
				if (TypeIsFloat(xSource))
				{
					new CPUx86.SSE.ConvertSS2SD { DestinationReg = CPUx86.Registers.XMM0, SourceReg = CPUx86.Registers.ESP, SourceIsIndirect = true };
				}
				else
				{
					new CPUx86.SSE.ConvertSI2SD { DestinationReg = CPUx86.Registers.XMM0, SourceReg = CPUx86.Registers.ESP, SourceIsIndirect = true };
				}
				// expand stack, that moved data is valid stack
				new CPUx86.Sub { DestinationReg = CPUx86.Registers.ESP, SourceValue = 4 };
				new CPUx86.SSE.MoveSD { DestinationReg = CPUx86.Registers.ESP, DestinationIsIndirect = true, SourceReg = CPUx86.Registers.XMM0 };
				break;
            case 8:
                {
					if (!TypeIsFloat(xSource))
					{
						new CPUx86.x87.IntLoad { DestinationReg = CPUx86.Registers.ESP, Size = 64, DestinationIsIndirect = true };
						new CPUx86.x87.FloatStoreAndPop { DestinationReg = CPUx86.Registers.ESP, Size = 64, DestinationIsIndirect = true};
					}
                    break;
                }
            default:
                //EmitNotImplementedException( Assembler, GetServiceProvider(), "Conv_U8: SourceSize " + xSource + " not supported!", mCurLabel, mMethodInformation, mCurOffset, mNextLabel );
                throw new NotImplementedException();
		}
    }
开发者ID:Orvid,项目名称:Cosmos,代码行数:34,代码来源:Conv_R8.cs

示例8: Execute

        public override void Execute( MethodInfo aMethod, ILOpCode aOpCode )
        {
            OpToken xToken = ( OpToken )aOpCode;
            string xTokenAddress = null;
            
            if (xToken.ValueIsType)
            {
                xTokenAddress = ILOp.GetTypeIDLabel(xToken.ValueType);
            }
            if (xToken.ValueIsField)
            {
                xTokenAddress= DataMember.GetStaticFieldName(xToken.ValueField);
            }

            if (String.IsNullOrEmpty(xTokenAddress))
            {
                throw new Exception("Ldtoken not implemented!");
            }

            //if( mType != null )
            //{
            //    mTokenAddress = GetService<IMetaDataInfoService>().GetTypeIdLabel( mType );
            //}
            //new CPUx86.Push { DestinationValue = xToken.Value };
            new CPU.Push { DestinationRef = Cosmos.Assembler.ElementReference.New( xTokenAddress ) };
        }
开发者ID:Orvid,项目名称:Cosmos,代码行数:26,代码来源:Ldtoken.cs

示例9: Execute

 public override void Execute( MethodInfo aMethod, ILOpCode aOpCode )
 {
     DoNullReferenceCheck(Assembler, DebugEnabled, 0);
     new CPUx86.Pop { DestinationReg = CPUx86.Registers.ECX };
     new CPUx86.MoveZeroExtend { DestinationReg = CPUx86.Registers.EAX, Size = 16, SourceReg = CPUx86.Registers.ECX, SourceIsIndirect = true };
     new CPUx86.Push { DestinationReg = CPUx86.Registers.EAX };
 }
开发者ID:Orvid,项目名称:Cosmos,代码行数:7,代码来源:Ldind_U2.cs

示例10: Execute

        public override void Execute( MethodInfo aMethod, ILOpCode aOpCode )
        {
            OpType xType = ( OpType )aOpCode;
            string xTypeID = GetTypeIDLabel(xType.Value);
            string mReturnNullLabel = GetLabel( aMethod, aOpCode ) + "_ReturnNull";

            XS.Set(XSRegisters.EAX, XSRegisters.ESP, sourceIsIndirect: true);

            XS.Compare(XSRegisters.EAX, 0);
            XS.Jump(CPUx86.ConditionalTestEnum.Zero, mReturnNullLabel);

            // EAX contains a memory handle now. Lets convert it to a pointer
            XS.Set(XSRegisters.EAX, XSRegisters.EAX, sourceIsIndirect: true);

            //XS.Mov(XSRegisters.EAX, XSRegisters.EAX, sourceIsIndirect: true);
            XS.Push(XSRegisters.EAX, isIndirect: true);
            XS.Push(xTypeID, isIndirect: true);

            SysReflection.MethodBase xMethodIsInstance = ReflectionUtilities.GetMethodBase( typeof( VTablesImpl ), "IsInstance", "System.UInt32", "System.UInt32" );
            //, new OpMethod( ILOpCode.Code.Call, aOpCode.Position, aOpCode.NextPosition, xMethodIsInstance, aOpCode.CurrentExceptionHandler));
            Call.DoExecute(Assembler, aMethod, xMethodIsInstance, aOpCode, GetLabel(aMethod, aOpCode), GetLabel(aMethod, aOpCode) + "_After_IsInstance_Call", DebugEnabled);

            new Label( GetLabel( aMethod, aOpCode ) + "_After_IsInstance_Call" );
            XS.Pop(XSRegisters.EAX);
            XS.Compare(XSRegisters.EAX, 0);
            XS.Jump(CPUx86.ConditionalTestEnum.Equal, mReturnNullLabel);
            // push nothing now, as we should return the object instance pointer.
            new CPUx86.Jump { DestinationLabel = GetLabel(aMethod, aOpCode.NextPosition) };
            XS.Label(mReturnNullLabel );
            XS.Add(XSRegisters.ESP, 4);
            XS.Push(0);
        }
开发者ID:Zino2201,项目名称:Cosmos,代码行数:32,代码来源:Isinst.cs

示例11: Execute

 public override void Execute(MethodInfo aMethod, ILOpCode aOpCode)
 {
   DoNullReferenceCheck(Assembler, DebugEnabled, 0);
   XS.Pop(XSRegisters.EAX);
   XS.Push(XSRegisters.EAX, isIndirect: true, displacement: 4);
   XS.Push(XSRegisters.EAX, isIndirect: true);
 }
开发者ID:fanoI,项目名称:Cosmos,代码行数:7,代码来源:Ldind_I8.cs

示例12: Execute

        public override void Execute( MethodInfo aMethod, ILOpCode aOpCode ) {
            var xOp = (OpInt64)aOpCode;
			// push high part
            new CPUx86.Push { DestinationValue = BitConverter.ToUInt32(BitConverter.GetBytes(xOp.Value), 4) };
			// push low part
			new CPUx86.Push { DestinationValue = BitConverter.ToUInt32(BitConverter.GetBytes(xOp.Value), 0) };
        }
开发者ID:Orvid,项目名称:Cosmos,代码行数:7,代码来源:Ldc_I8.cs

示例13: Execute

 public override void Execute( MethodInfo aMethod, ILOpCode aOpCode )
 {
     DoNullReferenceCheck(Assembler, DebugEnabled, 0);
     XS.Pop(XSRegisters.ECX);
     new CPUx86.MoveSignExtend { DestinationReg = CPUx86.RegistersEnum.EAX, Size = 8, SourceReg = CPUx86.RegistersEnum.ECX, SourceIsIndirect = true };
     XS.Push(XSRegisters.EAX);
 }
开发者ID:Zino2201,项目名称:Cosmos,代码行数:7,代码来源:Ldind_I1.cs

示例14: Execute

        public override void Execute( MethodInfo aMethod, ILOpCode aOpCode )
        {
            var xValue = aOpCode.StackPopTypes[0];
            var xValueIsFloat = TypeIsFloat(xValue);
            var xValueSize = SizeOfType(xValue);
            if (xValueSize > 8)
            {
                //EmitNotImplementedException( Assembler, aServiceProvider, "Size '" + xSize.Size + "' not supported (add)", aCurrentLabel, aCurrentMethodInfo, aCurrentOffset, aNextLabel );
                throw new NotImplementedException();
            }
			//TODO if on stack a float it is first truncated, http://msdn.microsoft.com/en-us/library/system.reflection.emit.opcodes.conv_r_un.aspx
            if (!xValueIsFloat)
            {
                switch (xValueSize)
                {
                    case 1:
                    case 2:
                    case 4:
                        new CPUx86.Mov { SourceReg = CPUx86.RegistersEnum.ESP, DestinationReg = CPUx86.RegistersEnum.EAX, SourceIsIndirect = true };
                        XS.SSE.ConvertSI2SS(XSRegisters.XMM0, XSRegisters.EAX);
                        XS.SSE.MoveSS(XSRegisters.ESP, XSRegisters.XMM0, destinationIsIndirect: true);
                        break;
                    case 8:
                    //XS.Add(XSRegisters.ESP, 4);
                    //break;
                    default:
                        //EmitNotImplementedException( Assembler, GetServiceProvider(), "Conv_I: SourceSize " + xSource + " not supported!", mCurLabel, mMethodInformation, mCurOffset, mNextLabel );
                        throw new NotImplementedException();
                }
            }
            else
            {
                throw new NotImplementedException();
            }
        }
开发者ID:ChrisJamesSadler,项目名称:Cosmos,代码行数:35,代码来源:Conv_R_Un.cs

示例15: Execute

 public override void Execute(MethodInfo aMethod, ILOpCode aOpCode)
 {
     //TODO: Return
     Jump_End(aMethod);
     // Need to jump to end of method. Assembler can emit this label for now
     //XS.Jump(MethodFooterOp.EndOfMethodLabelNameNormal);
 }
开发者ID:fanoI,项目名称:Cosmos,代码行数:7,代码来源:Ret.cs


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