本文整理汇总了C++中Klass::set_superKlass方法的典型用法代码示例。如果您正苦于以下问题:C++ Klass::set_superKlass方法的具体用法?C++ Klass::set_superKlass怎么用?C++ Klass::set_superKlass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Klass
的用法示例。
在下文中一共展示了Klass::set_superKlass方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: markSymbol
PRIM_DECL_2(behaviorPrimitives::setSuperclass, oop receiver, oop newSuper) {
PROLOGUE_2("setSuperclass", receiver, newSuper);
if (!receiver->is_klass())
return markSymbol(vmSymbols::receiver_has_wrong_type());
if (!(newSuper->is_klass() || newSuper == nilObj))
return markSymbol(vmSymbols::first_argument_has_wrong_type());
Klass* receiverClass = klassOop(receiver)->klass_part();
klassOop newSuperclass;
if (receiverClass->superKlass() == newSuper) return receiver; // no change
if (receiverClass->superKlass() == nilObj) {
newSuperclass = klassOop(newSuper);
if (newSuperclass->klass_part()->number_of_instance_variables() > 0)
return markSymbol(vmSymbols::argument_is_invalid());
} else {
Klass* oldSuperclass = receiverClass->superKlass()->klass_part();
if (newSuper == nilObj) {
newSuperclass = klassOop(nilObj);
if (oldSuperclass->number_of_instance_variables() > 0)
return markSymbol(vmSymbols::argument_is_invalid());
} else {
newSuperclass = klassOop(newSuper);
if (!oldSuperclass->has_same_inst_vars_as(newSuperclass))
return markSymbol(vmSymbols::invalid_klass());
}
}
receiverClass->set_superKlass(newSuperclass);
Universe::flush_inline_caches_in_methods();
Universe::code->clear_inline_caches();
lookupCache::flush();
DeltaCallCache::clearAll();
return receiver;
}