sun.jvm.hotspot.oops.Instance Java Examples

The following examples show how to use sun.jvm.hotspot.oops.Instance. 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: ArrayTypeImpl.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public ClassLoaderReference classLoader() {
    if (ref() instanceof TypeArrayKlass) {
        // primitive array klasses are loaded by bootstrap loader
        return null;
    } else {
        Klass bottomKlass = ((ObjArrayKlass)ref()).getBottomKlass();
        if (bottomKlass instanceof TypeArrayKlass) {
            // multidimensional primitive array klasses are loaded by bootstrap loader
            return null;
        } else {
            // class loader of any other obj array klass is same as the loader
            // that loaded the bottom InstanceKlass
            Instance xx = (Instance)(((InstanceKlass) bottomKlass).getClassLoader());
            return vm.classLoaderMirror(xx);
        }
    }
}
 
Example #2
Source File: ArrayTypeImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public ClassLoaderReference classLoader() {
    if (ref() instanceof TypeArrayKlass) {
        // primitive array klasses are loaded by bootstrap loader
        return null;
    } else {
        Klass bottomKlass = ((ObjArrayKlass)ref()).getBottomKlass();
        if (bottomKlass instanceof TypeArrayKlass) {
            // multidimensional primitive array klasses are loaded by bootstrap loader
            return null;
        } else {
            // class loader of any other obj array klass is same as the loader
            // that loaded the bottom InstanceKlass
            Instance xx = (Instance)(((InstanceKlass) bottomKlass).getClassLoader());
            return vm.classLoaderMirror(xx);
        }
    }
}
 
Example #3
Source File: ArrayTypeImpl.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public ClassLoaderReference classLoader() {
    if (ref() instanceof TypeArrayKlass) {
        // primitive array klasses are loaded by bootstrap loader
        return null;
    } else {
        Klass bottomKlass = ((ObjArrayKlass)ref()).getBottomKlass();
        if (bottomKlass instanceof TypeArrayKlass) {
            // multidimensional primitive array klasses are loaded by bootstrap loader
            return null;
        } else {
            // class loader of any other obj array klass is same as the loader
            // that loaded the bottom InstanceKlass
            Instance xx = (Instance)(((InstanceKlass) bottomKlass).getClassLoader());
            return vm.classLoaderMirror(xx);
        }
    }
}
 
Example #4
Source File: ArrayTypeImpl.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public ClassLoaderReference classLoader() {
    if (ref() instanceof TypeArrayKlass) {
        // primitive array klasses are loaded by bootstrap loader
        return null;
    } else {
        Klass bottomKlass = ((ObjArrayKlass)ref()).getBottomKlass();
        if (bottomKlass instanceof TypeArrayKlass) {
            // multidimensional primitive array klasses are loaded by bootstrap loader
            return null;
        } else {
            // class loader of any other obj array klass is same as the loader
            // that loaded the bottom InstanceKlass
            Instance xx = (Instance)(((InstanceKlass) bottomKlass).getClassLoader());
            return vm.classLoaderMirror(xx);
        }
    }
}
 
Example #5
Source File: ArrayTypeImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public ClassLoaderReference classLoader() {
    if (ref() instanceof TypeArrayKlass) {
        // primitive array klasses are loaded by bootstrap loader
        return null;
    } else {
        Klass bottomKlass = ((ObjArrayKlass)ref()).getBottomKlass();
        if (bottomKlass instanceof TypeArrayKlass) {
            // multidimensional primitive array klasses are loaded by bootstrap loader
            return null;
        } else {
            // class loader of any other obj array klass is same as the loader
            // that loaded the bottom InstanceKlass
            Instance xx = (Instance)(((InstanceKlass) bottomKlass).getClassLoader());
            return vm.classLoaderMirror(xx);
        }
    }
}
 
Example #6
Source File: ArrayTypeImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public ClassLoaderReference classLoader() {
    if (ref() instanceof TypeArrayKlass) {
        // primitive array klasses are loaded by bootstrap loader
        return null;
    } else {
        Klass bottomKlass = ((ObjArrayKlass)ref()).getBottomKlass();
        if (bottomKlass instanceof TypeArrayKlass) {
            // multidimensional primitive array klasses are loaded by bootstrap loader
            return null;
        } else {
            // class loader of any other obj array klass is same as the loader
            // that loaded the bottom InstanceKlass
            Instance xx = (Instance)(((InstanceKlass) bottomKlass).getClassLoader());
            return vm.classLoaderMirror(xx);
        }
    }
}
 
