本文整理汇总了Java中sun.jvm.hotspot.oops.Klass类的典型用法代码示例。如果您正苦于以下问题:Java Klass类的具体用法?Java Klass怎么用?Java Klass使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Klass类属于sun.jvm.hotspot.oops包,在下文中一共展示了Klass类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: componentType
import sun.jvm.hotspot.oops.Klass; //导入依赖的package包/类
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));
}
}
开发者ID:infobip,项目名称:infobip-open-jdk-8,代码行数:15,代码来源:ArrayTypeImpl.java
示例2: doit
import sun.jvm.hotspot.oops.Klass; //导入依赖的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));
}
}
}
}
);
}
}
开发者ID:arodchen,项目名称:MaxSim,代码行数:21,代码来源:CommandProcessor.java
示例3: compareTo
import sun.jvm.hotspot.oops.Klass; //导入依赖的package包/类
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;
}
开发者ID:arodchen,项目名称:MaxSim,代码行数:26,代码来源:ReferenceTypeImpl.java
示例4: reflectedType
import sun.jvm.hotspot.oops.Klass; //导入依赖的package包/类
public ReferenceType reflectedType() {
if (reflectedType == null) {
Klass k = java_lang_Class.asKlass(ref());
reflectedType = vm.referenceType(k);
}
return reflectedType;
}
开发者ID:arodchen,项目名称:MaxSim,代码行数:8,代码来源:ClassObjectReferenceImpl.java
示例5: addReferenceType
import sun.jvm.hotspot.oops.Klass; //导入依赖的package包/类
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;
}
开发者ID:arodchen,项目名称:MaxSim,代码行数:22,代码来源:VirtualMachineImpl.java
示例6: classLoader
import sun.jvm.hotspot.oops.Klass; //导入依赖的package包/类
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);
}
}
}
开发者ID:arodchen,项目名称:MaxSim,代码行数:18,代码来源:ArrayTypeImpl.java
示例7: doit
import sun.jvm.hotspot.oops.Klass; //导入依赖的package包/类
public void doit(Tokens t) {
if (t.countTokens() != 0) {
usage();
} else {
ClassLoaderDataGraph cldg = VM.getVM().getClassLoaderDataGraph();
cldg.classesDo(new ClassLoaderDataGraph.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));
}
}
}
}
);
}
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:CommandProcessor.java
示例8: writeClassDumpRecords
import sun.jvm.hotspot.oops.Klass; //导入依赖的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);
}
}
开发者ID:geoff-addepar,项目名称:heap-dump,代码行数:19,代码来源:HeapHprofBinWriter.java
示例9: getKlassAtAddress
import sun.jvm.hotspot.oops.Klass; //导入依赖的package包/类
public Klass getKlassAtAddress(Address klassAddress) {
int layoutHelper = klassAddress.getJIntAt(klassLayoutHelper.getOffset());
int tag = layoutHelper >> Klass.LH_ARRAY_TAG_SHIFT;
if (tag == Klass.LH_ARRAY_TAG_OBJ_VALUE) {
// object array
Klass bottomKlass = getKlassAtAddress(objArrayBottomKlass.getValue(klassAddress));
return new FastObjArrayKlass(klassAddress, bottomKlass);
} else if (tag == Klass.LH_ARRAY_TAG_TYPE_VALUE) {
// primitive array
return new TypeArrayKlass(klassAddress);
} else {
Symbol name = Symbol.create(klassAddress.getAddressAt(klassName.getOffset()));
if (javaLangClass.equals(name)) {
// java.lang.Class
return new FastInstanceMirrorKlass(klassAddress);
} else {
// any other non-array class
return new FastInstanceKlass(klassAddress);
}
}
}
开发者ID:geoff-addepar,项目名称:heap-dump,代码行数:23,代码来源:FastObjectHeap.java
示例10: addReferenceType
import sun.jvm.hotspot.oops.Klass; //导入依赖的package包/类
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");
}
typesByID.put(kk, newRefType);
typesBySignature.add(newRefType);
return newRefType;
}
开发者ID:aducode,项目名称:openjdk-source-code-learn,代码行数:22,代码来源:VirtualMachineImpl.java
示例11: run
import sun.jvm.hotspot.oops.Klass; //导入依赖的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);
}
开发者ID:odnoklassniki,项目名称:stack-traces-heap-dumps,代码行数:14,代码来源:KeyScanner.java
示例12: printOopValue
import sun.jvm.hotspot.oops.Klass; //导入依赖的package包/类
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");
}
}
开发者ID:arodchen,项目名称:MaxSim,代码行数:15,代码来源:CommandProcessor.java
示例13: ReferenceTypeImpl
import sun.jvm.hotspot.oops.Klass; //导入依赖的package包/类
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");
}
}
开发者ID:arodchen,项目名称:MaxSim,代码行数:9,代码来源:ReferenceTypeImpl.java
示例14: instances
import sun.jvm.hotspot.oops.Klass; //导入依赖的package包/类
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;
}
开发者ID:arodchen,项目名称:MaxSim,代码行数:34,代码来源:ReferenceTypeImpl.java
示例15: referenceType
import sun.jvm.hotspot.oops.Klass; //导入依赖的package包/类
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;
}
开发者ID:arodchen,项目名称:MaxSim,代码行数:13,代码来源:VirtualMachineImpl.java
示例16: objectsByExactType
import sun.jvm.hotspot.oops.Klass; //导入依赖的package包/类
private List/*<ObjectReference>*/ objectsByExactType(ReferenceType type) {
final List objects = new ArrayList(0);
final Klass givenKls = ((ReferenceTypeImpl)type).ref();
saObjectHeap.iterate(new DefaultHeapVisitor() {
public boolean doObj(Oop oop) {
if (givenKls.equals(oop.getKlass())) {
objects.add(objectMirror(oop));
}
return false;
}
});
return objects;
}
开发者ID:arodchen,项目名称:MaxSim,代码行数:14,代码来源:VirtualMachineImpl.java
示例17: objectsByType
import sun.jvm.hotspot.oops.Klass; //导入依赖的package包/类
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);
}
}
开发者ID:arodchen,项目名称:MaxSim,代码行数:28,代码来源:VirtualMachineImpl.java
注:本文中的sun.jvm.hotspot.oops.Klass类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论