Move the 12 static MAD variables from toke.c into the interpeter
Nicholas Clark [Fri, 10 Mar 2006 21:54:18 +0000 (21:54 +0000)]
structure.

p4raw-id: //depot/perl@27466

embedvar.h
intrpvar.h
makedef.pl
perl.c
perlapi.h
sv.c
toke.c

index 8312a12..64074c4 100644 (file)
 #define PL_cshlen              (vTHX->Icshlen)
 #define PL_cshname             (vTHX->Icshname)
 #define PL_curcopdb            (vTHX->Icurcopdb)
+#define PL_curforce            (vTHX->Icurforce)
 #define PL_curstname           (vTHX->Icurstname)
 #define PL_custom_op_descs     (vTHX->Icustom_op_descs)
 #define PL_custom_op_names     (vTHX->Icustom_op_names)
 #define PL_egid                        (vTHX->Iegid)
 #define PL_encoding            (vTHX->Iencoding)
 #define PL_endav               (vTHX->Iendav)
+#define PL_endwhite            (vTHX->Iendwhite)
 #define PL_envgv               (vTHX->Ienvgv)
 #define PL_errgv               (vTHX->Ierrgv)
 #define PL_error_count         (vTHX->Ierror_count)
 #define PL_exitlist            (vTHX->Iexitlist)
 #define PL_exitlistlen         (vTHX->Iexitlistlen)
 #define PL_expect              (vTHX->Iexpect)
+#define PL_faketokens          (vTHX->Ifaketokens)
 #define PL_fdpid               (vTHX->Ifdpid)
 #define PL_filemode            (vTHX->Ifilemode)
 #define PL_forkprocess         (vTHX->Iforkprocess)
 #define PL_nexttoke            (vTHX->Inexttoke)
 #define PL_nexttype            (vTHX->Inexttype)
 #define PL_nextval             (vTHX->Inextval)
+#define PL_nextwhite           (vTHX->Inextwhite)
 #define PL_nice_chunk          (vTHX->Inice_chunk)
 #define PL_nice_chunk_size     (vTHX->Inice_chunk_size)
 #define PL_nomemok             (vTHX->Inomemok)
 #define PL_psig_pend           (vTHX->Ipsig_pend)
 #define PL_psig_ptr            (vTHX->Ipsig_ptr)
 #define PL_ptr_table           (vTHX->Iptr_table)
+#define PL_realtokenstart      (vTHX->Irealtokenstart)
 #define PL_reentrant_buffer    (vTHX->Ireentrant_buffer)
 #define PL_reentrant_retint    (vTHX->Ireentrant_retint)
 #define PL_regex_pad           (vTHX->Iregex_pad)
 #define PL_sig_pending         (vTHX->Isig_pending)
 #define PL_sighandlerp         (vTHX->Isighandlerp)
 #define PL_signals             (vTHX->Isignals)
+#define PL_skipwhite           (vTHX->Iskipwhite)
 #define PL_sort_RealCmp                (vTHX->Isort_RealCmp)
 #define PL_splitstr            (vTHX->Isplitstr)
 #define PL_srand_called                (vTHX->Isrand_called)
 #define PL_sys_intern          (vTHX->Isys_intern)
 #define PL_taint_warn          (vTHX->Itaint_warn)
 #define PL_tainting            (vTHX->Itainting)
+#define PL_thisclose           (vTHX->Ithisclose)
+#define PL_thismad             (vTHX->Ithismad)
+#define PL_thisopen            (vTHX->Ithisopen)
+#define PL_thisstuff           (vTHX->Ithisstuff)
+#define PL_thistoken           (vTHX->Ithistoken)
+#define PL_thiswhite           (vTHX->Ithiswhite)
 #define PL_threadhook          (vTHX->Ithreadhook)
 #define PL_tokenbuf            (vTHX->Itokenbuf)
 #define PL_uid                 (vTHX->Iuid)
 #define PL_Icshlen             PL_cshlen
 #define PL_Icshname            PL_cshname
 #define PL_Icurcopdb           PL_curcopdb
+#define PL_Icurforce           PL_curforce
 #define PL_Icurstname          PL_curstname
 #define PL_Icustom_op_descs    PL_custom_op_descs
 #define PL_Icustom_op_names    PL_custom_op_names
 #define PL_Iegid               PL_egid
 #define PL_Iencoding           PL_encoding
 #define PL_Iendav              PL_endav
+#define PL_Iendwhite           PL_endwhite
 #define PL_Ienvgv              PL_envgv
 #define PL_Ierrgv              PL_errgv
 #define PL_Ierror_count                PL_error_count
 #define PL_Iexitlist           PL_exitlist
 #define PL_Iexitlistlen                PL_exitlistlen
 #define PL_Iexpect             PL_expect
+#define PL_Ifaketokens         PL_faketokens
 #define PL_Ifdpid              PL_fdpid
 #define PL_Ifilemode           PL_filemode
 #define PL_Iforkprocess                PL_forkprocess
 #define PL_Inexttoke           PL_nexttoke
 #define PL_Inexttype           PL_nexttype
 #define PL_Inextval            PL_nextval
+#define PL_Inextwhite          PL_nextwhite
 #define PL_Inice_chunk         PL_nice_chunk
 #define PL_Inice_chunk_size    PL_nice_chunk_size
 #define PL_Inomemok            PL_nomemok
 #define PL_Ipsig_pend          PL_psig_pend
 #define PL_Ipsig_ptr           PL_psig_ptr
 #define PL_Iptr_table          PL_ptr_table
+#define PL_Irealtokenstart     PL_realtokenstart
 #define PL_Ireentrant_buffer   PL_reentrant_buffer
 #define PL_Ireentrant_retint   PL_reentrant_retint
 #define PL_Iregex_pad          PL_regex_pad
 #define PL_Isig_pending                PL_sig_pending
 #define PL_Isighandlerp                PL_sighandlerp
 #define PL_Isignals            PL_signals
+#define PL_Iskipwhite          PL_skipwhite
 #define PL_Isort_RealCmp       PL_sort_RealCmp
 #define PL_Isplitstr           PL_splitstr
 #define PL_Isrand_called       PL_srand_called
 #define PL_Isys_intern         PL_sys_intern
 #define PL_Itaint_warn         PL_taint_warn
 #define PL_Itainting           PL_tainting
+#define PL_Ithisclose          PL_thisclose
+#define PL_Ithismad            PL_thismad
+#define PL_Ithisopen           PL_thisopen
+#define PL_Ithisstuff          PL_thisstuff
+#define PL_Ithistoken          PL_thistoken
+#define PL_Ithiswhite          PL_thiswhite
 #define PL_Ithreadhook         PL_threadhook
 #define PL_Itokenbuf           PL_tokenbuf
 #define PL_Iuid                        PL_uid
index 6cdf894..3a48de5 100644 (file)
@@ -301,6 +301,18 @@ PERLVAR(Ilex_casestack,    char *)         /* what kind of case mods in effect */
 #ifdef PERL_MAD
 PERLVARA(Inexttoke,5,  NEXTTOKE)       /* value of next token, if any */
 PERLVAR(Ilasttoke,     I32)
+PERLVAR(Irealtokenstart,I32)
+PERLVAR(Ifaketokens,   I32)
+PERLVAR(Ithismad,      MADPROP *)
+PERLVAR(Ithistoken,    SV *)
+PERLVAR(Ithisopen,     SV *)
+PERLVAR(Ithisstuff,    SV *)
+PERLVAR(Ithisclose,    SV *)
+PERLVAR(Ithiswhite,    SV *)
+PERLVAR(Inextwhite,    SV *)
+PERLVAR(Iskipwhite,    SV *)
+PERLVAR(Iendwhite,     SV *)
+PERLVAR(Icurforce,     I32)
 #else
 PERLVARA(Inextval,5,   YYSTYPE)        /* value of next token, if any */
 PERLVARA(Inexttype,5,  I32)            /* type of next token */
