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();
  }
}
Beispiel #2
0
// Print this EntryActivation and all other EntryActivation's that follow it.
void EntryActivation::print_list_on(Stream* st, int indent, int index) {
#if USE_DEBUG_PRINTING
  int last_indent = st->indentation();
  st->set_indentation(indent);
  st->indent();

  st->print("[%d] ", index);
  Method m = method();
  m.print_value_on(st);
  st->cr();

  for (int i = 0; i < length(); i++) {
    st->indent();
    st->print("    ");

    switch(tag_at(i)) { 
    case float_tag:
      st->print("(float)  %f", jvm_f2d(float_at(i)));
      break;
    case double_tag:
      st->print("(double)  %d", double_at(i));
      i++;
      break;
    case long_tag:
      st->print("(long)   ");
      st->print(OsMisc_jlong_format_specifier(), long_at(i));
      i++;
      break;
    case obj_tag:
      {
        st->print("(obj)  ");
        Oop obj = obj_at(i);
        obj.print_value_on(st);
      }
      break;
    case int_tag:
      st->print("(int)    %d", int_at(i));
      break;
    default:
      SHOULD_NOT_REACH_HERE();
    }
    st->cr();
  }

  EntryActivation mynext = next();
  if (mynext.not_null()) {
    mynext.print_list_on(st, indent, index+1);
  }
  st->set_indentation(last_indent);
#endif
}