void BytecodePrinter::print_constant(int i, outputStream* st) {
  int orig_i = i;
  if (!check_index(orig_i, false, i, st))  return;

  constantPoolOop constants = method()->constants();
  constantTag tag = constants->tag_at(i);

  if (tag.is_int()) {
    st->print_cr(" " INT32_FORMAT, constants->int_at(i));
  } else if (tag.is_long()) {
    st->print_cr(" " INT64_FORMAT, constants->long_at(i));
  } else if (tag.is_float()) {
    st->print_cr(" %f", constants->float_at(i));
  } else if (tag.is_double()) {
    st->print_cr(" %f", constants->double_at(i));
  } else if (tag.is_string()) {
    oop string = constants->resolved_string_at(i);
    print_oop(string, st);
  } else if (tag.is_unresolved_string()) {
    st->print_cr(" <unresolved string at %d>", i);
  } else if (tag.is_klass()) {
    st->print_cr(" %s", constants->resolved_klass_at(i)->klass_part()->external_name());
  } else if (tag.is_unresolved_klass()) {
    st->print_cr(" <unresolved klass at %d>", i);
  } else if (tag.is_object()) {
    st->print_cr(" " PTR_FORMAT, constants->object_at(i));
  } else {
    st->print_cr(" bad tag=%d at %d", tag.value(), i);
  }
}
示例#2
0
void BytecodePrinter::print_constant(int i, outputStream* st) {
  int orig_i = i;
  if (!check_index(orig_i, i, st))  return;

  constantPoolOop constants = method()->constants();
  constantTag tag = constants->tag_at(i);

  if (tag.is_int()) {
    st->print_cr(" " INT32_FORMAT, constants->int_at(i));
  } else if (tag.is_long()) {
    st->print_cr(" " INT64_FORMAT, constants->long_at(i));
  } else if (tag.is_float()) {
    st->print_cr(" %f", constants->float_at(i));
  } else if (tag.is_double()) {
    st->print_cr(" %f", constants->double_at(i));
  } else if (tag.is_string()) {
    oop string = constants->pseudo_string_at(i);
    print_oop(string, st);
  } else if (tag.is_unresolved_string()) {
    const char* string = constants->string_at_noresolve(i);
    st->print_cr(" %s", string);
  } else if (tag.is_klass()) {
    st->print_cr(" %s", constants->resolved_klass_at(i)->klass_part()->external_name());
  } else if (tag.is_unresolved_klass()) {
    st->print_cr(" <unresolved klass at %d>", i);
  } else if (tag.is_object()) {
    st->print(" <Object>");
    print_oop(constants->object_at(i), st);
  } else if (tag.is_method_type()) {
    int i2 = constants->method_type_index_at(i);
    st->print(" <MethodType> %d", i2);
    print_symbol(constants->symbol_at(i2), st);
  } else if (tag.is_method_handle()) {
    int kind = constants->method_handle_ref_kind_at(i);
    int i2 = constants->method_handle_index_at(i);
    st->print(" <MethodHandle of kind %d>", kind, i2);
    print_field_or_method(-i, i2, st);
  } else {
    st->print_cr(" bad tag=%d at %d", tag.value(), i);
  }
}
void BytecodePrinter::print_constant(int i) {
  constantPoolOop constants = method()->constants();
  constantTag tag = constants->tag_at(i);

  if (tag.is_int()) { 
    tty->print_cr(" " INT32_FORMAT, constants->int_at(i));
  } else if (tag.is_long()) {
    tty->print_cr(" " INT64_FORMAT, constants->long_at(i));
  } else if (tag.is_float()) { 
    tty->print_cr(" %f", constants->float_at(i));
  } else if (tag.is_double()) {
    tty->print_cr(" %f", constants->double_at(i));
  } else if (tag.is_string()) { 
    oop string = constants->resolved_string_at(i);
    print_oop(string);
  } else if (tag.is_unresolved_string()) { 
    tty->print_cr(" <unresolved string at %d>", i);  
  } else if (tag.is_klass()) { 
    tty->print_cr(" %s", constants->resolved_klass_at(i)->klass_part()->external_name());
  } else if (tag.is_unresolved_klass()) { 
    tty->print_cr(" <unresolved klass at %d>", i);  
  } else ShouldNotReachHere();  
}