twospace-gc-package-defs.scm 3.2 KB

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