sa-jdi

package sun.jvm.hotspot.runtime;

import java.util.Observable;
import java.util.Observer;

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

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

import java.util.Observable;
import java.util.Observer;
import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.types.JByteField;
import sun.jvm.hotspot.types.JIntField;
import sun.jvm.hotspot.types.JLongField;
import sun.jvm.hotspot.types.Type;
import sun.jvm.hotspot.types.TypeDataBase;

public class PerfDataPrologue
  extends VMObject
{
  private static JIntField magicField;
  private static JByteField byteOrderField;
  private static JByteField majorVersionField;
  private static JByteField minorVersionField;
  private static JByteField accessibleField;
  private static JIntField usedField;
  private static JIntField overflowField;
  private static JLongField modTimeStampField;
  private static JIntField entryOffsetField;
  private static JIntField numEntriesField;
  
  static
  {
    VM.registerVMInitializedObserver(new Observer()
    {
      public void update(Observable o, Object data)
      {
        PerfDataPrologue.initialize(VM.getVM().getTypeDataBase());
      }
    });
  }
  
  private static synchronized void initialize(TypeDataBase db)
  {
    Type type = db.lookupType("PerfDataPrologue");
    magicField = type.getJIntField("magic");
    byteOrderField = type.getJByteField("byte_order");
    majorVersionField = type.getJByteField("major_version");
    minorVersionField = type.getJByteField("minor_version");
    accessibleField = type.getJByteField("accessible");
    usedField = type.getJIntField("used");
    overflowField = type.getJIntField("overflow");
    modTimeStampField = type.getJLongField("mod_time_stamp");
    entryOffsetField = type.getJIntField("entry_offset");
    numEntriesField = type.getJIntField("num_entries");
  }
  
  public PerfDataPrologue(Address addr)
  {
    super(addr);
  }
  
  public int magic()
  {
    return magicField.getValue(addr);
  }
  
  public byte byteOrder()
  {
    return byteOrderField.getValue(addr);
  }
  
  public byte majorVersion()
  {
    return majorVersionField.getValue(addr);
  }
  
  public boolean accessible()
  {
    return accessibleField.getValue(addr) != 0;
  }
  
  public int used()
  {
    return usedField.getValue(addr);
  }
  
  public int overflow()
  {
    return overflowField.getValue(addr);
  }
  
  public long modTimeStamp()
  {
    return modTimeStampField.getValue(addr);
  }
  
  public int entryOffset()
  {
    return entryOffsetField.getValue(addr);
  }
  
  public int numEntries()
  {
    return numEntriesField.getValue(addr);
  }
}

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

import java.util.Observable;
import java.util.Observer;

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

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

public abstract interface PerfMemory$PerfDataEntryVisitor
{
  public abstract boolean visit(PerfDataEntry paramPerfDataEntry);
}

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

import java.util.Observable;
import java.util.Observer;
import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.types.AddressField;
import sun.jvm.hotspot.types.CIntegerField;
import sun.jvm.hotspot.types.JIntField;
import sun.jvm.hotspot.types.Type;
import sun.jvm.hotspot.types.TypeDataBase;

public class PerfMemory
{
  private static AddressField startField;
  private static AddressField endField;
  private static AddressField topField;
  private static CIntegerField capacityField;
  private static AddressField prologueField;
  private static JIntField initializedField;
  
  static
  {
    VM.registerVMInitializedObserver(new Observer()
    {
      public void update(Observable o, Object data)
      {
        PerfMemory.initialize(VM.getVM().getTypeDataBase());
      }
    });
  }
  
  private static synchronized void initialize(TypeDataBase db)
  {
    Type type = db.lookupType("PerfMemory");
    startField = type.getAddressField("_start");
    endField = type.getAddressField("_end");
    topField = type.getAddressField("_top");
    capacityField = type.getCIntegerField("_capacity");
    prologueField = type.getAddressField("_prologue");
    initializedField = type.getJIntField("_initialized");
  }
  
  public static Address start()
  {
    return startField.getValue();
  }
  
  public static Address end()
  {
    return endField.getValue();
  }
  
  public static Address top()
  {
    return topField.getValue();
  }
  
  public static long capacity()
  {
    return capacityField.getValue();
  }
  
  public static boolean initialized()
  {
    return initializedField.getValue() != 0;
  }
  
  public static PerfDataPrologue prologue()
  {
    return (PerfDataPrologue)VMObjectFactory.newObject(PerfDataPrologue.class, prologueField.getValue());
  }
  
  public static boolean contains(Address addr)
  {
    return (start() != null) && (addr.minus(start()) >= 0L) && (end().minus(addr) > 0L);
  }
  
