mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-22 03:54:33 +02:00
6829187: compiler optimizations required for JSR 292
C2 implementation for invokedynamic support. Reviewed-by: kvn, never
This commit is contained in:
parent
9be2e29930
commit
375527d84e
31 changed files with 566 additions and 89 deletions
|
@ -41,6 +41,7 @@ ciObjArrayKlassKlass* ciEnv::_obj_array_klass_klass_instance;
|
|||
ciInstanceKlass* ciEnv::_ArrayStoreException;
|
||||
ciInstanceKlass* ciEnv::_Class;
|
||||
ciInstanceKlass* ciEnv::_ClassCastException;
|
||||
ciInstanceKlass* ciEnv::_InvokeDynamic;
|
||||
ciInstanceKlass* ciEnv::_Object;
|
||||
ciInstanceKlass* ciEnv::_Throwable;
|
||||
ciInstanceKlass* ciEnv::_Thread;
|
||||
|
@ -735,6 +736,35 @@ ciMethod* ciEnv::get_method_by_index_impl(ciInstanceKlass* accessor,
|
|||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// ciEnv::get_fake_invokedynamic_method_impl
|
||||
ciMethod* ciEnv::get_fake_invokedynamic_method_impl(ciInstanceKlass* accessor,
|
||||
int index, Bytecodes::Code bc) {
|
||||
assert(bc == Bytecodes::_invokedynamic, "must be invokedynamic");
|
||||
assert(accessor->get_instanceKlass()->is_linked(), "must be linked before accessing constant pool");
|
||||
constantPoolHandle cpool = accessor->get_instanceKlass()->constants();
|
||||
|
||||
// Get the CallSite from the constant pool cache.
|
||||
ConstantPoolCacheEntry* cpc_entry = cpool->cache()->secondary_entry_at(index);
|
||||
assert(cpc_entry != NULL && cpc_entry->is_secondary_entry(), "sanity");
|
||||
Handle call_site = cpc_entry->f1();
|
||||
|
||||
// Call site might not be linked yet.
|
||||
if (call_site.is_null()) {
|
||||
ciInstanceKlass* mh_klass = get_object(SystemDictionary::MethodHandle_klass())->as_instance_klass();
|
||||
ciSymbol* sig_sym = get_object(cpool->signature_ref_at(index))->as_symbol();
|
||||
return get_unloaded_method(mh_klass, ciSymbol::invoke_name(), sig_sym);
|
||||
}
|
||||
|
||||
// Get the methodOop from the CallSite.
|
||||
methodOop method_oop = (methodOop) java_dyn_CallSite::vmmethod(call_site());
|
||||
assert(method_oop != NULL, "sanity");
|
||||
assert(method_oop->is_method_handle_invoke(), "consistent");
|
||||
|
||||
return get_object(method_oop)->as_method();
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// ciEnv::get_instance_klass_for_declared_method_holder
|
||||
ciInstanceKlass* ciEnv::get_instance_klass_for_declared_method_holder(ciKlass* method_holder) {
|
||||
|
@ -757,15 +787,18 @@ ciInstanceKlass* ciEnv::get_instance_klass_for_declared_method_holder(ciKlass* m
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// ciEnv::get_method_by_index
|
||||
ciMethod* ciEnv::get_method_by_index(ciInstanceKlass* accessor,
|
||||
int index, Bytecodes::Code bc) {
|
||||
GUARDED_VM_ENTRY(return get_method_by_index_impl(accessor, index, bc);)
|
||||
if (bc == Bytecodes::_invokedynamic) {
|
||||
GUARDED_VM_ENTRY(return get_fake_invokedynamic_method_impl(accessor, index, bc);)
|
||||
} else {
|
||||
GUARDED_VM_ENTRY(return get_method_by_index_impl(accessor, index, bc);)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// ciEnv::name_buffer
|
||||
char *ciEnv::name_buffer(int req_len) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue