[Mono-bugs] [Bug 61800][Wis] New - [PATCH] Reduce initialization code in System.Reflection.Emit.OpCode
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Wed, 21 Jul 2004 16:20:45 -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 duncan@ximian.com.
http://bugzilla.ximian.com/show_bug.cgi?id=61800
--- shadow/61800 2004-07-21 16:20:45.000000000 -0400
+++ shadow/61800.tmp.26794 2004-07-21 16:20:45.000000000 -0400
@@ -0,0 +1,47 @@
+Bug#: 61800
+Product: Mono: Class Libraries
+Version: unspecified
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Wishlist
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: duncan@ximian.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: [PATCH] Reduce initialization code in System.Reflection.Emit.OpCode
+
+2004-07-21 Duncan Mak <duncan@ximian.com>
+
+ This patch is based on an idea of Ben's to reduce the code size
+ in MCS. With this, I think we reduced a bit more than 2% of the
+ generated code size of MCS.
+
+ * OpCodes.cs: Instead pushing the data onto the stack when each
+ OpCode is initialized, move the data about the OpCodes into two
+ arrays and only keep an index into the arrays in each instance of
+ OpCode.
+
+ Furthermore, the names of each OpCode are stored in a separate
+ string array in the new OpCodeNames class, and everything else in
+ a one-dimension byte array called 'values' in the OpCodes class.
+
+ (OpCodeIndex) a new enum used to track the order of the 'values'
+ array, so we don't have to use magic numbers to index into the it.
+
+ * OpCodeNames.cs: The names of each OpCode are moved here to delay
+ the initialization of the strings, as they are not used very
+ frequently.
+
+ * OpCode.cs: Rewrote this to only store an index into a table
+ stored in the OpCodes class.
+
+Aside: I never built with the 1.0 profile, so we lose the 1.0 opcode
+'boxval' with this patch. Is it important that we keep the 1.0 profile? If
+it is, I can go back and add that value in: it's just a pain because it
+means I need to go rearrange all the opcode index.