index 5b4f930..6f20f12 100644 (file)
@@ -847,6 +847,18 @@ if ($define{'PERL_MAD'}) {
                    PL_madskills
                    PL_xmlfp
                    PL_lasttoke
+                   PL_realtokenstart
+                   PL_faketokens
+                   PL_thismad
+                   PL_thistoken
+                   PL_thisopen
+                   PL_thisstuff
+                   PL_thisclose
+                   PL_thiswhite
+                   PL_nextwhite
+                   PL_skipwhite
+                   PL_endwhite
+                   PL_curforce
                    Perl_pad_peg
                    Perl_xmldump_indent
                    Perl_xmldump_vindent
diff --git a/perl.c b/perl.c
index c152a39..2ffbb17 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -389,6 +389,10 @@ perl_construct(pTHXx)
     PL_timesbase.tms_cstime = 0;
 #endif
 
+#ifdef PERL_MAD
+    PL_curforce = -1;
+#endif
+
     ENTER;
 }
 
index 11a7039..de8ecb6 100644 (file)
--- a/perlapi.h
+++ b/perlapi.h
@@ -228,6 +228,8 @@ END_EXTERN_C
 #define PL_cshname             (*Perl_Icshname_ptr(aTHX))
 #undef  PL_curcopdb
 #define PL_curcopdb            (*Perl_Icurcopdb_ptr(aTHX))
+#undef  PL_curforce
+#define PL_curforce            (*Perl_Icurforce_ptr(aTHX))
 #undef  PL_curstname
 #define PL_curstname           (*Perl_Icurstname_ptr(aTHX))
 #undef  PL_custom_op_descs
@@ -266,6 +268,8 @@ END_EXTERN_C
 #define PL_encoding            (*Perl_Iencoding_ptr(aTHX))
 #undef  PL_endav
 #define PL_endav               (*Perl_Iendav_ptr(aTHX))
+#undef  PL_endwhite
+#define PL_endwhite            (*Perl_Iendwhite_ptr(aTHX))
 #undef  PL_envgv
 #define PL_envgv               (*Perl_Ienvgv_ptr(aTHX))
 #undef  PL_errgv
@@ -288,6 +292,8 @@ END_EXTERN_C
 #define PL_exitlistlen         (*Perl_Iexitlistlen_ptr(aTHX))
 #undef  PL_expect
 #define PL_expect              (*Perl_Iexpect_ptr(aTHX))
+#undef  PL_faketokens
+#define PL_faketokens          (*Perl_Ifaketokens_ptr(aTHX))
 #undef  PL_fdpid
 #define PL_fdpid               (*Perl_Ifdpid_ptr(aTHX))
 #undef  PL_filemode
@@ -452,6 +458,8 @@ END_EXTERN_C
 #define PL_nexttype            (*Perl_Inexttype_ptr(aTHX))
 #undef  PL_nextval
 #define PL_nextval             (*Perl_Inextval_ptr(aTHX))
+#undef  PL_nextwhite
+#define PL_nextwhite           (*Perl_Inextwhite_ptr(aTHX))
 #undef  PL_nice_chunk
 #define PL_nice_chunk          (*Perl_Inice_chunk_ptr(aTHX))
 #undef  PL_nice_chunk_size
@@ -526,6 +534,8 @@ END_EXTERN_C
 #define PL_psig_ptr            (*Perl_Ipsig_ptr_ptr(aTHX))
 #undef  PL_ptr_table
 #define PL_ptr_table           (*Perl_Iptr_table_ptr(aTHX))
+#undef  PL_realtokenstart
+#define PL_realtokenstart      (*Perl_Irealtokenstart_ptr(aTHX))
 #undef  PL_reentrant_buffer
 #define PL_reentrant_buffer    (*Perl_Ireentrant_buffer_ptr(aTHX))
 #undef  PL_reentrant_retint
