Several members of struct yy_parser can go on a diet. Some I32s were
Nicholas Clark [Sat, 21 Apr 2007 19:05:08 +0000 (19:05 +0000)]
actually only holding chars.

p4raw-id: //depot/perl@31015

intrpvar.h
op.c
parser.h
perl.h
toke.c

index 781de8f..12a9084 100644 (file)
@@ -285,7 +285,7 @@ PERLVARI(Icshname,  const char *,   CSH)
 PERLVARI(Icshlen,      I32,    0)
 #endif
 
-PERLVAR(Ilex_state,    U32)            /* next token is determined */
+PERLVAR(Ilex_state,    U8)             /* next token is determined */
 
 /* What we know when we're in LEX_KNOWNEXT state. */
 #ifdef PERL_MAD
@@ -302,7 +302,7 @@ PERLVAR(Ibufptr,    char *)
 PERLVAR(Ioldbufptr,    char *)
 PERLVAR(Ioldoldbufptr, char *)
 PERLVAR(Ibufend,       char *)
-PERLVARI(Iexpect,int,  XSTATE)         /* how to interpret ambiguous tokens */
+PERLVARI(Iexpect, U8,  XSTATE)         /* how to interpret ambiguous tokens */
 
 PERLVAR(Imulti_end,    I32)            /* last line of multi-line string */
 
diff --git a/op.c b/op.c
index 5ebbe17..9e16fc8 100644 (file)
--- a/op.c
+++ b/op.c
@@ -1817,7 +1817,7 @@ S_apply_attrs(pTHX_ HV *stash, SV *target, OP *attrs, bool for_my)
 
     /* fake up C<use attributes $pkg,$rv,@attrs> */
     ENTER;             /* need to protect against side-effects of 'use' */
-    SAVEINT(PL_expect);
+    SAVEI8(PL_expect);
     stashsv = stash ? newSVhek(HvNAME_HEK(stash)) : &PL_sv_no;
 
 #define ATTRSMODULE "attributes"
@@ -3864,7 +3864,7 @@ Perl_vload_module(pTHX_ U32 flags, SV *name, SV *ver, va_list *args)
     {
        const line_t ocopline = PL_copline;
        COP * const ocurcop = PL_curcop;
-       const int oexpect = PL_expect;
+       const U8 oexpect = PL_expect;
 
        utilize(!(flags & PERL_LOADMOD_DENY), start_subparse(FALSE, 0),
                veop, modname, imop);
index dd9f28e..da6d63b 100644 (file)
--- a/parser.h
+++ b/parser.h
@@ -42,19 +42,19 @@ typedef struct yy_parser {
     I32                lex_casemods;   /* casemod count */
     char       *lex_brackstack;/* what kind of brackets to pop */
     char       *lex_casestack; /* what kind of case mods in effect */
-    U32                lex_defer;      /* state after determined token */
-    I32                lex_dojoin;     /* doing an array interpolation */
-    int                lex_expect;     /* expect after determined token */
+    U8         lex_defer;      /* state after determined token */
+    bool       lex_dojoin;     /* doing an array interpolation */
+    U8         lex_expect;     /* expect after determined token */
     I32                lex_formbrack;  /* bracket count at outer format level */
     OP         *lex_inpat;     /* in pattern $) and $| are special */
     OP         *lex_op;        /* extra info to pass back on op */
     SV         *lex_repl;      /* runtime replacement from s/// */
-    I32                lex_inwhat;     /* what kind of quoting are we in */
+    U16                lex_inwhat;     /* what kind of quoting are we in */
     I32                lex_starts;     /* how many interps done on level */
     SV         *lex_stuff;     /* runtime pattern from m// or s/// */
     I32                multi_start;    /* 1st line of multi-line string */
-    I32                multi_open;     /* delimiter of said string */
-    I32                multi_close;    /* delimiter of said string */
+    char       multi_open;     /* delimiter of said string */
+    char       multi_close;    /* delimiter of said string */
     char       pending_ident;  /* pending identifier lookup */
     bool       preambled;
     SUBLEXINFO sublex_info;
diff --git a/perl.h b/perl.h
index 452b70d..6d9488b 100644 (file)
--- a/perl.h
+++ b/perl.h
@@ -3278,8 +3278,8 @@ struct nexttoken {
 
 typedef struct _sublex_info SUBLEXINFO;
 struct _sublex_info {
-    I32 super_state;   /* lexer state to save */
-    I32 sub_inwhat;    /* "lex_inwhat" to use */
+    U8 super_state;    /* lexer state to save */
+    U16 sub_inwhat;    /* "lex_inwhat" to use */
     OP *sub_op;                /* "lex_op" to use */
     char *super_bufptr;        /* PL_bufptr that was */
     char *super_bufend;        /* PL_bufend that was */
diff --git a/toke.c b/toke.c
index d5fbd0a..12d91af 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -645,7 +645,7 @@ Perl_lex_start(pTHX_ SV *line)
 
     /* initialise lexer state */
 
-    SAVEI32(PL_lex_state);
+    SAVEI8(PL_lex_state);
 #ifdef PERL_MAD
     if (PL_lex_state == LEX_KNOWNEXT) {
        I32 toke = parser->old_parser->lasttoke;
@@ -678,7 +678,7 @@ Perl_lex_start(pTHX_ SV *line)
     SAVEPPTR(PL_linestart);
     SAVESPTR(PL_linestr);
     SAVEDESTRUCTOR_X(restore_rsfp, PL_rsfp);
-    SAVEINT(PL_expect);
+    SAVEI8(PL_expect);
 
     PL_copline = NOLINE;
     PL_lex_state = LEX_NORMAL;
@@ -1658,13 +1658,13 @@ S_sublex_push(pTHX)
     ENTER;
 
     PL_lex_state = PL_sublex_info.super_state;
-    SAVEI32(PL_lex_dojoin);
+    SAVEBOOL(PL_lex_dojoin);
     SAVEI32(PL_lex_brackets);
     SAVEI32(PL_lex_casemods);
     SAVEI32(PL_lex_starts);
-    SAVEI32(PL_lex_state);
+    SAVEI8(PL_lex_state);
     SAVEVPTR(PL_lex_inpat);
-    SAVEI32(PL_lex_inwhat);
+    SAVEI8(PL_lex_inwhat);
     SAVECOPLINE(PL_curcop);
     SAVEPPTR(PL_bufptr);
     SAVEPPTR(PL_bufend);