Merge pull request #607 from maksimenko/master
authorMarek Safar <marek.safar@gmail.com>
Mon, 25 Mar 2013 14:44:13 +0000 (07:44 -0700)
committerMarek Safar <marek.safar@gmail.com>
Mon, 25 Mar 2013 14:44:13 +0000 (07:44 -0700)
use await GetRequestStreamAsync on System.Net.Http.HttpClientHandler SendAsync to avoid blocking

33 files changed:
mcs/class/System.Core/System.Linq/Enumerable.cs
mcs/class/System/System.Net/HttpUtility.cs
mcs/class/System/Test/System.Net/WebUtilityTest.cs
mcs/class/corlib/System.Runtime.InteropServices/Marshal.cs
mcs/class/corlib/System/Array.cs
mcs/class/corlib/System/IntPtr.cs
mcs/class/corlib/Test/System.Runtime.InteropServices/MarshalTest.cs
mcs/errors/cs1001-8.cs [new file with mode: 0644]
mcs/errors/cs1502-18.cs [new file with mode: 0644]
mcs/errors/cs1525-54.cs [new file with mode: 0644]
mcs/mcs/anonymous.cs
mcs/mcs/class.cs
mcs/mcs/cs-parser.jay
mcs/mcs/ecore.cs
mcs/mcs/expression.cs
mcs/mcs/iterators.cs
mcs/mcs/statement.cs
mcs/tests/ver-il-net_4_5.xml
mono/metadata/boehm-gc.c
mono/metadata/class-internals.h
mono/metadata/gc-internal.h
mono/metadata/gc.c
mono/metadata/icall-def.h
mono/metadata/marshal.c
mono/metadata/marshal.h
mono/metadata/null-gc.c
mono/metadata/sgen-alloc.c
mono/mini/aot-compiler.c
mono/mini/decompose.c
mono/mini/method-to-ir.c
mono/mini/mini-codegen.c
mono/mini/mini.c
mono/mini/mini.h

index 89547d0a059a2f196ca70cd897616932fcbcc897..71f392690a47666dc15496f0ffbcca58fe56dae7 100644 (file)
@@ -2885,7 +2885,7 @@ namespace System.Linq
                                collection.CopyTo (array, 0);
                                return array;
                        }
-                       
+
                        int pos = 0;
                        array = EmptyOf<TSource>.Instance;
                        foreach (var element in source) {
@@ -3105,6 +3105,11 @@ namespace System.Linq
                {
                        Check.SourceAndPredicate (source, predicate);
 
+                       // It cannot be IList<TSource> because it may break on user implementation
+                       var array = source as TSource[];
+                       if (array != null)
+                               return CreateWhereIterator (array, predicate);
+
                        return CreateWhereIterator (source, predicate);
                }
 
@@ -3115,14 +3120,27 @@ namespace System.Linq
                                        yield return element;
                }
 
+               static IEnumerable<TSource> CreateWhereIterator<TSource> (TSource[] source, Func<TSource, bool> predicate)
+               {
+                       for (int i = 0; i < source.Length; ++i) {
+                               var element = source [i];
+                               if (predicate (element))
+                                       yield return element;
+                       }
+               }       
+
                public static IEnumerable<TSource> Where<TSource> (this IEnumerable<TSource> source, Func<TSource, int, bool> predicate)
                {
                        Check.SourceAndPredicate (source, predicate);
 
+                       var array = source as TSource[];
+                       if (array != null)
+                               return CreateWhereIterator (array, predicate);
+
                        return CreateWhereIterator (source, predicate);
                }
 
-               static IEnumerable<TSource> CreateWhereIterator<TSource> (this IEnumerable<TSource> source, Func<TSource, int, bool> predicate)
+               static IEnumerable<TSource> CreateWhereIterator<TSource> (IEnumerable<TSource> source, Func<TSource, int, bool> predicate)
                {
                        int counter = 0;
                        foreach (TSource element in source) {
@@ -3132,6 +3150,15 @@ namespace System.Linq
                        }
                }
 
+               static IEnumerable<TSource> CreateWhereIterator<TSource> (TSource[] source, Func<TSource, int, bool> predicate)
+               {
+                       for (int i = 0; i < source.Length; ++i) {
+                               var element = source [i];
+                               if (predicate (element, i))
+                                       yield return element;
+                       }
+               }
+
                #endregion
 
                internal static ReadOnlyCollection<TSource> ToReadOnlyCollection<TSource> (this IEnumerable<TSource> source)
