exp_dist.ads, [...] (Build_To_Any_Call, [...]): Do an Unchecked_Conversion to handle the passage from the Underlying Type to...

2007-04-06  Thomas Quinot  <quinot@adacore.com>

	* exp_dist.ads, exp_dist.adb (Build_To_Any_Call, Build_From_Any_Call):
	Do an Unchecked_Conversion to handle the passage from the Underlying
	Type to the Base Type when calling Build_To_Any_Call and
	Build_From_Any_Call.
	(Build_Actual_Object_Declaration): Set Object's Ekind to E_Variable or
	E_Constant, depending upon Variable formal.
	(GARLIC_Support.Build_Subprogram_Receiving_Stubs,
	PolyORB_Support.Build_Subprogram_Receiving_Stubs): For a formal
	parameter that requires an extra constrained parameter, declare
	temporary for actual as a variable, not a constant.
	(Add_RACW_Primitive_Declarations_And_Bodies): Generate bodies only when
	the unit being compiled is the one that contains the stub type.
	Change primitive operation name for the RACW associated with a RAS
	from Call to _Call so it cannot clash with any legal identifier.
	(PolyORB_Support.Add_RACW_Write_Attribute): Remove unused constant
	Is_RAS.
	(Append_RACW_Bodies): New subprogram.
	(Expand_Receiving_Stubs_Bodies): Pass a 'Stmts' list to
	Add_Receiving_Stubs_To_Declarations functions.
	When expanding a package body, this list correspond to the
	statements in the HSS at the end of the pacakge.
	When expanding a package spec, this list correspond to the
	spec declarations.
	(Add_Receiving_Stubs_To_Declarations): Append the function
	registering the receiving stubs at the end of the 'Stmts' list.
	(RCI_Package_Locator): Pass the new Version generic formal when
	instantiating a RCI_Locator package.
	(Build_From_Any_Function): To compute the High bound for an
	unconstrained array actual, we add the Low bound with the length.
	Thus we must convert the low bound and the length to an appropriate
	type before doing the sum.
	(Build_Subprogram_Receiving_Stubs, PolyORB):
	 * Retrieve the extra formals parameters at the
	   end of the parameter stream.
	 * Use Move_Any_Value to write back out parameters
	   after executing the request as it is more efficient
	   than Copy_Any_Value.
	 * Build the any containing Extra Formals with the
	   appropriate typecode.
	(PolyORB_Support.Helpers.Append_Record_Traversal): Nothing to do for an
	empty Component_List.
	(Build_Actual_Object_Declaration): New subprogram. Build and insert into
	the tree the declaration for an object that serves as actual parameter
	in server-side stubs.
	(GARLIC_Support.Build_Subprogram_Receiving_Stubs,
	PolyORB_Support.Build_Subprogram_Receiving_Stubs):
	Use Build_Actual_Object_Declaration to prepare the actuals.
	(Add_Parameter_To_NVList): Set the parameter mode to In for
	Extra Constrained Parameters.
	(Build_General_Calling_Stubs): Set the parameter type to boolean for
	Extra Constrained parameters.
	(Build_To_Any_Function, Build_From_Any_Function,
	Built_TypeCode_Function): When Typ is implicit, call the correct
	function with the first not implicit parent type.
	(TC_Rec_Add_Process_Element, FA_Rec_Add_Process_Element,
	(FA_Ary_Add_Process_Element): When Datum is an Any, we cannot infer the
	typecode from the Etype. Therefore we retrieve the correct typecode
	with a call to Get_Any_Type.
	(Copy_Specification): Do controlling formal type substitution based on
	Is_Controlling_Formal flag, instead of caller-provided object type.
	(Build_Subprogram_Calling_Stubs): When retrieveing the original spec for
	a RACW primitive operation, we might get a subprogram declaration for an
	ancestor of the RACW designated type (not for the designated type
	itself), in the case where this operation is inherited. In this case we
	have no easy means of determining the original tagged type for which
	the primitive was declared, so instead we now rely on
	Copy_Specification to use the Is_Controlling_Formal flag to determine
	which formals require type substitution.

From-SVN: r123565
This commit is contained in:
Thomas Quinot 2007-04-06 11:20:52 +02:00 committed by Arnaud Charlet
parent cc2c4c6567
commit 8aa23fe306
2 changed files with 974 additions and 443 deletions

File diff suppressed because it is too large Load Diff

View File

@ -44,7 +44,7 @@ package Exp_Dist is
procedure Add_RACW_Primitive_Declarations_And_Bodies
(Designated_Type : Entity_Id;
Insertion_Node : Node_Id;
Decls : List_Id);
Body_Decls : List_Id);
-- Add primitive for the stub type, and the RPC receiver. The declarations
-- are inserted after insertion_Node, while the bodies are appened at the
-- end of Decls.
@ -86,21 +86,28 @@ package Exp_Dist is
function Copy_Specification
(Loc : Source_Ptr;
Spec : Node_Id;
Object_Type : Entity_Id := Empty;
Stub_Type : Entity_Id := Empty;
Ctrl_Type : Entity_Id := Empty;
New_Name : Name_Id := No_Name) return Node_Id;
-- Build a subprogram specification from another one, or from
-- an access-to-subprogram definition. If Object_Type is not Empty
-- and any access to Object_Type is found, then it is replaced by an
-- access to Stub_Type. If New_Name is given, then it will be used as
-- the name for the newly created spec.
-- Build a subprogram specification from another one, or from an
-- access-to-subprogram definition. If Ctrl_Type is not Empty, and any
-- controlling formal of an anonymous access type is found, then it is
-- replaced by an access to Ctrl_Type. If New_Name is given, then it will
-- be used as the name for the newly created spec.
function Corresponding_Stub_Type (RACW_Type : Entity_Id) return Entity_Id;
-- Return the stub type associated with the given RACW type
function Underlying_RACW_Type
(RAS_Typ : Entity_Id) return Entity_Id;
function Underlying_RACW_Type (RAS_Typ : Entity_Id) return Entity_Id;
-- Given a remote access-to-subprogram type or its equivalent
-- record type, return the RACW type generated to implement it.
procedure Append_RACW_Bodies (Decls : List_Id; Spec_Id : Entity_Id);
-- Append the unanalyzed subprogram bodies generated to support RACWs
-- declared in the given package spec (RACW stream subprograms, calling
-- stubs primitive operations) to the given list (which is expected to be
-- the declarations list for the corresponding package body, if there is
-- one). In the case where a body is present, the subprogram bodies must
-- not be generated in the package spec because this would cause an
-- incorrect attempt to freeze Taft amendment types declared in the spec.
end Exp_Dist;