annotate gcc/ada/exp_disp.ads @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ------------------------------------------------------------------------------
kono
parents:
diff changeset
2 -- --
kono
parents:
diff changeset
3 -- GNAT COMPILER COMPONENTS --
kono
parents:
diff changeset
4 -- --
kono
parents:
diff changeset
5 -- E X P _ D I S P --
kono
parents:
diff changeset
6 -- --
kono
parents:
diff changeset
7 -- S p e c --
kono
parents:
diff changeset
8 -- --
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
9 -- Copyright (C) 1992-2018, Free Software Foundation, Inc. --
111
kono
parents:
diff changeset
10 -- --
kono
parents:
diff changeset
11 -- GNAT is free software; you can redistribute it and/or modify it under --
kono
parents:
diff changeset
12 -- terms of the GNU General Public License as published by the Free Soft- --
kono
parents:
diff changeset
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
kono
parents:
diff changeset
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
kono
parents:
diff changeset
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
kono
parents:
diff changeset
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
kono
parents:
diff changeset
17 -- for more details. You should have received a copy of the GNU General --
kono
parents:
diff changeset
18 -- Public License distributed with GNAT; see file COPYING3. If not, go to --
kono
parents:
diff changeset
19 -- http://www.gnu.org/licenses for a complete copy of the license. --
kono
parents:
diff changeset
20 -- --
kono
parents:
diff changeset
21 -- GNAT was originally developed by the GNAT team at New York University. --
kono
parents:
diff changeset
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
kono
parents:
diff changeset
23 -- --
kono
parents:
diff changeset
24 ------------------------------------------------------------------------------
kono
parents:
diff changeset
25
kono
parents:
diff changeset
26 -- This package contains routines involved in tagged types and dynamic
kono
parents:
diff changeset
27 -- dispatching expansion.
kono
parents:
diff changeset
28
kono
parents:
diff changeset
29 with Types; use Types;
kono
parents:
diff changeset
30 with Uintp; use Uintp;
kono
parents:
diff changeset
31
kono
parents:
diff changeset
32 package Exp_Disp is
kono
parents:
diff changeset
33
kono
parents:
diff changeset
34 -------------------------------------
kono
parents:
diff changeset
35 -- Predefined primitive operations --
kono
parents:
diff changeset
36 -------------------------------------
kono
parents:
diff changeset
37
kono
parents:
diff changeset
38 -- The predefined primitive operations (PPOs) are subprograms generated
kono
parents:
diff changeset
39 -- by GNAT for a particular tagged type. Their role is to provide support
kono
parents:
diff changeset
40 -- for different Ada language features such as the attribute 'Size or
kono
parents:
diff changeset
41 -- handling of dispatching triggers in select statements. PPOs are created
kono
parents:
diff changeset
42 -- when a tagged type is expanded or frozen. These subprograms are later
kono
parents:
diff changeset
43 -- collected and inserted into the dispatch table of a tagged type at
kono
parents:
diff changeset
44 -- fixed positions. Some of the PPOs that manipulate data in tagged objects
kono
parents:
diff changeset
45 -- require the generation of thunks.
kono
parents:
diff changeset
46
kono
parents:
diff changeset
47 -- List of predefined primitive operations
kono
parents:
diff changeset
48
kono
parents:
diff changeset
49 -- Leading underscores designate reserved names. Bracketed numerical
kono
parents:
diff changeset
50 -- values represent dispatch table slot numbers.
kono
parents:
diff changeset
51
kono
parents:
diff changeset
52 -- _Size (1) - implementation of the attribute 'Size for any tagged
kono
parents:
diff changeset
53 -- type. Constructs of the form Prefix'Size are converted into
kono
parents:
diff changeset
54 -- Prefix._Size.
kono
parents:
diff changeset
55
kono
parents:
diff changeset
56 -- TSS_Stream_Read (2) - implementation of the stream attribute Read
kono
parents:
diff changeset
57 -- for any tagged type.
kono
parents:
diff changeset
58
kono
parents:
diff changeset
59 -- TSS_Stream_Write (3) - implementation of the stream attribute Write
kono
parents:
diff changeset
60 -- for any tagged type.
kono
parents:
diff changeset
61
kono
parents:
diff changeset
62 -- TSS_Stream_Input (4) - implementation of the stream attribute Input
kono
parents:
diff changeset
63 -- for any tagged type.
kono
parents:
diff changeset
64
kono
parents:
diff changeset
65 -- TSS_Stream_Output (5) - implementation of the stream attribute
kono
parents:
diff changeset
66 -- Output for any tagged type.
kono
parents:
diff changeset
67
kono
parents:
diff changeset
68 -- Op_Eq (6) - implementation of the equality operator for any non-
kono
parents:
diff changeset
69 -- limited tagged type.
kono
parents:
diff changeset
70
kono
parents:
diff changeset
71 -- _Assign (7) - implementation of the assignment operator for any
kono
parents:
diff changeset
72 -- non-limited tagged type.
kono
parents:
diff changeset
73
kono
parents:
diff changeset
74 -- TSS_Deep_Adjust (8) - implementation of the finalization operation
kono
parents:
diff changeset
75 -- Adjust for any non-limited tagged type.
kono
parents:
diff changeset
76
kono
parents:
diff changeset
77 -- TSS_Deep_Finalize (9) - implementation of the finalization
kono
parents:
diff changeset
78 -- operation Finalize for any non-limited tagged type.
kono
parents:
diff changeset
79
kono
parents:
diff changeset
80 -- _Disp_Asynchronous_Select (10) - used in the expansion of ATC with
kono
parents:
diff changeset
81 -- dispatching triggers. Null implementation for limited interfaces,
kono
parents:
diff changeset
82 -- full body generation for types that implement limited interfaces,
kono
parents:
diff changeset
83 -- not generated for the rest of the cases. See Expand_N_Asynchronous_
kono
parents:
diff changeset
84 -- Select in Exp_Ch9 for more information.
kono
parents:
diff changeset
85
kono
parents:
diff changeset
86 -- _Disp_Conditional_Select (11) - used in the expansion of conditional
kono
parents:
diff changeset
87 -- selects with dispatching triggers. Null implementation for limited
kono
parents:
diff changeset
88 -- interfaces, full body generation for types that implement limited
kono
parents:
diff changeset
89 -- interfaces, not generated for the rest of the cases. See Expand_N_
kono
parents:
diff changeset
90 -- Conditional_Entry_Call in Exp_Ch9 for more information.
kono
parents:
diff changeset
91
kono
parents:
diff changeset
92 -- _Disp_Get_Prim_Op_Kind (12) - helper routine used in the expansion
kono
parents:
diff changeset
93 -- of ATC with dispatching triggers. Null implementation for limited
kono
parents:
diff changeset
94 -- interfaces, full body generation for types that implement limited
kono
parents:
diff changeset
95 -- interfaces, not generated for the rest of the cases.
kono
parents:
diff changeset
96
kono
parents:
diff changeset
97 -- _Disp_Get_Task_Id (13) - helper routine used in the expansion of
kono
parents:
diff changeset
98 -- Abort, attributes 'Callable and 'Terminated for task interface
kono
parents:
diff changeset
99 -- class-wide types. Full body generation for task types, null
kono
parents:
diff changeset
100 -- implementation for limited interfaces, not generated for the rest
kono
parents:
diff changeset
101 -- of the cases. See Expand_N_Attribute_Reference in Exp_Attr and
kono
parents:
diff changeset
102 -- Expand_N_Abort_Statement in Exp_Ch9 for more information.
kono
parents:
diff changeset
103
kono
parents:
diff changeset
104 -- _Disp_Requeue (14) - used in the expansion of dispatching requeue
kono
parents:
diff changeset
105 -- statements. Null implementation is provided for protected, task
kono
parents:
diff changeset
106 -- and synchronized interfaces. Protected and task types implementing
kono
parents:
diff changeset
107 -- concurrent interfaces receive full bodies. See Expand_N_Requeue_
kono
parents:
diff changeset
108 -- Statement in Exp_Ch9 for more information.
kono
parents:
diff changeset
109
kono
parents:
diff changeset
110 -- _Disp_Timed_Select (15) - used in the expansion of timed selects
kono
parents:
diff changeset
111 -- with dispatching triggers. Null implementation for limited
kono
parents:
diff changeset
112 -- interfaces, full body generation for types that implement limited
kono
parents:
diff changeset
113 -- interfaces, not generated for the rest of the cases. See Expand_N_
kono
parents:
diff changeset
114 -- Timed_Entry_Call for more information.
kono
parents:
diff changeset
115
kono
parents:
diff changeset
116 -- Life cycle of predefined primitive operations
kono
parents:
diff changeset
117
kono
parents:
diff changeset
118 -- The specifications and bodies of the PPOs are created by
kono
parents:
diff changeset
119 -- Make_Predefined_Primitive_Specs and Predefined_Primitive_Bodies
kono
parents:
diff changeset
120 -- in Exp_Ch3. The generated specifications are immediately analyzed,
kono
parents:
diff changeset
121 -- while the bodies are left as freeze actions to the tagged type for
kono
parents:
diff changeset
122 -- which they are created.
kono
parents:
diff changeset
123
kono
parents:
diff changeset
124 -- PPOs are collected and added to the Primitive_Operations list of
kono
parents:
diff changeset
125 -- a type by the regular analysis mechanism.
kono
parents:
diff changeset
126
kono
parents:
diff changeset
127 -- PPOs are frozen by Exp_Ch3.Predefined_Primitive_Freeze
kono
parents:
diff changeset
128
kono
parents:
diff changeset
129 -- Thunks for PPOs are created by Make_DT
kono
parents:
diff changeset
130
kono
parents:
diff changeset
131 -- Dispatch table positions of PPOs are set by Set_All_DT_Position
kono
parents:
diff changeset
132
kono
parents:
diff changeset
133 -- Calls to PPOs proceed as regular dispatching calls. If the PPO
kono
parents:
diff changeset
134 -- has a thunk, a call proceeds as a regular dispatching call with
kono
parents:
diff changeset
135 -- a thunk.
kono
parents:
diff changeset
136
kono
parents:
diff changeset
137 -- Guidelines for addition of new predefined primitive operations
kono
parents:
diff changeset
138
kono
parents:
diff changeset
139 -- Update the value of constant Max_Predef_Prims in a-tags.ads to
kono
parents:
diff changeset
140 -- indicate the new number of PPOs.
kono
parents:
diff changeset
141
kono
parents:
diff changeset
142 -- Introduce a new predefined name for the new PPO in Snames.ads and
kono
parents:
diff changeset
143 -- Snames.adb.
kono
parents:
diff changeset
144
kono
parents:
diff changeset
145 -- Categorize the new PPO name as predefined by adding an entry in
kono
parents:
diff changeset
146 -- Is_Predefined_Dispatching_Operation in Exp_Disp.
kono
parents:
diff changeset
147
kono
parents:
diff changeset
148 -- Generate the specification of the new PPO in Make_Predefined_
kono
parents:
diff changeset
149 -- Primitive_Spec in Exp_Ch3.adb. The Is_Internal flag of the defining
kono
parents:
diff changeset
150 -- identifier of the specification must be set to True.
kono
parents:
diff changeset
151
kono
parents:
diff changeset
152 -- Generate the body of the new PPO in Predefined_Primitive_Bodies in
kono
parents:
diff changeset
153 -- Exp_Ch3.adb. The Is_Internal flag of the defining identifier of the
kono
parents:
diff changeset
154 -- specification must be set to True.
kono
parents:
diff changeset
155
kono
parents:
diff changeset
156 -- If the new PPO requires a thunk, add an entry in Freeze_Subprogram
kono
parents:
diff changeset
157 -- in Exp_Ch6.adb.
kono
parents:
diff changeset
158
kono
parents:
diff changeset
159 -- When generating calls to a PPO, use Find_Prim_Op from Exp_Util.ads
kono
parents:
diff changeset
160 -- to retrieve the entity of the operation directly.
kono
parents:
diff changeset
161
kono
parents:
diff changeset
162 -- Number of predefined primitive operations added by the Expander
kono
parents:
diff changeset
163 -- for a tagged type. If more predefined primitive operations are
kono
parents:
diff changeset
164 -- added, the following items must be changed:
kono
parents:
diff changeset
165
kono
parents:
diff changeset
166 -- Ada.Tags.Max_Predef_Prims - indirect use
kono
parents:
diff changeset
167 -- Exp_Disp.Default_Prim_Op_Position - indirect use
kono
parents:
diff changeset
168 -- Exp_Disp.Set_All_DT_Position - direct use
kono
parents:
diff changeset
169
kono
parents:
diff changeset
170 procedure Apply_Tag_Checks (Call_Node : Node_Id);
kono
parents:
diff changeset
171 -- Generate checks required on dispatching calls
kono
parents:
diff changeset
172
kono
parents:
diff changeset
173 function Building_Static_DT (Typ : Entity_Id) return Boolean;
kono
parents:
diff changeset
174 pragma Inline (Building_Static_DT);
kono
parents:
diff changeset
175 -- Returns true when building statically allocated dispatch tables
kono
parents:
diff changeset
176
kono
parents:
diff changeset
177 function Building_Static_Secondary_DT (Typ : Entity_Id) return Boolean;
kono
parents:
diff changeset
178 pragma Inline (Building_Static_Secondary_DT);
kono
parents:
diff changeset
179 -- Returns true when building statically allocated secondary dispatch
kono
parents:
diff changeset
180 -- tables
kono
parents:
diff changeset
181
kono
parents:
diff changeset
182 procedure Build_Static_Dispatch_Tables (N : Node_Id);
kono
parents:
diff changeset
183 -- N is a library level package declaration or package body. Build the
kono
parents:
diff changeset
184 -- static dispatch table of the tagged types defined at library level. In
kono
parents:
diff changeset
185 -- case of package declarations with private part the generated nodes are
kono
parents:
diff changeset
186 -- added at the end of the list of private declarations. Otherwise they are
kono
parents:
diff changeset
187 -- added to the end of the list of public declarations. In case of package
kono
parents:
diff changeset
188 -- bodies they are added to the end of the list of declarations of the
kono
parents:
diff changeset
189 -- package body.
kono
parents:
diff changeset
190
kono
parents:
diff changeset
191 function Convert_Tag_To_Interface
kono
parents:
diff changeset
192 (Typ : Entity_Id; Expr : Node_Id) return Node_Id;
kono
parents:
diff changeset
193 pragma Inline (Convert_Tag_To_Interface);
kono
parents:
diff changeset
194 -- This function is used in class-wide interface conversions; the expanded
kono
parents:
diff changeset
195 -- code generated to convert a tagged object to a class-wide interface type
kono
parents:
diff changeset
196 -- involves referencing the tag component containing the secondary dispatch
kono
parents:
diff changeset
197 -- table associated with the interface. Given the expression Expr that
kono
parents:
diff changeset
198 -- references a tag component, we cannot generate an unchecked conversion
kono
parents:
diff changeset
199 -- to leave the expression decorated with the class-wide interface type Typ
kono
parents:
diff changeset
200 -- because an unchecked conversion cannot be seen as a no-op. An unchecked
kono
parents:
diff changeset
201 -- conversion is conceptually a function call and therefore the RM allows
kono
parents:
diff changeset
202 -- the backend to obtain a copy of the value of the actual object and store
kono
parents:
diff changeset
203 -- it in some other place (like a register); in such case the interface
kono
parents:
diff changeset
204 -- conversion is not equivalent to a displacement of the pointer to the
kono
parents:
diff changeset
205 -- interface and any further displacement fails. Although the functionality
kono
parents:
diff changeset
206 -- of this function is simple and could be done directly, the purpose of
kono
parents:
diff changeset
207 -- this routine is to leave well documented in the sources these
kono
parents:
diff changeset
208 -- occurrences.
kono
parents:
diff changeset
209
kono
parents:
diff changeset
210 -- If Expr is an N_Selected_Component that references a tag generate:
kono
parents:
diff changeset
211 -- type ityp is non null access Typ;
kono
parents:
diff changeset
212 -- ityp!(Expr'Address).all
kono
parents:
diff changeset
213
kono
parents:
diff changeset
214 -- if Expr is an N_Function_Call to Ada.Tags.Displace then generate:
kono
parents:
diff changeset
215 -- type ityp is non null access Typ;
kono
parents:
diff changeset
216 -- ityp!(Expr).all
kono
parents:
diff changeset
217
kono
parents:
diff changeset
218 function CPP_Num_Prims (Typ : Entity_Id) return Nat;
kono
parents:
diff changeset
219 -- Return the number of primitives of the C++ part of the dispatch table.
kono
parents:
diff changeset
220 -- For types that are not derivations of CPP types return 0.
kono
parents:
diff changeset
221
kono
parents:
diff changeset
222 function Elab_Flag_Needed (Typ : Entity_Id) return Boolean;
kono
parents:
diff changeset
223 -- Return True if the elaboration of the tagged type Typ is completed at
kono
parents:
diff changeset
224 -- run time by the execution of code located in the IP routine and the
kono
parents:
diff changeset
225 -- expander must generate an extra elaboration flag to avoid performing
kono
parents:
diff changeset
226 -- such elaboration twice.
kono
parents:
diff changeset
227
kono
parents:
diff changeset
228 procedure Expand_Dispatching_Call (Call_Node : Node_Id);
kono
parents:
diff changeset
229 -- Expand the call to the operation through the dispatch table and perform
kono
parents:
diff changeset
230 -- the required tag checks when appropriate. For CPP types tag checks are
kono
parents:
diff changeset
231 -- not relevant.
kono
parents:
diff changeset
232
kono
parents:
diff changeset
233 procedure Expand_Interface_Actuals (Call_Node : Node_Id);
kono
parents:
diff changeset
234 -- Ada 2005 (AI-251): Displace all the actuals corresponding to class-wide
kono
parents:
diff changeset
235 -- interfaces to reference the interface tag of the actual object
kono
parents:
diff changeset
236
kono
parents:
diff changeset
237 procedure Expand_Interface_Conversion (N : Node_Id);
kono
parents:
diff changeset
238 -- Ada 2005 (AI-251): N is a type-conversion node. Displace the pointer
kono
parents:
diff changeset
239 -- to the object to give access to the interface tag associated with the
kono
parents:
diff changeset
240 -- dispatch table of the target type.
kono
parents:
diff changeset
241
kono
parents:
diff changeset
242 procedure Expand_Interface_Thunk
kono
parents:
diff changeset
243 (Prim : Node_Id;
kono
parents:
diff changeset
244 Thunk_Id : out Entity_Id;
kono
parents:
diff changeset
245 Thunk_Code : out Node_Id);
kono
parents:
diff changeset
246 -- Ada 2005 (AI-251): When a tagged type implements abstract interfaces we
kono
parents:
diff changeset
247 -- generate additional subprograms (thunks) associated with each primitive
kono
parents:
diff changeset
248 -- Prim to have a layout compatible with the C++ ABI. The thunk displaces
kono
parents:
diff changeset
249 -- the pointers to the actuals that depend on the controlling type before
kono
parents:
diff changeset
250 -- transferring control to the target subprogram. If there is no need to
kono
parents:
diff changeset
251 -- generate the thunk then Thunk_Id and Thunk_Code are set to Empty.
kono
parents:
diff changeset
252 -- Otherwise they are set to the defining identifier and the subprogram
kono
parents:
diff changeset
253 -- body of the generated thunk.
kono
parents:
diff changeset
254
kono
parents:
diff changeset
255 function Has_CPP_Constructors (Typ : Entity_Id) return Boolean;
kono
parents:
diff changeset
256 -- Returns true if the type has CPP constructors
kono
parents:
diff changeset
257
kono
parents:
diff changeset
258 function Is_Expanded_Dispatching_Call (N : Node_Id) return Boolean;
kono
parents:
diff changeset
259 -- Returns true if N is the expanded code of a dispatching call
kono
parents:
diff changeset
260
kono
parents:
diff changeset
261 function Make_DT (Typ : Entity_Id; N : Node_Id := Empty) return List_Id;
kono
parents:
diff changeset
262 -- Expand the declarations for the Dispatch Table. The node N is the
kono
parents:
diff changeset
263 -- declaration that forces the generation of the table. It is used to place
kono
parents:
diff changeset
264 -- error messages when the declaration leads to the freezing of a given
kono
parents:
diff changeset
265 -- primitive operation that has an incomplete non- tagged formal.
kono
parents:
diff changeset
266
kono
parents:
diff changeset
267 function Make_Disp_Asynchronous_Select_Body
kono
parents:
diff changeset
268 (Typ : Entity_Id) return Node_Id;
kono
parents:
diff changeset
269 -- Ada 2005 (AI-345): Generate the body of the primitive operation of type
kono
parents:
diff changeset
270 -- Typ used for dispatching in asynchronous selects. Generate a null body
kono
parents:
diff changeset
271 -- if Typ is an interface type.
kono
parents:
diff changeset
272
kono
parents:
diff changeset
273 function Make_Disp_Asynchronous_Select_Spec
kono
parents:
diff changeset
274 (Typ : Entity_Id) return Node_Id;
kono
parents:
diff changeset
275 -- Ada 2005 (AI-345): Generate the specification of the primitive operation
kono
parents:
diff changeset
276 -- of type Typ used for dispatching in asynchronous selects.
kono
parents:
diff changeset
277
kono
parents:
diff changeset
278 function Make_Disp_Conditional_Select_Body
kono
parents:
diff changeset
279 (Typ : Entity_Id) return Node_Id;
kono
parents:
diff changeset
280 -- Ada 2005 (AI-345): Generate the body of the primitive operation of type
kono
parents:
diff changeset
281 -- Typ used for dispatching in conditional selects. Generate a null body
kono
parents:
diff changeset
282 -- if Typ is an interface type.
kono
parents:
diff changeset
283
kono
parents:
diff changeset
284 function Make_Disp_Conditional_Select_Spec
kono
parents:
diff changeset
285 (Typ : Entity_Id) return Node_Id;
kono
parents:
diff changeset
286 -- Ada 2005 (AI-345): Generate the specification of the primitive operation
kono
parents:
diff changeset
287 -- of type Typ used for dispatching in conditional selects.
kono
parents:
diff changeset
288
kono
parents:
diff changeset
289 function Make_Disp_Get_Prim_Op_Kind_Body
kono
parents:
diff changeset
290 (Typ : Entity_Id) return Node_Id;
kono
parents:
diff changeset
291 -- Ada 2005 (AI-345): Generate the body of the primitive operation of type
kono
parents:
diff changeset
292 -- Typ used for retrieving the callable entity kind during dispatching in
kono
parents:
diff changeset
293 -- asynchronous selects. Generate a null body if Typ is an interface type.
kono
parents:
diff changeset
294
kono
parents:
diff changeset
295 function Make_Disp_Get_Prim_Op_Kind_Spec
kono
parents:
diff changeset
296 (Typ : Entity_Id) return Node_Id;
kono
parents:
diff changeset
297 -- Ada 2005 (AI-345): Generate the specification of the primitive operation
kono
parents:
diff changeset
298 -- of the type Typ use for retrieving the callable entity kind during
kono
parents:
diff changeset
299 -- dispatching in asynchronous selects.
kono
parents:
diff changeset
300
kono
parents:
diff changeset
301 function Make_Disp_Get_Task_Id_Body
kono
parents:
diff changeset
302 (Typ : Entity_Id) return Node_Id;
kono
parents:
diff changeset
303 -- Ada 2005 (AI-345): Generate body of the primitive operation of type Typ
kono
parents:
diff changeset
304 -- used for retrieving the _task_id field of a task interface class- wide
kono
parents:
diff changeset
305 -- type. Generate a null body if Typ is an interface or a non-task type.
kono
parents:
diff changeset
306
kono
parents:
diff changeset
307 function Make_Disp_Get_Task_Id_Spec
kono
parents:
diff changeset
308 (Typ : Entity_Id) return Node_Id;
kono
parents:
diff changeset
309 -- Ada 2005 (AI-345): Generate the specification of the primitive operation
kono
parents:
diff changeset
310 -- of type Typ used for retrieving the _task_id field of a task interface
kono
parents:
diff changeset
311 -- class-wide type.
kono
parents:
diff changeset
312
kono
parents:
diff changeset
313 function Make_Disp_Requeue_Body
kono
parents:
diff changeset
314 (Typ : Entity_Id) return Node_Id;
kono
parents:
diff changeset
315 -- Ada 2005 (AI05-0030): Generate the body of the primitive operation of
kono
parents:
diff changeset
316 -- type Typ used for dispatching on requeue statements. Generate a body
kono
parents:
diff changeset
317 -- containing a single null-statement if Typ is an interface type.
kono
parents:
diff changeset
318
kono
parents:
diff changeset
319 function Make_Disp_Requeue_Spec
kono
parents:
diff changeset
320 (Typ : Entity_Id) return Node_Id;
kono
parents:
diff changeset
321 -- Ada 2005 (AI05-0030): Generate the specification of the primitive
kono
parents:
diff changeset
322 -- operation of type Typ used for dispatching requeue statements.
kono
parents:
diff changeset
323
kono
parents:
diff changeset
324 function Make_Disp_Timed_Select_Body
kono
parents:
diff changeset
325 (Typ : Entity_Id) return Node_Id;
kono
parents:
diff changeset
326 -- Ada 2005 (AI-345): Generate the body of the primitive operation of type
kono
parents:
diff changeset
327 -- Typ used for dispatching in timed selects. Generate a body containing
kono
parents:
diff changeset
328 -- a single null-statement if Typ is an interface type.
kono
parents:
diff changeset
329
kono
parents:
diff changeset
330 function Make_Disp_Timed_Select_Spec
kono
parents:
diff changeset
331 (Typ : Entity_Id) return Node_Id;
kono
parents:
diff changeset
332 -- Ada 2005 (AI-345): Generate the specification of the primitive operation
kono
parents:
diff changeset
333 -- of type Typ used for dispatching in timed selects.
kono
parents:
diff changeset
334
kono
parents:
diff changeset
335 function Make_Select_Specific_Data_Table
kono
parents:
diff changeset
336 (Typ : Entity_Id) return List_Id;
kono
parents:
diff changeset
337 -- Ada 2005 (AI-345): Create and populate the auxiliary table in the TSD
kono
parents:
diff changeset
338 -- of Typ used for dispatching in asynchronous, conditional and timed
kono
parents:
diff changeset
339 -- selects. Generate code to set the primitive operation kinds and entry
kono
parents:
diff changeset
340 -- indexes of primitive operations and primitive wrappers.
kono
parents:
diff changeset
341
kono
parents:
diff changeset
342 function Make_Tags (Typ : Entity_Id) return List_Id;
kono
parents:
diff changeset
343 -- Generate the entities associated with the primary and secondary tags of
kono
parents:
diff changeset
344 -- Typ and fill the contents of Access_Disp_Table. In case of library level
kono
parents:
diff changeset
345 -- tagged types this routine imports the forward declaration of the tag
kono
parents:
diff changeset
346 -- entity, that will be declared and exported by Make_DT.
kono
parents:
diff changeset
347
kono
parents:
diff changeset
348 function Register_Primitive
kono
parents:
diff changeset
349 (Loc : Source_Ptr;
kono
parents:
diff changeset
350 Prim : Entity_Id) return List_Id;
kono
parents:
diff changeset
351 -- Build code to register Prim in the primary or secondary dispatch table.
kono
parents:
diff changeset
352 -- If Prim is associated with a secondary dispatch table then generate also
kono
parents:
diff changeset
353 -- its thunk and register it in the associated secondary dispatch table.
kono
parents:
diff changeset
354 -- In general the dispatch tables are always generated by Make_DT and
kono
parents:
diff changeset
355 -- Make_Secondary_DT; this routine is only used in two corner cases:
kono
parents:
diff changeset
356 --
kono
parents:
diff changeset
357 -- 1) To construct the dispatch table of a tagged type whose parent
kono
parents:
diff changeset
358 -- is a CPP_Class (see Build_Init_Procedure).
kono
parents:
diff changeset
359 -- 2) To handle late overriding of dispatching operations (see
kono
parents:
diff changeset
360 -- Check_Dispatching_Operation and Make_DT).
kono
parents:
diff changeset
361 --
kono
parents:
diff changeset
362 -- The caller is responsible for inserting the generated code in the
kono
parents:
diff changeset
363 -- proper place.
kono
parents:
diff changeset
364
kono
parents:
diff changeset
365 procedure Set_All_DT_Position (Typ : Entity_Id);
kono
parents:
diff changeset
366 -- Set the DT_Position field for each primitive operation. In the CPP
kono
parents:
diff changeset
367 -- Class case check that no pragma CPP_Virtual is missing and that the
kono
parents:
diff changeset
368 -- DT_Position are coherent
kono
parents:
diff changeset
369
kono
parents:
diff changeset
370 procedure Set_CPP_Constructors (Typ : Entity_Id);
kono
parents:
diff changeset
371 -- Typ is a CPP_Class type. Create the Init procedures of that type
kono
parents:
diff changeset
372 -- required to handle its default and non-default constructors. The
kono
parents:
diff changeset
373 -- functions to which pragma CPP_Constructor is applied in the sources
kono
parents:
diff changeset
374 -- are functions returning this type, and having an implicit access to the
kono
parents:
diff changeset
375 -- target object in its first argument; such implicit argument is explicit
kono
parents:
diff changeset
376 -- in the IP procedures built here.
kono
parents:
diff changeset
377
kono
parents:
diff changeset
378 procedure Set_DT_Position_Value (Prim : Entity_Id; Value : Uint);
kono
parents:
diff changeset
379 -- Set the position of a dispatching primitive its dispatch table. For
kono
parents:
diff changeset
380 -- subprogram wrappers propagate the value to the wrapped subprogram.
kono
parents:
diff changeset
381
kono
parents:
diff changeset
382 procedure Set_DTC_Entity_Value (Tagged_Type : Entity_Id; Prim : Entity_Id);
kono
parents:
diff changeset
383 -- Set the definite value of the DTC_Entity value associated with a given
kono
parents:
diff changeset
384 -- primitive of a tagged type. For subprogram wrappers, propagate the value
kono
parents:
diff changeset
385 -- to the wrapped subprogram.
kono
parents:
diff changeset
386
kono
parents:
diff changeset
387 procedure Write_DT (Typ : Entity_Id);
kono
parents:
diff changeset
388 pragma Export (Ada, Write_DT);
kono
parents:
diff changeset
389 -- Debugging procedure (to be called within gdb)
kono
parents:
diff changeset
390
kono
parents:
diff changeset
391 end Exp_Disp;