2 writes to _ilg
System.Private.DataContractSerialization (2)
System\Runtime\Serialization\XmlFormatWriterGenerator.cs (2)
82_ilg = new CodeGenerator(); 126_ilg = new CodeGenerator();
185 references to _ilg
System.Private.DataContractSerialization (185)
System\Runtime\Serialization\XmlFormatWriterGenerator.cs (185)
86_ilg.BeginMethod("Write" + classContract.XmlName.Name + "ToXml", Globals.TypeOfXmlFormatClassWriterDelegate, memberAccessFlag); 105return (XmlFormatClassWriterDelegate)_ilg.EndMethod(); 130_ilg.BeginMethod("Write" + collectionContract.XmlName.Name + "ToXml", Globals.TypeOfXmlFormatCollectionWriterDelegate, memberAccessFlag); 149return (XmlFormatCollectionWriterDelegate)_ilg.EndMethod(); 156_xmlWriterArg = _ilg.GetArg(0); 157_contextArg = _ilg.GetArg(2); 158_dataContractArg = _ilg.GetArg(3); 160_objectLocal = _ilg.DeclareLocal(objType); 161ArgBuilder objectArg = _ilg.GetArg(1); 162_ilg.Load(objectArg); 170_ilg.ConvertValue(objectArg.ArgType, Globals.TypeOfDateTimeOffset); 171_ilg.Call(XmlFormatGeneratorStatics.GetDateTimeOffsetAdapterMethod); 175_ilg.ConvertValue(objectArg.ArgType, Globals.TypeOfMemoryStream); 176_ilg.Call(XmlFormatGeneratorStatics.GetMemoryStreamAdapterMethod); 180_ilg.ConvertValue(objectArg.ArgType, objType); 182_ilg.Stloc(_objectLocal); 197_ilg.Load(_contextArg); 198_ilg.LoadMember(XmlFormatGeneratorStatics.SerializeReadOnlyTypesProperty); 199_ilg.IfNot(); 200_ilg.Load(_dataContractArg); 201_ilg.LoadMember(serializationExceptionMessageProperty); 202_ilg.Load(null); 203_ilg.Call(XmlFormatGeneratorStatics.ThrowInvalidDataContractExceptionMethod); 204_ilg.EndIf(); 213_ilg.LoadAddress(_objectLocal); 214_ilg.Load(_contextArg); 215_ilg.Call(XmlFormatGeneratorStatics.GetStreamingContextMethod); 216_ilg.Call(classContract.OnSerializing); 226_ilg.LoadAddress(_objectLocal); 227_ilg.Load(_contextArg); 228_ilg.Call(XmlFormatGeneratorStatics.GetStreamingContextMethod); 229_ilg.Call(classContract.OnSerialized); 241_ilg.Call(_contextArg, XmlFormatGeneratorStatics.WriteISerializableMethod, _xmlWriterArg, _objectLocal); 247_contractNamespacesLocal = _ilg.DeclareLocal(typeof(XmlDictionaryString[])); 248_ilg.Load(_dataContractArg); 249_ilg.LoadMember(XmlFormatGeneratorStatics.ContractNamespacesField); 250_ilg.Store(_contractNamespacesLocal); 253_memberNamesLocal = _ilg.DeclareLocal(typeof(XmlDictionaryString[])); 254_ilg.Load(_dataContractArg); 255_ilg.LoadMember(XmlFormatGeneratorStatics.MemberNamesField); 256_ilg.Store(_memberNamesLocal); 262_childElementNamespacesLocal = _ilg.DeclareLocal(typeof(XmlDictionaryString[])); 263_ilg.Load(_dataContractArg); 264_ilg.LoadMember(XmlFormatGeneratorStatics.ChildElementNamespacesProperty); 265_ilg.Store(_childElementNamespacesLocal); 271LocalBuilder extensionDataLocal = _ilg.DeclareLocal(Globals.TypeOfExtensionDataObject); 272_ilg.Load(_objectLocal); 273_ilg.ConvertValue(_objectLocal.LocalType, Globals.TypeOfIExtensibleDataObject); 274_ilg.LoadMember(XmlFormatGeneratorStatics.ExtensionDataProperty); 275_ilg.Store(extensionDataLocal); 276_ilg.Call(_contextArg, XmlFormatGeneratorStatics.WriteExtensionDataMethod, _xmlWriterArg, extensionDataLocal, -1); 294LocalBuilder namespaceLocal = _ilg.DeclareLocal(typeof(XmlDictionaryString)); 297_ilg.Load(_dataContractArg); 298_ilg.LoadMember(XmlFormatGeneratorStatics.NamespaceProperty); 302_ilg.LoadArrayElement(_contractNamespacesLocal, _typeIndex - 1); 305_ilg.Store(namespaceLocal); 308_ilg.Call(thisObj: _contextArg, XmlFormatGeneratorStatics.IncrementItemCountMethod, classMemberCount); 316_ilg.Load(_contextArg); 317_ilg.Call(methodInfo: member.IsGetOnlyCollection ? 324_ilg.IfNotDefaultValue(memberValue); 332_ilg.Load(_xmlWriterArg); 333_ilg.LoadArrayElement(_childElementNamespacesLocal!, i + _childElementIndex); 334_ilg.Call(methodInfo: XmlFormatGeneratorStatics.WriteNamespaceDeclMethod); 344_ilg.Call(thisObj: _contextArg, XmlFormatGeneratorStatics.WriteExtensionDataMethod, _xmlWriterArg, extensionDataLocal, memberCount); 351_ilg.Else(); 352_ilg.Call(thisObj: null, XmlFormatGeneratorStatics.ThrowRequiredMemberMustBeEmittedMethod, member.Name, classContract.UnderlyingType); 354_ilg.EndIf(); 365_ilg.LoadAddress(_objectLocal); 366_ilg.LoadMember(member.MemberInfo); 367LocalBuilder memberValue = _ilg.DeclareLocal(member.MemberType); 368_ilg.Stloc(memberValue); 376LocalBuilder itemNamespace = _ilg.DeclareLocal(typeof(XmlDictionaryString)); 377_ilg.Load(_dataContractArg); 378_ilg.LoadMember(XmlFormatGeneratorStatics.NamespaceProperty); 379_ilg.Store(itemNamespace); 381LocalBuilder itemName = _ilg.DeclareLocal(typeof(XmlDictionaryString)); 382_ilg.Load(_dataContractArg); 383_ilg.LoadMember(XmlFormatGeneratorStatics.CollectionItemNameProperty); 384_ilg.Store(itemName); 388_ilg.Load(_xmlWriterArg); 389_ilg.Load(_dataContractArg); 390_ilg.LoadMember(XmlFormatGeneratorStatics.ChildElementNamespaceProperty); 391_ilg.Call(XmlFormatGeneratorStatics.WriteNamespaceDeclMethod); 397LocalBuilder i = _ilg.DeclareLocal(Globals.TypeOfInt); 399_ilg.Call(_contextArg, XmlFormatGeneratorStatics.IncrementArrayCountMethod, _xmlWriterArg, _objectLocal); 403_ilg.For(i, 0, _objectLocal); 407_ilg.LoadArrayElement(_objectLocal, i); 408LocalBuilder memberValue = _ilg.DeclareLocal(itemType); 409_ilg.Stloc(memberValue); 413_ilg.EndFor(); 438_ilg.Call(_contextArg, incrementCollectionCountMethod, _xmlWriterArg, _objectLocal); 493LocalBuilder currentValue = _ilg.DeclareLocal(elementType); 495LocalBuilder enumerator = _ilg.DeclareLocal(enumeratorType); 496_ilg.Call(_objectLocal, collectionContract.GetEnumeratorMethod); 499_ilg.ConvertValue(collectionContract.GetEnumeratorMethod.ReturnType, Globals.TypeOfIDictionaryEnumerator); 500_ilg.New(XmlFormatGeneratorStatics.DictionaryEnumeratorCtor); 506_ilg.ConvertValue(collectionContract.GetEnumeratorMethod.ReturnType, ctorParam); 507_ilg.New(dictEnumCtor); 509_ilg.Stloc(enumerator); 511_ilg.ForEach(currentValue, elementType, enumerator, getCurrentMethod); 514_ilg.Call(_contextArg, XmlFormatGeneratorStatics.IncrementItemCountMethod, 1); 522_ilg.Call(_dataContractArg, XmlFormatGeneratorStatics.GetItemContractMethod); 523_ilg.Load(_xmlWriterArg); 524_ilg.Load(currentValue); 525_ilg.ConvertValue(currentValue.LocalType, Globals.TypeOfObject); 526_ilg.Load(_contextArg); 527_ilg.Call(XmlFormatGeneratorStatics.WriteXmlValueMethod); 535_ilg.EndForEach(moveNextMethod); 550_ilg.Load(_xmlWriterArg); 554_ilg.Load(_contextArg); 555_ilg.Load(_xmlWriterArg); 560_ilg.Load(value); 564_ilg.LoadAddress(_objectLocal); 565_ilg.LoadMember(memberInfo); 569_ilg.LoadArrayElement(_objectLocal, arrayItemIndex); 574_ilg.Load(name); 578_ilg.LoadArrayElement(_memberNamesLocal!, nameIndex); 581_ilg.Load(ns); 583_ilg.Call(primitiveContract.XmlFormatWriterMethod); 624_ilg.Load(_xmlWriterArg); 625_ilg.Load(value); 626_ilg.Load(itemName); 627_ilg.Load(itemNamespace); 628_ilg.Call(typeof(XmlWriterDelegator).GetMethod(writeArrayMethod, Globals.ScanAllMembers, new Type[] { type, typeof(XmlDictionaryString), typeof(XmlDictionaryString) })!); 641_ilg.Load(memberValue); 642_ilg.Load(memberType); 643_ilg.Call(XmlFormatGeneratorStatics.BoxPointer); 645memberValue = _ilg.DeclareLocal(memberType); 646_ilg.Store(memberValue); 654_ilg.Call(_xmlWriterArg, primitiveContract.XmlFormatContentWriterMethod, memberValue); 667_ilg.Load(memberValue); 668_ilg.Load(null); 669_ilg.Ceq(); 671_ilg.If(); 672_ilg.Call(_contextArg, XmlFormatGeneratorStatics.WriteNullMethod, _xmlWriterArg, memberType, DataContract.IsTypeSerializable(memberType)); 673_ilg.Else(); 679_ilg.Call(_xmlWriterArg, primitiveContract.XmlFormatContentWriterMethod, memberValue); 683_ilg.Call(_contextArg, primitiveContract.XmlFormatContentWriterMethod, _xmlWriterArg, memberValue); 692_ilg.Load(memberValue); 693_ilg.ConvertValue(memberValue.LocalType, Globals.TypeOfObject); 694memberValue = _ilg.DeclareLocal(Globals.TypeOfObject); 696_ilg.Stloc(memberValue); 697_ilg.If(memberValue, Cmp.EqualTo, null); 698_ilg.Call(_contextArg, XmlFormatGeneratorStatics.WriteNullMethod, _xmlWriterArg, memberType, DataContract.IsTypeSerializable(memberType)); 699_ilg.Else(); 705_ilg.EndIf(); 707_ilg.EndIf(); 713_ilg.Load(_contextArg); 714_ilg.Load(_xmlWriterArg); 715_ilg.Load(memberValue); 716_ilg.ConvertValue(memberValue.LocalType, Globals.TypeOfObject); 717LocalBuilder typeHandleValue = _ilg.DeclareLocal(typeof(RuntimeTypeHandle)); 718_ilg.Call(null, typeof(Type).GetMethod("GetTypeHandle")!, memberValue); 719_ilg.Stloc(typeHandleValue); 720_ilg.LoadAddress(typeHandleValue); 721_ilg.Ldtoken(memberType); 722_ilg.Call(typeof(RuntimeTypeHandle).GetMethod("Equals", new Type[] { typeof(RuntimeTypeHandle) })!); 723_ilg.Load(writeXsiType); 724_ilg.Load(DataContract.GetId(memberType.TypeHandle)); 725_ilg.Ldtoken(memberType); 726_ilg.Call(methodInfo); 735Label onNull = _ilg.DefineLabel(); 736Label end = _ilg.DefineLabel(); 737_ilg.Load(memberValue); 741_ilg.Dup(); 742_ilg.Call(XmlFormatGeneratorStatics.GetHasValueMethod.MakeGenericMethod(innerType)); 743_ilg.Brfalse(onNull); 744_ilg.Call(XmlFormatGeneratorStatics.GetNullableValueMethod.MakeGenericMethod(innerType)); 747memberValue = _ilg.DeclareLocal(memberType); 748_ilg.Stloc(memberValue); 749_ilg.Load(false); //isNull 750_ilg.Br(end); 751_ilg.MarkLabel(onNull); 752_ilg.Pop(); 753_ilg.Call(XmlFormatGeneratorStatics.GetDefaultValueMethod.MakeGenericMethod(memberType)); 754_ilg.Stloc(memberValue); 755_ilg.Load(true); //isNull 756_ilg.MarkLabel(end); 768_ilg.Load(_xmlWriterArg); 771_ilg.Load(Globals.ElementPrefix); 775_ilg.LoadArrayElement(_memberNamesLocal!, nameIndex); 777_ilg.Load(nameLocal); 780_ilg.Load(namespaceLocal); 782_ilg.Call(needsPrefix ? XmlFormatGeneratorStatics.WriteStartElementMethod3 : XmlFormatGeneratorStatics.WriteStartElementMethod2); 787_ilg.Call(_xmlWriterArg, XmlFormatGeneratorStatics.WriteEndElementMethod);