summaryrefslogtreecommitdiff
path: root/cop.h
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2006-09-17 10:39:27 +0000
committerNicholas Clark <nick@ccl4.org>2006-09-17 10:39:27 +0000
commit0a4986294ec50ec8a4a4a257f636963fe57ca322 (patch)
treea06d6ce9c9e6ecf299d910ce5e4ef4bc8e1ea8aa /cop.h
parent022eaa24f0f108e678e18c854c6eb92c735188c5 (diff)
downloadperl-0a4986294ec50ec8a4a4a257f636963fe57ca322.tar.gz
Some notes about struct block_loop
p4raw-id: //depot/perl@28859
Diffstat (limited to 'cop.h')
-rw-r--r--cop.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/cop.h b/cop.h
index 66b7ffb41d..effdbf34ae 100644
--- a/cop.h
+++ b/cop.h
@@ -404,11 +404,28 @@ struct block_loop {
SV ** itervar;
#endif
SV * itersave;
+ /* (from inspection of source code) for a .. range of strings this is the
+ current string. */
SV * iterlval;
+ /* (from inspection of source code) for a foreach loop this is the array
+ being iterated over. For a .. range of numbers it's the current value.
+ A check is often made on the SvTYPE of iterary to determine whether
+ we are iterating over an array or a range. (numbers or strings) */
AV * iterary;
IV iterix;
+ /* (from inspection of source code) for a .. range of numbers this is the
+ maximum value. */
IV itermax;
};
+/* It might be possible to squeeze this structure further. As best I can tell
+ itermax and iterlval are never used at the same time, so it might be possible
+ to make them into a union. However, I'm not confident that there are enough
+ flag bits/NULLable pointers in this structure alone to encode which is
+ active. There is, however, U8 of space free in struct block, which could be
+ used. Right now it may not be worth squeezing this structure further, as it's
+ the largest part of struct block, and currently struct block is 64 bytes on
+ an ILP32 system, which will give good cache alignment.
+*/
#ifdef USE_ITHREADS
# define CxITERVAR(c) \