Java Code Examples for sun.jvm.hotspot.memory.SystemDictionary#ClassVisitor

The following examples show how to use sun.jvm.hotspot.memory.SystemDictionary#ClassVisitor . 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: VirtualMachineImpl.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
private void retrieveAllClasses() {
    final List saKlasses = new ArrayList();
    SystemDictionary.ClassVisitor visitor = new SystemDictionary.ClassVisitor() {
            public void visit(Klass k) {
                for (Klass l = k; l != null; l = l.arrayKlassOrNull()) {
                    // for non-array classes filter out un-prepared classes
                    // refer to 'allClasses' in share/back/VirtualMachineImpl.c
                    if (l instanceof ArrayKlass) {
                       saKlasses.add(l);
                    } else {
                       int status = l.getClassStatus();
                       if ((status & JVMDIClassStatus.PREPARED) != 0) {
                           saKlasses.add(l);
                       }
                    }
                }
            }
    };

    // refer to jvmtiGetLoadedClasses.cpp - getLoadedClasses in VM code.

    // classes from SystemDictionary
    saSystemDictionary.classesDo(visitor);

    // From SystemDictionary we do not get primitive single
    // dimensional array classes. add primitive single dimensional array
    // klasses from Universe.
    saVM.getUniverse().basicTypeClassesDo(visitor);

    // Hold lock during processing to improve performance
    // and to have safe check/set of retrievedAllTypes
    synchronized (this) {
        if (!retrievedAllTypes) {
            // Number of classes
            int count = saKlasses.size();
            for (int ii = 0; ii < count; ii++) {
                Klass kk = (Klass)saKlasses.get(ii);
                ReferenceTypeImpl type = referenceType(kk);
            }
            retrievedAllTypes = true;
        }
    }
}
 
Example 2
Source File: VirtualMachineImpl.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
private void retrieveAllClasses() {
    final List saKlasses = new ArrayList();
    SystemDictionary.ClassVisitor visitor = new SystemDictionary.ClassVisitor() {
            public void visit(Klass k) {
                for (Klass l = k; l != null; l = l.arrayKlassOrNull()) {
                    // for non-array classes filter out un-prepared classes
                    // refer to 'allClasses' in share/back/VirtualMachineImpl.c
                    if (l instanceof ArrayKlass) {
                       saKlasses.add(l);
                    } else {
                       int status = l.getClassStatus();
                       if ((status & JVMDIClassStatus.PREPARED) != 0) {
                           saKlasses.add(l);
                       }
                    }
                }
            }
    };

    // refer to jvmtiGetLoadedClasses.cpp - getLoadedClasses in VM code.

    // classes from SystemDictionary
    saSystemDictionary.classesDo(visitor);

    // From SystemDictionary we do not get primitive single
    // dimensional array classes. add primitive single dimensional array
    // klasses from Universe.
    saVM.getUniverse().basicTypeClassesDo(visitor);

    // Hold lock during processing to improve performance
    // and to have safe check/set of retrievedAllTypes
    synchronized (this) {
        if (!retrievedAllTypes) {
            // Number of classes
            int count = saKlasses.size();
            for (int ii = 0; ii < count; ii++) {
                Klass kk = (Klass)saKlasses.get(ii);
                ReferenceTypeImpl type = referenceType(kk);
            }
            retrievedAllTypes = true;
        }
    }
}
 
Example 3
Source File: VirtualMachineImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
private void retrieveAllClasses() {
    final List saKlasses = new ArrayList();
    SystemDictionary.ClassVisitor visitor = new SystemDictionary.ClassVisitor() {
            public void visit(Klass k) {
                for (Klass l = k; l != null; l = l.arrayKlassOrNull()) {
                    // for non-array classes filter out un-prepared classes
                    // refer to 'allClasses' in share/back/VirtualMachineImpl.c
                    if (l instanceof ArrayKlass) {
                       saKlasses.add(l);
                    } else {
                       int status = l.getClassStatus();
                       if ((status & JVMDIClassStatus.PREPARED) != 0) {
                           saKlasses.add(l);
                       }
                    }
                }
            }
    };

    // refer to jvmtiGetLoadedClasses.cpp - getLoadedClasses in VM code.

    // classes from SystemDictionary
    saSystemDictionary.classesDo(visitor);

    // From SystemDictionary we do not get primitive single
    // dimensional array classes. add primitive single dimensional array
    // klasses from Universe.
    saVM.getUniverse().basicTypeClassesDo(visitor);

    // Hold lock during processing to improve performance
    // and to have safe check/set of retrievedAllTypes
    synchronized (this) {
        if (!retrievedAllTypes) {
            // Number of classes
            int count = saKlasses.size();
            for (int ii = 0; ii < count; ii++) {
                Klass kk = (Klass)saKlasses.get(ii);
                ReferenceTypeImpl type = referenceType(kk);
            }
            retrievedAllTypes = true;
        }
    }
}
 
