From: Eric Botcazou <[email protected]>
Compiling Ada.Tags with -gnatRh shows unused bits in the Type_Specific_Data
record type for 64-bit targets. This saves one 64-bit word in it for them.
gcc/ada/ChangeLog:
* libgnat/a-tags.ads (Type_Specific_Data): Move Boolean components
to right after Natural components and put Is_Abstract last.
* exp_disp.adb (Make_DT): Adjust to above reordering.
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/exp_disp.adb | 88 +++++++++++++++++++-------------------
gcc/ada/libgnat/a-tags.ads | 35 +++++++--------
2 files changed, 62 insertions(+), 61 deletions(-)
diff --git a/gcc/ada/exp_disp.adb b/gcc/ada/exp_disp.adb
index 8e0bcce49f9..13fc8158e78 100644
--- a/gcc/ada/exp_disp.adb
+++ b/gcc/ada/exp_disp.adb
@@ -5129,6 +5129,50 @@ package body Exp_Disp is
Attribute_Name => Name_Alignment));
end if;
+ -- Transportable: Set for types that can be used in remote calls
+ -- with respect to E.4(18) legality rules.
+
+ declare
+ Transportable : Entity_Id;
+
+ begin
+ Transportable :=
+ Boolean_Literals
+ (Is_Pure (Typ)
+ or else Is_Shared_Passive (Typ)
+ or else
+ ((Is_Remote_Types (Typ)
+ or else Is_Remote_Call_Interface (Typ))
+ and then Original_View_In_Visible_Part (Typ))
+ or else not Comes_From_Source (Typ));
+
+ Append_To (TSD_Aggr_List,
+ New_Occurrence_Of (Transportable, Loc));
+ end;
+
+ -- Needs_Finalization: Set if the type is controlled or has controlled
+ -- components.
+
+ declare
+ Needs_Fin : Entity_Id;
+ begin
+ Needs_Fin := Boolean_Literals (Needs_Finalization (Typ));
+ Append_To (TSD_Aggr_List, New_Occurrence_Of (Needs_Fin, Loc));
+ end;
+
+ -- Is_Abstract (Ada 2012: AI05-0173). This functionality is not
+ -- available in the HIE runtime.
+
+ if RTE_Record_Component_Available (RE_Is_Abstract) then
+ declare
+ Is_Abstract : Entity_Id;
+ begin
+ Is_Abstract := Boolean_Literals (Is_Abstract_Type (Typ));
+ Append_To (TSD_Aggr_List,
+ New_Occurrence_Of (Is_Abstract, Loc));
+ end;
+ end if;
+
-- Expanded_Name
Append_To (TSD_Aggr_List,
@@ -5345,50 +5389,6 @@ package body Exp_Disp is
New_Occurrence_Of (RTE (RE_Null_Address), Loc)));
end if;
- -- Transportable: Set for types that can be used in remote calls
- -- with respect to E.4(18) legality rules.
-
- declare
- Transportable : Entity_Id;
-
- begin
- Transportable :=
- Boolean_Literals
- (Is_Pure (Typ)
- or else Is_Shared_Passive (Typ)
- or else
- ((Is_Remote_Types (Typ)
- or else Is_Remote_Call_Interface (Typ))
- and then Original_View_In_Visible_Part (Typ))
- or else not Comes_From_Source (Typ));
-
- Append_To (TSD_Aggr_List,
- New_Occurrence_Of (Transportable, Loc));
- end;
-
- -- Is_Abstract (Ada 2012: AI05-0173). This functionality is not
- -- available in the HIE runtime.
-
- if RTE_Record_Component_Available (RE_Is_Abstract) then
- declare
- Is_Abstract : Entity_Id;
- begin
- Is_Abstract := Boolean_Literals (Is_Abstract_Type (Typ));
- Append_To (TSD_Aggr_List,
- New_Occurrence_Of (Is_Abstract, Loc));
- end;
- end if;
-
- -- Needs_Finalization: Set if the type is controlled or has controlled
- -- components.
-
- declare
- Needs_Fin : Entity_Id;
- begin
- Needs_Fin := Boolean_Literals (Needs_Finalization (Typ));
- Append_To (TSD_Aggr_List, New_Occurrence_Of (Needs_Fin, Loc));
- end;
-
-- Size_Func
if RTE_Record_Component_Available (RE_Size_Func) then
diff --git a/gcc/ada/libgnat/a-tags.ads b/gcc/ada/libgnat/a-tags.ads
index f4cf653b18c..c9d122dae65 100644
--- a/gcc/ada/libgnat/a-tags.ads
+++ b/gcc/ada/libgnat/a-tags.ads
@@ -289,10 +289,9 @@ private
access function (A : System.Address) return Long_Long_Integer;
type Type_Specific_Data (Idepth : Natural) is record
- -- The discriminant Idepth is the Inheritance Depth Level: Used to
- -- implement the membership test associated with single inheritance of
- -- tagged types in constant-time. It also indicates the size of the
- -- Tags_Table component.
+ -- Inheritance Depth Level: Used to implement the membership test
+ -- associated with single inheritance of tagged types in constant-time.
+ -- It also indicates the size of the Tags_Table component.
Access_Level : Natural;
-- Accessibility level required to give support to Ada 2005 nested type
@@ -303,28 +302,30 @@ private
-- function return, and class-wide stream I/O, the danger of objects
-- outliving their type declaration can be eliminated (Ada 2005: AI-344)
- Alignment : Natural;
- Expanded_Name : Cstring_Ptr;
- External_Tag : Cstring_Ptr;
- HT_Link : Tag_Ptr;
- -- Components used to support to the Ada.Tags subprograms in RM 3.9
-
- -- Note: Expanded_Name is referenced by GDB to determine the actual name
- -- of the tagged type. Its requirements are: 1) it must have this exact
- -- name, and 2) its contents must point to a C-style Nul terminated
- -- string containing its expanded name. GDB has no requirement on a
- -- given position inside the record.
+ Alignment : Natural;
+ -- Alignment of the type
Transportable : Boolean;
-- Used to check RM E.4(18), set for types that satisfy the requirements
-- for being used in remote calls as actuals for classwide formals or as
-- return values for classwide functions.
+ Needs_Finalization : Boolean;
+ -- Used to dynamically check whether an object is controlled or not
+
Is_Abstract : Boolean;
-- True if the type is abstract (Ada 2012: AI05-0173)
- Needs_Finalization : Boolean;
- -- Used to dynamically check whether an object is controlled or not
+ Expanded_Name : Cstring_Ptr;
+ External_Tag : Cstring_Ptr;
+ HT_Link : Tag_Ptr;
+ -- Components used to support the Ada.Tags subprograms in RM 3.9
+
+ -- Note: Expanded_Name is referenced by GDB to determine the actual name
+ -- of the tagged type. Its requirements are: 1) it must have this exact
+ -- name, and 2) its contents must point to a C-style Nul terminated
+ -- string containing its expanded name. GDB has no requirement on a
+ -- given position inside the record.
Size_Func : Size_Ptr;
-- Pointer to the subprogram computing the _size of the object. Used by
--
2.53.0