Commit 6b81741c by Arnaud Charlet

[multiple changes]

2011-09-01  Jose Ruiz  <ruiz@adacore.com>

	* s-taprop-linux.adb (Create_Task, Set_Task_Affinity): Use the linux
	macros for handling CPU sets (CPU_ZERO, CPU_SET) instead of modifying
	directly the bit array.
	* s-osinte-linux.ads (CPU_ZERO, CPU_SET): Import these wrappers around
	the linux macros with the same name.
	* adaint.h, adaint.c (__gnat_cpu_zero, __gnat_cpu_set): Create these
	wrappers around the CPU_ZERO and CPU_SET linux macros.

2011-09-01  Hristian Kirtchev  <kirtchev@adacore.com>

	* exp_ch7.adb (Find_Insertion_List): Removed.
	(Process_Transient_Objects): Insert the declarations of the hook
	access type and the hook object before the associated transient object.

2011-09-01  Jose Ruiz  <ruiz@adacore.com>

	* sem_ch8.adb (Attribute_Renaming): Add missing check to avoid loading
	package System.Aux_Dec when using restricted run-time libraries which
	do not have this package.

2011-09-01  Tristan Gingold  <gingold@adacore.com>

	* s-vaflop-vms-alpha.adb: Remove pragma optimize, useless.

2011-09-01  Bob Duff  <duff@adacore.com>

	* sem_attr.adb (Analyze_Access_Attribute): Do not call
	Kill_Current_Values for P'Unrestricted_Access, where P is library level

2011-09-01  Thomas Quinot  <quinot@adacore.com>

	* exp_ch5.adb: Minor reformatting
	* gnat_ugn.texi: Fix minor typos.
	* gcc-interface/Make-lang.in: Update dependencies.