Example #7
Source File: ThreadGroupReferenceImpl.java    From openjdk-8-source 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 #8
Source File: ThreadReferenceImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
ThreadReferenceImpl(VirtualMachine vm, Instance oRef) {
    // Instance must be of type java.lang.Thread
    super(vm, oRef);

    // JavaThread retrieved from java.lang.Thread instance may be null.
    // This is the case for threads not-started and for zombies. Wherever
    // appropriate, check for null instead of resulting in NullPointerException.
    myJavaThread = OopUtilities.threadOopGetJavaThread(oRef);
}
 
Example #9
Source File: ThreadReferenceImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
ThreadReferenceImpl(VirtualMachine aVm, sun.jvm.hotspot.runtime.JavaThread aRef) {
    // We are given a JavaThread and save it in our myJavaThread field.
    // But, our parent class is an ObjectReferenceImpl so we need an Oop
    // for it.  JavaThread is a wrapper around a Thread Oop so we get
    // that Oop and give it to our super.
    // We can get it back again by calling ref().
    super(aVm, (Instance)aRef.getThreadObj());
    myJavaThread = aRef;
}
 
Example #10
Source File: ThreadGroupReferenceImpl.java    From TencentKona-8 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 #11
Source File: ThreadReferenceImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
ThreadReferenceImpl(VirtualMachine vm, Instance oRef) {
    // Instance must be of type java.lang.Thread
    super(vm, oRef);

    // JavaThread retrieved from java.lang.Thread instance may be null.
    // This is the case for threads not-started and for zombies. Wherever
    // appropriate, check for null instead of resulting in NullPointerException.
    myJavaThread = OopUtilities.threadOopGetJavaThread(oRef);
}
 
Example #12
Source File: ThreadReferenceImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
ThreadReferenceImpl(VirtualMachine vm, Instance oRef) {
    // Instance must be of type java.lang.Thread
    super(vm, oRef);

    // JavaThread retrieved from java.lang.Thread instance may be null.
    // This is the case for threads not-started and for zombies. Wherever
    // appropriate, check for null instead of resulting in NullPointerException.
    myJavaThread = OopUtilities.threadOopGetJavaThread(oRef);
}
 
Example #13
Source File: ThreadGroupReferenceImpl.java    From jdk8u60 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 #14
Source File: ThreadReferenceImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
ThreadReferenceImpl(VirtualMachine aVm, sun.jvm.hotspot.runtime.JavaThread aRef) {
    // We are given a JavaThread and save it in our myJavaThread field.
    // But, our parent class is an ObjectReferenceImpl so we need an Oop
    // for it.  JavaThread is a wrapper around a Thread Oop so we get
    // that Oop and give it to our super.
    // We can get it back again by calling ref().
    super(aVm, (Instance)aRef.getThreadObj());
    myJavaThread = aRef;
}
 
Example #15
Source File: ThreadReferenceImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
ThreadReferenceImpl(VirtualMachine aVm, sun.jvm.hotspot.runtime.JavaThread aRef) {
    // We are given a JavaThread and save it in our myJavaThread field.
    // But, our parent class is an ObjectReferenceImpl so we need an Oop
    // for it.  JavaThread is a wrapper around a Thread Oop so we get
    // that Oop and give it to our super.
    // We can get it back again by calling ref().
    super(aVm, (Instance)aRef.getThreadObj());
    myJavaThread = aRef;
}
 
Example #16
Source File: ThreadGroupReferenceImpl.java    From openjdk-8 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 #17
Source File: ThreadReferenceImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
ThreadReferenceImpl(VirtualMachine vm, Instance oRef) {
    // Instance must be of type java.lang.Thread
    super(vm, oRef);

    // JavaThread retrieved from java.lang.Thread instance may be null.
    // This is the case for threads not-started and for zombies. Wherever
    // appropriate, check for null instead of resulting in NullPointerException.
    myJavaThread = OopUtilities.threadOopGetJavaThread(oRef);
}
 
