sun.jvm.hotspot.oops.ObjArrayKlass Java Examples

The following examples show how to use sun.jvm.hotspot.oops.ObjArrayKlass. 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 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 #2
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 #3
Source File: VirtualMachineImpl.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private synchronized ReferenceTypeImpl addReferenceType(Klass kk) {
    if (typesByID == null) {
        initReferenceTypes();
    }
    ReferenceTypeImpl newRefType = null;
    if (kk instanceof ObjArrayKlass || kk instanceof TypeArrayKlass) {
        newRefType = new ArrayTypeImpl(this, (ArrayKlass)kk);
    } else if (kk instanceof InstanceKlass) {
        if (kk.isInterface()) {
            newRefType = new InterfaceTypeImpl(this, (InstanceKlass)kk);
        } else {
            newRefType = new ClassTypeImpl(this, (InstanceKlass)kk);
        }
    } else {
        throw new RuntimeException("should not reach here:" + kk);
    }

    typesByID.put(kk, newRefType);
    typesBySignature.add(newRefType);
    return newRefType;
}
 
Example #4
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 #5
Source File: VirtualMachineImpl.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private synchronized ReferenceTypeImpl addReferenceType(Klass kk) {
    if (typesByID == null) {
        initReferenceTypes();
    }
    ReferenceTypeImpl newRefType = null;
    if (kk instanceof ObjArrayKlass || kk instanceof TypeArrayKlass) {
        newRefType = new ArrayTypeImpl(this, (ArrayKlass)kk);
    } else if (kk instanceof InstanceKlass) {
        if (kk.isInterface()) {
            newRefType = new InterfaceTypeImpl(this, (InstanceKlass)kk);
        } else {
            newRefType = new ClassTypeImpl(this, (InstanceKlass)kk);
        }
    } else {
        throw new RuntimeException("should not reach here:" + kk);
    }

    typesByID.put(kk, newRefType);
    typesBySignature.add(newRefType);
    return newRefType;
}
 
Example #6
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 #7
Source File: VirtualMachineImpl.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private synchronized ReferenceTypeImpl addReferenceType(Klass kk) {
    if (typesByID == null) {
        initReferenceTypes();
    }
    ReferenceTypeImpl newRefType = null;
    if (kk instanceof ObjArrayKlass || kk instanceof TypeArrayKlass) {
        newRefType = new ArrayTypeImpl(this, (ArrayKlass)kk);
    } else if (kk instanceof InstanceKlass) {
        if (kk.isInterface()) {
            newRefType = new InterfaceTypeImpl(this, (InstanceKlass)kk);
        } else {
            newRefType = new ClassTypeImpl(this, (InstanceKlass)kk);
        }
    } else {
        throw new RuntimeException("should not reach here:" + kk);
    }

    typesByID.put(kk, newRefType);
    typesBySignature.add(newRefType);
    return newRefType;
}
 
Example #8
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 #9
Source File: VirtualMachineImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private synchronized ReferenceTypeImpl addReferenceType(Klass kk) {
    if (typesByID == null) {
        initReferenceTypes();
    }
    ReferenceTypeImpl newRefType = null;
    if (kk instanceof ObjArrayKlass || kk instanceof TypeArrayKlass) {
        newRefType = new ArrayTypeImpl(this, (ArrayKlass)kk);
    } else if (kk instanceof InstanceKlass) {
        if (kk.isInterface()) {
            newRefType = new InterfaceTypeImpl(this, (InstanceKlass)kk);
        } else {
            newRefType = new ClassTypeImpl(this, (InstanceKlass)kk);
        }
    } else {
        throw new RuntimeException("should not reach here:" + kk);
    }

    typesByID.put(kk, newRefType);
    typesBySignature.add(newRefType);
    return newRefType;
}
 
Example #10
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 #11
Source File: VirtualMachineImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private synchronized ReferenceTypeImpl addReferenceType(Klass kk) {
    if (typesByID == null) {
        initReferenceTypes();
    }
    ReferenceTypeImpl newRefType = null;
    if (kk instanceof ObjArrayKlass || kk instanceof TypeArrayKlass) {
        newRefType = new ArrayTypeImpl(this, (ArrayKlass)kk);
    } else if (kk instanceof InstanceKlass) {
        if (kk.isInterface()) {
            newRefType = new InterfaceTypeImpl(this, (InstanceKlass)kk);
        } else {
            newRefType = new ClassTypeImpl(this, (InstanceKlass)kk);
        }
    } else {
        throw new RuntimeException("should not reach here:" + kk);
    }

    typesByID.put(kk, newRefType);
    typesBySignature.add(newRefType);
    return newRefType;
}
 
