summaryrefslogtreecommitdiffstats
path: root/continue.c
diff options
context:
space:
mode:
Diffstat (limited to 'continue.c')
-rw-r--r--continue.c35
1 files changed, 19 insertions, 16 deletions
diff --git a/continue.c b/continue.c
index b28fe6e..2f0f225 100644
--- a/continue.c
+++ b/continue.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1997 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -54,7 +54,7 @@
#endif
/* For platforms with short integers, we use thrown_value instead of
- the value returned from setjmp so that any (long) value can be
+ the value returned from setjump so that any (long) value can be
returned. */
#ifdef SHORT_INT
@@ -81,7 +81,7 @@ long stack_size(start)
CONTINUATION near the current extent of stack. This newly
allocated CONTINUATION is returned if successful, 0 if not. After
make_root_continuation() returns, the calling routine still needs
- to `setjmp(new_continuation->jmpbuf)' in order to complete the
+ to `setjump(new_continuation->jmpbuf)' in order to complete the
capture of this continuation. */
CONTINUATION *make_root_continuation(stack_base)
@@ -101,7 +101,7 @@ CONTINUATION *make_root_continuation(stack_base)
to the current top of stack. The newly allocated CONTINUATION is
returned if successful, 0 if not. After make_continuation()
returns, the calling routine still needs to
- `setjmp(new_continuation->jmpbuf)' in order to complete the capture
+ `setjump(new_continuation->jmpbuf)' in order to complete the capture
of this continuation. */
/* Note: allocating local (stack) storage for the CONTINUATION would
@@ -150,7 +150,7 @@ void free_continuation(cont)
/* Final routine involved in throw()ing to a continuation. After
ensuring that there is sufficient room on the stack for the saved
continuation, dynthrow() copies the continuation onto the stack and
- longjmp()s into it. The routine does not return. */
+ longjump()s into it. The routine does not return. */
/* If you use conservative GC and your Sparc(SUN-4) heap is growing
out of control:
@@ -174,6 +174,9 @@ void free_continuation(cont)
Let me know if you try it. */
+/* SCM_GROWTH is how many `long's to grow the stack by when we need room. */
+#define SCM_GROWTH 100
+
void dynthrow(a)
long *a;
{
@@ -183,13 +186,13 @@ void dynthrow(a)
register long j;
register STACKITEM *src, *dst = cont->stkbse;
# ifdef STACK_GROWS_UP
- if (a[2] && (a - ((long *)a[3]) < 100))
- puts("grow_throw: check if long growth[100]; being optimized out");
+ if (a[2] && (a - ((long *)a[3]) < SCM_GROWTH))
+ puts("grow_throw: check if long growth[]; being optimized out");
/* if (a[2]) fprintf(stderr, " ct = %ld, dist = %ld\n", a[2], (((long *)a[3]) - a)); */
if PTR_GE(dst + (cont->length), (STACKITEM *)&a) grow_throw(a);
# else
- if (a[2] && (((long *)a[3]) - a < 100))
- puts("grow_throw: check if long growth[100]; being optimized out");
+ if (a[2] && (((long *)a[3]) - a < SCM_GROWTH))
+ puts("grow_throw: check if long growth[]; being optimized out");
/* if (a[2]) fprintf(stderr, " ct = %ld, dist = %ld\n", a[2], (((long *)a[3]) - a)); */
dst -= cont->length;
if PTR_LE(dst, (STACKITEM *)&a) grow_throw(a);
@@ -200,15 +203,15 @@ void dynthrow(a)
#endif /* ndef CHEAP_CONTINUATIONS */
#ifdef SHORT_INT
thrown_value = val;
- longjmp(cont->jmpbuf, 1);
+ longjump(cont->jmpbuf, 1);
#else
- longjmp(cont->jmpbuf, val);
+ longjump(cont->jmpbuf, val);
#endif
}
-/* grow_throw() grows the stack by 100 long words. If the "sizeof
- growth" assignment is not sufficient to restrain your overly
- optimistic compiler, the stack will grow by much less and
+/* grow_throw() grows the stack by SCM_GROWTH long words. If the
+ "sizeof growth" assignment is not sufficient to restrain your
+ overly optimistic compiler, the stack will grow by much less and
grow_throw() and dynthrow() will waste time calling each other. To
fix this you will have to compile grow_throw() in a separate file
so the compiler won't be able to guess that the growth array isn't
@@ -218,12 +221,12 @@ void dynthrow(a)
void grow_throw(a) /* Grow the stack so that there is room */
long *a; /* to copy in the continuation. Then */
{ /* retry the throw. */
- long growth[100];
+ long growth[SCM_GROWTH];
growth[0] = a[0];
growth[1] = a[1];
growth[2] = a[2] + 1;
growth[3] = (long) a;
- growth[99] = sizeof growth;
+ growth[SCM_GROWTH-1] = sizeof growth;
dynthrow(growth);
}
#endif /* ndef CHEAP_CONTINUATIONS */