summaryrefslogtreecommitdiff
path: root/gv.c
diff options
context:
space:
mode:
authorJoshua Pritikin <joshua.pritikin@db.com>1998-07-09 05:22:46 -0400
committerGurusamy Sarathy <gsar@cpan.org>1998-07-10 21:23:53 +0000
commit005a453cfb613e5ffe5868c1301958751100cbdf (patch)
treeac6e97273d236f648c1aa64af6db8206cb474bd9 /gv.c
parente24c7c18173514bd97dba167341e7465f92d5ef7 (diff)
downloadperl-005a453cfb613e5ffe5868c1301958751100cbdf.tar.gz
add more correct version of change#1350 (as yet untested)
Message-Id: <H00000e50008f277@MHS> Subject: Re: [PATCH _70] cache missing methods p4raw-link: @1350 on //depot/perl: a4bb25971c379e48da873823e220bdef09e90ab9 p4raw-id: //depot/perl@1404
Diffstat (limited to 'gv.c')
-rw-r--r--gv.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/gv.c b/gv.c
index 07c0b19b6f..505f6339e5 100644
--- a/gv.c
+++ b/gv.c
@@ -103,6 +103,7 @@ gv_init(GV *gv, HV *stash, char *name, STRLEN len, int multi)
GvSV(gv) = NEWSV(72,0);
GvLINE(gv) = curcop->cop_line;
GvFILEGV(gv) = curcop->cop_filegv;
+ GvCVGEN(gv) = 0;
GvEGV(gv) = gv;
sv_magic((SV*)gv, (SV*)gv, '*', name, len);
GvSTASH(gv) = (HV*)SvREFCNT_inc(stash);
@@ -117,7 +118,6 @@ gv_init(GV *gv, HV *stash, char *name, STRLEN len, int multi)
GvCV(gv) = compcv;
LEAVE;
- GvCVGEN(gv) = 0;
sub_generation++;
CvGV(GvCV(gv)) = (GV*)SvREFCNT_inc(gv);
CvFILEGV(GvCV(gv)) = curcop->cop_filegv;
@@ -176,13 +176,15 @@ gv_fetchmeth(HV *stash, char *name, STRLEN len, I32 level)
gv_init(topgv, stash, name, len, TRUE);
if (cv = GvCV(topgv)) {
/* If genuine method or valid cache entry, use it */
- if (!GvCVGEN(topgv) || GvCVGEN(topgv) >= sub_generation)
+ if (!GvCVGEN(topgv) || GvCVGEN(topgv) == sub_generation)
return topgv;
/* Stale cached entry: junk it */
SvREFCNT_dec(cv);
GvCV(topgv) = cv = Nullcv;
GvCVGEN(topgv) = 0;
}
+ else if (GvCVGEN(topgv) == sub_generation)
+ return 0; /* cache indicates sub doesn't exist */
}
gvp = (GV**)hv_fetch(stash, "ISA", 3, FALSE);
@@ -258,6 +260,10 @@ gv_fetchmeth(HV *stash, char *name, STRLEN len, I32 level)
}
return gv;
}
+ else if (topgv && GvREFCNT(topgv) == 1) {
+ /* cache the fact that the method is not defined */
+ GvCVGEN(topgv) = sub_generation;
+ }
}
}