sun.jvm.hotspot.oops.DefaultHeapVisitor Java Examples

The following examples show how to use sun.jvm.hotspot.oops.DefaultHeapVisitor. 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: ObjectReferenceImpl.java    From openjdk-8-source 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 #2
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 #3
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 #4
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 #5
Source File: ObjectReferenceImpl.java    From hottub 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 #6
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 #7
Source File: VirtualMachineImpl.java    From hottub 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 #8
Source File: VirtualMachineImpl.java    From hottub 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 #9
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;
}
 
Example #10
Source File: VirtualMachineImpl.java    From openjdk-jdk8u-backup 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 #11
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 #12
Source File: VirtualMachineImpl.java    From openjdk-8-source 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 #13
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 #14
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 #15
Source File: ObjectReferenceImpl.java    From openjdk-8 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 #16
Source File: VirtualMachineImpl.java    From openjdk-8 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: VirtualMachineImpl.java    From openjdk-8 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 #18
Source File: VirtualMachineImpl.java    From openjdk-8 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 #19
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 #20
Source File: ObjectReferenceImpl.java    From TencentKona-8 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 TencentKona-8 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 TencentKona-8 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 TencentKona-8 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: ReferenceTypeImpl.java    From jdk8u60 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 #25
Source File: ObjectReferenceImpl.java    From jdk8u60 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 #26
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 #27
Source File: VirtualMachineImpl.java    From jdk8u60 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 #28
Source File: ReferenceTypeImpl.java    From TencentKona-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 #29
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 #30
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;
}