sa-jdi

  this.obj = obj;
  }
  
  public Oop getObj()
  {
    return obj;
  }
  
  private void printField(Field field)
  {
    field.printOn(tty);
  }
  
  public void doOop(OopField field, boolean isVMField)
  {
    printField(field);
    Oop.printOopValueOn(field.getValue(getObj()), tty);
    tty.println();
  }
  
  public void doOop(NarrowOopField field, boolean isVMField)
  {
    printField(field);
    Oop.printOopValueOn(field.getValue(getObj()), tty);
    tty.println();
  }
  
  public void doChar(CharField field, boolean isVMField)
  {
    printField(field);
    char c = field.getValue(getObj());
    if (Character.isLetterOrDigit(c)) {
      tty.println(c);
    } else {
      tty.println(c);
    }
  }
  
  public void doByte(ByteField field, boolean isVMField)
  {
    printField(field);
    tty.println(field.getValue(getObj()));
  }
  
  public void doBoolean(BooleanField field, boolean isVMField)
  {
    printField(field);
    tty.println(field.getValue(getObj()));
  }
  
  public void doShort(ShortField field, boolean isVMField)
  {
    printField(field);
    tty.println(field.getValue(getObj()));
  }
  
  public void doInt(IntField field, boolean isVMField)
  {
    printField(field);
    tty.println(field.getValue(getObj()));
  }
  
  public void doLong(LongField field, boolean isVMField)
  {
    printField(field);
    tty.println(field.getValue(getObj()));
  }
  
  public void doFloat(FloatField field, boolean isVMField)
  {
    printField(field);
    tty.println(field.getValue(getObj()));
  }
  
  public void doDouble(DoubleField field, boolean isVMField)
  {
    printField(field);
    tty.println(field.getValue(getObj()));
  }
  
  public void doCInt(CIntField field, boolean isVMField)
  {
    printField(field);
    tty.println(field.getValue(getObj()));
  }
}

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

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

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

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

import java.util.Observable;
import java.util.Observer;
import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.debugger.OopHandle;
import sun.jvm.hotspot.jdi.JVMTIThreadState;
import sun.jvm.hotspot.memory.SystemDictionary;
import sun.jvm.hotspot.runtime.JavaThread;
import sun.jvm.hotspot.runtime.Threads;
import sun.jvm.hotspot.runtime.VM;
import sun.jvm.hotspot.types.TypeDataBase;
import sun.jvm.hotspot.utilities.Assert;

