sa-jdi

 + " unbiased: " + unBiasSP(raw_sp));
    }
    return unBiasSP(raw_sp);
  }
  
  public Address getID()
  {
    return getSP();
  }
  
  public Address getYoungerSP()
  {
    if (DEBUG) {
      System.out.println("getYoungerSP: " + raw_youngerSP + " unbiased: " + unBiasSP(raw_youngerSP));
    }
    return unBiasSP(raw_youngerSP);
  }
  
  public SPARCFrame(Address raw_sp, Address raw_youngerSP, boolean youngerFrameIsInterpreted)
  {
    if (DEBUG) {
      System.out.println("Constructing frame(1) raw_sp: " + raw_sp + " raw_youngerSP: " + raw_youngerSP);
    }
    if (Assert.ASSERTS_ENABLED)
    {
      Assert.that(unBiasSP(raw_sp).andWithMask(VM.getVM().getAddressSize() - 1L) == null, "Expected raw sp likely got real sp, value was " + raw_sp);
      if (raw_youngerSP != null) {
        Assert.that(unBiasSP(raw_youngerSP).andWithMask(VM.getVM().getAddressSize() - 1L) == null, "Expected raw youngerSP likely got real youngerSP, value was " + raw_youngerSP);
      }
    }
    this.raw_sp = raw_sp;
    this.raw_youngerSP = raw_youngerSP;
    if (raw_youngerSP == null)
    {
      pc = null;
    }
    else
    {
      Address youngerSP = unBiasSP(raw_youngerSP);
      pc = youngerSP.getAddressAt(SPARCRegisters.I7.spOffsetInSavedWindow()).addOffsetTo(8L);
      if (Assert.ASSERTS_ENABLED) {
        Assert.that(youngerSP.getAddressAt(SPARCRegisters.FP.spOffsetInSavedWindow()).equals(raw_sp), "youngerSP must be valid");
      }
    }
    if (youngerFrameIsInterpreted)
    {
      long IsavedSP = SPARCRegisters.IsavedSP.spOffsetInSavedWindow();
      
      interpreterSPAdjustmentOffset = 0L;
      Address savedSP = unBiasSP(getYoungerSP().getAddressAt(IsavedSP));
      if (savedSP == null)
      {
        if (DEBUG) {
          System.out.println("WARNING: IsavedSP was null for frame " + this);
        }
      }
      else {
        interpreterSPAdjustmentOffset = savedSP.minus(getSP());
      }
    }
    else
    {
      interpreterSPAdjustmentOffset = 0L;
    }
    if (pc != null)
    {
      CodeBlob cb = VM.getVM().getCodeCache().findBlob(pc);
      if ((cb != null) && (cb.isJavaMethod()))
      {
        NMethod nm = (NMethod)cb;
        if (pc.equals(nm.deoptBegin()))
        {
          pc = getUnextendedSP().getAddressAt(nm.origPCOffset());
          deoptimized = true;
        }
      }
    }
  }
  
  public SPARCFrame(Address raw_sp, Address pc)
  {
    if (DEBUG) {
      System.out.println("Constructing frame(2) raw_sp: " + raw_sp);
    }
    this.raw_sp = raw_sp;
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(unBiasSP(raw_sp).andWithMask(VM.getVM().getAddressSize() - 1L) == null, "Expected raw sp likely got real sp, value was " + raw_sp);
    }
    raw_youngerSP = null;
    this.pc = pc;
    interpreterSPAdjustmentOffset = 0L;
  }
  
  private SPARCFrame() {}
  
  public Object clone()
  {
    SPARCFrame frame = new SPARCFrame();
    raw_sp = raw_sp;
    pc = pc;
    raw_youngerSP = raw_youngerSP;
    interpreterSPAdjustmentOffset = interpreterSPAdjustmentOffset;
    deoptimized = deoptimized;
    return frame;
  }
  
  public boolean equals(Object arg)
  {
    if (arg == null) {
      return false;
    }
    if (!(arg instanceof SPARCFrame)) {
      return false;
    }
    SPARCFrame other = (SPARCFrame)arg;
    
    return (AddressOps.equal(getSP(), other.getSP())) && (AddressOps.equal(getFP(), other.getFP())) && (AddressOps.equal(getPC(), other.getPC()));
  }
  
  public int hashCode()
  {
    if (raw_sp == null) {
      return 0;
    }
    return raw_sp.hashCode();
  }
  
  public String toString()
  {
    Address fp = getFP();
    Address sp = getSP();
    Address youngerSP = getYoungerSP();
    
    return "sp: " + (sp == null ? "null" : sp.toString()) + ", younger_sp: " + (youngerSP == null ? "null" : youngerSP.toString()) + ", fp: " + (fp == null ? "null" : fp.toString()) + ", pc: " + (pc == null ? "null" : pc.toString());
  }
  
  public boolean isSignalHandlerFrameDbg()
  {
    CDebugger cdbg = VM.getVM().getDebugger().getCDebugger();
    if (cdbg != null)
    {
      LoadObject dso = cdbg.loadObjectContainingPC(getPC());
      if (dso != null)
      {
        ClosestSymbol cs = dso.closestSymbolToPC(getPC());
        if ((cs != null) && (cs.getName().equals("__sighndlr"))) {
          return true;
        }
        return false;
      }
      return false;
    }
    if (getYoungerSP() == null) {
      return false;
    }
    Address i2 = getSP().getAddressAt(SPARCRegisters.I2.spOffsetInSavedWindow());
    if (i2 == null) {
      return false;
    }
    Address fp = getFP();
    
    int MAJOR_HACK_OFFSET = 8;
    
    boolean res = i2.equals(fp.addOffsetTo(VM.getVM().getAddressSize() * (16 + MAJOR_HACK_OFFSET)));
    if (res)
    {
      Address sigInfoAddr = getSP().getAddressAt(SPARCRegisters.I5.spOffsetInSavedWindow());
      if (sigInfoAddr == null)
      {
        System.err.println("Frame with fp = " + fp + " looked like a signal handler frame but wasn't");
        res = false;
      }
    }
    return res;
  }
  
  public int getSignalNumberDbg()
  {
    Address sigInfoAddr = getSP().getAddressAt(SPARCRegisters.I5.spOffsetInSavedWindow());
    
    return (int)sigInfoAddr.getCIntegerAt(0L, 4L, false);
  }
  
  public String getSignalNameDbg()
  {
    return POSIXSignals.getSignalName(getSignalNumberDbg());
  }
  
  public boolean isInterpretedFrameValid()
  {
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(isInterpretedFrame(), "Not an interpreted frame");
    }
    if ((getFP() == null) || (getFP().andWithMask(2L * VM.getVM().getAddressSize() - 1L) != null)) {
      return false;
    }
    if ((getSP() == null) || (getSP().andWithMask(2L * VM.getVM().getAddressSize() - 1L) != null)) {
      return false;
    }
    if (getFP().addOffsetTo(6L * VM.getVM().getAddressSize()).lessThan(getSP())) {
      return false;
    }
    OopHandle methodHandle = addressOfInterpreterFrameMethod().getOopHandleAt(0L);
    if (!VM.getVM().getObjectHeap().isValidMethod(methodHandle)) {
      return false;
    }
    if (getFP().lessThanOrEqual(getSP())) {
      return false;
    }
    if (getFP().minus(getSP()) > 4096L * VM.getVM().getAddressSize()) {
      return false;
    }
    Address bcx = addressOfInterpreterFrameBCX().getAddressAt(0L);
    Method method;
    try
    {
      method = (Method)VM.getVM().getObjectHeap().newOop(methodHandle);
    }
    catch (UnknownOopException ex)
    {
      return false;
    }
    int bci = bcpToBci(bcx, method);
    if (bci < 0) {
      return false;
    }
    return true;
  }
  
  public long frameSize()
  {
    return getSenderSP().minus(getSP()) / VM.getVM().getAddressSize();
  }
  
  public Address getLink()
  {
    return unBiasSP(getFP().getAddressAt(SPARCRegisters.FP.spOffsetInSavedWindow()));
  }
  
  public Frame sender(RegisterMap regMap, CodeBlob cb)
  {
    SPARCRegisterMap map = (SPARCRegisterMap)regMap;
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(map != null, "map must be set");
    }
    map.setIncludeArgumentOops(false);
    if (isEntryFrame()) {
      return senderForEntryFrame(map);
    }
    Address youngerSP = getSP();
    Address sp = getSenderSP();
    boolean isInterpreted = false;
    if (VM.getVM().isDebugging()) {
      if (isSignalHandlerFrameDbg())
      {
        if (DEBUG) {
          System.out.println("SPARCFrame.sender: found signal handler frame");
        }
        long offset = getMContextAreaOffsetInUContext();
        Address fp = sp;
        
        fp = fp.addOffsetTo(getUContextOffset() + getMContextAreaOffsetInUContext());
        
        int PC_OFFSET_IN_GREGSET = 1;
        int SP_OFFSET_IN_GREGSET = 17;
        raw_sp = fp.getAddressAt(VM.getVM().getAddressSize() * SP_OFFSET_IN_GREGSET);
        Address pc = fp.getAddressAt(VM.getVM().getAddressSize() * PC_OFFSET_IN_GREGSET);
        return new SPARCFrame(raw_sp, pc);
      }
    }
    if (!VM.getVM().isCore()) {
      if (VM.getVM().getInterpreter().contains(this.pc))
      {
        isInterpreted = true;
        map.makeIntegerRegsUnsaved();
        map.shiftWindow(sp, youngerSP);
      }
      else
      {
        cb = VM.getVM().getCodeCache().findBlob(this.pc);
        if (cb != null)
        {
          if (cb.callerMustGCArguments(map.getThread())) {
            map.setIncludeArgumentOops(true);
          }
          map.shiftWindow(sp, youngerSP);
          if ((map.getUpdateMap()) && 
            (cb.getOopMaps() != null)) {
            OopMapSet.updateRegisterMap(this, cb, map, VM.getVM().isDebugging());
          }
        }
      }
    }
    return new SPARCFrame(biasSP(sp), biasSP(youngerSP), isInterpreted);
  }
  
  protected boolean hasSenderPD()
  {
    try
    {
      if (getSP() == null) {
        return false;
      }
      if (unBiasSP(getSP().getAddressAt(SPARCRegisters.FP.spOffsetInSavedWindow())) == null) {
        return false;
      }
      return true;
    }
    catch (RuntimeException e)
    {
      if (DEBUG) {
        System.out.println("Bad frame " + this);
      }
      throw e;
    }
  }
  
  public Address getSenderPC()
  {
    return addressOfI7().getAddressAt(0L).addOffsetTo(8L);
  }
  
  public Address getUnextendedSP()
  {
    return getSP().addOffsetTo(interpreterSPAdjustmentOffset);
  }
  
  public Address getSenderSP()
  {
    return getFP();
  }
  
  public SPARCFrame afterSave()
  {
    return new SPARCFrame(biasSP(getYoungerSP()), null);
  }
  
  public Address getFP()
  {
    Address sp = getSP();
    if (sp == null) {
      System.out.println("SPARCFrame.getFP(): sp == null");
    }
    Address fpAddr = sp.addOffsetTo(SPARCRegisters.FP.spOffsetInSavedWindow());
    try
    {
      Address fp = unBiasSP(fpAddr.getAddressAt(0L));
      if (fp == null) {
        System.out.println("SPARCFrame.getFP(): fp == null (&fp == " + fpAddr + ")");
      }
      return fp;
    }
    catch (RuntimeException e)
    {
      System.out.println("SPARCFrame.getFP(): is bad (&fp == " + fpAddr + " sp = " + sp + ")");
    }
    return null;
  }
  
  private Address addressOfFPSlot(int index)
  {
    return getFP().addOffsetTo(index * VM.getVM().getAddressSize());
  }
  
  public Address addressOfInterpreterFrameLocals()
  {
    return getSP().addOffsetTo(SPARCRegisters.Llocals.spOffsetInSavedWindow());
  }
  
  private Address addressOfInterpreterFrameBCX()
  {
    return getSP().addOffsetTo(SPARCRegisters.Lbcp.spOffsetInSavedWindow());
  }
  
  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 addressOfInterpreterFrameExpressionStack()
  {
    return addressOfInterpreterFrameMonitors().addOffsetTo(-1L * VM.getVM().getAddressSize());
  }
  
  public int getInterpreterFrameExpressionStackDirection()
  {
    return -1;
  }
  
  public Address addressOfInterpreterFrameTOS()
  {
    return getSP().getAddressAt(SPARCRegisters.Lesp.spOffsetInSavedWindow()).addOffsetTo(VM.getVM().getAddressSize());
  }
  
  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 getFP();
  }
  
  private Address addressOfInterpreterFrameMonitors()
  {
    return getSP().addOffsetTo(SPARCRegisters.Lmonitors.spOffsetInSavedWindow()).getAddressAt(0L);
  }
  
  public BasicObjectLock interpreterFrameMonitorBegin()
  {
    int roundedVMLocalWords = Bits.roundTo(6, 2);
    return new BasicObjectLock(addressOfFPSlot(-1 * roundedVMLocalWords));
  }
  
  public BasicObjectLock interpreterFrameMonitorEnd()
  {
    return new BasicObjectLock(addressOfInterpreterFrameMonitors());
  }
  
  public int interpreterFrameMonitorSize()
  {
    return Bits.roundTo(BasicObjectLock.size(), 2 * (int)VM.getVM().getAddressSize());
  }
  
  public Address addressOfInterpreterFrameMethod()
  {
    return getSP().addOffsetTo(SPARCRegisters.Lmethod.spOffsetInSavedWindow());
  }
  
  public Address addressOfInterpreterFrameCPCache()
  {
    return getSP().addOffsetTo(SPARCRegisters.LcpoolCache.spOffsetInSavedWindow());
  }
  
  public JavaCallWrapper getEntryFrameCallWrapper()
  {
    SPARCArgument link = new SPARCArgument(0, false);
    return (JavaCallWrapper)VMObjectFactory.newObject(JavaCallWrapper.class, getSP().getAddressAt(link.asIn().asRegister().spOffsetInSavedWindow()));
  }
  
  protected Address addressOfSavedOopResult()
  {
    return addressOfO0();
  }
  
  protected Address addressOfSavedReceiver()
  {
    return addressOfO0();
  }
  
  private Address addressOfI7()
  {
    return getSP().addOffsetTo(SPARCRegisters.I7.spOffsetInSavedWindow());
  }
  
  private Address addressOfO7()
  {
    return afterSave().addressOfI7();
  }
  
  private Address addressOfI0()
  {
    return getSP().addOffsetTo(SPARCRegisters.I0.spOffsetInSavedWindow());
  }
  
  private Address addressOfO0()
  {
    return afterSave().addressOfI0();
  }
  
  private static boolean addressesEqual(Address a1, Address a2)
  {
    if ((a1 == null) && (a2 == null)) {
      return true;
    }
    if ((a1 == null) || (a2 == null)) {
      return false;
    }
    return a1.equals(a2);
  }
  
  private Frame senderForEntryFrame(RegisterMap regMap)
  {
    SPARCRegisterMap map = (SPARCRegisterMap)regMap;
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(map != null, "map must be set");
    }
    JavaCallWrapper jcw = 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");
    }
    Address lastJavaSP = jcw.getLastJavaSP();
    Address lastJavaPC = jcw.getLastJavaPC();
    map.clear();
    if (!VM.getVM().isCore())
    {
      map.makeIntegerRegsUnsaved();
      map.shiftWindow(lastJavaSP, null);
    }
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(map.getIncludeArgumentOops(), "should be set by clear");
    }
    if (lastJavaPC != null) {
      return new SPARCFrame(biasSP(lastJavaSP), lastJavaPC);
    }
    Address youngerSP = getNextYoungerSP(lastJavaSP, getSP());
    return new SPARCFrame(biasSP(lastJavaSP), biasSP(youngerSP), false);
  }
  
  private static Address getNextYoungerSP(Address oldSP, Address youngSP)
  {
    Address sp = getNextYoungerSPOrNull(oldSP, youngSP, null);
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(sp != null, "missed the SP");
    }
    return sp;
  }
  
  private static Address getNextYoungerSPOrNull(Address oldSP, Address youngSP, Address sp)
  {
    if (youngSP == null) {
      throw new RuntimeException("can not handle null youngSP in debugging system (seems to require register window flush)");
    }
    if (sp == null) {
      sp = youngSP;
    }
    Address previousSP = null;
    
    int maxFrames = (int)(oldSP.minus(sp) / (16L * VM.getVM().getAddressSize()));
    while ((!sp.equals(oldSP)) && (spIsValid(oldSP, youngSP, sp)) && 
      (maxFrames-- > 0))
    {
      previousSP = sp;
      sp = unBiasSP(sp.getAddressAt(SPARCRegisters.FP.spOffsetInSavedWindow()));
    }
    return sp.equals(oldSP) ? previousSP : null;
  }
  
  private static boolean spIsValid(Address oldSP, Address youngSP, Address sp)
  {
    long mask = VM.getVM().getAddressSize();
    mask = 2L * mask - 1L;
    return (sp.andWithMask(mask) == null) && (sp.lessThanOrEqual(oldSP)) && (sp.greaterThanOrEqual(youngSP));
  }
  
  public long getUContextOffset()
  {
    int MAJOR_HACK_OFFSET = 8;
    
    return VM.getVM().getAddressSize() * (16 + MAJOR_HACK_OFFSET);
  }
  
  public long getMContextAreaOffsetInUContext()
  {
    long offset = VM.getVM().alignUp(4L, VM.getVM().getAddressSize());
    offset = VM.getVM().alignUp(offset + VM.getVM().getAddressSize(), 8L);
    
    offset += 16L + 2L * VM.getVM().getAddressSize() + 4L;
    
    offset = VM.getVM().alignUp(offset + VM.getVM().getAddressSize(), 8L);
    
    return offset;
  }
}

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

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

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

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

