mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
During the work for 6829187 we have fixed a number of basic bugs which are logically grouped with 6815692 and 6858164 but which must be reviewed and pushed separately. Reviewed-by: kvn, never
This commit is contained in:
parent
14305ba3f4
commit
caf28727eb
32 changed files with 242 additions and 84 deletions
|
@ -75,6 +75,8 @@ void CallInfo::set_common(KlassHandle resolved_klass, KlassHandle selected_klass
|
|||
_selected_method = selected_method;
|
||||
_vtable_index = vtable_index;
|
||||
if (CompilationPolicy::mustBeCompiled(selected_method)) {
|
||||
// This path is unusual, mostly used by the '-Xcomp' stress test mode.
|
||||
|
||||
// Note: with several active threads, the mustBeCompiled may be true
|
||||
// while canBeCompiled is false; remove assert
|
||||
// assert(CompilationPolicy::canBeCompiled(selected_method), "cannot compile");
|
||||
|
@ -82,6 +84,16 @@ void CallInfo::set_common(KlassHandle resolved_klass, KlassHandle selected_klass
|
|||
// don't force compilation, resolve was on behalf of compiler
|
||||
return;
|
||||
}
|
||||
if (instanceKlass::cast(selected_method->method_holder())->is_not_initialized()) {
|
||||
// 'is_not_initialized' means not only '!is_initialized', but also that
|
||||
// initialization has not been started yet ('!being_initialized')
|
||||
// Do not force compilation of methods in uninitialized classes.
|
||||
// Note that doing this would throw an assert later,
|
||||
// in CompileBroker::compile_method.
|
||||
// We sometimes use the link resolver to do reflective lookups
|
||||
// even before classes are initialized.
|
||||
return;
|
||||
}
|
||||
CompileBroker::compile_method(selected_method, InvocationEntryBci,
|
||||
methodHandle(), 0, "mustBeCompiled", CHECK);
|
||||
}
|
||||
|
@ -223,6 +235,18 @@ void LinkResolver::resolve_method(methodHandle& resolved_method, KlassHandle& re
|
|||
resolve_method(resolved_method, resolved_klass, method_name, method_signature, current_klass, true, CHECK);
|
||||
}
|
||||
|
||||
void LinkResolver::resolve_dynamic_method(methodHandle& resolved_method, KlassHandle& resolved_klass, constantPoolHandle pool, int index, TRAPS) {
|
||||
// The class is java.dyn.MethodHandle
|
||||
resolved_klass = SystemDictionaryHandles::MethodHandle_klass();
|
||||
|
||||
symbolHandle method_name = vmSymbolHandles::invoke_name();
|
||||
|
||||
symbolHandle method_signature(THREAD, pool->signature_ref_at(index));
|
||||
KlassHandle current_klass (THREAD, pool->pool_holder());
|
||||
|
||||
resolve_method(resolved_method, resolved_klass, method_name, method_signature, current_klass, true, CHECK);
|
||||
}
|
||||
|
||||
void LinkResolver::resolve_interface_method(methodHandle& resolved_method, KlassHandle& resolved_klass, constantPoolHandle pool, int index, TRAPS) {
|
||||
|
||||
// resolve klass
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue