fra.c 882 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* $Id$ */
  2. #include "logging.h"
  3. #include "global.h"
  4. #include "mem.h"
  5. #include "shadow.h"
  6. #include "fra.h"
  7. #include "alloc.h"
  8. #ifdef LOGGING
  9. char *FRA_sh; /* shadowbytes */
  10. #endif /* LOGGING */
  11. init_FRA() {
  12. FRA = Malloc(FRALimit, "Function Return Area");
  13. #ifdef LOGGING
  14. FRA_sh = Malloc(FRALimit, "shadowspace for Function Return Area");
  15. #endif /* LOGGING */
  16. FRA_def = UNDEFINED; /* set FRA illegal */
  17. }
  18. pushFRA(sz)
  19. size sz;
  20. {
  21. register int i;
  22. if (sz == 0)
  23. return;
  24. st_inc(max(sz, wsize));
  25. for (i = 0; i < sz; i++) {
  26. stack_loc(SP + i) = FRA[i];
  27. #ifdef LOGGING
  28. st_sh(SP + i) = (i < FRASize ? FRA_sh[i] : UNDEFINED);
  29. #endif /* LOGGING */
  30. }
  31. }
  32. popFRA(sz)
  33. size sz;
  34. {
  35. register int i;
  36. if (sz == 0)
  37. return;
  38. for (i = 0; i < sz; i++) {
  39. FRA[i] = stack_loc(SP + i);
  40. #ifdef LOGGING
  41. FRA_sh[i] = st_sh(SP + i);
  42. #endif /* LOGGING */
  43. }
  44. st_dec(max(sz, wsize));
  45. }