diff options
author | Joshua Pritikin <joshua.pritikin@db.com> | 1998-07-09 05:22:46 -0400 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1998-07-10 21:23:53 +0000 |
commit | 005a453cfb613e5ffe5868c1301958751100cbdf (patch) | |
tree | ac6e97273d236f648c1aa64af6db8206cb474bd9 /gv.c | |
parent | e24c7c18173514bd97dba167341e7465f92d5ef7 (diff) | |
download | perl-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.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -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; + } } } |