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

@ -3644,9 +3644,8 @@ return mh1;
MemberName resolveOrFail(byte refKind, Class<?> refc, String name, MethodType type) throws NoSuchMethodException, IllegalAccessException {
checkSymbolicClass(refc); // do this before attempting to resolve
Objects.requireNonNull(name);
Objects.requireNonNull(type);
checkMethodName(refKind, name); // NPE check on name
checkMethodName(refKind, name); // implicit null-check of name
return IMPL_NAMES.resolveOrFail(refKind, new MemberName(refc, name, type, refKind), lookupClassOrNull(), allowedModes,
NoSuchMethodException.class);
}
@ -3669,6 +3668,19 @@ return mh1;
return IMPL_NAMES.resolveOrNull(refKind, member, lookupClassOrNull(), allowedModes);
}
MemberName resolveOrNull(byte refKind, Class<?> refc, String name, MethodType type) {
// do this before attempting to resolve
if (!isClassAccessible(refc)) {
return null;
}
Objects.requireNonNull(type);
// implicit null-check of name
if (name.startsWith("<") && refKind != REF_newInvokeSpecial) {
return null;
}
return IMPL_NAMES.resolveOrNull(refKind, new MemberName(refc, name, type, refKind), lookupClassOrNull(), allowedModes);
}
void checkSymbolicClass(Class<?> refc) throws IllegalAccessException {
if (!isClassAccessible(refc)) {
throw new MemberName(refc).makeAccessException("symbolic reference class is not accessible", this);
@ -3687,7 +3699,6 @@ return mh1;
throw new NoSuchMethodException("illegal method name: "+name);
}
/**
* Find my trustable caller class if m is a caller sensitive method.
* If this lookup object has original full privilege access, then the caller class is the lookupClass.