public class OopUtilities
  implements JVMTIThreadState
{
  private static IntField offsetField;
  private static IntField countField;
  private static OopField valueField;
  private static OopField threadGroupParentField;
  private static OopField threadGroupNameField;
  private static IntField threadGroupNThreadsField;
  private static OopField threadGroupThreadsField;
  private static IntField threadGroupNGroupsField;
  private static OopField threadGroupGroupsField;
  private static OopField threadNameField;
  private static OopField threadGroupField;
  private static LongField threadEETopField;
  private static IntField threadStatusField;
  private static OopField threadParkBlockerField;
  private static int THREAD_STATUS_NEW;
  private static OopField hcKlassField;
  private static OopField absOwnSyncOwnerThreadField;
  
  static
  {
    VM.registerVMInitializedObserver(new Observer()
    {
      public void update(Observable o, Object data)
      {
        OopUtilities.initialize(VM.getVM().getTypeDataBase());
      }
    });
  }
  
  public static String charArrayToString(TypeArray charArray)
  {
    if (charArray == null) {
      return null;
    }
    return charArrayToString(charArray, 0, (int)charArray.getLength());
  }
  
  public static String charArrayToString(TypeArray charArray, int offset, int length)
  {
    if (charArray == null) {
      return null;
    }
    int limit = offset + length;
    if (Assert.ASSERTS_ENABLED) {
      Assert.that((offset >= 0) && (limit <= charArray.getLength()), "out of bounds");
    }
    StringBuffer buf = new StringBuffer(length);
    for (int i = offset; i < limit; i++) {
      buf.append(charArray.getCharAt(i));
    }
    return buf.toString();
  }
  
  public static String stringOopToString(Oop stringOop)
  {
    if (offsetField == null)
    {
      InstanceKlass k = (InstanceKlass)stringOop.getKlass();
      offsetField = (IntField)k.findField("offset", "I");
      countField = (IntField)k.findField("count", "I");
      valueField = (OopField)k.findField("value", "[C");
      if (Assert.ASSERTS_ENABLED) {
        Assert.that((offsetField != null) && (countField != null) && (valueField != null), "must find all java.lang.String fields");
      }
    }
    return charArrayToString((TypeArray)valueField.getValue(stringOop), offsetField.getValue(stringOop), countField.getValue(stringOop));
  }
  
  private static void initThreadGroupFields()
  {
    if (threadGroupParentField == null)
    {
      SystemDictionary sysDict = VM.getVM().getSystemDictionary();
      InstanceKlass k = SystemDictionary.getThreadGroupKlass();
      threadGroupParentField = (OopField)k.findField("parent", "Ljava/lang/ThreadGroup;");
      threadGroupNameField = (OopField)k.findField("name", "Ljava/lang/String;");
      threadGroupNThreadsField = (IntField)k.findField("nthreads", "I");
      threadGroupThreadsField = (OopField)k.findField("threads", "[Ljava/lang/Thread;");
      threadGroupNGroupsField = (IntField)k.findField("ngroups", "I");
      threadGroupGroupsField = (OopField)k.findField("groups", "[Ljava/lang/ThreadGroup;");
      if (Assert.ASSERTS_ENABLED) {
        Assert.that((threadGroupParentField != null) && (threadGroupNameField != null) && (threadGroupNThreadsField != null) && (threadGroupThreadsField != null) && (threadGroupNGroupsField != null) && (threadGroupGroupsField != null), "must find all java.lang.ThreadGroup fields");
      }
    }
  }
  
  public static Oop threadGroupOopGetParent(Oop threadGroupOop)
  {
    initThreadGroupFields();
    return threadGroupParentField.getValue(threadGroupOop);
  }
  
  public static String threadGroupOopGetName(Oop threadGroupOop)
  {
    initThreadGroupFields();
    return stringOopToString(threadGroupNameField.getValue(threadGroupOop));
  }
  
  public static Oop[] threadGroupOopGetThreads(Oop threadGroupOop)
  {
    initThreadGroupFields();
    int nthreads = threadGroupNThreadsField.getValue(threadGroupOop);
    Oop[] result = new Oop[nthreads];
    ObjArray threads = (ObjArray)threadGroupThreadsField.getValue(threadGroupOop);
    for (int i = 0; i < nthreads; i++) {
      result[i] = threads.getObjAt(i);
    }
    return result;
  }
  
  public static Oop[] threadGroupOopGetGroups(Oop threadGroupOop)
  {
    initThreadGroupFields();
    int ngroups = threadGroupNGroupsField.getValue(threadGroupOop);
    Oop[] result = new Oop[ngroups];
    ObjArray groups = (ObjArray)threadGroupGroupsField.getValue(threadGroupOop);
    for (int i = 0; i < ngroups; i++) {
      result[i] = groups.getObjAt(i);
    }
    return result;
  }
  
  private static void initThreadFields()
  {
    if (threadNameField == null)
    {
      SystemDictionary sysDict = VM.getVM().getSystemDictionary();
      InstanceKlass k = SystemDictionary.getThreadKlass();
      threadNameField = (OopField)k.findField("name", "[C");
      threadGroupField = (OopField)k.findField("group", "Ljava/lang/ThreadGroup;");
      threadEETopField = (LongField)k.findField("eetop", "J");
      threadStatusField = (IntField)k.findField("threadStatus", "I");
      threadParkBlockerField = (OopField)k.findField("parkBlocker", "Ljava/lang/Object;");
      
      TypeDataBase db = VM.getVM().getTypeDataBase();
      THREAD_STATUS_NEW = db.lookupIntConstant("java_lang_Thread::NEW").intValue();
      if (Assert.ASSERTS_ENABLED) {
        Assert.that((threadNameField != null) && (threadGroupField != null) && (threadEETopField != null), "must find all java.lang.Thread fields");
      }
    }
  }
  
  public static Oop threadOopGetThreadGroup(Oop threadOop)
  {
    initThreadFields();
    return threadGroupField.getValue(threadOop);
  }
  
  public static String threadOopGetName(Oop threadOop)
  {
    initThreadFields();
    return charArrayToString((TypeArray)threadNameField.getValue(threadOop));
  }
  
  public static JavaThread threadOopGetJavaThread(Oop threadOop)
  {
    initThreadFields();
    Address addr = threadOop.getHandle().getAddressAt(threadEETopField.getOffset());
    if (addr == null) {
      return null;
    }
    return VM.getVM().getThreads().createJavaThreadWrapper(addr);
  }
  
  public static int threadOopGetThreadStatus(Oop threadOop)
  {
    
    if (threadStatusField != null) {
      return threadStatusField.getValue(threadOop);
    }
    JavaThread thr = threadOopGetJavaThread(threadOop);
    if (thr == null) {
      return THREAD_STATUS_NEW;
    }
    return 1;
  }
  
  public static Oop threadOopGetParkBlocker(Oop threadOop)
  {
    
    if (threadParkBlockerField != null) {
      return threadParkBlockerField.getValue(threadOop);
    }
    return null;
  }
  
  private static void initClassFields()
  {
    if (hcKlassField == null)
    {
      TypeDataBase db = VM.getVM().getTypeDataBase();
      int hcKlassOffset = (int)Instance.getHeaderSize();
      try
      {
        hcKlassOffset += db.lookupIntConstant("java_lang_Class::hc_klass_offset").intValue() * VM.getVM().getHeapOopSize();
      }
      catch (RuntimeException re) {}
      if (VM.getVM().isCompressedOopsEnabled()) {
        hcKlassField = new NarrowOopField(new NamedFieldIdentifier("hc_klass"), hcKlassOffset, true);
      } else {
        hcKlassField = new OopField(new NamedFieldIdentifier("hc_klass"), hcKlassOffset, true);
      }
    }
  }
  
  public static Klass classOopToKlass(Oop aClass)
  {
    initClassFields();
    return (Klass)hcKlassField.getValue(aClass);
  }
  
  private static void initAbsOwnSyncFields()
  {
    if (absOwnSyncOwnerThreadField == null)
    {
      SystemDictionary sysDict = VM.getVM().getSystemDictionary();
      InstanceKlass k = sysDict.getAbstractOwnableSynchronizerKlass();
      absOwnSyncOwnerThreadField = (OopField)k.findField("exclusiveOwnerThread", "Ljava/lang/Thread;");
    }
  }
  
  public static Oop abstractOwnableSynchronizerGetOwnerThread(Oop oop)
  {
    
    if (absOwnSyncOwnerThreadField == null) {
      return null;
    }
    return absOwnSyncOwnerThreadField.getValue(oop);
  }
  
  private static synchronized void initialize(TypeDataBase db) {}
}

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

public abstract interface OopVisitor
{
  public abstract void prologue();
  
  public abstract void epilogue();
  
  public abstract void setObj(Oop paramOop);
  
  public abstract Oop getObj();
  
  public abstract void doOop(OopField paramOopField, boolean paramBoolean);
  
  public abstract void doOop(NarrowOopField paramNarrowOopField, boolean paramBoolean);
  
  public abstract void doByte(ByteField paramByteField, boolean paramBoolean);
  
  public abstract void doChar(CharField paramCharField, boolean paramBoolean);
  
  public abstract void doBoolean(BooleanField paramBooleanField, boolean paramBoolean);
  
  public abstract void doShort(ShortField paramShortField, boolean paramBoolean);
  
  public abstract void doInt(IntField paramIntField, boolean paramBoolean);
  
  public abstract void doLong(LongField paramLongField, boolean paramBoolean);
  
  public abstract void doFloat(FloatField paramFloatField, boolean paramBoolean);
  
  public abstract void doDouble(DoubleField paramDoubleField, boolean paramBoolean);
  
  public abstract void doCInt(CIntField paramCIntField, boolean paramBoolean);
}

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

import sun.jvm.hotspot.runtime.AddressVisitor;

public abstract interface RawHeapVisitor
  extends AddressVisitor
{
  public abstract void prologue(long paramLong);
  
  public abstract void epilogue();
}

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

import sun.jvm.hotspot.debugger.OopHandle;
import sun.jvm.hotspot.types.JShortField;

public class ShortField
  extends Field
{
  public ShortField(FieldIdentifier id, long offset, boolean isVMField)
  {
    super(id, offset, isVMField);
  }
  
  public ShortField(JShortField vmField, long startOffset)
  {
    super(new NamedFieldIdentifier(vmField.getName()), vmField.getOffset(), true);
  }
  
  public ShortField(InstanceKlass holder, int fieldArrayIndex)
  {
    super(holder, fieldArrayIndex);
  }
  
  public short getValue(Oop obj)
  {
    return obj.getHandle().getJShortAt(getOffset());
  }
  
  public void setValue(Oop obj, short value)
    throws MutationException
  {}
}

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

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

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

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

import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.Observable;
import java.util.Observer;
import sun.jvm.hotspot.debugger.OopHandle;
import sun.jvm.hotspot.runtime.VM;
import sun.jvm.hotspot.types.Field;
import sun.jvm.hotspot.types.Type;
import sun.jvm.hotspot.types.TypeDataBase;
import sun.jvm.hotspot.types.WrongTypeException;
import sun.jvm.hotspot.utilities.Assert;

public class Symbol
  extends Oop
{
  private static long baseOffset;
  private static CIntField length;
  
  static
  {
    VM.registerVMInitializedObserver(new Observer()
    {
      public void update(Observable o, Object data)
      {
        Symbol.initialize(VM.getVM().getTypeDataBase());
      }
    });
  }
  
  private static synchronized void initialize(TypeDataBase db)
    throws WrongTypeException
  {
    Type type = db.lookupType("symbolOopDesc");
    length = new CIntField(type.getCIntegerField("_length"), 0L);
    baseOffset = type.getField("_body").getOffset();
  }
  
  Symbol(OopHandle handle, ObjectHeap heap)
  {
    super(handle, heap);
  }
  
  public boolean isSymbol()
  {
    return true;
  }
  
  public long getLength()
  {
    return length.getValue(this);
  }
  
  public byte getByteAt(long index)
  {
    return getHandle().getJByteAt(baseOffset + index);
  }
  
  public boolean equals(byte[] modUTF8Chars)
  {
    int l = (int)getLength();
    if (l != modUTF8Chars.length) {
      return false;
    }
    while (l-- > 0) {
      if (modUTF8Chars[l] != getByteAt(l)) {
        return false;
      }
    }
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(l == -1, "we should be at the beginning");
    }
    return true;
  }
  
  public byte[] asByteArray()
  {
    int length = (int)getLength();
    byte[] result = new byte[length];
    for (int index = 0; index < length; index++) {
      result[index] = getByteAt(index);
    }
    return result;
  }
  
  public String asString()
  {
    try
    {
      return readModifiedUTF8(asByteArray());
    }
    catch (IOException e) {}
    return null;
  }
  
  public boolean startsWith(String str)
  {
    return asString().startsWith(str);
  }
  
  public void printValueOn(PrintStream tty)
  {
    tty.print("#" + asString());
  }
  
  public long getObjectSize()
  {
    return alignObjectSize(baseOffset + getLength());
  }
  
  void iterateFields(OopVisitor visitor, boolean doVMFields)
  {
    super.iterateFields(visitor, doVMFields);
    if (doVMFields)
    {
      visitor.doCInt(length, true);
      int length = (int)getLength();
      for (int index = 0; index < length; index++) {
        visitor.doByte(new ByteField(new IndexableFieldIdentifier(index), baseOffset + index, false), true);
      }
    }
  }
  
  public int fastCompare(Symbol other)
  {
    return (int)getHandle().minus(other.getHandle());
  }
  
  private static String readModifiedUTF8(byte[] buf)
    throws IOException
  {
    int len = buf.length;
    byte[] tmp = new byte[len + 2];
    
    tmp[0] = ((byte)(len >>> 8 & 0xFF));
    tmp[1] = ((byte)(len >>> 0 & 0xFF));
    
    System.arraycopy(buf, 0, tmp, 2, len);
    DataInputStream dis = new DataInputStream(new ByteArrayInputStream(tmp));
    return dis.readUTF();
  }
}

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

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

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

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

import java.io.PrintStream;
import java.util.Observable;
import java.util.Observer;
import sun.jvm.hotspot.debugger.OopHandle;
import sun.jvm.hotspot.runtime.VM;
import sun.jvm.hotspot.types.Type;
import sun.jvm.hotspot.types.TypeDataBase;
import sun.jvm.hotspot.types.WrongTypeException;

public class SymbolKlass
  extends Klass
{
  private static long headerSize;
  
  static
  {
    VM.registerVMInitializedObserver(new Observer()
    {
      public void update(Observable o, Object data)
      {
        SymbolKlass.initialize(VM.getVM().getTypeDataBase());
      }
    });
  }
  
  private static synchronized void initialize(TypeDataBase db)
    throws WrongTypeException
  {
    Type type = db.lookupType("symbolKlass");
    headerSize = type.getSize() + Oop.getHeaderSize();
  }
  
  SymbolKlass(OopHandle handle, ObjectHeap heap)
  {
    super(handle, heap);
  }
  
  public long getObjectSize()
  {
    return alignObjectSize(headerSize);
  }
  
  public void printValueOn(PrintStream tty)
  {
    tty.print("SymbolKlass");
  }
}

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

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

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

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

import java.io.PrintStream;
import java.util.Observable;
import java.util.Observer;
import sun.jvm.hotspot.debugger.OopHandle;
import sun.jvm.hotspot.runtime.BasicType;
import sun.jvm.hotspot.runtime.VM;
import sun.jvm.hotspot.types.Type;
import sun.jvm.hotspot.types.TypeDataBase;
import sun.jvm.hotspot.types.WrongTypeException;

public class TypeArray
  extends Array
{
  static
  {
    VM.registerVMInitializedObserver(new Observer()
    {
      public void update(Observable o, Object data)
      {
        TypeArray.initialize(VM.getVM().getTypeDataBase());
      }
    });
  }
  
  private static synchronized void initialize(TypeDataBase db)
    throws WrongTypeException
  {
    Type type = db.lookupType("typeArrayOopDesc");
  }
  
  TypeArray(OopHandle handle, ObjectHeap heap)
  {
    super(handle, heap);
  }
  
  public boolean isTypeArray()
  {
    return true;
  }
  
  public byte getByteAt(long index)
  {
    long offset = baseOffsetInBytes(BasicType.T_BYTE) + index * getHeap().getByteSize();
    return getHandle().getJByteAt(offset);
  }
  
  public boolean getBooleanAt(long index)
  {
    long offset = baseOffsetInBytes(BasicType.T_BOOLEAN) + index * getHeap().getBooleanSize();
    return getHandle().getJBooleanAt(offset);
  }
  
  public char getCharAt(long index)
  {
    long offset = baseOffsetInBytes(BasicType.T_CHAR) + index * getHeap().getCharSize();
    return getHandle().getJCharAt(offset);
  }
  
  public int getIntAt(long index)
  {
    long offset = baseOffsetInBytes(BasicType.T_INT) + index * getHeap().getIntSize();
    return getHandle().getJIntAt(offset);
  }
  
  public short getShortAt(long index)
  {
    long offset = baseOffsetInBytes(BasicType.T_SHORT) + index * getHeap().getShortSize();
    return getHandle().getJShortAt(offset);
  }
  
  public long getLongAt(long index)
  {
    long offset = baseOffsetInBytes(BasicType.T_LONG) + index * getHeap().getLongSize();
    return getHandle().getJLongAt(offset);
  }
  
  public float getFloatAt(long index)
  {
    long offset = baseOffsetInBytes(BasicType.T_FLOAT) + index * getHeap().getFloatSize();
    return getHandle().getJFloatAt(offset);
  }
  
  public double getDoubleAt(long index)
  {
    long offset = baseOffsetInBytes(BasicType.T_DOUBLE) + index * getHeap().getDoubleSize();
    return getHandle().getJDoubleAt(offset);
  }
  
  public void printValueOn(PrintStream tty)
  {
    TypeArrayKlass klass = (TypeArrayKlass)getKlass();
    tty.print(klass.getTypeName());
  }
  
  public void iterateFields(OopVisitor visitor, boolean doVMFields)
  {
    super.iterateFields(visitor, doVMFields);
    TypeArrayKlass klass = (TypeArrayKlass)getKlass();
    int length = (int)getLength();
    int type = klass.getElementType();
    for (int index = 0; index < length; index++)
    {
      FieldIdentifier id = new IndexableFieldIdentifier(index);
      switch (type)
      {
      case 4: 
        long offset = baseOffsetInBytes(BasicType.T_BOOLEAN) + index * getHeap().getBooleanSize();
        visitor.doBoolean(new BooleanField(id, offset, false), false);
        break;
      case 5: 
        long offset = baseOffsetInBytes(BasicType.T_CHAR) + index * getHeap().getCharSize();
        visitor.doChar(new CharField(id, offset, false), false);
        break;
      case 6: 
        long offset = baseOffsetInBytes(BasicType.T_FLOAT) + index * getHeap().getFloatSize();
        visitor.doFloat(new FloatField(id, offset, false), false);
        break;
      case 7: 
        long offset = baseOffsetInBytes(BasicType.T_DOUBLE) + index * getHeap().getDoubleSize();
        visitor.doDouble(new DoubleField(id, offset, false), false);
        break;
      case 8: 
        long offset = baseOffsetInBytes(BasicType.T_BYTE) + index * getHeap().getByteSize();
        visitor.doByte(new ByteField(id, offset, false), false);
        break;
      case 9: 
        long offset = baseOffsetInBytes(BasicType.T_SHORT) + index * getHeap().getShortSize();
        visitor.doShort(new ShortField(id, offset, false), false);
        break;
      case 10: 
        long offset = baseOffsetInBytes(BasicType.T_INT) + index * getHeap().getIntSize();
        visitor.doInt(new IntField(id, offset, false), false);
        break;
      case 11: 
        long offset = baseOffsetInBytes(BasicType.T_LONG) + index * getHeap().getLongSize();
        visitor.doLong(new LongField(id, offset, false), false);
      }
    }
  }
}

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

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

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

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

import java.io.PrintStream;
import java.util.Observable;
import java.util.Observer;
import sun.jvm.hotspot.debugger.OopHandle;
import sun.jvm.hotspot.runtime.VM;
import sun.jvm.hotspot.types.Type;
import sun.jvm.hotspot.types.TypeDataBase;
import sun.jvm.hotspot.types.WrongTypeException;
import sun.jvm.hotspot.utilities.Assert;

