Skip to content
  • John van Groningen's avatar
    in mark using pointer reversal of the garbage collector, change marking of arrays with pointers, · dd968699
    John van Groningen authored
    the arrays are not reordered anymore
    
    also change the mark bits that are used when marking the first argument of the arguments part of a node:
    set the least significant 2 bits to 3 instead of 1
    
    to mark such an array:
    - temporarily overwrite the _ARRAY_ descriptor with the address of the pointer (of a previously marked node) to this node
    - elements are marked in reverse order, so starting with the last pointer element
    - temporarily overwrite the last pointer with a pointer to the beginning of the array
    - mark the first pointer of the array, or the first pointer of the last record element if the record also contains non pointers,
      by setting the least significant 2 bits to 1
    - continue marking by marking the elements, or the last record element
    - after marking these elements, the beginning of the array can be recognized because we have a pointer to the array (in the element)
      and therefore the address of the first element
    - if it was not the first element, we have marked a record element that also contains non pointers, we can load the record descriptor
      of the elements using the pointer to the array and compute the first and last pointer addresses of the previous record element,
      then temporarily store the address of the array in the last pointer and mark the least significant 2 bits of the first pointer
      with 1 and continue with marking this record element
    - otherwise, the array has been marked, restore the _ARRAY_descriptor and
      continue marking using the address of the pointer that was stored there at the beginning
    dd968699