This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Merge some parser fields
authorFather Chrysostomos <sprout@cpan.org>
Fri, 4 Nov 2011 21:30:09 +0000 (14:30 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 6 Nov 2011 08:13:49 +0000 (01:13 -0700)
By combining two booleans with the flags field, we save some space.
By making it a 16-bit instead of 32-bit field (only two flag bits
are currently used), we also avoid alignment holes (I hope; I’m
not very good at this).

parser.h

index 36b1a43..9167e6c 100644 (file)
--- a/parser.h
+++ b/parser.h
@@ -105,10 +105,10 @@ typedef struct yy_parser {
     COP                *saved_curcop;  /* the previous PL_curcop */
     char       tokenbuf[256];
 
-    bool       in_pod;         /* lexer is within a =pod section */
     U8         lex_fakeeof;    /* precedence at which to fake EOF */
-    bool       filtered;       /* source filters in evalbytes */
-    U32                lex_flags;
+    PERL_BITFIELD16    lex_flags:14;
+    PERL_BITFIELD16    in_pod:1;      /* lexer is within a =pod section */
+    PERL_BITFIELD16    filtered:1;    /* source filters in evalbytes */
 } yy_parser;
 
 /* flags for lexer API */