develooper Front page | perl.ponie.changes | Postings from March 2006

[svn:ponie] r399 - branches/5.9.3merge/perl

From:
nicholas
Date:
March 17, 2006 13:46
Subject:
[svn:ponie] r399 - branches/5.9.3merge/perl
Message ID:
20060317214552.955F0CBA2B@x12.develooper.com
Author: nicholas
Date: Fri Mar 17 13:45:51 2006
New Revision: 399

Modified:
   branches/5.9.3merge/perl/av.c
   branches/5.9.3merge/perl/dump.c
   branches/5.9.3merge/perl/embed.fnc
   branches/5.9.3merge/perl/embed.h
   branches/5.9.3merge/perl/global.sym
   branches/5.9.3merge/perl/hv.h
   branches/5.9.3merge/perl/mg.c
   branches/5.9.3merge/perl/op.c
   branches/5.9.3merge/perl/perl.h
   branches/5.9.3merge/perl/pp.c
   branches/5.9.3merge/perl/proto.h
   branches/5.9.3merge/perl/sv.c

Log:
Remove all references to the 5.9.2-5.9.3 magic types that were added to allow
the PVAV and PVHV structures to be shrunk.
Correct the definition of hv_name_set (add the missing line, so that it actually
does something).


Modified: branches/5.9.3merge/perl/av.c
==============================================================================
--- branches/5.9.3merge/perl/av.c	(original)
+++ branches/5.9.3merge/perl/av.c	Fri Mar 17 13:45:51 2006
@@ -915,25 +915,6 @@
 	return FALSE;
 }
 
