From 3deda84b0e64340b616d368fa1817e7cdbcb5cd1 Mon Sep 17 00:00:00 2001 From: "David M. Lloyd" Date: Mon, 10 Jun 2024 13:34:05 -0500 Subject: [PATCH] Update JDK --- jdk | 2 +- .../classfile/impl/StackMapDecoder.java | 30 ++++++++++++++----- .../classfile/impl/StackMapGenerator.java | 7 +++-- 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/jdk b/jdk index dce9703..d85b0ca 160000 --- a/jdk +++ b/jdk @@ -1 +1 @@ -Subproject commit dce97031555dcf689fecda16e444e7e8e9d5b270 +Subproject commit d85b0ca5cdc1820a886c46bf555b2051fed7f167 diff --git a/src/main/java/io/github/dmlloyd/classfile/impl/StackMapDecoder.java b/src/main/java/io/github/dmlloyd/classfile/impl/StackMapDecoder.java index 8b2dfdb..6726190 100644 --- a/src/main/java/io/github/dmlloyd/classfile/impl/StackMapDecoder.java +++ b/src/main/java/io/github/dmlloyd/classfile/impl/StackMapDecoder.java @@ -25,21 +25,21 @@ package io.github.dmlloyd.classfile.impl; +import io.github.dmlloyd.classfile.BufWriter; +import io.github.dmlloyd.classfile.ClassReader; +import io.github.dmlloyd.classfile.Label; +import io.github.dmlloyd.classfile.MethodModel; +import io.github.dmlloyd.classfile.attribute.StackMapFrameInfo; +import io.github.dmlloyd.classfile.attribute.StackMapFrameInfo.*; +import io.github.dmlloyd.classfile.constantpool.ClassEntry; import java.lang.constant.ConstantDescs; import java.lang.constant.MethodTypeDesc; import io.github.dmlloyd.classfile.extras.reflect.AccessFlag; import java.util.List; +import java.util.Objects; import java.util.TreeMap; -import io.github.dmlloyd.classfile.BufWriter; - -import io.github.dmlloyd.classfile.constantpool.ClassEntry; -import io.github.dmlloyd.classfile.attribute.StackMapFrameInfo; -import io.github.dmlloyd.classfile.attribute.StackMapFrameInfo.*; -import io.github.dmlloyd.classfile.ClassReader; import static io.github.dmlloyd.classfile.ClassFile.*; -import io.github.dmlloyd.classfile.Label; -import io.github.dmlloyd.classfile.MethodModel; public class StackMapDecoder { @@ -240,6 +240,20 @@ public record ObjectVerificationTypeInfoImpl( @Override public int tag() { return VT_OBJECT; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o instanceof ObjectVerificationTypeInfoImpl that) { + return Objects.equals(className, that.className); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(className); + } + @Override public String toString() { return className.asInternalName(); diff --git a/src/main/java/io/github/dmlloyd/classfile/impl/StackMapGenerator.java b/src/main/java/io/github/dmlloyd/classfile/impl/StackMapGenerator.java index 7d5df14..407bcae 100644 --- a/src/main/java/io/github/dmlloyd/classfile/impl/StackMapGenerator.java +++ b/src/main/java/io/github/dmlloyd/classfile/impl/StackMapGenerator.java @@ -1045,7 +1045,9 @@ private void setLocalRawInternal(int index, Type type) { } void setLocalsFromArg(String name, MethodTypeDesc methodDesc, boolean isStatic, Type thisKlass) { - localsSize = 0; + int localsSize = 0; + // Pre-emptively create a locals array that encompass all parameter slots + checkLocal(methodDesc.parameterCount() + (isStatic ? 0 : -1)); if (!isStatic) { localsSize++; if (OBJECT_INITIALIZER_NAME.equals(name) && !CD_Object.equals(thisKlass.sym)) { @@ -1057,7 +1059,7 @@ void setLocalsFromArg(String name, MethodTypeDesc methodDesc, boolean isStatic, } for (int i = 0; i < methodDesc.parameterCount(); i++) { var desc = methodDesc.parameterType(i); - if (desc.isClassOrInterface() || desc.isArray()) { + if (!desc.isPrimitive()) { setLocalRawInternal(localsSize++, Type.referenceType(desc)); } else switch (desc.descriptorString().charAt(0)) { case 'J' -> { @@ -1075,6 +1077,7 @@ void setLocalsFromArg(String name, MethodTypeDesc methodDesc, boolean isStatic, default -> throw new AssertionError("Should not reach here"); } } + this.localsSize = localsSize; } void copyFrom(Frame src) {