E.2.3 Remote Call Interface Library Units
[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
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
Legality Rules
{
8652/0078}
{
AI95-00048-01}
{
AI05-0243-1}
{
AI12-0417-1}
When
the library unit aspect (see 13.1.1) A pragma
Remote_Call_Interface
of is used to specify that a library
unit is
True, the library unit is a
remote
call interface (RCI), namely that the Remote_Call_Interface
aspect of the library unit
is True. A subprogram declared in the visible part of such a library
unit, or declared by such a library unit, is called a
remote subprogram.
Aspect Description for Remote_Call_Interface:
Subprograms in a given package may be used in remote procedure calls.
{
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, other remote
call interface library units, or preelaborated normal library units that
are mentioned only in private with clauses.
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.
Reason: {
8652/0078}
{
AI95-00048-01}
Remote call interface units do not provide remote data access. A shared
passive package has to be used for that.
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 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).
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.
{
AI12-0283-1}
it shall not be, nor shall its visible part contain,
the declaration of a subprogram that is nonblocking (see 9.5);
Reason: All such
subprograms are remote subprograms, and all calls on remote subprograms
are considered potentially blocking, so they cannot statically be allowed
in nonblocking code.
Ramification: The
type declaration of a remote subprogram is illegal if the Nonblocking
aspect is True, either implicitly by inheritance or by explicit specification.
Ramification: {
AI05-0101-1}
No anonymous access types support external streaming, so they are never
allowed as parameters or results of RCI subprograms.
any public child of the library unit shall be a
remote call interface library unit.
Reason: {
AI12-0417-1}
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
aspect pragma,
and be assigned to the same partition (see below).
Discussion: {
AI12-0417-1}
We considered making the public child of an RCI package implicitly RCI,
but it seemed better to require an explicit
aspect pragma
to avoid any confusion.
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.
{
AI12-0002-1}
Specification of a stream-oriented attribute is
illegal in the specification of a remote call interface library unit.
In addition to the places where Legality Rules normally apply (see 12.3),
this rule applies also in the private part of an instance of a generic
unit.
Reason: Stream-oriented
attributes are intended to be used locally (to marshall values), while
subprograms in a remote call interface are intended to be used remotely.
We resolve the conflict by banning the local use routines. The type should
be included in a remote types package and imported into the remote call
interface package.
{
AI05-0229-1}
{
AI12-0417-1}
A pragma All_Calls_Remotesets
the All_Calls_Remote
is a library unit representation
aspect
of the 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.
Aspect Description for All_Calls_Remote:
All indirect or dispatching remote subprogram
calls, and all direct remote subprogram procedure
calls, should use the Partition Communication
Subsystem, even if they are local.
Post-Compilation Rules
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.
Implementation Note: {
8652/0078}
{
AI95-00048-01}
The declaration of an RCI unit, 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.
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
{
8652/0078}
{
AI95-00048-01}
{
AI05-0229-1}
{
AI12-0031-1}
If aspect All_Calls_Remote is True for a
given RCI library unit, then the implementation shall route any
of
the following calls call to a subprogram
of the RCI unit from outside the declarative region of the unit
through the Partition Communication Subsystem (PCS); see
E.5:.
Calls to such subprograms from within the declarative region of the unit
are defined to be local and shall not go through the PCS.
{
AI12-0031-1}
A direct call to a subprogram of the RCI unit from
outside the declarative region of the unit;
{
AI12-0031-1}
An indirect call through a remote access-to-subprogram
value that designates a subprogram of the RCI unit;
{
AI12-0031-1}
A dispatching call with a controlling operand designated
by a remote access-to-class-wide value whose tag identifies a type declared
in the RCI unit.
Discussion: {
8652/0078}
{
AI95-00048-01}
{
AI05-0229-1}
{
AI12-0031-1}
{
AI12-0005-1}
When this aspect is False (or not used), it is presumed that most implementations
will
not make
direct
calls
through the PCS if the call originates
in the same partition as that of the RCI unit. When this aspect is True,
all
indirect or dispatching remote subprogram calls
to the RCI unit, and all direct calls from outside the subsystem rooted at the
RCI unit
, are treated like calls from outside
the partition, ensuring that the PCS is involved in all such calls (for
debugging, redundancy, etc.).
Reason: {
AI12-0031-1}
{
AI12-0005-1}
There is no point
in forcing to
force local
direct calls (
including 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
{
AI05-0243-1}
{
AI12-0417-1}
{
AI12-0444-1}
An implementation
may omit need
not support
for the Remote_Call_Interface
pragma or aspect
or nor the
All_Calls_Remote
aspect pragma.
[Explicit message-based communication between active partitions can be
supported as an alternative to RPC.]
Ramification: {
AI12-0417-1}
Of course, it is pointless to support the All_Calls_Remote
aspect pragma
if the Remote_Call_Interface
aspect pragma
(or some approximate equivalent) is not supported.
Incompatibilities With Ada 95
{
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
{
8652/0078}
{
AI95-00048-01}
Corrigendum: Changed the wording to allow a library subprogram
to be a remote call interface unit.
{
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
{
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
{
AI05-0206-1}
Added wording to allow private withs of preelaborated
normal units in the specification of a remote call interface unit.
Inconsistencies With Ada 2012
{
AI12-0031-1}
Corrigendum: Redefined
when indirect and dispatching remote calls have to be remote for a unit
for which the aspect All_Calls_Remote is True. With the new rules, a
local target called indirectly or via dispatching will be routed through
the PCS, while that was not necessarily true in earlier Ada. If a program
depended on local targets not being routed through the PCS even when
All_Calls_Remote is used, then it might behave differently or fail in
corrected Ada
2012 as corrected with this refinement.
This is highly unlikely as the PCS is going to be able to communicate
with any partition of the program, including the local partition.
Incompatibilities With Ada 2012
{
AI12-0002-1}
Correction: Specifying
user-defined stream-oriented attributes is now illegal in an RCI unit.
If a program contains such attributes, they and their associated type
will need to be moved to a remote types package (which is then imported
into the RCI unit).
Wording Changes from Ada 2012
{
AI12-0283-1}
Added a rule to ensure that potentially blocking
remote calls are not considered nonblocking.
{
AI12-0417-1}
The pragmas Remote_Call_Interface and All_Calls_Remote
are now obsolescent.
Ada 2005 and 2012 Editions sponsored in part by Ada-Europe