public class TypeArrayKlass
  extends ArrayKlass
{
  private static CIntField maxLength;
  public static final int T_BOOLEAN = 4;
  public static final int T_CHAR = 5;
  public static final int T_FLOAT = 6;
  public static final int T_DOUBLE = 7;
  public static final int T_BYTE = 8;
  public static final int T_SHORT = 9;
  public static final int T_INT = 10;
  public static final int T_LONG = 11;
  
  static
  {
    VM.registerVMInitializedObserver(new Observer()
    {
      public void update(Observable o, Object data)
      {
        TypeArrayKlass.initialize(VM.getVM().getTypeDataBase());
      }
    });
  }
  
  private static synchronized void initialize(TypeDataBase db)
    throws WrongTypeException
  {
    Type t = db.lookupType("typeArrayKlass");
    maxLength = new CIntField(t.getCIntegerField("_max_length"), Oop.getHeaderSize());
  }
  
  TypeArrayKlass(OopHandle handle, ObjectHeap heap)
  {
    super(handle, heap);
  }
  
  public long getMaxLength()
  {
    return maxLength.getValue(this);
  }
  
  public String getTypeName()
  {
    switch (getElementType())
    {
    case 4: 
      return "[Z";
    case 5: 
      return "[C";
    case 6: 
      return "[F";
    case 7: 
      return "[D";
    case 8: 
      return "[B";
    case 9: 
      return "[S";
    case 10: 
      return "[I";
    case 11: 
      return "[J";
    }
    return "Unknown TypeArray";
  }
  
  public String getElementTypeName()
  {
    switch (getElementType())
    {
    case 4: 
      return "boolean";
    case 5: 
      return "char";
    case 6: 
      return "float";
    case 7: 
      return "double";
    case 8: 
      return "byte";
    case 9: 
      return "short";
    case 10: 
      return "int";
    case 11: 
      return "long";
    }
    throw new RuntimeException("should not reach here");
  }
  
  public void printValueOn(PrintStream tty)
  {
    tty.print("TypeArrayKlass for " + getTypeName());
  }
  
  public void iterateFields(OopVisitor visitor, boolean doVMFields)
  {
    super.iterateFields(visitor, doVMFields);
    if (doVMFields) {
      visitor.doCInt(maxLength, true);
    }
  }
  
  public Klass arrayKlassImpl(boolean orNull, int n)
  {
    int dimension = (int)getDimension();
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(dimension <= n, "check order of chain");
    }
    if (dimension == n) {
      return this;
    }
    ObjArrayKlass ak = (ObjArrayKlass)getHigherDimension();
    if (ak == null)
    {
      if (orNull) {
        return null;
      }
      throw new RuntimeException("Can not allocate array klasses in debugging system");
    }
    if (orNull) {
      return ak.arrayKlassOrNull(n);
    }
    return ak.arrayKlass(n);
  }
  
  public Klass arrayKlassImpl(boolean orNull)
  {
    return arrayKlassImpl(orNull, (int)(getDimension() + 1L));
  }
}

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

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

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

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

import java.io.PrintStream;
import java.util.Observable;
import java.util.Observer;
import sun.jvm.hotspot.debugger.OopHandle;
import sun.jvm.hotspot.runtime.VM;
import sun.jvm.hotspot.types.Type;
import sun.jvm.hotspot.types.TypeDataBase;
import sun.jvm.hotspot.types.WrongTypeException;

public class TypeArrayKlassKlass
  extends ArrayKlassKlass
{
  private static long headerSize;
  
  static
  {
    VM.registerVMInitializedObserver(new Observer()
    {
      public void update(Observable o, Object data)
      {
        TypeArrayKlassKlass.initialize(VM.getVM().getTypeDataBase());
      }
    });
  }
  
  private static synchronized void initialize(TypeDataBase db)
    throws WrongTypeException
  {
    Type type = db.lookupType("typeArrayKlassKlass");
    headerSize = type.getSize() + Oop.getHeaderSize();
  }
  
  public TypeArrayKlassKlass(OopHandle handle, ObjectHeap heap)
  {
    super(handle, heap);
  }
  
  public long getObjectSize()
  {
    return alignObjectSize(headerSize);
  }
  
  public void printValueOn(PrintStream tty)
  {
    tty.print("TypeArrayKlassKlass");
  }
}

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

public class UnknownOopException
  extends RuntimeException
{
  public UnknownOopException() {}
  
  public UnknownOopException(String detail)
  {
    super(detail);
  }
}

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

import java.io.PrintStream;
import java.rmi.Naming;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import sun.jvm.hotspot.debugger.DebuggerException;

public class RMIHelper
{
  private static final boolean startRegistry;
  private static int port;
  
  static
  {
    String tmp = System.getProperty("sun.jvm.hotspot.rmi.startRegistry");
    if ((tmp != null) && (tmp.equals("false"))) {
      startRegistry = false;
    } else {
      startRegistry = true;
    }
    port = 1099;
    tmp = System.getProperty("sun.jvm.hotspot.rmi.port");
    if (tmp != null) {
      try
      {
        port = Integer.parseInt(tmp);
      }
      catch (NumberFormatException nfe)
      {
        System.err.println("invalid port supplied, assuming default");
      }
    }
    tmp = System.getProperty("sun.jvm.hotspot.rmi.serverNamePrefix");
  }
  
