diff options
author | Daniel Dragan <bulk88@hotmail.com> | 2014-11-08 00:20:52 -0500 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2014-11-07 22:52:22 -0800 |
commit | db6e00bd00dae7b918216c69bd58fe860e640276 (patch) | |
tree | b812a379126e4f58290cb6f2a9f293aa878abead /XSUB.h | |
parent | 6402d4ee6fab9f5d76a131921ef72d686ad7aac5 (diff) | |
download | perl-db6e00bd00dae7b918216c69bd58fe860e640276.tar.gz |
add xs_handshake API
This API elevates the amount of ABI compatibility protection between XS
modules and the interp. It also makes each boot XSUB smaller in machine
code by removing function calls and factoring out code into the new
Perl_xs_handshake and Perl_xs_epilog functions.
sv.c :
- revise padlist duping code to reduce code bloat/asserts on DEBUGGING
ext/DynaLoader/dlutils.c :
- disable version checking so interp startup is faster, ABI mismatches are
impossible because DynaLoader is never available as a shared library
ext/XS-APItest/XSUB-redefined-macros.xs :
- "" means dont check the version, so switch to " " to make the test in
xsub_h.t pass, see ML thread "XS_APIVERSION_BOOTCHECK and XS_VERSION
is CPP defined but "", mow what?"
ext/re/re.xs :
- disable API version checking until #123007 is resolved
ParseXS/Utilities.pm :
109-standard_XS_defs.t :
- remove context from S_croak_xs_usage similar to core commit cb077ed296 .
CvGV doesn't need a context until 5.21.4 and commit ae77754ae2 and
by then core's croak_xs_uage API has been long available and this
backport doesn't need to account for newer perls
- fix test where lack of having PERL_IMPLICIT_CONTEXT caused it to fail
Diffstat (limited to 'XSUB.h')
-rw-r--r-- | XSUB.h | 38 |
1 files changed, 36 insertions, 2 deletions
@@ -170,6 +170,17 @@ is a lexical $_ in scope. #else # define dXSARGS \ dSP; dAXMARK; dITEMS +/* These 2 macros are specialized replacements for dXSARGS macro. They may be + replaced with dXSARGS if no version checking is desired. The 2 macros factor + out common code in every BOOT XSUB. Computation of vars mark and items will + optimize away in most BOOT functions. Var ax can never be optimized away + since BOOT must return &PL_sv_yes by default from xsubpp */ +# define dXSBOOTARGSXSAPIVERCHK \ + I32 ax = XS_BOTHVERSION_POPMARK_BOOTCHECK; \ + SV **mark = PL_stack_base + ax; dSP; dITEMS +# define dXSBOOTARGSAPIVERCHK \ + I32 ax = XS_APIVERSION_POPMARK_BOOTCHECK; \ + SV **mark = PL_stack_base + ax; dSP; dITEMS #endif #define dXSTARG SV * const targ = ((PL_op->op_private & OPpENTERSUB_HASTARG) \ @@ -325,13 +336,36 @@ Rethrows a previously caught exception. See L<perlguts/"Exception Handling">. #ifdef XS_VERSION # define XS_VERSION_BOOTCHECK \ - Perl_xs_version_bootcheck(aTHX_ items, ax, STR_WITH_LEN(XS_VERSION)) + Perl_xs_handshake(HS_KEY(FALSE, "", XS_VERSION), HS_CXT, items, ax, XS_VERSION) #else # define XS_VERSION_BOOTCHECK #endif #define XS_APIVERSION_BOOTCHECK \ - Perl_xs_apiversion_bootcheck(ST(0), STR_WITH_LEN("v" PERL_API_VERSION_STRING)) + Perl_xs_handshake(HS_KEY(FALSE, "v" PERL_API_VERSION_STRING, ""), HS_CXT, items, ax, "v" PERL_API_VERSION_STRING) +/* public API, this is a combination of XS_VERSION_BOOTCHECK and + XS_APIVERSION_BOOTCHECK in 1, and is backportable */ +#ifdef XS_VERSION +# define XS_BOTHVERSION_BOOTCHECK \ + Perl_xs_handshake(HS_KEY(FALSE, "v" PERL_API_VERSION_STRING, XS_VERSION) \ + , HS_CXT, items, ax, "v" PERL_API_VERSION_STRING, XS_VERSION) +#else +/* should this be a #error? if you want both checked, you better supply XS_VERSION right? */ +# define XS_BOTHVERSION_BOOTCHECK XS_APIVERSION_BOOTCHECK +#endif + +/* private API */ +# define XS_APIVERSION_POPMARK_BOOTCHECK \ + Perl_xs_handshake(HS_KEY(TRUE, "v" PERL_API_VERSION_STRING, "") \ + , HS_CXT, "v" PERL_API_VERSION_STRING) +#ifdef XS_VERSION +# define XS_BOTHVERSION_POPMARK_BOOTCHECK \ + Perl_xs_handshake(HS_KEY(TRUE, "v" PERL_API_VERSION_STRING, XS_VERSION) \ + , HS_CXT, "v" PERL_API_VERSION_STRING, XS_VERSION) +#else +/* should this be a #error? if you want both checked, you better supply XS_VERSION right? */ +# define XS_BOTHVERSION_POPMARK_BOOTCHECK XS_APIVERSION_POPMARK_BOOTCHECK +#endif #ifdef NO_XSLOCKS # define dXCPT dJMPENV; int rEtV = 0 |