sa-jdi

tspot.asm.Instruction;

class ArithmeticDecoder
  extends Format3ADecoder
{
  ArithmeticDecoder(int op3, String name, int rtlOperation)
  {
    super(op3, name, rtlOperation);
  }
  
  Instruction decodeFormat3AInstruction(int instruction, SPARCRegister rs1, ImmediateOrRegister operand2, SPARCRegister rd, SPARCInstructionFactory factory)
  {
    return factory.newArithmeticInstruction(name, op3, rtlOperation, rs1, operand2, rd);
  }
}

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

import sun.jvm.hotspot.asm.Instruction;
import sun.jvm.hotspot.asm.PCRelativeAddress;

abstract class BranchDecoder
  extends InstructionDecoder
{
  static final String[] integerConditionNames = { "bn", "be", "ble", "bl", "bleu", "bcs", "bneg", "bvs", "ba", "bne", "bg", "bge", "bgu", "bcc", "bpos", "bvc" };
  static final String[] integerAnnuledConditionNames = { "bn,a", "be,a", "ble,a", "bl,a", "bleu,a", "bcs,a", "bneg,a", "bvs,a", "ba,a", "bne,a", "bg,a", "bge,a", "bgu,a", "bcc,a", "bpos,a", "bvc,a" };
  static final String[] floatConditionNames = { "fbn", "fbne", "fblg", "fbul", "fbl", "fbug", "fbg", "fbu", "fba", "fbe", "fbue", "fbge", "fbuge", "fble", "fbule", "fbo" };
  static final String[] floatAnnuledConditionNames = { "fbn,a", "fbne,a", "fblg,a", "fbul,a", "fbl,a", "fbug,a", "fbg,a", "fbu,a", "fba,a", "fbe,a", "fbue,a", "fbge,a", "fbuge,a", "fble,a", "fbule,a", "fbo,a" };
  
  static boolean getAnnuledBit(int instruction)
  {
    return (instruction & 0x20000000) != 0;
  }
  
  Instruction decode(int instruction, SPARCInstructionFactory factory)
  {
    boolean isAnnuled = getAnnuledBit(instruction);
    int conditionCode = getConditionCode(instruction);
    String conditionName = getConditionName(conditionCode, isAnnuled);
    int offset = extractSignedIntFromNBits(instruction, 22);
    
    offset <<= 2;
    PCRelativeAddress addr = new PCRelativeAddress(offset);
    return factory.newBranchInstruction(conditionName, addr, isAnnuled, conditionCode);
  }
  
  abstract String getConditionName(int paramInt, boolean paramBoolean);
}

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

import sun.jvm.hotspot.asm.Instruction;
import sun.jvm.hotspot.asm.PCRelativeAddress;

class CallDecoder
  extends InstructionDecoder
{
  Instruction decode(int instruction, SPARCInstructionFactory factory)
  {
    int offset = (instruction & 0x3FFFFFFF) << 2;
    return factory.newCallInstruction(new PCRelativeAddress(offset));
  }
}

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

class CoprocessorBranchDecoder
  extends BranchDecoder
{
  private static final String[] coprocessorConditionNames = { "cbn", "cb123", "cb12", "cb13", "cb1", "cb23", "cb2", "cb3", "cba", "cb0", "cb03", "cb02", "cb023", "cb01", "cb013", "cb012" };
  private static final String[] coprocessorAnnuledConditionNames = { "cbn,a", "cb123,a", "cb12,a", "cb13,a", "cb1,a", "cb23,a", "cb2,a", "cb3,a", "cba,a", "cb0,a", "cb03,a", "cb02,a", "cb023,a", "cb01,a", "cb013,a", "cb012,a" };
  
  String getConditionName(int conditionCode, boolean isAnnuled)
  {
    return isAnnuled ? coprocessorAnnuledConditionNames[conditionCode] : coprocessorConditionNames[conditionCode];
  }
}

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

import sun.jvm.hotspot.asm.Instruction;

class CoprocessorDecoder
  extends InstructionDecoder
{
  private int op3;
  
  CoprocessorDecoder(int op3)
  {
    this.op3 = op3;
  }
  
  Instruction decode(int instruction, SPARCInstructionFactory factory)
  {
    int rs1Num = getSourceRegister1(instruction);
    int rs2Num = getSourceRegister2(instruction);
    int rdNum = getDestinationRegister(instruction);
    
    return factory.newCoprocessorInstruction(instruction, op3, (instruction & 0x3FE0) >> 5, rs1Num, rs2Num, rdNum);
  }
}

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

class FloatBranchDecoder
  extends BranchDecoder
{
  String getConditionName(int conditionCode, boolean isAnnuled)
  {
    return isAnnuled ? floatAnnuledConditionNames[conditionCode] : floatConditionNames[conditionCode];
  }
}

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

import sun.jvm.hotspot.asm.Instruction;

abstract class FloatDecoder
  extends InstructionDecoder
{
  final int opf;
  final String name;
  final int numSources;
  final int src1Type;
  final int src2Type;
  final int resultType;
  
  FloatDecoder(int opf, String name, int src1Type, int src2Type, int resultType)
  {
    this.opf = opf;
    this.name = name;
    numSources = 2;
    this.src1Type = src1Type;
    this.src2Type = src2Type;
    this.resultType = resultType;
  }
  
  FloatDecoder(int opf, String name, int src2Type, int resultType)
  {
    this.opf = opf;
    this.name = name;
    numSources = 1;
    src1Type = Integer.MAX_VALUE;
    this.src2Type = src2Type;
    this.resultType = resultType;
  }
  
  abstract Instruction decodeFloatInstruction(int paramInt, SPARCRegister paramSPARCRegister1, SPARCRegister paramSPARCRegister2, SPARCRegister paramSPARCRegister3, SPARCInstructionFactory paramSPARCInstructionFactory);
  
  Instruction decode(int instruction, SPARCInstructionFactory factory)
  {
    int rs1Num = getSourceRegister1(instruction);
    int rs2Num = getSourceRegister2(instruction);
    int rdNum = getDestinationRegister(instruction);
    
    SPARCRegister rs1 = null;
    if (numSources == 2)
    {
      rs1 = RegisterDecoder.decode(src1Type, rs1Num);
      if (rs1 == null) {
        return factory.newIllegalInstruction(instruction);
      }
    }
    SPARCRegister rd = RegisterDecoder.decode(resultType, rdNum);
    SPARCRegister rs2 = RegisterDecoder.decode(src2Type, rs2Num);
    if ((rd == null) || (rs2 == null)) {
      return factory.newIllegalInstruction(instruction);
    }
    return decodeFloatInstruction(instruction, rs1, rs2, rd, factory);
  }
}

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

import sun.jvm.hotspot.asm.Instruction;

class FlushDecoder
  extends MemoryInstructionDecoder
{
  FlushDecoder()
  {
    super(59, "flush", Integer.MAX_VALUE);
  }
  
  Instruction decodeMemoryInstruction(int instruction, SPARCRegisterIndirectAddress addr, SPARCRegister rd, SPARCInstructionFactory factory)
  {
    return factory.newFlushInstruction(addr);
  }
}

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

import sun.jvm.hotspot.asm.ImmediateOrRegister;
import sun.jvm.hotspot.asm.Instruction;
import sun.jvm.hotspot.asm.RTLOperations;

abstract class Format3ADecoder
  extends InstructionDecoder
  implements RTLOperations
{
  final int op3;
  final String name;
  final int rtlOperation;
  
  Format3ADecoder(int op3, String name, int rtlOperation)
  {
    this.op3 = op3;
    this.name = name;
    this.rtlOperation = rtlOperation;
  }
  
  Instruction decode(int instruction, SPARCInstructionFactory factory)
  {
    SPARCRegister rs1 = SPARCRegisters.getRegister(getSourceRegister1(instruction));
    SPARCRegister rd = SPARCRegisters.getRegister(getDestinationRegister(instruction));
    ImmediateOrRegister operand2 = getOperand2(instruction);
    return decodeFormat3AInstruction(instruction, rs1, operand2, rd, factory);
  }
  
  abstract Instruction decodeFormat3AInstruction(int paramInt, SPARCRegister paramSPARCRegister1, ImmediateOrRegister paramImmediateOrRegister, SPARCRegister paramSPARCRegister2, SPARCInstructionFactory paramSPARCInstructionFactory);
}

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

import sun.jvm.hotspot.asm.Instruction;
import sun.jvm.hotspot.utilities.Assert;

class FP2RegisterDecoder
  extends FloatDecoder
{
  FP2RegisterDecoder(int opf, String name, int srcType, int resultType)
  {
    super(opf, name, srcType, resultType);
  }
  
  Instruction decodeFloatInstruction(int instruction, SPARCRegister rs1, SPARCRegister rs2, SPARCRegister rd, SPARCInstructionFactory factory)
  {
    if (Assert.ASSERTS_ENABLED) {
      Assert.that((rs2.isFloat()) && (rd.isFloat()), "rs2, rd have to be float registers");
    }
    return factory.newFP2RegisterInstruction(name, opf, (SPARCFloatRegister)rs2, (SPARCFloatRegister)rd);
  }
}

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

import sun.jvm.hotspot.asm.Instruction;
import sun.jvm.hotspot.utilities.Assert;