  public static void iterate(PerfDataEntryVisitor visitor)
  {
    PerfDataPrologue header = prologue();
    int off = header.entryOffset();
    int num = header.numEntries();
    Address addr = header.getAddress();
    for (int i = 0; i < num; i++)
    {
      PerfDataEntry pde = (PerfDataEntry)VMObjectFactory.newObject(PerfDataEntry.class, addr.addOffsetTo(off));
      
      off += pde.entryLength();
      if (!visitor.visit(pde)) {
        return;
      }
    }
  }
  
  public static abstract interface PerfDataEntryVisitor
  {
    public abstract boolean visit(PerfDataEntry paramPerfDataEntry);
  }
}

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

public class POSIXSignals
{
  private static String[] signalNames = { "", "SIGHUP", "SIGINT", "SIGQUIT", "SIGILL", "SIGTRAP", "SIGABRT", "SIGEMT", "SIGFPE", "SIGKILL", "SIGBUS", "SIGSEGV", "SIGSYS", "SIGPIPE", "SIGALRM", "SIGTERM", "SIGUSR1", "SIGUSR2", "SIGCHLD", "SIGPWR", "SIGWINCH", "SIGURG", "SIGPOLL", "SIGSTOP", "SIGTSTP", "SIGCONT", "SIGTTIN", "SIGTTOU", "SIGVTALRM", "SIGPROF", "SIGXCPU", "SIGXFSZ", "SIGWAITING", "SIGLWP", "SIGFREEZE", "SIGTHAW", "SIGCANCEL", "SIGLOST" };
  
  public static String getSignalName(int sigNum)
  {
    if ((sigNum <= 0) || (sigNum >= signalNames.length)) {
      return "<Error: Illegal signal number " + sigNum + ">";
    }
    return signalNames[sigNum];
  }
}

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

import java.util.Observable;
import java.util.Observer;

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

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

import java.io.PrintStream;
import java.util.Observable;
import java.util.Observer;
import sun.jvm.hotspot.code.VMRegImpl;
import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.types.Type;
import sun.jvm.hotspot.types.TypeDataBase;
import sun.jvm.hotspot.utilities.Assert;

public abstract class RegisterMap
  implements Cloneable
{
  protected Address[] location;
  protected long[] locationValid;
  protected boolean includeArgumentOops;
  protected JavaThread thread;
  protected boolean updateMap;
  protected static int regCount;
  protected static int locationValidTypeSize;
  protected static int locationValidSize;
  
  static
  {
    VM.registerVMInitializedObserver(new Observer()
    {
      public void update(Observable o, Object data)
      {
        RegisterMap.initialize(VM.getVM().getTypeDataBase());
      }
    });
  }
  
  private static void initialize(TypeDataBase db)
  {
    regCount = db.lookupIntConstant("ConcreteRegisterImpl::number_of_registers").intValue();
    
    locationValidTypeSize = (int)db.lookupType("julong").getSize() * 8;
    locationValidSize = (regCount + locationValidTypeSize - 1) / locationValidTypeSize;
  }
  
  protected RegisterMap(JavaThread thread, boolean updateMap)
  {
    this.thread = thread;
    this.updateMap = updateMap;
    location = new Address[regCount];
    locationValid = new long[locationValidSize];
    clear();
  }
  
  protected RegisterMap(RegisterMap map)
  {
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(map != null, "RegisterMap must be present");
    }
    thread = map.getThread();
    updateMap = map.getUpdateMap();
    includeArgumentOops = map.getIncludeArgumentOops();
    location = new Address[location.length];
    locationValid = new long[locationValid.length];
    initializeFromPD(map);
    if (updateMap) {
      for (int i = 0; i < locationValidSize; i++)
      {
        long bits = !getUpdateMap() ? 0L : locationValid[i];
        locationValid[i] = bits;
        
        int j = i * locationValidTypeSize;
        while (bits != 0L)
        {
          if ((bits & 1L) != 0L)
          {
            if (Assert.ASSERTS_ENABLED) {
              Assert.that((0 <= j) && (j < regCount), "range check");
            }
            location[j] = location[j];
          }
          bits >>>= 1;
          j++;
        }
      }
    }
  }
  
  public RegisterMap copy()
  {
    return (RegisterMap)clone();
  }
  
  public void clear()
  {
    setIncludeArgumentOops(true);
    if (!VM.getVM().isCore()) {
      if (updateMap)
      {
        for (int i = 0; i < locationValid.length; i++) {
          locationValid[i] = 0L;
        }
        clearPD();
      }
      else
      {
        initializePD();
      }
    }
  }
  
  public Address getLocation(VMReg reg)
  {
    int i = reg.getValue();
    int index = i / locationValidTypeSize;
    if (Assert.ASSERTS_ENABLED)
    {
      Assert.that((0 <= i) && (i < regCount), "sanity check");
      Assert.that((0 <= index) && (index < locationValidSize), "sanity check");
    }
    if ((locationValid[index] & 1 << i % locationValidTypeSize) != 0L) {
      return location[i];
    }
    return getLocationPD(reg);
  }
  
  public void setLocation(VMReg reg, Address loc)
  {
    int i = reg.getValue();
    int index = i / locationValidTypeSize;
    if (Assert.ASSERTS_ENABLED)
    {
      Assert.that((0 <= i) && (i < regCount), "sanity check");
      Assert.that((0 <= index) && (index < locationValidSize), "sanity check");
      Assert.that(updateMap, "updating map that does not need updating");
    }
    location[i] = loc;
    locationValid[index] |= 1 << i % locationValidTypeSize;
  }
  
  public boolean getIncludeArgumentOops()
  {
    return includeArgumentOops;
  }
  
  public void setIncludeArgumentOops(boolean f)
  {
    includeArgumentOops = f;
  }
  
  public JavaThread getThread()
  {
    return thread;
  }
  
  public boolean getUpdateMap()
  {
    return updateMap;
  }
  
  public void print()
  {
    printOn(System.out);
  }
  
  public void printOn(PrintStream tty)
  {
    tty.println("Register map");
    for (int i = 0; i < location.length; i++)
    {
      Address src = getLocation(new VMReg(i));
      if (src != null)
      {
        tty.print("  " + VMRegImpl.getRegisterName(i) + " [" + src + "] = ");
        if (src.andWithMask(VM.getVM().getAddressSize() - 1L) != null) {
          tty.print("<misaligned>");
        } else {
          tty.print(src.getAddressAt(0L));
        }
      }
    }
  }
  
  public abstract Object clone();
  
  protected abstract void clearPD();
  
  protected abstract void initializePD();
  
  protected abstract void initializeFromPD(RegisterMap paramRegisterMap);
  
  protected abstract Address getLocationPD(VMReg paramVMReg);
}

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

