Annotated Ada Reference ManualLegal Information
Contents   Index   References   Search   Previous   Next 

E.2.3 Remote Call Interface Library Units

1
[A remote call interface library unit can be used as an interface for remote procedure calls (RPCs) (or remote function calls) between active partitions.] 

Language Design Principles

1.a
The restrictions governing a remote call interface library unit are intended to ensure that the values of the actual parameters in a remote call can be meaningfully sent between two active partitions.

Syntax

2
The form of a pragma Remote_Call_Interface is as follows: 
3
  pragma Remote_Call_Interface[(library_unit_name)];
4
The form of a pragma All_Calls_Remote is as follows: 
5
  pragma All_Calls_Remote[(library_unit_name)];
6
A pragma All_Calls_Remote is a library unit pragma. 

Legality Rules

7/3
{8652/0078} {AI95-00048-01} {AI05-0243-1} A pragma Remote_Call_Interface is used to specify that a library unit is a remote call interface (RCI), namely that the is a library unit to which the pragma Remote_Call_Interface aspect of the library unit is True applies. A subprogram declared in the visible part of such a library unit, or declared by such a library unit, is called a remote subprogram.
7.a/3
Aspect Description for Remote_Call_Interface: Subprograms in a given package may be used in remote procedure calls.
8/3
{AI05-0206-1} {AI05-0243-1} The declaration of an RCI library unit shall be preelaborable (see 10.2.1), and shall depend semantically only upon declared pure library_items, shared passive library units, remote types library units, or other remote call interface library units, or preelaborated normal library units that are mentioned only in private with clauses.
8.a/3
Ramification: {AI05-0243-1} We say declared pure library_item here, so that (all) limited views are allowed; those are not library units, but they are declared pure library_items.
9/1
{8652/0078} {AI95-00048-01} In addition, the following restrictions apply to the visible part of an RCI library unit: 
10/1
{8652/0078} {AI95-00048-01} its visible part shall not contain the declaration of a variable; 
10.a/1
Reason: {8652/0078} {AI95-00048-01} Remote call interface units packages do not provide remote data access. A shared passive package has to be used for that. 
11/1
{8652/0078} {AI95-00048-01} its visible part shall not contain the declaration of a limited type; 
11.a/2
Reason: {AI95-00240-01} {AI95-00366-01} We disallow the declaration of task and protected types, since calling an entry or a protected subprogram implicitly passes an object of a limited type (the target task or protected object). We disallow other limited types since we require that such types have available user-defined Read and Write attributes, but we certainly don't want the Read and Write attributes themselves to involve remote calls (thereby defeating their purpose of marshalling the value for remote calls). 
12/1
{8652/0078} {AI95-00048-01} its visible part shall not contain a nested generic_declaration;
12.a
Reason: This is disallowed because the body of the nested generic would presumably have access to data inside the body of the RCI package, and if instantiated in a different partition, remote data access might result, which is not supported. 
13/3
{8652/0078} {AI95-00048-01} {AI05-0229-1} it shall not be, nor shall its visible part contain, the declaration of a subprogram for to which aspect a pragma Inline is True applies;
14/3
{8652/0078} {AI95-00048-01} {AI95-00240-01} {AI95-00366-01} {AI05-0101-1} it shall not be, nor shall its visible part contain, a subprogram (or access-to-subprogram) declaration whose profile has [an access parameter or] a parameter or result of a type that does not support external streaming (see 13.13.2) an access parameter, or a formal parameter of a limited type unless that limited type has user-specified Read and Write attributes;
14.a/3
Ramification: {AI05-0101-1} No anonymous access types support external streaming, so they are never allowed as parameters or results of RCI subprograms.
15
any public child of the library unit shall be a remote call interface library unit. 
15.a
Reason: No restrictions apply to the private part of an RCI package, and since a public child can “see” the private part of its parent, such a child must itself have a Remote_Call_Interface pragma, and be assigned to the same partition (see below). 
15.b
Discussion: We considered making the public child of an RCI package implicitly RCI, but it seemed better to require an explicit pragma to avoid any confusion.
15.c
Note that there is no need for a private child to be an RCI package, since it can only be seen from the body of its parent or its siblings, all of which are required to be in the same active partition. 
16/3
 {AI05-0229-1} A If a pragma All_Calls_Remote sets the All_Calls_Remote representation aspect of the applies to a library unit to which the pragma applies to the value True. If the All_Calls_Remote aspect of a library unit is True, the library unit shall be a remote call interface.
