This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Move all the regexp state variables into a single structure.
authorNicholas Clark <nick@ccl4.org>
Thu, 6 Apr 2006 15:52:37 +0000 (15:52 +0000)
committerNicholas Clark <nick@ccl4.org>
Thu, 6 Apr 2006 15:52:37 +0000 (15:52 +0000)
This allows it to be saved, restored and cloned with a single Copy()
(but inevitably still some fixup)

p4raw-id: //depot/perl@27732

embedvar.h
perl.c
perlapi.h
regcomp.c
regexp.h
scope.c
sv.c
thrdvar.h

index 5440e62..041d8fd 100644 (file)
@@ -44,7 +44,6 @@
 #define PL_Xpv                 (vTHX->TXpv)
 #define PL_av_fetch_sv         (vTHX->Tav_fetch_sv)
 #define PL_bodytarget          (vTHX->Tbodytarget)
-#define PL_bostr               (vTHX->Tbostr)
 #define PL_chopset             (vTHX->Tchopset)
 #define PL_colors              (vTHX->Tcolors)
 #define PL_colorset            (vTHX->Tcolorset)
 #define PL_maxscream           (vTHX->Tmaxscream)
 #define PL_modcount            (vTHX->Tmodcount)
 #define PL_na                  (vTHX->Tna)
-#define PL_nrs                 (vTHX->Tnrs)
 #define PL_ofs_sv              (vTHX->Tofs_sv)
 #define PL_op                  (vTHX->Top)
 #define PL_opsave              (vTHX->Topsave)
 #define PL_peepp               (vTHX->Tpeepp)
-#define PL_reg_call_cc         (vTHX->Treg_call_cc)
-#define PL_reg_curpm           (vTHX->Treg_curpm)
-#define PL_reg_eval_set                (vTHX->Treg_eval_set)
-#define PL_reg_flags           (vTHX->Treg_flags)
-#define PL_reg_ganch           (vTHX->Treg_ganch)
-#define PL_reg_leftiter                (vTHX->Treg_leftiter)
-#define PL_reg_magic           (vTHX->Treg_magic)
-#define PL_reg_match_utf8      (vTHX->Treg_match_utf8)
-#define PL_reg_maxiter         (vTHX->Treg_maxiter)
-#define PL_reg_oldcurpm                (vTHX->Treg_oldcurpm)
-#define PL_reg_oldpos          (vTHX->Treg_oldpos)
-#define PL_reg_oldsaved                (vTHX->Treg_oldsaved)
-#define PL_reg_oldsavedlen     (vTHX->Treg_oldsavedlen)
-#define PL_reg_poscache                (vTHX->Treg_poscache)
-#define PL_reg_poscache_size   (vTHX->Treg_poscache_size)
-#define PL_reg_re              (vTHX->Treg_re)
-#define PL_reg_start_tmp       (vTHX->Treg_start_tmp)
-#define PL_reg_start_tmpl      (vTHX->Treg_start_tmpl)
-#define PL_reg_starttry                (vTHX->Treg_starttry)
-#define PL_reg_sv              (vTHX->Treg_sv)
-#define PL_regbol              (vTHX->Tregbol)
+#define PL_reg_state           (vTHX->Treg_state)
 #define PL_regcompp            (vTHX->Tregcompp)
 #define PL_regdummy            (vTHX->Tregdummy)
-#define PL_regendp             (vTHX->Tregendp)
-#define PL_regeol              (vTHX->Tregeol)
 #define PL_regexecp            (vTHX->Tregexecp)
 #define PL_regfree             (vTHX->Tregfree)
-#define PL_regindent           (vTHX->Tregindent)
-#define PL_reginput            (vTHX->Treginput)
 #define PL_regint_start                (vTHX->Tregint_start)
 #define PL_regint_string       (vTHX->Tregint_string)
 #define PL_reginterp_cnt       (vTHX->Treginterp_cnt)
