Enhance pool allocator
* alloc-pool.h (allocate_raw): New function. (operator new (size_t, object_allocator<T> &a)): Use the function instead of object_allocator::allocate). From-SVN: r230105
This commit is contained in:
parent
bea408857a
commit
8bd37a2ec9
@ -1,3 +1,9 @@
|
||||
2015-11-10 Martin Liska <mliska@suse.cz>
|
||||
|
||||
* alloc-pool.h (allocate_raw): New function.
|
||||
(operator new (size_t, object_allocator<T> &a)): Use the
|
||||
function instead of object_allocator::allocate).
|
||||
|
||||
2015-11-10 Ilya Enkovich <enkovich.gnu@gmail.com>
|
||||
|
||||
* config/i386/sse.md (HALFMASKMODE): New attribute.
|
||||
|
@ -477,12 +477,25 @@ public:
|
||||
m_allocator.release_if_empty ();
|
||||
}
|
||||
|
||||
|
||||
/* Allocate memory for instance of type T and call a default constructor. */
|
||||
|
||||
inline T *
|
||||
allocate () ATTRIBUTE_MALLOC
|
||||
{
|
||||
return ::new (m_allocator.allocate ()) T;
|
||||
}
|
||||
|
||||
/* Allocate memory for instance of type T and return void * that
|
||||
could be used in situations where a default constructor is not provided
|
||||
by the class T. */
|
||||
|
||||
inline void *
|
||||
allocate_raw () ATTRIBUTE_MALLOC
|
||||
{
|
||||
return m_allocator.allocate ();
|
||||
}
|
||||
|
||||
inline void
|
||||
remove (T *object)
|
||||
{
|
||||
@ -528,7 +541,7 @@ template <typename T>
|
||||
inline void *
|
||||
operator new (size_t, object_allocator<T> &a)
|
||||
{
|
||||
return a.allocate ();
|
||||
return a.allocate_raw ();
|
||||
}
|
||||
|
||||
/* Hashtable mapping alloc_pool names to descriptors. */
|
||||
|
Loading…
Reference in New Issue
Block a user