[v3] __pool_alloc rework

Paolo Carlini pcarlini@suse.de
Fri Jun 18 12:16:00 GMT 2004


Benjamin Kosnik wrote:

>Hey Paolo. Here's another way to do __pool_alloc. This exports two
>protected member functions, which seems fine to me. Let me know what you
>think.
>  
>
Hi Benjamin. I'm not sure to understand why you are using GLIBCXX_3.4.2
for this?

>I'm still working on the locking bits, which is the only part of this
>patch that I'm unhappy with at the moment.
>
Indeed, in the case of __pool _alloc the template parameter was *not* 
unused...

> I'd like to check this in
>anyway, and continue work on that part along with mt_alloc and the fix
>to 13583.
>  
>
Ok! Please keep me updated: mt_alloc is still missing some alignments bits,
as you remember.

Some final observation: as I had noticed, following this standard approach
src/allocator.cc becomes rather, well, "populated", I wonder whether we can
do something about this...

Wrt the original SGI design, some functions are not static anymore, but I
don't think this is a problem, actually, besides the non-inlining, perhaps.

A last thing. The new _M_get_free_list reads:

!   // Static members of __pool_alloc and base class.

(comment out of date, I think)

!   __pool_base::_Obj* volatile*
!   __pool_base::_M_get_free_list(size_t __bytes)
!   { 
!     size_t __i = ((__bytes + (size_t)_S_align - 1) / (size_t)_S_align - 1);
!     return _S_free_list + __i - 1;
!   }

Are you sure about the final '- 1'??? If I'm not mistaken, 
_M_get_free_list replaces
the previous _S_free_list + _S_freelist_index

Paolo.



More information about the Libstdc++ mailing list