Example #18
Source File: ThreadGroupReferenceImpl.java    From openjdk-jdk8u 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 #19
Source File: ThreadReferenceImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
ThreadReferenceImpl(VirtualMachine aVm, sun.jvm.hotspot.runtime.JavaThread aRef) {
    // We are given a JavaThread and save it in our myJavaThread field.
    // But, our parent class is an ObjectReferenceImpl so we need an Oop
    // for it.  JavaThread is a wrapper around a Thread Oop so we get
    // that Oop and give it to our super.
    // We can get it back again by calling ref().
    super(aVm, (Instance)aRef.getThreadObj());
    myJavaThread = aRef;
}
 
Example #20
Source File: ThreadGroupReferenceImpl.java    From hottub 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 #21
Source File: ThreadReferenceImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
ThreadReferenceImpl(VirtualMachine aVm, sun.jvm.hotspot.runtime.JavaThread aRef) {
    // We are given a JavaThread and save it in our myJavaThread field.
    // But, our parent class is an ObjectReferenceImpl so we need an Oop
    // for it.  JavaThread is a wrapper around a Thread Oop so we get
    // that Oop and give it to our super.
    // We can get it back again by calling ref().
    super(aVm, (Instance)aRef.getThreadObj());
    myJavaThread = aRef;
}
 
Example #22
Source File: ThreadReferenceImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public ThreadGroupReference threadGroup() {
    return (ThreadGroupReferenceImpl)vm.threadGroupMirror(
           (Instance)OopUtilities.threadOopGetThreadGroup(ref()));
}
 
Example #23
Source File: ReferenceTypeImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public ClassLoaderReference classLoader() {
  Instance xx = (Instance)(((InstanceKlass)saKlass).getClassLoader());
  return (ClassLoaderReferenceImpl)vm.classLoaderMirror(xx);
}
 
Example #24
Source File: VirtualMachineImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
synchronized ObjectReferenceImpl objectMirror(Oop key) {

        // Handle any queue elements that are not strongly reachable
        processQueue();

        if (key == null) {
            return null;
        }
        ObjectReferenceImpl object = null;

        /*
         * Attempt to retrieve an existing object object reference
         */
        SoftObjectReference ref = (SoftObjectReference)objectsByID.get(key);
        if (ref != null) {
            object = ref.object();
        }

        /*
         * If the object wasn't in the table, or it's soft reference was
         * cleared, create a new instance.
         */
        if (object == null) {
            if (key instanceof Instance) {
                // look for well-known classes
                Symbol className = key.getKlass().getName();
                if (Assert.ASSERTS_ENABLED) {
                    Assert.that(className != null, "Null class name");
                }
                Instance inst = (Instance) key;
                if (className.equals(javaLangString)) {
                    object = new StringReferenceImpl(this, inst);
                } else if (className.equals(javaLangThread)) {
                    object = new ThreadReferenceImpl(this, inst);
                } else if (className.equals(javaLangThreadGroup)) {
                    object = new ThreadGroupReferenceImpl(this, inst);
                } else if (className.equals(javaLangClass)) {
                    object = new ClassObjectReferenceImpl(this, inst);
                } else if (className.equals(javaLangClassLoader)) {
                    object = new ClassLoaderReferenceImpl(this, inst);
                } else {
                    // not a well-known class. But the base class may be
                    // one of the known classes.
                    Klass kls = key.getKlass().getSuper();
                    while (kls != null) {
                       className = kls.getName();
                       // java.lang.Class and java.lang.String are final classes
                       if (className.equals(javaLangThread)) {
                          object = new ThreadReferenceImpl(this, inst);
                          break;
                       } else if(className.equals(javaLangThreadGroup)) {
                          object = new ThreadGroupReferenceImpl(this, inst);
                          break;
                       } else if (className.equals(javaLangClassLoader)) {
                          object = new ClassLoaderReferenceImpl(this, inst);
                          break;
                       }
                       kls = kls.getSuper();
                    }

                    if (object == null) {
                       // create generic object reference
                       object = new ObjectReferenceImpl(this, inst);
                    }
                }
            } else if (key instanceof TypeArray) {
                object = new ArrayReferenceImpl(this, (Array) key);
            } else if (key instanceof ObjArray) {
                object = new ArrayReferenceImpl(this, (Array) key);
            } else {
                throw new RuntimeException("unexpected object type " + key);
            }
            ref = new SoftObjectReference(key, object, referenceQueue);

            /*
             * If there was no previous entry in the table, we add one here
             * If the previous entry was cleared, we replace it here.
             */
            objectsByID.put(key, ref);
        } else {
            ref.incrementCount();
        }

        return object;
    }
 