class FPArithmeticDecoder
  extends FloatDecoder
{
  private final int rtlOperation;
  
  FPArithmeticDecoder(int opf, String name, int rtlOperation, int src1Type, int src2Type, int resultType)
  {
    super(opf, name, src1Type, src2Type, resultType);
    this.rtlOperation = rtlOperation;
  }
  
  Instruction decodeFloatInstruction(int instruction, SPARCRegister rs1, SPARCRegister rs2, SPARCRegister rd, SPARCInstructionFactory factory)
  {
    if (Assert.ASSERTS_ENABLED) {
      Assert.that((rs1.isFloat()) && (rs2.isFloat()) && (rd.isFloat()), "rs1, rs2 and rd must be floats");
    }
    return factory.newFPArithmeticInstruction(name, opf, rtlOperation, (SPARCFloatRegister)rs1, (SPARCFloatRegister)rs2, (SPARCFloatRegister)rd);
  }
}

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

import sun.jvm.hotspot.asm.Instruction;
import sun.jvm.hotspot.utilities.Assert;

class FPMoveDecoder
  extends FloatDecoder
{
  FPMoveDecoder(int opf, String name, int srcType, int resultType)
  {
    super(opf, name, srcType, resultType);
  }
  
  Instruction decodeFloatInstruction(int instruction, SPARCRegister rs1, SPARCRegister rs2, SPARCRegister rd, SPARCInstructionFactory factory)
  {
    if (Assert.ASSERTS_ENABLED) {
      Assert.that((rs2.isFloat()) && (rd.isFloat()), "rs2, rd have to be float registers");
    }
    return factory.newFPMoveInstruction(name, opf, (SPARCFloatRegister)rs2, (SPARCFloatRegister)rd);
  }
}

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

import sun.jvm.hotspot.asm.Instruction;

abstract class FPopDecoder
  extends InstructionDecoder
{
  abstract InstructionDecoder getOpfDecoder(int paramInt);
  
  Instruction decode(int instruction, SPARCInstructionFactory factory)
  {
    int opf = getOpf(instruction);
    InstructionDecoder decoder = getOpfDecoder(opf);
    return decoder == null ? factory.newIllegalInstruction(instruction) : decoder.decode(instruction, factory);
  }
}

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

import sun.jvm.hotspot.asm.Instruction;

class IllegalInstructionDecoder
  extends InstructionDecoder
{
  Instruction decode(int instruction, SPARCInstructionFactory factory)
  {
    return factory.newIllegalInstruction(instruction);
  }
}

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

import sun.jvm.hotspot.asm.Immediate;
import sun.jvm.hotspot.asm.ImmediateOrRegister;
import sun.jvm.hotspot.asm.Instruction;
import sun.jvm.hotspot.asm.RTLDataTypes;
import sun.jvm.hotspot.asm.RTLOperations;

abstract class InstructionDecoder
  implements SPARCOpcodes, RTLDataTypes, RTLOperations
{
  static int extractSignedIntFromNBits(int value, int num_bits)
  {
    return value << 32 - num_bits >> 32 - num_bits;
  }
  
  static int getSourceRegister1(int instruction)
  {
    return (instruction & 0x7C000) >>> 14;
  }
  
  static int getSourceRegister2(int instruction)
  {
    return instruction & 0x1F;
  }
  
  static int getDestinationRegister(int instruction)
  {
    return (instruction & 0x3E000000) >>> 25;
  }
  
  static int getConditionCode(int instruction)
  {
    return (instruction & 0x1E000000) >>> 25;
  }
  
  static boolean isIBitSet(int instruction)
  {
    return (instruction & 0x2000) != 0;
  }
  
  static ImmediateOrRegister getOperand2(int instruction)
  {
    boolean iBit = isIBitSet(instruction);
    ImmediateOrRegister operand2 = null;
    if (iBit) {
      operand2 = new Immediate(new Short((short)extractSignedIntFromNBits(instruction, 13)));
    } else {
      operand2 = SPARCRegisters.getRegister(getSourceRegister2(instruction));
    }
    return operand2;
  }
  
  static int getOpf(int instruction)
  {
    return (instruction & 0x3FE0) >>> 5;
  }
  
  abstract Instruction decode(int paramInt, SPARCInstructionFactory paramSPARCInstructionFactory);
}

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

class IntegerBranchDecoder
  extends BranchDecoder
{
  String getConditionName(int conditionCode, boolean isAnnuled)
  {
    return isAnnuled ? integerAnnuledConditionNames[conditionCode] : integerConditionNames[conditionCode];
  }
}

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

import sun.jvm.hotspot.asm.Instruction;
import sun.jvm.hotspot.asm.Register;

