1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 2, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING. If not, write --
19 -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
20 -- Boston, MA 02110-1301, USA. --
22 -- GNAT was originally developed by the GNAT team at New York University. --
23 -- Extensive contributions were provided by Ada Core Technologies Inc. --
25 ------------------------------------------------------------------------------
27 -- This package contains utility routines used for the generation of the
28 -- stubs relevant to the distribution annex.
30 with Namet; use Namet;
31 with Types; use Types;
35 procedure Add_RAST_Features (Vis_Decl : Node_Id);
36 -- Build and add bodies for dereference and 'Access subprograms for a
37 -- remote access to subprogram type. Vis_Decl is the declaration node for
40 procedure Add_RACW_Features (RACW_Type : Entity_Id);
41 -- Add RACW features. If the RACW and the designated type are not in the
42 -- same scope, then Add_RACW_Primitive_Declarations_And_Bodies is called
43 -- automatically since we do know the primitive list already.
45 procedure Add_RACW_Primitive_Declarations_And_Bodies
46 (Designated_Type : Entity_Id;
47 Insertion_Node : Node_Id;
48 Body_Decls : List_Id);
49 -- Add primitive for the stub type, and the RPC receiver. The declarations
50 -- are inserted after insertion_Node, while the bodies are appened at the
53 procedure Remote_Types_Tagged_Full_View_Encountered
54 (Full_View : Entity_Id);
55 -- When a full view with a private view is encountered in a Remote_Types
56 -- package and corresponds to a tagged type, then this procedure is called
57 -- to generate the needed RACW features if it is needed.
59 procedure RACW_Type_Is_Asynchronous (RACW_Type : Entity_Id);
60 -- This subprogram must be called when it is detected that the RACW type
63 procedure Expand_Calling_Stubs_Bodies (Unit_Node : Node_Id);
64 -- Call the expansion phase for the calling stubs. The code will be added
65 -- at the end of the compilation unit, which is a package spec.
67 procedure Expand_Receiving_Stubs_Bodies (Unit_Node : Node_Id);
68 -- Call the expansion phase for the calling stubs. The code will be added
69 -- at the end of the compilation unit, which may be either a package spec
72 procedure Expand_All_Calls_Remote_Subprogram_Call (N : Node_Id);
73 -- Rewrite a call to a subprogram located in a Remote_Call_Interface
74 -- package on which the pragma All_Calls_Remote applies so that it
75 -- goes through the PCS. N is either an N_Procedure_Call_Statement
76 -- or an N_Function_Call node.
78 procedure Build_Passive_Partition_Stub (U : Node_Id);
79 -- Build stub for a shared passive package. U is the analyzed
80 -- compilation unit for a package declaration.
82 function Build_Subprogram_Id
84 E : Entity_Id) return Node_Id;
85 -- Build a literal representing the remote subprogram identifier of E
87 function Copy_Specification
90 Ctrl_Type : Entity_Id := Empty;
91 New_Name : Name_Id := No_Name) return Node_Id;
92 -- Build a subprogram specification from another one, or from an
93 -- access-to-subprogram definition. If Ctrl_Type is not Empty, and any
94 -- controlling formal of an anonymous access type is found, then it is
95 -- replaced by an access to Ctrl_Type. If New_Name is given, then it will
96 -- be used as the name for the newly created spec.
98 function Corresponding_Stub_Type (RACW_Type : Entity_Id) return Entity_Id;
99 -- Return the stub type associated with the given RACW type
101 function Underlying_RACW_Type (RAS_Typ : Entity_Id) return Entity_Id;
102 -- Given a remote access-to-subprogram type or its equivalent
103 -- record type, return the RACW type generated to implement it.
105 procedure Append_RACW_Bodies (Decls : List_Id; Spec_Id : Entity_Id);
106 -- Append the unanalyzed subprogram bodies generated to support RACWs
107 -- declared in the given package spec (RACW stream subprograms, calling
108 -- stubs primitive operations) to the given list (which is expected to be
109 -- the declarations list for the corresponding package body, if there is
110 -- one). In the case where a body is present, the subprogram bodies must
111 -- not be generated in the package spec because this would cause an
112 -- incorrect attempt to freeze Taft amendment types declared in the spec.
114 function Make_Transportable_Check
116 Expr : Node_Id) return Node_Id;
117 -- Generate a check that the given expression (an actual in a remote
118 -- subprogram call, or the return value of a function in the context of
119 -- a remote call) satisfies the requirements for being transportable
120 -- across partitions, raising Program_Error if it does not.