// Verification
void methodDataKlass::oop_verify_on(oop obj, outputStream* st) {
  Klass::oop_verify_on(obj, st);
  guarantee(obj->is_methodData(), "object must be method data");
  methodDataOop m = methodDataOop(obj);
  guarantee(m->is_perm(), "should be in permspace");
  m->verify_data_on(st);
}
// Printing
void methodDataKlass::oop_print_on(oop obj, outputStream* st) {
  assert(obj->is_methodData(), "should be method data");
  methodDataOop m = methodDataOop(obj);
  st->print("method data for ");
  m->method()->print_value_on(st);
  st->cr();
  m->print_data_on(st);
}
void methodDataKlass::oop_follow_contents(oop obj) {
  assert (obj->is_methodData(), "object must be method data");
  methodDataOop m = methodDataOop(obj);

  obj->follow_header();
  MarkSweep::mark_and_push(m->adr_method());
  ResourceMark rm;
  for (ProfileData* data = m->first_data(); 
       m->is_valid(data); 
       data = m->next_data(data)) {
    data->follow_contents();
  }
}
int methodDataKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) {
  assert(obj->is_methodData(), "should be method data");
  methodDataOop m = methodDataOop(obj);

  PSParallelCompact::adjust_pointer(m->adr_method());

  ResourceMark rm;
  ProfileData* data;
  for (data = m->first_data(); m->is_valid(data); data = m->next_data(data)) {
    data->update_pointers();
  }
  return m->object_size();
}
object_type ClassifyObjectClosure::classify_object(oop obj, bool count) {
  object_type type = unknown_type;

  Klass* k = obj->blueprint();

  if (k->as_klassOop() == SystemDictionary::Object_klass()) {
    tty->print_cr("Found the class!");
  }

  if (count) {
    k->set_alloc_count(k->alloc_count() + 1);
  }

  if (obj->is_instance()) {
    if (k->oop_is_instanceRef()) {
      type = instanceRef_type;
    } else {
      type = instance_type;
    }
  } else if (obj->is_typeArray()) {
    type = typeArray_type;
  } else if (obj->is_objArray()) {
    type = objArray_type;
  } else if (obj->is_symbol()) {
    type = symbol_type;
  } else if (obj->is_klass()) {
    Klass* k = ((klassOop)obj)->klass_part();
    if (k->oop_is_instance()) {
      type = instanceKlass_type;
    } else {
      type = klass_type;
    }
  } else if (obj->is_method()) {
    type = method_type;
  } else if (obj->is_constMethod()) {
    type = constMethod_type;
  } else if (obj->is_methodData()) {
    ShouldNotReachHere();
  } else if (obj->is_constantPool()) {
    type = constantPool_type;
  } else if (obj->is_constantPoolCache()) {
    type = constantPoolCache_type;
  } else if (obj->is_compiledICHolder()) {
    type = compiledICHolder_type;
  } else {
    ShouldNotReachHere();
  }

  assert(type != unknown_type, "found object of unknown type.");
  return type;
}
void methodDataKlass::oop_follow_contents(ParCompactionManager* cm,
                                          oop obj) {
  assert (obj->is_methodData(), "object must be method data");
  methodDataOop m = methodDataOop(obj);

  obj->follow_header(cm);
  PSParallelCompact::mark_and_push(cm, m->adr_method());
  ResourceMark rm;
  for (ProfileData* data = m->first_data();
       m->is_valid(data);
       data = m->next_data(data)) {
    data->follow_contents(cm);
  }
}
Beispiel #7
0
  void do_object(oop obj) {
    // Zap data from the objects which is pertains only to this JVM.  We
    // want that data recreated in new JVMs when the shared file is used.
    if (obj->is_method()) {
      ((methodOop)obj)->remove_unshareable_info();
    }
    else if (obj->is_klass()) {
      Klass::cast((klassOop)obj)->remove_unshareable_info();
    }

    // Don't save compiler related special oops (shouldn't be any yet).
    if (obj->is_methodData() || obj->is_compiledICHolder()) {
      ShouldNotReachHere();
    }
  }
int methodDataKlass::oop_adjust_pointers(oop obj) {
  assert(obj->is_methodData(), "should be method data");
  methodDataOop m = methodDataOop(obj);
  // Get size before changing pointers
  // Don't call size() or oop_size() since that is a virtual call.
  int size = m->object_size();

  obj->adjust_header();
  MarkSweep::adjust_pointer(m->adr_method());
  ResourceMark rm;
  ProfileData* data;
  for (data = m->first_data(); m->is_valid(data); data = m->next_data(data)) {
    data->adjust_pointers();
  }
  return size;
}
int methodDataKlass::oop_oop_iterate(oop obj, OopClosure* blk) {
  assert (obj->is_methodData(), "object must be method data");
  methodDataOop m = methodDataOop(obj);
  // Get size before changing pointers
  // Don't call size() or oop_size() since that is a virtual call.
  int size = m->object_size();

  obj->oop_iterate_header(blk);
  blk->do_oop(m->adr_method());
  ResourceMark rm;
  for (ProfileData* data = m->first_data(); 
       m->is_valid(data);
       data = m->next_data(data)) {
    data->oop_iterate(blk);
  }
  return size;
}
bool methodDataKlass::oop_is_parsable(oop obj) const {
  assert(obj->is_methodData(), "must be method data oop");
  return methodDataOop(obj)->object_is_parsable();
}
int methodDataKlass::oop_size(oop obj) const {
  assert(obj->is_methodData(), "must be method data oop");
  return methodDataOop(obj)->object_size();
}
void methodDataKlass::oop_copy_contents(PSPromotionManager* pm, oop obj) {
  assert (obj->is_methodData(), "object must be method data");
  methodDataOop m = methodDataOop(obj);  
  // This should never point into the young gen.
  assert(!PSScavenge::should_scavenge(oop(*m->adr_method())), "Sanity");
}