class JmplDecoder
  extends MemoryInstructionDecoder
{
  JmplDecoder()
  {
    super(56, "jmpl", 5);
  }
  
  Instruction decodeMemoryInstruction(int instruction, SPARCRegisterIndirectAddress addr, SPARCRegister rd, SPARCInstructionFactory factory)
  {
    Instruction instr = null;
    if (rd == SPARCRegisters.O7)
    {
      instr = factory.newIndirectCallInstruction(addr, rd);
    }
    else if (rd == SPARCRegisters.G0)
    {
      int disp = (int)addr.getDisplacement();
      Register base = addr.getBase();
      if ((base == SPARCRegisters.I7) && (disp == 8)) {
        instr = factory.newReturnInstruction(addr, rd, false);
      } else if ((base == SPARCRegisters.O7) && (disp == 8)) {
        instr = factory.newReturnInstruction(addr, rd, true);
      } else {
        instr = factory.newJmplInstruction(addr, rd);
      }
    }
    else
    {
      instr = factory.newJmplInstruction(addr, rd);
    }
    return instr;
  }
}

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

import sun.jvm.hotspot.asm.Instruction;

class LdstubDecoder
  extends MemoryInstructionDecoder
{
  LdstubDecoder(int op3, String name, int dataType)
  {
    super(op3, name, dataType);
  }
  
  Instruction decodeMemoryInstruction(int instruction, SPARCRegisterIndirectAddress addr, SPARCRegister rd, SPARCInstructionFactory factory)
  {
    return factory.newLdstubInstruction(name, addr, rd);
  }
}

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

import sun.jvm.hotspot.asm.Instruction;

class LoadDecoder
  extends MemoryInstructionDecoder
{
  LoadDecoder(int op3, String name, int dataType)
  {
    super(op3, name, dataType);
  }
  
  Instruction decodeMemoryInstruction(int instruction, SPARCRegisterIndirectAddress addr, SPARCRegister rd, SPARCInstructionFactory factory)
  {
    return factory.newLoadInstruction(name, op3, addr, rd, dataType);
  }
}

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

import sun.jvm.hotspot.asm.ImmediateOrRegister;
import sun.jvm.hotspot.asm.Instruction;

class LogicDecoder
  extends Format3ADecoder
{
  LogicDecoder(int op3, String name, int rtlOperation)
  {
    super(op3, name, rtlOperation);
  }
  
  Instruction decodeFormat3AInstruction(int instruction, SPARCRegister rs1, ImmediateOrRegister operand2, SPARCRegister rd, SPARCInstructionFactory factory)
  {
    Instruction instr = null;
    if ((op3 == 2) && (rs1 == SPARCRegisters.G0) && (rd != SPARCRegisters.G0)) {
      instr = factory.newMoveInstruction(name, op3, operand2, rd);
    } else {
      instr = factory.newLogicInstruction(name, op3, rtlOperation, rs1, operand2, rd);
    }
    return instr;
  }
}

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

import sun.jvm.hotspot.asm.Instruction;

abstract class MemoryInstructionDecoder
  extends InstructionDecoder
{
  final int op3;
  final String name;
  final int dataType;
  
  SPARCRegisterIndirectAddress newRegisterIndirectAddress(SPARCRegister rs1, SPARCRegister rs2)
  {
    return new SPARCRegisterIndirectAddress(rs1, rs2);
  }
  
  SPARCRegisterIndirectAddress newRegisterIndirectAddress(SPARCRegister rs1, int offset)
  {
    return new SPARCRegisterIndirectAddress(rs1, offset);
  }
  
  static void setAddressSpace(int instruction, SPARCRegisterIndirectAddress addr)
  {
    int asi = (instruction & 0x1FE0) >>> 5;
    addr.setAddressSpace(asi);
  }
  
  SPARCRegisterIndirectAddress getRegisterIndirectAddress(int instruction)
  {
    SPARCRegister rs1 = SPARCRegisters.getRegister(getSourceRegister1(instruction));
    boolean iBit = isIBitSet(instruction);
    SPARCRegisterIndirectAddress addr = null;
    if (iBit)
    {
      int simm13 = extractSignedIntFromNBits(instruction, 13);
      addr = newRegisterIndirectAddress(rs1, simm13);
    }
    else
    {
      SPARCRegister rs2 = SPARCRegisters.getRegister(getSourceRegister2(instruction));
      addr = newRegisterIndirectAddress(rs1, rs2);
    }
    return addr;
  }
  
  MemoryInstructionDecoder(int op3, String name, int dataType)
  {
    this.op3 = op3;
    this.name = name;
    this.dataType = dataType;
  }
  
  Instruction decode(int instruction, SPARCInstructionFactory factory)
  {
    SPARCRegisterIndirectAddress addr = getRegisterIndirectAddress(instruction);
    SPARCRegister rd = getDestination(instruction);
    boolean isV9Okay = factory instanceof SPARCV9InstructionFactory;
    if ((rd == null) || ((!isV9Okay) && (rd.isV9Only()))) {
      return factory.newIllegalInstruction(instruction);
    }
    return decodeMemoryInstruction(instruction, addr, rd, factory);
  }
  
  SPARCRegister getDestination(int instruction)
  {
    int rdNum = getDestinationRegister(instruction);
    SPARCRegister rd = RegisterDecoder.decode(dataType, rdNum);
    return rd;
  }
  
  abstract Instruction decodeMemoryInstruction(int paramInt, SPARCRegisterIndirectAddress paramSPARCRegisterIndirectAddress, SPARCRegister paramSPARCRegister, SPARCInstructionFactory paramSPARCInstructionFactory);
}

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

