| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Commit 80ebaca actually exposed an existing bug that Class::Trait was
really close to triggering already:
undef *ISA; # @ISA no longer magical
Class::Trait’s tests just happened not to call ->isa before making any
changes to @ISA.
Now that the meta->isa cache is created immediately,
Class::Trait fails.
This bug can be reproduced in earlier perls by putting an ->isa call
right after the undef:
undef *{"Extra::TSpouse::ISA"};
'Extra::TSpouse'->isa('Class::Trait::Base');
unshift @{"Extra::TSpouse::ISA"}, Class::Trait::Base;
warn Extra::TSpouse->isa('Class::Trait::Base'); # something's wrong
This commit modifies gv_fetchpvn_flags to magicalise @ISA whenever it
is fetched.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
with package::ISA
This commit makes @ISA changes and package aliasing update PL_isarev
properly, removing old, unnecessary entries in addition to adding new
entries. So now it is capable of shrinking, not just growing.
------------
Gory Details
------------
There is a chicken-and-egg problem when it comes to calling
mro_isa_changed_in on the affected classes: When an isa linearisation
is recalculated, it uses the existing linearisations of the super-
classes (if any) (or at least the DFS implementation does). Since an
assigned package (e.g., the *b:: in *a:: = *b::) can contain nested
packages that inherit from each other in any order (b::c isa b::c::d
or b::c::e isa b::c), this means that mro_isa_changed_in *must not* be
called on any stash while another stash contains stale data.
So mro_package_moved has been restructured. It is no longer recurs-
ive. The recursive code for iterating through nested stashes has been
moved into a separate, static routine: mro_gather_and_rename. Instead
of calling mro_isa_changed_in during the iteration, it adds all the
classes to ‘the big hash’, which mro_package_moved holds a pointer to.
When mro_gather_and_rename returns, mro_package_moved iterates through
the big hash twice: the first time to wipe caches; the second to call
mro_isa_changed_in on all the stashes.
This ‘big hash’ is now used in place of the seen_stashes that
mro_package_moved used before.
Both mro_package_moved and mro_isa_changed_in now use the existing
mrometa->isa hash to determine which classes used to be superclasses
of the stash in question. A separate routine, S_mro_clean_isarev,
deletes entries mention in isa, except for those that still exist in
the new isa hash.
mro_isa_changed_in now does two iterations through isarev, just like
mro_package_moved. It has to call get_linear_isa on the subclasses so
that it can see what is in the new meta->isa hash created thereby.
Consequently, it has to make sure that all the subclasses have their
caches deleted before it can update anything. It makes the same
changes to isarev for each subclass that are made further down on the
class for which mro_isa_changed_in was called. Yes, it is repetitive.
But calling mro_isa_changed_in recursively has more overhead and would
do more unnecessary work. (Maybe we could make some macros for this
repetitive code.)
The loop through the superclasses near the end of mro_isa_changed_in
no longer adds the subclasses to all the superclasses’ isarev hashes,
because that is taken care of further up.
------------
Side Effects
------------
One result of this change is that mro::is_universal no longer
returns true for classes that are no longer universal. I consider
that a bug fix.
-------------
Miscellaneous
-------------
This also removes obsolete comments in mro_isa_changed_in, concerning
fake and universal flags on stashes, that have been invalid since
dd69841bebe.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
In mro_package_moved, I was calling mro_isa_changed_in, instead
of mro_package_moved, for a deleted package. So its subpackages
were ignored.
Exempli gratia, delete $::{'Cur::'} would call mro_isa_changed_in on
Cur::Cur, but ignore Cur::Cur::Cur.
I probably added this bug (or reinstated it, as it was in 5.13.5) in
d056e33c1.
|
|
|
|
|
| |
The existence of main::main::... caused mro_package_moved to break
Text::Template, and probably Acme::Meta as well.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This fixes the problem of isa cache linearisations’ and method caches’
not being reset on nonexistent packages when they are replaced with
real packages as a result of parent stashes’ being moved. This can
happen in cases like this:
@left::ISA = 'outer::inner';
@right::ISA = 'clone::inner';
{package outer::inner}
*clone:: = \%outer::;
print "ok 1", "\n" if left->isa("clone::inner");
print "ok 2", "\n" if right->isa("outer::inner");
This changes mro_package_moved’s parameter list as documented in the
diff for mro.c. See also the new comments in that function.
|
| |
|
|
|
|
|
|
|
|
| |
This makes string-to-glob assignment and hashref-to-glob assignment
reset isa caches by calling mro_package_moved, if the glob’s name
ends with ::.
Related to [perl #75176].
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
This only applies to glob-to-glob assignments and deletions of stash
elements. Other types of stash manipulation are dealt with by subse-
quent patches.
It adds mro_package_moved, a private function that iterates through
subpackages, calling mro_isa_changed_in on each.
This is related to [perl #75176], but is not the same bug. It simply
got in the way of fixing [perl #75176].
|
|
|
|
|
| |
Stop magic applied to $!, %SIG, et al. from applying to similarly-
named variables in other packages.
|
|
|
|
|
| |
It seems that Dylan Reference Book has been relocated, so included is
the small patch for the vulcan_* test files with the new link.
|
|
|
|
|
|
|
| |
The fix for rt #60220 (26d68d86) updated the isa cache when an
arrayref was assigned to some *ISA, but didn't add the magic to the
new @ISA to catch any further updates to it. Add the magic, and
tests.
|
| |
|
|
|
|
| |
Idea blatantly copied from chromatic's analogous change to parrot, r38477.
|
|
|
|
| |
Benchmarking with single inheritance suggests that this is 10% faster.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Patch modified to use a boolean rather than an integer for tracking
mro changes in S_glob_assign_ref and test fixed not to warn.
URL: http://rt.perl.org/rt3/Ticket/Display.html?id=60220
From the bug report:
-----------------------------------------------------------------
When creating a subclass dynamically, and when adding
AUTOLOAD dynamically into the parent class, then that
AUTOLOAD is not seen in the method cache, even after
a call to "mro::method_changed_in('Parent')".
It only appears in the method cache after a call
to mro::invalidate_all_method_caches().
The attached test file demonstrates the problem.
This was detected while trying to solve bug 40159 in DBIx::DataModel.
-----------------------------------------------------------------
Message-ID: <20081031132021.GA21341@mars.tony.develop-help.com>
|
|
|
|
| |
mro::method_changed_in(), which is used by constant.
|
|
|
|
|
|
| |
core, in ext/mro/mro.xs. Also move mro::_nextcan() to mro.xs. It needs direct
access to S_mro_get_linear_isa_c3(), and nothing on CPAN calls it, except via
methods defined in mro.pm. Hence all users already require mro;
|
|
|
|
|
| |
Message-ID: <491F3008.4060205@gmx.de>
p4raw-id: //depot/perl@34839
|
|
|
|
|
|
| |
This restores the 5.8.8 behaviour. The deleted stash is not vivified
again, hence the hierarchy remains broken. But there's no segfault.
p4raw-id: //depot/perl@33684
|
|
|
|
|
|
|
| |
Subject: [perl #51092] [PATCH] Segfault when calling ->next::method on non-existing package
From: ilmari@vesla.ilmari.org (via RT) <perlbug-followup@perl.org>
Message-ID: <rt-3.6.HEAD-15287-1203654581-377.51092-75-0@perl.org>
p4raw-id: //depot/perl@33367
|
|
|
|
|
| |
Message-ID: <20080109183655.GB11282@bort.ca>
p4raw-id: //depot/perl@32948
|
|
|
|
|
|
|
|
| |
From: "Brandon Black" <blblack@gmail.com>
Message-ID: <84621a60710080654s589f57eax90b7f78558ad8b6f@mail.gmail.com>
new tests.
p4raw-id: //depot/perl@32074
|
|
|
|
|
|
| |
mro::get_linear_isa() when passed a second parameter). However, there
were no tests for this. Fix both.
p4raw-id: //depot/perl@31981
|
|
|
|
|
| |
Message-ID: <20070906184039.GG9260@bort.ca>
p4raw-id: //depot/perl@31838
|
|
|
|
|
|
| |
Subject: Optimized magic_setisa has bug
Message-Id: <20070814054517.GA12709@bort.ca>
p4raw-id: //depot/perl@31719
|
|
|
|
|
|
|
|
|
|
|
| |
That change was adding a hook to cope with the case when one was
undef'ining *ISA globs, in order to clean up correctly. However, this
broke the case where one was assiging an array ref to @ISA, which
is likely to be more common.
Conclusion: don't undef *ISA. (or more generally don't undef globs
that contain magical variables)
p4raw-link: @31489 on //depot/perl: 5be5c7a687aa37f2ea9dec7988eb57cad1f1ec24
p4raw-id: //depot/perl@31502
|
|
|
|
|
|
| |
From: "Brandon Black" <blblack@gmail.com>
Message-ID: <84621a60706270807r7af65546x8d959b131ffa28e6@mail.gmail.com>
p4raw-id: //depot/perl@31489
|
|
|
|
|
|
|
|
|
| |
Subject: Re: [perl #43357] *DESTROY = sub {} at runtime
From: "Brandon Black" <blblack@gmail.com>
Message-ID: <84621a60706260905x2da6eaf1x4bd7d5223951e52@mail.gmail.com>
Fix MRO behaviour when one undefs @ISA
p4raw-id: //depot/perl@31473
|
|
|
|
|
|
|
|
|
|
| |
Subject: Re: [perl #43357] *DESTROY = sub {} at runtime
From: "Brandon Black" <blblack@gmail.com>
Message-ID: <84621a60706260905x2da6eaf1x4bd7d5223951e52@mail.gmail.com>
Fix problem recently introduced with loosing a DESTROY when redefined
at runtime.
p4raw-id: //depot/perl@31472
|
|
|
|
|
|
| |
From: "Brandon Black" <blblack@gmail.com>
Message-ID: <84621a60706032255g6702cd81ube1f582a1e07cf8a@mail.gmail.com>
p4raw-id: //depot/perl@31332
|
|
|
|
|
|
|
|
| |
<84621a60705111347q40f9dd9ciefa9468e9ff9ca6c@mail.gmail.com>
<84621a60705121458i34ff361fh9166e8558781df41@mail.gmail.com>
<84621a60705141111q70ed307r9181dfc2834a8f5c@mail.gmail.com>
<84621a60705160937h53946fcfg70635908302724e8@mail.gmail.com>
p4raw-id: //depot/perl@31239
|
|
|
|
|
|
| |
From: "Brandon Black" <blblack@gmail.com>
Message-ID: <84621a60705081315hca3885duc14b8c3e44080853@mail.gmail.com>
p4raw-id: //depot/perl@31174
|
|
|
|
|
|
| |
From: "Brandon Black" <blblack@gmail.com>
Message-ID: <84621a60704301445y37e9b05ey235210a8e5547cc1@mail.gmail.com>
p4raw-id: //depot/perl@31122
|
|
|
|
|
|
| |
From: "Brandon Black" <blblack@gmail.com>
Message-ID: <84621a60704291527y1b39be37l221ef66e4c828f66@mail.gmail.com>
p4raw-id: //depot/perl@31107
|
|
|
|
|
|
|
|
| |
Subject: Re: mro status, etc
From: "Brandon Black" <blblack@gmail.com>
Message-ID: <84621a60704260852y5a3dd2a5jeb633bb46cc7a8c0@mail.gmail.com>
p4raw-link: @29336 on //depot/perl: ae6d515f69537dd5e2631b15104c2c90d022fd19
p4raw-id: //depot/perl@31091
|
|
|
| |
p4raw-id: //depot/perl@31004
|
|
|
| |
p4raw-id: //depot/perl@30998
|
|
|
|
|
| |
that's possible, that is where is_deeply() isn't used)
p4raw-id: //depot/perl@30993
|
|
From: "Brandon Black" <blblack@gmail.com>
Message-ID: <84621a60704171114k29b0460el5b08ce5185d55ed5@mail.gmail.com>
p4raw-id: //depot/perl@30980
|