summaryrefslogtreecommitdiff
path: root/scope.c
diff options
context:
space:
mode:
authorStephen McCamant <smcc@mit.edu>1998-03-13 16:28:19 -0600
committerMalcolm Beattie <mbeattie@sable.ox.ac.uk>1998-03-16 16:02:50 +0000
commit2ce36478e58aef6258082c58568c0f469f8eb69c (patch)
tree8b2fd2da30cf61ed9b9e9edf150bc920ff16087a /scope.c
parent88f6dadfa85904befed3058706d299f3599d0462 (diff)
downloadperl-2ce36478e58aef6258082c58568c0f469f8eb69c.tar.gz
STRESS_REALLOC
p4raw-id: //depot/perl@820
Diffstat (limited to 'scope.c')
-rw-r--r--scope.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/scope.c b/scope.c
index 73aadff141..6de1841eb5 100644
--- a/scope.c
+++ b/scope.c
@@ -25,18 +25,28 @@ stack_grow(SV **sp, SV **p, int n)
abort();
#endif
stack_sp = sp;
+#ifndef STRESS_REALLOC
av_extend(curstack, (p - stack_base) + (n) + 128);
+#else
+ av_extend(curstack, (p - stack_base) + (n) + 1);
+#endif
#if defined(DEBUGGING) && !defined(USE_THREADS)
growing--;
#endif
return stack_sp;
}
+#ifndef STRESS_REALLOC
+#define GROW(old) ((old) * 3 / 2)
+#else
+#define GROW(old) ((old) + 1)
+#endif
+
I32
cxinc(void)
{
dTHR;
- cxstack_max = cxstack_max * 3 / 2;
+ cxstack_max = GROW(cxstack_max);
Renew(cxstack, cxstack_max + 1, PERL_CONTEXT); /* XXX should fix CXINC macro */
return cxstack_ix + 1;
}
@@ -46,7 +56,7 @@ push_return(OP *retop)
{
dTHR;
if (retstack_ix == retstack_max) {
- retstack_max = retstack_max * 3 / 2;
+ retstack_max = GROW(retstack_max);
Renew(retstack, retstack_max, OP*);
}
retstack[retstack_ix++] = retop;
@@ -67,7 +77,7 @@ push_scope(void)
{
dTHR;
if (scopestack_ix == scopestack_max) {
- scopestack_max = scopestack_max * 3 / 2;
+ scopestack_max = GROW(scopestack_max);
Renew(scopestack, scopestack_max, I32);
}
scopestack[scopestack_ix++] = savestack_ix;
@@ -87,7 +97,7 @@ markstack_grow(void)
{
dTHR;
I32 oldmax = markstack_max - markstack;
- I32 newmax = oldmax * 3 / 2;
+ I32 newmax = GROW(oldmax);
Renew(markstack, newmax, I32);
markstack_ptr = markstack + oldmax;
@@ -98,10 +108,12 @@ void
savestack_grow(void)
{
dTHR;
- savestack_max = savestack_max * 3 / 2;
+ savestack_max = GROW(savestack_max) + 4;
Renew(savestack, savestack_max, ANY);
}
+#undef GROW
+
void
free_tmps(void)
{