import sun.jvm.hotspot.oops.Symbol;

public class ResultTypeFinder
  extends SignatureInfo
{
  protected void set(int size, int type)
  {
    if (isReturnType()) {
      this.type = type;
    }
  }
  
  public ResultTypeFinder(Symbol signature)
  {
    super(signature);
  }
}

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

import sun.jvm.hotspot.oops.Symbol;

public class SignatureConverter
  extends SignatureIterator
{
  private StringBuffer buf;
  private boolean first = true;
  
  public SignatureConverter(Symbol sig, StringBuffer buf)
  {
    super(sig);
    this.buf = buf;
  }
  
  public void doBool()
  {
    appendComma();buf.append("boolean");
  }
  
  public void doChar()
  {
    appendComma();buf.append("char");
  }
  
  public void doFloat()
  {
    appendComma();buf.append("float");
  }
  
  public void doDouble()
  {
    appendComma();buf.append("double");
  }
  
  public void doByte()
  {
    appendComma();buf.append("byte");
  }
  
  public void doShort()
  {
    appendComma();buf.append("short");
  }
  
  public void doInt()
  {
    appendComma();buf.append("int");
  }
  
  public void doLong()
  {
    appendComma();buf.append("long");
  }
  
  public void doVoid()
  {
    if (isReturnType())
    {
      appendComma();buf.append("void");
    }
    else
    {
      throw new RuntimeException("Should not reach here");
    }
  }
  
  public void doObject(int begin, int end)
  {
    doObject(begin, end, true);
  }
  
  public void doArray(int begin, int end)
  {
    appendComma();
    int inner = arrayInnerBegin(begin);
    switch (_signature.getByteAt(inner))
    {
    case 66: 
      buf.append("byte"); break;
    case 67: 
      buf.append("char"); break;
    case 68: 
      buf.append("double"); break;
    case 70: 
      buf.append("float"); break;
    case 73: 
      buf.append("int"); break;
    case 74: 
      buf.append("long"); break;
    case 83: 
      buf.append("short"); break;
    case 90: 
      buf.append("boolean"); break;
    case 76: 
      doObject(inner + 1, end, false); break;
    }
    for (int i = 0; i < inner - begin + 1; i++) {
      buf.append("[]");
    }
  }
  
  public void appendComma()
  {
    if (!first) {
      buf.append(", ");
    }
    first = false;
  }
  
  private void doObject(int begin, int end, boolean comma)
  {
    if (comma) {
      appendComma();
    }
    appendSubstring(begin, end - 1);
  }
  
  private void appendSubstring(int begin, int end)
  {
    for (int i = begin; i < end; i++) {
      buf.append((char)(_signature.getByteAt(i) & 0xFF));
    }
  }
  
  private int arrayInnerBegin(int begin)
  {
    while (_signature.getByteAt(begin) == 91) {
      begin++;
    }
    return begin;
  }
}

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

import sun.jvm.hotspot.oops.Symbol;

