summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChip Salzenberg <chip@atlantic.net>1996-12-24 09:07:00 +1200
committerChip Salzenberg <chip@atlantic.net>1996-12-24 09:07:00 +1200
commit724421654fcf33f3acf0a7b8f4356b9255c9265a (patch)
treed012d222503a4083d0ede9c85a41b65fdb79bd1a
parent9a089a51dfdd5e97da27c26fc8f4b6089cd8d22d (diff)
downloadperl-724421654fcf33f3acf0a7b8f4356b9255c9265a.tar.gz
[revert some function caching changes]perl-5.003_15
[remove] some function caching changes that were supposed to be improvements, but weren't.
-rw-r--r--Changes10
-rw-r--r--gv.c33
-rw-r--r--patchlevel.h2
-rw-r--r--sv.c5
4 files changed, 33 insertions, 17 deletions
diff --git a/Changes b/Changes
index 01b4730d6a..450c44432f 100644
--- a/Changes
+++ b/Changes
@@ -9,6 +9,16 @@ releases.)
----------------
+Version 5.003_15
+----------------
+
+As soon as I posted 5.003_14, I found a fatal error in it. :-(
+
+This release is strictly a bug fix -- it removes some function caching
+changes that were supposed to be improvements, but weren't.
+
+
+----------------
Version 5.003_14
----------------
diff --git a/gv.c b/gv.c
index 8db44b42f0..fed7eca3dc 100644
--- a/gv.c
+++ b/gv.c
@@ -143,18 +143,19 @@ I32 level;
if (SvTYPE(topgv) != SVt_PVGV)
gv_init(topgv, stash, name, len, TRUE);
- if (cv = GvCV(topgv)) {
- if (CvXSUB(cv) || CvROOT(cv)) { /* Not undefed. */
- if (!GvCVGEN(topgv) || /* not an inheritance cache */
- GvCVGEN(topgv) >= sub_generation) /* valid inh. cache */
- return topgv;
+ if (cv=GvCV(topgv)) {
+ if (GvCVGEN(topgv) >= sub_generation)
+ return topgv; /* valid cached inheritance */
+ if (!GvCVGEN(topgv)) { /* not an inheritance cache */
+ return topgv;
+ }
+ else {
+ /* stale cached entry, just junk it */
+ GvCV(topgv) = cv = 0;
+ GvCVGEN(topgv) = 0;
}
- /* stale cached entry, just junk it */
- SvREFCNT_dec(cv);
- GvCV(topgv) = cv = 0;
- GvCVGEN(topgv) = 0;
}
- /* Now cv = 0, and there is no cv in topgv. */
+ /* if cv is still set, we have to free it if we find something to cache */
gvp = (GV**)hv_fetch(stash,"ISA",3,FALSE);
if (gvp && (gv = *gvp) != (GV*)&sv_undef && (av = GvAV(gv))) {
@@ -171,9 +172,13 @@ I32 level;
}
gv = gv_fetchmeth(basestash, name, len, level + 1);
if (gv) {
+ if (cv) { /* junk old undef */
+ assert(SvREFCNT(topgv) > 1);
+ SvREFCNT_dec(topgv);
+ SvREFCNT_dec(cv);
+ }
GvCV(topgv) = GvCV(gv); /* cache the CV */
GvCVGEN(topgv) = sub_generation; /* valid for now */
- SvREFCNT_inc(GvCV(gv));
return gv;
}
}
@@ -182,9 +187,13 @@ I32 level;
if (!level) {
if (lastchance = gv_stashpvn("UNIVERSAL", 9, FALSE)) {
if (gv = gv_fetchmeth(lastchance, name, len, level + 1)) {
+ if (cv) { /* junk old undef */
+ assert(SvREFCNT(topgv) > 1);
+ SvREFCNT_dec(topgv);
+ SvREFCNT_dec(cv);
+ }
GvCV(topgv) = GvCV(gv); /* cache the CV */
GvCVGEN(topgv) = sub_generation; /* valid for now */
- SvREFCNT_inc(GvCV(gv));
return gv;
}
}
diff --git a/patchlevel.h b/patchlevel.h
index a3ad66d227..07c9884f51 100644
--- a/patchlevel.h
+++ b/patchlevel.h
@@ -1,5 +1,5 @@
#define PATCHLEVEL 3
-#define SUBVERSION 14
+#define SUBVERSION 15
/*
local_patches -- list of locally applied less-than-subversion patches.
diff --git a/sv.c b/sv.c
index 47869b1209..87a1a2d017 100644
--- a/sv.c
+++ b/sv.c
@@ -1949,14 +1949,11 @@ register SV *sstr;
(CvROOT(cv) || CvXSUB(cv)) )
warn("Subroutine %s redefined",
GvENAME((GV*)dstr));
- if (SvREFCNT(cv) == 1)
- SvFAKE_on(cv);
+ SvFAKE_on(cv);
}
}
- sub_generation++;
if (GvCV(dstr) != (CV*)sref) {
GvCV(dstr) = (CV*)sref;
- GvCVGEN(dstr) = 0; /* Switch off cacheness. */
GvASSUMECV_on(dstr);
}
if (curcop->cop_stash != GvSTASH(dstr))