public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { VirtualResolutionFixupSignature otherNode = (VirtualResolutionFixupSignature)other; int result = ((int)_fixupKind).CompareTo((int)otherNode._fixupKind); if (result != 0) { return(result); } result = comparer.Compare(_implType, otherNode._implType); if (result != 0) { return(result); } result = _declMethod.CompareTo(otherNode._declMethod, comparer); if (result != 0) { return(result); } // Handle null _implMethod scenario if (_implMethod == otherNode._implMethod) { return(0); } return(_implMethod.CompareTo(otherNode._implMethod, comparer)); }
public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { DelegateCtorSignature otherNode = (DelegateCtorSignature)other; int result = comparer.Compare(_delegateType, otherNode._delegateType); if (result != 0) { return(result); } result = comparer.Compare(_targetMethod, otherNode._targetMethod); if (result != 0) { return(result); } return(_methodToken.CompareTo(otherNode._methodToken)); }
public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { ImportThunk otherNode = (ImportThunk)other; int result = ((int)_thunkKind).CompareTo((int)otherNode._thunkKind); if (result != 0) { return(result); } result = comparer.Compare(_helperCell, otherNode._helperCell); if (result != 0) { return(result); } return(comparer.Compare(_instanceCell, otherNode._instanceCell)); }
public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { Import otherNode = (Import)other; int result = comparer.Compare(CallingMethod, otherNode.CallingMethod); if (result != 0) { return(result); } result = comparer.Compare(ImportSignature.Target, otherNode.ImportSignature.Target); if (result != 0) { return(result); } return(Table.CompareToImpl(otherNode.Table, comparer)); }
public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { int result = comparer.Compare(_localMethod, ((PrecodeMethodImport)other)._localMethod); if (result != 0) { return(result); } return(base.CompareToImpl(other, comparer)); }
public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { MethodWithGCInfo otherNode = (MethodWithGCInfo)other; int result = comparer.Compare(_method, otherNode._method); if (result != 0) { return(result); } return(SignatureContext.CompareTo(otherNode.SignatureContext, comparer)); }
public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { FieldFixupSignature otherNode = (FieldFixupSignature)other; int result = ((int)_fixupKind).CompareTo((int)otherNode._fixupKind); if (result != 0) { return(result); } return(comparer.Compare(_fieldDesc, otherNode._fieldDesc)); }
public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { ILBodyFixupSignature otherNode = (ILBodyFixupSignature)other; int result = ((int)_fixupKind).CompareTo((int)otherNode._fixupKind); if (result != 0) { return(result); } return(comparer.Compare(_method, otherNode._method)); }
public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { NewArrayFixupSignature otherNode = (NewArrayFixupSignature)other; int result = comparer.Compare(_arrayType, otherNode._arrayType); if (result != 0) { return(result); } return(_signatureContext.CompareTo(otherNode._signatureContext, comparer)); }
public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { TypeFixupSignature otherNode = (TypeFixupSignature)other; int result = ((int)_fixupKind).CompareTo((int)otherNode._fixupKind); if (result != 0) { return(result); } result = comparer.Compare(_typeDesc, otherNode._typeDesc); if (result != 0) { return(result); } return(_signatureContext.CompareTo(otherNode._signatureContext, comparer)); }
public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { ImportThunk otherNode = (ImportThunk)other; int result = ((int)_thunkKind).CompareTo((int)otherNode._thunkKind); if (result != 0) { return(result); } result = ((ImportSectionNode)_containingImportSection).CompareToImpl((ImportSectionNode)otherNode._containingImportSection, comparer); if (result != 0) { return(result); } return(comparer.Compare(_helperCell, otherNode._helperCell)); }
public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { FieldFixupSignature otherNode = (FieldFixupSignature)other; int result = _fixupKind.CompareTo(otherNode._fixupKind); if (result != 0) { return(result); } result = comparer.Compare(_fieldDesc, otherNode._fieldDesc); if (result != 0) { return(result); } return(_signatureContext.CompareTo(otherNode._signatureContext, comparer)); }
public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { if ((_localMethod != null) && (((DelayLoadMethodImport)other)._localMethod != null)) { int result = comparer.Compare(_localMethod, ((DelayLoadMethodImport)other)._localMethod); if (result != 0) { return(result); } } else if (_localMethod != null) { return(1); } else if (((DelayLoadMethodImport)other)._localMethod != null) { return(-1); } return(base.CompareToImpl(other, comparer)); }
public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { GenericLookupSignature otherNode = (GenericLookupSignature)other; int result = ((int)_runtimeLookupKind).CompareTo((int)otherNode._runtimeLookupKind); if (result != 0) { return(result); } result = ((int)_fixupKind).CompareTo((int)otherNode._fixupKind); if (result != 0) { return(result); } if (_typeArgument != null || otherNode._typeArgument != null) { if (_typeArgument == null) { return(-1); } if (otherNode._typeArgument == null) { return(1); } result = comparer.Compare(_typeArgument, otherNode._typeArgument); if (result != 0) { return(result); } } if (_fieldArgument != null || otherNode._fieldArgument != null) { if (_fieldArgument == null) { return(-1); } if (otherNode._fieldArgument == null) { return(1); } result = comparer.Compare(_fieldArgument, otherNode._fieldArgument); if (result != 0) { return(result); } } if (_methodArgument != null || otherNode._methodArgument != null) { if (_methodArgument == null) { return(-1); } if (otherNode._methodArgument == null) { return(1); } result = _methodArgument.CompareTo(otherNode._methodArgument, comparer); if (result != 0) { return(result); } } var contextAsMethod = _methodContext.Context as MethodDesc; var otherContextAsMethod = otherNode._methodContext.Context as MethodDesc; if (contextAsMethod != null || otherContextAsMethod != null) { if (contextAsMethod == null) { return(-1); } if (otherContextAsMethod == null) { return(1); } return(comparer.Compare(contextAsMethod, otherContextAsMethod)); } else { return(comparer.Compare(_methodContext.ContextType, otherNode._methodContext.ContextType)); } }
public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return(comparer.Compare(_importSection, ((GCRefMapNode)other)._importSection)); }
public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return(comparer.Compare(_methodNode, ((ProfileDataNode)other)._methodNode)); }
public int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return(comparer.Compare(Type, ((ExternalTypeNode)other).Type)); }
public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return(comparer.Compare(_field, ((CopiedFieldRvaNode)other)._field)); }
public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return(comparer.Compare(_method, ((CopiedMethodILNode)other)._method)); }
public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { NewObjectFixupSignature otherNode = (NewObjectFixupSignature)other; return(comparer.Compare(_typeDesc, otherNode._typeDesc)); }
public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { MethodWithGCInfo otherNode = (MethodWithGCInfo)other; return(comparer.Compare(_method, otherNode._method)); }
public IEnumerable <IMethodNode> GetCompiledMethods(EcmaModule moduleToEnumerate, CompiledMethodCategory methodCategory) { lock (_methodsGenerated) { if (!_sortedMethods) { CompilerComparer comparer = CompilerComparer.Instance; SortableDependencyNode.ObjectNodeComparer objectNodeComparer = new SortableDependencyNode.ObjectNodeComparer(comparer); Comparison <IMethodNode> sortHelper = (x, y) => { int nodeComparerResult = objectNodeComparer.Compare((SortableDependencyNode)x, (SortableDependencyNode)y); #if DEBUG int methodOnlyResult = comparer.Compare(x.Method, y.Method); // Assert the two sorting techniques produce the same result unless there is a CustomSort applied Debug.Assert((nodeComparerResult == methodOnlyResult) || ((x is SortableDependencyNode sortableX && sortableX.CustomSort != Int32.MaxValue) || (y is SortableDependencyNode sortableY && sortableY.CustomSort != Int32.MaxValue))); #endif return(nodeComparerResult); }; Comparison <IMethodNode> sortHelperNoCustomSort = (x, y) => comparer.Compare(x, y); List <PerModuleMethodsGenerated> perModuleDatas = new List <PerModuleMethodsGenerated>(_methodsGenerated.Values); perModuleDatas.Sort((x, y) => x.Module.CompareTo(y.Module)); foreach (var perModuleData in perModuleDatas) { perModuleData.MethodsGenerated.MergeSort(sortHelperNoCustomSort); perModuleData.GenericMethodsGenerated.MergeSort(sortHelperNoCustomSort); _completeSortedMethods.AddRange(perModuleData.MethodsGenerated); _completeSortedMethods.AddRange(perModuleData.GenericMethodsGenerated); _completeSortedGenericMethods.AddRange(perModuleData.GenericMethodsGenerated); } _completeSortedMethods.MergeSort(sortHelper); _completeSortedGenericMethods.MergeSort(sortHelper); _sortedMethods = true; } } if (moduleToEnumerate == null) { if (methodCategory == CompiledMethodCategory.All) { return(_completeSortedMethods); } else if (methodCategory == CompiledMethodCategory.Instantiated) { return(_completeSortedGenericMethods); } else { // This isn't expected to be needed, and thus isn't implemented throw new ArgumentException(); } } else if (_methodsGenerated.TryGetValue(moduleToEnumerate, out var perModuleData)) { if (methodCategory == CompiledMethodCategory.All) { return(GetCompiledMethodsAllMethodsInModuleHelper(moduleToEnumerate)); } if (methodCategory == CompiledMethodCategory.Instantiated) { return(perModuleData.GenericMethodsGenerated); } else { Debug.Assert(methodCategory == CompiledMethodCategory.NonInstantiated); return(perModuleData.MethodsGenerated); } } else { return(Array.Empty <IMethodNode>()); } }
public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { GenericLookupSignature otherNode = (GenericLookupSignature)other; int result = _runtimeLookupKind.CompareTo(otherNode._runtimeLookupKind); if (result != 0) { return(result); } result = _fixupKind.CompareTo(otherNode._fixupKind); if (result != 0) { return(result); } if (_typeArgument != null || otherNode._typeArgument != null) { if (_typeArgument == null) { return(-1); } if (otherNode._typeArgument == null) { return(1); } result = comparer.Compare(_typeArgument, otherNode._typeArgument); if (result != 0) { return(result); } } if (_fieldArgument != null || otherNode._fieldArgument != null) { if (_fieldArgument == null) { return(-1); } if (otherNode._fieldArgument == null) { return(1); } result = comparer.Compare(_fieldArgument, otherNode._fieldArgument); if (result != 0) { return(result); } } if (_methodArgument != null || otherNode._methodArgument != null) { if (_methodArgument == null) { return(-1); } if (otherNode._methodArgument == null) { return(1); } result = _methodArgument.CompareTo(otherNode._methodArgument, comparer); if (result != 0) { return(result); } } result = comparer.Compare(_methodContext.ContextMethod, otherNode._methodContext.ContextMethod); if (result != 0) { return(result); } return(_signatureContext.CompareTo(otherNode._signatureContext, comparer)); }
public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { NewArrayFixupSignature otherNode = (NewArrayFixupSignature)other; return(comparer.Compare(_arrayType, otherNode._arrayType)); }
public int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return(comparer.Compare(Type, ((AvailableType)other).Type)); }