This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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] |
Hi! On Wed, 22 Oct 2014 10:04:48 +0200, Jakub Jelinek <jakub@redhat.com> wrote: > On Wed, Oct 22, 2014 at 09:45:29AM +0200, FX wrote: > > > Since malloc and free are magically provided by the ptx environment, but realloc is missing, [...] > Yeah, I wonder why can't you just wrap the PTX "malloc"/"free" by allocating > small header in front of the allocated area Thanks for hitting (at least me) with a clue bat... When we discussed this internally, I did have the hunch that it ought to be possible to implement realloc if only malloc and free are available, but I didn't see the obvious... Now I remember that I'd even seen something like that recently: > where your wrapping > implementation will deal with everything you need (remember the size of the > allocation, so realloc can work, or if PTX malloc doesn't support alignment, > also bias so that you can support aligned_alloc or posix_memalign). So, something in spirit of what has been implemented in gcc/config/i386/gmm_malloc.h. > As an optimization, if the compiler could prove that certain allocations are > never realloced, never need aligned memory etc., you could optimize it to > avoid the wrappers and use PTX "malloc"/"free" directly. I guess that if the compiler is able to prove that (no escaping pointers, basically?), chances are that malloc/free can be eliminated completely? GrÃÃe, Thomas
Attachment:
pgpu4421EqeuG.pgp
Description: PGP signature
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |