sun.jvm.hotspot.oops.Klass Java Examples
The following examples show how to use
sun.jvm.hotspot.oops.Klass.
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: CommandProcessor.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
public void doit(Tokens t) { if (t.countTokens() != 0) { usage(); } else { SystemDictionary sysDict = VM.getVM().getSystemDictionary(); sysDict.allClassesDo(new SystemDictionary.ClassVisitor() { public void visit(Klass k) { if (k instanceof InstanceKlass && ((InstanceKlass)k).getConstants().getCache() != null) { MethodArray methods = ((InstanceKlass)k).getMethods(); for (int i = 0; i < methods.length(); i++) { Method m = methods.at(i); HTMLGenerator gen = new HTMLGenerator(false); out.println(gen.genHTML(m)); } } } } ); } }
Example #2
Source File: VirtualMachineImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
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 #3
Source File: VirtualMachineImpl.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
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: ReferenceTypeImpl.java From hottub with GNU General Public License v2.0 | 6 votes |
public int compareTo(ReferenceType refType) { /* * Note that it is critical that compareTo() == 0 * implies that equals() == true. Otherwise, TreeSet * will collapse classes. * * (Classes of the same name loaded by different class loaders * or in different VMs must not return 0). */ ReferenceTypeImpl other = (ReferenceTypeImpl)refType; int comp = name().compareTo(other.name()); if (comp == 0) { Klass rf1 = ref(); Klass rf2 = other.ref(); // optimize for typical case: refs equal and VMs equal if (rf1.equals(rf2)) { // sequenceNumbers are always positive comp = vm.sequenceNumber - ((VirtualMachineImpl)(other.virtualMachine())).sequenceNumber; } else { comp = rf1.getAddress().minus(rf2.getAddress()) < 0? -1 : 1; } } return comp; }
Example #5
Source File: ArrayTypeImpl.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
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: VirtualMachineImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
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 #7
Source File: ArrayTypeImpl.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
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 #8
Source File: CommandProcessor.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public void doit(Tokens t) { if (t.countTokens() != 0) { usage(); } else { SystemDictionary sysDict = VM.getVM().getSystemDictionary(); sysDict.allClassesDo(new SystemDictionary.ClassVisitor() { public void visit(Klass k) { if (k instanceof InstanceKlass && ((InstanceKlass)k).getConstants().getCache() != null) { MethodArray methods = ((InstanceKlass)k).getMethods(); for (int i = 0; i < methods.length(); i++) { Method m = methods.at(i); HTMLGenerator gen = new HTMLGenerator(false); out.println(gen.genHTML(m)); } } } } ); } }
Example #9
Source File: ReferenceTypeImpl.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public int compareTo(ReferenceType refType) { /* * Note that it is critical that compareTo() == 0 * implies that equals() == true. Otherwise, TreeSet * will collapse classes. * * (Classes of the same name loaded by different class loaders * or in different VMs must not return 0). */ ReferenceTypeImpl other = (ReferenceTypeImpl)refType; int comp = name().compareTo(other.name()); if (comp == 0) { Klass rf1 = ref(); Klass rf2 = other.ref(); // optimize for typical case: refs equal and VMs equal if (rf1.equals(rf2)) { // sequenceNumbers are always positive comp = vm.sequenceNumber - ((VirtualMachineImpl)(other.virtualMachine())).sequenceNumber; } else { comp = rf1.getAddress().minus(rf2.getAddress()) < 0? -1 : 1; } } return comp; }
Example #10
Source File: CommandProcessor.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
public void doit(Tokens t) { if (t.countTokens() != 0) { usage(); } else { SystemDictionary sysDict = VM.getVM().getSystemDictionary(); sysDict.allClassesDo(new SystemDictionary.ClassVisitor() { public void visit(Klass k) { if (k instanceof InstanceKlass && ((InstanceKlass)k).getConstants().getCache() != null) { MethodArray methods = ((InstanceKlass)k).getMethods(); for (int i = 0; i < methods.length(); i++) { Method m = methods.at(i); HTMLGenerator gen = new HTMLGenerator(false); out.println(gen.genHTML(m)); } } } } ); } }
Example #11
Source File: CommandProcessor.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public void doit(Tokens t) { if (t.countTokens() != 0) { usage(); } else { SystemDictionary sysDict = VM.getVM().getSystemDictionary(); sysDict.allClassesDo(new SystemDictionary.ClassVisitor() { public void visit(Klass k) { if (k instanceof InstanceKlass && ((InstanceKlass)k).getConstants().getCache() != null) { MethodArray methods = ((InstanceKlass)k).getMethods(); for (int i = 0; i < methods.length(); i++) { Method m = methods.at(i); HTMLGenerator gen = new HTMLGenerator(false); out.println(gen.genHTML(m)); } } } } ); } }
Example #12
Source File: VirtualMachineImpl.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
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 #13
Source File: ArrayTypeImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
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 #14
Source File: HeapHistogramVisitor.java From vjtools with Apache License 2.0 | 6 votes |
@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 #15
Source File: ReferenceTypeImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public int compareTo(ReferenceType refType) { /* * Note that it is critical that compareTo() == 0 * implies that equals() == true. Otherwise, TreeSet * will collapse classes. * * (Classes of the same name loaded by different class loaders * or in different VMs must not return 0). */ ReferenceTypeImpl other = (ReferenceTypeImpl)refType; int comp = name().compareTo(other.name()); if (comp == 0) { Klass rf1 = ref(); Klass rf2 = other.ref(); // optimize for typical case: refs equal and VMs equal if (rf1.equals(rf2)) { // sequenceNumbers are always positive comp = vm.sequenceNumber - ((VirtualMachineImpl)(other.virtualMachine())).sequenceNumber; } else { comp = rf1.getAddress().minus(rf2.getAddress()) < 0? -1 : 1; } } return comp; }
Example #16
Source File: VirtualMachineImpl.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
ReferenceTypeImpl referenceType(Klass kk) { ReferenceTypeImpl retType = null; synchronized (this) { if (typesByID != null) { retType = (ReferenceTypeImpl)typesByID.get(kk); } if (retType == null) { retType = addReferenceType(kk); } } return retType; }
Example #17
Source File: ArrayTypeImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
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: ReferenceTypeImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
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 #19
Source File: ReferenceTypeImpl.java From hottub with GNU General Public License v2.0 | 5 votes |
protected ReferenceTypeImpl(VirtualMachine aVm, sun.jvm.hotspot.oops.Klass klass) { super(aVm); saKlass = klass; typeNameSymbol = saKlass.getName(); if (Assert.ASSERTS_ENABLED) { Assert.that(typeNameSymbol != null, "null type name for a Klass"); } }
Example #20
Source File: CommandProcessor.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
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 #21
Source File: ReferenceTypeImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
protected ReferenceTypeImpl(VirtualMachine aVm, sun.jvm.hotspot.oops.Klass klass) { super(aVm); saKlass = klass; typeNameSymbol = saKlass.getName(); if (Assert.ASSERTS_ENABLED) { Assert.that(typeNameSymbol != null, "null type name for a Klass"); } }
Example #22
Source File: HeapUtils.java From vjtools with Apache License 2.0 | 5 votes |
public static ClassStats getClassStats(Klass klass, HashMap<Klass, ClassStats> classStatsMap) { ClassStats stats = classStatsMap.get(klass); if (stats == null) { stats = new ClassStats(klass); classStatsMap.put(klass, stats); } return stats; }
Example #23
Source File: ClassStats.java From vjtools with Apache License 2.0 | 5 votes |
/** * 参考 sun.jvm.hotspot.oops.ObjectHistogramElement */ private String getInternalName(Klass k) { ByteArrayOutputStream bos = new ByteArrayOutputStream(); klass.printValueOn(new PrintStream(bos)); // '*' is used to denote VM internal klasses. return "* " + bos.toString(); }
Example #24
Source File: ReferenceTypeImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
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: CommandProcessor.java From hottub with GNU General Public License v2.0 | 5 votes |
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 #26
Source File: CommandProcessor.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
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 #27
Source File: HeapUtils.java From vjtools with Apache License 2.0 | 5 votes |
public static ClassStats getClassStats(Klass klass, HashMap<Klass, ClassStats> classStatsMap) { ClassStats stats = classStatsMap.get(klass); if (stats == null) { stats = new ClassStats(klass); classStatsMap.put(klass, stats); } return stats; }
Example #28
Source File: ArrayTypeImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
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 #29
Source File: ReferenceTypeImpl.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
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: CommandProcessor.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
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"); } }