8265135: Reduce work initializing VarForms

Reviewed-by: psandoz, mchung
This commit is contained in:
Claes Redestad 2021-04-19 14:39:31 +00:00
parent d9e40dd593
commit 5303ccb885
3 changed files with 66 additions and 50 deletions

View file

@ -1938,11 +1938,6 @@ public abstract class VarHandle implements Constable {
if (am != null) return am;
throw new IllegalArgumentException("No AccessMode value for method name " + methodName);
}
@ForceInline
static MemberName getMemberName(int ordinal, VarForm vform) {
return vform.memberName_table[ordinal];
}
}
static final class AccessDescriptor {
@ -2045,7 +2040,7 @@ public abstract class VarHandle implements Constable {
* {@code false}.
*/
public final boolean isAccessModeSupported(AccessMode accessMode) {
return AccessMode.getMemberName(accessMode.ordinal(), vform) != null;
return vform.getMemberNameOrNull(accessMode.ordinal()) != null;
}
/**
@ -2068,8 +2063,7 @@ public abstract class VarHandle implements Constable {
* @return a method handle bound to this VarHandle and the given access mode
*/
public MethodHandle toMethodHandle(AccessMode accessMode) {
MemberName mn = AccessMode.getMemberName(accessMode.ordinal(), vform);
if (mn != null) {
if (isAccessModeSupported(accessMode)) {
MethodHandle mh = getMethodHandle(accessMode.ordinal());
return mh.bindTo(this);
}