
Remove the predefined static initialization and generate the map dynamically to reduce code size.
This patch benefits were pointed out by Peter: http://www.nabble.com/forum/Permalink.jtp?root=25518020&post=25523748&am...
Signed-off-by: Nishanth Menon nm@ti.com Cc: Peter Tyser ptyser@xes-inc.com Cc: Sandeep Paulraj s-paulraj@ti.com Cc: Tom Rix tom.rix@windriver.com --- common/dlmalloc.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/common/dlmalloc.c b/common/dlmalloc.c index 241db8c..25e5314 100644 --- a/common/dlmalloc.c +++ b/common/dlmalloc.c @@ -1474,6 +1474,7 @@ typedef struct malloc_chunk* mbinptr;
#define IAV(i) bin_at(i), bin_at(i)
+#ifdef CONFIG_X86 static mbinptr av_[NAV * 2 + 2] = { 0, 0, IAV(0), IAV(1), IAV(2), IAV(3), IAV(4), IAV(5), IAV(6), IAV(7), @@ -1493,6 +1494,9 @@ static mbinptr av_[NAV * 2 + 2] = { IAV(112), IAV(113), IAV(114), IAV(115), IAV(116), IAV(117), IAV(118), IAV(119), IAV(120), IAV(121), IAV(122), IAV(123), IAV(124), IAV(125), IAV(126), IAV(127) }; +#else +static mbinptr av_[NAV * 2 + 2]; +#endif
void malloc_bin_reloc (void) { @@ -1527,6 +1531,11 @@ void *sbrk(ptrdiff_t increment) */ void mem_malloc_init(ulong start, ulong size) { + u8 i; + av_[0] = av_[1] = 0; + for (i = 0; i < 128; i++) + av_[2 + i * 2] = av_[2 + i * 2 + 1] = bin_at(i); + mem_malloc_start = start; mem_malloc_end = start + size; mem_malloc_brk = start;