[Mono-bugs] [Bug 74613][Blo] New - Mono.C5 or Runtime regression

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Fri, 15 Apr 2005 01:08:15 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by mikeluwork@hotmail.com.

http://bugzilla.ximian.com/show_bug.cgi?id=74613

--- shadow/74613	2005-04-15 01:08:15.000000000 -0400
+++ shadow/74613.tmp.11062	2005-04-15 01:08:15.000000000 -0400
@@ -0,0 +1,181 @@
+Bug#: 74613
+Product: Mono: Runtime
+Version: 1.1
+OS: Windows XP
+OS Details: Windows XP Home SP2
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Blocker
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: mikeluwork@hotmail.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Summary: Mono.C5 or Runtime regression
+
+Description of Problem:
+
+The csharp source file <hash2gmono.cs> compiles fine with gmcs under both
+mono-1.1.4 and mono-1.1.6. However, the .exe file runs without any problem
+under 1.1.4 but failed quickly with 1.1.6. (source file attached)
+
+Steps to reproduce the problem:
+1. gmcs hash2gmono.cs
+2. mono hash2gmono.exe 150
+3. that's it.
+
+Actual Results:
+* with mono-1.1.6(win32), 
+----------------------
+hashtable creation took 20 milliseconds
+
+
+Unhandled Exception: System.NullReferenceException: Object reference not
+set to an instance of an object
+in <0x00021> C5.DefaultReferenceTypeHasher`1[System.String]:Equals
+(System.String , System.String )
+in <0x0001d> C5.KeyValuePairHasher`2[System.String,System.Int32]:Equals
+(KeyValuePair`2 , KeyValuePair`2 )
+in <0x0004a>
+C5.HashSet`1[C5.KeyValuePair`2[System.String,System.Int32]]:isnull
+(KeyValuePair`2 )
+in <0x00218>
+C5.HashSet`1[C5.KeyValuePair`2[System.String,System.Int32]]:searchoradd
+(C5.KeyValuePair`2 , Boolean , Boo
+ean )
+in <0x00021>
+C5.HashSet`1[C5.KeyValuePair`2[System.String,System.Int32]]:Add
+(KeyValuePair`2 )
+in <0x00049> C5.DictionaryBase`2[System.String,System.Int32]:Add
+(System.String , Int32 )
+in <0x00259> App:Main2 (System.String[] args)
+in <0x0002c> App:Main (System.String[] args)
+-------------------------
+
+Expected Results:
+no problem with mono-1.1.4(win32)
+-------------------------
+hashtable creation took 30 milliseconds
+
+hash1 initialization took 50 milliseconds
+
+manipulating hash2 took 1553 milliseconds
+
+1 9999 150 1499850
+1763 milliseconds
+-------------------------
+
+
+How often does this happen? 
+* always the case
+
+Additional Information:
+------------- attached is the cs file ---------------
+// $Id: hash2.csharp,v 1.0 2002/02/14 15:01:00 dada Exp $
+// http://dada.perl.it/shootout/
+
+using System;
+//using System.Collections;
+//using System.Collections.Generic;
+using C5;
+using MSG = System.Collections.Generic;
+
+class App {
+		public static void Main(String[] args) 
+		{
+			DateTime	t1 = DateTime.Now;
+			Main2(args);
+			DateTime	t2 = DateTime.Now;
+			Console.WriteLine("{0} milliseconds\n", (t2 - t1).TotalMilliseconds);
+		}
+    public static void Main2(String[] args) {        
+        int n = 1;
+        try {        
+        	n = System.Convert.ToInt32(args[0]);
+    	} catch {
+	    	n = 1;
+    	}
+    	
+        if(n < 1) n = 1;
+			DateTime	t1 = DateTime.Now;
+			
+//         Hashtable hash1 = new Hashtable(10000, (float)0.75);
+//         Hashtable hash2 = new Hashtable(10000, (float)0.75);
+//         Dictionary<string, int> hash1 = new Dictionary<string, int>( 12899);
+//         Dictionary<string, int> hash2 = new Dictionary<string, int>( 12899);
+         HashDictionary<string, int> hash1 = new HashDictionary<string,
+int>(10000, 0.75, 
+         	new DefaultReferenceTypeHasher<string>());
+         HashDictionary<string, int> hash2 = new HashDictionary<string,
+int>(10000, 0.75, 
+         	new DefaultReferenceTypeHasher<string>());
+        //Hashtable hash2 = new Hashtable(15000);
+//          HashDictionary<string, int> hash1 = new HashDictionary<string,
+int>();
+//          HashDictionary<string, int> hash2 = new HashDictionary<string,
+int>();
+			DateTime	t2 = DateTime.Now;
+			Console.WriteLine("hashtable creation took {0} milliseconds\n", (t2 -
+t1).TotalMilliseconds);
+			
+			DateTime	t3 = DateTime.Now;
+        for(int i=0; i<10000; i++) {
+            hash1.Add( "foo_" + i.ToString(), i);
+            //hash1.Add( "foo_" + i, new Val(i));
+            //hash1.Add(i, new Val(i));
+        }
+			DateTime	t4 = DateTime.Now;
+			Console.WriteLine("hash1 initialization took {0} milliseconds\n", (t4 -
+t3).TotalMilliseconds);
+        
+			DateTime	t5 = DateTime.Now;
+        int v1;
+//         String	key;
+        string	key;
+        for(int i = 0; i < n; i++) {
+            //HashDictionary<string,int>.Enumerator it = hash1.GetEnumerator();
+            //IEnumerator	it = hash1.Keys.GetEnumerator();
+            //MSG.IEnumerator<KeyValuePair<string,int>> it =
+hash1.GetEnumerator();
+            //while(it.MoveNext()) {
+	        foreach (KeyValuePair<string, int> it in hash1) {    
+                //v1 = ((Val)it.Value).val;
+//                 key = (String)it.Key;
+//                 key = it.Current.key;
+//                 v1 = it.Current.value;
+                key = it.key;
+                v1 = it.value;
+//                 key = it.Current.Key;
+                //v1 = hash1[key];
+//                 v1 = it.Current.Value;
+//                 if(hash2.ContainsKey(key)) {
+                //if(hash2.Contains(key)) {
+	            try {
+                    //int v1 = (int) hash1[it.Key];
+                    //int v2 = (int) hash2[it.Key];                
+                    hash2[key] += v1;
+                    //int v1 = ((Val)hash1[it.Key]).val;
+                    //int v2 = ((Val)hash2[it.Key]).val;                
+                    //((Val)hash2[key]).val += v1;
+                } 
+                //else {
+	            catch {
+                    hash2.Add(key, v1);
+                    //hash2.Add(key, new Val(v1));
+                }
+            }
+        }
+			DateTime	t6 = DateTime.Now;
+			Console.WriteLine("manipulating hash2 took {0} milliseconds\n", (t6 -
+t5).TotalMilliseconds);
+        Console.WriteLine(hash1["foo_1"] + " " + hash1["foo_9999"] + " " +
+hash2["foo_1"] + " " + hash2["foo_9999"]);
+        //Console.WriteLine(hash1[1] + " " + hash1[9999] + " " + hash2[1] +
+" " + hash2[9999]);
+        //return(0);
+    }
+}
+
+------- END ----------