本文整理汇总了C++中Klass::alloc_count方法的典型用法代码示例。如果您正苦于以下问题:C++ Klass::alloc_count方法的具体用法?C++ Klass::alloc_count怎么用?C++ Klass::alloc_count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Klass
的用法示例。
在下文中一共展示了Klass::alloc_count方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: do_object
void ClassifyInstanceKlassClosure::do_object(oop obj) {
int type = classify_object(obj, false);
if (type == instanceKlass_type || type == klass_type) {
Klass* k = ((klassOop)obj)->klass_part();
if (k->alloc_count() > 0) {
ResourceMark rm;
const char *name;
if (k->name() == NULL) {
if (obj == Universe::klassKlassObj()) {
name = "_klassKlassObj";
} else if (obj == Universe::arrayKlassKlassObj()) {
name = "_arrayKlassKlassObj";
} else if (obj == Universe::objArrayKlassKlassObj()) {
name = "_objArrayKlassKlassObj";
} else if (obj == Universe::typeArrayKlassKlassObj()) {
name = "_typeArrayKlassKlassObj";
} else if (obj == Universe::instanceKlassKlassObj()) {
name = "_instanceKlassKlassObj";
} else if (obj == Universe::symbolKlassObj()) {
name = "_symbolKlassObj";
} else if (obj == Universe::methodKlassObj()) {
name = "_methodKlassObj";
} else if (obj == Universe::constMethodKlassObj()) {
name = "_constMethodKlassObj";
} else if (obj == Universe::constantPoolKlassObj()) {
name = "_constantPoolKlassObj";
} else if (obj == Universe::constantPoolCacheKlassObj()) {
name = "_constantPoolCacheKlassObj";
} else if (obj == Universe::compiledICHolderKlassObj()) {
name = "_compiledICHolderKlassObj";
} else if (obj == Universe::systemObjArrayKlassObj()) {
name = "_systemObjArrayKlassObj";
} else {
name = "[unnamed]";
}
} else {
name = k->external_name();
}
tty->print_cr("% 8d instances of %s", k->alloc_count(), name);
}
total_instances += k->alloc_count();
}
}
示例2: classify_object
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;
}
示例3: do_object
void do_object(oop obj) {
Klass* k = obj->blueprint();
k->set_alloc_count(k->alloc_count() + 1);
k->set_alloc_size(k->alloc_size() + obj->size());
}