sa-jdi

ntime.JavaThreadPDAccess;
import sun.jvm.hotspot.runtime.RegisterMap;
import sun.jvm.hotspot.runtime.VM;
import sun.jvm.hotspot.runtime.ia64.IA64Frame;
import sun.jvm.hotspot.runtime.ia64.IA64RegisterMap;
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 LinuxIA64JavaThreadPDAccess
  implements JavaThreadPDAccess
{
  private static AddressField lastJavaIFrameField;
  private static AddressField osThreadField;
  private static CIntegerField osThreadPThreadIDField;
  private static final long GUESS_SCAN_RANGE = 131072L;
  
  static
  {
    VM.registerVMInitializedObserver(new Observer()
    {
      public void update(Observable o, Object data)
      {
        LinuxIA64JavaThreadPDAccess.initialize(VM.getVM().getTypeDataBase());
      }
    });
  }
  
  private static synchronized void initialize(TypeDataBase db)
  {
    Type type = db.lookupType("JavaThread");
    
    lastJavaIFrameField = type.getAddressField("_last_Java_iframe");
    osThreadField = type.getAddressField("_osthread");
    
    type = db.lookupType("OSThread");
    osThreadPThreadIDField = type.getCIntegerField("_pthread_id");
  }
  
  public Address getLastJavaIFrame(Address addr)
  {
    return lastJavaIFrameField.getValue(addr);
  }
  
  public Address getBaseOfStackPointer(Address addr)
  {
    return null;
  }
  
  public Address getLastJavaFP(Address addr)
  {
    return null;
  }
  
  public Address getLastJavaPC(Address addr)
  {
    return null;
  }
  
  public boolean isInterpretedFrame()
  {
    return true;
  }
  
  public Frame getLastFramePD(JavaThread thread, Address addr)
  {
    Address iframe = getLastJavaIFrame(addr);
    Address pc = thread.getLastJavaPC();
    if (iframe == null) {
      return null;
    }
    return new IA64Frame(thread.getLastJavaSP(), iframe, pc);
  }
  
  public RegisterMap newRegisterMap(JavaThread thread, boolean updateMap)
  {
    return new IA64RegisterMap(thread, updateMap);
  }
  
  public Frame getCurrentFrameGuess(JavaThread thread, Address addr)
  {
    return getLastFramePD(thread, addr);
  }
  
  public void printThreadIDOn(Address addr, PrintStream tty)
  {
    tty.print(getThreadProxy(addr));
  }
  
  public void printInfoOn(Address threadAddr, PrintStream tty)
  {
    tty.print("Thread id: ");
    printThreadIDOn(threadAddr, tty);
    tty.println("\nLastJavaIFrame: " + getLastJavaIFrame(threadAddr));
  }
  
  public Address getLastSP(Address addr)
  {
    ThreadProxy t = getThreadProxy(addr);
    IA64ThreadContext context = (IA64ThreadContext)t.getContext();
    return context.getRegisterAsAddress(12);
  }
  
  public ThreadProxy getThreadProxy(Address addr)
  {
    Address osThreadAddr = osThreadField.getValue(addr);
    
    Address pthreadIdAddr = osThreadAddr.addOffsetTo(osThreadPThreadIDField.getOffset());
    
    JVMDebugger debugger = VM.getVM().getDebugger();
    return debugger.getThreadForIdentifierAddress(pthreadIdAddr);
  }
}

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

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

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