public abstract class SignatureInfo
  extends SignatureIterator
{
  protected boolean hasIterated;
  protected int size;
  protected int type;
  
  protected void lazyIterate()
  {
    if (!hasIterated)
    {
      iterate();
      hasIterated = true;
    }
  }
  
  protected abstract void set(int paramInt1, int paramInt2);
  
  public void doBool()
  {
    set(BasicTypeSize.getTBooleanSize(), BasicType.getTBoolean());
  }
  
  public void doChar()
  {
    set(BasicTypeSize.getTCharSize(), BasicType.getTChar());
  }
  
  public void doFloat()
  {
    set(BasicTypeSize.getTFloatSize(), BasicType.getTFloat());
  }
  
  public void doDouble()
  {
    set(BasicTypeSize.getTDoubleSize(), BasicType.getTDouble());
  }
  
  public void doByte()
  {
    set(BasicTypeSize.getTByteSize(), BasicType.getTByte());
  }
  
  public void doShort()
  {
    set(BasicTypeSize.getTShortSize(), BasicType.getTShort());
  }
  
  public void doInt()
  {
    set(BasicTypeSize.getTIntSize(), BasicType.getTInt());
  }
  
  public void doLong()
  {
    set(BasicTypeSize.getTLongSize(), BasicType.getTLong());
  }
  
  public void doVoid()
  {
    set(BasicTypeSize.getTVoidSize(), BasicType.getTVoid());
  }
  
  public void doObject(int begin, int end)
  {
    set(BasicTypeSize.getTObjectSize(), BasicType.getTObject());
  }
  
  public void doArray(int begin, int end)
  {
    set(BasicTypeSize.getTArraySize(), BasicType.getTArray());
  }
  
  public SignatureInfo(Symbol signature)
  {
    super(signature);
    
    type = BasicType.getTIllegal();
  }
  
  public int size()
  {
    lazyIterate();return size;
  }
  
  public int type()
  {
    lazyIterate();return type;
  }
}

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

import java.io.PrintStream;
import sun.jvm.hotspot.oops.Symbol;

public abstract class SignatureIterator
{
  protected Symbol _signature;
  protected int _index;
  protected int _parameter_index;
  
  protected void expect(char c)
  {
    if (_signature.getByteAt(_index) != (byte)c) {
      throw new RuntimeException("expecting '" + c + "'");
    }
    _index += 1;
  }
  
  protected void skipOptionalSize()
  {
    byte c = _signature.getByteAt(_index);
    while ((48 <= c) && (c <= 57)) {
      c = _signature.getByteAt(++_index);
    }
  }
  
  protected int parseType()
  {
    switch (_signature.getByteAt(_index))
    {
    case 66: 
      doByte();_index += 1;return BasicTypeSize.getTByteSize();
    case 67: 
      doChar();_index += 1;return BasicTypeSize.getTCharSize();
    case 68: 
      doDouble();_index += 1;return BasicTypeSize.getTDoubleSize();
    case 70: 
      doFloat();_index += 1;return BasicTypeSize.getTFloatSize();
    case 73: 
      doInt();_index += 1;return BasicTypeSize.getTIntSize();
    case 74: 
      doLong();_index += 1;return BasicTypeSize.getTLongSize();
    case 83: 
      doShort();_index += 1;return BasicTypeSize.getTShortSize();
    case 90: 
      doBool();_index += 1;return BasicTypeSize.getTBooleanSize();
    case 86: 
      if (!isReturnType()) {
        throw new RuntimeException("illegal parameter type V (void)");
      }
      doVoid();_index += 1;
      return BasicTypeSize.getTVoidSize();
    case 76: 
      int begin = ++_index;
      while (_signature.getByteAt(_index++) != 59) {}
      doObject(begin, _index);
      return BasicTypeSize.getTObjectSize();
    case 91: 
      int begin = ++_index;
      skipOptionalSize();
      while (_signature.getByteAt(_index) == 91)
      {
        _index += 1;
        skipOptionalSize();
      }
      if (_signature.getByteAt(_index) == 76) {
        while (_signature.getByteAt(_index++) != 59) {}
      }
      _index += 1;
      
      doArray(begin, _index);
      return BasicTypeSize.getTArraySize();
    }
    throw new RuntimeException("Should not reach here: char " + (char)_signature.getByteAt(_index) + " @ " + _index + " in " + _signature.asString());
  }
  
  protected void checkSignatureEnd()
  {
    if (_index < _signature.getLength())
    {
      System.err.println("too many chars in signature");
      _signature.printValueOn(System.err);
      System.err.println(" @ " + _index);
    }
  }
  
  public SignatureIterator(Symbol signature)
  {
    _signature = signature;
    _parameter_index = 0;
  }
  
  public void dispatchField()
  {
    _index = 0;
    _parameter_index = 0;
    parseType();
    checkSignatureEnd();
  }
  
