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


C# IILGen类代码示例

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


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

示例1: GenerateLoadEx

 public static void GenerateLoadEx(this ITypeDescriptor descriptor, IILGen ilGenerator, Action<IILGen> pushReader, Action<IILGen> pushCtx, Action<IILGen> pushDescriptor, Type asType, ITypeConvertorGenerator convertorGenerator)
 {
     if (descriptor.StoredInline)
     {
         if (descriptor.LoadNeedsHelpWithConversion && asType!=typeof(object))
         {
             var origType = descriptor.GetPreferedType();
             descriptor.GenerateLoad(ilGenerator, pushReader, pushCtx, pushDescriptor, origType);
             if (origType != asType)
             {
                 var conv = convertorGenerator.GenerateConversion(origType, asType);
                 if (conv == null)
                     throw new BTDBException("Don't know how to convert " + descriptor.Name + " from " +
                                             origType.ToSimpleName() + " to " + asType.ToSimpleName());
                 conv(ilGenerator);
             }
         }
         else
         {
             descriptor.GenerateLoad(ilGenerator, pushReader, pushCtx, pushDescriptor, asType);
         }
     }
     else
     {
         ilGenerator
             .Do(pushCtx)
             .Callvirt(() => default(ITypeBinaryDeserializerContext).LoadObject());
         if (asType != typeof(object))
             ilGenerator.Castclass(asType);
     }
 }
开发者ID:Bobris,项目名称:BTDB,代码行数:31,代码来源:TypeDescriptorExtensions.cs

示例2: FreeContent

 public bool FreeContent(IILGen ilGenerator, Action<IILGen> pushReaderOrCtx)
 {
     var needsFreeContent = false;
     var localCount = ilGenerator.DeclareLocal(typeof(uint));
     var finish = ilGenerator.DefineLabel();
     var next = ilGenerator.DefineLabel();
     ilGenerator
         .Do(pushReaderOrCtx)
         .Callvirt(() => ((IReaderCtx)null).SkipObject())
         .Brfalse(finish)
         .Do(Extensions.PushReaderFromCtx(pushReaderOrCtx))
         .Callvirt(() => ((AbstractBufferedReader)null).ReadVUInt32())
         .Stloc(localCount)
         .Mark(next)
         .Ldloc(localCount)
         .Brfalse(finish)
         .Ldloc(localCount)
         .LdcI4(1)
         .Sub()
         .ConvU4()
         .Stloc(localCount)
         .GenerateFreeContent(_keysHandler, pushReaderOrCtx, ref needsFreeContent)
         .GenerateFreeContent(_valuesHandler, pushReaderOrCtx, ref needsFreeContent)
         .Br(next)
         .Mark(finish);
     return needsFreeContent;
 }
开发者ID:Bobris,项目名称:BTDB,代码行数:27,代码来源:DictionaryFieldHandler.cs

示例3: ReplayTo

 internal void ReplayTo(IILGen target)
 {
     foreach (var inst in _instructions)
     {
         inst.ReplayTo(target);
     }
 }
开发者ID:Xamarui,项目名称:BTDB,代码行数:7,代码来源:CachingILGen.cs

示例4: Load

 public void Load(IILGen ilGenerator, Action<IILGen> pushReaderOrCtx)
 {
     ilGenerator
         .Do(pushReaderOrCtx)
         .Callvirt(() => default(IReaderCtx).ReadNativeObject());
     var type = HandledType();
     ilGenerator.Do(_service.TypeConvertorGenerator.GenerateConversion(typeof(object), type));
 }
开发者ID:Xamarui,项目名称:BTDB,代码行数:8,代码来源:ServiceObjectFieldHandler.cs

示例5: Save

 public void Save(IILGen ilGenerator, Action<IILGen> pushWriterOrCtx, Action<IILGen> pushValue)
 {
     ilGenerator
         .Do(pushWriterOrCtx)
         .Do(pushValue)
         .Do(_service.TypeConvertorGenerator.GenerateConversion(HandledType(), typeof(object)))
         .Callvirt(() => default(IWriterCtx).WriteNativeObject(null));
 }
开发者ID:Xamarui,项目名称:BTDB,代码行数:8,代码来源:ServiceObjectFieldHandler.cs