From-SVN: r178414
parent 8256c1bf
2011-09-01 Jose Ruiz <ruiz@adacore.com>
* s-taprop-linux.adb (Create_Task, Set_Task_Affinity): Use the linux
macros for handling CPU sets (CPU_ZERO, CPU_SET) instead of modifying
directly the bit array.
* s-osinte-linux.ads (CPU_ZERO, CPU_SET): Import these wrappers around
the linux macros with the same name.
* adaint.h, adaint.c (__gnat_cpu_zero, __gnat_cpu_set): Create these
wrappers around the CPU_ZERO and CPU_SET linux macros.
2011-09-01 Hristian Kirtchev <kirtchev@adacore.com>
* exp_ch7.adb (Find_Insertion_List): Removed.
(Process_Transient_Objects): Insert the declarations of the hook
access type and the hook object before the associated transient object.
2011-09-01 Jose Ruiz <ruiz@adacore.com>
* sem_ch8.adb (Attribute_Renaming): Add missing check to avoid loading
package System.Aux_Dec when using restricted run-time libraries which
do not have this package.
2011-09-01 Tristan Gingold <gingold@adacore.com>
* s-vaflop-vms-alpha.adb: Remove pragma optimize, useless.
2011-09-01 Bob Duff <duff@adacore.com>
* sem_attr.adb (Analyze_Access_Attribute): Do not call
Kill_Current_Values for P'Unrestricted_Access, where P is library level
2011-09-01 Thomas Quinot <quinot@adacore.com>
* exp_ch5.adb: Minor reformatting
* gnat_ugn.texi: Fix minor typos.
* gcc-interface/Make-lang.in: Update dependencies.
2011-09-01 Robert Dewar <dewar@adacore.com> 2011-09-01 Robert Dewar <dewar@adacore.com>
* inline.adb, sem_aggr.adb: Minor reformatting. * inline.adb, sem_aggr.adb: Minor reformatting.
......
...@@ -3770,6 +3770,20 @@ void *__gnat_lwp_self (void) ...@@ -3770,6 +3770,20 @@ void *__gnat_lwp_self (void)
{ {
return (void *) syscall (__NR_gettid); return (void *) syscall (__NR_gettid);
} }
#include <sched.h>
void __gnat_cpu_zero (cpu_set_t *set)
{
CPU_ZERO (set);
}
void __gnat_cpu_set (int cpu, cpu_set_t *set)
{
/* Ada handles CPU numbers starting from 1, while C identifies the first
CPU by a 0, so we need to adjust. */
CPU_SET (cpu - 1, set);
}
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
......
...@@ -247,6 +247,13 @@ extern void __gnat_os_filename (char *, char *, char *, ...@@ -247,6 +247,13 @@ extern void __gnat_os_filename (char *, char *, char *,
int *, char *, int *); int *, char *, int *);
#if defined (linux) #if defined (linux)
extern void *__gnat_lwp_self (void); extern void *__gnat_lwp_self (void);
/* Routines for interface to required CPU set primitives */
#include <sched.h>
extern void __gnat_cpu_zero (cpu_set_t *);
extern void __gnat_cpu_set (int, cpu_set_t *);
#endif #endif
#if defined (_WIN32) #if defined (_WIN32)
......
...@@ -62,17 +62,17 @@ with Validsw; use Validsw; ...@@ -62,17 +62,17 @@ with Validsw; use Validsw;
package body Exp_Ch5 is package body Exp_Ch5 is
function Change_Of_Representation (N : Node_Id) return Boolean; function Change_Of_Representation (N : Node_Id) return Boolean;
-- Determine if the right hand side of the assignment N is a type -- Determine if the right hand side of assignment N is a type conversion
-- conversion which requires a change of representation. Called -- which requires a change of representation. Called only for the array
-- only for the array and record cases. -- and record cases.
procedure Expand_Assign_Array (N : Node_Id; Rhs : Node_Id); procedure Expand_Assign_Array (N : Node_Id; Rhs : Node_Id);
-- N is an assignment which assigns an array value. This routine process -- N is an assignment which assigns an array value. This routine process
-- the various special cases and checks required for such assignments, -- the various special cases and checks required for such assignments,
-- including change of representation. Rhs is normally simply the right -- including change of representation. Rhs is normally simply the right
-- hand side of the assignment, except that if the right hand side is -- hand side of the assignment, except that if the right hand side is a
-- a type conversion or a qualified expression, then the Rhs is the -- type conversion or a qualified expression, then the RHS is the actual
-- actual expression inside any such type conversions or qualifications. -- expression inside any such type conversions or qualifications.
function Expand_Assign_Array_Loop function Expand_Assign_Array_Loop
(N : Node_Id; (N : Node_Id;
...@@ -3026,21 +3026,16 @@ package body Exp_Ch5 is ...@@ -3026,21 +3026,16 @@ package body Exp_Ch5 is
-- If the container type is a derived type, the cursor type is -- If the container type is a derived type, the cursor type is
-- found in the package of the parent type. -- found in the package of the parent type.
if Is_Derived_Type (Container_Typ) then
Pack := Scope (Root_Type (Container_Typ));
else
Pack := Scope (Container_Typ);
end if;
Iter_Type := Etype (Name (I_Spec)); Iter_Type := Etype (Name (I_Spec));
if Is_Iterator (Iter_Type) then if Is_Iterator (Iter_Type) then
if Is_Derived_Type (Container_Typ) then Pack := Scope (Pack);
Pack := Scope (Scope (Root_Type (Container_Typ)));
else
Pack := Scope (Scope (Container_Typ));
end if;
else
if Is_Derived_Type (Container_Typ) then
Pack := Scope (Root_Type (Container_Typ));
else
Pack := Scope (Container_Typ);
end if;
end if; end if;
-- The "of" case uses an internally generated cursor whose type -- The "of" case uses an internally generated cursor whose type
......
...@@ -4198,32 +4198,6 @@ package body Exp_Ch7 is ...@@ -4198,32 +4198,6 @@ package body Exp_Ch7 is
Last_Object : Node_Id; Last_Object : Node_Id;
Related_Node : Node_Id) Related_Node : Node_Id)
is is
function Find_Insertion_List return List_Id;
-- Return the statement list of the enclosing sequence of statements
-------------------------
-- Find_Insertion_List --
-------------------------
function Find_Insertion_List return List_Id is
Par : Node_Id;
begin
-- Climb up the tree looking for the enclosing sequence of
-- statements.
Par := N;
while Present (Par)
and then Nkind (Par) /= N_Handled_Sequence_Of_Statements
loop
Par := Parent (Par);
end loop;
return Statements (Par);
end Find_Insertion_List;
-- Local variables
Requires_Hooking : constant Boolean := Requires_Hooking : constant Boolean :=
Nkind_In (N, N_Function_Call, Nkind_In (N, N_Function_Call,
N_Procedure_Call_Statement); N_Procedure_Call_Statement);
...@@ -4242,8 +4216,6 @@ package body Exp_Ch7 is ...@@ -4242,8 +4216,6 @@ package body Exp_Ch7 is
Stmts : List_Id; Stmts : List_Id;
Temp_Id : Entity_Id; Temp_Id : Entity_Id;
-- Start of processing for Process_Transient_Objects
begin begin
-- Examine all objects in the list First_Object .. Last_Object -- Examine all objects in the list First_Object .. Last_Object
...@@ -4296,11 +4268,8 @@ package body Exp_Ch7 is ...@@ -4296,11 +4268,8 @@ package body Exp_Ch7 is
if Requires_Hooking then if Requires_Hooking then
declare declare
Ins_List : constant List_Id := Find_Insertion_List; Expr : Node_Id;
Expr : Node_Id; Ptr_Id : Entity_Id;
Ptr_Decl : Node_Id;
Ptr_Id : Entity_Id;
Temp_Decl : Node_Id;
begin begin
-- Step 1: Create an access type which provides a -- Step 1: Create an access type which provides a
...@@ -4310,7 +4279,7 @@ package body Exp_Ch7 is ...@@ -4310,7 +4279,7 @@ package body Exp_Ch7 is
Ptr_Id := Make_Temporary (Loc, 'A'); Ptr_Id := Make_Temporary (Loc, 'A');
Ptr_Decl := Insert_Action (Stmt,
Make_Full_Type_Declaration (Loc, Make_Full_Type_Declaration (Loc,
Defining_Identifier => Ptr_Id, Defining_Identifier => Ptr_Id,
Type_Definition => Type_Definition =>
...@@ -4318,7 +4287,7 @@ package body Exp_Ch7 is ...@@ -4318,7 +4287,7 @@ package body Exp_Ch7 is
All_Present => All_Present =>
Ekind (Obj_Typ) = E_General_Access_Type, Ekind (Obj_Typ) = E_General_Access_Type,
Subtype_Indication => Subtype_Indication =>
New_Reference_To (Desig_Typ, Loc))); New_Reference_To (Desig_Typ, Loc))));
-- Step 2: Create a temporary which acts as a hook to -- Step 2: Create a temporary which acts as a hook to
-- the transient object. Generate: -- the transient object. Generate:
...@@ -4327,19 +4296,11 @@ package body Exp_Ch7 is ...@@ -4327,19 +4296,11 @@ package body Exp_Ch7 is
Temp_Id := Make_Temporary (Loc, 'T'); Temp_Id := Make_Temporary (Loc, 'T');
Temp_Decl := Insert_Action (Stmt,
Make_Object_Declaration (Loc, Make_Object_Declaration (Loc,
Defining_Identifier => Temp_Id, Defining_Identifier => Temp_Id,
Object_Definition => Object_Definition =>
New_Reference_To (Ptr_Id, Loc)); New_Reference_To (Ptr_Id, Loc)));
-- Analyze the access type and the hook declarations
Prepend_To (Ins_List, Temp_Decl);
Prepend_To (Ins_List, Ptr_Decl);
Analyze (Ptr_Decl);
Analyze (Temp_Decl);
-- Mark the temporary as a transient hook. This signals -- Mark the temporary as a transient hook. This signals
-- the machinery in Build_Finalizer to recognize this -- the machinery in Build_Finalizer to recognize this
......
...@@ -5732,7 +5732,7 @@ as shown in the following example. ...@@ -5732,7 +5732,7 @@ as shown in the following example.
@emph{Activate warnings on unnecessary Warnings Off pragmas} @emph{Activate warnings on unnecessary Warnings Off pragmas}
@cindex @option{-gnatw.w} (@command{gcc}) @cindex @option{-gnatw.w} (@command{gcc})
@cindex Warnings Off control @cindex Warnings Off control
This switch activates warnings for use of @code{pragma Warnings (Off, entity} This switch activates warnings for use of @code{pragma Warnings (Off, entity)}
where either the pragma is entirely useless (because it suppresses no where either the pragma is entirely useless (because it suppresses no
warnings), or it could be replaced by @code{pragma Unreferenced} or warnings), or it could be replaced by @code{pragma Unreferenced} or
@code{pragma Unmodified}.The default is that these warnings are not given. @code{pragma Unmodified}.The default is that these warnings are not given.
...@@ -5742,7 +5742,7 @@ activated explicitly. ...@@ -5742,7 +5742,7 @@ activated explicitly.
@item -gnatw.W @item -gnatw.W
@emph{Suppress warnings on unnecessary Warnings Off pragmas} @emph{Suppress warnings on unnecessary Warnings Off pragmas}
@cindex @option{-gnatw.W} (@command{gcc}) @cindex @option{-gnatw.W} (@command{gcc})
This switch suppresses warnings for use of @code{pragma Warnings (Off, entity}. This switch suppresses warnings for use of @code{pragma Warnings (Off, entity)}.
@item -gnatwx @item -gnatwx
@emph{Activate warnings on Export/Import pragmas.} @emph{Activate warnings on Export/Import pragmas.}
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1991-1994, Florida State University -- -- Copyright (C) 1991-1994, Florida State University --
-- Copyright (C) 1995-2010, Free Software Foundation, Inc. -- -- Copyright (C) 1995-2011, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -482,6 +482,14 @@ package System.OS_Interface is ...@@ -482,6 +482,14 @@ package System.OS_Interface is
end record; end record;
pragma Convention (C, cpu_set_t); pragma Convention (C, cpu_set_t);
procedure CPU_ZERO (cpuset : access cpu_set_t);
pragma Import (C, CPU_ZERO, "__gnat_cpu_zero");
-- Wrapper around the CPU_ZERO C macro
procedure CPU_SET (cpu : int; cpuset : access cpu_set_t);
pragma Import (C, CPU_SET, "__gnat_cpu_set");
-- Wrapper around the CPU_SET C macro
function pthread_setaffinity_np function pthread_setaffinity_np
(thread : pthread_t; (thread : pthread_t;
cpusetsize : size_t; cpusetsize : size_t;
......
...@@ -869,9 +869,12 @@ package body System.Task_Primitives.Operations is ...@@ -869,9 +869,12 @@ package body System.Task_Primitives.Operations is
elsif T.Common.Base_CPU /= System.Multiprocessors.Not_A_Specific_CPU then elsif T.Common.Base_CPU /= System.Multiprocessors.Not_A_Specific_CPU then
declare declare
CPU_Set : aliased cpu_set_t := (bits => (others => False)); CPU_Set : aliased cpu_set_t;
begin begin
CPU_Set.bits (Integer (T.Common.Base_CPU)) := True; System.OS_Interface.CPU_ZERO (CPU_Set'Access);
System.OS_Interface.CPU_SET
(int (T.Common.Base_CPU), CPU_Set'Access);
Result := Result :=
pthread_attr_setaffinity_np pthread_attr_setaffinity_np
(Attributes'Access, (Attributes'Access,
...@@ -905,14 +908,18 @@ package body System.Task_Primitives.Operations is ...@@ -905,14 +908,18 @@ package body System.Task_Primitives.Operations is
Multiprocessors.Number_Of_CPUs => True)) Multiprocessors.Number_Of_CPUs => True))
then then
declare declare
CPU_Set : aliased cpu_set_t := (bits => (others => False)); CPU_Set : aliased cpu_set_t;
begin begin
System.OS_Interface.CPU_ZERO (CPU_Set'Access);
-- Set the affinity to all the processors belonging to the -- Set the affinity to all the processors belonging to the
-- dispatching domain. -- dispatching domain.
for Proc in T.Common.Domain'Range loop for Proc in T.Common.Domain'Range loop
CPU_Set.bits (Integer (Proc)) := T.Common.Domain (Proc); if T.Common.Domain (Proc) then
System.OS_Interface.CPU_SET (int (Proc), CPU_Set'Access);
end if;
end loop; end loop;
Result := Result :=
...@@ -1394,8 +1401,9 @@ package body System.Task_Primitives.Operations is ...@@ -1394,8 +1401,9 @@ package body System.Task_Primitives.Operations is
then then
declare declare
type cpu_set_t_ptr is access all cpu_set_t; type cpu_set_t_ptr is access all cpu_set_t;
CPU_Set : aliased cpu_set_t;
CPU_Set_Ptr : cpu_set_t_ptr := null;
CPU_Set : cpu_set_t_ptr := null;
Result : Interfaces.C.int; Result : Interfaces.C.int;
begin begin
...@@ -1406,16 +1414,17 @@ package body System.Task_Primitives.Operations is ...@@ -1406,16 +1414,17 @@ package body System.Task_Primitives.Operations is
if T.Common.Base_CPU /= Multiprocessors.Not_A_Specific_CPU then if T.Common.Base_CPU /= Multiprocessors.Not_A_Specific_CPU then
-- Set the affinity to an unique CPU -- Set the affinity to an unique CPU
System.OS_Interface.CPU_ZERO (CPU_Set'Access);
CPU_Set := new cpu_set_t'(bits => (others => False)); System.OS_Interface.CPU_SET
CPU_Set.bits (Integer (T.Common.Base_CPU)) := True; (int (T.Common.Base_CPU), CPU_Set'Access);
CPU_Set_Ptr := CPU_Set'Access;
-- Handle Task_Info -- Handle Task_Info
elsif T.Common.Task_Info /= null elsif T.Common.Task_Info /= null
and then T.Common.Task_Info.CPU_Affinity /= Task_Info.Any_CPU and then T.Common.Task_Info.CPU_Affinity /= Task_Info.Any_CPU
then then
CPU_Set := T.Common.Task_Info.CPU_Affinity'Access; CPU_Set_Ptr := T.Common.Task_Info.CPU_Affinity'Access;
-- Handle dispatching domains -- Handle dispatching domains
...@@ -1431,11 +1440,13 @@ package body System.Task_Primitives.Operations is ...@@ -1431,11 +1440,13 @@ package body System.Task_Primitives.Operations is
-- domain other than the default one, or when the default one -- domain other than the default one, or when the default one
-- has been modified. -- has been modified.
CPU_Set := new cpu_set_t'(bits => (others => False)); System.OS_Interface.CPU_ZERO (CPU_Set'Access);
for Proc in T.Common.Domain'Range loop for Proc in T.Common.Domain'Range loop
CPU_Set.bits (Integer (Proc)) := T.Common.Domain (Proc); System.OS_Interface.CPU_SET (int (Proc), CPU_Set'Access);
end loop; end loop;
CPU_Set_Ptr := CPU_Set'Access;
end if; end if;
-- We set the new affinity if needed. Otherwise, the new task -- We set the new affinity if needed. Otherwise, the new task
...@@ -1443,10 +1454,10 @@ package body System.Task_Primitives.Operations is ...@@ -1443,10 +1454,10 @@ package body System.Task_Primitives.Operations is
-- the documentation of pthread_setaffinity_np), which is -- the documentation of pthread_setaffinity_np), which is
-- consistent with Ada's required semantics. -- consistent with Ada's required semantics.
if CPU_Set /= null then if CPU_Set_Ptr /= null then
Result := Result :=
pthread_setaffinity_np pthread_setaffinity_np
(T.Common.LL.Thread, CPU_SETSIZE / 8, CPU_Set); (T.Common.LL.Thread, CPU_SETSIZE / 8, CPU_Set_Ptr);
pragma Assert (Result = 0); pragma Assert (Result = 0);
end if; end if;
end; end;
......
...@@ -35,11 +35,6 @@ with System.Machine_Code; use System.Machine_Code; ...@@ -35,11 +35,6 @@ with System.Machine_Code; use System.Machine_Code;
package body System.Vax_Float_Operations is package body System.Vax_Float_Operations is
-- Ensure this gets compiled with -O to avoid extra (and possibly
-- improper) memory stores.
pragma Optimize (Time);
-- Declare the functions that do the conversions between floating-point -- Declare the functions that do the conversions between floating-point
-- formats. Call the operands IEEE float so they get passed in -- formats. Call the operands IEEE float so they get passed in
-- FP registers. -- FP registers.
......
...@@ -601,30 +601,35 @@ package body Sem_Attr is ...@@ -601,30 +601,35 @@ package body Sem_Attr is
Build_Access_Subprogram_Type (P); Build_Access_Subprogram_Type (P);
-- For unrestricted access, kill current values, since this -- For P'Access or P'Unrestricted_Access, where P is a nested
-- attribute allows a reference to a local subprogram that -- subprogram, we might be passing P to another subprogram (but we
-- could modify local variables to be passed out of scope -- don't check that here), which might call P. P could modify
-- local variables, so we need to kill current values. It is
if Aname = Name_Unrestricted_Access then -- important not to do this for library-level subprograms, because
-- Kill_Current_Values is very inefficient in the case of library
-- Do not kill values on nodes initializing dispatch tables -- level packages with lots of tagged types.
-- slots. The construct Prim_Ptr!(Prim'Unrestricted_Access)
-- is currently generated by the expander only for this if Is_Library_Level_Entity (Entity (Prefix (N))) then
-- purpose. Done to keep the quality of warnings currently null;
-- generated by the compiler (otherwise any declaration of
-- a tagged type cleans constant indications from its scope). -- Do not kill values on nodes initializing dispatch tables
-- slots. The construct Prim_Ptr!(Prim'Unrestricted_Access)
if Nkind (Parent (N)) = N_Unchecked_Type_Conversion -- is currently generated by the expander only for this
and then (Etype (Parent (N)) = RTE (RE_Prim_Ptr) -- purpose. Done to keep the quality of warnings currently
or else -- generated by the compiler (otherwise any declaration of
Etype (Parent (N)) = RTE (RE_Size_Ptr)) -- a tagged type cleans constant indications from its scope).
and then Is_Dispatching_Operation
(Directly_Designated_Type (Etype (N))) elsif Nkind (Parent (N)) = N_Unchecked_Type_Conversion
then and then (Etype (Parent (N)) = RTE (RE_Prim_Ptr)
null; or else
else Etype (Parent (N)) = RTE (RE_Size_Ptr))
Kill_Current_Values; and then Is_Dispatching_Operation
end if; (Directly_Designated_Type (Etype (N)))
then
null;
else
Kill_Current_Values;
end if; end if;
return; return;
......
...@@ -3290,10 +3290,12 @@ package body Sem_Ch8 is ...@@ -3290,10 +3290,12 @@ package body Sem_Ch8 is
-- type is still not frozen). We exclude from this processing generic -- type is still not frozen). We exclude from this processing generic
-- formal subprograms found in instantiations and AST_Entry renamings. -- formal subprograms found in instantiations and AST_Entry renamings.
-- We must exclude VM targets because entity AST_Handler is defined in -- We must exclude VM targets and restricted run-time libraries because
-- package System.Aux_Dec which is not available in those platforms. -- entity AST_Handler is defined in package System.Aux_Dec which is not
-- available in those platforms.
if VM_Target = No_VM if VM_Target = No_VM
and then not Restricted_Profile
and then not Present (Corresponding_Formal_Spec (N)) and then not Present (Corresponding_Formal_Spec (N))
and then Etype (Nam) /= RTE (RE_AST_Handler) and then Etype (Nam) /= RTE (RE_AST_Handler)
then then
......
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