  public void iterateParameters()
  {
    _index = 0;
    _parameter_index = 0;
    expect('(');
    while (_signature.getByteAt(_index) != 41) {
      _parameter_index += parseType();
    }
    expect(')');
    _parameter_index = 0;
  }
  
  public void iterateReturntype()
  {
    _index = 0;
    expect('(');
    while (_signature.getByteAt(_index) != 41) {
      _index += 1;
    }
    expect(')');
    
    _parameter_index = -1;
    parseType();
    checkSignatureEnd();
    _parameter_index = 0;
  }
  
  public void iterate()
  {
    _index = 0;
    _parameter_index = 0;
    expect('(');
    while (_signature.getByteAt(_index) != 41) {
      _parameter_index += parseType();
    }
    expect(')');
    
    _parameter_index = -1;
    parseType();
    checkSignatureEnd();
    _parameter_index = 0;
  }
  
  public int parameterIndex()
  {
    return _parameter_index;
  }
  
  public boolean isReturnType()
  {
    return parameterIndex() < 0;
  }
  
  public abstract void doBool();
  
  public abstract void doChar();
  
  public abstract void doFloat();
  
  public abstract void doDouble();
  
  public abstract void doByte();
  
  public abstract void doShort();
  
  public abstract void doInt();
  
  public abstract void doLong();
  
  public abstract void doVoid();
  
  public abstract void doObject(int paramInt1, int paramInt2);
  
  public abstract void doArray(int paramInt1, int paramInt2);
}

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

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

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

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

import java.io.PrintStream;
import java.util.Observable;
import java.util.Observer;
import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.debugger.JVMDebugger;
import sun.jvm.hotspot.debugger.ThreadProxy;
import sun.jvm.hotspot.debugger.amd64.AMD64ThreadContext;
import sun.jvm.hotspot.runtime.Frame;
import sun.jvm.hotspot.runtime.JavaThread;
import sun.jvm.hotspot.runtime.JavaThreadPDAccess;
import sun.jvm.hotspot.runtime.RegisterMap;
import sun.jvm.hotspot.runtime.VM;
import sun.jvm.hotspot.runtime.amd64.AMD64CurrentFrameGuess;
import sun.jvm.hotspot.runtime.amd64.AMD64Frame;
import sun.jvm.hotspot.runtime.amd64.AMD64RegisterMap;
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 SolarisAMD64JavaThreadPDAccess
  implements JavaThreadPDAccess
{
  private static AddressField lastJavaFPField;
  private static AddressField osThreadField;
  private static AddressField baseOfStackPointerField;
  private static CIntegerField osThreadThreadIDField;
  private static final long GUESS_SCAN_RANGE = 131072L;
  
  static
  {
    VM.registerVMInitializedObserver(new Observer()
    {
      public void update(Observable o, Object data)
      {
        SolarisAMD64JavaThreadPDAccess.initialize(VM.getVM().getTypeDataBase());
      }
    });
  }
  
  private static synchronized void initialize(TypeDataBase db)
  {
    Type type = db.lookupType("JavaThread");
    Type anchorType = db.lookupType("JavaFrameAnchor");
    
    lastJavaFPField = anchorType.getAddressField("_last_Java_fp");
    osThreadField = type.getAddressField("_osthread");
    
    type = db.lookupType("OSThread");
    osThreadThreadIDField = type.getCIntegerField("_thread_id");
  }
  
  public Address getLastJavaFP(Address addr)
  {
    return lastJavaFPField.getValue(addr.addOffsetTo(JavaThread.getAnchorField().getOffset()));
  }
  
  public Address getLastJavaPC(Address addr)
  {
    return null;
  }
  
  public Address getBaseOfStackPointer(Address addr)
  {
    return null;
  }
  
  public Frame getLastFramePD(JavaThread thread, Address addr)
  {
    Address fp = thread.getLastJavaFP();
    if (fp == null) {
      return null;
    }
    Address pc = thread.getLastJavaPC();
    if (pc != null) {
      return new AMD64Frame(thread.getLastJavaSP(), fp, pc);
    }
    return new AMD64Frame(thread.getLastJavaSP(), fp);
  }
  
  public RegisterMap newRegisterMap(JavaThread thread, boolean updateMap)
  {
    return new AMD64RegisterMap(thread, updateMap);
  }
  
  public Frame getCurrentFrameGuess(JavaThread thread, Address addr)
  {
    ThreadProxy t = getThreadProxy(addr);
    AMD64ThreadContext context = (AMD64ThreadContext)t.getContext();
    AMD64CurrentFrameGuess guesser = new AMD64CurrentFrameGuess(context, thread);
    if (!guesser.run(131072L)) {
      return null;
    }
    if (guesser.getPC() == null) {
      return new AMD64Frame(guesser.getSP(), guesser.getFP());
    }
    return new AMD64Frame(guesser.getSP(), guesser.getFP(), guesser.getPC());
  }
  
  public void printThreadIDOn(Address addr, PrintStream tty)
  {
    tty.print(getThreadProxy(addr));
  }
  
  public Address getLastSP(Address addr)
  {
    ThreadProxy t = getThreadProxy(addr);
    AMD64ThreadContext context = (AMD64ThreadContext)t.getContext();
    return context.getRegisterAsAddress(20);
  }
  
  public ThreadProxy getThreadProxy(Address addr)
  {
    Address osThreadAddr = osThreadField.getValue(addr);
    
    Address tidAddr = osThreadAddr.addOffsetTo(osThreadThreadIDField.getOffset());
    
    JVMDebugger debugger = VM.getVM().getDebugger();
    return debugger.getThreadForIdentifierAddress(tidAddr);
  }
  
  public void printInfoOn(Address threadAddr, PrintStream tty) {}
}

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

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

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

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

