Commit Graph
135 Commits
Author SHA1 Message Date
Marek Safar 6d4a4e8e31 2010-06-29 Marek Safar <[email protected]>
* List.cs: Optimize IEnumerable<T> ctor.


svn path=/trunk/mcs/; revision=159651
2010-06-29 08:29:01 +00:00
Marek Safar f9bea41458 2010-05-15 Marek Safar <[email protected]>
* KeyValuePair.cs: Initialize fields definitely.


svn path=/trunk/mcs/; revision=157385
2010-05-15 21:18:13 +00:00
Sebastien Pouliot b1dfcf6b8b In System.Collections:
2010-03-19  Sebastien Pouliot  <[email protected]>

	* CollectionDebuggerView.cs: Change to internal so we can avoid
	a duplicating the type in assemblies that have [InternalsVisibleTo]

In System.Collections.Generic:
2010-03-19  Sebastien Pouliot  <[email protected]>

	* CollectionDebuggerView.cs: Change to internal so we can avoid
	a duplicating the type in assemblies that have [InternalsVisibleTo]


svn path=/trunk/mcs/; revision=153915
2010-03-19 18:54:23 +00:00
Gonzalo Paniagua Javier 4581393bc0 2010-01-25 Gonzalo Paniagua Javier <[email protected]>
* EqualityComparer.cs: (Equals) the arguments are checked to be
	the correct type.


svn path=/trunk/mcs/; revision=150156
2010-01-25 21:07:41 +00:00
Robert Jordan c42abafd5b In System.Collections.Generic:
2010-01-24  Robert Jordan  <[email protected]>

	* Dictionary.cs: Fix deserialization compatibility with MS.NET.
	Fixes bug #474009.

In Test/System.Collections.Generic:
2010-01-24  Robert Jordan  <[email protected]>

	* DictionaryTest.cs: Add test case for bug #474009.


svn path=/trunk/mcs/; revision=150089
2010-01-24 01:04:18 +00:00
Miguel de Icaza 820ad1b041 2010-01-20 Miguel de Icaza <[email protected]>
* Dictionary.cs: Always create the keys, fixes compatibility
       between Mono and .NET.  Patch from John Lenz <[email protected]>


svn path=/trunk/mcs/; revision=149947
2010-01-21 00:49:45 +00:00
Chris Toshok 8718686805 in class/corlib/System.Collections.Generic/:
2009-12-06  Chris Toshok  <[email protected]>

	* KeyValuePair.cs: we need setters for Key and Value so they can
	be set via reflection from
	System.ServiceModel.System.Runtime.Serialization.Json.TypeMap.cs.

in class/System.ServiceModel.Web/System.Runtime.Serialization.Json/:
2009-12-06  Chris Toshok  <[email protected]>

	* JsonSerializationReader.cs (DeserializeGenericCollection): this
	is jb's (iirc) patch, actually.  Types subclassing from
	ICollection<T> need to be supported, and since it's an interface
	the implementation might be explicit.  So instead of groveling
	around in the actual type, we need to dispatch through the
	interface's method.

	* TypeMap.cs (CreateDefaultTypeMap): we need to include non-public
	properties, since KeyValuePair items must be able to write to Key
	and Value properties.

	* JsonReader.cs (ReadContent): for builtin values (null, true,
	false), use TryReadString instead of individual ReadChar's, since
	they aren't reversible if the string didn't match.  In the default
	case, if we're LameSilverlightLiseralParser, we need to push back
	the current character onto the stream -- this is because for
	netflix's AppConfig.json we were parsing "frameRatePolicy" as
	"rameRatePolicy" (the 'f' was triggering the "false" parsing).
	(class PushBackReader): add this class to unify all the pushing
	back of characters we need to do.  1 character (JsonReader's old
	"saved_char") isn't enough given that you could have a property
	named, e.g., "falsifiable", and we'd need 4 characters worth of
	pushback to recognize that correctly.

svn path=/trunk/mcs/; revision=147766
2009-12-07 07:39:17 +00:00
Marek Safar d00165ebd2 2009-11-26 Marek Safar <[email protected]>
* CollectionDebuggerView.cs: Removed limit restriction.


