本文整理汇总了Java中sun.jvm.hotspot.debugger.OopHandle类的典型用法代码示例。如果您正苦于以下问题:Java OopHandle类的具体用法?Java OopHandle怎么用?Java OopHandle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OopHandle类属于sun.jvm.hotspot.debugger包,在下文中一共展示了OopHandle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: thisObject
import sun.jvm.hotspot.debugger.OopHandle; //导入依赖的package包/类
public ObjectReference thisObject() {
validateStackFrame();
MethodImpl currentMethod = (MethodImpl)location.method();
if (currentMethod.isStatic() || currentMethod.isNative()) {
return null;
}
if (thisObject == null) {
StackValueCollection values = saFrame.getLocals();
if (Assert.ASSERTS_ENABLED) {
Assert.that(values.size() > 0, "this is missing");
}
// 'this' at index 0.
if (values.get(0).getType() == BasicType.getTConflict()) {
return null;
}
OopHandle handle = values.oopHandleAt(0);
ObjectHeap heap = vm.saObjectHeap();
thisObject = vm.objectMirror(heap.newOop(handle));
}
return thisObject;
}
示例2: probeForObject
import sun.jvm.hotspot.debugger.OopHandle; //导入依赖的package包/类
/**
* Walk backwards to find the start of the object at probeAddress, but don't walk past the bottom
* of the live region.
*/
private Oop probeForObject(Address probeAddress, Address bottom) {
OopHandle cur = probeAddress.andWithMask(~(heapWordSize - 1)).addOffsetToAsOopHandle(0);
while (cur.greaterThanOrEqual(bottom)) {
Oop oop = objectHeap.newOopIfPossible(cur, bottom);
if (oop != null) {
if (cur.addOffsetToAsOopHandle(oop.getObjectSize()).greaterThan(probeAddress)) {
return oop; // original address was within the nearest object
} else {
// declare this a "miss" even though we might not have walked far enough, and we just
// stumbled on some spurious data that looked like an Oop header, but the size is busted
return null;
}
}
cur = cur.addOffsetToAsOopHandle(-heapWordSize);
}
return null; // not found
}
示例3: printStringValue
import sun.jvm.hotspot.debugger.OopHandle; //导入依赖的package包/类
private static void printStringValue(PrintStream tty, StackValueCollection values, int slot) {
OopHandle strOopHandle = values.oopHandleAt(slot);
if (stringValueArrayField != null) {
OopHandle valueOopHandle = null;
if (compressedOopsEnabled) {
valueOopHandle = strOopHandle.getCompOopHandleAt(stringValueArrayField.getOffset());
} else {
valueOopHandle = strOopHandle.getOopHandleAt(stringValueArrayField.getOffset());
}
StringBuilder sb = new StringBuilder();
int length = valueOopHandle.getJIntAt(arrayLengthOffset);
for (int i = 0; i < length; i++) {
long offset = charArrayBaseOffset + i * charSize;
sb.append(valueOopHandle.getJCharAt(offset));
}
tty.print(String.format("%-30s %s",
sb.toString(),
String.class.getName()));
} else {
tty.print(String.format("%-30s %s",
strOopHandle + " (address)",
String.class.getName()));
}
}
示例4: thisObject
import sun.jvm.hotspot.debugger.OopHandle; //导入依赖的package包/类
public ObjectReference thisObject() {
validateStackFrame();
MethodImpl currentMethod = (MethodImpl)location.method();
if (currentMethod.isStatic() || currentMethod.isNative()) {
return null;
}
if (thisObject == null) {
StackValueCollection values = saFrame.getLocals();
if (Assert.ASSERTS_ENABLED) {
Assert.that(values.size() > 0, "this is missing");
}
// 'this' at index 0.
OopHandle handle = values.oopHandleAt(0);
ObjectHeap heap = vm.saObjectHeap();
thisObject = vm.objectMirror(heap.newOop(handle));
}
return thisObject;
}
示例5: lookupOop
import sun.jvm.hotspot.debugger.OopHandle; //导入依赖的package包/类
/** From the SymbolLookup interface via Debugger and JVMDebugger */
public synchronized OopHandle lookupOop(String objectName, String symbol) {
Address addr = lookup(objectName, symbol);
if (addr == null) {
return null;
}
return addr.addOffsetToAsOopHandle(0);
}
示例6: writeGlobalJNIHandle
import sun.jvm.hotspot.debugger.OopHandle; //导入依赖的package包/类
protected void writeGlobalJNIHandle(Address handleAddr) throws IOException {
OopHandle oopHandle = handleAddr.getOopHandleAt(0);
Oop oop = objectHeap.newOop(oopHandle);
// exclude JNI handles of hotspot internal objects
if (oop != null && isJavaVisible(oop)) {
out.writeByte((byte) HPROF_GC_ROOT_JNI_GLOBAL);
writeObjectID(oop);
// use JNIHandle address as ID
writeObjectID(getAddressValue(handleAddr));
}
}
示例7: writeObjectArray
import sun.jvm.hotspot.debugger.OopHandle; //导入依赖的package包/类
protected void writeObjectArray(ObjArray array) throws IOException {
out.writeByte((byte) HPROF_GC_OBJ_ARRAY_DUMP);
writeObjectID(array);
out.writeInt(DUMMY_STACK_TRACE_ID);
out.writeInt((int) array.getLength());
writeObjectIDForKlass(array.getKlass());
final int length = (int) array.getLength();
for (int index = 0; index < length; index++) {
OopHandle handle = array.getOopHandleAt(index);
writeObjectID(getAddressValue(handle));
}
}
示例8: 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;
}
示例9: 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));
}
}
}
示例10: getSlotValue
import sun.jvm.hotspot.debugger.OopHandle; //导入依赖的package包/类
private ValueImpl getSlotValue(StackValueCollection values,
BasicType variableType, int ss) {
ValueImpl valueImpl = null;
OopHandle handle = null;
ObjectHeap heap = vm.saObjectHeap();
if (variableType == BasicType.T_BOOLEAN) {
valueImpl = (BooleanValueImpl) vm.mirrorOf(values.booleanAt(ss));
} else if (variableType == BasicType.T_CHAR) {
valueImpl = (CharValueImpl) vm.mirrorOf(values.charAt(ss));
} else if (variableType == BasicType.T_FLOAT) {
valueImpl = (FloatValueImpl) vm.mirrorOf(values.floatAt(ss));
} else if (variableType == BasicType.T_DOUBLE) {
valueImpl = (DoubleValueImpl) vm.mirrorOf(values.doubleAt(ss));
} else if (variableType == BasicType.T_BYTE) {
valueImpl = (ByteValueImpl) vm.mirrorOf(values.byteAt(ss));
} else if (variableType == BasicType.T_SHORT) {
valueImpl = (ShortValueImpl) vm.mirrorOf(values.shortAt(ss));
} else if (variableType == BasicType.T_INT) {
valueImpl = (IntegerValueImpl) vm.mirrorOf(values.intAt(ss));
} else if (variableType == BasicType.T_LONG) {
valueImpl = (LongValueImpl) vm.mirrorOf(values.longAt(ss));
} else if (variableType == BasicType.T_OBJECT) {
// we may have an [Ljava/lang/Object; - i.e., Object[] with the
// elements themselves may be arrays because every array is an Object.
handle = values.oopHandleAt(ss);
valueImpl = (ObjectReferenceImpl) vm.objectMirror(heap.newOop(handle));
} else if (variableType == BasicType.T_ARRAY) {
handle = values.oopHandleAt(ss);
valueImpl = vm.arrayMirror((Array)heap.newOop(handle));
} else if (variableType == BasicType.T_VOID) {
valueImpl = new VoidValueImpl(vm);
} else {
throw new RuntimeException("Should not read here");
}
return valueImpl;
}
示例11: getSlotValue
import sun.jvm.hotspot.debugger.OopHandle; //导入依赖的package包/类
private ValueImpl getSlotValue(StackValueCollection values,
BasicType variableType, int ss) {
ValueImpl valueImpl = null;
OopHandle handle = null;
ObjectHeap heap = vm.saObjectHeap();
if (values.get(ss).getType() == BasicType.getTConflict()) {
// Dead locals, so just represent them as a zero of the appropriate type
if (variableType == BasicType.T_BOOLEAN) {
valueImpl = (BooleanValueImpl) vm.mirrorOf(false);
} else if (variableType == BasicType.T_CHAR) {
valueImpl = (CharValueImpl) vm.mirrorOf((char)0);
} else if (variableType == BasicType.T_FLOAT) {
valueImpl = (FloatValueImpl) vm.mirrorOf((float)0);
} else if (variableType == BasicType.T_DOUBLE) {
valueImpl = (DoubleValueImpl) vm.mirrorOf((double)0);
} else if (variableType == BasicType.T_BYTE) {
valueImpl = (ByteValueImpl) vm.mirrorOf((byte)0);
} else if (variableType == BasicType.T_SHORT) {
valueImpl = (ShortValueImpl) vm.mirrorOf((short)0);
} else if (variableType == BasicType.T_INT) {
valueImpl = (IntegerValueImpl) vm.mirrorOf((int)0);
} else if (variableType == BasicType.T_LONG) {
valueImpl = (LongValueImpl) vm.mirrorOf((long)0);
} else if (variableType == BasicType.T_OBJECT) {
// we may have an [Ljava/lang/Object; - i.e., Object[] with the
// elements themselves may be arrays because every array is an Object.
handle = null;
valueImpl = (ObjectReferenceImpl) vm.objectMirror(heap.newOop(handle));
} else if (variableType == BasicType.T_ARRAY) {
handle = null;
valueImpl = vm.arrayMirror((Array)heap.newOop(handle));
} else if (variableType == BasicType.T_VOID) {
valueImpl = new VoidValueImpl(vm);
} else {
throw new RuntimeException("Should not read here");
}
} else {
if (variableType == BasicType.T_BOOLEAN) {
valueImpl = (BooleanValueImpl) vm.mirrorOf(values.booleanAt(ss));
} else if (variableType == BasicType.T_CHAR) {
valueImpl = (CharValueImpl) vm.mirrorOf(values.charAt(ss));
} else if (variableType == BasicType.T_FLOAT) {
valueImpl = (FloatValueImpl) vm.mirrorOf(values.floatAt(ss));
} else if (variableType == BasicType.T_DOUBLE) {
valueImpl = (DoubleValueImpl) vm.mirrorOf(values.doubleAt(ss));
} else if (variableType == BasicType.T_BYTE) {
valueImpl = (ByteValueImpl) vm.mirrorOf(values.byteAt(ss));
} else if (variableType == BasicType.T_SHORT) {
valueImpl = (ShortValueImpl) vm.mirrorOf(values.shortAt(ss));
} else if (variableType == BasicType.T_INT) {
valueImpl = (IntegerValueImpl) vm.mirrorOf(values.intAt(ss));
} else if (variableType == BasicType.T_LONG) {
valueImpl = (LongValueImpl) vm.mirrorOf(values.longAt(ss));
} else if (variableType == BasicType.T_OBJECT) {
// we may have an [Ljava/lang/Object; - i.e., Object[] with the
// elements themselves may be arrays because every array is an Object.
handle = values.oopHandleAt(ss);
valueImpl = (ObjectReferenceImpl) vm.objectMirror(heap.newOop(handle));
} else if (variableType == BasicType.T_ARRAY) {
handle = values.oopHandleAt(ss);
valueImpl = vm.arrayMirror((Array)heap.newOop(handle));
} else if (variableType == BasicType.T_VOID) {
valueImpl = new VoidValueImpl(vm);
} else {
throw new RuntimeException("Should not read here");
}
}
return valueImpl;
}
示例12: FastTypeArray
import sun.jvm.hotspot.debugger.OopHandle; //导入依赖的package包/类
public FastTypeArray(OopHandle handle, ObjectHeap heap, TypeArrayKlass klass) {
super(handle, heap);
this.klass = klass;
}
示例13: FastObjArray
import sun.jvm.hotspot.debugger.OopHandle; //导入依赖的package包/类
public FastObjArray(OopHandle handle, ObjectHeap heap, ObjArrayKlass klass) {
super(handle, heap);
this.klass = klass;
}
示例14: FastInstance
import sun.jvm.hotspot.debugger.OopHandle; //导入依赖的package包/类
public FastInstance(OopHandle handle, ObjectHeap heap, InstanceKlass klass) {
super(handle, heap);
this.klass = klass;
}
示例15: lookupOop
import sun.jvm.hotspot.debugger.OopHandle; //导入依赖的package包/类
@Override
public OopHandle lookupOop(String objectName, String symbol) {
Address addr = this.lookup(objectName, symbol);
return addr == null?null:addr.addOffsetToAsOopHandle(0L);
}