Exemplo n.º 1
0
void CompiledMethod::print_code_on(Stream* st) {
  int end_offset = RelocationReader::code_length(this);
  for (int offset = 0; offset < end_offset; offset += 2) { 
    short* instruction_start = (short*) (entry() + offset);

    print_comment_for(offset, st);

    bool is_oop = false;
    for (RelocationReader stream(this); !stream.at_end(); stream.advance()) {
      if (stream.code_offset() == offset) { 
        if (stream.is_oop() || stream.is_rom_oop()) { 
          is_oop = true;
          break;
        }
      }
    }
    st->print(" %4d: ", offset);
    if (VerbosePointers) {
      st->print("0x%08x: ", instruction_start);
    }
    if (!is_oop) { 
      decode_instruction(st, instruction_start, offset);
    } else { 
      GUARANTEE(((int)instruction_start & 0x3) == 0, 
                "Disassembler: Invalid embedded Oop");
      Oop o = (OopDesc*)*(int*)instruction_start;
      if (VerbosePointers) {
        st->print("0x%08x:", *(int*)instruction_start);
      }
      o.print_value_on(st);
      offset += 2;
    }
    st->cr();
  }
}
Exemplo n.º 2
0
void CompiledMethod::print_code_on(Stream* st) {
  // Warning this is not safe for garbage collection
  address pc = entry();
  while (*pc != 0x00) {
    DisassemblerEnv env(this);
    address instruction_start = pc;
    print_comment_for(instruction_start - entry(), st);
    st->print(" %4d: ", instruction_start - entry());
    pc = disasm(instruction_start, &env);
    st->print("%s", env.buffer());
    if (env.has_comment()) { 
      st->print("  // ");
      env.print_comment(st);
    }
    st->cr();
  }
}