Remove unprotected reads in the instance counting routines.

In the past, the instance counters would read the live bitmap, acquire
the heap lock, and then scan the live bitmap.  Reading the live bitmap
ahead of acquiring the heap lock gives the holder of the heap lock an
opportunity to invalidate the copy of the live bitmap read by the
instance counter routine.  For example, the garbage collector could
swap the mark and live bitmaps before releasing the heap lock.  This
change makes the read of the live bitmap safe by moving it into the
critical section.

Bug: 3271510
Change-Id: Ic02171e9ec3b4d24e83773199f00a18a75707427
1 file changed