import java.io.PrintStream;
import java.util.Observable;
import java.util.Observer;
import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.debugger.JVMDebugger;
import sun.jvm.hotspot.debugger.ThreadProxy;
import sun.jvm.hotspot.debugger.sparc.SPARCThreadContext;
import sun.jvm.hotspot.runtime.Frame;
import sun.jvm.hotspot.runtime.JavaThread;
import sun.jvm.hotspot.runtime.JavaThreadPDAccess;
import sun.jvm.hotspot.runtime.RegisterMap;
import sun.jvm.hotspot.runtime.VM;
import sun.jvm.hotspot.runtime.sparc.SPARCFrame;
import sun.jvm.hotspot.runtime.sparc.SPARCRegisterMap;
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 SolarisSPARCJavaThreadPDAccess
  implements JavaThreadPDAccess
{
  private static AddressField baseOfStackPointerField;
  private static AddressField postJavaStateField;
  private static AddressField osThreadField;
  private static int isPC;
  private static int hasFlushed;
  private static CIntegerField osThreadThreadIDField;
  
  static
  {
    VM.registerVMInitializedObserver(new Observer()
    {
      public void update(Observable o, Object data)
      {
        SolarisSPARCJavaThreadPDAccess.initialize(VM.getVM().getTypeDataBase());
      }
    });
  }
  
  private static synchronized void initialize(TypeDataBase db)
  {
    Type type = db.lookupType("JavaThread");
    Type anchorType = db.lookupType("JavaFrameAnchor");
    
    baseOfStackPointerField = type.getAddressField("_base_of_stack_pointer");
    osThreadField = type.getAddressField("_osthread");
    hasFlushed = db.lookupIntConstant("JavaFrameAnchor::flushed").intValue();
    
    type = db.lookupType("OSThread");
    osThreadThreadIDField = type.getCIntegerField("_thread_id");
  }
  
  public Address getLastJavaFP(Address addr)
  {
    return null;
  }
  
  public Address getLastJavaPC(Address addr)
  {
    return null;
  }
  
  public Address getBaseOfStackPointer(Address addr)
  {
    return baseOfStackPointerField.getValue(addr);
  }
  
  public Frame getLastFramePD(JavaThread thread, Address addr)
  {
    if (thread.getLastJavaSP() == null) {
      return null;
    }
    if (thread.getLastJavaPC() != null) {
      return new SPARCFrame(SPARCFrame.biasSP(thread.getLastJavaSP()), thread.getLastJavaPC());
    }
    Frame top = getCurrentFrameGuess(thread, addr);
    return new SPARCFrame(SPARCFrame.biasSP(thread.getLastJavaSP()), SPARCFrame.biasSP(SPARCFrame.findYoungerSP(top.getSP(), thread.getLastJavaSP())), false);
  }
  
  public RegisterMap newRegisterMap(JavaThread thread, boolean updateMap)
  {
    return new SPARCRegisterMap(thread, updateMap);
  }
  
  public Frame getCurrentFrameGuess(JavaThread thread, Address addr)
  {
    if ((thread.getLastJavaSP() != null) && (thread.getLastJavaPC() != null)) {
      return new SPARCFrame(SPARCFrame.biasSP(thread.getLastJavaSP()), thread.getLastJavaPC());
    }
    ThreadProxy t = getThreadProxy(addr);
    SPARCThreadContext context = (SPARCThreadContext)t.getContext();
    
    Address sp = context.getRegisterAsAddress(14);
    Address pc = context.getRegisterAsAddress(33);
    if ((sp == null) || (pc == null)) {
      return null;
    }
    return new SPARCFrame(sp, pc);
  }
  
  public void printThreadIDOn(Address addr, PrintStream tty)
  {
    tty.print(getThreadProxy(addr));
  }
  
  public Address getLastSP(Address addr)
  {
    ThreadProxy t = getThreadProxy(addr);
    SPARCThreadContext context = (SPARCThreadContext)t.getContext();
    return SPARCFrame.unBiasSP(context.getRegisterAsAddress(14));
  }
  
  public ThreadProxy getThreadProxy(Address addr)
  {
    Address osThreadAddr = osThreadField.getValue(addr);
    
    Address tidAddr = osThreadAddr.addOffsetTo(osThreadThreadIDField.getOffset());
    
    JVMDebugger debugger = VM.getVM().getDebugger();
    return debugger.getThreadForIdentifierAddress(tidAddr);
  }
  
  public void printInfoOn(Address threadAddr, PrintStream tty) {}
}

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

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

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

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

