diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-08-30 14:56:45 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-08-30 14:56:45 +0000 |
commit | 3157c4f3e0a036edae0f2e31502648119e109d82 (patch) | |
tree | b835d16538f8d08c37359d2bcd6b1863c3b2195e /gcc/ada/s-taprop-mingw.adb | |
parent | 17554eb5e0bb8bae5f016336a79d6d0f9db0dae1 (diff) | |
download | gcc-3157c4f3e0a036edae0f2e31502648119e109d82.tar.gz |
2011-08-30 Jose Ruiz <ruiz@adacore.com>
* s-taskin.ads (Common_ATCB): Add field domain which contains the
dispatching domain to which the task belongs.
* s-taskin.adb (Initialize): Create the default system dispatching
domain and make the environment task part of it.
* s-mudido.ads: Add this new spec for standard Ada 2012 package
Ada.Multiprocessors.Dispatching_Domains.
* s-mudido.adb: Add this new body for targets not supporting
dispatching domains.
* s-mudido-affinity.adb: Add this new body for targets supporting
dispatching domains setting the affinity to a CPU set.
* bindgen.adb (Dispatching_Domain_Used, Check_Dispatching_Domains_Used,
Gen_Adainit): When package System.Multiprocessors.Dispatching_Domains
is used we call the procedure to signal that when we are about to call
the main subprogram no new dispatching domain can be created.
(Check_File_In_Partition): Factor out the common functionality used by
Check_System_Restrictions_Used and Check_Dispatching_Domains_Used.
* s-tassta.adb (Create_Task): Tasks inherit the dispatching domain of
their activators.
* s-taprop.ads (Set_Task_Affinity): Add this new procedure to set task
affinities.
* s-taprop-dummy.adb, s-taprop-hpux-dce.adb, s-taprop-irix.adb,
s-taprop-posix.adb, s-taprop-tru64.adb, s-taprop-vms.adb
(Set_Task_Affinity): Dummy null body for these targets not supporting
task affinities.
s-taprop-linux.adb, s-taprop-mingw.adb, s-taprop-solaris.adb,
s-taprop-vxworks.adb (Create_Task, Enter_Task, Initialize): Handle
dispatching domains and set the affinity of the environment task.
(Set_Task_Affinity): Procedure that uses the underlying CPU set
functionality to handle dispatching domains, pragma CPU and Task_Info.
s-winext.ads (SetThreadAffinityMask): Import this function needed to
set CPU masks.
* s-osinte-solaris.ads (psetit_t, pset_create, pset_assign, pset_bind):
Import the functionality to handle CPU set affinities.
* affinity.c: New file.
* s-osinte-vxworks.ads, s-vxwext.ads, s-vxwext-kernel.ads,
s-vxwext-rtp.ads (taskMaskAffinitySet): Add this new spec for setting
affinity masks.
* s-vxwext.adb, s-vxwext-kernel.adb, s-vxwext-rtp.adb
(taskMaskAffinitySet): Body returning an error indicating that task
affinities are not supported.
Makefile.rtl: Indicate that s-mudido is part of libgnarl.
* gcc-interface/Makefile.in (LIBGNAT_TARGET_PAIRS for VxWorks SMP,
Solaris, Windows, and {x86,PowerPC, ia64,x86_64} Linux): Use the
s-mudido-affinity.adb body which supports task affinities.
2011-08-30 Thomas quinot <quinot@adacore.com>
* sem_ch13.adb: Minor reformatting.
2011-08-30 Vincent Celier <celier@adacore.com>
* vms_conv.adb (Process_Argument): When the qualifier
/UNCHECKED_SHARED_LIB_IMPORTS is for GNAT COMPILE, do not put the
corresponding switch --unchecked-shared-lib-imports after -cargs, as it
is for gnatmake, not for the compiler.
2011-08-30 Ed Schonberg <schonberg@adacore.com>
* sem_ch4.adb (Analyze_Quantified_Expression): Analyze iterator
specification and condition only in Semantics_Only mode. Otherwise the
analysis is done after expression has been rewritten as loop.
* sem_ch5.adb (Analyze_Iterator_Specification): Always generate a
temporary for the iterator name (the domain of iteration) because it
may need finalization actions and these must be generated outside of
the loop.
* sem_res.adb (Resolve_Quantified_Expression): Resolve only in
Semantic_Only mode.
* exp_ch4.adb (Expand_Quantified_Expression): Analyze and resolve once
rewritten as loop.
* exp_ch5.adb (Expand_Iterator_Loop): Code clean-up, now that the
iterator is always an expression.
2011-08-30 Robert Dewar <dewar@adacore.com>
* par-ch4.adb (P_Unparen_Cond_Case_Quant_Expression): New function
(P_Expression_If_OK): New spec checks parens
(P_Expression_Or_Range_Attribute_If_OK): New spec checks parens
* par.adb (P_Expression_If_OK): New spec checks parens
(P_Expression_Or_Range_Attribute_If_OK): New spec checks parens
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@178321 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/s-taprop-mingw.adb')
-rw-r--r-- | gcc/ada/s-taprop-mingw.adb | 92 |
1 files changed, 60 insertions, 32 deletions
diff --git a/gcc/ada/s-taprop-mingw.adb b/gcc/ada/s-taprop-mingw.adb index cbde1f4c90e..a770a6a4589 100644 --- a/gcc/ada/s-taprop-mingw.adb +++ b/gcc/ada/s-taprop-mingw.adb @@ -954,21 +954,7 @@ package body System.Task_Primitives.Operations is -- Step 4: Handle pragma CPU and Task_Info - if T.Common.Base_CPU /= System.Multiprocessors.Not_A_Specific_CPU then - - -- The CPU numbering in pragma CPU starts at 1 while the subprogram - -- to set the affinity starts at 0, therefore we must subtract 1. - - Result := SetThreadIdealProcessor - (hTask, ProcessorId (T.Common.Base_CPU) - 1); - pragma Assert (Result = 1); - - elsif T.Common.Task_Info /= null then - if T.Common.Task_Info.CPU /= Task_Info.Any_CPU then - Result := SetThreadIdealProcessor (hTask, T.Common.Task_Info.CPU); - pragma Assert (Result = 1); - end if; - end if; + Set_Task_Affinity (T); -- Step 5: Now, start it for good @@ -1074,10 +1060,6 @@ package body System.Task_Primitives.Operations is Discard : BOOL; pragma Unreferenced (Discard); - Result : DWORD; - - use type System.Multiprocessors.CPU_Range; - begin Environment_Task_Id := Environment_Task; OS_Primitives.Initialize; @@ -1109,20 +1091,9 @@ package body System.Task_Primitives.Operations is Enter_Task (Environment_Task); - -- pragma CPU for the environment task - - if Environment_Task.Common.Base_CPU /= - System.Multiprocessors.Not_A_Specific_CPU - then - -- The CPU numbering in pragma CPU starts at 1 while the subprogram - -- to set the affinity starts at 0, therefore we must subtract 1. + -- pragma CPU and dispatching domains for the environment task - Result := - SetThreadIdealProcessor - (Environment_Task.Common.LL.Thread, - ProcessorId (Environment_Task.Common.Base_CPU) - 1); - pragma Assert (Result = 1); - end if; + Set_Task_Affinity (Environment_Task); end Initialize; --------------------- @@ -1377,4 +1348,61 @@ package body System.Task_Primitives.Operations is return False; end Continue_Task; + ----------------------- + -- Set_Task_Affinity -- + ----------------------- + + procedure Set_Task_Affinity (T : ST.Task_Id) is + Result : DWORD; + + use type System.Multiprocessors.CPU_Range; + + begin + -- pragma CPU + + if T.Common.Base_CPU /= System.Multiprocessors.Not_A_Specific_CPU then + + -- The CPU numbering in pragma CPU starts at 1 while the subprogram + -- to set the affinity starts at 0, therefore we must substract 1. + + Result := SetThreadIdealProcessor + (T.Common.LL.Thread, ProcessorId (T.Common.Base_CPU) - 1); + pragma Assert (Result = 1); + + -- Task_Info + + elsif T.Common.Task_Info /= null then + if T.Common.Task_Info.CPU /= Task_Info.Any_CPU then + Result := + SetThreadIdealProcessor + (T.Common.LL.Thread, T.Common.Task_Info.CPU); + pragma Assert (Result = 1); + end if; + + -- Dispatching domains + + elsif T.Common.Domain /= null and then + (T.Common.Domain /= ST.System_Domain or else + T.Common.Domain.all /= (Multiprocessors.CPU'First .. + Multiprocessors.Number_Of_CPUs => True)) + then + declare + CPU_Set : DWORD := 0; + + begin + for Proc in T.Common.Domain'Range loop + if T.Common.Domain (Proc) then + -- The thread affinity mask is a bit vector in which each + -- bit represents a logical processor. + + CPU_Set := CPU_Set + 2 ** (Integer (Proc) - 1); + end if; + end loop; + + Result := SetThreadAffinityMask (T.Common.LL.Thread, CPU_Set); + pragma Assert (Result = 1); + end; + end if; + end Set_Task_Affinity; + end System.Task_Primitives.Operations; |