-SV **
-Perl_av_arylen_p(pTHX_ AV *av) {
-    dVAR;
-    MAGIC *mg;
-
-    assert(av);
-
-    mg = mg_find((SV*)av, PERL_MAGIC_arylen_p);
-
-    if (!mg) {
-	mg = sv_magicext((SV*)av, 0, PERL_MAGIC_arylen_p, &PL_vtbl_arylen_p,
-			 0, 0);
-	assert(mg);
-	/* sv_magicext won't set this for us because we pass in a NULL obj  */
-	mg->mg_flags |= MGf_REFCOUNTED;
-    }
-    return &(mg->mg_obj);
-}
-
 /*
  * Local variables:
  * c-indentation-style: bsd

Modified: branches/5.9.3merge/perl/dump.c
==============================================================================
--- branches/5.9.3merge/perl/dump.c	(original)
+++ branches/5.9.3merge/perl/dump.c	Fri Mar 17 13:45:51 2006
@@ -893,12 +893,9 @@
 static const struct { const char type; const char *name; } magic_names[] = {
 	{ PERL_MAGIC_sv,             "sv(\\0)" },
 	{ PERL_MAGIC_arylen,         "arylen(#)" },
-	{ PERL_MAGIC_rhash,          "rhash(%)" },
 	{ PERL_MAGIC_glob,           "glob(*)" },
 	{ PERL_MAGIC_pos,            "pos(.)" },
-	{ PERL_MAGIC_symtab,         "symtab(:)" },
 	{ PERL_MAGIC_backref,        "backref(<)" },
-	{ PERL_MAGIC_arylen_p,       "arylen_p(@)" },
 	{ PERL_MAGIC_overload,       "overload(A)" },
 	{ PERL_MAGIC_bm,             "bm(B)" },
 	{ PERL_MAGIC_regdata,        "regdata(D)" },
@@ -974,7 +971,6 @@
 	    else if (v == &PL_vtbl_amagicelem) s = "amagicelem";
 	    else if (v == &PL_vtbl_backref)    s = "backref";
 	    else if (v == &PL_vtbl_utf8)       s = "utf8";
-            else if (v == &PL_vtbl_arylen_p)   s = "arylen_p";
 	    if (s)
 	        Perl_dump_indent(aTHX_ level, file, "    MG_VIRTUAL = &PL_vtbl_%s\n", s);
 	    else
@@ -1434,12 +1430,8 @@
 	Perl_dump_indent(aTHX_ level, file, "  MAX = %"IVdf"\n", (IV)HvMAX(sv));
 	Perl_dump_indent(aTHX_ level, file, "  RITER = %"IVdf"\n", (IV)HvRITER_get(sv));
 	Perl_dump_indent(aTHX_ level, file, "  EITER = 0x%"UVxf"\n", PTR2UV(HvEITER_get(sv)));
-	{
-	    MAGIC *mg = mg_find(sv, PERL_MAGIC_symtab);
-	    if (mg && mg->mg_obj) {
-		Perl_dump_indent(aTHX_ level, file, "  PMROOT = 0x%"UVxf"\n", PTR2UV(mg->mg_obj));
-	    }
-	}
+	if (HvPMROOT(sv))
+	    Perl_dump_indent(aTHX_ level, file, "  PMROOT = 0x%"UVxf"\n", PTR2UV(HvPMROOT(sv)));
 	{
 	    const char *hvname = HvNAME_get(sv);
 	    if (hvname)

Modified: branches/5.9.3merge/perl/embed.fnc
==============================================================================
--- branches/5.9.3merge/perl/embed.fnc	(original)
+++ branches/5.9.3merge/perl/embed.fnc	Fri Mar 17 13:45:51 2006
@@ -112,7 +112,6 @@
 Apd	|SV**	|av_store	|NN AV* ar|I32 key|NULLOK SV* val
 Apd	|void	|av_undef	|NN AV* ar
 Apd	|void	|av_unshift	|NN AV* ar|I32 num
-Apo	|SV**	|av_arylen_p	|NN AV* av
 pR	|OP*	|bind_match	|I32 type|NN OP* left|NN OP* pat
 pR	|OP*	|block_end	|I32 floor|NULLOK OP* seq
 ApR	|I32	|block_gimme
@@ -423,7 +422,6 @@
 p	|int	|magic_set	|NN SV* sv|NN MAGIC* mg
 p	|int	|magic_setamagic|NN SV* sv|NN MAGIC* mg
 p	|int	|magic_setarylen|NN SV* sv|NN MAGIC* mg
-p	|int	|magic_freearylen_p|NN SV* sv|NN MAGIC* mg
 p	|int	|magic_setbm	|NN SV* sv|NN MAGIC* mg
 p	|int	|magic_setdbline|NN SV* sv|NN MAGIC* mg
 p	|int	|magic_setdefelem|NN SV* sv|NN MAGIC* mg

Modified: branches/5.9.3merge/perl/embed.h
==============================================================================
--- branches/5.9.3merge/perl/embed.h	(original)
+++ branches/5.9.3merge/perl/embed.h	Fri Mar 17 13:45:51 2006
@@ -421,7 +421,6 @@
 #define magic_set		Perl_magic_set
 #define magic_setamagic		Perl_magic_setamagic
 #define magic_setarylen		Perl_magic_setarylen
-#define magic_freearylen_p	Perl_magic_freearylen_p
 #define magic_setbm		Perl_magic_setbm
 #define magic_setdbline		Perl_magic_setdbline
 #define magic_setdefelem	Perl_magic_setdefelem
@@ -2492,7 +2491,6 @@
 #define magic_set(a,b)		Perl_magic_set(aTHX_ a,b)
 #define magic_setamagic(a,b)	Perl_magic_setamagic(aTHX_ a,b)
 #define magic_setarylen(a,b)	Perl_magic_setarylen(aTHX_ a,b)
-#define magic_freearylen_p(a,b)	Perl_magic_freearylen_p(aTHX_ a,b)
 #define magic_setbm(a,b)	Perl_magic_setbm(aTHX_ a,b)
 #define magic_setdbline(a,b)	Perl_magic_setdbline(aTHX_ a,b)
 #define magic_setdefelem(a,b)	Perl_magic_setdefelem(aTHX_ a,b)

Modified: branches/5.9.3merge/perl/global.sym
==============================================================================
--- branches/5.9.3merge/perl/global.sym	(original)
+++ branches/5.9.3merge/perl/global.sym	Fri Mar 17 13:45:51 2006
@@ -49,7 +49,6 @@
 Perl_av_store
 Perl_av_undef
 Perl_av_unshift
-Perl_av_arylen_p
 Perl_block_gimme
 Perl_call_list
 Perl_cast_ulong

Modified: branches/5.9.3merge/perl/hv.h
==============================================================================
--- branches/5.9.3merge/perl/hv.h	(original)
+++ branches/5.9.3merge/perl/hv.h	Fri Mar 17 13:45:51 2006
@@ -193,6 +193,7 @@
 #define HvNAME_get(hv)	(0 + ((XPVHV*)  SvANY(hv))->xhv_name)
 #define HvNAMELEN_get(hv) strlen(HvNAME(hv))
 #define hv_name_set(hv,name,length,flags) \
+    (HvNAME((hv)) = (name) ? savepvn(name, length) : 0)
 
 /* Sadly we can't do this as an LVALUE */
 #define HvDATA(hv)          ((XPVHV*) SvANY(hv))