-#define PL_reglastcloseparen   (vTHX->Treglastcloseparen)
-#define PL_reglastparen                (vTHX->Treglastparen)
 #define PL_regmatch_slab       (vTHX->Tregmatch_slab)
 #define PL_regmatch_state      (vTHX->Tregmatch_state)
-#define PL_regnarrate          (vTHX->Tregnarrate)
-#define PL_regsize             (vTHX->Tregsize)
-#define PL_regstartp           (vTHX->Tregstartp)
-#define PL_regtill             (vTHX->Tregtill)
 #define PL_restartop           (vTHX->Trestartop)
 #define PL_rs                  (vTHX->Trs)
 #define PL_savestack           (vTHX->Tsavestack)
 #define PL_TXpv                        PL_Xpv
 #define PL_Tav_fetch_sv                PL_av_fetch_sv
 #define PL_Tbodytarget         PL_bodytarget
-#define PL_Tbostr              PL_bostr
 #define PL_Tchopset            PL_chopset
 #define PL_Tcolors             PL_colors
 #define PL_Tcolorset           PL_colorset
 #define PL_Tmaxscream          PL_maxscream
 #define PL_Tmodcount           PL_modcount
 #define PL_Tna                 PL_na
-#define PL_Tnrs                        PL_nrs
 #define PL_Tofs_sv             PL_ofs_sv
 #define PL_Top                 PL_op
 #define PL_Topsave             PL_opsave
 #define PL_Tpeepp              PL_peepp
-#define PL_Treg_call_cc                PL_reg_call_cc
-#define PL_Treg_curpm          PL_reg_curpm
-#define PL_Treg_eval_set       PL_reg_eval_set
-#define PL_Treg_flags          PL_reg_flags
-#define PL_Treg_ganch          PL_reg_ganch
-#define PL_Treg_leftiter       PL_reg_leftiter
-#define PL_Treg_magic          PL_reg_magic
-#define PL_Treg_match_utf8     PL_reg_match_utf8
-#define PL_Treg_maxiter                PL_reg_maxiter
-#define PL_Treg_oldcurpm       PL_reg_oldcurpm
-#define PL_Treg_oldpos         PL_reg_oldpos
-#define PL_Treg_oldsaved       PL_reg_oldsaved
-#define PL_Treg_oldsavedlen    PL_reg_oldsavedlen
-#define PL_Treg_poscache       PL_reg_poscache
-#define PL_Treg_poscache_size  PL_reg_poscache_size
-#define PL_Treg_re             PL_reg_re
-#define PL_Treg_start_tmp      PL_reg_start_tmp
-#define PL_Treg_start_tmpl     PL_reg_start_tmpl
-#define PL_Treg_starttry       PL_reg_starttry
-#define PL_Treg_sv             PL_reg_sv
-#define PL_Tregbol             PL_regbol
+#define PL_Treg_state          PL_reg_state
 #define PL_Tregcompp           PL_regcompp
 #define PL_Tregdummy           PL_regdummy
-#define PL_Tregendp            PL_regendp
-#define PL_Tregeol             PL_regeol
 #define PL_Tregexecp           PL_regexecp
 #define PL_Tregfree            PL_regfree
-#define PL_Tregindent          PL_regindent
-#define PL_Treginput           PL_reginput
 #define PL_Tregint_start       PL_regint_start
 #define PL_Tregint_string      PL_regint_string
 #define PL_Treginterp_cnt      PL_reginterp_cnt
-#define PL_Treglastcloseparen  PL_reglastcloseparen
-#define PL_Treglastparen       PL_reglastparen
 #define PL_Tregmatch_slab      PL_regmatch_slab
 #define PL_Tregmatch_state     PL_regmatch_state
-#define PL_Tregnarrate         PL_regnarrate
-#define PL_Tregsize            PL_regsize
-#define PL_Tregstartp          PL_regstartp
-#define PL_Tregtill            PL_regtill
 #define PL_Trestartop          PL_restartop
 #define PL_Trs                 PL_rs
 #define PL_Tsavestack          PL_savestack
