sa-jdi

"tableswitch");
    buf.append(" ");
    buf.append("default: ");
    buf.append(Integer.toString(bci() + defaultOffset()));
    buf.append(", ");
    int lo = lowKey();
    int hi = highKey();
    int i = hi - lo - 1;
    while (i-- > 0)
    {
      buf.append("case ");
      buf.append(Integer.toString(lo + i));
      buf.append(':');
      buf.append(Integer.toString(bci() + destOffsetAt(i)));
      buf.append(", ");
    }
    return buf.toString();
  }
}

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

import sun.jvm.hotspot.oops.Method;

public abstract interface BytecodeVisitor
{
  public abstract void prologue(Method paramMethod);
  
  public abstract void visit(Bytecode paramBytecode);
  
  public abstract void epilogue();
}

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

import sun.jvm.hotspot.oops.Method;

public abstract class BytecodeWideable
  extends Bytecode
{
  BytecodeWideable(Method method, int bci)
  {
    super(method, bci);
  }
  
  public boolean isWide()
  {
    int prevBci = bci() - 1;
    return (prevBci > -1) && (method.getBytecodeOrBPAt(prevBci) == 196);
  }
  
  public int getLocalVarIndex()
  {
    return isWide() ? 0xFFFF & javaShortAt(1) : 0xFF & javaByteAt(1);
  }
}

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

import sun.jvm.hotspot.oops.ConstantPool;
import sun.jvm.hotspot.oops.ConstantPoolCache;
import sun.jvm.hotspot.oops.ConstantPoolCacheEntry;
import sun.jvm.hotspot.oops.Method;
import sun.jvm.hotspot.runtime.Bytes;
import sun.jvm.hotspot.runtime.VM;

public abstract class BytecodeWithCPIndex
  extends Bytecode
{
  BytecodeWithCPIndex(Method method, int bci)
  {
    super(method, bci);
  }
  
  public int index()
  {
    return 0xFFFF & javaShortAt(1);
  }
  
  public int getSecondaryIndex()
  {
    throw new IllegalArgumentException("must be invokedynamic");
  }
  
  protected int indexForFieldOrMethod()
  {
    ConstantPoolCache cpCache = method().getConstants().getCache();
    
    int cpCacheIndex = index();
    if (cpCache == null) {
      return cpCacheIndex;
    }
    if (code() == 186)
    {
      int secondaryIndex = getSecondaryIndex();
      return cpCache.getMainEntryAt(secondaryIndex).getConstantPoolIndex();
    }
    return cpCache.getEntryAt(0xFFFF & VM.getVM().getBytes().swapShort((short)cpCacheIndex)).getConstantPoolIndex();
  }
}

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

import sun.jvm.hotspot.oops.ConstantPool;
import sun.jvm.hotspot.oops.Klass;
import sun.jvm.hotspot.oops.Method;
import sun.jvm.hotspot.oops.Oop;
import sun.jvm.hotspot.oops.Symbol;

public class BytecodeWithKlass
  extends BytecodeWithCPIndex
{
  BytecodeWithKlass(Method method, int bci)
  {
    super(method, bci);
  }
  
  protected Klass getKlass()
  {
    return method().getConstants().getKlassRefAt(index());
  }
  
  public Symbol getClassName()
  {
    Oop obj = method().getConstants().getObjAt(index());
    if ((obj instanceof Symbol)) {
      return (Symbol)obj;
    }
    return ((Klass)obj).getName();
  }
  
  public String toString()
  {
    StringBuffer buf = new StringBuffer();
    buf.append(getJavaBytecodeName());
    buf.append(" ");
    buf.append('#');
    buf.append(Integer.toString(index()));
    buf.append(" ");
    buf.append("[Class ");
    buf.append(getClassName().asString().replace('/', '.'));
    buf.append(']');
    if (code() != javaCode())
    {
      buf.append(" ");
      buf.append('[');
      buf.append(getBytecodeName());
      buf.append(']');
    }
    return buf.toString();
  }
}

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

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

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

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

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

public class Interpreter
{
  private static AddressField codeField;
  
  static
  {
    VM.registerVMInitializedObserver(new Observer()
    {
      public void update(Observable o, Object data)
      {
        Interpreter.initialize(VM.getVM().getTypeDataBase());
      }
    });
  }
  
  private static synchronized void initialize(TypeDataBase db)
  {
    Type type = db.lookupType("AbstractInterpreter");
    
    codeField = type.getAddressField("_code");
  }
  
  public StubQueue getCode()
  {
    Address code = codeField.getValue();
    if (code == null) {
      return null;
    }
    return new StubQueue(code, InterpreterCodelet.class);
  }
  
  public boolean contains(Address pc)
  {
    return getCode().contains(pc);
  }
  
