summaryrefslogtreecommitdiff
path: root/gcc/vec.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2004-07-06 17:08:42 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2004-07-06 17:08:42 +0000
commita064479c835ec6c7aa02ab12a6369535d6453188 (patch)
tree2a4815255fa1826a8c800c509c09b3d8a467970b /gcc/vec.c
parent9bc813131482755edb213ddb5308c15f123c81c0 (diff)
downloadgcc-a064479c835ec6c7aa02ab12a6369535d6453188.tar.gz
vec.h (VEC_embedded_alloc): Remove.
* vec.h (VEC_embedded_alloc): Remove. (VEC_embedded_size, VEC_embedded_init): New. (VEC_alloc, VEC_reserve, VEC_safe_push, VEC_safe_insert): Add MEM_STAT_INFO. (VEC_truncate): New. (vec_p_reserve, vec_o_reserve): Add MEM_STAT_DECL. (vec_embedded_alloc): Remove. * vec.c (vec_p_reserve, vec_o_reserve): Add MEM_STAT_DECL, adjust. (vec_embedded_alloc): Remove. From-SVN: r84159
Diffstat (limited to 'gcc/vec.c')
-rw-r--r--gcc/vec.c28
1 files changed, 7 insertions, 21 deletions
diff --git a/gcc/vec.c b/gcc/vec.c
index b8c5a32af0e..01faf52bd78 100644
--- a/gcc/vec.c
+++ b/gcc/vec.c
@@ -39,10 +39,11 @@ struct vec_prefix
exponentially. VEC can be NULL, to create a new vector. */
void *
-vec_p_reserve (void *vec, size_t reserve)
+vec_p_reserve (void *vec, size_t reserve MEM_STAT_DECL)
{
return vec_o_reserve (vec, reserve,
- offsetof (struct vec_prefix, vec), sizeof (void *));
+ offsetof (struct vec_prefix, vec), sizeof (void *)
+ PASS_MEM_STAT);
}
/* Ensure there are at least RESERVE free slots in VEC, if RESERVE !=
@@ -52,7 +53,8 @@ vec_p_reserve (void *vec, size_t reserve)
consistes of ELT_SIZE sized elements. */
void *
-vec_o_reserve (void *vec, size_t reserve, size_t vec_offset, size_t elt_size)
+vec_o_reserve (void *vec, size_t reserve, size_t vec_offset, size_t elt_size
+ MEM_STAT_DECL)
{
struct vec_prefix *pfx = vec;
size_t alloc;
@@ -64,7 +66,8 @@ vec_o_reserve (void *vec, size_t reserve, size_t vec_offset, size_t elt_size)
if (!pfx || pfx->alloc < alloc)
{
- vec = ggc_realloc (vec, vec_offset + alloc * elt_size);
+ vec = ggc_realloc_stat (vec, vec_offset + alloc * elt_size
+ PASS_MEM_STAT);
((struct vec_prefix *)vec)->alloc = alloc;
if (!pfx)
((struct vec_prefix *)vec)->num = 0;
@@ -73,23 +76,6 @@ vec_o_reserve (void *vec, size_t reserve, size_t vec_offset, size_t elt_size)
return vec;
}
-/* Allocate a structure which contains a vector as a trailing element.
- The vector is at STRUCT_OFFSET offset within the struct and the
- vector's array is at VEC_OFFSET offset within the vector. */
-
-void *
-vec_embedded_alloc (size_t struct_offset, size_t vec_offset,
- size_t elt_size, size_t reserve)
-{
- void *ptr = ggc_alloc (struct_offset + vec_offset + elt_size * reserve);
- struct vec_prefix *pfx = (struct vec_prefix *)((char *)ptr + struct_offset);
-
- pfx->num = 0;
- pfx->alloc = reserve;
-
- return ptr;
-}
-
#if ENABLE_CHECKING
/* Issue a vector domain error, and then fall over. */