[Mono-bugs] [Bug 61442][Wis] New - [PATCH] use cmp DWORD PTR [eax], eax for null check

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Mon, 12 Jul 2004 13:45:35 -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=61442

--- shadow/61442	2004-07-12 13:45:35.000000000 -0400
+++ shadow/61442.tmp.27403	2004-07-12 13:45:35.000000000 -0400
@@ -0,0 +1,32 @@
+Bug#: 61442
+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: [PATCH] use cmp DWORD PTR [eax], eax for null check 
+
+Today we use the instruction:
+
+cmp DWORD PTR [eax], 0
+
+to do a null check. This instuction is minimally encoded in three bytes.
+However, the instruction:
+
+cmp DWORD PTR [eax], eax
+
+Can be encoded in 2 bytes. I ran some benchmarks on my Pentium M and the
+two instructions had the same performance. Microsoft's jit emits the cmp
+DWORD PTR [eax], eax instruction.
+
+This patch lets us use the shorter form.