partial MULTIPLICITY cleanup
authorGurusamy Sarathy <gsar@cpan.org>
Tue, 23 Jun 1998 09:03:46 +0000 (09:03 +0000)
committerGurusamy Sarathy <gsar@cpan.org>
Tue, 23 Jun 1998 09:03:46 +0000 (09:03 +0000)
p4raw-id: //depot/perl@1205

embedvar.h
interp.sym
intrpvar.h
perl.c
perlvars.h
proto.h
thrdvar.h

index ca1e065..e77abbc 100644 (file)
 #define cddir                  (curinterp->Icddir)
 #define colors                 (curinterp->Icolors)
 #define colorset               (curinterp->Icolorset)
+#define compcv                 (curinterp->Icompcv)
+#define compiling              (curinterp->Icompiling)
+#define comppad                        (curinterp->Icomppad)
+#define comppad_name           (curinterp->Icomppad_name)
+#define comppad_name_fill      (curinterp->Icomppad_name_fill)
+#define comppad_name_floor     (curinterp->Icomppad_name_floor)
 #define copline                        (curinterp->Icopline)
 #define curcopdb               (curinterp->Icurcopdb)
 #define curstname              (curinterp->Icurstname)
 #define preambleav             (curinterp->Ipreambleav)
 #define preambled              (curinterp->Ipreambled)
 #define preprocess             (curinterp->Ipreprocess)
+#define profiledata            (curinterp->Iprofiledata)
 #define reg_eval_set           (curinterp->Ireg_eval_set)
 #define reg_flags              (curinterp->Ireg_flags)
 #define reg_start_tmp          (curinterp->Ireg_start_tmp)
 #define regxend                        (curinterp->Iregxend)
 #define replgv                 (curinterp->Ireplgv)
 #define rightgv                        (curinterp->Irightgv)
+#define rsfp                   (curinterp->Irsfp)
+#define rsfp_filters           (curinterp->Irsfp_filters)
 #define sawampersand           (curinterp->Isawampersand)
 #define sawstudy               (curinterp->Isawstudy)
 #define sawvec                 (curinterp->Isawvec)
 #define Icddir                 cddir
 #define Icolors                        colors
 #define Icolorset              colorset
+#define Icompcv                        compcv
+#define Icompiling             compiling
+#define Icomppad               comppad
+#define Icomppad_name          comppad_name
+#define Icomppad_name_fill     comppad_name_fill
+#define Icomppad_name_floor    comppad_name_floor
 #define Icopline               copline
 #define Icurcopdb              curcopdb
 #define Icurstname             curstname
 #define Ipreambleav            preambleav
 #define Ipreambled             preambled
 #define Ipreprocess            preprocess
+#define Iprofiledata           profiledata
 #define Ireg_eval_set          reg_eval_set
 #define Ireg_flags             reg_flags
 #define Ireg_start_tmp         reg_start_tmp
 #define Iregxend               regxend
 #define Ireplgv                        replgv
 #define Irightgv               rightgv
+#define Irsfp                  rsfp
+#define Irsfp_filters          rsfp_filters
 #define Isawampersand          sawampersand
 #define Isawstudy              sawstudy
 #define Isawvec                        sawvec
 #define cddir                  Perl_cddir
 #define colors                 Perl_colors
 #define colorset               Perl_colorset
+#define compcv                 Perl_compcv
+#define compiling              Perl_compiling
+#define comppad                        Perl_comppad
+#define comppad_name           Perl_comppad_name
+#define comppad_name_fill      Perl_comppad_name_fill
+#define comppad_name_floor     Perl_comppad_name_floor
 #define copline                        Perl_copline
 #define curcopdb               Perl_curcopdb
 #define curstname              Perl_curstname
 #define preambleav             Perl_preambleav
 #define preambled              Perl_preambled
 #define preprocess             Perl_preprocess
+#define profiledata            Perl_profiledata
 #define reg_eval_set           Perl_reg_eval_set
 #define reg_flags              Perl_reg_flags
 #define reg_start_tmp          Perl_reg_start_tmp
 #define regxend                        Perl_regxend
 #define replgv                 Perl_replgv
 #define rightgv                        Perl_rightgv
+#define rsfp                   Perl_rsfp
+#define rsfp_filters           Perl_rsfp_filters
 #define sawampersand           Perl_sawampersand
 #define sawstudy               Perl_sawstudy
 #define sawvec                 Perl_sawvec
 #define collation_standard     (Perl_Vars.Gcollation_standard)
 #define collxfrm_base          (Perl_Vars.Gcollxfrm_base)
 #define collxfrm_mult          (Perl_Vars.Gcollxfrm_mult)
-#define compcv                 (Perl_Vars.Gcompcv)
-#define compiling              (Perl_Vars.Gcompiling)
-#define comppad                        (Perl_Vars.Gcomppad)
-#define comppad_name           (Perl_Vars.Gcomppad_name)
-#define comppad_name_fill      (Perl_Vars.Gcomppad_name_fill)
-#define comppad_name_floor     (Perl_Vars.Gcomppad_name_floor)
 #define cop_seqmax             (Perl_Vars.Gcop_seqmax)
 #define cryptseen              (Perl_Vars.Gcryptseen)
 #define cshlen                 (Perl_Vars.Gcshlen)
 #define nextval                        (Perl_Vars.Gnextval)
 #define nice_chunk             (Perl_Vars.Gnice_chunk)
 #define nice_chunk_size                (Perl_Vars.Gnice_chunk_size)
+#define ninterps               (Perl_Vars.Gninterps)
 #define nomemok                        (Perl_Vars.Gnomemok)
 #define nthreads               (Perl_Vars.Gnthreads)
 #define nthreads_cond          (Perl_Vars.Gnthreads_cond)
 #define padix_floor            (Perl_Vars.Gpadix_floor)
 #define patleave               (Perl_Vars.Gpatleave)
 #define pidstatus              (Perl_Vars.Gpidstatus)
-#define profiledata            (Perl_Vars.Gprofiledata)
-#define rsfp                   (Perl_Vars.Grsfp)
-#define rsfp_filters           (Perl_Vars.Grsfp_filters)
 #define runops                 (Perl_Vars.Grunops)
 #define sh_path                        (Perl_Vars.Gsh_path)
 #define sighandlerp            (Perl_Vars.Gsighandlerp)
 #define Gcollation_standard    collation_standard
 #define Gcollxfrm_base         collxfrm_base
 #define Gcollxfrm_mult         collxfrm_mult
-#define Gcompcv                        compcv
-#define Gcompiling             compiling
-#define Gcomppad               comppad
-#define Gcomppad_name          comppad_name
-#define Gcomppad_name_fill     comppad_name_fill
-#define Gcomppad_name_floor    comppad_name_floor
 #define Gcop_seqmax            cop_seqmax
 #define Gcryptseen             cryptseen
 #define Gcshlen                        cshlen
 #define Gnextval               nextval
 #define Gnice_chunk            nice_chunk
 #define Gnice_chunk_size       nice_chunk_size
+#define Gninterps              ninterps
 #define Gnomemok               nomemok
 #define Gnthreads              nthreads
 #define Gnthreads_cond         nthreads_cond
 #define Gpadix_floor           padix_floor
 #define Gpatleave              patleave
 #define Gpidstatus             pidstatus
-#define Gprofiledata           profiledata
-#define Grsfp                  rsfp
-#define Grsfp_filters          rsfp_filters
 #define Grunops                        runops
 #define Gsh_path               sh_path
 #define Gsighandlerp           sighandlerp
 #define collation_standard     Perl_collation_standard
 #define collxfrm_base          Perl_collxfrm_base
 #define collxfrm_mult          Perl_collxfrm_mult
