annotate gcc/ada/exp_dist.ads @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 1830386684a0
children
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 T --
kono
parents:
diff changeset
6 -- --
kono
parents:
diff changeset
7 -- S p e c --
kono
parents:
diff changeset
8 -- --
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
9 -- Copyright (C) 1992-2019, 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 utility routines used for the generation of the
kono
parents:
diff changeset
27 -- stubs relevant to the distribution annex.
kono
parents:
diff changeset
28
kono
parents:
diff changeset
29 with Namet; use Namet;
kono
parents:
diff changeset
30 with Snames; use Snames;
kono
parents:
diff changeset
31 with Types; use Types;
kono
parents:
diff changeset
32
kono
parents:
diff changeset
33 package Exp_Dist is
kono
parents:
diff changeset
34
kono
parents:
diff changeset
35 PCS_Version_Number : constant array (PCS_Names) of Int :=
kono
parents:
diff changeset
36 (Name_No_DSA => 1,
kono
parents:
diff changeset
37 Name_GARLIC_DSA => 1,
kono
parents:
diff changeset
38 Name_PolyORB_DSA => 6);
kono
parents:
diff changeset
39 -- PCS interface version. This is used to check for consistency between the
kono
parents:
diff changeset
40 -- compiler used to generate distribution stubs and the PCS implementation.
kono
parents:
diff changeset
41 -- It must be incremented whenever a change is made to the generated code
kono
parents:
diff changeset
42 -- for distribution stubs that would result in the compiler being
kono
parents:
diff changeset
43 -- incompatible with an older version of the PCS, or vice versa.
kono
parents:
diff changeset
44
kono
parents:
diff changeset
45 procedure Add_RAST_Features (Vis_Decl : Node_Id);
kono
parents:
diff changeset
46 -- Build and add bodies for dereference and 'Access subprograms for a
kono
parents:
diff changeset
47 -- remote access to subprogram type. Vis_Decl is the declaration node for
kono
parents:
diff changeset
48 -- the RAS type.
kono
parents:
diff changeset
49
kono
parents:
diff changeset
50 procedure Add_RACW_Features (RACW_Type : Entity_Id);
kono
parents:
diff changeset
51 -- Add RACW features. If the RACW and the designated type are not in the
kono
parents:
diff changeset
52 -- same scope, then Add_RACW_Primitive_Declarations_And_Bodies is called
kono
parents:
diff changeset
53 -- automatically since we do know the primitive list already.
kono
parents:
diff changeset
54
kono
parents:
diff changeset
55 procedure Add_RACW_Primitive_Declarations_And_Bodies
kono
parents:
diff changeset
56 (Designated_Type : Entity_Id;
kono
parents:
diff changeset
57 Insertion_Node : Node_Id;
kono
parents:
diff changeset
58 Body_Decls : List_Id);
kono
parents:
diff changeset
59 -- Add primitive for the stub type, and the RPC receiver. The declarations
kono
parents:
diff changeset
60 -- are inserted after Insertion_Node, while the bodies are appended at the
kono
parents:
diff changeset
61 -- end of Body_Decls.
kono
parents:
diff changeset
62
kono
parents:
diff changeset
63 procedure Remote_Types_Tagged_Full_View_Encountered
kono
parents:
diff changeset
64 (Full_View : Entity_Id);
kono
parents:
diff changeset
65 -- When a full view with a private view is encountered in a Remote_Types
kono
parents:
diff changeset
66 -- package and corresponds to a tagged type, then this procedure is called
kono
parents:
diff changeset
67 -- to generate the needed RACW features if it is needed.
kono
parents:
diff changeset
68
kono
parents:
diff changeset
69 procedure RACW_Type_Is_Asynchronous (RACW_Type : Entity_Id);
kono
parents:
diff changeset
70 -- This subprogram must be called when it is detected that the RACW type
kono
parents:
diff changeset
71 -- is asynchronous.
kono
parents:
diff changeset
72
kono
parents:
diff changeset
73 procedure Expand_Calling_Stubs_Bodies (Unit_Node : Node_Id);
kono
parents:
diff changeset
74 -- Call the expansion phase for the calling stubs. The code will be added
kono
parents:
diff changeset
75 -- at the end of the compilation unit, which is a package spec.
kono
parents:
diff changeset
76
kono
parents:
diff changeset
77 procedure Expand_Receiving_Stubs_Bodies (Unit_Node : Node_Id);
kono
parents:
diff changeset
78 -- Call the expansion phase for the receiving stubs. The code will be added
kono
parents:
diff changeset
79 -- at the end of the compilation unit, which may be either a package spec
kono
parents:
diff changeset
80 -- or a package body.
kono
parents:
diff changeset
81
kono
parents:
diff changeset
82 procedure Expand_All_Calls_Remote_Subprogram_Call (N : Node_Id);
kono
parents:
diff changeset
83 -- Rewrite a call to a subprogram located in a Remote_Call_Interface
kono
parents:
diff changeset
84 -- package to which the pragma All_Calls_Remote applies so that it
kono
parents:
diff changeset
85 -- goes through the PCS. N is either an N_Procedure_Call_Statement
kono
parents:
diff changeset
86 -- or an N_Function_Call node.
kono
parents:
diff changeset
87
kono
parents:
diff changeset
88 procedure Build_Passive_Partition_Stub (U : Node_Id);
kono
parents:
diff changeset
89 -- Build stub for a shared passive package. U is the analyzed
kono
parents:
diff changeset
90 -- compilation unit for a package declaration.
kono
parents:
diff changeset
91
kono
parents:
diff changeset
92 function Build_Subprogram_Id
kono
parents:
diff changeset
93 (Loc : Source_Ptr;
kono
parents:
diff changeset
94 E : Entity_Id) return Node_Id;
kono
parents:
diff changeset
95 -- Build a literal representing the remote subprogram identifier of E
kono
parents:
diff changeset
96
kono
parents:
diff changeset
97 function Copy_Specification
kono
parents:
diff changeset
98 (Loc : Source_Ptr;
kono
parents:
diff changeset
99 Spec : Node_Id;
kono
parents:
diff changeset
100 Ctrl_Type : Entity_Id := Empty;
kono
parents:
diff changeset
101 New_Name : Name_Id := No_Name) return Node_Id;
kono
parents:
diff changeset
102 -- Build a subprogram specification from another one, or from an
kono
parents:
diff changeset
103 -- access-to-subprogram definition. If Ctrl_Type is not Empty, and any
kono
parents:
diff changeset
104 -- controlling formal of an anonymous access type is found, then it is
kono
parents:
diff changeset
105 -- replaced by an access to Ctrl_Type. If New_Name is given, then it will
kono
parents:
diff changeset
106 -- be used as the name for the newly created spec.
kono
parents:
diff changeset
107 --
kono
parents:
diff changeset
108 -- Possibly factor this wrt Exp_Ch9.Build_Private_Protected_Declaration???
kono
parents:
diff changeset
109
kono
parents:
diff changeset
110 function Corresponding_Stub_Type (RACW_Type : Entity_Id) return Entity_Id;
kono
parents:
diff changeset
111 -- Return the stub type associated with the given RACW type
kono
parents:
diff changeset
112
kono
parents:
diff changeset
113 function Underlying_RACW_Type (RAS_Typ : Entity_Id) return Entity_Id;
kono
parents:
diff changeset
114 -- Given a remote access-to-subprogram type or its equivalent
kono
parents:
diff changeset
115 -- record type, return the RACW type generated to implement it.
kono
parents:
diff changeset
116
kono
parents:
diff changeset
117 procedure Append_RACW_Bodies (Decls : List_Id; Spec_Id : Entity_Id);
kono
parents:
diff changeset
118 -- Append the unanalyzed subprogram bodies generated to support RACWs
kono
parents:
diff changeset
119 -- declared in the given package spec (RACW stream subprograms, calling
kono
parents:
diff changeset
120 -- stubs primitive operations) to the given list (which is expected to be
kono
parents:
diff changeset
121 -- the declarations list for the corresponding package body, if there is
kono
parents:
diff changeset
122 -- one). In the case where a body is present, the subprogram bodies must
kono
parents:
diff changeset
123 -- not be generated in the package spec because this would cause an
kono
parents:
diff changeset
124 -- incorrect attempt to freeze Taft amendment types declared in the spec.
kono
parents:
diff changeset
125
kono
parents:
diff changeset
126 function Make_Transportable_Check
kono
parents:
diff changeset
127 (Loc : Source_Ptr;
kono
parents:
diff changeset
128 Expr : Node_Id) return Node_Id;
kono
parents:
diff changeset
129 -- Generate a check that the given expression (an actual in a remote
kono
parents:
diff changeset
130 -- subprogram call, or the return value of a function in the context of
kono
parents:
diff changeset
131 -- a remote call) satisfies the requirements for being transportable
kono
parents:
diff changeset
132 -- across partitions, raising Program_Error if it does not.
kono
parents:
diff changeset
133
kono
parents:
diff changeset
134 ----------------------------------------------------------------
kono
parents:
diff changeset
135 -- Functions for expansion of PolyORB/DSA specific attributes --
kono
parents:
diff changeset
136 ----------------------------------------------------------------
kono
parents:
diff changeset
137
kono
parents:
diff changeset
138 function Build_From_Any_Call
kono
parents:
diff changeset
139 (Typ : Entity_Id;
kono
parents:
diff changeset
140 N : Node_Id;
kono
parents:
diff changeset
141 Decls : List_Id) return Node_Id;
kono
parents:
diff changeset
142 -- Build call to From_Any attribute function of type Typ with expression
kono
parents:
diff changeset
143 -- N as actual parameter. Decls is the declarations list for an appropriate
kono
parents:
diff changeset
144 -- enclosing scope of the point where the call will be inserted; if the
kono
parents:
diff changeset
145 -- From_Any attribute for Typ needs to be generated at this point, its
kono
parents:
diff changeset
146 -- declaration is appended to Decls.
kono
parents:
diff changeset
147
kono
parents:
diff changeset
148 function Build_To_Any_Call
kono
parents:
diff changeset
149 (Loc : Source_Ptr;
kono
parents:
diff changeset
150 N : Node_Id;
kono
parents:
diff changeset
151 Decls : List_Id;
kono
parents:
diff changeset
152 Constrained : Boolean := False) return Node_Id;
kono
parents:
diff changeset
153 -- Build call to To_Any attribute function with expression as actual
kono
parents:
diff changeset
154 -- parameter. Loc is the reference location for generated nodes, Decls is
kono
parents:
diff changeset
155 -- the declarations list for an appropriate enclosing scope of the point
kono
parents:
diff changeset
156 -- where the call will be inserted; if the To_Any attribute for Typ needs
kono
parents:
diff changeset
157 -- to be generated at this point, its declaration is appended to Decls.
kono
parents:
diff changeset
158 -- For limited types, if Constrained is True then use 'Write else use
kono
parents:
diff changeset
159 -- 'Output.
kono
parents:
diff changeset
160
kono
parents:
diff changeset
161 function Build_TypeCode_Call
kono
parents:
diff changeset
162 (Loc : Source_Ptr;
kono
parents:
diff changeset
163 Typ : Entity_Id;
kono
parents:
diff changeset
164 Decls : List_Id) return Node_Id;
kono
parents:
diff changeset
165 -- Build call to TypeCode attribute function for Typ. Decls is the
kono
parents:
diff changeset
166 -- declarations list for an appropriate enclosing scope of the point
kono
parents:
diff changeset
167 -- where the call will be inserted; if the To_Any attribute for Typ
kono
parents:
diff changeset
168 -- needs to be generated at this point, its declaration is appended
kono
parents:
diff changeset
169 -- to Decls.
kono
parents:
diff changeset
170
kono
parents:
diff changeset
171 end Exp_Dist;