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>
* inline.adb, sem_aggr.adb: Minor reformatting.
......
......@@ -3770,6 +3770,20 @@ void *__gnat_lwp_self (void)
{
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
#ifdef __cplusplus
......
......@@ -247,6 +247,13 @@ extern void __gnat_os_filename (char *, char *, char *,
int *, char *, int *);
#if defined (linux)
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
#if defined (_WIN32)
......
......@@ -62,17 +62,17 @@ with Validsw; use Validsw;
package body Exp_Ch5 is
function Change_Of_Representation (N : Node_Id) return Boolean;
-- Determine if the right hand side of the assignment N is a type
-- conversion which requires a change of representation. Called
-- only for the array and record cases.
-- Determine if the right hand side of assignment N is a type conversion
-- which requires a change of representation. Called only for the array
-- and record cases.
procedure Expand_Assign_Array (N : Node_Id; Rhs : Node_Id);
-- N is an assignment which assigns an array value. This routine process
-- the various special cases and checks required for such assignments,
-- including change of representation. Rhs is normally simply the right
-- hand side of the assignment, except that if the right hand side is
-- a type conversion or a qualified expression, then the Rhs is the
-- actual expression inside any such type conversions or qualifications.
-- hand side of the assignment, except that if the right hand side is a
-- type conversion or a qualified expression, then the RHS is the actual
-- expression inside any such type conversions or qualifications.
function Expand_Assign_Array_Loop
(N : Node_Id;
......@@ -3026,21 +3026,16 @@ package body Exp_Ch5 is
-- If the container type is a derived type, the cursor type is
-- found in the package of the parent type.
Iter_Type := Etype (Name (I_Spec));
if Is_Iterator (Iter_Type) then
if Is_Derived_Type (Container_Typ) then
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;
Iter_Type := Etype (Name (I_Spec));
if Is_Iterator (Iter_Type) then
Pack := Scope (Pack);
end if;
-- The "of" case uses an internally generated cursor whose type
......
......@@ -4198,32 +4198,6 @@ package body Exp_Ch7 is
Last_Object : Node_Id;
Related_Node : Node_Id)
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 :=
Nkind_In (N, N_Function_Call,
N_Procedure_Call_Statement);
......@@ -4242,8 +4216,6 @@ package body Exp_Ch7 is
Stmts : List_Id;
Temp_Id : Entity_Id;
-- Start of processing for Process_Transient_Objects
begin
-- Examine all objects in the list First_Object .. Last_Object
......@@ -4296,11 +4268,8 @@ package body Exp_Ch7 is
if Requires_Hooking then
declare
Ins_List : constant List_Id := Find_Insertion_List;
Expr : Node_Id;
Ptr_Decl : Node_Id;
Ptr_Id : Entity_Id;
Temp_Decl : Node_Id;
begin
-- Step 1: Create an access type which provides a
......@@ -4310,7 +4279,7 @@ package body Exp_Ch7 is
Ptr_Id := Make_Temporary (Loc, 'A');
Ptr_Decl :=
Insert_Action (Stmt,
Make_Full_Type_Declaration (Loc,
Defining_Identifier => Ptr_Id,
Type_Definition =>
......@@ -4318,7 +4287,7 @@ package body Exp_Ch7 is
All_Present =>
Ekind (Obj_Typ) = E_General_Access_Type,
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
-- the transient object. Generate:
......@@ -4327,19 +4296,11 @@ package body Exp_Ch7 is
Temp_Id := Make_Temporary (Loc, 'T');
Temp_Decl :=
Insert_Action (Stmt,
Make_Object_Declaration (Loc,
Defining_Identifier => Temp_Id,
Object_Definition =>
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);
New_Reference_To (Ptr_Id, Loc)));
-- Mark the temporary as a transient hook. This signals
-- the machinery in Build_Finalizer to recognize this
......
......@@ -5732,7 +5732,7 @@ as shown in the following example.
@emph{Activate warnings on unnecessary Warnings Off pragmas}
@cindex @option{-gnatw.w} (@command{gcc})
@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
warnings), or it could be replaced by @code{pragma Unreferenced} or
@code{pragma Unmodified}.The default is that these warnings are not given.
......@@ -5742,7 +5742,7 @@ activated explicitly.
@item -gnatw.W
@emph{Suppress warnings on unnecessary Warnings Off pragmas}
@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
@emph{Activate warnings on Export/Import pragmas.}
......
......@@ -7,7 +7,7 @@
-- S p e c --
-- --
-- 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 --
-- terms of the GNU General Public License as published by the Free Soft- --
......@@ -482,6 +482,14 @@ package System.OS_Interface is
end record;
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
(thread : pthread_t;
cpusetsize : size_t;
......
......@@ -869,9 +869,12 @@ package body System.Task_Primitives.Operations is
elsif T.Common.Base_CPU /= System.Multiprocessors.Not_A_Specific_CPU then
declare
CPU_Set : aliased cpu_set_t := (bits => (others => False));
CPU_Set : aliased cpu_set_t;
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 :=
pthread_attr_setaffinity_np
(Attributes'Access,
......@@ -905,14 +908,18 @@ package body System.Task_Primitives.Operations is
Multiprocessors.Number_Of_CPUs => True))
then
declare
CPU_Set : aliased cpu_set_t := (bits => (others => False));
CPU_Set : aliased cpu_set_t;
begin
System.OS_Interface.CPU_ZERO (CPU_Set'Access);
-- Set the affinity to all the processors belonging to the
-- dispatching domain.
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;
Result :=
......@@ -1394,8 +1401,9 @@ package body System.Task_Primitives.Operations is
then
declare
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;
begin
......@@ -1406,16 +1414,17 @@ package body System.Task_Primitives.Operations is
if T.Common.Base_CPU /= Multiprocessors.Not_A_Specific_CPU then
-- Set the affinity to an unique CPU
CPU_Set := new cpu_set_t'(bits => (others => False));
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);
CPU_Set_Ptr := CPU_Set'Access;
-- Handle Task_Info
elsif T.Common.Task_Info /= null
and then T.Common.Task_Info.CPU_Affinity /= Task_Info.Any_CPU
then
CPU_Set := T.Common.Task_Info.CPU_Affinity'Access;
CPU_Set_Ptr := T.Common.Task_Info.CPU_Affinity'Access;
-- Handle dispatching domains
......@@ -1431,11 +1440,13 @@ package body System.Task_Primitives.Operations is
-- domain other than the default one, or when the default one
-- 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
CPU_Set.bits (Integer (Proc)) := T.Common.Domain (Proc);
System.OS_Interface.CPU_SET (int (Proc), CPU_Set'Access);
end loop;
CPU_Set_Ptr := CPU_Set'Access;
end if;
-- We set the new affinity if needed. Otherwise, the new task
......@@ -1443,10 +1454,10 @@ package body System.Task_Primitives.Operations is
-- the documentation of pthread_setaffinity_np), which is
-- consistent with Ada's required semantics.
if CPU_Set /= null then
if CPU_Set_Ptr /= null then
Result :=
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);
end if;
end;
......
......@@ -35,11 +35,6 @@ with System.Machine_Code; use System.Machine_Code;
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
-- formats. Call the operands IEEE float so they get passed in
-- FP registers.
......
......@@ -601,11 +601,16 @@ package body Sem_Attr is
Build_Access_Subprogram_Type (P);
-- For unrestricted access, kill current values, since this
-- attribute allows a reference to a local subprogram that
-- could modify local variables to be passed out of scope
if Aname = Name_Unrestricted_Access then
-- For P'Access or P'Unrestricted_Access, where P is a nested
-- subprogram, we might be passing P to another subprogram (but we
-- don't check that here), which might call P. P could modify
-- local variables, so we need to kill current values. It is
-- important not to do this for library-level subprograms, because
-- Kill_Current_Values is very inefficient in the case of library
-- level packages with lots of tagged types.
if Is_Library_Level_Entity (Entity (Prefix (N))) then
null;
-- Do not kill values on nodes initializing dispatch tables
-- slots. The construct Prim_Ptr!(Prim'Unrestricted_Access)
......@@ -614,7 +619,7 @@ package body Sem_Attr is
-- generated by the compiler (otherwise any declaration of
-- a tagged type cleans constant indications from its scope).
if Nkind (Parent (N)) = N_Unchecked_Type_Conversion
elsif Nkind (Parent (N)) = N_Unchecked_Type_Conversion
and then (Etype (Parent (N)) = RTE (RE_Prim_Ptr)
or else
Etype (Parent (N)) = RTE (RE_Size_Ptr))
......@@ -622,10 +627,10 @@ package body Sem_Attr is
(Directly_Designated_Type (Etype (N)))
then
null;
else
Kill_Current_Values;
end if;
end if;
return;
......
......@@ -3290,10 +3290,12 @@ package body Sem_Ch8 is
-- type is still not frozen). We exclude from this processing generic
-- formal subprograms found in instantiations and AST_Entry renamings.
-- We must exclude VM targets because entity AST_Handler is defined in
-- package System.Aux_Dec which is not available in those platforms.
-- We must exclude VM targets and restricted run-time libraries because
-- entity AST_Handler is defined in package System.Aux_Dec which is not
-- available in those platforms.
if VM_Target = No_VM
and then not Restricted_Profile
and then not Present (Corresponding_Formal_Spec (N))
and then Etype (Nam) /= RTE (RE_AST_Handler)
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