diff --git a/perl.c b/perl.c
index 8af44cc..8278442 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -3471,6 +3471,10 @@ S_init_interp(pTHX)
 #  undef PERLVARIC
 #endif
 
+    /* As these are inside a structure, PERLVARI isn't capable of initialising
+       them  */
+    PL_regindent = 0;
+    PL_reg_oldcurpm = PL_reg_curpm = PL_reg_poscache = PL_reg_starttry = NULL;
 }
 
 STATIC void
index 27578ac..cc6ce88 100644 (file)
--- a/perlapi.h
+++ b/perlapi.h
@@ -708,8 +708,6 @@ END_EXTERN_C
 #define PL_av_fetch_sv         (*Perl_Tav_fetch_sv_ptr(aTHX))
 #undef  PL_bodytarget
 #define PL_bodytarget          (*Perl_Tbodytarget_ptr(aTHX))
-#undef  PL_bostr
-#define PL_bostr               (*Perl_Tbostr_ptr(aTHX))
 #undef  PL_chopset
 #define PL_chopset             (*Perl_Tchopset_ptr(aTHX))
 #undef  PL_colors
@@ -776,8 +774,6 @@ END_EXTERN_C
 #define PL_modcount            (*Perl_Tmodcount_ptr(aTHX))
 #undef  PL_na
 #define PL_na                  (*Perl_Tna_ptr(aTHX))
-#undef  PL_nrs
-#define PL_nrs                 (*Perl_Tnrs_ptr(aTHX))
 #undef  PL_ofs_sv
 #define PL_ofs_sv              (*Perl_Tofs_sv_ptr(aTHX))
 #undef  PL_op
@@ -786,86 +782,26 @@ END_EXTERN_C
 #define PL_opsave              (*Perl_Topsave_ptr(aTHX))
 #undef  PL_peepp
 #define PL_peepp               (*Perl_Tpeepp_ptr(aTHX))
-#undef  PL_reg_call_cc
-#define PL_reg_call_cc         (*Perl_Treg_call_cc_ptr(aTHX))
-#undef  PL_reg_curpm
-#define PL_reg_curpm           (*Perl_Treg_curpm_ptr(aTHX))
-#undef  PL_reg_eval_set
-#define PL_reg_eval_set                (*Perl_Treg_eval_set_ptr(aTHX))
-#undef  PL_reg_flags
-#define PL_reg_flags           (*Perl_Treg_flags_ptr(aTHX))
-#undef  PL_reg_ganch
-#define PL_reg_ganch           (*Perl_Treg_ganch_ptr(aTHX))
-#undef  PL_reg_leftiter
-#define PL_reg_leftiter                (*Perl_Treg_leftiter_ptr(aTHX))
-#undef  PL_reg_magic
-#define PL_reg_magic           (*Perl_Treg_magic_ptr(aTHX))
-#undef  PL_reg_match_utf8
-#define PL_reg_match_utf8      (*Perl_Treg_match_utf8_ptr(aTHX))
-#undef  PL_reg_maxiter
-#define PL_reg_maxiter         (*Perl_Treg_maxiter_ptr(aTHX))
-#undef  PL_reg_oldcurpm
-#define PL_reg_oldcurpm                (*Perl_Treg_oldcurpm_ptr(aTHX))
-#undef  PL_reg_oldpos
-#define PL_reg_oldpos          (*Perl_Treg_oldpos_ptr(aTHX))
-#undef  PL_reg_oldsaved
-#define PL_reg_oldsaved                (*Perl_Treg_oldsaved_ptr(aTHX))
-#undef  PL_reg_oldsavedlen
-#define PL_reg_oldsavedlen     (*Perl_Treg_oldsavedlen_ptr(aTHX))
-#undef  PL_reg_poscache
-#define PL_reg_poscache                (*Perl_Treg_poscache_ptr(aTHX))
-#undef  PL_reg_poscache_size
-#define PL_reg_poscache_size   (*Perl_Treg_poscache_size_ptr(aTHX))
-#undef  PL_reg_re
-#define PL_reg_re              (*Perl_Treg_re_ptr(aTHX))
-#undef  PL_reg_start_tmp
-#define PL_reg_start_tmp       (*Perl_Treg_start_tmp_ptr(aTHX))
-#undef  PL_reg_start_tmpl
-#define PL_reg_start_tmpl      (*Perl_Treg_start_tmpl_ptr(aTHX))
-#undef  PL_reg_starttry
-#define PL_reg_starttry                (*Perl_Treg_starttry_ptr(aTHX))
-#undef  PL_reg_sv
-#define PL_reg_sv              (*Perl_Treg_sv_ptr(aTHX))
-#undef  PL_regbol
-#define PL_regbol              (*Perl_Tregbol_ptr(aTHX))
+#undef  PL_reg_state
+#define PL_reg_state           (*Perl_Treg_state_ptr(aTHX))
 #undef  PL_regcompp
 #define PL_regcompp            (*Perl_Tregcompp_ptr(aTHX))
 #undef  PL_regdummy
 #define PL_regdummy            (*Perl_Tregdummy_ptr(aTHX))
