Skip to content
  • John van Groningen's avatar
    in the compacting garbage collector for 32 bit Intel change marking and copying of arrays, · 2dd75d2d
    John van Groningen authored
    the arrays are not reordered anymore
    
    to mark an array using pointer reversal:
      - temporarily replace the _ARRAY_ descriptor with the previous node information, except the
        2 least significant bits. these are cleared because the least significant bit must be zero
        to detect reversed pointers
      - these 2 least significant bits from the previous node information are stored by temporarily
        multiplying the size by 4 and using the least significant 2 bits
      - the address of the array + 3 is stored in the first element of the array, or for unboxed
        arrays of records with both pointers and non pointers, in the first pointer of the current
        record to be marked
        the first argument of an argument part may also contain and address + 3 if the pointer to the
        argument part has been reversed. this pointer always points to a higher address. for arrays the
        address + 3 points to a lower address. so we can use this to distinguish these pointers
        while marking with pointer reversal. after marking this is no longer possible because
        forward pointers to argument parts will also be reversed.
      - the overwritten first element of the array or record in an array is stored in the element that
        is currently being marked, and later restored.
      - elements are marked in reverse order, so starting with the last pointer element
      - while marking we can detect if we have reached the first element because it is an address + 3
        that points backward. because this is the address of the array we can test if this is not
        yet the first record element of an array of records, and using the record descriptor determine
        the beginning and end of the previous (next to be marked) record element
    2dd75d2d