コード例 #1
0
void instanceKlassKlass::oop_print_on(oop obj, outputStream* st) {
  assert(obj->is_klass(), "must be klass");
  instanceKlass* ik = instanceKlass::cast(klassOop(obj));
  klassKlass::oop_print_on(obj, st);

  st->print(" - instance size:     %d", ik->size_helper());                        st->cr();
  st->print(" - klass size:        %d", ik->object_size());                        st->cr();
  st->print(" - access:            "); ik->access_flags().print_on(st);            st->cr();
  st->print(" - state:             "); st->print_cr(state_names[ik->_init_state]);
  st->print(" - name:              "); ik->name()->print_value_on(st);             st->cr();
  st->print(" - super:             "); ik->super()->print_value_on(st);            st->cr();
  st->print(" - sub:               "); 
  Klass* sub = ik->subklass(); 
  int n;
  for (n = 0; sub != NULL; n++, sub = sub->next_sibling()) {
    if (n < MaxSubklassPrintSize) {       
      sub->as_klassOop()->print_value_on(st); 
      st->print("   "); 
    }
  }
  if (n >= MaxSubklassPrintSize) st->print("(%d more klasses...)", n - MaxSubklassPrintSize);
  st->cr();

  if (ik->is_interface()) { 
    st->print_cr(" - nof implementors:  %d", ik->nof_implementors());
    if (ik->nof_implementors() == 1) {      
      st->print_cr(" - implementor:       "); ik->implementor()->print_value_on(st);st->cr();
    }
  }

  st->print(" - arrays:            "); ik->array_klasses()->print_value_on(st);     st->cr();
  st->print(" - methods:           "); ik->methods()->print_value_on(st);           st->cr();
  if (Verbose) {
    objArrayOop methods = ik->methods();
    for(int i = 0; i < methods->length(); i++) {
      tty->print("%d : ", i); methods->obj_at(i)->print_value(); tty->cr();
    }
  }
  st->print(" - method ordering:   "); ik->method_ordering()->print_value_on(st);       st->cr();
  st->print(" - local interfaces:  "); ik->local_interfaces()->print_value_on(st);      st->cr();
  st->print(" - trans. interfaces: "); ik->transitive_interfaces()->print_value_on(st); st->cr();
  st->print(" - constants:         "); ik->constants()->print_value_on(st);         st->cr();
  st->print(" - class loader:      "); ik->class_loader()->print_value_on(st);      st->cr();
  st->print(" - protection domain: "); ik->protection_domain()->print_value_on(st); st->cr();
  st->print(" - signers:           "); ik->signers()->print_value_on(st);           st->cr();
  if (ik->source_file_name() != NULL) {
    st->print(" - source file:       "); 
    ik->source_file_name()->print_value_on(st);
    st->cr();
  }
  if (ik->source_debug_extension() != NULL) {
    st->print(" - source debug extension:       "); 
    ik->source_debug_extension()->print_value_on(st);
    st->cr();
  }
  if (ik->has_previous_version()) {      
    st->print_cr(" - previous version:       "); 
    ik->previous_version()->print_value_on(st);
    st->cr();
  }
  st->print(" - inner classes:     "); ik->inner_classes()->print_value_on(st);     st->cr();
  st->print(" - java mirror:       "); ik->java_mirror()->print_value_on(st);       st->cr();
  st->print(" - vtable length      %d  (start addr: " INTPTR_FORMAT ")", ik->vtable_length(), ik->start_of_vtable());  st->cr();  
  st->print(" - itable length      %d (start addr: " INTPTR_FORMAT ")", ik->itable_length(), ik->start_of_itable()); st->cr();
  st->print_cr(" - static fields:");
  printing_stream = st;
  ik->do_local_static_fields(print_static_field, obj);
  st->print_cr(" - non-static fields:");
  ik->do_nonstatic_fields(print_nonstatic_field, NULL);
  printing_stream = NULL;

  st->print(" - static oop maps:     ");
  if (ik->static_oop_field_size() > 0) {
    int first_offset = ik->offset_of_static_fields();
    st->print("%d-%d", first_offset, first_offset + ik->static_oop_field_size() - 1);
  }
  st->cr();

  st->print(" - non-static oop maps: ");
  OopMapBlock* map     = ik->start_of_nonstatic_oop_maps();
  OopMapBlock* end_map = map + ik->nonstatic_oop_map_size();
  while (map < end_map) {
    st->print("%d-%d ", map->offset(), map->offset() + map->length() - 1);
    map++;
  }
  st->cr();
}
コード例 #2
0
void instanceKlassKlass::oop_print_on(oop obj, outputStream* st) {
  assert(obj->is_klass(), "must be klass");
  instanceKlass* ik = instanceKlass::cast(klassOop(obj));
  klassKlass::oop_print_on(obj, st);

  st->print(BULLET"instance size:     %d", ik->size_helper());                        st->cr();
  st->print(BULLET"klass size:        %d", ik->object_size());                        st->cr();
  st->print(BULLET"access:            "); ik->access_flags().print_on(st);            st->cr();
  st->print(BULLET"state:             "); st->print_cr(state_names[ik->_init_state]);
  st->print(BULLET"name:              "); ik->name()->print_value_on(st);             st->cr();
  st->print(BULLET"super:             "); ik->super()->print_value_on(st);            st->cr();
  st->print(BULLET"sub:               ");
  Klass* sub = ik->subklass();
  int n;
  for (n = 0; sub != NULL; n++, sub = sub->next_sibling()) {
    if (n < MaxSubklassPrintSize) {
      sub->as_klassOop()->print_value_on(st);
      st->print("   ");
    }
  }
  if (n >= MaxSubklassPrintSize) st->print("(%d more klasses...)", n - MaxSubklassPrintSize);
  st->cr();

  if (ik->is_interface()) {
    st->print_cr(BULLET"nof implementors:  %d", ik->nof_implementors());
    if (ik->nof_implementors() == 1) {
      st->print_cr(BULLET"implementor:    ");
      st->print("   ");
      ik->implementor()->print_value_on(st);
      st->cr();
    }
  }

  st->print(BULLET"arrays:            "); ik->array_klasses()->print_value_on(st);     st->cr();
  st->print(BULLET"methods:           "); ik->methods()->print_value_on(st);           st->cr();
  if (Verbose) {
    objArrayOop methods = ik->methods();
    for(int i = 0; i < methods->length(); i++) {
      tty->print("%d : ", i); methods->obj_at(i)->print_value(); tty->cr();
    }
  }
  st->print(BULLET"method ordering:   "); ik->method_ordering()->print_value_on(st);       st->cr();
  st->print(BULLET"local interfaces:  "); ik->local_interfaces()->print_value_on(st);      st->cr();
  st->print(BULLET"trans. interfaces: "); ik->transitive_interfaces()->print_value_on(st); st->cr();
  st->print(BULLET"constants:         "); ik->constants()->print_value_on(st);         st->cr();
  st->print(BULLET"class loader:      "); ik->class_loader()->print_value_on(st);      st->cr();
  st->print(BULLET"protection domain: "); ik->protection_domain()->print_value_on(st); st->cr();
  if (ik->host_klass() != NULL) {
    st->print(BULLET"host class:        "); ik->host_klass()->print_value_on(st);        st->cr();
  }
  st->print(BULLET"signers:           "); ik->signers()->print_value_on(st);           st->cr();
  if (ik->source_file_name() != NULL) {
    st->print(BULLET"source file:       ");
    ik->source_file_name()->print_value_on(st);
    st->cr();
  }
  if (ik->source_debug_extension() != NULL) {
    st->print(BULLET"source debug extension:       ");
    st->print_cr("%s", ik->source_debug_extension());
    st->cr();
  }

  {
    ResourceMark rm;
    // PreviousVersionInfo objects returned via PreviousVersionWalker
    // contain a GrowableArray of handles. We have to clean up the
    // GrowableArray _after_ the PreviousVersionWalker destructor
    // has destroyed the handles.
    {
      bool have_pv = false;
      PreviousVersionWalker pvw(ik);
      for (PreviousVersionInfo * pv_info = pvw.next_previous_version();
           pv_info != NULL; pv_info = pvw.next_previous_version()) {
        if (!have_pv)
          st->print(BULLET"previous version:  ");
        have_pv = true;
        pv_info->prev_constant_pool_handle()()->print_value_on(st);
      }
      if (have_pv)  st->cr();
    } // pvw is cleaned up
  } // rm is cleaned up

  if (ik->generic_signature() != NULL) {
    st->print(BULLET"generic signature: ");
    ik->generic_signature()->print_value_on(st);
    st->cr();
  }
  st->print(BULLET"inner classes:     "); ik->inner_classes()->print_value_on(st);     st->cr();
  st->print(BULLET"java mirror:       "); ik->java_mirror()->print_value_on(st);       st->cr();
  st->print(BULLET"vtable length      %d  (start addr: " INTPTR_FORMAT ")", ik->vtable_length(), ik->start_of_vtable());  st->cr();
  st->print(BULLET"itable length      %d (start addr: " INTPTR_FORMAT ")", ik->itable_length(), ik->start_of_itable()); st->cr();
  st->print_cr(BULLET"---- static fields (%d words):", ik->static_field_size());
  FieldPrinter print_static_field(st);
  ik->do_local_static_fields(&print_static_field);
  st->print_cr(BULLET"---- non-static fields (%d words):", ik->nonstatic_field_size());
  FieldPrinter print_nonstatic_field(st);
  ik->do_nonstatic_fields(&print_nonstatic_field);

  st->print(BULLET"non-static oop maps: ");
  OopMapBlock* map     = ik->start_of_nonstatic_oop_maps();
  OopMapBlock* end_map = map + ik->nonstatic_oop_map_count();
  while (map < end_map) {
    st->print("%d-%d ", map->offset(), map->offset() + heapOopSize*(map->count() - 1));
    map++;
  }
  st->cr();
}