本文整理汇总了C++中Klass::is_instance_klass方法的典型用法代码示例。如果您正苦于以下问题:C++ Klass::is_instance_klass方法的具体用法?C++ Klass::is_instance_klass怎么用?C++ Klass::is_instance_klass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Klass
的用法示例。
在下文中一共展示了Klass::is_instance_klass方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: compute_static_oop_field_count
int InstanceMirrorKlass::compute_static_oop_field_count(oop obj) {
Klass* k = java_lang_Class::as_Klass(obj);
if (k != NULL && k->is_instance_klass()) {
return InstanceKlass::cast(k)->static_oop_field_count();
}
return 0;
}
示例2: oop_pc_follow_contents
void InstanceMirrorKlass::oop_pc_follow_contents(oop obj, ParCompactionManager* cm) {
InstanceKlass::oop_pc_follow_contents(obj, cm);
// Follow the klass field in the mirror.
Klass* klass = java_lang_Class::as_Klass(obj);
if (klass != NULL) {
// An anonymous class doesn't have its own class loader, so the call
// to follow_klass will mark and push its java mirror instead of the
// class loader. When handling the java mirror for an anonymous class
// we need to make sure its class loader data is claimed, this is done
// by calling follow_class_loader explicitly. For non-anonymous classes
// the call to follow_class_loader is made when the class loader itself
// is handled.
if (klass->is_instance_klass() && InstanceKlass::cast(klass)->is_anonymous()) {
cm->follow_class_loader(klass->class_loader_data());
} else {
cm->follow_klass(klass);
}
} else {
// If klass is NULL then this a mirror for a primitive type.
// We don't have to follow them, since they are handled as strong
// roots in Universe::oops_do.
assert(java_lang_Class::is_primitive(obj), "Sanity check");
}
ParCompactionManager::MarkAndPushClosure cl(cm);
oop_oop_iterate_statics<true>(obj, &cl);
}
示例3: methods_do
void ClassLoaderData::methods_do(void f(Method*)) {
for (Klass* k = _klasses; k != NULL; k = k->next_link()) {
if (k->is_instance_klass()) {
InstanceKlass::cast(k)->methods_do(f);
}
}
}
示例4: classes_do
void ClassLoaderData::classes_do(void f(InstanceKlass*)) {
for (Klass* k = _klasses; k != NULL; k = k->next_link()) {
if (k->is_instance_klass()) {
f(InstanceKlass::cast(k));
}
assert(k != k->next_link(), "no loops!");
}
}
示例5: methods_do
void ClassLoaderData::methods_do(void f(Method*)) {
// Lock-free access requires load_ptr_acquire
for (Klass* k = load_ptr_acquire(&_klasses); k != NULL; k = k->next_link()) {
if (k->is_instance_klass()) {
InstanceKlass::cast(k)->methods_do(f);
}
}
}
示例6: classes_do
void ClassLoaderData::classes_do(void f(InstanceKlass*)) {
// Lock-free access requires load_ptr_acquire
for (Klass* k = load_ptr_acquire(&_klasses); k != NULL; k = k->next_link()) {
if (k->is_instance_klass()) {
f(InstanceKlass::cast(k));
}
assert(k != k->next_link(), "no loops!");
}
}
示例7: loaded_classes_do
void ClassLoaderData::loaded_classes_do(KlassClosure* klass_closure) {
// Lock to avoid classes being modified/added/removed during iteration
MutexLockerEx ml(metaspace_lock(), Mutex::_no_safepoint_check_flag);
for (Klass* k = _klasses; k != NULL; k = k->next_link()) {
// Do not filter ArrayKlass oops here...
if (k->is_array_klass() || (k->is_instance_klass() && InstanceKlass::cast(k)->is_loaded())) {
klass_closure->do_klass(k);
}
}
}
示例8: decay
void CounterDecay::decay() {
_last_timestamp = os::javaTimeMillis();
// This operation is going to be performed only at the end of a safepoint
// and hence GC's will not be going on, all Java mutators are suspended
// at this point and hence SystemDictionary_lock is also not needed.
assert(SafepointSynchronize::is_at_safepoint(), "can only be executed at a safepoint");
int nclasses = SystemDictionary::number_of_classes();
double classes_per_tick = nclasses * (CounterDecayMinIntervalLength * 1e-3 /
CounterHalfLifeTime);
for (int i = 0; i < classes_per_tick; i++) {
Klass* k = SystemDictionary::try_get_next_class();
if (k != NULL && k->is_instance_klass()) {
InstanceKlass::cast(k)->methods_do(do_method);
}
}
}
示例9:
// 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()