コード例 #1
0
 public OopHandle getOopHandle(int x) {
   Address oopAddr = getOopHandleAddress(x);
   if (oopAddr != null) {
     return oopAddr.getOopHandleAt(0);
   }
   return null;
 }
コード例 #2
0
 public void visitAddress(Address addr) {
   Oop next = heap.newOop(addr.getOopHandleAt(0));
   LivenessPathElement lp =
       new LivenessPathElement(
           null, new NamedFieldIdentifier(baseRootDescription + " @ " + addr));
   rp.put(lp, next);
   markAndTraverse(next);
 }
コード例 #3
0
  /** Only returns addresses of valid OopHandles */
  private Address getOopHandleAddress(int x) {
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(x < top(), "out of bounds");
    }

    Address oopAddr = addr.addOffsetTo(handlesField.getOffset() + x * VM.getVM().getOopSize());
    OopHandle handle = oopAddr.getOopHandleAt(0);
    if (VM.getVM().getUniverse().isInReserved(handle)
        && !VM.getVM().getJNIHandles().isDeletedHandle(handle)) {
      /* the oop handle is valid only if it is not freed (i.e. reserved in heap) and is not a deleted oop */
      return oopAddr;
    } else {
      return null;
    }
  }