• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ILOpCode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Execute

 public override void Execute(MethodInfo aMethod, ILOpCode aOpCode)
 {
   OpDouble xOp = (OpDouble)aOpCode;
   byte[] xBytes = BitConverter.GetBytes(xOp.Value);
   new CPU.Push { DestinationValue = BitConverter.ToUInt32(xBytes, 4) };
   new CPU.Push { DestinationValue = BitConverter.ToUInt32(xBytes, 0) };
 }
开发者ID:fanoI,项目名称:Cosmos,代码行数:7,代码来源:Ldc_R8.cs


示例17: Execute

		public override void Execute(MethodInfo aMethod, ILOpCode aOpCode) {
			//TODO: What if the last ILOp in a method was Conv_Ovf_I_Un or an other?
            var xSource = aOpCode.StackPopTypes[0];
            var xSourceSize = SizeOfType(xSource);
            var xSourceIsFloat = TypeIsFloat(xSource);
			if(xSourceIsFloat)
				ThrowNotImplementedException("Conv_Ovf_I_Un throws an ArgumentException, because float is not implemented!");

			switch (xSourceSize)
			{
				case 1:
				case 2:
				case 4:
					break;
				case 8:
					{
						string NoOverflowLabel = GetLabel(aMethod, aOpCode) + "__NoOverflow";
						new CPUx86.Pop { DestinationReg = CPUx86.Registers.EAX };
						// EBX is high part and should be zero for unsigned, so we test it on zero
						{
							new CPUx86.Pop { DestinationReg = CPUx86.Registers.EBX };
							new CPUx86.Compare { DestinationReg = CPUx86.Registers.EBX, SourceValue = 0 };
							new CPUx86.ConditionalJump { Condition = CPUx86.ConditionalTestEnum.Equal, DestinationLabel = NoOverflowLabel };
							ThrowNotImplementedException("Conv_Ovf_I_Un throws an overflow exception, which is not implemented!");
						}
						new Label(NoOverflowLabel);
						new CPUx86.Push { DestinationReg = CPUx86.Registers.EAX };
						break;
					}
				default:
					ThrowNotImplementedException("Conv_Ovf_I_Un not implemented for this size!");
					break;
			}
		}
开发者ID:Orvid,项目名称:Cosmos,代码行数:34,代码来源:Conv_Ovf_I_Un.cs


示例18: Execute

 public override void Execute( MethodInfo aMethod, ILOpCode aOpCode )
 {
     var xFieldSize = SizeOfType(aOpCode.StackPopTypes[0]);
     var xRoundedSize = Align(xFieldSize, 4);
     DoNullReferenceCheck(Assembler, DebugEnabled, xRoundedSize);
     
     new CPUx86.Mov { DestinationReg = CPUx86.Registers.ECX, SourceReg = CPUx86.Registers.ESP, SourceIsIndirect = true, SourceDisplacement = checked((int)xRoundedSize) };
     for( int i = 0; i < ( xFieldSize / 4 ); i++ )
     {
         new CPUx86.Pop { DestinationReg = CPUx86.Registers.EAX };
         new CPUx86.Mov { DestinationReg = CPUx86.Registers.ECX, DestinationIsIndirect = true, DestinationDisplacement = i * 4, SourceReg = CPUx86.Registers.EAX };
     }
     switch( xFieldSize % 4 )
     {
         case 1:
             {
                 new CPUx86.Pop { DestinationReg = CPUx86.Registers.EAX };
                 new CPUx86.Mov { DestinationReg = CPUx86.Registers.ECX, DestinationIsIndirect = true, DestinationDisplacement = checked((int)( xFieldSize / 4 ) * 4 ), SourceReg = CPUx86.Registers.AL };
                 break;
             }
         case 2:
             {
                 new CPUx86.Pop { DestinationReg = CPUx86.Registers.EAX };
                 new CPUx86.Mov { DestinationReg = CPUx86.Registers.ECX, DestinationIsIndirect = true, DestinationDisplacement = checked((int)( xFieldSize / 4 ) * 4 ), SourceReg = CPUx86.Registers.AX };
                 break;
             }
         case 0:
             {
                 break;
             }
         default:
             throw new Exception( "Remainder size " + ( xFieldSize % 4 ) + " not supported!" );
     }
     new CPUx86.Add { DestinationReg = CPUx86.Registers.ESP, SourceValue = 4 };
 }
开发者ID:Orvid,项目名称:Cosmos,代码行数:35,代码来源:Stobj.cs


示例19: Execute

 public override void Execute( MethodInfo aMethod, ILOpCode aOpCode )
 {
     var xType = aOpCode.StackPopTypes[0];
     var xSize = SizeOfType(xType);
     var xIsFloat = TypeIsFloat(xType);
     DoExecute(xSize, xIsFloat);
 }
开发者ID:ChrisJamesSadler,项目名称:Cosmos,代码行数:7,代码来源:Add.cs


示例20: 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 );
            //}
            //XS.Push(xToken.Value);
            XS.Push(xTokenAddress);
            XS.Push(0);
        }
开发者ID:fanoI,项目名称:Cosmos,代码行数:27,代码来源:Ldtoken.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ILOpcode类代码示例发布时间:2022-05-24
下一篇:
C# ILNode类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap