1

I am reading the paper Garbage-First Garbage Collection (http://cs.williams.edu/~dbarowy/cs334s18/assets/p37-detlefs.pdf), in section 2.2 it mentions the write barrier. In order to filter out the object from the same region, it has the following code, when rTmp is 0 means rX and rY contains pointer from the same region

rTmp := rX XOR rY
rTmp := rTmp >> LogOfHeapRegionSize

But if assume LogOfHeapRegionSize is 4 (bin=100), and rX starts the address (bin 0), rY starts the address (bin 111), clearly, they are not in the same region, but apply the code above, we have

111 XOR 000 = 111
111 >> 4 = 0

gives they are in the same region, why? Am I understand the code in the right way?

AlBlue
  • 23,254
  • 14
  • 71
  • 91
Canshi Wei
  • 55
  • 1
  • 5
  • 3
    LogOfHeapRegionSize=4 would mean the region size is 2⁴=16. Addresses 000b (0) and 111b (7) are both in the range 0-15, thus both belong to the first region. – apangin Dec 31 '20 at 10:44

0 Answers0