ack/util/int/fra.c

57 lines
889 B
C
Raw Normal View History

1994-06-24 11:31:16 +00:00
/* $Id$ */
1988-06-22 16:57:09 +00:00
#include "logging.h"
#include "global.h"
#include "mem.h"
#include "shadow.h"
#include "fra.h"
#include "alloc.h"
#ifdef LOGGING
2019-03-17 14:42:00 +00:00
char *FRA_sh; /* shadowbytes */
#endif /* LOGGING */
1988-06-22 16:57:09 +00:00
2019-03-17 14:42:00 +00:00
void init_FRA(void)
{
1988-06-22 16:57:09 +00:00
FRA = Malloc(FRALimit, "Function Return Area");
#ifdef LOGGING
FRA_sh = Malloc(FRALimit, "shadowspace for Function Return Area");
#endif /* LOGGING */
2019-03-17 14:42:00 +00:00
FRA_def = UNDEFINED; /* set FRA illegal */
1988-06-22 16:57:09 +00:00
}
2019-03-17 14:42:00 +00:00
void pushFRA(size sz)
1988-06-22 16:57:09 +00:00
{
register int i;
if (sz == 0)
return;
st_inc(max(sz, wsize));
2019-03-17 14:42:00 +00:00
for (i = 0; i < sz; i++)
{
1988-06-22 16:57:09 +00:00
stack_loc(SP + i) = FRA[i];
#ifdef LOGGING
st_sh(SP + i) = (i < FRASize ? FRA_sh[i] : UNDEFINED);
#endif /* LOGGING */
1988-06-22 16:57:09 +00:00
}
}
2019-03-17 14:42:00 +00:00
void popFRA(size sz)
1988-06-22 16:57:09 +00:00
{
register int i;
if (sz == 0)
return;
2019-03-17 14:42:00 +00:00
for (i = 0; i < sz; i++)
{
1988-06-22 16:57:09 +00:00
FRA[i] = stack_loc(SP + i);
#ifdef LOGGING
FRA_sh[i] = st_sh(SP + i);
#endif /* LOGGING */
1988-06-22 16:57:09 +00:00
}
st_dec(max(sz, wsize));
}