-#undef  PL_regendp
-#define PL_regendp             (*Perl_Tregendp_ptr(aTHX))
-#undef  PL_regeol
-#define PL_regeol              (*Perl_Tregeol_ptr(aTHX))
 #undef  PL_regexecp
 #define PL_regexecp            (*Perl_Tregexecp_ptr(aTHX))
 #undef  PL_regfree
 #define PL_regfree             (*Perl_Tregfree_ptr(aTHX))
-#undef  PL_regindent
-#define PL_regindent           (*Perl_Tregindent_ptr(aTHX))
-#undef  PL_reginput
-#define PL_reginput            (*Perl_Treginput_ptr(aTHX))
 #undef  PL_regint_start
 #define PL_regint_start                (*Perl_Tregint_start_ptr(aTHX))
 #undef  PL_regint_string
 #define PL_regint_string       (*Perl_Tregint_string_ptr(aTHX))
 #undef  PL_reginterp_cnt
 #define PL_reginterp_cnt       (*Perl_Treginterp_cnt_ptr(aTHX))
-#undef  PL_reglastcloseparen
-#define PL_reglastcloseparen   (*Perl_Treglastcloseparen_ptr(aTHX))
-#undef  PL_reglastparen
-#define PL_reglastparen                (*Perl_Treglastparen_ptr(aTHX))
 #undef  PL_regmatch_slab
 #define PL_regmatch_slab       (*Perl_Tregmatch_slab_ptr(aTHX))
 #undef  PL_regmatch_state
 #define PL_regmatch_state      (*Perl_Tregmatch_state_ptr(aTHX))
-#undef  PL_regnarrate
-#define PL_regnarrate          (*Perl_Tregnarrate_ptr(aTHX))
-#undef  PL_regsize
-#define PL_regsize             (*Perl_Tregsize_ptr(aTHX))
-#undef  PL_regstartp
-#define PL_regstartp           (*Perl_Tregstartp_ptr(aTHX))
-#undef  PL_regtill
-#define PL_regtill             (*Perl_Tregtill_ptr(aTHX))
 #undef  PL_restartop
 #define PL_restartop           (*Perl_Trestartop_ptr(aTHX))
 #undef  PL_rs
index 982fc7d..9ec5784 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -6177,43 +6177,7 @@ Perl_save_re_context(pTHX)
     PL_savestack_ix += SAVESTACK_ALLOC_FOR_RE_SAVE_STATE;
     SSPUSHINT(SAVEt_RE_STATE);
 
-    state->re_state_reg_flags = PL_reg_flags;
-    state->re_state_bostr = PL_bostr;
-    state->re_state_reginput = PL_reginput;
-    state->re_state_regbol = PL_regbol;
-    state->re_state_regeol = PL_regeol;
-    state->re_state_regstartp = PL_regstartp;
-    state->re_state_regendp = PL_regendp;
-    state->re_state_reglastparen = PL_reglastparen;
-    state->re_state_reglastcloseparen = PL_reglastcloseparen;
-    state->re_state_regtill = PL_regtill;
-    state->re_state_reg_start_tmp = PL_reg_start_tmp;
-    state->re_state_reg_start_tmpl = PL_reg_start_tmpl;
-    state->re_state_reg_eval_set = PL_reg_eval_set;
-    state->re_state_regnarrate = PL_regnarrate;
-    state->re_state_regindent = PL_regindent;
-    state->re_state_reg_call_cc = PL_reg_call_cc;
-    state->re_state_reg_re = PL_reg_re;
-    state->re_state_reg_ganch = PL_reg_ganch;
-    state->re_state_reg_sv = PL_reg_sv;
-    state->re_state_reg_match_utf8 = PL_reg_match_utf8;
-    state->re_state_reg_magic = PL_reg_magic;
-    state->re_state_reg_oldpos = PL_reg_oldpos;
-    state->re_state_reg_oldcurpm = PL_reg_oldcurpm;
-    state->re_state_reg_curpm = PL_reg_curpm;
-    state->re_state_reg_oldsaved = PL_reg_oldsaved;
-    state->re_state_reg_oldsavedlen = PL_reg_oldsavedlen;
-    state->re_state_reg_maxiter = PL_reg_maxiter;
-    state->re_state_reg_leftiter = PL_reg_leftiter;
-    state->re_state_reg_poscache = PL_reg_poscache;
-    state->re_state_reg_poscache_size = PL_reg_poscache_size;
-    state->re_state_regsize = PL_regsize;
-#ifdef DEBUGGING
-    state->re_state_reg_starttry = PL_reg_starttry;
-#endif
-#ifdef PERL_OLD_COPY_ON_WRITE
-    state->re_state_nrs = PL_nrs;
-#endif
+    Copy(&PL_reg_state, state, 1, struct re_save_state);
 
     PL_reg_start_tmp = 0;
     PL_reg_start_tmpl = 0;
@@ -6246,10 +6210,6 @@ Perl_save_re_context(pTHX)
            }
        }
     }
-
-#ifdef DEBUGGING
-    SAVEPPTR(PL_reg_starttry);         /* from regexec.c */
-#endif
 }
 
 static void
index 178feca..57f8d5d 100644 (file)
--- a/regexp.h
+++ b/regexp.h
@@ -288,6 +288,40 @@ typedef struct regmatch_slab {
     struct regmatch_slab *prev, *next;
 } regmatch_slab;
 
