/** 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; } }
public String toString() { Address handleBase = addr.addOffsetTo(handlesField.getOffset()); Address handleEnd = addr.addOffsetTo(handlesField.getOffset() + top() * VM.getVM().getOopSize()); return "JNIHandleBlock [" + handleBase + ", " + handleEnd + ")"; }