Commit d693e39d by Thomas Quinot Committed by Arnaud Charlet

2008-05-26 Thomas Quinot <quinot@adacore.com>

	* rtsfind.ads, rtsfind.adb:
	(RE_Get_RACW): New runtime library entity provided by PolyORB s-parint.
	(Check_RPC): Support per-PCS-kind API versioning.
	
	exp_dist.ads, exp_dist.adb:
	(Build_Stub_Tag, Get_Stub_Elements): New utility subprograms.
	(PolyORB_Support.Add_RACW_From_Any): Offload common code to new runtime
	 library function Get_RACW.
	(PolyORB_Support.Add_RACW_To_Any): Offload common code to new runtime
	library function Get_Reference.
	(PolyORB_Support.Add_RACW_Read_Attribute): Use Get_RACW instead of going
	through an intermediate Any.
	(PolyORB_Support.Add_RACW_Write_Attribute): Use Get_Reference instead of
	going through an intermediate Any.
	
	* sem_dist.adb: Minor reformatting.

From-SVN: r135932
parent 76fe54f0
2008-05-26 Thomas Quinot <quinot@adacore.com>
* rtsfind.ads, rtsfind.adb:
(RE_Get_RACW): New runtime library entity provided by PolyORB s-parint.
(Check_RPC): Support per-PCS-kind API versioning.
exp_dist.ads, exp_dist.adb:
(Build_Stub_Tag, Get_Stub_Elements): New utility subprograms.
(PolyORB_Support.Add_RACW_From_Any): Offload common code to new runtime
library function Get_RACW.
(PolyORB_Support.Add_RACW_To_Any): Offload common code to new runtime
library function Get_Reference.
(PolyORB_Support.Add_RACW_Read_Attribute): Use Get_RACW instead of going
through an intermediate Any.
(PolyORB_Support.Add_RACW_Write_Attribute): Use Get_Reference instead of
going through an intermediate Any.
* sem_dist.adb: Minor reformatting.
2008-05-26 Javier Miranda <miranda@adacore.com> 2008-05-26 Javier Miranda <miranda@adacore.com>
* einfo.ads (Abstract_Interface_Alias): Renamed as Interface_Alias. * einfo.ads (Abstract_Interface_Alias): Renamed as Interface_Alias.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -27,11 +27,15 @@ ...@@ -27,11 +27,15 @@
-- stubs relevant to the distribution annex. -- stubs relevant to the distribution annex.
with Namet; use Namet; with Namet; use Namet;
with Snames; use Snames;
with Types; use Types; with Types; use Types;
package Exp_Dist is package Exp_Dist is
PCS_Version_Number : constant := 1; PCS_Version_Number : constant array (PCS_Names) of Int :=
(Name_No_DSA => 1,
Name_GARLIC_DSA => 1,
Name_PolyORB_DSA => 2);
-- PCS interface version. This is used to check for consistency between the -- PCS interface version. This is used to check for consistency between the
-- compiler used to generate distribution stubs and the PCS implementation. -- compiler used to generate distribution stubs and the PCS implementation.
-- It must be incremented whenever a change is made to the generated code -- It must be incremented whenever a change is made to the generated code
......
...@@ -959,7 +959,9 @@ package body Rtsfind is ...@@ -959,7 +959,9 @@ package body Rtsfind is
if Get_PCS_Name = Name_No_DSA then if Get_PCS_Name = Name_No_DSA then
Check_RPC_Failure ("distribution feature not supported"); Check_RPC_Failure ("distribution feature not supported");
elsif Get_PCS_Version /= Exp_Dist.PCS_Version_Number then elsif Get_PCS_Version /=
Exp_Dist.PCS_Version_Number (Get_PCS_Name)
then
Check_RPC_Failure ("PCS version mismatch"); Check_RPC_Failure ("PCS version mismatch");
end if; end if;
......
...@@ -1078,6 +1078,7 @@ package Rtsfind is ...@@ -1078,6 +1078,7 @@ package Rtsfind is
RE_DSA_Implementation, -- System.Partition_Interface RE_DSA_Implementation, -- System.Partition_Interface
RE_PCS_Version, -- System.Partition_Interface RE_PCS_Version, -- System.Partition_Interface
RE_Get_RACW, -- System.Partition_Interface
RE_Get_RCI_Package_Receiver, -- System.Partition_Interface RE_Get_RCI_Package_Receiver, -- System.Partition_Interface
RE_Get_Unique_Remote_Pointer, -- System.Partition_Interface RE_Get_Unique_Remote_Pointer, -- System.Partition_Interface
RE_RACW_Stub_Type_Access, -- System.Partition_Interface RE_RACW_Stub_Type_Access, -- System.Partition_Interface
...@@ -2209,6 +2210,7 @@ package Rtsfind is ...@@ -2209,6 +2210,7 @@ package Rtsfind is
RE_DSA_Implementation => System_Partition_Interface, RE_DSA_Implementation => System_Partition_Interface,
RE_PCS_Version => System_Partition_Interface, RE_PCS_Version => System_Partition_Interface,
RE_Get_RACW => System_Partition_Interface,
RE_Get_RCI_Package_Receiver => System_Partition_Interface, RE_Get_RCI_Package_Receiver => System_Partition_Interface,
RE_Get_Unique_Remote_Pointer => System_Partition_Interface, RE_Get_Unique_Remote_Pointer => System_Partition_Interface,
RE_RACW_Stub_Type_Access => System_Partition_Interface, RE_RACW_Stub_Type_Access => System_Partition_Interface,
......
...@@ -64,7 +64,9 @@ package body Sem_Dist is ...@@ -64,7 +64,9 @@ package body Sem_Dist is
procedure Add_Stub_Constructs (N : Node_Id) is procedure Add_Stub_Constructs (N : Node_Id) is
U : constant Node_Id := Unit (N); U : constant Node_Id := Unit (N);
Spec : Entity_Id := Empty; Spec : Entity_Id := Empty;
Exp : Node_Id := U; -- Unit that will be expanded
Exp : Node_Id := U;
-- Unit that will be expanded
begin begin
pragma Assert (Distribution_Stub_Mode /= No_Stubs); pragma Assert (Distribution_Stub_Mode /= No_Stubs);
...@@ -84,7 +86,6 @@ package body Sem_Dist is ...@@ -84,7 +86,6 @@ package body Sem_Dist is
or else Is_Remote_Call_Interface (Spec)); or else Is_Remote_Call_Interface (Spec));
if Distribution_Stub_Mode = Generate_Caller_Stub_Body then if Distribution_Stub_Mode = Generate_Caller_Stub_Body then
if Is_Shared_Passive (Spec) then if Is_Shared_Passive (Spec) then
null; null;
elsif Nkind (U) = N_Package_Body then elsif Nkind (U) = N_Package_Body then
...@@ -95,7 +96,6 @@ package body Sem_Dist is ...@@ -95,7 +96,6 @@ package body Sem_Dist is
end if; end if;
else else
if Is_Shared_Passive (Spec) then if Is_Shared_Passive (Spec) then
Build_Passive_Partition_Stub (Exp); Build_Passive_Partition_Stub (Exp);
else else
...@@ -186,7 +186,6 @@ package body Sem_Dist is ...@@ -186,7 +186,6 @@ package body Sem_Dist is
if Parent_Name /= No_String then if Parent_Name /= No_String then
Start_String (Parent_Name); Start_String (Parent_Name);
Store_String_Char (Get_Char_Code ('.')); Store_String_Char (Get_Char_Code ('.'));
else else
Start_String; Start_String;
end if; end if;
...@@ -242,15 +241,13 @@ package body Sem_Dist is ...@@ -242,15 +241,13 @@ package body Sem_Dist is
Par : Node_Id; Par : Node_Id;
begin begin
if (Nkind (N) = N_Function_Call if Nkind_In (N, N_Function_Call, N_Procedure_Call_Statement)
or else Nkind (N) = N_Procedure_Call_Statement)
and then Nkind (Name (N)) in N_Has_Entity and then Nkind (Name (N)) in N_Has_Entity
and then Is_Remote_Call_Interface (Entity (Name (N))) and then Is_Remote_Call_Interface (Entity (Name (N)))
and then Has_All_Calls_Remote (Scope (Entity (Name (N)))) and then Has_All_Calls_Remote (Scope (Entity (Name (N))))
and then Comes_From_Source (N) and then Comes_From_Source (N)
then then
Par := Parent (Entity (Name (N))); Par := Parent (Entity (Name (N)));
while Present (Par) while Present (Par)
and then (Nkind (Par) /= N_Package_Specification and then (Nkind (Par) /= N_Package_Specification
or else Is_Wrapper_Package (Defining_Entity (Par))) or else Is_Wrapper_Package (Defining_Entity (Par)))
...@@ -294,9 +291,10 @@ package body Sem_Dist is ...@@ -294,9 +291,10 @@ package body Sem_Dist is
------------------------------------ ------------------------------------
function Package_Specification_Of_Scope (E : Entity_Id) return Node_Id is function Package_Specification_Of_Scope (E : Entity_Id) return Node_Id is
N : Node_Id := Parent (E); N : Node_Id;
begin begin
N := Parent (E);
while Nkind (N) /= N_Package_Specification loop while Nkind (N) /= N_Package_Specification loop
N := Parent (N); N := Parent (N);
end loop; end loop;
...@@ -317,11 +315,10 @@ package body Sem_Dist is ...@@ -317,11 +315,10 @@ package body Sem_Dist is
Typ : constant Entity_Id := Etype (N); Typ : constant Entity_Id := Etype (N);
begin begin
Ety := Entity (Prefix (N));
-- In case prefix is not a library unit entity, get the entity -- In case prefix is not a library unit entity, get the entity
-- of library unit. -- of library unit.
Ety := Entity (Prefix (N));
while (Present (Scope (Ety)) while (Present (Scope (Ety))
and then Scope (Ety) /= Standard_Standard) and then Scope (Ety) /= Standard_Standard)
and not Is_Child_Unit (Ety) and not Is_Child_Unit (Ety)
...@@ -363,7 +360,6 @@ package body Sem_Dist is ...@@ -363,7 +360,6 @@ package body Sem_Dist is
else else
Get_Pt_Id_Call := Make_Function_Call (Loc, Get_Pt_Id); Get_Pt_Id_Call := Make_Function_Call (Loc, Get_Pt_Id);
end if; end if;
-- Replace the attribute node by a conversion of the function call -- Replace the attribute node by a conversion of the function call
...@@ -429,7 +425,8 @@ package body Sem_Dist is ...@@ -429,7 +425,8 @@ package body Sem_Dist is
Name => New_Occurrence_Of (Attribute_Subp, Loc), Name => New_Occurrence_Of (Attribute_Subp, Loc),
Parameter_Associations => Parameter_Associations =>
New_List ( New_List (
Make_String_Literal (Loc, Full_Qualified_Name (RS_Pkg_E)), Make_String_Literal (Loc,
Strval => Full_Qualified_Name (RS_Pkg_E)),
Build_Subprogram_Id (Loc, Remote_Subp), Build_Subprogram_Id (Loc, Remote_Subp),
New_Occurrence_Of (Async_E, Loc), New_Occurrence_Of (Async_E, Loc),
New_Occurrence_Of (All_Calls_Remote_E, Loc))); New_Occurrence_Of (All_Calls_Remote_E, Loc)));
...@@ -527,8 +524,7 @@ package body Sem_Dist is ...@@ -527,8 +524,7 @@ package body Sem_Dist is
Append_To (Priv_Decls, Append_To (Priv_Decls,
Make_Full_Type_Declaration (Loc, Make_Full_Type_Declaration (Loc,
Defining_Identifier => Defining_Identifier => Full_Obj_Type,
Full_Obj_Type,
Type_Definition => Type_Definition =>
Make_Record_Definition (Loc, Make_Record_Definition (Loc,
Abstract_Present => True, Abstract_Present => True,
...@@ -558,39 +554,33 @@ package body Sem_Dist is ...@@ -558,39 +554,33 @@ package body Sem_Dist is
All_Present => True, All_Present => True,
Subtype_Indication => Subtype_Indication =>
Make_Attribute_Reference (Loc, Make_Attribute_Reference (Loc,
Prefix => Prefix => New_Occurrence_Of (Obj_Type, Loc),
New_Occurrence_Of (Obj_Type, Loc), Attribute_Name => Name_Class))));
Attribute_Name =>
Name_Class))));
Set_Is_Remote_Call_Interface (RACW_Type, Is_RCI); Set_Is_Remote_Call_Interface (RACW_Type, Is_RCI);
Set_Is_Remote_Types (RACW_Type, Is_RT); Set_Is_Remote_Types (RACW_Type, Is_RT);
Subpkg_Decl := Subpkg_Decl :=
Make_Package_Declaration (Loc, Make_Package_Declaration (Loc,
Make_Package_Specification (Loc, Make_Package_Specification (Loc,
Defining_Unit_Name => Defining_Unit_Name => Subpkg,
Subpkg, Visible_Declarations => Vis_Decls,
Visible_Declarations => Private_Declarations => Priv_Decls,
Vis_Decls, End_Label => New_Occurrence_Of (Subpkg, Loc)));
Private_Declarations =>
Priv_Decls,
End_Label =>
New_Occurrence_Of (Subpkg, Loc)));
Set_Is_Remote_Call_Interface (Subpkg, Is_RCI); Set_Is_Remote_Call_Interface (Subpkg, Is_RCI);
Set_Is_Remote_Types (Subpkg, Is_RT); Set_Is_Remote_Types (Subpkg, Is_RT);
Insert_After_And_Analyze (N, Subpkg_Decl); Insert_After_And_Analyze (N, Subpkg_Decl);
-- Generate package body to receive RACW calling stubs -- Generate package body to receive RACW calling stubs
-- Note: Analyze_Declarations has an absolute requirement that
-- the declaration list be non-empty, so we provide a dummy null -- Note: Analyze_Declarations has an absolute requirement that the
-- statement here. -- declaration list be non-empty, so provide dummy null statement here.
Subpkg_Body := Subpkg_Body :=
Make_Package_Body (Loc, Make_Package_Body (Loc,
Defining_Unit_Name => Defining_Unit_Name => Make_Defining_Identifier (Loc, Chars (Subpkg)),
Make_Defining_Identifier (Loc, Chars (Subpkg)), Declarations => New_List (Make_Null_Statement (Loc)));
Declarations => New_List (
Make_Null_Statement (Loc)));
Insert_After_And_Analyze (Subpkg_Decl, Subpkg_Body); Insert_After_And_Analyze (Subpkg_Decl, Subpkg_Body);
-- Many parts of the analyzer and expander expect -- Many parts of the analyzer and expander expect
...@@ -612,10 +602,10 @@ package body Sem_Dist is ...@@ -612,10 +602,10 @@ package body Sem_Dist is
Make_Defining_Identifier (Loc, Name_Ras), Make_Defining_Identifier (Loc, Name_Ras),
Component_Definition => Component_Definition =>
Make_Component_Definition (Loc, Make_Component_Definition (Loc,
Aliased_Present => Aliased_Present => False,
False,
Subtype_Indication => Subtype_Indication =>
New_Occurrence_Of (RACW_Type, Loc))))))); New_Occurrence_Of (RACW_Type, Loc)))))));
Set_Equivalent_Type (User_Type, Fat_Type); Set_Equivalent_Type (User_Type, Fat_Type);
Set_Corresponding_Remote_Type (Fat_Type, User_Type); Set_Corresponding_Remote_Type (Fat_Type, User_Type);
Insert_After_And_Analyze (Subpkg_Body, Fat_Type_Decl); Insert_After_And_Analyze (Subpkg_Body, Fat_Type_Decl);
...@@ -656,7 +646,6 @@ package body Sem_Dist is ...@@ -656,7 +646,6 @@ package body Sem_Dist is
end if; end if;
elsif Nkind (Deref_Subp_Call) = N_Indexed_Component then elsif Nkind (Deref_Subp_Call) = N_Indexed_Component then
Params := Expressions (Deref_Subp_Call); Params := Expressions (Deref_Subp_Call);
if Present (Params) then if Present (Params) then
...@@ -683,7 +672,6 @@ package body Sem_Dist is ...@@ -683,7 +672,6 @@ package body Sem_Dist is
Make_Function_Call (Loc, Make_Function_Call (Loc,
Name => New_Occurrence_Of (Deref_Proc, Loc), Name => New_Occurrence_Of (Deref_Proc, Loc),
Parameter_Associations => Params); Parameter_Associations => Params);
else else
Call_Node := Call_Node :=
Make_Procedure_Call_Statement (Loc, Make_Procedure_Call_Statement (Loc,
...@@ -711,8 +699,8 @@ package body Sem_Dist is ...@@ -711,8 +699,8 @@ package body Sem_Dist is
and then (Is_Remote_Call_Interface (ET) and then (Is_Remote_Call_Interface (ET)
or else Is_Remote_Types (ET)) or else Is_Remote_Types (ET))
and then Present (Corresponding_Remote_Type (ET)) and then Present (Corresponding_Remote_Type (ET))
and then (Nkind (Parent (Parent (P))) = N_Procedure_Call_Statement and then Nkind_In (Parent (Parent (P)), N_Procedure_Call_Statement,
or else Nkind (Parent (Parent (P))) = N_Indexed_Component) N_Indexed_Component)
and then Expander_Active and then Expander_Active
then then
RAS_E_Dereference (P); RAS_E_Dereference (P);
...@@ -788,17 +776,14 @@ package body Sem_Dist is ...@@ -788,17 +776,14 @@ package body Sem_Dist is
-- We do not have to handle this case -- We do not have to handle this case
return False; return False;
end if; end if;
Rewrite (N, Rewrite (N,
Make_Aggregate (Loc, Make_Aggregate (Loc,
Component_Associations => New_List ( Component_Associations => New_List (
Make_Component_Association (Loc, Make_Component_Association (Loc,
Choices => New_List ( Choices => New_List (Make_Identifier (Loc, Name_Ras)),
Make_Identifier (Loc, Name_Ras)), Expression => Make_Null (Loc)))));
Expression =>
Make_Null (Loc)))));
Analyze_And_Resolve (N, Target_Type); Analyze_And_Resolve (N, Target_Type);
return True; return True;
end Remote_AST_Null_Value; end Remote_AST_Null_Value;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment