sa-jdi

_SP_OFFSET = INTERPRETER_FRAME_BCX_OFFSET - 1;
    INTERPRETER_FRAME_MONITOR_BLOCK_TOP_OFFSET = INTERPRETER_FRAME_INITIAL_SP_OFFSET;
    INTERPRETER_FRAME_MONITOR_BLOCK_BOTTOM_OFFSET = INTERPRETER_FRAME_INITIAL_SP_OFFSET;
  }
  
  private void adjustForDeopt()
  {
    if (pc != null)
    {
      CodeBlob cb = VM.getVM().getCodeCache().findBlob(pc);
      if ((cb != null) && (cb.isJavaMethod()))
      {
        NMethod nm = (NMethod)cb;
        if (pc.equals(nm.deoptBegin()))
        {
          if (Assert.ASSERTS_ENABLED) {
            Assert.that(getUnextendedSP() != null, "null SP in Java frame");
          }
          pc = getUnextendedSP().getAddressAt(nm.origPCOffset());
          deoptimized = true;
        }
      }
    }
  }
  
  public AMD64Frame(Address raw_sp, Address raw_fp, Address pc)
  {
    this.raw_sp = raw_sp;
    raw_unextendedSP = raw_sp;
    this.raw_fp = raw_fp;
    this.pc = pc;
    
    adjustForDeopt();
    if (DEBUG)
    {
      System.out.println("AMD64Frame(sp, fp, pc): " + this);
      dumpStack();
    }
  }
  
  public AMD64Frame(Address raw_sp, Address raw_fp)
  {
    this.raw_sp = raw_sp;
    raw_unextendedSP = raw_sp;
    this.raw_fp = raw_fp;
    pc = raw_sp.getAddressAt(-1L * VM.getVM().getAddressSize());
    
    adjustForDeopt();
    if (DEBUG)
    {
      System.out.println("AMD64Frame(sp, fp): " + this);
      dumpStack();
    }
  }
  
  public AMD64Frame(Address raw_sp, Address raw_fp, long extension)
  {
    this.raw_sp = raw_sp;
    if (raw_sp == null) {
      raw_unextendedSP = null;
    } else {
      raw_unextendedSP = raw_sp.addOffsetTo(extension);
    }
    this.raw_fp = raw_fp;
    pc = raw_sp.getAddressAt(-1L * VM.getVM().getAddressSize());
    
    adjustForDeopt();
    if (DEBUG)
    {
      System.out.println("AMD64Frame(sp, fp, extension): " + this);
      dumpStack();
    }
  }
  
  public Object clone()
  {
    AMD64Frame frame = new AMD64Frame();
    raw_sp = raw_sp;
    raw_unextendedSP = raw_unextendedSP;
    raw_fp = raw_fp;
    pc = pc;
    deoptimized = deoptimized;
    return frame;
  }
  
  public boolean equals(Object arg)
  {
    if (arg == null) {
      return false;
    }
    if (!(arg instanceof AMD64Frame)) {
      return false;
    }
    AMD64Frame other = (AMD64Frame)arg;
    
    return (AddressOps.equal(getSP(), other.getSP())) && (AddressOps.equal(getFP(), other.getFP())) && (AddressOps.equal(getUnextendedSP(), other.getUnextendedSP())) && (AddressOps.equal(getPC(), other.getPC()));
  }
  
  public int hashCode()
  {
    if (raw_sp == null) {
      return 0;
    }
    return raw_sp.hashCode();
  }
  
  public String toString()
  {
    return "sp: " + (getSP() == null ? "null" : getSP().toString()) + ", unextendedSP: " + (getUnextendedSP() == null ? "null" : getUnextendedSP().toString()) + ", fp: " + (getFP() == null ? "null" : getFP().toString()) + ", pc: " + (pc == null ? "null" : pc.toString());
  }
  
  public Address getFP()
  {
    return raw_fp;
  }
  
  public Address getSP()
  {
    return raw_sp;
  }
  
  public Address getID()
  {
    return raw_sp;
  }
  
  public boolean isSignalHandlerFrameDbg()
  {
    return false;
  }
  
  public int getSignalNumberDbg()
  {
    return 0;
  }
  
  public String getSignalNameDbg()
  {
    return null;
  }
  
  public boolean isInterpretedFrameValid()
  {
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(isInterpretedFrame(), "Not an interpreted frame");
    }
    if ((getFP() == null) || (getFP().andWithMask(3L) != null)) {
      return false;
    }
    if ((getSP() == null) || (getSP().andWithMask(3L) != null)) {
      return false;
    }
    if (getFP().addOffsetTo(INTERPRETER_FRAME_INITIAL_SP_OFFSET * VM.getVM().getAddressSize()).lessThan(getSP())) {
      return false;
    }
    if (getFP().lessThanOrEqual(getSP())) {
      return false;
    }
    if (getFP().minus(getSP()) > 4096L * VM.getVM().getAddressSize()) {
      return false;
    }
    return true;
  }
  
  public Frame sender(RegisterMap regMap, CodeBlob cb)
  {
    AMD64RegisterMap map = (AMD64RegisterMap)regMap;
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(map != null, "map must be set");
    }
    map.setIncludeArgumentOops(false);
    if (isEntryFrame()) {
      return senderForEntryFrame(map);
    }
    if (isInterpretedFrame()) {
      return senderForInterpreterFrame(map);
    }
    if (!VM.getVM().isCore())
    {
      if (cb == null) {
        cb = VM.getVM().getCodeCache().findBlob(getPC());
      } else if (Assert.ASSERTS_ENABLED) {
        Assert.that(cb.equals(VM.getVM().getCodeCache().findBlob(getPC())), "Must be the same");
      }
      if (cb != null) {
        return senderForCompiledFrame(map, cb);
      }
    }
    return new AMD64Frame(getSenderSP(), getLink(), getSenderPC());
  }
  
  private Frame senderForEntryFrame(AMD64RegisterMap map)
  {
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(map != null, "map must be set");
    }
    AMD64JavaCallWrapper jcw = (AMD64JavaCallWrapper)getEntryFrameCallWrapper();
    if (Assert.ASSERTS_ENABLED)
    {
      Assert.that(!entryFrameIsFirst(), "next Java fp must be non zero");
      Assert.that(jcw.getLastJavaSP().greaterThan(getSP()), "must be above this frame on stack");
    }
    AMD64Frame fr;
    AMD64Frame fr;
    if (jcw.getLastJavaPC() != null) {
      fr = new AMD64Frame(jcw.getLastJavaSP(), jcw.getLastJavaFP(), jcw.getLastJavaPC());
    } else {
      fr = new AMD64Frame(jcw.getLastJavaSP(), jcw.getLastJavaFP());
    }
    map.clear();
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(map.getIncludeArgumentOops(), "should be set by clear");
    }
    return fr;
  }
  
  private Frame senderForInterpreterFrame(AMD64RegisterMap map)
  {
    Address unextendedSP = addressOfStackSlot(-1).getAddressAt(0L);
    Address sp = addressOfStackSlot(2);
    
    return new AMD64Frame(sp, getLink(), unextendedSP.minus(sp));
  }
  
  private Frame senderForCompiledFrame(AMD64RegisterMap map, CodeBlob cb)
  {
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(map != null, "map must be set");
    }
    Address sender_sp = null;
    if (VM.getVM().isClientCompiler())
    {
      sender_sp = addressOfStackSlot(2);
    }
    else
    {
      if (Assert.ASSERTS_ENABLED) {
        Assert.that(cb.getFrameSize() >= 0L, "Compiled by Compiler1: do not use");
      }
      sender_sp = getUnextendedSP().addOffsetTo(cb.getFrameSize());
    }
    Address sender_pc = sender_sp.getAddressAt(-1L * VM.getVM().getAddressSize());
    if ((map.getUpdateMap()) && (cb.getOopMaps() != null)) {
      OopMapSet.updateRegisterMap(this, cb, map, true);
    }
    if (VM.getVM().isClientCompiler()) {
      map.setIncludeArgumentOops(cb.callerMustGCArguments(map.getThread()));
    }
    Address saved_fp = null;
    if (VM.getVM().isClientCompiler()) {
      saved_fp = getFP().getAddressAt(0L);
    } else if ((VM.getVM().isServerCompiler()) && ((VM.getVM().getInterpreter().contains(sender_pc)) || (VM.getVM().getStubRoutines().returnsToCallStub(sender_pc)))) {
      saved_fp = sender_sp.getAddressAt(-2L * VM.getVM().getAddressSize());
    }
    return new AMD64Frame(sender_sp, saved_fp, sender_pc);
  }
  
  protected boolean hasSenderPD()
  {
    return true;
  }
  
  public long frameSize()
  {
    return getSenderSP().minus(getSP()) / VM.getVM().getAddressSize();
  }
  
  public Address getLink()
  {
    return addressOfStackSlot(0).getAddressAt(0L);
  }
  
  public Address getUnextendedSP()
  {
    return raw_unextendedSP;
  }
  
  public Address getSenderPCAddr()
  {
    return addressOfStackSlot(1);
  }
  
  public Address getSenderPC()
  {
    return getSenderPCAddr().getAddressAt(0L);
  }
  
  public Address getNativeParamAddr(int idx)
  {
    return addressOfStackSlot(2 + idx);
  }
  
  public Address getSenderSP()
  {
    return addressOfStackSlot(2);
  }
  
  public Address compiledArgumentToLocationPD(VMReg reg, RegisterMap regMap, int argSize)
  {
    if ((VM.getVM().isCore()) || (VM.getVM().isClientCompiler())) {
      throw new RuntimeException("Should not reach here");
    }
    return oopMapRegToLocation(reg, regMap);
  }
  
  public Address addressOfInterpreterFrameLocals()
  {
    return addressOfStackSlot(INTERPRETER_FRAME_LOCALS_OFFSET);
  }
  
  private Address addressOfInterpreterFrameBCX()
  {
    return addressOfStackSlot(INTERPRETER_FRAME_BCX_OFFSET);
  }
  
  public int getInterpreterFrameBCI()
  {
    Address bcp = addressOfInterpreterFrameBCX().getAddressAt(0L);
    OopHandle methodHandle = addressOfInterpreterFrameMethod().getOopHandleAt(0L);
    Method method = (Method)VM.getVM().getObjectHeap().newOop(methodHandle);
    return bcpToBci(bcp, method);
  }
  
  public Address addressOfInterpreterFrameMDX()
  {
    return addressOfStackSlot(INTERPRETER_FRAME_MDX_OFFSET);
  }
  
  public Address addressOfInterpreterFrameExpressionStack()
  {
    Address monitorEnd = interpreterFrameMonitorEnd().address();
    return monitorEnd.addOffsetTo(-1L * VM.getVM().getAddressSize());
  }
  
  public int getInterpreterFrameExpressionStackDirection()
  {
    return -1;
  }
  
  public Address addressOfInterpreterFrameTOS()
  {
    return getSP();
  }
  
  public Address addressOfInterpreterFrameTOSAt(int slot)
  {
    return addressOfInterpreterFrameTOS().addOffsetTo(slot * VM.getVM().getAddressSize());
  }
  
  public Address getInterpreterFrameSenderSP()
  {
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(isInterpretedFrame(), "interpreted frame expected");
    }
    return addressOfStackSlot(-1).getAddressAt(0L);
  }
  
  public BasicObjectLock interpreterFrameMonitorBegin()
  {
    return new BasicObjectLock(addressOfStackSlot(INTERPRETER_FRAME_MONITOR_BLOCK_BOTTOM_OFFSET));
  }
  
  public BasicObjectLock interpreterFrameMonitorEnd()
  {
    Address result = addressOfStackSlot(INTERPRETER_FRAME_MONITOR_BLOCK_TOP_OFFSET).getAddressAt(0L);
    if (Assert.ASSERTS_ENABLED)
    {
      Assert.that(AddressOps.gt(getFP(), result), "result must <  than frame pointer");
      Assert.that(AddressOps.lte(getSP(), result), "result must >= than stack pointer");
    }
    return new BasicObjectLock(result);
  }
  
  public int interpreterFrameMonitorSize()
  {
    return BasicObjectLock.size();
  }
  
  public Address addressOfInterpreterFrameMethod()
  {
    return addressOfStackSlot(-3);
  }
  
  public Address addressOfInterpreterFrameCPCache()
  {
    return addressOfStackSlot(INTERPRETER_FRAME_CACHE_OFFSET);
  }
  
  public JavaCallWrapper getEntryFrameCallWrapper()
  {
    return new AMD64JavaCallWrapper(addressOfStackSlot(-6).getAddressAt(0L));
  }
  
  protected Address addressOfSavedOopResult()
  {
    return getSP().addOffsetTo((VM.getVM().isClientCompiler() ? 2 : 3) * VM.getVM().getAddressSize());
  }
  
  protected Address addressOfSavedReceiver()
  {
    return getSP().addOffsetTo(-4L * VM.getVM().getAddressSize());
  }
  
  private void dumpStack()
  {
    if (getFP() != null) {
      for (Address addr = getSP().addOffsetTo(-5L * VM.getVM().getAddressSize()); AddressOps.lte(addr, getFP().addOffsetTo(5L * VM.getVM().getAddressSize())); addr = addr.addOffsetTo(VM.getVM().getAddressSize())) {
        System.out.println(addr + ": " + addr.getAddressAt(0L));
      }
    } else {
      for (Address addr = getSP().addOffsetTo(-5L * VM.getVM().getAddressSize()); AddressOps.lte(addr, getSP().addOffsetTo(20L * VM.getVM().getAddressSize())); addr = addr.addOffsetTo(VM.getVM().getAddressSize())) {
        System.out.println(addr + ": " + addr.getAddressAt(0L));
      }
    }
  }
  
  private AMD64Frame() {}
}

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

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

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

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

import java.util.Observable;
import java.util.Observer;
import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.runtime.JavaCallWrapper;
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 AMD64JavaCallWrapper
  extends JavaCallWrapper
{
  private static AddressField lastJavaFPField;
  
  static
  {
    VM.registerVMInitializedObserver(new Observer()
    {
      public void update(Observable o, Object data)
      {
        AMD64JavaCallWrapper.initialize(VM.getVM().getTypeDataBase());
      }
    });
  }
  
  private static synchronized void initialize(TypeDataBase db)
  {
    Type type = db.lookupType("JavaFrameAnchor");
    
    lastJavaFPField = type.getAddressField("_last_Java_fp");
  }
  
  public AMD64JavaCallWrapper(Address addr)
  {
    super(addr);
  }
  
  public Address getLastJavaFP()
  {
    return lastJavaFPField.getValue(addr.addOffsetTo(anchorField.getOffset()));
  }
}

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

import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.runtime.JavaThread;
import sun.jvm.hotspot.runtime.RegisterMap;
import sun.jvm.hotspot.runtime.VMReg;

public class AMD64RegisterMap
  extends RegisterMap
{
  public AMD64RegisterMap(JavaThread thread, boolean updateMap)
  {
    super(thread, updateMap);
  }
  
  protected AMD64RegisterMap(RegisterMap map)
  {
    super(map);
  }
  
  public Object clone()
  {
    AMD64RegisterMap retval = new AMD64RegisterMap(this);
    return retval;
  }
  
  protected void clearPD() {}
  
  protected void initializePD() {}
  
  protected void initializeFromPD(RegisterMap map) {}
  
  protected Address getLocationPD(VMReg reg)
  {
    return null;
  }
}

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

