[PATCH] introduce a MALLOC_ALIGNMENT configuration macro

Olivier Hainque hainque@adacore.com
Fri Jun 27 16:20:00 GMT 2008


Thanks for your constructive feedback Richard.

Richard Guenther wrote:
> I think we need to be careful here.

 Agreed.

> Even if glibc may align to say 16bytes, the user may override
> glibcs implementation with one aligning only to 4bytes if this is all
> the ABI guarantees.

 Indeed.
 
> So, IMHO this at least asks for an optimization flag, like
> --param malloc-alignment=N, not a static configuration.

 While adding a parameter is a very nice idea, a per-target
 static default still looks useful to me.

 We couldn't make the option mandatory, I think, and I don't see an
 existing macro that would be really appropriate as a default in every
 case.

 How about introducing an "OS_MALLOC_ALIGNMENT" optional target
 definition, which would default to BIGGEST_ALIGNMENT, then a
 malloc-alignment parameter as you suggested, and something like

    #include "params.h"

    /* The maximum alignment "malloc" may be assumed to offer,
       user specified or system specific.  */
    #define MALLOC_ALIGNMENT \
	PARAM_SET_P(PARAM_MALLOC_ALIGNMENT) \
	? PARAM_VALUE(PARAM_MALLOC_ALIGNMENT) : OS_MALLOC_ALIGNMENT

 somewhere (possibly in gigi to start with) ?

 This would push the --param usage to cases where there is the
 allocator is redefined, which sounds pretty consistent.

 



  



More information about the Gcc-patches mailing list