mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8195650: Method references to VarHandle accessors
Reviewed-by: jrose
This commit is contained in:
parent
f44956330d
commit
14651d9e02
6 changed files with 190 additions and 13 deletions
|
@ -491,6 +491,24 @@ vmIntrinsics::ID MethodHandles::signature_polymorphic_name_id(Klass* klass, Symb
|
|||
return vmIntrinsics::_none;
|
||||
}
|
||||
|
||||
// Returns true if method is signature polymorphic and public
|
||||
bool MethodHandles::is_signature_polymorphic_public_name(Klass* klass, Symbol* name) {
|
||||
if (is_signature_polymorphic_name(klass, name)) {
|
||||
InstanceKlass* iklass = InstanceKlass::cast(klass);
|
||||
int me;
|
||||
int ms = iklass->find_method_by_name(name, &me);
|
||||
assert(ms != -1, "");
|
||||
for (; ms < me; ms++) {
|
||||
Method* m = iklass->methods()->at(ms);
|
||||
int required = JVM_ACC_NATIVE | JVM_ACC_VARARGS | JVM_ACC_PUBLIC;
|
||||
int flags = m->access_flags().as_int();
|
||||
if ((flags & required) == required && ArgumentCount(m->signature()).size() == 1) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// convert the external string or reflective type to an internal signature
|
||||
Symbol* MethodHandles::lookup_signature(oop type_str, bool intern_if_not_found, TRAPS) {
|
||||
|
@ -741,7 +759,7 @@ Handle MethodHandles::resolve_MemberName(Handle mname, Klass* caller,
|
|||
|
||||
vmIntrinsics::ID mh_invoke_id = vmIntrinsics::_none;
|
||||
if ((flags & ALL_KINDS) == IS_METHOD &&
|
||||
(defc == SystemDictionary::MethodHandle_klass()) &&
|
||||
(defc == SystemDictionary::MethodHandle_klass() || defc == SystemDictionary::VarHandle_klass()) &&
|
||||
(ref_kind == JVM_REF_invokeVirtual ||
|
||||
ref_kind == JVM_REF_invokeSpecial ||
|
||||
// static invocation mode is required for _linkToVirtual, etc.:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue