/** * Return the expected reference count. For non-reference counting collectors this becomes a * true/false relationship. * * @param object The object to check. * @param sanityRootRC The number of root references to the object. * @return The expected (root excluded) reference count. */ public int sanityExpectedRC(ObjectReference object, int sanityRootRC) { Space space = Space.getSpaceForObject(object); // Nursery if (space == Gen.nurserySpace) { return SanityChecker.DEAD; } // Immortal spaces if (space == Gen.immortalSpace || space == Gen.vmSpace) { return space.isReachable(object) ? SanityChecker.ALIVE : SanityChecker.DEAD; } // Mature space (nursery collection) if (VM.activePlan.global().isCurrentGCNursery()) { return SanityChecker.UNSURE; } // Mature space (full heap collection) return space.isReachable(object) ? SanityChecker.ALIVE : SanityChecker.DEAD; }
/** * Return the expected reference count. For non-reference counting collectors this becomes a * true/false relationship. * * @param object The object to check. * @param sanityRootRC The number of root references to the object. * @return The expected (root excluded) reference count. */ public int sanityExpectedRC(ObjectReference object, int sanityRootRC) { Space space = Space.getSpaceForObject(object); return space.isReachable(object) ? SanityChecker.ALIVE : SanityChecker.DEAD; }