sun.jvm.hotspot.types.Type Java Examples

The following examples show how to use sun.jvm.hotspot.types.Type. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CommandProcessor.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
void dumpFields(Type type, boolean allowStatic) {
    Iterator i = type.getFields();
    while (i.hasNext()) {
        Field f = (Field) i.next();
        if (!allowStatic && f.isStatic()) continue;
        out.print("field ");
        quote(type.getName());
        out.print(" ");
        out.print(f.getName());
        out.print(" ");
        quote(f.getType().getName());
        out.print(" ");
        out.print(f.isStatic());
        out.print(" ");
        if (f.isStatic()) {
            out.print("0 ");
            out.print(f.getStaticFieldAddress());
        } else {
            out.print(f.getOffset());
            out.print(" 0x0");
        }
        out.println();
    }
}
 
Example #2
Source File: Method.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
  Type type                  = db.lookupType("Method");
  constMethod                = type.getAddressField("_constMethod");
  methodData                 = type.getAddressField("_method_data");
  methodCounters             = type.getAddressField("_method_counters");
  methodSize                 = new CIntField(type.getCIntegerField("_method_size"), 0);
  accessFlags                = new CIntField(type.getCIntegerField("_access_flags"), 0);
  code                       = type.getAddressField("_code");
  vtableIndex                = new CIntField(type.getCIntegerField("_vtable_index"), 0);
  bytecodeOffset = type.getSize();

  /*
  interpreterEntry           = type.getAddressField("_interpreter_entry");
  fromCompiledCodeEntryPoint = type.getAddressField("_from_compiled_code_entry_point");

  */
  objectInitializerName = null;
  classInitializerName = null;
}
 
Example #3
Source File: CommandProcessor.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
void dumpFields(Type type, boolean allowStatic) {
    Iterator i = type.getFields();
    while (i.hasNext()) {
        Field f = (Field) i.next();
        if (!allowStatic && f.isStatic()) continue;
        out.print("field ");
        quote(type.getName());
        out.print(" ");
        out.print(f.getName());
        out.print(" ");
        quote(f.getType().getName());
        out.print(" ");
        out.print(f.isStatic());
        out.print(" ");
        if (f.isStatic()) {
            out.print("0 ");
            out.print(f.getStaticFieldAddress());
        } else {
            out.print(f.getOffset());
            out.print(" 0x0");
        }
        out.println();
    }
}
 
Example #4
Source File: CommandProcessor.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
void dumpFields(Type type, boolean allowStatic) {
    Iterator i = type.getFields();
    while (i.hasNext()) {
        Field f = (Field) i.next();
        if (!allowStatic && f.isStatic()) continue;
        out.print("field ");
        quote(type.getName());
        out.print(" ");
        out.print(f.getName());
        out.print(" ");
        quote(f.getType().getName());
        out.print(" ");
        out.print(f.isStatic());
        out.print(" ");
        if (f.isStatic()) {
            out.print("0 ");
            out.print(f.getStaticFieldAddress());
        } else {
            out.print(f.getOffset());
            out.print(" 0x0");
        }
        out.println();
    }
}
 
Example #5
Source File: Method.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
  Type type                  = db.lookupType("Method");
  constMethod                = type.getAddressField("_constMethod");
  methodData                 = type.getAddressField("_method_data");
  methodCounters             = type.getAddressField("_method_counters");
  methodSize                 = new CIntField(type.getCIntegerField("_method_size"), 0);
  accessFlags                = new CIntField(type.getCIntegerField("_access_flags"), 0);
  code                       = type.getAddressField("_code");
  vtableIndex                = new CIntField(type.getCIntegerField("_vtable_index"), 0);
  bytecodeOffset = type.getSize();

  /*
  interpreterEntry           = type.getAddressField("_interpreter_entry");
  fromCompiledCodeEntryPoint = type.getAddressField("_from_compiled_code_entry_point");

  */
  objectInitializerName = null;
  classInitializerName = null;
}
 
Example #6
Source File: CommandProcessor.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
void dumpType(Type type) {
    out.print("type ");
    quote(type.getName());
    out.print(" ");
    if (type.getSuperclass() != null) {
        quote(type.getSuperclass().getName());
        out.print(" ");
    } else {
        out.print("null ");
    }
    out.print(type.isOopType());
    out.print(" ");
    if (type.isCIntegerType()) {
        out.print("true ");
        out.print(((CIntegerType)type).isUnsigned());
        out.print(" ");
    } else {
        out.print("false false ");
    }
    out.print(type.getSize());
    out.println();
}
 
