本文整理汇总了Java中sun.jvm.hotspot.memory.SystemDictionary类的典型用法代码示例。如果您正苦于以下问题:Java SystemDictionary类的具体用法?Java SystemDictionary怎么用?Java SystemDictionary使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SystemDictionary类属于sun.jvm.hotspot.memory包,在下文中一共展示了SystemDictionary类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doit
import sun.jvm.hotspot.memory.SystemDictionary; //导入依赖的package包/类
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));
}
}
}
}
);
}
}
示例2: writeClassDumpRecords
import sun.jvm.hotspot.memory.SystemDictionary; //导入依赖的package包/类
private void writeClassDumpRecords() throws IOException {
SystemDictionary sysDict = VM.getVM().getSystemDictionary();
try {
sysDict.allClassesDo(new SystemDictionary.ClassVisitor() {
public void visit(Klass k) {
try {
writeHeapRecordPrologue();
writeClassDumpRecord(k);
writeHeapRecordEpilogue();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
});
} catch (RuntimeException re) {
handleRuntimeException(re);
}
}
示例3: run
import sun.jvm.hotspot.memory.SystemDictionary; //导入依赖的package包/类
@Override
public void run() {
SystemDictionary dictionary = VM.getVM().getSystemDictionary();
Klass klass = dictionary.find("java/security/PrivateKey", null, null);
VM.getVM().getObjectHeap().iterateObjectsOfKlass(new DefaultHeapVisitor() {
@Override
public boolean doObj(Oop oop) {
oop.iterate(new KeyPrinter(), false);
return false;
}
}, klass);
}
示例4: getSystemDictionary
import sun.jvm.hotspot.memory.SystemDictionary; //导入依赖的package包/类
private SystemDictionary getSystemDictionary() {
return vm.saSystemDictionary();
}
示例5: saSystemDictionary
import sun.jvm.hotspot.memory.SystemDictionary; //导入依赖的package包/类
SystemDictionary saSystemDictionary() {
return saSystemDictionary;
}
示例6: retrieveAllClasses
import sun.jvm.hotspot.memory.SystemDictionary; //导入依赖的package包/类
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;
}
}
}
示例7: writeClasses
import sun.jvm.hotspot.memory.SystemDictionary; //导入依赖的package包/类
private void writeClasses() throws IOException {
final Set klasses = new HashSet();
// write class list (id, name) association
SystemDictionary sysDict = VM.getVM().getSystemDictionary();
try {
sysDict.allClassesDo(new SystemDictionary.ClassVisitor() {
public void visit(Klass k) {
try {
klasses.add(k.getAddress());
writeClassLoadRecord(k);
} catch (IOException exp) {
throw new RuntimeException(exp);
}
}
});
} catch (RuntimeException re) {
handleRuntimeException(re);
}
final Symbol javaLangClass = symTbl.probe("java/lang/Class");
System.out.println("Dumping lambda classes");
objectHeap.iterate(new DefaultHeapVisitor() {
@Override
public boolean doObj(Oop oop) {
if (oop instanceof Instance) {
Instance instance = (Instance)oop;
Klass klass = instance.getKlass();
Symbol name = klass.getName();
if (name.equals(javaLangClass)) {
try {
Klass reflectedKlass = objectHeap.getKlassForClass(instance);
if (reflectedKlass != null && !klasses.contains(reflectedKlass.getAddress())) {
klasses.add(reflectedKlass.getAddress());
writeClassLoadRecord(reflectedKlass);
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
return false;
}
});
System.out.println("Done dumping lambda classes");
}