← All compilation units

Flyology_Cachelines.Padded_Groups

Description

Groups a caller-selected number of same-owner values in one isolated destructive-interference region.

Constant_Reference

function Constant_Reference
  (Container : aliased Grouped_Array; Position : Cursor) return Constant_Reference_Type

@exclude Standard iterator protocol.

Parameters
Container

Container being traversed.

Position

Iterator cursor.

Return value

A constant reference to the selected element.

Constant_Reference

function Constant_Reference
  (Container : aliased Grouped_Array; Position : Positive) return Constant_Reference_Type

@exclude Standard indexing protocol.

Parameters
Container

Container being indexed.

Position

Flat logical index.

Return value

A constant reference to the selected element.

Constant_Reference_Type

type Constant_Reference_Type (Element : not null access constant Element_Type) is limited private
with Implicit_Dereference => Element;

@exclude Standard constant-indexing protocol.

Record fields
Element

Referenced constant element.

Create

function Create (Values : Element_Array) return Group

Construct a physical group from compact element values.

Parameters
Values

Values to place in the group.

Return value

An isolated group containing Values.

Create

function Create (Element_Count : Positive; Initial_Value : Element_Type) return Grouped_Array

Create a grouped array filled with one initial value.

Parameters
Element_Count

Number of logical elements to allocate.

Initial_Value

Value assigned to every logical element.

Return value

A grouped array containing Element_Count logical elements.

Cursor

type Cursor is private;

@exclude Iterator protocol cursor.

Element_Array

type Element_Array is array (Index) of aliased Element_Type;

Compact payload stored inside a physical group.

Element_Type

type Element_Type is private;

Fast_Cursor

type Fast_Cursor is private;

Fast_View is a GNAT-specific Iterable view for hot mutable traversals. Its access discriminant keeps the view scoped to its Grouped_Array.

Fast_First

function Fast_First (View : Fast_View) return Fast_Cursor

@exclude GNAT Iterable protocol.

Parameters
View

View to start traversing.

Return value

The first cursor.

Fast_Has_Element

function Fast_Has_Element (View : Fast_View; Position : Fast_Cursor) return Boolean

@exclude GNAT Iterable protocol.

Parameters
View

View being traversed.

Position

Cursor to inspect.

Return value

True when Position identifies an element.

Fast_Next

function Fast_Next (View : Fast_View; Position : Fast_Cursor) return Fast_Cursor

@exclude GNAT Iterable protocol.

Parameters
View

View being traversed.

Position

Current cursor.

Return value

The next cursor.

Fast_Reference

function Fast_Reference (View : Fast_View; Position : Fast_Cursor) return Reference_Type

@exclude GNAT Iterable protocol.

Parameters
View

View being traversed.

Position

Cursor to dereference.

Return value

A mutable reference to the selected element.

Fast_View

type Fast_View (Container : not null access Grouped_Array) is limited private
with
  Iterable =>
    (First => Fast_First, Next => Fast_Next, Has_Element => Fast_Has_Element, Element => Fast_Reference);

Mutable flat view using GNAT's lightweight Iterable protocol.

Record fields
Container

The grouped array traversed by the view.

Group

type Group is new Element_Array with Alignment => Destructive_Interference_Size;

One isolated group of same-owner elements.

Elements within a group may share cache lines and therefore must have compatible ownership. Distinct Group objects occupy distinct destructive-interference regions.

Group_Array

type Group_Array is array (Positive range <>) of aliased Group;

Array of physically isolated groups.

Group_Length

Group_Length : Positive;

Group_Size_In_Storage_Elements

Group_Size_In_Storage_Elements : constant Positive := Group'Object_Size / System.Storage_Unit;

Object size of Group in System.Storage_Unit elements.

Grouped_Array

type Grouped_Array (Group_Count : Positive) is tagged record
   Last_Group_Length : Index := Index'Last;
   Groups            : Group_Array (1 .. Group_Count);
end record;

Grouped_Array is physically an array of isolated groups but presents one logical, flat sequence for indexing and iteration. A final partial group remains physically isolated, while its unused tail is skipped.

Record fields
Group_Count

Number of allocated physical groups.

Last_Group_Length

Number of logical values in the final group.

Groups

Physical group storage.

Has_Element

function Has_Element (Position : Cursor) return Boolean

@exclude Iterator protocol operation.

Parameters
Position

Cursor to inspect.

Return value

True when Position identifies an element.

Index

subtype Index is Positive range 1 .. Group_Length;

Valid index range within one physical group.

Iterate

function Iterate (Container : Grouped_Array) return Iterator_Interfaces.Forward_Iterator'Class

@exclude Standard iterator protocol.

Parameters
Container

Container to traverse.

Return value

A forward iterator over logical elements.

Iterator_Interfaces

package Iterator_Interfaces is new Ada.Iterator_Interfaces (Cursor, Has_Element);

@exclude Iterator protocol instantiation.

Length

function Length (Container : Grouped_Array) return Positive

Return the number of logical elements, excluding unused tail storage.

Parameters
Container

The grouped array to inspect.

Return value

The logical element count.

No_Element

No_Element : constant Cursor;

@exclude Iterator protocol sentinel.

Payload_Size_In_Storage_Elements

Payload_Size_In_Storage_Elements : constant Natural :=
  (Element_Array'Object_Size + System.Storage_Unit - 1) / System.Storage_Unit;

Payload size in System.Storage_Unit elements before group alignment.

Reference

function Reference (Container : aliased in out Grouped_Array; Position : Cursor) return Reference_Type

@exclude Standard iterator protocol.

Parameters
Container

Container being traversed.

Position

Iterator cursor.

Return value

A mutable reference to the selected element.

Reference

function Reference (Container : aliased in out Grouped_Array; Position : Positive) return Reference_Type

@exclude Standard indexing protocol.

Parameters
Container

Container being indexed.

Position

Flat logical index.

Return value

A mutable reference to the selected element.

Reference_Type

type Reference_Type (Element : not null access Element_Type) is limited private
with Implicit_Dereference => Element;

@exclude Standard variable-indexing protocol.

Record fields
Element

Referenced mutable element.