summaryrefslogtreecommitdiff
path: root/mro.c
Commit message (Collapse)AuthorAgeFilesLines
* Convert Perl_sv_dup_inc() from a macro to a real function.Nicholas Clark2010-05-241-5/+4
|
* Fix build warning in mro.cJerry D. Hedden2009-08-211-1/+1
|
* Optimise S_mro_get_linear_isa_dfs() when dealing with the first parent class.Nicholas Clark2009-08-201-33/+69
| | | | Benchmarking with single inheritance suggests that this is 10% faster.
* When resetting our children, wipe out the isa cache too.Nicholas Clark2009-07-251-1/+5
| | | | (Fix to change 34354, which introduced a cached hash to make ->isa O(1))
* Following change 34356, which decoupled get_isa_hash() fromNicholas Clark2009-01-031-35/+0
| | | | S_mro_get_linear_isa_dfs(), we can move get_isa_hash() to any other source file.
* Add casts to gain C++ compatibility, as spotted by Yves.Nicholas Clark2008-12-281-5/+5
|
* Move all mro:: XS functions from mro.c to ext/mro/mro.xs, except forNicholas Clark2008-12-271-185/+0
| | | | mro::method_changed_in(), which is used by constant.
* In struct mro_meta, rename mro_linear_dfs to mro_linear_all, and change it fromNicholas Clark2008-12-271-14/+14
| | | | AV * to HV *.
* In struct mro_meta, rename mro_linear_c3 to mro_linear_current, and change itNicholas Clark2008-12-271-20/+21
| | | | from AV * to SV *.
* Break out the set-the-MRO logic from the XS_mro_set_mro into Perl_mro_set_mro(),Nicholas Clark2008-12-271-21/+29
| | | | which can be called from C code (such as the guts of extensions).
* Optimisation of the use of the meta structure - don't create a hash if all weNicholas Clark2008-12-271-18/+65
| | | | | are dealing with is data for the current MRO. Instead the direct pointer "owns" the (reference to the) data, with the hash pointer left as NULL to signal this.
* Proper pluggable Method Resolution Orders. 'c3' is now implemented outside theNicholas Clark2008-12-271-442/+0
| | | | | | 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;
* Add Perl_mro_register() to register Method Resolution Orders,Nicholas Clark2008-12-271-29/+44
| | | | | | Perl_mro_get_from_name() to retrieve MROs by name, and PL_registered_mros to store them in. Abolish the static array of mros, and instead register the dfs and c3 MRO structures.
* Add MRO_GET_PRIVATE_DATA() to use the cached mro private data where possible.Nicholas Clark2008-12-271-2/+2
|
* Repurpose struct mro_meta to allow it to store cached linear ISA for arbitaryNicholas Clark2008-12-271-13/+68
| | | | | | | method resolution orders. mro_linear_dfs becomes a hash holding the different MROs' private data. mro_linear_c3 becomes a shortcut pointer to the current MRO's private data.
* S_mro_get_linear_isa_*() should have an *un*signed level.Nicholas Clark2008-11-271-3/+3
| | | | | [Unless it's a signed concept, use an usigned type.] p4raw-id: //depot/perl@34948
* PATCH: Large omnibus patch to clean up the JRRT quotesTom Christiansen2008-11-021-2/+4
| | | | | | Message-ID: <25940.1225611819@chthon> Date: Sun, 02 Nov 2008 01:43:39 -0600 p4raw-id: //depot/perl@34698
* Eliminate (SV *) casts from the rest of *.c, picking up one (further)Nicholas Clark2008-10-301-22/+22
| | | | | erroneous const in dump.c. p4raw-id: //depot/perl@34675
* Eliminate (AV *) casts in *.c.Nicholas Clark2008-10-291-6/+6
| | | p4raw-id: //depot/perl@34650
* Every remaining (HV *) cast in *.cNicholas Clark2008-10-281-9/+9
| | | p4raw-id: //depot/perl@34629
* 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