From fae75791d47423cf8816d13f7030c34cfdb1c512 Mon Sep 17 00:00:00 2001 From: Chip Salzenberg Date: Thu, 4 Jun 1998 09:47:31 -0400 Subject: [PATCH] Invalidate method cache on C Message-ID: <19980604134731.D24343@perlsupport.com> p4raw-id: //depot/perl@1097 --- scope.c | 5 +++++ t/op/method.t | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/scope.c b/scope.c index 7a0a578..5958aba 100644 --- a/scope.c +++ b/scope.c @@ -222,6 +222,9 @@ save_gp(GV *gv, I32 empty) if (empty) { register GP *gp; + + if (GvCVu(gv)) + sub_generation++; /* taking a method out of circulation */ Newz(602, gp, 1, GP); GvGP(gv) = gp_ref(gp); GvSV(gv) = NEWSV(72,0); @@ -678,6 +681,8 @@ leave_scope(I32 base) SvLEN(gv) = (STRLEN)SSPOPIV; gp_free(gv); GvGP(gv) = (GP*)ptr; + if (GvCVu(gv)) + sub_generation++; /* putting a method back into circulation */ SvREFCNT_dec(gv); break; case SAVEt_FREESV: diff --git a/t/op/method.t b/t/op/method.t index d955705..f1b1888 100755 --- a/t/op/method.t +++ b/t/op/method.t @@ -4,7 +4,7 @@ # test method calls and autoloading. # -print "1..24\n"; +print "1..26\n"; @A::ISA = 'B'; @B::ISA = 'C'; @@ -66,6 +66,12 @@ test (A->d, "B::d4"); # Update hash table; delete $B::{d}; # Should work without any help too test (A->d, "C::d"); +{ + local *C::d; + test (eval { A->d } || "nope", "nope"); +} +test (A->d, "C::d"); + *A::x = *A::d; # See if cache incorrectly follows synonyms A->d; test (eval { A->x } || "nope", "nope"); -- 1.8.3.1