cvs commit: ponie/src/pmc perl5cargo_cult.pmc perl5pv.pmc perl5pvav.pmc perl5pvbm.pmc perl5pvcv.pmc perl5pvfm.pmc perl5pvgv.pmc perl5pvhv.pmc perl5pvio.pmc perl5pviv.pmc perl5pvlv.pmc perl5pvmg.pmc perl5pvnv.pmc perl5rv.pmc ponie.h

[email protected] (Nicholas Clark) 30 Apr 2005 17:35:37 -0000
Newsgroups perl.ponie.changes
Message-ID <[email protected]>
cvsuser     05/04/30 10:35:37

  Modified:    perl     embed.fnc embed.h proto.h sv.c sv.h
               src/pmc  perl5cargo_cult.pmc perl5pv.pmc perl5pvav.pmc
                        perl5pvbm.pmc perl5pvcv.pmc perl5pvfm.pmc
                        perl5pvgv.pmc perl5pvhv.pmc perl5pvio.pmc
                        perl5pviv.pmc perl5pvlv.pmc perl5pvmg.pmc
                        perl5pvnv.pmc perl5rv.pmc ponie.h
  Log:
  Phase 2 of migrating sv_clear into the PMCs
  
  Revision  Changes    Path
  1.37      +1 -1      ponie/perl/embed.fnc
  
  Index: embed.fnc
  ===================================================================
  RCS file: /cvs/public/ponie/perl/embed.fnc,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- embed.fnc	30 Apr 2005 09:12:44 -0000	1.36
  +++ embed.fnc	30 Apr 2005 17:35:36 -0000	1.37
  @@ -1284,7 +1284,7 @@
   s	|void	|not_a_number	|SV *sv
   s	|I32	|visit		|SVFUNC_t f|U32 flags|U32 mask
   s	|void	|sv_add_backref	|SV *tsv|SV *sv
  -s	|void	|sv_del_backref	|SV *sv
  +p	|void	|sv_del_backref	|SV *sv
   #  if !defined(NV_PRESERVES_UV)
   s	|int	|sv_2iuv_non_preserve	|SV *sv|I32 numtype
   #  endif
  
  
  
  1.27      +2 -2      ponie/perl/embed.h
  
  Index: embed.h
  ===================================================================
  RCS file: /cvs/public/ponie/perl/embed.h,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- embed.h	30 Apr 2005 09:12:44 -0000	1.26
  +++ embed.h	30 Apr 2005 17:35:36 -0000	1.27
  @@ -1839,7 +1839,7 @@
   #define sv_add_backref		S_sv_add_backref
   #endif
   #ifdef PERL_CORE
  -#define sv_del_backref		S_sv_del_backref
  +#define sv_del_backref		Perl_sv_del_backref
   #endif
   #  if !defined(NV_PRESERVES_UV)
   #ifdef PERL_CORE
  @@ -4445,7 +4445,7 @@
   #define sv_add_backref(a,b)	S_sv_add_backref(aTHX_ a,b)
   #endif
   #ifdef PERL_CORE
  -#define sv_del_backref(a)	S_sv_del_backref(aTHX_ a)
  +#define sv_del_backref(a)	Perl_sv_del_backref(aTHX_ a)
   #endif
   #  if !defined(NV_PRESERVES_UV)
   #ifdef PERL_CORE
  
  
  
  1.37      +1 -1      ponie/perl/proto.h
  
  Index: proto.h
  ===================================================================
  RCS file: /cvs/public/ponie/perl/proto.h,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- proto.h	30 Apr 2005 09:12:44 -0000	1.36
  +++ proto.h	30 Apr 2005 17:35:36 -0000	1.37
  @@ -1236,7 +1236,7 @@
   STATIC void	S_not_a_number(pTHX_ SV *sv);
   STATIC I32	S_visit(pTHX_ SVFUNC_t f, U32 flags, U32 mask);
   STATIC void	S_sv_add_backref(pTHX_ SV *tsv, SV *sv);
  -STATIC void	S_sv_del_backref(pTHX_ SV *sv);
  +PERL_CALLCONV void	Perl_sv_del_backref(pTHX_ SV *sv);
   #  if !defined(NV_PRESERVES_UV)
   STATIC int	S_sv_2iuv_non_preserve(pTHX_ SV *sv, I32 numtype);
   #  endif
  
  
  
  1.70      +3 -104    ponie/perl/sv.c
  
  Index: sv.c
  ===================================================================
  RCS file: /cvs/public/ponie/perl/sv.c,v
  retrieving revision 1.69
  retrieving revision 1.70
  diff -u -r1.69 -r1.70
  --- sv.c	30 Apr 2005 13:10:28 -0000	1.69
  +++ sv.c	30 Apr 2005 17:35:36 -0000	1.70
  @@ -5464,8 +5464,8 @@
    * with the SV we point to.
    */
   
  -STATIC void
  -S_sv_del_backref(pTHX_ SV *sv)
  +void
  +Perl_sv_del_backref(pTHX_ SV *sv)
   {
       AV *av;
       SV **svp;
  @@ -5718,108 +5718,7 @@
   		--PL_sv_objcount;	/* XXX Might want something more general */
   	}
       }
  -    if (SvTYPE(sv) >= SVt_PVMG) {
  -    	if (SvMAGIC(sv))
  -	    mg_free(sv);
  -	if (SvFLAGS(sv) & SVpad_TYPED)
  -	    SvREFCNT_dec(SvSTASH(sv));
  -    }
  -    switch (SvTYPE(sv)) {
  -    case SVt_PVIO:
  -	if (IoIFP(sv) &&
  -	    IoIFP(sv) != PerlIO_stdin() &&
  -	    IoIFP(sv) != PerlIO_stdout() &&
  -	    IoIFP(sv) != PerlIO_stderr())
  -	{
  -	    io_close((IO*)sv, FALSE);
  -	}
  -	if (IoDIRP(sv) && !(IoFLAGS(sv) & IOf_FAKE_DIRP))
  -	    PerlDir_close(IoDIRP(sv));
  -	IoDIRP(sv) = (DIR*)NULL;
  -	Safefree(IoTOP_NAME(sv));
  -	Safefree(IoFMT_NAME(sv));
  -	Safefree(IoBOTTOM_NAME(sv));
  -	/* FALL THROUGH */
  -    case SVt_PVBM:
  -	goto freescalar;
  -    case SVt_PVCV:
  -    case SVt_PVFM:
  -	cv_undef((CV*)sv);
  -	goto freescalar;
  -    case SVt_PVHV:
  -	hv_undef((HV*)sv);
  -	break;
  -    case SVt_PVAV:
  -	av_undef((AV*)sv);
  -	break;
  -    case SVt_PVLV:
  -	if (LvTYPE(sv) == 'T') { /* for tie: return HE to pool */
  -	    SvREFCNT_dec(HeKEY_sv((HE*)LvTARG(sv)));
  -	    HeNEXT((HE*)LvTARG(sv)) = PL_hv_fetch_ent_mh;
  -	    PL_hv_fetch_ent_mh = (HE*)LvTARG(sv);
  -	}
  -	else if (LvTYPE(sv) != 't') /* unless tie: unrefcnted fake SV**  */
  -	    SvREFCNT_dec(LvTARG(sv));
  -	goto freescalar;
  -    case SVt_PVGV:
  -	gp_free((GV*)sv);
  -	Safefree(GvNAME(sv));
  -	/* cannot decrease stash refcount yet, as we might recursively delete
  -	   ourselves when the refcnt drops to zero. Delay SvREFCNT_dec
  -	   of stash until current sv is completely gone.
  -	   -- JohnPC, 27 Mar 1998 */
  -	/* FALL THROUGH */
  -    case SVt_PVMG:
  -    case SVt_PVNV:
  -    case SVt_PVIV:
  -      freescalar:
  -	SvOOK_off(sv);
  -	/* FALL THROUGH */
  -    case SVt_PV:
  -    case SVt_RV:
  -	if (SvROK(sv)) {
  -	    if (SvWEAKREF(sv))
  -	        sv_del_backref(sv);
  -	    else
  -	        SvREFCNT_dec(SvRV(sv));
  -	}
  -#ifdef PERL_COPY_ON_WRITE
  -	else if (SvPVX(sv)) {
  -            if (SvIsCOW(sv)) {
  -                /* I believe I need to grab the global SV mutex here and
  -                   then recheck the COW status.  */
  -                if (DEBUG_C_TEST) {
  -                    PerlIO_printf(Perl_debug_log, "Copy on write: clear\n");
  -                    sv_dump(sv);
  -                }
  -                sv_release_COW(sv, SvPVX(sv), SvCUR(sv), SvLEN(sv),
  -                                 SvUVX(sv), SV_COW_NEXT_SV(sv));
  -                /* And drop it here.  */
  -                SvFAKE_off(sv);
  -            } else if (SvLEN(sv)) {
  -                Safefree(SvPVX(sv));
  -            }
  -	}
  -#else
  -	else if (SvANY(sv)) {
  -	    if (SvPVX(sv) && SvLEN(sv))
  -		Safefree(SvPVX(sv));
  -	    else if (SvPVX(sv) && SvREADONLY(sv) && SvFAKE(sv)) {
  -		unsharepvn(SvPVX(sv),
  -			   SvUTF8(sv) ? -(I32)SvCUR(sv) : SvCUR(sv),
  -			   SvUVX(sv));
  -		SvFAKE_off(sv);
  -	    }
  -	}
  -#endif
  -	break;
  -/*
  -    case SVt_NV:
  -    case SVt_IV:
  -    case SVt_NULL:
  -	break;
  -*/
  -    }
  +
       Parrot_PMC_set_pointer_intkey(PL_Parrot,MUMBLE(sv), Ponie_P_CLEAR, 0);
   }
   
  
  
  
  1.73      +1 -0      ponie/perl/sv.h
  
  Index: sv.h
  ===================================================================
  RCS file: /cvs/public/ponie/perl/sv.h,v
  retrieving revision 1.72
  retrieving revision 1.73
  diff -u -r1.72 -r1.73
  --- sv.h	30 Apr 2005 13:10:29 -0000	1.72
  +++ sv.h	30 Apr 2005 17:35:36 -0000	1.73
  @@ -251,6 +251,7 @@
     Ponie_P_GET_UPGRADE,		/* Pull data from SvANY and free it   */
     Ponie_P_SET_UPGRADE,		/* Allocate SvANY and push data to it */
     Ponie_P_CLEAR,		/* Free SvANY and things hanging from it */
  +  Ponie_P_FREESCALAR_COMMON,	/* Common legacy code for freeing scalars */
     Ponie_P_UNGLOB,		/* Special things for sv_unglob */
     Ponie_P_NEWRV_HACK,		/* Special things for newSVrv */
     Ponie_P_REPLACE,		/* Special things for sv_replace */
  
  
  
  1.54      +30 -1     ponie/src/pmc/perl5cargo_cult.pmc
  
  Index: perl5cargo_cult.pmc
  ===================================================================
  RCS file: /cvs/public/ponie/src/pmc/perl5cargo_cult.pmc,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- perl5cargo_cult.pmc	30 Apr 2005 13:10:29 -0000	1.53
  +++ perl5cargo_cult.pmc	30 Apr 2005 17:35:36 -0000	1.54
  @@ -33,6 +33,35 @@
         & (SVs_GMG|SVs_SMG|SVs_RMG);
   }
   
  +void Ponie_freescalar_common(SV *sv) {
  +    /* OOK cannot be true on anything < PVIV, so no need to worry about
  +       misreading the IVX.  */
  +    SvOOK_off(sv);
  +    if (SvROK(sv)) {
  +        if (SvWEAKREF(sv))
  +            Perl_sv_del_backref(sv);
  +        else
  +            SvREFCNT_dec(SvRV(sv));
  +    }
  +    else if (SvANY(sv)) {
  +        if (SvPVX(sv) && SvLEN(sv))
  +            Safefree(SvPVX(sv));
  +        else if (SvPVX(sv) && SvREADONLY(sv) && SvFAKE(sv)) {
  +            unsharepvn(SvPVX(sv),
  +                       SvUTF8(sv) ? -(I32)SvCUR(sv) : SvCUR(sv),
  +                       SvUVX(sv));
  +            SvFAKE_off(sv);
  +        }
  +    }
  +}
  +
  +void Ponie_freescalar_common_magic(SV *sv) {
  +    if (SvMAGIC(sv))
  +        mg_free(sv);
  +    if (SvFLAGS(sv) & SVpad_TYPED)
  +        SvREFCNT_dec(SvSTASH(sv));
  +}
  +
   pmclass Perl5cargo_cult dynpmc {
   
       void init () {	
  
  
  
  1.4       +3 -1      ponie/src/pmc/perl5pv.pmc
  
  Index: perl5pv.pmc
  ===================================================================
  RCS file: /cvs/public/ponie/src/pmc/perl5pv.pmc,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- perl5pv.pmc	30 Apr 2005 13:10:29 -0000	1.3
  +++ perl5pv.pmc	30 Apr 2005 17:35:36 -0000	1.4
  @@ -69,6 +69,8 @@
               {
                   SV *sv = MUMBLE(SELF);
   
  +                Ponie_freescalar_common(sv);
  +
                   del_XPV(SvANY(sv));
                   Parrot_PMC_set_intval_intkey(PL_Parrot,SELF,
                                                Ponie_I_SV_ZERO_FLAGS_SET_TYPEMASK_BREAK_DEAD,
  
  
  
  1.4       +5 -1      ponie/src/pmc/perl5pvav.pmc
  
  Index: perl5pvav.pmc
  ===================================================================
  RCS file: /cvs/public/ponie/src/pmc/perl5pvav.pmc,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- perl5pvav.pmc	30 Apr 2005 13:10:29 -0000	1.3
  +++ perl5pvav.pmc	30 Apr 2005 17:35:36 -0000	1.4
  @@ -47,6 +47,10 @@
               {
                   SV *sv = MUMBLE(SELF);
   
  +                Ponie_freescalar_common_magic(sv);
  +
  +                av_undef((AV*)sv);
  +
                   del_XPVAV(SvANY(sv));
                   Parrot_PMC_set_intval_intkey(PL_Parrot,SELF,
                                                Ponie_I_SV_ZERO_FLAGS_SET_TYPEMASK_BREAK_DEAD,
  
  
  
  1.4       +5 -1      ponie/src/pmc/perl5pvbm.pmc
  
  Index: perl5pvbm.pmc
  ===================================================================
  RCS file: /cvs/public/ponie/src/pmc/perl5pvbm.pmc,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- perl5pvbm.pmc	30 Apr 2005 13:10:29 -0000	1.3
  +++ perl5pvbm.pmc	30 Apr 2005 17:35:36 -0000	1.4
  @@ -51,6 +51,10 @@
               {
                   SV *sv = MUMBLE(SELF);
   
  +                Ponie_freescalar_common_magic(sv);
  +
  +                Ponie_freescalar_common(sv);
  +
                   del_XPVBM(SvANY(sv));
                   Parrot_PMC_set_intval_intkey(PL_Parrot,SELF,
                                                Ponie_I_SV_ZERO_FLAGS_SET_TYPEMASK_BREAK_DEAD,
  
  
  
  1.5       +7 -1      ponie/src/pmc/perl5pvcv.pmc
  
  Index: perl5pvcv.pmc
  ===================================================================
  RCS file: /cvs/public/ponie/src/pmc/perl5pvcv.pmc,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- perl5pvcv.pmc	30 Apr 2005 13:10:29 -0000	1.4
  +++ perl5pvcv.pmc	30 Apr 2005 17:35:36 -0000	1.5
  @@ -42,6 +42,12 @@
               {
                   SV *sv = MUMBLE(SELF);
   
  +                Ponie_freescalar_common_magic(sv);
  +
  +                cv_undef((CV*)sv);
  +
  +                Ponie_freescalar_common(sv);
  +
                   del_XPVCV(SvANY(sv));
                   Parrot_PMC_set_intval_intkey(PL_Parrot,SELF,
                                                Ponie_I_SV_ZERO_FLAGS_SET_TYPEMASK_BREAK_DEAD,
  
  
  
  1.5       +7 -1      ponie/src/pmc/perl5pvfm.pmc
  
  Index: perl5pvfm.pmc
  ===================================================================
  RCS file: /cvs/public/ponie/src/pmc/perl5pvfm.pmc,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- perl5pvfm.pmc	30 Apr 2005 13:10:29 -0000	1.4
  +++ perl5pvfm.pmc	30 Apr 2005 17:35:36 -0000	1.5
  @@ -48,6 +48,12 @@
               {
                   SV *sv = MUMBLE(SELF);
   
  +                Ponie_freescalar_common_magic(sv);
  +
  +                cv_undef((CV*)sv);
  +
  +                Ponie_freescalar_common(sv);
  +
                   del_XPVFM(SvANY(sv));
                   Parrot_PMC_set_intval_intkey(PL_Parrot,SELF,
                                                Ponie_I_SV_ZERO_FLAGS_SET_TYPEMASK_BREAK_DEAD,
  
  
  
  1.5       +12 -1     ponie/src/pmc/perl5pvgv.pmc
  
  Index: perl5pvgv.pmc
  ===================================================================
  RCS file: /cvs/public/ponie/src/pmc/perl5pvgv.pmc,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- perl5pvgv.pmc	30 Apr 2005 13:10:29 -0000	1.4
  +++ perl5pvgv.pmc	30 Apr 2005 17:35:36 -0000	1.5
  @@ -59,6 +59,17 @@
                   SV *sv = MUMBLE(SELF);
                   HV *stash = GvSTASH(sv);
   
  +                Ponie_freescalar_common_magic(sv);
  +                gp_free((GV*)sv);
  +                Safefree(GvNAME(sv));
  +                /* cannot decrease stash refcount yet, as we might
  +                   recursively delete ourselves when the refcnt drops to
  +                   zero. Delay SvREFCNT_dec of stash until current sv is
  +                   completely gone.
  +                   -- JohnPC, 27 Mar 1998 */
  +
  +                Ponie_freescalar_common(sv);
  +
                   del_XPVGV(SvANY(sv));
                   Parrot_PMC_set_intval_intkey(PL_Parrot,SELF,
                                                Ponie_I_SV_ZERO_FLAGS_SET_TYPEMASK_BREAK_DEAD,
  
  
  
  1.4       +5 -1      ponie/src/pmc/perl5pvhv.pmc
  
  Index: perl5pvhv.pmc
  ===================================================================
  RCS file: /cvs/public/ponie/src/pmc/perl5pvhv.pmc,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- perl5pvhv.pmc	30 Apr 2005 13:10:29 -0000	1.3
  +++ perl5pvhv.pmc	30 Apr 2005 17:35:36 -0000	1.4
  @@ -48,6 +48,10 @@
               {
                   SV *sv = MUMBLE(SELF);
   
  +                Ponie_freescalar_common_magic(sv);
  +
  +                hv_undef((HV*)sv);
  +
                   del_XPVHV(SvANY(sv));
                   Parrot_PMC_set_intval_intkey(PL_Parrot,SELF,
                                                Ponie_I_SV_ZERO_FLAGS_SET_TYPEMASK_BREAK_DEAD,
  
  
  
  1.5       +18 -1     ponie/src/pmc/perl5pvio.pmc
  
  Index: perl5pvio.pmc
  ===================================================================
  RCS file: /cvs/public/ponie/src/pmc/perl5pvio.pmc,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- perl5pvio.pmc	30 Apr 2005 13:10:29 -0000	1.4
  +++ perl5pvio.pmc	30 Apr 2005 17:35:36 -0000	1.5
  @@ -50,6 +50,23 @@
               {
                   SV *sv = MUMBLE(SELF);
   
  +                Ponie_freescalar_common_magic(sv);
  +
  +                if (IoIFP(sv) &&
  +                    IoIFP(sv) != PerlIO_stdin() &&
  +                    IoIFP(sv) != PerlIO_stdout() &&
  +                    IoIFP(sv) != PerlIO_stderr()) {
  +                    Perl_io_close((IO*)sv, FALSE);
  +                }
  +                if (IoDIRP(sv) && !(IoFLAGS(sv) & IOf_FAKE_DIRP))
  +                    PerlDir_close(IoDIRP(sv));
  +                IoDIRP(sv) = (DIR*)NULL;
  +                Safefree(IoTOP_NAME(sv));
  +                Safefree(IoFMT_NAME(sv));
  +                Safefree(IoBOTTOM_NAME(sv));
  +
  +                Ponie_freescalar_common(sv);
  +
                   del_XPVIO(SvANY(sv));
                   Parrot_PMC_set_intval_intkey(PL_Parrot,SELF,
                                                Ponie_I_SV_ZERO_FLAGS_SET_TYPEMASK_BREAK_DEAD,
  
  
  
  1.5       +3 -1      ponie/src/pmc/perl5pviv.pmc
  
  Index: perl5pviv.pmc
  ===================================================================
  RCS file: /cvs/public/ponie/src/pmc/perl5pviv.pmc,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- perl5pviv.pmc	30 Apr 2005 13:10:29 -0000	1.4
  +++ perl5pviv.pmc	30 Apr 2005 17:35:36 -0000	1.5
  @@ -68,6 +68,8 @@
               {
                   SV *sv = MUMBLE(SELF);
   
  +                Ponie_freescalar_common(sv);
  +
                   del_XPVIV(SvANY(sv));
                   Parrot_PMC_set_intval_intkey(PL_Parrot,SELF,
                                                Ponie_I_SV_ZERO_FLAGS_SET_TYPEMASK_BREAK_DEAD,
  
  
  
  1.4       +15 -1     ponie/src/pmc/perl5pvlv.pmc
  
  Index: perl5pvlv.pmc
  ===================================================================
  RCS file: /cvs/public/ponie/src/pmc/perl5pvlv.pmc,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- perl5pvlv.pmc	30 Apr 2005 13:10:29 -0000	1.3
  +++ perl5pvlv.pmc	30 Apr 2005 17:35:36 -0000	1.4
  @@ -57,6 +57,20 @@
               {
                   SV *sv = MUMBLE(SELF);
   
  +                Ponie_freescalar_common_magic(sv);
  +
  +                if (LvTYPE(sv) == 'T') { /* for tie: return HE to pool */
  +                    SvREFCNT_dec(HeKEY_sv((HE*)LvTARG(sv)));
  +                    HeNEXT((HE*)LvTARG(sv)) = PL_hv_fetch_ent_mh;
  +                    PL_hv_fetch_ent_mh = (HE*)LvTARG(sv);
  +                }
  +                else if (LvTYPE(sv) != 't') {
  +                    /* unless tie: unrefcnted fake SV**  */
  +                    SvREFCNT_dec(LvTARG(sv));
  +                }
  +
  +                Ponie_freescalar_common(sv);
  +
                   del_XPVLV(SvANY(sv));
                   Parrot_PMC_set_intval_intkey(PL_Parrot,SELF,
                                                Ponie_I_SV_ZERO_FLAGS_SET_TYPEMASK_BREAK_DEAD,
  
  
  
  1.5       +4 -1      ponie/src/pmc/perl5pvmg.pmc
  
  Index: perl5pvmg.pmc
  ===================================================================
  RCS file: /cvs/public/ponie/src/pmc/perl5pvmg.pmc,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- perl5pvmg.pmc	30 Apr 2005 13:10:29 -0000	1.4
  +++ perl5pvmg.pmc	30 Apr 2005 17:35:36 -0000	1.5
  @@ -72,6 +72,9 @@
               {
                   SV *sv = MUMBLE(SELF);
   
  +                Ponie_freescalar_common_magic(sv);
  +                Ponie_freescalar_common(sv);
  +
                   del_XPVMG(SvANY(sv));
                   Parrot_PMC_set_intval_intkey(PL_Parrot,SELF,
                                                Ponie_I_SV_ZERO_FLAGS_SET_TYPEMASK_BREAK_DEAD,
  
  
  
  1.5       +3 -1      ponie/src/pmc/perl5pvnv.pmc
  
  Index: perl5pvnv.pmc
  ===================================================================
  RCS file: /cvs/public/ponie/src/pmc/perl5pvnv.pmc,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- perl5pvnv.pmc	30 Apr 2005 13:10:29 -0000	1.4
  +++ perl5pvnv.pmc	30 Apr 2005 17:35:36 -0000	1.5
  @@ -67,6 +67,8 @@
               {
                   SV *sv = MUMBLE(SELF);
   
  +                Ponie_freescalar_common(sv);
  +
                	del_XPVNV(SvANY(sv));
                   Parrot_PMC_set_intval_intkey(PL_Parrot,SELF,
                                                Ponie_I_SV_ZERO_FLAGS_SET_TYPEMASK_BREAK_DEAD,
  
  
  
  1.4       +18 -6     ponie/src/pmc/perl5rv.pmc
  
  Index: perl5rv.pmc
  ===================================================================
  RCS file: /cvs/public/ponie/src/pmc/perl5rv.pmc,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- perl5rv.pmc	30 Apr 2005 13:10:29 -0000	1.3
  +++ perl5rv.pmc	30 Apr 2005 17:35:36 -0000	1.4
  @@ -39,11 +39,23 @@
                   break;
               }
           case Ponie_P_CLEAR:
  -            assert(SvANY(MUMBLE(SELF)) == 0);
  -            Parrot_PMC_set_intval_intkey(PL_Parrot,SELF,
  -                                         Ponie_I_SV_ZERO_FLAGS_SET_TYPEMASK_BREAK_DEAD,
  -                                         0);
  -            break;
  +            {
  +                SV *sv = MUMBLE(SELF);
  +
  +                assert(SvANY(sv) == 0);
  +
  +                if (SvROK(sv)) {
  +                    if (SvWEAKREF(sv))
  +                        Perl_sv_del_backref(sv);
  +                    else
  +                        SvREFCNT_dec(SvRV(sv));
  +                }
  +
  +                Parrot_PMC_set_intval_intkey(PL_Parrot,SELF,
  +                                             Ponie_I_SV_ZERO_FLAGS_SET_TYPEMASK_BREAK_DEAD,
  +                                             0);
  +                break;
  +            }
           default:
               SUPER(key, value);
           }
  
  
  
  1.2       +25 -0     ponie/src/pmc/ponie.h
  
  Index: ponie.h
  ===================================================================
  RCS file: /cvs/public/ponie/src/pmc/ponie.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ponie.h	29 Apr 2005 22:11:31 -0000	1.1
  +++ ponie.h	30 Apr 2005 17:35:36 -0000	1.2
  @@ -1,3 +1,15 @@
  +/* Perl5cargo_cult.pmc -*- c -*-
  + *  Copyright: 2005 The Perl Foundation.  All Rights Reserved.
  + *  CVS Info
  + *     $Id$
  + *  Overview:
  + *     Structures and prototypes used internally by the ponie PMC classes.
  + *  Data Structure and Algorithms:
  + *  History:
  + *  Notes:
  + *  References:
  + */
  +
   #include "parrot/parrot.h"
   /*#include "parrot/embed.h"
     #include "parrot/extend.h"*/
  @@ -23,3 +35,16 @@
     U32	 p5_type;
     struct Ponie_upgrade_value value;
   };
  +
  +void Ponie_freescalar_common(SV *sv);
  +void Ponie_freescalar_common_magic(SV *sv);
  +
  +/*
  + * Local variables:
  + * c-indentation-style: bsd
  + * c-basic-offset: 4
  + * indent-tabs-mode: nil
  + * End:
  + *
  + * vim: expandtab shiftwidth=4:
  +*/