This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: More CSELIB memory reduction
> Jan Hubicka writes:
>
> > I've bootstrapped i686-pc-gnu-linux and mips got to the end of stage2,
> > so I will commit the patch.
>
> Thanks for the quick fix.
I've commited the attached patch with additional sanity checking.
OK for 3.4-branch?
2004-01-23 Jan Hubicka <jh@suse.cz>
* alloc-pool.c (align_four): Kill.
(create_alloc_pool): Align size to eight.
(free_alloc_pool, free_pool): Invalidate deallocated data.
Index: alloc-pool.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/alloc-pool.c,v
retrieving revision 1.9
diff -c -3 -p -r1.9 alloc-pool.c
*** alloc-pool.c 21 Dec 2003 14:08:32 -0000 1.9
--- alloc-pool.c 23 Jan 2004 21:19:12 -0000
*************** extern void fancy_abort (const char *, i
*** 34,40 ****
ATTRIBUTE_NORETURN;
#define abort() fancy_abort (__FILE__, __LINE__, __FUNCTION__)
- #define align_four(x) (((x+3) >> 2) << 2)
#define align_eight(x) (((x+7) >> 3) << 3)
/* The internal allocation object. */
--- 34,39 ----
*************** create_alloc_pool (const char *name, siz
*** 90,96 ****
size = sizeof (alloc_pool_list);
/* Now align the size to a multiple of 4. */
! size = align_four (size);
#ifdef ENABLE_CHECKING
/* Add the aligned size of ID. */
--- 89,95 ----
size = sizeof (alloc_pool_list);
/* Now align the size to a multiple of 4. */
! size = align_eight (size);
#ifdef ENABLE_CHECKING
/* Add the aligned size of ID. */
*************** free_alloc_pool (alloc_pool pool)
*** 154,159 ****
--- 153,161 ----
}
/* Lastly, free the pool and the name. */
free (pool->name);
+ #ifdef ENABLE_CHECKING
+ memset (pool, 0xaf, sizeof (*pool));
+ #endif
free (pool);
}
*************** pool_free (alloc_pool pool, void *ptr)
*** 224,229 ****
--- 226,233 ----
#ifdef ENABLE_CHECKING
if (!ptr)
abort ();
+
+ memset (ptr, 0xaf, pool->elt_size - offsetof (allocation_object, u.data));
/* Check whether the PTR was allocated from POOL. */
if (pool->id != ALLOCATION_OBJECT_PTR_FROM_USER_PTR (ptr)->id)