當前位置: 首頁>>代碼示例>>C#>>正文


C# Reflection.TracingILGenerator類代碼示例

本文整理匯總了C#中MsgPack.Serialization.Reflection.TracingILGenerator的典型用法代碼示例。如果您正苦於以下問題:C# TracingILGenerator類的具體用法?C# TracingILGenerator怎麽用?C# TracingILGenerator使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


TracingILGenerator類屬於MsgPack.Serialization.Reflection命名空間,在下文中一共展示了TracingILGenerator類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: EmitFor

		/// <summary>
		///		Emits 'for' statement on current IL stream.
		/// </summary>
		/// <param name="il">IL generator to be emitted to.</param>
		/// <param name="count">'count' local variable which is <see cref="Int32"/> type and holds maximum loop count.</param>
		/// <param name="bodyEmitter">Delegate to emit for statement body.</param>
		public static void EmitFor( TracingILGenerator il, LocalBuilder count, Action<TracingILGenerator, LocalBuilder> bodyEmitter )
		{
			Contract.Requires( il != null );
			Contract.Requires( count != null );
			Contract.Requires( bodyEmitter != null );

			var i = il.DeclareLocal( typeof( int ), "i" );
			il.EmitLdc_I4_0();
			il.EmitAnyStloc( i );
			var forCond = il.DefineLabel( "FOR_COND" );
			il.EmitBr( forCond );
			var body = il.DefineLabel( "BODY" );
			il.MarkLabel( body );
			bodyEmitter( il, i );
			// increment
			il.EmitAnyLdloc( i );
			il.EmitLdc_I4_1();
			il.EmitAdd();
			il.EmitAnyStloc( i );
			// cond
			il.MarkLabel( forCond );
			il.EmitAnyLdloc( i );
			il.EmitAnyLdloc( count );
			il.EmitBlt( body );
		}
開發者ID:purplecow,項目名稱:msgpack-cli,代碼行數:31,代碼來源:Emittion.cs

示例2: LoadValue

		public override void LoadValue( TracingILGenerator il, bool shouldBeAddress )
		{
			this.Evaluate( il );
			il.TraceWriteLine( "// Load->: {0}", this );
			if ( this.ContextType.ResolveRuntimeType().GetIsValueType() && shouldBeAddress )
			{
				if ( this._isLocal )
				{
					il.EmitAnyLdloca( this._index );
				}
				else
				{
					il.EmitAnyLdarga( this._index );
				}
			}
			else
			{
				if ( this._isLocal )
				{
					il.EmitAnyLdloc( this._index );
				}
				else
				{
					il.EmitAnyLdarg( this._index );
				}
			}
			il.TraceWriteLine( "// ->Load: {0}", this );
		}
開發者ID:msgpack,項目名稱:msgpack-cli,代碼行數:28,代碼來源:VariableILConstruct.cs

示例3: DoConditionalInstruction

		private void DoConditionalInstruction(
			TracingILGenerator il, Action onThen, Action onElse
			)
		{
			if ( this._elseExpression != null )
			{
				var @else = il.DefineLabel( "ELSE" );
				var endIf = il.DefineLabel( "END_IF" );
				this._condition.Branch( il, @else );
				onThen();
				if ( !this._thenExpression.IsTerminating )
				{
					il.EmitBr( endIf );
				}

				il.MarkLabel( @else );
				onElse();
				il.MarkLabel( endIf );
			}
			else
			{
				var endIf = il.DefineLabel( "END_IF" );
				this._condition.Branch( il, endIf );
				onThen();
				il.MarkLabel( endIf );
			}
		}
開發者ID:msgpack,項目名稱:msgpack-cli,代碼行數:27,代碼來源:ConditionalILConstruct.cs

示例4: Evaluate

		public override void Evaluate( TracingILGenerator il )
		{
			if ( this._value != null )
			{
				this._value.LoadValue( il, false );
			}

			this._variable.StoreValue( il );
		}
開發者ID:gezidan,項目名稱:ZYSOCKET,代碼行數:9,代碼來源:StoreVariableILConstruct.cs

示例5: StoreValue

		public override void StoreValue( TracingILGenerator il )
		{
			il.TraceWriteLine( "// Stor->: {0}", this );
			this.DoConditionalInstruction(
				il,
				() => this._thenExpression.StoreValue( il ),
				() => this._elseExpression.StoreValue( il )
				);
			il.TraceWriteLine( "// ->Stor: {0}", this );
		}
開發者ID:msgpack,項目名稱:msgpack-cli,代碼行數:10,代碼來源:ConditionalILConstruct.cs

示例6: LoadValue

		public override void LoadValue( TracingILGenerator il, bool shouldBeAddress )
		{
			il.TraceWriteLine( "// Load->: {0}", this );
			this.DoConditionalInstruction(
				il,
				() => this._thenExpression.LoadValue( il, shouldBeAddress ),
				() => this._elseExpression.LoadValue( il, shouldBeAddress )
				);
			il.TraceWriteLine( "// ->Load: {0}", this );
		}
