Wireshark-commits: [Wireshark-commits] rev 50271: /trunk/epan/ /trunk/epan/: column.c

Date: Sun, 30 Jun 2013 23:03:20 GMT
http://anonsvn.wireshark.org/viewvc/viewvc.cgi?view=rev&revision=50271

User: wmeier
Date: 2013/06/30 04:03 PM

Log:
 Declare slist[] as static (reduces storage & code executed: *See below);
 Declare dlist[] similarly to slist[] (not really needed since generated storage/code was OK as is)
 
 *On Windows the following program generates sub-optimal code
  (when built using VC10 or VC11 with CFLAGS as used when building Wireshark).
 
 void foo(void) {
     const char *const zz[] = {"ABC", "abc"};
 }
 -------------
 
 Code generated:
 
 <snip>
 _DATA	SEGMENT
 $SG1013	DB	'ABC', 00H  !!! note string stored twice !!
 $SG1014	DB	'ABC', 00H
 $SG1015	DB	'abc', 00H
 $SG1016	DB	'abc', 00H
 _DATA	ENDS
 
 <snip>
 ; 1    : void foo(void) {
 
 	push	ebp
 	mov	ebp, esp
 	sub	esp, 8
 
 ; 2    :     const char *const zz[] = {"ABC", "abc"};
 
 	mov	DWORD PTR _zz$[ebp], OFFSET $SG1014    !! note: each ptr of array
 	mov	DWORD PTR _zz$[ebp+4], OFFSET $SG1016  !!  individually pushed on stack
 
 <snip>
 
 Not shown: Declaring zz as 'static' generates much better code....

Directory: /trunk/epan/
  Changes    Path          Action
  +5 -5      column.c      Modified