From 557b887a4219c4f375c8d0bd3219fb4da7bbc7ff Mon Sep 17 00:00:00 2001 From: Sergey Skvortsov Date: Mon, 17 Jan 2005 09:02:33 +0000 Subject: [PATCH] [perl #33809] optimize macro dXSARGS From: Sergey Skvortsov (via RT) Message-ID: p4raw-id: //depot/perl@24372 --- XSUB.h | 11 +++++++++-- pod/perlapi.pod | 10 ++++++++++ universal.c | 4 ++-- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/XSUB.h b/XSUB.h index 358a4b7..c23ee71 100644 --- a/XSUB.h +++ b/XSUB.h @@ -54,6 +54,10 @@ C. Sets up the C variable. This is usually handled automatically by C by calling C. +=for apidoc Ams||dAXMARK +Sets up the C variable and stack marker variable C. +This is usually handled automatically by C by calling C. + =for apidoc Ams||dITEMS Sets up the C variable. This is usually handled automatically by C by calling C. @@ -97,11 +101,14 @@ is a lexical $_ in scope. #define dAX I32 ax = MARK - PL_stack_base + 1 +#define dAXMARK \ + I32 ax = POPMARK; \ + register SV **mark = PL_stack_base + ax++ + #define dITEMS I32 items = SP - MARK #define dXSARGS \ - dSP; dMARK; \ - dAX; dITEMS + dSP; dAXMARK; dITEMS #define dXSTARG SV * targ = ((PL_op->op_private & OPpENTERSUB_HASTARG) \ ? PAD_SV(PL_op->op_targ) : sv_newmortal()) diff --git a/pod/perlapi.pod b/pod/perlapi.pod index b003135..3895ae6 100644 --- a/pod/perlapi.pod +++ b/pod/perlapi.pod @@ -5615,6 +5615,16 @@ This is usually handled automatically by C by calling C. =for hackers Found in file XSUB.h +=item dAXMARK + +Sets up the C variable and stack marker variable C. +This is usually handled automatically by C by calling C. + + dAXMARK; + +=for hackers +Found in file XSUB.h + =item dITEMS Sets up the C variable. diff --git a/universal.c b/universal.c index bf0a6fc..f13f8af 100644 --- a/universal.c +++ b/universal.c @@ -924,7 +924,7 @@ XS(XS_Internals_hash_seed) { /* Using dXSARGS would also have dITEM and dSP, * which define 2 unused local variables. */ - dMARK; dAX; + dAXMARK; XSRETURN_UV(PERL_HASH_SEED); } @@ -932,7 +932,7 @@ XS(XS_Internals_rehash_seed) { /* Using dXSARGS would also have dITEM and dSP, * which define 2 unused local variables. */ - dMARK; dAX; + dAXMARK; XSRETURN_UV(PL_rehash_seed); } -- 2.7.4