diff options
author | Father Chrysostomos <sprout@cpan.org> | 2016-08-07 15:53:40 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2016-08-07 17:36:50 -0700 |
commit | 33a4312b882ab5f5396974a8fe8f5235559c2d82 (patch) | |
tree | a946e1c01c926eb1ef790c3551203f08f5cce2b9 /pp.h | |
parent | 6a29646efd2b54a6feec66ee83d2852418bfb748 (diff) | |
download | perl-33a4312b882ab5f5396974a8fe8f5235559c2d82.tar.gz |
Unify mark macros
Use static inline functions to avoid having different code paths
for GCC and non-GCC. INCMARK is unused on CPAN and only used as
a statement in core, so it can become a statement.
Diffstat (limited to 'pp.h')
-rw-r--r-- | pp.h | 42 |
1 files changed, 6 insertions, 36 deletions
@@ -55,9 +55,7 @@ Refetch the stack pointer. Used after a callback. See L<perlcall>. #define MARK mark #define TARG targ -#if defined(DEBUGGING) && defined(PERL_USE_GCC_BRACE_GROUPS) - -# define PUSHMARK(p) \ +#define PUSHMARK(p) \ STMT_START { \ I32 * mark_stack_entry; \ if (UNLIKELY((mark_stack_entry = ++PL_markstack_ptr) \ @@ -69,44 +67,16 @@ Refetch the stack pointer. Used after a callback. See L<perlcall>. PL_markstack_ptr, (IV)*mark_stack_entry))); \ } STMT_END -# define TOPMARK \ - ({ \ - DEBUG_s(DEBUG_v(PerlIO_printf(Perl_debug_log, \ - "MARK top %p %"IVdf"\n", \ - PL_markstack_ptr, (IV)*PL_markstack_ptr))); \ - *PL_markstack_ptr; \ - }) +#define TOPMARK S_TOPMARK(aTHX) +#define POPMARK S_POPMARK(aTHX) -# define POPMARK \ - ({ \ - DEBUG_s(DEBUG_v(PerlIO_printf(Perl_debug_log, \ - "MARK pop %p %"IVdf"\n", \ - (PL_markstack_ptr-1), (IV)*(PL_markstack_ptr-1)))); \ - assert((PL_markstack_ptr > PL_markstack) || !"MARK underflow");\ - *PL_markstack_ptr--; \ - }) - -# define INCMARK \ - ({ \ +#define INCMARK \ + STMT_START { \ DEBUG_s(DEBUG_v(PerlIO_printf(Perl_debug_log, \ "MARK inc %p %"IVdf"\n", \ (PL_markstack_ptr+1), (IV)*(PL_markstack_ptr+1)))); \ - *PL_markstack_ptr++; \ - }) - -#else - -# define PUSHMARK(p) \ - STMT_START { \ - I32 * mark_stack_entry; \ - if (UNLIKELY((mark_stack_entry = ++PL_markstack_ptr) == PL_markstack_max)) \ - mark_stack_entry = markstack_grow(); \ - *mark_stack_entry = (I32)((p) - PL_stack_base); \ + PL_markstack_ptr++; \ } STMT_END -# define TOPMARK (*PL_markstack_ptr) -# define POPMARK (*PL_markstack_ptr--) -# define INCMARK (*PL_markstack_ptr++) -#endif #define dSP SV **sp = PL_stack_sp #define djSP dSP |