In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/a0074a595ba9467095da80f22054deac26706f64?hp=28c5c15c9196adf231d52b99e78f3de3d7b63e2b>

- Log -----------------------------------------------------------------
commit a0074a595ba9467095da80f22054deac26706f64
Author: Nicholas Clark <[email protected]>
Date:   Sat Oct 23 07:36:53 2010 +0100

    For PROXYSUBS, also avoid calling get_missing_hash() in the XS constant 
code.
    
    (Follow on from 4639bd9c727433ad)
    For modules such as File::Glob and I18N::Langinfo, which always define all
    constants on all platforms, this saves about 700 bytes of object code.
-----------------------------------------------------------------------

Summary of changes:
 .../lib/ExtUtils/Constant/ProxySubs.pm             |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/cpan/ExtUtils-Constant/lib/ExtUtils/Constant/ProxySubs.pm 
b/cpan/ExtUtils-Constant/lib/ExtUtils/Constant/ProxySubs.pm
index d9eca8b..15c679f 100644
--- a/cpan/ExtUtils-Constant/lib/ExtUtils/Constant/ProxySubs.pm
+++ b/cpan/ExtUtils-Constant/lib/ExtUtils/Constant/ProxySubs.pm
@@ -581,8 +581,14 @@ EOA
         print $xs_fh <<"EOC";
     PPCODE:
 #ifndef SYMBIAN
-       HV *${c_subname}_missing = get_missing_hash(aTHX);
-       if (hv_exists_ent(${c_subname}_missing, sv, 0)) {
+       /* It's not obvious how to calculate this at C pre-processor time.
+          However, any compiler optimiser worth its salt should be able to
+          remove the dead code, and hopefully the now-obviously-unused static
+          function too.  */
+       HV *${c_subname}_missing = (C_ARRAY_LENGTH(values_for_notfound) > 1)
+           ? get_missing_hash(aTHX) : NULL;
+       if ((C_ARRAY_LENGTH(values_for_notfound) > 1)
+           ? hv_exists_ent(${c_subname}_missing, sv, 0) : 0) {
            sv = newSVpvf("Your vendor has not defined $package_sprintf_safe 
macro %" SVf
                          ", used at %" COP_FILE_F " line %d\\n", sv,
                          COP_FILE(cop), CopLINE(cop));
@@ -613,8 +619,14 @@ $xs_subname(sv)
        SV *            sv;
     PPCODE:
 #ifndef SYMBIAN
-       HV *${c_subname}_missing = get_missing_hash(aTHX);
-       if (hv_exists_ent(${c_subname}_missing, sv, 0)) {
+       /* It's not obvious how to calculate this at C pre-processor time.
+          However, any compiler optimiser worth its salt should be able to
+          remove the dead code, and hopefully the now-obviously-unused static
+          function too.  */
+       HV *${c_subname}_missing = (C_ARRAY_LENGTH(values_for_notfound) > 1)
+           ? get_missing_hash(aTHX) : NULL;
+       if ((C_ARRAY_LENGTH(values_for_notfound) > 1)
+           ? hv_exists_ent(${c_subname}_missing, sv, 0) : NULL) {
            sv = newSVpvf("Your vendor has not defined $package_sprintf_safe 
macro %" SVf
                          ", used", sv);
        } else

--
Perl5 Master Repository

Reply via email to