import java.util.Observable;
import java.util.Observer;
import sun.jvm.hotspot.asm.sparc.SPARCRegister;
import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.runtime.Frame;
import sun.jvm.hotspot.runtime.JavaThread;
import sun.jvm.hotspot.runtime.RegisterMap;
import sun.jvm.hotspot.runtime.VM;
import sun.jvm.hotspot.runtime.VMReg;
import sun.jvm.hotspot.types.Type;
import sun.jvm.hotspot.types.TypeDataBase;
import sun.jvm.hotspot.utilities.Assert;

public class SPARCRegisterMap
  extends RegisterMap
{
  private Address window;
  private Address youngerWindow;
  private static int registerImplNumberOfRegisters;
  private static int[] R_L_nums = { 32, 34, 36, 38, 40, 42, 44, 46 };
  private static int[] R_I_nums = { 48, 50, 52, 54, 56, 58, 60, 62 };
  private static int[] R_O_nums = { 16, 18, 20, 22, 24, 26, 28, 30 };
  private static int[] R_G_nums = { 0, 2, 4, 6, 8, 10, 12, 14 };
  private static long badMask;
  private static long R_LIO_mask;
  private static int sizeofJint;
  
  static
  {
    VM.registerVMInitializedObserver(new Observer()
    {
      public void update(Observable o, Object data)
      {
        SPARCRegisterMap.initialize(VM.getVM().getTypeDataBase());
      }
    });
  }
  
  private static void initialize(TypeDataBase db)
  {
    badMask = 0L;
    R_LIO_mask = 0L;
    
    sizeofJint = (int)db.lookupType("jint").getSize();
    registerImplNumberOfRegisters = db.lookupIntConstant("RegisterImpl::number_of_registers").intValue();
    for (int i = 0; i < 8; i++)
    {
      Assert.that(R_L_nums[i] < locationValidTypeSize, "in first chunk");
      Assert.that(R_I_nums[i] < locationValidTypeSize, "in first chunk");
      Assert.that(R_O_nums[i] < locationValidTypeSize, "in first chunk");
      Assert.that(R_G_nums[i] < locationValidTypeSize, "in first chunk");
    }
    badMask |= 1L << R_O_nums[6];
    badMask |= 1L << R_O_nums[7];
    badMask |= 1L << R_I_nums[6];
    badMask |= 1L << R_I_nums[7];
    badMask |= 1L << R_G_nums[2];
    badMask |= 1L << R_G_nums[7];
    for (int i = 0; i < 8; i++)
    {
      R_LIO_mask |= 1L << R_L_nums[i];
      R_LIO_mask |= 1L << R_I_nums[i];
      R_LIO_mask |= 1L << R_O_nums[i];
    }
  }
  
  public SPARCRegisterMap(JavaThread thread, boolean updateMap)
  {
    super(thread, updateMap);
  }
  
  protected SPARCRegisterMap(RegisterMap map)
  {
    super(map);
  }
  
  public Object clone()
  {
    SPARCRegisterMap retval = new SPARCRegisterMap(this);
    return retval;
  }
  
  protected void clearPD()
  {
    if (thread.hasLastJavaFrame())
    {
      Frame fr = thread.getLastFrame();
      window = fr.getSP();
    }
    else
    {
      window = null;
      if (VM.getVM().isDebugging())
      {
        Frame fr = thread.getCurrentFrameGuess();
        if (fr != null) {
          window = fr.getSP();
        }
      }
    }
    youngerWindow = null;
  }
  
  protected Address getLocationPD(VMReg vmreg)
  {
    VM vm = VM.getVM();
    int regname = vmreg.getValue();
    if (Assert.ASSERTS_ENABLED) {
      Assert.that((0 <= regname) && (regname < regCount), "sanity check");
    }
    if (regname >= registerImplNumberOfRegisters << 1) {
      return null;
    }
    if ((badMask & 1L << regname) != 0L) {
      return null;
    }
    int secondWord = 0;
    if (!isEven(regname)) {
      if (vm.isLP64()) {
        secondWord = sizeofJint;
      } else {
        return null;
      }
    }
    SPARCRegister reg = new SPARCRegister(regname >> 1);
    if (reg.isOut())
    {
      if (Assert.ASSERTS_ENABLED) {
        Assert.that(youngerWindow != null, "Younger window should be available");
      }
      return youngerWindow.addOffsetTo(reg.afterSave().spOffsetInSavedWindow() + secondWord);
    }
    if ((reg.isLocal()) || (reg.isIn()))
    {
      if (Assert.ASSERTS_ENABLED) {
        Assert.that(window != null, "Window should be available");
      }
      return window.addOffsetTo(reg.spOffsetInSavedWindow() + secondWord);
    }
    return null;
  }
  
  protected void initializePD()
  {
    window = null;
    youngerWindow = null;
    
    makeIntegerRegsUnsaved();
  }
  
  protected void initializeFromPD(RegisterMap map)
  {
    SPARCRegisterMap srm = (SPARCRegisterMap)map;
    window = window;
    youngerWindow = youngerWindow;
    
    makeIntegerRegsUnsaved();
  }
  
  public void shiftWindow(Address sp, Address youngerSP)
  {
    window = sp;
    youngerWindow = youngerSP;
    if (locationValid[0] != 0L) {
      shiftIndividualRegisters();
    }
  }
  
  public void makeIntegerRegsUnsaved()
  {
    locationValid[0] = 0L;
  }
  
  private void shiftIndividualRegisters()
  {
    if (!getUpdateMap()) {
      return;
    }
    checkLocationValid();
    
    long lv = locationValid[0];
    long lv0 = lv;
    
    lv &= (R_LIO_mask ^ 0xFFFFFFFFFFFFFFFF);
    if (lv != lv0) {
      for (int i = 0; i < 8; i++) {
        if ((lv0 & 1L << R_I_nums[i]) != 0L)
        {
          location[R_O_nums[i]] = location[R_I_nums[i]];
          lv |= 1L << R_O_nums[i];
        }
      }
    }
    locationValid[0] = lv;
    checkLocationValid();
  }
  
  private boolean isEven(int i)
  {
    return (i & 0x1) == 0;
  }
  
  private void checkLocationValid()
  {
    if (Assert.ASSERTS_ENABLED) {
      Assert.that((locationValid[0] & badMask) == 0L, "cannot have special locations for SP,FP,TLS,etc.");
    }
  }
}

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

