当前位置: 首页>>代码示例>>Java>>正文


Java OopHandle.getAddressAt方法代码示例

本文整理汇总了Java中sun.jvm.hotspot.debugger.OopHandle.getAddressAt方法的典型用法代码示例。如果您正苦于以下问题:Java OopHandle.getAddressAt方法的具体用法?Java OopHandle.getAddressAt怎么用?Java OopHandle.getAddressAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sun.jvm.hotspot.debugger.OopHandle的用法示例。


在下文中一共展示了OopHandle.getAddressAt方法的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;
}
 
开发者ID:geoff-addepar,项目名称:heap-dump,代码行数:30,代码来源:FastObjectHeap.java

示例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));
    }
  }
}
 
开发者ID:geoff-addepar,项目名称:heap-dump,代码行数:36,代码来源:FastObjectHeap.java

示例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));
    }
  }
}
 
开发者ID:geoff-addepar,项目名称:heap-dump,代码行数:55,代码来源:FastObjectHeap.java


注:本文中的sun.jvm.hotspot.debugger.OopHandle.getAddressAt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。