[Mono-bugs] [Bug 61509][Wis] New - Exception handling clauses prevent many register assignments

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Tue, 13 Jul 2004 22:22:12 -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 bmaurer@users.sf.net.

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

--- shadow/61509	2004-07-13 22:22:12.000000000 -0400
+++ shadow/61509.tmp.23812	2004-07-13 22:22:12.000000000 -0400
@@ -0,0 +1,71 @@
+Bug#: 61509
+Product: Mono: Runtime
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: bmaurer@users.sf.net               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Exception handling clauses prevent many register assignments
+
+Consider this benchmark:
+
+using System;
+
+class T {
+	static void Main ()
+	{
+		int i = Environment.TickCount;
+		
+		WithEH ();
+		
+		Console.WriteLine (Environment.TickCount - i);
+		
+		i = Environment.TickCount;
+		
+		NoEH ();
+		
+		Console.WriteLine (Environment.TickCount - i);
+	}
+	
+	static void WithEH () {
+		try {
+		} catch {
+		}
+		
+		int j = 0, k = 0;
+		for (int i = 0; i < 100000000; i ++) {
+			j = i;
+			j ++;
+			k += j;
+		}
+	}
+	
+	static void NoEH ()
+	{
+		int j = 0, k = 0;
+		for (int i = 0; i < 100000000; i ++) {
+			j = i;
+			j ++;
+			k += j;
+		}
+	}
+}
+
+On my computer the results are:
+865
+337
+
+That means that the method without any EH clauses will have many
+restrictions on how it uses register variables.
+
+In OOP, EH clauses are going to be pretty common. For example, foreach
+often translates into try...finally.