-#define compcv                 Perl_compcv
-#define compiling              Perl_compiling
-#define comppad                        Perl_comppad
-#define comppad_name           Perl_comppad_name
-#define comppad_name_fill      Perl_comppad_name_fill
-#define comppad_name_floor     Perl_comppad_name_floor
 #define cop_seqmax             Perl_cop_seqmax
 #define cryptseen              Perl_cryptseen
 #define cshlen                 Perl_cshlen
 #define nextval                        Perl_nextval
 #define nice_chunk             Perl_nice_chunk
 #define nice_chunk_size                Perl_nice_chunk_size
+#define ninterps               Perl_ninterps
 #define nomemok                        Perl_nomemok
 #define nthreads               Perl_nthreads
 #define nthreads_cond          Perl_nthreads_cond
 #define padix_floor            Perl_padix_floor
 #define patleave               Perl_patleave
 #define pidstatus              Perl_pidstatus
-#define profiledata            Perl_profiledata
-#define rsfp                   Perl_rsfp
-#define rsfp_filters           Perl_rsfp_filters
 #define runops                 Perl_runops
 #define sh_path                        Perl_sh_path
 #define sighandlerp            Perl_sighandlerp
index 924b048..8e38117 100644 (file)
@@ -19,6 +19,12 @@ cddir
 chopset
 colors
 colorset
+compcv
+compiling
+comppad
+comppad_name
+comppad_name_fill
+comppad_name_floor
 copline
 curcop
 curcopdb
@@ -118,6 +124,7 @@ perl_destruct_level
 preambled
 preambleav
 preprocess
+profiledata
 reg_eval_set
 reg_flags
 reg_start_tmp
@@ -150,6 +157,8 @@ replgv
 restartop
 rightgv
 rs
+rsfp
+rsfp_filters
 regcomp_rx
 sawampersand
 sawstudy
index 5637f12..2ecde8d 100644 (file)
@@ -2,84 +2,96 @@
 /* Global only to current interpreter instance */
 /***********************************************/
 
+/* Don't forget to re-run embed.pl to propagate changes! */
+
+/* The 'I' prefix is only needed for vars that need appropriate #defines
+ * generated when built with or without MULTIPLICITY.  It is also used
+ * to generate the appropriate export list for win32.
+ *
+ * When building without MULTIPLICITY, these variables will be truly global.
+ *
+ * Avoid build-specific #ifdefs here, like DEBUGGING.  That way,
+ * we can keep binary compatibility of the curinterp structure */
+
 /* pseudo environmental stuff */
-PERLVAR(Iorigargc,     int)            
-PERLVAR(Iorigargv,     char **)                
-PERLVAR(Ienvgv,                GV *)           
-PERLVAR(Isiggv,                GV *)           
-PERLVAR(Iincgv,                GV *)           
-PERLVAR(Iorigfilename, char *)         
-PERLVAR(Idiehook,      SV *)           
-PERLVAR(Iwarnhook,     SV *)           
-PERLVAR(Iparsehook,    SV *)           
+PERLVAR(Iorigargc,     int)
+PERLVAR(Iorigargv,     char **)
+PERLVAR(Ienvgv,                GV *)
+PERLVAR(Isiggv,                GV *)
+PERLVAR(Iincgv,                GV *)
+PERLVAR(Iorigfilename, char *)
+PERLVAR(Idiehook,      SV *)
+PERLVAR(Iwarnhook,     SV *)
+PERLVAR(Iparsehook,    SV *)
 PERLVAR(Icddir,                char *)         /* switches */
-PERLVAR(Iminus_c,      bool)           
-PERLVAR(Ipatchlevel[10],char)          
-PERLVAR(Ilocalpatches, char **)                
-PERLVARI(Isplitstr,    char *, " ")    
-PERLVAR(Ipreprocess,   bool)           
-PERLVAR(Iminus_n,      bool)           
-PERLVAR(Iminus_p,      bool)           
-PERLVAR(Iminus_l,      bool)           
-PERLVAR(Iminus_a,      bool)           
-PERLVAR(Iminus_F,      bool)           
-PERLVAR(Idoswitches,   bool)           
-PERLVAR(Idowarn,       bool)           
-PERLVAR(Idoextract,    bool)           
+PERLVAR(Iminus_c,      bool)
+PERLVAR(Ipatchlevel[10],char)
+PERLVAR(Ilocalpatches, char **)
+PERLVARI(Isplitstr,    char *, " ")
+PERLVAR(Ipreprocess,   bool)
+PERLVAR(Iminus_n,      bool)
+PERLVAR(Iminus_p,      bool)
+PERLVAR(Iminus_l,      bool)
+PERLVAR(Iminus_a,      bool)
+PERLVAR(Iminus_F,      bool)
+PERLVAR(Idoswitches,   bool)
+PERLVAR(Idowarn,       bool)
+PERLVAR(Idoextract,    bool)
 PERLVAR(Isawampersand, bool)           /* must save all match strings */
 PERLVAR(Isawstudy,     bool)           /* do fbm_instr on all strings */
-PERLVAR(Isawvec,       bool)           
-PERLVAR(Iunsafe,       bool)           
-PERLVAR(Iinplace,      char *)         
-PERLVAR(Ie_script,     SV *)           
-PERLVAR(Iperldb,       U32)            
+PERLVAR(Isawvec,       bool)
+PERLVAR(Iunsafe,       bool)
+PERLVAR(Iinplace,      char *)
+PERLVAR(Ie_script,     SV *)
+PERLVAR(Iperldb,       U32)
 
 /* This value may be raised by extensions for testing purposes */
 /* 0=none, 1=full, 2=full with checks */
-PERLVARI(Iperl_destruct_level, int,    0)      
+PERLVARI(Iperl_destruct_level, int,    0)
 
 /* magical thingies */
 PERLVAR(Ibasetime,     Time_t)         /* $^T */
 PERLVAR(Iformfeed,     SV *)           /* $^L */
 
 
-PERLVARI(Imaxsysfd,    I32,    MAXSYSFD)       /* top fd to pass to subprocesses */
+PERLVARI(Imaxsysfd,    I32,    MAXSYSFD)
+                                       /* top fd to pass to subprocesses */
 PERLVAR(Imultiline,    int)            /* $*--do strings hold >1 line? */
 PERLVAR(Istatusvalue,  I32)            /* $? */
 #ifdef VMS
-PERLVAR(Istatusvalue_vms,      U32)            
+PERLVAR(Istatusvalue_vms,U32)
 #endif
 
-PERLVAR(Istatcache,    Stat_t) /* _ */
-PERLVAR(Istatgv,       GV *)           
-PERLVARI(Istatname,    SV *,   Nullsv) 
+PERLVAR(Istatcache,    Stat_t)         /* _ */
+PERLVAR(Istatgv,       GV *)
+PERLVARI(Istatname,    SV *,   Nullsv)
 
 /* shortcuts to various I/O objects */
-PERLVAR(Istdingv,      GV *)           
-PERLVAR(Idefgv,                GV *)           
-PERLVAR(Iargvgv,       GV *)           
-PERLVAR(Iargvoutgv,    GV *)           
+PERLVAR(Istdingv,      GV *)
+PERLVAR(Idefgv,                GV *)
+PERLVAR(Iargvgv,       GV *)
+PERLVAR(Iargvoutgv,    GV *)
 
 /* shortcuts to regexp stuff */