@@ -562,6 +572,8 @@ END_EXTERN_C
 #define PL_sighandlerp         (*Perl_Isighandlerp_ptr(aTHX))
 #undef  PL_signals
 #define PL_signals             (*Perl_Isignals_ptr(aTHX))
+#undef  PL_skipwhite
+#define PL_skipwhite           (*Perl_Iskipwhite_ptr(aTHX))
 #undef  PL_sort_RealCmp
 #define PL_sort_RealCmp                (*Perl_Isort_RealCmp_ptr(aTHX))
 #undef  PL_splitstr
@@ -610,6 +622,18 @@ END_EXTERN_C
 #define PL_taint_warn          (*Perl_Itaint_warn_ptr(aTHX))
 #undef  PL_tainting
 #define PL_tainting            (*Perl_Itainting_ptr(aTHX))
+#undef  PL_thisclose
+#define PL_thisclose           (*Perl_Ithisclose_ptr(aTHX))
+#undef  PL_thismad
+#define PL_thismad             (*Perl_Ithismad_ptr(aTHX))
+#undef  PL_thisopen
+#define PL_thisopen            (*Perl_Ithisopen_ptr(aTHX))
+#undef  PL_thisstuff
+#define PL_thisstuff           (*Perl_Ithisstuff_ptr(aTHX))
+#undef  PL_thistoken
+#define PL_thistoken           (*Perl_Ithistoken_ptr(aTHX))
+#undef  PL_thiswhite
+#define PL_thiswhite           (*Perl_Ithiswhite_ptr(aTHX))
 #undef  PL_threadhook
 #define PL_threadhook          (*Perl_Ithreadhook_ptr(aTHX))
 #undef  PL_tokenbuf
diff --git a/sv.c b/sv.c
index 846f812..e5e997c 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -10911,6 +10911,18 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags,
 #ifdef PERL_MAD
     Copy(proto_perl->Inexttoke, PL_nexttoke, 5, NEXTTOKE);
     PL_lasttoke                = proto_perl->Ilasttoke;
+    PL_realtokenstart  = proto_perl->Irealtokenstart;
+    PL_faketokens      = proto_perl->Ifaketokens;
+    PL_thismad         = proto_perl->Ithismad;
+    PL_thistoken       = proto_perl->Ithistoken;
+    PL_thisopen                = proto_perl->Ithisopen;
+    PL_thisstuff       = proto_perl->Ithisstuff;
+    PL_thisclose       = proto_perl->Ithisclose;
+    PL_thiswhite       = proto_perl->Ithiswhite;
+    PL_nextwhite       = proto_perl->Inextwhite;
+    PL_skipwhite       = proto_perl->Iskipwhite;
+    PL_endwhite                = proto_perl->Iendwhite;
+    PL_curforce                = proto_perl->Icurforce;
 #else
     Copy(proto_perl->Inextval, PL_nextval, 5, YYSTYPE);
     Copy(proto_perl->Inexttype, PL_nexttype, 5,        I32);
diff --git a/toke.c b/toke.c
index fe530bc..3a3afe5 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -36,20 +36,6 @@ static I32 utf16rev_textfilter(pTHX_ int idx, SV *sv, int maxlen);
 #endif
 
 #ifdef PERL_MAD
-/* XXX these probably need to be made into PL vars */
-static I32 PL_realtokenstart;
-static I32 PL_faketokens = 0;
-static MADPROP *PL_thismad;
-static SV *PL_thistoken;
-static SV *PL_thisopen;
-static SV *PL_thisstuff;
-static SV *PL_thisclose;
-static SV *PL_thiswhite;
-static SV *PL_nextwhite;
-static SV *PL_skipwhite;
-static SV *PL_endwhite;
-static I32 PL_curforce = -1;
-
 #  define CURMAD(slot,sv) if (PL_madskills) { curmad(slot,sv); sv = 0; }
 #  define NEXTVAL_NEXTTOKE PL_nexttoke[PL_curforce].next_val
 #else