From: Gurusamy Sarathy Date: Mon, 14 Feb 2000 04:45:01 +0000 (+0000) Subject: remove outdated -DPURIFY code--it reports bogus errors during global X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9b94d1ddc3fee7ce145aed1662eaa6ce880eeb97;p=p5sagit%2Fp5-mst-13.2.git remove outdated -DPURIFY code--it reports bogus errors during global destruction since we actually depend on SVs being in arenas there p4raw-id: //depot/perl@5074 --- diff --git a/embed.h b/embed.h index 61ffadf..028153b 100644 --- a/embed.h +++ b/embed.h @@ -1033,12 +1033,7 @@ #define sv_unglob S_sv_unglob #define not_a_number S_not_a_number #define visit S_visit -# if defined(PURIFY) -#define reg_add S_reg_add -#define reg_remove S_reg_remove -# else #define my_safemalloc S_my_safemalloc -# endif #define sv_add_backref S_sv_add_backref #define sv_del_backref S_sv_del_backref # if defined(DEBUGGING) @@ -2445,12 +2440,7 @@ #define sv_unglob(a) S_sv_unglob(aTHX_ a) #define not_a_number(a) S_not_a_number(aTHX_ a) #define visit(a) S_visit(aTHX_ a) -# if defined(PURIFY) -#define reg_add(a) S_reg_add(aTHX_ a) -#define reg_remove(a) S_reg_remove(aTHX_ a) -# else #define my_safemalloc S_my_safemalloc -# endif #define sv_add_backref(a,b) S_sv_add_backref(aTHX_ a,b) #define sv_del_backref(a) S_sv_del_backref(aTHX_ a) # if defined(DEBUGGING) @@ -4763,15 +4753,8 @@ #define not_a_number S_not_a_number #define S_visit CPerlObj::S_visit #define visit S_visit -# if defined(PURIFY) -#define S_reg_add CPerlObj::S_reg_add -#define reg_add S_reg_add -#define S_reg_remove CPerlObj::S_reg_remove -#define reg_remove S_reg_remove -# else #define S_my_safemalloc CPerlObj::S_my_safemalloc #define my_safemalloc S_my_safemalloc -# endif #define S_sv_add_backref CPerlObj::S_sv_add_backref #define sv_add_backref S_sv_add_backref #define S_sv_del_backref CPerlObj::S_sv_del_backref diff --git a/embed.pl b/embed.pl index 80dda09..7848e8d 100755 --- a/embed.pl +++ b/embed.pl @@ -2385,12 +2385,7 @@ s |void |del_xrv |XRV* p s |void |sv_unglob |SV* sv s |void |not_a_number |SV *sv s |void |visit |SVFUNC_t f -# if defined(PURIFY) -s |void |reg_add |SV *sv -s |void |reg_remove |SV *sv -# else ns |void* |my_safemalloc |MEM_SIZE size -# endif s |void |sv_add_backref |SV *tsv|SV *sv s |void |sv_del_backref |SV *sv # if defined(DEBUGGING) diff --git a/objXSUB.h b/objXSUB.h index 36d428f..e37978f 100644 --- a/objXSUB.h +++ b/objXSUB.h @@ -2153,9 +2153,6 @@ #if defined(PERL_IN_SCOPE_C) || defined(PERL_DECL_PROT) #endif #if defined(PERL_IN_SV_C) || defined(PERL_DECL_PROT) -# if defined(PURIFY) -# else -# endif # if defined(DEBUGGING) # endif #endif diff --git a/perl.c b/perl.c index 1891836..bab92b8 100644 --- a/perl.c +++ b/perl.c @@ -1453,7 +1453,7 @@ Perl_call_method(pTHX_ const char *methname, I32 flags) dSP; OP myop; if (!PL_op) { - myop.op_next = Nullop; + Zero(&myop, 1, OP); PL_op = &myop; } XPUSHs(sv_2mortal(newSVpv(methname,0))); diff --git a/perlapi.c b/perlapi.c index 4badd9f..d57a500 100644 --- a/perlapi.c +++ b/perlapi.c @@ -3851,9 +3851,6 @@ Perl_ptr_table_split(pTHXo_ PTR_TBL_t *tbl) #if defined(PERL_IN_SCOPE_C) || defined(PERL_DECL_PROT) #endif #if defined(PERL_IN_SV_C) || defined(PERL_DECL_PROT) -# if defined(PURIFY) -# else -# endif # if defined(DEBUGGING) # endif #endif diff --git a/proto.h b/proto.h index f00531c..80da727 100644 --- a/proto.h +++ b/proto.h @@ -1154,12 +1154,7 @@ STATIC void S_del_xrv(pTHX_ XRV* p); STATIC void S_sv_unglob(pTHX_ SV* sv); STATIC void S_not_a_number(pTHX_ SV *sv); STATIC void S_visit(pTHX_ SVFUNC_t f); -# if defined(PURIFY) -STATIC void S_reg_add(pTHX_ SV *sv); -STATIC void S_reg_remove(pTHX_ SV *sv); -# else STATIC void* S_my_safemalloc(MEM_SIZE size); -# endif STATIC void S_sv_add_backref(pTHX_ SV *tsv, SV *sv); STATIC void S_sv_del_backref(pTHX_ SV *sv); # if defined(DEBUGGING) diff --git a/sv.c b/sv.c index ac24299..7e791b2 100644 --- a/sv.c +++ b/sv.c @@ -25,105 +25,6 @@ static void do_clean_named_objs(pTHXo_ SV *sv); #endif static void do_clean_all(pTHXo_ SV *sv); - -#ifdef PURIFY - -#define new_SV(p) \ - STMT_START { \ - LOCK_SV_MUTEX; \ - (p) = (SV*)safemalloc(sizeof(SV)); \ - reg_add(p); \ - UNLOCK_SV_MUTEX; \ - SvANY(p) = 0; \ - SvREFCNT(p) = 1; \ - SvFLAGS(p) = 0; \ - } STMT_END - -#define del_SV(p) \ - STMT_START { \ - LOCK_SV_MUTEX; \ - reg_remove(p); \ - Safefree((char*)(p)); \ - UNLOCK_SV_MUTEX; \ - } STMT_END - -static SV **registry; -static I32 registry_size; - -#define REGHASH(sv,size) ((((U32)(sv)) >> 2) % (size)) - -#define REG_REPLACE(sv,a,b) \ - STMT_START { \ - void* p = sv->sv_any; \ - I32 h = REGHASH(sv, registry_size); \ - I32 i = h; \ - while (registry[i] != (a)) { \ - if (++i >= registry_size) \ - i = 0; \ - if (i == h) \ - Perl_die(aTHX_ "SV registry bug"); \ - } \ - registry[i] = (b); \ - } STMT_END - -#define REG_ADD(sv) REG_REPLACE(sv,Nullsv,sv) -#define REG_REMOVE(sv) REG_REPLACE(sv,sv,Nullsv) - -STATIC void -S_reg_add(pTHX_ SV *sv) -{ - if (PL_sv_count >= (registry_size >> 1)) - { - SV **oldreg = registry; - I32 oldsize = registry_size; - - registry_size = registry_size ? ((registry_size << 2) + 1) : 2037; - Newz(707, registry, registry_size, SV*); - - if (oldreg) { - I32 i; - - for (i = 0; i < oldsize; ++i) { - SV* oldsv = oldreg[i]; - if (oldsv) - REG_ADD(oldsv); - } - Safefree(oldreg); - } - } - - REG_ADD(sv); - ++PL_sv_count; -} - -STATIC void -S_reg_remove(pTHX_ SV *sv) -{ - REG_REMOVE(sv); - --PL_sv_count; -} - -STATIC void -S_visit(pTHX_ SVFUNC_t f) -{ - I32 i; - - for (i = 0; i < registry_size; ++i) { - SV* sv = registry[i]; - if (sv && SvTYPE(sv) != SVTYPEMASK) - (*f)(sv); - } -} - -void -Perl_sv_add_arena(pTHX_ char *ptr, U32 size, U32 flags) -{ - if (!(flags & SVf_FAKE)) - Safefree(ptr); -} - -#else /* ! PURIFY */ - /* * "A time to plant, and a time to uproot what was planted..." */ @@ -262,8 +163,6 @@ S_visit(pTHX_ SVFUNC_t f) } } -#endif /* PURIFY */ - void Perl_sv_report_used(pTHX) { @@ -801,42 +700,18 @@ S_more_xpvbm(pTHX) xpvbm->xpv_pv = 0; } -#ifdef PURIFY -#define new_XIV() (void*)safemalloc(sizeof(XPVIV)) -#define del_XIV(p) Safefree((char*)p) -#else #define new_XIV() (void*)new_xiv() #define del_XIV(p) del_xiv((XPVIV*) p) -#endif -#ifdef PURIFY -#define new_XNV() (void*)safemalloc(sizeof(XPVNV)) -#define del_XNV(p) Safefree((char*)p) -#else #define new_XNV() (void*)new_xnv() #define del_XNV(p) del_xnv((XPVNV*) p) -#endif -#ifdef PURIFY -#define new_XRV() (void*)safemalloc(sizeof(XRV)) -#define del_XRV(p) Safefree((char*)p) -#else #define new_XRV() (void*)new_xrv() #define del_XRV(p) del_xrv((XRV*) p) -#endif -#ifdef PURIFY -#define new_XPV() (void*)safemalloc(sizeof(XPV)) -#define del_XPV(p) Safefree((char*)p) -#else #define new_XPV() (void*)new_xpv() #define del_XPV(p) del_xpv((XPV *)p) -#endif -#ifdef PURIFY -# define my_safemalloc(s) safemalloc(s) -# define my_safefree(s) safefree(s) -#else STATIC void* S_my_safemalloc(MEM_SIZE size) { @@ -845,76 +720,34 @@ S_my_safemalloc(MEM_SIZE size) return (void*)p; } # define my_safefree(s) Safefree(s) -#endif -#ifdef PURIFY -#define new_XPVIV() (void*)safemalloc(sizeof(XPVIV)) -#define del_XPVIV(p) Safefree((char*)p) -#else #define new_XPVIV() (void*)new_xpviv() #define del_XPVIV(p) del_xpviv((XPVIV *)p) -#endif - -#ifdef PURIFY -#define new_XPVNV() (void*)safemalloc(sizeof(XPVNV)) -#define del_XPVNV(p) Safefree((char*)p) -#else + #define new_XPVNV() (void*)new_xpvnv() #define del_XPVNV(p) del_xpvnv((XPVNV *)p) -#endif - -#ifdef PURIFY -#define new_XPVCV() (void*)safemalloc(sizeof(XPVCV)) -#define del_XPVCV(p) Safefree((char*)p) -#else #define new_XPVCV() (void*)new_xpvcv() #define del_XPVCV(p) del_xpvcv((XPVCV *)p) -#endif -#ifdef PURIFY -#define new_XPVAV() (void*)safemalloc(sizeof(XPVAV)) -#define del_XPVAV(p) Safefree((char*)p) -#else #define new_XPVAV() (void*)new_xpvav() #define del_XPVAV(p) del_xpvav((XPVAV *)p) -#endif -#ifdef PURIFY -#define new_XPVHV() (void*)safemalloc(sizeof(XPVHV)) -#define del_XPVHV(p) Safefree((char*)p) -#else #define new_XPVHV() (void*)new_xpvhv() #define del_XPVHV(p) del_xpvhv((XPVHV *)p) -#endif -#ifdef PURIFY -#define new_XPVMG() (void*)safemalloc(sizeof(XPVMG)) -#define del_XPVMG(p) Safefree((char*)p) -#else #define new_XPVMG() (void*)new_xpvmg() #define del_XPVMG(p) del_xpvmg((XPVMG *)p) -#endif - -#ifdef PURIFY -#define new_XPVLV() (void*)safemalloc(sizeof(XPVLV)) -#define del_XPVLV(p) Safefree((char*)p) -#else + #define new_XPVLV() (void*)new_xpvlv() #define del_XPVLV(p) del_xpvlv((XPVLV *)p) -#endif - + #define new_XPVGV() (void*)my_safemalloc(sizeof(XPVGV)) #define del_XPVGV(p) my_safefree((char*)p) -#ifdef PURIFY -#define new_XPVBM() (void*)safemalloc(sizeof(XPVBM)) -#define del_XPVBM(p) Safefree((char*)p) -#else #define new_XPVBM() (void*)new_xpvbm() #define del_XPVBM(p) del_xpvbm((XPVBM *)p) -#endif - + #define new_XPVFM() (void*)my_safemalloc(sizeof(XPVFM)) #define del_XPVFM(p) my_safefree((char*)p)