gc0.1 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. ;;
  2. ;; Clu garbage collector step 0 - setup and test for debugging and construction
  3. ;;
  4. ;; At present this just gets some core, sets up the registers, and
  5. ;; jumps to the start of step 1.
  6. ;;
  7. .blow== 10*pgsize ;; start of basic&types area
  8. .bhigh==13*pgsize-1 ;; end of basic&types area
  9. .slow== 14*pgsize ;; start of stack
  10. .glow== 20*pgsize+(pgsize/2) ;; start of GC area
  11. .ghigh==30*pgsize-1 ;; end of GC area
  12. .ulow== 10 ;; number of lowest page to use
  13. .uhigh==34 ;; number of highest page to use
  14. .mlow== 0 ;; number of lowest page to map out
  15. .mhigh==34 ;; number of highest page to map out
  16. ;;
  17. ;; Start assembling at 100 octal
  18. ;;
  19. loc 100
  20. ;;
  21. ;; First, get core (fill out up to mapped out area)
  22. ;;
  23. begin: hrrei r0,.mlow ;; start with lowest mapped out page
  24. loop01: caile r0,.mhigh
  25. jrst reglod ;; see if done
  26. movem r0,pgsrc
  27. .call pgexst ;; see if page r0 exists
  28. $die Couldn't see if page existed
  29. skipe pgdest ;; pgdest = 0 if page does not exist
  30. aoja r0,loop01
  31. move r2,r0 ;; save # of first nonexistent page in a group
  32. hrrei r3,-1 ;; start keeping count of # of nonexistent pages
  33. hrrei r4,0 ;; clear done flag
  34. loop02: aoj r0, ;; bump to next one
  35. caile r0,.mhigh ;; see if at end
  36. aoja r4,getem ;; say we are done, go get pages
  37. movem r0,pgsrc
  38. .call pgexst ;; see if page exists
  39. $die Couldn't see if page exists
  40. skipn pgdest
  41. soja r3,loop02
  42. getem: hrl r2,r3 ;; make aobjn ptr
  43. movem r2,pgdest
  44. .call getpgs ;; get pages
  45. $die Couldn't get pages
  46. jumpn r4,.+2 ;; skip if we are done
  47. aoja r0,loop01
  48. ;;
  49. ;; Load up registers with arguments
  50. ;;
  51. reglod: move bas,[.bhigh,,.blow]
  52. move stk,[.shigh,,.slow]
  53. move gca,[.ghigh,,.glow]
  54. movei frm,.frame
  55. move use,[.uhigh,,.ulow]
  56. move map,[.mhigh,,.mlow]
  57. jrst cont1 ;; jump to next phase
  58. ;;
  59. ;; Insert constants to keep locality
  60. ;;
  61. consta
  62. ;;
  63. ;; Continue here
  64. ;;
  65. cont1:
  66. ;;
  67. ;; Fake stack frames for debugging
  68. ;;
  69. ;; First, macro to make frames
  70. ;;
  71. .mr.== 1 ;; used in macro to make fake mr's
  72. .ra.== -1 ;; used in macro to make fake ra's
  73. ;; macro for making frames
  74. define $frame name,oer,ier
  75. .mr.,,.ra.
  76. .mr.==.mr.+1
  77. .ra.==.ra.-1
  78. name: ier,,oer
  79. termin
  80. ;; Now save current loc and go make some frames!
  81. dsave== .
  82. .== .slow
  83. ;;
  84. ;; Diagram of call structure:
  85. ;;
  86. ;; p1 -> i1 -> i2
  87. ;; -> i3 -> i4
  88. ;; -> i5
  89. ;; -> p2 -> i6 -> p3
  90. ;;
  91. $frame p1,0,f5
  92. $frame i1,p1,f3
  93. $frame i2,i1,0
  94. $frame f2,i2,0
  95. $frame i3,i1,f4
  96. $frame i4,i3,0
  97. $frame f4,i4,0
  98. $frame f3,i3,f2
  99. $frame f1,i1,0
  100. $frame i5,p1,0
  101. $frame f5,i5,f1
  102. $frame p2,p1,0
  103. $frame i6,p2,0
  104. $frame p3,i6,0
  105. ;;
  106. ;; Set stuff to be loaded as args
  107. ;;
  108. .frame==p3
  109. .shigh==.
  110. .== dsave