-PERLVAR(Ileftgv,       GV *)           
-PERLVAR(Iampergv,      GV *)           
-PERLVAR(Irightgv,      GV *)           
-PERLVAR(Iscreamfirst,  I32 *)          
-PERLVAR(Iscreamnext,   I32 *)          
-PERLVARI(Imaxscream,   I32,    -1)     
-PERLVAR(Ilastscream,   SV *)           
-PERLVAR(Ireplgv,       GV *)           
+PERLVAR(Ileftgv,       GV *)
+PERLVAR(Iampergv,      GV *)
+PERLVAR(Irightgv,      GV *)
+PERLVAR(Iscreamfirst,  I32 *)
+PERLVAR(Iscreamnext,   I32 *)
+PERLVARI(Imaxscream,   I32,    -1)
+PERLVAR(Ilastscream,   SV *)
+PERLVAR(Ireplgv,       GV *)
 
 /* shortcuts to misc objects */
-PERLVAR(Ierrgv,                GV *)           
+PERLVAR(Ierrgv,                GV *)
 
 /* shortcuts to debugging objects */
-PERLVAR(IDBgv,         GV *)           
-PERLVAR(IDBline,       GV *)           
-PERLVAR(IDBsub,                GV *)           
-PERLVAR(IDBsingle,     SV *)           
-PERLVAR(IDBtrace,      SV *)           
-PERLVAR(IDBsignal,     SV *)           
+PERLVAR(IDBgv,         GV *)
+PERLVAR(IDBline,       GV *)
+PERLVAR(IDBsub,                GV *)
+PERLVAR(IDBsingle,     SV *)
+PERLVAR(IDBtrace,      SV *)
+PERLVAR(IDBsignal,     SV *)
 PERLVAR(Ilineary,      AV *)           /* lines of script for debugger */
 PERLVAR(Idbargs,       AV *)           /* args to call listed by caller function */
 
@@ -99,8 +111,8 @@ PERLVAR(Isv_root,    SV*)            /* storage for SVs belonging to interp */
 PERLVAR(Isv_arenaroot, SV*)            /* list of areas for garbage collection */
 
 /* funky return mechanisms */
-PERLVAR(Ilastspbase,   I32)            
-PERLVAR(Ilastsize,     I32)            
+PERLVAR(Ilastspbase,   I32)
+PERLVAR(Ilastsize,     I32)
 PERLVAR(Iforkprocess,  int)            /* so do_open |- can return proc# */
 
 /* subprocess state */
@@ -112,21 +124,21 @@ PERLVARI(Iop_mask,        char *, NULL)   /* masked operations for safe evals */
 PERLVAR(Ilast_proto, char *)           /* Prototype of last sub seen. */
 
 /* trace state */
-PERLVAR(Idlevel,       I32)            
-PERLVARI(Idlmax,       I32,    128)    
-PERLVAR(Idebname,      char *)         
-PERLVAR(Idebdelim,     char *)         
+PERLVAR(Idlevel,       I32)
+PERLVARI(Idlmax,       I32,    128)
+PERLVAR(Idebname,      char *)
+PERLVAR(Idebdelim,     char *)
 
 /* current interpreter roots */
-PERLVAR(Imain_cv,      CV *)           
-PERLVAR(Imain_root,    OP *)           
-PERLVAR(Imain_start,   OP *)           
-PERLVAR(Ieval_root,    OP *)           
-PERLVAR(Ieval_start,   OP *)           
+PERLVAR(Imain_cv,      CV *)
+PERLVAR(Imain_root,    OP *)
+PERLVAR(Imain_start,   OP *)
+PERLVAR(Ieval_root,    OP *)
+PERLVAR(Ieval_start,   OP *)
 
 /* runtime control stuff */
-PERLVARI(Icurcopdb,    COP *,  NULL)   
-PERLVARI(Icopline,     line_t, NOLINE) 
+PERLVARI(Icurcopdb,    COP *,  NULL)
+PERLVARI(Icopline,     line_t, NOLINE)
 
 /* statics moved here for shared library purposes */
 PERLVAR(Istrchop,      SV)             /* return value from chop */
@@ -141,25 +153,41 @@ PERLVAR(Ifirstgv, GV *)           /* $a */
 PERLVAR(Isecondgv,     GV *)           /* $b */
 PERLVAR(Imystrk,       SV *)           /* temp key string for do_each() */
 PERLVAR(Idumplvl,      I32)            /* indentation level on syntax tree dump */
-PERLVAR(Ioldlastpm,    PMOP *)         /* for saving regexp context during debugger */
+PERLVAR(Ioldlastpm,    PMOP *)         /* for saving regexp context in debugger */
 PERLVAR(Igensym,       I32)            /* next symbol for getsym() to define */
-PERLVAR(Ipreambled,    bool)           
-PERLVAR(Ipreambleav,   AV *)           
-PERLVARI(Ilaststatval, int,    -1)     
-PERLVARI(Ilaststype,   I32,    OP_STAT)        
-PERLVAR(Imess_sv,      SV *)           
+PERLVAR(Ipreambled,    bool)
+PERLVAR(Ipreambleav,   AV *)
+PERLVARI(Ilaststatval, int,    -1)
+PERLVARI(Ilaststype,   I32,    OP_STAT)
+PERLVAR(Imess_sv,      SV *)
 
-PERLVAR(Iors,          char *)         /* $\ */
-PERLVAR(Iorslen,       STRLEN)         
-PERLVAR(Iofmt,         char *)         /* $# */
+/* XXX shouldn't these be per-thread? --GSAR */
+PERLVAR(Iors,          char *)         /* output record separator $\ */
+PERLVAR(Iorslen,       STRLEN)
+PERLVAR(Iofmt,         char *)         /* output format for numbers $# */
 
 /* interpreter atexit processing */
-PERLVARI(Iexitlist,    PerlExitListEntry *, NULL)      /* list of exit functions */
-PERLVARI(Iexitlistlen, I32, 0)                         /* length of same */
-PERLVAR(Imodglobal,    HV *)                           /* per-interp module data */
+PERLVARI(Iexitlist,    PerlExitListEntry *, NULL)
+                                       /* list of exit functions */
+PERLVARI(Iexitlistlen, I32, 0)         /* length of same */
+PERLVAR(Imodglobal,    HV *)           /* per-interp module data */
+
+/* these used to be in global before 5.004_68 */
+PERLVARI(Iprofiledata, U32 *,  NULL)   /* table of ops, counts */
+PERLVARI(Irsfp,        PerlIO * VOL,   Nullfp) /* current source file pointer */
+PERLVARI(Irsfp_filters,        AV *,   Nullav) /* keeps active source filters */
+
+PERLVAR(Icompiling,    COP)            /* compiling/done executing marker */
+
+PERLVAR(Icompcv,       CV *)           /* currently compiling subroutine */
+PERLVAR(Icomppad,      AV *)           /* storage for lexically scoped temporaries */
+PERLVAR(Icomppad_name, AV *)           /* variable names for "my" variables */
+PERLVAR(Icomppad_name_fill,    I32)    /* last "introduced" variable offset */
+PERLVAR(Icomppad_name_floor,   I32)    /* start of vars in innermost block */
 
 #ifdef HAVE_INTERP_INTERN
-PERLVAR(Isys_intern,   struct interp_intern)           /* platform internals */
+PERLVAR(Isys_intern,   struct interp_intern)
+                                       /* platform internals */
 #endif
 
 /* more statics moved here */
