From: Nicholas Clark Date: Mon, 21 Jan 2008 17:50:03 +0000 (+0000) Subject: Eliminate the U8 sbu_once from struct subst, and shrink sbu_rflags from X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1ed74d04861891f5c39302fcdf4cef047509e873;p=p5sagit%2Fp5-mst-13.2.git Eliminate the U8 sbu_once from struct subst, and shrink sbu_rflags from I32 to U8, which reduces the size of the struct by at least 4 bytes. p4raw-id: //depot/perl@33035 --- diff --git a/cop.h b/cop.h index 7c4c721..b6e35e8 100644 --- a/cop.h +++ b/cop.h @@ -601,11 +601,10 @@ struct block { /* substitution context */ struct subst { U8 sbu_type; /* what kind of context this is */ - U8 sbu_once; /* Actually both booleans, but U8/U16 */ + U8 sbu_rflags; U16 sbu_rxtainted; /* matches struct block */ I32 sbu_iters; I32 sbu_maxiters; - I32 sbu_rflags; I32 sbu_oldsave; char * sbu_orig; SV * sbu_dstr; @@ -636,7 +635,6 @@ struct subst { cx->sb_maxiters = maxiters, \ cx->sb_rflags = r_flags, \ cx->sb_oldsave = oldsave, \ - cx->sb_once = once, \ cx->sb_rxtainted = rxtainted, \ cx->sb_orig = orig, \ cx->sb_dstr = dstr, \ @@ -646,11 +644,11 @@ struct subst { cx->sb_strend = strend, \ cx->sb_rxres = NULL, \ cx->sb_rx = rx, \ - cx->cx_type = CXt_SUBST; \ + cx->cx_type = CXt_SUBST | (once ? CXp_ONCE : 0); \ rxres_save(&cx->sb_rxres, rx); \ (void)ReREFCNT_inc(rx) -#define CxONCE(cx) (0 + cx->sb_once) +#define CxONCE(cx) ((cx)->cx_type & CXp_ONCE) #define POPSUBST(cx) cx = &cxstack[cxstack_ix--]; \ rxres_free(&cx->sb_rxres); \ @@ -698,6 +696,8 @@ struct context { # define CxPADLOOP(c) (((c)->cx_type & (CXt_LOOP|CXp_PADVAR)) \ == (CXt_LOOP|CXp_PADVAR)) #endif +/* private flags for CXt_SUBST */ +#define CXp_ONCE 0x10 /* What was sbu_once in struct subst */ #define CxTYPE(c) ((c)->cx_type & CXTYPEMASK) #define CxMULTICALL(c) (((c)->cx_type & CXp_MULTICALL) \ diff --git a/pp_hot.c b/pp_hot.c index 03eeb71..f1bf9d4 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -1227,7 +1227,7 @@ PP(pp_match) register const char *s; const char *strend; I32 global; - I32 r_flags = REXEC_CHECKED; + U8 r_flags = REXEC_CHECKED; const char *truebase; /* Start of string */ register REGEXP *rx = PM_GETRE(pm); bool rxtainted; @@ -2053,7 +2053,7 @@ PP(pp_subst) bool once; U8 rxtainted; char *orig; - I32 r_flags; + U8 r_flags; register REGEXP *rx = PM_GETRE(pm); STRLEN len; int force_on_match = 0;