summaryrefslogtreecommitdiff
path: root/mro.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2010-11-11 20:39:31 -0800
committerFather Chrysostomos <sprout@cpan.org>2010-11-11 20:39:31 -0800
commit4df35a07ff9fe98fb378b84929dddace96bcb9fb (patch)
treeec135193be5043f6d128fa191677320e8f8f7389 /mro.c
parentb89cdb229b520dceadf180df9462c8a0a1edf975 (diff)
downloadperl-4df35a07ff9fe98fb378b84929dddace96bcb9fb.tar.gz
mro_isa_changed_in3 is no longer necessary
as of 80ebaca. It was nice while it lasted. This reverts 6f86b615fa.
Diffstat (limited to 'mro.c')
-rw-r--r--mro.c55
1 files changed, 18 insertions, 37 deletions
diff --git a/mro.c b/mro.c
index 7c40688836..4435c2b1a9 100644
--- a/mro.c
+++ b/mro.c
@@ -441,22 +441,10 @@ Takes the necessary steps (cache invalidations, mostly)
when the @ISA of the given package has changed. Invoked
by the C<setisa> magic, should not need to invoke directly.
-=for apidoc mro_isa_changed_in3
-
-Takes the necessary steps (cache invalidations, mostly)
-when the @ISA of the given package has changed. Invoked
-by the C<setisa> magic, should not need to invoke directly.
-
-The stash can be passed as the first argument, or its name and length as
-the second and third (or both). If just the name is passed and the stash
-does not exist, then only the subclasses' method and isa caches will be
-invalidated.
-
=cut
*/
void
-Perl_mro_isa_changed_in3(pTHX_ HV* stash, const char *stashname,
- STRLEN stashname_len)
+Perl_mro_isa_changed_in(pTHX_ HV* stash)
{
dVAR;
HV* isarev;
@@ -465,42 +453,39 @@ Perl_mro_isa_changed_in3(pTHX_ HV* stash, const char *stashname,
SV** svp;
I32 items;
bool is_universal;
- struct mro_meta * meta = NULL;
+ struct mro_meta * meta;
HV *isa = NULL;
- if(!stashname && stash) {
- stashname = HvENAME_get(stash);
- stashname_len = HvENAMELEN_get(stash);
- }
- else if(!stash)
- stash = gv_stashpvn(stashname, stashname_len, 0 /* don't add */);
+ const char * const stashname = HvENAME_get(stash);
+ const STRLEN stashname_len = HvENAMELEN_get(stash);
+
+ PERL_ARGS_ASSERT_MRO_ISA_CHANGED_IN;
if(!stashname)
Perl_croak(aTHX_ "Can't call mro_isa_changed_in() on anonymous symbol table");
- if(stash) {
- /* wipe out the cached linearizations for this stash */
- meta = HvMROMETA(stash);
- if (meta->mro_linear_all) {
+
+ /* wipe out the cached linearizations for this stash */
+ meta = HvMROMETA(stash);
+ if (meta->mro_linear_all) {
SvREFCNT_dec(MUTABLE_SV(meta->mro_linear_all));
meta->mro_linear_all = NULL;
/* This is just acting as a shortcut pointer. */
meta->mro_linear_current = NULL;
- } else if (meta->mro_linear_current) {
+ } else if (meta->mro_linear_current) {
/* Only the current MRO is stored, so this owns the data. */
SvREFCNT_dec(meta->mro_linear_current);
meta->mro_linear_current = NULL;
- }
- if (meta->isa) {
+ }
+ if (meta->isa) {
/* Steal it for our own purposes. */
isa = (HV *)sv_2mortal((SV *)meta->isa);
meta->isa = NULL;
- }
-
- /* Inc the package generation, since our @ISA changed */
- meta->pkg_gen++;
}
+ /* Inc the package generation, since our @ISA changed */
+ meta->pkg_gen++;
+
/* Wipe the global method cache if this package
is UNIVERSAL or one of its parents */
@@ -513,12 +498,12 @@ Perl_mro_isa_changed_in3(pTHX_ HV* stash, const char *stashname,
is_universal = TRUE;
}
else { /* Wipe the local method cache otherwise */
- if(meta) meta->cache_gen++;
+ meta->cache_gen++;
is_universal = FALSE;
}
/* wipe next::method cache too */
- if(meta && meta->mro_nextmethod) hv_clear(meta->mro_nextmethod);
+ if(meta->mro_nextmethod) hv_clear(meta->mro_nextmethod);
/* Iterate the isarev (classes that are our children),
wiping out their linearization, method and isa caches
@@ -638,9 +623,6 @@ Perl_mro_isa_changed_in3(pTHX_ HV* stash, const char *stashname,
our isarev to their isarev.
*/
- /* This only applies if the stash exists. */
- if(!stash) goto clean_up_isarev;
-
/* We're starting at the 2nd element, skipping ourselves here */
linear_mro = mro_get_linear_isa(stash);
svp = AvARRAY(linear_mro) + 1;
@@ -668,7 +650,6 @@ Perl_mro_isa_changed_in3(pTHX_ HV* stash, const char *stashname,
(void)hv_store(mroisarev, stashname, stashname_len, &PL_sv_yes, 0);
}
- clean_up_isarev:
/* Delete our name from our former parents’ isarevs. */
if(isa && HvARRAY(isa))
mro_clean_isarev(isa, stashname, stashname_len, meta->isa);