Do not call default constructor of SourceInterpreter in subclasses

It became illegal since asm-6.x

See https://gitlab.ow2.org/asm/asm/blob/c72a86bd5f48a308537695213d3a23ac35a57d55/asm-analysis/src/main/java/org/objectweb/asm/tree/analysis/SourceInterpreter.java#L56

 #KT-27572 Fixed
This commit is contained in:
Denis Zharkov
2018-10-15 11:38:52 +03:00
parent c63eb18b3c
commit 26da0b9e7e
4 changed files with 8 additions and 5 deletions
@@ -948,7 +948,7 @@ private fun allSuspensionPointsAreTailCalls(
}
}
internal class IgnoringCopyOperationSourceInterpreter : SourceInterpreter() {
internal class IgnoringCopyOperationSourceInterpreter : SourceInterpreter(OPTIMIZATION_ASM_API_VERSION) {
override fun copyOperation(insn: AbstractInsnNode?, value: SourceValue?) = value
}
@@ -169,7 +169,7 @@ private fun checkUpdatedExpectedType(was: Type?, new: Type) {
}
}
private class MySourceInterpreter : SourceInterpreter() {
private class MySourceInterpreter : SourceInterpreter(OPTIMIZATION_ASM_API_VERSION) {
override fun copyOperation(insn: AbstractInsnNode, value: SourceValue) =
when {
insn.isStoreOperation() || insn.isLoadOperation() -> SourceValue(value.size, insn)
@@ -17,6 +17,7 @@
package org.jetbrains.kotlin.codegen.optimization.boxing
import org.jetbrains.kotlin.codegen.optimization.OptimizationMethodVisitor
import org.jetbrains.kotlin.codegen.optimization.common.OPTIMIZATION_ASM_API_VERSION
import org.jetbrains.kotlin.codegen.optimization.common.debugText
import org.jetbrains.kotlin.codegen.optimization.common.isLoadOperation
import org.jetbrains.kotlin.codegen.optimization.common.isMeaningful
@@ -119,7 +120,7 @@ class PopBackwardPropagationTransformer : MethodTransformer() {
throw AssertionError("Incorrect bytecode at ${methodNode.instructions.indexOf(insn)}: ${insn.debugText} $frame")
}
private inner class HazardsTrackingInterpreter : SourceInterpreter() {
private inner class HazardsTrackingInterpreter : SourceInterpreter(OPTIMIZATION_ASM_API_VERSION) {
override fun naryOperation(insn: AbstractInsnNode, values: MutableList<out SourceValue>): SourceValue {
for (value in values) {
value.insns.markAsDontTouch()
@@ -313,4 +314,4 @@ fun AbstractInsnNode.isUnitInstance() =
this is FieldInsnNode && owner == "kotlin/Unit" && name == "INSTANCE"
fun AbstractInsnNode.isPrimitiveTypeConversion() =
opcode in Opcodes.I2L..Opcodes.I2S
opcode in Opcodes.I2L..Opcodes.I2S
@@ -27,6 +27,8 @@ 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
val AbstractInsnNode.isMeaningful: Boolean
get() =
when (this.type) {
@@ -221,4 +223,4 @@ internal inline fun <reified T : AbstractInsnNode> AbstractInsnNode.takeInsnIf(o
fun InsnList.removeAll(nodes: Collection<AbstractInsnNode>) {
for (node in nodes) remove(node)
}
}