import java.io.PrintStream;
import java.util.Observable;
import java.util.Observer;
import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.debugger.JVMDebugger;
import sun.jvm.hotspot.debugger.ThreadProxy;
import sun.jvm.hotspot.debugger.x86.X86ThreadContext;
import sun.jvm.hotspot.runtime.Frame;
import sun.jvm.hotspot.runtime.JavaThread;
import sun.jvm.hotspot.runtime.JavaThreadPDAccess;
import sun.jvm.hotspot.runtime.RegisterMap;
import sun.jvm.hotspot.runtime.VM;
import sun.jvm.hotspot.runtime.x86.X86CurrentFrameGuess;
import sun.jvm.hotspot.runtime.x86.X86Frame;
import sun.jvm.hotspot.runtime.x86.X86RegisterMap;
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 SolarisX86JavaThreadPDAccess
  implements JavaThreadPDAccess
{
  private static AddressField lastJavaFPField;
  private static AddressField osThreadField;
  private static AddressField baseOfStackPointerField;
  private static CIntegerField osThreadThreadIDField;
  private static final long GUESS_SCAN_RANGE = 131072L;
  
  static
  {
    VM.registerVMInitializedObserver(new Observer()
    {
      public void update(Observable o, Object data)
      {
        SolarisX86JavaThreadPDAccess.initialize(VM.getVM().getTypeDataBase());
      }
    });
  }
  
  private static synchronized void initialize(TypeDataBase db)
  {
    Type type = db.lookupType("JavaThread");
    Type anchorType = db.lookupType("JavaFrameAnchor");
    
    lastJavaFPField = anchorType.getAddressField("_last_Java_fp");
    osThreadField = type.getAddressField("_osthread");
    
    type = db.lookupType("OSThread");
    osThreadThreadIDField = type.getCIntegerField("_thread_id");
  }
  
  public Address getLastJavaFP(Address addr)
  {
    return lastJavaFPField.getValue(addr.addOffsetTo(JavaThread.getAnchorField().getOffset()));
  }
  
  public Address getLastJavaPC(Address addr)
  {
    return null;
  }
  
  public Address getBaseOfStackPointer(Address addr)
  {
    return null;
  }
  
  public Frame getLastFramePD(JavaThread thread, Address addr)
  {
    Address fp = thread.getLastJavaFP();
    if (fp == null) {
      return null;
    }
    Address pc = thread.getLastJavaPC();
    if (pc != null) {
      return new X86Frame(thread.getLastJavaSP(), fp, pc);
    }
    return new X86Frame(thread.getLastJavaSP(), fp);
  }
  
  public RegisterMap newRegisterMap(JavaThread thread, boolean updateMap)
  {
    return new X86RegisterMap(thread, updateMap);
  }
  
  public Frame getCurrentFrameGuess(JavaThread thread, Address addr)
  {
    ThreadProxy t = getThreadProxy(addr);
    X86ThreadContext context = (X86ThreadContext)t.getContext();
    X86CurrentFrameGuess guesser = new X86CurrentFrameGuess(context, thread);
    if (!guesser.run(131072L)) {
      return null;
    }
    if (guesser.getPC() == null) {
      return new X86Frame(guesser.getSP(), guesser.getFP());
    }
    return new X86Frame(guesser.getSP(), guesser.getFP(), guesser.getPC());
  }
  
  public void printThreadIDOn(Address addr, PrintStream tty)
  {
    tty.print(getThreadProxy(addr));
  }
  
  public Address getLastSP(Address addr)
  {
    ThreadProxy t = getThreadProxy(addr);
    X86ThreadContext context = (X86ThreadContext)t.getContext();
    return context.getRegisterAsAddress(7);
  }
  
  public ThreadProxy getThreadProxy(Address addr)
  {
    Address osThreadAddr = osThreadField.getValue(addr);
    
    Address tidAddr = osThreadAddr.addOffsetTo(osThreadThreadIDField.getOffset());
    
    JVMDebugger debugger = VM.getVM().getDebugger();
    return debugger.getThreadForIdentifierAddress(tidAddr);
  }
  
  public void printInfoOn(Address threadAddr, PrintStream tty) {}
}

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

