/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* The Original Code is HAT. The Initial Developer of the
* Original Code is Bill Foote, with contributions from others
*/
/**
*
* @author Bill Foote
*/
/**
* Represents an object that's allocated out of the Java heap. It occupies
* memory in the VM, and is the sort of thing that in a JDK 1.1 VM had
* a handle. It can be a
* JavaClass, a JavaObjectArray, a JavaValueArray or a JavaObject.
*/
//
// Who we refer to. This is heavily optimized for space, because it's
// well worth trading a bit of speed for less swapping.
// referers and referersLen go through two phases: Building and
// resolved. When building, referers might have duplicates, but can
// be appended to. When resolved, referers has no duplicates or
// empty slots.
//
public abstract int getSize();
public abstract long getId();
/**
* Do any initialization this thing needs after its data is read in.
* Subclasses that override this should call super.resolve().
*/
}
}
//
// Eliminate duplicates from referers, and size the array exactly.
// This sets us up to answer queries. See the comments around the
// referers data member for details.
//
void setupReferers() {
if (referersLen > 1) {
// Copy referers to map, screening out duplicates
for (int i = 0; i < referersLen; i++) {
}
}
// Now copy into the array
}
referersLen = -1;
}
/**
* @return the id of this thing as hex string
*/
}
}
/**
* @return the StackTrace of the point of allocation of this object,
* or null if unknown
*/
return getClazz().getSiteTrace(this);
}
public boolean isNew() {
}
}
/**
* Tell the visitor about all of the objects we refer to
*/
}
if (referersLen == 0) {
}
// We just append to referers here. Measurements have shown that
// around 10% to 30% are duplicates, so it's better to just append
// blindly and screen out all the duplicates at once.
}
getClazz().addReferenceFromRoot(r, this);
}
/**
* If the rootset includes this object, return a Root describing one
* of the reasons why.
*/
}
/**
* Tell who refers to us.
*
* @return an Enumeration of JavaHeapObject instances
*/
if (referersLen != -1) {
}
return new Enumeration() {
private int num = 0;
public boolean hasMoreElements() {
}
public Object nextElement() {
}
};
}
/**
* Given other, which the caller promises is in referers, determines if
* the reference is only a weak reference.
*/
return false;
}
/**
* Describe the reference that this thing has to target. This will only
* be called if target is in the array returned by getChildrenForRootset.
*/
return "??";
}
public boolean isHeapAllocated() {
return true;
}
}