import sun.jvm.hotspot.utilities.Assert;

public class StackFrameStream
{
  private Frame fr;
  private RegisterMap regMap;
  private boolean isDone;
  
  public StackFrameStream(JavaThread thread)
  {
    this(thread, true);
  }
  
  public StackFrameStream(JavaThread thread, boolean update)
  {
    if (!VM.getVM().isDebugging())
    {
      if (Assert.ASSERTS_ENABLED) {
        Assert.that(thread.hasLastJavaFrame(), "sanity check");
      }
      fr = thread.getLastFrame();
      regMap = thread.newRegisterMap(update);
      isDone = false;
    }
    else
    {
      fr = thread.getCurrentFrameGuess();
      regMap = thread.newRegisterMap(update);
      while ((fr != null) && (!fr.isJavaFrame())) {
        if (fr.isFirstFrame()) {
          fr = null;
        } else {
          fr = fr.sender(regMap);
        }
      }
      if (fr == null) {
        isDone = true;
      }
    }
  }
  
  public boolean isDone()
  {
    if (isDone) {
      return true;
    }
    if (fr == null)
    {
      isDone = true;
      return true;
    }
    isDone = fr.isFirstFrame();
    return false;
  }
  
  public void next()
  {
    if (!isDone) {
      fr = fr.sender(regMap);
    }
  }
  