開發者ID:msgpack,項目名稱:msgpack-cli,代碼行數:10,代碼來源:ConditionalILConstruct.cs

示例7: Evaluate

		public override void Evaluate( TracingILGenerator il )
		{
			il.TraceWriteLine( "// Eval->: {0}", this );
			this.DoConditionalInstruction(
				il,
				() => this._thenExpression.Evaluate( il ),
				() => this._elseExpression.Evaluate( il )
				);
			il.TraceWriteLine( "// ->Eval: {0}", this );
		}
開發者ID:msgpack,項目名稱:msgpack-cli,代碼行數:10,代碼來源:ConditionalILConstruct.cs

示例8: Evaluate

		private void Evaluate( TracingILGenerator il, bool shouldBeAddress )
		{
			if ( !this._isBound )
			{
				this._binding.Evaluate( il );
				this._isBound = true;
			}

			this._expression.LoadValue( il, shouldBeAddress );
		}
開發者ID:gezidan,項目名稱:ZYSOCKET,代碼行數:10,代碼來源:StatementExpressionILConstruct.cs

示例9: Evaluate

		public override void Evaluate( TracingILGenerator il )
		{
			if ( this._isLocal && this._index < 0 )
			{
				il.TraceWriteLine( "// Eval->: {0}", this );

				this._index = il.DeclareLocal( this.ContextType.ResolveRuntimeType(), this._name ).LocalIndex;

				il.TraceWriteLine( "// ->Eval: {0}", this );
			}
		}
開發者ID:msgpack,項目名稱:msgpack-cli,代碼行數:11,代碼來源:VariableILConstruct.cs

示例10: Branch

		public override void Branch( TracingILGenerator il, Label @else )
		{
			il.TraceWriteLine( "// Brnc->: {0}", this );
			foreach ( var expression in this._expressions )
			{
				expression.LoadValue( il, false );
				il.EmitBrfalse( @else );
			}

			il.TraceWriteLine( "// ->Brnc: {0}", this );
		}
開發者ID:gezidan,項目名稱:ZYSOCKET,代碼行數:11,代碼來源:AndConditionILConstruct.cs

示例11: Evaluate

		public override void Evaluate( TracingILGenerator il )
		{
			il.TraceWriteLine( "// Eval->: {0}", this );

			foreach ( var statement in this._statements )
			{
				statement.Evaluate( il );
			}

			il.TraceWriteLine( "// ->Eval: {0}", this );
		}
開發者ID:gezidan,項目名稱:ZYSOCKET,代碼行數:11,代碼來源:SequenceILConstruct.cs

示例12: EvaluateCore

		private void EvaluateCore( TracingILGenerator il )
		{
			for ( int i = 0; i < this._expressions.Count; i++ )
			{
				this._expressions[ i ].LoadValue( il, false );

				if ( i > 0 )
				{
					il.EmitAnd();
				}
			}
		}
開發者ID:gezidan,項目名稱:ZYSOCKET,代碼行數:12,代碼來源:AndConditionILConstruct.cs

示例13: Branch

		public sealed override void Branch( TracingILGenerator il, Label @else )
		{
			il.TraceWriteLine( "// Brnc->: {0}", this );
			if ( this.ContextType != typeof( bool ) )
			{
				throw new InvalidOperationException(
					String.Format( CultureInfo.CurrentCulture, "Cannot branch with non boolean type '{0}'.", this.ContextType )
					);
			}

			this.BranchCore( il, @else );
			il.TraceWriteLine( "// ->Brnc: {0}", this );
		}
開發者ID:gezidan,項目名稱:ZYSOCKET,代碼行數:13,代碼來源:ContextfulILConstruct.cs

示例14: StoreValue

		public override void StoreValue( TracingILGenerator il )
		{
			il.TraceWriteLine( "// Stor->: {0}", this );
			if ( this._instance != null )
			{
				this._instance.LoadValue( il, this._instance.ContextType.GetIsValueType() );
			}

			this._value.LoadValue( il, false );

			il.EmitStfld( this._field );
			il.TraceWriteLine( "// ->Stor: {0}", this );
		}
開發者ID:gezidan,項目名稱:ZYSOCKET,代碼行數:13,代碼來源:StoreFieldILConstruct.cs

示例15: LoadValue

		public override void LoadValue( TracingILGenerator il, bool shouldBeAddress )
		{
			il.TraceWriteLine( "// Load->: {0}", this );
			if ( this._instance != null )
			{
				this._instance.LoadValue( il, this._instance.ContextType.GetIsValueType() );
			}

			if ( shouldBeAddress )
			{
				il.EmitLdflda( this._field );
			}
			else
			{
				il.EmitLdfld( this._field );
			}
			il.TraceWriteLine( "// ->Load: {0}", this );
		}
開發者ID:gezidan,項目名稱:ZYSOCKET,代碼行數:18,代碼來源:LoadFieldILConstruct.cs


注:本文中的MsgPack.Serialization.Reflection.TracingILGenerator類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。