  private static String serverNamePrefix = tmp != null ? serverNamePrefix : "SARemoteDebugger";
  
  public static void rebind(String uniqueID, Remote object)
    throws DebuggerException
  {
    String name = getName(uniqueID);
    try
    {
      Naming.rebind(name, object);
    }
    catch (RemoteException re)
    {
      if (startRegistry) {
        try
        {
          LocateRegistry.createRegistry(port);
          Naming.rebind(name, object);
        }
        catch (Exception exp)
        {
          throw new DebuggerException(exp);
        }
      } else {
        throw new DebuggerException(re);
      }
    }
    catch (Exception exp)
    {
      throw new DebuggerException(exp);
    }
  }
  
  public static void unbind(String uniqueID)
    throws DebuggerException
  {
    String name = getName(uniqueID);
    try
    {
      Naming.unbind(name);
    }
    catch (Exception exp)
    {
      throw new DebuggerException(exp);
    }
  }
  
  public static Remote lookup(String debugServerID)
    throws DebuggerException
  {
    int index = debugServerID.indexOf('@');
    StringBuffer nameBuf = new StringBuffer("//");
    String uniqueID = null;
    if (index != -1)
    {
      nameBuf.append(debugServerID.substring(index + 1));
      uniqueID = debugServerID.substring(0, index);
    }
    else
    {
      nameBuf.append(debugServerID);
    }
    nameBuf.append('/');
    nameBuf.append(serverNamePrefix);
    if (uniqueID != null)
    {
      nameBuf.append('_');
      nameBuf.append(uniqueID);
    }
    try
    {
      return Naming.lookup(nameBuf.toString());
    }
    catch (Exception exp)
    {
      throw new DebuggerException(exp);
    }
  }
  
  private static String getName(String uniqueID)
  {
    String name = null;
    if (uniqueID != null) {
      name = serverNamePrefix + "_" + uniqueID;
    } else {
      name = serverNamePrefix;
    }
    if (port != 1099) {
      name = "//localhost:" + port + "/" + name;
    }
    return name;
  }
}

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

import sun.jvm.hotspot.debugger.Address;

public abstract interface AddressVisitor
{
  public abstract void visitAddress(Address paramAddress);
  
  public abstract void visitCompOopAddress(Address paramAddress);
}

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

import java.io.PrintStream;
import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.debugger.amd64.AMD64ThreadContext;
import sun.jvm.hotspot.interpreter.Interpreter;
import sun.jvm.hotspot.runtime.Frame;
import sun.jvm.hotspot.runtime.JavaThread;
import sun.jvm.hotspot.runtime.RegisterMap;
import sun.jvm.hotspot.runtime.VM;

public class AMD64CurrentFrameGuess
{
  private AMD64ThreadContext context;
  private JavaThread thread;
  private Address spFound;
  private Address fpFound;
  private Address pcFound;
  private static final boolean DEBUG = System.getProperty("sun.jvm.hotspot.runtime.amd64.AMD64Frame.DEBUG") != null;
  
  public AMD64CurrentFrameGuess(AMD64ThreadContext context, JavaThread thread)
  {
    this.context = context;
    this.thread = thread;
  }
  
  public boolean run(long regionInBytesToSearch)
  {
    Address sp = context.getRegisterAsAddress(20);
    Address pc = context.getRegisterAsAddress(17);
    Address fp = context.getRegisterAsAddress(10);
    if (sp == null)
    {
      if (thread.getLastJavaSP() != null)
      {
        setValues(thread.getLastJavaSP(), thread.getLastJavaFP(), null);
        return true;
      }
      return false;
    }
    Address end = sp.addOffsetTo(regionInBytesToSearch);
    VM vm = VM.getVM();
    
    setValues(null, null, null);
    if (vm.isJavaPCDbg(pc))
    {
      if (vm.isClientCompiler())
      {
        setValues(sp, fp, pc);
        return true;
      }
      if (vm.getInterpreter().contains(pc))
      {
        if (DEBUG) {
          System.out.println("CurrentFrameGuess: choosing interpreter frame: sp = " + sp + ", fp = " + fp + ", pc = " + pc);
        }
        setValues(sp, fp, pc);
        return true;
      }
      for (long offset = 0L; offset < regionInBytesToSearch; offset += vm.getAddressSize()) {
        try
        {
          Address curSP = sp.addOffsetTo(offset);
          Frame frame = new AMD64Frame(curSP, null, pc);
          RegisterMap map = thread.newRegisterMap(false);
          while (frame != null)
          {
            if ((frame.isEntryFrame()) && (frame.entryFrameIsFirst()))
            {
              if (DEBUG) {
                System.out.println("CurrentFrameGuess: Choosing sp = " + curSP + ", pc = " + pc);
              }
              setValues(curSP, null, pc);
              return true;
            }
            frame = frame.sender(map);
          }
        }
        catch (Exception e)
        {
          if (DEBUG) {
            System.out.println("CurrentFrameGuess: Exception " + e + " at offset " + offset);
          }
        }
      }
      return false;
    }
    if (DEBUG) {
      System.out.println("CurrentFrameGuess: choosing last Java frame: sp = " + thread.getLastJavaSP() + ", fp = " + thread.getLastJavaFP());
    }
    if (thread.getLastJavaSP() == null) {
      return false;
    }
    setValues(thread.getLastJavaSP(), thread.getLastJavaFP(), null);
    return true;
  }
  
  public Address getSP()
  {
    return spFound;
  }
  
  public Address getFP()
  {
    return fpFound;
  }
  
  public Address getPC()
  {
    return pcFound;
  }
  
  private void setValues(Address sp, Address fp, Address pc)
  {
    spFound = sp;
    fpFound = fp;
    pcFound = pc;
  }
}

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

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

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

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

import java.io.PrintStream;
import java.util.Observable;
import java.util.Observer;
import sun.jvm.hotspot.code.CodeBlob;
import sun.jvm.hotspot.code.CodeCache;
import sun.jvm.hotspot.code.NMethod;
import sun.jvm.hotspot.compiler.OopMapSet;
import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.debugger.OopHandle;
import sun.jvm.hotspot.interpreter.Interpreter;
import sun.jvm.hotspot.oops.Method;
import sun.jvm.hotspot.oops.ObjectHeap;
import sun.jvm.hotspot.runtime.BasicObjectLock;
import sun.jvm.hotspot.runtime.Frame;
import sun.jvm.hotspot.runtime.JavaCallWrapper;
import sun.jvm.hotspot.runtime.RegisterMap;
import sun.jvm.hotspot.runtime.StubRoutines;
import sun.jvm.hotspot.runtime.VM;
import sun.jvm.hotspot.runtime.VMReg;
import sun.jvm.hotspot.types.TypeDataBase;
import sun.jvm.hotspot.utilities.AddressOps;
import sun.jvm.hotspot.utilities.Assert;

public class AMD64Frame
  extends Frame
{
  private static final boolean DEBUG = System.getProperty("sun.jvm.hotspot.runtime.amd64.AMD64Frame.DEBUG") != null;
  private static final int PC_RETURN_OFFSET = 0;
  private static final int LINK_OFFSET = 0;
  private static final int RETURN_ADDR_OFFSET = 1;
  private static final int SENDER_SP_OFFSET = 2;
  private static final int INTERPRETER_FRAME_MIRROR_OFFSET = 2;
  private static final int INTERPRETER_FRAME_SENDER_SP_OFFSET = -1;
  private static final int INTERPRETER_FRAME_LAST_SP_OFFSET = -2;
  private static final int INTERPRETER_FRAME_METHOD_OFFSET = -3;
  private static int INTERPRETER_FRAME_MDX_OFFSET;
  private static int INTERPRETER_FRAME_CACHE_OFFSET;
  private static int INTERPRETER_FRAME_LOCALS_OFFSET;
  private static int INTERPRETER_FRAME_BCX_OFFSET;
  private static int INTERPRETER_FRAME_INITIAL_SP_OFFSET;
  private static int INTERPRETER_FRAME_MONITOR_BLOCK_TOP_OFFSET;
  private static int INTERPRETER_FRAME_MONITOR_BLOCK_BOTTOM_OFFSET;
  private static final int ENTRY_FRAME_CALL_WRAPPER_OFFSET = -6;
  private static final int NATIVE_FRAME_INITIAL_PARAM_OFFSET = 2;
  Address raw_fp;
  private Address raw_unextendedSP;
  
  static
  {
    VM.registerVMInitializedObserver(new Observer()
    {
      public void update(Observable o, Object data)
      {
        AMD64Frame.initialize(VM.getVM().getTypeDataBase());
      }
    });
  }
  
  private static synchronized void initialize(TypeDataBase db)
  {
    if (VM.getVM().isCore())
    {
      INTERPRETER_FRAME_CACHE_OFFSET = -4;
    }
    else
    {
      INTERPRETER_FRAME_MDX_OFFSET = -4;
      INTERPRETER_FRAME_CACHE_OFFSET = INTERPRETER_FRAME_MDX_OFFSET - 1;
    }
    INTERPRETER_FRAME_LOCALS_OFFSET = INTERPRETER_FRAME_CACHE_OFFSET - 1;
    INTERPRETER_FRAME_BCX_OFFSET = INTERPRETER_FRAME_LOCALS_OFFSET - 1;
    INTERPRETER_FRAME_INITIAL
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