gc3.1 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. ;;
  2. ;; Clu garbage collector - step 3
  3. ;; Actual garbage collection (trace phase)
  4. ;;
  5. ;; Map in GC area and set up copy window
  6. ;;
  7. move r0,gspg ;; make "aobjn" pointer
  8. sub r0,gepg
  9. soj r0, ;; r0 = - # of pages
  10. hrlz r0,r0 ;; in left half
  11. hrr r0,gspg
  12. movem pgdest
  13. hrrz r0,r0 ;; from same pages in inferior
  14. movem pgsrc
  15. .call mapin
  16. $die Couldn't map in GC area!
  17. ;;
  18. ;; Get fresh page for write window
  19. ;;
  20. move r0,rwind
  21. movem r0,pgdest
  22. .call getpgs
  23. $die Couldn't get fresh copy page
  24. ;;
  25. ;; Init copy window variables
  26. ;;
  27. ;; cpptr: actual address in window of last used word
  28. ;; (space is allocated from high to low addresses)
  29. ;; cpptr2: address intended for stuff cpptr points to after GC
  30. ;; cppage: cpptr2 mod pgsize (i.e., page to put window in when full)
  31. ;;
  32. move r0,hipage
  33. movem r0,cppage
  34. lsh r0,pglog2
  35. movem r0,cpptr
  36. movem r0,cpptr2
  37. ;;
  38. ;; Local register definitions
  39. ;;
  40. mode== 10 ;; used for one of five modes
  41. scnptr==11 ;; address of stuff being processed now
  42. ;;
  43. ;; Modes:
  44. ;; There are five modes in tracing:
  45. ;; 1) BS - basic area/stack scanning (looking for objects or refs)
  46. ;; 2) BT - basic area/stack tracing (when inside objects found there)
  47. ;; 3) GT - GC area tracing (for normal objects there)
  48. ;; 4) GS - GC area scanning (inside vecs, etc.)
  49. ;; 5) GST - GC area trace while scanning (for objects inside objects)
  50. ;;
  51. ;; codes fro them are as follows:
  52. ;; mode octal binary
  53. ;; BT 0 000
  54. ;; BS 1 001
  55. ;; GT 2 010
  56. ;; GS 3 011
  57. ;; GST 4 100
  58. ;;
  59. ;; thus, bit 0 = 0 => tracing
  60. ;; bit 0 = 1 => scanning
  61. ;; bit 1 = 0 => no copy
  62. ;; bit 1 = 1 => copy
  63. ;; bits 1 & 2 = 0 => no forwarding address propagation
  64. ;; bit 1 or 2 = 1 => forwarding address propagation
  65. ;;
  66. ;; (all this should become clear from the code!)
  67. ;; Define mode codes
  68. ;;
  69. bt== 0
  70. bs== 1
  71. gs== 2
  72. gt== 3
  73. gst== 4
  74. ;;
  75. ;; Now set up for and scan basic area, then stack
  76. ;;
  77. move r0,bspg ;; first page processed is bspg
  78. movem r0,scanpg
  79. movem r0,pgsrc
  80. move r0,rwind
  81. movem r0,pgdest
  82. .call mapin ;; map it in to the read window
  83. $die Couldn't map in first basic area page
  84. move r1,bstart ;; compute starting scan point
  85. move r2,r1 ;; = rwind*pgsize+(bstart mod pgsize)
  86. andi r1,pgsize-1
  87. lsh r0,pglog2
  88. or r1,r0
  89. sub r2,bend ;; get - # of words and make aobjn pointer
  90. soj r2,
  91. hrl r1,r2
  92. move scnptr,r1 ;; scan pointer all set
  93. movei mode,bs ;; set mode
  94. push sp,[-1,,basdun] ;; push return stuff
  95. jrst trace
  96. basdun: move r0,sspg ;; get first stack page
  97. movem r0,scanpg
  98. movem r0,pgsrc
  99. move r0,rwind
  100. movem r0,pgdest
  101. .call mapin
  102. $die Couldn't map in first stack page
  103. move r1,sstart ;; set up to scan stack
  104. move r2,r1
  105. andi r1,pgsize-1
  106. lsh r0,pglog2
  107. or r1,r0
  108. sub r2,send
  109. soj r2,
  110. hrl r1,r2
  111. move scnptr,r1
  112. movei mode,bs
  113. push sp,[-1,stkdun]
  114. jrst trace
  115. stkdun: