本文整理汇总了Java中sun.jvm.hotspot.oops.Oop类的典型用法代码示例。如果您正苦于以下问题:Java Oop类的具体用法?Java Oop怎么用?Java Oop使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Oop类属于sun.jvm.hotspot.oops包,在下文中一共展示了Oop类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: threads
import sun.jvm.hotspot.oops.Oop; //导入依赖的package包/类
public List threads() {
// Each element of this array is the Oop for a thread;
// NOTE it is not the JavaThread that we need to create
// a ThreadReferenceImpl.
Oop[] myThreads = OopUtilities.threadGroupOopGetThreads(ref());
ArrayList myList = new ArrayList(myThreads.length);
for (int ii = 0; ii < myThreads.length; ii++) {
JavaThread jt = OopUtilities.threadOopGetJavaThread(myThreads[ii]);
if (jt != null) {
ThreadReferenceImpl xx = (ThreadReferenceImpl)vm.threadMirror(jt);
myList.add(xx);
}
}
return myList;
}
示例2: probeForObject
import sun.jvm.hotspot.oops.Oop; //导入依赖的package包/类
/**
* Walk backwards to find the start of the object at probeAddress, but don't walk past the bottom
* of the live region.
*/
private Oop probeForObject(Address probeAddress, Address bottom) {
OopHandle cur = probeAddress.andWithMask(~(heapWordSize - 1)).addOffsetToAsOopHandle(0);
while (cur.greaterThanOrEqual(bottom)) {
Oop oop = objectHeap.newOopIfPossible(cur, bottom);
if (oop != null) {
if (cur.addOffsetToAsOopHandle(oop.getObjectSize()).greaterThan(probeAddress)) {
return oop; // original address was within the nearest object
} else {
// declare this a "miss" even though we might not have walked far enough, and we just
// stumbled on some spurious data that looked like an Oop header, but the size is busted
return null;
}
}
cur = cur.addOffsetToAsOopHandle(-heapWordSize);
}
return null; // not found
}
示例3: compareTo
import sun.jvm.hotspot.oops.Oop; //导入依赖的package包/类
public int compareTo(ReferenceType refType) {
/*
* Note that it is critical that compareTo() == 0
* implies that equals() == true. Otherwise, TreeSet
* will collapse classes.
*
* (Classes of the same name loaded by different class loaders
* or in different VMs must not return 0).
*/
ReferenceTypeImpl other = (ReferenceTypeImpl)refType;
int comp = name().compareTo(other.name());
if (comp == 0) {
Oop rf1 = ref();
Oop rf2 = other.ref();
// optimize for typical case: refs equal and VMs equal
if (rf1.equals(rf2)) {
// sequenceNumbers are always positive
comp = vm.sequenceNumber -
((VirtualMachineImpl)(other.virtualMachine())).sequenceNumber;
} else {
comp = rf1.getHandle().minus(rf2.getHandle()) < 0? -1 : 1;
}
}
return comp;
}
示例4: run
import sun.jvm.hotspot.oops.Oop; //导入依赖的package包/类
@Override
public void run() {
SystemDictionary dictionary = VM.getVM().getSystemDictionary();
Klass klass = dictionary.find("java/security/PrivateKey", null, null);
VM.getVM().getObjectHeap().iterateObjectsOfKlass(new DefaultHeapVisitor() {
@Override
public boolean doObj(Oop oop) {
oop.iterate(new KeyPrinter(), false);
return false;
}
}, klass);
}
示例5: printOopValue
import sun.jvm.hotspot.oops.Oop; //导入依赖的package包/类
void printOopValue(Oop oop) {
if (oop != null) {
Klass k = oop.getKlass();
Symbol s = k.getName();
if (s != null) {
out.print("Oop for " + s.asString() + " @ ");
} else {
out.print("Oop @ ");
}
Oop.printOopAddressOn(oop, out);
} else {
out.print("null");
}
}
示例6: instances
import sun.jvm.hotspot.oops.Oop; //导入依赖的package包/类
public List instances(long maxInstances) {
if (!vm.canGetInstanceInfo()) {
throw new UnsupportedOperationException(
"target does not support getting instances");
}
if (maxInstances < 0) {
throw new IllegalArgumentException("maxInstances is less than zero: "
+ maxInstances);
}
final List objects = new ArrayList(0);
if (isAbstract() || (this instanceof InterfaceType)) {
return objects;
}
final Klass givenKls = this.ref();
final long max = maxInstances;
vm.saObjectHeap().iterate(new DefaultHeapVisitor() {
private long instCount=0;
public boolean doObj(Oop oop) {
if (givenKls.equals(oop.getKlass())) {
objects.add(vm.objectMirror(oop));
instCount++;
}
if (max > 0 && instCount >= max) {
return true;
}
return false;
}
});
return objects;
}
示例7: referringObjects
import sun.jvm.hotspot.oops.Oop; //导入依赖的package包/类
public List referringObjects(long maxReferrers) {
if (!vm.canGetInstanceInfo()) {
throw new UnsupportedOperationException(
"target does not support getting instances");
}
if (maxReferrers < 0) {
throw new IllegalArgumentException("maxReferrers is less than zero: "
+ maxReferrers);
}
final ObjectReference obj = this;
final List objects = new ArrayList(0);
final long max = maxReferrers;
vm.saObjectHeap().iterate(new DefaultHeapVisitor() {
private long refCount = 0;
public boolean doObj(Oop oop) {
try {
ObjectReference objref = vm.objectMirror(oop);
List fields = objref.referenceType().allFields();
for (int i=0; i < fields.size(); i++) {
Field fld = (Field)fields.get(i);
if (objref.getValue(fld).equals(obj) && !objects.contains(objref)) {
objects.add(objref);
refCount++;
}
}
if (max > 0 && refCount >= max) {
return true;
}
} catch (RuntimeException x) {
// Ignore RuntimeException thrown from vm.objectMirror(oop)
// for bad oop. It is possible to see some bad oop
// because heap might be iterating at no safepoint.
}
return false;
}
});
return objects;
}
示例8: threadGroups
import sun.jvm.hotspot.oops.Oop; //导入依赖的package包/类
public List threadGroups() {
Oop[] myGroups = OopUtilities.threadGroupOopGetGroups(ref());
ArrayList myList = new ArrayList(myGroups.length);
for (int ii = 0; ii < myGroups.length; ii++) {
ThreadGroupReferenceImpl xx = (ThreadGroupReferenceImpl)vm.threadGroupMirror(
(Instance)myGroups[ii]);
myList.add(xx);
}
return myList;
}
示例9: allObjects
import sun.jvm.hotspot.oops.Oop; //导入依赖的package包/类
public List/*<ObjectReference>*/ allObjects() {
final List objects = new ArrayList(0);
saObjectHeap.iterate(
new DefaultHeapVisitor() {
public boolean doObj(Oop oop) {
objects.add(objectMirror(oop));
return false;
}
});
return objects;
}
示例10: objectsByExactType
import sun.jvm.hotspot.oops.Oop; //导入依赖的package包/类
private List/*<ObjectReference>*/ objectsByExactType(ReferenceType type) {
final List objects = new ArrayList(0);
final Klass givenKls = ((ReferenceTypeImpl)type).ref();
saObjectHeap.iterate(new DefaultHeapVisitor() {
public boolean doObj(Oop oop) {
if (givenKls.equals(oop.getKlass())) {
objects.add(objectMirror(oop));
}
return false;
}
});
return objects;
}
示例11: objectsBySubType
import sun.jvm.hotspot.oops.Oop; //导入依赖的package包/类
private List/*<ObjectReference>*/ objectsBySubType(ReferenceType type) {
final List objects = new ArrayList(0);
final ReferenceType givenType = type;
saObjectHeap.iterate(new DefaultHeapVisitor() {
public boolean doObj(Oop oop) {
ReferenceTypeImpl curType = (ReferenceTypeImpl) referenceType(oop.getKlass());
if (curType.isAssignableTo(givenType)) {
objects.add(objectMirror(oop));
}
return false;
}
});
return objects;
}
示例12: writeGlobalJNIHandle
import sun.jvm.hotspot.oops.Oop; //导入依赖的package包/类
protected void writeGlobalJNIHandle(Address handleAddr) throws IOException {
OopHandle oopHandle = handleAddr.getOopHandleAt(0);
Oop oop = objectHeap.newOop(oopHandle);
// exclude JNI handles of hotspot internal objects
if (oop != null && isJavaVisible(oop)) {
out.writeByte((byte) HPROF_GC_ROOT_JNI_GLOBAL);
writeObjectID(oop);
// use JNIHandle address as ID
writeObjectID(getAddressValue(handleAddr));
}
}
示例13: addToGraph
import sun.jvm.hotspot.oops.Oop; //导入依赖的package包/类
private void addToGraph(Graph graph, Oop object) {
Klass klass = object.getKlass();
Node node = graph.nodes.get(klass.getAddress());
if (node == null) {
node = new Node();
node.klass = klass;
graph.nodes.put(klass.getAddress(), node);
}
node.hits++;
node.size += object.getObjectSize();
}
示例14: newOop
import sun.jvm.hotspot.oops.Oop; //导入依赖的package包/类
@Override
public Oop newOop(OopHandle handle) {
if (handle == null) {
return null;
}
Address klassAddress;
if (VM.getVM().isCompressedKlassPointersEnabled()) {
klassAddress = handle.getCompKlassAddressAt(oopCompressedKlass.getOffset());
} else {
klassAddress = handle.getAddressAt(oopKlass.getOffset());
}
int layoutHelper = klassAddress.getJIntAt(klassLayoutHelper.getOffset());
int tag = layoutHelper >> Klass.LH_ARRAY_TAG_SHIFT;
if (tag == Klass.LH_ARRAY_TAG_OBJ_VALUE) {
// object array
Klass bottomKlass = getKlassAtAddress(objArrayBottomKlass.getValue(klassAddress));
return new FastObjArray(handle, this, new FastObjArrayKlass(klassAddress, bottomKlass));
} else if (tag == Klass.LH_ARRAY_TAG_TYPE_VALUE) {
// primitive array
return new FastTypeArray(handle, this, new TypeArrayKlass(klassAddress));
} else {
Symbol name = Symbol.create(klassAddress.getAddressAt(klassName.getOffset()));
if (javaLangClass.equals(name)) {
// instance of java.lang.Class, which has special handling for static members
return new FastInstance(handle, this, new FastInstanceMirrorKlass(klassAddress));
} else {
// instance of anything else. we don't handle InstanceRefKlass or InstanceClassLoaderKlass
// because they contain no extra logic
return new FastInstance(handle, this, new FastInstanceKlass(klassAddress));
}
}
}
示例15: getKlassForClass
import sun.jvm.hotspot.oops.Oop; //导入依赖的package包/类
public Klass getKlassForClass(Oop instanceOfJavaLangClass) {
Address address = instanceOfJavaLangClass.getHandle().getAddressAt(oopKlassOffset);
if (address == null) {
return null;
}
return getKlassAtAddress(address);
}