diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2024-01-23 12:54:52 +0100 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2024-05-13 10:03:30 +0200 |
commit | c8e01e79224ff2ebd2e488ecb4243874b6ff3d6b (patch) | |
tree | 8ef89fa213404d8ff608e07d2baf53868dfad0eb /gcc/ada/sem_ch6.adb | |
parent | eff0e268f4b1c4d8783f1da4e8a54028a3e28a1a (diff) | |
download | gcc-c8e01e79224ff2ebd2e488ecb4243874b6ff3d6b.zip gcc-c8e01e79224ff2ebd2e488ecb4243874b6ff3d6b.tar.gz gcc-c8e01e79224ff2ebd2e488ecb4243874b6ff3d6b.tar.bz2 |
ada: Replace finalization masters with finalization collections
This change replaces finalization masters with finalization collections in
most cases, that is to say, when they implement a list of objects created
by allocators of a given access type; indeed the moniker is overloaded in
the front-end, e.g. Sem_Util.Is_Master determines if a node "constitutes
a finalization master" but is not affected by the change.
This is mostly a renaming at this stage, toward something more in keeping
with the terminology used in the RM 7.6.1 clause and no functional changes:
although it gets rid of the rest of the System.Finalization_Masters unit,
the functionalities are reimplemented in the System.Finalization_Primitives
unit in terms of collections with only minor adjustments.
gcc/ada/
* Makefile.rtl (GNATRTL_NONTASKING_OBJS): Remove s-finmas$(objext).
* einfo.ads (Anonymous_Masters): Rename into Anonymous_Collections.
(Finalization_Master): Rename into Finalization_Collection.
* gen_il-fields.ads (Opt_Field_Enum): Replace Anonymous_Masters
with Anonymous_Collections; and Finalization_Master with
Finalization_Collection.
* gen_il-gen-gen_entities.adb (Access_Kind): Likewise.
(E_Function): Likewise.
(E_Procedure): Likewise.
(E_Package): Likewise.
(E_Subprogram_Body): Likewise.
* exp_ch3.adb (Build_Heap_Or_Pool_Allocator): Adjust to renamings.
(Freeze_Type): Likewise.
(Stream_Operation_OK): Remove obsolete test.
* exp_ch4.adb (Expand_Allocator_Expression): Adjust to renamings.
(Expand_N_Allocator): Likewise.
* exp_ch6.ads (BIP_Formal_Kind): Replace BIP_Finalization_Master
with BIP_Collection.
(Needs_BIP_Finalization_Master): Rename into...
(Needs_BIP_Collection): ...this.
* exp_ch6.adb (BIP_Finalization_Master_Suffix): Delete.
(BIP_Collection_Suffix): New constant string.
(Add_Finalization_Master_Actual_To_Build_In_Place_Call): Rename to
(Add_Collection_Actual_To_Build_In_Place_Call): ...this and adjust.
(BIP_Formal_Suffix): Replace BIP_Finalization_Master alternative
with BIP_Collection alternative.
(BIP_Suffix_Kind): Replace test on BIP_Finalization_Master_Suffix
with test on BIP_Collection_Suffix.
(Is_Build_In_Place_Entity): Likewise.
(Make_Build_In_Place_Call_In_Allocator): Call Needs_BIP_Collection
and Add_Collection_Actual_To_Build_In_Place_Call.
(Make_Build_In_Place_Call_In_Anonymous_Context): Likewise.
(Make_Build_In_Place_Call_In_Assignment): Likewise.
(Make_Build_In_Place_Call_In_Object_Declaration): Likewise.
(Needs_BIP_Finalization_Master): Rename into...
(Needs_BIP_Collection): ...this.
(Needs_BIP_Alloc_Form): Call Needs_BIP_Collection.
* exp_ch7.ads (Build_Anonymous_Master): Rename into...
(Build_Anonymous_Collection): ...this.
(Build_Finalization_Master): Rename into...
(Build_Finalization_Collection): ...this.
* exp_ch7.adb (Allows_Finalization_Master): Rename into...
(Allows_Finalization_Collection): ...this.
(Build_BIP_Cleanup_Stmts): Adjust to renamings.
(Build_Anonymous_Master): Rename into...
(Build_Anonymous_Collection): ...this. Adjust to renamings.
(Build_Finalization_Master): Rename into...
(Build_Finalization_Collection): ...this. Adjust to renamings.
(Build_Finalizer): Adjust comment to renamings.
* exp_ch13.adb (Expand_N_Free_Statement): Adjust to renamings.
* exp_util.adb (Build_Allocate_Deallocate_Proc): Likewise.
(Requires_Cleanup_Actions): Adjust comment to renamings.
* freeze.adb (Freeze_All): Likewise.
* rtsfind.ads (RTU_Id): Remove System_Finalization_Masters.
(RE_Id): Remove RE_Finalization_Master & RE_Finalization_Master_Ptr
add RE_Finalization_Collection & RE_Finalization_Collection_Ptr.
Adjust RE_Add_Offset_To_Address and RE_Finalization_Scope_Master.
(RE_Unit_Table): Remove entries for RE_Finalization_Master &
RE_Finalization_Master_Ptr, add ones for RE_Finalization_Collection
& RE_Finalization_Collection_Ptr. Also adjust those of
RE_Add_Offset_To_Address and RE_Finalization_Scope_Master.
* sem_ch3.adb (Access_Type_Declaration): Adjust to renamings.
* sem_ch6.adb (Create_Extra_Formals): Likewise.
* sem_util.adb (Designated_Subtype_Mark): Likewise.
* libgnat/s-finpri.ads: Add clauses for Ada.Finalization and
System.Storage_Elements.
(Finalization_Collection): New limited controlled type.
(Finalization_Collection_Ptr): Likewise.
(Initialize): New overriding procedure.
(Finalize): Likewise.
(Finalization_Started): Likewise.
(Collection_Node): New type.
(Collection_Node_Ptr): Likewise.
(Attach_Node_To_Collection): New procedure.
(Detach_Node_From_Collection): Likewise.
(Header_Size): New function.
(Add_Offset_To_Address): Likewise.
* libgnat/s-finpri.adb (Add_Offset_To_Address): New function.
(Attach_Node_To_Collection): New procedure.
(Detach_Node_From_Collection): Likewise.
(Finalization_Started): Likewise.
(Finalize): New overriding procedure.
(Header_Size): New function.
(Initialize): New overriding procedure.
* libgnat/s-spsufi.ads (Finalize_And_Deallocate): Adjust comment.
* libgnat/s-spsufi.adb: Remove clause for Finalization_Masters and
add clause for Finalization_Primitives.
(Finalize_And_Deallocate): Finalize the Collection component.
* libgnat/s-stposu.ads: Remove clause for Finalization_Masters and
add clause for Finalization_Primitives.
(Root_Subpool): Replace Master component with Collection.
(Allocate_Any_Controlled): Replace Context_Master parameter with
Context_Collection parameter.
* libgnat/s-stposu.adb: Remove clauses for Finalization_Masters and
add clauses for Finalization_Primitives.
(Address_To_FM_Node_Ptr): Delete.
(To_Collection_Node_Ptr): New instance of Ada.Unchecked_Conversion.
(Adjust_Controlled_Dereference): Adjust comment to renamings.
(Allocate_Any_Controlled): Replace Context_Master parameter with
Context_Collection parameter. Adjust to renamings.
(Deallocate_Any_Controlled): Adjust to renamings.
(Print_Subpool): Likewise.
* libgnat/s-finmas.ads: Delete.
* libgnat/s-finmas.adb: Likewise.
Diffstat (limited to 'gcc/ada/sem_ch6.adb')
-rw-r--r-- | gcc/ada/sem_ch6.adb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index fb43b04..446a0b8 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -9302,24 +9302,24 @@ package body Sem_Ch6 is end if; -- In the case of functions whose result type needs finalization, - -- add an extra formal which represents the finalization master. + -- add an extra formal which represents the caller's collection. - if Needs_BIP_Finalization_Master (Ref_E) + if Needs_BIP_Collection (Ref_E) or else (Present (Parent_Subp) and then Has_BIP_Extra_Formal (Parent_Subp, - Kind => BIP_Finalization_Master, + Kind => BIP_Collection, Must_Be_Frozen => False)) or else (Present (Alias_Subp) and then Has_BIP_Extra_Formal (Alias_Subp, - Kind => BIP_Finalization_Master, + Kind => BIP_Collection, Must_Be_Frozen => False)) then Discard := Add_Extra_Formal - (E, RTE (RE_Finalization_Master_Ptr), - E, BIP_Formal_Suffix (BIP_Finalization_Master)); + (E, RTE (RE_Finalization_Collection_Ptr), + E, BIP_Formal_Suffix (BIP_Collection)); end if; -- When the result type contains tasks, add two extra formals: the |