Example 4
Source File: VirtualMachineImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
private void retrieveAllClasses() {
    final List saKlasses = new ArrayList();
    SystemDictionary.ClassVisitor visitor = new SystemDictionary.ClassVisitor() {
            public void visit(Klass k) {
                for (Klass l = k; l != null; l = l.arrayKlassOrNull()) {
                    // for non-array classes filter out un-prepared classes
                    // refer to 'allClasses' in share/back/VirtualMachineImpl.c
                    if (l instanceof ArrayKlass) {
                       saKlasses.add(l);
                    } else {
                       int status = l.getClassStatus();
                       if ((status & JVMDIClassStatus.PREPARED) != 0) {
                           saKlasses.add(l);
                       }
                    }
                }
            }
    };

    // refer to jvmtiGetLoadedClasses.cpp - getLoadedClasses in VM code.

    // classes from SystemDictionary
    saSystemDictionary.classesDo(visitor);

    // From SystemDictionary we do not get primitive single
    // dimensional array classes. add primitive single dimensional array
    // klasses from Universe.
    saVM.getUniverse().basicTypeClassesDo(visitor);

    // Hold lock during processing to improve performance
    // and to have safe check/set of retrievedAllTypes
    synchronized (this) {
        if (!retrievedAllTypes) {
            // Number of classes
            int count = saKlasses.size();
            for (int ii = 0; ii < count; ii++) {
                Klass kk = (Klass)saKlasses.get(ii);
                ReferenceTypeImpl type = referenceType(kk);
            }
            retrievedAllTypes = true;
        }
    }
}
 
Example 5
Source File: VirtualMachineImpl.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
private void retrieveAllClasses() {
    final List saKlasses = new ArrayList();
    SystemDictionary.ClassVisitor visitor = new SystemDictionary.ClassVisitor() {
            public void visit(Klass k) {
                for (Klass l = k; l != null; l = l.arrayKlassOrNull()) {
                    // for non-array classes filter out un-prepared classes
                    // refer to 'allClasses' in share/back/VirtualMachineImpl.c
                    if (l instanceof ArrayKlass) {
                       saKlasses.add(l);
                    } else {
                       int status = l.getClassStatus();
                       if ((status & JVMDIClassStatus.PREPARED) != 0) {
                           saKlasses.add(l);
                       }
                    }
                }
            }
    };

    // refer to jvmtiGetLoadedClasses.cpp - getLoadedClasses in VM code.

    // classes from SystemDictionary
    saSystemDictionary.classesDo(visitor);

    // From SystemDictionary we do not get primitive single
    // dimensional array classes. add primitive single dimensional array
    // klasses from Universe.
    saVM.getUniverse().basicTypeClassesDo(visitor);

    // Hold lock during processing to improve performance
    // and to have safe check/set of retrievedAllTypes
    synchronized (this) {
        if (!retrievedAllTypes) {
            // Number of classes
            int count = saKlasses.size();
            for (int ii = 0; ii < count; ii++) {
                Klass kk = (Klass)saKlasses.get(ii);
                ReferenceTypeImpl type = referenceType(kk);
            }
            retrievedAllTypes = true;
        }
    }
}
 
Example 6
Source File: VirtualMachineImpl.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
private void retrieveAllClasses() {
    final List saKlasses = new ArrayList();
    SystemDictionary.ClassVisitor visitor = new SystemDictionary.ClassVisitor() {
            public void visit(Klass k) {
                for (Klass l = k; l != null; l = l.arrayKlassOrNull()) {
                    // for non-array classes filter out un-prepared classes
                    // refer to 'allClasses' in share/back/VirtualMachineImpl.c
                    if (l instanceof ArrayKlass) {
                       saKlasses.add(l);
                    } else {
                       int status = l.getClassStatus();
                       if ((status & JVMDIClassStatus.PREPARED) != 0) {
                           saKlasses.add(l);
                       }
                    }
                }
            }
    };

    // refer to jvmtiGetLoadedClasses.cpp - getLoadedClasses in VM code.

    // classes from SystemDictionary
    saSystemDictionary.classesDo(visitor);

    // From SystemDictionary we do not get primitive single
    // dimensional array classes. add primitive single dimensional array
    // klasses from Universe.
    saVM.getUniverse().basicTypeClassesDo(visitor);

    // Hold lock during processing to improve performance
    // and to have safe check/set of retrievedAllTypes
    synchronized (this) {
        if (!retrievedAllTypes) {
            // Number of classes
            int count = saKlasses.size();
            for (int ii = 0; ii < count; ii++) {
                Klass kk = (Klass)saKlasses.get(ii);
                ReferenceTypeImpl type = referenceType(kk);
            }
            retrievedAllTypes = true;
        }
    }
}
 
Example 7
Source File: VirtualMachineImpl.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
private void retrieveAllClasses() {
    final List saKlasses = new ArrayList();
    SystemDictionary.ClassVisitor visitor = new SystemDictionary.ClassVisitor() {
            public void visit(Klass k) {
                for (Klass l = k; l != null; l = l.arrayKlassOrNull()) {
                    // for non-array classes filter out un-prepared classes
                    // refer to 'allClasses' in share/back/VirtualMachineImpl.c
                    if (l instanceof ArrayKlass) {
                       saKlasses.add(l);
                    } else {
                       int status = l.getClassStatus();
                       if ((status & JVMDIClassStatus.PREPARED) != 0) {
                           saKlasses.add(l);
                       }
                    }
                }
            }
    };

    // refer to jvmtiGetLoadedClasses.cpp - getLoadedClasses in VM code.

    // classes from SystemDictionary
    saSystemDictionary.classesDo(visitor);

    // From SystemDictionary we do not get primitive single
    // dimensional array classes. add primitive single dimensional array
    // klasses from Universe.
    saVM.getUniverse().basicTypeClassesDo(visitor);

    // Hold lock during processing to improve performance
    // and to have safe check/set of retrievedAllTypes
    synchronized (this) {
        if (!retrievedAllTypes) {
            // Number of classes
            int count = saKlasses.size();
            for (int ii = 0; ii < count; ii++) {
                Klass kk = (Klass)saKlasses.get(ii);
                ReferenceTypeImpl type = referenceType(kk);
            }
            retrievedAllTypes = true;
        }
    }
}