svn path=/trunk/mcs/; revision=146991
2009-11-26 15:11:22 +00:00
Carlos Alberto Cortez 7ce82fe77f 2009-11-23 Carlos Alberto Cortez <[email protected]>
* Comparer.cs: Our DefaultComparer class should be serializable just
	as the generic one is.
	Fixes #503585.


svn path=/trunk/mcs/; revision=146789
2009-11-24 01:24:08 +00:00
Carlos Alberto Cortez 7d1b43a099 2009-11-23 Juraj Skripsky <[email protected]>
* List.cs (Sort): Call more appropriate overload of Array.Sort<T>.
	Array.Sort<T> should be able to determine the comparison itself.
	Speeds up the sorting for items of primitive type. 
	Fixes #530450.


svn path=/trunk/mcs/; revision=146704
2009-11-23 06:49:25 +00:00
Juraj Skripsky 016587e4fd 2009-11-08 Juraj Skripsky <[email protected]>
* Array.cs (Sort):
	- Sort(..) without IComparer param call Sort(.., (IComparer)null) siblings
	- Sort(keys, items,..) with items == null call Sort(keys,..) siblings
	Add missing argument checks. Add SortImpl method to be used by
	List<T>.Sort(Comparison <T>).

	Part 3 of 3 fixing bug #351638.

2009-11-08  Juraj Skripsky <[email protected]>

	* List.cs (Sort): Sync to latest changes in Array.Sort.


svn path=/trunk/mcs/; revision=145678
2009-11-08 19:31:32 +00:00
Marek Safar 511cd3ef88 2009-10-20 Marek Safar <[email protected]>
* List.cs, CollectionDebuggerView.cs, KeyValuePair.cs, Dictionary.cs
	Improve debugging experience.


svn path=/trunk/mcs/; revision=144437
2009-10-20 10:32:19 +00:00
Marek Safar d519764e4d 2009-10-19 Marek Safar <[email protected]>
* CollectionDebuggerView.cs: New file.


svn path=/trunk/mcs/; revision=144414
2009-10-19 22:07:40 +00:00
Sebastien Pouliot 98dff5513c 2009-10-17 Sebastien Pouliot <[email protected]>
* EqualityComparer.cs: Seal internal classes


svn path=/trunk/mcs/; revision=144308
2009-10-17 15:53:48 +00:00
Raja R Harinath b668695e59 * Dictionary.cs (Do_ICollectionCopyTo): Revert 2009-10-01 change.
Use BOOTSTRAP_BASIC to hide code from gmcs 2.4.x.

svn path=/trunk/mcs/; revision=143210
2009-10-01 20:20:51 +00:00
Marek Habersack e64813b7f7 2009-10-01 Marek Habersack <[email protected]>
* Dictionary.cs: cast target array to TRet[] instead of object[] -
	may fail, but otherwise it doesn't compile with 2.4 (e.g. when
	bootstrapping trunk)

svn path=/trunk/mcs/; revision=143188
2009-10-01 18:24:46 +00:00
Raja R Harinath 162d3490c5 Dictionary: Ensure that invalid arrays to CopyTo result in ArgumentExceptions.
* System.Collections.Generic/Dictionary.cs (CopyToCheck, Do_CopyTo):
Carve out of ...
(CopyTo): ... this.
(Do_ICollectionCopyTo): Carve out of ICollection.CopyTo.  Convert
type-cast exceptions to ArgumentExceptions.
(KeyCollection.CopyTo): Use them.
(ValueCollection.CopyTo): Use them.
* Test/System.Collections.Generic/DictionaryTest.cs (ICollectionCopyTo):
Test various odd scenarios where .NET CopyTo does _not_ throw an exception.
(ICollectionCopyTo_ex1..4): Ensure that ArgumentExceptions are
thrown in appropriate cases.

svn path=/trunk/mcs/; revision=142427
2009-09-22 17:39:52 +00:00
Raja R Harinath f741a048f0 IList implementation: convert NullReferenceException to ArgumentException
* List.cs (IList.this.set): Convert NullReference and InvalidCast
exceptions into ArgumentExceptions.
(IList.Add, IList.Contains, IList.IndexOf, IList.Insert, IList.Remove):
Convert NullReferenceException to ArgumentException.
* ListTest.cs: Add a few testcases for IList interface, using null
values with a List<int>.

