ExtUtils::Constant - better machine code on threaded perl
authorDaniel Dragan <bulk88@hotmail.com>
Sun, 10 May 2015 22:38:29 +0000 (18:38 -0400)
committerNicholas Clark <nick@ccl4.org>
Tue, 8 Aug 2017 13:21:42 +0000 (15:21 +0200)
croak doesnt require a context param to be pushed on the c stack,
Perl_croak does, since Perl_croak/croak is very rarily called, minimize
the machine code of the error branches

don't do dTHX in thread aware XS code, this just sets up another my_perl
var for the scope of const-xs BOOT sum masking the original declared
my_perl in the outer C scope

cpan/ExtUtils-Constant/lib/ExtUtils/Constant/ProxySubs.pm

index c7e6d05..3388b98 100644 (file)
@@ -268,7 +268,7 @@ EO_NOPCS
     SV *sv;
 
     if (!he) {
-        Perl_croak($athx "Couldn't add key '%s' to %%$package_sprintf_safe\::",
+        croak("Couldn't add key '%s' to %%$package_sprintf_safe\::",
                   name);
     }
     sv = HeVAL(he);
@@ -306,9 +306,8 @@ static int
 Im_sorry_Dave(pTHX_ SV *sv, MAGIC *mg)
 {
     PERL_UNUSED_ARG(mg);
-    Perl_croak(aTHX_
-              "Your vendor has not defined $package_sprintf_safe macro %"SVf
-              " used", sv);
+    croak("Your vendor has not defined $package_sprintf_safe macro %"SVf
+         " used", sv);
     NORETURN_FUNCTION_END;
 }
 
@@ -373,7 +372,7 @@ MISSING
     print $xs_fh <<"EOBOOT";
 BOOT:
   {
-#ifdef dTHX
+#if defined(dTHX) && !defined(PERL_NO_GET_CONTEXT)
     dTHX;
 #endif
     HV *symbol_table = get_hv("$symbol_table", GV_ADD);
@@ -491,9 +490,8 @@ EXPLODE
                HEK *hek;
 #endif
                if (!he) {
-                   Perl_croak($athx
-                              "Couldn't add key '%s' to %%$package_sprintf_safe\::",
-                              value_for_notfound->name);
+                   croak("Couldn't add key '%s' to %%$package_sprintf_safe\::",
+                         value_for_notfound->name);
                }
                sv = HeVAL(he);
                if (!SvOK(sv) && SvTYPE(sv) != SVt_PVGV) {
@@ -521,8 +519,8 @@ EXPLODE
                if (!hv_common(${c_subname}_missing, NULL, HEK_KEY(hek),
                               HEK_LEN(hek), HEK_FLAGS(hek), HV_FETCH_ISSTORE,
                               &PL_sv_yes, HEK_HASH(hek)))
-                   Perl_croak($athx "Couldn't add key '%s' to missing_hash",
-                              value_for_notfound->name);
+                   croak("Couldn't add key '%s' to missing_hash",
+                         value_for_notfound->name);
 #endif
 DONT