import sun.jvm.hotspot.asm.Instruction;

class ReadDecoder
  extends ReadWriteDecoder
{
  ReadDecoder(int specialRegNum)
  {
    super(specialRegNum);
  }
  
  Instruction decodeReadWrite(int instruction, SPARCInstructionFactory factory, int rs1Num, int rdNum)
  {
    Instruction instr = null;
    int specialReg = specialRegNum;
    if (rs1Num == 0) {
      specialReg = 0;
    }
    if ((rs1Num == 15) && (rdNum == 0)) {
      instr = factory.newStbarInstruction();
    } else {
      instr = factory.newReadInstruction(specialReg, rs1Num, SPARCRegisters.getRegister(rdNum));
    }
    return instr;
  }
}

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

import sun.jvm.hotspot.asm.Instruction;

abstract class ReadWriteDecoder
  extends InstructionDecoder
{
  final int specialRegNum;
  
  abstract Instruction decodeReadWrite(int paramInt1, SPARCInstructionFactory paramSPARCInstructionFactory, int paramInt2, int paramInt3);
  
  ReadWriteDecoder(int specialRegNum)
  {
    this.specialRegNum = specialRegNum;
  }
  
  Instruction decode(int instruction, SPARCInstructionFactory factory)
  {
    Instruction instr = null;
    int rs1Num = getSourceRegister1(instruction);
    int rdNum = getDestinationRegister(instruction);
    return decodeReadWrite(instruction, factory, rs1Num, rdNum);
  }
}

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

import sun.jvm.hotspot.asm.RTLDataTypes;

class RegisterDecoder
  implements RTLDataTypes
{
  private static SPARCFloatRegister decodeDouble(int num)
  {
    boolean lsb = (0x1 & num) != 0;
    if (lsb) {
      num |= 0x20;
    }
    if (num % 2 != 0) {
      return null;
    }
    return SPARCFloatRegisters.getRegister(num);
  }
  
  private static SPARCFloatRegister decodeQuad(int num)
  {
    boolean lsb = (0x1 & num) != 0;
    if (lsb) {
      num |= 0x20;
    }
    if (num % 4 != 0) {
      return null;
    }
    return SPARCFloatRegisters.getRegister(num);
  }
  
  static SPARCRegister decode(int dataType, int regNum)
  {
    regNum &= 0x1F;
    SPARCRegister result = null;
    switch (dataType)
    {
    case 10: 
      result = SPARCFloatRegisters.getRegister(regNum);
      break;
    case 11: 
      result = decodeDouble(regNum);
      break;
    case 13: 
      result = decodeQuad(regNum);
      break;
    case 2147483647: 
      result = null;
      break;
    default: 
      result = SPARCRegisters.getRegister(regNum);
    }
    return result;
  }
}

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

import sun.jvm.hotspot.asm.ImmediateOrRegister;
import sun.jvm.hotspot.asm.Instruction;

class RestoreDecoder
  extends Format3ADecoder
{
  RestoreDecoder()
  {
    super(61, "restore", Integer.MAX_VALUE);
  }
  
  Instruction decodeFormat3AInstruction(int instruction, SPARCRegister rs1, ImmediateOrRegister operand2, SPARCRegister rd, SPARCInstructionFactory factory)
  {
    return factory.newRestoreInstruction(rs1, operand2, rd);
  }
}

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

import sun.jvm.hotspot.asm.Instruction;

class RettDecoder
  extends MemoryInstructionDecoder
{
  RettDecoder()
  {
    super(57, "rett", Integer.MAX_VALUE);
  }
  
  Instruction decodeMemoryInstruction(int instruction, SPARCRegisterIndirectAddress addr, SPARCRegister rd, SPARCInstructionFactory factory)
  {
    return factory.newRettInstruction(addr);
  }
}

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

import sun.jvm.hotspot.asm.ImmediateOrRegister;
import sun.jvm.hotspot.asm.Instruction;

class SaveDecoder
  extends Format3ADecoder
{
  SaveDecoder()
  {
    super(60, "save", Integer.MAX_VALUE);
  }
  
  Instruction decodeFormat3AInstruction(int instruction, SPARCRegister rs1, ImmediateOrRegister operand2, SPARCRegister rd, SPARCInstructionFactory factory)
  {
    return factory.newSaveInstruction(rs1, operand2, rd);
  }
}

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

import sun.jvm.hotspot.asm.Instruction;

