8335475: ClassBuilder incorrectly calculates max_locals in some cases

Reviewed-by: asotona
This commit is contained in:
Chen Liang 2024-07-02 23:15:31 +00:00
parent 27982c8f5d
commit 1ef34c1833
2 changed files with 32 additions and 4 deletions

View file

@ -1046,7 +1046,7 @@ public final class StackMapGenerator {
void setLocalsFromArg(String name, MethodTypeDesc methodDesc, boolean isStatic, Type thisKlass) {
int localsSize = 0;
// Pre-emptively create a locals array that encompass all parameter slots
checkLocal(methodDesc.parameterCount() + (isStatic ? 0 : -1));
checkLocal(methodDesc.parameterCount() + (isStatic ? -1 : 0));
if (!isStatic) {
localsSize++;
if (OBJECT_INITIALIZER_NAME.equals(name) && !CD_Object.equals(thisKlass.sym)) {