GCC Middle and Back End API Reference
|
#include <vec.h>
Public Member Functions | |
void | register_overhead (size_t, const char *, int, const char *) |
void | release_overhead (void) |
Static Public Member Functions | |
static unsigned | calculate_allocation (vec_prefix *, unsigned, bool) |
Data Fields | |
unsigned | m_alloc: 31 |
unsigned | m_has_auto_buf: 1 |
unsigned | m_num |
Friends | |
struct | vec |
struct | va_gc |
struct | va_gc_atomic |
struct | va_heap |
Control data for vectors. This contains the number of allocated and used slots inside a vector.
|
static |
Calculate the number of slots to reserve a vector, making sure that RESERVE slots are free. If EXACT grow exactly, otherwise grow exponentially. PFX is the control data for the vector.
If there's no vector, and we've not requested anything, then we will create a NULL vector.
We must have run out of room.
Exact size.
Exponential growth.
Double when small.
Grow slower when large.
If this is still too small, set it to the right size.
void vec_prefix::register_overhead | ( | size_t | size, |
const char * | name, | ||
int | line, | ||
const char * | function | ||
) |
FIXME - These fields should be private, but we need to cater to compilers that have stricter notions of PODness for types. Memory allocation support routines in vec.c.
Account the overhead.
void vec_prefix::release_overhead | ( | void | ) |
|
friend |
The allocator types also need access to our internals.
|
friend |
|
friend |
|
friend |
Note that vec_prefix should be a base class for vec, but we use offsetof() on vector fields of tree structures (e.g., tree_binfo::base_binfos), and offsetof only supports base types.
To compensate, we make vec_prefix a field inside vec and make vec a friend class of vec_prefix so it can access its fields.
unsigned vec_prefix::m_alloc |
Referenced by release_overhead().
unsigned vec_prefix::m_has_auto_buf |
unsigned vec_prefix::m_num |
Referenced by release_overhead().