class SethiDecoder
  extends InstructionDecoder
{
  Instruction decode(int instruction, SPARCInstructionFactory factory)
  {
    Instruction instr = null;
    int rdNum = getDestinationRegister(instruction);
    SPARCRegister rd = SPARCRegisters.getRegister(rdNum);
    int imm22 = instruction & 0x3FFFFF;
    if ((imm22 == 0) && (rd == SPARCRegisters.G0)) {
      instr = factory.newNoopInstruction();
    } else {
      instr = factory.newSethiInstruction(imm22, rd);
    }
    return instr;
  }
}

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

import sun.jvm.hotspot.asm.Immediate;
import sun.jvm.hotspot.asm.ImmediateOrRegister;
import sun.jvm.hotspot.asm.Instruction;

class ShiftDecoder
  extends InstructionDecoder
{
  final int op3;
  final String name;
  final int rtlOperation;
  
  ShiftDecoder(int op3, String name, int rtlOperation)
  {
    this.op3 = op3;
    this.name = name;
    this.rtlOperation = rtlOperation;
  }
  
  private ImmediateOrRegister getShiftLength(int instruction)
  {
    boolean iBit = isIBitSet(instruction);
    ImmediateOrRegister operand2 = null;
    if (iBit)
    {
      int value = instruction & 0x1F;
      operand2 = new Immediate(new Short((short)value));
    }
    else
    {
      operand2 = SPARCRegisters.getRegister(getSourceRegister2(instruction));
    }
    return operand2;
  }
  
  Instruction decode(int instruction, SPARCInstructionFactory factory)
  {
    SPARCRegister rs1 = SPARCRegisters.getRegister(getSourceRegister1(instruction));
    SPARCRegister rd = SPARCRegisters.getRegister(getDestinationRegister(instruction));
    ImmediateOrRegister operand2 = getShiftLength(instruction);
    return factory.newShiftInstruction(name, op3, rtlOperation, rs1, operand2, rd);
  }
}

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

import sun.jvm.hotspot.utilities.Assert;

public class SPARCArgument
{
  private int number;
  private boolean isIn;
  public static final int NUM_REGISTER_PARAMETERS = 6;
  
  public SPARCArgument(int number, boolean isIn)
  {
    this.number = number;
    this.isIn = isIn;
  }
  
  int getNumber()
  {
    return number;
  }
  
  boolean getIsIn()
  {
    return isIn;
  }
  
  boolean getIsOut()
  {
    return !getIsIn();
  }
  
  public SPARCArgument getSuccessor()
  {
    return new SPARCArgument(getNumber() + 1, getIsIn());
  }
  
  public SPARCArgument asIn()
  {
    return new SPARCArgument(getNumber(), true);
  }
  
  public SPARCArgument asOut()
  {
    return new SPARCArgument(getNumber(), false);
  }
  
  public boolean isRegister()
  {
    return number < 6;
  }
  
  public SPARCRegister asRegister()
  {
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(isRegister(), "must be a register argument");
    }
    return new SPARCRegister(getIsIn() ? SPARCRegisterType.IN : SPARCRegisterType.OUT, getNumber());
  }
}

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

import sun.jvm.hotspot.asm.ArithmeticInstruction;
import sun.jvm.hotspot.asm.Immediate;
import sun.jvm.hotspot.asm.ImmediateOrRegister;
import sun.jvm.hotspot.asm.Operand;

public class SPARCArithmeticInstruction
  extends SPARCFormat3AInstruction
  implements ArithmeticInstruction
{
  private final int operation;
  
  public SPARCArithmeticInstruction(String name, int opcode, int operation, SPARCRegister rs1, ImmediateOrRegister operand2, SPARCRegister rd)
  {
    super(name, opcode, rs1, operand2, rd);
    this.operation = operation;
  }
  
  protected String getDescription()
  {
    if ((rd == rs1) && (operand2.isImmediate()))
    {
      int value = ((Immediate)operand2).getNumber().intValue();
      StringBuffer buf = new StringBuffer();
      switch (opcode)
      {
      case 0: 
        buf.append("inc");
        break;
      case 16: 
        buf.append("inccc");
        break;
      case 4: 
        buf.append("dec");
        break;
      case 20: 
        buf.append("deccc");
        break;
      default: 
        return super.getDescription();
      }
      buf.append(spaces);
      if (value != 1)
      {
        buf.append(getOperand2String());buf.append(comma);
      }
      buf.append(rd.toString());
      return buf.toString();
    }
    if ((rd == SPARCRegisters.G0) && (opcode == 20))
    {
      StringBuffer buf = new StringBuffer();
      buf.append("cmp");
      buf.append(spaces);
      buf.append(rs1.toString());
      buf.append(comma);
      buf.append(getOperand2String());
      return buf.toString();
    }
    if ((rs1 == SPARCRegisters.G0) && (opcode == 4) && (operand2.isRegister()))
    {
      StringBuffer buf = new StringBuffer();
      buf.append("neg");
      buf.append(spaces);
      buf.append(operand2.toString());
      if (operand2 != rd)
      {
        buf.append(comma);
        buf.append(rd.toString());
      }
      return buf.toString();
    }
    return super.getDescription();
  }
  
  public Operand getArithmeticDestination()
  {
    return getDestinationRegister();
  }
  
  public Operand[] getArithmeticSources()
  {
    return new Operand[] { rs1, operand2 };
  }
  
  public int getOperation()
  {
    return operation;
  }
  
  public boolean isArithmetic()
  {
    return true;
  }
}

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