  public Frame getCurrent()
  {
    return fr;
  }
  
  public RegisterMap getRegisterMap()
  {
    return regMap;
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.runtime.StackFrameStream
 * 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.debugger.OopHandle;
import sun.jvm.hotspot.utilities.Assert;

public class StackValue
{
  private int type;
  private OopHandle handleValue;
  private long integerValue;
  
  public StackValue()
  {
    type = BasicType.getTConflict();
  }
  
  public StackValue(OopHandle h, long scalar_replaced)
  {
    handleValue = h;
    type = BasicType.getTObject();
    integerValue = scalar_replaced;
    Assert.that((integerValue == 0L) || (handleValue == null), "not null object should not be marked as scalar replaced");
  }
  
  public StackValue(long i)
  {
    integerValue = i;
    type = BasicType.getTInt();
  }
  
  public int getType()
  {
    return type;
  }
  
  public OopHandle getObject()
  {
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(type == BasicType.getTObject(), "type check");
    }
    return handleValue;
  }
  
  boolean objIsScalarReplaced()
  {
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(type == BasicType.getTObject(), "type check");
    }
    return integerValue != 0L;
  }
  
  public long getInteger()
  {
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(type == BasicType.getTInt(), "type check");
    }
    return integerValue;
  }
  
  public boolean equals(Object arg)
  {
    if (arg == null) {
      return false;
    }
    if (!arg.getClass().equals(getClass())) {
      return false;
    }
    StackValue sv = (StackValue)arg;
    if (type != type) {
      return false;
    }
    if (type == BasicType.getTObject()) {
      return handleValue.equals(handleValue);
    }
    if (type == BasicType.getTInt()) {
      return integerValue == integerValue;
    }
    return true;
  }
  
  public int hashCode()
  {
    if (type == BasicType.getTObject()) {
      return handleValue.hashCode();
    }
    return (int)integerValue;
  }
  
  public void print()
  {
    printOn(System.out);
  }
  
  public void printOn(PrintStream tty)
  {
    if (type == BasicType.getTInt()) {
      tty.print(integerValue + " (long) " + (int)integerValue + " (int)");
    } else if (type == BasicType.getTObject()) {
      tty.print("<" + handleValue + ">");
    } else if (type == BasicType.getTConflict()) {
      tty.print("conflict");
    } else {
      throw new RuntimeException("should not reach here");
    }
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.runtime.StackValue
 * 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.debugger.OopHandle;

public class StackValueCollection
{
  private List list;
  
  public StackValueCollection()
  {
    list = new ArrayList();
  }
  
  public StackValueCollection(int length)
  {
    list = new ArrayList(length);
  }
  
  public void add(StackValue val)
  {
    list.add(val);
  }
  
  public int size()
  {
    return list.size();
  }
  
  public boolean isEmpty()
  {
    return size() == 0;
  }
  
  public StackValue get(int i)
  {
    return (StackValue)list.get(i);
  }
  
  public boolean booleanAt(int slot)
  {
    return (int)get(slot).getInteger() != 0;
  }
  
  public byte byteAt(int slot)
  {
    return (byte)(int)get(slot).getInteger();
  }
  
  public char charAt(int slot)
  {
    return (char)(int)get(slot).getInteger();
  }
  
  public short shortAt(int slot)
  {
    return (short)(int)get(slot).getInteger();
  }
  
  public int intAt(int slot)
  {
    return (int)get(slot).getInteger();
  }
  
  public long longAt(int slot)
  {
    return VM.getVM().buildLongFromIntsPD((int)get(slot).getInteger(), (int)get(slot + 1).getInteger());
  }
  
  public OopHandle oopHandleAt(int slot)
  {
    return get(slot).getObject();
  }
  
  public float floatAt(int slot)
  {
    return Float.intBitsToFloat(intAt(slot));
  }
  
  public double doubleAt(int slot)
  {
    return Double.longBitsToDouble(longAt(slot));
  }
}

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

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

public class StubRoutines
{
  private static AddressField callStubReturnAddressField;
  private static AddressField callStubCompiledReturnAddressField;
  
  static
  {
    VM.registerVMInitializedObserver(new Observer()
    {
      public void update(Observable o, Object data)
      {
        StubRoutines.initialize(VM.getVM().getTypeDataBase());
      }
    });
  }
  
  private static synchronized void initialize(TypeDataBase db)
  {
    Type type = db.lookupType("StubRoutines");
    
    callStubReturnAddressField = type.getAddressField("_call_stub_return_address");
    try
    {
      type = db.lookupType("StubRoutines::x86");
      if (type != null) {
        callStubCompiledReturnAddressField = type.getAddressField("_call_stub_compiled_return");
      }
    }
    catch (RuntimeException re)
    {
      callStubCompiledReturnAddressField = null;
    }
    if ((callStubCompiledReturnAddressField == null) && (VM.getVM().getCPU().equals("x86"))) {
      throw new InternalError("Missing definition for _call_stub_compiled_return");
    }
  }
  
  public boolean returnsToCallStub(Address returnPC)
  {
    Address addr = callStubReturnAddressField.getValue();
    boolean result = false;
    if (addr == null) {
      result = addr == returnPC;
    } else {
      result = addr.equals(returnPC);
    }
    if ((result) || (callStubCompiledReturnAddressField == null)) {
      return result;
    }
    addr = callStubCompiledReturnAddressField.getValue();
    if (addr == null) {
      return addr == returnPC;
    }
    return addr.equals(returnPC);
  }
}

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

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

public class Thread
  extends VMObject
{
  private static long tlabFieldOffset;
  private static CIntegerField suspendFlagsField;
  private static int EXTERNAL_SUSPEND;
  private static int EXT_SUSPENDED;
  private static int HAS_ASYNC_EXCEPTION;
  private static AddressField activeHandlesField;
  private static AddressField currentPendingMonitorField;
  private static AddressField currentWaitingMonitorField;
  
  static
  {
    VM.registerVMInitializedObserver(new Observer()
    {
      public void update(Observable o, Object data)
      {
        Thread.initialize(VM.getVM().getTypeDataBase());
      }
    });
  }
  
  private static synchronized void initialize(TypeDataBase db)
  {
    Type type = db.lookupType("Thread");
    
    suspendFlagsField = type.getCIntegerField("_suspend_flags");
    EXTERNAL_SUSPEND = db.lookupIntConstant("Thread::_external_suspend").intValue();
    EXT_SUSPENDED = db.lookupIntConstant("Thread::_ext_suspended").intValue();
    HAS_ASYNC_EXCEPTION = db.lookupIntConstant("Thread::_has_async_exception").intValue();
    
    tlabFieldOffset = type.getField("_tlab").getOffset();
    activeHandlesField = type.getAddressField("_active_handles");
    currentPendingMonitorField = type.getAddressField("_current_pending_monitor");
    currentWaitingMonitorField = type.getAddressField("_current_waiting_monitor");
  }
  
  public Thread(Address addr)
  {
    super(addr);
  }
  
  public int suspendFlags()
  {
    return (int)suspendFlagsField.getValue(addr);
  }
  
  public boolean isExternalSuspend()
  {
    return (suspendFlags() & EXTERNAL_SUSPEND) != 0;
  }
  
  public boolean isExtSuspended()
  {
    return (suspendFlags() & EXT_SUSPENDED) != 0;
  }
  
  public boolean isBeingExtSuspended()
  {
    return (isExtSuspended()) || (isExternalSuspend());
  }
  
  public boolean isAnySuspended()
  {
    return isExtSuspended();
  }
  
  public boolean hasAsyncException()
  {
    return (suspendFlags() & HAS_ASYNC_EXCEPTION) != 0;
  }
  
  public ThreadLocalAllocBuffer tlab()
  {
    return new ThreadLocalAllocBuffer(addr.addOffsetTo(tlabFieldOffset));
  }
  
  public JNIHandleBlock activeHandles()
  {
    Address a = activeHandlesField.getAddress(addr);
    if (a == null) {
      return null;
    }
    return new JNIHandleBlock(a);
  }
  
  public boolean isVMThread()
  {
    return false;
  }
  
  public boolean isJavaThread()
  {
    return false;
  }
  
  public boolean isCompilerThread()
  {
    return false;
  }
  
  public boolean isHiddenFromExternalView()
  {
    return false;
  }
  
  public boolean isJvmtiAgentThread()
  {
    return false;
  }
  
  public boolean isWatcherThread()
  {
    return false;
  }
  
  public boolean isConcurrentMarkSweepThread()
  {
    return false;
  }
  
  public boolean isLowMemoryDetectorThread()
  {
    return false;
  }
  
  public ObjectMonitor getCurrentPendingMonitor()
  {
    Address monitorAddr = currentPendingMonitorField.getValue(addr);
    if (monitorAddr == null) {
      return null;
    }
    return new ObjectMonitor(monitorAddr);
  }
  
  public ObjectMonitor getCurrentWaitingMonitor()
  {
    Address monitorAddr = currentWaitingMonitorField.getValue(addr);
    if (monitorAddr == null) {
      return null;
    }
    return new ObjectMonitor(monitorAddr);
  }
  
  public boolean isLockOwned(Address lock)
  {
    if (isInStack(lock)) {
      return true;
    }
    return false;
  }
  
  public boolean isInStack(Address a)
  {
    return false;
  }
  
  Address threadObjectAddress()
  {
    return addr;
  }
  
  public void oopsDo(AddressVisitor oopVisitor) {}
}

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

/* Location:
 * Qualified Name:     sun.jvm.hotspot.runtime.ThreadLocalAllocBuffer.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.debugger.Address;
import sun.jvm.hotspot.debugger.OopHandle;
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 ThreadLocalAllocBuffer
  extends VMObject
{
  private static AddressField startField;
  private static AddressField topField;
  private static AddressField endField;
  private static CIntegerField desired_sizeField;
  
  static
  {
    VM.registerVMInitializedObserver(new Observer()
    {
      public void update(Observable o, Object data)
      {
        ThreadLocalAllocBuffer.initialize(VM.getVM().getTypeDataBase());
      }
    });
  }
  
  private static synchronized void initialize(TypeDataBase db)
  {
    Type type = db.lookupType("ThreadLocalAllocBuffer");
    
    startField = type.getAddressField("_start");
    topField = type.getAddressField("_top");
    endField = type.getAddressField("_end");
    desired_sizeField = type.getCIntegerField("_desired_size");
  }
  
  public ThreadLocalAllocBuffer(Address addr)
  {
    super(addr);
  }
  
  public Address start()
  {
    return startField.getValue(addr);
  }
  
  public Address end()
  {
    return endField.getValue(addr);
  }
  
  public Address top()
  {
    return topField.getValue(addr);
  }
  
  public OopHandle startAsOopHandle()
  {
    return startField.getOopHandle(addr);
  }
  
  public OopHandle nextOopHandle(OopHandle handle, long size)
  {
    return handle.addOffsetToAsOopHandle(size);
  }
  
  public void print()
  {
    printOn(System.out);
  }
  
  public boolean contains(Address p)
  {
    if (top() == null) {
      return false;
    }
    return (start().lessThanOrEqual(p)) && (top().greaterThan(p));
  }
  
  public void printOn(PrintStream tty)
  {
    tty.println(" [" + start() + "," + top() + "," + end() + ")");
  }
}

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

/* Location:
 * Qualified Name:     sun.jvm.hotspot.runtime.Threads.1
 * 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 java.util.Observable;
import java.util.Observer;
import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.runtime.linux_amd64.LinuxAMD64JavaThreadPDAccess;
import sun.jvm.hotspot.runtime.linux_ia64.LinuxIA64JavaThreadPDAccess;
import sun.jvm.hotspot.runtime.linux_sparc.LinuxSPARCJavaThreadPDAccess;
import sun.jvm.hotspot.runtime.linux_x86.LinuxX86JavaThreadPDAccess;
import sun.jvm.hotspot.runtime.solaris_amd64.SolarisAMD64JavaThreadPDAccess;
import sun.jvm.hotspot.runtime.solaris_sparc.SolarisSPARCJavaThreadPDAccess;
import sun.jvm.hotspot.runtime.solaris_x86.SolarisX86JavaThreadPDAccess;
import sun.jvm.hotspot.runtime.win32_amd64.Win32AMD64JavaThreadPDAccess;
import sun.jvm.hotspot.runtime.win32_ia64.Win32IA64JavaThreadPDAccess;
import sun.jvm.hotspot.runtime.win32_x86.Win32X86JavaThreadPDAccess;
import sun.jvm.hotspot.types.AddressField;
import sun.jvm.hotspot.types.Type;
import sun.jvm.hotspot.types.TypeDataBase;

public class Threads
{
  private static JavaThreadFactory threadFactory;
  private static AddressField threadListField;
  private static VirtualConstructor virtualConstructor;
  private static JavaThreadPDAccess access;
  
  static
  {
    VM.registerVMInitializedObserver(new Observer()
    {
      public void update(Observable o, Object data)
      {
        Threads.initialize(VM.getVM().getTypeDataBase());
      }
    });
  }
  
  private static synchronized void initialize(TypeDataBase db)
  {
    Type type = db.lookupType("Threads");
    
    threadListField = type.getAddressField("_thread_list");
    
    String os = VM.getVM().getOS();
    String cpu = VM.getVM().getCPU();
    
    access = null;
    if (os.equals("solaris"))
    {
      if (cpu.equals("sparc")) {
        access = new SolarisSPARCJavaThreadPDAccess();
      } else if (cpu.equals("x86")) {
        access = new SolarisX86JavaThreadPDAccess();
      } else if (cpu.equals("amd64")) {
        access = new SolarisAMD64JavaThreadPDAccess();
      }
    }
    else if (os.equals("win32"))
    {
      if (cpu.equals("x86")) {
        access = new Win32X86JavaThreadPDAcces
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