Zero  0.1.0
Public Member Functions | Public Attributes | List of all members
GcSegment< T > Struct Template Reference

A segment in each generation. More...

#include <w_gc_pool_forest.h>

Public Member Functions

 GcSegment (gc_offset size)
 
 ~GcSegment ()
 
void recycle ()
 

Public Attributes

gc_thread_id owner
 
gc_offset total_objects
 
gc_offset allocated_objects
 
Tobjects
 

Detailed Description

template<class T>
struct GcSegment< T >

A segment in each generation.

A segment is allocated in bulk and assigned to a single thread. So, no race on allocation. The owner thread can safely allocate without atomic operations nor barriers. We do not reuse any objects or segments, so what we just need is a per-thread counter. Deallocation might be called from any thread, so [JUNG13] uses a kind of counting network.

On the other hand, this implementation does absolutely nothing on deallocation. The caller even don't have to call the deallocation method (although we do so for future change). The GC generation will retire based on LSN when it is safe.

Hence, we don't need any atomic/barrier for allocation/deallocation.

Constructor & Destructor Documentation

§ GcSegment()

template<class T>
GcSegment< T >::GcSegment ( gc_offset  size)
inline

§ ~GcSegment()

template<class T>
GcSegment< T >::~GcSegment ( )
inline

Member Function Documentation

§ recycle()

template<class T>
void GcSegment< T >::recycle ( )
inline

Recycle this generation assuming there is no transaction that uses any of the objects in this segment. If the assumption does not hold, this might cause ABA and other corruption.

Member Data Documentation

§ allocated_objects

template<class T>
gc_offset GcSegment< T >::allocated_objects

How many objects we allocated. Stop allocation when this reaches total_objects.

§ objects

template<class T>
T* GcSegment< T >::objects

The bulk-allocated objects. T[total_objects].

§ owner

template<class T>
gc_thread_id GcSegment< T >::owner

ID of the thread that can exclusively own this segment.

§ total_objects

template<class T>
gc_offset GcSegment< T >::total_objects

size of objects array.


The documentation for this struct was generated from the following file: