B && BEGIN handling
James A. Duncan [Mon, 6 Aug 2001 17:29:11 +0000 (18:29 +0100)]
Message-ID: <20010806172911.A2071@fotango.com>

(the intrpvar.h addition moved to the end for bincompat)

p4raw-id: //depot/perl@11601

embedvar.h
ext/B/B.xs
intrpvar.h
perl.c
perlapi.h

index f6d6aac..d0a7ec4 100644 (file)
 #define PL_rsfp                        (PERL_GET_INTERP->Irsfp)
 #define PL_rsfp_filters                (PERL_GET_INTERP->Irsfp_filters)
 #define PL_runops              (PERL_GET_INTERP->Irunops)
+#define PL_savebegin           (PERL_GET_INTERP->Isavebegin)
 #define PL_sawampersand                (PERL_GET_INTERP->Isawampersand)
 #define PL_sh_path             (PERL_GET_INTERP->Ish_path)
 #define PL_sig_pending         (PERL_GET_INTERP->Isig_pending)
 #define PL_rsfp                        (vTHX->Irsfp)
 #define PL_rsfp_filters                (vTHX->Irsfp_filters)
 #define PL_runops              (vTHX->Irunops)
+#define PL_savebegin           (vTHX->Isavebegin)
 #define PL_sawampersand                (vTHX->Isawampersand)
 #define PL_sh_path             (vTHX->Ish_path)
 #define PL_sig_pending         (vTHX->Isig_pending)
 #define PL_rsfp                        (aTHXo->interp.Irsfp)
 #define PL_rsfp_filters                (aTHXo->interp.Irsfp_filters)
 #define PL_runops              (aTHXo->interp.Irunops)
+#define PL_savebegin           (aTHXo->interp.Isavebegin)
 #define PL_sawampersand                (aTHXo->interp.Isawampersand)
 #define PL_sh_path             (aTHXo->interp.Ish_path)
 #define PL_sig_pending         (aTHXo->interp.Isig_pending)
 #define PL_Irsfp               PL_rsfp
 #define PL_Irsfp_filters       PL_rsfp_filters
 #define PL_Irunops             PL_runops
+#define PL_Isavebegin          PL_savebegin
 #define PL_Isawampersand       PL_sawampersand
 #define PL_Ish_path            PL_sh_path
 #define PL_Isig_pending                PL_sig_pending
index df53d9a..c3ce0ed 100644 (file)
@@ -528,7 +528,7 @@ minus_c()
 void
 save_BEGINs()
     CODE:
-       PL_minus_c |= 0x10;
+       PL_savebegin = TRUE;
 
 SV *
 cstring(sv)
index 4e92302..4fa7374 100644 (file)
@@ -476,18 +476,17 @@ PERLVAR(Inumeric_radix_sv,        SV *)   /* The radix separator if not '.' */
 #endif
 
 #if defined(USE_ITHREADS)
-PERLVAR(Iregex_pad,     SV**)    /* All regex objects */
-PERLVAR(Iregex_padav,   AV*)    /* All regex objects */
+PERLVAR(Iregex_pad,     SV**)          /* All regex objects */
+PERLVAR(Iregex_padav,   AV*)           /* All regex objects */
 
 #ifdef USE_REENTRANT_API
-PERLVAR(Ireentrant_buffer, REBUF*) /* were we store _r buffers */
+PERLVAR(Ireentrant_buffer, REBUF*)     /* here we store the _r buffers */
 #endif
 
 #endif
 
+PERLVAR(Isavebegin,     bool)  /* save BEGINs for compiler     */
+
 /* New variables must be added to the very end for binary compatibility.
  * XSUB.h provides wrapper functions via perlapi.h that make this
  * irrelevant, but not all code may be expected to #include XSUB.h. */
-
-
-
diff --git a/perl.c b/perl.c
index 28e8761..17fbac4 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -3860,7 +3860,7 @@ Perl_call_list(pTHX_ I32 oldscope, AV *paramList)
 
     while (AvFILL(paramList) >= 0) {
        cv = (CV*)av_shift(paramList);
-       if ((PL_minus_c & 0x10) && (paramList == PL_beginav)) {
+       if (PL_savebegin && (paramList == PL_beginav)) {
                /* save PL_beginav for compiler */
            if (! PL_beginav_save)
                PL_beginav_save = newAV();
index 71384ac..6a5a6c7 100644 (file)
--- a/perlapi.h
+++ b/perlapi.h
@@ -472,6 +472,8 @@ START_EXTERN_C
 #define PL_rsfp_filters                (*Perl_Irsfp_filters_ptr(aTHXo))
 #undef  PL_runops
 #define PL_runops              (*Perl_Irunops_ptr(aTHXo))
+#undef  PL_savebegin
+#define PL_savebegin           (*Perl_Isavebegin_ptr(aTHXo))
 #undef  PL_sawampersand
 #define PL_sawampersand                (*Perl_Isawampersand_ptr(aTHXo))
 #undef  PL_sh_path