16.a/3
Aspect Description for All_Calls_Remote: All remote procedure calls should use the Partition Communication Subsystem, even if they are local.

Post-Compilation Rules

17
A remote call interface library unit shall be assigned to at most one partition of a given program. A remote call interface library unit whose parent is also an RCI library unit shall be assigned only to the same partition as its parent. 
17.a/1
Implementation Note: {8652/0078} {AI95-00048-01} The declaration of an RCI unit package, with a calling-stub body, is automatically included in all active partitions with compilation units that depend on it. However the whole RCI library unit, including its (non-stub) body, will only be in one of the active partitions. 
18
Notwithstanding the rule given in 10.2, a compilation unit in a given partition that semantically depends on the declaration of an RCI library unit, needs (in the sense of 10.2) only the declaration of the RCI library unit, not the body, to be included in that same partition. [Therefore, the body of an RCI library unit is included only in the partition to which the RCI library unit is explicitly assigned.]

Implementation Requirements

19/3
 {8652/0078} {AI95-00048-01} {AI05-0229-1} If aspect a pragma All_Calls_Remote is True for applies to a given RCI library unit package, then the implementation shall route any call to a subprogram of the RCI unit package from outside the declarative region of the unit package through the Partition Communication Subsystem (PCS); see E.5. Calls to such subprograms from within the declarative region of the unit package are defined to be local and shall not go through the PCS. 
19.a/3
Discussion: {8652/0078} {AI95-00048-01} {AI05-0229-1} When this aspect is False (or not used) Without this pragma, it is presumed that most implementations will make direct calls if the call originates in the same partition as that of the RCI unit package. When this aspect is True With this pragma, all calls from outside the subsystem rooted at the RCI unit package are treated like calls from outside the partition, ensuring that the PCS is involved in all such calls (for debugging, redundancy, etc.).
19.b
Reason: There is no point to force local calls (or calls from children) to go through the PCS, since on the target system, these calls are always local, and all the units are in the same active partition. 

Implementation Permissions

20/3
 {AI05-0243-1} An implementation need not support the Remote_Call_Interface pragma or aspect nor the All_Calls_Remote pragma. [Explicit message-based communication between active partitions can be supported as an alternative to RPC.] 
20.a
Ramification: Of course, it is pointless to support the All_Calls_Remote pragma if the Remote_Call_Interface pragma (or some approximate equivalent) is not supported. 

Incompatibilities With Ada 95

20.b/3
{AI95-00240-01} {AI05-0248-1} Amendment Correction: The wording was changed from “user-specified” to “available” read and write attributes. (This was then further changed, see below.) This means that a type with the attributes specified in the private part would originally have been allowed as a formal parameter of an RCI subprogram, but that is no longer allowed. This change was made so that the rules were consistent with the rules introduced for the Corrigendum for stream attributes; moreover, legality should not depend on the contents of the private part.

Wording Changes from Ada 95

20.c/2
{8652/0078} {AI95-00048-01} Corrigendum: Changed the wording to allow a library subprogram to be a remote call interface unit.
20.d/2
{AI95-00366-01} Changed the wording to use the newly defined term type that supports external streaming, so that various issues with access types in pure units and implicitly declared attributes for type extensions are properly handled. 

Incompatibilities With Ada 2005

20.e/3
{AI05-0101-1} Correction: Added a rule to ensure that function results are streamable; this was missing in previous versions of Ada. While programs that returned unstreamable types from RCI functions were legal, it is not clear what they could have done (as the results could not be marshalled). Thus, it seems unlikely that any real programs will be impacted by this change. 

Extensions to Ada 2005

20.f/3
{AI05-0206-1} Added wording to allow private withs of preelaborated normal units in the specification of a remote call interface unit.
20.g/3
{AI05-0229-1} All_Calls_Remote is now a representation aspect, so it can be specified by an aspect_specification — although the pragma is still preferred by the Standard.
20.h/3
{AI05-0243-1} Remote_Call_Interface is now a categorization aspect, so it can be specified by an aspect_specification — although the pragma is still preferred by the Standard.

Contents   Index   References   Search   Previous   Next 
Ada-Europe Ada 2005 and 2012 Editions sponsored in part by Ada-Europe