twospace-gc-package-defs.scm 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. ; Copyright (c) 1993-2008 by Richard Kelsey and Jonathan Rees. See file COPYING.
  2. ;; Packages for two-space copier GC
  3. ;----------------------------------------------------------------
  4. ; Memory management
  5. (define-interface heap-two-space-interface
  6. (export heap-begin
  7. set-heap-pointer!
  8. heap-pointer
  9. swap-spaces
  10. heap-limit
  11. allocate
  12. get-new-heap-start-addr
  13. in-trouble?))
  14. ; for the native-code compiler
  15. (define-interface heap-two-space-native-code-interface
  16. (export s48-*hp* s48-*limit*))
  17. (define-structures ((heap heap-interface)
  18. (heap-gc-util heap-gc-util-interface)
  19. (heap-init heap-init-interface)
  20. (heap-two-space heap-two-space-interface)
  21. (heap-two-space-native-code heap-two-space-native-code-interface))
  22. (open prescheme ps-receive vm-utilities vm-architecture memory data
  23. ps-memory
  24. debugging)
  25. (files (gc-twospace heap)))
  26. (define-structure gc gc-interface
  27. (open prescheme ps-receive vm-utilities vm-architecture
  28. external
  29. memory data
  30. heap heap-gc-util
  31. heap-two-space
  32. interpreter-gc
  33. debugging)
  34. (files (gc-twospace gc)
  35. (heap trace-continuation)))
  36. (define-structure allocation allocation-interface
  37. (open prescheme memory
  38. heap-gc-util heap-two-space
  39. gc
  40. gc-static-hack
  41. data
  42. vm-architecture
  43. debugging
  44. vm-utilities
  45. )
  46. (files (gc-twospace allocation)))
  47. ; This should be in heap.scm except that it needs GC and GC needs HEAP,
  48. ; so we have to put this in its own package to avoid a dependency loop.
  49. (define-structure gc-static-hack (export)
  50. (open prescheme gc heap-gc-util gc-roots)
  51. (begin
  52. (add-gc-root! (lambda ()
  53. (walk-impure-areas
  54. (lambda (start end)
  55. (s48-trace-locations! start end)
  56. #t))))))
  57. ; Image handling
  58. (define-structure read-image-gc-specific read-image-gc-specific-interface
  59. (open prescheme ps-receive enum-case
  60. vm-utilities vm-architecture
  61. memory
  62. data struct
  63. ps-memory ;allocate/deallocate-memory
  64. heap ;s48-heap-size
  65. heap-init ;s48-initialize-heap
  66. ;s48-initialize-image-areas
  67. ;s48-check-heap-size
  68. heap-two-space
  69. image-util
  70. image-table ;make-table
  71. read-image-util
  72. read-image-portable
  73. )
  74. (files (gc-twospace read-image)))
  75. (define-structure read-image-util-gc-specific read-image-util-gc-specific-interface
  76. (open prescheme
  77. ps-memory
  78. read-image-util)
  79. (begin
  80. (define (get-small-start-addr heap-image-pointer)
  81. (address+ heap-image-pointer
  82. (address-difference (get-weaks-img-end-addr)
  83. (get-large-img-start-addr))))
  84. (define (get-large-start-addr heap-image-pointer)
  85. (address+ heap-image-pointer
  86. (address-difference (get-weaks-img-end-addr)
  87. (get-weaks-img-start-addr))))
  88. (define (get-weaks-start-addr heap-image-pointer)
  89. heap-image-pointer)))
  90. (define-structure write-image-gc-specific write-image-gc-specific-interface
  91. (open prescheme ps-receive
  92. vm-utilities vm-architecture
  93. memory data struct
  94. heap
  95. heap-two-space
  96. image-table
  97. image-util
  98. write-image-util
  99. string-tables
  100. symbols ;s48-symbol-table
  101. shared-bindings-access
  102. )
  103. (files (gc-twospace write-image)))