At 10:56 PM +0100 10/15/06, Nicholas Clark wrote:
>On Sun, Oct 15, 2006 at 04:02:43PM -0500, Craig A. Berry wrote:
>
>> Change 28770 by [EMAIL PROTECTED] on 2006/08/31 08:26:13
>>
>> Save 4 bytes from struct context (on ILP32) by moving cx_type into
> > struct block and struct subst.
>What type does U8 end up as on VMS? And what type is bool?
$ perl -"V:u8size"
u8size='1';
$ perl -"V:u8type"
u8type='unsigned char';
$ perl -"V:boolsize"
boolsize='UNKNOWN';
$ perl -"V:booltype"
booltype='UNKNOWN';
Hmm. No bool type detected at configuration time, but this from
handy.h makes it an int, which is going to be 32 bits:
#ifndef HAS_BOOL
# if defined(UTS) || defined(VMS)
# define bool int
I have no idea why we have that. It seems a waste of about 31 bits,
but it's probably been that way forever.
>What's the offset of the I32 blku_oldsp in struct block? 3, or 4?
Since it's a longword (32 bits), it would be longword-aligned on
Alpha and Itanium (things are aligned to their "natural" boundaries).
But everything is byte aligned on VAX. So the offset would be 3
bytes on VAX, 4 on non-VAX VMS systems. These are the defaults and
there are ways to override that behavior with pragmas if necessary.
However, if a 32-bit bool is supposed to overly an 8-bit U8, that's
gonna be a problem. I had thought in a quick glance that only the
first structure members needed to match (the _type fields), but if
things further down in the structure must match or if the overall
structure sizes must match, then we need to do what your patch does.
>Does the appended patch fix it?
And indeed that fixes it, thanks.
In summary, it really wasn't an alignment issue, but having a goofy
32-bit bool type.
>
>Nicholas Clark
>
>==== //depot/perl/cop.h#131 - /home/nick/p4perl/perl/cop.h ====
>--- /tmp/tmp.74363.0 Sun Oct 15 22:55:17 2006
>+++ /home/nick/p4perl/perl/cop.h Sun Oct 15 22:39:23 2006
>@@ -497,6 +497,7 @@ struct block_givwhen {
> struct block {
> U16 blku_type; /* what kind of context this is */
> U8 blku_gimme; /* is this block running in list
> context? */
>+ U8 blku_spare; /* Padding to match with struct subst */
> I32 blku_oldsp; /* stack pointer to copy stuff down to
> */
> COP * blku_oldcop; /* old curcop pointer */
> I32 blku_oldmarksp; /* mark stack index */
>@@ -556,8 +557,8 @@ struct block {
> /* substitution context */
> struct subst {
> U16 sbu_type; /* what kind of context this is */
>- bool sbu_once;
>- bool sbu_rxtainted;
>+ U8 sbu_once; /* Actually both booleans, but U8 to
>matches */
>+ U8 sbu_rxtainted; /* struct block */
> I32 sbu_iters;
> I32 sbu_maxiters;
> I32 sbu_rflags;
--
________________________________________
Craig A. Berry
mailto:[EMAIL PROTECTED]
"... getting out of a sonnet is much more
difficult than getting in."
Brad Leithauser