Example #25
Source File: VirtualMachineImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
StringReferenceImpl stringMirror(Instance id) {
    return (StringReferenceImpl) objectMirror(id);
}
 
Example #26
Source File: VirtualMachineImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
ThreadReferenceImpl threadMirror(Instance id) {
    return (ThreadReferenceImpl) objectMirror(id);
}
 
Example #27
Source File: VirtualMachineImpl.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
synchronized ObjectReferenceImpl objectMirror(Oop key) {

        // Handle any queue elements that are not strongly reachable
        processQueue();

        if (key == null) {
            return null;
        }
        ObjectReferenceImpl object = null;

        /*
         * Attempt to retrieve an existing object object reference
         */
        SoftObjectReference ref = (SoftObjectReference)objectsByID.get(key);
        if (ref != null) {
            object = ref.object();
        }

        /*
         * If the object wasn't in the table, or it's soft reference was
         * cleared, create a new instance.
         */
        if (object == null) {
            if (key instanceof Instance) {
                // look for well-known classes
                Symbol className = key.getKlass().getName();
                if (Assert.ASSERTS_ENABLED) {
                    Assert.that(className != null, "Null class name");
                }
                Instance inst = (Instance) key;
                if (className.equals(javaLangString)) {
                    object = new StringReferenceImpl(this, inst);
                } else if (className.equals(javaLangThread)) {
                    object = new ThreadReferenceImpl(this, inst);
                } else if (className.equals(javaLangThreadGroup)) {
                    object = new ThreadGroupReferenceImpl(this, inst);
                } else if (className.equals(javaLangClass)) {
                    object = new ClassObjectReferenceImpl(this, inst);
                } else if (className.equals(javaLangClassLoader)) {
                    object = new ClassLoaderReferenceImpl(this, inst);
                } else {
                    // not a well-known class. But the base class may be
                    // one of the known classes.
                    Klass kls = key.getKlass().getSuper();
                    while (kls != null) {
                       className = kls.getName();
                       // java.lang.Class and java.lang.String are final classes
                       if (className.equals(javaLangThread)) {
                          object = new ThreadReferenceImpl(this, inst);
                          break;
                       } else if(className.equals(javaLangThreadGroup)) {
                          object = new ThreadGroupReferenceImpl(this, inst);
                          break;
                       } else if (className.equals(javaLangClassLoader)) {
                          object = new ClassLoaderReferenceImpl(this, inst);
                          break;
                       }
                       kls = kls.getSuper();
                    }

                    if (object == null) {
                       // create generic object reference
                       object = new ObjectReferenceImpl(this, inst);
                    }
                }
            } else if (key instanceof TypeArray) {
                object = new ArrayReferenceImpl(this, (Array) key);
            } else if (key instanceof ObjArray) {
                object = new ArrayReferenceImpl(this, (Array) key);
            } else {
                throw new RuntimeException("unexpected object type " + key);
            }
            ref = new SoftObjectReference(key, object, referenceQueue);

            /*
             * If there was no previous entry in the table, we add one here
             * If the previous entry was cleared, we replace it here.
             */
            objectsByID.put(key, ref);
        } else {
            ref.incrementCount();
        }

        return object;
    }
 
Example #28
Source File: VirtualMachineImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
ClassLoaderReferenceImpl classLoaderMirror(Instance id) {
    return (ClassLoaderReferenceImpl) objectMirror(id);
}
 
Example #29
Source File: VirtualMachineImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
ClassObjectReferenceImpl classObjectMirror(Instance id) {
    return (ClassObjectReferenceImpl) objectMirror(id);
}
 
Example #30
Source File: StringReferenceImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
StringReferenceImpl(VirtualMachine aVm, sun.jvm.hotspot.oops.Instance oRef) {
    super(aVm,oRef);
    value = OopUtilities.stringOopToString(oRef);
}