diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2000-02-14 05:01:56 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2000-02-14 05:01:56 +0000 |
commit | 2a6e449dc8b1d64e2d4f012a0f60099b25d8e380 (patch) | |
tree | 4c23dba5e1dd76b72b301bcee1eb96083c865e09 | |
parent | bde6b06b2c493fef8675c736d4a35e766b022abb (diff) | |
parent | 9b94d1ddc3fee7ce145aed1662eaa6ce880eeb97 (diff) | |
download | perl-2a6e449dc8b1d64e2d4f012a0f60099b25d8e380.tar.gz |
Integrate with Sarathy.
p4raw-id: //depot/cfgperl@5076
-rw-r--r-- | embed.h | 17 | ||||
-rwxr-xr-x | embed.pl | 5 | ||||
-rw-r--r-- | objXSUB.h | 3 | ||||
-rw-r--r-- | perl.c | 2 | ||||
-rwxr-xr-x | perlapi.c | 3 | ||||
-rw-r--r-- | proto.h | 5 | ||||
-rw-r--r-- | sv.c | 175 |
7 files changed, 5 insertions, 205 deletions
@@ -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 @@ -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) @@ -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 @@ -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))); @@ -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 @@ -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) @@ -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) |