import sun.jvm.hotspot.asm.Address;
import sun.jvm.hotspot.asm.LoadInstruction;
import sun.jvm.hotspot.asm.Register;
import sun.jvm.hotspot.asm.StoreInstruction;
import sun.jvm.hotspot.asm.SymbolFinder;

public abstract class SPARCAtomicLoadStoreInstruction
  extends SPARCInstruction
  implements LoadInstruction, StoreInstruction
{
  protected final SPARCRegisterIndirectAddress addr;
  protected final SPARCRegister rd;
  protected final Register[] regs = new Register[1];
  protected final String description;
  
  public SPARCAtomicLoadStoreInstruction(String name, SPARCRegisterIndirectAddress addr, SPARCRegister rd)
  {
    super(name);
    this.addr = addr;
    this.rd = rd;
    regs[0] = rd;
    description = initDescription();
  }
  
  private String initDescription()
  {
    StringBuffer buf = new StringBuffer();
    buf.append(getName());
    buf.append(spaces);
    buf.append(addr.toString());
    buf.append(comma);
    buf.append(rd.toString());
    return buf.toString();
  }
  
  public Address getLoadSource()
  {
    return addr;
  }
  
  public Address getStoreDestination()
  {
    return addr;
  }
  
  public Register[] getLoadDestinations()
  {
    return regs;
  }
  
  public Register[] getStoreSources()
  {
    return regs;
  }
  
  public boolean isLoad()
  {
    return true;
  }
  
  public boolean isStore()
  {
    return true;
  }
  
  public String asString(long currentPc, SymbolFinder symFinder)
  {
    return description;
  }
}

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

import sun.jvm.hotspot.asm.Address;
import sun.jvm.hotspot.asm.BranchInstruction;
import sun.jvm.hotspot.asm.PCRelativeAddress;
import sun.jvm.hotspot.asm.SymbolFinder;

public class SPARCBranchInstruction
  extends SPARCInstruction
  implements BranchInstruction
{
  protected final PCRelativeAddress addr;
  protected final int conditionCode;
  protected final boolean isAnnuled;
  
  public SPARCBranchInstruction(String name, PCRelativeAddress addr, boolean isAnnuled, int conditionCode)
  {
    super(name);
    this.addr = addr;
    this.conditionCode = conditionCode;
    this.isAnnuled = isAnnuled;
  }
  
  public String asString(long currentPc, SymbolFinder symFinder)
  {
    long address = addr.getDisplacement() + currentPc;
    StringBuffer buf = new StringBuffer();
    buf.append(getName());
    buf.append(spaces);
    buf.append(symFinder.getSymbolFor(address));
    return buf.toString();
  }
  
  public Address getBranchDestination()
  {
    return addr;
  }
  
  public int getConditionCode()
  {
    return conditionCode;
  }
  
  public boolean isAnnuledBranch()
  {
    return isAnnuled;
  }
  
  public boolean isBranch()
  {
    return true;
  }
  
  public boolean isConditional()
  {
    return (conditionCode != 0) && (conditionCode != 8);
  }
}

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

import sun.jvm.hotspot.asm.Address;
import sun.jvm.hotspot.asm.CallInstruction;
import sun.jvm.hotspot.asm.PCRelativeAddress;
import sun.jvm.hotspot.asm.SymbolFinder;

public class SPARCCallInstruction
  extends SPARCInstruction
  implements CallInstruction
{
  private final PCRelativeAddress addr;
  
  public SPARCCallInstruction(PCRelativeAddress addr)
  {
    super("call");
    this.addr = addr;
  }
  
  public String asString(long currentPc, SymbolFinder symFinder)
  {
    long address = addr.getDisplacement() + currentPc;
    StringBuffer buf = new StringBuffer();
    buf.append(getName());
    buf.append(spaces);
    buf.append(symFinder.getSymbolFor(address));
    return buf.toString();
  }
  
  public Address getBranchDestination()
  {
    return addr;
  }
  
  public boolean isCall()
  {
    return true;
  }
  
  public boolean isConditional()
  {
    return false;
  }
}

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

import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import sun.jvm.hotspot.asm.Disassembler;
import sun.jvm.hotspot.asm.Instruction;
import sun.jvm.hotspot.asm.InstructionVisitor;
import sun.jvm.hotspot.asm.RTLDataTypes;
import sun.jvm.hotspot.asm.RTLOperations;

