annotate gcc/ada/exp_ch9.ads @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children 84e7813d76e9
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 _ C H 9 --
kono
parents:
diff changeset
6 -- --
kono
parents:
diff changeset
7 -- S p e c --
kono
parents:
diff changeset
8 -- --
kono
parents:
diff changeset
9 -- Copyright (C) 1992-2016, Free Software Foundation, Inc. --
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 -- Expand routines for chapter 9 constructs
kono
parents:
diff changeset
27
kono
parents:
diff changeset
28 with Types; use Types;
kono
parents:
diff changeset
29
kono
parents:
diff changeset
30 package Exp_Ch9 is
kono
parents:
diff changeset
31
kono
parents:
diff changeset
32 type Subprogram_Protection_Mode is
kono
parents:
diff changeset
33 (Dispatching_Mode,
kono
parents:
diff changeset
34 Protected_Mode,
kono
parents:
diff changeset
35 Unprotected_Mode);
kono
parents:
diff changeset
36 -- This type is used to distinguish the different protection modes of a
kono
parents:
diff changeset
37 -- protected subprogram.
kono
parents:
diff changeset
38
kono
parents:
diff changeset
39 procedure Build_Activation_Chain_Entity (N : Node_Id);
kono
parents:
diff changeset
40 -- Given a declaration N of an object that is a task, or contains tasks
kono
parents:
diff changeset
41 -- (other than allocators to tasks) this routine ensures that an activation
kono
parents:
diff changeset
42 -- chain has been declared in the appropriate scope, building the required
kono
parents:
diff changeset
43 -- declaration for the chain variable if not. The name of this variable
kono
parents:
diff changeset
44 -- is always _Chain and it is accessed by name.
kono
parents:
diff changeset
45
kono
parents:
diff changeset
46 function Build_Call_With_Task (N : Node_Id; E : Entity_Id) return Node_Id;
kono
parents:
diff changeset
47 -- N is a node representing the name of a task or an access to a task.
kono
parents:
diff changeset
48 -- The value returned is a call to the function whose name is the entity
kono
parents:
diff changeset
49 -- E (typically a runtime routine entity obtained using RTE) with the
kono
parents:
diff changeset
50 -- Task_Id of the associated task as the parameter. The caller is
kono
parents:
diff changeset
51 -- responsible for analyzing and resolving the resulting tree.
kono
parents:
diff changeset
52
kono
parents:
diff changeset
53 procedure Build_Class_Wide_Master (Typ : Entity_Id);
kono
parents:
diff changeset
54 -- Given an access-to-limited class-wide type or an access-to-limited
kono
parents:
diff changeset
55 -- interface, ensure that the designated type has a _master and generate
kono
parents:
diff changeset
56 -- a renaming of the said master to service the access type.
kono
parents:
diff changeset
57
kono
parents:
diff changeset
58 procedure Build_Master_Entity (Obj_Or_Typ : Entity_Id);
kono
parents:
diff changeset
59 -- Given the name of an object or a type which is either a task, contains
kono
parents:
diff changeset
60 -- tasks or designates tasks, create a _master in the appropriate scope
kono
parents:
diff changeset
61 -- which captures the value of Current_Master. Mark the nearest enclosing
kono
parents:
diff changeset
62 -- body or block as being a task master.
kono
parents:
diff changeset
63
kono
parents:
diff changeset
64 procedure Build_Master_Renaming
kono
parents:
diff changeset
65 (Ptr_Typ : Entity_Id;
kono
parents:
diff changeset
66 Ins_Nod : Node_Id := Empty);
kono
parents:
diff changeset
67 -- Given an access type Ptr_Typ whose designated type is either a task or
kono
parents:
diff changeset
68 -- contains tasks, create a renaming of the form:
kono
parents:
diff changeset
69 --
kono
parents:
diff changeset
70 -- <Ptr_Typ>M : Master_Id renames _Master;
kono
parents:
diff changeset
71 --
kono
parents:
diff changeset
72 -- where _master denotes the task master of the enclosing context. Ins_Nod
kono
parents:
diff changeset
73 -- is used to provide a specific insertion node for the renaming.
kono
parents:
diff changeset
74
kono
parents:
diff changeset
75 function Build_Private_Protected_Declaration (N : Node_Id) return Entity_Id;
kono
parents:
diff changeset
76 -- A subprogram body without a previous spec that appears in a protected
kono
parents:
diff changeset
77 -- body must be expanded separately to create a subprogram declaration
kono
parents:
diff changeset
78 -- for it, in order to resolve internal calls to it from other protected
kono
parents:
diff changeset
79 -- operations. It would seem that no locking version of the operation is
kono
parents:
diff changeset
80 -- needed, but in fact, in Ada 2005 the subprogram may be used in a call-
kono
parents:
diff changeset
81 -- back, and therefore a protected version of the operation must be
kono
parents:
diff changeset
82 -- generated as well.
kono
parents:
diff changeset
83 --
kono
parents:
diff changeset
84 -- Possibly factor this with Exp_Dist.Copy_Specification ???
kono
parents:
diff changeset
85
kono
parents:
diff changeset
86 function Build_Protected_Sub_Specification
kono
parents:
diff changeset
87 (N : Node_Id;
kono
parents:
diff changeset
88 Prot_Typ : Entity_Id;
kono
parents:
diff changeset
89 Mode : Subprogram_Protection_Mode) return Node_Id;
kono
parents:
diff changeset
90 -- Build the specification for protected subprogram. This is called when
kono
parents:
diff changeset
91 -- expanding a protected type, and also when expanding the declaration for
kono
parents:
diff changeset
92 -- an Access_To_Protected_Subprogram type. In the latter case, Prot_Typ is
kono
parents:
diff changeset
93 -- empty, and the first parameter of the signature of the protected op is
kono
parents:
diff changeset
94 -- of type System.Address.
kono
parents:
diff changeset
95
kono
parents:
diff changeset
96 procedure Build_Protected_Subprogram_Call
kono
parents:
diff changeset
97 (N : Node_Id;
kono
parents:
diff changeset
98 Name : Node_Id;
kono
parents:
diff changeset
99 Rec : Node_Id;
kono
parents:
diff changeset
100 External : Boolean := True);
kono
parents:
diff changeset
101 -- The node N is a subprogram or entry call to a protected subprogram. This
kono
parents:
diff changeset
102 -- procedure rewrites this call with the appropriate expansion. Name is the
kono
parents:
diff changeset
103 -- subprogram, and Rec is the record corresponding to the protected object.
kono
parents:
diff changeset
104 -- External is False if the call is to another protected subprogram within
kono
parents:
diff changeset
105 -- the same object.
kono
parents:
diff changeset
106
kono
parents:
diff changeset
107 procedure Build_Protected_Subprogram_Call_Cleanup
kono
parents:
diff changeset
108 (Op_Spec : Node_Id;
kono
parents:
diff changeset
109 Conc_Typ : Node_Id;
kono
parents:
diff changeset
110 Loc : Source_Ptr;
kono
parents:
diff changeset
111 Stmts : List_Id);
kono
parents:
diff changeset
112 -- Append to Stmts the cleanups after a call to a protected subprogram
kono
parents:
diff changeset
113 -- whose specification is Op_Spec. Conc_Typ is the concurrent type and Loc
kono
parents:
diff changeset
114 -- the sloc for appended statements. The cleanup will either unlock the
kono
parents:
diff changeset
115 -- protected object or serve pending entries.
kono
parents:
diff changeset
116
kono
parents:
diff changeset
117 procedure Build_Task_Activation_Call (N : Node_Id);
kono
parents:
diff changeset
118 -- This procedure is called for constructs that can be task activators,
kono
parents:
diff changeset
119 -- i.e. task bodies, subprogram bodies, package bodies and blocks. If the
kono
parents:
diff changeset
120 -- construct is a task activator (as indicated by the non-empty setting of
kono
parents:
diff changeset
121 -- Activation_Chain_Entity, either in the construct, or, in the case of a
kono
parents:
diff changeset
122 -- package body, in its associated package spec), then a call to
kono
parents:
diff changeset
123 -- Activate_Tasks with this entity as the single parameter is inserted at
kono
parents:
diff changeset
124 -- the start of the statements of the activator.
kono
parents:
diff changeset
125
kono
parents:
diff changeset
126 procedure Build_Task_Allocate_Block
kono
parents:
diff changeset
127 (Actions : List_Id;
kono
parents:
diff changeset
128 N : Node_Id;
kono
parents:
diff changeset
129 Args : List_Id);
kono
parents:
diff changeset
130 -- This routine is used in the case of allocators where the designated type
kono
parents:
diff changeset
131 -- is a task or contains tasks. In this case, the normal initialize call
kono
parents:
diff changeset
132 -- is replaced by:
kono
parents:
diff changeset
133 --
kono
parents:
diff changeset
134 -- blockname : label;
kono
parents:
diff changeset
135 -- blockname : declare
kono
parents:
diff changeset
136 -- _Chain : Activation_Chain;
kono
parents:
diff changeset
137 --
kono
parents:
diff changeset
138 -- procedure _Expunge is
kono
parents:
diff changeset
139 -- begin
kono
parents:
diff changeset
140 -- Expunge_Unactivated_Tasks (_Chain);
kono
parents:
diff changeset
141 -- end;
kono
parents:
diff changeset
142 --
kono
parents:
diff changeset
143 -- begin
kono
parents:
diff changeset
144 -- Init (Args);
kono
parents:
diff changeset
145 -- Activate_Tasks (_Chain);
kono
parents:
diff changeset
146 -- at end
kono
parents:
diff changeset
147 -- _Expunge;
kono
parents:
diff changeset
148 -- end;
kono
parents:
diff changeset
149 --
kono
parents:
diff changeset
150 -- to get the task or tasks created and initialized. The expunge call
kono
parents:
diff changeset
151 -- ensures that any tasks that get created but not activated due to an
kono
parents:
diff changeset
152 -- exception are properly expunged (it has no effect in the normal case).
kono
parents:
diff changeset
153 -- The argument N is the allocator, and Args is the list of arguments for
kono
parents:
diff changeset
154 -- the initialization call, constructed by the caller, which uses the
kono
parents:
diff changeset
155 -- Master_Id of the access type as the _Master parameter, and _Chain
kono
parents:
diff changeset
156 -- (defined above) as the _Chain parameter.
kono
parents:
diff changeset
157
kono
parents:
diff changeset
158 procedure Build_Task_Allocate_Block_With_Init_Stmts
kono
parents:
diff changeset
159 (Actions : List_Id;
kono
parents:
diff changeset
160 N : Node_Id;
kono
parents:
diff changeset
161 Init_Stmts : List_Id);
kono
parents:
diff changeset
162 -- Ada 2005 (AI-287): Similar to previous routine, but used to expand
kono
parents:
diff changeset
163 -- allocated aggregates with default initialized components. Init_Stmts
kono
parents:
diff changeset
164 -- contains the list of statements required to initialize the allocated
kono
parents:
diff changeset
165 -- aggregate. It replaces the call to Init (Args) done by
kono
parents:
diff changeset
166 -- Build_Task_Allocate_Block. Also used to expand allocators containing
kono
parents:
diff changeset
167 -- build-in-place function calls.
kono
parents:
diff changeset
168
kono
parents:
diff changeset
169 function Build_Wrapper_Spec
kono
parents:
diff changeset
170 (Subp_Id : Entity_Id;
kono
parents:
diff changeset
171 Obj_Typ : Entity_Id;
kono
parents:
diff changeset
172 Formals : List_Id) return Node_Id;
kono
parents:
diff changeset
173 -- Ada 2005 (AI-345): Build the specification of a primitive operation
kono
parents:
diff changeset
174 -- associated with a protected or task type. This is required to implement
kono
parents:
diff changeset
175 -- dispatching calls through interfaces. Subp_Id is the primitive to be
kono
parents:
diff changeset
176 -- wrapped, Obj_Typ is the type of the newly added formal parameter to
kono
parents:
diff changeset
177 -- handle object notation, Formals are the original entry formals that
kono
parents:
diff changeset
178 -- will be explicitly replicated.
kono
parents:
diff changeset
179
kono
parents:
diff changeset
180 function Concurrent_Ref (N : Node_Id) return Node_Id;
kono
parents:
diff changeset
181 -- Given the name of a concurrent object (task or protected object), or
kono
parents:
diff changeset
182 -- the name of an access to a concurrent object, this function returns an
kono
parents:
diff changeset
183 -- expression referencing the associated Task_Id or Protection object,
kono
parents:
diff changeset
184 -- respectively. Note that a special case is when the name is a reference
kono
parents:
diff changeset
185 -- to a task type name. This can only happen within a task body, and the
kono
parents:
diff changeset
186 -- meaning is to get the Task_Id for the currently executing task.
kono
parents:
diff changeset
187
kono
parents:
diff changeset
188 function Convert_Concurrent
kono
parents:
diff changeset
189 (N : Node_Id;
kono
parents:
diff changeset
190 Typ : Entity_Id) return Node_Id;
kono
parents:
diff changeset
191 -- N is an expression of type Typ. If the type is not a concurrent type
kono
parents:
diff changeset
192 -- then it is returned unchanged. If it is a task or protected reference,
kono
parents:
diff changeset
193 -- Convert_Concurrent creates an unchecked conversion node from this
kono
parents:
diff changeset
194 -- expression to the corresponding concurrent record type value. We need
kono
parents:
diff changeset
195 -- this in any situation where the concurrent type is used, because the
kono
parents:
diff changeset
196 -- actual concurrent object is an object of the corresponding concurrent
kono
parents:
diff changeset
197 -- type, and manipulations on the concurrent object actually manipulate the
kono
parents:
diff changeset
198 -- corresponding object of the record type.
kono
parents:
diff changeset
199
kono
parents:
diff changeset
200 function Entry_Index_Expression
kono
parents:
diff changeset
201 (Sloc : Source_Ptr;
kono
parents:
diff changeset
202 Ent : Entity_Id;
kono
parents:
diff changeset
203 Index : Node_Id;
kono
parents:
diff changeset
204 Ttyp : Entity_Id)
kono
parents:
diff changeset
205 return Node_Id;
kono
parents:
diff changeset
206 -- Returns an expression to compute a task entry index given the name of
kono
parents:
diff changeset
207 -- the entry or entry family. For the case of a task entry family, the
kono
parents:
diff changeset
208 -- Index parameter contains the expression for the subscript. Ttyp is the
kono
parents:
diff changeset
209 -- task type.
kono
parents:
diff changeset
210
kono
parents:
diff changeset
211 procedure Establish_Task_Master (N : Node_Id);
kono
parents:
diff changeset
212 -- Given a subprogram body, or a block statement, or a task body, this
kono
parents:
diff changeset
213 -- procedure makes the necessary transformations required of a task master
kono
parents:
diff changeset
214 -- (add Enter_Master call at start, and establish a cleanup routine to make
kono
parents:
diff changeset
215 -- sure Complete_Master is called on exit).
kono
parents:
diff changeset
216
kono
parents:
diff changeset
217 procedure Expand_Access_Protected_Subprogram_Type (N : Node_Id);
kono
parents:
diff changeset
218 -- Build Equivalent_Type for an Access_To_Protected_Subprogram.
kono
parents:
diff changeset
219 -- Equivalent_Type is a record type with two components: a pointer to the
kono
parents:
diff changeset
220 -- protected object, and a pointer to the operation itself.
kono
parents:
diff changeset
221
kono
parents:
diff changeset
222 procedure Expand_Accept_Declarations (N : Node_Id; Ent : Entity_Id);
kono
parents:
diff changeset
223 -- Expand declarations required for accept statement. See bodies of both
kono
parents:
diff changeset
224 -- Expand_Accept_Declarations and Expand_N_Accept_Statement for full
kono
parents:
diff changeset
225 -- details of the nature and use of these declarations, which are inserted
kono
parents:
diff changeset
226 -- immediately before the accept node N. The second argument is the entity
kono
parents:
diff changeset
227 -- for the corresponding entry.
kono
parents:
diff changeset
228
kono
parents:
diff changeset
229 procedure Expand_Entry_Barrier (N : Node_Id; Ent : Entity_Id);
kono
parents:
diff changeset
230 -- Expand the entry barrier into a function. This is called directly
kono
parents:
diff changeset
231 -- from Analyze_Entry_Body so that the discriminals and privals of the
kono
parents:
diff changeset
232 -- barrier can be attached to the function declaration list, and a new
kono
parents:
diff changeset
233 -- set prepared for the entry body procedure, before the entry body
kono
parents:
diff changeset
234 -- statement sequence can be expanded. The resulting function is analyzed
kono
parents:
diff changeset
235 -- now, within the context of the protected object, to resolve calls to
kono
parents:
diff changeset
236 -- other protected functions.
kono
parents:
diff changeset
237
kono
parents:
diff changeset
238 procedure Expand_N_Abort_Statement (N : Node_Id);
kono
parents:
diff changeset
239 procedure Expand_N_Accept_Statement (N : Node_Id);
kono
parents:
diff changeset
240 procedure Expand_N_Asynchronous_Select (N : Node_Id);
kono
parents:
diff changeset
241 procedure Expand_N_Conditional_Entry_Call (N : Node_Id);
kono
parents:
diff changeset
242 procedure Expand_N_Delay_Relative_Statement (N : Node_Id);
kono
parents:
diff changeset
243 procedure Expand_N_Delay_Until_Statement (N : Node_Id);
kono
parents:
diff changeset
244 procedure Expand_N_Entry_Body (N : Node_Id);
kono
parents:
diff changeset
245 procedure Expand_N_Entry_Call_Statement (N : Node_Id);
kono
parents:
diff changeset
246 procedure Expand_N_Entry_Declaration (N : Node_Id);
kono
parents:
diff changeset
247 procedure Expand_N_Protected_Body (N : Node_Id);
kono
parents:
diff changeset
248
kono
parents:
diff changeset
249 procedure Expand_N_Protected_Type_Declaration (N : Node_Id);
kono
parents:
diff changeset
250 -- Expands protected type declarations. This results, among other things,
kono
parents:
diff changeset
251 -- in the declaration of a record type for the representation of protected
kono
parents:
diff changeset
252 -- objects and (if there are entries) in an entry service procedure. The
kono
parents:
diff changeset
253 -- Protection value used by the GNARL to control the object will always be
kono
parents:
diff changeset
254 -- the first field of the record, and the entry service procedure spec (if
kono
parents:
diff changeset
255 -- it exists) will always immediately follow the record declaration. This
kono
parents:
diff changeset
256 -- allows these two nodes to be found from the type, without benefit of
kono
parents:
diff changeset
257 -- further attributes, using Corresponding_Record.
kono
parents:
diff changeset
258
kono
parents:
diff changeset
259 procedure Expand_N_Requeue_Statement (N : Node_Id);
kono
parents:
diff changeset
260 procedure Expand_N_Selective_Accept (N : Node_Id);
kono
parents:
diff changeset
261 procedure Expand_N_Single_Protected_Declaration (N : Node_Id);
kono
parents:
diff changeset
262 procedure Expand_N_Single_Task_Declaration (N : Node_Id);
kono
parents:
diff changeset
263 procedure Expand_N_Task_Body (N : Node_Id);
kono
parents:
diff changeset
264 procedure Expand_N_Task_Type_Declaration (N : Node_Id);
kono
parents:
diff changeset
265 procedure Expand_N_Timed_Entry_Call (N : Node_Id);
kono
parents:
diff changeset
266
kono
parents:
diff changeset
267 procedure Expand_Protected_Body_Declarations
kono
parents:
diff changeset
268 (N : Node_Id;
kono
parents:
diff changeset
269 Spec_Id : Entity_Id);
kono
parents:
diff changeset
270 -- Expand declarations required for a protected body. See bodies of both
kono
parents:
diff changeset
271 -- Expand_Protected_Body_Declarations and Expand_N_Protected_Body for full
kono
parents:
diff changeset
272 -- details of the nature and use of these declarations. The second argument
kono
parents:
diff changeset
273 -- is the entity for the corresponding protected type declaration.
kono
parents:
diff changeset
274
kono
parents:
diff changeset
275 function External_Subprogram (E : Entity_Id) return Entity_Id;
kono
parents:
diff changeset
276 -- Return the external version of a protected operation, which locks
kono
parents:
diff changeset
277 -- the object before invoking the internal protected subprogram body.
kono
parents:
diff changeset
278
kono
parents:
diff changeset
279 function Find_Master_Scope (E : Entity_Id) return Entity_Id;
kono
parents:
diff changeset
280 -- When a type includes tasks, a master entity is created in the scope, to
kono
parents:
diff changeset
281 -- be used by the runtime during activation. In general the master is the
kono
parents:
diff changeset
282 -- immediate scope in which the type is declared, but in Ada 2005, in the
kono
parents:
diff changeset
283 -- presence of synchronized classwide interfaces, the immediate scope of
kono
parents:
diff changeset
284 -- an anonymous access type may be a transient scope, which has no run-time
kono
parents:
diff changeset
285 -- presence. In this case, the scope of the master is the innermost scope
kono
parents:
diff changeset
286 -- that comes from source.
kono
parents:
diff changeset
287
kono
parents:
diff changeset
288 function First_Protected_Operation (D : List_Id) return Node_Id;
kono
parents:
diff changeset
289 -- Given the declarations list for a protected body, find the
kono
parents:
diff changeset
290 -- first protected operation body.
kono
parents:
diff changeset
291
kono
parents:
diff changeset
292 procedure Install_Private_Data_Declarations
kono
parents:
diff changeset
293 (Loc : Source_Ptr;
kono
parents:
diff changeset
294 Spec_Id : Entity_Id;
kono
parents:
diff changeset
295 Conc_Typ : Entity_Id;
kono
parents:
diff changeset
296 Body_Nod : Node_Id;
kono
parents:
diff changeset
297 Decls : List_Id;
kono
parents:
diff changeset
298 Barrier : Boolean := False;
kono
parents:
diff changeset
299 Family : Boolean := False);
kono
parents:
diff changeset
300 -- This routines generates several types, objects and object renamings used
kono
parents:
diff changeset
301 -- in the handling of discriminants and private components of protected and
kono
parents:
diff changeset
302 -- task types. It also generates the entry index for entry families. Formal
kono
parents:
diff changeset
303 -- Spec_Id denotes an entry, entry family or a subprogram, Conc_Typ is the
kono
parents:
diff changeset
304 -- concurrent type where Spec_Id resides, Body_Nod is the corresponding
kono
parents:
diff changeset
305 -- body of Spec_Id, Decls are the declarations of the subprogram or entry.
kono
parents:
diff changeset
306 -- Flag Barrier denotes whether the context is an entry barrier function.
kono
parents:
diff changeset
307 -- Flag Family is used in conjunction with Barrier to denote a barrier for
kono
parents:
diff changeset
308 -- an entry family.
kono
parents:
diff changeset
309 --
kono
parents:
diff changeset
310 -- The generated types, entities and renamings are:
kono
parents:
diff changeset
311 --
kono
parents:
diff changeset
312 -- * If flag Barrier is set or Spec_Id denotes a protected entry or an
kono
parents:
diff changeset
313 -- entry family, generate:
kono
parents:
diff changeset
314 --
kono
parents:
diff changeset
315 -- type prot_typVP is access prot_typV;
kono
parents:
diff changeset
316 -- _object : prot_typVP := prot_typV (_O);
kono
parents:
diff changeset
317 --
kono
parents:
diff changeset
318 -- where prot_typV is the corresponding record of a protected type and
kono
parents:
diff changeset
319 -- _O is a formal parameter representing the concurrent object of either
kono
parents:
diff changeset
320 -- the barrier function or the entry (family).
kono
parents:
diff changeset
321 --
kono
parents:
diff changeset
322 -- * If Conc_Typ is a protected type, create a renaming for the Protection
kono
parents:
diff changeset
323 -- field _object:
kono
parents:
diff changeset
324 --
kono
parents:
diff changeset
325 -- conc_typR : protection_typ renames _object._object;
kono
parents:
diff changeset
326 --
kono
parents:
diff changeset
327 -- * If Conc_Typ has discriminants, create renamings of the form:
kono
parents:
diff changeset
328 --
kono
parents:
diff changeset
329 -- discr_nameD : discr_typ renames _object.discr_name;
kono
parents:
diff changeset
330 -- or
kono
parents:
diff changeset
331 -- discr_nameD : discr_typ renames _task.discr_name;
kono
parents:
diff changeset
332 --
kono
parents:
diff changeset
333 -- * If Conc_Typ denotes a protected type and has private components,
kono
parents:
diff changeset
334 -- generate renamings of the form:
kono
parents:
diff changeset
335 --
kono
parents:
diff changeset
336 -- comp_name : comp_typ renames _object.comp_name;
kono
parents:
diff changeset
337 --
kono
parents:
diff changeset
338 -- * Finally, is flag Barrier and Family are set or Spec_Id denotes an
kono
parents:
diff changeset
339 -- entry family, generate the entry index constant:
kono
parents:
diff changeset
340 --
kono
parents:
diff changeset
341 -- subtype Jnn is <Type of Index> range Low .. High;
kono
parents:
diff changeset
342 -- J : constant Jnn :=
kono
parents:
diff changeset
343 -- Jnn'Val (_E - <Index expression> + Jnn'Pos (Jnn'First));
kono
parents:
diff changeset
344 --
kono
parents:
diff changeset
345 -- All the above declarations are inserted in the order shown to the front
kono
parents:
diff changeset
346 -- of Decls.
kono
parents:
diff changeset
347
kono
parents:
diff changeset
348 function Make_Task_Create_Call (Task_Rec : Entity_Id) return Node_Id;
kono
parents:
diff changeset
349 -- Given the entity of the record type created for a task type, build
kono
parents:
diff changeset
350 -- the call to Create_Task
kono
parents:
diff changeset
351
kono
parents:
diff changeset
352 function Make_Initialize_Protection
kono
parents:
diff changeset
353 (Protect_Rec : Entity_Id) return List_Id;
kono
parents:
diff changeset
354 -- Given the entity of the record type created for a protected type, build
kono
parents:
diff changeset
355 -- a list of statements needed for proper initialization of the object.
kono
parents:
diff changeset
356
kono
parents:
diff changeset
357 function Next_Protected_Operation (N : Node_Id) return Node_Id;
kono
parents:
diff changeset
358 -- Given a protected operation node (a subprogram or entry body), find the
kono
parents:
diff changeset
359 -- following node in the declarations list.
kono
parents:
diff changeset
360
kono
parents:
diff changeset
361 procedure Set_Discriminals (Dec : Node_Id);
kono
parents:
diff changeset
362 -- Replace discriminals in a protected type for use by the next protected
kono
parents:
diff changeset
363 -- operation on the type. Each operation needs a new set of discriminals,
kono
parents:
diff changeset
364 -- since it needs a unique renaming of the discriminant fields in the
kono
parents:
diff changeset
365 -- record used to implement the protected type.
kono
parents:
diff changeset
366
kono
parents:
diff changeset
367 end Exp_Ch9;