Revert "Fix backend for working with asm-7.0 beta (KT-27540, KT-27774)"

Original commit that cause this change was removed in asm 7.0 release
This commit is contained in:
Mikhael Bogdanov
2018-10-30 10:58:39 +01:00
parent e5a3feada4
commit 43e79035e9
6 changed files with 0 additions and 30 deletions
@@ -51,10 +51,6 @@ import org.jetbrains.kotlin.types.SimpleType;
import org.jetbrains.org.objectweb.asm.*;
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter;
import org.jetbrains.org.objectweb.asm.commons.Method;
import org.jetbrains.org.objectweb.asm.tree.AbstractInsnNode;
import org.jetbrains.org.objectweb.asm.tree.InsnList;
import org.jetbrains.org.objectweb.asm.tree.LabelNode;
import org.jetbrains.org.objectweb.asm.tree.MethodNode;
import java.util.ArrayList;
import java.util.List;
@@ -1233,21 +1229,4 @@ public class AsmUtil {
//Trait always should have this descriptor
return kind != OwnerKind.DEFAULT_IMPLS && isStaticMethod(kind, descriptor) ? 0 : 1;
}
public static void resetLabelInfos(@NotNull MethodNode methodNode) {
//noinspection ConstantConditions
if (Opcodes.API_VERSION <= Opcodes.ASM6) {
return;
}
InsnList instructions = methodNode.instructions;
for (AbstractInsnNode inst = instructions.getFirst(); inst != null; inst = inst.getNext()) {
if (inst instanceof LabelNode) {
Label label = ((LabelNode) inst).getLabel();
if (label != null) {
label.info = null;
}
}
}
}
}
@@ -407,7 +407,6 @@ class AnonymousObjectTransformer(
val first = intermediateMethodNode.instructions.first
val oldStartLabel = (first as? LabelNode)?.label
AsmUtil.resetLabelInfos(intermediateMethodNode)
intermediateMethodNode.accept(object : MethodBodyVisitor(capturedFieldInitializer) {
override fun visitLocalVariable(
name: String, desc: String, signature: String?, start: Label, end: Label, index: Int
@@ -16,7 +16,6 @@
package org.jetbrains.kotlin.codegen.inline
import org.jetbrains.kotlin.codegen.AsmUtil
import org.jetbrains.org.objectweb.asm.MethodVisitor
import org.jetbrains.org.objectweb.asm.tree.MethodNode
@@ -28,7 +27,6 @@ class DeferredMethodVisitor(
override fun visitEnd() {
super.visitEnd()
val resultVisitor = resultNode()
AsmUtil.resetLabelInfos(intermediate)
intermediate.accept(resultVisitor)
}
}
@@ -290,7 +290,6 @@ abstract class InlineCodegen<out T : BaseExpressionCodegen>(
removeFinallyMarkers(adapter)
}
AsmUtil.resetLabelInfos(adapter)
adapter.accept(MethodBodyVisitor(codegen.v))
if (shouldSpillStack) {
@@ -70,7 +70,6 @@ class InlineCodegenForDefaultBody(
val argsSize =
(Type.getArgumentsAndReturnSizes(jvmSignature.asmMethod.descriptor) ushr 2) - if (callableMethod.isStaticCall()) 1 else 0
AsmUtil.resetLabelInfos(node)
node.accept(object : InlineAdapter(transformedMethod, 0, childSourceMapper) {
override fun visitLocalVariable(name: String, desc: String, signature: String?, start: Label, end: Label, index: Int) {
val startLabel = if (index < argsSize) methodStartLabel else start
@@ -78,7 +77,6 @@ class InlineCodegenForDefaultBody(
}
})
AsmUtil.resetLabelInfos(transformedMethod)
transformedMethod.accept(MethodBodyVisitor(codegen.visitor))
}
@@ -131,9 +131,7 @@ class MethodInliner(
}
processReturns(resultNode, labelOwner, remapReturn, end)
//flush transformed node to output
AsmUtil.resetLabelInfos(resultNode)
resultNode.accept(MethodBodyVisitor(adapter, true))
sourceMapper.endMapping()
@@ -391,7 +389,6 @@ class MethodInliner(
}
}
AsmUtil.resetLabelInfos(node)
node.accept(lambdaInliner)
return resultNode