public abstract class SPARCDisassembler
  extends Disassembler
  implements SPARCOpcodes, RTLDataTypes, RTLOperations
{
  protected static Map instructionCache = new HashMap();
  protected final SPARCInstructionFactory factory;
  
  public SPARCDisassembler(long startPc, byte[] code, SPARCInstructionFactory factory)
  {
    super(startPc, code);
    this.factory = factory;
  }
  
  protected static InstructionDecoder illegalDecoder = new IllegalInstructionDecoder();
  protected static InstructionDecoder callDecoder = new CallDecoder();
  
  protected Instruction decodeFormat1Instruction(int instruction)
  {
    return callDecoder.decode(instruction, factory);
  }
  
  protected abstract InstructionDecoder getFormat2Decoder(int paramInt);
  
  protected Instruction decodeFormat2Instruction(int instruction)
  {
    int op2 = (instruction & 0x1C00000) >>> 22;
    InstructionDecoder decoder = getFormat2Decoder(op2);
    return decoder.decode(instruction, factory);
  }
  
  protected static int getOp3(int instruction)
  {
    return (instruction & 0x1F80000) >>> 19;
  }
  
  protected static int getOp3Row(int op3)
  {
    return op3 & 0xF;
  }
  
  protected static int getOp3Column(int op3)
  {
    return op3 >>> 4 & 0x3;
  }
  
  protected abstract InstructionDecoder getFormat3Decoder(int paramInt1, int paramInt2);
  
  protected Instruction decodeFormat3Instruction(int instruction)
  {
    int op3 = getOp3(instruction);
    int row = getOp3Row(op3);
    int column = getOp3Column(op3);
    return getFormat3Decoder(row, column).decode(instruction, factory);
  }
  
  protected abstract InstructionDecoder getFormat3ADecoder(int paramInt1, int paramInt2);
  
  protected Instruction decodeFormat3AInstruction(int instruction)
  {
    int op3 = getOp3(instruction);
    int row = getOp3Row(op3);
    int column = getOp3Column(op3);
    return getFormat3ADecoder(row, column).decode(instruction, factory);
  }
  
  public void decode(InstructionVisitor visitor)
  {
    visitor.prologue();
    try
    {
      DataInputStream dis = new DataInputStream(new ByteArrayInputStream(code));
      int instruction = -1;
      int format = -1;
      Instruction instr = null;
      int len = 0;
      while (len < code.length)
      {
        instr = null;
        instruction = dis.readInt();
        
        instr = (Instruction)instructionCache.get(new Integer(instruction));
        if (instr == null)
        {
          format = (instruction & 0xC0000000) >>> 30;
          switch (format)
          {
          case 0: 
            instr = decodeFormat2Instruction(instruction);
            break;
          case 1: 
            instr = decodeFormat1Instruction(instruction);
            break;
          case 2: 
            instr = decodeFormat3AInstruction(instruction);
            break;
          case 3: 
            instr = decodeFormat3Instruction(instruction);
          }
          instructionCache.put(new Integer(instruction), instr);
        }
        visitor.visit(startPc + len, instr);
        len += 4;
      }
    }
    catch (IOException ioExp) {}finally
    {
      visitor.epilogue();
    }
  }
}

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

import sun.jvm.hotspot.utilities.Assert;

public class SPARCFloatRegister
  extends SPARCRegister
{
  public static final int SINGLE_PRECISION = 1;
  public static final int DOUBLE_PRECISION = 2;
  public static final int QUAD_PRECISION = 3;
  private static final int nofRegisters = 63;
  
  public SPARCFloatRegister(int number)
  {
    super(number);
  }
  
  public int getNumber()
  {
    return number;
  }
  
  public int getNumber(int width)
  {
    switch (width)
    {
    case 1: 
      Assert.that(number < 32, "bad single-prec fp register");
      return number;
    case 2: 
      Assert.that((number < 64) && ((number & 0x1) == 0), "bad double-prec fp register");
      return number & 0x1E | (number & 0x20) >> 5;
    case 3: 
      Assert.that((number < 64) && ((number & 0x3) == 0), "bad quad-prec fp register");
      return number & 0x1C | (number & 0x20) >> 5;
    }
    throw new RuntimeException("Invalid floating point width supplied");
  }
  
  public int getNumberOfRegisters()
  {
    return 63;
  }
  
  public boolean isFloat()
  {
    return true;
  }
  
  public boolean isFramePointer()
  {
    return false;
  }
  
  public boolean isStackPointer()
  {
    return false;
  }
  
  public boolean isV9Only()
  {
    return number > 31;
  }
  
  public boolean isValid()
  {
    return (number >= 0) && (number < 63);
  }
  
  public String toString()
  {
    return SPARCFloatRegisters.getRegisterName(number);
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.asm.sparc.SPARCFloatRegister
 * Java Class Version: 1.4 (48.0)
 * JD-Core Ver
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