In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/a8ae8fee103e29c80450bb74b87866088a24b4a1?hp=b3ed409dee4fd31952bdcb9fa77d0e0c4e4516ab>
- Log ----------------------------------------------------------------- commit a8ae8fee103e29c80450bb74b87866088a24b4a1 Author: Nicholas Clark <[email protected]> Date: Fri Aug 21 11:04:06 2009 +0100 Use the constant _CAN_PCS to optimise out things that can't happen pre 5.10 M lib/constant.pm commit 81a8de77c95e1a449aaa4780c3e993117e10733d Author: Nicholas Clark <[email protected]> Date: Fri Aug 21 09:53:47 2009 +0100 Remove a refactoring typo - don't post-increment $flush_mro at the sub's end. M lib/constant.pm commit a18d9f20d1de8843127a2b32b9d608c7d2a1b7b9 Author: Nicholas Clark <[email protected]> Date: Fri Aug 21 09:40:03 2009 +0100 In mro_get_linear_isa_c3() optimise even if AvARRAY(isa_lin) is NULL. It can only be NULL if AvFILLp(isa_lin) is -1, and the code in the fast path block will work cleanly in that case too. M ext/mro/mro.xs ----------------------------------------------------------------------- Summary of changes: ext/mro/mro.xs | 2 +- lib/constant.pm | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ext/mro/mro.xs b/ext/mro/mro.xs index d9451b6..92be620 100644 --- a/ext/mro/mro.xs +++ b/ext/mro/mro.xs @@ -91,7 +91,7 @@ S_mro_get_linear_isa_c3(pTHX_ HV* stash, U32 level) AV* const isa_lin = S_mro_get_linear_isa_c3(aTHX_ isa_item_stash, level + 1); - if(items == 0 && AvFILLp(seqs) == -1 && AvARRAY(isa_lin)) { + if(items == 0 && AvFILLp(seqs) == -1) { /* Only one parent class. For this case, the C3 linearisation is this class followed by the parent's inearisation, so don't bother with the expensive diff --git a/lib/constant.pm b/lib/constant.pm index 69f16c5..a51ee7f 100644 --- a/lib/constant.pm +++ b/lib/constant.pm @@ -117,7 +117,9 @@ sub import { $declared{$full_name}++; if ($multiple || @_ == 1) { my $scalar = $multiple ? $constants->{$name} : $_[0]; - if ($symtab && !exists $symtab->{$name}) { + # The constant serves to optimise this entire block out on + # 5.8 and earlier. + if (_CAN_PCS && $symtab && !exists $symtab->{$name}) { # No typeglob yet, so we can use a reference as space- # efficient proxy for a constant subroutine # The check in Perl_ck_rvconst knows that inlinable @@ -137,7 +139,7 @@ sub import { } } # Flush the cache exactly once if we make any direct symbol table changes. - mro::method_changed_in($pkg) if $flush_mro++; + mro::method_changed_in($pkg) if _CAN_PCS && $flush_mro; } 1; -- Perl5 Master Repository
