Avoid using hand-specialized qsort<K,T> instantiations in SortImpl<TKey,TValue> when using full-aot, as it leads to a code blowup. Inline swap methods.

This commit is contained in:
Zoltan Varga committed 2012-12-04 19:15:59 +01:00
1 parent 37e48013a4
commit 6769a30f4a
1 file changed
+5
+5
View File
@@ -1753,6 +1753,8 @@ namespace System
// Check for value types which can be sorted without Compare () method
//
if (comparer == null) {
/* Avoid this when using full-aot to prevent the generation of many unused qsort<K,T> instantiations */
#if FULL_AOT_RUNTIME
#if !BOOTSTRAP_BASIC
switch (Type.GetTypeCode (typeof (TKey))) {
case TypeCode.Int32:
@@ -1795,6 +1797,7 @@ namespace System
qsort (keys as UInt64[], items, low, high);
return;
}
#endif
#endif
// Using Comparer<TKey> adds a small overload, but with value types it
// helps us to not box them.
@@ -2664,6 +2667,7 @@ namespace System
}
}
[MethodImpl ((MethodImplOptions)256)]
private static void swap<K, V> (K [] keys, V [] items, int i, int j)
{
K tmp;
@@ -2680,6 +2684,7 @@ namespace System
}
}
[MethodImpl ((MethodImplOptions)256)]
private static void swap<T> (T [] array, int i, int j)
{
T tmp = array [i];