import java.io.PrintStream;
import sun.jvm.hotspot.asm.sparc.SPARCArgument;
import sun.jvm.hotspot.asm.sparc.SPARCRegister;
import sun.jvm.hotspot.asm.sparc.SPARCRegisters;
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.JVMDebugger;
import sun.jvm.hotspot.debugger.OopHandle;
import sun.jvm.hotspot.debugger.cdbg.CDebugger;
import sun.jvm.hotspot.debugger.cdbg.ClosestSymbol;
import sun.jvm.hotspot.debugger.cdbg.LoadObject;
import sun.jvm.hotspot.interpreter.Interpreter;
import sun.jvm.hotspot.oops.Method;
import sun.jvm.hotspot.oops.ObjectHeap;
import sun.jvm.hotspot.oops.UnknownOopException;
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.VM;
import sun.jvm.hotspot.runtime.VMObjectFactory;
import sun.jvm.hotspot.runtime.posix.POSIXSignals;
import sun.jvm.hotspot.utilities.AddressOps;
import sun.jvm.hotspot.utilities.Assert;
import sun.jvm.hotspot.utilities.Bits;

public class SPARCFrame
  extends Frame
{
  private Address raw_youngerSP;
  private long interpreterSPAdjustmentOffset;
  private static final int WORDS_PER_LONG = 2;
  public static final int PC_RETURN_OFFSET = 8;
  public static final int REGISTER_SAVE_WORDS = 16;
  public static final int CALLEE_AGGREGATE_RETURN_POINTER_WORDS = 1;
  public static final int CALLEE_REGISTER_ARGUMENT_SAVE_AREA_WORDS = 6;
  public static final int REGISTER_SAVE_WORDS_SP_OFFSET = 0;
  public static final int CALLEE_AGGREGATE_RETURN_POINTER_SP_OFFSET = 16;
  public static final int CALLEE_REGISTER_ARGUMENT_SAVE_AREA_SP_OFFSET = 17;
  public static final int MEMORY_PARAMETER_WORD_SP_OFFSET = 23;
  public static final int VARARGS_OFFSET = 23;
  private static final boolean DEBUG = System.getProperty("sun.jvm.hotspot.runtime.sparc.SPARCFrame.DEBUG") != null;
  public static final int INTERPRETER_FRAME_D_SCRATCH_FP_OFFSET = -2;
  public static final int INTERPRETER_FRAME_L_SCRATCH_FP_OFFSET = -4;
  public static final int INTERPRETER_FRAME_PADDING_OFFSET = -5;
  public static final int INTERPRETER_FRAME_MIRROR_OFFSET = -6;
  public static final int INTERPRETER_FRAME_VM_LOCALS_FP_OFFSET = -6;
  public static final int INTERPRETER_FRAME_VM_LOCAL_WORDS = 6;
  public static final int INTERPRETER_FRAME_EXTRA_OUTGOING_ARGUMENT_WORDS = 2;
  
  public static Address unBiasSP(Address raw_sp)
  {
    if (raw_sp != null) {
      return raw_sp.addOffsetTo(VM.getVM().getStackBias());
    }
    return null;
  }
  
  public static Address biasSP(Address real_sp)
  {
    if (real_sp != null)
    {
      if (DEBUG) {
        System.out.println("biasing realsp: " + real_sp + " biased: " + real_sp.addOffsetTo(-VM.getVM().getStackBias()));
      }
      return real_sp.addOffsetTo(-VM.getVM().getStackBias());
    }
    if (DEBUG) {
      System.out.println("biasing null realsp");
    }
    return null;
  }
  
  public static Address findYoungerSP(Address top, Address find)
  {
    Address findRaw = biasSP(find);
    if ((top == null) || (find == null) || (findRaw == null)) {
      throw new RuntimeException("bad values for findYoungerSP top: " + top + " find: " + find);
    }
    int maxFrames = 20;
    int count = 0;
    Address search = top;
    if (DEBUG) {
      System.out.println("findYoungerSP top: " + top + " find: " + find + " findRaw: " + findRaw);
    }
    while ((count != 20) && (search != null))
    {
      Address next = search.getAddressAt(SPARCRegisters.I6.spOffsetInSavedWindow());
      Address pc = search.getAddressAt(SPARCRegisters.I7.spOffsetInSavedWindow());
      if (DEBUG) {
        System.out.println("findYoungerSP next: " + next + " pc: " + pc);
      }
      if (next.equals(findRaw)) {
        return search;
      }
      search = unBiasSP(next);
    }
    if (DEBUG) {
      System.out.println("findYoungerSP: never found younger, top: " + top + " find: " + find);
    }
    return null;
  }
  
  public Address getSP()
  {
    if (DEBUG) {
      System.out.println("getSP raw: " + raw_sp
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