|
Zero
0.1.0
|
Garbage-collected Pool Forest. More...
#include <w_gc_pool_forest.h>
Static Public Member Functions | |
| static gc_generation | wrap (size_t i) |
Public Attributes | |
| const char * | name |
| uint32_t | head_nowrap |
| uint32_t | curr_nowrap |
| uint32_t | tail_nowrap |
| uint32_t | desired_generations |
| GcGeneration< T > * | generations [GC_MAX_GENERATIONS] |
| lsn_t | epochs [GC_MAX_GENERATIONS] |
| GcWakeupFunctor * | gc_wakeup_functor |
Garbage-collected Pool Forest.
| T | Type of the managed class/struct. It must have a member "gc_pointer_raw gc_pointer" accessible to this class. |
This is a Roll-Your-Own Garbage Collector implementation optimized for long-running services such as filesystems and databases.
|
inline |
|
inline |
|
inline |
Returns the number of active generations.
|
inline |
Create a new generation for the given starting LSN.
| [in] | low_water_mark | LSN of the oldest transaction in the system. Used to recycle old generations. lsn_t::null prohibits recycling. |
| [in] | now | higest LSN as of now, which means every thread that newly allocates from this new generation would have this LSN or higher. |
|
inline |
Allocate a new object from this pool.
| [in,out] | next | this is a thread-local hint to allocate from. we also increment or even switch to new segment. the caller probably uses a thread-local for this. |
| [in] | self | Some ID of the calling thread. eg, pthread_self(). |
|
inline |
The yougnest active generation in which we should allocate new segments. wrapped.
|
inline |
|
inline |
Return an object to this pool.
| [in] | pointer | The object to return. |
|
inline |
Return an object to this pool.
| [in] | pointer | Logical pointer to the object to return. |
|
inline |
The oldest active generation. wrapped.
|
inline |
|
inline |
|
inline |
full load-store fence.
|
inline |
Occupy a segment in latest generation and return a pointer to its first object.
|
inline |
|
inline |
|
inline |
Returns a physical pointer represented by the logical pointer.
|
inline |
Returns a physical pointer represented by the logical pointer.
|
inline |
|
inline |
|
inline |
Retire old generations that are no longer needed.
| [in] | low_water_mark | LSN of the oldest transaction in the system |
| [in] | recycle_now | higest LSN as of now. This is used to recycle retired generations. lsn_t::null means prohibiting recycle. |
|
inline |
The exclusive end of active generations. wrapped.
|
inlinestatic |
| uint32_t GcPoolForest< T >::curr_nowrap |
The latest active generation. No wrap, so take modulo before use.
| uint32_t GcPoolForest< T >::desired_generations |
Desired number of generations. Don't add more than it unless can't retire old ones.
| lsn_t GcPoolForest< T >::epochs[GC_MAX_GENERATIONS] |
LSN as of starting each generation.
| GcWakeupFunctor* GcPoolForest< T >::gc_wakeup_functor |
Function pointer to wakeup GC when pre-allocation or retiring gets behind.
| GcGeneration<T>* GcPoolForest< T >::generations[GC_MAX_GENERATIONS] |
Active (or being-retired) generation objects.
| uint32_t GcPoolForest< T >::head_nowrap |
The oldest active generation. No wrap, so take modulo before use.
| const char* GcPoolForest< T >::name |
Only used to put the name of this forest in debug print.
| uint32_t GcPoolForest< T >::tail_nowrap |
The exclusive end of active generation. No wrap, so take modulo before use.
1.8.12