@@ -171,7 +199,7 @@ PERLVAR(Ilastgotoprobe,     OP*)            /* from pp_ctl.c */
 PERLVAR(Iregdummy,     regnode)        /* from regcomp.c */
 PERLVAR(Iregcomp_parse,        char*)          /* Input-scan pointer. */
 PERLVAR(Iregxend,      char*)          /* End of input for compile */
-PERLVAR(Iregcode,      regnode*)       /* Code-emit pointer; &regdummy = don't. */
+PERLVAR(Iregcode,      regnode*)       /* Code-emit pointer; &regdummy = don't */
 PERLVAR(Iregnaughty,   I32)            /* How bad is this pattern? */
 PERLVAR(Iregsawback,   I32)            /* Did we see \1, ...? */
 
@@ -185,10 +213,8 @@ PERLVAR(Iregseen,  U32)            /* from regcomp.c */
 PERLVAR(Iseen_zerolen, I32)            /* from regcomp.c */
 PERLVAR(Iregcomp_rx,   regexp *)       /* from regcomp.c */
 PERLVAR(Iextralen,     I32)            /* from regcomp.c */
-/* #ifdef DEBUGGING -- keep the structure the same with/without DEBUGGING defined */
 PERLVAR(Icolorset,     int)            /* from regcomp.c */
 PERLVAR(Icolors[4],    char *)         /* from regcomp.c */
-/* #endif */
 
 PERLVAR(Ireginput,     char *)         /* String-input pointer. */
 PERLVAR(Iregbol,       char *)         /* Beginning of input, for ^ check. */
@@ -201,27 +227,26 @@ PERLVAR(Iregprev, char)           /* char before regbol, \n if none */
 
 PERLVAR(Ireg_start_tmp,        char **)        /* from regexec.c */
 PERLVAR(Ireg_start_tmpl,U32)           /* from regexec.c */
-PERLVAR(Iregdata,      struct reg_data *) /* from regexec.c renamed was data */
+PERLVAR(Iregdata,      struct reg_data *)
+                                       /* from regexec.c renamed was data */
 PERLVAR(Ibostr,                char *)         /* from regexec.c */
 PERLVAR(Ireg_flags,    U32)            /* from regexec.c */
 PERLVAR(Ireg_eval_set, I32)            /* from regexec.c */
 
-/* #ifdef DEBUGGING -- keep the structure the same with/without DEBUGGING defined */
 PERLVAR(Iregnarrate,   I32)            /* from regexec.c */
 PERLVAR(Iregprogram,   regnode *)      /* from regexec.c */
 PERLVARI(Iregindent,   int,        0)  /* from regexec.c */
-/* #endif */
 
 PERLVAR(Iregcc,                CURCUR *)       /* from regexec.c */
-PERLVARI(Iin_clean_objs,bool,      FALSE)  /* from sv.c */
-PERLVARI(Iin_clean_all,        bool,       FALSE)  /* from sv.c */
+PERLVARI(Iin_clean_objs,bool,    FALSE)        /* from sv.c */
+PERLVARI(Iin_clean_all,        bool,    FALSE) /* from sv.c */
 
 PERLVAR(Ilinestart,    char *)         /* beg. of most recently read line */
 PERLVAR(Ipending_ident,        char)           /* pending identifier lookup */
 PERLVAR(Isublex_info,  SUBLEXINFO)     /* from toke.c */
 
 #ifdef USE_THREADS
-PERLVAR(Ithrsv,                SV *)           /* holds struct perl_thread for main thread */
+PERLVAR(Ithrsv,                SV *)           /* struct perl_thread for main thread */
 PERLVARI(Ithreadnum,   U32,    0)      /* incremented each thread creation */
 #endif /* USE_THREADS */
 
diff --git a/perl.c b/perl.c
index af74ddb..084a1c3 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -45,41 +45,13 @@ dEXTCONST char rcsid[] = "perl.c\nPatch level: ###\n";
 #endif
 #endif
 
-#define I_REINIT \
-  STMT_START {                 \
-    chopset    = " \n-";       \
-    copline    = NOLINE;       \
-    curcop     = &compiling;   \
-    curcopdb    = NULL;                \
-    dbargs     = 0;            \
-    dlmax      = 128;          \
-    laststatval        = -1;           \
-    laststype  = OP_STAT;      \
-    maxscream  = -1;           \
-    maxsysfd   = MAXSYSFD;     \
-    statname   = Nullsv;       \
-    tmps_floor = -1;           \
-    tmps_ix     = -1;          \
-    op_mask     = NULL;                \
-    dlmax       = 128;         \
-    laststatval = -1;          \
-    laststype   = OP_STAT;     \
-    mess_sv     = Nullsv;      \
-    splitstr    = " ";         \
-    generation  = 100;         \
-    exitlist    = NULL;                \
-    exitlistlen = 0;           \
-    regindent   = 0;           \
-    in_clean_objs = FALSE;     \
-    in_clean_all= FALSE;       \
-  } STMT_END
-
 #ifdef PERL_OBJECT
 static I32 read_e_script _((CPerlObj* pPerl, int idx, SV *buf_sv, int maxlen));
 #else
 static void find_beginning _((void));
 static void forbid_setid _((char *));
 static void incpush _((char *, int));
+static void init_interp _((void));
 static void init_ids _((void));
 static void init_debugger _((void));
 static void init_lexer _((void));
@@ -140,6 +112,7 @@ perl_construct(register PerlInterpreter *sv_interp)
 #endif
 
 #ifdef MULTIPLICITY
+    ++ninterps;
     Zero(sv_interp, 1, PerlInterpreter);
 #endif
 
@@ -209,11 +182,11 @@ perl_construct(register PerlInterpreter *sv_interp)
 
     init_stacks(ARGS);
 #ifdef MULTIPLICITY
-    I_REINIT;
+    init_interp();
     perl_destruct_level = 1; 
 #else
-   if(perl_destruct_level > 0)
-       I_REINIT;
+   if (perl_destruct_level > 0)
+       init_interp();
 #endif
 
     init_ids();
@@ -357,6 +330,10 @@ perl_destruct(register PerlInterpreter *sv_interp)
     LEAVE;
     FREETMPS;
 
+#ifdef MULTIPLICITY
+    --ninterps;
+#endif
+
     /* We must account for everything.  */
 
     /* Destroy the main CV and syntax tree */
@@ -1798,6 +1775,58 @@ my_unexec(void)
 #endif
 }
 
