|CProf cache profiling system available email@example.com (1994-10-13)|
|Re: C struct Ordering Rules (Re: Data Structure Reorganizing Optimizat firstname.lastname@example.org (1994-10-27)|
|Re: C struct Ordering Rules email@example.com (1994-10-31)|
|Re: C struct Ordering Rules firstname.lastname@example.org (1994-10-31)|
|Re: C struct Ordering Rules email@example.com (1994-11-01)|
|Re: C struct Ordering Rules firstname.lastname@example.org (1994-11-01)|
|Re: C struct Ordering Rules email@example.com (1994-11-01)|
|From:||firstname.lastname@example.org (Bill Leonard)|
|Keywords:||C, design, optimize|
|Organization:||Harris Computer Systems, Ft. Lauderdale FL|
|Date:||Tue, 1 Nov 1994 22:00:41 GMT|
email@example.com (Barton C. Massey) writes:
> All this said, I too would like to see field rearrangement.
> There's several possibilities: my favorite suggestion is to
> forbid rearrangement to move fields past non-volatile fields
> (i.e. treat them as tombstones), and to force volatile structs
> to be completely unpadded and in order (possibly necessitating
> structure packing and unpacking across assignment).
Unfortunately, "volatile" is a pretty big sledgehammer to use just to get
field placement the way you want it. Declaring objects volatile disables
lots of useful optimizations that have nothing to do with structure-field
placement, such as elimination of redundant loads, common subexpression
elimination, and dead store elimination. That's a lot to give up just so I
can make the compiler lay out the structure the way I wanted.
As Robert Bedichek pointed out in a related article, lots of code would
break as a result of different compilations doing different structure
layouts. In practice, how would you make sure that compiling two source
files, which will eventually be linked together, get the same layout of the
same structure? You can't unless the compiler sees the whole program, I
think, and even then there is the operating system to consider, which is
*certainly* going to be compiled separately.
To put this another way, on what would you base your structure
Harris Computer Systems Corporation
2101 W. Cypress Creek Road
Fort Lauderdale, FL 33309
Return to the
Search the comp.compilers archives again.