Force List<T> accessors to be inlined.
authorRodrigo Kumpera <kumpera@gmail.com>
Mon, 1 Oct 2012 18:22:49 +0000 (14:22 -0400)
committerRodrigo Kumpera <kumpera@gmail.com>
Mon, 1 Oct 2012 18:28:06 +0000 (14:28 -0400)
* List.cs: Make sure indexers are always inlined. We use the 256 literal instead
of MethodImplOptions.AggressiveInlining since the later is only available on 4.5.

mcs/class/corlib/System.Collections.Generic/List.cs

index e288d2868c6bbaf03355c3f59c94321f5695aa59..b08fcbb80a50e43f9002fee5b04820960ffc0c3b 100644 (file)
@@ -636,12 +636,14 @@ namespace System.Collections.Generic {
                }
                
                public T this [int index] {
+                       [MethodImpl ((MethodImplOptions)256)]
                        get {
                                if ((uint) index >= (uint) _size)
                                        throw new ArgumentOutOfRangeException ("index");
                                return Array.UnsafeLoad (_items, index);
                        }
 
+                       [MethodImpl ((MethodImplOptions)256)]
                        set {
                                if ((uint) index >= (uint) _size)
                                        throw new ArgumentOutOfRangeException ("index");