sun.jvm.hotspot.oops.InstanceKlass Java Examples
The following examples show how to use
sun.jvm.hotspot.oops.InstanceKlass.
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: TestInstanceKlassSize.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private static void SAInstanceKlassSize(int pid, String[] SAInstanceKlassNames) { HotSpotAgent agent = new HotSpotAgent(); try { agent.attach(pid); } catch (DebuggerException e) { System.out.println(e.getMessage()); System.err.println("Unable to connect to process ID: " + pid); agent.detach(); e.printStackTrace(); } for (String SAInstanceKlassName : SAInstanceKlassNames) { InstanceKlass ik = SystemDictionaryHelper.findInstanceKlass( SAInstanceKlassName); Asserts.assertNotNull(ik, String.format("Unable to find instance klass for %s", ik)); System.out.println("SA: The size of " + SAInstanceKlassName + " is " + ik.getSize()); } agent.detach(); }
Example #2
Source File: ReferenceTypeImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
List getInterfaces() { List myInterfaces; if (saKlass instanceof ArrayKlass) { // Actually, JLS says arrays implement Cloneable and Serializable // But, JVMDI-JDI just returns 0 interfaces for arrays. We follow // the same for consistency. myInterfaces = new ArrayList(0); } else { // Get a list of the sa InstanceKlass types List saInterfaces = ((InstanceKlass)saKlass).getDirectImplementedInterfaces(); // Create a list of our InterfaceTypes int len = saInterfaces.size(); myInterfaces = new ArrayList(len); for (int ii = 0; ii < len; ii++) { myInterfaces.add(new InterfaceTypeImpl(vm, (InstanceKlass)saInterfaces.get(ii))); } } return myInterfaces; }
Example #3
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 #4
Source File: ReferenceTypeImpl.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
List getInterfaces() { List myInterfaces; if (saKlass instanceof ArrayKlass) { // Actually, JLS says arrays implement Cloneable and Serializable // But, JVMDI-JDI just returns 0 interfaces for arrays. We follow // the same for consistency. myInterfaces = new ArrayList(0); } else { // Get a list of the sa InstanceKlass types List saInterfaces = ((InstanceKlass)saKlass).getDirectImplementedInterfaces(); // Create a list of our InterfaceTypes int len = saInterfaces.size(); myInterfaces = new ArrayList(len); for (int ii = 0; ii < len; ii++) { myInterfaces.add(new InterfaceTypeImpl(vm, (InstanceKlass)saInterfaces.get(ii))); } } return myInterfaces; }
Example #5
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 #6
Source File: ArrayTypeImpl.java From hottub 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 #7
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 #8
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 #9
Source File: CommandProcessor.java From openjdk-jdk8u-backup 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 #10
Source File: ArrayTypeImpl.java From openjdk-8-source 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 #11
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 #12
Source File: ReferenceTypeImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
List getInterfaces() { List myInterfaces; if (saKlass instanceof ArrayKlass) { // Actually, JLS says arrays implement Cloneable and Serializable // But, JVMDI-JDI just returns 0 interfaces for arrays. We follow // the same for consistency. myInterfaces = new ArrayList(0); } else { // Get a list of the sa InstanceKlass types List saInterfaces = ((InstanceKlass)saKlass).getDirectImplementedInterfaces(); // Create a list of our InterfaceTypes int len = saInterfaces.size(); myInterfaces = new ArrayList(len); for (int ii = 0; ii < len; ii++) { myInterfaces.add(new InterfaceTypeImpl(vm, (InstanceKlass)saInterfaces.get(ii))); } } return myInterfaces; }
Example #13
Source File: VirtualMachineImpl.java From TencentKona-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 #14
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 #15
Source File: ArrayTypeImpl.java From jdk8u60 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 #16
Source File: CommandProcessor.java From hottub 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 #17
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 #18
Source File: ReferenceTypeImpl.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
List getInterfaces() { List myInterfaces; if (saKlass instanceof ArrayKlass) { // Actually, JLS says arrays implement Cloneable and Serializable // But, JVMDI-JDI just returns 0 interfaces for arrays. We follow // the same for consistency. myInterfaces = new ArrayList(0); } else { // Get a list of the sa InstanceKlass types List saInterfaces = ((InstanceKlass)saKlass).getDirectImplementedInterfaces(); // Create a list of our InterfaceTypes int len = saInterfaces.size(); myInterfaces = new ArrayList(len); for (int ii = 0; ii < len; ii++) { myInterfaces.add(new InterfaceTypeImpl(vm, (InstanceKlass)saInterfaces.get(ii))); } } return myInterfaces; }
Example #19
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 #20
Source File: TestInstanceKlassSizeForInterface.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private static void SAInstanceKlassSize(int lingeredAppPid, String[] instanceKlassNames) { HotSpotAgent agent = new HotSpotAgent(); try { agent.attach(lingeredAppPid); } catch (DebuggerException e) { System.out.println(e.getMessage()); System.err.println("Unable to connect to process ID: " + lingeredAppPid); agent.detach(); e.printStackTrace(); } for (String instanceKlassName : instanceKlassNames) { InstanceKlass iKlass = SystemDictionaryHelper.findInstanceKlass( instanceKlassName); Asserts.assertNotNull(iKlass, String.format("Unable to find instance klass for %s", instanceKlassName)); System.out.println("SA: The size of " + instanceKlassName + " is " + iKlass.getSize()); } agent.detach(); }
Example #21
Source File: CommandProcessor.java From TencentKona-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 #22
Source File: ReferenceTypeImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public String genericSignature() { if (saKlass instanceof ArrayKlass) { return null; } else { Symbol genSig = ((InstanceKlass)saKlass).getGenericSignature(); return (genSig != null)? genSig.asString() : null; } }
Example #23
Source File: VirtualMachineImpl.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public List/*<ObjectReference>*/ objectsByType(ReferenceType type, boolean includeSubtypes) { Klass kls = ((ReferenceTypeImpl)type).ref(); if (kls instanceof InstanceKlass) { InstanceKlass ik = (InstanceKlass) kls; // if the Klass is final or if there are no subklasses loaded yet if (ik.getAccessFlagsObj().isFinal() || ik.getSubklassKlass() == null) { includeSubtypes = false; } } else { // no subtypes for primitive array types ArrayTypeImpl arrayType = (ArrayTypeImpl) type; try { Type componentType = arrayType.componentType(); if (componentType instanceof PrimitiveType) { includeSubtypes = false; } } catch (ClassNotLoadedException cnle) { // ignore. component type not yet loaded } } if (includeSubtypes) { return objectsBySubType(type); } else { return objectsByExactType(type); } }
Example #24
Source File: ReferenceTypeImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
String baseSourceName() throws AbsentInformationException { if (saKlass instanceof ArrayKlass) { throw new AbsentInformationException(); } Symbol sym = ((InstanceKlass)saKlass).getSourceFileName(); if (sym != null) { return sym.asString(); } else { throw new AbsentInformationException(); } }
Example #25
Source File: ReferenceTypeImpl.java From hottub with GNU General Public License v2.0 | 5 votes |
String baseSourceName() throws AbsentInformationException { if (saKlass instanceof ArrayKlass) { throw new AbsentInformationException(); } Symbol sym = ((InstanceKlass)saKlass).getSourceFileName(); if (sym != null) { return sym.asString(); } else { throw new AbsentInformationException(); } }
Example #26
Source File: ReferenceTypeImpl.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
String baseSourceName() throws AbsentInformationException { if (saKlass instanceof ArrayKlass) { throw new AbsentInformationException(); } Symbol sym = ((InstanceKlass)saKlass).getSourceFileName(); if (sym != null) { return sym.asString(); } else { throw new AbsentInformationException(); } }
Example #27
Source File: ReferenceTypeImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public String genericSignature() { if (saKlass instanceof ArrayKlass) { return null; } else { Symbol genSig = ((InstanceKlass)saKlass).getGenericSignature(); return (genSig != null)? genSig.asString() : null; } }
Example #28
Source File: CommandProcessor.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public boolean canInclude(InstanceKlass kls) { if (kls.getClassLoader() == null) return false; if (emitted.get(kls.getName()) != null) { // Since multiple class loaders are being shoved // together duplicate classes are a possibilty. For // now just ignore them. return false; } emitted.put(kls.getName(), kls); return true; }
Example #29
Source File: CommandProcessor.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public boolean canInclude(InstanceKlass kls) { if (kls.getClassLoader() == null) return false; if (emitted.get(kls.getName()) != null) { // Since multiple class loaders are being shoved // together duplicate classes are a possibilty. For // now just ignore them. return false; } emitted.put(kls.getName(), kls); return true; }
Example #30
Source File: ReferenceTypeImpl.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public String genericSignature() { if (saKlass instanceof ArrayKlass) { return null; } else { Symbol genSig = ((InstanceKlass)saKlass).getGenericSignature(); return (genSig != null)? genSig.asString() : null; } }