Beispiel #1
0
void PcDesc::print(nmethod* code) {
#ifndef PRODUCT
  ResourceMark rm;
  tty->print_cr("PcDesc(pc=0x%lx offset=%x bits=%x):", real_pc(code), pc_offset(), _flags);

  if (scope_decode_offset() == DebugInformationRecorder::serialized_null) {
    return;
  }

  for (ScopeDesc* sd = code->scope_desc_at(real_pc(code));
       sd != NULL;
       sd = sd->sender()) {
    tty->print("  ");
    sd->method()->print_short_name(tty);
    tty->print("  @%d", sd->bci());
    if (sd->should_reexecute())
      tty->print("  reexecute=true");
    tty->cr();
  }
#endif
}
Beispiel #2
0
address PcDesc::real_pc(const nmethod* code) const {
  return code->code_begin() + pc_offset();
}
void disasm_mips_instruction(u32 opcode, char *buffer, u32 pc)
{
  int opcode_type = opcode >> 26;

  if(opcode == 0)
  {
    sprintf(buffer, "nop");
    return;
  }

  switch(mips_opcode_types[opcode_type])
  {
    case MIPS_OPCODE_ALU_IMMS:
    {
      u32 rs = op_bits(reg_rs, 0x1F);

      if((opcode_type == 0x9) && (rs == 0))
      {
        sprintf(buffer, "li %s, %d",
         reg_op(reg_rt), imms());
      }
      else
      {
        sprintf(buffer, "%s %s, %s, %d",
         mips_opcode_names[opcode_type], reg_op(reg_rt),
         mips_reg_names[rs], imms());
      }
      break;
    }

    case MIPS_OPCODE_ALU_IMMU:
    {
      sprintf(buffer, "%s %s, %s, 0x%x",
       mips_opcode_names[opcode_type], reg_op(reg_rt), reg_op(reg_rs),
       immu());
      break;
    }

    case MIPS_OPCODE_ALU2_IMMU:
    {
      sprintf(buffer, "%s %s, 0x%x",
       mips_opcode_names[opcode_type], reg_op(reg_rt), immu());
      break;
    }


    case MIPS_OPCODE_REGIMM:
    {
      u32 function = op_bits(16, 0x1F);

      sprintf(buffer, "%s %s, %08x",
       mips_function_regimm_names[function], reg_op(reg_rs),
       pc_offset());
      break;
    }

    case MIPS_OPCODE_SPECIAL:
    {
      mips_function_special_type function = (mips_function_special_type)op_bits(0, 0x3F);

      switch(mips_function_special_types[function])
      {
        case MIPS_SPECIAL_FUNCTION_ALU:
        {
          sprintf(buffer, "%s %s, %s, %s",
           mips_function_special_names[function], reg_op(reg_rd),
           reg_op(reg_rs), reg_op(reg_rt));
          break;
        }

        case MIPS_SPECIAL_FUNCTION_MUL_DIV:
        {
          sprintf(buffer, "%s %s, %s",
           mips_function_special_names[function], reg_op(reg_rs),
           reg_op(reg_rt));
          break;
        }

        case MIPS_SPECIAL_FUNCTION_JALR: 
        { 
          u32 rd = op_bits(reg_rd, 0x1F); 
 
          if(rd == 31) 
          { 
            sprintf(buffer, "%s %s", 
             mips_function_special_names[function], reg_op(reg_rs)); 
          } 
          else 
          { 
            sprintf(buffer, "%s %s, %s", 
             mips_function_special_names[function], mips_reg_names[rd], 
             reg_op(reg_rs)); 
          } 
          break; 
        } 

        case MIPS_SPECIAL_FUNCTION_JR:
        {
          sprintf(buffer, "%s %s",
           mips_function_special_names[function], reg_op(reg_rs));
          break;
        }

        case MIPS_SPECIAL_FUNCTION_HI_LO:
        {
          sprintf(buffer, "%s %s",
           mips_function_special_names[function], reg_op(reg_rd));
          break;
        }

        case MIPS_SPECIAL_FUNCTION_SHIFT:
        {
          sprintf(buffer, "%s %s, %s, %d",
           mips_function_special_names[function], reg_op(reg_rd),
           reg_op(reg_rt), op_bits(6, 0x1F));
          break;
        }

        default:
        {
          sprintf(buffer, "unknown");
          break;
        }
      }
      break;
    }

    case MIPS_OPCODE_BRANCH:
    {
      u32 offset = op_bits(0, 0x3FFFFFF);
      offset = (offset << 2) | ((pc + 4) & 0xFC000000);

      sprintf(buffer, "%s %08x",
       mips_opcode_names[opcode_type], offset);

      break;
    }

    case MIPS_OPCODE_BRANCHC:
    {
      sprintf(buffer, "%s %s, %08x",
       mips_opcode_names[opcode_type], reg_op(reg_rs), pc_offset());
      break;
    }

    case MIPS_OPCODE_BRANCHC2:
    {
      sprintf(buffer, "%s %s, %s, %08x",
       mips_opcode_names[opcode_type], reg_op(reg_rs),
       reg_op(reg_rt), pc_offset());
      break;
    }

    case MIPS_OPCODE_MEM:
    {
      s32 offset = signed_offset();

      if(offset < 0)
      {
        sprintf(buffer, "%s %s, [%s - %d]",
         mips_opcode_names[opcode_type], reg_op(reg_rt), reg_op(reg_rs),
         -offset);
      }
      else
      {
        sprintf(buffer, "%s %s, [%s + %d]",
         mips_opcode_names[opcode_type], reg_op(reg_rt), reg_op(reg_rs),
         offset);
      }
      break;
    }

    default:
    {
      sprintf(buffer, "unknown");
      break;
    }
  }
}