This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [tree-ssa] dead const/pure/alloca call removal

Daniel Jacobowitz <> writes:

| On Sun, Nov 09, 2003 at 03:42:30AM +0100, Gabriel Dos Reis wrote:
| > Jan Hubicka <> writes:
| > 
| > | I definitly know of at least one C++ compiler able to turn malloc/free
| > | pairs into alloca and alloca into stack allocations getting very
| > | noticeable gains from this on certain cases.
| > 
| > For GCC to do that, it would have to come with its own implmentation
| > of malloc()/free() so as to pretend that it has knowledge ot them.
| > But at the moment, and in the near future, GCC does *not* provide an
| > implementation for malloc()/free().  It relies on host libraries.  And
| > people who provide their functions expect them to be called. 
| No, you can do this transformation (as-if) without your own
| malloc/free; if you can guarantee that the pointer never escapes.

That assumes that the only effect of malloc() is to return a pointer,
i.e. it already assumes its knowledge of malloc/free. 

| At least in C, and presumably in C++ with direct calls to malloc/free.

Again, that is fine *if* GCC is a whole implementation of the compiler
plus the library.  Currently, it is not.  It relies on third party
libraries, and such libraries might be doing additional things like
tracing or implement their own view of memory allocation.

-- Gaby

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]