import sun.jvm.hotspot.oops.Symbol;
import sun.jvm.hotspot.utilities.Assert;

class ArgumentOopFinder
  extends SignatureInfo
{
  private AddressVisitor f;
  private int offset;
  private boolean isStatic;
  private Frame fr;
  
  protected void set(int size, int type)
  {
    offset -= size;
    if ((type == BasicType.getTObject()) || (type == BasicType.getTArray())) {
      oopOffsetDo();
    }
  }
  
  private void oopOffsetDo()
  {
    f.visitAddress(fr.addressOfInterpreterFrameTOSAt(offset));
  }
  
  public ArgumentOopFinder(Symbol signature, boolean isStatic, Frame fr, AddressVisitor f)
  {
    super(signature);
    
    int argsSize = new ArgumentSizeComputer(signature).size() + (isStatic ? 0 : 1);
    if (Assert.ASSERTS_ENABLED) {
      Assert.that((!fr.isInterpretedFrame()) || (argsSize <= fr.getInterpreterFrameExpressionStackSize()), "args cannot be on stack anymore");
    }
    this.f = f;
    this.fr = fr;
    offset = argsSize;
    this.isStatic = isStatic;
  }
  
  public void oopsDo()
  {
    if (!isStatic)
    {
      offset -= 1;
      oopOffsetDo();
    }
    iterateParameters();
  }
}

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

