sa-jdi

    if (jt.getThreadObj() != null)
      {
        writeJavaThread(jt, index);
        index++;
      }
      jt = jt.next();
    }
  }
  
  protected void writeJavaThread(JavaThread jt, int index)
    throws IOException
  {}
  
  protected void writeGlobalJNIHandles()
    throws IOException
  {
    JNIHandles handles = VM.getVM().getJNIHandles();
    JNIHandleBlock blk = handles.globalHandles();
    if (blk != null) {
      try
      {
        blk.oopsDo(new AddressVisitor()
        {
          public void visitAddress(Address handleAddr)
          {
            try
            {
              if (handleAddr != null) {
                writeGlobalJNIHandle(handleAddr);
              }
            }
            catch (IOException exp)
            {
              throw new RuntimeException(exp);
            }
          }
          
          public void visitCompOopAddress(Address handleAddr)
          {
            throw new RuntimeException("Should not reach here. JNIHandles are not compressed");
          }
        });
      }
      catch (RuntimeException re)
      {
        handleRuntimeException(re);
      }
    }
  }
  
  protected void writeGlobalJNIHandle(Address handleAddr)
    throws IOException
  {}
  
  protected void writeHeapHeader()
    throws IOException
  {}
  
  protected void writeInternalObject(Oop oop)
    throws IOException
  {}
  
  protected void writePrimitiveArray(TypeArray array)
    throws IOException
  {
    writeObject(array);
  }
  
  protected void writeObjectArray(ObjArray array)
    throws IOException
  {
    writeObject(array);
  }
  
  protected void writeInstance(Instance instance)
    throws IOException
  {
    writeObject(instance);
  }
  
  protected void writeString(Instance instance)
    throws IOException
  {
    writeInstance(instance);
  }
  
  protected void writeClass(Instance instance)
    throws IOException
  {
    writeInstance(instance);
  }
  
  protected void writeThread(Instance instance)
    throws IOException
  {
    writeInstance(instance);
  }
  
  protected void writeObject(Oop oop)
    throws IOException
  {
    writeObjectHeader(oop);
    writeObjectFields(oop);
    writeObjectFooter(oop);
  }
  
  protected void writeObjectHeader(Oop oop)
    throws IOException
  {}
  
  protected void writeObjectFields(final Oop oop)
    throws IOException
  {
    try
    {
      oop.iterate(new DefaultOopVisitor()
      {
        public void doOop(OopField field, boolean isVMField)
        {
          try
          {
            Oop ref = field.getValue(oop);
            if (((ref instanceof TypeArray)) || ((ref instanceof ObjArray)) || ((ref instanceof Instance))) {
              writeReferenceField(oop, field);
            } else {
              writeInternalReferenceField(oop, field);
            }
          }
          catch (IOException exp)
          {
            throw new RuntimeException(exp);
          }
        }
        
        public void doByte(ByteField field, boolean isVMField)
        {
          try
          {
            writeByteField(oop, field);
          }
          catch (IOException exp)
          {
            throw new RuntimeException(exp);
          }
        }
        
        public void doChar(CharField field, boolean isVMField)
        {
          try
          {
            writeCharField(oop, field);
          }
          catch (IOException exp)
          {
            throw new RuntimeException(exp);
          }
        }
        
        public void doBoolean(BooleanField field, boolean vField)
        {
          try
          {
            writeBooleanField(oop, field);
          }
          catch (IOException exp)
          {
            throw new RuntimeException(exp);
          }
        }
        
        public void doShort(ShortField field, boolean isVMField)
        {
          try
          {
            writeShortField(oop, field);
          }
          catch (IOException exp)
          {
            throw new RuntimeException(exp);
          }
        }
        
        public void doInt(IntField field, boolean isVMField)
        {
          try
          {
            writeIntField(oop, field);
          }
          catch (IOException exp)
          {
            throw new RuntimeException(exp);
          }
        }
        
        public void doLong(LongField field, boolean isVMField)
        {
          try
          {
            writeLongField(oop, field);
          }
          catch (IOException exp)
          {
            throw new RuntimeException(exp);
          }
        }
        
        public void doFloat(FloatField field, boolean isVMField)
        {
          try
          {
            writeFloatField(oop, field);
          }
          catch (IOException exp)
          {
            throw new RuntimeException(exp);
          }
        }
        
        public void doDouble(DoubleField field, boolean vField)
        {
          try
          {
            writeDoubleField(oop, field);
          }
          catch (IOException exp)
          {
            throw new RuntimeException(exp);
          }
        }
      }, false);
    }
    catch (RuntimeException re)
    {
      handleRuntimeException(re);
    }
  }
  
  protected void writeInternalReferenceField(Oop oop, OopField field)
    throws IOException
  {}
  
  protected void writeReferenceField(Oop oop, OopField field)
    throws IOException
  {}
  
  protected void writeByteField(Oop oop, ByteField field)
    throws IOException
  {}
  
  protected void writeCharField(Oop oop, CharField field)
    throws IOException
  {}
  
  protected void writeBooleanField(Oop oop, BooleanField field)
    throws IOException
  {}
  
  protected void writeShortField(Oop oop, ShortField field)
    throws IOException
  {}
  
  protected void writeIntField(Oop oop, IntField field)
    throws IOException
  {}
  
  protected void writeLongField(Oop oop, LongField field)
    throws IOException
  {}
  
  protected void writeFloatField(Oop oop, FloatField field)
    throws IOException
  {}
  
  protected void writeDoubleField(Oop oop, DoubleField field)
    throws IOException
  {}
  
  protected void writeObjectFooter(Oop oop)
    throws IOException
  {}
  
  protected void writeHeapFooter()
    throws IOException
  {}
  
  protected void handleRuntimeException(RuntimeException re)
    throws IOException
  {
    Throwable cause = re.getCause();
    if ((cause != null) && ((cause instanceof IOException))) {
      throw ((IOException)cause);
    }
    throw re;
  }
  
  protected boolean isJavaVisible(Oop oop)
  {
    if (((oop instanceof Instance)) || ((oop instanceof TypeArray))) {
      return true;
    }
    if ((oop instanceof ObjArray))
    {
      ObjArrayKlass oak = (ObjArrayKlass)oop.getKlass();
      Klass bottomKlass = oak.getBottomKlass();
      return ((bottomKlass instanceof InstanceKlass)) || ((bottomKlass instanceof TypeArrayKlass));
    }
    return false;
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.utilities.AbstractHeapGraphWriter
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.utilities;

import sun.jvm.hotspot.debugger.Address;

public class AddressOps
{
  public static boolean lessThan(Address a1, Address a2)
  {
    if (a2 == null) {
      return false;
    }
    if (a1 == null) {
      return true;
    }
    return a1.lessThan(a2);
  }
  
  public static boolean lessThanOrEqual(Address a1, Address a2)
  {
    if (a2 == null) {
      return a1 == null;
    }
    if (a1 == null) {
      return true;
    }
    return a1.lessThanOrEqual(a2);
  }
  
  public static boolean greaterThan(Address a1, Address a2)
  {
    if (a1 == null) {
      return false;
    }
    if (a2 == null) {
      return true;
    }
    return a1.greaterThan(a2);
  }
  
  public static boolean greaterThanOrEqual(Address a1, Address a2)
  {
    if (a1 == null) {
      return a2 == null;
    }
    if (a2 == null) {
      return true;
    }
    return a1.greaterThanOrEqual(a2);
  }
  
  public static boolean equal(Address a1, Address a2)
  {
    if ((a1 == null) && (a2 == null)) {
      return true;
    }
    if ((a1 == null) || (a2 == null)) {
      return false;
    }
    return a1.equals(a2);
  }
  
  public static boolean lt(Address a1, Address a2)
  {
    return lessThan(a1, a2);
  }
  
  public static boolean lte(Address a1, Address a2)
  {
    return lessThanOrEqual(a1, a2);
  }
  
  public static boolean gt(Address a1, Address a2)
  {
    return greaterThan(a1, a2);
  }
  
  public static boolean gte(Address a1, Address a2)
  {
    return greaterThanOrEqual(a1, a2);
  }
  
  public static Address max(Address a1, Address a2)
  {
    return gt(a1, a2) ? a1 : a2;
  }
  
  public static Address min(Address a1, Address a2)
  {
    return lt(a1, a2) ? a1 : a2;
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.utilities.AddressOps
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.utilities;

public class Assert
{
  public static boolean ASSERTS_ENABLED = true;
  
  public static void that(boolean test, String message)
  {
    if ((ASSERTS_ENABLED) && (!test)) {
      throw new AssertionFailure(message);
    }
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.utilities.Assert
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.utilities;

public class AssertionFailure
  extends RuntimeException
{
  public AssertionFailure() {}
  
  public AssertionFailure(String message)
  {
    super(message);
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.utilities.AssertionFailure
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.utilities;

import java.util.Observable;
import java.util.Observer;
import sun.jvm.hotspot.runtime.VM;

final class BasicHashtable$1
  implements Observer
{
  public void update(Observable o, Object data)
  {
    BasicHashtable.access$000(VM.getVM().getTypeDataBase());
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.utilities.BasicHashtable.1
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.utilities;

import java.util.Observable;
import java.util.Observer;
import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.runtime.VM;
import sun.jvm.hotspot.runtime.VMObject;
import sun.jvm.hotspot.runtime.VMObjectFactory;
import sun.jvm.hotspot.types.AddressField;
import sun.jvm.hotspot.types.CIntegerField;
import sun.jvm.hotspot.types.Type;
import sun.jvm.hotspot.types.TypeDataBase;

public class BasicHashtable
  extends VMObject
{
  private static CIntegerField tableSizeField;
  private static AddressField bucketsField;
  private static long bucketSize;
  
  static
  {
    VM.registerVMInitializedObserver(new Observer()
    {
      public void update(Observable o, Object data)
      {
        BasicHashtable.initialize(VM.getVM().getTypeDataBase());
      }
    });
  }
  
  private static synchronized void initialize(TypeDataBase db)
  {
    Type type = db.lookupType("BasicHashtable");
    tableSizeField = type.getCIntegerField("_table_size");
    bucketsField = type.getAddressField("_buckets");
    bucketSize = db.lookupType("HashtableBucket").getSize();
  }
  
  protected int tableSize()
  {
    return (int)tableSizeField.getValue(addr);
  }
  
  protected BasicHashtableEntry bucket(int i)
  {
    if (Assert.ASSERTS_ENABLED) {
      Assert.that((i >= 0) && (i < tableSize()), "Invalid bucket id");
    }
    Address tmp = bucketsField.getValue(addr);
    tmp = tmp.addOffsetTo(i * bucketSize);
    HashtableBucket bucket = (HashtableBucket)VMObjectFactory.newObject(HashtableBucket.class, tmp);
    
    return bucket.getEntry(getHashtableEntryClass());
  }
  
  protected Class getHashtableEntryClass()
  {
    return BasicHashtableEntry.class;
  }
  
  public BasicHashtable(Address addr)
  {
    super(addr);
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.utilities.BasicHashtable
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.utilities;

import java.util.Observable;
import java.util.Observer;
import sun.jvm.hotspot.runtime.VM;

final class BasicHashtableEntry$1
  implements Observer
{
  public void update(Observable o, Object data)
  {
    BasicHashtableEntry.access$000(VM.getVM().getTypeDataBase());
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.utilities.BasicHashtableEntry.1
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.utilities;

import java.util.Observable;
import java.util.Observer;
import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.debugger.Debugger;
import sun.jvm.hotspot.runtime.VM;
import sun.jvm.hotspot.runtime.VMObject;
import sun.jvm.hotspot.runtime.VMObjectFactory;
import sun.jvm.hotspot.types.AddressField;
import sun.jvm.hotspot.types.CIntegerField;
import sun.jvm.hotspot.types.Type;
import sun.jvm.hotspot.types.TypeDataBase;

public class BasicHashtableEntry
  extends VMObject
{
  private static CIntegerField hashField;
  private static AddressField nextField;
  
  static
  {
    VM.registerVMInitializedObserver(new Observer()
    {
      public void update(Observable o, Object data)
      {
        BasicHashtableEntry.initialize(VM.getVM().getTypeDataBase());
      }
    });
  }
  
  private static synchronized void initialize(TypeDataBase db)
  {
    Type type = db.lookupType("BasicHashtableEntry");
    hashField = type.getCIntegerField("_hash");
    nextField = type.getAddressField("_next");
  }
  
  public long hash()
  {
    return hashField.getValue(addr) & 0xFFFFFFFF;
  }
  
  private long nextAddressValue()
  {
    Debugger dbg = VM.getVM().getDebugger();
    Address nextValue = nextField.getValue(addr);
    return nextValue != null ? dbg.getAddressValue(nextValue) : 0L;
  }
  
  public boolean isShared()
  {
    return (nextAddressValue() & 1L) != 0L;
  }
  
  public BasicHashtableEntry next()
  {
    Address nextValue = nextField.getValue(addr);
    Address next = nextValue != null ? nextValue.andWithMask(-2L) : null;
    
    return (BasicHashtableEntry)VMObjectFactory.newObject(getClass(), next);
  }
  
  public BasicHashtableEntry(Address addr)
  {
    super(addr);
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.utilities.BasicHashtableEntry
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.utilities;

import sun.jvm.hotspot.debugger.Address;

public class BitMap
{
  private int size;
  private int[] data;
  private static final int bitsPerWord = 32;
  private static final int bytesPerWord = 4;
  
  public BitMap(int sizeInBits)
  {
    size = sizeInBits;
    int nofWords = sizeInWords();
    data = new int[nofWords];
  }
  
  public int size()
  {
    return size;
  }
  
  public boolean at(int offset)
  {
    if (Assert.ASSERTS_ENABLED) {
      Assert.that((offset >= 0) && (offset < size()), "BitMap index out of bounds");
    }
    return Bits.isSetNthBit(wordFor(offset), offset % 32);
  }
  
  public void atPut(int offset, boolean value)
  {
    int index = indexFor(offset);
    int pos = offset % 32;
    if (value) {
      data[index] = Bits.setNthBit(data[index], pos);
    } else {
      data[index] = Bits.clearNthBit(data[index], pos);
    }
  }
  
  public void set_size(int value)
  {
    size = value;
  }
  
  public void set_map(Address addr)
  {
    for (int i = 0; i < sizeInWords(); i++)
    {
      data[i] = ((int)addr.getCIntegerAt(0L, 4L, true));
      addr = addr.addOffsetTo(4L);
    }
  }
  
  public void clear()
  {
    for (int i = 0; i < sizeInWords(); i++) {
      data[i] = 0;
    }
  }
  
  public void iterate(BitMapClosure blk)
  {
    for (int index = 0; index < sizeInWords(); index++)
    {
      int rest = data[index];
      for (int offset = index * 32; rest != 0; offset++)
      {
        if (rest % 2 == 1) {
          if (offset < size()) {
            blk.doBit(offset);
          } else {
            return;
          }
        }
        rest >>>= 1;
      }
    }
  }
  
  public boolean setUnion(BitMap other)
  {
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(size() == other.size(), "must have same size");
    }
    boolean changed = false;
    for (int index = 0; index < sizeInWords(); index++)
    {
      int temp = data[index] | data[index];
      changed = (changed) || (temp != data[index]);
      data[index] = temp;
    }
    return changed;
  }
  
  public void setIntersection(BitMap other)
  {
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(size() == other.size(), "must have same size");
    }
    for (int index = 0; index < sizeInWords(); index++) {
      data[index] &= data[index];
    }
  }
  
  public void setFrom(BitMap other)
  {
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(size() == other.size(), "must have same size");
    }
    for (int index = 0; index < sizeInWords(); index++) {
      data[index] = data[index];
    }
  }
  
  public boolean setDifference(BitMap other)
  {
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(size() == other.size(), "must have same size");
    }
    boolean changed = false;
    for (int index = 0; index < sizeInWords(); index++)
    {
      int temp = data[index] & (data[index] ^ 0xFFFFFFFF);
      changed = (changed) || (temp != data[index]);
      data[index] = temp;
    }
    return changed;
  }
  
  public boolean isSame(BitMap other)
  {
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(size() == other.size(), "must have same size");
    }
    for (int index = 0; index < sizeInWords(); index++) {
      if (data[index] != data[index]) {
        return false;
      }
    }
    return true;
  }
  
  public int getNextOneOffset(int l_offset, int r_offset)
  {
    if (l_offset == r_offset) {
      return l_offset;
    }
    int index = indexFor(l_offset);
    int r_index = indexFor(r_offset);
    int res_offset = l_offset;
    
    int pos = bitInWord(res_offset);
    int res = data[index] >> pos;
    if (res != 0)
    {
      for (; (res & 0x1) == 0; res_offset++) {
        res >>= 1;
      }
      return res_offset;
    }
    for (index++; index < r_index; index++)
    {
      res = data[index];
      if (res != 0)
      {
        for (res_offset = index * 32; (res & 0x1) == 0; res_offset++) {
          res >>= 1;
        }
        return res_offset;
      }
    }
    return r_offset;
  }
  
  private int sizeInWords()
  {
    return (size() + 32 - 1) / 32;
  }
  
  private int indexFor(int offset)
  {
    return offset / 32;
  }
  
  private int wordFor(int offset)
  {
    return data[(offset / 32)];
  }
  
  private int bitInWord(int offset)
  {
    return offset & 0x1F;
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.utilities.BitMap
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.utilities;

public abstract interface BitMapClosure
{
  public abstract void doBit(int paramInt);
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.utilities.BitMapClosure
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.utilities;

public class Bits
{
  public static final int AllBits = -1;
  public static final int NoBits = 0;
  public static final int OneBit = 1;
  public static final int BitsPerByte = 8;
  public static final int BitsPerInt = 32;
  public static final int LogBytesPerInt = 2;
  public static final int LogBytesPerLong = 3;
  
  public static int setBits(int x, int m)
  {
    return x | m;
  }
  
  public static int clearBits(int x, int m)
  {
    return x & (m ^ 0xFFFFFFFF);
  }
  
  public static int nthBit(int n)
  {
    return n > 32 ? 0 : 1 << n;
  }
  
  public static int setNthBit(int x, int n)
  {
    return setBits(x, nthBit(n));
  }
  
  public static int clearNthBit(int x, int n)
  {
    return clearBits(x, nthBit(n));
  }
  
  public static boolean isSetNthBit(int word, int n)
  {
    return maskBits(word, nthBit(n)) != 0;
  }
  
  public static int rightNBits(int n)
  {
    return nthBit(n) - 1;
  }
  
  public static int maskBits(int x, int m)
  {
    return x & m;
  }
  
  public static long maskBitsLong(long x, long m)
  {
    return x & m;
  }
  
  public static int roundTo(int x, int s)
  {
    int m = s - 1;
    return maskBits(x + m, m ^ 0xFFFFFFFF);
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.utilities.Bits
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.utilities;

public class ConstantTag
{
  private static int JVM_CONSTANT_Utf8 = 1;
  private static int JVM_CONSTANT_Unicode = 2;
  private static int JVM_CONSTANT_Integer = 3;
  private static int JVM_CONSTANT_Float = 4;
  private static int JVM_CONSTANT_Long = 5;
  private static int JVM_CONSTANT_Double = 6;
  private static int JVM_CONSTANT_Class = 7;
  private static int JVM_CONSTANT_String = 8;
  private static int JVM_CONSTANT_Fieldref = 9;
  private static int JVM_CONSTANT_Methodref = 10;
  private static int JVM_CONSTANT_InterfaceMethodref = 11;
  private static int JVM_CONSTANT_NameAndType = 12;
  private static int JVM_CONSTANT_MethodHandle = 15;
  private static int JVM_CONSTANT_MethodType = 16;
  private static int JVM_CONSTANT_InvokeDynamicTrans = 17;
  private static int JVM_CONSTANT_InvokeDynamic = 18;
  private static int JVM_CONSTANT_Invalid = 0;
  private static int JVM_CONSTANT_UnresolvedClass = 100;
  private static int JVM_CONSTANT_ClassIndex = 101;
  private static int JVM_CONSTANT_UnresolvedString = 102;
  private static int JVM_CONSTANT_StringIndex = 103;
  private static int JVM_CONSTANT_UnresolvedClassInError = 104;
  private static int JVM_CONSTANT_Object = 105;
  private static int JVM_REF_getField = 1;
  private static int JVM_REF_getStatic = 2;
  private static int JVM_REF_putField = 3;
  private static int JVM_REF_putStatic = 4;
  private static int JVM_REF_invokeVirtual = 5;
  private static int JVM_REF_invokeStatic = 6;
  private static int JVM_REF_invokeSpecial = 7;
  private static int JVM_REF_newInvokeSpecial = 8;
  private static int JVM_REF_invokeInterface = 9;
  private byte tag;
  
  public ConstantTag(byte tag)
  {
    this.tag = tag;
  }
  
  public int value()
  {
    return tag;
  }
  
  public boolean isKlass()
  {
    return tag == JVM_CONSTANT_Class;
  }
  
  public boolean isField()
  {
    return tag == JVM_CONSTANT_Fieldref;
  }
  
  public boolean isMethod()
  {
    return tag == JVM_CONSTANT_Methodref;
  }
  
  public boolean isInterfaceMethod()
  {
    return tag == JVM_CONSTANT_InterfaceMethodref;
  }
  
  public boolean isString()
  {
    return tag == JVM_CONSTANT_String;
  }
  
  public boolean isInt()
  {
    return tag == JVM_CONSTANT_Integer;
  }
  
  public boolean isFloat()
  {
    return tag == JVM_CONSTANT_Float;
  }
  
  public boolean isLong()
  {
    return tag == JVM_CONSTANT_Long;
  }
  
  public boolean isDouble()
  {
    return tag == JVM_CONSTANT_Double;
  }
  
  public boolean isNameAndType()
  {
    return tag == JVM_CONSTANT_NameAndType;
  }
  
  public boolean isUtf8()
  {
    return tag == JVM_CONSTANT_Utf8;
  }
  
  public boolean isMethodHandle()
  {
    return tag == JVM_CONSTANT_MethodHandle;
  }
  
  public boolean isMethodType()
  {
    return tag == JVM_CONSTANT_MethodType;
  }
  
  public boolean isInvokeDynamic()
  {
    return tag == JVM_CONSTANT_InvokeDynamic;
  }
  
  public boolean isInvokeDynamicTrans()
  {
    return tag == JVM_CONSTANT_InvokeDynamicTrans;
  }
  
  public boolean isInvalid()
  {
    return tag == JVM_CONSTANT_Invalid;
  }
  
  public boolean isUnresolvedKlass()
  {
    return (tag == JVM_CONSTANT_UnresolvedClass) || (tag == JVM_CONSTANT_UnresolvedClassInError);
  }
  
  public boolean isUnresolveKlassInError()
  {
    return tag == JVM_CONSTANT_UnresolvedClassInError;
  }
  
  public boolean isKlassIndex()
  {
    return tag == JVM_CONSTANT_ClassIndex;
  }
  
  public boolean isUnresolvedString()
  {
    return tag == JVM_CONSTANT_UnresolvedString;
  }
  
  public boolean isStringIndex()
  {
    return tag == JVM_CONSTANT_StringIndex;
  }
  
  public boolean isObject()
  {
    return tag == JVM_CONSTANT_Object;
  }
  
  public boolean isKlassReference()
  {
    return (isKlassIndex()) || (isUnresolvedKlass());
  }
  
  public boolean isFieldOrMethod()
  {
    return (isField()) || (isMethod()) || (isInterfaceMethod());
  }
  
  public boolean isSymbol()
  {
    return isUtf8();
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.utilities.ConstantTag
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.utilities;

import java.util.Iterator;

public class ConstIterator
  implements Iterator
{
  private Iterator iter;
  
  public ConstIterator(Iterator iter)
  {
    this.iter = iter;
  }
  
  public boolean hasNext()
  {
    return iter.hasNext();
  }
  
  public Object next()
  {
    return iter.next();
  }
  
  public void remove()
  {
    throw new UnsupportedOperationException();
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.utilities.ConstIterator
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.utilities;

class CPPExpressions$1 {}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.utilities.CPPExpressions.1
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.utilities;

public class CPPExpressions$CastExpr
{
  private String type;
  private String address;
  
  CPPExpressions$CastExpr(String x0, String x1, CPPExpressions.1 x2)
  {
    this(x0, x1);
  }
  
  private CPPExpressions$CastExpr(String type, String address)
  {
    this.type = type;
    this.address = address;
  }
  
  public String getType()
  {
    return type;
  }
  
  public String getAddress()
  {
    return address;
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.utilities.CPPExpressions.CastExpr
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.utilities;

public class CPPExpressions$StaticFieldExpr
{
  private String containingType;
  private String fieldName;
  
  CPPExpressions$StaticFieldExpr(String x0, String x1, CPPExpressions.1 x2)
  {
    this(x0, x1);
  }
  
  private CPPExpressions$StaticFieldExpr(String containingType, String fieldName)
  {
    this.containingType = containingType;
    this.fieldName = fieldName;
  }
  
  public String getContainingType()
  {
    return containingType;
  }
  
  public String getFieldName()
  {
    return fieldName;
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.utilities.CPPExpressions.StaticFieldExpr
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.utilities;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class CPPExpressions
{
  private static Pattern castPattern;
  
  public static class CastExpr
  {
    private String type;
    private String address;
    
    CastExpr(String x0, String x1, CPPExpressions.1 x2)
    {
      this(x0, x1);
    }
    
    private CastExpr(String type, String address)
    {
      this.type = type;
      this.address = address;
    }
    
    public String getType()
    {
      return type;
    }
    
    public String getAddress()
    {
      return address;
    }
  }
  
  public static class StaticFieldExpr
  {
    private String containingType;
    private String fieldName;
    
    StaticFieldExpr(String x0, String x1, CPPExpressions.1 x2)
    {
      this(x0, x1);
    }
    
    private StaticFieldExpr(String containingType, String fieldName)
    {
      this.containingType = containingType;
      this.fieldName = fieldName;
    }
    
    public String getContainingType()
    {
      return containingType;
    }
    
    public String getFieldName()
    {
      return fieldName;
    }
  }
  
  public static CastExpr parseCast(String expr)
  {
    if (castPattern == null) {
      castPattern = Pattern.compile("\\s*\\(\\s*([0-9A-Za-z:_]*)\\s*\\*\\s*\\)\\s*([0-9a-zA-Z]*)\\s*");
    }
    Matcher matcher = castPattern.matcher(expr);
    if (matcher.matches())
    {
      String type = matcher.group(1);
      String addr = matcher.group(2);
      return new CastExpr(type, addr, null);
    }
    return null;
  }
  
  public static StaticFieldExpr parseStaticField(String expr)
  {
    String sep = "::";
    int idx = expr.lastIndexOf(sep);
    if (idx < 0) {
      return null;
    }
    String containingType = expr.substring(0, idx);
    String fieldName = expr.substring(idx + sep.length(), expr.length());
    return new StaticFieldExpr(containingType, fieldName, null);
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.utilities.CPPExpressions
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.utilities;

import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import sun.jvm.hotspot.debugger.Address;

public class CStringUtilities
{
  public static int getStringLength(Address addr)
  {
    int i = 0;
    while (addr.getCIntegerAt(i, 1L, false) != 0L) {
      i++;
    }
    return i;
  }
  
  private static String encoding = System.getProperty("file.encoding", "US-ASCII");
  
  public static String getString(Address addr)
  {
    if (addr == null) {
      return null;
    }
    List data = new ArrayList();
    byte val = 0;
    long i = 0L;
    do
    {
      val = (byte)(int)addr.getCIntegerAt(i, 1L, false);
      if (val != 0) {
        data.add(new Byte(val));
      }
      i += 1L;
    } while (val != 0);
    byte[] bytes = new byte[data.size()];
    for (i = 0L; i < data.size(); i += 1L) {
      bytes[((int)i)] = ((Byte)data.get((int)i)).byteValue();
    }
    try
    {
      return new String(bytes, encoding);
    }
    catch (UnsupportedEncodingException e)
    {
      throw new RuntimeException("Error converting bytes to String using " + encoding + " encoding", e);
    }
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.utilities.CStringUtilities
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.utilities;

import java.util.ArrayList;
import java.util.List;
import sun.jvm.hotspot.oops.HeapVisitor;
import sun.jvm.hotspot.oops.Klass;
import sun.jvm.hotspot.oops.Oop;

public class FindObjectByType
  implements HeapVisitor
{
  private Klass type;
  private List results = new ArrayList();
  
  public FindObjectByType(Klass type)
  {
    this.type = type;
  }
  
  public List getResults()
  {
    return results;
  }
  
  public void prologue(long size) {}
  
  public void epilogue() {}
  
  public boolean doObj(Oop obj)
  {
    if (obj.getKlass().equals(type)) {
      results.add(obj);
    }
    return false;
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.utilities.FindObjectByType
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.utilities;

import java.util.Observable;
import java.util.Observer;
import sun.jvm.hotspot.runtime.VM;

final class Hashtable$1
  implements Observer
{
  public void update(Observable o, Object data)
  {
    Hashtable.access$000(VM.getVM().getTypeDataBase());
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.utilities.Hashtable.1
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.utilities;

import java.util.Observable;
import java.util.Observer;
import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.runtime.VM;
import sun.jvm.hotspot.types.Type;
import sun.jvm.hotspot.types.TypeDataBase;

public class Hashtable
  extends BasicHashtable
{
  static
  {
    VM.registerVMInitializedObserver(new Observer()
    {
      public void update(Observable o, Object data)
      {
        Hashtable.initialize(VM.getVM().getTypeDataBase());
      }
    });
  }
  
  private static synchronized void initialize(TypeDataBase db)
  {
    Type type = db.lookupType("Hashtable");
  }
  
  protected Class getHashtableEntryClass()
  {
    return HashtableEntry.class;
  }
  
  public int hashToIndex(long fullHash)
  {
    return (int)(fullHash % tableSize());
  }
  
  public Hashtable(Address addr)
  {
    super(addr);
  }
  
  protected static long hashSymbol(byte[] buf)
  {
    long h = 0L;
    int s = 0;
    int len = buf.length;
    while (len-- > 0)
    {
      h = 31L * h + (0xFF & buf[s]);
      s++;
    }
    return h & 0xFFFFFFFF;
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.utilities.Hashtable
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.utilities;

import java.util.Observable;
import java.util.Observer;
import sun.jvm.hotspot.runtime.VM;

final class HashtableBucket$1
  implements Observer
{
  public void update(Observable o, Object data)
  {
    HashtableBucket.access$000(VM.getVM().getTypeDataBase());
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.utilities.HashtableBucket.1
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.utilities;

import java.util.Observable;
import java.util.Observer;
import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.runtime.VM;
import sun.jvm.hotspot.runtime.VMObject;
import sun.jvm.hotspot.runtime.VMObjectFactory;
import sun.jvm.hotspot.types.AddressField;
import sun.jvm.hotspot.types.Type;
import sun.jvm.hotspot.types.TypeDataBase;

public class HashtableBucket
  extends VMObject
{
  private static AddressField entryField;
  
  static
  {
    VM.registerVMInitializedObserver(new Observer()
    {
      public void update(Observable o, Object data)
      {
        HashtableBucket.initialize(VM.getVM().getTypeDataBase());
      }
    });
  }
  
  private static synchronized void initialize(TypeDataBase db)
  {
    Type type = db.lookupType("HashtableBucket");
    entryField = type.getAddressField("_entry");
  }
  
  public BasicHashtableEntry getEntry(Class clazz)
  {
    Address tmp = entryField.getValue(addr);
    return (BasicHashtableEntry)VMObjectFactory.newObject(clazz, tmp);
  }
  
  public BasicHashtableEntry entry()
  {
    return getEntry(HashtableEntry.class);
  }
  
  public HashtableBucket(Address addr)
  {
    super(addr);
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.utilities.HashtableBucket
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.utilities;

import java.util.Observable;
import java.util.Observer;
import sun.jvm.hotspot.runtime.VM;

final class HashtableEntry$1
  implements Observer
{
  public void update(Observable o, Object data)
  {
    HashtableEntry.access$000(VM.getVM().getTypeDataBase());
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.utilities.HashtableEntry.1
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.utilities;

import java.util.Observable;
import java.util.Observer;
import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.oops.ObjectHeap;
import sun.jvm.hotspot.oops.Oop;
import sun.jvm.hotspot.runtime.VM;
import sun.jvm.hotspot.types.OopField;
import sun.jvm.hotspot.types.Type;
import sun.jvm.hotspot.types.TypeDataBase;

public class HashtableEntry
  extends BasicHashtableEntry
{
  private static OopField literalField;
  
  static
  {
    VM.registerVMInitializedObserver(new Observer()
    {
      public void update(Observable o, Object data)
      {
        HashtableEntry.initialize(VM.getVM().getTypeDataBase());
      }
    });
  }
  
  private static synchronized void initialize(TypeDataBase db)
  {
    Type type = db.lookupType("HashtableEntry");
    literalField = type.getOopField("_literal");
  }
  
  public Oop literal()
  {
    return VM.getVM().getObjectHeap().newOop(literalField.getValue(addr));
  }
  
  public HashtableEntry(Address addr)
  {
    super(addr);
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.utilities.HashtableEntry
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.utilities;

import java.io.IOException;

public abstract interface HeapGraphWriter
{
  public abstract void write(String paramString)
    throws IOException;
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.utilities.HeapGraphWriter
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.utilities;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import sun.jvm.hotspot.oops.Array;
import sun.jvm.hotspot.oops.BooleanField;
import sun.jvm.hotspot.oops.ByteField;
import sun.jvm.hotspot.oops.CharField;
import sun.jvm.hotspot.oops.DoubleField;
import sun.jvm.hotspot.oops.Field;
import sun.jvm.hotspot.oops.FieldIdentifier;
import sun.jvm.hotspot.oops.FloatField;
import sun.jvm.hotspot.oops.Instance;
import sun.jvm.hotspot.oops.InstanceKlass;
import sun.jvm.hotspot.oops.IntField;
import sun.jvm.hotspot.oops.Klass;
import sun.jvm.hotspot.oops.LongField;
import sun.jvm.hotspot.oops.ObjArray;
import sun.jvm.hotspot.oops.Oop;
import sun.jvm.hotspot.oops.OopField;
import sun.jvm.hotspot.oops.OopUtilities;
import sun.jvm.hotspot.oops.ShortField;
import sun.jvm.hotspot.oops.Symbol;
import sun.jvm.hotspot.oops.TypeArray;
import sun.jvm.hotspot.oops.TypeArrayKlass;
import sun.jvm.hotspot.runtime.VM;

public class HeapGXLWriter
  extends AbstractHeapGraphWriter
{
  private static final String ENCODING = "UTF-8";
  private List refFields;
  private boolean isArray;
  private PrintWriter out;
  
  public void write(String fileName)
    throws IOException
  {
    out = new PrintWriter(new BufferedWriter(new FileWriter(fileName)));
    super.write();
    if (out.checkError()) {
      throw new IOException();
    }
    out.flush();
  }
  
  protected void writeHeapHeader()
    throws IOException
  {
    out.print("<?xml version='1.0' encoding='");
    out.print("UTF-8");
    out.println("'?>");
    
    out.println("<gxl>");
    out.println("<graph id='JavaHeap'>");
    
    writeAttribute("creation-date", "string", new Date().toString());
    
    writeVMInfo();
    
    out.print("<node id='");
    out.print(getID(null));
    out.println("'/>");
  }
  
  protected void writeObjectHeader(Oop oop)
    throws IOException
  {
    refFields = new ArrayList();
    isArray = oop.isArray();
    
    writeEdge(oop, oop.getKlass().getJavaMirror(), "instanceof");
    
    out.print("<node id='");
    out.print(getID(oop));
    out.println("'>");
  }
  
  protected void writeObjectFooter(Oop oop)
    throws IOException
  {
    out.println("</node>");
    for (Iterator itr = refFields.iterator(); itr.hasNext();)
    {
      OopField field = (OopField)itr.next();
      Oop ref = field.getValue(oop);
      
      String name = field.getID().getName();
      if (isArray) {
        name = "element" + name;
      } else {
        name = identifierToXMLName(name);
      }
      writeEdge(oop, ref, name);
    }
    refFields = null;
  }
  
  protected void writeObjectArray(ObjArray array)
    throws IOException
  {
    writeObjectHeader(array);
    writeArrayLength(array);
    writeObjectFields(array);
    writeObjectFooter(array);
  }
  
  protected void writePrimitiveArray(TypeArray array)
    throws IOException
  {
    writeObjectHeader(array);
    
    writeArrayLength(array);
    
    out.println("\t<attr name='elements'>");
    TypeArrayKlass klass = (TypeArrayKlass)array.getKlass();
    if (klass.getElementType() == 5)
    {
      out.print("\t<string>");
      out.print(escapeXMLChars(OopUtilities.charArrayToString(array)));
      out.println("</string>");
    }
    else
    {
      out.println("\t<seq>");
      writeObjectFields(array);
      out.println("\t</seq>");
    }
    out.println("\t</attr>");
    writeObjectFooter(array);
  }
  
  protected void writeClass(Instance instance)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2019. Infinite Loop Ltd