示例6: GenerateSave

 public void GenerateSave(IILGen ilGenerator, Action<IILGen> pushWriter, Action<IILGen> pushCtx, Action<IILGen> pushValue, Type valueType)
 {
     pushWriter(ilGenerator);
     pushValue(ilGenerator);
     if (valueType==typeof(byte[]))
         ilGenerator.Call(() => default(AbstractBufferedWriter).WriteByteArray(null));
     else if (valueType==typeof(ByteBuffer))
         ilGenerator.Call(() => default(AbstractBufferedWriter).WriteByteArray(ByteBuffer.NewEmpty()));
     else throw new ArgumentOutOfRangeException(nameof(valueType));
 }
开发者ID:tomasdeml,项目名称:BTDB,代码行数:10,代码来源:ByteArrayTypeDescriptor.cs

示例7: FreeContent

 public bool FreeContent(IILGen ilGenerator, Action<IILGen> pushReaderOrCtx)
 {
     var tableInfo = ((ObjectDB) _objectDB).TablesInfo.FindByType(HandledType());
     //decides upon current version  (null for object types never stored in DB)
     var needsContent = tableInfo == null || tableInfo.GetFreeContent(tableInfo.ClientTypeVersion).Item1;
     ilGenerator
         .Do(pushReaderOrCtx)
         .Callvirt(() => default(IReaderCtx).FreeContentInNativeObject());
     return needsContent;
 }
开发者ID:Bobris,项目名称:BTDB,代码行数:10,代码来源:DBObjectFieldHandler.cs

示例8: GenerateSkipEx

 public static void GenerateSkipEx(this ITypeDescriptor descriptor, IILGen ilGenerator, Action<IILGen> pushReader, Action<IILGen> pushCtx)
 {
     if (descriptor.StoredInline)
     {
         descriptor.GenerateSkip(ilGenerator, pushReader, pushCtx);
     }
     else
     {
         ilGenerator
             .Do(pushCtx)
             .Callvirt(() => default(ITypeBinaryDeserializerContext).SkipObject());
     }
 }
开发者ID:Bobris,项目名称:BTDB,代码行数:13,代码来源:TypeDescriptorExtensions.cs

示例9: GenerateSaveEx

 public static void GenerateSaveEx(this ITypeDescriptor descriptor, IILGen ilGenerator, Action<IILGen> pushWriter, Action<IILGen> pushCtx, Action<IILGen> pushSubValue, Type subValueType)
 {
     if (descriptor.StoredInline)
     {
         descriptor.GenerateSave(ilGenerator, pushWriter, pushCtx, pushSubValue, subValueType);
     }
     else
     {
         ilGenerator
             .Do(pushCtx)
             .Do(pushSubValue)
             .Callvirt(() => default(ITypeBinarySerializerContext).StoreObject(null));
     }
 }
开发者ID:Bobris,项目名称:BTDB,代码行数:14,代码来源:TypeDescriptorExtensions.cs

示例10: Load

 public void Load(IILGen ilGenerator, Action<IILGen> pushReaderOrCtx)
 {
     var localCount = ilGenerator.DeclareLocal(typeof(uint));
     var localResultOfObject = ilGenerator.DeclareLocal(typeof(object));
     var localResult = ilGenerator.DeclareLocal(HandledType());
     var loadSkipped = ilGenerator.DefineLabel();
     var finish = ilGenerator.DefineLabel();
     var readfinish = ilGenerator.DefineLabel();
     var next = ilGenerator.DefineLabel();
     var genericArguments = _type.GetGenericArguments();
     object fake;
     ilGenerator
         .Do(pushReaderOrCtx)
         .Ldloca(localResultOfObject)
         .Callvirt(() => default(IReaderCtx).ReadObject(out fake))
         .Brfalse(loadSkipped)
         .Do(Extensions.PushReaderFromCtx(pushReaderOrCtx))
         .Callvirt(() => default(AbstractBufferedReader).ReadVUInt32())
         .Stloc(localCount)
         .Ldloc(localCount)
         .Newobj(typeof(Dictionary<,>).MakeGenericType(genericArguments).GetConstructor(new[] { typeof(int) }))
         .Stloc(localResult)
         .Do(pushReaderOrCtx)
         .Ldloc(localResult)
         .Castclass(typeof(object))
         .Callvirt(() => default(IReaderCtx).RegisterObject(null))
         .Mark(next)
         .Ldloc(localCount)
         .Brfalse(readfinish)
         .Ldloc(localCount)
         .LdcI4(1)
         .Sub()
         .ConvU4()
         .Stloc(localCount)
         .Ldloc(localResult)
         .GenerateLoad(_keysHandler, genericArguments[0], pushReaderOrCtx, _typeConvertorGenerator)
         .GenerateLoad(_valuesHandler, genericArguments[1], pushReaderOrCtx, _typeConvertorGenerator)
         .Callvirt(_type.GetMethod("Add"))
         .Br(next)
         .Mark(readfinish)
         .Do(pushReaderOrCtx)
         .Callvirt(() => default(IReaderCtx).ReadObjectDone())
         .Br(finish)
         .Mark(loadSkipped)
         .Ldloc(localResultOfObject)
         .Isinst(_type)
         .Stloc(localResult)
         .Mark(finish)
         .Ldloc(localResult);
 }
开发者ID:Xamarui,项目名称:BTDB,代码行数:50,代码来源:DictionaryFieldHandler.cs

示例11: GenerateLoadEx

 public static void GenerateLoadEx(this ITypeDescriptor descriptor, IILGen ilGenerator, Action<IILGen> pushReader, Action<IILGen> pushCtx, Action<IILGen> pushDescriptor, Type asType)
 {
     if (descriptor.StoredInline)
     {
         descriptor.GenerateLoad(ilGenerator, pushReader, pushCtx, pushDescriptor, asType);
     }
     else
     {
         ilGenerator
             .Do(pushCtx)
             .Callvirt(() => default(ITypeBinaryDeserializerContext).LoadObject());
         if (asType != typeof(object))
             ilGenerator.Castclass(asType);
     }
 }
开发者ID:Xamarui,项目名称:BTDB,代码行数:15,代码来源:TypeDescriptorExtensions.cs

示例12: Load

 public void Load(IILGen ilGenerator, Action<IILGen> pushReaderOrCtx)
 {
     pushReaderOrCtx(ilGenerator);
     Type typeRead;
     if (_signed)
     {
         ilGenerator.Call(() => default(AbstractBufferedReader).ReadVInt64());
         typeRead = typeof(long);
     }
     else
     {
         ilGenerator.Call(() => default(AbstractBufferedReader).ReadVUInt64());
         typeRead = typeof(ulong);
     }
     new DefaultTypeConvertorGenerator().GenerateConversion(typeRead, _enumType.GetEnumUnderlyingType())(ilGenerator);
 }
开发者ID:Bobris,项目名称:BTDB,代码行数:16,代码来源:EnumFieldHandler.cs

示例13: GenerateLoad

 public void GenerateLoad(IILGen ilGenerator, Action<IILGen> pushReader, Action<IILGen> pushCtx, Action<IILGen> pushDescriptor, Type targetType)
 {
     pushReader(ilGenerator);
     ilGenerator.Call(() => default(AbstractBufferedReader).ReadByteArray());
     if (targetType == typeof (ByteBuffer))
     {
         ilGenerator.Call(() => ByteBuffer.NewAsync(null));
         return;
     }
     if (targetType != typeof (object))
     {
         if (targetType!=typeof(byte[]))
             throw new ArgumentOutOfRangeException(nameof(targetType));
         return;
     }
     ilGenerator.Castclass(typeof(object));
 }
开发者ID:Xamarui,项目名称:BTDB,代码行数:17,代码来源:ByteArrayTypeDescriptor.cs

示例14: GenerateLoad

 public void GenerateLoad(IILGen ilGenerator, Action<IILGen> pushReader, Action<IILGen> pushCtx, Action<IILGen> pushDescriptor, Type targetType)
 {
     pushReader(ilGenerator);
     ilGenerator.Call(_loader);
     if (targetType != typeof(object))
     {
         if (targetType != GetPreferedType())
             throw new ArgumentOutOfRangeException(nameof(targetType));
         return;
     }
     if (GetPreferedType().IsValueType)
     {
         ilGenerator.Box(GetPreferedType());
     }
     else
     {
         ilGenerator.Castclass(typeof(object));
     }
 }
开发者ID:klesta490,项目名称:BTDB,代码行数:19,代码来源:SimpleTypeDescriptor.cs

示例15: ReplayTo

 public void ReplayTo(IILGen target)
 {
     Local = target.DeclareLocal(_type, _name, _pinned);
     Debug.Assert(Local.Index == Index);
 }
开发者ID:mano-cz,项目名称:BTDB,代码行数:5,代码来源:CachingILGen.cs


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