  public InterpreterCodelet getCodeletContaining(Address pc)
  {
    return (InterpreterCodelet)getCode().getStubContaining(pc);
  }
}

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

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

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

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

import java.io.PrintStream;
import java.util.Observable;
import java.util.Observer;
import sun.jvm.hotspot.code.Stub;
import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.runtime.VM;
import sun.jvm.hotspot.types.AddressField;
import sun.jvm.hotspot.types.CIntegerField;
import sun.jvm.hotspot.types.Type;
import sun.jvm.hotspot.types.TypeDataBase;
import sun.jvm.hotspot.utilities.CStringUtilities;

public class InterpreterCodelet
  extends Stub
{
  private static long instanceSize;
  private static CIntegerField sizeField;
  private static AddressField descriptionField;
  private static CIntegerField bytecodeField;
  
  static
  {
    VM.registerVMInitializedObserver(new Observer()
    {
      public void update(Observable o, Object data)
      {
        InterpreterCodelet.initialize(VM.getVM().getTypeDataBase());
      }
    });
  }
  
  private static synchronized void initialize(TypeDataBase db)
  {
    Type type = db.lookupType("InterpreterCodelet");
    
    sizeField = type.getCIntegerField("_size");
    descriptionField = type.getAddressField("_description");
    bytecodeField = type.getCIntegerField("_bytecode");
    
    instanceSize = type.getSize();
  }
  
  public InterpreterCodelet(Address addr)
  {
    super(addr);
  }
  
  public long getSize()
  {
    return sizeField.getValue(addr);
  }
  
  public Address codeBegin()
  {
    return addr.addOffsetTo(instanceSize);
  }
  
  public Address codeEnd()
  {
    return addr.addOffsetTo(getSize());
  }
  
  public long codeSize()
  {
    return codeEnd().minus(codeBegin());
  }
  
  public String getDescription()
  {
    return CStringUtilities.getString(descriptionField.getValue(addr));
  }
  
  public void printOn(PrintStream tty)
  {
    String desc = getDescription();
    if (desc != null) {
      tty.print(desc);
    }
    tty.println(" [" + codeBegin() + ", " + codeEnd() + ")  " + codeSize() + " bytes  ");
  }
  
  public void verify() {}
}

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

import sun.jvm.hotspot.oops.Method;

public class LookupswitchPair
  extends Bytecode
{
  LookupswitchPair(Method method, int bci)
  {
    super(method, bci);
  }
  
  public int match()
  {
    return javaSignedWordAt(0);
  }
  
  public int offset()
  {
    return javaSignedWordAt(4);
  }
}

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

import sun.jvm.hotspot.oops.Method;
import sun.jvm.hotspot.runtime.NativeSignatureIterator;
import sun.jvm.hotspot.utilities.BitMap;

class MaskFillerForNative
  extends NativeSignatureIterator
{
  private BitMap mask;
  private int size;
  
  MaskFillerForNative(Method method, BitMap mask, int maskSize)
  {
    super(method);
    this.mask = mask;
    size = maskSize;
  }
  
  public void passInt() {}
  
  public void passLong() {}
  
  public void passFloat() {}
  
  public void passDouble() {}
  
  public void passObject()
  {
    mask.atPut(offset(), true);
  }
  
  public void generate()
  {
    super.iterate();
  }
}

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

public abstract interface OffsetClosure
{
  public abstract void offsetDo(int paramInt);
}

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

class OopMapCacheEntry$VerifyClosure
  implements OffsetClosure
{
  private OopMapCacheEntry entry;
  private boolean failed;
  
  OopMapCacheEntry$VerifyClosure(OopMapCacheEntry entry)
  {
    this.entry = entry;
  }
  
  public void offsetDo(int offset)
  {
    if (!entry.isOop(offset)) {
      failed = true;
    }
  }
  
  boolean failed()
  {
    return failed;
  }
}

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

import sun.jvm.hotspot.oops.CellTypeState;
import sun.jvm.hotspot.oops.CellTypeStateList;
import sun.jvm.hotspot.oops.Method;
import sun.jvm.hotspot.utilities.Assert;
import sun.jvm.hotspot.utilities.BitMap;

public class OopMapCacheEntry
{
  private Method method;
  private int bci;
  private int maskSize;
  private BitMap mask;
  
  public boolean isValue(int offset)
  {
    return !entryAt(offset);
  }
  
  public boolean isOop(int offset)
  {
    return entryAt(offset);
  }
  
  public void iterateOop(OffsetClosure oopClosure)
  {
    int n = numberOfEntries();
    for (int i = 0; i < n; i++) {
      if (entryAt(i)) {
        oopClosure.offsetDo(i);
      }
    }
  }
  
