mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
Enhance method resolution and resulting data structures, plus some refactoring. Reviewed-by: twisti, acorn, jrose
This commit is contained in:
parent
98d8f57603
commit
222c735458
40 changed files with 715 additions and 601 deletions
|
@ -496,15 +496,15 @@ IRT_END
|
|||
|
||||
IRT_ENTRY(void, InterpreterRuntime::resolve_get_put(JavaThread* thread, Bytecodes::Code bytecode))
|
||||
// resolve field
|
||||
FieldAccessInfo info;
|
||||
fieldDescriptor info;
|
||||
constantPoolHandle pool(thread, method(thread)->constants());
|
||||
bool is_put = (bytecode == Bytecodes::_putfield || bytecode == Bytecodes::_putstatic);
|
||||
bool is_static = (bytecode == Bytecodes::_getstatic || bytecode == Bytecodes::_putstatic);
|
||||
|
||||
{
|
||||
JvmtiHideSingleStepping jhss(thread);
|
||||
LinkResolver::resolve_field(info, pool, get_index_u2_cpcache(thread, bytecode),
|
||||
bytecode, false, CHECK);
|
||||
LinkResolver::resolve_field_access(info, pool, get_index_u2_cpcache(thread, bytecode),
|
||||
bytecode, CHECK);
|
||||
} // end JvmtiHideSingleStepping
|
||||
|
||||
// check if link resolution caused cpCache to be updated
|
||||
|
@ -524,7 +524,7 @@ IRT_ENTRY(void, InterpreterRuntime::resolve_get_put(JavaThread* thread, Bytecode
|
|||
// class is intitialized. This is required so that access to the static
|
||||
// field will call the initialization function every time until the class
|
||||
// is completely initialized ala. in 2.17.5 in JVM Specification.
|
||||
InstanceKlass *klass = InstanceKlass::cast(info.klass()());
|
||||
InstanceKlass* klass = InstanceKlass::cast(info.field_holder());
|
||||
bool uninitialized_static = ((bytecode == Bytecodes::_getstatic || bytecode == Bytecodes::_putstatic) &&
|
||||
!klass->is_initialized());
|
||||
Bytecodes::Code get_code = (Bytecodes::Code)0;
|
||||
|
@ -539,9 +539,9 @@ IRT_ENTRY(void, InterpreterRuntime::resolve_get_put(JavaThread* thread, Bytecode
|
|||
cache_entry(thread)->set_field(
|
||||
get_code,
|
||||
put_code,
|
||||
info.klass(),
|
||||
info.field_index(),
|
||||
info.field_offset(),
|
||||
info.field_holder(),
|
||||
info.index(),
|
||||
info.offset(),
|
||||
state,
|
||||
info.access_flags().is_final(),
|
||||
info.access_flags().is_volatile(),
|
||||
|
@ -686,29 +686,55 @@ IRT_ENTRY(void, InterpreterRuntime::resolve_invoke(JavaThread* thread, Bytecodes
|
|||
if (already_resolved(thread)) return;
|
||||
|
||||
if (bytecode == Bytecodes::_invokeinterface) {
|
||||
|
||||
if (TraceItables && Verbose) {
|
||||
ResourceMark rm(thread);
|
||||
tty->print_cr("Resolving: klass: %s to method: %s", info.resolved_klass()->name()->as_C_string(), info.resolved_method()->name()->as_C_string());
|
||||
}
|
||||
}
|
||||
#ifdef ASSERT
|
||||
if (bytecode == Bytecodes::_invokeinterface) {
|
||||
if (info.resolved_method()->method_holder() ==
|
||||
SystemDictionary::Object_klass()) {
|
||||
// NOTE: THIS IS A FIX FOR A CORNER CASE in the JVM spec
|
||||
// (see also cpCacheOop.cpp for details)
|
||||
// (see also CallInfo::set_interface for details)
|
||||
assert(info.call_kind() == CallInfo::vtable_call ||
|
||||
info.call_kind() == CallInfo::direct_call, "");
|
||||
methodHandle rm = info.resolved_method();
|
||||
assert(rm->is_final() || info.has_vtable_index(),
|
||||
"should have been set already");
|
||||
cache_entry(thread)->set_method(bytecode, rm, info.vtable_index());
|
||||
} else if (!info.resolved_method()->has_itable_index()) {
|
||||
// Resolved something like CharSequence.toString. Use vtable not itable.
|
||||
assert(info.call_kind() != CallInfo::itable_call, "");
|
||||
} else {
|
||||
// Setup itable entry
|
||||
int index = klassItable::compute_itable_index(info.resolved_method()());
|
||||
cache_entry(thread)->set_interface_call(info.resolved_method(), index);
|
||||
assert(info.call_kind() == CallInfo::itable_call, "");
|
||||
int index = info.resolved_method()->itable_index();
|
||||
assert(info.itable_index() == index, "");
|
||||
}
|
||||
} else {
|
||||
cache_entry(thread)->set_method(
|
||||
assert(info.call_kind() == CallInfo::direct_call ||
|
||||
info.call_kind() == CallInfo::vtable_call, "");
|
||||
}
|
||||
#endif
|
||||
switch (info.call_kind()) {
|
||||
case CallInfo::direct_call:
|
||||
cache_entry(thread)->set_direct_call(
|
||||
bytecode,
|
||||
info.resolved_method());
|
||||
break;
|
||||
case CallInfo::vtable_call:
|
||||
cache_entry(thread)->set_vtable_call(
|
||||
bytecode,
|
||||
info.resolved_method(),
|
||||
info.vtable_index());
|
||||
break;
|
||||
case CallInfo::itable_call:
|
||||
cache_entry(thread)->set_itable_call(
|
||||
bytecode,
|
||||
info.resolved_method(),
|
||||
info.itable_index());
|
||||
break;
|
||||
default: ShouldNotReachHere();
|
||||
}
|
||||
}
|
||||
IRT_END
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue