4 writes to _ilg
System.Private.DataContractSerialization (4)
System\Runtime\Serialization\XmlFormatReaderGenerator.cs (4)
88_ilg = new CodeGenerator(); 180_ilg = GenerateCollectionReaderHelper(collectionContract, false /*isGetOnlyCollection*/); 205_ilg = GenerateCollectionReaderHelper(collectionContract, true /*isGetOnlyCollection*/); 214_ilg = new CodeGenerator();
265 references to _ilg
System.Private.DataContractSerialization (265)
System\Runtime\Serialization\XmlFormatReaderGenerator.cs (265)
92_ilg.BeginMethod("Read" + classContract.XmlName.Name + "FromXml", Globals.TypeOfXmlFormatClassReaderDelegate, memberAccessFlag); 108_ilg.Call(_contextArg, XmlFormatGeneratorStatics.AddNewObjectMethod, _objectLocal); 113objectId = _ilg.DeclareLocal(Globals.TypeOfString); 114_ilg.Call(_contextArg, XmlFormatGeneratorStatics.GetObjectIdMethod); 115_ilg.Stloc(objectId); 130_ilg.Call(_objectLocal, XmlFormatGeneratorStatics.OnDeserializationMethod, null); 136_ilg.Load(_objectLocal); 144_ilg.ConvertValue(_objectLocal.LocalType, Globals.TypeOfDateTimeOffsetAdapter); 145_ilg.Call(XmlFormatGeneratorStatics.GetDateTimeOffsetMethod); 146_ilg.ConvertValue(Globals.TypeOfDateTimeOffset, _ilg.CurrentMethod.ReturnType); 150_ilg.ConvertValue(_objectLocal.LocalType, Globals.TypeOfMemoryStreamAdapter); 151_ilg.Call(XmlFormatGeneratorStatics.GetMemoryStreamMethod); 152_ilg.ConvertValue(Globals.TypeOfMemoryStream, _ilg.CurrentMethod.ReturnType); 156_ilg.ConvertValue(_objectLocal.LocalType, _ilg.CurrentMethod.ReturnType); 159return (XmlFormatClassReaderDelegate)_ilg.EndMethod(); 182_ilg.Load(_objectLocal); 183_ilg.ConvertValue(_objectLocal.LocalType, _ilg.CurrentMethod.ReturnType); 184return (XmlFormatCollectionReaderDelegate)_ilg.EndMethod(); 207return (XmlFormatGetOnlyCollectionReaderDelegate)_ilg.EndMethod(); 220_ilg.BeginMethod("Read" + collectionContract.XmlName.Name + "FromXml" + "IsGetOnly", Globals.TypeOfXmlFormatGetOnlyCollectionReaderDelegate, memberAccessFlag); 224_ilg.BeginMethod("Read" + collectionContract.XmlName.Name + "FromXml" + string.Empty, Globals.TypeOfXmlFormatCollectionReaderDelegate, memberAccessFlag); 239_collectionContractArg = _ilg.GetArg(4); 240return _ilg; 245_xmlReaderArg = _ilg.GetArg(0); 246_contextArg = _ilg.GetArg(1); 247_memberNamesArg = _ilg.GetArg(2); 248_memberNamespacesArg = _ilg.GetArg(3); 260_objectLocal = _ilg.DeclareLocal(type); 264_ilg.LoadMember(GetDBNullValueField()); 265_ilg.Stloc(_objectLocal); 271_ilg.Ldloca(_objectLocal); 272_ilg.InitObj(type); 276_ilg.New(classContract.GetNonAttributedTypeConstructor()!); 277_ilg.Stloc(_objectLocal); 282_ilg.Call(null, XmlFormatGeneratorStatics.GetUninitializedObjectMethod, DataContract.GetIdForInitialization(classContract)); 283_ilg.ConvertValue(Globals.TypeOfObject, type); 284_ilg.Stloc(_objectLocal); 299_ilg.LoadAddress(_objectLocal); 300_ilg.ConvertAddress(_objectLocal.LocalType, _objectType); 301_ilg.Load(_contextArg); 302_ilg.LoadMember(XmlFormatGeneratorStatics.GetStreamingContextMethod); 303_ilg.Call(classContract.OnDeserializing); 316_ilg.LoadAddress(_objectLocal); 317_ilg.ConvertAddress(_objectLocal.LocalType, _objectType); 318_ilg.Load(_contextArg); 319_ilg.LoadMember(XmlFormatGeneratorStatics.GetStreamingContextMethod); 320_ilg.Call(classContract.OnDeserialized); 335_ilg.Load(_contextArg); 336_ilg.LoadAddress(_objectLocal); 337_ilg.ConvertAddress(_objectLocal.LocalType, Globals.TypeOfIObjectReference); 338_ilg.Load(objectId); 339_ilg.Call(XmlFormatGeneratorStatics.GetRealObjectMethod); 340_ilg.ConvertValue(Globals.TypeOfObject, _ilg.CurrentMethod.ReturnType); 353LocalBuilder extensionDataLocal = _ilg.DeclareLocal(Globals.TypeOfExtensionDataObject); 354_ilg.New(XmlFormatGeneratorStatics.ExtensionDataObjectCtor); 355_ilg.Store(extensionDataLocal); 363_ilg.Call(_objectLocal, extensionDataSetMethod, extensionDataLocal); 378_ilg.Call(_contextArg, XmlFormatGeneratorStatics.IncrementItemCountMethod, memberCount); 380LocalBuilder memberIndexLocal = _ilg.DeclareLocal(Globals.TypeOfInt, -1); 385LocalBuilder? requiredIndexLocal = hasRequiredMembers ? _ilg.DeclareLocal(Globals.TypeOfInt, firstRequiredMember) : null; 387object forReadElements = _ilg.For(null, null, null); 388_ilg.Call(null, XmlFormatGeneratorStatics.MoveToNextElementMethod, _xmlReaderArg); 389_ilg.IfFalseBreak(forReadElements); 391_ilg.Call(_contextArg, XmlFormatGeneratorStatics.GetMemberIndexWithRequiredMembersMethod, _xmlReaderArg, _memberNamesArg, _memberNamespacesArg, memberIndexLocal, requiredIndexLocal, extensionDataLocal); 393_ilg.Call(_contextArg, XmlFormatGeneratorStatics.GetMemberIndexMethod, _xmlReaderArg, _memberNamesArg, _memberNamespacesArg, memberIndexLocal, extensionDataLocal); 396Label[] memberLabels = _ilg.Switch(memberCount); 398_ilg.EndSwitch(); 402_ilg.Pop(); 404_ilg.EndFor(); 407_ilg.If(requiredIndexLocal!, Cmp.LessThan, memberCount); 408_ilg.Call(null, XmlFormatGeneratorStatics.ThrowRequiredMemberMissingExceptionMethod, _xmlReaderArg, memberIndexLocal, requiredIndexLocal, _memberNamesArg); 409_ilg.EndIf(); 427_ilg.Case(memberLabels[memberCount]); 434_ilg.Set(requiredIndexLocal!, nextRequiredIndex); 441_ilg.LoadAddress(_objectLocal); 442_ilg.LoadMember(dataMember.MemberInfo); 443value = _ilg.DeclareLocal(memberType); 444_ilg.Stloc(value); 445_ilg.Call(_contextArg, XmlFormatGeneratorStatics.StoreCollectionMemberInfoMethod, value); 450_ilg.Call(_contextArg, XmlFormatGeneratorStatics.ResetCollectionMemberInfoMethod); 452_ilg.LoadAddress(_objectLocal); 453_ilg.ConvertAddress(_objectLocal.LocalType, _objectType); 454_ilg.Ldloc(value); 455_ilg.StoreMember(dataMember.MemberInfo); 458_ilg.Set(memberIndexLocal, memberCount); 460_ilg.EndCase(); 494_ilg.LoadAddress(_objectLocal); 495_ilg.ConvertAddress(_objectLocal.LocalType, _objectType); 496_ilg.Call(_contextArg, XmlFormatGeneratorStatics.ReadSerializationInfoMethod, _xmlReaderArg, classContract.UnderlyingType); 497_ilg.Load(_contextArg); 498_ilg.LoadMember(XmlFormatGeneratorStatics.GetStreamingContextMethod); 499_ilg.Call(ctor); 506LocalBuilder value = _ilg.DeclareLocal(type); 518LocalBuilder objectId = _ilg.DeclareLocal(Globals.TypeOfString); 519_ilg.Call(_contextArg, XmlFormatGeneratorStatics.ReadAttributesMethod, _xmlReaderArg); 520_ilg.Call(_contextArg, XmlFormatGeneratorStatics.ReadIfNullOrRefMethod, _xmlReaderArg, type, DataContract.IsTypeSerializable(type)); 521_ilg.Stloc(objectId); 523_ilg.If(objectId, Cmp.EqualTo, Globals.NullObjectId); 526_ilg.LoadAddress(value); 527_ilg.InitObj(value.LocalType); 533_ilg.Load(null); 534_ilg.Stloc(value); 540_ilg.ElseIfIsEmptyString(objectId); 541_ilg.Call(_contextArg, XmlFormatGeneratorStatics.GetObjectIdMethod); 542_ilg.Stloc(objectId); 545_ilg.IfNotIsEmptyString(objectId); 547_ilg.EndIf(); 552value = _ilg.DeclareLocal(type); 557_ilg.Call(_xmlReaderArg, primitiveContract.XmlFormatReaderMethod); 558_ilg.Stloc(value); 560_ilg.Call(_contextArg, XmlFormatGeneratorStatics.AddNewObjectMethod, value); 567_ilg.Else(); 572_ilg.Call(_contextArg, XmlFormatGeneratorStatics.GetExistingObjectMethod, objectId, type, name, ns); 573_ilg.ConvertValue(Globals.TypeOfObject, type); 574_ilg.Stloc(value); 576_ilg.EndIf(); 580_ilg.If(objectId, Cmp.NotEqualTo, Globals.NullObjectId); 582_ilg.EndIf(); 597_ilg.Load(_contextArg); 598_ilg.Load(_xmlReaderArg); 600_ilg.Load(DataContract.GetId(declaredType.TypeHandle)); 601_ilg.Ldtoken(declaredType); 602_ilg.Load(name); 603_ilg.Load(ns); 604_ilg.Call(XmlFormatGeneratorStatics.InternalDeserializeMethod); 607_ilg.Call(XmlFormatGeneratorStatics.UnboxPointer); 609_ilg.ConvertValue(Globals.TypeOfObject, type); 611_ilg.Stloc(value); 619_ilg.LoadAddress(outerValue); 620_ilg.Load(innerValue); 624_ilg.New(type.GetConstructor(new Type[] { innerType })!); 627_ilg.Call(outerType.GetConstructor(new Type[] { innerType })!); 667_objectLocal = _ilg.DeclareLocal(type); 672_ilg.Ldloca(_objectLocal); 673_ilg.InitObj(type); 677_ilg.New(constructor); 678_ilg.Stloc(_objectLocal); 679_ilg.Call(_contextArg, XmlFormatGeneratorStatics.AddNewObjectMethod, _objectLocal); 683LocalBuilder size = _ilg.DeclareLocal(Globals.TypeOfInt); 684_ilg.Call(_contextArg, XmlFormatGeneratorStatics.GetArraySizeMethod); 685_ilg.Stloc(size); 687LocalBuilder objectId = _ilg.DeclareLocal(Globals.TypeOfString); 688_ilg.Call(_contextArg, XmlFormatGeneratorStatics.GetObjectIdMethod); 689_ilg.Stloc(objectId); 695_ilg.IfNot(); 698_ilg.If(size, Cmp.EqualTo, -1); 703growingCollection = _ilg.DeclareLocal(type); 704_ilg.NewArray(itemType, 32); 705_ilg.Stloc(growingCollection); 707LocalBuilder i = _ilg.DeclareLocal(Globals.TypeOfInt); 708object forLoop = _ilg.For(i, 0, int.MaxValue); 710_ilg.If(); 711_ilg.Call(_contextArg, XmlFormatGeneratorStatics.IncrementItemCountMethod, 1); 717_ilg.Call(null, ensureArraySizeMethod, growingCollection, i); 718_ilg.Stloc(growingCollection); 719_ilg.StoreArrayElement(growingCollection, i, value); 723_ilg.Else(); 725_ilg.If(); 726_ilg.Break(forLoop); 727_ilg.Else(); 729_ilg.EndIf(); 730_ilg.EndIf(); 732_ilg.EndFor(); 736_ilg.Call(null, trimArraySizeMethod, growingCollection, i); 737_ilg.Stloc(_objectLocal); 738_ilg.Call(_contextArg, XmlFormatGeneratorStatics.AddNewObjectWithIdMethod, objectId, _objectLocal); 740_ilg.Else(); 742_ilg.Call(_contextArg, XmlFormatGeneratorStatics.IncrementItemCountMethod, size); 745_ilg.NewArray(itemType, size); 746_ilg.Stloc(_objectLocal); 747_ilg.Call(_contextArg, XmlFormatGeneratorStatics.AddNewObjectMethod, _objectLocal); 749LocalBuilder j = _ilg.DeclareLocal(Globals.TypeOfInt); 750_ilg.For(j, 0, size); 752_ilg.If(); 755_ilg.StoreArrayElement(_objectLocal, j, itemValue); 758_ilg.Else(); 760_ilg.EndIf(); 761_ilg.EndFor(); 762_ilg.Call(_contextArg, XmlFormatGeneratorStatics.CheckEndOfArrayMethod, _xmlReaderArg, size, _memberNamesArg, _memberNamespacesArg); 763_ilg.EndIf(); 767_ilg.Else(); 768_ilg.Call(_contextArg, XmlFormatGeneratorStatics.AddNewObjectWithIdMethod, objectId, _objectLocal); 769_ilg.EndIf(); 783_objectLocal = _ilg.DeclareLocal(type); 784_ilg.Load(_contextArg); 785_ilg.LoadMember(XmlFormatGeneratorStatics.GetCollectionMemberMethod); 786_ilg.ConvertValue(Globals.TypeOfObject, type); 787_ilg.Stloc(_objectLocal); 791_ilg.If(); 792_ilg.If(_objectLocal, Cmp.EqualTo, null); 793_ilg.Call(null, XmlFormatGeneratorStatics.ThrowNullValueReturnedForGetOnlyCollectionExceptionMethod, type); 795_ilg.Else(); 796LocalBuilder size = _ilg.DeclareLocal(Globals.TypeOfInt); 799_ilg.Load(_objectLocal); 800_ilg.Call(XmlFormatGeneratorStatics.GetArrayLengthMethod); 801_ilg.Stloc(size); 804_ilg.Call(_contextArg, XmlFormatGeneratorStatics.AddNewObjectMethod, _objectLocal); 806LocalBuilder i = _ilg.DeclareLocal(Globals.TypeOfInt); 807object forLoop = _ilg.For(i, 0, int.MaxValue); 809_ilg.If(); 810_ilg.Call(_contextArg, XmlFormatGeneratorStatics.IncrementItemCountMethod, 1); 814_ilg.If(size, Cmp.EqualTo, i); 815_ilg.Call(null, XmlFormatGeneratorStatics.ThrowArrayExceededSizeExceptionMethod, size, type); 816_ilg.Else(); 817_ilg.StoreArrayElement(_objectLocal, i, value); 818_ilg.EndIf(); 822_ilg.Else(); 824_ilg.If(); 825_ilg.Break(forLoop); 826_ilg.Else(); 828_ilg.EndIf(); 829_ilg.EndIf(); 830_ilg.EndFor(); 831_ilg.Call(_contextArg, XmlFormatGeneratorStatics.CheckEndOfArrayMethod, _xmlReaderArg, size, _memberNamesArg, _memberNamespacesArg); 833_ilg.EndIf(); 834_ilg.EndIf(); 876_ilg.Load(_xmlReaderArg); 877_ilg.Load(_contextArg); 878_ilg.Load(_memberNamesArg); 879_ilg.Load(_memberNamespacesArg); 880_ilg.Load(size); 881_ilg.Ldloca(_objectLocal); 882_ilg.Call(typeof(XmlReaderDelegator).GetMethod(readArrayMethod, Globals.ScanAllMembers)!); 894_ilg.Call(_contextArg, XmlFormatGeneratorStatics.ResetAttributesMethod); 895LocalBuilder value = _ilg.DeclareLocal(itemType); 896_ilg.Load(_collectionContractArg); 897_ilg.Call(XmlFormatGeneratorStatics.GetItemContractMethod); 898_ilg.Load(_xmlReaderArg); 899_ilg.Load(_contextArg); 900_ilg.Call(XmlFormatGeneratorStatics.ReadXmlValueMethod); 901_ilg.ConvertValue(Globals.TypeOfObject, itemType); 902_ilg.Stloc(value); 926LocalBuilder pairKey = _ilg.DeclareLocal(keyMember.MemberType); 927LocalBuilder pairValue = _ilg.DeclareLocal(valueMember.MemberType); 928_ilg.LoadAddress(value); 929_ilg.LoadMember(keyMember.MemberInfo); 930_ilg.Stloc(pairKey); 931_ilg.LoadAddress(value); 932_ilg.LoadMember(valueMember.MemberInfo); 933_ilg.Stloc(pairValue); 935_ilg.Call(collection, collectionContract.AddMethod, pairKey, pairValue); 937_ilg.Pop(); 941_ilg.Call(collection, collectionContract.AddMethod, value); 943_ilg.Pop(); 950_ilg.If(); 951_ilg.Call(_contextArg, XmlFormatGeneratorStatics.SkipUnknownElementMethod, _xmlReaderArg); 952_ilg.Dec(iterator); 953_ilg.Else(); 955_ilg.EndIf(); 960_ilg.Call(_xmlReaderArg, XmlFormatGeneratorStatics.IsStartElementMethod2, nameArg, nsArg); 965_ilg.Call(_xmlReaderArg, XmlFormatGeneratorStatics.IsStartElementMethod0); 970_ilg.Load(_xmlReaderArg); 971_ilg.LoadMember(XmlFormatGeneratorStatics.NodeTypeProperty); 972_ilg.Load(XmlNodeType.EndElement); 973_ilg.Ceq(); 978_ilg.Call(null, XmlFormatGeneratorStatics.CreateUnexpectedStateExceptionMethod, expectedState, _xmlReaderArg); 979_ilg.Throw(); 984_ilg.Load(msg); 990_ilg.New(XmlFormatGeneratorStatics.SerializationExceptionCtor); 991_ilg.Throw();