Attribute Simple_Storage_Pool (GNAT Reference Manual) (original) (raw)


4.56 Attribute Simple_Storage_Pool

For every nonformal, nonderived access-to-object type Acc, the representation attribute Simple_Storage_Pool may be specified via an attribute_definition_clause (or by specifying the equivalent aspect):

My_Pool : My_Simple_Storage_Pool_Type;

type Acc is access My_Data_Type;

for Acc'Simple_Storage_Pool use My_Pool;

The name given in an attribute_definition_clause for theSimple_Storage_Pool attribute shall denote a variable of a ‘simple storage pool type’ (see pragma Simple_Storage_Pool_Type).

The use of this attribute is only allowed for a prefix denoting a type for which it has been specified. The type of the attribute is the type of the variable specified as the simple storage pool of the access type, and the attribute denotes that variable.

It is illegal to specify both Storage_Pool and Simple_Storage_Poolfor the same access type.

If the Simple_Storage_Pool attribute has been specified for an access type, then applying the Storage_Pool attribute to the type is flagged with a warning and its evaluation raises the exception Program_Error.

If the Simple_Storage_Pool attribute has been specified for an access type S, then the evaluation of the attribute S'Storage_Sizereturns the result of calling Storage_Size (S'Simple_Storage_Pool), which is intended to indicate the number of storage elements reserved for the simple storage pool. If the Storage_Size function has not been defined for the simple storage pool type, then this attribute returns zero.

If an access type S has a specified simple storage pool of typeSSP, then the evaluation of an allocator for that access type calls the primitive Allocate procedure for type SSP, passingS'Simple_Storage_Pool as the pool parameter. The detailed semantics of such allocators is the same as those defined for allocators in section 13.11 of the Ada Reference Manual, with the term ‘simple storage pool’ substituted for ‘storage pool’.

If an access type S has a specified simple storage pool of typeSSP, then a call to an instance of the Ada.Unchecked_Deallocationfor that access type invokes the primitive Deallocate procedure for type SSP, passing S'Simple_Storage_Pool as the pool parameter. The detailed semantics of such unchecked deallocations is the same as defined in section 13.11.2 of the Ada Reference Manual, except that the term ‘simple storage pool’ is substituted for ‘storage pool’.