Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
XmlILGenerator.cs
Go to the documentation of this file.
9
10namespace System.Xml.Xsl;
11
12internal sealed class XmlILGenerator
13{
15
17
19
21
23
24 [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "This method will generate the IL methods using RefEmit at runtime, which will then try to call them using methods that are annotated as RequiresUnreferencedCode. In this case, these uses can be suppressed as the trimmer won't be able to trim any IL that gets generated at runtime.")]
26 {
27 _qil = query;
28 bool useLRE = !_qil.IsDebug && typeBldr == null;
29 bool isDebug = _qil.IsDebug;
32 if (typeBldr != null)
33 {
35 }
36 else
37 {
39 }
42 MethodInfo methExec = _module.DefineMethod("Execute", typeof(void), Type.EmptyTypes, Array.Empty<string>(), XmlILMethodAttributes.NonUser);
44 MethodInfo methRoot = _module.DefineMethod("Root", typeof(void), Type.EmptyTypes, Array.Empty<string>(), xmlAttrs);
46 {
48 }
56 if (typeBldr != null)
57 {
60 return null;
61 }
64 return new XmlILCommand(delExec, staticData);
65 }
66
68 {
69 foreach (QilFunction func in funcList)
70 {
71 Type[] array = new Type[func.Arguments.Count];
72 string[] array2 = new string[func.Arguments.Count];
73 for (int i = 0; i < func.Arguments.Count; i++)
74 {
75 QilParameter qilParameter = (QilParameter)func.Arguments[i];
77 if (qilParameter.DebugName != null)
78 {
79 array2[i] = qilParameter.DebugName;
80 }
81 }
82 Type returnType = ((!XmlILConstructInfo.Read(func).PushToWriterLast) ? XmlILTypeHelper.GetStorageType(func.XmlType) : typeof(void));
85 for (int j = 0; j < func.Arguments.Count; j++)
86 {
87 XmlILAnnotation.Write(func.Arguments[j]).ArgumentPosition = j;
88 }
89 XmlILAnnotation.Write(func).FunctionBinding = functionBinding;
90 }
91 }
92
103
114
137
139 {
140 foreach (QilIterator iter in iterList)
141 {
142 if (_qil.IsDebug || OptimizerPatterns.Read(iter).MatchesPattern(OptimizerPatternName.MaybeSideEffects))
143 {
148 }
149 }
150 }
151
184}
virtual void GetObjectData(SerializationInfo info, StreamingContext context)
static readonly OpCode Brfalse
Definition OpCodes.cs:117
static readonly OpCode Stloc
Definition OpCodes.cs:429
static readonly OpCode Stelem_Ref
Definition OpCodes.cs:323
static readonly OpCode Stsfld
Definition OpCodes.cs:255
static readonly OpCode Pop
Definition OpCodes.cs:79
static readonly OpCode Ldarg_1
Definition OpCodes.cs:11
static readonly OpCode Ldtoken
Definition OpCodes.cs:353
static readonly OpCode Ret
Definition OpCodes.cs:87
static readonly OpCode Ldloc
Definition OpCodes.cs:425
static readonly OpCode Ldarg_0
Definition OpCodes.cs:9
static readonly OpCode Dup
Definition OpCodes.cs:77
static readonly OpCode Newarr
Definition OpCodes.cs:281
static readonly Type[] EmptyTypes
Definition Type.cs:19
LocalBuilder DeclareLocal(string name, Type type)
void MethodBegin(MethodBase methInfo, ISourceLineInfo sourceInfo, bool initWriters)
static OptimizerPatterns Read(QilNode nd)
int DeclareEarlyBound(string namespaceUri, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type ebType)
static XmlILAnnotation Write(QilNode nd)
static XmlILConstructInfo Read(QilNode nd)
static readonly MethodInfo InitializeArray
static readonly MethodInfo NavClone
static readonly MethodInfo NavMoveTo
FieldInfo DefineField(string fieldName, Type type)
MethodInfo DefineMethod(string name, Type returnType, Type[] paramTypes, string[] paramNames, XmlILMethodAttributes xmlAttrs)
ConstructorInfo DefineTypeInitializer()
FieldInfo DefineInitializedData(string name, byte[] data)
Delegate CreateDelegate(string name, Type typDelegate)
static Type GetStorageType(XmlQueryType qyTyp)
void Visit(QilExpression qil, GenerateHelper helper, MethodInfo methRoot)
XmlWriterSettings DefaultWriterSettings
IList< WhitespaceRule > WhitespaceRules
IList< EarlyBoundInfo > EarlyBoundTypes
void CreateTypeInitializer(XmlQueryStaticData staticData)
void CreateFunctionMetadata(IList< QilNode > funcList)
MethodInfo GenerateExecuteFunction(MethodInfo methExec, MethodInfo methRoot)
XmlILCommand Generate(QilExpression query, TypeBuilder typeBldr)
XmlILOptimizerVisitor _optVisitor
void CreateGlobalValueMetadata(IList< QilNode > globalList)
void EvaluateGlobalValues(IList< QilNode > iterList)
delegate void ExecuteDelegate(XmlQueryRuntime runtime)