Commit 8417f4b2 by Arnaud Charlet

[multiple changes]

2011-10-13  Fedor Rybin  <frybin@adacore.com>

	* gnat_ugn.texi: Add gnattest section.

2011-10-13  Ed Schonberg  <schonberg@adacore.com>

	* freeze.adb: Do not create body of renaming if declaration has
	errors.

2011-10-13  Olivier Hainque  <hainque@adacore.com>

	* init.c (__gnat_error_handler - vxworks case): Restrict sigtramp calls
	further, to the ppc+kernel case only.

2011-10-13  Hristian Kirtchev  <kirtchev@adacore.com>

	* exp_ch4.adb (Expand_N_Allocator): Comment reformatting.
	* exp_ch6.adb (Add_Unconstrained_Actuals_To_Build_In_Place_Call):
	Do not create a pool formal on .NET/JVM.
	(Expand_N_Extended_Return_Statement): Alphabetize local
	variables. Do not create a renaming of the build-in-place pool
	parameter on .NET/JVM.	(Make_Build_In_Place_Call_In_Allocator):
	Add the user-defined pool only on non-VM targets.
	(Make_Build_In_Place_Call_In_Object_Declaration): Alphabetize
	local variables.  Do not add a pool actual on .NET/JVM.
	* sem_ch6.adb: Add with and use clause for Targparm.
	(Create_Extra_Formals): Add build-in-place pool formal only on
	non-VM targets.
	* rtsfind.ads: Alphabetize entries.

