summaryrefslogtreecommitdiff
path: root/pp.h
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2013-11-20 20:39:56 -0800
committerFather Chrysostomos <sprout@cpan.org>2013-11-22 21:20:37 -0800
commit865e3ae09bd2dde9953a008963d3c5a0ad14e32d (patch)
tree561da0ed53edbfa8fa507bff4ae30331115ad08e /pp.h
parent0ff725582ada84044c87936ed5498addbfbb2a5a (diff)
downloadperl-865e3ae09bd2dde9953a008963d3c5a0ad14e32d.tar.gz
Extend STRESS_REALLOC to move the stack with every EXTEND
This allows us easily to catch cases where the stack could move to a new memory address while code still holds pointers to the old loca- tion. Indeed, this causes test failures.
Diffstat (limited to 'pp.h')
-rw-r--r--pp.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/pp.h b/pp.h
index 42e63fa2c9..820c81b80b 100644
--- a/pp.h
+++ b/pp.h
@@ -270,15 +270,25 @@ Does not use C<TARG>. See also C<XPUSHu>, C<mPUSHu> and C<PUSHu>.
=cut
*/
-#define EXTEND(p,n) (void)(UNLIKELY(PL_stack_max - p < (SSize_t)(n)) && \
+#ifdef STRESS_REALLOC
+# define EXTEND(p,n) (void)(sp = stack_grow(sp,p, (SSize_t)(n)))
+/* Same thing, but update mark register too. */
+# define MEXTEND(p,n) STMT_START { \
+ const int markoff = mark - PL_stack_base; \
+ sp = stack_grow(sp,p,(SSize_t) (n)); \
+ mark = PL_stack_base + markoff; \
+ } STMT_END
+#else
+# define EXTEND(p,n) (void)(UNLIKELY(PL_stack_max - p < (SSize_t)(n)) && \
(sp = stack_grow(sp,p, (SSize_t) (n))))
/* Same thing, but update mark register too. */
-#define MEXTEND(p,n) STMT_START {if (UNLIKELY(PL_stack_max - p < (int)(n))) {\
+# define MEXTEND(p,n) STMT_START {if (UNLIKELY(PL_stack_max - p < (int)(n))) {\
const int markoff = mark - PL_stack_base; \
sp = stack_grow(sp,p,(SSize_t) (n)); \
mark = PL_stack_base + markoff; \
} } STMT_END
+#endif
#define PUSHs(s) (*++sp = (s))
#define PUSHTARG STMT_START { SvSETMAGIC(TARG); PUSHs(TARG); } STMT_END