  public void fill(Method method, int bci)
  {
    this.method = method;
    this.bci = bci;
    if (method.isNative())
    {
      fillForNative();
    }
    else
    {
      OopMapForCacheEntry gen = new OopMapForCacheEntry(method, bci, this);
      gen.computeMap();
    }
  }
  
  public void setMask(CellTypeStateList vars, CellTypeStateList stack, int stackTop)
  {
    int maxLocals = (int)method.getMaxLocals();
    int nEntries = maxLocals + stackTop;
    maskSize = nEntries;
    allocateBitMask();
    
    CellTypeStateList curList = vars;
    int listIdx = 0;
    for (int entryIdx = 0; entryIdx < nEntries; listIdx++)
    {
      if (entryIdx == maxLocals)
      {
        curList = stack;
        listIdx = 0;
      }
      CellTypeState cell = curList.get(listIdx);
      if (cell.isReference()) {
        mask.atPut(entryIdx, true);
      }
      entryIdx++;
    }
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(verifyMask(vars, stack, maxLocals, stackTop), "mask could not be verified");
    }
  }
  
  Method method()
  {
    return method;
  }
  
  int bci()
  {
    return bci;
  }
  
  int numberOfEntries()
  {
    return maskSize;
  }
  
  boolean entryAt(int offset)
  {
    return mask.at(offset);
  }
  
  void setEmptyMask()
  {
    mask = null;
  }
  
  void allocateBitMask()
  {
    if (maskSize > 0) {
      mask = new BitMap(maskSize);
    }
  }
  
  void fillForNative()
  {
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(method.isNative(), "method must be native method");
    }
    maskSize = ((int)method.getSizeOfParameters());
    allocateBitMask();
    
    MaskFillerForNative mf = new MaskFillerForNative(method, mask, maskSize);
    mf.generate();
  }
  
  static class VerifyClosure
    implements OffsetClosure
  {
    private OopMapCacheEntry entry;
    private boolean failed;
    
    VerifyClosure(OopMapCacheEntry entry)
    {
      this.entry = entry;
    }
    
    public void offsetDo(int offset)
    {
      if (!entry.isOop(offset)) {
        failed = true;
      }
    }
    
    boolean failed()
    {
      return failed;
    }
  }
  
  boolean verifyMask(CellTypeStateList vars, CellTypeStateList stack, int maxLocals, int stackTop)
  {
    VerifyClosure blk = new VerifyClosure(this);
    iterateOop(blk);
    if (blk.failed()) {
      return false;
    }
    for (int i = 0; i < maxLocals; i++)
    {
      boolean v1 = isOop(i);
      boolean v2 = vars.get(i).isReference();
      if (Assert.ASSERTS_ENABLED) {
        Assert.that(v1 == v2, "locals oop mask generation error");
      }
    }
    for (int j = 0; j < stackTop; j++)
    {
      boolean v1 = isOop(maxLocals + j);
      boolean v2 = stack.get(j).isReference();
      if (Assert.ASSERTS_ENABLED) {
        Assert.that(v1 == v2, "stack oop mask generation error");
      }
    }
    return true;
  }
}

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

import java.util.List;
import sun.jvm.hotspot.oops.CellTypeStateList;
import sun.jvm.hotspot.oops.GenerateOopMap;
import sun.jvm.hotspot.oops.Method;
import sun.jvm.hotspot.utilities.Assert;

class OopMapForCacheEntry
  extends GenerateOopMap
{
  private OopMapCacheEntry entry;
  private int bci;
  private int stackTop;
  
  OopMapForCacheEntry(Method method, int bci, OopMapCacheEntry entry)
  {
    super(method);
    this.entry = entry;
    this.bci = bci;
    stackTop = -1;
  }
  
  public boolean reportResults()
  {
    return false;
  }
  
  public boolean possibleGCPoint(BytecodeStream bcs)
  {
    return false;
  }
  
  public void fillStackmapProlog(int nof_gc_points) {}
  
  public void fillStackmapEpilog() {}
  
  public void fillStackmapForOpcodes(BytecodeStream bcs, CellTypeStateList vars, CellTypeStateList stack, int stackTop)
  {
    if (bcs.bci() == bci)
    {
      entry.setMask(vars, stack, stackTop);
      this.stackTop = stackTop;
    }
  }
  
  public void fillInitVars(List initVars) {}
  
  public void computeMap()
  {
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(!method().isNative(), "cannot compute oop map for native methods");
    }
    if ((method().getCodeSize() == 0L) || (method().getMaxLocals() + method().getMaxStack() == 0L))
    {
      entry.setEmptyMask();
    }
    else
    {
      super.computeMap();
      resultForBasicblock(bci);
    }
  }
  
  public int size()
  {
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(stackTop != -1, "computeMap must be called first");
    }
    return (int)((method().isStatic() ? 0 : 1) + method().getMaxLocals() + stackTop);
  }
}

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

