[PATCH] irange_pool class
Andrew MacLeod
amacleod@redhat.com
Fri Sep 18 16:42:21 GMT 2020
On 9/18/20 8:28 AM, David Malcolm wrote:I think of a "pool allocator" as
something that makes a small
>>> number of
>>> large allocation under the covers, and then uses that to serve
>>> large
>>> numbers of fixed sized small allocations and deallocations with
>>> O(1)
>>> using a free list.
>> Ah, I didn't know pool had a different meaning.
> See e.g. gcc/alloc-pool.h
The name originated when the original v1 version was based on using
alloc-pool.h. when we went to varying sizes, we switched to and obstack
implementation and never changed the name.
<...>
>>> I think it would be clearer to name this "irange_obstack", or
>>> somesuch.
>> I'd prefer something more generic. We don't want to tie the name of
>> the
>> allocator to the underlying implementation. What if we later change
>> to
>> malloc? We'd have to change the name to irange_malloc.
>> irange_allocator? Or is there something more generically appropriate
>> here?
> How about "irange_bump_allocator?" Rather long, but it expresses the
"irange_allocator" is sufficient . The consumer should not care
what the implementation is, and we may decide to implement it
differently down the road. So I don't want to imply something specific
in the name or we'd have to change it again.
Andrew
More information about the Gcc-patches
mailing list