Example #7
Source File: Method.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
  Type type                  = db.lookupType("Method");
  constMethod                = type.getAddressField("_constMethod");
  methodData                 = type.getAddressField("_method_data");
  methodCounters             = type.getAddressField("_method_counters");
  methodSize                 = new CIntField(type.getCIntegerField("_method_size"), 0);
  accessFlags                = new CIntField(type.getCIntegerField("_access_flags"), 0);
  code                       = type.getAddressField("_code");
  vtableIndex                = new CIntField(type.getCIntegerField("_vtable_index"), 0);
  bytecodeOffset = type.getSize();

  /*
  interpreterEntry           = type.getAddressField("_interpreter_entry");
  fromCompiledCodeEntryPoint = type.getAddressField("_from_compiled_code_entry_point");

  */
  objectInitializerName = null;
  classInitializerName = null;
}
 
Example #8
Source File: CommandProcessor.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
void dumpType(Type type) {
    out.print("type ");
    quote(type.getName());
    out.print(" ");
    if (type.getSuperclass() != null) {
        quote(type.getSuperclass().getName());
        out.print(" ");
    } else {
        out.print("null ");
    }
    out.print(type.isOopType());
    out.print(" ");
    if (type.isCIntegerType()) {
        out.print("true ");
        out.print(((CIntegerType)type).isUnsigned());
        out.print(" ");
    } else {
        out.print("false false ");
    }
    out.print(type.getSize());
    out.println();
}
 
Example #9
Source File: CommandProcessor.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
void dumpFields(Type type, boolean allowStatic) {
    Iterator i = type.getFields();
    while (i.hasNext()) {
        Field f = (Field) i.next();
        if (!allowStatic && f.isStatic()) continue;
        out.print("field ");
        quote(type.getName());
        out.print(" ");
        out.print(f.getName());
        out.print(" ");
        quote(f.getType().getName());
        out.print(" ");
        out.print(f.isStatic());
        out.print(" ");
        if (f.isStatic()) {
            out.print("0 ");
            out.print(f.getStaticFieldAddress());
        } else {
            out.print(f.getOffset());
            out.print(" 0x0");
        }
        out.println();
    }
}
 
Example #10
Source File: Method.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
  Type type                  = db.lookupType("Method");
  constMethod                = type.getAddressField("_constMethod");
  methodData                 = type.getAddressField("_method_data");
  methodCounters             = type.getAddressField("_method_counters");
  methodSize                 = new CIntField(type.getCIntegerField("_method_size"), 0);
  accessFlags                = new CIntField(type.getCIntegerField("_access_flags"), 0);
  code                       = type.getAddressField("_code");
  vtableIndex                = new CIntField(type.getCIntegerField("_vtable_index"), 0);
  bytecodeOffset = type.getSize();

  /*
  interpreterEntry           = type.getAddressField("_interpreter_entry");
  fromCompiledCodeEntryPoint = type.getAddressField("_from_compiled_code_entry_point");

  */
  objectInitializerName = null;
  classInitializerName = null;
}
 
Example #11
Source File: BasicTypeDataBase.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public Type guessTypeForAddress(Address addr) {
  for (Iterator iter = getTypes(); iter.hasNext(); ) {
    Type t = (Type) iter.next();
    if (addressTypeIsEqualToType(addr, t)) {
      return t;
    }
  }
  return null;
}
 
Example #12
Source File: BasicTypeDataBase.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/** This method should only be used by the builder of the
    TypeDataBase. Throws a RuntimeException if a class with this
    name was already present. */
public void addType(Type type) {
  if (nameToTypeMap.get(type.getName()) != null) {
    throw new RuntimeException("type of name \"" + type.getName() + "\" already present");
  }

  nameToTypeMap.put(type.getName(), type);
}
 
Example #13
Source File: ciInstanceKlass.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
  Type type      = db.lookupType("ciInstanceKlass");
  initStateField = new CIntField(type.getCIntegerField("_init_state"), 0);
  isSharedField = new CIntField(type.getCIntegerField("_is_shared"), 0);
  CLASS_STATE_LINKED = db.lookupIntConstant("InstanceKlass::linked").intValue();
  CLASS_STATE_FULLY_INITIALIZED = db.lookupIntConstant("InstanceKlass::fully_initialized").intValue();
}
 
