private-gc.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * private-gc.h - private declarations for garbage collection.
  3. *
  4. * Copyright (C) 2002, 03, 04, 05, 06, 07, 08, 09 Free Software Foundation, Inc.
  5. *
  6. * This library is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public License
  8. * as published by the Free Software Foundation; either version 3 of
  9. * the License, or (at your option) any later version.
  10. *
  11. * This library is distributed in the hope that it will be useful, but
  12. * WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with this library; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  19. * 02110-1301 USA
  20. */
  21. #ifndef SCM_PRIVATE_GC
  22. #define SCM_PRIVATE_GC
  23. #include "_scm.h"
  24. /* {heap tuning parameters}
  25. *
  26. * These are parameters for controlling memory allocation. The heap
  27. * is the area out of which scm_cons, and object headers are allocated.
  28. *
  29. * Each heap cell is 8 bytes on a 32 bit machine and 16 bytes on a
  30. * 64 bit machine. The units of the _SIZE parameters are bytes.
  31. * Cons pairs and object headers occupy one heap cell.
  32. */
  33. #define SCM_DEFAULT_INIT_HEAP_SIZE_2 32*1024
  34. #define SCM_DOUBLECELL_ALIGNED_P(x) (((2 * sizeof (scm_t_cell) - 1) & SCM_UNPACK (x)) == 0)
  35. SCM_INTERNAL int scm_getenv_int (const char *var, int def);
  36. typedef enum { return_on_error, abort_on_error } policy_on_error;
  37. #define SCM_MAX(A, B) ((A) > (B) ? (A) : (B))
  38. #define SCM_MIN(A, B) ((A) < (B) ? (A) : (B))
  39. /* CELL_P checks a random word whether it has the right form for a
  40. pointer to a cell. Use scm_i_find_heap_segment_containing_object
  41. to find out whether it actually points to a real cell.
  42. The right form for a cell pointer is this: the low three bits must
  43. be scm_tc3_cons, and when the scm_tc3_cons tag is stripped, the
  44. resulting pointer must be correctly aligned.
  45. scm_i_initialize_heap_segment_data guarantees that the test below
  46. works.
  47. */
  48. #define CELL_P(x) ((SCM_UNPACK(x) & (sizeof(scm_t_cell)-1)) == scm_tc3_cons)
  49. SCM_INTERNAL char const *scm_i_tag_name (scm_t_bits tag); /* MOVEME */
  50. #endif