C++ TargetRTS
Loading...
Searching...
No Matches
RTActorSlot.h
1/*
2 * Licensed Materials - Property of HCL and/or IBM
3 * Copyright HCL Technologies Ltd. 2016, 2021. All Rights Reserved.
4 * Copyright IBM Corporation 1999, 2016. All Rights Reserved.
5 *
6 * U.S. Government Users Restricted Rights - Use, duplication or
7 * disclosure restricted by GSA ADP Schedule.
8 */
9
10#ifndef __RTActorSlot_h__
11#define __RTActorSlot_h__ included
12
13#ifdef PRAGMA
14#pragma interface
15#endif
16
17#ifndef __RTConfig_h__
18#include <RTConfig.h>
19#endif
20
21class RTActor;
22
23// If the replication factor, n, of an optional reference satisfies
24// ( 2 <= n < threshold ), we allocate n + 1 RTSmallOptional objects.
25// The first one serves as the anchor for the free list.
26// This depends on two things:
27// 1. size_t is no larger than a pointer, and
28// 2. all addresses allocated on the heap are even.
29
31{
32 RTS_INLINE static int supports( int size );
33 RTS_INLINE void insert( int prev, int next );
34 RTS_INLINE int inuse( void ) const;
35 RTS_INLINE void prev( int );
36 RTS_INLINE int prev( void ) const;
37 RTS_INLINE void next( int );
38 RTS_INLINE int next( void ) const;
39
40 RTActor * _actor;
41
42 // we assume sizeof( size_t ) <= sizeof( RTActor * )
43 static const size_t link_bits = 4 * sizeof( size_t ) - 1;
44 static const size_t threshold = 1U << link_bits;
45 static const size_t link_mask = threshold - 1;
46 static const size_t next_shift = 1U;
47 static const size_t prev_shift = next_shift + link_bits;
48};
49
50// If ( n >= threshold ), we allocate n + 1 RTLargeOptional objects.
51// The first one serves as the anchor for the free list.
52// The next pointer is nil when the entry has been reserved.
53
55{
56 RTLargeOptional * next;
57 union
58 {
59 RTLargeOptional * prev;
60 RTActor * actor;
61 };
62};
63
64#if RTS_INLINES
65#include <RTActorSlot.inl>
66#endif
67
68#endif // __RTActorSlot_h__
An instance of this class represents a capsule instance.
Definition: RTActor.h:44
Definition: RTActorSlot.h:55
Definition: RTActorSlot.h:31