Example #14
Source File: ciInstanceKlass.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
  Type type      = db.lookupType("ciInstanceKlass");
  initStateField = new CIntField(type.getCIntegerField("_init_state"), 0);
  isSharedField = new CIntField(type.getCIntegerField("_is_shared"), 0);
  CLASS_STATE_LINKED = db.lookupIntConstant("InstanceKlass::linked").intValue();
  CLASS_STATE_FULLY_INITIALIZED = db.lookupIntConstant("InstanceKlass::fully_initialized").intValue();
}
 
Example #15
Source File: GenericArray.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets the element at the given index.
 */
protected long getIntegerAt(int index) {
  if (index < 0 || index >= length()) throw new ArrayIndexOutOfBoundsException(index + " " + length());

  Type elemType = getElemType();
  if (!getElemType().isCIntegerType()) throw new RuntimeException("elemType must be of CInteger type");

  Address data = getAddress().addOffsetTo(dataFieldOffset);
  long elemSize = elemType.getSize();

  return data.getCIntegerAt(index * elemSize, elemSize, false);
}
 
Example #16
Source File: BasicTypeDataBase.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/** This method should only be used by the builder of the
    TypeDataBase. Throws a RuntimeException if this class was not
    present. */
public void removeType(Type type) {
  Type curType = (Type) nameToTypeMap.get(type.getName());
  if (curType == null) {
    throw new RuntimeException("type of name \"" + type.getName() + "\" not present");
  }

  if (!curType.equals(type)) {
    throw new RuntimeException("a different type of name \"" + type.getName() + "\" was present");
  }

  nameToTypeMap.remove(type.getName());
}
 
Example #17
Source File: CommandProcessor.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void doit(Tokens t) {
    if (t.countTokens() != 2) {
        usage();
    } else {
        Type type = agent.getTypeDataBase().lookupType(t.nextToken());
        Address a = VM.getVM().getDebugger().parseAddress(t.nextToken());
        CTypeTreeNodeAdapter node = new CTypeTreeNodeAdapter(a, type, null);

        out.println("pointer to " + type + " @ " + a +
                    " (size = " + type.getSize() + ")");
        printNode(node);
    }
}
 
Example #18
Source File: CommandProcessor.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void doit(Tokens t) {
    if (t.countTokens() != 2) {
        usage();
    } else {
        Type type = agent.getTypeDataBase().lookupType(t.nextToken());
        Address a = VM.getVM().getDebugger().parseAddress(t.nextToken());
        CTypeTreeNodeAdapter node = new CTypeTreeNodeAdapter(a, type, null);

        out.println("pointer to " + type + " @ " + a +
                    " (size = " + type.getSize() + ")");
        printNode(node);
    }
}
 
Example #19
Source File: BasicTypeDataBase.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private Address vtblForType(Type type) {
  Address vtblAddr = (Address)typeToVtbl.get(type);
  if (vtblAddr == null) {
    vtblAddr = vtblAccess.getVtblForType(type);
    if (vtblAddr != null) {
      typeToVtbl.put(type, vtblAddr);
    }
  }
  return vtblAddr;
}
 
Example #20
Source File: java_lang_Class.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private static synchronized void initialize(TypeDataBase db) {
  // klass and oop_size are HotSpot magic fields and hence we can't
  // find them from InstanceKlass for java.lang.Class.
  Type jlc = db.lookupType("java_lang_Class");
  klassOffset = (int) jlc.getCIntegerField("_klass_offset").getValue();
  int oopSizeOffset = (int) jlc.getCIntegerField("_oop_size_offset").getValue();
  oopSizeField = new IntField(new NamedFieldIdentifier("oop_size"), oopSizeOffset, true);
}
 
Example #21
Source File: CompactibleFreeListSpace.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private static synchronized void initialize(TypeDataBase db) {
   long sizeofFreeChunk = db.lookupType("FreeChunk").getSize();
   VM vm = VM.getVM();
   MinChunkSizeInBytes = numQuanta(sizeofFreeChunk, vm.getMinObjAlignmentInBytes()) *
                  vm.getMinObjAlignmentInBytes();

  Type type = db.lookupType("CompactibleFreeListSpace");
  collectorField = type.getAddressField("_collector");
  collectorField       = type.getAddressField("_collector");
  dictionaryField      = type.getAddressField("_dictionary");
  indexedFreeListField = type.getAddressField("_indexedFreeList[0]");
  smallLinearAllocBlockFieldOffset = type.getField("_smallLinearAllocBlock").getOffset();
}
 
