summaryrefslogtreecommitdiffstats
path: root/continue.c
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:34 -0800
committerBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:34 -0800
commit50eb784bfcf15ee3c6b0b53d747db92673395040 (patch)
tree60f039bb5aa27bc58d92ab0c7bab0d82dbfe7686 /continue.c
parentae2b295c7deaf2d7c18ad1ed9b6050970e56bae7 (diff)
downloadscm-50eb784bfcf15ee3c6b0b53d747db92673395040.tar.gz
scm-50eb784bfcf15ee3c6b0b53d747db92673395040.zip
Import Upstream version 5e3upstream/5e3
Diffstat (limited to 'continue.c')
-rw-r--r--continue.c44
1 files changed, 24 insertions, 20 deletions
diff --git a/continue.c b/continue.c
index ec0097b..43c5f37 100644
--- a/continue.c
+++ b/continue.c
@@ -84,6 +84,7 @@ long stack_size(start)
to `setjump(new_continuation->jmpbuf)' in order to complete the
capture of this continuation. */
+#ifndef __ia64__
CONTINUATION *make_root_continuation(stack_base)
STACKITEM *stack_base;
{
@@ -111,12 +112,12 @@ CONTINUATION *make_continuation(parent_cont)
CONTINUATION *parent_cont;
{
CONTINUATION *cont;
-#ifdef CHEAP_CONTINUATIONS
+# ifdef CHEAP_CONTINUATIONS
cont = (CONTINUATION *)malloc(sizeof(CONTINUATION));
if (!cont) return 0;
cont->length = 0;
cont->stkbse = parent_cont->stkbse;
-#else
+# else
long j;
register STACKITEM *src, *dst;
FLUSH_REGISTER_WINDOWS;
@@ -126,17 +127,18 @@ CONTINUATION *make_continuation(parent_cont)
cont->length = j;
cont->stkbse = parent_cont->stkbse;
src = cont->stkbse;
-# ifdef STACK_GROWS_UP
+# ifdef STACK_GROWS_UP
src += parent_cont->length;
-# else
+# else
src -= parent_cont->length + cont->length;
-# endif/* ndef STACK_GROWS_UP */
+# endif/* ndef STACK_GROWS_UP */
dst = (STACKITEM *)(cont + 1);
for (j = cont->length; 0 <= --j; ) *dst++ = *src++;
-#endif /* ndef CHEAP_CONTINUATIONS */
+# endif /* ndef CHEAP_CONTINUATIONS */
cont->parent = parent_cont;
return cont;
}
+#endif
/* free_continuation() is trivial, but who knows what the future
holds. */
@@ -177,40 +179,41 @@ void free_continuation(cont)
/* SCM_GROWTH is how many `long's to grow the stack by when we need room. */
#define SCM_GROWTH 100
+#ifndef __ia64__
void dynthrow(a)
long *a;
{
register CONTINUATION *cont = (CONTINUATION *)(a[0]);
long val = a[1];
-#ifndef CHEAP_CONTINUATIONS
+# ifndef CHEAP_CONTINUATIONS
register long j;
register STACKITEM *src, *dst = cont->stkbse;
-# ifdef STACK_GROWS_UP
-# ifndef hpux
+# ifdef STACK_GROWS_UP
+# ifndef hpux
if (a[2] && (a - ((long *)a[3]) < SCM_GROWTH))
puts("grow_throw: check if long growth[]; being optimized out");
-# endif
+# endif
/* 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
-# ifndef hpux
+# else
+# ifndef hpux
if (a[2] && (((long *)a[3]) - a < SCM_GROWTH))
puts("grow_throw: check if long growth[]; being optimized out");
-# endif
+# endif
/* 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);
-# endif/* def STACK_GROWS_UP */
+# endif/* def STACK_GROWS_UP */
FLUSH_REGISTER_WINDOWS;
src = (STACKITEM *)(cont + 1);
for (j = cont->length;0 <= --j;) *dst++ = *src++;
-#endif /* ndef CHEAP_CONTINUATIONS */
-#ifdef SHORT_INT
+# endif /* ndef CHEAP_CONTINUATIONS */
+# ifdef SHORT_INT
thrown_value = val;
longjump(cont->jmpbuf, 1);
-#else
+# else
longjump(cont->jmpbuf, val);
-#endif
+# endif
}
/* grow_throw() grows the stack by SCM_GROWTH long words. If the
@@ -221,7 +224,7 @@ void dynthrow(a)
so the compiler won't be able to guess that the growth array isn't
all used. */
-#ifndef CHEAP_CONTINUATIONS
+# ifndef CHEAP_CONTINUATIONS
void grow_throw(a) /* Grow the stack so that there is room */
long *a; /* to copy in the continuation. Then */
{ /* retry the throw. */
@@ -233,7 +236,8 @@ void grow_throw(a) /* Grow the stack so that there is room */
growth[SCM_GROWTH-1] = sizeof growth;
dynthrow(growth);
}
-#endif /* ndef CHEAP_CONTINUATIONS */
+# endif /* ndef CHEAP_CONTINUATIONS */
+#endif
/* throw_to_continuation() restores the stack in effect when
@var{cont} was made and resumes @var{cont}'s processor state. If