Example #12
Source File: ArrayTypeImpl.java    From jdk8u60 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 #13
Source File: VirtualMachineImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private synchronized ReferenceTypeImpl addReferenceType(Klass kk) {
    if (typesByID == null) {
        initReferenceTypes();
    }
    ReferenceTypeImpl newRefType = null;
    if (kk instanceof ObjArrayKlass || kk instanceof TypeArrayKlass) {
        newRefType = new ArrayTypeImpl(this, (ArrayKlass)kk);
    } else if (kk instanceof InstanceKlass) {
        if (kk.isInterface()) {
            newRefType = new InterfaceTypeImpl(this, (InstanceKlass)kk);
        } else {
            newRefType = new ClassTypeImpl(this, (InstanceKlass)kk);
        }
    } else {
        throw new RuntimeException("should not reach here:" + kk);
    }

    typesByID.put(kk, newRefType);
    typesBySignature.add(newRefType);
    return newRefType;
}
 
Example #14
Source File: VirtualMachineImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private synchronized ReferenceTypeImpl addReferenceType(Klass kk) {
    if (typesByID == null) {
        initReferenceTypes();
    }
    ReferenceTypeImpl newRefType = null;
    if (kk instanceof ObjArrayKlass || kk instanceof TypeArrayKlass) {
        newRefType = new ArrayTypeImpl(this, (ArrayKlass)kk);
    } else if (kk instanceof InstanceKlass) {
        if (kk.isInterface()) {
            newRefType = new InterfaceTypeImpl(this, (InstanceKlass)kk);
        } else {
            newRefType = new ClassTypeImpl(this, (InstanceKlass)kk);
        }
    } else {
        throw new RuntimeException("should not reach here:" + kk);
    }

    typesByID.put(kk, newRefType);
    typesBySignature.add(newRefType);
    return newRefType;
}
 
Example #15
Source File: ArrayTypeImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public Type componentType() throws ClassNotLoadedException {
    ArrayKlass k = (ArrayKlass) ref();
    if (k instanceof ObjArrayKlass) {
        Klass elementKlass = ((ObjArrayKlass)k).getElementKlass();
        if (elementKlass == null) {
            throw new ClassNotLoadedException(componentSignature());
        } else {
            return vm.referenceType(elementKlass);
        }
    } else {
        // It's a primitive type
        return vm.primitiveTypeMirror(signature().charAt(1));
    }
}
 
Example #16
Source File: ClassStats.java    From vjtools with Apache License 2.0 5 votes vote down vote up
public String initDescription() {
	Klass k = klass;
	if (k instanceof InstanceKlass)
		return k.getName().asString().replace('/', '.');

	if (k instanceof ArrayKlass) {
		ArrayKlass ak = (ArrayKlass) k;
		if (k instanceof TypeArrayKlass) {
			TypeArrayKlass tak = (TypeArrayKlass) ak;
			return tak.getElementTypeName() + "[]";
		}

		if (k instanceof ObjArrayKlass) {
			ObjArrayKlass oak = (ObjArrayKlass) ak;
			// 兼容JDK8
			// if (oak.equals(VM.getVM().getUniverse().systemObjArrayKlassObj())) {
			// return "* System ObjArray";
			// }
			Klass bottom = oak.getBottomKlass();
			StringBuilder buf = new StringBuilder(32);
			if (bottom instanceof TypeArrayKlass) {
				buf.append(((TypeArrayKlass) bottom).getElementTypeName());
			} else if (bottom instanceof InstanceKlass) {
				buf.append(bottom.getName().asString().replace('/', '.'));
			} else {
				throw new RuntimeException("should not reach here");
			}

			int dim = (int) oak.getDimension();
			for (int i = 0; i < dim; i++) {
				buf.append("[]");
			}
			return buf.toString();
		}
	}

	return getInternalName(k);
}
 
Example #17
Source File: ArrayTypeImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public Type componentType() throws ClassNotLoadedException {
    ArrayKlass k = (ArrayKlass) ref();
    if (k instanceof ObjArrayKlass) {
        Klass elementKlass = ((ObjArrayKlass)k).getElementKlass();
        if (elementKlass == null) {
            throw new ClassNotLoadedException(componentSignature());
        } else {
            return vm.referenceType(elementKlass);
        }
    } else {
        // It's a primitive type
        return vm.primitiveTypeMirror(signature().charAt(1));
    }
}
 