/* Location:
 * Qualified Name:     sun.jvm.hotspot.runtime.Arguments.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.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 Arguments
{
  private static AddressField jvmFlagsField;
  private static AddressField jvmArgsField;
  private static AddressField javaCommandField;
  private static long jvmFlagsCount;
  private static long jvmArgsCount;
  
  static
  {
    VM.registerVMInitializedObserver(new Observer()
    {
      public void update(Observable o, Object data)
      {
        Arguments.initialize(VM.getVM().getTypeDataBase());
      }
    });
  }
  
  public static String getJVMFlags()
  {
    return buildString(jvmFlagsField, jvmFlagsCount);
  }
  
  public static String getJVMArgs()
  {
    return buildString(jvmArgsField, jvmArgsCount);
  }
  
  public static String getJavaCommand()
  {
    return getString(javaCommandField);
  }
  
  private static synchronized void initialize(TypeDataBase db)
  {
    Type argumentsType = db.lookupType("Arguments");
    jvmFlagsField = argumentsType.getAddressField("_jvm_flags_array");
    jvmArgsField = argumentsType.getAddressField("_jvm_args_array");
    javaCommandField = argumentsType.getAddressField("_java_command");
    
    jvmArgsCount = argumentsType.getCIntegerField("_num_jvm_args").getValue();
    jvmFlagsCount = argumentsType.getCIntegerField("_num_jvm_flags").getValue();
  }
  
  private static String buildString(AddressField arrayField, long count)
  {
    StringBuilder sb = new StringBuilder();
    if (count > 0L)
    {
      sb.append(getStringAt(arrayField, 0L));
      for (long i = 1L; i < count; i += 1L)
      {
        sb.append(" ");
        sb.append(getStringAt(arrayField, i));
      }
    }
    return sb.toString();
  }
  
  private static String getString(AddressField field)
  {
    Address addr = field.getAddress();
    return CStringUtilities.getString(addr);
  }
  
  private static String getStringAt(AddressField field, long index)
  {
    Address addr = field.getAddress();
    return CStringUtilities.getString(addr.getAddressAt(index * VM.getVM().getAddressSize()));
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.runtime.Arguments
 * 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 ArgumentSizeComputer
  extends SignatureInfo
{
  protected void set(int size, int type)
  {
    if (!isReturnType()) {
      this.size += size;
    }
  }
  
  public ArgumentSizeComputer(Symbol signature)
  {
    super(signature);
  }
}

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

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

public class BasicLock
  extends VMObject
{
  private static CIntegerField displacedHeaderField;
  
  static
  {
    VM.registerVMInitializedObserver(new Observer()
    {
      public void update(Observable o, Object data)
      {
        BasicLock.initialize(VM.getVM().getTypeDataBase());
      }
    });
  }
  
  private static synchronized void initialize(TypeDataBase db)
    throws WrongTypeException
  {
    Type type = db.lookupType("BasicLock");
    displacedHeaderField = type.getCIntegerField("_displaced_header");
  }
  
  public BasicLock(Address addr)
  {
    super(addr);
  }
  
  public Mark displacedHeader()
  {
    return new Mark(addr.addOffsetTo(displacedHeaderField.getOffset()));
  }
}

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

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

public class BasicObjectLock
  extends VMObject
{
  private static Field lockField;
  private static OopField objField;
  private static int size;
  
  static
  {
    VM.registerVMInitializedObserver(new Observer()
    {
      public void update(Observable o, Object data)
      {
        BasicObjectLock.initialize(VM.getVM().getTypeDataBase());
      }
    });
  }
  
  private static synchronized void initialize(TypeDataBase db)
    throws WrongTypeException
  {
    Type type = db.lookupType("BasicObjectLock");
    lockField = type.getField("_lock");
    objField = type.getOopField("_obj");
    size = (int)type.getSize();
  }
  
  public BasicObjectLock(Address addr)
  {
    super(addr);
  }
  
  public OopHandle obj()
  {
    return objField.getValue(addr);
  }
  
  public BasicLock lock()
  {
    return new BasicLock(addr.addOffsetTo(lockField.getOffset()));
  }
  
  public static int size()
  {
    return size;
  }
  
  public Address address()
  {
    return addr;
  }
}

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

public class BasicType
{
  public static final int tBoolean = 4;
  public static final int tChar = 5;
  public static final int tFloat = 6;
  public static final int tDouble = 7;
  public static final int tByte = 8;
  public static final int tShort = 9;
  public static final int tInt = 10;
  public static final int tLong = 11;
  public static final int tObject = 12;
  public static final int tArray = 13;
  public static final int tVoid = 14;
  public static final int tAddress = 15;
  public static final int tConflict = 16;
  public static final int tIllegal = 99;
  public static final BasicType T_BOOLEAN = new BasicType(4);
  public static final BasicType T_CHAR = new BasicType(5);
  public static final BasicType T_FLOAT = new BasicType(6);
  public static final BasicType T_DOUBLE = new BasicType(7);
  public static final BasicType T_BYTE = new BasicType(8);
  public static final BasicType T_SHORT = new BasicType(9);
  public static final BasicType T_INT = new BasicType(10);
  public static final BasicType T_LONG = new BasicType(11);
  public static final BasicType T_OBJECT = new BasicType(12);
  public static final BasicType T_ARRAY = new BasicType(13);
  public static final BasicType T_VOID = new BasicType(14);
  public static final BasicType T_ADDRESS = new BasicType(15);
  public static final BasicType T_CONFLICT = new BasicType(16);
  public static final BasicType T_ILLEGAL = new BasicType(99);
  private int type;
  
  public static int getTBoolean()
  {
    return 4;
  }
  
  public static int getTChar()
  {
    return 5;
  }
  
  public static int getTFloat()
  {
    return 6;
  }
  
  public static int getTDouble()
  {
    return 7;
  }
  
  public static int getTByte()
  {
    return 8;
  }
  
  public static int getTShort()
  {
    return 9;
  }
  
  public static int getTInt()
  {
    return 10;
  }
  
  public static int getTLong()
  {
    return 11;
  }
  
  public static int getTObject()
  {
    return 12;
  }
  
  public static int getTArray()
  {
    return 13;
  }
  
  public static int getTVoid()
  {
    return 14;
  }
  
  public static int getTAddress()
  {
    return 15;
  }
  
  public static int getTConflict()
  {
    return 16;
  }
  
  public static int getTIllegal()
  {
    return 99;
  }
  
  public static BasicType charToBasicType(char c)
  {
    switch (c)
    {
    case 'B': 
      return T_BYTE;
    case 'C': 
      return T_CHAR;
    case 'D': 
      return T_DOUBLE;
    case 'F': 
      return T_FLOAT;
    case 'I': 
      return T_INT;
    case 'J': 
      return T_LONG;
    case 'S': 
      return T_SHORT;
    case 'Z': 
      return T_BOOLEAN;
    case 'V': 
      return T_VOID;
    case 'L': 
      return T_OBJECT;
    case '[': 
      return T_ARRAY;
    }
    return T_ILLEGAL;
  }
  
  public static int charToType(char c)
  {
    return charToBasicType(c).getType();
  }
  
  public int getType()
  {
    return type;
  }
  
  private BasicType(int type)
  {
    this.type = type;
  }
}

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

public class BasicTypeSize
{
  private static boolean initialized = false;
  private static int tBooleanSize = 1;
  private static int tCharSize = 1;
  private static int tFloatSize = 1;
  private static int tDoubleSize = 2;
  private static int tByteSize = 1;
  private static int tShortSize = 1;
  private static int tIntSize = 1;
  private static int tLongSize = 2;
  private static int tObjectSize = 1;
  private static int tArraySize = 1;
  private static int tVoidSize = 0;
  
  public static int getTBooleanSize()
  {
    return tBooleanSize;
  }
  
  public static int getTCharSize()
  {
    return tCharSize;
  }
  
  public static int getTFloatSize()
  {
    return tFloatSize;
  }
  
  public static int getTDoubleSize()
  {
    return tDoubleSize;
  }
  
  public static int getTByteSize()
  {
    return tByteSize;
  }
  
  public static int getTShortSize()
  {
    return tShortSize;
  }
  
  public static int getTIntSize()
  {
    return tIntSize;
  }
  
  public static int getTLongSize()
  {
    return tLongSize;
  }
  
  public static int getTObjectSize()
  {
    return tObjectSize;
  }
  
  public static int getTArraySize()
  {
    return tArraySize;
  }
  
  public static int getTVoidSize()
  {
    return tVoidSize;
  }
}

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

import sun.jvm.hotspot.debugger.MachineDescription;

public class Bytes
{
  private boolean swap;
  
  public Bytes(MachineDescription machDesc)
  {
    swap = (!machDesc.isBigEndian());
  }
  
  public short swapShort(short x)
  {
    if (!swap) {
      return x;
    }
    return (short)(x >> 8 & 0xFF | x << 8);
  }
  
  public int swapInt(int x)
  {
    if (!swap) {
      return x;
    }
    return swapShort((short)x) << 16 | swapShort((short)(x >> 16)) & 0xFFFF;
  }
  
  public long swapLong(long x)
  {
    if (!swap) {
      return x;
    }
    return swapInt((int)x) << 32 | swapInt((int)(x >> 32)) & 0xFFFFFFFF;
  }
}

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

public abstract interface ClassConstants
{
  public static final int JVM_CONSTANT_Utf8 = 1;
  public static final int JVM_CONSTANT_Unicode = 2;
  public static final int JVM_CONSTANT_Integer = 3;
  public static final int JVM_CONSTANT_Float = 4;
  public static final int JVM_CONSTANT_Long = 5;
  public static final int JVM_CONSTANT_Double = 6;
  public static final int JVM_CONSTANT_Class = 7;
  public static final int JVM_CONSTANT_String = 8;
  public static final int JVM_CONSTANT_Fieldref = 9;
  public static final int JVM_CONSTANT_Methodref = 10;
  public static final int JVM_CONSTANT_InterfaceMethodref = 11;
  public static final int JVM_CONSTANT_NameAndType = 12;
  public static final int JVM_CONSTANT_MethodHandle = 15;
  public static final int JVM_CONSTANT_MethodType = 16;
  public static final int JVM_CONSTANT_InvokeDynamicTrans = 17;
  public static final int JVM_CONSTANT_InvokeDynamic = 18;
  public static final int JVM_REF_getField = 1;
  public static final int JVM_REF_getStatic = 2;
  public static final int JVM_REF_putField = 3;
  public static final int JVM_REF_putStatic = 4;
  public static final int JVM_REF_invokeVirtual = 5;
  public static final int JVM_REF_invokeStatic = 6;
  public static final int JVM_REF_invokeSpecial = 7;
  public static final int JVM_REF_newInvokeSpecial = 8;
  public static final int JVM_REF_invokeInterface = 9;
  public static final int JVM_CONSTANT_Invalid = 0;
  public static final int JVM_CONSTANT_UnresolvedClass = 100;
  public static final int JVM_CONSTANT_ClassIndex = 101;
  public static final int JVM_CONSTANT_UnresolvedString = 102;
  public static final int JVM_CONSTANT_StringIndex = 103;
  public static final int JVM_CONSTANT_UnresolvedClassInError = 104;
  public static final short MAJOR_VERSION = 49;
  public static final short MINOR_VERSION = 0;
  public static final short MAJOR_VERSION_OLD = 46;
  public static final short MINOR_VERSION_OLD = 0;
  public static final long JVM_ACC_PUBLIC = 1L;
  public static final long JVM_ACC_PRIVATE = 2L;
  public static final long JVM_ACC_PROTECTED = 4L;
  public static final long JVM_ACC_STATIC = 8L;
  public static final long JVM_ACC_FINAL = 16L;
  public static final long JVM_ACC_SYNCHRONIZED = 32L;
  public static final long JVM_ACC_SUPER = 32L;
  public static final long JVM_ACC_VOLATILE = 64L;
  public static final long JVM_ACC_BRIDGE = 64L;
  public static final long JVM_ACC_TRANSIENT = 128L;
  public static final long JVM_ACC_VARARGS = 128L;
  public static final long JVM_ACC_NATIVE = 256L;
  public static final long JVM_ACC_INTERFACE = 512L;
  public static final long JVM_ACC_ABSTRACT = 1024L;
  public static final long JVM_ACC_STRICT = 2048L;
  public static final long JVM_ACC_SYNTHETIC = 4096L;
  public static final long JVM_ACC_ANNOTATION = 8192L;
  public static final long JVM_ACC_ENUM = 16384L;
  public static final long JVM_ACC_WRITTEN_FLAGS = 32767L;
  public static final long JVM_ACC_MONITOR_MATCH = 268435456L;
  public static final long JVM_ACC_HAS_MONITOR_BYTECODES = 536870912L;
  public static final long JVM_ACC_HAS_LOOPS = 1073741824L;
  public static final long JVM_ACC_LOOPS_FLAG_INIT = -2147483648L;
  public static final long JVM_ACC_QUEUED = 16777216L;
  public static final long JVM_ACC_NOT_OSR_COMPILABLE = 134217728L;
  public static final long JVM_ACC_HAS_LINE_NUMBER_TABLE = 1048576L;
  public static final long JVM_ACC_HAS_CHECKED_EXCEPTIONS = 4194304L;
  public static final long JVM_ACC_HAS_JSRS = 8388608L;
  public static final long JVM_ACC_IS_OBSOLETE = 65536L;
  public static final long JVM_ACC_HAS_MIRANDA_METHODS = 268435456L;
  public static final long JVM_ACC_HAS_VANILLA_CONSTRUCTOR = 536870912L;
  public static final long JVM_ACC_HAS_FINALIZER = 1073741824L;
  public static final long JVM_ACC_IS_CLONEABLE = -2147483648L;
  public static final long JVM_ACC_HAS_LOCAL_VARIABLE_TABLE = 2097152L;
  public static final long JVM_ACC_PROMOTED_FLAGS = 2097152L;
  public static final long JVM_ACC_FIELD_ACCESS_WATCHED = 8192L;
  public static final long JVM_ACC_FIELD_MODIFICATION_WATCHED = 32768L;
  public static final long JVM_ACC_FIELD_FLAGS = 65535L;
  public static final long JVM_RECOGNIZED_CLASS_MODIFIERS = 30257L;
  public static final long JVM_RECOGNIZED_FIELD_MODIFIERS = 20703L;
  public static final long JVM_RECOGNIZED_METHOD_MODIFIERS = 7679L;
}

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

import java.util.ArrayList;
import java.util.List;
import sun.jvm.hotspot.code.CodeCache;
import sun.jvm.hotspot.code.ConstantDoubleValue;
import sun.jvm.hotspot.code.ConstantIntValue;
import sun.jvm.hotspot.code.ConstantLongValue;
import sun.jvm.hotspot.code.ConstantOopReadValue;
import sun.jvm.hotspot.code.Location;
import sun.jvm.hotspot.code.LocationValue;
import sun.jvm.hotspot.code.MonitorValue;
import sun.jvm.hotspot.code.NMethod;
import sun.jvm.hotspot.code.ObjectValue;
import sun.jvm.hotspot.code.ScopeDesc;
import sun.jvm.hotspot.code.ScopeValue;
import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.debugger.OopHandle;
import sun.jvm.hotspot.oops.Method;
import sun.jvm.hotspot.utilities.Assert;

public class CompiledVFrame
  extends JavaVFrame
{
  private ScopeDesc scope;
  private boolean mayBeImprecise;
  
  public CompiledVFrame(Frame fr, RegisterMap regMap, JavaThread thread, ScopeDesc scope, boolean mayBeImprecise)
  {
    super(fr, regMap, thread);
    this.scope = scope;
    this.mayBeImprecise = mayBeImprecise;
    if (!VM.getVM().isDebugging()) {
      Assert.that(scope != null, "scope must be present");
    }
  }
  
  public boolean isTop()
  {
    if (VM.getVM().isDebugging()) {
      return (getScope() == null) || (getScope().isTop());
    }
    return getScope().isTop();
  }
  
  public boolean isCompiledFrame()
  {
    return true;
  }
  
  public boolean isDeoptimized()
  {
    return fr.isDeoptimized();
  }
  
  public boolean mayBeImpreciseDbg()
  {
    return mayBeImprecise;
  }
  
  public NMethod getCode()
  {
    return VM.getVM().getCodeCache().findNMethod(fr.getPC());
  }
  
  public NMethod getCodeUnsafe()
  {
    return VM.getVM().getCodeCache().findNMethodUnsafe(fr.getPC());
  }
  
  public ScopeDesc getScope()
  {
    return scope;
  }
  
  public Method getMethod()
  {
    if ((VM.getVM().isDebugging()) && (getScope() == null)) {
      return getCodeUnsafe().getMethod();
    }
    return getScope().getMethod();
  }
  
  public StackValueCollection getLocals()
  {
    List scvList = getScope().getLocals();
    if (scvList == null) {
      return new StackValueCollection();
    }
    int length = scvList.size();
    StackValueCollection result = new StackValueCollection(length);
    for (int i = 0; i < length; i++) {
      result.add(createStackValue((ScopeValue)scvList.get(i)));
    }
    return result;
  }
  
  public StackValueCollection getExpressions()
  {
    List scvList = getScope().getExpressions();
    if (scvList == null) {
      return new StackValueCollection();
    }
    int length = scvList.size();
    StackValueCollection result = new StackValueCollection(length);
    for (int i = 0; i < length; i++) {
      result.add(createStackValue((ScopeValue)scvList.get(i)));
    }
    return result;
  }
  
  public List getMonitors()
  {
    List monitors = getScope().getMonitors();
    if (monitors == null) {
      return new ArrayList();
    }
    List result = new ArrayList(monitors.size());
    for (int i = 0; i < monitors.size(); i++)
    {
      MonitorValue mv = (MonitorValue)monitors.get(i);
      ScopeValue ov = mv.owner();
      StackValue ownerSV = createStackValue(ov);
      if (ov.isObject())
      {
        Assert.that((mv.eliminated()) && (ownerSV.objIsScalarReplaced()), "monitor should be eliminated for scalar replaced object");
        
        ScopeValue kv = ((ObjectValue)ov).getKlass();
        Assert.that(kv.isConstantOop(), "klass should be oop constant for scalar replaced object");
        OopHandle k = ((ConstantOopReadValue)kv).getValue();
        result.add(new MonitorInfo(k, resolveMonitorLock(mv.basicLock()), mv.eliminated(), true));
      }
      else
      {
        result.add(new MonitorInfo(ownerSV.getObject(), resolveMonitorLock(mv.basicLock()), mv.eliminated(), false));
      }
    }
    return result;
  }
  
  public int getBCI()
  {
    int raw = getRawBCI();
    return raw == -1 ? 0 : raw;
  }
  
  public int getRawBCI()
  {
    if ((VM.getVM().isDebugging()) && (getScope() == null)) {
      return 0;
    }
    return getScope().getBCI();
  }
  
  public VFrame sender()
  {
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(isTop(), "just checking");
    }
    return sender(false);
  }
  
  public VFrame sender(boolean mayBeImprecise)
  {
    if ((!VM.getVM().isDebugging()) && 
      (Assert.ASSERTS_ENABLED)) {
      Assert.that(scope != null, "When new stub generator is in place, then scope can never be NULL");
    }
    Frame f = (Frame)getFrame().clone();
    return isTop() ? super.sender(false) : new CompiledVFrame(f, getRegisterMap(), getThread(), getScope().sender(), mayBeImprecise);
  }
  
  private StackValue createStackValue(ScopeValue sv)
  {
    if (sv.isLocation())
    {
      Location loc = ((LocationValue)sv).getLocation();
      if (loc.isIllegal()) {
        return new StackValue();
      }
      Address valueAddr = loc.isRegister() ? getRegisterMap().getLocation(new VMReg(loc.getRegisterNumber())) : fr.getUnextendedSP().addOffsetTo(loc.getStackOffset());
      if (loc.holdsFloat())
      {
        if (Assert.ASSERTS_ENABLED) {
          Assert.that(loc.isRegister(), "floats always saved to stack in 1 word");
        }
        float value = (float)valueAddr.getJDoubleAt(0L);
        return new StackValue(Float.floatToIntBits(value) & 0xFFFFFFFF);
      }
      if (loc.holdsInt())
      {
        if (Assert.ASSERTS_ENABLED) {
          Assert.that(loc.isRegister(), "ints always saved to stack in 1 word");
        }
        return new StackValue(valueAddr.getJLongAt(0L) & 0xFFFFFFFFFFFFFFFF);
      }
      if (loc.holdsNarrowOop())
      {
        if ((loc.isRegister()) && (VM.getVM().isBigEndian())) {
          return new StackValue(valueAddr.getCompOopHandleAt(VM.getVM().getIntSize()), 0L);
        }
        return new StackValue(valueAddr.getCompOopHandleAt(0L), 0L);
      }
      if (loc.holdsOop()) {
        return new StackValue(valueAddr.getOopHandleAt(0L), 0L);
      }
      if (loc.holdsDouble()) {
        return new StackValue(valueAddr.getJIntAt(0L) & 0xFFFFFFFF);
      }
      if (loc.holdsAddr())
      {
        if (Assert.ASSERTS_ENABLED) {
          Assert.that(!VM.getVM().isServerCompiler(), "No address type for locations with C2 (jsr-s are inlined)");
        }
        return new StackValue(0L);
      }
      if ((VM.getVM().isLP64()) && (loc.holdsLong()))
      {
        if (loc.isRegister()) {
          return new StackValue((valueAddr.getJLongAt(0L) & 0xFFFFFFFFFFFFFFFF) << 32 | valueAddr.getJLongAt(8L) & 0xFFFFFFFFFFFFFFFF);
        }
        return new StackValue(valueAddr.getJLongAt(0L));
      }
      if (loc.isRegister()) {
        return new StackValue(valueAddr.getJIntAt(0L) & 0xFFFFFFFF);
      }
      return new StackValue(valueAddr.getJIntAt(0L) & 0xFFFFFFFF);
    }
    if (sv.isConstantInt()) {
      return new StackValue(((ConstantIntValue)sv).getValue() & 0xFFFFFFFF);
    }
    if (sv.isConstantOop()) {
      return new StackValue(((ConstantOopReadValue)sv).getValue(), 0L);
    }
    if (sv.isConstantDouble())
    {
      double d = ((ConstantDoubleValue)sv).getValue();
      return new StackValue(Double.doubleToLongBits(d) & 0xFFFFFFFFFFFFFFFF);
    }
    if ((VM.getVM().isLP64()) && (sv.isConstantLong())) {
      return new StackValue(((ConstantLongValue)sv).getValue() & 0xFFFFFFFFFFFFFFFF);
    }
    if (sv.isObject()) {
      return new StackValue(((ObjectValue)sv).getValue(), 1L);
    }
    Assert.that(false, "Should not reach here");
    return new StackValue(0L);
  }
  
  private BasicLock resolveMonitorLock(Location location)
  {
    if (Ass
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