svn path=/trunk/mcs/; revision=139159
2009-07-31 10:25:04 +00:00
Raja R Harinath 6d523ef3e4 * List.cs (Enumerator.MoveNext): Simplify.
svn path=/trunk/mcs/; revision=139112
2009-07-30 19:04:39 +00:00
Raja R Harinath ac80cb8d8e * Dictionary.cs (Enumerator.MoveNext): Avoid an out-of-bounds access.
svn path=/trunk/mcs/; revision=139111
2009-07-30 19:04:14 +00:00
Raja R Harinath ef326448f4 List<>-relevant fix for #491858 and #517415
* System.Collections.Generic/List.cs (Enumerator.current): New.
(Enumerator.MoveNext): Update it.
(Enumerator.Current): Don't verify any invariants.
(Enumerator.Dispose): Set 'l' to null.
* Test/System.Collections.Generic/ListTest.cs (Enumerator_Current):
New test, includes relevant parts of #491858 and #517415.

svn path=/trunk/mcs/; revision=139087
2009-07-30 14:55:24 +00:00
Raja R Harinath a22621964d Fix Dictionary<,>-relevant parts of #491858 and #517415
* System.Collections.Generic/Dictionary.cs (Enumerator.current): New.
(Enumerator.MoveNext): Update it.
(Enumerator.Current): Don't verify any invariants.
* Test/System.Collections.Generic/DictionaryTest.cs (Enumerator_Current):
New test, includes relevant parts of #491858 and #517415.

svn path=/trunk/mcs/; revision=139082
2009-07-30 13:52:39 +00:00
Marek Safar 7bfc38ec7a 2009-06-10 Marek Safar <[email protected]>
* IEqualityComparer.cs, IComparer.cs, IEnumerable.cs,
	IEnumerator.cs: Add type variance.


svn path=/trunk/mcs/; revision=135846
2009-06-10 14:14:17 +00:00
Jb Evain c0deaf8193 2009-04-02 Jb Evain <[email protected]>
* Dictionary.cs (ValueCollection.CopyTo): fix for copying to
	an object array. Based on a patch by Tobias Grimm <[email protected]>.
	Fixes bug #328036.


svn path=/trunk/mcs/; revision=130884
2009-04-02 17:33:12 +00:00
Zoltan Varga f77392683a 2009-02-04 Zoltan Varga <[email protected]>
* Dictionary.cs: Declare the Link struct outside the main class to avoid
	creating a separate inflated instances for each instantiation of Dictionary.

svn path=/trunk/mcs/; revision=125739
2009-02-04 20:24:35 +00:00
Jb Evain 667f5dbe39 2008-11-14 Jb Evain <[email protected]>
* Dictionary.cs (ICollection.CopyTo): fix the different possible
	copying cases depending on the actual type of destination array,
	be it an array of KeyValuePair, DictionaryEntry, or object.
	Fixes #444778.


svn path=/trunk/mcs/; revision=118841
2008-11-14 11:47:11 +00:00
Jb Evain 1330c66bc1 2008-11-14 Jb Evain <[email protected]>
* Dictionary.cs: fix ICollection<KeyValuePair<T>>.Remove and .Contains
	to not only check if the key exists but if the associated value is the
	good one as well. Fixes #444768.


svn path=/trunk/mcs/; revision=118838
2008-11-14 10:36:28 +00:00
Zoltan Varga 9a6df6496c 2008-10-06 Zoltan Varga <[email protected]>
* Dictionary.cs (Clear): Clear the linkSlots array as well, as 
	Enumerator.MoveNext () depends on it. Fixes #432441.

svn path=/trunk/mcs/; revision=114915
2008-10-06 03:35:26 +00:00
Paolo Molaro 2b223a5248 Fri Oct 3 23:08:06 CEST 2008 Paolo Molaro <[email protected]>
* Dictionary.cs: by popular demand, return keys/values in insertion
	order when possible.


svn path=/trunk/mcs/; revision=114791
2008-10-03 21:17:58 +00:00
Jb Evain 399b1652ad 2008-09-29 Jb Evain <[email protected]>
* Dictionary.cs: check for null argument in ContainsKey.
	Patch by Jonathan Anderson  <[email protected]>