Modified: branches/5.9.3merge/perl/mg.c
==============================================================================
--- branches/5.9.3merge/perl/mg.c	(original)
+++ branches/5.9.3merge/perl/mg.c	Fri Mar 17 13:45:51 2006
@@ -428,9 +428,6 @@
 	case PERL_MAGIC_arylen:
 	case PERL_MAGIC_pos:
 	case PERL_MAGIC_backref:
-	case PERL_MAGIC_arylen_p:
-	case PERL_MAGIC_rhash:
-	case PERL_MAGIC_symtab:
 	    continue;
 	}
 		

Modified: branches/5.9.3merge/perl/op.c
==============================================================================
--- branches/5.9.3merge/perl/op.c	(original)
+++ branches/5.9.3merge/perl/op.c	Fri Mar 17 13:45:51 2006
@@ -406,22 +406,19 @@
 clear_pmop:
 	{
 	    HV * const pmstash = PmopSTASH(cPMOPo);
-	    if (pmstash && !SvIS_FREED(pmstash)) {
-		MAGIC * const mg = mg_find((SV*)pmstash, PERL_MAGIC_symtab);
-		if (mg) {
-		    PMOP *pmop = (PMOP*) mg->mg_obj;
-		    PMOP *lastpmop = NULL;
-		    while (pmop) {
-			if (cPMOPo == pmop) {
-			    if (lastpmop)
-				lastpmop->op_pmnext = pmop->op_pmnext;
-			    else
-				mg->mg_obj = (SV*) pmop->op_pmnext;
-			    break;
-			}
-			lastpmop = pmop;
-			pmop = pmop->op_pmnext;
+	    if (pmstash && SvREFCNT(pmstash)) {
+		PMOP *pmop = HvPMROOT(pmstash);
+		PMOP *lastpmop = NULL;
+		while (pmop) {
+		    if (cPMOPo == pmop) {
+			if (lastpmop)
+			    lastpmop->op_pmnext = pmop->op_pmnext;
+			else
+			    HvPMROOT(pmstash) = pmop->op_pmnext;
+			break;
 		    }
+		    lastpmop = pmop;
+		    pmop = pmop->op_pmnext;
 		}
 	    }
 	    PmopSTASH_free(cPMOPo);
@@ -2751,13 +2748,8 @@
 
         /* link into pm list */
     if (type != OP_TRANS && PL_curstash) {
-	MAGIC *mg = mg_find((SV*)PL_curstash, PERL_MAGIC_symtab);
-
-	if (!mg) {
-	    mg = sv_magicext((SV*)PL_curstash, 0, PERL_MAGIC_symtab, 0, 0, 0);
-	}
-	pmop->op_pmnext = (PMOP*)mg->mg_obj;
-	mg->mg_obj = (SV*)pmop;
+	pmop->op_pmnext = HvPMROOT(PL_curstash);
+	HvPMROOT(PL_curstash) = pmop;
 	PmopSTASH_set(pmop,PL_curstash);
     }
 

Modified: branches/5.9.3merge/perl/perl.h
==============================================================================
--- branches/5.9.3merge/perl/perl.h	(original)
+++ branches/5.9.3merge/perl/perl.h	Fri Mar 17 13:45:51 2006
@@ -3512,9 +3512,6 @@
 #define PERL_MAGIC_arylen	  '#' /* Array length ($#ary) */
 #define PERL_MAGIC_pos		  '.' /* pos() lvalue */
 #define PERL_MAGIC_backref	  '<' /* for weak ref data */
-#define PERL_MAGIC_symtab	  ':' /* extra data for symbol tables */
-#define PERL_MAGIC_rhash	  '%' /* extra data for restricted hashes */
-#define PERL_MAGIC_arylen_p	  '@' /* to move arylen out of XPVAV */
 #define PERL_MAGIC_ext		  '~' /* Available for use by extensions */
 
 
@@ -4136,8 +4133,6 @@
     want_vtbl_regdatum,
     want_vtbl_backref,
     want_vtbl_utf8,
-    want_vtbl_symtab,
-    want_vtbl_arylen_p
 };
 
 				/* Note: the lowest 8 bits are reserved for
@@ -4497,17 +4492,6 @@
 );
 
 MGVTBL_SET(
-    PL_vtbl_arylen_p,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    MEMBER_TO_FPTR(Perl_magic_freearylen_p),
-    NULL,
-    NULL
-);
-
-MGVTBL_SET(
     PL_vtbl_glob,
     MEMBER_TO_FPTR(Perl_magic_getglob),
     MEMBER_TO_FPTR(Perl_magic_setglob),

Modified: branches/5.9.3merge/perl/pp.c
==============================================================================
--- branches/5.9.3merge/perl/pp.c	(original)
+++ branches/5.9.3merge/perl/pp.c	Fri Mar 17 13:45:51 2006
@@ -294,15 +294,15 @@
 
 PP(pp_av2arylen)
 {
-    dVAR; dSP;
-    AV * const av = (AV*)TOPs;
-    SV ** const sv = Perl_av_arylen_p(aTHX_ (AV*)av);
-    if (!*sv) {
-	*sv = newSV(0);
-	sv_upgrade(*sv, SVt_PVMG);
-	sv_magic(*sv, (SV*)av, PERL_MAGIC_arylen, NULL, 0);
+    dSP;
+    AV *av = (AV*)TOPs;
+    SV *sv = AvARYLEN(av);
+    if (!sv) {
+	AvARYLEN(av) = sv = newSV(0);
+	sv_upgrade(sv, SVt_IV);
+	sv_magic(sv, (SV*)av, PERL_MAGIC_arylen, Nullch, 0);
     }
-    SETs(*sv);
+    SETs(sv);
     RETURN;
 }
 

Modified: branches/5.9.3merge/perl/proto.h
==============================================================================
--- branches/5.9.3merge/perl/proto.h	(original)
+++ branches/5.9.3merge/perl/proto.h	Fri Mar 17 13:45:51 2006
@@ -178,9 +178,6 @@
 PERL_CALLCONV void	Perl_av_unshift(pTHX_ AV* ar, I32 num)
 			__attribute__nonnull__(pTHX_1);
 
-PERL_CALLCONV SV**	Perl_av_arylen_p(pTHX_ AV* av)
-			__attribute__nonnull__(pTHX_1);
-
 PERL_CALLCONV OP*	Perl_bind_match(pTHX_ I32 type, OP* left, OP* pat)
 			__attribute__warn_unused_result__
 			__attribute__nonnull__(pTHX_2)
@@ -1151,10 +1148,6 @@
 			__attribute__nonnull__(pTHX_1)
 			__attribute__nonnull__(pTHX_2);
 
-PERL_CALLCONV int	Perl_magic_freearylen_p(pTHX_ SV* sv, MAGIC* mg)
-			__attribute__nonnull__(pTHX_1)
-			__attribute__nonnull__(pTHX_2);
-
 PERL_CALLCONV int	Perl_magic_setbm(pTHX_ SV* sv, MAGIC* mg)
 			__attribute__nonnull__(pTHX_1)
 			__attribute__nonnull__(pTHX_2);

Modified: branches/5.9.3merge/perl/sv.c
==============================================================================
--- branches/5.9.3merge/perl/sv.c	(original)
+++ branches/5.9.3merge/perl/sv.c	Fri Mar 17 13:45:51 2006
@@ -3647,7 +3647,6 @@
     if (!obj || obj == sv ||
 	how == PERL_MAGIC_arylen ||
 	how == PERL_MAGIC_qr ||
-	how == PERL_MAGIC_symtab ||
 	(SvTYPE(obj) == SVt_PVGV &&
 	    (GvSV(obj) == sv || GvHV(obj) == (HV*)sv || GvAV(obj) == (AV*)sv ||
 	    GvCV(obj) == (CV*)sv || GvIOp(obj) == (IO*)sv ||



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About