本文整理汇总了Java中sun.jvm.hotspot.debugger.OopHandle.getCompKlassAddressAt方法的典型用法代码示例。如果您正苦于以下问题:Java OopHandle.getCompKlassAddressAt方法的具体用法?Java OopHandle.getCompKlassAddressAt怎么用?Java OopHandle.getCompKlassAddressAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sun.jvm.hotspot.debugger.OopHandle
的用法示例。
在下文中一共展示了OopHandle.getCompKlassAddressAt方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isInternalKlassPointer
import sun.jvm.hotspot.debugger.OopHandle; //导入方法依赖的package包/类
private boolean isInternalKlassPointer(Address address, Address bottom, long offset) {
OopHandle classOop = address.addOffsetToAsOopHandle(-offset);
if (VM.getVM().isCompressedKlassPointersEnabled()) {
classOop = classOop.addOffsetToAsOopHandle(oopCompressedKlass.getOffset());
} else {
classOop = classOop.addOffsetToAsOopHandle(oopKlass.getOffset());
}
if (classOop.greaterThanOrEqual(bottom)) {
Address classKlass;
if (VM.getVM().isCompressedKlassPointersEnabled()) {
classKlass = classOop.getCompKlassAddressAt(oopCompressedKlass.getOffset());
} else {
classKlass = classOop.getAddressAt(oopKlass.getOffset());
}
if (classKlass == null) {
return false;
}
try {
Address vtbl = classKlass.getAddressAt(0);
return instanceMirrorKlassVtbl.equals(vtbl);
} catch (UnmappedAddressException e) {
return false;
}
}
return false;
}
示例2: newOop
import sun.jvm.hotspot.debugger.OopHandle; //导入方法依赖的package包/类
@Override
public Oop newOop(OopHandle handle) {
if (handle == null) {
return null;
}
Address klassAddress;
if (VM.getVM().isCompressedKlassPointersEnabled()) {
klassAddress = handle.getCompKlassAddressAt(oopCompressedKlass.getOffset());
} else {
klassAddress = handle.getAddressAt(oopKlass.getOffset());
}
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 FastObjArray(handle, this, new FastObjArrayKlass(klassAddress, bottomKlass));
} else if (tag == Klass.LH_ARRAY_TAG_TYPE_VALUE) {
// primitive array
return new FastTypeArray(handle, this, new TypeArrayKlass(klassAddress));
} else {
Symbol name = Symbol.create(klassAddress.getAddressAt(klassName.getOffset()));
if (javaLangClass.equals(name)) {
// instance of java.lang.Class, which has special handling for static members
return new FastInstance(handle, this, new FastInstanceMirrorKlass(klassAddress));
} else {
// instance of anything else. we don't handle InstanceRefKlass or InstanceClassLoaderKlass
// because they contain no extra logic
return new FastInstance(handle, this, new FastInstanceKlass(klassAddress));
}
}
}
示例3: newOopIfPossible
import sun.jvm.hotspot.debugger.OopHandle; //导入方法依赖的package包/类
public Oop newOopIfPossible(OopHandle handle, Address bottom) {
if (handle == null) {
return null;
}
Address klassAddress;
if (VM.getVM().isCompressedKlassPointersEnabled()) {
klassAddress = handle.getCompKlassAddressAt(oopCompressedKlass.getOffset());
} else {
klassAddress = handle.getAddressAt(oopKlass.getOffset());
}
if (klassAddress == null) {
return null;
}
// Validate that the address actually points at a Klass
try {
Address vtbl = klassAddress.getAddressAt(0);
if (!klassVtbls.contains(vtbl)) {
return null;
}
} catch (UnmappedAddressException e) {
return null;
}
// Check if we hit the Class.klass or Class.array_klass fields
if (isInternalKlassPointer(handle, bottom, oopKlassOffset) ||
isInternalKlassPointer(handle, bottom, oopArrayKlassOffset)) {
return null;
}
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 FastObjArray(handle, this, new FastObjArrayKlass(klassAddress, bottomKlass));
} else if (tag == Klass.LH_ARRAY_TAG_TYPE_VALUE) {
// primitive array
return new FastTypeArray(handle, this, new TypeArrayKlass(klassAddress));
} else {
Symbol name = Symbol.create(klassAddress.getAddressAt(klassName.getOffset()));
if (javaLangClass.equals(name)) {
// instance of java.lang.Class, which has special handling for static members
return new FastInstance(handle, this, new FastInstanceMirrorKlass(klassAddress));
} else {
// instance of anything else. we don't handle InstanceRefKlass or InstanceClassLoaderKlass
// because they contain no extra logic
return new FastInstance(handle, this, new FastInstanceKlass(klassAddress));
}
}
}