本文整理汇总了C++中methodHandle::is_old_version方法的典型用法代码示例。如果您正苦于以下问题:C++ methodHandle::is_old_version方法的具体用法?C++ methodHandle::is_old_version怎么用?C++ methodHandle::is_old_version使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类methodHandle
的用法示例。
在下文中一共展示了methodHandle::is_old_version方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: set_method
void ConstantPoolCacheEntry::set_method(Bytecodes::Code invoke_code,
methodHandle method,
int vtable_index) {
assert(method->interpreter_entry() != NULL, "should have been set at this point");
assert(!method->is_old_version(), "attempt to write old method to cpCache");
bool change_to_virtual = (invoke_code == Bytecodes::_invokeinterface);
int byte_no = -1;
bool needs_vfinal_flag = false;
switch (invoke_code) {
case Bytecodes::_invokevirtual:
case Bytecodes::_invokeinterface: {
if (Klass::can_be_statically_bound(method())) {
set_f2((intptr_t)method());
needs_vfinal_flag = true;
} else {
set_f2(vtable_index);
}
byte_no = 2;
break;
}
case Bytecodes::_invokespecial:
// Preserve the value of the vfinal flag on invokevirtual bytecode
// which may be shared with this constant pool cache entry.
needs_vfinal_flag = is_resolved(Bytecodes::_invokevirtual) && is_vfinal();
// fall through
case Bytecodes::_invokestatic:
set_f1(method());
byte_no = 1;
break;
default:
ShouldNotReachHere();
break;
}
set_flags(as_flags(as_TosState(method->result_type()),
method->is_final_method(),
needs_vfinal_flag,
false,
change_to_virtual,
true)|
method()->size_of_parameters());
// Note: byte_no also appears in TemplateTable::resolve.
if (byte_no == 1) {
set_bytecode_1(invoke_code);
} else if (byte_no == 2) {
if (change_to_virtual) {
// NOTE: THIS IS A HACK - BE VERY CAREFUL!!!
//
// Workaround for the case where we encounter an invokeinterface, but we
// should really have an _invokevirtual since the resolved method is a
// virtual method in java.lang.Object. This is a corner case in the spec
// but is presumably legal. javac does not generate this code.
//
// We set bytecode_1() to _invokeinterface, because that is the
// bytecode # used by the interpreter to see if it is resolved.
// We set bytecode_2() to _invokevirtual.
// See also interpreterRuntime.cpp. (8/25/2000)
set_bytecode_1(invoke_code);
set_bytecode_2(Bytecodes::_invokevirtual);
} else {
set_bytecode_2(invoke_code);
}
} else {
ShouldNotReachHere();
}
verify(tty);
}