Permalink
Browse files

Convert rest of PerlIO's memory tables to per-interp and add clone fu…

…nctions

for them. Call explicit cleanup during destruct process.
 - one binmode test is failing
 - also ext/threads/t/basic.t fails under make test, and is noisy under
   harness. (Threads results are intermingled and don't match order expected.)

p4raw-id: //depot/perlio@12547
  • Loading branch information...
1 parent a1ea730 commit 3a1ee7e89ce6793a321c9c259b0464c3f464c5ce Nick Ing-Simmons committed Oct 21, 2001
Showing with 103 additions and 88 deletions.
  1. +6 −0 embedvar.h
  2. +2 −0 intrpvar.h
  3. +9 −4 perl.c
  4. +4 −0 perlapi.h
  5. +72 −75 perlio.c
  6. +6 −5 perlio.h
  7. +2 −2 perliol.h
  8. +2 −2 sv.c
View
@@ -223,6 +223,7 @@
#define PL_dbargs (PERL_GET_INTERP->Idbargs)
#define PL_debstash (PERL_GET_INTERP->Idebstash)
#define PL_debug (PERL_GET_INTERP->Idebug)
+#define PL_def_layerlist (PERL_GET_INTERP->Idef_layerlist)
#define PL_defgv (PERL_GET_INTERP->Idefgv)
#define PL_diehook (PERL_GET_INTERP->Idiehook)
#define PL_doextract (PERL_GET_INTERP->Idoextract)
@@ -266,6 +267,7 @@
#define PL_incgv (PERL_GET_INTERP->Iincgv)
#define PL_initav (PERL_GET_INTERP->Iinitav)
#define PL_inplace (PERL_GET_INTERP->Iinplace)
+#define PL_known_layers (PERL_GET_INTERP->Iknown_layers)
#define PL_last_lop (PERL_GET_INTERP->Ilast_lop)
#define PL_last_lop_op (PERL_GET_INTERP->Ilast_lop_op)
#define PL_last_swash_hv (PERL_GET_INTERP->Ilast_swash_hv)
@@ -512,6 +514,7 @@
#define PL_dbargs (vTHX->Idbargs)
#define PL_debstash (vTHX->Idebstash)
#define PL_debug (vTHX->Idebug)
+#define PL_def_layerlist (vTHX->Idef_layerlist)
#define PL_defgv (vTHX->Idefgv)
#define PL_diehook (vTHX->Idiehook)
#define PL_doextract (vTHX->Idoextract)
@@ -555,6 +558,7 @@
#define PL_incgv (vTHX->Iincgv)
#define PL_initav (vTHX->Iinitav)
#define PL_inplace (vTHX->Iinplace)
+#define PL_known_layers (vTHX->Iknown_layers)
#define PL_last_lop (vTHX->Ilast_lop)
#define PL_last_lop_op (vTHX->Ilast_lop_op)
#define PL_last_swash_hv (vTHX->Ilast_swash_hv)
@@ -804,6 +808,7 @@
#define PL_Idbargs PL_dbargs
#define PL_Idebstash PL_debstash
#define PL_Idebug PL_debug
+#define PL_Idef_layerlist PL_def_layerlist
#define PL_Idefgv PL_defgv
#define PL_Idiehook PL_diehook
#define PL_Idoextract PL_doextract
@@ -847,6 +852,7 @@
#define PL_Iincgv PL_incgv
#define PL_Iinitav PL_initav
#define PL_Iinplace PL_inplace
+#define PL_Iknown_layers PL_known_layers
#define PL_Ilast_lop PL_last_lop
#define PL_Ilast_lop_op PL_last_lop_op
#define PL_Ilast_swash_hv PL_last_swash_hv
View
@@ -495,6 +495,8 @@ PERLVAR(Icustom_op_descs, HV*) /* Descriptions of user defined ops */
#ifdef PERLIO_LAYERS
PERLVARI(Iperlio, PerlIO *,NULL)
+PERLVARI(Iknown_layers, PerlIO_list_t *,NULL)
+PERLVARI(Idef_layerlist, PerlIO_list_t *,NULL)
#endif
/* New variables must be added to the very end for binary compatibility.
View
13 perl.c
@@ -258,7 +258,7 @@ perl_construct(pTHXx)
sys_intern_init();
#endif
- PerlIO_init(); /* Hook to IO system */
+ PerlIO_init(aTHX); /* Hook to IO system */
PL_fdpid = newAV(); /* for remembering popen pids by fd */
PL_modglobal = newHV(); /* pointers to per-interpreter module globals */
@@ -498,7 +498,7 @@ perl_destruct(pTHXx)
* flag is set in regexec.c:S_regtry
*/
SvFLAGS(resv) &= ~SVf_BREAK;
- }
+ }
else if(SvREPADTMP(resv)) {
SvREPADTMP_off(resv);
}
@@ -800,6 +800,11 @@ perl_destruct(pTHXx)
if (PL_sv_count != 0 && ckWARN_d(WARN_INTERNAL))
Perl_warner(aTHX_ WARN_INTERNAL,"Scalars leaked: %ld\n", (long)PL_sv_count);
+#if 1 && defined(PERLIO_LAYERS)
+ /* No more IO - including error messages ! */
+ PerlIO_cleanup(aTHX);
+#endif
+
Safefree(PL_origfilename);
Safefree(PL_reg_start_tmp);
if (PL_reg_curpm)
@@ -946,7 +951,7 @@ setuid perl scripts securely.\n");
{
/* we copy rather than point to argv
* since perl_clone will copy and perl_destruct
- * has no way of knowing if we've made a copy or
+ * has no way of knowing if we've made a copy or
* just point to argv
*/
int i = PL_origargc;
@@ -1517,7 +1522,7 @@ perl_run(pTHXx)
LEAVE;
FREETMPS;
PL_curstash = PL_defstash;
- if (!(PL_exit_flags & PERL_EXIT_DESTRUCT_END) &&
+ if (!(PL_exit_flags & PERL_EXIT_DESTRUCT_END) &&
PL_endav && !PL_minus_c)
call_list(oldscope, PL_endav);
#ifdef MYMALLOC
View
@@ -183,6 +183,8 @@ END_EXTERN_C
#define PL_debstash (*Perl_Idebstash_ptr(aTHX))
#undef PL_debug
#define PL_debug (*Perl_Idebug_ptr(aTHX))
+#undef PL_def_layerlist
+#define PL_def_layerlist (*Perl_Idef_layerlist_ptr(aTHX))
#undef PL_defgv
#define PL_defgv (*Perl_Idefgv_ptr(aTHX))
#undef PL_diehook
@@ -269,6 +271,8 @@ END_EXTERN_C
#define PL_initav (*Perl_Iinitav_ptr(aTHX))
#undef PL_inplace
#define PL_inplace (*Perl_Iinplace_ptr(aTHX))
+#undef PL_known_layers
+#define PL_known_layers (*Perl_Iknown_layers_ptr(aTHX))
#undef PL_last_lop
#define PL_last_lop (*Perl_Ilast_lop_ptr(aTHX))
#undef PL_last_lop_op
Oops, something went wrong.

0 comments on commit 3a1ee7e

Please sign in to comment.