+#define PL_reg_flags           PL_reg_state.re_state_reg_flags
+#define PL_bostr               PL_reg_state.re_state_bostr
+#define PL_reginput            PL_reg_state.re_state_reginput
+#define PL_regbol              PL_reg_state.re_state_regbol
+#define PL_regeol              PL_reg_state.re_state_regeol
+#define PL_regstartp           PL_reg_state.re_state_regstartp
+#define PL_regendp             PL_reg_state.re_state_regendp
+#define PL_reglastparen                PL_reg_state.re_state_reglastparen
+#define PL_reglastcloseparen   PL_reg_state.re_state_reglastcloseparen
+#define PL_regtill             PL_reg_state.re_state_regtill
+#define PL_reg_start_tmp       PL_reg_state.re_state_reg_start_tmp
+#define PL_reg_start_tmpl      PL_reg_state.re_state_reg_start_tmpl
+#define PL_reg_eval_set                PL_reg_state.re_state_reg_eval_set
+#define PL_regnarrate          PL_reg_state.re_state_regnarrate
+#define PL_regindent           PL_reg_state.re_state_regindent
+#define PL_reg_call_cc         PL_reg_state.re_state_reg_call_cc
+#define PL_reg_re              PL_reg_state.re_state_reg_re
+#define PL_reg_ganch           PL_reg_state.re_state_reg_ganch
+#define PL_reg_sv              PL_reg_state.re_state_reg_sv
+#define PL_reg_match_utf8      PL_reg_state.re_state_reg_match_utf8
+#define PL_reg_magic           PL_reg_state.re_state_reg_magic
+#define PL_reg_oldpos          PL_reg_state.re_state_reg_oldpos
+#define PL_reg_oldcurpm                PL_reg_state.re_state_reg_oldcurpm
+#define PL_reg_curpm           PL_reg_state.re_state_reg_curpm
+#define PL_reg_oldsaved                PL_reg_state.re_state_reg_oldsaved
+#define PL_reg_oldsavedlen     PL_reg_state.re_state_reg_oldsavedlen
+#define PL_reg_maxiter         PL_reg_state.re_state_reg_maxiter
+#define PL_reg_leftiter                PL_reg_state.re_state_reg_leftiter
+#define PL_reg_poscache                PL_reg_state.re_state_reg_poscache
+#define PL_reg_poscache_size   PL_reg_state.re_state_reg_poscache_size
+#define PL_regsize             PL_reg_state.re_state_regsize
+#define PL_reg_starttry                PL_reg_state.re_state_reg_starttry
+#define PL_nrs                 PL_reg_state.re_state_nrs
+
 struct re_save_state {
     U32 re_state_reg_flags;            /* from regexec.c */
     char *re_state_bostr;
@@ -322,7 +356,7 @@ struct re_save_state {
     I32 re_state_regsize;              /* from regexec.c */
     char *re_state_reg_starttry;       /* from regexec.c */
 #ifdef PERL_OLD_COPY_ON_WRITE
-    SV *re_state_nrs;
+    SV *re_state_nrs;                  /* was placeholder: unused since 5.8.0 (5.7.2 patch #12027 for bug ID 20010815.012). Used to save rx->saved_copy */
 #endif
 };
 
diff --git a/scope.c b/scope.c
index d7e4d5e..cec853e 100644 (file)
--- a/scope.c
+++ b/scope.c
@@ -992,49 +992,13 @@ Perl_leave_scope(pTHX_ I32 base)
                     - SAVESTACK_ALLOC_FOR_RE_SAVE_STATE);
                PL_savestack_ix -= SAVESTACK_ALLOC_FOR_RE_SAVE_STATE;
 
-               PL_reg_flags = state->re_state_reg_flags;
-               PL_bostr = state->re_state_bostr;
-               PL_reginput = state->re_state_reginput;
-               PL_regbol = state->re_state_regbol;
-               PL_regeol = state->re_state_regeol;
-               PL_regstartp = state->re_state_regstartp;
-               PL_regendp = state->re_state_regendp;
-               PL_reglastparen = state->re_state_reglastparen;
-               PL_reglastcloseparen = state->re_state_reglastcloseparen;
-               PL_regtill = state->re_state_regtill;
                if (PL_reg_start_tmp != state->re_state_reg_start_tmp) {
                    Safefree(PL_reg_start_tmp);
-                   PL_reg_start_tmp = state->re_state_reg_start_tmp;
                }
-               PL_reg_start_tmpl = state->re_state_reg_start_tmpl;
-               PL_reg_eval_set = state->re_state_reg_eval_set;
-               PL_regnarrate = state->re_state_regnarrate;
-               PL_regindent = state->re_state_regindent;
-               PL_reg_call_cc = state->re_state_reg_call_cc;
-               PL_reg_re = state->re_state_reg_re;
-               PL_reg_ganch = state->re_state_reg_ganch;
-               PL_reg_sv = state->re_state_reg_sv;
-               PL_reg_match_utf8 = state->re_state_reg_match_utf8;
-               PL_reg_magic = state->re_state_reg_magic;
-               PL_reg_oldpos = state->re_state_reg_oldpos;
-               PL_reg_oldcurpm = state->re_state_reg_oldcurpm;
-               PL_reg_curpm = state->re_state_reg_curpm;
-               PL_reg_oldsaved = state->re_state_reg_oldsaved;
-               PL_reg_oldsavedlen = state->re_state_reg_oldsavedlen;
-               PL_reg_maxiter = state->re_state_reg_maxiter;
-               PL_reg_leftiter = state->re_state_reg_leftiter;
                if (PL_reg_poscache != state->re_state_reg_poscache) {
                    Safefree(PL_reg_poscache);
-                   PL_reg_poscache = state->re_state_reg_poscache;
                }
