summaryrefslogtreecommitdiffstats
path: root/gcc/ada/exp_ch6.ads
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2007-04-06 09:19:10 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2007-04-06 09:19:10 +0000
commit21ec6442052f5a2c9f387418cf82e808b8beb8ba (patch)
tree12ed0014102d78ce0433f132d50d7cdaeaa18628 /gcc/ada/exp_ch6.ads
parent92ad093e4ea3aea8784fc37dd83394ac0effcc2e (diff)
downloadppe42-gcc-21ec6442052f5a2c9f387418cf82e808b8beb8ba.tar.gz
ppe42-gcc-21ec6442052f5a2c9f387418cf82e808b8beb8ba.zip
2007-04-06 Robert Dewar <dewar@adacore.com>
Thomas Quinot <quinot@adacore.com> Ed Schonberg <schonberg@adacore.com> Bob Duff <duff@adacore.com> * einfo.ads, einfo.adb: (First_Component_Or_Discriminant): New function (Next_Component_Or_Discriminant): New function and procedure (First_Index, First_Literal, Master_Id, Set_First_Index, Set_First_Literal, Set_Master_Id): Add missing Ekind assertions. (Is_Access_Protected_Subprogram_Type): New predicate. (Has_RACW): New entity flag, set on package entities to indicate that the package contains the declaration of a remote accecss-to-classwide type. (E_Return_Statement): This node type has the Finalization_Chain_Entity attribute, in case the result type has controlled parts. (Requires_Overriding): Add this new flag, because "requires overriding" is subtly different from "is abstract" (see AI-228). (Is_Abstract): Split Is_Abstract flag into Is_Abstract_Subprogram and Is_Abstract_Type. Make sure these are called only when appropriate. (Has_Pragma_Unreferenced_Objects): New flag * exp_ch5.adb (Expand_N_Assignment_Statement): If the left-hand side is class-wide, the tag of the right-hand side must be an exact match, not an ancestor of that of the object on left-hand side. (Move_Activation_Chain): New procedure to create the call to System.Tasking.Stages.Move_Activation_Chain. (Expand_N_Extended_Return_Statement): Generate code to call System.Finalization_Implementation.Move_Final_List at the end of a return statement if the function's result type has controlled parts. Move asserts to Build_In_Place_Formal. (Move_Final_List): New function to create the call statement. (Expand_N_Assignment_Statement): In case of assignment to a class-wide tagged type, replace generation of call to the run-time subprogram CW_Membership by call to Build_CW_Membership. (Expand_N_Return_Statement): Replace generation of call to the run-time subprogram Get_Access_Level by call to Build_Get_Access_Level. (Expand_N_Simple_Function_Return): Replace generation of call to the run-time subprogram Get_Access_Level by call to Build_Get_Access_Level. * exp_ch6.ads, exp_ch6.adb (Expand_Call): Use new predicate Is_Access_Protected_Subprogram_Type, to handle both named and anonymous access to protected operations. (Add_Task_Actuals_To_Build_In_Place_Call): New procedure to add the master and chain actual parameters to a build-in-place function call involving tasks. (BIP_Formal_Suffix): Add new enumeration literals to complete the case statement. (Make_Build_In_Place_Call_In_Allocator, Make_Build_In_Place_Call_In_Anonymous_Context, Make_Build_In_Place_Call_In_Assignment, Make_Build_In_Place_Call_In_Object_Declaration): Call Add_Task_Actuals_To_Build_In_Place_Call with the appropriate master. (Expand_Inlined_Call): If the subprogram is a null procedure, or a stubbed procedure with a null body, replace the call with a null statement without using the full inlining machinery, for efficiency and to avoid invalid values in source file table entries. * exp_ch8.adb (Expand_N_Object_Renaming_Declaration): Add support for renamings of calls to build-in-place functions. * rtsfind.adb (RTE_Record_Component_Available): New subprogram that provides the functionality of RTE_Available to record components. (RTU_Entity): The function Entity has been renamed to RTU_Entity to avoid undesired overloading. (Entity): New subprogram that returns the entity for the referened unit. If this unit has not been loaded, it returns Empty. (RE_Activation_Chain_Access, RE_Move_Activation_Chain): New entities. Remove no longer used entities. (RE_Finalizable_Ptr_Ptr, RE_Move_Final_List): New entities. (RE_Type_Specific_Data): New entity. (RE_Move_Any_Value): New entity. (RE_TA_A, RE_Get_Any_Type): New entities. (RE_Access_Level, RE_Dispatch_Table, E_Default_Prim_Op_Count, RE_Prims_Ptr, RE_RC_Offset, RE_Remotely_Callable, RE_DT_Typeinfo_Ptr_Size, RE_Cstring_Ptr, RE_DT_Expanded_Name): Added. (Entity): New subprogram that returns the entity for the referened unit. If this unit has not been loaded, it returns Empty. (RTE): Addition of a new formal that extends the search to the scopes of the record types found in the chain of the package. * sem_ch6.ads, sem_ch6.adb (Check_Overriding_Indicator): Print "abstract subprograms must be visible" message, whether or not the type is an interface; that is, remove the special case for interface types. (Analyze_Function_Return): Remove error message "return of task objects is not yet implemented" because this is now implemented. (Create_Extra_Formals): Add the extra master and activation chain formals in case the result type has tasks. Remove error message "return of limited controlled objects is not yet implemented". (Create_Extra_Formals): Add the extra caller's finalization list formal in case the result type has controlled parts. (Process_Formals): In case of access formal types there is no need to continue with the analysis of the formals if we already notified errors. (Check_Overriding_Indicator): Add code to check overriding of predefined operators. (Create_Extra_Formals): Prevent creation of useless Extra_Constrained flags for formals that do not require them,. (Enter_Overloaded_Entity): Do not give -gnatwh warning message unless hidden entity is use visible or directly visible. (Analyze_Abstract_Subprogram_Declaration,Analyze_Subprogram_Body, Analyze_Subprogram_Declaration,Analyze_Subprogram_Specification, Check_Conventions,Check_Delayed_Subprogram,Make_Inequality_Operator, New_Overloaded_Entity): Split Is_Abstract flag into Is_Abstract_Subprogram and Is_Abstract_Type. * s-finimp.ads, s-finimp.adb (Move_Final_List): New procedure to move a return statement's finalization list to the caller's list, used for build-in-place functions with result type with controlled parts. Remove no longer used entities. * s-taskin.ads (Activation_Chain): Remove pragma Volatile. It is no longer needed, because the full type is now limited, and therefore a pass-by-reference type. (Foreign_Task_Level): New constant. * s-tassta.ads, s-tassta.adb (Move_Activation_Chain): New procedure to move tasks from the activation chain belonging to a return statement to the one passed in by the caller, and update the master to the one passed in by the caller. (Vulnerable_Complete_Master, Check_Unactivated_Tasks): Check the master of unactivated tasks, so we don't kill the ones that are being returned by a build-in-place function. (Create_Task): Ignore AI-280 for foreign threads. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@123558 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/exp_ch6.ads')
-rw-r--r--gcc/ada/exp_ch6.ads80
1 files changed, 71 insertions, 9 deletions
diff --git a/gcc/ada/exp_ch6.ads b/gcc/ada/exp_ch6.ads
index 219ce70abdb..436654c4c1b 100644
--- a/gcc/ada/exp_ch6.ads
+++ b/gcc/ada/exp_ch6.ads
@@ -40,21 +40,83 @@ package Exp_Ch6 is
-- This procedure contains common processing for Expand_N_Function_Call,
-- Expand_N_Procedure_Statement, and Expand_N_Entry_Call.
+ procedure Freeze_Subprogram (N : Node_Id);
+ -- generate the appropriate expansions related to Subprogram freeze
+ -- nodes (e. g. the filling of the corresponding Dispatch Table for
+ -- Primitive Operations)
+
+ -- The following type defines the various forms of allocation used for the
+ -- results of build-in-place function calls.
+
+ type BIP_Allocation_Form is
+ (Unspecified,
+ Caller_Allocation,
+ Secondary_Stack,
+ Global_Heap,
+ User_Storage_Pool);
+
+ type BIP_Formal_Kind is
+ -- Ada 2005 (AI-318-02): This type defines the kinds of implicit extra
+ -- formals created for build-in-place functions. The order of the above
+ -- enumeration literals matches the order in which the formals are
+ -- declared. See Sem_Ch6.Create_Extra_Formals.
+ (BIP_Alloc_Form,
+ -- Present if result subtype is unconstrained. Indicates whether the
+ -- return object is allocated by the caller or callee, and if the
+ -- callee, whether to use the secondary stack or the heap. See
+ -- Create_Extra_Formals.
+ BIP_Final_List,
+ -- Present if result type has controlled parts. Pointer to caller's
+ -- finalization list.
+ BIP_Master,
+ -- Present if result type contains tasks. Master associated with
+ -- calling context.
+ BIP_Activation_Chain,
+ -- Present if result type contains tasks. Caller's activation chain.
+ BIP_Object_Access);
+ -- Present for all build-in-place functions. Address at which to place
+ -- the return object, or null if BIP_Alloc_Form indicates
+ -- allocated by callee.
+ -- ??? We also need to be able to pass in some way to access a
+ -- user-defined storage pool at some point. And perhaps a constrained
+ -- flag.
+
+ function BIP_Formal_Suffix (Kind : BIP_Formal_Kind) return String;
+ -- Ada 2005 (AI-318-02): Returns a string to be used as the suffix of names
+ -- for build-in-place formal parameters of the given kind.
+
+ function Build_In_Place_Formal
+ (Func : Entity_Id;
+ Kind : BIP_Formal_Kind) return Entity_Id;
+ -- Ada 2005 (AI-318-02): Locates and returns the entity for the implicit
+ -- build-in-place formal parameter of the given kind associated with the
+ -- function Func, and returns its Entity_Id. It is a bug if not found; the
+ -- caller should ensure this is called only when the extra formal exists.
+
function Is_Build_In_Place_Function (E : Entity_Id) return Boolean;
- -- Ada 2005 (AI-318-02): Returns True if E denotes a function or an
- -- access-to-function type whose result must be built in place; otherwise
- -- returns False. Currently this is restricted to the subset of functions
- -- whose result subtype is a constrained inherently limited type.
+ -- Ada 2005 (AI-318-02): Returns True if E denotes a function, generic
+ -- function, or access-to-function type whose result must be built in
+ -- place; otherwise returns False. For Ada 2005, this is currently
+ -- restricted to the set of functions whose result subtype is an inherently
+ -- limited type. In Ada 95, this must be False for inherently limited
+ -- result types (but currently returns False for all Ada 95 functions).
+ -- Eventually we plan to support build-in-place for nonlimited types.
+ -- Build-in-place is usually more efficient for large things, and less
+ -- efficient for small things. However, we never use build-in-place if the
+ -- convention is other than Ada, because that would disturb mixed-language
+ -- programs. Note that for the non-inherently-limited cases, we must make
+ -- the same decision for Ada 95 and 2005, so that mixed-dialect programs
+ -- will work.
function Is_Build_In_Place_Function_Call (N : Node_Id) return Boolean;
-- Ada 2005 (AI-318-02): Returns True if N denotes a call to a function
-- that requires handling as a build-in-place call or is a qualified
-- expression applied to such a call; otherwise returns False.
- procedure Freeze_Subprogram (N : Node_Id);
- -- generate the appropriate expansions related to Subprogram freeze
- -- nodes (e. g. the filling of the corresponding Dispatch Table for
- -- Primitive Operations)
+ function Is_Build_In_Place_Function_Return (N : Node_Id) return Boolean;
+ -- Ada 2005 (AI-318-02): Returns True if N is an N_Return_Statement or
+ -- N_Extended_Return_Statement and it applies to a build-in-place function
+ -- or generic function.
procedure Make_Build_In_Place_Call_In_Allocator
(Allocator : Node_Id;
@@ -84,7 +146,7 @@ package Exp_Ch6 is
Function_Call : Node_Id);
-- Ada 2005 (AI-318-02): Handle a call to a build-in-place function that
-- occurs as the right-hand side of an assignment statement by passing
- -- access to the left-hand sid as an additional parameter of the function
+ -- access to the left-hand side as an additional parameter of the function
-- call. Assign must denote a N_Assignment_Statement. Function_Call must
-- denote either an N_Function_Call node for which Is_Build_In_Place_Call
-- is True, or an N_Qualified_Expression node applied to such a function
OpenPOWER on IntegriCloud