svn path=/trunk/mcs/; revision=114371
2008-09-29 07:43:31 +00:00
Jb Evain 271b49aabf 2008-09-24 Jb Evain <[email protected]>
* Dictionary.cs: properly reset all compounds enumerators.
	Fixes #429530.


svn path=/trunk/mcs/; revision=113954
2008-09-24 13:34:05 +00:00
Jb Evain 553bc77516 2008-09-12 Jb Evain <[email protected]>
* Dictionary.cs: (ToTValue) allow null values to be added for non
	value types TValues to the dictionary when using the
	non generic IDictionary. Fixes #425693.


svn path=/trunk/mcs/; revision=112907
2008-09-12 20:58:02 +00:00
Andreas N 0577f9a422 2008-06-16 Andreas Nahr <[email protected]>
* String.cs: Dictionary: Do not change the index data when using the indexer for
	an already existing index. This is somewhat illogical and breakes obscure code situations

svn path=/trunk/mcs/; revision=105870
2008-06-15 23:00:42 +00:00
Juraj Skripsky e102585db6 2008-05-29 Juraj Skripsky <[email protected]>
* List.cs (RemoveAll, Shift): Fix leak by clearing empty array
	items.

2008-05-29  Juraj Skripsky  <[email protected]>

	* ArrayList.cs: Create the empty array only once and reuse it.


svn path=/trunk/mcs/; revision=104415
2008-05-29 15:01:15 +00:00
Juraj Skripsky 226db4e636 2008-04-29 Juraj Skripsky <[email protected]>
* Dictionary.cs (Clear, Remove): Clear empty slots in keySlots 
	and valueSlots. Otherwise the garbage collector cannot reclaim 
	the referenced key/value. Fixes bug #384723.


svn path=/trunk/mcs/; revision=102114
2008-04-29 12:58:17 +00:00
Andreas N 29f3b5d24a 2008-04-02 Andreas Nahr <[email protected]>
* KeyNotFoundException.cs
	* KeyValuePair.cs: Fix parameter names

svn path=/trunk/mcs/; revision=99647
2008-04-02 17:02:20 +00:00
Sebastien Pouliot 25814c7b16 2008-03-21 Sebastien Pouliot <[email protected]>
* EqualityComparer.cs: Add null checks in GetHashCode. Fix bug 
	#372892


svn path=/trunk/mcs/; revision=98739
2008-03-21 14:42:08 +00:00
Sebastien Pouliot aa4096bfbf 2007-11-05 Sebastien Pouliot <[email protected]>
* Dictionary.cs: Ensure that the non-generic CopyTo works on Array.
	Fix #322783


svn path=/trunk/mcs/; revision=88940
2007-11-05 23:51:42 +00:00
Miguel de Icaza 2b6fc7d4a2 2007-10-31 Miguel de Icaza <[email protected]>
* Dictionary.cs: Do not increment curTableItem when we return
	false.   Was not necessary, just a defensive move.

svn path=/trunk/mcs/; revision=88535
2007-10-31 04:12:56 +00:00
Miguel de Icaza 2c01aa0209 Patch from Juraj:
2007-10-10  Juraj Skripsky <[email protected]>

	* Dictionary.cs (Enumerator.MoveNext): Handle the case where we
	had already reached the end. Fixes bug #332534.



svn path=/trunk/mcs/; revision=88534
2007-10-31 04:10:33 +00:00
Jb Evain da07f762ad 2007-08-20 Jb Evain <[email protected]>
* List.cs (AddCollection): return early if the collection
	to be added is empty.

svn path=/trunk/mcs/; revision=84420
2007-08-20 01:57:32 +00:00
Atsushi Eno 56c9656fd4 another set of cosmetic 2.0 API fixes.
svn path=/trunk/mcs/; revision=83679
2007-08-08 16:25:59 +00:00
Marek Safar f2347a2a65 2007-06-23 Marek Safar <[email protected]>
* List.cs: Make CheckMatch static.


svn path=/trunk/mcs/; revision=80604
2007-06-23 21:37:08 +00:00
Juraj Skripsky 5a11e85018 2007-06-20 Juraj Skripsky <[email protected]>
* Dictionary.cs: Optimize and add implementation notes. Use a "mini-heap"
   to store the linked lists instead of the regular heap. Split arrays of
   structs into separate arrays to make the GC's life simpler (see bug 81879
   for details). Make class serialization compatible with MS.NET.

   * EqualityComparer.cs: Rename IEquatableOfTEqualityComparer<T> to
   GenericEqualityComparer<T> to fix binary serialization compatibility
   with MS.