-               PL_reg_poscache_size = state->re_state_reg_poscache_size;
-               PL_regsize = state->re_state_regsize;
-#ifdef DEBUGGING
-               PL_reg_starttry = state->re_state_reg_starttry;
-#endif
-#ifdef PERL_OLD_COPY_ON_WRITE
-               PL_nrs = state->re_state_nrs;
-#endif
+               Copy(state, &PL_reg_state, 1, struct re_save_state);
            }
            break;
        default:
diff --git a/sv.c b/sv.c
index acadce7..146012e 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -11432,42 +11432,8 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags,
     PL_watchok         = NULL;
 
     PL_regdummy                = proto_perl->Tregdummy;
-    PL_regsize         = 0;
     PL_colorset                = 0;            /* reinits PL_colors[] */
     /*PL_colors[6]     = {0,0,0,0,0,0};*/
-    PL_reginput                = NULL;
-    PL_regbol          = NULL;
-    PL_regeol          = NULL;
-    PL_regstartp       = (I32*)NULL;
-    PL_regendp         = (I32*)NULL;
-    PL_reglastparen    = (U32*)NULL;
-    PL_reglastcloseparen       = (U32*)NULL;
-    PL_regtill         = NULL;
-    PL_reg_start_tmp   = (char**)NULL;
-    PL_reg_start_tmpl  = 0;
-    PL_bostr           = NULL;
-    PL_reg_flags       = 0;
-    PL_reg_eval_set    = 0;
-    PL_regnarrate      = 0;
-    PL_regindent       = 0;
-    PL_reg_call_cc     = (struct re_cc_state*)NULL;
-    PL_reg_re          = (regexp*)NULL;
-    PL_reg_ganch       = NULL;
-    PL_reg_sv          = NULL;
-    PL_reg_match_utf8  = FALSE;
-    PL_reg_magic       = (MAGIC*)NULL;
-    PL_reg_oldpos      = 0;
-    PL_reg_oldcurpm    = (PMOP*)NULL;
-    PL_reg_curpm       = (PMOP*)NULL;
-    PL_reg_oldsaved    = NULL;
-    PL_reg_oldsavedlen = 0;
-#ifdef PERL_OLD_COPY_ON_WRITE
-    PL_nrs             = NULL;
-#endif
-    PL_reg_maxiter     = 0;
-    PL_reg_leftiter    = 0;
-    PL_reg_poscache    = NULL;
-    PL_reg_poscache_size= 0;
 
     /* RE engine - function pointers */
     PL_regcompp                = proto_perl->Tregcompp;
@@ -11475,9 +11441,8 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags,
     PL_regint_start    = proto_perl->Tregint_start;
     PL_regint_string   = proto_perl->Tregint_string;
     PL_regfree         = proto_perl->Tregfree;
-
+    Zero(&PL_reg_state, 1, struct re_save_state);
     PL_reginterp_cnt   = 0;
-    PL_reg_starttry    = 0;
     PL_regmatch_slab   = NULL;
 
     /* Pluggable optimizer */
index c626f5f..1b68a87 100644 (file)
--- a/thrdvar.h
+++ b/thrdvar.h
@@ -86,7 +86,6 @@ PERLVAR(Ttimesbuf,    struct tms)
 /* Fields used by magic variables such as $@, $/ and so on */
 PERLVAR(Ttainted,      bool)           /* using variables controlled by $< */
 PERLVAR(Tcurpm,                PMOP *)         /* what to do \ interps in REs from */
-PERLVAR(Tnrs,          SV *)           /* was placeholder: unused since 5.8.0 (5.7.2 patch #12027 for bug ID 20010815.012). Used to save rx->saved_copy */
 
 /*
 =for apidoc mn|SV*|PL_rs
@@ -159,40 +158,10 @@ PERLVAR(Tscreamnext,      I32 *)
 PERLVARI(Tmaxscream,   I32,    -1)
 PERLVAR(Tlastscream,   SV *)
 
+PERLVAR(Treg_state,    struct re_save_state)
 PERLVAR(Tregdummy,     regnode)        /* from regcomp.c */
