4 writes to _ilg
System.Private.DataContractSerialization (4)
System\Runtime\Serialization\Json\JsonFormatReaderGenerator.cs (4)
66_ilg = new CodeGenerator(); 129_ilg = GenerateCollectionReaderHelper(collectionContract, false /*isGetOnlyCollection*/); 140_ilg = GenerateCollectionReaderHelper(collectionContract, true /*isGetOnlyCollection*/); 148_ilg = new CodeGenerator();
300 references to _ilg
System.Private.DataContractSerialization (300)
System\Runtime\Serialization\Json\JsonFormatReaderGenerator.cs (300)
70BeginMethod(_ilg, "Read" + DataContract.SanitizeTypeName(classContract.XmlName!.Name) + "FromJson", typeof(JsonFormatClassReaderDelegate), memberAccessFlag); 85_ilg.Call(_contextArg, XmlFormatGeneratorStatics.AddNewObjectMethod, _objectLocal); 94_ilg.Call(_objectLocal, JsonFormatGeneratorStatics.OnDeserializationMethod, null); 100_ilg.Load(_objectLocal); 107_ilg.ConvertValue(_objectLocal.LocalType, Globals.TypeOfDateTimeOffsetAdapter); 108_ilg.Call(XmlFormatGeneratorStatics.GetDateTimeOffsetMethod); 109_ilg.ConvertValue(Globals.TypeOfDateTimeOffset, _ilg.CurrentMethod.ReturnType); 113_ilg.ConvertValue(_objectLocal.LocalType, Globals.TypeOfMemoryStreamAdapter); 114_ilg.Call(XmlFormatGeneratorStatics.GetMemoryStreamMethod); 115_ilg.ConvertValue(Globals.TypeOfMemoryStream, _ilg.CurrentMethod.ReturnType); 119_ilg.ConvertValue(_objectLocal.LocalType, _ilg.CurrentMethod.ReturnType); 122return (JsonFormatClassReaderDelegate)_ilg.EndMethod(); 131_ilg.Load(_objectLocal); 132_ilg.ConvertValue(_objectLocal.LocalType, _ilg.CurrentMethod.ReturnType); 133return (JsonFormatCollectionReaderDelegate)_ilg.EndMethod(); 142return (JsonFormatGetOnlyCollectionReaderDelegate)_ilg.EndMethod(); 154BeginMethod(_ilg, "Read" + DataContract.SanitizeTypeName(collectionContract.XmlName.Name) + "FromJson" + "IsGetOnly", typeof(JsonFormatGetOnlyCollectionReaderDelegate), memberAccessFlag); 158BeginMethod(_ilg, "Read" + DataContract.SanitizeTypeName(collectionContract.XmlName.Name) + "FromJson", typeof(JsonFormatCollectionReaderDelegate), memberAccessFlag); 173_collectionContractArg = _ilg.GetArg(4); 174return _ilg; 192_xmlReaderArg = _ilg.GetArg(0); 193_contextArg = _ilg.GetArg(1); 194_emptyDictionaryStringArg = _ilg.GetArg(2); 195_memberNamesArg = _ilg.GetArg(3); 204_objectLocal = _ilg.DeclareLocal(type); 208_ilg.LoadMember(Globals.TypeOfDBNull.GetField("Value")!); 209_ilg.Stloc(_objectLocal); 215_ilg.Ldloca(_objectLocal); 216_ilg.InitObj(type); 220_ilg.New(classContract.GetNonAttributedTypeConstructor()!); 221_ilg.Stloc(_objectLocal); 226_ilg.Call(null, JsonFormatGeneratorStatics.GetUninitializedObjectMethod, classContract.TypeForInitialization); 227_ilg.ConvertValue(Globals.TypeOfObject, type); 228_ilg.Stloc(_objectLocal); 238_ilg.LoadAddress(_objectLocal); 239_ilg.ConvertAddress(_objectLocal.LocalType, _objectType!); 240_ilg.Load(_contextArg); 241_ilg.LoadMember(XmlFormatGeneratorStatics.GetStreamingContextMethod); 242_ilg.Call(classContract.OnDeserializing); 252_ilg.LoadAddress(_objectLocal); 253_ilg.ConvertAddress(_objectLocal.LocalType, _objectType!); 254_ilg.Load(_contextArg); 255_ilg.LoadMember(XmlFormatGeneratorStatics.GetStreamingContextMethod); 256_ilg.Call(classContract.OnDeserialized); 269_ilg.Load(_contextArg); 270_ilg.LoadAddress(_objectLocal); 271_ilg.ConvertAddress(_objectLocal.LocalType, Globals.TypeOfIObjectReference); 272_ilg.Load(Globals.NewObjectId); 273_ilg.Call(XmlFormatGeneratorStatics.GetRealObjectMethod); 274_ilg.ConvertValue(Globals.TypeOfObject, _ilg.CurrentMethod.ReturnType); 287LocalBuilder extensionDataLocal = _ilg.DeclareLocal(Globals.TypeOfExtensionDataObject); 288_ilg.New(JsonFormatGeneratorStatics.ExtensionDataObjectCtor); 289_ilg.Store(extensionDataLocal); 297_ilg.Call(_objectLocal, extensionDataSetMethod, extensionDataLocal); 312_ilg.Call(_contextArg, XmlFormatGeneratorStatics.IncrementItemCountMethod, memberCount); 314BitFlagsGenerator expectedElements = new BitFlagsGenerator(memberCount, _ilg); 319LocalBuilder memberIndexLocal = _ilg.DeclareLocal(Globals.TypeOfInt, -1); 320Label throwDuplicateMemberLabel = _ilg.DefineLabel(); 321Label throwMissingRequiredMembersLabel = _ilg.DefineLabel(); 323object forReadElements = _ilg.For(null, null, null); 324_ilg.Call(null, XmlFormatGeneratorStatics.MoveToNextElementMethod, _xmlReaderArg); 325_ilg.IfFalseBreak(forReadElements); 326_ilg.Call(_contextArg, JsonFormatGeneratorStatics.GetJsonMemberIndexMethod, _xmlReaderArg, _memberNamesArg, memberIndexLocal, extensionDataLocal); 329Label[] memberLabels = _ilg.Switch(memberCount); 331_ilg.EndSwitch(); 335_ilg.Pop(); 337_ilg.EndFor(); 339Label endOfTypeLabel = _ilg.DefineLabel(); 340_ilg.Br(endOfTypeLabel); 342_ilg.MarkLabel(throwDuplicateMemberLabel); 343_ilg.Call(null, JsonFormatGeneratorStatics.ThrowDuplicateMemberExceptionMethod, _objectLocal, _memberNamesArg, memberIndexLocal); 345_ilg.MarkLabel(throwMissingRequiredMembersLabel); 346_ilg.Load(_objectLocal); 347_ilg.ConvertValue(_objectLocal.LocalType, Globals.TypeOfObject); 348_ilg.Load(_memberNamesArg); 351_ilg.Call(JsonFormatGeneratorStatics.ThrowMissingRequiredMembersMethod); 353_ilg.MarkLabel(endOfTypeLabel); 368_ilg.Case(memberLabels[memberCount]); 369_ilg.Set(memberIndexLocal, memberCount); 371_ilg.Brfalse(throwDuplicateMemberLabel); 375_ilg.LoadAddress(_objectLocal); 376_ilg.LoadMember(dataMember.MemberInfo); 377value = _ilg.DeclareLocal(memberType); 378_ilg.Stloc(value); 379_ilg.Call(_contextArg, XmlFormatGeneratorStatics.StoreCollectionMemberInfoMethod, value); 384_ilg.Call(_contextArg, XmlFormatGeneratorStatics.ResetCollectionMemberInfoMethod); 386_ilg.LoadAddress(_objectLocal); 387_ilg.ConvertAddress(_objectLocal.LocalType, _objectType!); 388_ilg.Ldloc(value); 389_ilg.StoreMember(dataMember.MemberInfo); 392_ilg.EndCase(); 401_ilg.Load(expectedElements.GetLocal(i)); 402_ilg.Load(requiredElements[i]); 403_ilg.And(); 404_ilg.Load(0); 405_ilg.Ceq(); 406_ilg.Brfalse(throwMissingRequiredMembersLabel); 412LocalBuilder localArray = _ilg.DeclareLocal(Globals.TypeOfByteArray); 413_ilg.NewArray(typeof(byte), array.Length); 414_ilg.Store(localArray); 417_ilg.StoreArrayElement(localArray, i, array[i]); 419_ilg.Load(localArray); 457_ilg.LoadAddress(_objectLocal); 458_ilg.ConvertAddress(_objectLocal.LocalType, _objectType!); 459_ilg.Call(_contextArg, XmlFormatGeneratorStatics.ReadSerializationInfoMethod, _xmlReaderArg, classContract.UnderlyingType); 460_ilg.Load(_contextArg); 461_ilg.LoadMember(XmlFormatGeneratorStatics.GetStreamingContextMethod); 462_ilg.Call(ctor); 469LocalBuilder value = _ilg.DeclareLocal(type); 481LocalBuilder objectId = _ilg.DeclareLocal(Globals.TypeOfString); 482_ilg.Call(_contextArg, XmlFormatGeneratorStatics.ReadAttributesMethod, _xmlReaderArg); 483_ilg.Call(_contextArg, XmlFormatGeneratorStatics.ReadIfNullOrRefMethod, _xmlReaderArg, type, DataContract.IsTypeSerializable(type)); 484_ilg.Stloc(objectId); 486_ilg.If(objectId, Cmp.EqualTo, Globals.NullObjectId); 489_ilg.LoadAddress(value); 490_ilg.InitObj(value.LocalType); 496_ilg.Load(null); 497_ilg.Stloc(value); 503_ilg.ElseIfIsEmptyString(objectId); 504_ilg.Call(_contextArg, XmlFormatGeneratorStatics.GetObjectIdMethod); 505_ilg.Stloc(objectId); 508_ilg.IfNotIsEmptyString(objectId); 510_ilg.EndIf(); 515value = _ilg.DeclareLocal(type); 520_ilg.Call(_xmlReaderArg, primitiveContract.XmlFormatReaderMethod); 521_ilg.Stloc(value); 523_ilg.Call(_contextArg, XmlFormatGeneratorStatics.AddNewObjectMethod, value); 530_ilg.Else(); 535_ilg.Call(_contextArg, XmlFormatGeneratorStatics.GetExistingObjectMethod, objectId, type, name, string.Empty); 536_ilg.ConvertValue(Globals.TypeOfObject, type); 537_ilg.Stloc(value); 539_ilg.EndIf(); 543_ilg.If(objectId, Cmp.NotEqualTo, Globals.NullObjectId); 545_ilg.EndIf(); 560_ilg.Load(_contextArg); 561_ilg.Load(_xmlReaderArg); 563_ilg.Load(DataContract.GetId(declaredType.TypeHandle)); 564_ilg.Ldtoken(declaredType); 565_ilg.Load(name); 567_ilg.Load(string.Empty); 568_ilg.Call(XmlFormatGeneratorStatics.InternalDeserializeMethod); 572_ilg.Call(JsonFormatGeneratorStatics.UnboxPointer); 576_ilg.ConvertValue(Globals.TypeOfObject, type); 578_ilg.Stloc(value); 586_ilg.LoadAddress(outerValue); 587_ilg.Load(innerValue); 591_ilg.New(type.GetConstructor(new Type[] { innerType })!); 594_ilg.Call(outerType.GetConstructor(new Type[] { innerType })!); 629_objectLocal = _ilg.DeclareLocal(type); 634_ilg.Ldloca(_objectLocal); 635_ilg.InitObj(type); 639_ilg.New(constructor); 640_ilg.Stloc(_objectLocal); 641_ilg.Call(_contextArg, XmlFormatGeneratorStatics.AddNewObjectMethod, _objectLocal); 649_ilg.Load(_contextArg); 650_ilg.LoadMember(JsonFormatGeneratorStatics.UseSimpleDictionaryFormatReadProperty); 651_ilg.If(); 655_ilg.Else(); 658LocalBuilder objectId = _ilg.DeclareLocal(Globals.TypeOfString); 659_ilg.Call(_contextArg, XmlFormatGeneratorStatics.GetObjectIdMethod); 660_ilg.Stloc(objectId); 666_ilg.IfNot(); 672growingCollection = _ilg.DeclareLocal(type); 673_ilg.NewArray(itemType, 32); 674_ilg.Stloc(growingCollection); 676LocalBuilder i = _ilg.DeclareLocal(Globals.TypeOfInt); 677object forLoop = _ilg.For(i, 0, int.MaxValue); 680_ilg.If(); 681_ilg.Call(_contextArg, XmlFormatGeneratorStatics.IncrementItemCountMethod, 1); 687_ilg.Call(null, ensureArraySizeMethod, growingCollection, i); 688_ilg.Stloc(growingCollection); 689_ilg.StoreArrayElement(growingCollection, i, value); 693_ilg.Else(); 695_ilg.If(); 696_ilg.Break(forLoop); 697_ilg.Else(); 699_ilg.EndIf(); 700_ilg.EndIf(); 702_ilg.EndFor(); 706_ilg.Call(null, trimArraySizeMethod, growingCollection, i); 707_ilg.Stloc(_objectLocal); 708_ilg.Call(_contextArg, XmlFormatGeneratorStatics.AddNewObjectWithIdMethod, objectId, _objectLocal); 713_ilg.Else(); 714_ilg.Call(_contextArg, XmlFormatGeneratorStatics.AddNewObjectWithIdMethod, objectId, _objectLocal); 715_ilg.EndIf(); 720_ilg.EndIf(); 768LocalBuilder nodeType = _ilg.DeclareLocal(typeof(XmlNodeType)); 770_ilg.BeginWhileCondition(); 771_ilg.Call(_xmlReaderArg, JsonFormatGeneratorStatics.MoveToContentMethod); 772_ilg.Stloc(nodeType); 773_ilg.Load(nodeType); 774_ilg.Load(XmlNodeType.EndElement); 775_ilg.BeginWhileBody(Cmp.NotEqualTo); 777_ilg.Load(nodeType); 778_ilg.Load(XmlNodeType.Element); 779_ilg.If(Cmp.NotEqualTo); 781_ilg.EndIf(); 783_ilg.Call(_contextArg, XmlFormatGeneratorStatics.IncrementItemCountMethod, 1); 787_ilg.Load(keyType); 790_ilg.Load(_xmlReaderArg); 791_ilg.Call(JsonFormatGeneratorStatics.GetJsonMemberNameMethod); 795_ilg.Call(JsonFormatGeneratorStatics.ParseEnumMethod); 796_ilg.ConvertValue(Globals.TypeOfObject, keyType); 800_ilg.Call(keyDataContract.ParseMethod!); 802LocalBuilder pairKey = _ilg.DeclareLocal(keyType); 803_ilg.Stloc(pairKey); 806LocalBuilder pairKeyNullable = _ilg.DeclareLocal(keyTypeOriginal); 814_ilg.EndWhile(); 825LocalBuilder size = _ilg.DeclareLocal(Globals.TypeOfInt); 827_objectLocal = _ilg.DeclareLocal(type); 828_ilg.Load(_contextArg); 829_ilg.LoadMember(XmlFormatGeneratorStatics.GetCollectionMemberMethod); 830_ilg.ConvertValue(Globals.TypeOfObject, type); 831_ilg.Stloc(_objectLocal); 837_ilg.Load(_contextArg); 838_ilg.LoadMember(JsonFormatGeneratorStatics.UseSimpleDictionaryFormatReadProperty); 839_ilg.If(); 843_ilg.If(_objectLocal, Cmp.EqualTo, null); 844_ilg.Call(null, XmlFormatGeneratorStatics.ThrowNullValueReturnedForGetOnlyCollectionExceptionMethod, type); 845_ilg.EndIf(); 850_ilg.Call(_contextArg, XmlFormatGeneratorStatics.CheckEndOfArrayMethod, _xmlReaderArg, size, _memberNamesArg, _emptyDictionaryStringArg); 852_ilg.Else(); 857_ilg.If(); 861_ilg.If(_objectLocal, Cmp.EqualTo, null); 862_ilg.Call(null, XmlFormatGeneratorStatics.ThrowNullValueReturnedForGetOnlyCollectionExceptionMethod, type); 863_ilg.EndIf(); 868_ilg.Load(_objectLocal); 869_ilg.Call(XmlFormatGeneratorStatics.GetArrayLengthMethod); 870_ilg.Stloc(size); 873LocalBuilder i = _ilg.DeclareLocal(Globals.TypeOfInt); 874object forLoop = _ilg.For(i, 0, int.MaxValue); 876_ilg.If(); 877_ilg.Call(_contextArg, XmlFormatGeneratorStatics.IncrementItemCountMethod, 1); 881_ilg.If(size, Cmp.EqualTo, i); 882_ilg.Call(null, XmlFormatGeneratorStatics.ThrowArrayExceededSizeExceptionMethod, size, type); 883_ilg.Else(); 884_ilg.StoreArrayElement(_objectLocal, i, value); 885_ilg.EndIf(); 889_ilg.Else(); 891_ilg.If(); 892_ilg.Break(forLoop); 893_ilg.Else(); 895_ilg.EndIf(); 896_ilg.EndIf(); 897_ilg.EndFor(); 898_ilg.Call(_contextArg, XmlFormatGeneratorStatics.CheckEndOfArrayMethod, _xmlReaderArg, size, _memberNamesArg, _emptyDictionaryStringArg); 900_ilg.EndIf(); 904_ilg.EndIf(); 945_ilg.Load(_xmlReaderArg); 946_ilg.ConvertValue(typeof(XmlReaderDelegator), typeof(JsonReaderDelegator)); 947_ilg.Load(_contextArg); 948_ilg.Load(_memberNamesArg); 950_ilg.Load(_emptyDictionaryStringArg); 952_ilg.Load(-1); 953_ilg.Ldloca(_objectLocal); 954_ilg.Call(typeof(JsonReaderDelegator).GetMethod(readArrayMethod, Globals.ScanAllMembers)!); 966_ilg.Call(_contextArg, XmlFormatGeneratorStatics.ResetAttributesMethod); 967LocalBuilder value = _ilg.DeclareLocal(itemType); 968_ilg.Load(_collectionContractArg); 969_ilg.Call(JsonFormatGeneratorStatics.GetItemContractMethod); 970_ilg.Call(JsonFormatGeneratorStatics.GetRevisedItemContractMethod); 971_ilg.Load(_xmlReaderArg); 972_ilg.Load(_contextArg); 973_ilg.Call(JsonFormatGeneratorStatics.ReadJsonValueMethod); 974_ilg.ConvertValue(Globals.TypeOfObject, itemType); 975_ilg.Stloc(value); 997LocalBuilder pairKey = _ilg.DeclareLocal(keyMember.MemberType); 998LocalBuilder pairValue = _ilg.DeclareLocal(valueMember.MemberType); 999_ilg.LoadAddress(value); 1000_ilg.LoadMember(keyMember.MemberInfo); 1001_ilg.Stloc(pairKey); 1002_ilg.LoadAddress(value); 1003_ilg.LoadMember(valueMember.MemberInfo); 1004_ilg.Stloc(pairValue); 1012_ilg.Call(collection, collectionContract.AddMethod, value); 1014_ilg.Pop(); 1022_ilg.Call(collection, collectionContract.AddMethod, pairKey, pairValue); 1024_ilg.Pop(); 1030_ilg.If(); 1031_ilg.Call(_contextArg, XmlFormatGeneratorStatics.SkipUnknownElementMethod, _xmlReaderArg); 1032_ilg.Dec(iterator); 1033_ilg.Else(); 1035_ilg.EndIf(); 1040_ilg.Call(_xmlReaderArg, JsonFormatGeneratorStatics.IsStartElementMethod2, nameArg, nsArg); 1045_ilg.Call(_xmlReaderArg, JsonFormatGeneratorStatics.IsStartElementMethod0); 1050_ilg.Load(_xmlReaderArg); 1051_ilg.LoadMember(JsonFormatGeneratorStatics.NodeTypeProperty); 1052_ilg.Load(XmlNodeType.EndElement); 1053_ilg.Ceq(); 1058_ilg.Call(null, XmlFormatGeneratorStatics.CreateUnexpectedStateExceptionMethod, expectedState, _xmlReaderArg); 1059_ilg.Throw(); 1065_ilg.CallStringFormat(msg, values); 1067_ilg.Load(msg); 1073_ilg.New(JsonFormatGeneratorStatics.SerializationExceptionCtor); 1074_ilg.Throw();