summaryrefslogtreecommitdiff
path: root/t/mro
Commit message (Collapse)AuthorAgeFilesLines
...
* [perl #79024] Bleadperl 80ebaca breaks OVID/Class-Trait-0.31.tar.gzFather Chrysostomos2010-11-111-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* undef *glob should update isa(rev)Father Chrysostomos2010-11-111-1/+11
|
* [perl #75176] Symbol::delete_package does not free certain memory associated ↵Father Chrysostomos2010-11-082-7/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Tests for [perl #77358]Father Chrysostomos2010-10-301-3/+27
|
* A plethora of isarev testsFather Chrysostomos2010-10-301-7/+69
|
* To-do tests for isarev (more to come)Father Chrysostomos2010-10-301-0/+35
|
* Fix a nested package deletion bugFather Chrysostomos2010-10-211-1/+21
| | | | | | | | | | | | 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.
* [perl #78362] Make mro_package_moved check for recursionFather Chrysostomos2010-10-121-1/+8
| | | | | The existence of main::main::... caused mro_package_moved to break Text::Template, and probably Acme::Meta as well.
* Reset isa caches on nonexistent substashes when stash trees are movedFather Chrysostomos2010-10-121-1/+44
| | | | | | | | | | | | | | | | | 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.
* Add an inheritance diagram to package_aliases.tFather Chrysostomos2010-10-101-0/+9
|
* Make more ways to move packages around reset isa cachesFather Chrysostomos2010-10-091-42/+76
| | | | | | | | 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].
* Oops. Remove a duplicate require.Father Chrysostomos2010-10-091-1/+1
|
* Reset isa on stash manipulationFather Chrysostomos2010-10-091-1/+76
| | | | | | | | | | | | 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].
* [perl #76138] perl inadvertently destroys signal handlers as of f746176000Father Chrysostomos2010-09-061-1/+14
| | | | | Stop magic applied to $!, %SIG, et al. from applying to similarly- named variables in other packages.
* t/mro/vulcan* fixesArkturuz2010-04-232-2/+2
| | | | | It seems that Dylan Reference Book has been relocated, so included is the small patch for the vulcan_* test files with the new link.
* rt #72866 - add magic to arrayrefs assigned to *Foo::ISATony Cook2010-02-181-1/+23
| | | | | | | 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.
* Instead of trusting mro::get_linear_isa(), test it against the expected output.Nicholas Clark2009-08-201-1/+13
|
* Optimise mro_get_linear_isa_c3() when there is a single parent. 40% speed up.Nicholas Clark2009-08-201-0/+69
| | | | Idea blatantly copied from chromatic's analogous change to parrot, r38477.
* Optimise S_mro_get_linear_isa_dfs() when dealing with the first parent class.Nicholas Clark2009-08-201-0/+53
| | | | Benchmarking with single inheritance suggests that this is 10% faster.
* Add a test for mro::method_changed_in() and mro::invalidate_all_method_caches()Bram2009-07-241-1/+18
|
* mro::method_changed_in(..) ignores AUTOLOAD (RT #60220)Tony Cook2009-07-181-1/+16
| | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Move all mro:: XS functions from mro.c to ext/mro/mro.xs, except forNicholas Clark2008-12-271-0/+2
| | | | mro::method_changed_in(), which is used by constant.
* Proper pluggable Method Resolution Orders. 'c3' is now implemented outside theNicholas Clark2008-12-273-0/+6
| | | | | | 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;
* MRO tests for isa() and package aliasesTorsten Schoenfeld2008-11-161-0/+33
| | | | | Message-ID: <491F3008.4060205@gmx.de> p4raw-id: //depot/perl@34839
* Fix for [perl #52074] Segfault on ISA push after symbol table deleteRafael Garcia-Suarez2008-04-151-1/+5
| | | | | | 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
* Avoid a segfault case in MRO code, based on :ilmari@vesla.ilmari.org2008-02-251-2/+13
| | | | | | | 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
* Re: [perl #49564] Re: MRO and av_clearRick Delaney2008-01-111-1/+14
| | | | | Message-ID: <20080109183655.GB11282@bort.ca> p4raw-id: //depot/perl@32948
* Re: [perl #46217] (resent) Typeglobs vs. SUPER:: (Hook::LexWrap failure)Brandon Black2007-10-091-1/+29
| | | | | | | | From: "Brandon Black" <blblack@gmail.com> Message-ID: <84621a60710080654s589f57eax90b7f78558ad8b6f@mail.gmail.com> new tests. p4raw-id: //depot/perl@32074
* Change 31977 introduced a bug (failing to set the return value ofNicholas Clark2007-09-261-5/+16
| | | | | | mro::get_linear_isa() when passed a second parameter). However, there were no tests for this. Fix both. p4raw-id: //depot/perl@31981
* Re: [perl #44623] Optimized magic_setisa has bugRick Delaney2007-09-101-4/+1
| | | | | Message-ID: <20070906184039.GG9260@bort.ca> p4raw-id: //depot/perl@31838
* Test update to demonstrate @ISA assignment bug:Rick Delaney2007-08-151-1/+36
| | | | | | Subject: Optimized magic_setisa has bug Message-Id: <20070814054517.GA12709@bort.ca> p4raw-id: //depot/perl@31719
* Revert change #31489.Rafael Garcia-Suarez2007-06-291-42/+1
| | | | | | | | | | | 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
* Re: [perl #43357] *DESTROY = sub {} at runtimeBrandon Black2007-06-281-1/+45
| | | | | | From: "Brandon Black" <blblack@gmail.com> Message-ID: <84621a60706270807r7af65546x8d959b131ffa28e6@mail.gmail.com> p4raw-id: //depot/perl@31489
* Second patch from:Brandon Black2007-06-261-1/+20
| | | | | | | | | 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
* First patch from:Brandon Black2007-06-261-1/+57
| | | | | | | | | | 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
* another mro patchBrandon Black2007-06-041-0/+35
| | | | | | From: "Brandon Black" <blblack@gmail.com> Message-ID: <84621a60706032255g6702cd81ube1f582a1e07cf8a@mail.gmail.com> p4raw-id: //depot/perl@31332
* Various mro updates from Brandon Black. References:Craig A. Berry2007-05-192-2/+62
| | | | | | | | <84621a60705111347q40f9dd9ciefa9468e9ff9ca6c@mail.gmail.com> <84621a60705121458i34ff361fh9166e8558781df41@mail.gmail.com> <84621a60705141111q70ed307r9181dfc2834a8f5c@mail.gmail.com> <84621a60705160937h53946fcfg70635908302724e8@mail.gmail.com> p4raw-id: //depot/perl@31239
* Re: mro c3 infinite recursion problem. Attemp to free unreferenced scalarBrandon Black2007-05-091-0/+11
| | | | | | From: "Brandon Black" <blblack@gmail.com> Message-ID: <84621a60705081315hca3885duc14b8c3e44080853@mail.gmail.com> p4raw-id: //depot/perl@31174
* Re: mro status, etcBrandon Black2007-05-032-2/+0
| | | | | | From: "Brandon Black" <blblack@gmail.com> Message-ID: <84621a60704301445y37e9b05ey235210a8e5547cc1@mail.gmail.com> p4raw-id: //depot/perl@31122
* Re: mro status, etcBrandon Black2007-04-301-8/+25
| | | | | | From: "Brandon Black" <blblack@gmail.com> Message-ID: <84621a60704291527y1b39be37l221ef66e4c828f66@mail.gmail.com> p4raw-id: //depot/perl@31107
* Fix a bug in method caching. Better version (broader) of change #29336.Brandon Black2007-04-261-0/+1
| | | | | | | | 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
* Completely remove Test::More from the MRO tests, by Brandon BlackRafael Garcia-Suarez2007-04-2119-276/+172
| | | p4raw-id: //depot/perl@31004
* Shorten some file namesRafael Garcia-Suarez2007-04-205-0/+0
| | | p4raw-id: //depot/perl@30998
* Don't use Test::More in core tests (at least, whereRafael Garcia-Suarez2007-04-2011-24/+19
| | | | | that's possible, that is where is_deeply() isn't used) p4raw-id: //depot/perl@30993
* Re: new C3 MRO patchBrandon Black2007-04-1930-0/+2304
From: "Brandon Black" <blblack@gmail.com> Message-ID: <84621a60704171114k29b0460el5b08ce5185d55ed5@mail.gmail.com> p4raw-id: //depot/perl@30980