summaryrefslogtreecommitdiff
path: root/gcc/ada/a-coorse.ads
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2015-05-22 13:01:37 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2015-05-22 13:01:37 +0000
commitb79743418f17c6f483807a8b5e2dea1908289f2f (patch)
tree8b36160fdde6190f5222ddb6061d762b8c0ecc3d /gcc/ada/a-coorse.ads
parent9d3c8b0f2d9d21d00d00bf36b36ee6271ff50b00 (diff)
downloadgcc-b79743418f17c6f483807a8b5e2dea1908289f2f.tar.gz
2015-05-22 Robert Dewar <dewar@adacore.com>
* einfo.ads: Minor comment updates. * exp_unst.adb: Move Subps table to spec Don't remove old entries from table Add Last field to record last entry used. * exp_unst.ads: Move Subps table here from body So that Cprint can access saved values. 2015-05-22 Bob Duff <duff@adacore.com> * a-cdlili.adb, a-cdlili.ads, a-cohama.adb, a-cohama.ads, * a-cohase.adb, a-cohase.ads, a-convec.adb, a-convec.ads, * a-coorma.adb, a-coorma.ads, a-coorse.adb, a-coorse.ads: (Pseudo_Reference, Element_Access, Get_Element_Access): New declarations added for use by performance improvements in exp_ch5.adb. * snames.ads-tmpl: New names referenced by exp_ch5.adb. * exp_ch5.adb: Speed up "for ... of" loops for predefined containers. Instead of doing literally what the RM calls for, we do something equivalent that avoids expensive operations inside the loop. If the container package has appropriate Next, Pseudo_Reference, Element_Access, Get_Element_Access declarations, we invoke the optimization. * snames.ads-tmpl: Note speed improvement. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223563 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/a-coorse.ads')
-rw-r--r--gcc/ada/a-coorse.ads18
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/ada/a-coorse.ads b/gcc/ada/a-coorse.ads
index 3e16c944fb0..f574f3c92ca 100644
--- a/gcc/ada/a-coorse.ads
+++ b/gcc/ada/a-coorse.ads
@@ -413,6 +413,24 @@ private
for Constant_Reference_Type'Read use Read;
+ -- Three operations are used to optimize in the expansion of "for ... of"
+ -- loops: the Next(Cursor) procedure in the visible part, and the following
+ -- Pseudo_Reference and Get_Element_Access functions. See Sem_Ch5 for
+ -- details.
+
+ function Pseudo_Reference
+ (Container : aliased Set'Class) return Reference_Control_Type;
+ pragma Inline (Pseudo_Reference);
+ -- Creates an object of type Reference_Control_Type pointing to the
+ -- container, and increments the Lock. Finalization of this object will
+ -- decrement the Lock.
+
+ type Element_Access is access all Element_Type;
+
+ function Get_Element_Access
+ (Position : Cursor) return not null Element_Access;
+ -- Returns a pointer to the element designated by Position.
+
Empty_Set : constant Set :=
(Controlled with Tree => (First => null,
Last => null,