Example #22
Source File: G1MonitoringSupport.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
static private synchronized void initialize(TypeDataBase db) {
    Type type = db.lookupType("G1MonitoringSupport");

    edenCommittedField = type.getCIntegerField("_eden_committed");
    edenUsedField = type.getCIntegerField("_eden_used");
    survivorCommittedField = type.getCIntegerField("_survivor_committed");
    survivorUsedField = type.getCIntegerField("_survivor_used");
    oldCommittedField = type.getCIntegerField("_old_committed");
    oldUsedField = type.getCIntegerField("_old_used");
}
 
Example #23
Source File: BasicTypeDataBase.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public Type guessTypeForAddress(Address addr) {
  for (Iterator iter = getTypes(); iter.hasNext(); ) {
    Type t = (Type) iter.next();
    if (addressTypeIsEqualToType(addr, t)) {
      return t;
    }
  }
  return null;
}
 
Example #24
Source File: GenericArray.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
protected Address getAddressAt(int index) {
  if (index < 0 || index >= length()) throw new ArrayIndexOutOfBoundsException(index);

  Type elemType = getElemType();
  if (getElemType().isCIntegerType()) throw new RuntimeException("elemType must not be of CInteger type");

  Address data = getAddress().addOffsetTo(dataFieldOffset);
  long elemSize = elemType.getSize();

  return data.getAddressAt(index * elemSize);
}
 
Example #25
Source File: G1HeapRegionTable.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
static private synchronized void initialize(TypeDataBase db) {
    Type type = db.lookupType("G1HeapRegionTable");

    baseField = type.getAddressField("_base");
    lengthField = type.getCIntegerField("_length");
    biasedBaseField = type.getAddressField("_biased_base");
    biasField = type.getCIntegerField("_bias");
    shiftByField = type.getCIntegerField("_shift_by");
}
 
Example #26
Source File: CommandProcessor.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void doit(Tokens t) {
    if (t.countTokens() != 2) {
        usage();
    } else {
        Type type = agent.getTypeDataBase().lookupType(t.nextToken());
        Address a = VM.getVM().getDebugger().parseAddress(t.nextToken());
        CTypeTreeNodeAdapter node = new CTypeTreeNodeAdapter(a, type, null);

        out.println("pointer to " + type + " @ " + a +
                    " (size = " + type.getSize() + ")");
        printNode(node);
    }
}
 
Example #27
Source File: G1HeapRegionTable.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
static private synchronized void initialize(TypeDataBase db) {
    Type type = db.lookupType("G1HeapRegionTable");

    baseField = type.getAddressField("_base");
    lengthField = type.getCIntegerField("_length");
    biasedBaseField = type.getAddressField("_biased_base");
    biasField = type.getCIntegerField("_bias");
    shiftByField = type.getCIntegerField("_shift_by");
}
 
Example #28
Source File: CommandProcessor.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void doit(Tokens t) {
    if (t.countTokens() != 2) {
        usage();
    } else {
        Type type = agent.getTypeDataBase().lookupType(t.nextToken());
        Address a = VM.getVM().getDebugger().parseAddress(t.nextToken());
        CTypeTreeNodeAdapter node = new CTypeTreeNodeAdapter(a, type, null);

        out.println("pointer to " + type + " @ " + a +
                    " (size = " + type.getSize() + ")");
        printNode(node);
    }
}
 
Example #29
Source File: BasicTypeDataBase.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public Type guessTypeForAddress(Address addr) {
  for (Iterator iter = getTypes(); iter.hasNext(); ) {
    Type t = (Type) iter.next();
    if (addressTypeIsEqualToType(addr, t)) {
      return t;
    }
  }
  return null;
}
 
Example #30
Source File: BasicTypeDataBase.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/** This method should only be used by the builder of the
    TypeDataBase. Throws a RuntimeException if this class was not
    present. */
public void removeType(Type type) {
  Type curType = (Type) nameToTypeMap.get(type.getName());
  if (curType == null) {
    throw new RuntimeException("type of name \"" + type.getName() + "\" not present");
  }

  if (!curType.equals(type)) {
    throw new RuntimeException("a different type of name \"" + type.getName() + "\" was present");
  }

  nameToTypeMap.remove(type.getName());
}