+/* initialize curinterp */
+STATIC void
+init_interp(void)
+{
+
+#if 0
+#define I_REINIT \
+  STMT_START {                 \
+    chopset    = " \n-";       \
+    copline    = NOLINE;       \
+    curcop     = &compiling;   \
+    curcopdb    = NULL;                \
+    dbargs     = 0;            \
+    dlmax      = 128;          \
+    laststatval        = -1;           \
+    laststype  = OP_STAT;      \
+    maxscream  = -1;           \
+    maxsysfd   = MAXSYSFD;     \
+    statname   = Nullsv;       \
+    tmps_floor = -1;           \
+    tmps_ix     = -1;          \
+    op_mask     = NULL;                \
+    dlmax       = 128;         \
+    laststatval = -1;          \
+    laststype   = OP_STAT;     \
+    mess_sv     = Nullsv;      \
+    splitstr    = " ";         \
+    generation  = 100;         \
+    exitlist    = NULL;                \
+    exitlistlen = 0;           \
+    regindent   = 0;           \
+    in_clean_objs = FALSE;     \
+    in_clean_all= FALSE;       \
+    profiledata = NULL;                \
+    rsfp       = Nullfp;       \
+    rsfp_filters= Nullav;      \
+  } STMT_END
+#endif
+
+#define PERLVAR(var,type)
+#define PERLVARI(var,type,init)                curinterp->var = init;
+#define PERLVARIC(var,type,init)       curinterp->var = init;
+#include "intrpvar.h"
+#ifndef USE_THREADS
+#  include "thrdvar.h"
+#endif
+#undef PERLVAR
+#undef PERLVARI
+#undef PERLVARIC
+
+}
+
 STATIC void
 init_main_stash(void)
 {
@@ -2303,44 +2332,23 @@ init_stacks(ARGSproto)
     tmps_ix = -1;
     tmps_max = REASONABLE(128);
 
-    /*
-     * The following stacks almost certainly should be per-interpreter,
-     * but for now they're not.  XXX
-     */
-
-    if (markstack) {
-       markstack_ptr = markstack;
-    } else {
-       New(54,markstack,REASONABLE(32),I32);
-       markstack_ptr = markstack;
-       markstack_max = markstack + REASONABLE(32);
-    }
+    New(54,markstack,REASONABLE(32),I32);
+    markstack_ptr = markstack;
+    markstack_max = markstack + REASONABLE(32);
 
     SET_MARKBASE;
 
-    if (scopestack) {
-       scopestack_ix = 0;
-    } else {
-       New(54,scopestack,REASONABLE(32),I32);
-       scopestack_ix = 0;
-       scopestack_max = REASONABLE(32);
-    }
+    New(54,scopestack,REASONABLE(32),I32);
+    scopestack_ix = 0;
+    scopestack_max = REASONABLE(32);
 
-    if (savestack) {
-       savestack_ix = 0;
-    } else {
-       New(54,savestack,REASONABLE(128),ANY);
-       savestack_ix = 0;
-       savestack_max = REASONABLE(128);
-    }
+    New(54,savestack,REASONABLE(128),ANY);
+    savestack_ix = 0;
+    savestack_max = REASONABLE(128);
 
-    if (retstack) {
-       retstack_ix = 0;
-    } else {
-       New(54,retstack,REASONABLE(16),OP*);
-       retstack_ix = 0;
-       retstack_max = REASONABLE(16);
-    }
+    New(54,retstack,REASONABLE(16),OP*);
+    retstack_ix = 0;
+    retstack_max = REASONABLE(16);
 }
 
 #undef REASONABLE
@@ -2359,12 +2367,10 @@ nuke_stacks(void)
        curstackinfo = p;
     }
     Safefree(tmps_stack);