svn path=/trunk/mcs/; revision=80341
2007-06-20 18:00:23 +00:00
Jonathan Chambers 1888bc79f1 2006-04-16 Jonathan Chambers <[email protected]>
* List.cs: Clear entry in RemoveAt after removing item. 
	Fixes bug #81387.

svn path=/trunk/mcs/; revision=75788
2007-04-16 20:54:22 +00:00
Alan McGovern af4b028e30 Optimised a lot of the List methods to increase performance.
svn path=/trunk/mcs/; revision=75021
2007-03-27 14:42:51 +00:00
Juraj Skripsky ea28770cf8 2007-03-21 Juraj Skripsky <[email protected]>
* List.cs (FindAllStackBits): Small optimization to the new code.
	Built resulting List<T> directly as an array, wrap it in a List<T>
	afterwards. Stop the filling of the result array as soon as all
	matching items have been processed.

svn path=/trunk/mcs/; revision=74715
2007-03-21 09:22:24 +00:00
Miguel de Icaza 926556e10b 2007-03-20 Juan Cristóbal Olivares <[email protected]>
* List.cs (FindAll): Optimize FindAll using a bitmask to
        * determine
        the number of positive matches, this increases the performance
in
        all cases below 10,000,000 elements extensively:

        100 elements:
        old method:             00:00:00.0126610 (26x)
        stackalloc bit method:  00:00:00.0004750 (1x)
        array bit method:       00:00:00.0010700 (2x)
        heap bit method:        00:00:00.0038830 (8x)

        1,000 elements:
        old method:             00:00:00.0139250 (24x)
        stackalloc bit method:  00:00:00.0005670 (1x)
        array bit method:       00:00:00.0010890 (2x)
        heap bit method:        00:00:00.0034920 (6x)

        10,000 elements:
        old method:             00:00:00.0136110 (12x)
        stackalloc bit method:  00:00:00.0011240 (1x)
        array bit method:       00:00:00.0016450 (1.4x)
        heap bit method:        00:00:00.0043110 (3x)

        50,000 elements:
        old method:             00:00:00.0175970 (3x)
        stackalloc bit method:  00:00:00.0085630 (1.5x)
        array bit method:       00:00:00.0055010 (1x)
        heap bit method:        00:00:00.0099590 (1.8x)

        100,000 elements:
        old method:             00:00:00.0210330 (2x)
        array bit method:       00:00:00.0100430 (1x)
        heap bit method:        00:00:00.0154150 (1.5x)

        1,000,000 elements:
        old method:             00:00:00.1243730 (1.2x)
        array bit method:       00:00:00.0973110 (1x)
        heap bit method:        00:00:00.1285650 (1.3x)

        10,000,000 elements:
        old method:             00:00:00.9252570 (1x)
        array bit method:       00:00:00.9632300 ( 1.05x)
        heap bit method:        00:00:01.1098490 (1.20x)



svn path=/trunk/mcs/; revision=74694
2007-03-20 15:39:19 +00:00
Miguel de Icaza 929fcbd4fa 2007-03-08 David Mitchell <[email protected]>
* List.cs: Fix the case where List.set_Item(int index) throws
	inappropriate exception when index is equal to List.Count

	List.IndexOf(object item) and IList.Contains(object item) throw
	exceptions when given invalid types.

	IList.Add(object item) throws InvalidCastException when item is
	not of the correct type.

svn path=/trunk/mcs/; revision=73976
2007-03-09 00:38:11 +00:00
Gert Driesen dfdbcf7fdd * Comparer.cs: Renamed IComparableOfTComparer<T> to GenericComparer<T>
to fix binary serialization compatibility with MS.
* ComparerTest.cs: Added test for bug #80929. Added tests to verify
binary serialization compatibility.
* IListTest.cs: Fixed header.
* corlib_test.dll.sources: Added ComparerTest.cs.

svn path=/trunk/mcs/; revision=73964
2007-03-08 20:22:06 +00:00