/* Location:
 * Qualified Name:     sun.jvm.hotspot.runtime.linux_sparc.LinuxSPARCJavaThreadPDAccess.1
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.runtime.linux_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 LinuxSPARCJavaThreadPDAccess
  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)
      {
        LinuxSPARCJavaThreadPDAccess.initialize(VM.getVM().getTypeDataBase());
      }
    });
  }
  
  private static synchronized void initialize(TypeDataBase db)
  {
    Type type = db.lookupType("JavaThread");
    Type anchorType = db.lookupType("JavaFrameAnchor");
    
    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)
  {
    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.linux_sparc.LinuxSPARCJavaThreadPDAccess
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.runtime.linux_x86;

public class LinuxSignals
{
  private static String[] signalNames = { "", "SIGHUP", "SIGINT", "SIGQUIT", "SIGILL", "SIGTRAP", "SIGABRT", "SIGIOT", "SIGBUS", "SIGFPE", "SIGKILL", "SIGUSR1", "SIGSEGV", "SIGUSR2", "SIGPIPE", "SIGALRM", "SIGTERM", "SIGSTKFLT", "SIGCHLD", "SIGCONT", "SIGSTOP", "SIGTSTP", "SIGTTIN", "SIGTTOU", "SIGURG", "SIGXCPU", "SIGXFSZ", "SIGVTALRM", "SIGPROF", "SIGWINCH", "SIGPOLL", "SIGPWR", "SIGSYS" };
  
  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.linux_x86.LinuxSignals
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.runtime.linux_x86;

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

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

/* Location:
 * Qualified Name:     sun.jvm.hotspot.runtime.linux_x86.LinuxX86JavaThreadPDAccess.1
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.runtime.linux_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 LinuxX86JavaThreadPDAccess
  implements JavaThreadPDAccess
{
  private static AddressField lastJavaFPField;
  private static AddressField osThreadField;
  private static CIntegerField osThreadThreadIDField;
  private static final long GUESS_SCAN_RANGE = 131072L;
  
  static
  {
    VM.registerVMInitializedObserver(new Observer()
    {
      public void update(Observable o, Object data)
      {
        LinuxX86JavaThreadPDAccess.initialize(VM.getVM().getTypeDataBase());
      }
    });
  }
  
  private static synchronized void initialize(TypeDataBase db)
  {
    Type type = db.lookupType("JavaThread");
    osThreadField = type.getAddressField("_osthread");
    
    Type anchorType = db.lookupType("JavaFrameAnchor");
    lastJavaFPField = anchorType.getAddressField("_last_Java_fp");
    
    Type osThreadType = db.lookupType("OSThread");
    osThreadThreadIDField = osThreadType.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;
    }
    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 void printInfoOn(Address threadAddr, PrintStream tty)
  {
    tty.print("Thread id: ");
    printThreadIDOn(threadAddr, tty);
  }
  
  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 threadIdAddr = osThreadAddr.addOffsetTo(osThreadThreadIDField.getOffset());
    
    JVMDebugger debugger = VM.getVM().getDebugger();
    return debugger.getThreadForIdentifierAddress(threadIdAddr);
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.runtime.linux_x86.LinuxX86JavaThreadPDAccess
 * 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 class LowMemoryDetectorThread
  extends JavaThread
{
  public LowMemoryDetectorThread(Address addr)
  {
    super(addr);
  }
  
  public boolean isJavaThread()
  {
    return false;
  }
  
  public boolean isHiddenFromExternalView()
  {
    return true;
  }
  
  public boolean isLowMemoryDetectorThread()
  {
    return true;
  }
}

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

import sun.jvm.hotspot.debugger.OopHandle;
import sun.jvm.hotspot.utilities.Assert;

public class MonitorInfo
{
  private OopHandle owner;
  private BasicLock lock;
  private OopHandle ownerKlass;
  private boolean eliminated;
  private boolean ownerIsScalarReplaced;
  
  public MonitorInfo(OopHandle owner, BasicLock lock, boolean eliminated, boolean ownerIsScalarReplaced)
  {
    if (!ownerIsScalarReplaced)
    {
      this.owner = owner;
      ownerKlass = null;
    }
    else
    {
      Assert.that(eliminated, "monitor should be eliminated for scalar replaced object");
      this.owner = null;
      ownerKlass = owner;
    }
    this.eliminated = eliminated;
    this.ownerIsScalarReplaced = ownerIsScalarReplaced;
  }
  
  public OopHandle owner()
  {
    Assert.that(!ownerIsScalarReplaced, "should not be called for scalar replaced object");
    return owner;
  }
  
  public OopHandle ownerKlass()
  {
    Assert.that(ownerIsScalarReplaced, "should not be called for not scalar replaced object");
    return ownerKlass;
  }
  
  public BasicLock lock()
  {
    return lock;
  }
  
  public boolean eliminated()
  {
    return eliminated;
  }
  
  public boolean ownerIsScalarReplaced()
  {
    return ownerIsScalarReplaced;
  }
}

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

import sun.jvm.hotspot.oops.Method;

public abstract class NativeSignatureIterator
  extends SignatureIterator
{
  private Method method;
  private int offset;
  private int prepended;
  private int jni_offset;
  
  public void doBool()
  {
    passInt();jni_offset += 1;offset += 1;
  }
  
  public void doChar()
  {
    passInt();jni_offset += 1;offset += 1;
  }
  
  public void doFloat()
  {
    if (VM.getVM().isLP64()) {
      passFloat();
    } else {
      passInt();
    }
    jni_offset += 1;offset += 1;
  }
  
  public void doDouble()
  {
    if (VM.getVM().isLP64())
    {
      passDouble();jni_offset += 1;offset += 2;
    }
    else
    {
      passDouble();jni_offset += 2;offset += 2;
    }
  }
  
  public void doByte()
  {
    passInt();jni_offset += 1;offset += 1;
  }
  
  public void doShort()
  {
    passInt();jni_offset += 1;offset += 1;
  }
  
  public void doInt()
  {
    passInt();jni_offset += 1;offset += 1;
  }
  
  public void doLong()
  {
    if (VM.getVM().isLP64())
    {
      passLong();jni_offset += 1;offset += 2;
    }
    else
    {
      passLong();jni_offset += 2;offset += 2;
    }
  }
  
  public void doVoid()
  {
    throw new RuntimeException("should not reach here");
  }
  
  public void doObject(int begin, int end)
  {
    passObject();jni_offset += 1;offset += 1;
  }
  
  public void doArray(int begin, int end)
  {
    passObject();jni_offset += 1;offset += 1;
  }
  
  public Method method()
  {
    return method;
  }
  
  public int offset()
  {
    return offset;
  }
  
  public int jniOffset()
  {
    return jni_offset + prepended;
  }
  
  public boolean isStatic()
  {
    return method.isStatic();
  }
  
  public abstract void passInt();
  
  public abstract void passLong();
  
  public abstract void passObject();
  
  public abstract void passFloat();
  
  public abstract void passDouble();
  
  public NativeSignatureIterator(Method method)
  {
    super(method.getSignature());
    this.method = method;
    offset = 0;
    jni_offset = 0;
    
    int JNIEnv_words = 1;
    int mirror_words = 1;
    prepended = (!isStatic() ? JNIEnv_words : JNIEnv_words + mirror_words);
  }
  
  public void iterate()
  {
    if (!isStatic())
    {
      passObject();jni_offset += 1;offset += 1;
    }
    iterateParameters();
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.runtime.NativeSignatureIterator
 * 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 ObjectMonitor$1
  implements Observer
{
  public void update(Observable o, Object data)
  {
    ObjectMonitor.access$000(VM.getVM().getTypeDataBase());
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.runtime.ObjectMonitor.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.debugger.OopHandle;
import sun.jvm.hotspot.oops.Mark;
import sun.jvm.hotspot.oops.ObjectHeap;
import sun.jvm.hotspot.types.CIntegerField;
import sun.jvm.hotspot.types.Field;
import sun.jvm.hotspot.types.Type;
import sun.jvm.hotspot.types.TypeDataBase;
import sun.jvm.hotspot.types.WrongTypeException;

public class ObjectMonitor
  extends VMObject
{
  private static ObjectHeap heap;
  private static long headerFieldOffset;
  private static long objectFieldOffset;
  private static long ownerFieldOffset;
  private static long FreeNextFieldOffset;
  private static CIntegerField countField;
  private static CIntegerField waitersField;
  private static CIntegerField recursionsField;
  
  static
  {
    VM.registerVMInitializedObserver(new Observer()
    {
      public void update(Observable o, Object data)
      {
        ObjectMonitor.initialize(VM.getVM().getTypeDataBase());
      }
    });
  }
  
  private static synchronized void initialize(TypeDataBase db)
    throws WrongTypeException
  {
    heap = VM.getVM().getObjectHeap();
    Type type = db.lookupType("ObjectMonitor");
    Field f = type.getField("_header");
    headerFieldOffset = f.getOffset();
    f = type.getField("_object");
    objectFieldOffset = f.getOffset();
    f = type.getField("_owner");
    ownerFieldOffset = f.getOffset();
    f = type.getField("FreeNext");
    FreeNextFieldOffset = f.getOffset();
    countField = type.getCIntegerField("_count");
    waitersField = type.getCIntegerField("_waiters");
    recursionsField = type.getCIntegerField("_recursions");
  }
  
  public ObjectMonitor(Address addr)
  {
    super(addr);
  }
  
  public Mark header()
  {
    return new Mark(addr.addOffsetTo(headerFieldOffset));
  }
  
  public boolean isEntered(Thread current)
  {
    Address o = owner();
    if ((current.threadObjectAddress().equals(o)) || (current.isLockOwned(o))) {
      return true;
    }
    return false;
  }
  
  public Address owner()
  {
    return addr.getAddressAt(ownerFieldOffset);
  }
  
  public long waiters()
  {
    return waitersField.getValue(addr);
  }
  
  public Address freeNext()
  {
    return addr.getAddressAt(FreeNextFieldOffset);
  }
  
  public long count()
  {
    return countField.getValue(addr);
  }
  
  public long recursions()
  {
    return recursionsField.getValue(addr);
  }
  
  public OopHandle object()
  {
    return addr.getOopHandleAt(objectFieldOffset);
  }
  
  public long contentions()
  {
    long count = count();
    if (VM.getVM().getOS().equals("win32")) {
      return count > 0L ? count - 1L : 0L;
    }
    return count;
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.runtime.ObjectMonitor
 * 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 ObjectSynchronizer$1
  implements Observer
{
  public void update(Observable o, Object data)
  {
    ObjectSynchronizer.access$000(VM.getVM().getTypeDataBase());
  }
}

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

import java.util.Iterator;
import sun.jvm.hotspot.debugger.Address;

class ObjectSynchronizer$ObjectMonitorIterator
  implements Iterator
{
  private ObjectMonitor block;
  private int index;
  private Address blockAddr;
  
  ObjectSynchronizer$ObjectMonitorIterator()
  {
    blockAddr = ObjectSynchronizer.access$100();
    index = (ObjectSynchronizer.access$200() - 1);
    block = new ObjectMonitor(blockAddr);
  }
  
  public boolean hasNext()
  {
    return (index > 0) || (block.freeNext() != null);
  }
  
  public Object next()
  {
    Address addr;
    Address addr;
    if (index > 0)
    {
      addr = blockAddr.addOffsetTo(index * ObjectSynchronizer.access$300());
    }
    else
    {
      blockAddr = block.freeNext();
      index = (ObjectSynchronizer.access$200() - 1);
      addr = blockAddr.addOffsetTo(index * ObjectSynchronizer.access$300());
    }
    index -= 1;
    return new ObjectMonitor(addr);
  }
  
  public void remove()
  {
    throw new UnsupportedOperationException();
  }
}

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

import java.util.Iterator;
import java.util.Observable;
import java.util.Observer;
import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.oops.Mark;
import sun.jvm.hotspot.oops.Oop;
import sun.jvm.hotspot.types.AddressField;
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 ObjectSynchronizer
{
  private static Address gBlockListAddr;
  private static int blockSize;
  private static long objectMonitorTypeSize;
  
  static
  {
    VM.registerVMInitializedObserver(new Observer()
    {
      public void update(Observable o, Object data)
      {
        ObjectSynchronizer.initialize(VM.getVM().getTypeDataBase());
      }
    });
  }
  
  private static synchronized void initialize(TypeDataBase db)
    throws WrongTypeException
  {
    try
    {
      type = db.lookupType("ObjectSynchronizer");
      
      AddressField blockListField = type.getAddressField("gBlockList");
      gBlockListAddr = blockListField.getValue();
      blockSize = db.lookupIntConstant("ObjectSynchronizer::_BLOCKSIZE").intValue();
    }
    catch (RuntimeException e) {}
    Type type = db.lookupType("ObjectMonitor");
    objectMonitorTypeSize = type.getSize();
  }
  
  public long identityHashValueFor(Oop obj)
  {
    Mark mark = obj.getMark();
    if (mark.isUnlocked()) {
      return mark.hash();
    }
    if (mark.hasMonitor())
    {
      ObjectMonitor monitor = mark.monitor();
      Mark temp = monitor.header();
      return temp.hash();
    }
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(VM.getVM().isDebugging(), "Can not access displaced header otherwise");
    }
    if (mark.hasDisplacedMarkHelper())
    {
      Mark temp = mark.displacedMarkHelper();
      return temp.hash();
    }
    return 0L;
  }
  
  public static Iterator objectMonitorIterator()
  {
    if (gBlockListAddr != null) {
      return new ObjectMonitorIterator();
    }
    return null;
  }
  
  private static class ObjectMonitorIterator
    implements Iterator
  {
    private ObjectMonitor block;
    private int index;
    private Address blockAddr;
    
    ObjectMonitorIterator()
    {
      blockAddr = ObjectSynchronizer.gBlockListAddr;
      index = (ObjectSynchronizer.blockSize - 1);
      block = new ObjectMonitor(blockAddr);
    }
    
    public boolean hasNext()
    {
      return (index > 0) || (block.freeNext() != null);
    }
    
    public Object next()
    {
      Address addr;
      Address addr;
      if (index > 0)
      {
        addr = blockAddr.addOffsetTo(index * ObjectSynchronizer.objectMonitorTypeSize);
      }
      else
      {
        blockAddr = block.freeNext();
        index = (ObjectSynchronizer.blockSize - 1);
        addr = blockAddr.addOffsetTo(index * ObjectSynchronizer.objectMonitorTypeSize);
      }
      index -= 1;
      return new ObjectMonitor(addr);
    }
    
    public void remove()
    {
      throw new UnsupportedOperationException();
    }
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.runtime.ObjectSynchronizer
 * 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 OSThread$1
  implements Observer
{
  public void update(Observable o, Object data)
  {
    OSThread.access$000(VM.getVM().getTypeDataBase());
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.runtime.OSThread.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.JIntField;
import sun.jvm.hotspot.types.Type;
import sun.jvm.hotspot.types.TypeDataBase;

public class OSThread
  extends VMObject
{
  private static JIntField interruptedField;
  
  static
  {
    VM.registerVMInitializedObserver(new Observer()
    {
      public void update(Observable o, Object data)
      {
        OSThread.initialize(VM.getVM().getTypeDataBase());
      }
    });
  }
  
  private static synchronized void initialize(TypeDataBase db)
  {
    Type type = db.lookupType("OSThread");
    interruptedField = type.getJIntField("_interrupted");
  }
  
  public OSThread(Address addr)
  {
    super(addr);
  }
  
  public boolean interrupted()
  {
    return interruptedField.getValue(addr) != 0;
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.runtime.OSThread
 * 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 PerfDataEntry$1
  implements Observer
{
  public void update(Observable o, Object data)
  {
    PerfDataEntry.access$000(VM.getVM().getTypeDataBase());
  }
}

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

public abstract interface PerfDataEntry$PerfDataUnits
{
  public static final int U_None = 1;
  public static final int U_Bytes = 2;
  public static final int U_Ticks = 3;
  public static final int U_Events = 4;
  public static final int U_String = 5;
  public static final int U_Hertz = 6;
}

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

public abstract interface PerfDataEntry$PerfDataVariability
{
  public static final int V_Constant = 1;
  public static final int V_Monotonic = 2;
  public static final int V_Variable = 3;
}

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

import java.io.UnsupportedEncodingException;
import java.util.Observable;
import java.util.Observer;
import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.oops.ObjectHeap;
import sun.jvm.hotspot.types.JByteField;
import sun.jvm.hotspot.types.JIntField;
import sun.jvm.hotspot.types.Type;
import sun.jvm.hotspot.types.TypeDataBase;
import sun.jvm.hotspot.utilities.Assert;
import sun.jvm.hotspot.utilities.CStringUtilities;

public class PerfDataEntry
  extends VMObject
{
  private static JIntField entryLengthField;
  private static JIntField nameOffsetField;
  private static JIntField vectorLengthField;
  private static JByteField dataTypeField;
  private static JByteField flagsField;
  private static JByteField dataUnitsField;
  private static JByteField dataVariabilityField;
  private static JIntField dataOffsetField;
  
  static
  {
    VM.registerVMInitializedObserver(new Observer()
    {
      public void update(Observable o, Object data)
      {
        PerfDataEntry.initialize(VM.getVM().getTypeDataBase());
      }
    });
  }
  
  private static synchronized void initialize(TypeDataBase db)
  {
    Type type = db.lookupType("PerfDataEntry");
    entryLengthField = type.getJIntField("entry_length");
    nameOffsetField = type.getJIntField("name_offset");
    vectorLengthField = type.getJIntField("vector_length");
    dataTypeField = type.getJByteField("data_type");
    flagsField = type.getJByteField("flags");
    dataUnitsField = type.getJByteField("data_units");
    dataVariabilityField = type.getJByteField("data_variability");
    dataOffsetField = type.getJIntField("data_offset");
  }
  
  public PerfDataEntry(Address addr)
  {
    super(addr);
  }
  
  public int entryLength()
  {
    return entryLengthField.getValue(addr);
  }
  
  public int nameOffset()
  {
    return nameOffsetField.getValue(addr);
  }
  
  public int vectorLength()
  {
    return vectorLengthField.getValue(addr);
  }
  
  public int dataType()
  {
    char ch = (char)dataTypeField.getValue(addr);
    return BasicType.charToType(ch);
  }
  
  public byte flags()
  {
    return flagsField.getValue(addr);
  }
  
  public boolean supported()
  {
    return (flags() & 0x1) != 0;
  }
  
  public int dataUnits()
  {
    return dataUnitsField.getValue(addr);
  }
  
  public int dataVariability()
  {
    return dataVariabilityField.getValue(addr);
  }
  
  public int dataOffset()
  {
    return dataOffsetField.getValue(addr);
  }
  
  public String name()
  {
    int off = nameOffset();
    return CStringUtilities.getString(addr.addOffsetTo(off));
  }
  
  public boolean booleanValue()
  {
    if (Assert.ASSERTS_ENABLED) {
      Assert.that((vectorLength() == 0) && (dataType() == 4), "not a boolean");
    }
    return addr.getJBooleanAt(dataOffset());
  }
  
  public char charValue()
  {
    if (Assert.ASSERTS_ENABLED) {
      Assert.that((vectorLength() == 0) && (dataType() == 5), "not a char");
    }
    return addr.getJCharAt(dataOffset());
  }
  
  public byte byteValue()
  {
    if (Assert.ASSERTS_ENABLED) {
      Assert.that((vectorLength() == 0) && (dataType() == 8), "not a byte");
    }
    return addr.getJByteAt(dataOffset());
  }
  
  public short shortValue()
  {
    if (Assert.ASSERTS_ENABLED) {
      Assert.that((vectorLength() == 0) && (dataType() == 9), "not a short");
    }
    return addr.getJShortAt(dataOffset());
  }
  
  public int intValue()
  {
    if (Assert.ASSERTS_ENABLED) {
      Assert.that((vectorLength() == 0) && (dataType() == 10), "not an int");
    }
    return addr.getJIntAt(dataOffset());
  }
  
  public long longValue()
  {
    if (Assert.ASSERTS_ENABLED) {
      Assert.that((vectorLength() == 0) && (dataType() == 11), "not a long");
    }
    return addr.getJLongAt(dataOffset());
  }
  
  public float floatValue()
  {
    if (Assert.ASSERTS_ENABLED) {
      Assert.that((vectorLength() == 0) && (dataType() == 6), "not a float");
    }
    return addr.getJFloatAt(dataOffset());
  }
  
  public double doubleValue()
  {
    if (Assert.ASSERTS_ENABLED) {
      Assert.that((vectorLength() == 0) && (dataType() == 7), "not a double");
    }
    return addr.getJDoubleAt(dataOffset());
  }
  
  public boolean[] booleanArrayValue()
  {
    int len = vectorLength();
    if (Assert.ASSERTS_ENABLED) {
      Assert.that((len > 0) && (dataType() == 4), "not a boolean vector");
    }
    boolean[] res = new boolean[len];
    int off = dataOffset();
    long size = getHeap().getBooleanSize();
    for (int i = 0; i < len; i++) {
      res[i] = addr.getJBooleanAt(off + i * size);
    }
    return res;
  }
  
  public char[] charArrayValue()
  {
    int len = vectorLength();
    if (Assert.ASSERTS_ENABLED) {
      Assert.that((len > 0) && (dataType() == 5), "not a char vector");
    }
    char[] res = new char[len];
    int off = dataOffset();
    long size = getHeap().getCharSize();
    for (int i = 0; i < len; i++) {
      res[i] = addr.getJCharAt(off + i * size);
    }
    return res;
  }
  
  public byte[] byteArrayValue()
  {
    int len = vectorLength();
    if (Assert.ASSERTS_ENABLED) {
      Assert.that((len > 0) && (dataType() == 8), "not a byte vector");
    }
    byte[] res = new byte[len];
    int off = dataOffset();
    long size = getHeap().getByteSize();
    for (int i = 0; i < len; i++) {
      res[i] = addr.getJByteAt(off + i * size);
    }
    return res;
  }
  
  public short[] shortArrayValue()
  {
    int len = vectorLength();
    if (Assert.ASSERTS_ENABLED) {
      Assert.that((len > 0) && (dataType() == 9), "not a short vector");
    }
    short[] res = new short[len];
    int off = dataOffset();
    long size = getHeap().getShortSize();
    for (int i = 0; i < len; i++) {
      res[i] = addr.getJShortAt(off + i * size);
    }
    return res;
  }
  
  public int[] intArrayValue()
  {
    int len = vectorLength();
    if (Assert.ASSERTS_ENABLED) {
      Assert.that((len > 0) && (dataType() == 10), "not an int vector");
    }
    int[] res = new int[len];
    int off = dataOffset();
    long size = getHeap().getIntSize();
    for (int i = 0; i < len; i++) {
      res[i] = addr.getJIntAt(off + i * size);
    }
    return res;
  }
  
  public long[] longArrayValue()
  {
    int len = vectorLength();
    if (Assert.ASSERTS_ENABLED) {
      Assert.that((len > 0) && (dataType() == 11), "not a long vector");
    }
    long[] res = new long[len];
    int off = dataOffset();
    long size = getHeap().getLongSize();
    for (int i = 0; i < len; i++) {
      res[i] = addr.getJLongAt(off + i * size);
    }
    return res;
  }
  
  public float[] floatArrayValue()
  {
    int len = vectorLength();
    if (Assert.ASSERTS_ENABLED) {
      Assert.that((len > 0) && (dataType() == 6), "not a float vector");
    }
    float[] res = new float[len];
    int off = dataOffset();
    long size = getHeap().getFloatSize();
    for (int i = 0; i < len; i++) {
      res[i] = addr.getJFloatAt(off + i * size);
    }
    return res;
  }
  
  public double[] doubleArrayValue()
  {
    int len = vectorLength();
    if (Assert.ASSERTS_ENABLED) {
      Assert.that((len > 0) && (dataType() == 7), "not a double vector");
    }
    double[] res = new double[len];
    int off = dataOffset();
    long size = getHeap().getDoubleSize();
    for (int i = 0; i < len; i++) {
      res[i] = addr.getJDoubleAt(off + i * size);
    }
    return res;
  }
  
  public String valueAsString()
  {
    int dataType = dataType();
    int len = vectorLength();
    String str = null;
    if (len == 0) {
      switch (dataType)
      {
      case 4: 
        str = Boolean.toString(booleanValue());
        break;
      case 5: 
        str = "'" + Character.toString(charValue()) + "'";
        break;
      case 8: 
        str = Byte.toString(byteValue());
        break;
      case 9: 
        str = Short.toString(shortValue());
        break;
      case 10: 
        str = Integer.toString(intValue());
        break;
      case 11: 
        str = Long.toString(longValue());
        break;
      case 6: 
        str = Float.toString(floatValue());
        break;
      case 7: 
        str = Double.toString(doubleValue());
        break;
      default: 
        str = "<unknown scalar value>";
        break;
      }
    } else {
      switch (dataType)
      {
      case 4: 
        boolean[] res = booleanArrayValue();
        StringBuffer buf = new StringBuffer();
        buf.append('[');
        for (int i = 0; i < res.length; i++)
        {
          buf.append(Boolean.toString(res[i]));
          buf.append(", ");
        }
        buf.append(']');
        str = buf.toString();
        break;
      case 5: 
        str = new String(charArrayValue());
        break;
      case 8: 
        try
        {
          str = new String(byteArrayValue(), "US-ASCII");
        }
        catch (UnsupportedEncodingException e)
        {
          str = "can't decode string : " + e.getMessage();
        }
      case 9: 
        short[] res = shortArrayValue();
        StringBuffer buf = new StringBuffer();
        buf.append('[');
        for (int i = 0; i < res.length; i++)
        {
          buf.append(Short.toString(res[i]));
          buf.append(", ");
        }
        buf.append(']');
        str = buf.toString();
        break;
      case 10: 
        int[] res = intArrayValue();
        StringBuffer buf = new StringBuffer();
        buf.append('[');
        for (int i = 0; i < res.length; i++)
        {
          buf.append(Integer.toString(res[i]));
          buf.append(", ");
        }
        buf.append(']');
        str = buf.toString();
        break;
      case 11: 
        long[] res = longArrayValue();
        StringBuffer buf = new StringBuffer();
        buf.append('[');
        for (int i = 0; i < res.length; i++)
        {
          buf.append(Long.toString(res[i]));
          buf.append(", ");
        }
        buf.append(']');
        str = buf.toString();
        break;
      case 6: 
        float[] res = floatArrayValue();
        StringBuffer buf = new StringBuffer();
        buf.append('[');
        for (int i = 0; i < res.length; i++)
        {
          buf.append(Float.toString(res[i]));
          buf.append(", ");
        }
        buf.append(']');
        str = buf.toString();
        break;
      case 7: 
        double[] res = doubleArrayValue();
        StringBuffer buf = new StringBuffer();
        buf.append('[');
        for (int i = 0; i < res.length; i++)
        {
          buf.append(Double.toString(res[i]));
          buf.append(", ");
        }
        buf.append(']');
        str = buf.toString();
        break;
      default: 
        str = "<unknown vector value>";
      }
    }
    switch (dataUnits())
    {
    case 1: 
      break;
    case 2: 
      str = str + " byte(s)";
      break;
    case 3: 
      str = str + " tick(s)";
      break;
    case 4: 
      str = str + " event(s)";
      break;
    case 5: 
      break;
    case 6: 
      str = str + " Hz";
    }
    return str;
  }
  
  private ObjectHeap getHeap()
  {
    return VM.getVM().getObjectHeap();
  }
  
  public static abstract interface PerfDataVariability
  {
    public static final int V_Constant = 1;
    public static final int V_Monotonic = 2;
    public static final int V_Variable = 3;
  }
  
  public static abstract interface PerfDataUnits
  {
    public static final int U_None = 1;
    public static final int U_Bytes = 2;
    public static final int U_Ticks = 3;
    public static final int U_Events = 4;
    public static final int U_String = 5;
    public static final int U_Hertz = 6;
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.runtime.PerfDataEntry
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
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