index d5bb836f5743ed8aa24307bcefc520617a86a188..a39768c9a3a6df64eb8cd8834505b2e9ff724f46 100644 (file)
@@ -39,7 +39,7 @@ using System.Text;
 
 namespace System.Net {
 
-       internal sealed class HttpUtility
+       static class HttpUtility
        {
                sealed class HttpQSCollection : NameValueCollection
                {
@@ -58,291 +58,518 @@ namespace System.Net {
                                return sb.ToString ();
                        }
                }
-               #region Fields
-       
-               static Hashtable entities;
-               static object lock_ = new object ();
-       
-               #endregion // Fields
-       
-               static Hashtable Entities {
-                       get {
-                               lock (lock_) {
-                                       if (entities == null)
-                                               InitEntities ();
-
-                                       return entities;
-                               }
-                       }
-               }
-               
-               #region Constructors
 
-               static void InitEntities ()
-               {
-                       // Build the hash table of HTML entity references.  This list comes
-                       // from the HTML 4.01 W3C recommendation.
-                       entities = new Hashtable ();
-                       entities.Add ("nbsp", '\u00A0');
-                       entities.Add ("iexcl", '\u00A1');
-                       entities.Add ("cent", '\u00A2');
-                       entities.Add ("pound", '\u00A3');
-                       entities.Add ("curren", '\u00A4');
-                       entities.Add ("yen", '\u00A5');
-                       entities.Add ("brvbar", '\u00A6');
-                       entities.Add ("sect", '\u00A7');
-                       entities.Add ("uml", '\u00A8');
-                       entities.Add ("copy", '\u00A9');
-                       entities.Add ("ordf", '\u00AA');
-                       entities.Add ("laquo", '\u00AB');
-                       entities.Add ("not", '\u00AC');
-                       entities.Add ("shy", '\u00AD');
-                       entities.Add ("reg", '\u00AE');
-                       entities.Add ("macr", '\u00AF');
-                       entities.Add ("deg", '\u00B0');
-                       entities.Add ("plusmn", '\u00B1');
-                       entities.Add ("sup2", '\u00B2');
-                       entities.Add ("sup3", '\u00B3');
-                       entities.Add ("acute", '\u00B4');
-                       entities.Add ("micro", '\u00B5');
-                       entities.Add ("para", '\u00B6');
-                       entities.Add ("middot", '\u00B7');
-                       entities.Add ("cedil", '\u00B8');
-                       entities.Add ("sup1", '\u00B9');
-                       entities.Add ("ordm", '\u00BA');
-                       entities.Add ("raquo", '\u00BB');
-                       entities.Add ("frac14", '\u00BC');
-                       entities.Add ("frac12", '\u00BD');
-                       entities.Add ("frac34", '\u00BE');
-                       entities.Add ("iquest", '\u00BF');
-                       entities.Add ("Agrave", '\u00C0');
-                       entities.Add ("Aacute", '\u00C1');
-                       entities.Add ("Acirc", '\u00C2');
-                       entities.Add ("Atilde", '\u00C3');
-                       entities.Add ("Auml", '\u00C4');
-                       entities.Add ("Aring", '\u00C5');
-                       entities.Add ("AElig", '\u00C6');
-                       entities.Add ("Ccedil", '\u00C7');
-                       entities.Add ("Egrave", '\u00C8');
-                       entities.Add ("Eacute", '\u00C9');
-                       entities.Add ("Ecirc", '\u00CA');
-                       entities.Add ("Euml", '\u00CB');
-                       entities.Add ("Igrave", '\u00CC');
-                       entities.Add ("Iacute", '\u00CD');
-                       entities.Add ("Icirc", '\u00CE');
-                       entities.Add ("Iuml", '\u00CF');
-                       entities.Add ("ETH", '\u00D0');
-                       entities.Add ("Ntilde", '\u00D1');
-                       entities.Add ("Ograve", '\u00D2');
-                       entities.Add ("Oacute", '\u00D3');
-                       entities.Add ("Ocirc", '\u00D4');
-                       entities.Add ("Otilde", '\u00D5');
-                       entities.Add ("Ouml", '\u00D6');
-                       entities.Add ("times", '\u00D7');
-                       entities.Add ("Oslash", '\u00D8');
-                       entities.Add ("Ugrave", '\u00D9');
-                       entities.Add ("Uacute", '\u00DA');
-                       entities.Add ("Ucirc", '\u00DB');
-                       entities.Add ("Uuml", '\u00DC');
-                       entities.Add ("Yacute", '\u00DD');
-                       entities.Add ("THORN", '\u00DE');
-                       entities.Add ("szlig", '\u00DF');
-                       entities.Add ("agrave", '\u00E0');
-                       entities.Add ("aacute", '\u00E1');
-                       entities.Add ("acirc", '\u00E2');
-                       entities.Add ("atilde", '\u00E3');
-                       entities.Add ("auml", '\u00E4');
-                       entities.Add ("aring", '\u00E5');
-                       entities.Add ("aelig", '\u00E6');
-                       entities.Add ("ccedil", '\u00E7');
-                       entities.Add ("egrave", '\u00E8');
-                       entities.Add ("eacute", '\u00E9');
-                       entities.Add ("ecirc", '\u00EA');
-                       entities.Add ("euml", '\u00EB');
-                       entities.Add ("igrave", '\u00EC');
-                       entities.Add ("iacute", '\u00ED');
-                       entities.Add ("icirc", '\u00EE');
-                       entities.Add ("iuml", '\u00EF');
-                       entities.Add ("eth", '\u00F0');
-                       entities.Add ("ntilde", '\u00F1');
-                       entities.Add ("ograve", '\u00F2');
-                       entities.Add ("oacute", '\u00F3');
-                       entities.Add ("ocirc", '\u00F4');
-                       entities.Add ("otilde", '\u00F5');
-                       entities.Add ("ouml", '\u00F6');
-                       entities.Add ("divide", '\u00F7');
-                       entities.Add ("oslash", '\u00F8');
-                       entities.Add ("ugrave", '\u00F9');
-                       entities.Add ("uacute", '\u00FA');
-                       entities.Add ("ucirc", '\u00FB');
-                       entities.Add ("uuml", '\u00FC');
-                       entities.Add ("yacute", '\u00FD');
-                       entities.Add ("thorn", '\u00FE');
-                       entities.Add ("yuml", '\u00FF');
-                       entities.Add ("fnof", '\u0192');
-                       entities.Add ("Alpha", '\u0391');
-                       entities.Add ("Beta", '\u0392');
-                       entities.Add ("Gamma", '\u0393');
-                       entities.Add ("Delta", '\u0394');
-                       entities.Add ("Epsilon", '\u0395');
-                       entities.Add ("Zeta", '\u0396');
-                       entities.Add ("Eta", '\u0397');
-                       entities.Add ("Theta", '\u0398');
-                       entities.Add ("Iota", '\u0399');
-                       entities.Add ("Kappa", '\u039A');
-                       entities.Add ("Lambda", '\u039B');
-                       entities.Add ("Mu", '\u039C');
-                       entities.Add ("Nu", '\u039D');
-                       entities.Add ("Xi", '\u039E');
-                       entities.Add ("Omicron", '\u039F');
-                       entities.Add ("Pi", '\u03A0');
-                       entities.Add ("Rho", '\u03A1');
-                       entities.Add ("Sigma", '\u03A3');
-                       entities.Add ("Tau", '\u03A4');
-                       entities.Add ("Upsilon", '\u03A5');
-                       entities.Add ("Phi", '\u03A6');
-                       entities.Add ("Chi", '\u03A7');
-                       entities.Add ("Psi", '\u03A8');
-                       entities.Add ("Omega", '\u03A9');
-                       entities.Add ("alpha", '\u03B1');
-                       entities.Add ("beta", '\u03B2');
-                       entities.Add ("gamma", '\u03B3');
-                       entities.Add ("delta", '\u03B4');
-                       entities.Add ("epsilon", '\u03B5');
-                       entities.Add ("zeta", '\u03B6');
-                       entities.Add ("eta", '\u03B7');
-                       entities.Add ("theta", '\u03B8');
-                       entities.Add ("iota", '\u03B9');
-                       entities.Add ("kappa", '\u03BA');
-                       entities.Add ("lambda", '\u03BB');
-                       entities.Add ("mu", '\u03BC');
-                       entities.Add ("nu", '\u03BD');
-                       entities.Add ("xi", '\u03BE');
-                       entities.Add ("omicron", '\u03BF');
-                       entities.Add ("pi", '\u03C0');
-                       entities.Add ("rho", '\u03C1');
-                       entities.Add ("sigmaf", '\u03C2');
-                       entities.Add ("sigma", '\u03C3');
-                       entities.Add ("tau", '\u03C4');
-                       entities.Add ("upsilon", '\u03C5');
-                       entities.Add ("phi", '\u03C6');
-                       entities.Add ("chi", '\u03C7');
-                       entities.Add ("psi", '\u03C8');
-                       entities.Add ("omega", '\u03C9');
-                       entities.Add ("thetasym", '\u03D1');
-                       entities.Add ("upsih", '\u03D2');
-                       entities.Add ("piv", '\u03D6');
-                       entities.Add ("bull", '\u2022');
-                       entities.Add ("hellip", '\u2026');
-                       entities.Add ("prime", '\u2032');
-                       entities.Add ("Prime", '\u2033');
-                       entities.Add ("oline", '\u203E');
-                       entities.Add ("frasl", '\u2044');
-                       entities.Add ("weierp", '\u2118');
-                       entities.Add ("image", '\u2111');
-                       entities.Add ("real", '\u211C');
-                       entities.Add ("trade", '\u2122');
-                       entities.Add ("alefsym", '\u2135');
-                       entities.Add ("larr", '\u2190');
-                       entities.Add ("uarr", '\u2191');
-                       entities.Add ("rarr", '\u2192');
-                       entities.Add ("darr", '\u2193');
-                       entities.Add ("harr", '\u2194');
-                       entities.Add ("crarr", '\u21B5');
-                       entities.Add ("lArr", '\u21D0');
-                       entities.Add ("uArr", '\u21D1');
-                       entities.Add ("rArr", '\u21D2');
-                       entities.Add ("dArr", '\u21D3');
-                       entities.Add ("hArr", '\u21D4');
-                       entities.Add ("forall", '\u2200');
-                       entities.Add ("part", '\u2202');
-                       entities.Add ("exist", '\u2203');
-                       entities.Add ("empty", '\u2205');
-                       entities.Add ("nabla", '\u2207');
-                       entities.Add ("isin", '\u2208');
-                       entities.Add ("notin", '\u2209');
-                       entities.Add ("ni", '\u220B');
-                       entities.Add ("prod", '\u220F');
-                       entities.Add ("sum", '\u2211');
-                       entities.Add ("minus", '\u2212');
-                       entities.Add ("lowast", '\u2217');
-                       entities.Add ("radic", '\u221A');
-                       entities.Add ("prop", '\u221D');
-                       entities.Add ("infin", '\u221E');
-                       entities.Add ("ang", '\u2220');
-                       entities.Add ("and", '\u2227');
-                       entities.Add ("or", '\u2228');
-                       entities.Add ("cap", '\u2229');
-                       entities.Add ("cup", '\u222A');
-                       entities.Add ("int", '\u222B');
-                       entities.Add ("there4", '\u2234');
-                       entities.Add ("sim", '\u223C');
-                       entities.Add ("cong", '\u2245');
-                       entities.Add ("asymp", '\u2248');
-                       entities.Add ("ne", '\u2260');
-                       entities.Add ("equiv", '\u2261');
-                       entities.Add ("le", '\u2264');
-                       entities.Add ("ge", '\u2265');
-                       entities.Add ("sub", '\u2282');
-                       entities.Add ("sup", '\u2283');
-                       entities.Add ("nsub", '\u2284');
-                       entities.Add ("sube", '\u2286');
-                       entities.Add ("supe", '\u2287');
-                       entities.Add ("oplus", '\u2295');
-                       entities.Add ("otimes", '\u2297');
-                       entities.Add ("perp", '\u22A5');
-                       entities.Add ("sdot", '\u22C5');
-                       entities.Add ("lceil", '\u2308');
-                       entities.Add ("rceil", '\u2309');
-                       entities.Add ("lfloor", '\u230A');
-                       entities.Add ("rfloor", '\u230B');
-                       entities.Add ("lang", '\u2329');
-                       entities.Add ("rang", '\u232A');
-                       entities.Add ("loz", '\u25CA');
-                       entities.Add ("spades", '\u2660');
-                       entities.Add ("clubs", '\u2663');
-                       entities.Add ("hearts", '\u2665');
-                       entities.Add ("diams", '\u2666');
-                       entities.Add ("quot", '\u0022');
-                       entities.Add ("amp", '\u0026');
-                       entities.Add ("lt", '\u003C');
-                       entities.Add ("gt", '\u003E');
-                       entities.Add ("OElig", '\u0152');
-                       entities.Add ("oelig", '\u0153');
-                       entities.Add ("Scaron", '\u0160');
-                       entities.Add ("scaron", '\u0161');
-                       entities.Add ("Yuml", '\u0178');
-                       entities.Add ("circ", '\u02C6');
-                       entities.Add ("tilde", '\u02DC');
-                       entities.Add ("ensp", '\u2002');
-                       entities.Add ("emsp", '\u2003');
-                       entities.Add ("thinsp", '\u2009');
-                       entities.Add ("zwnj", '\u200C');
-                       entities.Add ("zwj", '\u200D');
-                       entities.Add ("lrm", '\u200E');
-                       entities.Add ("rlm", '\u200F');
-                       entities.Add ("ndash", '\u2013');
-                       entities.Add ("mdash", '\u2014');
-                       entities.Add ("lsquo", '\u2018');
-                       entities.Add ("rsquo", '\u2019');
-                       entities.Add ("sbquo", '\u201A');
-                       entities.Add ("ldquo", '\u201C');
-                       entities.Add ("rdquo", '\u201D');
-                       entities.Add ("bdquo", '\u201E');
-                       entities.Add ("dagger", '\u2020');
-                       entities.Add ("Dagger", '\u2021');
-                       entities.Add ("permil", '\u2030');
-                       entities.Add ("lsaquo", '\u2039');
-                       entities.Add ("rsaquo", '\u203A');
-                       entities.Add ("euro", '\u20AC');
-               }
+               // Must be sorted
+               static readonly long[] entities = new long[] {
+                       (long)'A' << 56 | (long)'E' << 48 | (long)'l' << 40 | (long)'i' << 32 | (long)'g' << 24, 
+                       (long)'A' << 56 | (long)'a' << 48 | (long)'c' << 40 | (long)'u' << 32 | (long)'t' << 24 | (long)'e' << 16, 
+                       (long)'A' << 56 | (long)'c' << 48 | (long)'i' << 40 | (long)'r' << 32 | (long)'c' << 24, 
+                       (long)'A' << 56 | (long)'g' << 48 | (long)'r' << 40 | (long)'a' << 32 | (long)'v' << 24 | (long)'e' << 16, 
+                       (long)'A' << 56 | (long)'l' << 48 | (long)'p' << 40 | (long)'h' << 32 | (long)'a' << 24, 
+                       (long)'A' << 56 | (long)'r' << 48 | (long)'i' << 40 | (long)'n' << 32 | (long)'g' << 24, 
+                       (long)'A' << 56 | (long)'t' << 48 | (long)'i' << 40 | (long)'l' << 32 | (long)'d' << 24 | (long)'e' << 16, 
+                       (long)'A' << 56 | (long)'u' << 48 | (long)'m' << 40 | (long)'l' << 32, 
+                       (long)'B' << 56 | (long)'e' << 48 | (long)'t' << 40 | (long)'a' << 32, 
+                       (long)'C' << 56 | (long)'c' << 48 | (long)'e' << 40 | (long)'d' << 32 | (long)'i' << 24 | (long)'l' << 16, 
+                       (long)'C' << 56 | (long)'h' << 48 | (long)'i' << 40, 
+                       (long)'D' << 56 | (long)'a' << 48 | (long)'g' << 40 | (long)'g' << 32 | (long)'e' << 24 | (long)'r' << 16, 
+                       (long)'D' << 56 | (long)'e' << 48 | (long)'l' << 40 | (long)'t' << 32 | (long)'a' << 24, 
+                       (long)'E' << 56 | (long)'T' << 48 | (long)'H' << 40, 
+                       (long)'E' << 56 | (long)'a' << 48 | (long)'c' << 40 | (long)'u' << 32 | (long)'t' << 24 | (long)'e' << 16, 
+                       (long)'E' << 56 | (long)'c' << 48 | (long)'i' << 40 | (long)'r' << 32 | (long)'c' << 24, 
+                       (long)'E' << 56 | (long)'g' << 48 | (long)'r' << 40 | (long)'a' << 32 | (long)'v' << 24 | (long)'e' << 16, 
+                       (long)'E' << 56 | (long)'p' << 48 | (long)'s' << 40 | (long)'i' << 32 | (long)'l' << 24 | (long)'o' << 16 | (long)'n' << 8, 
+                       (long)'E' << 56 | (long)'t' << 48 | (long)'a' << 40, 
+                       (long)'E' << 56 | (long)'u' << 48 | (long)'m' << 40 | (long)'l' << 32, 
+                       (long)'G' << 56 | (long)'a' << 48 | (long)'m' << 40 | (long)'m' << 32 | (long)'a' << 24, 
+                       (long)'I' << 56 | (long)'a' << 48 | (long)'c' << 40 | (long)'u' << 32 | (long)'t' << 24 | (long)'e' << 16, 
+                       (long)'I' << 56 | (long)'c' << 48 | (long)'i' << 40 | (long)'r' << 32 | (long)'c' << 24, 
+                       (long)'I' << 56 | (long)'g' << 48 | (long)'r' << 40 | (long)'a' << 32 | (long)'v' << 24 | (long)'e' << 16, 
+                       (long)'I' << 56 | (long)'o' << 48 | (long)'t' << 40 | (long)'a' << 32, 
+                       (long)'I' << 56 | (long)'u' << 48 | (long)'m' << 40 | (long)'l' << 32, 
+                       (long)'K' << 56 | (long)'a' << 48 | (long)'p' << 40 | (long)'p' << 32 | (long)'a' << 24, 
+                       (long)'L' << 56 | (long)'a' << 48 | (long)'m' << 40 | (long)'b' << 32 | (long)'d' << 24 | (long)'a' << 16, 
+                       (long)'M' << 56 | (long)'u' << 48, 
+                       (long)'N' << 56 | (long)'t' << 48 | (long)'i' << 40 | (long)'l' << 32 | (long)'d' << 24 | (long)'e' << 16, 
+                       (long)'N' << 56 | (long)'u' << 48, 
+                       (long)'O' << 56 | (long)'E' << 48 | (long)'l' << 40 | (long)'i' << 32 | (long)'g' << 24, 
+                       (long)'O' << 56 | (long)'a' << 48 | (long)'c' << 40 | (long)'u' << 32 | (long)'t' << 24 | (long)'e' << 16, 
+                       (long)'O' << 56 | (long)'c' << 48 | (long)'i' << 40 | (long)'r' << 32 | (long)'c' << 24, 
+                       (long)'O' << 56 | (long)'g' << 48 | (long)'r' << 40 | (long)'a' << 32 | (long)'v' << 24 | (long)'e' << 16, 
+                       (long)'O' << 56 | (long)'m' << 48 | (long)'e' << 40 | (long)'g' << 32 | (long)'a' << 24, 
+                       (long)'O' << 56 | (long)'m' << 48 | (long)'i' << 40 | (long)'c' << 32 | (long)'r' << 24 | (long)'o' << 16 | (long)'n' << 8, 
+                       (long)'O' << 56 | (long)'s' << 48 | (long)'l' << 40 | (long)'a' << 32 | (long)'s' << 24 | (long)'h' << 16, 
+                       (long)'O' << 56 | (long)'t' << 48 | (long)'i' << 40 | (long)'l' << 32 | (long)'d' << 24 | (long)'e' << 16, 
+                       (long)'O' << 56 | (long)'u' << 48 | (long)'m' << 40 | (long)'l' << 32, 
+                       (long)'P' << 56 | (long)'h' << 48 | (long)'i' << 40, 
+                       (long)'P' << 56 | (long)'i' << 48, 
+                       (long)'P' << 56 | (long)'r' << 48 | (long)'i' << 40 | (long)'m' << 32 | (long)'e' << 24, 
+                       (long)'P' << 56 | (long)'s' << 48 | (long)'i' << 40, 
+                       (long)'R' << 56 | (long)'h' << 48 | (long)'o' << 40, 
+                       (long)'S' << 56 | (long)'c' << 48 | (long)'a' << 40 | (long)'r' << 32 | (long)'o' << 24 | (long)'n' << 16, 
+                       (long)'S' << 56 | (long)'i' << 48 | (long)'g' << 40 | (long)'m' << 32 | (long)'a' << 24, 
+                       (long)'T' << 56 | (long)'H' << 48 | (long)'O' << 40 | (long)'R' << 32 | (long)'N' << 24, 
+                       (long)'T' << 56 | (long)'a' << 48 | (long)'u' << 40, 
+                       (long)'T' << 56 | (long)'h' << 48 | (long)'e' << 40 | (long)'t' << 32 | (long)'a' << 24, 
+                       (long)'U' << 56 | (long)'a' << 48 | (long)'c' << 40 | (long)'u' << 32 | (long)'t' << 24 | (long)'e' << 16, 
+                       (long)'U' << 56 | (long)'c' << 48 | (long)'i' << 40 | (long)'r' << 32 | (long)'c' << 24, 
+                       (long)'U' << 56 | (long)'g' << 48 | (long)'r' << 40 | (long)'a' << 32 | (long)'v' << 24 | (long)'e' << 16, 
+                       (long)'U' << 56 | (long)'p' << 48 | (long)'s' << 40 | (long)'i' << 32 | (long)'l' << 24 | (long)'o' << 16 | (long)'n' << 8, 
+                       (long)'U' << 56 | (long)'u' << 48 | (long)'m' << 40 | (long)'l' << 32, 
+                       (long)'X' << 56 | (long)'i' << 48, 
+                       (long)'Y' << 56 | (long)'a' << 48 | (long)'c' << 40 | (long)'u' << 32 | (long)'t' << 24 | (long)'e' << 16, 
+                       (long)'Y' << 56 | (long)'u' << 48 | (long)'m' << 40 | (long)'l' << 32, 
+                       (long)'Z' << 56 | (long)'e' << 48 | (long)'t' << 40 | (long)'a' << 32, 
+                       (long)'a' << 56 | (long)'a' << 48 | (long)'c' << 40 | (long)'u' << 32 | (long)'t' << 24 | (long)'e' << 16, 
+                       (long)'a' << 56 | (long)'c' << 48 | (long)'i' << 40 | (long)'r' << 32 | (long)'c' << 24, 
+                       (long)'a' << 56 | (long)'c' << 48 | (long)'u' << 40 | (long)'t' << 32 | (long)'e' << 24, 
+                       (long)'a' << 56 | (long)'e' << 48 | (long)'l' << 40 | (long)'i' << 32 | (long)'g' << 24, 
+                       (long)'a' << 56 | (long)'g' << 48 | (long)'r' << 40 | (long)'a' << 32 | (long)'v' << 24 | (long)'e' << 16, 
+                       (long)'a' << 56 | (long)'l' << 48 | (long)'e' << 40 | (long)'f' << 32 | (long)'s' << 24 | (long)'y' << 16 | (long)'m' << 8, 
+                       (long)'a' << 56 | (long)'l' << 48 | (long)'p' << 40 | (long)'h' << 32 | (long)'a' << 24, 
+                       (long)'a' << 56 | (long)'m' << 48 | (long)'p' << 40, 
+                       (long)'a' << 56 | (long)'n' << 48 | (long)'d' << 40, 
+                       (long)'a' << 56 | (long)'n' << 48 | (long)'g' << 40, 
+                       (long)'a' << 56 | (long)'r' << 48 | (long)'i' << 40 | (long)'n' << 32 | (long)'g' << 24, 
+                       (long)'a' << 56 | (long)'s' << 48 | (long)'y' << 40 | (long)'m' << 32 | (long)'p' << 24, 
+                       (long)'a' << 56 | (long)'t' << 48 | (long)'i' << 40 | (long)'l' << 32 | (long)'d' << 24 | (long)'e' << 16, 
+                       (long)'a' << 56 | (long)'u' << 48 | (long)'m' << 40 | (long)'l' << 32, 
+                       (long)'b' << 56 | (long)'d' << 48 | (long)'q' << 40 | (long)'u' << 32 | (long)'o' << 24, 
+                       (long)'b' << 56 | (long)'e' << 48 | (long)'t' << 40 | (long)'a' << 32, 
+                       (long)'b' << 56 | (long)'r' << 48 | (long)'v' << 40 | (long)'b' << 32 | (long)'a' << 24 | (long)'r' << 16, 
+                       (long)'b' << 56 | (long)'u' << 48 | (long)'l' << 40 | (long)'l' << 32, 
+                       (long)'c' << 56 | (long)'a' << 48 | (long)'p' << 40, 
+                       (long)'c' << 56 | (long)'c' << 48 | (long)'e' << 40 | (long)'d' << 32 | (long)'i' << 24 | (long)'l' << 16, 
+                       (long)'c' << 56 | (long)'e' << 48 | (long)'d' << 40 | (long)'i' << 32 | (long)'l' << 24, 
+                       (long)'c' << 56 | (long)'e' << 48 | (long)'n' << 40 | (long)'t' << 32, 
+                       (long)'c' << 56 | (long)'h' << 48 | (long)'i' << 40, 
+                       (long)'c' << 56 | (long)'i' << 48 | (long)'r' << 40 | (long)'c' << 32, 
+                       (long)'c' << 56 | (long)'l' << 48 | (long)'u' << 40 | (long)'b' << 32 | (long)'s' << 24, 
+                       (long)'c' << 56 | (long)'o' << 48 | (long)'n' << 40 | (long)'g' << 32, 
+                       (long)'c' << 56 | (long)'o' << 48 | (long)'p' << 40 | (long)'y' << 32, 
+                       (long)'c' << 56 | (long)'r' << 48 | (long)'a' << 40 | (long)'r' << 32 | (long)'r' << 24, 
+                       (long)'c' << 56 | (long)'u' << 48 | (long)'p' << 40, 
+                       (long)'c' << 56 | (long)'u' << 48 | (long)'r' << 40 | (long)'r' << 32 | (long)'e' << 24 | (long)'n' << 16, 
+                       (long)'d' << 56 | (long)'A' << 48 | (long)'r' << 40 | (long)'r' << 32, 
+                       (long)'d' << 56 | (long)'a' << 48 | (long)'g' << 40 | (long)'g' << 32 | (long)'e' << 24 | (long)'r' << 16, 
+                       (long)'d' << 56 | (long)'a' << 48 | (long)'r' << 40 | (long)'r' << 32, 
+                       (long)'d' << 56 | (long)'e' << 48 | (long)'g' << 40, 
+                       (long)'d' << 56 | (long)'e' << 48 | (long)'l' << 40 | (long)'t' << 32 | (long)'a' << 24, 
+                       (long)'d' << 56 | (long)'i' << 48 | (long)'a' << 40 | (long)'m' << 32 | (long)'s' << 24, 
+                       (long)'d' << 56 | (long)'i' << 48 | (long)'v' << 40 | (long)'i' << 32 | (long)'d' << 24 | (long)'e' << 16, 
+                       (long)'e' << 56 | (long)'a' << 48 | (long)'c' << 40 | (long)'u' << 32 | (long)'t' << 24 | (long)'e' << 16, 
+                       (long)'e' << 56 | (long)'c' << 48 | (long)'i' << 40 | (long)'r' << 32 | (long)'c' << 24, 
+                       (long)'e' << 56 | (long)'g' << 48 | (long)'r' << 40 | (long)'a' << 32 | (long)'v' << 24 | (long)'e' << 16, 
+                       (long)'e' << 56 | (long)'m' << 48 | (long)'p' << 40 | (long)'t' << 32 | (long)'y' << 24, 
+                       (long)'e' << 56 | (long)'m' << 48 | (long)'s' << 40 | (long)'p' << 32, 
+                       (long)'e' << 56 | (long)'n' << 48 | (long)'s' << 40 | (long)'p' << 32, 
+                       (long)'e' << 56 | (long)'p' << 48 | (long)'s' << 40 | (long)'i' << 32 | (long)'l' << 24 | (long)'o' << 16 | (long)'n' << 8, 
+                       (long)'e' << 56 | (long)'q' << 48 | (long)'u' << 40 | (long)'i' << 32 | (long)'v' << 24, 
+                       (long)'e' << 56 | (long)'t' << 48 | (long)'a' << 40, 
+                       (long)'e' << 56 | (long)'t' << 48 | (long)'h' << 40, 
+                       (long)'e' << 56 | (long)'u' << 48 | (long)'m' << 40 | (long)'l' << 32, 
+                       (long)'e' << 56 | (long)'u' << 48 | (long)'r' << 40 | (long)'o' << 32, 
+                       (long)'e' << 56 | (long)'x' << 48 | (long)'i' << 40 | (long)'s' << 32 | (long)'t' << 24, 
+                       (long)'f' << 56 | (long)'n' << 48 | (long)'o' << 40 | (long)'f' << 32, 
+                       (long)'f' << 56 | (long)'o' << 48 | (long)'r' << 40 | (long)'a' << 32 | (long)'l' << 24 | (long)'l' << 16, 
+                       (long)'f' << 56 | (long)'r' << 48 | (long)'a' << 40 | (long)'c' << 32 | (long)'1' << 24 | (long)'2' << 16, 
+                       (long)'f' << 56 | (long)'r' << 48 | (long)'a' << 40 | (long)'c' << 32 | (long)'1' << 24 | (long)'4' << 16, 
+                       (long)'f' << 56 | (long)'r' << 48 | (long)'a' << 40 | (long)'c' << 32 | (long)'3' << 24 | (long)'4' << 16, 
+                       (long)'f' << 56 | (long)'r' << 48 | (long)'a' << 40 | (long)'s' << 32 | (long)'l' << 24, 
+                       (long)'g' << 56 | (long)'a' << 48 | (long)'m' << 40 | (long)'m' << 32 | (long)'a' << 24, 
+                       (long)'g' << 56 | (long)'e' << 48, 
+                       (long)'g' << 56 | (long)'t' << 48, 
+                       (long)'h' << 56 | (long)'A' << 48 | (long)'r' << 40 | (long)'r' << 32, 
+                       (long)'h' << 56 | (long)'a' << 48 | (long)'r' << 40 | (long)'r' << 32, 
+                       (long)'h' << 56 | (long)'e' << 48 | (long)'a' << 40 | (long)'r' << 32 | (long)'t' << 24 | (long)'s' << 16, 
+                       (long)'h' << 56 | (long)'e' << 48 | (long)'l' << 40 | (long)'l' << 32 | (long)'i' << 24 | (long)'p' << 16, 
+                       (long)'i' << 56 | (long)'a' << 48 | (long)'c' << 40 | (long)'u' << 32 | (long)'t' << 24 | (long)'e' << 16, 
+                       (long)'i' << 56 | (long)'c' << 48 | (long)'i' << 40 | (long)'r' << 32 | (long)'c' << 24, 
+                       (long)'i' << 56 | (long)'e' << 48 | (long)'x' << 40 | (long)'c' << 32 | (long)'l' << 24, 
+                       (long)'i' << 56 | (long)'g' << 48 | (long)'r' << 40 | (long)'a' << 32 | (long)'v' << 24 | (long)'e' << 16, 
+                       (long)'i' << 56 | (long)'m' << 48 | (long)'a' << 40 | (long)'g' << 32 | (long)'e' << 24, 
+                       (long)'i' << 56 | (long)'n' << 48 | (long)'f' << 40 | (long)'i' << 32 | (long)'n' << 24, 
+                       (long)'i' << 56 | (long)'n' << 48 | (long)'t' << 40, 
+                       (long)'i' << 56 | (long)'o' << 48 | (long)'t' << 40 | (long)'a' << 32, 
+                       (long)'i' << 56 | (long)'q' << 48 | (long)'u' << 40 | (long)'e' << 32 | (long)'s' << 24 | (long)'t' << 16, 
+                       (long)'i' << 56 | (long)'s' << 48 | (long)'i' << 40 | (long)'n' << 32, 
+                       (long)'i' << 56 | (long)'u' << 48 | (long)'m' << 40 | (long)'l' << 32, 
+                       (long)'k' << 56 | (long)'a' << 48 | (long)'p' << 40 | (long)'p' << 32 | (long)'a' << 24, 
+                       (long)'l' << 56 | (long)'A' << 48 | (long)'r' << 40 | (long)'r' << 32, 
+                       (long)'l' << 56 | (long)'a' << 48 | (long)'m' << 40 | (long)'b' << 32 | (long)'d' << 24 | (long)'a' << 16, 
+                       (long)'l' << 56 | (long)'a' << 48 | (long)'n' << 40 | (long)'g' << 32, 
+                       (long)'l' << 56 | (long)'a' << 48 | (long)'q' << 40 | (long)'u' << 32 | (long)'o' << 24, 
+                       (long)'l' << 56 | (long)'a' << 48 | (long)'r' << 40 | (long)'r' << 32, 
+                       (long)'l' << 56 | (long)'c' << 48 | (long)'e' << 40 | (long)'i' << 32 | (long)'l' << 24, 
+                       (long)'l' << 56 | (long)'d' << 48 | (long)'q' << 40 | (long)'u' << 32 | (long)'o' << 24, 
+                       (long)'l' << 56 | (long)'e' << 48, 
+                       (long)'l' << 56 | (long)'f' << 48 | (long)'l' << 40 | (long)'o' << 32 | (long)'o' << 24 | (long)'r' << 16, 
+                       (long)'l' << 56 | (long)'o' << 48 | (long)'w' << 40 | (long)'a' << 32 | (long)'s' << 24 | (long)'t' << 16, 
+                       (long)'l' << 56 | (long)'o' << 48 | (long)'z' << 40, 
+                       (long)'l' << 56 | (long)'r' << 48 | (long)'m' << 40, 
+                       (long)'l' << 56 | (long)'s' << 48 | (long)'a' << 40 | (long)'q' << 32 | (long)'u' << 24 | (long)'o' << 16, 
+                       (long)'l' << 56 | (long)'s' << 48 | (long)'q' << 40 | (long)'u' << 32 | (long)'o' << 24, 
+                       (long)'l' << 56 | (long)'t' << 48, 
+                       (long)'m' << 56 | (long)'a' << 48 | (long)'c' << 40 | (long)'r' << 32, 
+                       (long)'m' << 56 | (long)'d' << 48 | (long)'a' << 40 | (long)'s' << 32 | (long)'h' << 24, 
+                       (long)'m' << 56 | (long)'i' << 48 | (long)'c' << 40 | (long)'r' << 32 | (long)'o' << 24, 
+                       (long)'m' << 56 | (long)'i' << 48 | (long)'d' << 40 | (long)'d' << 32 | (long)'o' << 24 | (long)'t' << 16, 
+                       (long)'m' << 56 | (long)'i' << 48 | (long)'n' << 40 | (long)'u' << 32 | (long)'s' << 24, 
+                       (long)'m' << 56 | (long)'u' << 48, 
+                       (long)'n' << 56 | (long)'a' << 48 | (long)'b' << 40 | (long)'l' << 32 | (long)'a' << 24, 
+                       (long)'n' << 56 | (long)'b' << 48 | (long)'s' << 40 | (long)'p' << 32, 
+                       (long)'n' << 56 | (long)'d' << 48 | (long)'a' << 40 | (long)'s' << 32 | (long)'h' << 24, 
+                       (long)'n' << 56 | (long)'e' << 48, 
+                       (long)'n' << 56 | (long)'i' << 48, 
+                       (long)'n' << 56 | (long)'o' << 48 | (long)'t' << 40, 
+                       (long)'n' << 56 | (long)'o' << 48 | (long)'t' << 40 | (long)'i' << 32 | (long)'n' << 24, 
+                       (long)'n' << 56 | (long)'s' << 48 | (long)'u' << 40 | (long)'b' << 32, 
+                       (long)'n' << 56 | (long)'t' << 48 | (long)'i' << 40 | (long)'l' << 32 | (long)'d' << 24 | (long)'e' << 16, 
+                       (long)'n' << 56 | (long)'u' << 48, 
+                       (long)'o' << 56 | (long)'a' << 48 | (long)'c' << 40 | (long)'u' << 32 | (long)'t' << 24 | (long)'e' << 16, 
+                       (long)'o' << 56 | (long)'c' << 48 | (long)'i' << 40 | (long)'r' << 32 | (long)'c' << 24, 
+                       (long)'o' << 56 | (long)'e' << 48 | (long)'l' << 40 | (long)'i' << 32 | (long)'g' << 24, 
+                       (long)'o' << 56 | (long)'g' << 48 | (long)'r' << 40 | (long)'a' << 32 | (long)'v' << 24 | (long)'e' << 16, 
+                       (long)'o' << 56 | (long)'l' << 48 | (long)'i' << 40 | (long)'n' << 32 | (long)'e' << 24, 
+                       (long)'o' << 56 | (long)'m' << 48 | (long)'e' << 40 | (long)'g' << 32 | (long)'a' << 24, 
+                       (long)'o' << 56 | (long)'m' << 48 | (long)'i' << 40 | (long)'c' << 32 | (long)'r' << 24 | (long)'o' << 16 | (long)'n' << 8, 
+                       (long)'o' << 56 | (long)'p' << 48 | (long)'l' << 40 | (long)'u' << 32 | (long)'s' << 24, 
+                       (long)'o' << 56 | (long)'r' << 48, 
+                       (long)'o' << 56 | (long)'r' << 48 | (long)'d' << 40 | (long)'f' << 32, 
+                       (long)'o' << 56 | (long)'r' << 48 | (long)'d' << 40 | (long)'m' << 32, 
+                       (long)'o' << 56 | (long)'s' << 48 | (long)'l' << 40 | (long)'a' << 32 | (long)'s' << 24 | (long)'h' << 16, 
+                       (long)'o' << 56 | (long)'t' << 48 | (long)'i' << 40 | (long)'l' << 32 | (long)'d' << 24 | (long)'e' << 16, 
+                       (long)'o' << 56 | (long)'t' << 48 | (long)'i' << 40 | (long)'m' << 32 | (long)'e' << 24 | (long)'s' << 16, 
+                       (long)'o' << 56 | (long)'u' << 48 | (long)'m' << 40 | (long)'l' << 32, 
+                       (long)'p' << 56 | (long)'a' << 48 | (long)'r' << 40 | (long)'a' << 32, 
+                       (long)'p' << 56 | (long)'a' << 48 | (long)'r' << 40 | (long)'t' << 32, 
+                       (long)'p' << 56 | (long)'e' << 48 | (long)'r' << 40 | (long)'m' << 32 | (long)'i' << 24 | (long)'l' << 16, 
+                       (long)'p' << 56 | (long)'e' << 48 | (long)'r' << 40 | (long)'p' << 32, 
+                       (long)'p' << 56 | (long)'h' << 48 | (long)'i' << 40, 
+                       (long)'p' << 56 | (long)'i' << 48, 
+                       (long)'p' << 56 | (long)'i' << 48 | (long)'v' << 40, 
+                       (long)'p' << 56 | (long)'l' << 48 | (long)'u' << 40 | (long)'s' << 32 | (long)'m' << 24 | (long)'n' << 16, 
+                       (long)'p' << 56 | (long)'o' << 48 | (long)'u' << 40 | (long)'n' << 32 | (long)'d' << 24, 
+                       (long)'p' << 56 | (long)'r' << 48 | (long)'i' << 40 | (long)'m' << 32 | (long)'e' << 24, 
+                       (long)'p' << 56 | (long)'r' << 48 | (long)'o' << 40 | (long)'d' << 32, 
+                       (long)'p' << 56 | (long)'r' << 48 | (long)'o' << 40 | (long)'p' << 32, 
+                       (long)'p' << 56 | (long)'s' << 48 | (long)'i' << 40, 
+                       (long)'q' << 56 | (long)'u' << 48 | (long)'o' << 40 | (long)'t' << 32, 
+                       (long)'r' << 56 | (long)'A' << 48 | (long)'r' << 40 | (long)'r' << 32, 
+                       (long)'r' << 56 | (long)'a' << 48 | (long)'d' << 40 | (long)'i' << 32 | (long)'c' << 24, 
+                       (long)'r' << 56 | (long)'a' << 48 | (long)'n' << 40 | (long)'g' << 32, 
+                       (long)'r' << 56 | (long)'a' << 48 | (long)'q' << 40 | (long)'u' << 32 | (long)'o' << 24, 
+                       (long)'r' << 56 | (long)'a' << 48 | (long)'r' << 40 | (long)'r' << 32, 
+                       (long)'r' << 56 | (long)'c' << 48 | (long)'e' << 40 | (long)'i' << 32 | (long)'l' << 24, 
+                       (long)'r' << 56 | (long)'d' << 48 | (long)'q' << 40 | (long)'u' << 32 | (long)'o' << 24, 
+                       (long)'r' << 56 | (long)'e' << 48 | (long)'a' << 40 | (long)'l' << 32, 
+                       (long)'r' << 56 | (long)'e' << 48 | (long)'g' << 40, 
+                       (long)'r' << 56 | (long)'f' << 48 | (long)'l' << 40 | (long)'o' << 32 | (long)'o' << 24 | (long)'r' << 16, 
+                       (long)'r' << 56 | (long)'h' << 48 | (long)'o' << 40, 
+                       (long)'r' << 56 | (long)'l' << 48 | (long)'m' << 40, 
+                       (long)'r' << 56 | (long)'s' << 48 | (long)'a' << 40 | (long)'q' << 32 | (long)'u' << 24 | (long)'o' << 16, 
+                       (long)'r' << 56 | (long)'s' << 48 | (long)'q' << 40 | (long)'u' << 32 | (long)'o' << 24, 
+                       (long)'s' << 56 | (long)'b' << 48 | (long)'q' << 40 | (long)'u' << 32 | (long)'o' << 24, 
+                       (long)'s' << 56 | (long)'c' << 48 | (long)'a' << 40 | (long)'r' << 32 | (long)'o' << 24 | (long)'n' << 16, 
+                       (long)'s' << 56 | (long)'d' << 48 | (long)'o' << 40 | (long)'t' << 32, 
+                       (long)'s' << 56 | (long)'e' << 48 | (long)'c' << 40 | (long)'t' << 32, 
+                       (long)'s' << 56 | (long)'h' << 48 | (long)'y' << 40, 
+                       (long)'s' << 56 | (long)'i' << 48 | (long)'g' << 40 | (long)'m' << 32 | (long)'a' << 24, 
+                       (long)'s' << 56 | (long)'i' << 48 | (long)'g' << 40 | (long)'m' << 32 | (long)'a' << 24 | (long)'f' << 16, 
+                       (long)'s' << 56 | (long)'i' << 48 | (long)'m' << 40, 
+                       (long)'s' << 56 | (long)'p' << 48 | (long)'a' << 40 | (long)'d' << 32 | (long)'e' << 24 | (long)'s' << 16, 
+                       (long)'s' << 56 | (long)'u' << 48 | (long)'b' << 40, 
+                       (long)'s' << 56 | (long)'u' << 48 | (long)'b' << 40 | (long)'e' << 32, 
+                       (long)'s' << 56 | (long)'u' << 48 | (long)'m' << 40, 
+                       (long)'s' << 56 | (long)'u' << 48 | (long)'p' << 40, 
+                       (long)'s' << 56 | (long)'u' << 48 | (long)'p' << 40 | (long)'1' << 32, 
+                       (long)'s' << 56 | (long)'u' << 48 | (long)'p' << 40 | (long)'2' << 32, 
+                       (long)'s' << 56 | (long)'u' << 48 | (long)'p' << 40 | (long)'3' << 32, 
+                       (long)'s' << 56 | (long)'u' << 48 | (long)'p' << 40 | (long)'e' << 32, 
+                       (long)'s' << 56 | (long)'z' << 48 | (long)'l' << 40 | (long)'i' << 32 | (long)'g' << 24, 
+                       (long)'t' << 56 | (long)'a' << 48 | (long)'u' << 40, 
+                       (long)'t' << 56 | (long)'h' << 48 | (long)'e' << 40 | (long)'r' << 32 | (long)'e' << 24 | (long)'4' << 16, 
+                       (long)'t' << 56 | (long)'h' << 48 | (long)'e' << 40 | (long)'t' << 32 | (long)'a' << 24, 
+                       (long)'t' << 56 | (long)'h' << 48 | (long)'e' << 40 | (long)'t' << 32 | (long)'a' << 24 | (long)'s' << 16 | (long)'y' << 8 | (long)'m' << 0, 
+                       (long)'t' << 56 | (long)'h' << 48 | (long)'i' << 40 | (long)'n' << 32 | (long)'s' << 24 | (long)'p' << 16, 
+                       (long)'t' << 56 | (long)'h' << 48 | (long)'o' << 40 | (long)'r' << 32 | (long)'n' << 24, 
+                       (long)'t' << 56 | (long)'i' << 48 | (long)'l' << 40 | (long)'d' << 32 | (long)'e' << 24, 
+                       (long)'t' << 56 | (long)'i' << 48 | (long)'m' << 40 | (long)'e' << 32 | (long)'s' << 24, 
+                       (long)'t' << 56 | (long)'r' << 48 | (long)'a' << 40 | (long)'d' << 32 | (long)'e' << 24, 
+                       (long)'u' << 56 | (long)'A' << 48 | (long)'r' << 40 | (long)'r' << 32, 
+                       (long)'u' << 56 | (long)'a' << 48 | (long)'c' << 40 | (long)'u' << 32 | (long)'t' << 24 | (long)'e' << 16, 
+                       (long)'u' << 56 | (long)'a' << 48 | (long)'r' << 40 | (long)'r' << 32, 
+                       (long)'u' << 56 | (long)'c' << 48 | (long)'i' << 40 | (long)'r' << 32 | (long)'c' << 24, 
+                       (long)'u' << 56 | (long)'g' << 48 | (long)'r' << 40 | (long)'a' << 32 | (long)'v' << 24 | (long)'e' << 16, 
+                       (long)'u' << 56 | (long)'m' << 48 | (long)'l' << 40, 
+                       (long)'u' << 56 | (long)'p' << 48 | (long)'s' << 40 | (long)'i' << 32 | (long)'h' << 24, 
+                       (long)'u' << 56 | (long)'p' << 48 | (long)'s' << 40 | (long)'i' << 32 | (long)'l' << 24 | (long)'o' << 16 | (long)'n' << 8, 
+                       (long)'u' << 56 | (long)'u' << 48 | (long)'m' << 40 | (long)'l' << 32, 
+                       (long)'w' << 56 | (long)'e' << 48 | (long)'i' << 40 | (long)'e' << 32 | (long)'r' << 24 | (long)'p' << 16, 
+                       (long)'x' << 56 | (long)'i' << 48, 
+                       (long)'y' << 56 | (long)'a' << 48 | (long)'c' << 40 | (long)'u' << 32 | (long)'t' << 24 | (long)'e' << 16, 
+                       (long)'y' << 56 | (long)'e' << 48 | (long)'n' << 40, 
+                       (long)'y' << 56 | (long)'u' << 48 | (long)'m' << 40 | (long)'l' << 32, 
+                       (long)'z' << 56 | (long)'e' << 48 | (long)'t' << 40 | (long)'a' << 32, 
+                       (long)'z' << 56 | (long)'w' << 48 | (long)'j' << 40, 
+                       (long)'z' << 56 | (long)'w' << 48 | (long)'n' << 40 | (long)'j' << 32
+               };
+
+               static readonly char[] entities_values = new char[] {
+                       '\u00C6',
+                       '\u00C1',
+                       '\u00C2',
+                       '\u00C0',
+                       '\u0391',
+                       '\u00C5',
+                       '\u00C3',
+                       '\u00C4',
+                       '\u0392',
+                       '\u00C7',
+                       '\u03A7',
+                       '\u2021',
+                       '\u0394',
+                       '\u00D0',
+                       '\u00C9',
+                       '\u00CA',
+                       '\u00C8',
+                       '\u0395',
+                       '\u0397',
+                       '\u00CB',
+                       '\u0393',
+                       '\u00CD',
+                       '\u00CE',
+                       '\u00CC',
+                       '\u0399',
+                       '\u00CF',
+                       '\u039A',
+                       '\u039B',
+                       '\u039C',
+                       '\u00D1',
+                       '\u039D',
+                       '\u0152',
+                       '\u00D3',
+                       '\u00D4',
+                       '\u00D2',
+                       '\u03A9',
+                       '\u039F',
+                       '\u00D8',
+                       '\u00D5',
+                       '\u00D6',
+                       '\u03A6',
+                       '\u03A0',
+                       '\u2033',
+                       '\u03A8',
+                       '\u03A1',
+                       '\u0160',
+                       '\u03A3',
+                       '\u00DE',
+                       '\u03A4',
+                       '\u0398',
+                       '\u00DA',
+                       '\u00DB',
+                       '\u00D9',
+                       '\u03A5',
+                       '\u00DC',
+                       '\u039E',
+                       '\u00DD',
+                       '\u0178',
+                       '\u0396',
+                       '\u00E1',
+                       '\u00E2',
+                       '\u00B4',
+                       '\u00E6',
+                       '\u00E0',
+                       '\u2135',
+                       '\u03B1',
+                       '\u0026',
+                       '\u2227',
+                       '\u2220',
+                       '\u00E5',
+                       '\u2248',
+                       '\u00E3',
+                       '\u00E4',
+                       '\u201E',
+                       '\u03B2',
+                       '\u00A6',
+                       '\u2022',
+                       '\u2229',
+                       '\u00E7',
+                       '\u00B8',
+                       '\u00A2',
+                       '\u03C7',
+                       '\u02C6',
+                       '\u2663',
+                       '\u2245',
+                       '\u00A9',
+                       '\u21B5',
+                       '\u222A',
+                       '\u00A4',
+                       '\u21D3',
+                       '\u2020',
+                       '\u2193',
+                       '\u00B0',
+                       '\u03B4',
+                       '\u2666',
+                       '\u00F7',
+                       '\u00E9',
+                       '\u00EA',
+                       '\u00E8',
+                       '\u2205',
+                       '\u2003',
+                       '\u2002',
+                       '\u03B5',
+                       '\u2261',
+                       '\u03B7',
+                       '\u00F0',
+                       '\u00EB',
+                       '\u20AC',
+                       '\u2203',
+                       '\u0192',
+                       '\u2200',
+                       '\u00BD',
+                       '\u00BC',
+                       '\u00BE',
+                       '\u2044',
+                       '\u03B3',
+                       '\u2265',
+                       '\u003E',
+                       '\u21D4',
+                       '\u2194',
+                       '\u2665',
+                       '\u2026',
+                       '\u00ED',
+                       '\u00EE',
+                       '\u00A1',
+                       '\u00EC',
+                       '\u2111',
+                       '\u221E',
+                       '\u222B',
+                       '\u03B9',
+                       '\u00BF',
+                       '\u2208',
+                       '\u00EF',
+                       '\u03BA',
+                       '\u21D0',
+                       '\u03BB',
+                       '\u2329',
+                       '\u00AB',
+                       '\u2190',
+                       '\u2308',
+                       '\u201C',
+                       '\u2264',
+                       '\u230A',
+                       '\u2217',
+                       '\u25CA',
+                       '\u200E',
+                       '\u2039',
+                       '\u2018',
+                       '\u003C',
+                       '\u00AF',
+                       '\u2014',
+                       '\u00B5',
+                       '\u00B7',
+                       '\u2212',
+                       '\u03BC',
+                       '\u2207',
+                       '\u00A0',
+                       '\u2013',
+                       '\u2260',
+                       '\u220B',
+                       '\u00AC',
+                       '\u2209',
+                       '\u2284',
+                       '\u00F1',
+                       '\u03BD',
+                       '\u00F3',
+                       '\u00F4',
+                       '\u0153',
+                       '\u00F2',
+                       '\u203E',
+                       '\u03C9',
+                       '\u03BF',
+                       '\u2295',
+                       '\u2228',
+                       '\u00AA',
+                       '\u00BA',
+                       '\u00F8',
+                       '\u00F5',
+                       '\u2297',
+                       '\u00F6',
+                       '\u00B6',
+                       '\u2202',
+                       '\u2030',
+                       '\u22A5',
+                       '\u03C6',
+                       '\u03C0',
+                       '\u03D6',
+                       '\u00B1',
+                       '\u00A3',
+                       '\u2032',
+                       '\u220F',
+                       '\u221D',
+                       '\u03C8',
+                       '\u0022',
+                       '\u21D2',
+                       '\u221A',
+                       '\u232A',
+                       '\u00BB',
+                       '\u2192',
+                       '\u2309',
+                       '\u201D',
+                       '\u211C',
+                       '\u00AE',
+                       '\u230B',
+                       '\u03C1',
+                       '\u200F',
+                       '\u203A',
+                       '\u2019',
+                       '\u201A',
+                       '\u0161',
+                       '\u22C5',
+                       '\u00A7',
+                       '\u00AD',
+                       '\u03C3',
+                       '\u03C2',
+                       '\u223C',
+                       '\u2660',
+                       '\u2282',
+                       '\u2286',
+                       '\u2211',
+                       '\u2283',
+                       '\u00B9',
+                       '\u00B2',
+                       '\u00B3',
+                       '\u2287',
+                       '\u00DF',
+                       '\u03C4',
+                       '\u2234',
+                       '\u03B8',
+                       '\u03D1',
+                       '\u2009',
+                       '\u00FE',
+                       '\u02DC',
+                       '\u00D7',
+                       '\u2122',
+                       '\u21D1',
+                       '\u00FA',
+                       '\u2191',
+                       '\u00FB',
+                       '\u00F9',
+                       '\u00A8',
+                       '\u03D2',
+                       '\u03C5',
+                       '\u00FC',
+                       '\u2118',
+                       '\u03BE',
+                       '\u00FD',
+                       '\u00A5',
+                       '\u00FF',
+                       '\u03B6',
+                       '\u200D',
+                       '\u200C'
+               };
 
-               public HttpUtility () 
-               {
-               }
-       
-               #endregion // Constructors
-       
                #region Methods
        
                public static void HtmlAttributeEncode (string s, TextWriter output) 
@@ -816,6 +1043,36 @@ namespace System.Net {
                        return result.ToArray ();
                }
 
+               static string ConvertKeyToEntity (string key)
+               {
+                       var token = CalculateKeyValue (key);
+                       if (token == 0)
+                               return key;
+
+                       var idx = Array.BinarySearch (entities, token);
+                       if (idx < 0)
+                               return key;
+
+                       return entities_values [idx].ToString ();
+               }
+
+               static long CalculateKeyValue (string s)
+               {
+                       if (s.Length > 8)
+                               return 0;
+
+                       long key = 0;
+                       for (int i = 0; i < s.Length; ++i) {
+                               long ch = s[i];
+                               if (ch > 'z' || ch < '0')
+                                       return 0;
+
+                               key |= ch << ((7 - i) * 8);
+                       }
+
+                       return key;
+               }
+
                /// <summary>
                /// Decodes an HTML-encoded string and returns the decoded string.
                /// </summary>
@@ -884,8 +1141,10 @@ namespace System.Net {
                                        entity.Append (c);
                                        if (c == ';') {
                                                string key = entity.ToString ();
-                                               if (key.Length > 1 && Entities.ContainsKey (key.Substring (1, key.Length - 2)))
-                                                       key = Entities [key.Substring (1, key.Length - 2)].ToString ();
+                                               if (key.Length > 1) {
+                                                       var skey = key.Substring (1, key.Length - 2);
+                                                       key = ConvertKeyToEntity (skey);
+                                               }
 
                                                output.Append (key);
                                                state = 0;
index 8a4414fb774442d89415ec9da15f045592858027..92c1a54300ba13b5cdb3488875de883f32c32d15 100644 (file)
@@ -180,6 +180,16 @@ namespace MonoTests.System.Net {
                                        " + \"&mid=\" + ModuleID + \"&pageindex=\" + Request.Params.Get(\"pageindex\") %>";
                        Assert.AreEqual (str, WebUtility.HtmlDecode (str));
                }
+
+               [Test]
+               public void EntityEncoding ()
+               {
+                       var expected = "\u00A0\u00A1\u00A2\u00A3\u00A4\u00A5\u00A6\u00A7\u00A8\u00A9\u00AA\u00AB\u00AC\u00AD\u00AE\u00AF\u00B0\u00B1\u00B2\u00B3\u00B4\u00B5\u00B6\u00B7\u00B8\u00B9\u00BA\u00BB\u00BC\u00BD\u00BE\u00BF\u00C0\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7\u00C8\u00C9\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF\u00D0\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6\u00D7\u00D8\u00D9\u00DA\u00DB\u00DC\u00DD\u00DE\u00DF\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5\u00E6\u00E7\u00E8\u00E9\u00EA\u00EB\u00EC\u00ED\u00EE\u00EF\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7\u00F8\u00F9\u00FA\u00FB\u00FC\u00FD\u00FE\u00FF\u0192\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039A\u039B\u039C\u039D\u039E\u039F\u03A0\u03A1\u03A3\u03A4\u03A5\u03A6\u03A7\u03A8\u03A9\u03B1\u03B2\u03B3\u03B4\u03B5\u03B6\u03B7\u03B8\u03B9\u03BA\u03BB\u03BC\u03BD\u03BE\u03BF\u03C0\u03C1\u03C2\u03C3\u03C4\u03C5\u03C6\u03C7\u03C8\u03C9\u03D1\u03D2\u03D6\u2022\u2026\u2032\u2033\u203E\u2044\u2118\u2111\u211C\u2122\u2135\u2190\u2191\u2192\u2193\u2194\u21B5\u21D0\u21D1\u21D2\u21D3\u21D4\u2200\u2202\u2203\u2205\u2207\u2208\u2209\u220B\u220F\u2211\u2212\u2217\u221A\u221D\u221E\u2220\u2227\u2228\u2229\u222A\u222B\u2234\u223C\u2245\u2248\u2260\u2261\u2264\u2265\u2282\u2283\u2284\u2286\u2287\u2295\u2297\u22A5\u22C5\u2308\u2309\u230A\u230B\u2329\u232A\u25CA\u2660\u2663\u2665\u2666\u0022\u0026\u003C\u003E\u0152\u0153\u0160\u0161\u0178\u02C6\u02DC\u2002\u2003\u2009\u200C\u200D\u200E\u200F\u2013\u2014\u2018\u2019\u201A\u201C\u201D\u201E\u2020\u2021\u2030\u2039\u203A\u20AC";
+
+                       var htmlDecoded = WebUtility.HtmlDecode ("&nbsp;&iexcl;&cent;&pound;&curren;&yen;&brvbar;&sect;&uml;&copy;&ordf;&laquo;&not;&shy;&reg;&macr;&deg;&plusmn;&sup2;&sup3;&acute;&micro;&para;&middot;&cedil;&sup1;&ordm;&raquo;&frac14;&frac12;&frac34;&iquest;&Agrave;&Aacute;&Acirc;&Atilde;&Auml;&Aring;&AElig;&Ccedil;&Egrave;&Eacute;&Ecirc;&Euml;&Igrave;&Iacute;&Icirc;&Iuml;&ETH;&Ntilde;&Ograve;&Oacute;&Ocirc;&Otilde;&Ouml;&times;&Oslash;&Ugrave;&Uacute;&Ucirc;&Uuml;&Yacute;&THORN;&szlig;&agrave;&aacute;&acirc;&atilde;&auml;&aring;&aelig;&ccedil;&egrave;&eacute;&ecirc;&euml;&igrave;&iacute;&icirc;&iuml;&eth;&ntilde;&ograve;&oacute;&ocirc;&otilde;&ouml;&divide;&oslash;&ugrave;&uacute;&ucirc;&uuml;&yacute;&thorn;&yuml;&fnof;&Alpha;&Beta;&Gamma;&Delta;&Epsilon;&Zeta;&Eta;&Theta;&Iota;&Kappa;&Lambda;&Mu;&Nu;&Xi;&Omicron;&Pi;&Rho;&Sigma;&Tau;&Upsilon;&Phi;&Chi;&Psi;&Omega;&alpha;&beta;&gamma;&delta;&epsilon;&zeta;&eta;&theta;&iota;&kappa;&lambda;&mu;&nu;&xi;&omicron;&pi;&rho;&sigmaf;&sigma;&tau;&upsilon;&phi;&chi;&psi;&omega;&thetasym;&upsih;&piv;&bull;&hellip;&prime;&Prime;&oline;&frasl;&weierp;&image;&real;&trade;&alefsym;&larr;&uarr;&rarr;&darr;&harr;&crarr;&lArr;&uArr;&rArr;&dArr;&hArr;&forall;&part;&exist;&empty;&nabla;&isin;&notin;&ni;&prod;&sum;&minus;&lowast;&radic;&prop;&infin;&ang;&and;&or;&cap;&cup;&int;&there4;&sim;&cong;&asymp;&ne;&equiv;&le;&ge;&sub;&sup;&nsub;&sube;&supe;&oplus;&otimes;&perp;&sdot;&lceil;&rceil;&lfloor;&rfloor;&lang;&rang;&loz;&spades;&clubs;&hearts;&diams;&quot;&amp;&lt;&gt;&OElig;&oelig;&Scaron;&scaron;&Yuml;&circ;&tilde;&ensp;&emsp;&thinsp;&zwnj;&zwj;&lrm;&rlm;&ndash;&mdash;&lsquo;&rsquo;&sbquo;&ldquo;&rdquo;&bdquo;&dagger;&Dagger;&permil;&lsaquo;&rsaquo;&euro;");
+                       
+                       Assert.AreEqual (expected, htmlDecoded);
+               }
        }
 }
 #endif
index 746e1f6f35ff8d0a775da5d01d9facfa45f59f15..240d1139d1c1b3e828cb255d0ef1379345a75d4b 100644 (file)
@@ -705,11 +705,16 @@ namespace System.Runtime.InteropServices
 
                public static byte ReadByte (IntPtr ptr)
                {
-                       return ReadByte (ptr, 0);
+                       unsafe {
+                               return *(byte*)ptr;
+                       }
                }
 
-               [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               public extern static byte ReadByte (IntPtr ptr, int ofs);
+               public static byte ReadByte (IntPtr ptr, int ofs) {
+                       unsafe {
+                               return *((byte*)ptr + ofs);
+                       }
+               }
 
                [MonoTODO]
                [SuppressUnmanagedCodeSecurity]
@@ -720,11 +725,34 @@ namespace System.Runtime.InteropServices
 
                public static short ReadInt16 (IntPtr ptr)
                {
-                       return ReadInt16 (ptr, 0);
+                       // The mono JIT can't inline this due to the hight number of calls
+                       // return ReadInt16 (ptr, 0);
+                       if ((uint)ptr % 2 == 0) {
+                               unsafe {
+                                       return *(short*)ptr;
+                               }
+                       } else {
+                               unsafe {
+                                       short s;
+                                       String.memcpy ((byte*)&s, (byte*)ptr, 2);
+                                       return s;
+                               }
+                       }
                }
 
-               [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               public extern static short ReadInt16 (IntPtr ptr, int ofs);
+               public static short ReadInt16 (IntPtr ptr, int ofs) {
+                       if ((IntPtr.Add (ptr, ofs)).ToInt32 () % 2 == 0) {
+                               unsafe {
+                                       return *(short*)(IntPtr.Add (ptr, ofs));
+                               }
+                       } else {
+                               unsafe {
+                                       short s;
+                                       String.memcpy ((byte*)&s, (byte*)(IntPtr.Add (ptr, ofs)), 2);
+                                       return s;
+                               }
+                       }
+               }
 
                [MonoTODO]
                [SuppressUnmanagedCodeSecurity]
@@ -736,12 +764,33 @@ namespace System.Runtime.InteropServices
                [ReliabilityContractAttribute (Consistency.WillNotCorruptState, Cer.Success)]
                public static int ReadInt32 (IntPtr ptr)
                {
-                       return ReadInt32 (ptr, 0);
+                       if ((uint)ptr % 4 == 0) {
+                               unsafe {
+                                       return *(int*)ptr;
+                               }
+                       } else {
+                               unsafe {
+                                       int s;
+                                       String.memcpy ((byte*)&s, (byte*)ptr, 4);
+                                       return s;
+                               }
+                       }
                }
 
                [ReliabilityContractAttribute (Consistency.WillNotCorruptState, Cer.Success)]
-               [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               public extern static int ReadInt32 (IntPtr ptr, int ofs);
+               public static int ReadInt32 (IntPtr ptr, int ofs) {
+                       if ((IntPtr.Add (ptr, ofs)).ToInt32 () % 4 == 0) {
+                               unsafe {
+                                       return *(int*)(IntPtr.Add (ptr, ofs));
+                               }
+                       } else {
+                               unsafe {
+                                       int s;
+                                       String.memcpy ((byte*)&s, (byte*)(IntPtr.Add (ptr, ofs)), 4);
+                                       return s;
+                               }
+                       }
+               }
 
                [ReliabilityContractAttribute (Consistency.WillNotCorruptState, Cer.Success)]
                [MonoTODO]
@@ -754,11 +803,34 @@ namespace System.Runtime.InteropServices
                [ReliabilityContractAttribute (Consistency.WillNotCorruptState, Cer.Success)]
                public static long ReadInt64 (IntPtr ptr)
                {
-                       return ReadInt64 (ptr, 0);
+                       // The real alignment might be 4 on some platforms, but this is just an optimization,
+                       // so it doesn't matter.
+                       if ((uint)ptr % 8 == 0) {
+                               unsafe {
+                                       return *(long*)ptr;
+                               }
+                       } else {
+                               unsafe {
+                                       long s;
+                                       String.memcpy ((byte*)&s, (byte*)ptr, 8);
+                                       return s;
+                               }
+                       }
                }
 
-               [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               public extern static long ReadInt64 (IntPtr ptr, int ofs);
+               public static long ReadInt64 (IntPtr ptr, int ofs) {
+                       if ((IntPtr.Add (ptr, ofs)).ToInt32 () % 8 == 0) {
+                               unsafe {
+                                       return *(long*)(IntPtr.Add (ptr, ofs));
+                               }
+                       } else {
+                               unsafe {
+                                       long s;
+                                       String.memcpy ((byte*)&s, (byte*)(IntPtr.Add (ptr, ofs)), 8);
+                                       return s;
+                               }
+                       }
+               }
 
                [ReliabilityContractAttribute (Consistency.WillNotCorruptState, Cer.Success)]
                [MonoTODO]
@@ -775,8 +847,12 @@ namespace System.Runtime.InteropServices
                }
                
                [ReliabilityContractAttribute (Consistency.WillNotCorruptState, Cer.Success)]
-               [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               public extern static IntPtr ReadIntPtr (IntPtr ptr, int ofs);
+               public static IntPtr ReadIntPtr (IntPtr ptr, int ofs) {
+                       if (IntPtr.Size == 4)
+                               return (IntPtr)ReadInt32 (ptr, ofs);
+                       else
+                               return (IntPtr)ReadInt64 (ptr, ofs);
+               }
 
                [ReliabilityContractAttribute (Consistency.WillNotCorruptState, Cer.Success)]
                [MonoTODO]
@@ -1009,11 +1085,16 @@ namespace System.Runtime.InteropServices
 
                public static void WriteByte (IntPtr ptr, byte val)
                {
-                       WriteByte (ptr, 0, val);
+                       unsafe {
+                               *(byte*)ptr = val;
+                       }
                }
 
-               [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               public extern static void WriteByte (IntPtr ptr, int ofs, byte val);
+               public static void WriteByte (IntPtr ptr, int ofs, byte val) {
+                       unsafe {
+                               *(byte*)(IntPtr.Add (ptr, ofs)) = val;
+                       }
+               }
 
                [MonoTODO]
                [SuppressUnmanagedCodeSecurity]
@@ -1024,11 +1105,28 @@ namespace System.Runtime.InteropServices
 
                public static void WriteInt16 (IntPtr ptr, short val)
                {
-                       WriteInt16 (ptr, 0, val);
+                       if ((uint)ptr % 2 == 0) {
+                               unsafe {
+                                       *(short*)ptr = val;
+                               }
+                       } else {
+                               unsafe {
+                                       String.memcpy ((byte*)ptr, (byte*)&val, 2);
+                               }
+                       }
                }
 
-               [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               public extern static void WriteInt16 (IntPtr ptr, int ofs, short val);
+               public static void WriteInt16 (IntPtr ptr, int ofs, short val) {
+                       if ((IntPtr.Add (ptr, ofs)).ToInt32 () % 2 == 0) {
+                               unsafe {
+                                       *(short*)(IntPtr.Add (ptr, ofs)) = val;
+                               }
+                       } else {
+                               unsafe {
+                                       String.memcpy ((byte*)(IntPtr.Add (ptr, ofs)), (byte*)&val, 2);
+                               }
+                       }
+               }
 
                [MonoTODO]
                [SuppressUnmanagedCodeSecurity]
@@ -1039,12 +1137,12 @@ namespace System.Runtime.InteropServices
 
                public static void WriteInt16 (IntPtr ptr, char val)
                {
-                       WriteInt16 (ptr, 0, val);
+                       WriteInt16 (ptr, 0, (short)val);
                }
 
-               [MonoTODO]
-               [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               public extern static void WriteInt16 (IntPtr ptr, int ofs, char val);
+               public static void WriteInt16 (IntPtr ptr, int ofs, char val) {
+                       WriteInt16 (ptr, ofs, (short)val);
+               }
 
                [MonoTODO]
                public static void WriteInt16([In, Out] object ptr, int ofs, char val)
@@ -1054,11 +1152,28 @@ namespace System.Runtime.InteropServices
 
                public static void WriteInt32 (IntPtr ptr, int val)
                {
-                       WriteInt32 (ptr, 0, val);
+                       if ((uint)ptr % 4 == 0) {
+                               unsafe {
+                                       *(int*)ptr = val;
+                               }
+                       } else {
+                               unsafe {
+                                       String.memcpy ((byte*)ptr, (byte*)&val, 4);
+                               }
+                       }
                }
 
-               [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               public extern static void WriteInt32 (IntPtr ptr, int ofs, int val);
+               public static void WriteInt32 (IntPtr ptr, int ofs, int val) {
+                       if ((IntPtr.Add (ptr, ofs)).ToInt32 () % 4 == 0) {
+                               unsafe {
+                                       *(int*)(IntPtr.Add (ptr, ofs)) = val;
+                               }
+                       } else {
+                               unsafe {
+                                       String.memcpy ((byte*)(IntPtr.Add (ptr, ofs)), (byte*)&val, 4);
+                               }
+                       }
+               }
 
                [MonoTODO]
                [SuppressUnmanagedCodeSecurity]
@@ -1069,11 +1184,29 @@ namespace System.Runtime.InteropServices
 
                public static void WriteInt64 (IntPtr ptr, long val)
                {
-                       WriteInt64 (ptr, 0, val);
+                       // See ReadInt64 ()
+                       if ((uint)ptr % 8 == 0) {
+                               unsafe {
+                                       *(long*)ptr = val;
+                               }
+                       } else {
+                               unsafe {
+                                       String.memcpy ((byte*)ptr, (byte*)&val, 8);
+                               }
+                       }
                }
 
-               [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               public extern static void WriteInt64 (IntPtr ptr, int ofs, long val);
+               public static void WriteInt64 (IntPtr ptr, int ofs, long val) {
+                       if ((IntPtr.Add (ptr, ofs)).ToInt32 () % 8 == 0) {
+                               unsafe {
+                                       *(long*)(IntPtr.Add (ptr, ofs)) = val;
+                               }
+                       } else {
+                               unsafe {
+                                       String.memcpy ((byte*)(IntPtr.Add (ptr, ofs)), (byte*)&val, 8);
+                               }
+                       }
+               }
 
                [MonoTODO]
                [SuppressUnmanagedCodeSecurity]
@@ -1087,8 +1220,12 @@ namespace System.Runtime.InteropServices
                        WriteIntPtr (ptr, 0, val);
                }
 
-               [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               public extern static void WriteIntPtr (IntPtr ptr, int ofs, IntPtr val);
+               public static void WriteIntPtr (IntPtr ptr, int ofs, IntPtr val) {
+                       if (IntPtr.Size == 4)
+                               WriteInt32 (ptr, ofs, (int)val);
+                       else
+                               WriteInt64 (ptr, ofs, (long)val);
+               }
 
                [MonoTODO]
                public static void WriteIntPtr([In, Out, MarshalAs(UnmanagedType.AsAny)] object ptr, int ofs, IntPtr val)
index db82bdcf924154678b2d96f359d323b04c80f515..2f90fbd131be5a982ef04f7d984020f5b257d767 100644 (file)
@@ -2808,8 +2808,14 @@ namespace System
                                return;
                        
                        T [] a = new T [newSize];
-                       if (length != 0)
-                               FastCopy (arr, 0, a, 0, Math.Min (newSize, length));
+                       int tocopy = Math.Min (newSize, length);
+
+                       if (tocopy < 9) {
+                               for (int i = 0; i < tocopy; ++i)
+                                       UnsafeStore (a, i, UnsafeLoad (arr, i));
+                       } else {
+                               FastCopy (arr, 0, a, 0, tocopy);
+                       }
                        array = a;
                }
                
index 1b36f47d372556da378adc0b7f3946659d67d0d6..e8ca505de18e06bdaa06e9fad7c63672b0a9d95c 100644 (file)
@@ -224,6 +224,12 @@ namespace System
                {
                        return (IntPtr) (unchecked (((byte *) pointer) - offset));
                }
+#else
+               /* Needed by Marshal.cs */
+               internal static IntPtr Add (IntPtr pointer, int offset)
+               {
+                       return (IntPtr) (unchecked (((byte *) pointer) + offset));
+               }
 #endif
        }
 }
index bb401e4c6d8095c29cf0de6abedb5d36f0c21c1a..1a904931d01b694b2ee672353ac5917034b58b96 100644 (file)
@@ -258,6 +258,61 @@ namespace MonoTests.System.Runtime.InteropServices
                        Assert.AreEqual (19, s.Length, "#2");
                }
 
+               [Test]
+               public void ReadIntByte ()
+               {
+                       IntPtr ptr = Marshal.AllocHGlobal (4);
+                       try {
+                               Marshal.WriteByte (ptr, 0, 0x1);
+                               Marshal.WriteByte (ptr, 1, 0x2);
+                               Assert.AreEqual (0x1, Marshal.ReadByte (ptr));
+                               Assert.AreEqual (0x1, Marshal.ReadByte (ptr, 0));
+                               Assert.AreEqual (0x2, Marshal.ReadByte (ptr, 1));
+                       } finally {
+                               Marshal.FreeHGlobal (ptr);
+                       }
+               }
+
+               [Test]
+               public void ReadInt16 ()
+               {
+                       IntPtr ptr = Marshal.AllocHGlobal (64);
+                       try {
+                               Marshal.WriteInt16 (ptr, 0, 0x1234);
+                               Marshal.WriteInt16 (ptr, 2, 0x4567);
+                               Marshal.WriteInt16 (ptr, 5, 0x4567);
+                               Assert.AreEqual (0x1234, Marshal.ReadInt16 (ptr));
+                               Assert.AreEqual (0x1234, Marshal.ReadInt16 (ptr, 0));
+                               Assert.AreEqual (0x4567, Marshal.ReadInt16 (ptr, 2));
+#if NET_4_5
+                               Assert.AreEqual (0x4567, Marshal.ReadInt16 ((ptr + 5)));
+#endif
+                               Assert.AreEqual (0x4567, Marshal.ReadInt16 (ptr, 5));
+                       } finally {
+                               Marshal.FreeHGlobal (ptr);
+                       }
+               }
+
+               [Test]
+               public void ReadInt32 ()
+               {
+                       IntPtr ptr = Marshal.AllocHGlobal (64);
+                       try {
+                               Marshal.WriteInt32 (ptr, 0, 0x12345678);
+                               Marshal.WriteInt32 (ptr, 4, 0x77654321);
+                               Marshal.WriteInt32 (ptr, 10, 0x77654321);
+                               Assert.AreEqual (0x12345678, Marshal.ReadInt32 (ptr));
+                               Assert.AreEqual (0x12345678, Marshal.ReadInt32 (ptr, 0));
+                               Assert.AreEqual (0x77654321, Marshal.ReadInt32 (ptr, 4));
+#if NET_4_5
+                               Assert.AreEqual (0x77654321, Marshal.ReadInt32 ((ptr + 10)));
+#endif
+                               Assert.AreEqual (0x77654321, Marshal.ReadInt32 (ptr, 10));
+                       } finally {
+                               Marshal.FreeHGlobal (ptr);
+                       }
+               }
+
                [Test]
                public void ReadInt32_Endian ()
                {
@@ -278,6 +333,21 @@ namespace MonoTests.System.Runtime.InteropServices
                        }
                }
 
+               [Test]
+               public void ReadInt64 ()
+               {
+                       IntPtr ptr = Marshal.AllocHGlobal (16);
+                       try {
+                               Marshal.WriteInt64 (ptr, 0, 0x12345678ABCDEFL);
+                               Marshal.WriteInt64 (ptr, 8, 0x87654321ABCDEFL);
+                               Assert.AreEqual (0x12345678ABCDEFL, Marshal.ReadInt64 (ptr));
+                               Assert.AreEqual (0x12345678ABCDEFL, Marshal.ReadInt64 (ptr, 0));
+                               Assert.AreEqual (0x87654321ABCDEFL, Marshal.ReadInt64 (ptr, 8));
+                       } finally {
+                               Marshal.FreeHGlobal (ptr);
+                       }
+               }
+
                [Test]
                [Category ("MobileNotWorking")]
                public void BSTR_Roundtrip ()
diff --git a/mcs/errors/cs1001-8.cs b/mcs/errors/cs1001-8.cs
new file mode 100644 (file)
index 0000000..2462ee4
--- /dev/null
@@ -0,0 +1,10 @@
+// CS1001: Unexpected symbol `,', expecting identifier
+// Line: 8
+
+static class Converter
+{
+       static Dictionary<Options, string> options = new Dictionary<Options, string> () 
+       {
+               { Options., "I am completed!" },
+       };
+}
\ No newline at end of file
diff --git a/mcs/errors/cs1502-18.cs b/mcs/errors/cs1502-18.cs
new file mode 100644 (file)
index 0000000..4e1a0da
--- /dev/null
@@ -0,0 +1,18 @@
+// CS1502: The best overloaded method match for `X.Add(params object[])' has some invalid arguments
+// Line: 8
+
+class X
+{
+       public static void Main ()
+       {
+               Add (Foo (), Foo ());
+       }
+
+       public static void Add (params object[] args)
+       {
+       }
+
+       static void Foo ()
+       {
+       }
+}
\ No newline at end of file
diff --git a/mcs/errors/cs1525-54.cs b/mcs/errors/cs1525-54.cs
new file mode 100644 (file)
index 0000000..faf331e
--- /dev/null
@@ -0,0 +1,10 @@
+// CS1525: Unexpected symbol `}'
+// Line: 8
+
+class MainClass
+{
+       public string Test ()
+       {
+               return true ? "Hello" :
+       }
+}
index fe16344ae0dccfeac67792434e9433441d1ded99..7b7ba0b53225830a7cdc6ca1168c69bce13f8078 100644 (file)
@@ -569,6 +569,9 @@ namespace Mono.CSharp {
                protected virtual void EmitHoistedParameters (EmitContext ec, List<HoistedParameter> hoisted)
                {
                        foreach (HoistedParameter hp in hoisted) {
+                               if (hp == null)
+                                       continue;
+
                                //
                                // Parameters could be proxied via local fields for value type storey
                                //
@@ -851,6 +854,8 @@ namespace Mono.CSharp {
                        }
                }
 
+               public bool IsAssigned { get; set; }
+
                public ParameterReference Parameter {
                        get {
                                return parameter;
index 01a545d622ac0d02f7944d8c4688260317bd04fc..a13adb2ef79335f5e47d7394c9d4d7cea8832dd0 100644 (file)
@@ -17,7 +17,6 @@ using System.Collections.Generic;
 using System.Runtime.InteropServices;
 using System.Security;
 using System.Security.Permissions;
-using System.Linq;
 using System.Text;
 using System.Diagnostics;
 using Mono.CompilerServices.SymbolWriter;
@@ -2503,7 +2502,7 @@ namespace Mono.CSharp
                /// <summary>
                /// Defines the default constructors 
                /// </summary>
-               protected Constructor DefineDefaultConstructor (bool is_static)
+               protected virtual Constructor DefineDefaultConstructor (bool is_static)
                {
                        // The default instance constructor is public
                        // If the class is abstract, the default constructor is protected
index 9330a3eb02da5bbc0cbab366565604f40be949c1..902690017e992da6e112221bbd8078cc1d7751c8 100644 (file)
@@ -4337,6 +4337,14 @@ conditional_expression
                $$ = new Conditional (new BooleanExpression ((Expression) $1), (Expression) $3, null, GetLocation ($2));
                lbag.AddLocation ($$, GetLocation ($4));
          }
+       | null_coalescing_expression INTERR expression COLON CLOSE_BRACE
+         {
+               Error_SyntaxError (Token.CLOSE_BRACE);
+
+               $$ = new Conditional (new BooleanExpression ((Expression) $1), (Expression) $3, null, GetLocation ($2));
+               lbag.AddLocation ($$, GetLocation ($4));
+               lexer.putback ('}');
+         }
        ;
 
 assignment_expression
@@ -5633,7 +5641,7 @@ for_initializer
                $$ = current_variable;
                if ($4 != null)
                        lbag.AddLocation (current_variable, PopLocation ());
-                       
+
                current_variable = null;
          }
        | statement_expression_list
@@ -5849,7 +5857,7 @@ yield_statement
                        FeatureIsNotAvailable (lt.Location, "iterators");
                }
                
-               current_block.Explicit.RegisterIteratorYield ();
+               current_block.ParametersBlock.TopBlock.IsIterator = true;
                $$ = new YieldBreak (lt.Location);
                lbag.AddStatement ($$, GetLocation ($2), GetLocation ($3));
          }
index e8bd8554dcd23882a08ba5ec0c7a8547a430aa7d..5644adb14c2f24df1ae87109b0eea92d682c9bfc 100644 (file)
@@ -4555,17 +4555,18 @@ namespace Mono.CSharp {
                                // It can be applicable in expanded form (when not doing exact match like for delegates)
                                //
                                if (score != 0 && (p_mod & Parameter.Modifier.PARAMS) != 0 && (restrictions & Restrictions.CovariantDelegate) == 0) {
-                                       if (!params_expanded_form)
+                                       if (!params_expanded_form) {
                                                pt = ((ElementTypeSpec) pt).Element;
+                                       }
 
                                        if (score > 0)
                                                score = IsArgumentCompatible (ec, a, Parameter.Modifier.NONE, pt);
 
-                                       if (score == 0) {
-                                               params_expanded_form = true;
-                                       } else if (score < 0) {
+                                       if (score < 0) {
                                                params_expanded_form = true;
                                                dynamicArgument = true;
+                                       } else if (score == 0 || arg_count > pd.Count) {
+                                               params_expanded_form = true;
                                        }
                                }
 
index a43e4ab7dc84ee792573907ed88c4e4add0954b9..5047b891a4e9172bf8fba9821c77bc514e7c475e 100644 (file)
@@ -5184,6 +5184,9 @@ namespace Mono.CSharp
 
                void SetAssigned (ResolveContext ec)
                {
+                       if (Parameter.HoistedVariant != null)
+                               Parameter.HoistedVariant.IsAssigned = true;
+
                        if (HasOutModifier && ec.DoFlowAnalysis)
                                ec.CurrentBranching.SetAssigned (VariableInfo);
                }
index dcbf10edf722bb4a6bf635406f9e62d75466939f..bb7d4ab86f107f24c75fafc460fff0343ffbced8 100644 (file)
@@ -245,7 +245,7 @@ namespace Mono.CSharp
 
                                                for (int i = 0; i < host.hoisted_params.Count; ++i) {
                                                        HoistedParameter hp = host.hoisted_params [i];
-                                                       HoistedParameter hp_cp = host.hoisted_params_copy [i];
+                                                       HoistedParameter hp_cp = host.hoisted_params_copy [i] ?? hp;
 
                                                        FieldExpr from = new FieldExpr (hp_cp.Field, loc);
                                                        from.InstanceExpression = new CompilerGeneratedThis (ec.CurrentType, loc);
@@ -431,6 +431,13 @@ namespace Mono.CSharp
                        get { return hoisted_params; }
                }
 
+               protected override Constructor DefineDefaultConstructor (bool is_static)
+               {
+                       var ctor = base.DefineDefaultConstructor (is_static);
+                       ctor.ModFlags |= Modifiers.DEBUGGER_HIDDEN;
+                       return ctor;
+               }
+
                protected override TypeSpec[] ResolveBaseTypes (out FullNamedExpression base_class)
                {
                        var mtype = Iterator.OriginalIteratorType;
@@ -469,17 +476,26 @@ namespace Mono.CSharp
                        current_field = AddCompilerGeneratedField ("$current", iterator_type_expr);
                        disposing_field = AddCompilerGeneratedField ("$disposing", new TypeExpression (Compiler.BuiltinTypes.Bool, Location));
 
-                       if (hoisted_params != null) {
+                       if (Iterator.IsEnumerable && hoisted_params != null) {
                                //
                                // Iterators are independent, each GetEnumerator call has to
                                // create same enumerator therefore we have to keep original values
                                // around for re-initialization
                                //
-                               // TODO: Do it for assigned/modified parameters only
-                               //
                                hoisted_params_copy = new List<HoistedParameter> (hoisted_params.Count);
                                foreach (HoistedParameter hp in hoisted_params) {
-                                       hoisted_params_copy.Add (new HoistedParameter (hp, "<$>" + hp.Field.Name));
+
+                                       //
+                                       // Don't create field copy for unmodified captured parameters
+                                       //
+                                       HoistedParameter hp_copy;
+                                       if (hp.IsAssigned) {
+                                               hp_copy = new HoistedParameter (hp, "<$>" + hp.Field.Name);
+                                       } else {
+                                               hp_copy = null;
+                                       }
+
+                                       hoisted_params_copy.Add (hp_copy);
                                }
                        }
 
@@ -565,7 +581,8 @@ namespace Mono.CSharp
                protected override void EmitHoistedParameters (EmitContext ec, List<HoistedParameter> hoisted)
                {
                        base.EmitHoistedParameters (ec, hoisted);
-                       base.EmitHoistedParameters (ec, hoisted_params_copy);
+                       if (hoisted_params_copy != null)
+                               base.EmitHoistedParameters (ec, hoisted_params_copy);
                }
        }
 
index eec04bb687b4a7d633138b887e467c9ffe249044..6a8f29a6d2a772c7abfe7f52cb7dc4b5017c1cfb 100644 (file)
@@ -2059,7 +2059,8 @@ namespace Mono.CSharp {
                        HasAsyncModifier = 1 << 10,
                        Resolved = 1 << 11,
                        YieldBlock = 1 << 12,
-                       AwaitBlock = 1 << 13
+                       AwaitBlock = 1 << 13,
+                       Iterator = 1 << 14
                }
 
                public Block Parent;
@@ -2664,6 +2665,8 @@ namespace Mono.CSharp {
 
                public void RegisterIteratorYield ()
                {
+                       ParametersBlock.TopBlock.IsIterator = true;
+
                        var block = this;
                        while ((block.flags & Flags.YieldBlock) == 0) {
                                block.flags |= Flags.YieldBlock;
@@ -3207,7 +3210,10 @@ namespace Mono.CSharp {
 
                public bool IsIterator {
                        get {
-                               return HasYield;
+                               return (flags & Flags.Iterator) != 0;
+                       }
+                       set {
+                               flags = value ? flags | Flags.Iterator : flags & ~Flags.Iterator;
                        }
                }
 
index d97db884e0096d91b202b3c3e8fecdaa358b4b19..d0f29b72b54df41af28b9262ba41469ab89ff6eb 100644 (file)
   <test name="gtest-062.cs">\r
     <type name="X">\r
       <method name="IEnumerable`1 Test(Int32, Int64)" attrs="134">\r
-        <size>51</size>\r
+        <size>44</size>\r
       </method>\r
       <method name="Int32 Main()" attrs="150">\r
         <size>95</size>\r
   <test name="gtest-163.cs">\r
     <type name="Foo`1[T]">\r
       <method name="IEnumerator`1 getEnumerator(Int32)" attrs="134">\r
-        <size>29</size>\r
+        <size>22</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
         <size>7</size>\r
         <size>2</size>\r
       </method>\r
       <method name="IEnumerable get_Item(Int32)" attrs="2177">\r
-        <size>37</size>\r
+        <size>30</size>\r
       </method>\r
       <method name="Void set_Item(Int32, IEnumerable)" attrs="2177">\r
         <size>2</size>\r
   <test name="gtest-183.cs">\r
     <type name="test.Test`1[T]">\r
       <method name="IEnumerable`1 Lookup(T)" attrs="134">\r
-        <size>37</size>\r
+        <size>30</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
         <size>7</size>\r
     </type>\r
     <type name="Test5.Test">\r
       <method name="IEnumerable`1 Replace[T](T)" attrs="150">\r
-        <size>37</size>\r
+        <size>30</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
         <size>7</size>\r
     </type>\r
     <type name="Test6.Test">\r
       <method name="IEnumerable`1 Replace[T](T)" attrs="150">\r
-        <size>37</size>\r
+        <size>30</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
         <size>7</size>\r
     </type>\r
     <type name="Test7.Test">\r
       <method name="IEnumerable`1 Replace[T](T[])" attrs="150">\r
-        <size>37</size>\r
+        <size>30</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
         <size>7</size>\r
   <test name="gtest-193.cs">\r
     <type name="OrderedMultiDictionary`2[T,U]">\r
       <method name="IEnumerator`1 EnumerateKeys(RedBlackTree`1+RangeTester[System.Collections.Generic.KeyValuePair`2[T,U]])" attrs="129">\r
-        <size>36</size>\r
+        <size>29</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
         <size>7</size>\r
     </type>\r
     <type name="OrderedMultiDictionary`2[T,U]">\r
       <method name="IEnumerator`1 EnumerateKeys(RedBlackTree`1+RangeTester[System.Collections.Generic.KeyValuePair`2[T,U]])" attrs="129">\r
-        <size>36</size>\r
+        <size>29</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
         <size>7</size>\r
         <size>99</size>\r
       </method>\r
       <method name="IEnumerable`1 Map[Aa,Af,Rf,Rr](Fun`2[Af,Rf], IEnumerable`1)" attrs="150">\r
-        <size>51</size>\r
+        <size>37</size>\r
       </method>\r
       <method name="IEnumerable`1 FromTo(Int32, Int32)" attrs="150">\r
-        <size>51</size>\r
+        <size>37</size>\r
       </method>\r
       <method name="System.String &lt;Main&gt;m__0(Int32)" attrs="145">\r
         <size>22</size>\r
     </type>\r
     <type name="ConvertHelper">\r
       <method name="IEnumerator`1 Test[S,T](S)" attrs="150">\r
-        <size>29</size>\r
+        <size>22</size>\r
       </method>\r
       <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
   <test name="gtest-anontype-13.cs">\r
     <type name="Test">\r
       <method name="IEnumerable`1 Select[T](System.Array, System.Func`2[System.Object,T])" attrs="150">\r
-        <size>51</size>\r
+        <size>37</size>\r
       </method>\r
       <method name="Void Main()" attrs="150">\r
         <size>182</size>\r
         <size>66</size>\r
       </method>\r
       <method name="IEnumerable`1 Test[T](Int32)" attrs="145">\r
-        <size>37</size>\r
+        <size>30</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
         <size>7</size>\r
         <size>67</size>\r
       </method>\r
       <method name="IEnumerable`1 GetPersons[T](IEnumerable`1, Int32)" attrs="145">\r
-        <size>51</size>\r
+        <size>37</size>\r
       </method>\r
       <method name="Boolean Test[T](T, System.Linq.Expressions.Expression`1[System.Func`2[T,System.Boolean]])" attrs="145">\r
         <size>21</size>\r
         <size>30</size>\r
       </method>\r
       <method name="IEnumerable`1 Annotations(System.Type)" attrs="134">\r
-        <size>44</size>\r
+        <size>37</size>\r
       </method>\r
       <method name="Void Main()" attrs="150">\r
         <size>15</size>\r
         <size>32</size>\r
       </method>\r
       <method name="IEnumerable`1 TestRoutine[T](IEnumerable`1, Foo`1[T])" attrs="150">\r
-        <size>51</size>\r
+        <size>37</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
         <size>7</size>\r
         <size>16</size>\r
       </method>\r
       <method name="IEnumerable`1 CreateUnfoldrIterator[TSource,TResult](TSource, System.Func`2[TSource,System.Nullable`1[System.Collections.Generic.KeyValuePair`2[TResult,TSource]]])" attrs="145">\r
-        <size>51</size>\r
+        <size>44</size>\r
       </method>\r
     </type>\r
     <type name="Mono.Rocks.Test">\r
   <test name="gtest-iter-09.cs">\r
     <type name="Test">\r
       <method name="IEnumerable`1 Create[T](T[,])" attrs="145">\r
-        <size>37</size>\r
+        <size>30</size>\r
       </method>\r
       <method name="Int32 Main()" attrs="150">\r
         <size>89</size>\r
   <test name="gtest-iter-10.cs">\r
     <type name="Test">\r
       <method name="IEnumerable`1 FromTo(Int32, Int32)" attrs="145">\r
-        <size>51</size>\r
+        <size>44</size>\r
       </method>\r
       <method name="Int32 Main()" attrs="150">\r
         <size>185</size>\r
         <size>2</size>\r
       </method>\r
       <method name="IEnumerable`1 Merge[T](IEnumerator`1)" attrs="150">\r
-        <size>37</size>\r
+        <size>30</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
         <size>7</size>\r
         <size>20</size>\r
       </method>\r
       <method name="IEnumerable`1 Filter(System.Func`2[T,System.Boolean])" attrs="134">\r
-        <size>44</size>\r
+        <size>37</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
         <size>7</size>\r
   <test name="gtest-iter-15.cs">\r
     <type name="C`1[TFirst]">\r
       <method name="IEnumerable`1 GetEnumerable[V](IEnumerable`1)" attrs="131">\r
-        <size>37</size>\r
+        <size>30</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
         <size>7</size>\r
     </type>\r
     <type name="Test.Derived">\r
       <method name="IEnumerable`1 GetStuff(Int32)" attrs="198">\r
-        <size>44</size>\r
+        <size>37</size>\r
       </method>\r
       <method name="IEnumerable`1 &lt;GetStuff&gt;__BaseCallProxy0(Int32)" attrs="129">\r
         <size>15</size>\r
     </type>\r
     <type name="Test.SpecialDerived">\r
       <method name="IEnumerable`1 GetStuff(Int32)" attrs="198">\r
-        <size>44</size>\r
+        <size>37</size>\r
       </method>\r
       <method name="Void Main()" attrs="150">\r
         <size>65</size>\r
   <test name="gtest-iter-19.cs">\r
     <type name="IEnumerableTransform">\r
       <method name="IEnumerable`1 Transform[TOut](IEnumerable`1, IEnumerableTransform+EmitterFunc`1[TOut])" attrs="150">\r
-        <size>51</size>\r
+        <size>37</size>\r
       </method>\r
       <method name="IEnumerableTransform+EmitterFunc`1[TOut] Emit[TOut](TOut)" attrs="150">\r
         <size>34</size>\r
   <test name="gtest-iter-28.cs">\r
     <type name="A">\r
       <method name="IEnumerable`1 Test(B)" attrs="134">\r
-        <size>44</size>\r
+        <size>37</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
         <size>18</size>\r
     </type>\r
     <type name="NameCollisionTest.Ex">\r
       <method name="IEnumerable`1 Foo[T,TR](IEnumerable`1, System.Func`2[T,TR])" attrs="150">\r
-        <size>51</size>\r
+        <size>37</size>\r
       </method>\r
     </type>\r
     <type name="NameCollisionTest.C">\r
     </type>\r
     <type name="Foo">\r
       <method name="IEnumerable`1 Test(Foo)" attrs="134">\r
-        <size>49</size>\r
+        <size>42</size>\r
       </method>\r
       <method name="Void Hello(Int32)" attrs="134">\r
         <size>20</size>\r
     </type>\r
     <type name="X">\r
       <method name="IEnumerable`1 Test(Int32)" attrs="150">\r
-        <size>37</size>\r
+        <size>30</size>\r
       </method>\r
       <method name="Void Main()" attrs="150">\r
         <size>62</size>\r
         <size>38</size>\r
       </method>\r
       <method name="IEnumerable`1 op_Addition(Test, Test)" attrs="2198">\r
-        <size>51</size>\r
+        <size>37</size>\r
       </method>\r
       <method name="IEnumerable`1 get_Foo()" attrs="2182">\r
         <size>23</size>\r
   <test name="test-anon-110.cs">\r
     <type name="X">\r
       <method name="IEnumerable`1 Test[T](T, T)" attrs="134">\r
-        <size>51</size>\r
+        <size>44</size>\r
       </method>\r
       <method name="Int32 Main()" attrs="150">\r
         <size>110</size>\r
   <test name="test-anon-50.cs">\r
     <type name="Test">\r
       <method name="IEnumerable Foo(Int32)" attrs="134">\r
-        <size>37</size>\r
+        <size>30</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
         <size>7</size>\r
   <test name="test-anon-52.cs">\r
     <type name="X">\r
       <method name="IEnumerator GetIt(System.Int32[])" attrs="145">\r
-        <size>29</size>\r
+        <size>22</size>\r
       </method>\r
       <method name="Int32 Main()" attrs="150">\r
         <size>40</size>\r
   <test name="test-anon-63.cs">\r
     <type name="X">\r
       <method name="IEnumerator GetIt(System.Int32[])" attrs="145">\r
-        <size>29</size>\r
+        <size>22</size>\r
       </method>\r
       <method name="Int32 Main()" attrs="150">\r
         <size>40</size>\r
   <test name="test-async-30.cs">\r
     <type name="C">\r
       <method name="IEnumerable`1 Test(System.String)" attrs="129">\r
-        <size>37</size>\r
+        <size>30</size>\r
       </method>\r
       <method name="IEnumerable`1 Test2()" attrs="129">\r
         <size>23</size>\r
   <test name="test-iter-03.cs">\r
     <type name="X">\r
       <method name="IEnumerable GetIt(System.Int32[])" attrs="145">\r
-        <size>37</size>\r
+        <size>30</size>\r
       </method>\r
       <method name="IEnumerable GetMulti(System.Int32[,])" attrs="145">\r
-        <size>37</size>\r
+        <size>30</size>\r
       </method>\r
       <method name="Int32 Main()" attrs="150">\r
         <size>275</size>\r
   <test name="test-iter-04.cs">\r
     <type name="X">\r
       <method name="IEnumerable GetRange(Int32, Int32)" attrs="145">\r
-        <size>51</size>\r
+        <size>37</size>\r
       </method>\r
       <method name="Void Main()" attrs="150">\r
         <size>104</size>\r
   <test name="test-iter-06.cs">\r
     <type name="S">\r
       <method name="IEnumerable Get(Int32)" attrs="134">\r
-        <size>49</size>\r
+        <size>42</size>\r
       </method>\r
       <method name="IEnumerable GetS(Int32)" attrs="150">\r
-        <size>37</size>\r
+        <size>30</size>\r
       </method>\r
     </type>\r
     <type name="X">\r
       <method name="IEnumerable Get(Int32)" attrs="129">\r
-        <size>37</size>\r
+        <size>30</size>\r
       </method>\r
       <method name="IEnumerable GetS(Int32)" attrs="145">\r
-        <size>37</size>\r
+        <size>30</size>\r
       </method>\r
       <method name="Int32 Main()" attrs="150">\r
         <size>449</size>\r
   <test name="test-iter-07.cs">\r
     <type name="Test">\r
       <method name="IEnumerable Foo(Int32)" attrs="134">\r
-        <size>37</size>\r
+        <size>30</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
         <size>7</size>\r
       <method name="Void Reset()" attrs="486">\r
         <size>6</size>\r
       </method>\r
-      <method name="Void .ctor()" attrs="6278">\r
-        <size>7</size>\r
-      </method>\r
       <method name="Void &lt;&gt;__Finally0()" attrs="129">\r
         <size>13</size>\r
       </method>\r
       <method name="Void &lt;&gt;__Finally2()" attrs="129">\r
         <size>13</size>\r
       </method>\r
+      <method name="Void .ctor()" attrs="6278">\r
+        <size>7</size>\r
+      </method>\r
     </type>\r
   </test>\r
   <test name="test-iter-08.cs">\r
     </type>\r
     <type name="X">\r
       <method name="IEnumerable Test(Int32, Int32)" attrs="150">\r
-        <size>51</size>\r
+        <size>37</size>\r
       </method>\r
       <method name="Int32 Main()" attrs="150">\r
         <size>210</size>\r
         <size>2</size>\r
       </method>\r
       <method name="IEnumerable get_Item(Int32)" attrs="2177">\r
-        <size>37</size>\r
+        <size>30</size>\r
       </method>\r
       <method name="Void set_Item(Int32, IEnumerable)" attrs="2177">\r
         <size>2</size>\r
   <test name="test-iter-18.cs">\r
     <type name="test">\r
       <method name="IEnumerable testen(Int32)" attrs="134">\r
-        <size>37</size>\r
+        <size>30</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
         <size>7</size>\r
   <test name="test-iter-21.cs">\r
     <type name="X">\r
       <method name="IEnumerable GetIt(System.Int32[])" attrs="145">\r
-        <size>37</size>\r
+        <size>30</size>\r
       </method>\r
       <method name="Int32 Main()" attrs="150">\r
         <size>138</size>\r
         <size>26</size>\r
       </method>\r
       <method name="Boolean MoveNext()" attrs="486">\r
-        <size>75</size>\r
+        <size>60</size>\r
       </method>\r
       <method name="Void Dispose()" attrs="486">\r
         <size>1</size>\r
   <test name="test-iter-26.cs">\r
     <type name="C">\r
       <method name="IEnumerable Test(Boolean, Int32)" attrs="150">\r
-        <size>51</size>\r
+        <size>37</size>\r
       </method>\r
       <method name="Void Main()" attrs="150">\r
         <size>10</size>\r
         <size>26</size>\r
       </method>\r
       <method name="Boolean MoveNext()" attrs="486">\r
-        <size>37</size>\r
+        <size>32</size>\r
       </method>\r
       <method name="Void Dispose()" attrs="486">\r
         <size>1</size>\r
         <size>26</size>\r
       </method>\r
       <method name="Boolean MoveNext()" attrs="486">\r
-        <size>37</size>\r
+        <size>32</size>\r
       </method>\r
       <method name="Void Dispose()" attrs="486">\r
         <size>1</size>\r
         <size>26</size>\r
       </method>\r
       <method name="Boolean MoveNext()" attrs="486">\r
-        <size>37</size>\r
+        <size>32</size>\r
       </method>\r
       <method name="Void Dispose()" attrs="486">\r
         <size>1</size>\r
index e8ff58a98ca020adbdf5c9782d7ce0f32da4504a..bcc86ba335a81f90f81805fc5fd985564f742190 100644 (file)
@@ -949,7 +949,7 @@ mono_gc_get_managed_allocator (MonoVTable *vtable, gboolean for_box)
 }
 
 MonoMethod*
-mono_gc_get_managed_array_allocator (MonoVTable *vtable, int rank)
+mono_gc_get_managed_array_allocator (MonoClass *klass)
 {
        return NULL;
 }
@@ -1002,7 +1002,7 @@ mono_gc_get_managed_allocator (MonoVTable *vtable, gboolean for_box)
 }
 
 MonoMethod*
-mono_gc_get_managed_array_allocator (MonoVTable *vtable, int rank)
+mono_gc_get_managed_array_allocator (MonoClass *klass)
 {
        return NULL;
 }
index 18d05e989f61413badeca37b42db64d173457a81..39b37fd1afdbb205ff870bb27036d85e8d24743b 100644 (file)
@@ -711,7 +711,7 @@ typedef struct {
 #define MONO_SIZEOF_REMOTE_CLASS (sizeof (MonoRemoteClass) - MONO_ZERO_LEN_ARRAY * SIZEOF_VOID_P)
 
 typedef struct {
-       gulong new_object_count;
+       guint64 new_object_count;
        gulong initialized_class_count;
        gulong generic_vtable_count;
        gulong used_class_count;
index 24880dd582069d86913aa22193264a92e5ec2eb8..4cd959a1933268700cde589640e1339c9880837a 100644 (file)
@@ -220,7 +220,7 @@ typedef struct {
 } AllocatorWrapperInfo;
 
 MonoMethod* mono_gc_get_managed_allocator (MonoVTable *vtable, gboolean for_box) MONO_INTERNAL;
-MonoMethod* mono_gc_get_managed_array_allocator (MonoVTable *vtable, int rank) MONO_INTERNAL;
+MonoMethod* mono_gc_get_managed_array_allocator (MonoClass *klass) MONO_INTERNAL;
 MonoMethod *mono_gc_get_managed_allocator_by_type (int atype) MONO_INTERNAL;
 
 guint32 mono_gc_get_managed_allocator_types (void) MONO_INTERNAL;
index f0a6ef10c95fe8714d6884224cb9c6574eff6d69..cd6678866df81096b95937959855cfc45b17c35b 100644 (file)
@@ -1136,6 +1136,7 @@ mono_gc_init (void)
        MONO_GC_REGISTER_ROOT_FIXED (gc_handles [HANDLE_NORMAL].entries);
        MONO_GC_REGISTER_ROOT_FIXED (gc_handles [HANDLE_PINNED].entries);
 
+       mono_counters_register ("Created object count", MONO_COUNTER_GC | MONO_COUNTER_ULONG, &mono_stats.new_object_count);
        mono_counters_register ("Minor GC collections", MONO_COUNTER_GC | MONO_COUNTER_INT, &gc_stats.minor_gc_count);
        mono_counters_register ("Major GC collections", MONO_COUNTER_GC | MONO_COUNTER_INT, &gc_stats.major_gc_count);
        mono_counters_register ("Minor GC time", MONO_COUNTER_GC | MONO_COUNTER_TIME_INTERVAL, &gc_stats.minor_gc_time_usecs);
index 93569b9d56ba442b3f05d59377c9815e1adc9f76..5d62466ffbc6fbd04a0a3599d5832bd14a420ba5 100644 (file)
@@ -715,11 +715,6 @@ ICALL(MARSHAL_22, "QueryInterfaceInternal", ves_icall_System_Runtime_InteropServ
 #endif
 ICALL(MARSHAL_43, "ReAllocCoTaskMem", ves_icall_System_Runtime_InteropServices_Marshal_ReAllocCoTaskMem)
 ICALL(MARSHAL_23, "ReAllocHGlobal", ves_icall_System_Runtime_InteropServices_Marshal_ReAllocHGlobal)
-ICALL(MARSHAL_24, "ReadByte", ves_icall_System_Runtime_InteropServices_Marshal_ReadByte)
-ICALL(MARSHAL_25, "ReadInt16", ves_icall_System_Runtime_InteropServices_Marshal_ReadInt16)
-ICALL(MARSHAL_26, "ReadInt32", ves_icall_System_Runtime_InteropServices_Marshal_ReadInt32)
-ICALL(MARSHAL_27, "ReadInt64", ves_icall_System_Runtime_InteropServices_Marshal_ReadInt64)
-ICALL(MARSHAL_28, "ReadIntPtr", ves_icall_System_Runtime_InteropServices_Marshal_ReadIntPtr)
 #ifndef DISABLE_COM
 ICALL(MARSHAL_49, "ReleaseComObjectInternal", ves_icall_System_Runtime_InteropServices_Marshal_ReleaseComObjectInternal)
 ICALL(MARSHAL_29, "ReleaseInternal", ves_icall_System_Runtime_InteropServices_Marshal_ReleaseInternal)
@@ -730,11 +725,6 @@ ICALL(MARSHAL_32, "StringToHGlobalAnsi", ves_icall_System_Runtime_InteropService
 ICALL(MARSHAL_33, "StringToHGlobalUni", ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalUni)
 ICALL(MARSHAL_34, "StructureToPtr", ves_icall_System_Runtime_InteropServices_Marshal_StructureToPtr)
 ICALL(MARSHAL_35, "UnsafeAddrOfPinnedArrayElement", ves_icall_System_Runtime_InteropServices_Marshal_UnsafeAddrOfPinnedArrayElement)
-ICALL(MARSHAL_36, "WriteByte", ves_icall_System_Runtime_InteropServices_Marshal_WriteByte)
-ICALL(MARSHAL_37, "WriteInt16", ves_icall_System_Runtime_InteropServices_Marshal_WriteInt16)
-ICALL(MARSHAL_38, "WriteInt32", ves_icall_System_Runtime_InteropServices_Marshal_WriteInt32)
-ICALL(MARSHAL_39, "WriteInt64", ves_icall_System_Runtime_InteropServices_Marshal_WriteInt64)
-ICALL(MARSHAL_40, "WriteIntPtr", ves_icall_System_Runtime_InteropServices_Marshal_WriteIntPtr)
 ICALL(MARSHAL_41, "copy_from_unmanaged", ves_icall_System_Runtime_InteropServices_Marshal_copy_from_unmanaged)
 ICALL(MARSHAL_42, "copy_to_unmanaged", ves_icall_System_Runtime_InteropServices_Marshal_copy_to_unmanaged)
 
index 3dd967b4534c7541de8bac8b0297ec68ca94f2a7..afdfbe56aa9793f2166f9dbf1bb4268f3d4e71b8 100644 (file)
@@ -11443,122 +11443,6 @@ ves_icall_System_Runtime_InteropServices_Marshal_copy_from_unmanaged (gpointer s
        memcpy (dest_addr, src, length * element_size);
 }
 
-#if NO_UNALIGNED_ACCESS
-#define RETURN_UNALIGNED(type, addr) \
-       { \
-               type val; \
-               memcpy(&val, p + offset, sizeof(val)); \
-               return val; \
-       }
-#define WRITE_UNALIGNED(type, addr, val) \
-       memcpy(addr, &val, sizeof(type))
-#else
-#define RETURN_UNALIGNED(type, addr) \
-       return *(type*)(p + offset);
-#define WRITE_UNALIGNED(type, addr, val) \
-       (*(type *)(addr) = (val))
-#endif
-
-gpointer
-ves_icall_System_Runtime_InteropServices_Marshal_ReadIntPtr (gpointer ptr, gint32 offset)
-{
-       char *p = ptr;
-
-       MONO_ARCH_SAVE_REGS;
-
-       RETURN_UNALIGNED(gpointer, p + offset);
-}
-
-unsigned char
-ves_icall_System_Runtime_InteropServices_Marshal_ReadByte (gpointer ptr, gint32 offset)
-{
-       char *p = ptr;
-
-       MONO_ARCH_SAVE_REGS;
-
-       return *(unsigned char*)(p + offset);
-}
-
-gint16
-ves_icall_System_Runtime_InteropServices_Marshal_ReadInt16 (gpointer ptr, gint32 offset)
-{
-       char *p = ptr;
-
-       MONO_ARCH_SAVE_REGS;
-
-       RETURN_UNALIGNED(gint16, p + offset);
-}
-
-gint32
-ves_icall_System_Runtime_InteropServices_Marshal_ReadInt32 (gpointer ptr, gint32 offset)
-{
-       char *p = ptr;
-
-       MONO_ARCH_SAVE_REGS;
-
-       RETURN_UNALIGNED(gint32, p + offset);
-}
-
-gint64
-ves_icall_System_Runtime_InteropServices_Marshal_ReadInt64 (gpointer ptr, gint32 offset)
-{
-       char *p = ptr;
-
-       MONO_ARCH_SAVE_REGS;
-
-       RETURN_UNALIGNED(gint64, p + offset);
-}
-
-void
-ves_icall_System_Runtime_InteropServices_Marshal_WriteByte (gpointer ptr, gint32 offset, unsigned char val)
-{
-       char *p = ptr;
-
-       MONO_ARCH_SAVE_REGS;
-
-       *(unsigned char*)(p + offset) = val;
-}
-
-void
-ves_icall_System_Runtime_InteropServices_Marshal_WriteIntPtr (gpointer ptr, gint32 offset, gpointer val)
-{
-       char *p = ptr;
-
-       MONO_ARCH_SAVE_REGS;
-
-       WRITE_UNALIGNED(gpointer, p + offset, val);
-}
-
-void
-ves_icall_System_Runtime_InteropServices_Marshal_WriteInt16 (gpointer ptr, gint32 offset, gint16 val)
-{
-       char *p = ptr;
-
-       MONO_ARCH_SAVE_REGS;
-
-       WRITE_UNALIGNED(gint16, p + offset, val);
-}
-
-void
-ves_icall_System_Runtime_InteropServices_Marshal_WriteInt32 (gpointer ptr, gint32 offset, gint32 val)
-{
-       char *p = ptr;
-
-       MONO_ARCH_SAVE_REGS;
-
-       WRITE_UNALIGNED(gint32, p + offset, val);
-}
-
-void
-ves_icall_System_Runtime_InteropServices_Marshal_WriteInt64 (gpointer ptr, gint32 offset, gint64 val)
-{
-       char *p = ptr;
-
-       MONO_ARCH_SAVE_REGS;
-
-       WRITE_UNALIGNED(gint64, p + offset, val);
-}
-
 MonoString *
 ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi (char *ptr)
 {
index a8f7057d6294272322cbde71319577a086d3f966..3a99ac60bd70a39c93de836470411ce8cab0925e 100644 (file)
@@ -394,36 +394,6 @@ void
 ves_icall_System_Runtime_InteropServices_Marshal_copy_from_unmanaged (gpointer src, gint32 start_index,
                                                                      MonoArray *dest, gint32 length) MONO_INTERNAL;
 
-gpointer
-ves_icall_System_Runtime_InteropServices_Marshal_ReadIntPtr (gpointer ptr, gint32 offset) MONO_INTERNAL;
-
-unsigned char
-ves_icall_System_Runtime_InteropServices_Marshal_ReadByte (gpointer ptr, gint32 offset) MONO_INTERNAL;
-
-gint16
-ves_icall_System_Runtime_InteropServices_Marshal_ReadInt16 (gpointer ptr, gint32 offset) MONO_INTERNAL;
-
-gint32
-ves_icall_System_Runtime_InteropServices_Marshal_ReadInt32 (gpointer ptr, gint32 offset) MONO_INTERNAL;
-
-gint64
-ves_icall_System_Runtime_InteropServices_Marshal_ReadInt64 (gpointer ptr, gint32 offset) MONO_INTERNAL;
-
-void
-ves_icall_System_Runtime_InteropServices_Marshal_WriteByte (gpointer ptr, gint32 offset, unsigned char val) MONO_INTERNAL;
-
-void
-ves_icall_System_Runtime_InteropServices_Marshal_WriteIntPtr (gpointer ptr, gint32 offset, gpointer val) MONO_INTERNAL;
-
-void
-ves_icall_System_Runtime_InteropServices_Marshal_WriteInt16 (gpointer ptr, gint32 offset, gint16 val) MONO_INTERNAL;
-
-void
-ves_icall_System_Runtime_InteropServices_Marshal_WriteInt32 (gpointer ptr, gint32 offset, gint32 val) MONO_INTERNAL;
-
-void
-ves_icall_System_Runtime_InteropServices_Marshal_WriteInt64 (gpointer ptr, gint32 offset, gint64 val) MONO_INTERNAL;
-
 MonoString *
 ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi (char *ptr) MONO_INTERNAL;
 
index 4d48eb50adc2f72ede553b7a8d1518908fd1e073..47d541594cf9aa7956acb144d36d9a171277cedb 100644 (file)
@@ -221,7 +221,7 @@ mono_gc_get_managed_allocator (MonoVTable *vtable, gboolean for_box)
 }
 
 MonoMethod*
-mono_gc_get_managed_array_allocator (MonoVTable *vtable, int rank)
+mono_gc_get_managed_array_allocator (MonoClass *klass)
 {
        return NULL;
 }
index 55cd85bc75b084f63ec8caa3c40f9e1aaf15d814..55a472ffa44e561703d9a3ac271fdaccce8355c7 100644 (file)
@@ -953,11 +953,9 @@ mono_gc_get_managed_allocator (MonoVTable *vtable, gboolean for_box)
 }
 
 MonoMethod*
-mono_gc_get_managed_array_allocator (MonoVTable *vtable, int rank)
+mono_gc_get_managed_array_allocator (MonoClass *klass)
 {
 #ifdef MANAGED_ALLOCATION
-       MonoClass *klass = vtable->klass;
-
 #ifdef HAVE_KW_THREAD
        int tlab_next_offset = -1;
        int tlab_temp_end_offset = -1;
@@ -968,7 +966,7 @@ mono_gc_get_managed_array_allocator (MonoVTable *vtable, int rank)
                return NULL;
 #endif
 
-       if (rank != 1)
+       if (klass->rank != 1)
                return NULL;
        if (!mono_runtime_has_tls_get ())
                return NULL;
index cce9e7a28439ecc70a4d57bcecf795aa4bda37a9..55fd1e6fe09e7096f7578ab16c891b619d9934cf 100644 (file)
@@ -2841,8 +2841,6 @@ get_plt_entry (MonoAotCompile *acfg, MonoJumpInfo *patch_info)
 
                new_ji = mono_patch_info_dup_mp (acfg->mempool, patch_info);
 
-               // g_assert (mono_patch_info_equal (patch_info, new_ji));
-
                res = mono_mempool_alloc0 (acfg->mempool, sizeof (MonoPltEntry));
                res->plt_offset = acfg->plt_offset;
                res->ji = new_ji;
@@ -2858,6 +2856,10 @@ get_plt_entry (MonoAotCompile *acfg, MonoJumpInfo *patch_info)
 
                g_hash_table_insert (acfg->plt_offset_to_entry, GUINT_TO_POINTER (res->plt_offset), res);
 
+               //g_assert (mono_patch_info_equal (patch_info, new_ji));
+               //mono_print_ji (patch_info); printf ("\n");
+               //g_hash_table_print_stats (acfg->patch_to_plt_entry);
+
                acfg->plt_offset ++;
        }
 
@@ -3580,7 +3582,8 @@ add_wrappers (MonoAotCompile *acfg)
                        continue;
                }
 
-               if (klass->valuetype && !klass->generic_container && can_marshal_struct (klass)) {
+               if (klass->valuetype && !klass->generic_container && can_marshal_struct (klass) &&
+                       !(klass->nested_in && strstr (klass->nested_in->name, "<PrivateImplementationDetails>") == klass->nested_in->name)) {
                        add_method (acfg, mono_marshal_get_struct_to_ptr (klass));
                        add_method (acfg, mono_marshal_get_ptr_to_struct (klass));
                }
index 29f2e348017cabd5ca9768b998ffcda681056d63..b86678d4e2305694c31a6a5706e162f09f10af0e 100644 (file)
@@ -1397,8 +1397,9 @@ mono_decompose_array_access_opts (MonoCompile *cfg)
                                                dest = mono_emit_jit_icall (cfg, mono_array_new, iargs);
                                                dest->dreg = ins->dreg;
                                        } else {
-                                               MonoVTable *vtable = mono_class_vtable (cfg->domain, mono_array_class_get (ins->inst_newa_class, 1));
-                                               MonoMethod *managed_alloc = mono_gc_get_managed_array_allocator (vtable, 1);
+                                               MonoClass *array_class = mono_array_class_get (ins->inst_newa_class, 1);
+                                               MonoVTable *vtable = mono_class_vtable (cfg->domain, array_class);
+                                               MonoMethod *managed_alloc = mono_gc_get_managed_array_allocator (array_class);
 
                                                g_assert (vtable); /*This shall not fail since we check for this condition on OP_NEWARR creation*/
                                                NEW_VTABLECONST (cfg, iargs [0], vtable);
index 2b8a72a7ff0dcd050e9c5cd76039697430389a4b..7e0121d5778226621ec86e243031fd48d4d8f5cc 100644 (file)
@@ -7109,6 +7109,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                        gboolean emit_widen = TRUE;
                        gboolean push_res = TRUE;
                        gboolean skip_ret = FALSE;
+                       gboolean delegate_invoke = FALSE;
 
                        CHECK_OPSIZE (5);
                        token = read32 (ip + 1);
@@ -7365,6 +7366,11 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                        if (!calli && check_call_signature (cfg, fsig, sp))
                                UNVERIFIED;
 
+#ifdef MONO_ARCH_HAVE_CREATE_DELEGATE_TRAMPOLINE
+                       if (cmethod && (cmethod->klass->parent == mono_defaults.multicastdelegate_class) && !strcmp (cmethod->name, "Invoke"))
+                               delegate_invoke = TRUE;
+#endif
+
                        if (cmethod && (cfg->opt & MONO_OPT_INTRINS) && (ins = mini_emit_inst_for_sharable_method (cfg, cmethod, fsig, sp))) {
                                bblock = cfg->cbb;
                                if (!MONO_TYPE_IS_VOID (fsig->ret)) {
@@ -7719,7 +7725,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                        /* Generic sharing */
                        /* FIXME: only do this for generic methods if
                           they are not shared! */
-                       if (context_used && !imt_arg && !array_rank &&
+                       if (context_used && !imt_arg && !array_rank && !delegate_invoke &&
                                (!mono_method_is_generic_sharable_impl (cmethod, TRUE) ||
                                 !mono_class_generic_sharing_enabled (cmethod->klass)) &&
                                (!virtual || MONO_METHOD_IS_FINAL (cmethod) ||
@@ -9904,21 +9910,9 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                        if (context_used) {
                                MonoInst *args [3];
                                MonoClass *array_class = mono_array_class_get (klass, 1);
-                               /* FIXME: we cannot get a managed
-                                  allocator because we can't get the
-                                  open generic class's vtable.  We
-                                  have the same problem in
-                                  handle_alloc().  This
-                                  needs to be solved so that we can
-                                  have managed allocs of shared
-                                  generic classes. */
-                               /*
-                               MonoVTable *array_class_vtable = mono_class_vtable (cfg->domain, array_class);
-                               MonoMethod *managed_alloc = mono_gc_get_managed_array_allocator (array_class_vtable, 1);
-                               */
-                               MonoMethod *managed_alloc = NULL;
+                               MonoMethod *managed_alloc = mono_gc_get_managed_array_allocator (array_class);
 
-                               /* FIXME: Decompose later to help abcrem */
+                               /* FIXME: Use OP_NEWARR and decompose later to help abcrem */
 
                                /* vtable */
                                args [0] = emit_get_rgctx_klass (cfg, context_used,
index facd18c2494f911a5b96710d0d7f5ed94a62546a..8ef772a1b14c82c2c139ba05f0ea329e46bc9b16 100644 (file)
@@ -411,15 +411,21 @@ typedef struct {
 
 #ifndef DISABLE_LOGGING
 
-static void
-print_ji (MonoJumpInfo *ji)
+static const char* const patch_info_str[] = {
+#define PATCH_INFO(a,b) "" #a,
+#include "patch-info.h"
+#undef PATCH_INFO
+};
+
+void
+mono_print_ji (const MonoJumpInfo *ji)
 {
        switch (ji->type) {
        case MONO_PATCH_INFO_RGCTX_FETCH: {
                MonoJumpInfoRgctxEntry *entry = ji->data.rgctx_entry;
 
                printf ("[RGCTX_FETCH ");
-               print_ji (entry->data);
+               mono_print_ji (entry->data);
                printf (" - %s]", mono_rgctx_info_type_to_str (entry->info_type));
                break;
        }
@@ -430,7 +436,7 @@ print_ji (MonoJumpInfo *ji)
                break;
        }
        default:
-               printf ("[%d]", ji->type);
+               printf ("[%s]", patch_info_str [ji->type]);
                break;
        }
 }
@@ -611,7 +617,7 @@ mono_print_ins_index (int i, MonoInst *ins)
                        MonoJumpInfo *ji = (MonoJumpInfo*)call->fptr;
 
                        printf (" ");
-                       print_ji (ji);
+                       mono_print_ji (ji);
                } else if (call->fptr) {
                        MonoJitICallInfo *info = mono_find_jit_icall_by_addr (call->fptr);
                        if (info)
@@ -699,6 +705,12 @@ print_regtrack (RegTrack *t, int num)
        }
 }
 #else
+
+void
+mono_print_ji (const MonoJumpInfo *ji)
+{
+}
+
 void
 mono_print_ins_index (int i, MonoInst *ins)
 {
index 1d75429d5583dc48d8f77a4a8148e751bd64c1b6..88d6bd834e0a53d61a0b58405b2bef67cb1eb7db 100644 (file)
@@ -2983,19 +2983,42 @@ mono_patch_info_hash (gconstpointer data)
        case MONO_PATCH_INFO_IID:
        case MONO_PATCH_INFO_ADJUSTED_IID:
        case MONO_PATCH_INFO_CLASS_INIT:
+       case MONO_PATCH_INFO_GENERIC_CLASS_INIT:
        case MONO_PATCH_INFO_METHODCONST:
        case MONO_PATCH_INFO_METHOD:
        case MONO_PATCH_INFO_METHOD_JUMP:
        case MONO_PATCH_INFO_IMAGE:
        case MONO_PATCH_INFO_JIT_ICALL_ADDR:
+       case MONO_PATCH_INFO_ICALL_ADDR:
        case MONO_PATCH_INFO_FIELD:
        case MONO_PATCH_INFO_SFLDA:
        case MONO_PATCH_INFO_SEQ_POINT_INFO:
+       case MONO_PATCH_INFO_METHOD_RGCTX:
+       case MONO_PATCH_INFO_DELEGATE_TRAMPOLINE:
+       case MONO_PATCH_INFO_SIGNATURE:
                return (ji->type << 8) | (gssize)ji->data.target;
        case MONO_PATCH_INFO_GSHAREDVT_CALL:
                return (ji->type << 8) | (gssize)ji->data.gsharedvt->method;
-       default:
+       case MONO_PATCH_INFO_RGCTX_FETCH: {
+               MonoJumpInfoRgctxEntry *e = ji->data.rgctx_entry;
+
+               return (ji->type << 8) | (gssize)e->method | (e->in_mrgctx) | e->info_type | mono_patch_info_hash (e->data);
+       }
+       case MONO_PATCH_INFO_INTERRUPTION_REQUEST_FLAG:
+       case MONO_PATCH_INFO_MSCORLIB_GOT_ADDR:
+       case MONO_PATCH_INFO_GC_CARD_TABLE_ADDR:
+       case MONO_PATCH_INFO_JIT_TLS_ID:
+       case MONO_PATCH_INFO_MONITOR_ENTER:
+       case MONO_PATCH_INFO_MONITOR_EXIT:
+       case MONO_PATCH_INFO_CASTCLASS_CACHE:
                return (ji->type << 8);
+       case MONO_PATCH_INFO_SWITCH:
+               return (ji->type << 8) | ji->data.table->table_size;
+       default:
+               printf ("info type: %d\n", ji->type);
+               mono_print_ji (ji); printf ("\n");
+               g_assert_not_reached ();
+               return 0;
        }
 }
 
@@ -7146,7 +7169,6 @@ print_jit_stats (void)
                g_print ("Biggest method:         %ld (%s)\n", mono_jit_stats.biggest_method_size,
                                 mono_jit_stats.biggest_method);
 
-               g_print ("\nCreated object count:   %ld\n", mono_stats.new_object_count);
                g_print ("Delegates created:      %ld\n", mono_stats.delegate_creations);
                g_print ("Initialized classes:    %ld\n", mono_stats.initialized_class_count);
                g_print ("Used classes:           %ld\n", mono_stats.used_class_count);
index c5c60c133c0dbc4d3fa3661a10f2b87f91fd278c..1b6f5b550ec4a9284636aa8751959ba8c2cea54b 100644 (file)
@@ -1863,6 +1863,7 @@ void      mono_merge_basic_blocks           (MonoCompile *cfg, MonoBasicBlock *b
 void      mono_optimize_branches            (MonoCompile *cfg) MONO_INTERNAL;
 
 void      mono_blockset_print               (MonoCompile *cfg, MonoBitSet *set, const char *name, guint idom) MONO_INTERNAL;
+void      mono_print_ji                     (const MonoJumpInfo *ji) MONO_INTERNAL;
 void      mono_print_ins_index              (int i, MonoInst *ins) MONO_INTERNAL;
 void      mono_print_ins                    (MonoInst *ins) MONO_INTERNAL;
 void      mono_print_bb                     (MonoBasicBlock *bb, const char *msg) MONO_INTERNAL;