summaryrefslogtreecommitdiff
path: root/mro.c
Commit message (Collapse)AuthorAgeFilesLines
* Update copyright years.Nicholas Clark2008-10-251-0/+1
| | | p4raw-id: //depot/perl@34585
* In S_mro_get_linear_isa_dfs(), add void casts to silence two warningsNicholas Clark2008-09-121-7/+11
| | | | | | | about "value computed is not used". Re-order the code to group operations on the isa hash with each other. Add a SvREADONLY_on() on the isa array if it is generated by Perl_get_isa_hash(). p4raw-id: //depot/perl@34357
* Build the isa cache from any linear ISA, rather than forcing the useNicholas Clark2008-09-121-3/+22
| | | | | | of dfs. This avoids calling dfs on a C3 class (and all its parents), which won't break anything, but is more work than is needed. p4raw-id: //depot/perl@34356
* Need to free the isa lookup hash before rebuilding it.Nicholas Clark2008-09-121-0/+4
| | | p4raw-id: //depot/perl@34355
* Create a direct lookup hash for ->isa() lookup, by retaining theNicholas Clark2008-09-121-7/+38
| | | | | | | | | | | de-duping hash used by S_mro_get_linear_isa_dfs(). Provide a new function Perl_get_isa_hash() to lazily retrieve this. (Which could actually be static if S_isa_lookup() and Perl_sv_derived_from() moved into mro.c.) Make S_isa_lookup() use this lookup hash in place of a linear walk of the linear isa. This should turn isa lookups from O(n) to O(1), which should make heavy users of ->isa() faster. (eg PPI, and hence Perl Critic). p4raw-id: //depot/perl@34354
* In S_mro_get_linear_isa_dfs(), save copying by making a shared hashNicholas Clark2008-08-221-1/+15
| | | | | | | key scalar from the key of the hash entry we've just creating. (Currently the hash is disposed of afterwards, but soon it won't, so having both point to the same string buffer will also save memory.) p4raw-id: //depot/perl@34215
* In S_mro_get_linear_isa_dfs(), hv_exists_ent() followed by an optionalNicholas Clark2008-08-221-3/+12
| | | | | hv_store_ent() can be replaced with an lvalue fetch. p4raw-id: //depot/perl@34214
* Add Perl_croak_xs_usage(), which reduces a lot of explicit calls ofNicholas Clark2008-05-211-24/+8
| | | | | | | the form Perl_croak(aTHX_ "Usage %s::%s(%s)", "ouch" "awk", "eee_yow"); down to croak_xs_usage(cv, "eee_yow"); and refactor all the core XS code to use it. This adds () to the error messages for attributes::* p4raw-id: //depot/perl@33901
* Avoid a segfault case in MRO code, based on :ilmari@vesla.ilmari.org2008-02-251-1/+1
| | | | | | | 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
* assert() that every NN argument is not NULL. Otherwise we have theNicholas Clark2008-02-121-5/+9
| | | | | | | | | | | | ability to create landmines that will explode under someone in the future when they upgrade their compiler to one with better optimisation. We've already done this at least twice. (Yes, some of the assertions are after code that would already have SEGVd because it already deferences a pointer, but they are put in to make it easier to automate checking that each and every case is covered.) Add a tool, checkARGS_ASSERT.pl, to check that every case is covered. p4raw-id: //depot/perl@33291
* Add macros mPUSHs() and mXPUSHs() for pushing SVs on the stackMarcus Holland-Moritz2008-01-041-6/+4
| | | | | | and mortalizing them. Use these macros where possible. And also mX?PUSH[inpu] where possible. p4raw-id: //depot/perl@32821
* Extend newSVpvn_flags() to also call sv_2mortal() if SVs_TEMP is set inNicholas Clark2008-01-031-1/+1
| | | | | | the flags. Move its implementation just ahead of sv_2mortal()'s for CPU cache locality. Refactor all code that can be to use this. p4raw-id: //depot/perl@32818
* We can now sv_upgrade(sv, SVt_PVHV), so do so, to simplify the code.Nicholas Clark2008-01-031-10/+3
| | | p4raw-id: //depot/perl@32815
* hv_iterkeysv() actually creates a mortal SV for every call.Nicholas Clark2007-10-221-6/+8
| | | | | | | | gv_stashsv() is just a wrapper for gv_stashpvn(), so doesn't need an SV internally. Hence avoid creating lots of mortal SVs by using hv_iterkey() to get the keys and lengths. Also tweak whitespace in change 32168. p4raw-id: //depot/perl@32169
* In Perl_mro_isa_changed_in(), no need to call an RVALUE hv_fetch() thenNicholas Clark2007-10-221-4/+15
| | | | | | | hv_store() a new HV if fetch drew a blank, as we can detect the new SV an LVALUE fetch gave us, and replace it with a new HV, which will be more efficient. p4raw-id: //depot/perl@32168
* S_mro_get_linear_isa_c3() doesn't need to call hv_fetch() thenNicholas Clark2007-10-221-5/+6
| | | | | hv_store(), as hv_fetch() can do it all for us. p4raw-id: //depot/perl@32167
* By using the HEK that holds the stash name in S_mro_get_linear_isa_c3()Nicholas Clark2007-10-181-14/+12
| | | | | and S_mro_get_linear_isa_dfs() we can create scalars more efficiently. p4raw-id: //depot/perl@32133
* Remove some strlen()s and replace one strlcpy() with memcpy() becauseNicholas Clark2007-10-121-2/+1
| | | | | we already know the string length. p4raw-id: //depot/perl@32105
* Remove unneeded castRafael Garcia-Suarez2007-09-281-1/+1
| | | p4raw-id: //depot/perl@31991
* Change 31977 introduced a bug (failing to set the return value ofNicholas Clark2007-09-261-1/+1
| | | | | | mro::get_linear_isa() when passed a second parameter). However, there were no tests for this. Fix both. p4raw-id: //depot/perl@31981
* Change the way of determining the MRO algorithm used from an enumNicholas Clark2007-09-261-25/+39
| | | | | | | | defined in the header, to a pointer to a structure. This allows the flexibility to easily add more MROs in the future, and to provide an API to do so. Dispatch in mro.c is now via the structure pointed to, rather than switch statements on the value of the enum. p4raw-id: //depot/perl@31977
* Silence a load of "value computed is not used" warningsRafael Garcia-Suarez2007-09-211-6/+6
| | | p4raw-id: //depot/perl@31936
* SVs know their length, so avoid 2 calls to strlen().Nicholas Clark2007-09-201-10/+6
| | | | | As we have an SV, call hv_fetch_ent() rather than hv_fetch(). p4raw-id: //depot/perl@31921
* mro_get_linear_isa_dfs and mro_get_linear_isa_c3 can have staticNicholas Clark2007-09-121-4/+5
| | | | | linkage. p4raw-id: //depot/perl@31849
* Restore a comment from 30501 unintentionally deleted with change 31513.Nicholas Clark2007-07-011-1/+4
| | | p4raw-id: //depot/perl@31514
* Avoid copying the AV in Perl_mro_get_linear_isa_dfs()Nicholas Clark2007-07-011-10/+9
| | | p4raw-id: //depot/perl@31513
* Revert change #31489.Rafael Garcia-Suarez2007-06-291-4/+2
| | | | | | | | | | | 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: valgrind findingsBrandon Black2007-06-291-4/+11
| | | | | | From: "Brandon Black" <blblack@gmail.com> Message-ID: <84621a60706281358o3b379b20k2c1e53566587d79b@mail.gmail.com> p4raw-id: //depot/perl@31501
* Re: [perl #43357] *DESTROY = sub {} at runtimeBrandon Black2007-06-281-2/+4
| | | | | | From: "Brandon Black" <blblack@gmail.com> Message-ID: <84621a60706270807r7af65546x8d959b131ffa28e6@mail.gmail.com> p4raw-id: //depot/perl@31489
* yet another mro.c patchBrandon Black2007-06-131-48/+50
| | | | | | From: "Brandon Black" <blblack@gmail.com> Message-ID: <84621a60706130619g17c9d2fbi111cca567da3d500@mail.gmail.com> p4raw-id: //depot/perl@31370
* Silence compiler warningsJerry D. Hedden2007-06-071-0/+2
| | | | | | From: "Jerry D. Hedden" <jdhedden@cpan.org> Message-ID: <1ff86f510706061145r540c7f02kba96c04bc9dcf8b0@mail.gmail.com> p4raw-id: //depot/perl@31348
* another mro patchBrandon Black2007-06-041-220/+174
| | | | | | From: "Brandon Black" <blblack@gmail.com> Message-ID: <84621a60706032255g6702cd81ube1f582a1e07cf8a@mail.gmail.com> p4raw-id: //depot/perl@31332
* Re: HvMROMETABrandon Black2007-05-301-2/+11
| | | | | | From: "Brandon Black" <blblack@gmail.com> Message-ID: <84621a60705291708m3f106d74r473f3d91c780163d@mail.gmail.com> p4raw-id: //depot/perl@31312
* Various mro updates from Brandon Black. References:Craig A. Berry2007-05-191-30/+66
| | | | | | | | <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-9/+12
| | | | | | From: "Brandon Black" <blblack@gmail.com> Message-ID: <84621a60705081315hca3885duc14b8c3e44080853@mail.gmail.com> p4raw-id: //depot/perl@31174
* more constingAndy Lester2007-05-081-73/+66
| | | | | Message-ID: <20070507163416.GA6187@petdance.com> p4raw-id: //depot/perl@31167
* Re: mro status, etcBrandon Black2007-04-301-104/+79
| | | | | | From: "Brandon Black" <blblack@gmail.com> Message-ID: <84621a60704291527y1b39be37l221ef66e4c828f66@mail.gmail.com> p4raw-id: //depot/perl@31107
* mro status, etcBrandon Black2007-04-261-2/+8
| | | | | | From: "Brandon Black" <blblack@gmail.com> Message-ID: <84621a60704251637v1f4a3f84y19b39461166e3631@mail.gmail.com> p4raw-id: //depot/perl@31087
* Fix mro docs.Brandon Black2007-04-261-6/+6
| | | | | | | Subject: Re: mro callbacks patch From: "Brandon Black" <blblack@gmail.com> Message-ID: <84621a60704231658o4c85783ere3c3e90dd614c30b@mail.gmail.com> p4raw-id: //depot/perl@31086
* Silence VC6 warning about not all control paths returning a valueSteve Hay2007-04-241-0/+1
| | | p4raw-id: //depot/perl@31057
* An optimisation to the MRO code, by Brandon Black,Rafael Garcia-Suarez2007-04-231-25/+78
| | | | | plus more comments. p4raw-id: //depot/perl@31025
* Shorten long symbols in mro.c to avoid name mangling on VMS.Craig A. Berry2007-04-231-6/+6
| | | p4raw-id: //depot/perl@31024
* Storing PL_sv_yes over itself is as cheap as calling hv_exists(), soNicholas Clark2007-04-211-6/+9
| | | | | | | | always store it, to save the (second) store call. SvIVx is more expensive than SvIVX, so use the latter. Reorder the other call to hv_store() to be immediately after the call to hv_exists(), to try to avoid thrashing the CPU cache. p4raw-id: //depot/perl@31009
* In Perl_mro_get_linear_isa_dfs(), by treating the local variable sv asNicholas Clark2007-04-211-21/+18
| | | | | an array of size 1, we can merge two arms and reduce code duplication. p4raw-id: //depot/perl@31008
* Small optimisations, by Brandon BlackRafael Garcia-Suarez2007-04-211-2/+2
| | | p4raw-id: //depot/perl@31003
* Code comments, by Brandon BlackRafael Garcia-Suarez2007-04-211-4/+68
| | | p4raw-id: //depot/perl@31002
* Terser source code in Perl_mro_meta_dup()Nicholas Clark2007-04-201-18/+15
| | | p4raw-id: //depot/perl@31000
* Simpler version, and that zeroes the allocated memoryRafael Garcia-Suarez2007-04-191-2/+2
| | | p4raw-id: //depot/perl@30988
* Use Newxc instead of casting by handRafael Garcia-Suarez2007-04-191-7/+5
| | | p4raw-id: //depot/perl@30987
* A Tolkien quote for mro.c, found by Audrey Tang.Rafael Garcia-Suarez2007-04-191-0/+5
| | | p4raw-id: //depot/perl@30986