示例#1
0
 /**
  * Is the specified object live?
  *
  * @param object The object.
  * @return True if the object is live.
  */
 @Inline
 public boolean isLive(ObjectReference object) {
   Space space = Space.getSpaceForObject(object);
   if (space == Plan.loSpace) return Plan.loSpace.isLive(object);
   else if (space == Plan.ploSpace) return Plan.ploSpace.isLive(object);
   else if (Plan.USE_CODE_SPACE && space == Plan.smallCodeSpace)
     return Plan.smallCodeSpace.isLive(object);
   else if (Plan.USE_CODE_SPACE && space == Plan.largeCodeSpace)
     return Plan.largeCodeSpace.isLive(object);
   else if (space == null) {
     if (VM.VERIFY_ASSERTIONS) {
       Log.write("space failure: ");
       Log.writeln(object);
     }
   }
   return true;
 }
示例#2
0
文件: Gen.java 项目: dtzWill/vmkit
  /**
   * 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;
  }
示例#3
0
 /**
  * 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;
 }
示例#4
0
 /**
  * Is the specified object reachable? Used for GC Trace
  *
  * @param object The object.
  * @return True if the object is live.
  */
 @Inline
 public boolean isReachable(ObjectReference object) {
   return Space.getSpaceForObject(object).isReachable(object);
 }