sun.jvm.hotspot.oops.Oop Java Examples

The following examples show how to use sun.jvm.hotspot.oops.Oop. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HeapHistogramVisitor.java    From vjtools with Apache License 2.0 6 votes vote down vote up
private void updateWith(ClassStats classStats, Oop obj, Place place) {
	long objSize = obj.getObjectSize();
	classStats.count++;
	classStats.size += objSize;

	switch (place) {
		case InEden:
			classStats.edenCount++;
			classStats.edenSize += objSize;
			break;
		case InSurvivor:
			classStats.survivorCount++;
			classStats.survivorSize += objSize;
			break;
		case InOld:
			classStats.oldCount++;
			classStats.oldSize += objSize;
			break;
		case Unknown:
			break;
	}
}
 
Example #2
Source File: ThreadGroupReferenceImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example #3
Source File: ThreadGroupReferenceImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example #4
Source File: HeapHistogramVisitor.java    From vjtools with Apache License 2.0 6 votes vote down vote up
@Override
public boolean doObj(Oop obj) {
	Klass klass = obj.getKlass();

	ClassStats classStats = HeapUtils.getClassStats(klass, classStatsMap);
	Place place = isCms ? getCmsLocation(obj) : getParLocation(obj);
	long objSize = obj.getObjectSize();

	updateWith(classStats, objSize, place);

	// 每完成1% 打印一个.,每完成10% 打印百分比提示
	progressNodifier.processingSize += objSize;
	if (progressNodifier.processingSize > progressNodifier.nextNotificationSize) {
		progressNodifier.printProgress();
	}

	return false;
}
 
Example #5
Source File: ThreadGroupReferenceImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example #6
Source File: CommandProcessor.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
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");
    }
}
 
Example #7
Source File: ReferenceTypeImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #8
Source File: HeapHistogramVisitor.java    From vjtools with Apache License 2.0 5 votes vote down vote up
public Place getParLocation(Oop obj) {
	OopHandle handle = obj.getHandle();

	if (parEden.contains(handle)) {
		return Place.InEden;
	}
	if (parOld.isIn(handle)) {
		return Place.InOld;
	}
	if (parSur.contains(handle)) {
		return Place.InSurvivor;
	}

	return Place.Unknown;
}
 
Example #9
Source File: ReferenceTypeImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #10
Source File: HeapHistogramVisitor.java    From vjtools with Apache License 2.0 5 votes vote down vote up
public Place getParLocation(Oop obj) {
	OopHandle handle = obj.getHandle();

	if (parEden.contains(handle)) {
		return Place.InEden;
	}
	if (parOld.isIn(handle)) {
		return Place.InOld;
	}
	if (parSur.contains(handle)) {
		return Place.InSurvivor;
	}

	return Place.Unknown;
}
 
Example #11
Source File: HeapHistogramVisitor.java    From vjtools with Apache License 2.0 5 votes vote down vote up
private Place getCmsLocation(Oop obj) {
	OopHandle handle = obj.getHandle();

	if (cmsEden.contains(handle)) {
		return Place.InEden;
	}
	if (cmsOld.contains(handle)) {
		return Place.InOld;
	}
	if (cmsSur.contains(handle)) {
		return Place.InSurvivor;
	}

	return Place.Unknown;
}
 
Example #12
Source File: VirtualMachineImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #13
Source File: VirtualMachineImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #14
Source File: VirtualMachineImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #15
Source File: VirtualMachineImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #16
Source File: VirtualMachineImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #17
Source File: ReferenceTypeImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #18
Source File: CommandProcessor.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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");
    }
}
 
Example #19
Source File: CommandProcessor.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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");
    }
}
 
Example #20
Source File: ObjectReferenceImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #21
Source File: VirtualMachineImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #22
Source File: VirtualMachineImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #23
Source File: VirtualMachineImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #24
Source File: CommandProcessor.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
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");
    }
}
 
Example #25
Source File: ReferenceTypeImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #26
Source File: ObjectReferenceImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #27
Source File: ThreadGroupReferenceImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #28
Source File: VirtualMachineImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #29
Source File: VirtualMachineImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #30
Source File: ReferenceTypeImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
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;
}