-PERLVAR(Tregsize,      I32)            /* Code size. */
 PERLVAR(Tcolorset,     int)            /* from regcomp.c */
 PERLVARA(Tcolors,6,    char *)         /* from regcomp.c */
-PERLVAR(Treginput,     char *)         /* String-input pointer. */
-PERLVAR(Tregbol,       char *)         /* Beginning of input, for ^ check. */
-PERLVAR(Tregeol,       char *)         /* End of input, for $ check. */
-PERLVAR(Tregstartp,    I32 *)          /* Pointer to startp array. */
-PERLVAR(Tregendp,      I32 *)          /* Ditto for endp. */
-PERLVAR(Treglastparen, U32 *)          /* Similarly for lastparen. */
-PERLVAR(Treglastcloseparen, U32 *)     /* Similarly for lastcloseparen. */
-PERLVAR(Tregtill,      char *)         /* How far we are required to go. */
-PERLVAR(Treg_start_tmp,        char **)        /* from regexec.c */
-PERLVAR(Treg_start_tmpl,U32)           /* from regexec.c */
-                                       /* from regexec.c renamed was data */
-PERLVAR(Tbostr,                char *)         /* from regexec.c */
-PERLVAR(Treg_flags,    U32)            /* from regexec.c */
-PERLVAR(Treg_eval_set, I32)            /* from regexec.c */
-PERLVAR(Tregnarrate,   I32)            /* from regexec.c */
-PERLVARI(Tregindent,   int,        0)  /* from regexec.c */
-PERLVAR(Treg_call_cc,  struct re_cc_state *)   /* from regexec.c */
-PERLVAR(Treg_re,       regexp *)       /* from regexec.c */
-PERLVAR(Treg_ganch,    char *)         /* position of \G */
-PERLVAR(Treg_sv,       SV *)           /* what we match against */
-PERLVAR(Treg_magic,    MAGIC *)        /* pos-magic of what we match */
-PERLVAR(Treg_oldpos,   I32)            /* old pos of what we match */
-PERLVARI(Treg_oldcurpm,        PMOP*, NULL)    /* curpm before match */
-PERLVARI(Treg_curpm,   PMOP*, NULL)    /* curpm during match */
-PERLVAR(Treg_oldsaved, char*)          /* old saved substr during match */
-PERLVAR(Treg_oldsavedlen, STRLEN)      /* old length of saved substr during match */
-PERLVAR(Treg_maxiter,  I32)            /* max wait until caching pos */
-PERLVAR(Treg_leftiter, I32)            /* wait until caching pos */
-PERLVARI(Treg_poscache, char *, NULL)  /* cache of pos of WHILEM */
-PERLVAR(Treg_poscache_size, STRLEN)    /* size of pos cache of WHILEM */
 
 PERLVARI(Tpeepp,       peep_t, MEMBER_TO_FPTR(Perl_peep))
                                        /* Pointer to peephole optimizer */
@@ -208,15 +177,12 @@ PERLVARI(Tregfree,        regfree_t, MEMBER_TO_FPTR(Perl_pregfree))
                                        /* Pointer to REx free()er */
 
 PERLVARI(Treginterp_cnt,int,       0)  /* Whether "Regexp" was interpolated. */
-PERLVARI(Treg_starttry,        char *,     0)  /* -Dr: where regtry was called. */
 PERLVARI(Twatchaddr,   char **,    0)
 PERLVAR(Twatchok,      char *)
 
 /* Note that the variables below are all explicitly referenced in the code
  * as thr->whatever and therefore don't need the 'T' prefix. */
 
-PERLVAR(Treg_match_utf8,       bool)           /* was what we matched against utf8 */
-
 /* the currently active slab in a chain of slabs of regmatch states,
  * and the currently active state within that slab */