Retain classes allocated after their objects until the objects are compacted

When freeing pages in from-space, ensure that pages for those classes
which are allocated after their objects are not freed until the objects
are compacted. Only after the usage for a class (for visiting
references in its objects) are finised, we should free the from-space
pages.

Bug: 160737021
Bug: 261733722
Test: ART_USE_READ_BARRIER=false art/tools/run-libcore-tests.sh --mode=host
--debug  test.java.security.KeyAgreement.MultiThreadTest

Change-Id: I6c52f10d02a30d69ee357c85f06152b140a785b9
(cherry picked from commit 7f92fbab86b67b6e1d9aa7b565822156fcc861d8)
Merged-In: I6c52f10d02a30d69ee357c85f06152b140a785b9
3 files changed