-    /*  XXX refcount interpreters to determine when to free global data
     Safefree(markstack);
     Safefree(scopestack);
     Safefree(savestack);
     Safefree(retstack);
-    */
     DEBUG( {
        Safefree(debname);
        Safefree(debdelim);
index 9bbd615..6b16279 100644 (file)
@@ -1,79 +1,94 @@
-/* This file describes the "global" variables used by perl  */
-/* This used to be in perl.h directly but we want to        */
-/* abstract out which are per-thread per-interpreter really */
-/* global and how initialized into one file                 */
-
 /****************/
 /* Truly global */
 /****************/
 
+/* Don't forget to re-run embed.pl to propagate changes! */
+
+/* This file describes the "global" variables used by perl
+ * This used to be in perl.h directly but we want to abstract out into
+ * distinct files which are per-thread, per-interpreter or really global,
+ * and how they're initialized.
+ *
+ * The 'G' prefix is only needed for vars that need appropriate #defines
+ * generated when built with or without EMBED.  It is also used to generate
+ * the appropriate export list for win32.
+ *
+ * Avoid build-specific #ifdefs here, like DEBUGGING.  That way,
+ * we can keep binary compatibility of the curinterp structure */
+
+
 /* global state */
-PERLVAR(Gcurinterp,    PerlInterpreter *)              /* currently running interpreter */
+PERLVAR(Gcurinterp,    PerlInterpreter *)
+                                       /* currently running interpreter */
 #ifdef USE_THREADS
-PERLVAR(Gthr_key,      perl_key)               /* For per-thread struct perl_thread* */
-PERLVAR(Gsv_mutex,     perl_mutex)             /* Mutex for allocating SVs in sv.c */
-PERLVAR(Gmalloc_mutex, perl_mutex)             /* Mutex for malloc */
-PERLVAR(Geval_mutex,   perl_mutex)             /* Mutex for doeval */
-PERLVAR(Geval_cond,    perl_cond)              /* Condition variable for doeval */
-PERLVAR(Geval_owner,   struct perl_thread *)           /* Owner thread for doeval */
+PERLVAR(Gthr_key,      perl_key)       /* For per-thread struct perl_thread* */
+PERLVAR(Gsv_mutex,     perl_mutex)     /* Mutex for allocating SVs in sv.c */
+PERLVAR(Gmalloc_mutex, perl_mutex)     /* Mutex for malloc */
+PERLVAR(Geval_mutex,   perl_mutex)     /* Mutex for doeval */
+PERLVAR(Geval_cond,    perl_cond)      /* Condition variable for doeval */
+PERLVAR(Geval_owner,   struct perl_thread *)
+                                       /* Owner thread for doeval */
 PERLVAR(Gnthreads,     int)            /* Number of threads currently */
-PERLVAR(Gthreads_mutex,        perl_mutex)             /* Mutex for nthreads and thread list */
-PERLVAR(Gnthreads_cond,        perl_cond)              /* Condition variable for nthreads */
-PERLVAR(Gsvref_mutex,  perl_mutex)             /* Mutex for SvREFCNT_{inc,dec} */
-PERLVARI(Gthreadsv_names,      char *, THREADSV_NAMES) 
+PERLVAR(Gthreads_mutex,        perl_mutex)     /* Mutex for nthreads and thread list */
+PERLVAR(Gnthreads_cond,        perl_cond)      /* Condition variable for nthreads */
+PERLVAR(Gsvref_mutex,  perl_mutex)     /* Mutex for SvREFCNT_{inc,dec} */
+PERLVARI(Gthreadsv_names,char *,       THREADSV_NAMES)
 #ifdef FAKE_THREADS
-PERLVAR(Gcurthr,       struct perl_thread *)   /* Currently executing (fake) thread */
+PERLVAR(Gcurthr,       struct perl_thread *)
+                                       /* Currently executing (fake) thread */
 #endif
 #endif /* USE_THREADS */
 
-PERLVAR(Guid,  int)            /* current real user id */
-PERLVAR(Geuid, int)            /* current effective user id */
-PERLVAR(Ggid,  int)            /* current real group id */
-PERLVAR(Gegid, int)            /* current effective group id */
+PERLVAR(Gninterps,     int)            /* number of active interpreters */
+
+PERLVAR(Guid,          int)            /* current real user id */
+PERLVAR(Geuid,         int)            /* current effective user id */
+PERLVAR(Ggid,          int)            /* current real group id */
+PERLVAR(Gegid,         int)            /* current effective group id */
 PERLVAR(Gnomemok,      bool)           /* let malloc context handle nomem */
-PERLVAR(Gan,   U32)            /* malloc sequence number */
+PERLVAR(Gan,           U32)            /* malloc sequence number */
 PERLVAR(Gcop_seqmax,   U32)            /* statement sequence number */
 PERLVAR(Gop_seqmax,    U16)            /* op sequence number */
 PERLVAR(Gevalseq,      U32)            /* eval sequence number */
-PERLVAR(Gsub_generation,       U32)            /* inc to force methods to be looked up again */
-PERLVAR(Gorigenviron,  char **)                
-PERLVAR(Gorigalen,     U32)            
+PERLVAR(Gsub_generation,U32)           /* incr to invalidate method cache */
+PERLVAR(Gorigenviron,  char **)
+PERLVAR(Gorigalen,     U32)
 PERLVAR(Gpidstatus,    HV *)           /* pid-to-status mappings for waitpid */
-PERLVAR(Gprofiledata,  U32 *)          
-PERLVARI(Gmaxo,        int,    MAXO)   /* Number of ops */
+PERLVARI(Gmaxo,        int,    MAXO)           /* maximum number of ops */
 PERLVAR(Gosname,       char *)         /* operating system */
-PERLVARI(Gsh_path,     char *, SH_PATH)        /* full path of shell */
-PERLVAR(Gsighandlerp,  Sighandler_t)           
+PERLVARI(Gsh_path,     char *, SH_PATH)/* full path of shell */
+PERLVAR(Gsighandlerp,  Sighandler_t)
 
 PERLVAR(Gxiv_arenaroot,        XPV*)           /* list of allocated xiv areas */
 PERLVAR(Gxiv_root,     IV **)          /* free xiv list--shared by interpreters */
-PERLVAR(Gxnv_root,     double *)               /* free xnv list--shared by interpreters */
+PERLVAR(Gxnv_root,     double *)       /* free xnv list--shared by interpreters */
 PERLVAR(Gxrv_root,     XRV *)          /* free xrv list--shared by interpreters */
 PERLVAR(Gxpv_root,     XPV *)          /* free xpv list--shared by interpreters */
 PERLVAR(Ghe_root,      HE *)           /* free he list--shared by interpreters */
 PERLVAR(Gnice_chunk,   char *)         /* a nice chunk of memory to reuse */
-PERLVAR(Gnice_chunk_size,      U32)            /* how nice the chunk of memory is */
+PERLVAR(Gnice_chunk_size,      U32)    /* how nice the chunk of memory is */
 
 #ifdef PERL_OBJECT
-PERLVARI(Grunops,      runops_proc_t,  FUNC_NAME_TO_PTR(RUNOPS_DEFAULT))       
+PERLVARI(Grunops,      runops_proc_t,  FUNC_NAME_TO_PTR(RUNOPS_DEFAULT))
 #else
-PERLVARI(Grunops,      runops_proc_t *,        RUNOPS_DEFAULT) 
+PERLVARI(Grunops,      runops_proc_t *,        RUNOPS_DEFAULT)
 #endif
 
-PERLVAR(Gtokenbuf[256],        char)           
-PERLVAR(Gna,   STRLEN)         /* for use in SvPV when length is Not Applicable */
+PERLVAR(Gtokenbuf[256],        char)
+PERLVAR(Gna,           STRLEN)         /* for use in SvPV when length is
+                                          Not Applicable */
 
-PERLVAR(Gsv_undef,     SV)             
-PERLVAR(Gsv_no,        SV)             
-PERLVAR(Gsv_yes,       SV)             
+PERLVAR(Gsv_undef,     SV)
+PERLVAR(Gsv_no,                SV)
+PERLVAR(Gsv_yes,       SV)
 #ifdef CSH
-PERLVARI(Gcshname,     char *, CSH)    
-PERLVAR(Gcshlen,       I32)            
+PERLVARI(Gcshname,     char *, CSH)
+PERLVAR(Gcshlen,       I32)
 #endif
 
 PERLVAR(Glex_state,    U32)            /* next token is determined */
 PERLVAR(Glex_defer,    U32)            /* state after determined token */
-PERLVAR(Glex_expect,   expectation)            /* expect after determined token */
+PERLVAR(Glex_expect,   expectation)    /* expect after determined token */
 PERLVAR(Glex_brackets, I32)            /* bracket count */
 PERLVAR(Glex_formbrack,        I32)            /* bracket count at outer format level */
 PERLVAR(Glex_fakebrack,        I32)            /* outer bracket is mere delimiter */
@@ -85,22 +100,20 @@ PERLVAR(Glex_repl, SV *)           /* runtime replacement from s/// */
 PERLVAR(Glex_op,       OP *)           /* extra info to pass back on op */
 PERLVAR(Glex_inpat,    OP *)           /* in pattern $) and $| are special */
 PERLVAR(Glex_inwhat,   I32)            /* what kind of quoting are we in */
-PERLVAR(Glex_brackstack,       char *)         /* what kind of brackets to pop */
+PERLVAR(Glex_brackstack,char *)                /* what kind of brackets to pop */
 PERLVAR(Glex_casestack,        char *)         /* what kind of case mods in effect */
 
 /* What we know when we're in LEX_KNOWNEXT state. */
-PERLVAR(Gnextval[5],   YYSTYPE)                /* value of next token, if any */
+PERLVAR(Gnextval[5],   YYSTYPE)        /* value of next token, if any */
 PERLVAR(Gnexttype[5],  I32)            /* type of next token */
-PERLVAR(Gnexttoke,     I32)            
+PERLVAR(Gnexttoke,     I32)
 
-PERLVARI(Grsfp,        PerlIO * VOL,   Nullfp) 
-PERLVAR(Glinestr,      SV *)           
-PERLVAR(Gbufptr,       char *)         
-PERLVAR(Goldbufptr,    char *)         
-PERLVAR(Goldoldbufptr, char *)         
-PERLVAR(Gbufend,       char *)         
-PERLVARI(Gexpect,      expectation,    XSTATE) /* how to interpret ambiguous tokens */
-PERLVAR(Grsfp_filters, AV *)           
+PERLVAR(Glinestr,      SV *)
+PERLVAR(Gbufptr,       char *)
+PERLVAR(Goldbufptr,    char *)
+PERLVAR(Goldoldbufptr, char *)
+PERLVAR(Gbufend,       char *)
+PERLVARI(Gexpect,expectation,  XSTATE) /* how to interpret ambiguous tokens */
 
 PERLVAR(Gmulti_start,  I32)            /* 1st line of multi-line string */
 PERLVAR(Gmulti_end,    I32)            /* last line of multi-line string */
@@ -111,53 +124,50 @@ PERLVAR(Gerror_count,     I32)            /* how many errors so far, max 10 */
 PERLVAR(Gsubline,      I32)            /* line this subroutine began on */
 PERLVAR(Gsubname,      SV *)           /* name of current subroutine */
 
-PERLVAR(Gcompcv,       CV *)           /* currently compiling subroutine */
-PERLVAR(Gcomppad,      AV *)           /* storage for lexically scoped temporaries */
-PERLVAR(Gcomppad_name, AV *)           /* variable names for "my" variables */
-PERLVAR(Gcomppad_name_fill,    I32)            /* last "introduced" variable offset */
-PERLVAR(Gcomppad_name_floor,   I32)            /* start of vars in innermost block */
-PERLVAR(Gmin_intro_pending,    I32)            /* start of vars to introduce */
-PERLVAR(Gmax_intro_pending,    I32)            /* end of vars to introduce */
-PERLVAR(Gpadix,        I32)            /* max used index in current "register" pad */
+PERLVAR(Gmin_intro_pending,    I32)    /* start of vars to introduce */
+PERLVAR(Gmax_intro_pending,    I32)    /* end of vars to introduce */
+PERLVAR(Gpadix,                I32)            /* max used index in current "register" pad */
 PERLVAR(Gpadix_floor,  I32)            /* how low may inner block reset padix */
-PERLVAR(Gpad_reset_pending,    I32)            /* reset pad on next attempted alloc */
-PERLVAR(Gcompiling,    COP)            
+PERLVAR(Gpad_reset_pending,    I32)    /* reset pad on next attempted alloc */
 
 PERLVAR(Gthisexpr,     I32)            /* name id for nothing_in_common() */
-PERLVAR(Glast_uni,     char *)         /* position of last named-unary operator */
+PERLVAR(Glast_uni,     char *)         /* position of last named-unary op */
 PERLVAR(Glast_lop,     char *)         /* position of last list operator */
 PERLVAR(Glast_lop_op,  OPCODE)         /* last list operator */
-PERLVAR(Gin_my,        bool)           /* we're compiling a "my" declaration */
+PERLVAR(Gin_my,        bool)                   /* we're compiling a "my" declaration */
 PERLVAR(Gin_my_stash,  HV *)           /* declared class of this "my" declaration */
 #ifdef FCRYPT
 PERLVAR(Gcryptseen,    I32)            /* has fast crypt() been initialized? */
 #endif
 
-PERLVAR(Ghints,        U32)            /* various compilation flags */
+PERLVAR(Ghints,        U32)                    /* pragma-tic compile-time flags */
 
 PERLVAR(Gdo_undump,    bool)           /* -u or dump seen? */
-PERLVAR(Gdebug,        VOL U32)                
+PERLVAR(Gdebug,                VOL U32)        /* flags given to -D switch */
 
 
 #ifdef OVERLOAD
 
-PERLVAR(Gamagic_generation,    long)           
+PERLVAR(Gamagic_generation,    long)
 
 #endif
 
 #ifdef USE_LOCALE_COLLATE
 PERLVAR(Gcollation_ix, U32)            /* Collation generation index */
-PERLVAR(Gcollation_name,       char *)         /* Name of current collation */
-PERLVARI(Gcollation_standard,  bool,   TRUE)   /* Assume simple collation */
+PERLVAR(Gcollation_name,char *)                /* Name of current collation */
+PERLVARI(Gcollation_standard, bool,    TRUE)
+                                       /* Assume simple collation */
 PERLVAR(Gcollxfrm_base,        Size_t)         /* Basic overhead in *xfrm() */
-PERLVARI(Gcollxfrm_mult,       Size_t, 2)      /* Expansion factor in *xfrm() */
+PERLVARI(Gcollxfrm_mult,Size_t,        2)      /* Expansion factor in *xfrm() */
 #endif /* USE_LOCALE_COLLATE */
 
 #ifdef USE_LOCALE_NUMERIC
 
 PERLVAR(Gnumeric_name, char *)         /* Name of current numeric locale */
-PERLVARI(Gnumeric_standard,    bool,   TRUE)   /* Assume simple numerics */
-PERLVARI(Gnumeric_local,       bool,   TRUE)   /* Assume local numerics */
+PERLVARI(Gnumeric_standard,    bool,   TRUE)
+                                       /* Assume simple numerics */
+PERLVARI(Gnumeric_local,       bool,   TRUE)
+                                       /* Assume local numerics */
 
 #endif /* !USE_LOCALE_NUMERIC */
 
@@ -167,5 +177,5 @@ PERLVARIC(GNo,              char *, "")
 PERLVARIC(Ghexdigit,   char *, "0123456789abcdef0123456789ABCDEFx")
 PERLVARIC(Gpatleave,   char *, "\\.^$@dDwWsSbB+*?|()-nrtfeaxc0123456789[{]}")
 
-PERLVAR(Gspecialsv_list[4], SV *)              /* from byterun.h */
+PERLVAR(Gspecialsv_list[4],SV *)       /* from byterun.h */
 
diff --git a/proto.h b/proto.h
index fe8b638..cff62d6 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -772,6 +772,7 @@ CV *cv_clone2 _((CV *proto, CV *outside));
 void find_beginning _((void));
 void forbid_setid _((char *));
 void incpush _((char *, int));
+void init_interp _((void));
 void init_ids _((void));
 void init_debugger _((void));
 void init_lexer _((void));
index 7c40481..529a757 100644 (file)
--- a/thrdvar.h
+++ b/thrdvar.h
+/***********************************************/
+/* Global only to current thread               */
+/***********************************************/
+
 /* Don't forget to re-run embed.pl to propagate changes! */
 
-/* Per-thread variables
-   The 'T' prefix is only needed for vars that need appropriate #defines
-generated when built with or without USE_THREADS.  (It is also used
-to generate the appropriate the export list for win32.) */
+/* The 'T' prefix is only needed for vars that need appropriate #defines
+ * generated when built with or without USE_THREADS.  It is also used
+ * to generate the appropriate export list for win32.
+ *
+ * When building without USE_THREADS, these variables will be truly global.
+ * When building without USE_THREADS but with MULTIPLICITY, these variables
+ * will be global per-interpreter.
+ *
+ * Avoid build-specific #ifdefs here, like DEBUGGING.  That way,
+ * we can keep binary compatibility of the curinterp structure */
 
 /* Important ones in the first cache line (if alignment is done right) */
 
-PERLVAR(Tstack_sp,     SV **)          
+PERLVAR(Tstack_sp,     SV **)          /* top of the stack */
 #ifdef OP_IN_REGISTER
-PERLVAR(Topsave,       OP *)           
+PERLVAR(Topsave,       OP *)
 #else
-PERLVAR(Top,           OP *)           
+PERLVAR(Top,           OP *)           /* currently executing op */
 #endif
-PERLVAR(Tcurpad,       SV **)          
+PERLVAR(Tcurpad,       SV **)          /* active pad (lexicals+tmps) */
+
+PERLVAR(Tstack_base,   SV **)
+PERLVAR(Tstack_max,    SV **)
+
+PERLVAR(Tscopestack,   I32 *)          /* scopes we've ENTERed */
+PERLVAR(Tscopestack_ix,        I32)
+PERLVAR(Tscopestack_max,I32)
 
-PERLVAR(Tstack_base,   SV **)          
-PERLVAR(Tstack_max,    SV **)          
+PERLVAR(Tsavestack,    ANY *)          /* items that need to be restored
+                                          when LEAVEing scopes we've ENTERed */
+PERLVAR(Tsavestack_ix, I32)
+PERLVAR(Tsavestack_max,        I32)
 
-PERLVAR(Tscopestack,   I32 *)          
-PERLVAR(Tscopestack_ix,        I32)            
-PERLVAR(Tscopestack_max,I32)           
+PERLVAR(Ttmps_stack,   SV **)          /* mortals we've made */
+PERLVARI(Ttmps_ix,     I32,    -1)
+PERLVARI(Ttmps_floor,  I32,    -1)
+PERLVAR(Ttmps_max,     I32)
 
-PERLVAR(Tsavestack,    ANY *)          
-PERLVAR(Tsavestack_ix, I32)            
-PERLVAR(Tsavestack_max,        I32)            
+PERLVAR(Tmarkstack,    I32 *)          /* stack_sp locations we're remembering */
+PERLVAR(Tmarkstack_ptr,        I32 *)
+PERLVAR(Tmarkstack_max,        I32 *)
 
-PERLVAR(Tretstack,     OP **)          
-PERLVAR(Tretstack_ix,  I32)            
-PERLVAR(Tretstack_max, I32)            
+PERLVAR(Tretstack,     OP **)          /* OPs we have postponed executing */
+PERLVAR(Tretstack_ix,  I32)
+PERLVAR(Tretstack_max, I32)
 
-PERLVAR(Tmarkstack,    I32 *)          
-PERLVAR(Tmarkstack_ptr,        I32 *)          
-PERLVAR(Tmarkstack_max,        I32 *)          
+PERLVAR(TSv,           SV *)           /* used to hold temporary values */
+PERLVAR(TXpv,          XPV *)          /* used to hold temporary values */
 
-PERLVAR(TSv,           SV *)           
-PERLVAR(TXpv,          XPV *)          
-PERLVAR(Tstatbuf,      Stat_t)         
+PERLVAR(Tstatbuf,      Stat_t)
 #ifdef HAS_TIMES
-PERLVAR(Ttimesbuf,     struct tms)             
+PERLVAR(Ttimesbuf,     struct tms)
 #endif
-    
-/* Now the fields that used to be "per interpreter" (even when global) */
 
 /* Fields used by magic variables such as $@, $/ and so on */
 PERLVAR(Ttainted,      bool)           /* using variables controlled by $< */
-PERLVAR(Tcurpm,                PMOP *)         /* what to do \ interps from */
-PERLVAR(Tnrs,          SV *)           
-PERLVAR(Trs,           SV *)           /* $/ */
-PERLVAR(Tlast_in_gv,   GV *)           
-PERLVAR(Tofs,          char *)         /* $, */
-PERLVAR(Tofslen,       STRLEN)         
-PERLVAR(Tdefoutgv,     GV *)           
+PERLVAR(Tcurpm,                PMOP *)         /* what to do \ interps in REs from */
+PERLVAR(Tnrs,          SV *)
+PERLVAR(Trs,           SV *)           /* input record separator $/ */
+PERLVAR(Tlast_in_gv,   GV *)           /* GV used in last <FH> */
+PERLVAR(Tofs,          char *)         /* output field separator $, */
+PERLVAR(Tofslen,       STRLEN)
+PERLVAR(Tdefoutgv,     GV *)           /* default FH for output */
 PERLVARI(Tchopset,     char *, " \n-") /* $: */
-PERLVAR(Tformtarget,   SV *)           
-PERLVAR(Tbodytarget,   SV *)           
-PERLVAR(Ttoptarget,    SV *)           
+PERLVAR(Tformtarget,   SV *)
+PERLVAR(Tbodytarget,   SV *)
+PERLVAR(Ttoptarget,    SV *)
 
 /* Stashes */
 PERLVAR(Tdefstash,     HV *)           /* main symbol table */
 PERLVAR(Tcurstash,     HV *)           /* symbol table for current package */
 
-/* Stacks */
-PERLVAR(Ttmps_stack,   SV **)          
-PERLVARI(Ttmps_ix,     I32,    -1)     
-PERLVARI(Ttmps_floor,  I32,    -1)     
-PERLVAR(Ttmps_max,     I32)            
-
-PERLVAR(Trestartop,    OP *)           /* Are we propagating an error from croak? */
-PERLVARI(Tcurcop,      COP * VOL,      &compiling)     
+PERLVAR(Trestartop,    OP *)           /* propagating an error from croak? */
+PERLVARI(Tcurcop,      COP * VOL,      &compiling)
 PERLVAR(Tin_eval,      VOL int)        /* trap "fatal" errors? */
 PERLVAR(Tdelaymagic,   int)            /* ($<,$>) = ... */
-PERLVAR(Tdirty,                bool)           /* In the middle of tearing things down? */
+PERLVAR(Tdirty,                bool)           /* in the middle of tearing things down? */
 PERLVAR(Tlocalizing,   int)            /* are we processing a local() list? */
 
-PERLVAR(Tcurstack,     AV *)                   /* THE STACK */
-PERLVAR(Tcurstackinfo, PERL_SI *)              /* current stack + context */
-PERLVAR(Tmainstack,    AV *)                   /* the stack when nothing funny is happening */
-PERLVAR(Ttop_env,      JMPENV *)               /* ptr. to current sigjmp() environment */
-PERLVAR(Tstart_env,    JMPENV)                 /* empty startup sigjmp() environment */
+PERLVAR(Tcurstack,     AV *)           /* THE STACK */
+PERLVAR(Tcurstackinfo, PERL_SI *)      /* current stack + context */
+PERLVAR(Tmainstack,    AV *)           /* the stack when nothing funny is happening */
+PERLVAR(Ttop_env,      JMPENV *)       /* ptr. to current sigjmp() environment */
+PERLVAR(Tstart_env,    JMPENV)         /* empty startup sigjmp() environment */
 
 /* statics "owned" by various functions */
-PERLVAR(Tav_fetch_sv,  SV *)
-PERLVAR(Thv_fetch_sv,  SV *)
-PERLVAR(Thv_fetch_ent_mh, HE)
-PERLVAR(Tmodcount, I32)
+PERLVAR(Tav_fetch_sv,  SV *)           /* owned by av_fetch() */
+PERLVAR(Thv_fetch_sv,  SV *)           /* owned by hv_fetch() */
+PERLVAR(Thv_fetch_ent_mh, HE)          /* owned by hv_fetch_ent() */
+
+PERLVAR(Tmodcount,     I32)            /* how much mod()ification in assignment? */
 
 /* XXX Sort stuff, firstgv secongv and so on? */
 /* XXX What about regexp stuff? */
 
 /* Note that the variables below are all explicitly referenced in the code
-as thr->whatever and therefore don't need the 'T' prefix. */
+ * as thr->whatever and therefore don't need the 'T' prefix. */
 
 #ifdef USE_THREADS
 
-PERLVAR(oursv,         SV *)           
-PERLVAR(cvcache,       HV *)           
-PERLVAR(self,          perl_os_thread)         /* Underlying thread object */
-PERLVAR(flags,         U32)            
-PERLVAR(threadsv,      AV *)                   /* Per-thread SVs ($_, $@ etc.) */
-PERLVAR(threadsvp,     SV **)                  /* AvARRAY(threadsv) */
-PERLVAR(specific,      AV *)                   /* Thread-specific user data */
-PERLVAR(errsv,         SV *)                   /* Backing SV for $@ */
-PERLVAR(errhv,         HV *)                   /* HV for what was %@ in pp_ctl.c */
-PERLVAR(mutex,         perl_mutex)             /* For the fields others can change */
-PERLVAR(tid,           U32)            
+PERLVAR(oursv,         SV *)
+PERLVAR(cvcache,       HV *)
+PERLVAR(self,          perl_os_thread) /* Underlying thread object */
+PERLVAR(flags,         U32)
+PERLVAR(threadsv,      AV *)           /* Per-thread SVs ($_, $@ etc.) */
+PERLVAR(threadsvp,     SV **)          /* AvARRAY(threadsv) */
+PERLVAR(specific,      AV *)           /* Thread-specific user data */
+PERLVAR(errsv,         SV *)           /* Backing SV for $@ */
+PERLVAR(errhv,         HV *)           /* HV for what was %@ in pp_ctl.c */
+PERLVAR(mutex,         perl_mutex)     /* For the fields others can change */
+PERLVAR(tid,           U32)
 PERLVAR(prev,          struct perl_thread *)
-PERLVAR(next,          struct perl_thread *)   /* Circular linked list of threads */
+PERLVAR(next,          struct perl_thread *)
+                                       /* Circular linked list of threads */
 
 #ifdef HAVE_THREAD_INTERN
-PERLVAR(i,             struct thread_intern)   /* Platform-dependent internals */
+PERLVAR(i,             struct thread_intern)
+                                       /* Platform-dependent internals */
 #endif
 
-PERLVAR(trailing_nul,  char)                   /* For the sake of thrsv and oursv */
+PERLVAR(trailing_nul,  char)           /* For the sake of thrsv and oursv */
 
 #endif /* USE_THREADS */