From-SVN: r179906
parent 4674dd21
2011-10-13 Fedor Rybin <frybin@adacore.com>
* gnat_ugn.texi: Add gnattest section.
2011-10-13 Ed Schonberg <schonberg@adacore.com>
* freeze.adb: Do not create body of renaming if declaration has
errors.
2011-10-13 Olivier Hainque <hainque@adacore.com>
* init.c (__gnat_error_handler - vxworks case): Restrict sigtramp calls
further, to the ppc+kernel case only.
2011-10-13 Hristian Kirtchev <kirtchev@adacore.com>
* exp_ch4.adb (Expand_N_Allocator): Comment reformatting.
* exp_ch6.adb (Add_Unconstrained_Actuals_To_Build_In_Place_Call):
Do not create a pool formal on .NET/JVM.
(Expand_N_Extended_Return_Statement): Alphabetize local
variables. Do not create a renaming of the build-in-place pool
parameter on .NET/JVM. (Make_Build_In_Place_Call_In_Allocator):
Add the user-defined pool only on non-VM targets.
(Make_Build_In_Place_Call_In_Object_Declaration): Alphabetize
local variables. Do not add a pool actual on .NET/JVM.
* sem_ch6.adb: Add with and use clause for Targparm.
(Create_Extra_Formals): Add build-in-place pool formal only on
non-VM targets.
* rtsfind.ads: Alphabetize entries.
2011-10-13 Sergey Rybin <rybin@adacore.com>
* gnat_ugn.texi: Minor correction.
......
......@@ -3526,8 +3526,8 @@ package body Exp_Ch4 is
end if;
-- Set the storage pool and find the appropriate version of Allocate to
-- call. But don't overwrite the storage pool if it is already set,
-- which can happen for build-in-place function returns (see
-- call. Do not overwrite the storage pool if it is already set, which
-- can happen for build-in-place function returns (see
-- Exp_Ch4.Expand_N_Extended_Return_Statement).
if No (Storage_Pool (N)) then
......
......@@ -311,13 +311,15 @@ package body Exp_Ch6 is
Add_Extra_Actual_To_Call
(Function_Call, Alloc_Form_Formal, Alloc_Form_Actual);
-- Pass the Storage_Pool parameter
Pool_Formal := Build_In_Place_Formal (Function_Id, BIP_Storage_Pool);
Analyze_And_Resolve (Pool_Actual, Etype (Pool_Formal));
Add_Extra_Actual_To_Call
(Function_Call, Pool_Formal, Pool_Actual);
-- Pass the Storage_Pool parameter. This parameter is omitted on .NET
-- and JVM as those targets do not support pools.
if VM_Target = No_VM then
Pool_Formal := Build_In_Place_Formal (Function_Id, BIP_Storage_Pool);
Analyze_And_Resolve (Pool_Actual, Etype (Pool_Formal));
Add_Extra_Actual_To_Call
(Function_Call, Pool_Formal, Pool_Actual);
end if;
end Add_Unconstrained_Actuals_To_Build_In_Place_Call;
-----------------------------------------------------------
......@@ -5132,17 +5134,17 @@ package body Exp_Ch6 is
Build_In_Place_Formal (Par_Func, BIP_Alloc_Form);
declare
Ref_Type : Entity_Id;
Ptr_Type_Decl : Node_Id;
Pool_Id : constant Entity_Id :=
Make_Temporary (Loc, 'P');
Alloc_Obj_Id : Entity_Id;
Alloc_Obj_Decl : Node_Id;
Alloc_If_Stmt : Node_Id;
SS_Allocator : Node_Id;
Heap_Allocator : Node_Id;
Pool_Decl : Node_Id;
Pool_Allocator : Node_Id;
Pool_Id : constant Entity_Id := Make_Temporary (Loc, 'P');
Ptr_Type_Decl : Node_Id;
Ref_Type : Entity_Id;
SS_Allocator : Node_Id;
begin
-- Reuse the itype created for the function's implicit
......@@ -5237,23 +5239,33 @@ package body Exp_Ch6 is
end if;
-- The Pool_Allocator is just like the Heap_Allocator,
-- except we set Storage_Pool and Procedure_To_Call so it
-- will use the user-defined storage pool.
-- except we set Storage_Pool and Procedure_To_Call so
-- it will use the user-defined storage pool.
Pool_Allocator := New_Copy_Tree (Heap_Allocator);
Pool_Decl :=
Make_Object_Renaming_Declaration (Loc,
Defining_Identifier => Pool_Id,
Subtype_Mark =>
New_Reference_To (RTE (RE_Root_Storage_Pool), Loc),
Name =>
Make_Explicit_Dereference (Loc,
New_Reference_To
(Build_In_Place_Formal
(Par_Func, BIP_Storage_Pool), Loc)));
Set_Storage_Pool (Pool_Allocator, Pool_Id);
Set_Procedure_To_Call
(Pool_Allocator, RTE (RE_Allocate_Any));
-- Do not generate the renaming of the build-in-place
-- pool parameter on .NET/JVM because the parameter is
-- not created in the first place.
if VM_Target = No_VM then
Pool_Decl :=
Make_Object_Renaming_Declaration (Loc,
Defining_Identifier => Pool_Id,
Subtype_Mark =>
New_Reference_To
(RTE (RE_Root_Storage_Pool), Loc),
Name =>
Make_Explicit_Dereference (Loc,
New_Reference_To
(Build_In_Place_Formal
(Par_Func, BIP_Storage_Pool), Loc)));
Set_Storage_Pool (Pool_Allocator, Pool_Id);
Set_Procedure_To_Call
(Pool_Allocator, RTE (RE_Allocate_Any));
else
Pool_Decl := Make_Null_Statement (Loc);
end if;
-- If the No_Allocators restriction is active, then only
-- an allocator for secondary stack allocation is needed.
......@@ -7686,20 +7698,14 @@ package body Exp_Ch6 is
-- operations. ???
else
-- No user-defined pool; pass an allocation parameter indicating that
-- the function should allocate its result on the heap.
if No (Associated_Storage_Pool (Acc_Type)) then
Add_Unconstrained_Actuals_To_Build_In_Place_Call
(Func_Call, Function_Id, Alloc_Form => Global_Heap);
-- User-defined pool; pass an allocation parameter indicating that
-- the function should allocate its result in the pool, and pass the
-- pool. We need 'Unrestricted_Access here, because 'Access is
-- illegal, because the storage pool is not aliased.
-- Case of a user-defined storage pool. Pass an allocation parameter
-- indicating that the function should allocate its result in the
-- pool, and pass the pool. Use 'Unrestricted_Access because the
-- pool may not be aliased.
else
if VM_Target = No_VM
and then Present (Associated_Storage_Pool (Acc_Type))
then
Add_Unconstrained_Actuals_To_Build_In_Place_Call
(Func_Call, Function_Id, Alloc_Form => User_Storage_Pool,
Pool_Actual =>
......@@ -7708,6 +7714,13 @@ package body Exp_Ch6 is
New_Reference_To
(Associated_Storage_Pool (Acc_Type), Loc),
Attribute_Name => Name_Unrestricted_Access));
-- No user-defined pool; pass an allocation parameter indicating that
-- the function should allocate its result on the heap.
else
Add_Unconstrained_Actuals_To_Build_In_Place_Call
(Func_Call, Function_Id, Alloc_Form => Global_Heap);
end if;
Add_Finalization_Master_Actual_To_Build_In_Place_Call
......@@ -8059,20 +8072,20 @@ package body Exp_Ch6 is
Loc : Source_Ptr;
Obj_Def_Id : constant Entity_Id :=
Defining_Identifier (Object_Decl);
Func_Call : Node_Id := Function_Call;
Function_Id : Entity_Id;
Result_Subt : Entity_Id;
Caller_Object : Node_Id;
Call_Deref : Node_Id;
Ref_Type : Entity_Id;
Ptr_Typ_Decl : Node_Id;
Def_Id : Entity_Id;
New_Expr : Node_Id;
Enclosing_Func : constant Entity_Id :=
Enclosing_Subprogram (Obj_Def_Id);
Call_Deref : Node_Id;
Caller_Object : Node_Id;
Def_Id : Entity_Id;
Fmaster_Actual : Node_Id := Empty;
Func_Call : Node_Id := Function_Call;
Function_Id : Entity_Id;
Pool_Actual : Node_Id;
Ptr_Typ_Decl : Node_Id;
Pass_Caller_Acc : Boolean := False;
New_Expr : Node_Id;
Ref_Type : Entity_Id;
Result_Subt : Entity_Id;
begin
-- Step past qualification or unchecked conversion (the latter can occur
......@@ -8128,6 +8141,17 @@ package body Exp_Ch6 is
-- has an unconstrained or tagged result type).
if Needs_BIP_Alloc_Form (Enclosing_Func) then
if VM_Target = No_VM then
Pool_Actual :=
New_Reference_To (Build_In_Place_Formal
(Enclosing_Func, BIP_Storage_Pool), Loc);
-- The build-in-place pool formal is not built on .NET/JVM
else
Pool_Actual := Empty;
end if;
Add_Unconstrained_Actuals_To_Build_In_Place_Call
(Func_Call,
Function_Id,
......@@ -8135,10 +8159,7 @@ package body Exp_Ch6 is
New_Reference_To
(Build_In_Place_Formal (Enclosing_Func, BIP_Alloc_Form),
Loc),
Pool_Actual =>
New_Reference_To
(Build_In_Place_Formal (Enclosing_Func, BIP_Storage_Pool),
Loc));
Pool_Actual => Pool_Actual);
-- Otherwise, if enclosing function has a constrained result subtype,
-- then caller allocation will be used.
......
......@@ -1407,7 +1407,12 @@ package body Freeze is
Decl := Unit_Declaration_Node (E);
if Nkind (Decl) = N_Subprogram_Renaming_Declaration then
Build_And_Analyze_Renamed_Body (Decl, E, After);
if Error_Posted (Decl) then
Set_Has_Completion (E);
else
Build_And_Analyze_Renamed_Body (Decl, E, After);
end if;
elsif Nkind (Decl) = N_Subprogram_Declaration
and then Present (Corresponding_Body (Decl))
......
......@@ -2014,13 +2014,13 @@ __gnat_error_handler (int sig, void *si, struct sigcontext *sc)
sigdelset (&mask, sig);
sigprocmask (SIG_SETMASK, &mask, NULL);
#if defined (__PPC__)
/* On PowerPC, we process signals through a Call Frame Info trampoline,
voiding the need for myriads of fallback_frame_state variants in the
ZCX runtime. We have no simple way to distinguish ZCX from SJLJ here,
so we do this for SJLJ as well even though this is not necessary.
This only incurs a few extra instructions and a tiny amount of extra
stack usage. */
#if defined (__PPC__) && defined(_WRS_KERNEL)
/* On PowerPC, kernel mode, we process signals through a Call Frame Info
trampoline, voiding the need for myriads of fallback_frame_state
variants in the ZCX runtime. We have no simple way to distinguish ZCX
from SJLJ here, so we do this for SJLJ as well even though this is not
necessary. This only incurs a few extra instructions and a tiny
amount of extra stack usage. */
#include "sigtramp.h"
......
......@@ -1346,10 +1346,10 @@ package Rtsfind is
RE_Storage_Offset, -- System.Storage_Elements
RE_To_Address, -- System.Storage_Elements
RE_Root_Storage_Pool_Ptr, -- System.Storage_Pools
RE_Allocate_Any, -- System.Storage_Pools
RE_Deallocate_Any, -- System.Storage_Pools
RE_Root_Storage_Pool, -- System.Storage_Pools
RE_Root_Storage_Pool_Ptr, -- System.Storage_Pools
RE_Allocate_Any_Controlled, -- System.Storage_Pools.Subpools
RE_Deallocate_Any_Controlled, -- System.Storage_Pools.Subpools
......@@ -2543,10 +2543,10 @@ package Rtsfind is
RE_Storage_Offset => System_Storage_Elements,
RE_To_Address => System_Storage_Elements,
RE_Root_Storage_Pool_Ptr => System_Storage_Pools,
RE_Allocate_Any => System_Storage_Pools,
RE_Deallocate_Any => System_Storage_Pools,
RE_Root_Storage_Pool => System_Storage_Pools,
RE_Root_Storage_Pool_Ptr => System_Storage_Pools,
RE_Allocate_Any_Controlled => System_Storage_Pools_Subpools,
RE_Deallocate_Any_Controlled => System_Storage_Pools_Subpools,
......
......@@ -78,6 +78,7 @@ with Snames; use Snames;
with Stringt; use Stringt;
with Style;
with Stylesw; use Stylesw;
with Targparm; use Targparm;
with Tbuild; use Tbuild;
with Uintp; use Uintp;
with Urealp; use Urealp;
......@@ -6483,14 +6484,16 @@ package body Sem_Ch6 is
(E, Standard_Natural,
E, BIP_Formal_Suffix (BIP_Alloc_Form));
-- Whenever we need BIP_Alloc_Form, we also need
-- BIP_Storage_Pool, in case BIP_Alloc_Form indicates to use a
-- user-defined pool.
-- Add BIP_Storage_Pool, in case BIP_Alloc_Form indicates to
-- use a user-defined pool. This formal is not added on .NET
-- and JVM as those targets do not support pools.
Discard :=
Add_Extra_Formal
(E, RTE (RE_Root_Storage_Pool_Ptr),
E, BIP_Formal_Suffix (BIP_Storage_Pool));
if VM_Target = No_VM then
Discard :=
Add_Extra_Formal
(E, RTE (RE_Root_Storage_Pool_Ptr),
E, BIP_Formal_Suffix (BIP_Storage_Pool));
end if;
end if;
-- In the case of functions whose result type needs finalization,
......
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