Re: Data Structure Reorganizing Optimizations

robertb@HING.LCS.MIT.EDU (Robert Bedichek)
Wed, 26 Oct 1994 22:19:26 GMT

          From comp.compilers

Related articles
CProf cache profiling system available david@cs.wisc.edu (1994-10-13)
Data Structure Reorganizing Optimizations [Was: Re: CProf cache profil glew@ichips.intel.com (1994-10-19)
Re: Data Structure Reorganizing Optimizations john@iastate.edu (1994-10-22)
Re: Data Structure Reorganizing Optimizations robertb@HING.LCS.MIT.EDU (1994-10-26)
Re: Data Structure Reorganizing Optimizations johnm@cory.EECS.Berkeley.EDU (1994-10-22)
Re: Data Structure Reorganizing Optimizations stripes@uunet.uu.net (1994-10-27)
Re: Data Structure Reorganizing Optimizations bret@icicle.winternet.com (1994-10-23)
Data Structure Reorganizing Optimizations leichter@zodiac.rutgers.edu (1994-10-31)
Re: Data Structure Reorganizing Optimizations yuri@shimari.cmf.nrl.navy.mil (1994-10-31)
Re: Data Structure Reorganizing Optimizations ddg@cci.com (1994-10-31)
[17 later articles]
| List of all articles for this month |
Newsgroups: comp.arch,comp.compilers
From: robertb@HING.LCS.MIT.EDU (Robert Bedichek)
Keywords: optimize, C
Organization: MIT Laboratory for Computer Science
References: 94-10-108 94-10-141
Date: Wed, 26 Oct 1994 22:19:26 GMT

glew@ichips.intel.com (Andy Glew) writes:
>I believe that C's rules about data structure organization are
>obsolete. Certainly, they are not in the ken of the usual programmer
>using C or C++. Why not permit compilers to do such "illegal" data
>structure reorganizations, bringing the performance gains Lebeck and
>Wood describes to the standard application?
>
>I suggest that this be considered by future X3J11 ANSI C standards (if
>any such revisions are forthcoming).


Many programs would not work after being compiled by a compiler that
freely reorganized structures. If you add such a "feature" to a C
compiler, you'll have to make it a non-default compiler option.


Consider what will break:


1. Device drivers where C structures are used to describe
      register layouts.


2. Network code where structures are used to describe stuff that
      comes off of the wire.


3. Operating system and library code that depends on the ability
      of structures to describe stack frames, especially exception frames.


4. Applications and utilities that make system calls like 'stat()'
      where the operating system's compilation used a different layout
      for the stat buffer.


5. OS/Apps/Utils that read structures from disk where the C compiler
      run that wrote the file disagree with the run that compiled the OS or
      application or utility.


C compilers don't have to agree on how they lay out structures, but for
a given architecture, they almost always do. I've had big headaches
when they didn't.


I believe that if you let structures be freely changed, you'll not be
able to run most operating system and utility code, and many
applications.


Perhaps you'll let the programmer constrain the layout, as in Ada's
chapter 13 features. I found these features in Ada quite cumbersome and
they were a big hassle for the compiler writers. You would also have to
modify huge amounts of existing C.


Robert Bedichek
robertb@lcs.mit.edu
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.