| 1 |
@comment{ $Source: e:\\cvsroot/ARM/Source/ds.mss,v $ } |
| 2 |
@comment{ $Revision: 1.83 $ $Date: 2020/06/03 00:09:01 $ $Author: randy $ } |
| 3 |
@Part(dist, Root="ada.mss") |
| 4 |
@Comment{$Date: 2020/06/03 00:09:01 $} |
| 5 |
|
| 6 |
@LabeledNormativeAnnex{Distributed Systems} |
| 7 |
|
| 8 |
@begin{Intro} |
| 9 |
@redundant[This Annex defines facilities for supporting the implementation |
| 10 |
of distributed systems using multiple partitions working |
| 11 |
cooperatively as part of a single Ada program.] |
| 12 |
@end{Intro} |
| 13 |
|
| 14 |
@begin{Extend83} |
| 15 |
@Defn{extensions to Ada 83} |
| 16 |
This Annex is new to Ada 95. |
| 17 |
@end{Extend83} |
| 18 |
|
| 19 |
@begin{LinkTime} |
| 20 |
|
| 21 |
@Defn{processing node} |
| 22 |
@Defn{storage node} |
| 23 |
@Defn{distributed system} |
| 24 |
A @i{distributed system} is an interconnection of one or more |
| 25 |
@i{processing nodes} (a system resource that has both computational |
| 26 |
and storage capabilities), and zero or more @i{storage nodes} |
| 27 |
(a system resource that has only storage capabilities, with the storage |
| 28 |
addressable by one or more processing nodes). |
| 29 |
|
| 30 |
@Defn{distributed program} |
| 31 |
A @i{distributed program} comprises one or more partitions that |
| 32 |
execute independently (except when they communicate) in a distributed system. |
| 33 |
|
| 34 |
@Defn2{Term=[configuration], Sec=(of the partitions of a program)} |
| 35 |
The process of mapping the partitions of a program |
| 36 |
to the nodes in a distributed system is |
| 37 |
called @i{configuring the partitions of the program}. |
| 38 |
@end{LinkTime} |
| 39 |
|
| 40 |
@begin{ImplReq} |
| 41 |
|
| 42 |
The implementation shall provide means for explicitly assigning library |
| 43 |
units to a partition and for the configuring and execution of a program |
| 44 |
consisting of multiple partitions on a distributed system; |
| 45 |
the means are implementation defined. |
| 46 |
@ImplDef{The means for creating and executing distributed programs.} |
| 47 |
|
| 48 |
@end{ImplReq} |
| 49 |
|
| 50 |
@begin{ImplPerm} |
| 51 |
|
| 52 |
An implementation may require that the set of processing nodes of |
| 53 |
a distributed system be homogeneous. |
| 54 |
|
| 55 |
@end{ImplPerm} |
| 56 |
|
| 57 |
@begin{Notes} |
| 58 |
|
| 59 |
|
| 60 |
The partitions comprising a program may be executed on differently |
| 61 |
configured distributed systems or on a nondistributed system without |
| 62 |
requiring recompilation. |
| 63 |
A distributed program may be partitioned differently from the same set of |
| 64 |
library units without recompilation. |
| 65 |
The resulting execution is semantically equivalent. |
| 66 |
|
| 67 |
A distributed program retains the same type safety |
| 68 |
as the equivalent single partition program. |
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
@end{Notes} |
| 73 |
|
| 74 |
@LabeledClause{Partitions} |
| 75 |
|
| 76 |
@begin{Intro} |
| 77 |
@redundant[The partitions of a distributed program are classified as either |
| 78 |
active or passive.] |
| 79 |
@end{Intro} |
| 80 |
|
| 81 |
@begin{LinkTime} |
| 82 |
|
| 83 |
@Defn{active partition} |
| 84 |
@Defn{passive partition} |
| 85 |
An @i{active partition} is a partition as defined in |
| 86 |
@RefSecNum{Program Execution}. A @i{passive partition} is a partition |
| 87 |
that has no thread of control of its own, whose |
| 88 |
library units are all preelaborated, and whose data and subprograms are |
| 89 |
accessible to one or more active partitions. |
| 90 |
@begin{Discussion} |
| 91 |
In most situations, a passive partition does not execute, and does not have |
| 92 |
a @lquotes@;real@rquotes@; environment task. Any execution involved in |
| 93 |
its elaboration and initialization occurs before it comes into existence in a |
| 94 |
distributed program (like most preelaborated entities). Likewise, |
| 95 |
there is no concrete meaning to passive partition termination. |
| 96 |
@end{Discussion} |
| 97 |
|
| 98 |
A passive partition shall include only @nt{library_item}s that either are |
| 99 |
declared pure or are shared |
| 100 |
passive (see @RefSecNum{Elaboration Control} and |
| 101 |
@RefSecNum{Shared Passive Library Units}). |
| 102 |
|
| 103 |
An active partition shall be configured on a processing node. |
| 104 |
A passive partition shall be configured either on a storage node |
| 105 |
or on a processing node. |
| 106 |
|
| 107 |
The configuration of the partitions of a program onto a |
| 108 |
distributed system shall |
| 109 |
be consistent with the possibility for data references or calls |
| 110 |
between the partitions implied by their semantic dependences. |
| 111 |
@Defn{remote access} |
| 112 |
Any reference to data or call of |
| 113 |
a subprogram across partitions is called a @i{remote access}. |
| 114 |
@begin{Discussion} |
| 115 |
For example, an active partition that includes a unit with a semantic |
| 116 |
dependence on the declaration of another RCI package of some other active |
| 117 |
partition has to be connected to that other partition by some sort |
| 118 |
of a message passing mechanism. |
| 119 |
|
| 120 |
A passive partition that is accessible to an active partition should have |
| 121 |
its storage addressable to the processor(s) of the active partition. The |
| 122 |
processor(s) should be able to read and write from/to that |
| 123 |
storage, as well as |
| 124 |
to perform @lquotes@;read-modify-write@rquotes@; operations (in order to support entry-less |
| 125 |
protected objects). |
| 126 |
|
| 127 |
@end{Discussion} |
| 128 |
|
| 129 |
@begin{Ramification} |
| 130 |
@ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0359-1]} |
| 131 |
@ChgAdded{Version=[5],Text=[A passive partition has no execution resources of |
| 132 |
its own, so while a call of a subprogram in a passive partition is a remote |
| 133 |
access to that subprogram, it is @i<not> a remote subprogram call (see |
| 134 |
@RefSecNum{Remote Subprogram Calls}). The calling active partition executes |
| 135 |
the body of the subprogram of the passive partition.]} |
| 136 |
@end{Ramification} |
| 137 |
@end{LinkTime} |
| 138 |
|
| 139 |
@begin{RunTime} |
| 140 |
|
| 141 |
@Defn2{Term=[elaboration], Sec=(partition)} |
| 142 |
A @nt{library_item} is elaborated as part of the elaboration |
| 143 |
of each partition that includes it. |
| 144 |
If a normal library unit |
| 145 |
(see @RefSecNum{Categorization of Library Units}) has state, then a separate |
| 146 |
copy of the state exists in each active partition that elaborates it. |
| 147 |
@Redundant[The state evolves independently in each such partition.] |
| 148 |
|
| 149 |
|
| 150 |
@begin{Ramification} |
| 151 |
Normal library units cannot be included in passive partitions. |
| 152 |
@end{Ramification} |
| 153 |
|
| 154 |
@Defn2{Term=[termination], Sec=(of a partition)} |
| 155 |
@Defn2{Term=[abort], Sec=(of a partition)} |
| 156 |
@Defn{inaccessible partition} |
| 157 |
@Defn{accessible partition} |
| 158 |
@Redundant[An active partition @i{terminates} when its environment task |
| 159 |
terminates.] A partition becomes @i{inaccessible} if it terminates or if |
| 160 |
it is @i{aborted}. An active partition is aborted when its environment |
| 161 |
task is aborted. In addition, if a partition fails during its |
| 162 |
elaboration, it becomes inaccessible to other partitions. Other |
| 163 |
implementation-defined events can also result in a partition becoming |
| 164 |
inaccessible. |
| 165 |
@ImplDef{Any events that can result in a partition becoming |
| 166 |
inaccessible.} |
| 167 |
|
| 168 |
@ChgRef{Version=[1],Kind=[Revised]}@ChgNote{To be consistent with 8652/0006} |
| 169 |
@Leading@;For @ChgPrefixType{Version=[1],Kind=[Revised],Text=[a |
| 170 |
@Chg{New=[@nt{prefix}],Old=[prefix]} D that denotes a |
| 171 |
library-level declaration, |
| 172 |
excepting a declaration of or within a declared-pure library unit]}, |
| 173 |
the following attribute is defined: |
| 174 |
@begin{Description} |
| 175 |
@Attribute{Prefix=<D>, AttrName=<Partition_Id>, |
| 176 |
Text=[Denotes a value of the type @i{universal_integer} that |
| 177 |
identifies the partition in which D was elaborated. |
| 178 |
If D denotes the declaration of a remote call interface |
| 179 |
library unit |
| 180 |
(see @RefSecNum{Remote Call Interface Library Units}) the |
| 181 |
given partition is the one where the body of D was elaborated.]} |
| 182 |
@end{Description} |
| 183 |
|
| 184 |
@end{RunTime} |
| 185 |
|
| 186 |
@begin{Bounded} |
| 187 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00226-01]} |
| 188 |
@PDefn2{Term=(bounded error),Sec=(cause)} |
| 189 |
It is a bounded error for there to be cyclic elaboration dependences |
| 190 |
between the active partitions of a single distributed |
| 191 |
program. |
| 192 |
The possible effects@Chg{Version=[2],New=[, in each of the partitions involved,],Old=[]} |
| 193 |
are deadlock during elaboration, or the raising of |
| 194 |
@Chg{Version=[2],New=[Communication_Error or ],Old=[]}Program_Error@Chg{Version=[2], |
| 195 |
New=[],Old=[ in one or all of the active partitions involved]}. |
| 196 |
@end{Bounded} |
| 197 |
|
| 198 |
@begin{ImplPerm} |
| 199 |
|
| 200 |
An implementation may allow multiple active or passive partitions |
| 201 |
to be configured on |
| 202 |
a single processing node, and multiple passive partitions to be |
| 203 |
configured on a single storage node. |
| 204 |
In these cases, the scheduling policies, treatment |
| 205 |
of priorities, and management of shared resources between |
| 206 |
these partitions are implementation defined. |
| 207 |
@ImplDef{The scheduling policies, treatment |
| 208 |
of priorities, and management of shared resources between |
| 209 |
partitions in certain cases.} |
| 210 |
|
| 211 |
An implementation may allow separate copies of an active partition to be |
| 212 |
configured on different processing nodes, and to provide |
| 213 |
appropriate interactions between the copies to present |
| 214 |
a consistent state of the partition to other active partitions. |
| 215 |
@begin{Ramification} |
| 216 |
The language does not specify the nature of these interactions, |
| 217 |
nor the actual level of consistency preserved. |
| 218 |
@end{Ramification} |
| 219 |
|
| 220 |
In an implementation, the partitions of a distributed |
| 221 |
program need not be loaded and elaborated all at the same time; |
| 222 |
they may be loaded and elaborated one at a time over an extended |
| 223 |
period of time. An implementation may provide facilities to abort |
| 224 |
and reload a partition during the execution of a distributed program. |
| 225 |
|
| 226 |
An implementation may allow the state of some of the partitions of |
| 227 |
a distributed program to persist while other partitions of the program |
| 228 |
terminate and are later reinvoked. |
| 229 |
@end{ImplPerm} |
| 230 |
|
| 231 |
@begin{Notes} |
| 232 |
|
| 233 |
Library units are grouped into partitions after compile time, |
| 234 |
but before run time. |
| 235 |
At compile time, only the relevant library unit properties are |
| 236 |
identified using categorization pragmas. |
| 237 |
|
| 238 |
|
| 239 |
The value returned by the Partition_Id attribute can be used as a |
| 240 |
parameter to implementation-provided subprograms in order |
| 241 |
to query information about the partition. |
| 242 |
|
| 243 |
@end{Notes} |
| 244 |
|
| 245 |
@begin{DiffWord95} |
| 246 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00226-01]} |
| 247 |
@ChgAdded{Version=[2],Text=[Corrected wording so that a partition that |
| 248 |
has an elaboration problem will either deadlock or raise an exception. |
| 249 |
While an Ada 95 implementation could allow some partitions to continue to |
| 250 |
execute, they could be accessing unelaborated data, which is very bad |
| 251 |
(and erroneous in a practical sense). Therefore, this isn't listed as an |
| 252 |
inconsistency.]} |
| 253 |
@end{DiffWord95} |
| 254 |
|
| 255 |
|
| 256 |
@RMNewPageVer{Version=[3]}@Comment{For printed version of Ada 2012 RM} |
| 257 |
@LabeledClause{Categorization of Library Units} |
| 258 |
|
| 259 |
@begin{Intro} |
| 260 |
@redundant[Library units can be categorized according to the role |
| 261 |
they play in a distributed program. Certain restrictions |
| 262 |
are associated with each category to ensure that the semantics |
| 263 |
of a distributed program remain close to the semantics for a nondistributed |
| 264 |
program.] |
| 265 |
|
| 266 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0243-1]} |
| 267 |
@RootDefn{categorization pragma} |
| 268 |
@RootDefn{pragma, categorization} |
| 269 |
@PDefn2{Term=[library unit pragma], Sec=(categorization pragmas)} |
| 270 |
@PDefn2{Term=[pragma, library unit], Sec=(categorization pragmas)} |
| 271 |
@Chg{Version=[3],New=[@Defn{categorization aspect}],Old=[]}@Defn{categorized library unit} |
| 272 |
A @i{categorization pragma} is a library unit pragma |
| 273 |
(see @RefSecNum{Pragmas and Program Units}) |
| 274 |
that @Chg{Version=[3],New=[specifies a corresponding @i{categorization aspect}. |
| 275 |
A categorization aspect ],Old=[]}restricts the declarations, child units, or |
| 276 |
semantic dependences of the library unit to which it applies. A |
| 277 |
@i{categorized library unit} is a library unit @Chg{Version=[3],New=[that has a |
| 278 |
categorization aspect that is True],Old=[to which a categorization pragma |
| 279 |
applies]}. |
| 280 |
|
| 281 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0243-1]} |
| 282 |
The pragmas Shared_Passive, Remote_Types, and Remote_Call_Interface |
| 283 |
are categorization pragmas@Chg{Version=[3],New=[, |
| 284 |
and the associated aspects are categorization aspects],Old=[]}. |
| 285 |
In addition, for the purposes of this Annex, the @Chg{Version=[3],New=[aspect |
| 286 |
Pure (see @RefSecNum{Elaboration Control}) is |
| 287 |
considered a categorization aspect and the],Old=[]} |
| 288 |
pragma Pure @Chg{Version=[3],New=[],Old=[(see @RefSecNum{Elaboration Control}) ]}is |
| 289 |
considered a categorization pragma. |
| 290 |
|
| 291 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0078],ARef=[AI95-00048-01]} |
| 292 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0243-1]} |
| 293 |
@Redundant[@Defn{shared passive library unit} |
| 294 |
A library package or generic library package is called a |
| 295 |
@i{shared passive} library unit if @Chg{Version=[3],New=[the],Old=[a]} |
| 296 |
Shared_Passive @Chg{Version=[3],New=[aspect of the unit is True],Old=[pragma |
| 297 |
applies to it]}. @Defn{remote types library unit} A library package or generic |
| 298 |
library package is called a @i{remote types} library unit if |
| 299 |
@Chg{Version=[3],New=[the],Old=[a]} Remote_Types @Chg{Version=[3],New=[aspect of |
| 300 |
the unit is True],Old=[pragma applies to it]}. @Defn{remote call interface} A |
| 301 |
library @Chg{New=[unit],Old=[package or generic library package]} is called a |
| 302 |
@i{remote call interface} if @Chg{Version=[3],New=[the],Old=[a]} |
| 303 |
Remote_Call_Interface @Chg{Version=[3],New=[aspect of the unit is |
| 304 |
True],Old=[pragma applies to it]}.] |
| 305 |
@Defn{normal library unit} |
| 306 |
A @i{normal library unit} is one @Chg{Version=[3],New=[for],Old=[to]} |
| 307 |
which no categorization |
| 308 |
@Chg{Version=[3],New=[aspect is True],Old=[pragma applies]}. |
| 309 |
@begin{TheProof} |
| 310 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0243-1],ARef=[AI05-0299-1]} |
| 311 |
@ChgAdded{Version=[3],Text=[These terms (other than @ldquote@;normal |
| 312 |
library unit@rdquote) are really defined in the following subclauses.]} |
| 313 |
@end{TheProof} |
| 314 |
@begin{Ramification} |
| 315 |
@ChgRef{Version=[1],Kind=[Added],Ref=[8652/0078],ARef=[AI95-00048-01]} |
| 316 |
@ChgAdded{Version=[1],Text=[A library subprogram can be a remote call |
| 317 |
interface, but it cannot be a remote types or shared passive library unit.]} |
| 318 |
@end{Ramification} |
| 319 |
|
| 320 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0206-1],ARef=[AI05-0243-1],ARef=[AI05-0269-1],ARef=[AI05-0299-1]} |
| 321 |
@redundant[The various categories of library units and the associated |
| 322 |
restrictions are described in this @Chg{Version=[3],New=[and the following], |
| 323 |
Old=[clause and its]} subclauses. The categories are |
| 324 |
related hierarchically in that the library units of one category can depend |
| 325 |
semantically only on library units of that category or an earlier |
| 326 |
one@Chg{Version=[3],New=[ in the hierarchy],Old=[]}, except |
| 327 |
that the body of a remote types or remote call interface library unit is |
| 328 |
unrestricted@Chg{Version=[3],New=[, the declaration of a remote types or |
| 329 |
remote call interface library unit may depend on preelaborated normal library |
| 330 |
units that are mentioned only in private with clauses, and all categories can |
| 331 |
depend on limited views],Old=[]}. |
| 332 |
|
| 333 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0243-1],ARef=[AI05-0269-1]} |
| 334 |
@Leading@;The overall hierarchy (including declared pure) is as |
| 335 |
follows@Chg{Version=[3],New=[, with a lower-numbered category being |
| 336 |
@ldquote@;earlier in the hierarchy@rdquote in the sense of the |
| 337 |
previous paragraph],Old=[]}: |
| 338 |
@begin{Enumerate} |
| 339 |
@ChgRef{Version=[3],Kind=[Added]} |
| 340 |
@ChgAdded{Version=[3],Text=[Declared Pure]} |
| 341 |
|
| 342 |
@ChgRef{Version=[3],Kind=[Added]} |
| 343 |
@ChgAdded{Version=[3],Text=[Shared Passive]} |
| 344 |
|
| 345 |
@ChgRef{Version=[3],Kind=[Added]} |
| 346 |
@ChgAdded{Version=[3],Text=[Remote Types]} |
| 347 |
|
| 348 |
@ChgRef{Version=[3],Kind=[Added]} |
| 349 |
@ChgAdded{Version=[3],Text=[Remote Call Interface]} |
| 350 |
|
| 351 |
@ChgRef{Version=[3],Kind=[Added]} |
| 352 |
@ChgAdded{Version=[3],Text=[Normal (no restrictions)]} |
| 353 |
@end{Enumerate} |
| 354 |
@begin{NotIso} |
| 355 |
@ChgAdded{Version=[3],Noparanum=[T],Text=[@Shrink{@i<Paragraphs 7 through 11 |
| 356 |
were deleted.>}]}@Comment{This message should be |
| 357 |
deleted if the paragraphs are ever renumbered.} |
| 358 |
@end{NotIso} |
| 359 |
@begin{Description} |
| 360 |
@ChgRef{Version=[3],Kind=[DeletedNoDelMsg],ARef=[AI05-0243-1]} |
| 361 |
@ChgDeleted{Version=[3],Text=[Declared Pure @\Can depend only on other declared |
| 362 |
pure library units;]} |
| 363 |
|
| 364 |
@ChgRef{Version=[3],Kind=[DeletedNoDelMsg],ARef=[AI05-0243-1]} |
| 365 |
@ChgDeleted{Version=[3],Text=[Shared Passive @\Can depend only on other shared passive |
| 366 |
or declared pure library units;]} |
| 367 |
|
| 368 |
@ChgRef{Version=[3],Kind=[DeletedNoDelMsg],ARef=[AI05-0206-1],ARef=[AI05-0243-1]} |
| 369 |
@ChgDeleted{Version=[3],Text=[Remote Types @\The declaration of the library unit can depend only |
| 370 |
on other remote types library units, |
| 371 |
or one of the |
| 372 |
above library unit categories, or limited views, |
| 373 |
or preelaborated normal library units that are mentioned |
| 374 |
only in private with clauses; |
| 375 |
the body of the library unit is unrestricted;]} |
| 376 |
|
| 377 |
@ChgRef{Version=[3],Kind=[DeletedNoDelMsg],ARef=[AI05-0206-1],ARef=[AI05-0243-1]} |
| 378 |
@ChgDeleted{Version=[3],Text=[Remote Call Interface @\The declaration of the library unit can depend only |
| 379 |
on other remote call interfaces, or one |
| 380 |
of the above; |
| 381 |
the body of the library unit is unrestricted;]} |
| 382 |
|
| 383 |
@ChgRef{Version=[3],Kind=[DeletedNoDelMsg],ARef=[AI05-0243-1]} |
| 384 |
@ChgDeleted{Version=[3],Text=[Normal @\Unrestricted.]} |
| 385 |
@end{Description} |
| 386 |
|
| 387 |
Declared pure and shared passive library units are preelaborated. |
| 388 |
The declaration of a remote types or remote call interface library unit |
| 389 |
is required to be preelaborable. |
| 390 |
] |
| 391 |
|
| 392 |
@end{Intro} |
| 393 |
|
| 394 |
@begin{ImplReq} |
| 395 |
@ChgRef{Version=[1],Kind=[DeletedNoDelMsg],Ref=[8652/0079],ARef=[AI95-00208-01]} |
| 396 |
@ChgDeleted{Version=[1],Text=[For a given library-level type declared in |
| 397 |
a preelaborated library unit or in the declaration of a remote types or remote |
| 398 |
call interface library unit, the implementation shall choose the same |
| 399 |
representation for the type upon each elaboration of the type's declaration for |
| 400 |
different partitions of the same program.]} |
| 401 |
@end{ImplReq} |
| 402 |
@begin{NotIso} |
| 403 |
@ChgAdded{Version=[3],Noparanum=[T],Text=[@Shrink{@i<Paragraph 13 was |
| 404 |
deleted.>}]}@Comment{This message should be deleted if the paragraphs |
| 405 |
are ever renumbered.} |
| 406 |
@end{NotIso} |
| 407 |
|
| 408 |
@begin{ImplPerm} |
| 409 |
|
| 410 |
Implementations are allowed to define other categorization pragmas. |
| 411 |
|
| 412 |
@end{ImplPerm} |
| 413 |
|
| 414 |
@begin{DiffWord95} |
| 415 |
@ChgRef{Version=[2],Kind=[AddedNormal],Ref=[8652/0078],ARef=[AI95-00048-01]} |
| 416 |
@ChgAdded{Version=[2],Text=[@b<Corrigendum:> Clarified that a library |
| 417 |
subprogram can be a remote call interface unit.]} |
| 418 |
|
| 419 |
@ChgRef{Version=[2],Kind=[AddedNormal],Ref=[8652/0079],ARef=[AI95-00208-01]} |
| 420 |
@ChgAdded{Version=[2],Text=[@b<Corrigendum:> Removed the requirement that |
| 421 |
types be represented the same in all partitions, because it prevents the |
| 422 |
definition of heterogeneous distributed systems and goes much further than |
| 423 |
required.]} |
| 424 |
@end{DiffWord95} |
| 425 |
|
| 426 |
@begin{DiffWord2005} |
| 427 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0206-1],ARef=[AI05-0299-1]} |
| 428 |
@ChgAdded{Version=[3],Text=[We now allow private withs of preelaborated |
| 429 |
units in Remote Types and Remote Call Interface units; this is documented |
| 430 |
as an extension in the subclauses where this is defined normatively.]} |
| 431 |
|
| 432 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0243-1],ARef=[AI05-0299-1]} |
| 433 |
@ChgAdded{Version=[3],Text=[We have introduced categorization aspects; these |
| 434 |
are documented as extensions in the subclauses where they actually are defined.]} |
| 435 |
@end{DiffWord2005} |
| 436 |
|
| 437 |
|
| 438 |
@LabeledSubClause{Shared Passive Library Units} |
| 439 |
@begin{Intro} |
| 440 |
@redundant[A shared passive library unit is used for managing global data |
| 441 |
shared between active partitions. The restrictions on shared passive |
| 442 |
library units prevent the data or tasks of one active partition |
| 443 |
from being accessible to another active partition through |
| 444 |
references implicit in objects declared in the shared passive library |
| 445 |
unit.] |
| 446 |
@end{Intro} |
| 447 |
|
| 448 |
@begin{MetaRules} |
| 449 |
The restrictions governing a shared |
| 450 |
passive library unit are |
| 451 |
designed to ensure that objects and |
| 452 |
subprograms declared in the package can be used safely from |
| 453 |
multiple active partitions, even though the active partitions |
| 454 |
live in different address spaces, and have separate run-time systems. |
| 455 |
@end{MetaRules} |
| 456 |
|
| 457 |
@begin{Syntax} |
| 458 |
@begin{SyntaxText} |
| 459 |
@Leading@PDefn2{Term=[categorization pragma], Sec=(Shared_Passive)} |
| 460 |
@PDefn2{Term=[pragma, categorization], Sec=(Shared_Passive)} |
| 461 |
The form of a @nt{pragma} Shared_Passive is as follows: |
| 462 |
@end{SyntaxText} |
| 463 |
|
| 464 |
@PragmaSyn`@key{pragma} @prag(Shared_Passive)[(@SynI{library_unit_}@Syn2{name})];' |
| 465 |
|
| 466 |
@end{Syntax} |
| 467 |
|
| 468 |
@begin{Legality} |
| 469 |
|
| 470 |
@Leading@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0243-1]} |
| 471 |
@Defn{shared passive library unit} |
| 472 |
A@Chg{Version=[3],New=[ @nt{pragma} Shared_Passive is used to specify that a |
| 473 |
library unit is a],Old=[]} @i{shared passive library unit}@Chg{Version=[3],New=[, |
| 474 |
namely that the],Old=[ is |
| 475 |
a library unit to which a]} |
| 476 |
Shared_Passive |
| 477 |
@Chg{Version=[3],New=[aspect@AspectDefn{Shared_Passive} of the library unit is |
| 478 |
True],Old=[pragma applies]}. The following restrictions apply to such a library |
| 479 |
unit: |
| 480 |
|
| 481 |
@ChgAspectDesc{Version=[3],Kind=[AddedNormal],Aspect=[Shared_Passive], |
| 482 |
Text=[@ChgAdded{Version=[3],Text=[A given package is used to represent |
| 483 |
shared memory in a distributed system.]}]} |
| 484 |
|
| 485 |
@begin{itemize} |
| 486 |
@Redundant[it shall be preelaborable (see @RefSecNum{Elaboration Control});] |
| 487 |
@begin{Ramification} |
| 488 |
It cannot contain library-level declarations of protected objects |
| 489 |
with entries, nor of task objects. Task objects are disallowed |
| 490 |
because passive partitions don't have any threads of control of their |
| 491 |
own, nor any run-time system of their own. |
| 492 |
Protected objects with entries are disallowed because an entry queue |
| 493 |
contains references to calling tasks, and that would require in |
| 494 |
effect a pointer from a passive partition back to a task in |
| 495 |
some active partition. |
| 496 |
@end{Ramification} |
| 497 |
|
| 498 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0243-1]} |
| 499 |
it shall depend semantically only upon declared pure or shared passive |
| 500 |
@Chg{Version=[3],New=[@nt{library_item}s],Old=[library units]}; |
| 501 |
@begin{Reason} |
| 502 |
Shared passive packages cannot depend semantically upon remote types packages |
| 503 |
because the values of an access type declared in a remote types package |
| 504 |
refer to the local heap of the active partition including the |
| 505 |
remote types package. |
| 506 |
@end{Reason} |
| 507 |
@begin{Ramification} |
| 508 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0243-1]} |
| 509 |
@ChgAdded{Version=[3],Text=[We say @nt{library_item} here, so that |
| 510 |
limited views are allowed; those are not library units, but they are |
| 511 |
@nt{library_item}.]} |
| 512 |
@end{Ramification} |
| 513 |
|
| 514 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0080],ARef=[AI95-00003-01]} |
| 515 |
@ChgRef{Version=[4],Kind=[Revised],ARef=[AI12-0038-1]} |
| 516 |
@ChgRef{Version=[5],Kind=[Revised],ARef=[AI12-0320-1]} |
| 517 |
@ChgAdded{Version=[5],Type=[Leading],Text=[]}@Comment{Conditional "Leading"} |
| 518 |
it shall not contain a library-level declaration@Chg{Version=[5],New=[:],Old=[ |
| 519 |
of an access type |
| 520 |
that designates a class-wide type,@Chg{Version=[4],New=[ nor a type |
| 521 |
with a part that is of a],Old=[]} |
| 522 |
task type@Chg{Version=[4],New=[],Old=[,]} or protected type with |
| 523 |
@nt{entry_declaration}s@Chg{Version=[4],New=[;],Old=[@Chg{New=[], |
| 524 |
Old=[; if the shared passive library unit is generic, it shall |
| 525 |
not contain a declaration for such an access type unless the |
| 526 |
declaration is nested within a body other than |
| 527 |
a @nt<package_body>]}.]}]} |
| 528 |
|
| 529 |
@begin{Itemize} |
| 530 |
@ChgRef{Version=[5],Kind=[Added],ARef=[AI12-0320-1]} |
| 531 |
@ChgAdded{Version=[5],Text=[of an access type |
| 532 |
that designates a class-wide type;]} |
| 533 |
@begin{Reason} |
| 534 |
These kinds of access types are disallowed because the object |
| 535 |
designated by an access value of such a type could |
| 536 |
contain an implicit reference back to |
| 537 |
the active partition on whose behalf the designated object was |
| 538 |
created. |
| 539 |
@end{Reason} |
| 540 |
|
| 541 |
@ChgRef{Version=[5],Kind=[Added],ARef=[AI12-0320-1]} |
| 542 |
@ChgAdded{Version=[5],Text=[of a type with a part that is of a task type;]} |
| 543 |
|
| 544 |
@ChgRef{Version=[5],Kind=[Added],ARef=[AI12-0320-1]} |
| 545 |
@ChgAdded{Version=[5],Text=[of a type with a part that is of |
| 546 |
a protected type with @nt{entry_declaration}s; nor]} |
| 547 |
|
| 548 |
@ChgRef{Version=[4],Kind=[Added],ARef=[AI12-0038-1]} |
| 549 |
@ChgRef{Version=[5],Kind=[RevisedAdded],ARef=[AI12-0320-1]} |
| 550 |
@ChgAdded{Version=[4],Text=[@Chg{Version=[5],New=[],Old=[it shall not contain |
| 551 |
a library-level declaration ]}that contains a name that denotes a type |
| 552 |
declared within a declared-pure |
| 553 |
package, if that type has a part that is of an access type; for the purposes of |
| 554 |
this rule, the parts considered include those of the full views of any private |
| 555 |
types or private extensions.]} |
| 556 |
|
| 557 |
@begin{Reason} |
| 558 |
@ChgRef{Version=[4],Kind=[AddedNormal]} |
| 559 |
@ChgAdded{Version=[4],Text=[This rule breaks privacy by looking into the full |
| 560 |
views of private types. Avoiding privacy breakage here would have required |
| 561 |
disallowing the use in a shared passive package of any private type |
| 562 |
declared in a declared-pure package, which would have been severely |
| 563 |
incompatible.]} |
| 564 |
@end{Reason} |
| 565 |
@end{Itemize} |
| 566 |
|
| 567 |
@end{itemize} |
| 568 |
|
| 569 |
@PDefn2{Term=[accessibility], Sec=(from shared passive library units)} |
| 570 |
@Defn{notwithstanding} |
| 571 |
Notwithstanding the definition of accessibility given in |
| 572 |
@RefSecNum(Operations of Access Types), the declaration |
| 573 |
of a library unit P1 is not accessible from within the declarative |
| 574 |
region of a shared passive library unit P2, |
| 575 |
unless the shared passive library unit |
| 576 |
P2 depends semantically on P1. |
| 577 |
@begin{Discussion} |
| 578 |
We considered a more complex rule, but dropped it. This is |
| 579 |
the simplest rule that recognizes that a shared passive |
| 580 |
package may outlive some other library package, unless it |
| 581 |
depends semantically on that package. In a nondistributed |
| 582 |
program, all library packages are presumed to have the same lifetime. |
| 583 |
|
| 584 |
Implementations may define additional pragmas that |
| 585 |
force two library packages to be in the same partition, or to have |
| 586 |
the same lifetime, which would allow this rule to be relaxed |
| 587 |
in the presence of such pragmas. |
| 588 |
@end{Discussion} |
| 589 |
|
| 590 |
@end{Legality} |
| 591 |
|
| 592 |
@begin{StaticSem} |
| 593 |
|
| 594 |
@PDefn{preelaborated} |
| 595 |
A shared passive library unit is |
| 596 |
preelaborated. |
| 597 |
|
| 598 |
@end{StaticSem} |
| 599 |
|
| 600 |
@begin{LinkTime} |
| 601 |
|
| 602 |
A shared passive library unit shall be |
| 603 |
assigned to at most one partition within a given program. |
| 604 |
|
| 605 |
@PDefn2{Term=[compilation units needed], Sec=(shared passive library unit)} |
| 606 |
@PDefn2{Term=[needed], Sec=(shared passive library unit)} |
| 607 |
@Defn{notwithstanding} |
| 608 |
Notwithstanding the rule given in @RefSecNum{Program Execution}, |
| 609 |
a compilation unit in a given partition |
| 610 |
does not @i{need} (in the |
| 611 |
sense of @RefSecNum{Program Execution}) |
| 612 |
the shared passive library units |
| 613 |
on which it depends semantically to be included in that same |
| 614 |
partition; they will typically reside in separate passive |
| 615 |
partitions. |
| 616 |
|
| 617 |
@begin{Honest} |
| 618 |
@ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0359-1]} |
| 619 |
@ChgAdded{Version=[5],Text=[This rule is necessary so that the shared data |
| 620 |
of a shared passive partition is not duplicated in each partition. It does |
| 621 |
not imply a particular implementation; in particular, code can be replicated |
| 622 |
in each active partition.]} |
| 623 |
@end{Honest} |
| 624 |
|
| 625 |
@begin{ImplNote} |
| 626 |
@ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0359-1]} |
| 627 |
@ChgAdded{Version=[5],Text=[One possible implementation for a shared passive |
| 628 |
partition is as a shared library that is mapped into the address space of of |
| 629 |
each active partition. In such case, both the code and the data of the passive |
| 630 |
partition would be mapped into the active partitions and directly |
| 631 |
called/accessed from each active partition. For instance, on Microsoft Windows |
| 632 |
a DLL has the correct semantics.]} |
| 633 |
|
| 634 |
@ChgRef{Version=[5],Kind=[AddedNormal]} |
| 635 |
@ChgAdded{Version=[5],Text=[Alternatively, the shared data can be represented |
| 636 |
as a file or persistent memory, with the shared code being replicated in each |
| 637 |
active partition. Code replication is an as-if optimization; it should be |
| 638 |
impossible to tell where the code lives since no elaboration is necessary.]} |
| 639 |
@end{ImplNote} |
| 640 |
|
| 641 |
@end{LinkTime} |
| 642 |
|
| 643 |
@begin{DiffWord95} |
| 644 |
@ChgRef{Version=[2],Kind=[AddedNormal],Ref=[8652/0080],ARef=[AI95-00003-01]} |
| 645 |
@ChgAdded{Version=[2],Text=[@b<Corrigendum:> Corrected the wording to allow |
| 646 |
access types in blocks in shared passive generic packages.]} |
| 647 |
@end{DiffWord95} |
| 648 |
|
| 649 |
@begin{Extend2005} |
| 650 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0243-1]} |
| 651 |
@ChgAdded{Version=[3],Text=[@Defn{extensions to Ada 2005}Shared_Passive |
| 652 |
is now a categorization aspect, |
| 653 |
so it can be specified by an @nt{aspect_specification} @em |
| 654 |
although the pragma is still preferred by the Standard.]} |
| 655 |
@end{Extend2005} |
| 656 |
|
| 657 |
@begin{Incompatible2012} |
| 658 |
@ChgRef{Version=[4],Kind=[AddedNormal],ARef=[AI12-0038-1]} |
| 659 |
@ChgAdded{Version=[4],Text=[@Defn{incompatibilities with Ada 2012}@b<Corrigendum:> |
| 660 |
Uses of access types declared in declared-pure units are not allowed in |
| 661 |
library-level shared passive packages. These were allowed by Ada 2005 and |
| 662 |
Ada 2012, but it is unlikely that they work properly, as active partitions |
| 663 |
could disappear before the shared-passive partition. As such, the new |
| 664 |
errors are more likely to catch bugs than to cause them.]} |
| 665 |
@end{Incompatible2012} |
| 666 |
|
| 667 |
|
| 668 |
@LabeledSubClause{Remote Types Library Units} |
| 669 |
|
| 670 |
@begin{Intro} |
| 671 |
@redundant[A remote types library unit supports the definition of types |
| 672 |
intended for use in communication between active |
| 673 |
partitions.] |
| 674 |
@end{Intro} |
| 675 |
@begin{MetaRules} |
| 676 |
The restrictions governing a remote types package are similar to those for |
| 677 |
a declared pure package. However, the restrictions are relaxed |
| 678 |
deliberately to allow such a package to contain declarations that violate |
| 679 |
the stateless property of pure packages, though it is presumed |
| 680 |
that any state-dependent properties are essentially invisible |
| 681 |
outside the package. |
| 682 |
@end{MetaRules} |
| 683 |
|
| 684 |
@begin{Syntax} |
| 685 |
@begin{SyntaxText} |
| 686 |
@Leading@PDefn2{Term=[categorization pragma], Sec=(Remote_Types)} |
| 687 |
@PDefn2{Term=[pragma, categorization], Sec=(Remote_Types)} |
| 688 |
The form of a @nt{pragma} Remote_Types is as follows: |
| 689 |
@end{SyntaxText} |
| 690 |
|
| 691 |
@PragmaSyn`@key{pragma} @prag(Remote_Types)[(@SynI{library_unit_}@Syn2{name})];' |
| 692 |
|
| 693 |
@end{Syntax} |
| 694 |
|
| 695 |
@begin{Legality} |
| 696 |
|
| 697 |
@Leading@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0243-1]} |
| 698 |
@Defn{remote types library unit} |
| 699 |
A@Chg{Version=[3],New=[ @nt{pragma} Remote_Types is used to specify that a library unit is a],Old=[]} |
| 700 |
@i{remote types library unit}@Chg{Version=[3],New=[, |
| 701 |
namely that the],Old=[ is a library unit to which the pragma]} |
| 702 |
Remote_Types |
| 703 |
@Chg{Version=[3],New=[aspect@AspectDefn{Remote_Types} of the library unit is |
| 704 |
True],Old=[applies]}. The following restrictions apply to the declaration of |
| 705 |
such a library unit: |
| 706 |
|
| 707 |
@ChgAspectDesc{Version=[3],Kind=[AddedNormal],Aspect=[Remote_Types], |
| 708 |
Text=[@ChgAdded{Version=[3],Text=[Types in a given package may be used in |
| 709 |
remote procedure calls.]}]} |
| 710 |
|
| 711 |
@begin{itemize} |
| 712 |
@Redundant[it shall be preelaborable;] |
| 713 |
|
| 714 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0206-1],ARef=[AI05-0243-1]} |
| 715 |
it shall depend semantically only on declared pure@Chg{Version=[3],New=[ |
| 716 |
@nt{library_item}s],Old=[]}, shared passive@Chg{Version=[3],New=[ library |
| 717 |
units],Old=[]}, @Chg{Version=[3],New=[],Old=[or ]}other remote types library |
| 718 |
units@Chg{Version=[3],New=[, or preelaborated normal library units that are |
| 719 |
mentioned only in private with clauses],Old=[]}; |
| 720 |
|
| 721 |
@begin{Ramification} |
| 722 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0243-1]} |
| 723 |
@ChgAdded{Version=[3],Text=[We say declared pure @nt{library_item} here, |
| 724 |
so that (all) limited views are allowed; those are not library units, but |
| 725 |
they are declared pure @nt{library_item}s.]} |
| 726 |
@end{Ramification} |
| 727 |
|
| 728 |
it shall not contain the declaration of any variable |
| 729 |
within the visible part of the library unit; |
| 730 |
@begin{Reason} |
| 731 |
This is essentially a @lquotes@;methodological@rquotes@; restriction. |
| 732 |
A separate copy of a remote types package is included |
| 733 |
in each partition that references it, just like a normal package. |
| 734 |
Nevertheless, a remote types package is thought of as |
| 735 |
an @lquotes@;essentially pure@rquotes@; package for defining types to be used |
| 736 |
for interpartition communication, |
| 737 |
and it could be misleading to declare visible objects |
| 738 |
when no remote data access is actually being provided. |
| 739 |
@end{Reason} |
| 740 |
|
| 741 |
|
| 742 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00240-01],ARef=[AI95-00366-01]} |
| 743 |
@Chg{Version=[2],New=[],Old=[if ]}the full view of @Chg{Version=[2],New=[each],Old=[a]} |
| 744 |
type declared in the visible part of the |
| 745 |
library unit @Chg{Version=[2],New=[that has any available stream attributes |
| 746 |
shall support external streaming (see |
| 747 |
@RefSecNum{Stream-Oriented Attributes})], Old=[has a part that is of a |
| 748 |
nonremote access type, then that access type, or the type of some |
| 749 |
part that includes the access type subcomponent, |
| 750 |
shall have user-specified Read and Write attributes]}. |
| 751 |
@begin{Reason} |
| 752 |
This is to prevent the use of the predefined Read and Write |
| 753 |
attributes of an access type as part of the Read and Write |
| 754 |
attributes of a visible type. |
| 755 |
@end{Reason} |
| 756 |
@begin{Ramification} |
| 757 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00366-01]} |
| 758 |
@ChgAdded{Version=[2],Text=[Types that do not have available stream |
| 759 |
attributes are excluded from this rule; that means that attributes do not |
| 760 |
need to be specified for most limited types. It is only necessary to specify |
| 761 |
attributes for nonlimited types that have a part that is of any access type, |
| 762 |
and for extensions of limited types with available stream attributes where |
| 763 |
the @nt{record_extension_part} includes a subcomponent of an access type, |
| 764 |
where the access type does not have specified attributes.]} |
| 765 |
@end{Ramification} |
| 766 |
@end{itemize} |
| 767 |
|
| 768 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0082],ARef=[AI95-00164-01]} |
| 769 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0060-1]} |
| 770 |
@ChgAdded{Version=[1],Type=[Leading],Text=[]}@ChgNote{Use ChgAdded to get conditional Leading}@Defn{remote access type} |
| 771 |
@Chg{Version=[3],New=[A named],Old=[An]} access type declared in the |
| 772 |
visible part of a remote types or remote |
| 773 |
call interface library unit is called a @i{remote access type}. |
| 774 |
@Defn{remote access-to-subprogram type} |
| 775 |
@Defn{remote access-to-class-wide type} |
| 776 |
Such a type shall be@Chg{New=[:],Old=[ either an access-to-subprogram type |
| 777 |
or a general access type that designates a class-wide limited private |
| 778 |
type.]} |
| 779 |
|
| 780 |
@begin{Itemize} |
| 781 |
@ChgRef{Version=[1],Kind=[Added],Ref=[8652/0082],ARef=[AI95-00164-01]} |
| 782 |
@ChgAdded{Version=[1],Text=[an access-to-subprogram type, or]} |
| 783 |
|
| 784 |
@ChgRef{Version=[1],Kind=[Added],Ref=[8652/0082],ARef=[AI95-00164-01]} |
| 785 |
@ChgRef{Version=[3],Kind=[RevisedAdded],ARef=[AI05-0060-1]} |
| 786 |
@ChgAdded{Version=[1],Text=[a general access type that designates a class-wide |
| 787 |
limited private type@Chg{Version=[3],New=[, a class-wide limited interface |
| 788 |
type,],Old=[]} or a class-wide |
| 789 |
private @Chg{Version=[3],New=[],Old=[type ]}extension all of whose |
| 790 |
ancestors are either |
| 791 |
private @Chg{Version=[3],New=[],Old=[type ]}extensions@Chg{Version=[3],New=[, |
| 792 |
limited interface types,],Old=[]} or limited private types.]} |
| 793 |
@end{Itemize} |
| 794 |
|
| 795 |
@ChgRef{Version=[1],Kind=[Added],Ref=[8652/0081],ARef=[AI95-00004-01]} |
| 796 |
@ChgAdded{Version=[1],Text=[A type that is derived from a remote access type |
| 797 |
is also a remote access type.]} |
| 798 |
|
| 799 |
@ChgRef{Version=[5],Kind=[Added],ARef=[AI12-0283-1]} |
| 800 |
@ChgAdded{Version=[5],Text=[A remote access-to-subprogram type shall not be |
| 801 |
nonblocking (see @RefSecNum{Intertask Communication}).]} |
| 802 |
|
| 803 |
@begin{Reason} |
| 804 |
@ChgRef{Version=[5],Kind=[AddedNormal]} |
| 805 |
@ChgAdded{Version=[5],Text=[All calls on remote subprograms are considered |
| 806 |
potentially blocking, so they cannot statically be allowed in nonblocking |
| 807 |
code.]} |
| 808 |
@end{Reason} |
| 809 |
|
| 810 |
@begin{Ramification} |
| 811 |
@ChgRef{Version=[5],Kind=[AddedNormal]} |
| 812 |
@ChgAdded{Version=[5],Text=[The type declaration of a remote type is illegal |
| 813 |
if the Nonblocking aspect is True, either implicitly by inheritance or |
| 814 |
by explicit specification.]} |
| 815 |
@end{Ramification} |
| 816 |
|
| 817 |
@Leading@;The following restrictions apply to the use of a |
| 818 |
remote access-to-subprogram type: |
| 819 |
@begin{Itemize} |
| 820 |
|
| 821 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00431-01]} |
| 822 |
A value of a remote access-to-subprogram type |
| 823 |
shall be converted only to @Chg{Version=[2],New=[or from ],Old=[]}another |
| 824 |
(subtype-conformant) remote access-to-subprogram type; |
| 825 |
|
| 826 |
The @nt<prefix> of an Access @nt<attribute_reference> that yields |
| 827 |
a value of a remote access-to-subprogram type shall statically denote a |
| 828 |
(subtype-conformant) remote subprogram. |
| 829 |
@end{Itemize} |
| 830 |
|
| 831 |
@Leading@;The following restrictions apply to the use of a |
| 832 |
remote access-to-class-wide type: |
| 833 |
@begin{Itemize} |
| 834 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0083],ARef=[AI95-00047-01]} |
| 835 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00240-01],ARef=[AI95-00366-01]} |
| 836 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0060-1],ARef=[AI05-0101-1]} |
| 837 |
The primitive subprograms of the corresponding specific |
| 838 |
@Chg{Version=[3],New=[],Old=[limited private ]}type |
| 839 |
shall only have access parameters if they are controlling formal |
| 840 |
parameters@Chg{Version=[3],New=[. The primitive functions of the corresponding |
| 841 |
specific type shall only have an access result if it is a controlling access |
| 842 |
result.],Old=[;]} @Chg{New=[@Chg{Version=[3],New=[Each],Old=[each]} |
| 843 |
noncontrolling formal parameter],Old=[the types of all the noncontrolling |
| 844 |
formal parameters]} @Chg{Version=[3],New=[and noncontrolling result |
| 845 |
type ],Old=[]}shall @Chg{Version=[2],New=[support external streaming (see |
| 846 |
@RefSecNum{Stream-Oriented Attributes});], Old=[have @Chg{New=[either a |
| 847 |
nonlimited type or a type with],Old=[]} Read and Write attributes@Chg{New=[ |
| 848 |
specified via an @nt{attribute_definition_clause};],Old=[.]}]} |
| 849 |
|
| 850 |
@ChgRef{Version=[3],Kind=[Added],ARef=[AI05-0060-1],ARef=[AI05-0215-1],ARef=[AI05-0269-1]} |
| 851 |
@ChgAdded{Version=[3],Text=[The corresponding specific type shall not have |
| 852 |
a primitive procedure with the Synchronization aspect specified unless the |
| 853 |
@nt{synchronization_kind} is Optional (see |
| 854 |
@RefSecNum{Intertask Communication});]} |
| 855 |
|
| 856 |
A value of a remote access-to-class-wide type shall be |
| 857 |
explicitly converted only to another remote access-to-class-wide type; |
| 858 |
|
| 859 |
@ChgRef{Version=[4],Kind=[Revised],ARef=[AI12-0034-1]} |
| 860 |
A value of a remote access-to-class-wide type shall be dereferenced |
| 861 |
(or implicitly converted to an anonymous access type) |
| 862 |
only as part of a dispatching call @Chg{Version=[4],New=[to a primitive |
| 863 |
operation of the designated type ],Old=[]}where the value designates |
| 864 |
a controlling operand of the call (see @RefSec{Remote Subprogram Calls}); |
| 865 |
@begin{Ramification} |
| 866 |
@ChgRef{Version=[4],Kind=[AddedNormal],ARef=[AI12-0034-1]} |
| 867 |
@ChgAdded{Version=[4],Text=[Stream attributes of the designated type are not |
| 868 |
primitive operations of the designated type, and thus remote calls to them are |
| 869 |
prohibited by this rule. This is good, as the access parameter of a stream |
| 870 |
attribute does not have external streaming, and thus cannot be a parameter of |
| 871 |
a remote call.]} |
| 872 |
@end{Ramification} |
| 873 |
|
| 874 |
@ChgRef{Version=[3],Kind=[Added],ARef=[AI05-0101-1]} |
| 875 |
@ChgAdded{Version=[3],Text=[A controlling access result value for a primitive |
| 876 |
function with any controlling operands of the corresponding specific type shall |
| 877 |
either be explicitly converted to a remote access-to-class-wide type or be part |
| 878 |
of a dispatching call where the value designates a controlling operand of the |
| 879 |
call;]} |
| 880 |
|
| 881 |
@ChgRef{Version=[1],Kind=[Revised]} |
| 882 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00366-01]} |
| 883 |
@ChgRef{Version=[4],Kind=[Revised],ARef=[AI12-0085-1]} |
| 884 |
The Storage_Pool @Chg{Version=[2],New=[attribute is],Old=[and |
| 885 |
Storage_Size attributes are]} not defined for@Chg{Version=[2],New=[ a],Old=[]} |
| 886 |
remote access-to-class-wide @Chg{Version=[2],New=[type],Old=[types]}; |
| 887 |
the expected type for an @nt{allocator} shall not be a remote |
| 888 |
access-to-class-wide type@Chg{Version=[2],New=[. A],Old=[; a]} remote |
| 889 |
access-to-class-wide type shall not be an actual parameter for a generic |
| 890 |
formal access type@Chg{New=[.],Old=[;]}@Chg{Version=[2],New=[ The Storage_Size |
| 891 |
attribute of a remote access-to-class-wide type yields 0@Chg{Version=[4], |
| 892 |
New=[],Old=[; it is not allowed in an @nt{attribute_definition_clause}]}.], |
| 893 |
Old=[]}@Chg{Version=[4],New=[ The Storage_Pool and Storage_Size aspects |
| 894 |
shall not be specified for a remote access-to-class-wide type.],Old=[]} |
| 895 |
@begin{Reason} |
| 896 |
@ChgRef{Version=[2],Kind=[Revised]} |
| 897 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0005-1]} |
| 898 |
All @Chg{Version=[3],New=[],Old=[three ]}@ChgNote{There are more than three!}of |
| 899 |
these restrictions are because |
| 900 |
there is no storage pool associated with a remote |
| 901 |
access-to-class-wide type.@Chg{Version=[2],New=[ The Storage_Size is defined |
| 902 |
to be 0 so that there is no conflict with the rules for pure units.],Old=[]} |
| 903 |
@end{Reason} |
| 904 |
@begin{Ramification} |
| 905 |
@ChgRef{Version=[4],Kind=[AddedNormal],ARef=[AI12-0085-1]} |
| 906 |
@ChgAdded{Version=[4],Text=[The prohibition against specifying the |
| 907 |
Storage_Size aspect for an access-to-class-wide type applies to any |
| 908 |
method of doing that, including via either an @nt{aspect_specification} or |
| 909 |
an @nt{attribute_definition_clause}.]} |
| 910 |
@end{Ramification} |
| 911 |
@end{Itemize} |
| 912 |
|
| 913 |
@end{Legality} |
| 914 |
|
| 915 |
@begin{Erron} |
| 916 |
@ChgRef{Version=[4],Kind=[Added],ARef=[AI12-0076-1]} |
| 917 |
@ChgAdded{Version=[4],Text=[Execution is erroneous if some operation (other |
| 918 |
than the initialization or finalization of the object) modifies the value of a |
| 919 |
constant object declared in the visible part of a remote types package.]} |
| 920 |
|
| 921 |
@begin{Discussion} |
| 922 |
@ChgRef{Version=[4],Kind=[AddedNormal]} |
| 923 |
@ChgAdded{Version=[4],Text=[This could be accomplished via a |
| 924 |
self-referencing pointer or via squirrelling a writable pointer to a |
| 925 |
controlled object.]} |
| 926 |
@end{Discussion} |
| 927 |
@end{Erron} |
| 928 |
|
| 929 |
@begin{Notes} |
| 930 |
A remote types library unit |
| 931 |
need not be pure, and the types it defines may |
| 932 |
include levels of indirection implemented by using access types. |
| 933 |
User-specified Read and Write attributes |
| 934 |
(see @RefSecNum{Stream-Oriented Attributes}) |
| 935 |
provide for sending values of such a type |
| 936 |
between active partitions, with Write marshalling the |
| 937 |
representation, and Read unmarshalling any levels of |
| 938 |
indirection. |
| 939 |
|
| 940 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0060-1]} |
| 941 |
@ChgAdded{Version=[3],Text=[The value of a remote access-to-class-wide limited |
| 942 |
interface can designate an object of a nonlimited type derived from the |
| 943 |
interface.]} |
| 944 |
|
| 945 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0060-1]} |
| 946 |
@ChgAdded{Version=[3],Text=[A remote access type may designate a class-wide |
| 947 |
synchronized, protected, or task interface type.]} |
| 948 |
@begin{TheProof} |
| 949 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 950 |
@ChgAdded{Version=[3],Text=[Synchronized, protected, and task interfaces |
| 951 |
are all considered limited interfaces, see @RefSecNum{Interface types}.]} |
| 952 |
@end{TheProof} |
| 953 |
|
| 954 |
@end{Notes} |
| 955 |
|
| 956 |
@begin{Incompatible95} |
| 957 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00240-01]} |
| 958 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0248-1]} |
| 959 |
@ChgAdded{Version=[2],Text=[@Defn{incompatibilities with Ada 95} |
| 960 |
@b[Amendment Correction:] The wording was changed from |
| 961 |
@lquotes@;user-specified@rquotes to @lquotes@;available@rquotes |
| 962 |
@Chg{Version=[3],New=[read and write ],Old=[]}attributes. (This was then |
| 963 |
further changed, see below.) This means that |
| 964 |
an access type with the attributes specified in the private part would |
| 965 |
originally have been sufficient to allow the access type to be used in |
| 966 |
a remote type, but that is no longer allowed. Similarly, the attributes |
| 967 |
of a remote type that has access components have to be specified in the |
| 968 |
visible part. These changes were made so that the rules were consistent with |
| 969 |
the rules introduced for the Corrigendum for stream attributes; moreover, |
| 970 |
legality should not depend on the contents of the private part.]} |
| 971 |
@end{Incompatible95} |
| 972 |
|
| 973 |
@begin{Extend95} |
| 974 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00366-01]} |
| 975 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0005-1]} |
| 976 |
@ChgAdded{Version=[2],Text=[@Defn{extensions to Ada 95} |
| 977 |
Remote types that cannot be streamed (that is, have no available stream |
| 978 |
attributes) do not require the specification of stream attributes. |
| 979 |
This is necessary so that most extensions of Limited_Controlled do not |
| 980 |
need stream attributes defined (otherwise there would be a |
| 981 |
@Chg{Version=[3],New=[significant],Old=[signficant]} |
| 982 |
incompatibility, as Limited_Controlled would need stream attributes, and then |
| 983 |
all extensions of it also would need stream attributes).]} |
| 984 |
@end{Extend95} |
| 985 |
|
| 986 |
@begin{DiffWord95} |
| 987 |
@ChgRef{Version=[2],Kind=[AddedNormal],Ref=[8652/0081],ARef=[AI95-00004-01]} |
| 988 |
@ChgAdded{Version=[2],Text=[@b<Corrigendum:> Added missing wording so that |
| 989 |
a type derived from a remote access type is also a remote access type.]} |
| 990 |
|
| 991 |
@ChgRef{Version=[2],Kind=[AddedNormal],Ref=[8652/0083],ARef=[AI95-00047-01]} |
| 992 |
@ChgAdded{Version=[2],Text=[@b<Corrigendum:> Clarified that user-defined |
| 993 |
Read and Write attributes are required for the primitive subprograms |
| 994 |
corresponding to a remote access-to-class-wide type.]} |
| 995 |
|
| 996 |
@ChgRef{Version=[2],Kind=[AddedNormal],Ref=[8652/0082],ARef=[AI95-00164-01]} |
| 997 |
@ChgAdded{Version=[2],Text=[@b<Corrigendum:> Added missing wording so that |
| 998 |
a remote access type can designate an appropriate private extension.]} |
| 999 |
|
| 1000 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00366-01]} |
| 1001 |
@ChgAdded{Version=[2],Text=[Changed the wording to use the newly defined |
| 1002 |
term @i<type that supports external streaming>, so that various issues |
| 1003 |
with access types in pure units and implicitly declared attributes for |
| 1004 |
type extensions are properly handled.]} |
| 1005 |
|
| 1006 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00366-01]} |
| 1007 |
@ChgAdded{Version=[2],Text=[Defined Storage_Size to be 0 for |
| 1008 |
remote access-to-class-wide types, rather than having it undefined. This |
| 1009 |
eliminates issues with pure units requiring a defined storage size.]} |
| 1010 |
|
| 1011 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00431-01]} |
| 1012 |
@ChgAdded{Version=[2],Text=[Corrected the wording so that a value of a local |
| 1013 |
access-to-subprogram type cannot be converted to a remote |
| 1014 |
access-to-subprogram type, as intended (and required by the ACATS).]} |
| 1015 |
@end{DiffWord95} |
| 1016 |
|
| 1017 |
@begin{Incompatible2005} |
| 1018 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0101-1]} |
| 1019 |
@ChgRef{Version=[4],Kind=[Revised],ARef=[AI12-0005-1]} |
| 1020 |
@ChgRef{Version=[5],Kind=[Revised],ARef=[AI12-0005-1]} |
| 1021 |
@ChgAdded{Version=[3],Text=[@Defn{incompatibilities with Ada 2005}@b<Correction:> |
| 1022 |
Added rules @Chg{Version=[5],New=[about the],Old=[for]} returning of remote |
| 1023 |
@Chg{Version=[4],New=[access-to-class-wide],Old=[access-to-classwide]} types; |
| 1024 |
this had been missed in the past. While programs that returned unstreamable |
| 1025 |
types from RCI |
| 1026 |
functions were legal, it is not clear what they could have done (as the |
| 1027 |
results could not be marshalled). Similarly, RCI functions that return remote |
| 1028 |
controlling access types could try to save those values, but it is unlikely |
| 1029 |
that a compiler would know how to do that usefully. Thus, it seems unlikely |
| 1030 |
that any real programs will be impacted by these changes.]} |
| 1031 |
@end{Incompatible2005} |
| 1032 |
|
| 1033 |
@begin{Extend2005} |
| 1034 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0060-1]} |
| 1035 |
@ChgAdded{Version=[3],Text=[@Defn{extensions to Ada 2005}@b<Correction:> |
| 1036 |
Clarified that anonymous access types are never remote access types (and can |
| 1037 |
be used in remote types units subject to the normal restrictions). Added |
| 1038 |
wording to allow limited class-wide interfaces to be designated by remote |
| 1039 |
access types.]} |
| 1040 |
|
| 1041 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0206-1]} |
| 1042 |
@ChgAdded{Version=[3],Text=[Added wording to allow private withs of |
| 1043 |
preelaborated normal units in the specification of a remote types unit.]} |
| 1044 |
|
| 1045 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0243-1]} |
| 1046 |
@ChgAdded{Version=[3],Text=[@Defn{extensions to Ada 2005}Remote_Types |
| 1047 |
is now a categorization aspect, |
| 1048 |
so it can be specified by an @nt{aspect_specification} @em |
| 1049 |
although the pragma is still preferred by the Standard.]} |
| 1050 |
@end{Extend2005} |
| 1051 |
|
| 1052 |
@begin{DiffWord2012} |
| 1053 |
@ChgRef{Version=[4],Kind=[AddedNormal],ARef=[AI12-0034-1]} |
| 1054 |
@ChgAdded{Version=[4],Text=[@B<Corrigendum:> Clarified that dispatching |
| 1055 |
remote stream attribute calls are prohibited. We don't document this as |
| 1056 |
an incompatibility, as the stream parameter cannot be marshalled for a |
| 1057 |
remote call (it doesn't have external streaming), so it's impossible that |
| 1058 |
any working program depends on this functionality.]} |
| 1059 |
|
| 1060 |
@ChgRef{Version=[4],Kind=[AddedNormal],ARef=[AI12-0076-1]} |
| 1061 |
@ChgAdded{Version=[4],Text=[@B<Corrigendum:> Explicitly stated that modifying |
| 1062 |
a visible constant in a remote types package is erroneous. We don't document |
| 1063 |
this as inconsistent as implementations certainly can still do whatever they |
| 1064 |
were previously doing (no change is required); moreover, this case (and many |
| 1065 |
more) were erroneous in Ada 2005 and before, so we're just restoring the |
| 1066 |
previous semantics.]} |
| 1067 |
|
| 1068 |
@ChgRef{Version=[4],Kind=[AddedNormal],ARef=[AI12-0085-1]} |
| 1069 |
@ChgAdded{Version=[4],Text=[@B<Corrigendum:> Clarified that specifying |
| 1070 |
the Storage_Pool or Storage_Size aspect for an access-to-class-wide type is |
| 1071 |
not allowed. The intent is clear, and no implementation has ever allowed |
| 1072 |
specifying the aspects (the attributes already cannot be specified), |
| 1073 |
so we don't document this as an incompatibility.]} |
| 1074 |
|
| 1075 |
@ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0283-1]} |
| 1076 |
@ChgAdded{Version=[5],Text=[Added a rule to ensure that potentially blocking |
| 1077 |
remote calls are not considered nonblocking.]} |
| 1078 |
@end{DiffWord2012} |
| 1079 |
|
| 1080 |
|
| 1081 |
@LabeledSubClause{Remote Call Interface Library Units} |
| 1082 |
|
| 1083 |
@begin{Intro} |
| 1084 |
@redundant[A remote call interface library unit can be |
| 1085 |
used as an interface for remote procedure calls (RPCs) (or remote |
| 1086 |
function calls) between active partitions.] |
| 1087 |
@end{Intro} |
| 1088 |
|
| 1089 |
@begin{MetaRules} |
| 1090 |
The restrictions governing a remote call |
| 1091 |
interface library unit are intended to ensure that |
| 1092 |
the values of the actual parameters in a remote call can be meaningfully |
| 1093 |
sent between two active partitions. |
| 1094 |
@end{MetaRules} |
| 1095 |
|
| 1096 |
@begin{Syntax} |
| 1097 |
@begin{SyntaxText} |
| 1098 |
@Leading@PDefn2{Term=[categorization pragma], Sec=(Remote_Call_Interface)} |
| 1099 |
@PDefn2{Term=[pragma, categorization], Sec=(Remote_Call_Interface)} |
| 1100 |
The form of a @nt{pragma} Remote_Call_Interface is as follows: |
| 1101 |
@end{SyntaxText} |
| 1102 |
|
| 1103 |
@PragmaSyn`@key{pragma} @prag(Remote_Call_Interface)[(@SynI{library_unit_}@Syn2{name})];' |
| 1104 |
|
| 1105 |
@begin{SyntaxText} |
| 1106 |
@Leading@;The form of a @nt{pragma} All_Calls_Remote is as follows: |
| 1107 |
@end{SyntaxText} |
| 1108 |
|
| 1109 |
@PragmaSyn`@key{pragma} @prag(All_Calls_Remote)[(@SynI{library_unit_}@Syn2{name})];' |
| 1110 |
|
| 1111 |
@begin{SyntaxText} |
| 1112 |
@PDefn2{Term=[library unit pragma], Sec=(All_Calls_Remote)} |
| 1113 |
@PDefn2{Term=[pragma, library unit], Sec=(All_Calls_Remote)} |
| 1114 |
A @nt{pragma} All_Calls_Remote is a library unit pragma. |
| 1115 |
@end{SyntaxText} |
| 1116 |
|
| 1117 |
@end{Syntax} |
| 1118 |
|
| 1119 |
@begin{Legality} |
| 1120 |
|
| 1121 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0078],ARef=[AI95-00048-01]} |
| 1122 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0243-1]} |
| 1123 |
@Defn{remote call interface} |
| 1124 |
@Defn2{Term=[RCI],Sec=(library unit)} |
| 1125 |
@Defn2{Term=[RCI],Sec=(package)} |
| 1126 |
@Defn2{Term=[RCI],Sec=(generic)} |
| 1127 |
@Defn{remote subprogram} |
| 1128 |
A@Chg{Version=[3],New=[ @nt{pragma} Remote_Call_Interface is used to specify that a |
| 1129 |
library unit is a],Old=[]} @i{remote call interface (RCI)}@Chg{Version=[3],New=[, |
| 1130 |
namely that the],Old=[ is a library unit to which the pragma]} |
| 1131 |
Remote_Call_Interface |
| 1132 |
@Chg{Version=[3],New=[aspect@AspectDefn{Remote_Call_Interface} of the library |
| 1133 |
unit is True],Old=[applies]}. A subprogram declared in the visible part of such |
| 1134 |
a library unit@Chg{New=[, or declared by such a library unit,],Old=[]} is called |
| 1135 |
a @i{remote subprogram}. |
| 1136 |
|
| 1137 |
@ChgAspectDesc{Version=[3],Kind=[AddedNormal],Aspect=[Remote_Call_Interface], |
| 1138 |
Text=[@ChgAdded{Version=[3],Text=[Subprograms in a given package may be |
| 1139 |
used in remote procedure calls.]}]} |
| 1140 |
|
| 1141 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0206-1],ARef=[AI05-0243-1]} |
| 1142 |
The declaration of an RCI library unit shall be preelaborable |
| 1143 |
(see @RefSecNum{Elaboration Control}), and shall depend semantically |
| 1144 |
only upon declared pure@Chg{Version=[3],New=[ @nt{library_item}s],Old=[]}, |
| 1145 |
shared passive@Chg{Version=[3],New=[ library units],Old=[]}, |
| 1146 |
remote types@Chg{Version=[3],New=[ library units],Old=[]}, |
| 1147 |
@Chg{Version=[3],New=[],Old=[or ]}other remote call interface library |
| 1148 |
units@Chg{Version=[3],New=[, or preelaborated normal library units that are |
| 1149 |
mentioned only in private with clauses],Old=[]}. |
| 1150 |
|
| 1151 |
@begin{Ramification} |
| 1152 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0243-1]} |
| 1153 |
@ChgAdded{Version=[3],Text=[We say declared pure @nt{library_item} here, |
| 1154 |
so that (all) limited views are allowed; those are not library units, but |
| 1155 |
they are declared pure @nt{library_item}s.]} |
| 1156 |
@end{Ramification} |
| 1157 |
|
| 1158 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0078],ARef=[AI95-00048-01]} |
| 1159 |
@Leading@;In addition, the following restrictions apply to @Chg{New=[],Old=[the |
| 1160 |
visible part of ]}an RCI library unit: |
| 1161 |
@begin{itemize} |
| 1162 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0078],ARef=[AI95-00048-01]} |
| 1163 |
it@Chg{New=[s visible part],Old=[]} shall not contain the declaration of a |
| 1164 |
variable; |
| 1165 |
@begin{Reason} |
| 1166 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0078],ARef=[AI95-00048-01]} |
| 1167 |
Remote call interface @Chg{New=[units],Old=[packages]} do not provide remote |
| 1168 |
data access. A shared passive package has to be used for that. |
| 1169 |
@end{Reason} |
| 1170 |
|
| 1171 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0078],ARef=[AI95-00048-01]} |
| 1172 |
it@Chg{New=[s visible part],Old=[]} shall not contain the declaration of a |
| 1173 |
limited type; |
| 1174 |
@begin{Reason} |
| 1175 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00240-01],ARef=[AI95-00366-01]} |
| 1176 |
We disallow the declaration of task and protected types, |
| 1177 |
since calling an entry or a protected subprogram implicitly passes |
| 1178 |
an object of a limited type (the target task or protected object). |
| 1179 |
We disallow other limited types since we require that such types |
| 1180 |
have @Chg{Version=[2],New=[available],Old=[user-defined]} Read and Write |
| 1181 |
attributes, but we certainly |
| 1182 |
don't want the Read and Write attributes themselves to involve remote |
| 1183 |
calls (thereby defeating their purpose of marshalling the |
| 1184 |
value for remote calls). |
| 1185 |
@end{Reason} |
| 1186 |
|
| 1187 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0078],ARef=[AI95-00048-01]} |
| 1188 |
it@Chg{New=[s visible part],Old=[]} shall not contain a nested |
| 1189 |
@nt{generic_declaration}; |
| 1190 |
@begin{Reason} |
| 1191 |
This is disallowed because the body of the nested generic |
| 1192 |
would presumably have access to data inside the body of the |
| 1193 |
RCI package, and if instantiated in a different partition, remote |
| 1194 |
data access might result, which is not supported. |
| 1195 |
@end{Reason} |
| 1196 |
|
| 1197 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0078],ARef=[AI95-00048-01]} |
| 1198 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0229-1]} |
| 1199 |
it shall not @Chg{New=[be, nor shall its visible part],Old=[]} contain@Chg{New=[,],Old=[]} the |
| 1200 |
declaration of a subprogram @Chg{Version=[3],New=[for],Old=[to]} which |
| 1201 |
@Chg{Version=[3],New=[aspect],Old=[a pragma]} Inline @Chg{Version=[3],New=[is True], |
| 1202 |
Old=[applies]}; |
| 1203 |
|
| 1204 |
@ChgRef{Version=[5],Kind=[Added],ARef=[AI12-0283-1]} |
| 1205 |
@ChgAdded{Version=[5],Text=[it shall not be, nor shall its visible part contain, |
| 1206 |
the declaration of a subprogram that is nonblocking (see @RefSecNum{Intertask Communication});]} |
| 1207 |
|
| 1208 |
@begin{Reason} |
| 1209 |
@ChgRef{Version=[5],Kind=[AddedNormal]} |
| 1210 |
@ChgAdded{Version=[5],Text=[All such subprograms are remote subprograms, and |
| 1211 |
all calls on remote subprograms are considered potentially blocking, so |
| 1212 |
they cannot statically be allowed in nonblocking code.]} |
| 1213 |
@end{Reason} |
| 1214 |
|
| 1215 |
@begin{Ramification} |
| 1216 |
@ChgRef{Version=[5],Kind=[AddedNormal]} |
| 1217 |
@ChgAdded{Version=[5],Text=[The type declaration of a remote subprogram is |
| 1218 |
illegal if the Nonblocking aspect is True, either implicitly by inheritance |
| 1219 |
or by explicit specification.]} |
| 1220 |
@end{Ramification} |
| 1221 |
|
| 1222 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0078],ARef=[AI95-00048-01]} |
| 1223 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00240-01],ARef=[AI95-00366-01]} |
| 1224 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0101-1]} |
| 1225 |
it shall not @Chg{New=[be, nor shall its visible part], |
| 1226 |
Old=[]} contain@Chg{New=[,],Old=[]} a |
| 1227 |
subprogram (or access-to-subprogram) declaration |
| 1228 |
whose profile has @Chg{Version=[2],New=[@Chg{Version=[3],New=[], |
| 1229 |
Old=[@Redundant[an access parameter or]]} |
| 1230 |
a parameter @Chg{Version=[3],New=[or result ],Old=[]}of a type that |
| 1231 |
does not support external streaming |
| 1232 |
(see @RefSecNum{Stream-Oriented Attributes})], |
| 1233 |
Old=[an access parameter, or a formal parameter of a |
| 1234 |
limited type unless that limited type has user-specified Read and Write |
| 1235 |
attributes]}; |
| 1236 |
|
| 1237 |
@begin{Ramification} |
| 1238 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0101-1]} |
| 1239 |
@ChgAdded{Version=[3],Text=[No anonymous access types support external |
| 1240 |
streaming, so they are never allowed as parameters or results of |
| 1241 |
RCI subprograms.]} |
| 1242 |
@end{Ramification} |
| 1243 |
|
| 1244 |
any public child of the library unit shall |
| 1245 |
be a remote call interface library unit. |
| 1246 |
@begin{Reason} |
| 1247 |
No restrictions apply to the private part of an RCI package, |
| 1248 |
and since a public child can @lquotes@;see@rquotes@; the private part |
| 1249 |
of its parent, such a child must itself have a |
| 1250 |
Remote_Call_Interface pragma, and be assigned to the same partition |
| 1251 |
(see below). |
| 1252 |
@end{Reason} |
| 1253 |
@begin{Discussion} |
| 1254 |
We considered making the public child of an RCI package |
| 1255 |
implicitly RCI, but it seemed better to require an explicit |
| 1256 |
pragma to avoid any confusion. |
| 1257 |
|
| 1258 |
Note that there is no need for a private child to be an RCI package, |
| 1259 |
since it can only be seen from the body of its parent |
| 1260 |
or its siblings, all of which are required to be in the |
| 1261 |
same active partition. |
| 1262 |
@end{Discussion} |
| 1263 |
@end{itemize} |
| 1264 |
|
| 1265 |
@ChgRef{Version=[5],Kind=[Added],ARef=[AI12-0002-1]} |
| 1266 |
@ChgAdded{Version=[5],Text=[Specification of a stream-oriented attribute is illegal in the specification |
| 1267 |
of a remote call interface library unit. |
| 1268 |
In addition to the places where @LegalityTitle |
| 1269 |
normally apply (see @RefSecNum{Generic Instantiation}), this rule applies also |
| 1270 |
in the private part of an instance of a generic |
| 1271 |
unit.@PDefn{generic contract issue}]} |
| 1272 |
|
| 1273 |
@begin{Ramification} |
| 1274 |
@ChgRef{Version=[5],Kind=[AddedNormal]} |
| 1275 |
@ChgAdded{Version=[5],Text=[This applies whether the stream-oriented |
| 1276 |
attribute is specified with an @nt{attribute_definition_clause} or with |
| 1277 |
an @nt{aspect_specification}.]} |
| 1278 |
@end{Ramification} |
| 1279 |
@begin{Reason} |
| 1280 |
@ChgRef{Version=[5],Kind=[AddedNormal]} |
| 1281 |
@ChgAdded{Version=[5],Text=[Stream-oriented attributes are intended to be |
| 1282 |
used locally (to marshall values), while subprograms in a remote call |
| 1283 |
interface are intended to be used remotely. We resolve the conflict by |
| 1284 |
banning the local use routines. The type should be included in a remote |
| 1285 |
types package and imported into the remote call interface package.]} |
| 1286 |
@end{Reason} |
| 1287 |
|
| 1288 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0229-1]} |
| 1289 |
@Chg{Version=[3],New=[A],Old=[If a]} pragma All_Calls_Remote |
| 1290 |
@Chg{Version=[3],New=[sets the All_Calls_Remote representation aspect of |
| 1291 |
@AspectDefn{All_Calls_Remote}the],Old=[applies to a]} library unit@Chg{Version=[3],New=[ to which the pragma |
| 1292 |
applies to the value True. If the All_Calls_Remote aspect of a library unit is True], |
| 1293 |
Old=[]}, the library unit shall be a remote call interface. |
| 1294 |
|
| 1295 |
@ChgAspectDesc{Version=[4],Kind=[Revised],InitialVersion=[3],Aspect=[All_Calls_Remote], |
| 1296 |
Text=[@ChgAdded{Version=[3],Text=[All @Chg{Version=[4],New=[indirect or |
| 1297 |
dispatching remote subprogram calls, and all direct],Old=[]} |
| 1298 |
remote @Chg{Version=[4],New=[subprogram],Old=[procedure]} |
| 1299 |
calls@Chg{Version=[4],New=[,],Old=[]} |
| 1300 |
should use the Partition Communication |
| 1301 |
Subsystem@Chg{Version=[4],New=[],Old=[, even if they are local]}.]}]} |
| 1302 |
|
| 1303 |
@end{Legality} |
| 1304 |
|
| 1305 |
@begin{LinkTime} |
| 1306 |
|
| 1307 |
A remote call interface library unit shall be |
| 1308 |
assigned to at most one partition of a given program. |
| 1309 |
A remote call |
| 1310 |
interface library unit whose parent is also an RCI library unit |
| 1311 |
shall be |
| 1312 |
assigned only to the same partition as its parent. |
| 1313 |
@begin{ImplNote} |
| 1314 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0078],ARef=[AI95-00048-01]} |
| 1315 |
The declaration of an RCI @Chg{New=[unit],Old=[package]}, with a calling-stub |
| 1316 |
body, is automatically included in all active |
| 1317 |
partitions with compilation units that depend on it. |
| 1318 |
However the whole RCI library unit, including its |
| 1319 |
(non-stub) body, will only be in one of the active partitions. |
| 1320 |
@end{ImplNote} |
| 1321 |
|
| 1322 |
@PDefn2{Term=[compilation units needed], Sec=(remote call interface)} |
| 1323 |
@PDefn2{Term=[needed], Sec=(remote call interface)} |
| 1324 |
@Defn{notwithstanding} |
| 1325 |
Notwithstanding the rule given in @RefSecNum{Program Execution}, |
| 1326 |
a compilation unit in a given partition that semantically depends on |
| 1327 |
the declaration of an RCI library unit, |
| 1328 |
@i{needs} (in the sense of @RefSecNum{Program Execution}) |
| 1329 |
only the declaration of the |
| 1330 |
RCI library unit, not the body, to be included in that same partition. |
| 1331 |
@Redundant[Therefore, the body of an RCI library unit is included |
| 1332 |
only in the partition to which the RCI library unit is |
| 1333 |
explicitly assigned.] |
| 1334 |
|
| 1335 |
@end{LinkTime} |
| 1336 |
|
| 1337 |
@begin{ImplReq} |
| 1338 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0078],ARef=[AI95-00048-01]} |
| 1339 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0229-1]} |
| 1340 |
@ChgRef{Version=[4],Kind=[Revised],ARef=[AI12-0031-1]} |
| 1341 |
@ChgNote{Use ChgAdded to get conditional Leading}@ChgAdded{Version=[4], |
| 1342 |
Type=[Leading],Text=[]}If @Chg{Version=[3],New=[aspect],Old=[a pragma]} |
| 1343 |
All_Calls_Remote @Chg{Version=[3],New=[is True for],Old=[applies to]} a |
| 1344 |
given RCI library @Chg{New=[unit],Old=[package]}, then the |
| 1345 |
implementation shall route any @Chg{Version=[4],New=[of the following calls], |
| 1346 |
Old=[call to a subprogram of the RCI @Chg{New=[unit],Old=[package]} from |
| 1347 |
outside the declarative region of the @Chg{New=[unit],Old=[package]}]} through |
| 1348 |
the Partition Communication Subsystem (PCS); see |
| 1349 |
@RefSecNum{Partition Communication Subsystem}@Chg{Version=[4],New=[:],Old=[. |
| 1350 |
Calls to such subprograms from within the declarative region of |
| 1351 |
the @Chg{New=[unit],Old=[package]} are defined to be local and shall |
| 1352 |
not go through the PCS.]} |
| 1353 |
@begin{Itemize} |
| 1354 |
@ChgRef{Version=[4],Kind=[Added],ARef=[AI12-0031-1]} |
| 1355 |
@ChgAdded{Version=[4],Text=[A direct call to a subprogram of the RCI unit from |
| 1356 |
outside the declarative region of the unit;]} |
| 1357 |
|
| 1358 |
@ChgRef{Version=[4],Kind=[Added],ARef=[AI12-0031-1]} |
| 1359 |
@ChgAdded{Version=[4],Text=[An indirect call through a remote |
| 1360 |
access-to-subprogram value that designates a subprogram of the RCI unit;]} |
| 1361 |
|
| 1362 |
@ChgRef{Version=[4],Kind=[Added],ARef=[AI12-0031-1]} |
| 1363 |
@ChgAdded{Version=[4],Text=[A dispatching call with a controlling operand |
| 1364 |
designated by a remote access-to-class-wide value whose tag identifies a |
| 1365 |
type declared in the RCI unit.]} |
| 1366 |
@end{Itemize} |
| 1367 |
@begin{Discussion} |
| 1368 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0078],ARef=[AI95-00048-01]} |
| 1369 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0229-1]} |
| 1370 |
@ChgRef{Version=[4],Kind=[Revised],ARef=[AI12-0031-1]} |
| 1371 |
@ChgRef{Version=[5],Kind=[Revised],ARef=[AI12-0005-1]} |
| 1372 |
@Chg{Version=[3],New=[When this aspect is False (or not used)],Old=[Without |
| 1373 |
this pragma]}, it is presumed |
| 1374 |
that most implementations will@Chg{Version=[4],New=[ not],Old=[]} |
| 1375 |
make@Chg{Version=[4],New=[],Old=[ direct]} calls@Chg{Version=[4],New=[ through |
| 1376 |
the PCS],Old=[]} if the call originates in the same partition |
| 1377 |
as that of the RCI @Chg{New=[unit],Old=[package]}. @Chg{Version=[3],New=[When |
| 1378 |
this aspect is True],Old=[With this pragma]}, all @Chg{Version=[4],New=[indirect |
| 1379 |
or dispatching remote subprogram calls to the RCI |
| 1380 |
unit@Chg{Version=[5],New=[,],Old=[]} and all direct ],Old=[]}calls |
| 1381 |
from outside the subsystem rooted at the RCI |
| 1382 |
@Chg{New=[unit],Old=[package]}@Chg{Version=[5],New=[,],Old=[]} are |
| 1383 |
treated like calls from outside the |
| 1384 |
partition, ensuring that the PCS is involved in all such calls |
| 1385 |
(for debugging, redundancy, etc.). |
| 1386 |
@end{Discussion} |
| 1387 |
@begin{Reason} |
| 1388 |
@ChgRef{Version=[4],Kind=[Revised],ARef=[AI12-0031-1]} |
| 1389 |
@ChgRef{Version=[5],Kind=[Revised],ARef=[AI12-0005-1]} |
| 1390 |
There is no point @Chg{Version=[5],New=[in forcing],Old=[to force]} local |
| 1391 |
@Chg{Version=[4],New=[direct ],Old=[]}calls |
| 1392 |
(@Chg{Version=[4],New=[including],Old=[or]} calls from children) to go through |
| 1393 |
the PCS, since on the target system@Chg{Version=[4],New=[],Old=[,]} these calls |
| 1394 |
are always local, and all the units are in the same active partition. |
| 1395 |
@end{Reason} |
| 1396 |
@end{ImplReq} |
| 1397 |
|
| 1398 |
@begin{ImplPerm} |
| 1399 |
|
| 1400 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0243-1]} |
| 1401 |
An implementation need not support the |
| 1402 |
Remote_Call_Interface pragma @Chg{Version=[3],New=[or aspect ],Old=[]}nor |
| 1403 |
the All_Calls_Remote pragma. |
| 1404 |
@Redundant[Explicit message-based communication between active partitions can |
| 1405 |
be supported as an alternative to RPC.] |
| 1406 |
@begin{Ramification} |
| 1407 |
Of course, it is pointless to support the All_Calls_Remote |
| 1408 |
pragma if the Remote_Call_Interface pragma (or some |
| 1409 |
approximate equivalent) is not supported. |
| 1410 |
@end{Ramification} |
| 1411 |
|
| 1412 |
@end{ImplPerm} |
| 1413 |
|
| 1414 |
@begin{Incompatible95} |
| 1415 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00240-01]} |
| 1416 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0248-1]} |
| 1417 |
@ChgAdded{Version=[2],Text=[@Defn{incompatibilities with Ada 95} |
| 1418 |
@b[Amendment Correction:] The wording was changed from |
| 1419 |
@lquotes@;user-specified@rquotes to @lquotes@;available@rquotes |
| 1420 |
@Chg{Version=[3],New=[read and write ],Old=[]}attributes. (This was then |
| 1421 |
further changed, see below.) This means that |
| 1422 |
a type with the attributes specified in the private part would |
| 1423 |
originally have been allowed as a formal parameter of an RCI subprogram, |
| 1424 |
but that is no longer allowed. |
| 1425 |
This change was made so that the rules were consistent with the rules |
| 1426 |
introduced for the Corrigendum for stream attributes; moreover, legality |
| 1427 |
should not depend on the contents of the private part.]} |
| 1428 |
@end{Incompatible95} |
| 1429 |
|
| 1430 |
@begin{DiffWord95} |
| 1431 |
@ChgRef{Version=[2],Kind=[AddedNormal],Ref=[8652/0078],ARef=[AI95-00048-01]} |
| 1432 |
@ChgAdded{Version=[2],Text=[@b<Corrigendum:> Changed the wording to allow |
| 1433 |
a library subprogram to be a remote call interface unit.]} |
| 1434 |
|
| 1435 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00366-01]} |
| 1436 |
@ChgAdded{Version=[2],Text=[Changed the wording to use the newly defined |
| 1437 |
term @i<type that supports external streaming>, so that various issues |
| 1438 |
with access types in pure units and implicitly declared attributes for |
| 1439 |
type extensions are properly handled.]} |
| 1440 |
@end{DiffWord95} |
| 1441 |
|
| 1442 |
@begin{Incompatible2005} |
| 1443 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0101-1]} |
| 1444 |
@ChgAdded{Version=[3],Text=[@Defn{incompatibilities with Ada 2005}@b<Correction:> |
| 1445 |
Added a rule to ensure that function results are streamable; this was |
| 1446 |
missing in previous versions of Ada. While programs that returned |
| 1447 |
unstreamable types from RCI functions were legal, it is not clear what |
| 1448 |
they could have done (as the results could not be marshalled). Thus, it seems |
| 1449 |
unlikely that any real programs will be impacted by this change.]} |
| 1450 |
@end{Incompatible2005} |
| 1451 |
|
| 1452 |
@begin{Extend2005} |
| 1453 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0206-1]} |
| 1454 |
@ChgAdded{Version=[3],Text=[@Defn{extensions to Ada 2005}Added wording to |
| 1455 |
allow private withs of preelaborated normal units in the specification of a |
| 1456 |
remote call interface unit.]} |
| 1457 |
|
| 1458 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0229-1]} |
| 1459 |
@ChgAdded{Version=[3],Text=[All_Calls_Remote |
| 1460 |
is now a representation aspect, so it can be specified by |
| 1461 |
an @nt{aspect_specification} @em |
| 1462 |
although the pragma is still preferred by the Standard.]} |
| 1463 |
|
| 1464 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0243-1]} |
| 1465 |
@ChgAdded{Version=[3],Text=[Remote_Call_Interface |
| 1466 |
is now a categorization aspect, so it can be specified by |
| 1467 |
an @nt{aspect_specification} @em |
| 1468 |
although the pragma is still preferred by the Standard.]} |
| 1469 |
@end{Extend2005} |
| 1470 |
|
| 1471 |
@begin{Inconsistent2012} |
| 1472 |
@ChgRef{Version=[4],Kind=[AddedNormal],ARef=[AI12-0031-1]} |
| 1473 |
@ChgAdded{Version=[4],Text=[@Defn{incompatibilities with Ada 2012}@b<Corrigendum:> |
| 1474 |
Redefined when indirect and dispatching remote calls have to be remote |
| 1475 |
for a unit for which the aspect All_Calls_Remote is True. With the new rules, |
| 1476 |
a local target called indirectly or via dispatching will be routed through |
| 1477 |
the PCS, while that was not necessarily true in earlier Ada. If a program |
| 1478 |
depended on local targets not being routed through the PCS even when |
| 1479 |
All_Calls_Remote is used, then it might behave differently or fail in |
| 1480 |
Chg{Version=[5],New=[],Old=[corrected ]}Ada |
| 1481 |
2012@Chg{Version=[5],New=[ as corrected with this refinement],Old=[]}. This |
| 1482 |
is highly unlikely as PCS is going to be able to communicate with any |
| 1483 |
partition of the program, including the local partition.]} |
| 1484 |
@end{Inconsistent2012} |
| 1485 |
|
| 1486 |
@begin{Incompatible2012} |
| 1487 |
@ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0002-1]} |
| 1488 |
@ChgAdded{Version=[5],Text=[@Defn{incompatibilities with Ada 2012}@b<Correction:> |
| 1489 |
Specifying user-defined stream-oriented attributes is now illegal in an |
| 1490 |
RCI unit. If a program contains such attributes, they and their associated |
| 1491 |
type will need to be moved to a remote types package (which is then |
| 1492 |
imported into the RCI unit).]} |
| 1493 |
@end{Incompatible2012} |
| 1494 |
|
| 1495 |
@begin{DiffWord2012} |
| 1496 |
@ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0283-1]} |
| 1497 |
@ChgAdded{Version=[5],Text=[Added a rule to ensure that potentially blocking |
| 1498 |
remote calls are not considered nonblocking.]} |
| 1499 |
@end{DiffWord2012} |
| 1500 |
|
| 1501 |
|
| 1502 |
@LabeledClause{Consistency of a Distributed System} |
| 1503 |
|
| 1504 |
@begin{Intro} |
| 1505 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0299-1]} |
| 1506 |
@redundant[This @Chg{Version=[3],New=[subclause],Old=[clause]} defines |
| 1507 |
attributes and rules associated with verifying |
| 1508 |
the consistency of a distributed program.] |
| 1509 |
@end{Intro} |
| 1510 |
|
| 1511 |
@begin{MetaRules} |
| 1512 |
|
| 1513 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0248-1]} |
| 1514 |
The rules guarantee that remote call interface |
| 1515 |
and shared passive @Chg{Version=[3],New=[library units],Old=[packages]} |
| 1516 |
are consistent among all partitions |
| 1517 |
prior to the execution of a distributed program, so |
| 1518 |
that the semantics of the distributed program are well defined. |
| 1519 |
|
| 1520 |
@end{MetaRules} |
| 1521 |
|
| 1522 |
@begin{StaticSem} |
| 1523 |
|
| 1524 |
@ChgRef{Version=[1],Kind=[Revised]}@ChgNote{To be consistent with 8652/0006} |
| 1525 |
@Leading@;For @ChgPrefixType{Version=[1],Kind=[Revised],Text=[a |
| 1526 |
@Chg{New=[@nt{prefix}],Old=[prefix]} P that statically denotes a |
| 1527 |
program unit]}, the following attributes are defined: |
| 1528 |
@begin{Description} |
| 1529 |
@Attribute{Prefix=<P>, AttrName=<Version>, |
| 1530 |
Text=[Yields a value of the predefined type String |
| 1531 |
that identifies the version of the compilation unit that |
| 1532 |
contains the declaration of the program unit.]} |
| 1533 |
|
| 1534 |
@Attribute{Prefix=<P>, AttrName=<Body_Version>, |
| 1535 |
Text=[Yields a value of the predefined type String |
| 1536 |
that identifies the version of the compilation unit that contains |
| 1537 |
the body (but not any subunits) of the program unit.]} |
| 1538 |
@end{Description} |
| 1539 |
@EndPrefixType{} |
| 1540 |
|
| 1541 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0084],ARef=[AI95-00104-01]} |
| 1542 |
@Defn2{Term=[version], Sec=(of a compilation unit)} |
| 1543 |
The @i{version} of a compilation unit changes whenever the |
| 1544 |
@Chg{New=[],Old=[version changes for any ]}compilation unit |
| 1545 |
@Chg{New=[changes in a semantically significant way. This International |
| 1546 |
Standard does not define the exact meaning of "semantically significant"], |
| 1547 |
Old=[on which it depends semantically. The version also changes whenever the |
| 1548 |
compilation unit itself changes in a semantically significant way]}. |
| 1549 |
It is @Chg{New=[unspecified],Old=[implementation defined]} |
| 1550 |
whether there are other events (such as recompilation) that |
| 1551 |
result in the version of a compilation unit changing. |
| 1552 |
@Chg{New=[@PDefn{unspecified}],Old=[]} |
| 1553 |
@ChgImplDef{Version=[1],Kind=[Deleted],InitialVersion=[0], |
| 1554 |
Text=[@Chg{New=[],Old=[Events that |
| 1555 |
cause the version of a compilation unit to change.]}]} |
| 1556 |
|
| 1557 |
@ChgRef{Version=[1],Kind=[Added],Ref=[8652/0084],ARef=[AI95-00104-01]} |
| 1558 |
@ChgAdded{Version=[1],Text=[If P is not a library unit, and P has no completion, |
| 1559 |
then P'Body_Version returns the Body_Version of the innermost program unit |
| 1560 |
enclosing the declaration of P. If P is a library unit, and P has no |
| 1561 |
completion, then P'Body_Version returns a value that is different from |
| 1562 |
Body_Version of any version of P that has a completion.]} |
| 1563 |
@end{StaticSem} |
| 1564 |
|
| 1565 |
@begin{Bounded} |
| 1566 |
@PDefn2{Term=(bounded error),Sec=(cause)} |
| 1567 |
@Defn{unit consistency} |
| 1568 |
In a distributed program, a library unit is @i{consistent} if the same |
| 1569 |
version of its declaration is used throughout. |
| 1570 |
It is a bounded error to elaborate a partition of a distributed |
| 1571 |
program that contains a compilation unit that depends on a different |
| 1572 |
version of the declaration of a shared passive or RCI library |
| 1573 |
unit than |
| 1574 |
that included in the partition to which the shared passive or |
| 1575 |
RCI library unit |
| 1576 |
was assigned. |
| 1577 |
As a result of this error, Program_Error |
| 1578 |
can be raised in one or both partitions during elaboration; |
| 1579 |
in any case, the partitions |
| 1580 |
become inaccessible to one another. |
| 1581 |
@begin{Ramification} |
| 1582 |
Because a version changes if anything on which it depends undergoes |
| 1583 |
a version change, requiring consistency for shared passive |
| 1584 |
and remote call interface library units is |
| 1585 |
sufficient to ensure |
| 1586 |
consistency for the declared pure and remote types library |
| 1587 |
units that |
| 1588 |
define the types used for the objects and parameters |
| 1589 |
through which interpartition communication takes place. |
| 1590 |
|
| 1591 |
Note that we do not require matching Body_Versions; it is |
| 1592 |
irrelevant for shared passive and remote call interface |
| 1593 |
packages, since only one copy of their body exists in a |
| 1594 |
distributed program (in the absence of implicit replication), |
| 1595 |
and we allow the bodies to differ for declared pure and |
| 1596 |
remote types packages from partition to partition, presuming |
| 1597 |
that the differences are due to required error corrections |
| 1598 |
that took place during the execution of a long-running distributed |
| 1599 |
program. The Body_Version attribute provides a means |
| 1600 |
for performing stricter consistency checks. |
| 1601 |
@end{Ramification} |
| 1602 |
@end{Bounded} |
| 1603 |
|
| 1604 |
@begin{DiffWord95} |
| 1605 |
@ChgRef{Version=[2],Kind=[AddedNormal],Ref=[8652/0084],ARef=[AI95-00104-01]} |
| 1606 |
@ChgAdded{Version=[2],Text=[@b<Corrigendum:> Clarified the meaning of |
| 1607 |
'Version and 'Body_Version.]} |
| 1608 |
@end{DiffWord95} |
| 1609 |
|
| 1610 |
|
| 1611 |
@LabeledClause{Remote Subprogram Calls} |
| 1612 |
|
| 1613 |
@begin{Intro} |
| 1614 |
@ChgRef{Version=[5],Kind=[Revised],ARef=[AI12-0359-1]} |
| 1615 |
@Defn{remote subprogram call} |
| 1616 |
@RootDefn{asynchronous remote procedure call} |
| 1617 |
@Defn{calling partition} |
| 1618 |
@Defn{called partition} |
| 1619 |
@Defn{remote subprogram binding} |
| 1620 |
A @i{remote subprogram call} is a subprogram call that invokes the |
| 1621 |
execution of a subprogram in another |
| 1622 |
@Chg{Version=[5],New=[(active) ],Old=[]}partition. The partition that |
| 1623 |
originates the remote subprogram call is the @i{calling partition}, and the |
| 1624 |
partition that executes the corresponding subprogram body is the @i{called |
| 1625 |
partition}. |
| 1626 |
Some remote procedure calls are allowed to return prior to the completion of |
| 1627 |
subprogram execution. These are called @i{asynchronous remote procedure |
| 1628 |
calls}. |
| 1629 |
|
| 1630 |
@begin{Discussion} |
| 1631 |
@ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0359-1]} |
| 1632 |
@ChgAdded{Version=[5],Text=[Remote subprogram calls are always between active |
| 1633 |
partitions; a passive partition has no execution resources of its own and thus |
| 1634 |
cannot execute anything, while a remote subprogram call is always executed by |
| 1635 |
the called partition.]} |
| 1636 |
@end{Discussion} |
| 1637 |
|
| 1638 |
@Leading@;There are three different ways of performing a remote subprogram call: |
| 1639 |
@begin{Itemize} |
| 1640 |
As a direct call on a (remote) subprogram explicitly declared in a |
| 1641 |
remote call interface; |
| 1642 |
|
| 1643 |
As an indirect call through a value of a remote access-to-subprogram type; |
| 1644 |
|
| 1645 |
As a dispatching call with a controlling operand designated by |
| 1646 |
a value of a remote access-to-class-wide type. |
| 1647 |
@end{Itemize} |
| 1648 |
|
| 1649 |
The first way of calling corresponds to a @i(static) binding between |
| 1650 |
the calling and the called partition. |
| 1651 |
The latter two ways correspond to a @i(dynamic) binding between |
| 1652 |
the calling and the called partition. |
| 1653 |
|
| 1654 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0101-1]} |
| 1655 |
@Chg{Version=[3],New=[Remote types library units (see |
| 1656 |
@RefSecNum{Remote Types Library Units}) and],Old=[A]} remote |
| 1657 |
call interface library @Chg{Version=[3],New=[units],Old=[unit]} |
| 1658 |
(see @RefSecNum{Remote Call Interface Library Units}) |
| 1659 |
@Chg{Version=[3],New=[define],Old=[defines]} |
| 1660 |
the remote subprograms or remote access types used for |
| 1661 |
remote subprogram calls. |
| 1662 |
@end{Intro} |
| 1663 |
|
| 1664 |
@begin{MetaRules} |
| 1665 |
|
| 1666 |
Remote subprogram calls are standardized since the RPC paradigm is |
| 1667 |
widely-used, and establishing an interface to it in the annex will |
| 1668 |
increase the portability and reusability of distributed |
| 1669 |
programs. |
| 1670 |
|
| 1671 |
@end{MetaRules} |
| 1672 |
|
| 1673 |
@begin{Legality} |
| 1674 |
In a dispatching call with two or more controlling operands, |
| 1675 |
if one controlling operand is designated by a value of a |
| 1676 |
remote access-to-class-wide type, then all shall be. |
| 1677 |
|
| 1678 |
@ChgRef{Version=[5],Kind=[Added],ARef=[AI12-0283-1]} |
| 1679 |
@ChgAdded{Version=[5],Text=[A nonblocking program unit shall not contain, other |
| 1680 |
than within nested units with Nonblocking specified as statically False, a |
| 1681 |
dispatching call with a controlling operand designated by a value of a remote |
| 1682 |
access-to-class-wide type.]} |
| 1683 |
|
| 1684 |
@begin{Reason} |
| 1685 |
@ChgRef{Version=[5],Kind=[AddedNormal]} |
| 1686 |
@ChgAdded{Version=[5],Text=[Such a dispatching call is a potentially |
| 1687 |
blocking call (see below) even if the called subprogram is nonblocking, so |
| 1688 |
we must not assert that no blocking is possible.]} |
| 1689 |
@end{Reason} |
| 1690 |
|
| 1691 |
@begin{Ramification} |
| 1692 |
@ChgRef{Version=[5],Kind=[AddedNormal]} |
| 1693 |
@ChgAdded{Version=[5],Text=[The calls is illegal if the Nonblocking aspect |
| 1694 |
of the containing unit is True, either implicitly by inheritance |
| 1695 |
or by explicit specification.]} |
| 1696 |
@end{Ramification} |
| 1697 |
|
| 1698 |
@end{Legality} |
| 1699 |
|
| 1700 |
@begin{RunTime} |
| 1701 |
|
| 1702 |
@Defn{marshalling} |
| 1703 |
@Defn{unmarshalling} |
| 1704 |
@PDefn2{Term=[execution], Sec=(remote subprogram call)} |
| 1705 |
For the execution of a remote subprogram call, subprogram parameters |
| 1706 |
(and later the results, if any) are passed using a stream-oriented |
| 1707 |
representation |
| 1708 |
(see @RefSecNum{The Streams Subsystem}) @Redundant[which is |
| 1709 |
suitable for transmission between partitions]. This action is called |
| 1710 |
@i{marshalling}. @i{Unmarshalling} is the reverse action of |
| 1711 |
reconstructing the parameters or results from the stream-oriented |
| 1712 |
representation. |
| 1713 |
@redundant[Marshalling is performed initially as part of the remote subprogram call in |
| 1714 |
the calling partition; unmarshalling is done in the called partition. |
| 1715 |
After the remote subprogram completes, marshalling is performed in the |
| 1716 |
called partition, and finally unmarshalling is done in the calling |
| 1717 |
partition.] |
| 1718 |
|
| 1719 |
@Defn{calling stub} |
| 1720 |
@Defn{receiving stub} |
| 1721 |
A @i{calling stub} is the sequence of code that replaces the subprogram |
| 1722 |
body of a remotely called subprogram in the calling partition. A |
| 1723 |
@i{receiving stub} is the sequence of code (the @lquotes@;wrapper@rquotes@;) that |
| 1724 |
receives a remote subprogram call on the called partition and invokes |
| 1725 |
the appropriate subprogram body. |
| 1726 |
@begin{Discussion} |
| 1727 |
The use of the term @i{stub} in this annex should not be confused with |
| 1728 |
@nt{body_stub} as defined in @RefSecNum{Subunits of Compilation Units}. The |
| 1729 |
term @i{stub} is used here because it is a commonly understood term when |
| 1730 |
talking about the RPC paradigm. |
| 1731 |
@end{Discussion} |
| 1732 |
|
| 1733 |
@Defn{at-most-once execution} |
| 1734 |
Remote subprogram calls are executed at most once, that is, |
| 1735 |
if the subprogram call returns normally, then the called |
| 1736 |
subprogram's body was executed exactly once. |
| 1737 |
|
| 1738 |
The task executing a remote subprogram call blocks until the subprogram |
| 1739 |
in the called partition returns, unless the call is asynchronous. For an |
| 1740 |
asynchronous remote procedure call, the calling task can |
| 1741 |
become ready before the |
| 1742 |
procedure in the called partition returns. |
| 1743 |
|
| 1744 |
@Defn{cancellation of a remote subprogram call} |
| 1745 |
If a construct containing a remote call is aborted, the |
| 1746 |
remote subprogram call is @i{cancelled}. |
| 1747 |
Whether the execution of the remote subprogram is immediately aborted |
| 1748 |
as a result of the cancellation is implemen@!tation defined. |
| 1749 |
@ImplDef{Whether the execution of the remote subprogram is immediately |
| 1750 |
aborted as a result of cancellation.} |
| 1751 |
|
| 1752 |
If a remote subprogram call is received by a called partition before the |
| 1753 |
partition has |
| 1754 |
completed its elaboration, the call is kept pending until the called |
| 1755 |
partition completes its elaboration (unless the call is |
| 1756 |
cancelled by the calling partition prior to that). |
| 1757 |
|
| 1758 |
If an exception is propagated by a remotely called subprogram, |
| 1759 |
and the call is not an asynchronous call, |
| 1760 |
the corresponding exception is reraised at the point |
| 1761 |
of the remote subprogram call. |
| 1762 |
For an asynchronous call, if the remote procedure call returns prior to |
| 1763 |
the completion of the remotely called subprogram, any exception is lost. |
| 1764 |
|
| 1765 |
The exception Communication_Error |
| 1766 |
(see @RefSecNum{Partition Communication Subsystem}) is raised if a remote call |
| 1767 |
cannot be completed due to difficulties in communicating with the called |
| 1768 |
partition. |
| 1769 |
|
| 1770 |
@ChgRef{Version=[5],Kind=[Revised],ARef=[AI12-0183-1]} |
| 1771 |
@PDefn2{Term=[potentially blocking operation],Sec=(remote subprogram call)} |
| 1772 |
@PDefn2{Term=[blocking, potentially],Sec=(remote subprogram call)} |
| 1773 |
All forms of remote subprogram calls are potentially blocking operations |
| 1774 |
(see @Chg{Version=[5],New=[@RefSecNum{Intertask Communication}], |
| 1775 |
Old=[@RefSecNum{Protected Subprograms and Protected Actions}]}). |
| 1776 |
@begin{Reason} |
| 1777 |
Asynchronous remote procedure calls are potentially blocking since the |
| 1778 |
implementation may require waiting for the availability of shared resources |
| 1779 |
to initiate the remote call. |
| 1780 |
@end{Reason} |
| 1781 |
|
| 1782 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0085],ARef=[AI95-00215-01]} |
| 1783 |
@IndexCheck{Accessibility_Check} |
| 1784 |
In a remote subprogram call with a formal parameter of a class-wide |
| 1785 |
type, a check is made that the tag of the actual parameter identifies |
| 1786 |
a tagged type declared in a declared-pure or shared passive library |
| 1787 |
unit, or in the visible part of a remote types or remote call interface |
| 1788 |
library unit. |
| 1789 |
@Defn2{Term=[Program_Error],Sec=(raised by failure of runtime check)} |
| 1790 |
Program_Error is raised if this check fails. |
| 1791 |
@Chg{New=[In a remote function call which returns a class-wide type, the same |
| 1792 |
check is made on the function result.],Old=[]} |
| 1793 |
@begin{Discussion} |
| 1794 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0085],ARef=[AI95-00215-01]} |
| 1795 |
This check makes certain that the specific type passed@Chg{New=[ or returned], |
| 1796 |
Old=[]} in an RPC |
| 1797 |
satisfies the rules for a "communicable" type. Normally this |
| 1798 |
is guaranteed by the compile-time restrictions on remote call interfaces. |
| 1799 |
However, with class-wide types, it is possible to pass an object |
| 1800 |
whose tag identifies a type declared outside the "safe" packages. |
| 1801 |
|
| 1802 |
This is considered an accessibility_check since only the types |
| 1803 |
declared in "safe" packages are considered truly "global" (cross-partition). |
| 1804 |
Other types are local to a single partition. This is analogous |
| 1805 |
to the "accessibility" of global vs. local declarations in |
| 1806 |
a single-partition program. |
| 1807 |
|
| 1808 |
This rule replaces a rule from an early version of Ada 9X |
| 1809 |
which was given in the subclause on Remote Types Library Units |
| 1810 |
(now @RefSec{Remote Types Library Units}). That rule tried |
| 1811 |
to prevent "bad" types from being sent by arranging for their |
| 1812 |
tags to mismatch between partitions. However, that interfered |
| 1813 |
with other uses of tags. The new rule allows tags to agree |
| 1814 |
in all partitions, even for those types which are not "safe" |
| 1815 |
to pass in an RPC. |
| 1816 |
@end{Discussion} |
| 1817 |
|
| 1818 |
@IndexCheck{Partition_Check} |
| 1819 |
In a dispatching call with two or more controlling operands that are |
| 1820 |
designated by values of a remote access-to-class-wide type, |
| 1821 |
a check is made @Redundant[(in addition to the normal Tag_Check |
| 1822 |
@em see @RefSecNum{Suppressing Checks})] that all the remote |
| 1823 |
access-to-class-wide values originated from Access |
| 1824 |
@nt<attribute_reference>s that were evaluated by tasks of the |
| 1825 |
same active partition. |
| 1826 |
@Defn2{Term=[Constraint_Error],Sec=(raised by failure of runtime check)} |
| 1827 |
Constraint_Error is raised if this check fails. |
| 1828 |
@begin{ImplNote} |
| 1829 |
When a remote access-to-class-wide value is created by |
| 1830 |
an Access @nt<attribute_reference>, the identity of the |
| 1831 |
active partition that evaluated the @nt<attribute_reference> |
| 1832 |
should be recorded in the representation of the remote access value. |
| 1833 |
@end{ImplNote} |
| 1834 |
|
| 1835 |
@end{RunTime} |
| 1836 |
|
| 1837 |
@begin{ImplReq} |
| 1838 |
|
| 1839 |
The implementation of remote subprogram calls shall conform |
| 1840 |
to the PCS interface as defined by the specification of the |
| 1841 |
language-defined package System.RPC |
| 1842 |
(see @RefSecNum{Partition Communication Subsystem}). |
| 1843 |
The calling stub shall use the Do_RPC procedure unless the remote |
| 1844 |
procedure call is asynchronous in which case Do_APC shall be used. |
| 1845 |
On the receiving side, the corresponding receiving stub shall be |
| 1846 |
invoked by the RPC-receiver. |
| 1847 |
@begin{ImplNote} |
| 1848 |
One possible implementation model is as follows: |
| 1849 |
|
| 1850 |
The code for calls to subprograms declared in an RCI |
| 1851 |
package is generated |
| 1852 |
normally, that is, the call-site is the same as for a |
| 1853 |
local subprogram call. |
| 1854 |
The code for the remotely callable subprogram bodies is also generated |
| 1855 |
normally. Subprogram's prologue and epilogue are the same as for a local call. |
| 1856 |
|
| 1857 |
When compiling the specification of an RCI package, the compiler |
| 1858 |
generates calling stubs for each visible subprogram. Similarly, when |
| 1859 |
compiling the body of an RCI package, the compiler generates |
| 1860 |
receiving stubs for each visible subprogram together with the appropriate |
| 1861 |
tables to allow the RPC-receiver to locate the correct receiving stub. |
| 1862 |
|
| 1863 |
For the statically bound remote calls, the identity of the remote |
| 1864 |
partition is statically determined (it is resolved at configuration/link time). |
| 1865 |
|
| 1866 |
@Leading@;The calling stub operates as follows: |
| 1867 |
@begin(Itemize) |
| 1868 |
It allocates (or reuses) a stream of Params_Stream_Type of Initial_Size, |
| 1869 |
and initializes it by repeatedly calling Write operations, |
| 1870 |
first to identify which remote subprogram in the receiving partition |
| 1871 |
is being called, and then to pass the incoming value of each of the |
| 1872 |
@b(in) and @b(in out) parameters of the call. |
| 1873 |
|
| 1874 |
|
| 1875 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0229-1]} |
| 1876 |
It allocates (or reuses) a stream for the Result, |
| 1877 |
unless @Chg{Version=[3],New=[an aspect],Old=[a pragma]} Asynchronous is |
| 1878 |
@Chg{Version=[3],New=[specified as True for],Old=[applied to]} the procedure. |
| 1879 |
|
| 1880 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0229-1]} |
| 1881 |
It calls Do_RPC unless @Chg{Version=[3],New=[an aspect],Old=[a pragma]} |
| 1882 |
Asynchronous @Chg{Version=[3],New=[is specified as True for],Old=[applied to]} |
| 1883 |
the procedure |
| 1884 |
in which case it calls Do_APC. An access value designating the message |
| 1885 |
stream allocated and initialized above is passed as the Params parameter. |
| 1886 |
An access value designating the Result stream is passed as the Result |
| 1887 |
parameter. |
| 1888 |
|
| 1889 |
|
| 1890 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0229-1]} |
| 1891 |
If the @Chg{Version=[3],New=[aspect],Old=[pragma]} Asynchronous is not specified for the procedure, |
| 1892 |
Do_RPC blocks until a reply message arrives, |
| 1893 |
and then returns to the calling stub. |
| 1894 |
The stub returns after extracting |
| 1895 |
from the Result stream, using Read operations, the @b(in out) and @b(out) |
| 1896 |
parameters or the function result. If the reply message |
| 1897 |
indicates that the execution of the remote subprogram propagated |
| 1898 |
an exception, the exception is propagated from Do_RPC to the |
| 1899 |
calling stub, and thence to the point of the original remote subprogram call. |
| 1900 |
If Do_RPC detects that communication with the remote partition has |
| 1901 |
failed, it propagates Communication_Error. |
| 1902 |
|
| 1903 |
@end(Itemize) |
| 1904 |
|
| 1905 |
@Leading@;On the receiving side, the RPC-receiver procedure operates as follows: |
| 1906 |
@begin(Itemize) |
| 1907 |
It is called from the PCS when a remote-subprogram-call message is received. |
| 1908 |
The call originates in some remote call receiver task executed and |
| 1909 |
managed in the context of the PCS. |
| 1910 |
|
| 1911 |
It extracts information from the stream to identify the appropriate |
| 1912 |
receiving stub. |
| 1913 |
|
| 1914 |
The receiving stub extracts the @b(in) and @b(in out) parameters using |
| 1915 |
Read from the stream designated by the Params parameter. |
| 1916 |
|
| 1917 |
The receiving stub calls the actual subprogram body and, upon completion of |
| 1918 |
the subprogram, uses Write to insert the results into the |
| 1919 |
stream pointed to by the Result parameter. The receiving stub returns to |
| 1920 |
the RPC-receiver procedure which in turn returns to the PCS. |
| 1921 |
If the actual subprogram body propagates an exception, it is propagated |
| 1922 |
by the RPC-receiver to the PCS, which handles the exception, |
| 1923 |
and indicates in the reply message that the execution of the |
| 1924 |
subprogram body propagated an exception. The exception occurrence |
| 1925 |
can be represented in the reply message using the Write attribute |
| 1926 |
of Ada.Exceptions.Exception_Occurrence. |
| 1927 |
@end(Itemize) |
| 1928 |
|
| 1929 |
For remote access-to-subprogram types: |
| 1930 |
|
| 1931 |
A value of a remote access-to-subprogram type can be |
| 1932 |
represented by the following components: a reference to the remote partition, |
| 1933 |
an index to the package containing the remote subprogram, and an index to |
| 1934 |
the subprogram within the package. The values of these components are |
| 1935 |
determined at run time when the remote access value is created. |
| 1936 |
These three components serve the same purpose when calling Do_APC/RPC, |
| 1937 |
as in the statically bound remote calls; the only difference is that they |
| 1938 |
are evaluated dynamically. |
| 1939 |
|
| 1940 |
For remote access-to-class-wide types: |
| 1941 |
|
| 1942 |
For each remote access-to-class-wide type, |
| 1943 |
a calling stub is generated for each dispatching operation of |
| 1944 |
the designated type. In addition, receiving stubs are generated to perform |
| 1945 |
the remote dispatching operations in the called partition. The appropriate |
| 1946 |
@nt{subprogram_body} is determined as for a local |
| 1947 |
dispatching call once the receiving stub has been reached. |
| 1948 |
|
| 1949 |
A value of a remote access-to-class-wide type |
| 1950 |
can be represented with the following components: |
| 1951 |
a reference to the remote partition, an index to a table (created one per |
| 1952 |
each such access type) containing addresses of all the dispatching operations |
| 1953 |
of the designated type, and an access value designating the actual remote |
| 1954 |
object. |
| 1955 |
|
| 1956 |
Alternatively, a remote access-to-class-wide value can be represented as |
| 1957 |
a normal access value, pointing to a "stub" object which in turn |
| 1958 |
contains the information mentioned above. A call on any |
| 1959 |
dispatching operation of such a stub object does the remote call, |
| 1960 |
if necessary, using the information in the stub object to locate |
| 1961 |
the target partition, etc. This approach has the advantage that |
| 1962 |
less special-casing is required in the compiler. All access values |
| 1963 |
can remain just a simple address. |
| 1964 |
|
| 1965 |
@Defn2{Term=[Constraint_Error],Sec=(raised by failure of runtime check)} |
| 1966 |
For a call to Do_RPC or Do_APC: The partition ID of all controlling |
| 1967 |
operands are checked for equality (a Constraint_Error is raised if this |
| 1968 |
check fails). The partition ID value is used for the Partition parameter. |
| 1969 |
An index into the @i{tagged-type-descriptor} is created. This index |
| 1970 |
points to the receiving stub of the class-wide operation. This index and |
| 1971 |
the index to the table (described above) are |
| 1972 |
written to the stream. |
| 1973 |
Then, the actual parameters are marshalled into the message |
| 1974 |
stream. For a controlling operand, only the access value |
| 1975 |
designating the remote object is required (the other two |
| 1976 |
components are already present in the other parameters). |
| 1977 |
|
| 1978 |
On the called partition (after the RPC-receiver has transferred control |
| 1979 |
to the appropriate receiving stub) the parameters are first unmarshalled. |
| 1980 |
Then, the tags of the controlling operands (obtained by dereferencing the |
| 1981 |
pointer to the object) are checked for equality. |
| 1982 |
@Defn2{Term=[Constraint_Error],Sec=(raised by failure of runtime check)} |
| 1983 |
If the check fails Constraint_Error is raised and propagated back to the |
| 1984 |
calling partition, unless it is a result of an asynchronous call. |
| 1985 |
Finally, a dispatching call to the specific subprogram (based on the |
| 1986 |
controlling object's tag) is made. Note that since this subprogram is not |
| 1987 |
in an RCI package, no specific stub is generated for it, it is called |
| 1988 |
normally from the @i{dispatching stub}. |
| 1989 |
|
| 1990 |
@end{ImplNote} |
| 1991 |
|
| 1992 |
@ChgRef{Version=[1],Kind=[Added],Ref=[8652/0086],ARef=[AI95-00159-01]} |
| 1993 |
@ChgAdded{Version=[1],Text=[With respect to shared variables in shared |
| 1994 |
passive library units, the |
| 1995 |
execution of the corresponding subprogram body of a synchronous remote |
| 1996 |
procedure call is considered to be part of the execution of the calling task. |
| 1997 |
The execution of the corresponding subprogram body of an asynchronous remote |
| 1998 |
procedure call proceeds in parallel with the calling task and does not signal |
| 1999 |
the next action of the calling task (see @RefSecNum{Shared Variables}).]} |
| 2000 |
@end{ImplReq} |
| 2001 |
|
| 2002 |
@begin{Notes} |
| 2003 |
A given active partition can both make and receive remote subprogram calls. |
| 2004 |
Thus, an active partition can act as both a client and a server. |
| 2005 |
|
| 2006 |
If a given exception is propagated by a remote |
| 2007 |
subprogram call, but the exception does not exist in the calling |
| 2008 |
partition, the exception can be handled by an @key(others) choice |
| 2009 |
or be propagated to and handled by a third partition. |
| 2010 |
@begin{Discussion} |
| 2011 |
This situation can happen |
| 2012 |
in a case of dynamically nested remote subprogram calls, where an |
| 2013 |
intermediate call executes in a partition that does |
| 2014 |
not include the library unit that defines the exception. |
| 2015 |
@end{Discussion} |
| 2016 |
@end{Notes} |
| 2017 |
|
| 2018 |
@begin{DiffWord95} |
| 2019 |
@ChgRef{Version=[2],Kind=[AddedNormal],Ref=[8652/0086],ARef=[AI95-00159-01]} |
| 2020 |
@ChgAdded{Version=[2],Text=[@b<Corrigendum:> Added rules so that tasks can |
| 2021 |
safely access shared passive objects.]} |
| 2022 |
|
| 2023 |
@ChgRef{Version=[2],Kind=[AddedNormal],Ref=[8652/0085],ARef=[AI95-00215-01]} |
| 2024 |
@ChgAdded{Version=[2],Text=[@b<Corrigendum:> Clarified that the check on |
| 2025 |
class-wide types also applies to values returned from remote subprogram call |
| 2026 |
functions.]} |
| 2027 |
@end{DiffWord95} |
| 2028 |
|
| 2029 |
@begin{DiffWord2005} |
| 2030 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0101-1]} |
| 2031 |
@ChgAdded{Version=[3],Text=[@b<Correction:> Corrected the text to |
| 2032 |
note that remote access types can be defined in remote types units.]} |
| 2033 |
@end{DiffWord2005} |
| 2034 |
|
| 2035 |
@begin{DiffWord2012} |
| 2036 |
@ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0283-1]} |
| 2037 |
@ChgAdded{Version=[5],Text=[Added a rule to ensure that potentially blocking |
| 2038 |
remote calls are not considered nonblocking.]} |
| 2039 |
|
| 2040 |
@ChgRef{Version=[5],Kind=[AddedNormal],ARef=[AI12-0359-1]} |
| 2041 |
@ChgAdded{Version=[5],Text=[Clarified that remote subprogram calls are |
| 2042 |
always to active partitions.]} |
| 2043 |
@end{DiffWord2012} |
| 2044 |
|
| 2045 |
|
| 2046 |
@LabeledRevisedSubClause{Version=[3],New=[Asynchronous Remote Calls],Old=[Pragma Asynchronous]} |
| 2047 |
|
| 2048 |
@begin{Intro} |
| 2049 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0229-1]} |
| 2050 |
@redundant[This subclause introduces the |
| 2051 |
@Chg{Version=[3],New=[aspect],Old=[pragma]} Asynchronous which |
| 2052 |
@Chg{Version=[3],New=[can be specified to allow],Old=[allows]} a |
| 2053 |
remote subprogram call to return prior to completion of the execution |
| 2054 |
of the corresponding remote subprogram body.] |
| 2055 |
@end{Intro} |
| 2056 |
|
| 2057 |
@begin{NotIso} |
| 2058 |
@ChgAdded{Version=[3],Noprefix=[T],Noparanum=[T],Text=[@Shrink{@i<Paragraphs 2 |
| 2059 |
through 7 were deleted.>}]}@Comment{This message |
| 2060 |
should be deleted if the paragraphs are ever renumbered.} |
| 2061 |
@end{NotIso} |
| 2062 |
|
| 2063 |
@begin{Syntax} |
| 2064 |
@begin{SyntaxText} |
| 2065 |
@ChgRef{Version=[3],Kind=[DeletedNoDelMsg],ARef=[AI05-0229-1]} |
| 2066 |
@ChgDeleted{Version=[3],Type=[Leading],Text=[The form of a @nt{pragma} |
| 2067 |
Asynchronous is as follows:]} |
| 2068 |
@end{SyntaxText} |
| 2069 |
|
| 2070 |
@ChgRef{Version=[3],Kind=[DeletedNoDelMsg]} |
| 2071 |
@DeletedPragmaSyn<Version=[3],InitialVersion=[0],@ChgDeleted{Version=[3], |
| 2072 |
Text=[@key{pragma} @prag(Asynchronous)(@Syn2{local_name});]}> |
| 2073 |
@end{Syntax} |
| 2074 |
|
| 2075 |
@begin{Legality} |
| 2076 |
@ChgRef{Version=[3],Kind=[DeletedNoDelMsg],ARef=[AI05-0229-1]} |
| 2077 |
@ChgDeleted{Version=[3],Type=[Leading],Text=[The @nt<local_name> of a pragma |
| 2078 |
Asynchronous shall denote either:]} |
| 2079 |
@begin{Itemize} |
| 2080 |
@ChgRef{Version=[3],Kind=[DeletedNoDelMsg]} |
| 2081 |
@ChgDeleted{Version=[3],Text=[One or more remote procedures; |
| 2082 |
the formal parameters of the procedure(s) shall all be of |
| 2083 |
mode @key{in};]} |
| 2084 |
|
| 2085 |
@ChgRef{Version=[3],Kind=[DeletedNoDelMsg]} |
| 2086 |
@ChgDeleted{Version=[3],Text=[The first subtype of a remote |
| 2087 |
access-to-procedure type; the formal parameters |
| 2088 |
of the designated profile of |
| 2089 |
the type shall all be of mode @key{in};]} |
| 2090 |
|
| 2091 |
@ChgRef{Version=[3],Kind=[DeletedNoDelMsg]} |
| 2092 |
@ChgDeleted{Version=[3],Text=[The first subtype of a remote |
| 2093 |
access-to-class-wide type.]} |
| 2094 |
@end{Itemize} |
| 2095 |
@end{Legality} |
| 2096 |
|
| 2097 |
@begin{StaticSem} |
| 2098 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0229-1]} |
| 2099 |
@ChgAdded{Version=[3],Type=[Leading],Text=[]}@Comment{Fake to get conditional Leading} |
| 2100 |
@Chg{Version=[3],New=[For a remote procedure, the following language-defined |
| 2101 |
representation aspect may be specified:], |
| 2102 |
Old=[@PDefn2{Term=[representation pragma], Sec=(Asynchronous)} |
| 2103 |
@PDefn2{Term=[pragma, representation], Sec=(Asynchronous)} |
| 2104 |
A pragma Asynchronous is a representation pragma. |
| 2105 |
When applied to a type, it specifies the type-related @i{asynchronous} |
| 2106 |
aspect of the type.]} |
| 2107 |
@begin{Description} |
| 2108 |
@ChgRef{Version=[3],Kind=[Added]} |
| 2109 |
@ChgAdded{Version=[3],Text=[Asynchronous@\The type of aspect Asynchronous is |
| 2110 |
Boolean. If directly specified, the @nt{aspect_definition} shall be a static |
| 2111 |
expression. If not specified, the aspect is False.@AspectDefn{Asynchronous}]} |
| 2112 |
|
| 2113 |
@ChgAspectDesc{Version=[3],Kind=[AddedNormal],Aspect=[Asynchronous], |
| 2114 |
Text=[@ChgAdded{Version=[3],Text=[Remote procedure calls are asynchronous; |
| 2115 |
the caller continues without waiting for the call to return.]}]} |
| 2116 |
|
| 2117 |
@end{Description} |
| 2118 |
|
| 2119 |
@ChgRef{Version=[3],Kind=[Added],ARef=[AI05-0229-1]} |
| 2120 |
@ChgAdded{Version=[3],Type=[Leading],Text=[For a remote access type, the |
| 2121 |
following language-defined representation aspect may be specified:]} |
| 2122 |
@begin{Description} |
| 2123 |
@ChgRef{Version=[3],Kind=[Added]} |
| 2124 |
@ChgAdded{Version=[3],Text=[Asynchronous@\The type of aspect Asynchronous is |
| 2125 |
Boolean. If directly specified, the @nt{aspect_definition} shall be a static |
| 2126 |
expression. If not specified (including by inheritance), the aspect is False.]} |
| 2127 |
@end{Description} |
| 2128 |
@end{StaticSem} |
| 2129 |
|
| 2130 |
@begin{Legality} |
| 2131 |
@ChgRef{Version=[3],Kind=[Added],ARef=[AI05-0229-1]} |
| 2132 |
@ChgAdded{Version=[3],Text=[If aspect Asynchronous is specified for a remote |
| 2133 |
procedure, the formal parameters of the procedure shall all be of mode |
| 2134 |
@key[in].]} |
| 2135 |
|
| 2136 |
@ChgRef{Version=[3],Kind=[Added],ARef=[AI05-0229-1]} |
| 2137 |
@ChgAdded{Version=[3],Text=[If aspect Asynchronous is specified for a remote |
| 2138 |
access type, the type shall be a remote access-to-class-wide type, or the type |
| 2139 |
shall be a remote access-to-procedure type with the formal parameters of the |
| 2140 |
designated profile of the type all of mode @key[in].]} |
| 2141 |
@end{Legality} |
| 2142 |
|
| 2143 |
@begin{RunTime} |
| 2144 |
|
| 2145 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0229-1]} |
| 2146 |
@Defn2{Term=[remote procedure call],Sec=(asynchronous)} |
| 2147 |
@Defn2{Term=[asynchronous], Sec=(remote procedure call)} |
| 2148 |
A remote call is @i{asynchronous} if it is a call to a procedure, |
| 2149 |
or a call through a value of an access-to-procedure type, |
| 2150 |
@Chg{Version=[3],New=[for],Old=[to]} which |
| 2151 |
@Chg{Version=[3],New=[aspect],Old=[a pragma]} Asynchronous |
| 2152 |
@Chg{Version=[3],New=[is True],Old=[applies]}. |
| 2153 |
In addition, if @Chg{Version=[3],New=[aspect],Old=[a pragma]} Asynchronous |
| 2154 |
@Chg{Version=[3],New=[is True for],Old=[applies to]} a remote |
| 2155 |
access-to-class-wide type, then |
| 2156 |
a dispatching call on a procedure |
| 2157 |
with a controlling operand designated by a value of the type |
| 2158 |
is asynchronous if the |
| 2159 |
formal parameters of the procedure are all of mode @key{in}. |
| 2160 |
@end{RunTime} |
| 2161 |
|
| 2162 |
@begin{ImplReq} |
| 2163 |
|
| 2164 |
Asynchronous remote procedure calls shall be implemented such that the |
| 2165 |
corresponding body executes at most once as a result of the call. |
| 2166 |
@begin{Honest} |
| 2167 |
It is not clear that this rule can be tested or even defined formally. |
| 2168 |
@end{Honest} |
| 2169 |
@end{ImplReq} |
| 2170 |
|
| 2171 |
@begin{Extend2005} |
| 2172 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0229-1]} |
| 2173 |
@ChgAdded{Version=[3],Text=[@Defn{extensions to Ada 2005} |
| 2174 |
Aspect Asynchronous is new; @nt{pragma} Asynchronous is now obsolescent.]} |
| 2175 |
@end{Extend2005} |
| 2176 |
|
| 2177 |
|
| 2178 |
@LabeledSubClause{Example of Use of a Remote Access-to-Class-Wide Type} |
| 2179 |
|
| 2180 |
@begin{Examples} |
| 2181 |
@Leading@i{Example of using a remote access-to-class-wide type to achieve dynamic binding |
| 2182 |
across active partitions:} |
| 2183 |
@begin{example} |
| 2184 |
@key{package} Tapes @key{is} |
| 2185 |
@key{pragma} Pure(Tapes); |
| 2186 |
@key{type} Tape @key{is abstract tagged limited private}; |
| 2187 |
@RI{-- Primitive dispatching operations where} |
| 2188 |
@RI{-- Tape is controlling operand} |
| 2189 |
@key{procedure} Copy (From, To : @key{access} Tape; Num_Recs : @key[in] Natural) @key{is} @key{abstract}; |
| 2190 |
@key{procedure} Rewind (T : @key{access} Tape) @key{is} @key{abstract}; |
| 2191 |
@RI{-- More operations} |
| 2192 |
@key{private} |
| 2193 |
@key{type} Tape @key{is} ... |
| 2194 |
@key{end} Tapes; |
| 2195 |
|
| 2196 |
@key{with} Tapes; |
| 2197 |
@key{package} Name_Server @key{is} |
| 2198 |
@key{pragma} Remote_Call_Interface; |
| 2199 |
@RI{-- Dynamic binding to remote operations is achieved} |
| 2200 |
@RI{-- using the access-to-limited-class-wide type Tape_Ptr} |
| 2201 |
@key{type} Tape_Ptr @key{is access all} Tapes.Tape'Class; |
| 2202 |
@RI{-- The following statically bound remote operations} |
| 2203 |
@RI{-- allow for a name-server capability in this example} |
| 2204 |
@key{function} Find (Name : String) @key{return} Tape_Ptr; |
| 2205 |
@key{procedure} Register (Name : @key[in] String; T : @key[in] Tape_Ptr); |
| 2206 |
@key{procedure} Remove (T : @key[in] Tape_Ptr); |
| 2207 |
@RI{-- More operations} |
| 2208 |
@key{end} Name_Server; |
| 2209 |
|
| 2210 |
@key{package} Tape_Driver @key{is} |
| 2211 |
@RI{-- Declarations are not shown, they are irrelevant here} |
| 2212 |
@key{end} Tape_Driver; |
| 2213 |
|
| 2214 |
@ChgRef{Version=[5],Kind=[Revised],ARef=[AI12-0347-1]} |
| 2215 |
@key{with} Tapes, Name_Server; |
| 2216 |
@key{package body} Tape_Driver @key{is} |
| 2217 |
@key{type} New_Tape @key{is new} Tapes.Tape @key{with} ...@Chg{Version=[5],New=[ |
| 2218 |
@key{overriding} |
| 2219 |
@key{procedure} Rewind (T : @key{access} New_Tape); |
| 2220 |
@key{overriding}],Old=[]} |
| 2221 |
@key{procedure} Copy |
| 2222 |
(From, To : @key{access} New_Tape; Num_Recs: @key[in] Natural) @key{is} |
| 2223 |
@key{begin} |
| 2224 |
. . . |
| 2225 |
@key{end} Copy; |
| 2226 |
@key{procedure} Rewind (T : @key{access} New_Tape) @key{is} |
| 2227 |
@key{begin} |
| 2228 |
. . . |
| 2229 |
@key{end} Rewind; |
| 2230 |
@RI{-- Objects remotely accessible through use} |
| 2231 |
@RI{-- of Name_Server operations} |
| 2232 |
Tape1, Tape2 : @key[aliased] New_Tape; |
| 2233 |
@key{begin} |
| 2234 |
Name_Server.Register ("NINE-TRACK", Tape1'Access); |
| 2235 |
Name_Server.Register ("SEVEN-TRACK", Tape2'Access); |
| 2236 |
@key{end} Tape_Driver; |
| 2237 |
|
| 2238 |
@key{with} Tapes, Name_Server; |
| 2239 |
@RI{-- Tape_Driver is not needed and thus not mentioned in the @nt{with_clause}} |
| 2240 |
@key{procedure} Tape_Client @key{is} |
| 2241 |
T1, T2 : Name_Server.Tape_Ptr; |
| 2242 |
@key{begin} |
| 2243 |
T1 := Name_Server.Find ("NINE-TRACK"); |
| 2244 |
T2 := Name_Server.Find ("SEVEN-TRACK"); |
| 2245 |
Tapes.Rewind (T1); |
| 2246 |
Tapes.Rewind (T2); |
| 2247 |
Tapes.Copy (T1, T2, 3); |
| 2248 |
@key{end} Tape_Client; |
| 2249 |
@end{example} |
| 2250 |
|
| 2251 |
@leading@keepnext@i{Notes on the example}: |
| 2252 |
@begin{Discussion} |
| 2253 |
The example does not show the case where tapes are removed from or added to |
| 2254 |
the system. In the former case, an appropriate exception needs to be defined |
| 2255 |
to instruct the client to use another tape. In the latter, the Name_Server |
| 2256 |
should have a query function visible to the clients to inform them about the |
| 2257 |
availability of the tapes in the system. |
| 2258 |
@end{Discussion} |
| 2259 |
|
| 2260 |
@ChgRef{Version=[1], Kind=[Deleted]} |
| 2261 |
@Chg[New=<>,Old=<@ @;@comment{Empty paragraph to hang junk paragraph number from original RM}>] |
| 2262 |
|
| 2263 |
@begin{itemize} |
| 2264 |
The package Tapes provides the necessary declarations of the type and its |
| 2265 |
primitive operations. |
| 2266 |
|
| 2267 |
Name_Server is a remote call interface package and is elaborated in a separate |
| 2268 |
active partition to provide the necessary naming services (such as Register |
| 2269 |
and Find) to the entire distributed program |
| 2270 |
through remote subprogram calls. |
| 2271 |
|
| 2272 |
Tape_Driver is a normal package that is elaborated in a partition configured |
| 2273 |
on the processing node that is connected to the tape device(s). The abstract |
| 2274 |
operations are overridden to support |
| 2275 |
the locally declared tape devices (Tape1, Tape2). The package is not visible |
| 2276 |
to its clients, but it exports the tape devices (as remote objects) |
| 2277 |
through the services of the Name_Server. This allows for tape devices to be |
| 2278 |
dynamically added, removed or replaced without requiring the modification of |
| 2279 |
the clients' code. |
| 2280 |
|
| 2281 |
The Tape_Client procedure references only declarations in the Tapes and |
| 2282 |
Name_Server packages. Before using a tape for the first time, it needs to |
| 2283 |
query the Name_Server for a system-wide identity for that tape. From then on, |
| 2284 |
it can use that identity to access the tape device. |
| 2285 |
|
| 2286 |
Values of remote access type Tape_Ptr include the necessary information to |
| 2287 |
complete the remote dispatching operations that result from |
| 2288 |
dereferencing the controlling operands T1 and T2. |
| 2289 |
|
| 2290 |
@end{itemize} |
| 2291 |
@end{Examples} |
| 2292 |
|
| 2293 |
|
| 2294 |
@NotISORMNewPageVer{Version=[3]}@Comment{For printed version of Ada 2012 RM} |
| 2295 |
@LabeledClause{Partition Communication Subsystem} |
| 2296 |
|
| 2297 |
@begin{Intro} |
| 2298 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00273-01]} |
| 2299 |
@Defn{partition communication subsystem (PCS)} |
| 2300 |
@Defn{PCS (partition communication subsystem)} |
| 2301 |
@redundant[The @i{Partition Communication Subsystem} (PCS) provides facilities for |
| 2302 |
supporting communication between the active partitions of a distributed |
| 2303 |
program. The package System.RPC is a language-defined interface to the |
| 2304 |
PCS.]@Chg{Version=[2],New=[],Old=[ An implementation conforming to this |
| 2305 |
Annex shall use the RPC interface to implement remote subprogram calls.]} |
| 2306 |
@begin{Reason} |
| 2307 |
The prefix RPC is used rather than RSC because the term remote procedure call |
| 2308 |
and its acronym are more familiar. |
| 2309 |
@end{Reason} |
| 2310 |
@end{Intro} |
| 2311 |
|
| 2312 |
@begin{StaticSem} |
| 2313 |
|
| 2314 |
@leading@keepnext@;The following language-defined library package exists: |
| 2315 |
@begin{example} |
| 2316 |
@ChgRef{Version=[5],Kind=[Revised],ARef=[AI12-0241-1]} |
| 2317 |
@b(with) Ada.Streams; -- @Examcom{see @RefSecNum[The Streams Subsystem]} |
| 2318 |
@key(package) System.RPC@Chg{Version=[5],New=[ |
| 2319 |
@key(with) Nonblocking => False],Old=[]} @key(is)@ChildUnit{Parent=[System],Child=[RPC]} |
| 2320 |
|
| 2321 |
@key(type) @AdaTypeDefn{Partition_Id} @key(is range) 0 .. @RI(implementation-defined); |
| 2322 |
|
| 2323 |
@AdaExcDefn{Communication_Error} : @key(exception); |
| 2324 |
|
| 2325 |
@key(type) @AdaTypeDefn{Params_Stream_Type} ( |
| 2326 |
Initial_Size : Ada.Streams.Stream_Element_Count) @key(is) @key(new) |
| 2327 |
Ada.Streams.Root_Stream_Type @key(with) @key(private); |
| 2328 |
|
| 2329 |
@key(procedure) @AdaSubDefn{Read}( |
| 2330 |
Stream : @key(in out) Params_Stream_Type; |
| 2331 |
Item : @key(out) Ada.Streams.Stream_Element_Array; |
| 2332 |
Last : @key(out) Ada.Streams.Stream_Element_Offset); |
| 2333 |
|
| 2334 |
@key(procedure) @AdaSubDefn{Write}( |
| 2335 |
Stream : @key(in out) Params_Stream_Type; |
| 2336 |
Item : @key(in) Ada.Streams.Stream_Element_Array); |
| 2337 |
|
| 2338 |
|
| 2339 |
@RI(-- Synchronous call) |
| 2340 |
@key(procedure) @AdaSubDefn{Do_RPC}( |
| 2341 |
Partition : @key(in) Partition_Id; |
| 2342 |
Params : @key(access) Params_Stream_Type; |
| 2343 |
Result : @key(access) Params_Stream_Type); |
| 2344 |
|
| 2345 |
@RI(-- Asynchronous call) |
| 2346 |
@key(procedure) @AdaSubDefn{Do_APC}( |
| 2347 |
Partition : @key(in) Partition_Id; |
| 2348 |
Params : @key(access) Params_Stream_Type); |
| 2349 |
|
| 2350 |
@RI(-- The handler for incoming RPCs) |
| 2351 |
@key(type) @AdaTypeDefn{RPC_Receiver} @key(is access procedure)( |
| 2352 |
Params : @key(access) Params_Stream_Type; |
| 2353 |
Result : @key(access) Params_Stream_Type); |
| 2354 |
|
| 2355 |
@key(procedure) @AdaSubDefn{Establish_RPC_Receiver}( |
| 2356 |
Partition : @key(in) Partition_Id; |
| 2357 |
Receiver : @key(in) RPC_Receiver); |
| 2358 |
|
| 2359 |
@key[private] |
| 2360 |
... -- @RI{not specified by the language} |
| 2361 |
@b(end) System.RPC; |
| 2362 |
@end{example} |
| 2363 |
|
| 2364 |
A value of the type Partition_Id is used to identify a partition. |
| 2365 |
@ChgImplDef{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2],Text=[ |
| 2366 |
The range of type System.RPC.Partition_Id.]}]} |
| 2367 |
|
| 2368 |
An object of the type Params_Stream_Type is used for identifying |
| 2369 |
the particular remote subprogram that is being called, as |
| 2370 |
well as marshalling and |
| 2371 |
unmarshalling the parameters or result of a remote |
| 2372 |
subprogram call, as part of sending them between partitions. |
| 2373 |
|
| 2374 |
@redundant[The Read and Write procedures override the corresponding abstract operations |
| 2375 |
for the type Params_Stream_Type.] |
| 2376 |
|
| 2377 |
@end{StaticSem} |
| 2378 |
|
| 2379 |
@begin{RunTime} |
| 2380 |
|
| 2381 |
The Do_RPC and Do_APC procedures send a message to the active partition |
| 2382 |
identified by the Partition parameter. |
| 2383 |
@begin{ImplNote} |
| 2384 |
It is assumed that the RPC interface is above the message-passing |
| 2385 |
layer of the network protocol stack and is implemented in terms of it. |
| 2386 |
@end{ImplNote} |
| 2387 |
|
| 2388 |
After sending the message, Do_RPC blocks the calling task until a reply |
| 2389 |
message comes back from the called partition or some error is detected by |
| 2390 |
the underlying communication system in which case Communication_Error is |
| 2391 |
raised at the point of the call to Do_RPC. |
| 2392 |
@begin{Reason} |
| 2393 |
Only one exception is defined in System.RPC, although many sources of errors |
| 2394 |
might exist. This is so because it is not always possible |
| 2395 |
to distinguish among these errors. In particular, it is often impossible to |
| 2396 |
tell the difference between a failing communication link and |
| 2397 |
a failing processing node. Additional information might be associated with |
| 2398 |
a particular Exception_Occurrence for a Communication_Error. |
| 2399 |
@end{Reason} |
| 2400 |
|
| 2401 |
Do_APC operates in the same way as Do_RPC except that it |
| 2402 |
is allowed to return immediately after sending the message. |
| 2403 |
|
| 2404 |
Upon normal return, the stream designated by the Result parameter |
| 2405 |
of Do_RPC contains the reply message. |
| 2406 |
|
| 2407 |
@PDefn2{Term=[elaboration], Sec=(partition)} |
| 2408 |
The procedure System.RPC.Establish_RPC_Receiver is called |
| 2409 |
once, immediately after elaborating |
| 2410 |
the library units of an active partition |
| 2411 |
(that is, right after the @i{elaboration of the partition}) if the partition |
| 2412 |
includes an RCI library unit, but prior to invoking the main |
| 2413 |
subprogram, if any. |
| 2414 |
The Partition parameter is the Partition_Id of the active partition |
| 2415 |
being elaborated. |
| 2416 |
@Defn{RPC-receiver} |
| 2417 |
The Receiver parameter designates an |
| 2418 |
implementation-provided procedure called the |
| 2419 |
@i{RPC-receiver} which will handle all RPCs received by the |
| 2420 |
partition from the PCS. |
| 2421 |
Establish_RPC_Receiver saves a reference to the RPC-receiver; |
| 2422 |
when a message is received at the called partition, the RPC-receiver |
| 2423 |
is called with the Params stream containing |
| 2424 |
the message. When the RPC-receiver |
| 2425 |
returns, the contents of the stream designated by Result is |
| 2426 |
placed in a message and sent back to the calling partition. |
| 2427 |
@begin{ImplNote} |
| 2428 |
It is defined by the PCS implementation whether one or more threads of control |
| 2429 |
should be available to process incoming messages and to wait for their |
| 2430 |
completion. |
| 2431 |
@end{ImplNote} |
| 2432 |
@begin{ImplNote} |
| 2433 |
At link-time, the linker provides the RPC-receiver and the necessary tables |
| 2434 |
to support it. A call on Establish_RPC_Receiver is inserted just before |
| 2435 |
the call on the main subprogram. |
| 2436 |
@end{ImplNote} |
| 2437 |
@begin{Reason} |
| 2438 |
The interface between the PCS (the System.RPC package) and the |
| 2439 |
RPC-receiver is defined to be dynamic in order to allow the elaboration |
| 2440 |
sequence to notify the PCS that all packages have been |
| 2441 |
elaborated and that it is safe to call the receiving stubs. It is not |
| 2442 |
guaranteed that the PCS units will be the last to be elaborated, so some |
| 2443 |
other indication that elaboration is complete is needed. |
| 2444 |
@end{Reason} |
| 2445 |
|
| 2446 |
If a call on Do_RPC is aborted, a cancellation message is sent |
| 2447 |
to the called partition, to request that the execution of the |
| 2448 |
remotely called subprogram be aborted. |
| 2449 |
@begin{Honest} |
| 2450 |
The full effects of this message are dependent on the implementation of |
| 2451 |
the PCS. |
| 2452 |
@end{Honest} |
| 2453 |
|
| 2454 |
@ChgRef{Version=[5],Kind=[Deleted],ARef=[AI12-0241-1]} |
| 2455 |
@ChgDeleted{Version=[5],Text=[@PDefn2{Term=[potentially blocking operation],Sec=(RPC operations)} |
| 2456 |
@PDefn2{Term=[blocking, potentially],Sec=(RPC operations)} |
| 2457 |
The subprograms declared in System.RPC are potentially |
| 2458 |
blocking operations.]} |
| 2459 |
@end{RunTime} |
| 2460 |
|
| 2461 |
@begin{ImplReq} |
| 2462 |
The implementation of the RPC-receiver shall be reentrant@Redundant[, |
| 2463 |
thereby allowing concurrent calls on it from the PCS to service |
| 2464 |
concurrent remote subprogram calls into the partition]. |
| 2465 |
@begin{Reason} |
| 2466 |
There seems no reason to allow the implementation of RPC-receiver |
| 2467 |
to be nonreentrant, even though we don't require that every |
| 2468 |
implementation of the PCS actually perform concurrent calls |
| 2469 |
on the RPC-receiver. |
| 2470 |
@end{Reason} |
| 2471 |
|
| 2472 |
@ChgRef{Version=[1],Kind=[Added],Ref=[8652/0087],ARef=[AI95-00082-01]} |
| 2473 |
@ChgAdded{Version=[1],Text=[An implementation shall not restrict the |
| 2474 |
replacement of the body of |
| 2475 |
System.RPC. An implementation shall not restrict children of System.RPC. |
| 2476 |
@Redundant[The related implementation permissions in the introduction to |
| 2477 |
Annex A do not apply.]]} |
| 2478 |
@begin{Reason} |
| 2479 |
@ChgRef{Version=[1],Kind=[Added]} |
| 2480 |
@ChgAdded{Version=[1],Text=[The point of System.RPC is to let the user tailor |
| 2481 |
the communications |
| 2482 |
mechanism without requiring changes to or other cooperation from the compiler. |
| 2483 |
However, implementations can restrict the replacement of language-defined units. |
| 2484 |
This requirement overrides that permission for System.RPC.]} |
| 2485 |
@end{Reason} |
| 2486 |
@ChgRef{Version=[1],Kind=[Added],Ref=[8652/0087],ARef=[AI95-00082-01]} |
| 2487 |
@ChgAdded{Version=[1],Text=[If the implementation of System.RPC is provided by |
| 2488 |
the user, an implementation shall support remote subprogram calls as specified.]} |
| 2489 |
@begin{Discussion} |
| 2490 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00273-01]} |
| 2491 |
@ChgAdded{Version=[2],Text=[If the implementation takes advantage of the |
| 2492 |
implementation permission to use a different specification for System.RPC, |
| 2493 |
it still needs to use it for remote subprogram calls, and allow the user |
| 2494 |
to replace the body of System.RPC. It just isn't guaranteed to be portable |
| 2495 |
to do so in Ada 2005 - an advantage which was more theoretical than real |
| 2496 |
anyway.]} |
| 2497 |
@end{Discussion} |
| 2498 |
@end{ImplReq} |
| 2499 |
|
| 2500 |
@begin{DocReq} |
| 2501 |
|
| 2502 |
The implementation of the PCS shall document whether |
| 2503 |
the RPC-receiver is invoked from concurrent tasks. If there is an |
| 2504 |
upper limit on the number of such tasks, this limit shall be documented as |
| 2505 |
well, together with the mechanisms to configure it (if this is supported). |
| 2506 |
@ChgImplDef{Version=[2],Kind=[Deleted],InitialVersion=[0], |
| 2507 |
Text=[@ChgDeleted{Version=[2], |
| 2508 |
Text=[Implementation-defined aspects of the PCS.]}]} |
| 2509 |
@ChgDocReq{Version=[2],Kind=[Added],Text=[@ChgAdded{Version=[2], |
| 2510 |
Text=[Whether the RPC-receiver is invoked from concurrent tasks, and if so, |
| 2511 |
the number of such tasks.]}]} |
| 2512 |
|
| 2513 |
@end{DocReq} |
| 2514 |
|
| 2515 |
@begin{ImplPerm} |
| 2516 |
|
| 2517 |
The PCS is allowed to contain implementation-defined interfaces for |
| 2518 |
explicit message passing, broadcasting, etc. Similarly, it is allowed |
| 2519 |
to provide additional |
| 2520 |
interfaces to query the state of some remote partition (given its partition |
| 2521 |
ID) or of the PCS itself, to set timeouts and retry parameters, to get more |
| 2522 |
detailed error status, etc. These |
| 2523 |
additional interfaces should be provided in child packages of System.RPC. |
| 2524 |
@ImplDef{Implementation-defined interfaces in the PCS.} |
| 2525 |
|
| 2526 |
A body for the package System.RPC need not be supplied by the |
| 2527 |
implementation. |
| 2528 |
@begin{Reason} |
| 2529 |
It is presumed that a body for the package System.RPC might be |
| 2530 |
extremely environment specific. Therefore, we do not require |
| 2531 |
that a body be provided by the (compiler) implementation. The user |
| 2532 |
will have to write a body, or acquire one, appropriate for the |
| 2533 |
target environment. |
| 2534 |
@end{Reason} |
| 2535 |
|
| 2536 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00273-01]} |
| 2537 |
@ChgRef{Version=[3],Kind=[RevisedAdded],ARef=[AI05-0299-1]} |
| 2538 |
@ChgAdded{Version=[2],Text=[An alternative declaration is allowed for |
| 2539 |
package System.RPC as long as it provides a set of operations that is |
| 2540 |
substantially equivalent to the specification defined in this |
| 2541 |
@Chg{Version=[3],New=[subclause],Old=[clause]}.]} |
| 2542 |
@begin{Reason} |
| 2543 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 2544 |
@ChgAdded{Version=[2],Text=[Experience has proved that the definition |
| 2545 |
of System.RPC given here is inadequate for interfacing to existing |
| 2546 |
distribution mechanisms (such as CORBA), especially on heterogeneous |
| 2547 |
systems. Rather than mandate a change in the mechanism (which would |
| 2548 |
break existing systems), require implementations to support multiple |
| 2549 |
mechanisms (which is impractical), or prevent the use of Annex E facilities |
| 2550 |
with existing systems (which would be silly), we simply make this facility |
| 2551 |
optional.]} |
| 2552 |
|
| 2553 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 2554 |
@ChgAdded{Version=[2],Text=[One of the purposes behind System.RPC was |
| 2555 |
that knowledgeable users, rather than compiler vendors, could create |
| 2556 |
this package tailored to their networks. Experience has shown that |
| 2557 |
users get their RPC from vendors anyway; users have not taken advantage |
| 2558 |
of the flexibility provided by this defined interface. Moreover, one |
| 2559 |
could compare this defined interface to requiring Ada compilers to use |
| 2560 |
a defined interface to implement tasking. No one thinks that the latter is |
| 2561 |
a good idea, why should anyone believe that the former is?]} |
| 2562 |
|
| 2563 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 2564 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0299-1]} |
| 2565 |
@ChgAdded{Version=[2],Text=[Therefore, this |
| 2566 |
@Chg{Version=[3],New=[subclause],Old=[clause]} is made optional. We considered |
| 2567 |
deleting the @Chg{Version=[3],New=[subclause],Old=[clause]} outright, but we |
| 2568 |
still require that users may replace the package (whatever its interface). |
| 2569 |
Also, it still provides a useful guide to the implementation of this |
| 2570 |
feature.]} |
| 2571 |
@end{Reason} |
| 2572 |
@end{ImplPerm} |
| 2573 |
|
| 2574 |
@begin{ImplAdvice} |
| 2575 |
|
| 2576 |
Whenever possible, the PCS on the called partition should |
| 2577 |
allow for multiple tasks to call the RPC-receiver with |
| 2578 |
different messages and should allow them to block until the corresponding |
| 2579 |
subprogram body returns. |
| 2580 |
@ChgImplAdvice{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2], |
| 2581 |
Text=[The PCS should allow for multiple tasks to call the RPC-receiver.]}]} |
| 2582 |
|
| 2583 |
The Write operation on a stream of type Params_Stream_Type should raise |
| 2584 |
Storage_Error if it runs out of space trying to write the Item |
| 2585 |
into the stream. |
| 2586 |
@ChgImplAdvice{Version=[2],Kind=[Added],Text=[@ChgAdded{Version=[2], |
| 2587 |
Text=[The System.RPC.Write operation should raise Storage_Error if it runs out |
| 2588 |
of space when writing an item.]}]} |
| 2589 |
@begin{ImplNote} |
| 2590 |
An implementation could also dynamically allocate more space |
| 2591 |
as needed, only propagating Storage_Error if the @nt<allocator> |
| 2592 |
it calls raises Storage_Error. This storage could be managed |
| 2593 |
through a controlled component of the stream object, to |
| 2594 |
ensure that it is reclaimed when the stream object |
| 2595 |
is finalized. |
| 2596 |
@end{ImplNote} |
| 2597 |
|
| 2598 |
@end{ImplAdvice} |
| 2599 |
|
| 2600 |
@begin{Notes} |
| 2601 |
The package System.RPC is not designed for direct calls by user |
| 2602 |
programs. It is instead designed for use in the implementation of remote |
| 2603 |
subprograms calls, being called by the calling stubs generated for a |
| 2604 |
remote call interface library unit to initiate a remote call, |
| 2605 |
and in turn calling back to an |
| 2606 |
RPC-receiver that dispatches to the receiving stubs generated |
| 2607 |
for the body of a remote call interface, to handle a remote call |
| 2608 |
received from elsewhere. |
| 2609 |
@end{Notes} |
| 2610 |
|
| 2611 |
@begin{Incompatible95} |
| 2612 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00273-01]} |
| 2613 |
@ChgAdded{Version=[2],Text=[@Defn{incompatibilities with Ada 95} |
| 2614 |
The specification of System.RPC can now be |
| 2615 |
tailored for an implementation. If a program replaces the body of System.RPC |
| 2616 |
with a user-defined body, it might not compile in a given implementation |
| 2617 |
of Ada 2005 (if the specification of System.RPC has been changed).]} |
| 2618 |
@end{Incompatible95} |
| 2619 |
|
| 2620 |
@begin{DiffWord95} |
| 2621 |
@ChgRef{Version=[2],Kind=[AddedNormal],Ref=[8652/0087],ARef=[AI95-00082-01]} |
| 2622 |
@ChgAdded{Version=[2],Text=[@b<Corrigendum:> Clarified that the user can |
| 2623 |
replace System.RPC.]} |
| 2624 |
@end{DiffWord95} |