Example #18
Source File: ClassStats.java    From vjtools with Apache License 2.0 5 votes vote down vote up
/**
 * 参考 JDK8 sun.jvm.hotspot.oops.ObjectHistogramElement
 * 
 * StringBuffer->StringBuilder
 */
public String initDescription() {
	Klass k = klass;
	if (k instanceof InstanceKlass) {
		return k.getName().asString().replace('/', '.');
	} else if (k instanceof ArrayKlass) {
		ArrayKlass ak = (ArrayKlass) k;
		if (k instanceof TypeArrayKlass) {
			TypeArrayKlass tak = (TypeArrayKlass) ak;
			return tak.getElementTypeName() + "[]";
		} else if (k instanceof ObjArrayKlass) {
			ObjArrayKlass oak = (ObjArrayKlass) ak;
			Klass bottom = oak.getBottomKlass();
			int dim = (int) oak.getDimension();
			StringBuilder buf = new StringBuilder(64);
			if (bottom instanceof TypeArrayKlass) {
				buf.append(((TypeArrayKlass) bottom).getElementTypeName());
			} else if (bottom instanceof InstanceKlass) {
				buf.append(bottom.getName().asString().replace('/', '.'));
			} else {
				throw new RuntimeException("should not reach here");
			}
			for (int i = 0; i < dim; i++) {
				buf.append("[]");
			}
			return buf.toString();
		}
	}
	return getInternalName(k);
}
 
Example #19
Source File: ArrayTypeImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public Type componentType() throws ClassNotLoadedException {
    ArrayKlass k = (ArrayKlass) ref();
    if (k instanceof ObjArrayKlass) {
        Klass elementKlass = ((ObjArrayKlass)k).getElementKlass();
        if (elementKlass == null) {
            throw new ClassNotLoadedException(componentSignature());
        } else {
            return vm.referenceType(elementKlass);
        }
    } else {
        // It's a primitive type
        return vm.primitiveTypeMirror(signature().charAt(1));
    }
}
 
Example #20
Source File: ArrayTypeImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public Type componentType() throws ClassNotLoadedException {
    ArrayKlass k = (ArrayKlass) ref();
    if (k instanceof ObjArrayKlass) {
        Klass elementKlass = ((ObjArrayKlass)k).getElementKlass();
        if (elementKlass == null) {
            throw new ClassNotLoadedException(componentSignature());
        } else {
            return vm.referenceType(elementKlass);
        }
    } else {
        // It's a primitive type
        return vm.primitiveTypeMirror(signature().charAt(1));
    }
}
 
Example #21
Source File: ArrayTypeImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public Type componentType() throws ClassNotLoadedException {
    ArrayKlass k = (ArrayKlass) ref();
    if (k instanceof ObjArrayKlass) {
        Klass elementKlass = ((ObjArrayKlass)k).getElementKlass();
        if (elementKlass == null) {
            throw new ClassNotLoadedException(componentSignature());
        } else {
            return vm.referenceType(elementKlass);
        }
    } else {
        // It's a primitive type
        return vm.primitiveTypeMirror(signature().charAt(1));
    }
}
 
Example #22
Source File: ArrayTypeImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public Type componentType() throws ClassNotLoadedException {
    ArrayKlass k = (ArrayKlass) ref();
    if (k instanceof ObjArrayKlass) {
        Klass elementKlass = ((ObjArrayKlass)k).getElementKlass();
        if (elementKlass == null) {
            throw new ClassNotLoadedException(componentSignature());
        } else {
            return vm.referenceType(elementKlass);
        }
    } else {
        // It's a primitive type
        return vm.primitiveTypeMirror(signature().charAt(1));
    }
}
 
Example #23
Source File: ArrayTypeImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public Type componentType() throws ClassNotLoadedException {
    ArrayKlass k = (ArrayKlass) ref();
    if (k instanceof ObjArrayKlass) {
        Klass elementKlass = ((ObjArrayKlass)k).getElementKlass();
        if (elementKlass == null) {
            throw new ClassNotLoadedException(componentSignature());
        } else {
            return vm.referenceType(elementKlass);
        }
    } else {
        // It's a primitive type
        return vm.primitiveTypeMirror(signature().charAt(1));
    }
}