source: rtems/c/src/exec/score/inline/object.inl @ a5f56a43

4.104.114.84.95
Last change on this file since a5f56a43 was 1a8fde6c, checked in by Joel Sherrill <joel.sherrill@…>, on 03/06/96 at 21:34:57

Removed prototyes for static inline routines and moved the comments into
the inline implementation. The impetus for this was twofold. First,
it is incorrect to have static inline prototypes when using the macro
implementation. Second, this reduced the number of lines in the include
files seen by rtems.h by about 2000 lines.

Next we restricted visibility for the inline routines to inside the
executive itself EXCEPT for a handful of objects. This reduced the
number of include files included by rtems.h by 40 files and reduced
the lines in the include files seen by rtems.h by about 6000 lines.

In total, these reduced the compile time of the entire RTEMS tree by 20%.
This results in about 8 minutes savings on the SparcStation? 10 morgana.

  • Property mode set to 100644
File size: 4.6 KB
Line 
1/*  object.inl
2 *
3 *  This include file contains the static inline implementation of all
4 *  of the inlined routines in the Object Handler.
5 *
6 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
7 *  On-Line Applications Research Corporation (OAR).
8 *  All rights assigned to U.S. Government, 1994.
9 *
10 *  This material may be reproduced by or for the U.S. Government pursuant
11 *  to the copyright license under the clause at DFARS 252.227-7013.  This
12 *  notice must appear in all copies of this file and its derivatives.
13 *
14 *  $Id$
15 */
16
17#ifndef __OBJECTS_inl
18#define __OBJECTS_inl
19
20/*PAGE
21 *
22 *  _Objects_Build_id
23 *
24 *  DESCRIPTION:
25 *
26 *  This function builds an object's id from the processor node and index
27 *  values specified.
28 */
29
30STATIC INLINE Objects_Id _Objects_Build_id(
31  Objects_Classes  the_class,
32  unsigned32       node,
33  unsigned32       index
34)
35{
36  return ( (the_class << OBJECTS_CLASS_START_BIT) |
37           (node << OBJECTS_NODE_START_BIT)       |
38           (index << OBJECTS_INDEX_START_BIT) );
39}
40
41/*PAGE
42 *
43 *  _Objects_Get_class
44 *
45 *  DESCRIPTION:
46 *
47 *  This function returns the class portion of the ID.
48 */
49 
50STATIC INLINE Objects_Classes _Objects_Get_class(
51  Objects_Id id
52)
53{
54  return (Objects_Classes)
55    ((id >> OBJECTS_CLASS_START_BIT) & OBJECTS_CLASS_VALID_BITS);
56}
57 
58
59/*PAGE
60 *
61 *  _Objects_Get_node
62 *
63 *  DESCRIPTION:
64 *
65 *  This function returns the node portion of the ID.
66 */
67
68STATIC INLINE unsigned32 _Objects_Get_node(
69  Objects_Id id
70)
71{
72  return (id >> OBJECTS_NODE_START_BIT) & OBJECTS_NODE_VALID_BITS;
73}
74
75/*PAGE
76 *
77 *  _Objects_Get_index
78 *
79 *  DESCRIPTION:
80 *
81 *  This function returns the index portion of the ID.
82 */
83
84STATIC INLINE unsigned32 _Objects_Get_index(
85  Objects_Id id
86)
87{
88  return (id >> OBJECTS_INDEX_START_BIT) & OBJECTS_INDEX_VALID_BITS;
89}
90
91/*PAGE
92 *
93 *  _Objects_Is_class_valid
94 *
95 *  DESCRIPTION:
96 *
97 *  This function returns TRUE if the class is valid.
98 */
99 
100STATIC INLINE boolean _Objects_Is_class_valid(
101  Objects_Classes the_class
102)
103{
104  return the_class <= OBJECTS_CLASSES_LAST;
105}
106
107/*PAGE
108 *
109 *  _Objects_Is_local_node
110 *
111 *  DESCRIPTION:
112 *
113 *  This function returns TRUE if the node is of the local object, and
114 *  FALSE otherwise.
115 */
116
117STATIC INLINE boolean _Objects_Is_local_node(
118  unsigned32 node
119)
120{
121  return ( node == _Objects_Local_node );
122}
123
124/*PAGE
125 *
126 *  _Objects_Is_local_id
127 *
128 *  DESCRIPTION:
129 *
130 *  This function returns TRUE if the id is of a local object, and
131 *  FALSE otherwise.
132 */
133
134STATIC INLINE boolean _Objects_Is_local_id(
135  Objects_Id id
136)
137{
138  return _Objects_Is_local_node( _Objects_Get_node(id) );
139}
140
141/*PAGE
142 *
143 *  _Objects_Are_ids_equal
144 *
145 *  DESCRIPTION:
146 *
147 *  This function returns TRUE if left and right are equal,
148 *  and FALSE otherwise.
149 */
150
151STATIC INLINE boolean _Objects_Are_ids_equal(
152  Objects_Id left,
153  Objects_Id right
154)
155{
156  return ( left == right );
157}
158
159/*PAGE
160 *
161 *  _Objects_Allocate
162 *
163 *  DESCRIPTION:
164 *
165 *  This function allocates a object control block from
166 *  the inactive chain of free object control blocks.
167 */
168
169STATIC INLINE Objects_Control *_Objects_Allocate(
170  Objects_Information *information
171)
172{
173  return (Objects_Control *) _Chain_Get( &information->Inactive );
174}
175
176/*PAGE
177 *
178 *  _Objects_Free
179 *
180 *  DESCRIPTION:
181 *
182 *  This function frees a object control block to the
183 *  inactive chain of free object control blocks.
184 */
185
186STATIC INLINE void _Objects_Free(
187  Objects_Information *information,
188  Objects_Control     *the_object
189)
190{
191  _Chain_Append( &information->Inactive, &the_object->Node );
192}
193
194/*PAGE
195 *
196 *  _Objects_Open
197 *
198 *  DESCRIPTION:
199 *
200 *  This function places the_object control pointer and object name
201 *  in the Local Pointer and Local Name Tables, respectively.
202 */
203
204STATIC INLINE void _Objects_Open(
205  Objects_Information *information,
206  Objects_Control     *the_object,
207  Objects_Name         name
208)
209{
210  unsigned32  index;
211
212  index = _Objects_Get_index( the_object->id );
213  information->local_table[ index ] = the_object;
214
215  if ( information->is_string )
216    _Objects_Copy_name_string( name, the_object->name );
217  else
218    _Objects_Copy_name_raw( name, the_object->name, information->name_length );
219}
220
221/*PAGE
222 *
223 *  _Objects_Close
224 *
225 *  DESCRIPTION:
226 *
227 *  This function removes the_object control pointer and object name
228 *  in the Local Pointer and Local Name Tables.
229 */
230
231STATIC INLINE void _Objects_Close(
232  Objects_Information  *information,
233  Objects_Control      *the_object
234)
235{
236  unsigned32 index;
237
238  index = _Objects_Get_index( the_object->id );
239  information->local_table[ index ] = NULL;
240  _Objects_Clear_name( the_object->name, information->name_length );
241}
242
243#endif
244/* end of include file */
Note: See TracBrowser for help on using the repository browser.