本文整理汇总了C++中oop::is_instance方法的典型用法代码示例。如果您正苦于以下问题:C++ oop::is_instance方法的具体用法?C++ oop::is_instance怎么用?C++ oop::is_instance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oop
的用法示例。
在下文中一共展示了oop::is_instance方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2:
// Return true if oop represents an object that is "visible"
// to the java world.
static inline bool visible_oop(oop o) {
// the sentinel for deleted handles isn't visible
if (o == JNIHandles::deleted_handle()) {
return false;
}
// instance
if (o->is_instance()) {
// instance objects are visible
if (o->klass() != SystemDictionary::Class_klass()) {
return true;
}
if (java_lang_Class::is_primitive(o)) {
return true;
}
// java.lang.Classes are visible
Klass* k = java_lang_Class::as_Klass(o);
if (k->is_klass()) {
// if it's a class for an object, an object array, or
// primitive (type) array then it's visible.
if (k->is_instance_klass()) {
return true;
}
if (k->is_objArray_klass()) {
return true;
}
if (k->is_typeArray_klass()) {
return true;
}
}
return false;
}
// object arrays are visible if they aren't system object arrays
if (o->is_objArray()) {
return true;
}
// type arrays are visible
if (o->is_typeArray()) {
return true;
}
// everything else (Method*s, ...) aren't visible
return false;
}; // end of visible_oop()
示例3: do_object
void do_object(oop obj) {
obj->oop_iterate_header(&resolve);
obj->oop_iterate(&resolve);
assert(obj->klass()->is_shared(), "Klass not pointing into shared space.");
// If the object is a Java object or class which might (in the
// future) contain a reference to a young gen object, add it to the
// list.
if (obj->is_klass() || obj->is_instance()) {
if (obj->is_klass() ||
obj->is_a(SystemDictionary::Class_klass()) ||
obj->is_a(SystemDictionary::Throwable_klass())) {
// Do nothing
}
else if (obj->is_a(SystemDictionary::String_klass())) {
// immutable objects.
} else {
// someone added an object we hadn't accounted for.
ShouldNotReachHere();
}
}
}