Use last asm api for visitor construction
This commit is contained in:
@@ -31,8 +31,8 @@ import java.util.List;
|
||||
import static org.jetbrains.kotlin.codegen.inline.InlineCodegenUtilsKt.GENERATE_SMAP;
|
||||
|
||||
public abstract class AbstractClassBuilder implements ClassBuilder {
|
||||
protected static final MethodVisitor EMPTY_METHOD_VISITOR = new MethodVisitor(Opcodes.ASM5) {};
|
||||
protected static final FieldVisitor EMPTY_FIELD_VISITOR = new FieldVisitor(Opcodes.ASM5) {};
|
||||
protected static final MethodVisitor EMPTY_METHOD_VISITOR = new MethodVisitor(Opcodes.API_VERSION) {};
|
||||
protected static final FieldVisitor EMPTY_FIELD_VISITOR = new FieldVisitor(Opcodes.API_VERSION) {};
|
||||
|
||||
private String thisName;
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ public abstract class AnnotationCodegen {
|
||||
new JvmFlagAnnotation(JvmAnnotationUtilKt.SYNCHRONIZED_ANNOTATION_FQ_NAME.asString(), Opcodes.ACC_SYNCHRONIZED)
|
||||
);
|
||||
|
||||
private static final AnnotationVisitor NO_ANNOTATION_VISITOR = new AnnotationVisitor(Opcodes.ASM5) {
|
||||
private static final AnnotationVisitor NO_ANNOTATION_VISITOR = new AnnotationVisitor(Opcodes.API_VERSION) {
|
||||
@Override
|
||||
public AnnotationVisitor visitAnnotation(String name, @NotNull String desc) {
|
||||
return safe(super.visitAnnotation(name, desc));
|
||||
|
||||
@@ -53,7 +53,7 @@ fun createMethodNodeForAlwaysEnabledAssert(
|
||||
|
||||
val node =
|
||||
org.jetbrains.org.objectweb.asm.tree.MethodNode(
|
||||
Opcodes.ASM5,
|
||||
Opcodes.API_VERSION,
|
||||
Opcodes.ACC_STATIC,
|
||||
"fake",
|
||||
typeMapper.mapAsmMethod(functionDescriptor).descriptor, null, null
|
||||
|
||||
@@ -34,7 +34,7 @@ abstract class TransformationMethodVisitor(
|
||||
desc: String,
|
||||
signature: String?,
|
||||
exceptions: Array<out String>?,
|
||||
api: Int = Opcodes.ASM5
|
||||
api: Int = Opcodes.API_VERSION
|
||||
) : MethodVisitor(api) {
|
||||
|
||||
private val methodNode = MethodNode(access, name, desc, signature, exceptions).apply {
|
||||
@@ -70,7 +70,7 @@ abstract class TransformationMethodVisitor(
|
||||
performTransformations(methodNode)
|
||||
}
|
||||
|
||||
methodNode.accept(EndIgnoringMethodVisitorDecorator(Opcodes.ASM5, delegate))
|
||||
methodNode.accept(EndIgnoringMethodVisitorDecorator(Opcodes.API_VERSION, delegate))
|
||||
|
||||
|
||||
// In case of empty instructions list MethodNode.accept doesn't call visitLocalVariables of delegate
|
||||
|
||||
+2
-2
@@ -354,8 +354,8 @@ class CoroutineTransformerMethodVisitor(
|
||||
methodNode.instructions.resetLabels()
|
||||
methodNode.accept(
|
||||
MaxStackFrameSizeAndLocalsCalculator(
|
||||
Opcodes.ASM5, methodNode.access, methodNode.desc,
|
||||
object : MethodVisitor(Opcodes.ASM5) {
|
||||
Opcodes.API_VERSION, methodNode.access, methodNode.desc,
|
||||
object : MethodVisitor(Opcodes.API_VERSION) {
|
||||
override fun visitMaxs(maxStack: Int, maxLocals: Int) {
|
||||
methodNode.maxStack = maxStack
|
||||
}
|
||||
|
||||
+3
-3
@@ -340,7 +340,7 @@ fun createMethodNodeForIntercepted(
|
||||
|
||||
val node =
|
||||
MethodNode(
|
||||
Opcodes.ASM5,
|
||||
Opcodes.API_VERSION,
|
||||
Opcodes.ACC_STATIC,
|
||||
"fake",
|
||||
typeMapper.mapAsmMethod(functionDescriptor).descriptor, null, null
|
||||
@@ -366,7 +366,7 @@ fun createMethodNodeForCoroutineContext(
|
||||
|
||||
val node =
|
||||
MethodNode(
|
||||
Opcodes.ASM5,
|
||||
Opcodes.API_VERSION,
|
||||
Opcodes.ACC_STATIC,
|
||||
"fake",
|
||||
Type.getMethodDescriptor(languageVersionSettings.coroutineContextAsmType()),
|
||||
@@ -395,7 +395,7 @@ fun createMethodNodeForSuspendCoroutineUninterceptedOrReturn(
|
||||
|
||||
val node =
|
||||
MethodNode(
|
||||
Opcodes.ASM5,
|
||||
Opcodes.API_VERSION,
|
||||
Opcodes.ACC_STATIC,
|
||||
"fake",
|
||||
typeMapper.mapAsmMethod(functionDescriptor).descriptor, null, null
|
||||
|
||||
@@ -56,7 +56,7 @@ import java.io.PrintWriter
|
||||
import java.io.StringWriter
|
||||
|
||||
const val GENERATE_SMAP = true
|
||||
const val API = Opcodes.ASM5
|
||||
const val API = Opcodes.API_VERSION
|
||||
const val NUMBERED_FUNCTION_PREFIX = "kotlin/jvm/functions/Function"
|
||||
const val INLINE_FUN_VAR_SUFFIX = "\$iv"
|
||||
|
||||
|
||||
+1
-1
@@ -251,7 +251,7 @@ class RedundantBoxingMethodTransformer(private val generationState: GenerationSt
|
||||
castWithType: Pair<AbstractInsnNode, Type>
|
||||
) {
|
||||
val castInsn = castWithType.getFirst()
|
||||
val castInsnsListener = MethodNode(Opcodes.ASM5)
|
||||
val castInsnsListener = MethodNode(Opcodes.API_VERSION)
|
||||
InstructionAdapter(castInsnsListener).cast(value.unboxedType, castWithType.getSecond())
|
||||
|
||||
for (insn in castInsnsListener.instructions.toArray()) {
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ import static org.jetbrains.kotlin.codegen.optimization.common.StrictBasicValue.
|
||||
|
||||
public class OptimizationBasicInterpreter extends Interpreter<BasicValue> implements Opcodes {
|
||||
public OptimizationBasicInterpreter() {
|
||||
super(ASM5);
|
||||
super(API_VERSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.jetbrains.org.objectweb.asm.Opcodes.*
|
||||
import org.jetbrains.org.objectweb.asm.Type
|
||||
import org.jetbrains.org.objectweb.asm.tree.*
|
||||
|
||||
const val OPTIMIZATION_ASM_API_VERSION = Opcodes.ASM5
|
||||
const val OPTIMIZATION_ASM_API_VERSION = Opcodes.API_VERSION
|
||||
|
||||
val AbstractInsnNode.isMeaningful: Boolean
|
||||
get() =
|
||||
@@ -80,8 +80,8 @@ fun MethodNode.prepareForEmitting() {
|
||||
maxStack = -1
|
||||
accept(
|
||||
MaxStackFrameSizeAndLocalsCalculator(
|
||||
Opcodes.ASM5, access, desc,
|
||||
object : MethodVisitor(Opcodes.ASM5) {
|
||||
Opcodes.API_VERSION, access, desc,
|
||||
object : MethodVisitor(Opcodes.API_VERSION) {
|
||||
override fun visitMaxs(maxStack: Int, maxLocals: Int) {
|
||||
this@prepareForEmitting.maxStack = maxStack
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user