cvs commit: ponie/perl/ext/Devel/Peek/t Peek.t

[email protected] (Nicholas Clark) 5 May 2004 18:23:19 -0000
Newsgroups perl.ponie.changes
Message-ID <[email protected]>
cvsuser     04/05/05 11:23:19

  Modified:    perl     embed.fnc proto.h sv.c
               perl/ext/Devel/Peek/t Peek.t
  Log:
  Hide PVs as PMCs
  
  Revision  Changes    Path
  1.19      +3 -3      ponie/perl/embed.fnc
  
  Index: embed.fnc
  ===================================================================
  RCS file: /cvs/public/ponie/perl/embed.fnc,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -w -r1.18 -r1.19
  --- embed.fnc	5 May 2004 16:10:23 -0000	1.18
  +++ embed.fnc	5 May 2004 18:23:18 -0000	1.19
  @@ -1266,7 +1266,7 @@
   s	|void	|more_xrv
   s	|XPVIV*	|new_xiv
   s	|XPVNV*	|new_xnv
  -s	|XPV*	|new_xpv
  +s	|Parrot_PMC	|new_xpv
   s	|Parrot_PMC	|new_xpviv
   s	|Parrot_PMC	|new_xpvnv
   s	|Parrot_PMC	|new_xpvcv
  @@ -1277,10 +1277,10 @@
   s	|XPVMG*	|new_xpvmg
   s	|Parrot_PMC	|new_xpvlv
   s	|XPVBM*	|new_xpvbm
  -s	|XRV*	|new_xrv
  +s	|Parrot_PMC	|new_xrv
   s	|void	|del_xiv	|XPVIV* p
   s	|void	|del_xnv	|XPVNV* p
  -s	|void	|del_xpv	|XPV* p
  +s	|void	|del_xpv	|Parrot_PMC p
   s	|void	|del_xpviv	|Parrot_PMC p
   s	|void	|del_xpvnv	|Parrot_PMC p
   s	|void	|del_xpvcv	|Parrot_PMC p
  
  
  
  1.19      +3 -3      ponie/perl/proto.h
  
  Index: proto.h
  ===================================================================
  RCS file: /cvs/public/ponie/perl/proto.h,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -w -r1.18 -r1.19
  --- proto.h	5 May 2004 16:10:24 -0000	1.18
  +++ proto.h	5 May 2004 18:23:18 -0000	1.19
  @@ -1218,7 +1218,7 @@
   STATIC void	S_more_xrv(pTHX);
   STATIC XPVIV*	S_new_xiv(pTHX);
   STATIC XPVNV*	S_new_xnv(pTHX);
  -STATIC XPV*	S_new_xpv(pTHX);
  +STATIC Parrot_PMC	S_new_xpv(pTHX);
   STATIC Parrot_PMC	S_new_xpviv(pTHX);
   STATIC Parrot_PMC	S_new_xpvnv(pTHX);
   STATIC Parrot_PMC	S_new_xpvcv(pTHX);
  @@ -1229,10 +1229,10 @@
   STATIC XPVMG*	S_new_xpvmg(pTHX);
   STATIC Parrot_PMC	S_new_xpvlv(pTHX);
   STATIC XPVBM*	S_new_xpvbm(pTHX);
  -STATIC XRV*	S_new_xrv(pTHX);
  +STATIC Parrot_PMC	S_new_xrv(pTHX);
   STATIC void	S_del_xiv(pTHX_ XPVIV* p);
   STATIC void	S_del_xnv(pTHX_ XPVNV* p);
  -STATIC void	S_del_xpv(pTHX_ XPV* p);
  +STATIC void	S_del_xpv(pTHX_ Parrot_PMC p);
   STATIC void	S_del_xpviv(pTHX_ Parrot_PMC p);
   STATIC void	S_del_xpvnv(pTHX_ Parrot_PMC p);
   STATIC void	S_del_xpvcv(pTHX_ Parrot_PMC p);
  
  
  
  1.26      +15 -15    ponie/perl/sv.c
  
  Index: sv.c
  ===================================================================
  RCS file: /cvs/public/ponie/perl/sv.c,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -w -r1.25 -r1.26
  --- sv.c	5 May 2004 16:10:24 -0000	1.25
  +++ sv.c	5 May 2004 18:23:18 -0000	1.26
  @@ -718,7 +718,7 @@
   
   /* grab a new struct xrv from the free list, allocating more if necessary */
   
  -STATIC XRV*
  +STATIC Parrot_PMC
   S_new_xrv(pTHX)
   {
     Parrot_Int  type = Parrot_PMC_typenum(PL_Parrot, "Perl5RV");
  @@ -765,28 +765,26 @@
   
   /* grab a new struct xpv from the free list, allocating more if necessary */
   
  -STATIC XPV*
  +STATIC Parrot_PMC
   S_new_xpv(pTHX)
   {
  -    XPV* xpv;
  -    LOCK_SV_MUTEX;
  -    if (!PL_xpv_root)
  -	more_xpv();
  -    xpv = PL_xpv_root;
  -    PL_xpv_root = (XPV*)xpv->xpv_pv;
  -    UNLOCK_SV_MUTEX;
  -    return xpv;
  +  Parrot_Int  type = Parrot_PMC_typenum(PL_Parrot, "Perl5PV");
  +  Parrot_PMC  pv;
  +  /*
  +    Instead of giving back a real XPV we give back a PMC
  +  */
  +
  +  pv = Parrot_PMC_new(PL_Parrot, type);
  +  Parrot_register_pmc(PL_Parrot, pv);
  +  return MUMBLE(pv);
   }
   
   /* return a struct xpv to the free list */
   
   STATIC void
  -S_del_xpv(pTHX_ XPV *p)
  +S_del_xpv(pTHX_ Parrot_PMC p)
   {
  -    LOCK_SV_MUTEX;
  -    p->xpv_pv = (char*)PL_xpv_root;
  -    PL_xpv_root = p;
  -    UNLOCK_SV_MUTEX;
  +  Parrot_unregister_pmc(PL_Parrot, p);
   }
   
   /* allocate another arena's worth of struct xpv */
  @@ -1778,6 +1776,7 @@
   	magic	= 0;
   	stash	= 0;
   	del_XPV(SvANY(sv));
  +	SvPMC_off(sv);
   	if (mt <= SVt_IV)
   	    mt = SVt_PVIV;
   	else if (mt == SVt_NV)
  @@ -1837,6 +1836,7 @@
   	break;
       case SVt_PV:
   	SvANY(sv) = new_XPV();
  +	SvPMC_on(sv);
   	SvPVX(sv)	= pv;
   	SvCUR(sv)	= cur;
   	SvLEN(sv)	= len;
  
  
  
  1.6       +6 -6      ponie/perl/ext/Devel/Peek/t/Peek.t
  
  Index: Peek.t
  ===================================================================
  RCS file: /cvs/public/ponie/perl/ext/Devel/Peek/t/Peek.t,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -w -r1.5 -r1.6
  --- Peek.t	5 May 2004 16:10:25 -0000	1.5
  +++ Peek.t	5 May 2004 18:23:19 -0000	1.6
  @@ -53,7 +53,7 @@
   	$a = "foo",
   'SV = PV\\($ADDR\\) at $ADDR
     REFCNT = 1
  -  FLAGS = \\(POK,pPOK\\)
  +  FLAGS = \\(pmc,POK,pPOK\\)
     PV = $ADDR "foo"\\\0
     CUR = 3
     LEN = \\d+'
  @@ -135,7 +135,7 @@
     RV = $ADDR
     SV = PV\\($ADDR\\) at $ADDR
       REFCNT = 2
  -    FLAGS = \\(POK,pPOK\\)
  +    FLAGS = \\(pmc,POK,pPOK\\)
       PV = $ADDR "foo"\\\0
       CUR = 3
       LEN = \\d+');
  @@ -328,7 +328,7 @@
   	chr(256).chr(0).chr(512),
   'SV = PV\\($ADDR\\) at $ADDR
     REFCNT = 1
  -  FLAGS = \\((?:PADTMP,)?POK,READONLY,pPOK,UTF8\\)
  +  FLAGS = \\(pmc,(?:PADTMP,)?POK,READONLY,pPOK,UTF8\\)
     PV = $ADDR "\\\214\\\101\\\0\\\235\\\101"\\\0 \[UTF8 "\\\x\{100\}\\\x\{0\}\\\x\{200\}"\]
     CUR = 5
     LEN = \\d+');
  @@ -337,7 +337,7 @@
   	chr(256).chr(0).chr(512),
   'SV = PV\\($ADDR\\) at $ADDR
     REFCNT = 1
  -  FLAGS = \\((?:PADTMP,)?POK,READONLY,pPOK,UTF8\\)
  +  FLAGS = \\(pmc,(?:PADTMP,)?POK,READONLY,pPOK,UTF8\\)
     PV = $ADDR "\\\304\\\200\\\0\\\310\\\200"\\\0 \[UTF8 "\\\x\{100\}\\\x\{0\}\\\x\{200\}"\]
     CUR = 5
     LEN = \\d+');
  @@ -365,7 +365,7 @@
       Elt "\\\214\\\101" \[UTF8 "\\\x\{100\}"\] HASH = $ADDR
       SV = PV\\($ADDR\\) at $ADDR
         REFCNT = 1
  -      FLAGS = \\(POK,pPOK,UTF8\\)
  +      FLAGS = \\(pmc,POK,pPOK,UTF8\\)
         PV = $ADDR "\\\235\\\101"\\\0 \[UTF8 "\\\x\{200\}"\]
         CUR = 2
         LEN = \\d+');
  @@ -391,7 +391,7 @@
       Elt "\\\304\\\200" \[UTF8 "\\\x\{100\}"\] HASH = $ADDR
       SV = PV\\($ADDR\\) at $ADDR
         REFCNT = 1
  -      FLAGS = \\(POK,pPOK,UTF8\\)
  +      FLAGS = \\(pmc,POK,pPOK,UTF8\\)
         PV = $ADDR "\\\310\\\200"\\\0 \[UTF8 "\\\x\{200\}"\]
         CUR = 2
         LEN = \\d+');