8338532: Speed up the ClassFile API MethodTypeDesc#ofDescriptor

Reviewed-by: redestad, liach
This commit is contained in:
Shaojin Wen 2024-08-21 14:56:30 +00:00 committed by Chen Liang
parent 918cf11454
commit 3aeb6733f9
11 changed files with 201 additions and 110 deletions

View file

@ -304,21 +304,6 @@ public enum Wrapper {
throw newIllegalArgumentException("not primitive: " + type);
}
/** Return the wrapper that corresponds to the provided basic type char.
* The basic type char must be for one of the eight primitive types, or void.
* @throws IllegalArgumentException for unexpected types
*/
public static Wrapper forPrimitiveType(char basicTypeChar) {
Wrapper w = FROM_CHAR[(basicTypeChar + (basicTypeChar >> 1)) & 0xf];
if (w == null || w.basicTypeChar != basicTypeChar) {
throw basicTypeError(basicTypeChar);
}
if (w == OBJECT) {
throw newIllegalArgumentException("not primitive: " + basicTypeChar);
}
return w;
}
/** Return the wrapper that wraps values into the given wrapper type.
* If it is {@code Object}, return {@code OBJECT}.
* Otherwise, it must be a wrapper type.