import com.sun.jdi.ArrayReference;
import com.sun.jdi.ClassNotLoadedException;
import com.sun.jdi.InvalidTypeException;
import com.sun.jdi.Value;
import com.sun.jdi.VirtualMachine;
import java.util.ArrayList;
import java.util.List;
import sun.jvm.hotspot.oops.Array;
import sun.jvm.hotspot.oops.ObjArray;
import sun.jvm.hotspot.oops.TypeArray;
import sun.jvm.hotspot.runtime.BasicType;

public class ArrayReferenceImpl
  extends ObjectReferenceImpl
  implements ArrayReference
{
  private int length;
  
  ArrayReferenceImpl(VirtualMachine aVm, Array aRef)
  {
    super(aVm, aRef);
    length = ((int)aRef.getLength());
  }
  
  ArrayTypeImpl arrayType()
  {
    return (ArrayTypeImpl)type();
  }
  
  public int length()
  {
    return length;
  }
  
  public Value getValue(int index)
  {
    List list = getValues(index, 1);
    return (Value)list.get(0);
  }
  
  public List getValues()
  {
    return getValues(0, -1);
  }
  
  private void validateArrayAccess(int index, int len)
  {
    if ((index < 0) || (index > length())) {
      throw new IndexOutOfBoundsException("Invalid array index: " + index);
    }
    if (len < 0) {
      throw new IndexOutOfBoundsException("Invalid array range length: " + len);
    }
    if (index + len > length()) {
      throw new IndexOutOfBoundsException("Invalid array range: " + index + " to " + (index + len - 1));
    }
  }
  
  public List getValues(int index, int len)
  {
    if (len == -1) {
      len = length() - index;
    }
    validateArrayAccess(index, len);
    List vals = new ArrayList();
    if (len == 0) {
      return vals;
    }
    TypeArray typeArray = null;
    ObjArray objArray = null;
    if ((ref() instanceof TypeArray)) {
      typeArray = (TypeArray)ref();
    } else if ((ref() instanceof ObjArray)) {
      objArray = (ObjArray)ref();
    } else {
      throw new RuntimeException("should not reach here");
    }
    char c = arrayType().componentSignature().charAt(0);
    BasicType variableType = BasicType.charToBasicType(c);
    
    int limit = index + len;
    for (int ii = index; ii < limit; ii++)
    {
      ValueImpl valueImpl;
      if (variableType == BasicType.T_BOOLEAN)
      {
        valueImpl = (BooleanValueImpl)vm.mirrorOf(typeArray.getBooleanAt(ii));
      }
      else
      {
        ValueImpl valueImpl;
        if (variableType == BasicType.T_CHAR)
        {
          valueImpl = (CharValueImpl)vm.mirrorOf(typeArray.getCharAt(ii));
        }
        else
        {
          ValueImpl valueImpl;
          if (variableType == BasicType.T_FLOAT)
          {
            valueImpl = (FloatValueImpl)vm.mirrorOf(typeArray.getFloatAt(ii));
          }
          else
          {
            ValueImpl valueImpl;
            if (variableType == BasicType.T_DOUBLE)
            {
              valueImpl = (DoubleValueImpl)vm.mirrorOf(typeArray.getDoubleAt(ii));
            }
            else
            {
              ValueImpl valueImpl;
              if (variableType == BasicType.T_BYTE)
              {
                valueImpl = (ByteValueImpl)vm.mirrorOf(typeArray.getByteAt(ii));
              }
              else
              {
                ValueImpl valueImpl;
                if (variableType == BasicType.T_SHORT)
                {
                  valueImpl = (ShortValueImpl)vm.mirrorOf(typeArray.getShortAt(ii));
                }
                else
                {
                  ValueImpl valueImpl;
                  if (variableType == BasicType.T_INT)
                  {
                    valueImpl = (IntegerValueImpl)vm.mirrorOf(typeArray.getIntAt(ii));
                  }
                  else
                  {
                    ValueImpl valueImpl;
                    if (variableType == BasicType.T_LONG)
                    {
                      valueImpl = (LongValueImpl)vm.mirrorOf(typeArray.getLongAt(ii));
                    }
                    else
                    {
                      ValueImpl valueImpl;
                      if (variableType == BasicType.T_OBJECT)
                      {
                        valueImpl = vm.objectMirror(objArray.getObjAt(ii));
                      }
                      else
                      {
                        ValueImpl valueImpl;
                        if (variableType == BasicType.T_ARRAY) {
                          valueImpl = vm.arrayMirror((Array)objArray.getObjAt(ii));
                        } else {
                          throw new RuntimeException("should not reach here");
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
      ValueImpl valueImpl;
      vals.add(valueImpl);
    }
    return vals;
  }
  
  public void setValue(int index, Value value)
    throws InvalidTypeException, ClassNotLoadedException
  {
    vm.throwNotReadOnlyException("ArrayReference.setValue(...)");
  }
  
  public void setValues(List values)
    throws InvalidTypeException, ClassNotLoadedException
  {
    setValues(0, values, 0, -1);
  }
  
  public void setValues(int index, List values, int srcIndex, int length)
    throws InvalidTypeException, ClassNotLoadedException
  {
    vm.throwNotReadOnlyException("ArrayReference.setValue(...)");
  }
  
  public String toString()
  {
    return "instance of " + arrayType().componentTypeName() + "[" + length() + "] (id=" + uniqueID() + ")";
  }
}

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

import com.sun.jdi.ArrayReference;
import com.sun.jdi.ArrayType;
import com.sun.jdi.ClassLoaderReference;
import com.sun.jdi.ClassNotLoadedException;
import com.sun.jdi.InterfaceType;
import com.sun.jdi.PrimitiveType;
import com.sun.jdi.ReferenceType;
import com.sun.jdi.Type;
import com.sun.jdi.VirtualMachine;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import sun.jvm.hotspot.oops.ArrayKlass;
import sun.jvm.hotspot.oops.Instance;
import sun.jvm.hotspot.oops.InstanceKlass;
import sun.jvm.hotspot.oops.Klass;
import sun.jvm.hotspot.oops.ObjArrayKlass;
import sun.jvm.hotspot.oops.Symbol;
import sun.jvm.hotspot.oops.TypeArrayKlass;

public class ArrayTypeImpl
  extends ReferenceTypeImpl
  implements ArrayType
{
  protected ArrayTypeImpl(VirtualMachine aVm, ArrayKlass aRef)
  {
    super(aVm, aRef);
  }
  
  public ArrayReference newInstance(int length)
  {
    vm.throwNotReadOnlyException("ArrayType.newInstance(int)");
    return null;
  }
  
  public String componentSignature()
  {
    return signature().substring(1);
  }
  
  public String componentTypeName()
  {
    JNITypeParser parser = new JNITypeParser(componentSignature());
    return parser.typeName();
  }
  
  public ClassLoaderReference classLoader()
  {
    if ((ref() instanceof TypeArrayKlass)) {
      return null;
    }
    Klass bottomKlass = ((ObjArrayKlass)ref()).getBottomKlass();
    if ((bottomKlass instanceof TypeArrayKlass)) {
      return null;
    }
    Instance xx = (Instance)((InstanceKlass)bottomKlass).getClassLoader();
    return vm.classLoaderMirror(xx);
  }
  
  void addVisibleMethods(Map methodMap) {}
  
  List getAllMethods()
  {
    return new ArrayList(0);
  }
  
  public Type componentType()
    throws ClassNotLoadedException
  {
    ArrayKlass k = (ArrayKlass)ref();
    if ((k instanceof ObjArrayKlass))
    {
      Klass elementKlass = ((ObjArrayKlass)k).getElementKlass();
      if (elementKlass == null) {
        throw new ClassNotLoadedException(componentSignature());
      }
      return vm.referenceType(elementKlass);
    }
    return vm.primitiveTypeMirror(signature().charAt(1));
  }
  
  static boolean isComponentAssignable(Type destination, Type source)
  {
    if ((source instanceof PrimitiveType)) {
      return source.equals(destination);
    }
    if ((destination instanceof PrimitiveType)) {
      return false;
    }
    ReferenceTypeImpl refSource = (ReferenceTypeImpl)source;
    ReferenceTypeImpl refDestination = (ReferenceTypeImpl)destination;
    
    return refSource.isAssignableTo(refDestination);
  }
  
  boolean isAssignableTo(ReferenceType destType)
  {
    if ((destType instanceof ArrayType)) {
      try
      {
        Type destComponentType = ((ArrayType)destType).componentType();
        return isComponentAssignable(destComponentType, componentType());
      }
      catch (ClassNotLoadedException e)
      {
        return false;
      }
    }
    Symbol typeName = ((ReferenceTypeImpl)destType).typeNameAsSymbol();
    if ((destType instanceof InterfaceType)) {
      return (typeName.equals(vm.javaLangCloneable())) || (typeName.equals(vm.javaIoSerializable()));
    }
    return typeName.equals(vm.javaLangObject());
  }
  
  List inheritedTypes()
  {
    return new ArrayList(0);
  }
  
  int getModifiers()
  {
    try
    {
      Type t = componentType();
      if ((t instanceof PrimitiveType)) {
        return 17;
      }
      ReferenceType rt = (ReferenceType)t;
      return rt.modifiers();
    }
    catch (ClassNotLoadedException cnle)
    {
      cnle.printStackTrace();
    }
    return -1;
  }
  
  public String toString()
  {
    return "array class " + name() + " (" + loaderString() + ")";
  }
  
  public boolean isPrepared()
  {
    return true;
  }
  
  public boolean isVerified()
  {
    return true;
  }
  
  public boolean isInitialized()
  {
    return true;
  }
  
  public boolean failedToInitialize()
  {
    return false;
  }
  
  public boolean isAbstract()
  {
    return false;
  }
  
  public boolean isFinal()
  {
    return true;
  }
}

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

import com.sun.jdi.AbsentInformationException;

class BaseLineInfo
  implements LineInfo
{
  private final int lineNumber;
  private final ReferenceTypeImpl declaringType;
  
  BaseLineInfo(int lineNumber, ReferenceTypeImpl declaringType)
  {
    this.lineNumber = lineNumber;
    this.declaringType = declaringType;
  }
  
  public String liStratum()
  {
    return "Java";
  }
  
  public int liLineNumber()
  {
    return lineNumber;
  }
  
  public String liSourceName()
    throws AbsentInformationException
  {
    return declaringType.baseSourceName();
  }
  
  public String liSourcePath()
    throws AbsentInformationException
  {
    return declaringType.baseSourcePath();
  }
}

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

import com.sun.jdi.BooleanType;
import com.sun.jdi.InvalidTypeException;
import com.sun.jdi.PrimitiveValue;
import com.sun.jdi.VirtualMachine;

public class BooleanTypeImpl
  extends PrimitiveTypeImpl
  implements BooleanType
{
  BooleanTypeImpl(VirtualMachine vm)
  {
    super(vm);
  }
  
  public String signature()
  {
    return "Z";
  }
  
  PrimitiveValue convert(PrimitiveValue value)
    throws InvalidTypeException
  {
    return vm.mirrorOf(((PrimitiveValueImpl)value).checkedBooleanValue());
  }
}

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

import com.sun.jdi.BooleanValue;
import com.sun.jdi.Type;
import com.sun.jdi.VirtualMachine;

public class BooleanValueImpl
  extends PrimitiveValueImpl
  implements BooleanValue
{
  private boolean value;
  
  BooleanValueImpl(VirtualMachine aVm, boolean aValue)
  {
    super(aVm);
    
    value = aValue;
  }
  
  public boolean equals(Object obj)
  {
    if ((obj != null) && ((obj instanceof BooleanValue))) {
      return (value == ((BooleanValue)obj).value()) && (super.equals(obj));
    }
    return false;
  }
  
  public int hashCode()
  {
    return intValue();
  }
  
  public Type type()
  {
    return vm.theBooleanType();
  }
  
  public boolean value()
  {
    return value;
  }
  
  public boolean booleanValue()
  {
    return value;
  }
  
  public byte byteValue()
  {
    return (byte)(value ? 1 : 0);
  }
  
  public char charValue()
  {
    return (char)(value ? 1 : 0);
  }
  
  public short shortValue()
  {
    return (short)(value ? 1 : 0);
  }
  
  public int intValue()
  {
    return value ? 1 : 0;
  }
  
  public long longValue()
  {
    return value ? 1 : 0;
  }
  
  public float floatValue()
  {
    return (float)(value ? 1.0D : 0.0D);
  }
  
  public double doubleValue()
  {
    return value ? 1.0D : 0.0D;
  }
  
  public String toString()
  {
    return "" + value;
  }
}

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

import com.sun.jdi.ByteType;
import com.sun.jdi.InvalidTypeException;
import com.sun.jdi.PrimitiveValue;
import com.sun.jdi.VirtualMachine;

public class ByteTypeImpl
  extends PrimitiveTypeImpl
  implements ByteType
{
  ByteTypeImpl(VirtualMachine vm)
  {
    super(vm);
  }
  
  public String signature()
  {
    return "B";
  }
  
  PrimitiveValue convert(PrimitiveValue value)
    throws InvalidTypeException
  {
    return vm.mirrorOf(((PrimitiveValueImpl)value).checkedByteValue());
  }
}

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

import com.sun.jdi.ByteValue;
import com.sun.jdi.InvalidTypeException;
import com.sun.jdi.Type;
import com.sun.jdi.VirtualMachine;

public class ByteValueImpl
  extends PrimitiveValueImpl
  implements ByteValue
{
  private byte value;
  
  ByteValueImpl(VirtualMachine aVm, byte aValue)
  {
    super(aVm);
    
    value = aValue;
  }
  
  public boolean equals(Object obj)
  {
    if ((obj != null) && ((obj instanceof ByteValue))) {
      return (value == ((ByteValue)obj).value()) && (super.equals(obj));
    }
    return false;
  }
  
  public int hashCode()
  {
    return intValue();
  }
  
  public int compareTo(Object obj)
  {
    byte other = ((ByteValue)obj).value();
    return value() - other;
  }
  
  public Type type()
  {
    return vm.theByteType();
  }
  
  public byte value()
  {
    return value;
  }
  
  public boolean booleanValue()
  {
    return value != 0;
  }
  
  public byte byteValue()
  {
    return value;
  }
  
  public char charValue()
  {
    return (char)value;
  }
  
  public short shortValue()
  {
    return (short)value;
  }
  
  public int intValue()
  {
    return value;
  }
  
  public long longValue()
  {
    return value;
  }
  
  public float floatValue()
  {
    return value;
  }
  
  public double doubleValue()
  {
    return value;
  }
  
  char checkedCharValue()
    throws InvalidTypeException
  {
    if ((value > 65535) || (value < 0)) {
      throw new InvalidTypeException("Can't convert " + value + " to char");
    }
    return super.checkedCharValue();
  }
  
  public String toString()
  {
    return "" + value;
  }
}

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

import com.sun.jdi.CharType;
import com.sun.jdi.InvalidTypeException;
import com.sun.jdi.PrimitiveValue;
import com.sun.jdi.VirtualMachine;

public class CharTypeImpl
  extends PrimitiveTypeImpl
  implements CharType
{
  CharTypeImpl(VirtualMachine vm)
  {
    super(vm);
  }
  
  public String signature()
  {
    return "C";
  }
  
  PrimitiveValue convert(PrimitiveValue value)
    throws InvalidTypeException
  {
    return vm.mirrorOf(((PrimitiveValueImpl)value).checkedCharValue());
  }
}

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

import com.sun.jdi.CharValue;
import com.sun.jdi.InvalidTypeException;
import com.sun.jdi.Type;
import com.sun.jdi.VirtualMachine;

public class CharValueImpl
  extends PrimitiveValueImpl
  implements CharValue
{
  private char value;
  
  CharValueImpl(VirtualMachine aVm, char aValue)
  {
    super(aVm);
    
    value = aValue;
  }
  
  public boolean equals(Object obj)
  {
    if ((obj != null) && ((obj instanceof CharValue))) {
      return (value == ((CharValue)obj).value()) && (super.equals(obj));
    }
    return false;
  }
  
  public int hashCode()
  {
    return intValue();
  }
  
  public int compareTo(Object obj)
  {
    char other = ((CharValue)obj).value();
    return value() - other;
  }
  
  public Type type()
  {
    return vm.theCharType();
  }
  
  public char value()
  {
    return value;
  }
  
  public boolean booleanValue()
  {
    return value != 0;
  }
  
  public byte byteValue()
  {
    return (byte)value;
  }
  
  public char charValue()
  {
    return value;
  }
  
  public short shortValue()
  {
    return (short)value;
  }
  
  public int intValue()
  {
    return value;
  }
  
  public long longValue()
  {
    return value;
  }
  
  public float floatValue()
  {
    return value;
  }
  
  public double doubleValue()
  {
    return value;
  }
  
  public String toString()
  {
    return "" + value;
  }
  
  byte checkedByteValue()
    throws InvalidTypeException
  {
    if (value > '') {
      throw new InvalidTypeException("Can't convert " + value + " to byte");
    }
    return super.checkedByteValue();
  }
  
  short checkedShortValue()
    throws InvalidTypeException
  {
    if (value > '?') {
      throw new InvalidTypeException("Can't convert " + value + " to short");
    }
    return super.checkedShortValue();
  }
}

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

import java.util.List;
import sun.jvm.hotspot.memory.SystemDictionary.ClassAndLoaderVisitor;
import sun.jvm.hotspot.oops.Klass;
import sun.jvm.hotspot.oops.Oop;

final class ClassLoaderReferenceImpl$1
  implements SystemDictionary.ClassAndLoaderVisitor
{
  private final ClassLoaderReferenceImpl this$0;
  
  ClassLoaderReferenceImpl$1(ClassLoaderReferenceImpl paramClassLoaderReferenceImpl) {}
  
  public void visit(Klass k, Oop loader)
  {
    if (this$0.ref().equals(loader)) {
      for (Klass l = k; l != null; l = l.arrayKlassOrNull()) {
        ClassLoaderReferenceImpl.access$000(this$0).add(this$0.vm.referenceType(l));
      }
    }
  }
}

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

import java.util.List;
import sun.jvm.hotspot.memory.SystemDictionary.ClassAndLoaderVisitor;
import sun.jvm.hotspot.oops.Klass;
import sun.jvm.hotspot.oops.Oop;

final class ClassLoaderReferenceImpl$2
  implements SystemDictionary.ClassAndLoaderVisitor
{
  private final ClassLoaderReferenceImpl this$0;
  
  ClassLoaderReferenceImpl$2(ClassLoaderReferenceImpl paramClassLoaderReferenceImpl) {}
  
  public void visit(Klass k, Oop loader)
  {
    if (this$0.ref().equals(loader)) {
      ClassLoaderReferenceImpl.access$000(this$0).add(this$0.vm.referenceType(k));
    }
  }
}

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

import java.util.List;
import sun.jvm.hotspot.memory.SystemDictionary.ClassVisitor;
import sun.jvm.hotspot.oops.Klass;

final class ClassLoaderReferenceImpl$3
  implements SystemDictionary.ClassVisitor
{
  private final ClassLoaderReferenceImpl this$0;
  
  ClassLoaderReferenceImpl$3(ClassLoaderReferenceImpl paramClassLoaderReferenceImpl) {}
  
  public void visit(Klass k)
  {
    ClassLoaderReferenceImpl.access$000(this$0).add(this$0.vm.referenceType(k));
  }
}

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

import com.sun.jdi.ClassLoaderReference;
import com.sun.jdi.ClassNotLoadedException;
import com.sun.jdi.ReferenceType;
import com.sun.jdi.Type;
import com.sun.jdi.VirtualMachine;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import sun.jvm.hotspot.memory.SystemDictionary;
import sun.jvm.hotspot.memory.SystemDictionary.ClassAndLoaderVisitor;
import sun.jvm.hotspot.memory.SystemDictionary.ClassVisitor;
import sun.jvm.hotspot.memory.Universe;
import sun.jvm.hotspot.oops.Instance;
import sun.jvm.hotspot.oops.Klass;
import sun.jvm.hotspot.oops.Oop;

public class ClassLoaderReferenceImpl
  extends ObjectReferenceImpl
  implements ClassLoaderReference
{
  private List visibleClassesCache;
  private List definedClassesCache;
  
  ClassLoaderReferenceImpl(VirtualMachine aVm, Instance oRef)
  {
    super(aVm, oRef);
  }
  
  protected String description()
  {
    return "ClassLoaderReference " + uniqueID();
  }
  
  public List definedClasses()
  {
    if (definedClassesCache == null)
    {
      definedClassesCache = new ArrayList();
      Iterator iter = vm.allClasses().iterator();
      while (iter.hasNext())
      {
        ReferenceType type = (ReferenceType)iter.next();
        if (equals(type.classLoader())) {
          definedClassesCache.add(type);
        }
      }
    }
    return definedClassesCache;
  }
  
  private SystemDictionary getSystemDictionary()
  {
    return vm.saSystemDictionary();
  }
  
  private Universe getUniverse()
  {
    return vm.saUniverse();
  }
  
  public List visibleClasses()
  {
    if (visibleClassesCache != null) {
      return visibleClassesCache;
    }
    visibleClassesCache = new ArrayList();
    
    SystemDictionary sysDict = getSystemDictionary();
    sysDict.classesDo(new SystemDictionary.ClassAndLoaderVisitor()
    {
      public void visit(Klass k, Oop loader)
      {
        if (ref().equals(loader)) {
          for (Klass l = k; l != null; l = l.arrayKlassOrNull()) {
            visibleClassesCache.add(vm.referenceType(l));
          }
        }
      }
    });
    sysDict.primArrayClassesDo(new SystemDictionary.ClassAndLoaderVisitor()
    {
      public void visit(Klass k, Oop loader)
      {
        if (ref().equals(loader)) {
          visibleClassesCache.add(vm.referenceType(k));
        }
      }
    });
    getUniverse().basicTypeClassesDo(new SystemDictionary.ClassVisitor()
    {
      public void visit(Klass k)
      {
        visibleClassesCache.add(vm.referenceType(k));
      }
    });
    return visibleClassesCache;
  }
  
  Type findType(String signature)
    throws ClassNotLoadedException
  {
    List types = visibleClasses();
    Iterator iter = types.iterator();
    while (iter.hasNext())
    {
      ReferenceType type = (ReferenceType)iter.next();
      if (type.signature().equals(signature)) {
        return type;
      }
    }
    JNITypeParser parser = new JNITypeParser(signature);
    throw new ClassNotLoadedException(parser.typeName(), "Class " + parser.typeName() + " not loaded");
  }
}

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

import com.sun.jdi.ClassObjectReference;
import com.sun.jdi.ReferenceType;
import com.sun.jdi.VirtualMachine;
import sun.jvm.hotspot.oops.Instance;
import sun.jvm.hotspot.oops.Klass;
import sun.jvm.hotspot.oops.OopUtilities;

public class ClassObjectReferenceImpl
  extends ObjectReferenceImp
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