From 54533a0b36101d77e146f1d88e8dfcaad467730a Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Wed, 22 Jan 2014 12:17:01 +0100 Subject: [PATCH] [multiple changes] 2014-01-22 Jerome Guitton * mlib-tgt-specific-vxworks.adb (Get_Target_Suffix): Replace xscale by arm. 2014-01-22 Robert Dewar * gnat_rm.texi, gnat_ugn.texi: Document passive task optimization From-SVN: r206919 --- gcc/ada/ChangeLog | 9 ++++++++ gcc/ada/gnat_rm.texi | 3 +++ gcc/ada/gnat_ugn.texi | 43 +++++++++++++++++++++++++++++++++++ gcc/ada/mlib-tgt-specific-vxworks.adb | 4 ++-- 4 files changed, 57 insertions(+), 2 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 5a23f0a..68a6414 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,12 @@ +2014-01-22 Jerome Guitton + + * mlib-tgt-specific-vxworks.adb (Get_Target_Suffix): Replace xscale by + arm. + +2014-01-22 Robert Dewar + + * gnat_rm.texi, gnat_ugn.texi: Document passive task optimization + 2014-01-22 Eric Botcazou * gcc-interface/Makefile.in: Minor fixes. diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi index 80aa33d..adf4ec2 100644 --- a/gcc/ada/gnat_rm.texi +++ b/gcc/ada/gnat_rm.texi @@ -5060,6 +5060,9 @@ desired. If the argument @code{No} is present, the task must not be optimized. GNAT does not attempt to optimize any tasks in this manner (since protected objects are available in place of passive tasks). +For more information on the subject of passive tasks, see the section +``Passive Task Optimization'' in the GNAT Users Guide. + @node Pragma Persistent_BSS @unnumberedsec Pragma Persistent_BSS @findex Persistent_BSS diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi index b8cc039..c84b0a9 100644 --- a/gcc/ada/gnat_ugn.texi +++ b/gcc/ada/gnat_ugn.texi @@ -10154,6 +10154,7 @@ some guidelines on debugging optimized code. * Other Optimization Switches:: * Optimization and Strict Aliasing:: * Aliased Variables and Optimization:: +* Passive Task Optimization:: @ifset vms * Coverage Analysis:: @@ -10999,6 +11000,48 @@ inhibits optimizations that assume the value cannot be assigned. This means that the above example will in fact "work" reliably, that is, it will produce the expected results. +@node Passive Task Optimization +@subsection Passive Task Optimization +@cindex Passive Task + +A passive task is one which is sufficiently simple that +in theory a compiler could recognize it an implement it +efficiently without creating a new thread. The original design +of Ada 83 had in mind this kind of passive task optimization, but +only a few Ada 83 compilers attempted it. The problem was that +it was difficult to determine the exact conditions under which +the optimization was possible. The result is a very fragile +optimization where a very minor change in the program can +suddenly silently make a task non-optimizable. + +With the revisiting of this issue in Ada 95, there was general +agreement that this approach was fundamentally flawed, and the +notion of protected types was introduced. When using protected +types, the restrictions are well defined, and you KNOW that the +operations will be optimized, and furthermore this optimized +performance is fully portable. + +Although it would theoretically be possible for GNAT to attempt to +do this optimization, but it really doesn't make sense in the +context of Ada 95, and none of the Ada 95 compilers implement +this optimization as far as we know. In particular GNAT never +attempts to perform this optimization. + +In any new Ada 95 code that is written, you should always +use protected types in place of tasks that might be able to +be optimized in this manner. +Of course this does not help if you have legacy Ada 83 code +that depends on this optimization, but it is unusual to encounter +a case where the performance gains from this optimization +are significant. + +Your program should work correctly without this optimization. If +you have performance problems, then the most practical +approach is to figure out exactly where these performance problems +arise, and update those particular tasks to be protected types. Note +that typically clients of the tasks who call entries, will not have +to be modified, only the task definition itself. + @ifset vms @node Coverage Analysis @subsection Coverage Analysis diff --git a/gcc/ada/mlib-tgt-specific-vxworks.adb b/gcc/ada/mlib-tgt-specific-vxworks.adb index 17a9d74..29abd80 100644 --- a/gcc/ada/mlib-tgt-specific-vxworks.adb +++ b/gcc/ada/mlib-tgt-specific-vxworks.adb @@ -7,7 +7,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2003-2011, Free Software Foundation, Inc. -- +-- Copyright (C) 2003-2013, 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- -- @@ -157,7 +157,7 @@ package body MLib.Tgt.Specific is return "sparc"; elsif Target_Name (Target_Name'First .. Index) = "sparc64" then return "sparc64"; - elsif Target_Name (Target_Name'First .. Index) = "xscale" then + elsif Target_Name (Target_Name'First .. Index) = "arm" then return "arm"; elsif Target_Name (Target_Name'First .. Index) = "i586" then return "pentium"; -- 2.7.4