From: Nicholas Clark Date: Sat, 31 Mar 2007 23:15:15 +0000 (+0000) Subject: Rearrange members of structures to reduce memory size on some X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9bd878171021311bd025e403714388c68ff5d9e2;p=p5sagit%2Fp5-mst-13.2.git Rearrange members of structures to reduce memory size on some platforms. On LP64 structs stackinfo, refcounted_he, and magic shrink by 8 bytes, struct yy_parser by 16. p4raw-id: //depot/perl@30817 --- diff --git a/cop.h b/cop.h index 1062056..c59a7d6 100644 --- a/cop.h +++ b/cop.h @@ -748,11 +748,11 @@ L. struct stackinfo { AV * si_stack; /* stack for current runlevel */ PERL_CONTEXT * si_cxstack; /* context stack for runlevel */ + struct stackinfo * si_prev; + struct stackinfo * si_next; I32 si_cxix; /* current context index */ I32 si_cxmax; /* maximum allocated index */ I32 si_type; /* type of runlevel */ - struct stackinfo * si_prev; - struct stackinfo * si_next; I32 si_markoff; /* offset where markstack begins for us. * currently used only with DEBUGGING, * but not #ifdef-ed for bincompat */ diff --git a/gv.h b/gv.h index 61af704..8494137 100644 --- a/gv.h +++ b/gv.h @@ -10,14 +10,14 @@ struct gp { SV * gp_sv; /* scalar value */ - U32 gp_refcnt; /* how many globs point to this? */ struct io * gp_io; /* filehandle value */ - CV * gp_form; /* format value */ - AV * gp_av; /* array value */ - HV * gp_hv; /* hash value */ - GV * gp_egv; /* effective gv, if *glob */ CV * gp_cv; /* subroutine value */ U32 gp_cvgen; /* generational validity of cached gv_cv */ + U32 gp_refcnt; /* how many globs point to this? */ + HV * gp_hv; /* hash value */ + AV * gp_av; /* array value */ + CV * gp_form; /* format value */ + GV * gp_egv; /* effective gv, if *glob */ line_t gp_line; /* line first declared at (for -w) */ HEK * gp_file_hek; /* file first declared in (for -w) */ }; diff --git a/hv.h b/hv.h index d6a0361..0f60be3 100644 --- a/hv.h +++ b/hv.h @@ -403,13 +403,13 @@ struct refcounted_he { #else HEK *refcounted_he_hek; /* hint key */ #endif - U32 refcounted_he_refcnt; /* reference count */ union { IV refcounted_he_u_iv; UV refcounted_he_u_uv; STRLEN refcounted_he_u_len; void *refcounted_he_u_ptr; /* Might be useful in future */ } refcounted_he_val; + U32 refcounted_he_refcnt; /* reference count */ /* First byte is flags. Then NUL-terminated value. Then for ithreads, non-NUL terminated key. */ char refcounted_he_data[1]; diff --git a/mg.h b/mg.h index 2e12374..05ad08b 100644 --- a/mg.h +++ b/mg.h @@ -30,9 +30,9 @@ struct magic { U16 mg_private; char mg_type; U8 mg_flags; + I32 mg_len; SV* mg_obj; char* mg_ptr; - I32 mg_len; }; #define MGf_TAINTEDDIR 1 /* PERL_MAGIC_envelem only */ diff --git a/parser.h b/parser.h index a78eafc..dd9f28e 100644 --- a/parser.h +++ b/parser.h @@ -25,8 +25,8 @@ typedef struct yy_parser { /* parser state */ struct yy_parser *old_parser; /* previous value of PL_parser */ - int yychar; /* The lookahead symbol. */ YYSTYPE yylval; /* value of lookahead symbol, set by yylex() */ + int yychar; /* The lookahead symbol. */ /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; @@ -47,9 +47,9 @@ typedef struct yy_parser { int lex_expect; /* expect after determined token */ I32 lex_formbrack; /* bracket count at outer format level */ OP *lex_inpat; /* in pattern $) and $| are special */ - I32 lex_inwhat; /* what kind of quoting are we in */ 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 */ 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 */ diff --git a/perl.h b/perl.h index bd77507..0571d3e 100644 --- a/perl.h +++ b/perl.h @@ -5013,8 +5013,8 @@ struct am_table { U32 flags; U32 was_ok_sub; long was_ok_am; - CV* table[NofAMmeth]; long fallback; + CV* table[NofAMmeth]; }; struct am_table_short { U32 flags;