Inline API constant
This commit is contained in:
+1
-1
@@ -52,7 +52,7 @@ class AnonymousObjectTransformer(
|
|||||||
val metadataReader = ReadKotlinClassHeaderAnnotationVisitor()
|
val metadataReader = ReadKotlinClassHeaderAnnotationVisitor()
|
||||||
lateinit var superClassName: String
|
lateinit var superClassName: String
|
||||||
|
|
||||||
createClassReader().accept(object : ClassVisitor(API, classBuilder.visitor) {
|
createClassReader().accept(object : ClassVisitor(Opcodes.API_VERSION, classBuilder.visitor) {
|
||||||
override fun visit(version: Int, access: Int, name: String, signature: String?, superName: String, interfaces: Array<String>) {
|
override fun visit(version: Int, access: Int, name: String, signature: String?, superName: String, interfaces: Array<String>) {
|
||||||
classBuilder.defineClass(null, version, access, name, signature, superName, interfaces)
|
classBuilder.defineClass(null, version, access, name, signature, superName, interfaces)
|
||||||
if (languageVersionSettings.isCoroutineSuperClass(superName)) {
|
if (languageVersionSettings.isCoroutineSuperClass(superName)) {
|
||||||
|
|||||||
@@ -17,12 +17,13 @@
|
|||||||
package org.jetbrains.kotlin.codegen.inline
|
package org.jetbrains.kotlin.codegen.inline
|
||||||
|
|
||||||
import org.jetbrains.org.objectweb.asm.MethodVisitor
|
import org.jetbrains.org.objectweb.asm.MethodVisitor
|
||||||
|
import org.jetbrains.org.objectweb.asm.Opcodes
|
||||||
import org.jetbrains.org.objectweb.asm.tree.MethodNode
|
import org.jetbrains.org.objectweb.asm.tree.MethodNode
|
||||||
|
|
||||||
class DeferredMethodVisitor(
|
class DeferredMethodVisitor(
|
||||||
val intermediate: MethodNode,
|
val intermediate: MethodNode,
|
||||||
private val resultNode: () -> MethodVisitor
|
private val resultNode: () -> MethodVisitor
|
||||||
) : MethodVisitor(API, intermediate) {
|
) : MethodVisitor(Opcodes.API_VERSION, intermediate) {
|
||||||
|
|
||||||
override fun visitEnd() {
|
override fun visitEnd() {
|
||||||
super.visitEnd()
|
super.visitEnd()
|
||||||
|
|||||||
@@ -20,12 +20,12 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.org.objectweb.asm.Label;
|
import org.jetbrains.org.objectweb.asm.Label;
|
||||||
import org.jetbrains.org.objectweb.asm.MethodVisitor;
|
import org.jetbrains.org.objectweb.asm.MethodVisitor;
|
||||||
|
import org.jetbrains.org.objectweb.asm.Opcodes;
|
||||||
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter;
|
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.jetbrains.kotlin.codegen.inline.InlineCodegenUtilsKt.API;
|
|
||||||
import static org.jetbrains.kotlin.codegen.inline.InlineCodegenUtilsKt.GENERATE_SMAP;
|
import static org.jetbrains.kotlin.codegen.inline.InlineCodegenUtilsKt.GENERATE_SMAP;
|
||||||
import static org.jetbrains.kotlin.codegen.inline.InlineCodegenUtilsKt.getLoadStoreArgSize;
|
import static org.jetbrains.kotlin.codegen.inline.InlineCodegenUtilsKt.getLoadStoreArgSize;
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ public class InlineAdapter extends InstructionAdapter {
|
|||||||
private int nextLocalIndexBeforeInline = -1;
|
private int nextLocalIndexBeforeInline = -1;
|
||||||
|
|
||||||
public InlineAdapter(@NotNull MethodVisitor mv, int localsSize, @NotNull SourceMapper sourceMapper) {
|
public InlineAdapter(@NotNull MethodVisitor mv, int localsSize, @NotNull SourceMapper sourceMapper) {
|
||||||
super(API, mv);
|
super(Opcodes.API_VERSION, mv);
|
||||||
this.nextLocalIndex = localsSize;
|
this.nextLocalIndex = localsSize;
|
||||||
this.sourceMapper = sourceMapper;
|
this.sourceMapper = sourceMapper;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -542,7 +542,7 @@ abstract class InlineCodegen<out T : BaseExpressionCodegen>(
|
|||||||
private fun cloneMethodNode(methodNode: MethodNode): MethodNode {
|
private fun cloneMethodNode(methodNode: MethodNode): MethodNode {
|
||||||
methodNode.instructions.resetLabels()
|
methodNode.instructions.resetLabels()
|
||||||
return MethodNode(
|
return MethodNode(
|
||||||
API, methodNode.access, methodNode.name, methodNode.desc, methodNode.signature,
|
Opcodes.API_VERSION, methodNode.access, methodNode.name, methodNode.desc, methodNode.signature,
|
||||||
ArrayUtil.toStringArray(methodNode.exceptions)
|
ArrayUtil.toStringArray(methodNode.exceptions)
|
||||||
).also(methodNode::accept)
|
).also(methodNode::accept)
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -6,12 +6,13 @@
|
|||||||
package org.jetbrains.kotlin.codegen.inline;
|
package org.jetbrains.kotlin.codegen.inline;
|
||||||
|
|
||||||
import org.jetbrains.org.objectweb.asm.MethodVisitor;
|
import org.jetbrains.org.objectweb.asm.MethodVisitor;
|
||||||
|
import org.jetbrains.org.objectweb.asm.Opcodes;
|
||||||
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter;
|
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter;
|
||||||
|
|
||||||
public class InlineMethodInstructionAdapter extends InstructionAdapter {
|
public class InlineMethodInstructionAdapter extends InstructionAdapter {
|
||||||
|
|
||||||
InlineMethodInstructionAdapter(MethodVisitor methodVisitor) {
|
InlineMethodInstructionAdapter(MethodVisitor methodVisitor) {
|
||||||
super(InlineCodegenUtilsKt.API, methodVisitor);
|
super(Opcodes.API_VERSION, methodVisitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void visitAnnotableParameterCount(int parameterCount, boolean visible) {
|
public void visitAnnotableParameterCount(int parameterCount, boolean visible) {
|
||||||
|
|||||||
+1
-1
@@ -105,7 +105,7 @@ public class InternalFinallyBlockInliner extends CoveringTryCatchNodeProcessor {
|
|||||||
|
|
||||||
private int initAndGetVarIndexForNonLocalReturnValue() {
|
private int initAndGetVarIndexForNonLocalReturnValue() {
|
||||||
MaxLocalsCalculator tempCalcNode = new MaxLocalsCalculator(
|
MaxLocalsCalculator tempCalcNode = new MaxLocalsCalculator(
|
||||||
API,
|
Opcodes.API_VERSION,
|
||||||
inlineFun.access, inlineFun.desc, null
|
inlineFun.access, inlineFun.desc, null
|
||||||
);
|
);
|
||||||
inlineFun.accept(tempCalcNode);
|
inlineFun.accept(tempCalcNode);
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import org.jetbrains.kotlin.types.KotlinType
|
|||||||
import org.jetbrains.kotlin.util.OperatorNameConventions
|
import org.jetbrains.kotlin.util.OperatorNameConventions
|
||||||
import org.jetbrains.org.objectweb.asm.ClassReader
|
import org.jetbrains.org.objectweb.asm.ClassReader
|
||||||
import org.jetbrains.org.objectweb.asm.ClassVisitor
|
import org.jetbrains.org.objectweb.asm.ClassVisitor
|
||||||
|
import org.jetbrains.org.objectweb.asm.Opcodes
|
||||||
import org.jetbrains.org.objectweb.asm.Type
|
import org.jetbrains.org.objectweb.asm.Type
|
||||||
import org.jetbrains.org.objectweb.asm.commons.Method
|
import org.jetbrains.org.objectweb.asm.commons.Method
|
||||||
import org.jetbrains.org.objectweb.asm.tree.FieldInsnNode
|
import org.jetbrains.org.objectweb.asm.tree.FieldInsnNode
|
||||||
@@ -106,7 +107,7 @@ class DefaultLambda(
|
|||||||
val classReader = buildClassReaderByInternalName(sourceCompiler.state, lambdaClassType.internalName)
|
val classReader = buildClassReaderByInternalName(sourceCompiler.state, lambdaClassType.internalName)
|
||||||
var isPropertyReference = false
|
var isPropertyReference = false
|
||||||
var isFunctionReference = false
|
var isFunctionReference = false
|
||||||
classReader.accept(object : ClassVisitor(API) {
|
classReader.accept(object : ClassVisitor(Opcodes.API_VERSION) {
|
||||||
override fun visit(
|
override fun visit(
|
||||||
version: Int,
|
version: Int,
|
||||||
access: Int,
|
access: Int,
|
||||||
@@ -187,7 +188,7 @@ abstract class ExpressionLambda(protected val typeMapper: KotlinTypeMapper, isCr
|
|||||||
val jvmMethodSignature = typeMapper.mapSignatureSkipGeneric(invokeMethodDescriptor)
|
val jvmMethodSignature = typeMapper.mapSignatureSkipGeneric(invokeMethodDescriptor)
|
||||||
val asmMethod = jvmMethodSignature.asmMethod
|
val asmMethod = jvmMethodSignature.asmMethod
|
||||||
val methodNode = MethodNode(
|
val methodNode = MethodNode(
|
||||||
API, AsmUtil.getMethodAsmFlags(invokeMethodDescriptor, OwnerKind.IMPLEMENTATION, sourceCompiler.state),
|
Opcodes.API_VERSION, AsmUtil.getMethodAsmFlags(invokeMethodDescriptor, OwnerKind.IMPLEMENTATION, sourceCompiler.state),
|
||||||
asmMethod.name, asmMethod.descriptor, null, null
|
asmMethod.name, asmMethod.descriptor, null, null
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -16,19 +16,16 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.codegen.inline
|
package org.jetbrains.kotlin.codegen.inline
|
||||||
|
|
||||||
import org.jetbrains.org.objectweb.asm.AnnotationVisitor
|
import org.jetbrains.org.objectweb.asm.*
|
||||||
import org.jetbrains.org.objectweb.asm.Attribute
|
|
||||||
import org.jetbrains.org.objectweb.asm.MethodVisitor
|
|
||||||
import org.jetbrains.org.objectweb.asm.TypePath
|
|
||||||
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
|
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
|
||||||
|
|
||||||
open class SkipMaxAndEndVisitor(mv: MethodVisitor) : InstructionAdapter(API, mv) {
|
open class SkipMaxAndEndVisitor(mv: MethodVisitor) : InstructionAdapter(Opcodes.API_VERSION, mv) {
|
||||||
override fun visitMaxs(maxStack: Int, maxLocals: Int) {}
|
override fun visitMaxs(maxStack: Int, maxLocals: Int) {}
|
||||||
|
|
||||||
override fun visitEnd() {}
|
override fun visitEnd() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
open class MethodBodyVisitor(mv: MethodVisitor) : MethodVisitor(API, mv) {
|
open class MethodBodyVisitor(mv: MethodVisitor) : MethodVisitor(Opcodes.API_VERSION, mv) {
|
||||||
|
|
||||||
@Suppress("NOTHING_TO_OVERRIDE")
|
@Suppress("NOTHING_TO_OVERRIDE")
|
||||||
override fun visitAnnotableParameterCount(parameterCount: Int, visible: Boolean) {
|
override fun visitAnnotableParameterCount(parameterCount: Int, visible: Boolean) {
|
||||||
|
|||||||
@@ -107,8 +107,8 @@ class MethodInliner(
|
|||||||
transformedNode.instructions.resetLabels()
|
transformedNode.instructions.resetLabels()
|
||||||
|
|
||||||
val resultNode = MethodNode(
|
val resultNode = MethodNode(
|
||||||
API, transformedNode.access, transformedNode.name, transformedNode.desc,
|
Opcodes.API_VERSION, transformedNode.access, transformedNode.name, transformedNode.desc,
|
||||||
transformedNode.signature, transformedNode.exceptions?.toTypedArray()
|
transformedNode.signature, transformedNode.exceptions?.toTypedArray()
|
||||||
)
|
)
|
||||||
|
|
||||||
val visitor = RemapVisitor(resultNode, remapper, nodeRemapper)
|
val visitor = RemapVisitor(resultNode, remapper, nodeRemapper)
|
||||||
@@ -407,7 +407,7 @@ class MethodInliner(
|
|||||||
val capturedParamsSize = parameters.capturedParametersSizeOnStack
|
val capturedParamsSize = parameters.capturedParametersSizeOnStack
|
||||||
val realParametersSize = parameters.realParametersSizeOnStack
|
val realParametersSize = parameters.realParametersSizeOnStack
|
||||||
val transformedNode = MethodNode(
|
val transformedNode = MethodNode(
|
||||||
API, node.access, node.name,
|
Opcodes.API_VERSION, node.access, node.name,
|
||||||
Type.getMethodDescriptor(Type.getReturnType(node.desc), *(Type.getArgumentTypes(node.desc) + parameters.capturedTypes)),
|
Type.getMethodDescriptor(Type.getReturnType(node.desc), *(Type.getArgumentTypes(node.desc) + parameters.capturedTypes)),
|
||||||
node.signature, node.exceptions?.toTypedArray()
|
node.signature, node.exceptions?.toTypedArray()
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ class WhenMappingTransformer(
|
|||||||
/*MAPPING File could contains mappings for several enum classes, we should filter one*/
|
/*MAPPING File could contains mappings for several enum classes, we should filter one*/
|
||||||
val methodNodes = arrayListOf<MethodNode>()
|
val methodNodes = arrayListOf<MethodNode>()
|
||||||
val fieldNode = transformationInfo.fieldNode
|
val fieldNode = transformationInfo.fieldNode
|
||||||
classReader.accept(object : ClassVisitor(API, classBuilder.visitor) {
|
classReader.accept(object : ClassVisitor(Opcodes.API_VERSION, classBuilder.visitor) {
|
||||||
override fun visit(version: Int, access: Int, name: String, signature: String?, superName: String, interfaces: Array<String>) {
|
override fun visit(version: Int, access: Int, name: String, signature: String?, superName: String, interfaces: Array<String>) {
|
||||||
classBuilder.defineClass(null, version, access, name, signature, superName, interfaces)
|
classBuilder.defineClass(null, version, access, name, signature, superName, interfaces)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ class ReifiedTypeInliner(private val parametersMapping: TypeParameterMappings?,
|
|||||||
) = rewriteNextTypeInsn(insn, Opcodes.CHECKCAST) { stubCheckcast: AbstractInsnNode ->
|
) = rewriteNextTypeInsn(insn, Opcodes.CHECKCAST) { stubCheckcast: AbstractInsnNode ->
|
||||||
if (stubCheckcast !is TypeInsnNode) return false
|
if (stubCheckcast !is TypeInsnNode) return false
|
||||||
|
|
||||||
val newMethodNode = MethodNode(API)
|
val newMethodNode = MethodNode(Opcodes.API_VERSION)
|
||||||
generateAsCast(InstructionAdapter(newMethodNode), kotlinType, asmType, safe, isReleaseCoroutines)
|
generateAsCast(InstructionAdapter(newMethodNode), kotlinType, asmType, safe, isReleaseCoroutines)
|
||||||
|
|
||||||
instructions.insert(insn, newMethodNode.instructions)
|
instructions.insert(insn, newMethodNode.instructions)
|
||||||
@@ -187,7 +187,7 @@ class ReifiedTypeInliner(private val parametersMapping: TypeParameterMappings?,
|
|||||||
) = rewriteNextTypeInsn(insn, Opcodes.INSTANCEOF) { stubInstanceOf: AbstractInsnNode ->
|
) = rewriteNextTypeInsn(insn, Opcodes.INSTANCEOF) { stubInstanceOf: AbstractInsnNode ->
|
||||||
if (stubInstanceOf !is TypeInsnNode) return false
|
if (stubInstanceOf !is TypeInsnNode) return false
|
||||||
|
|
||||||
val newMethodNode = MethodNode(API)
|
val newMethodNode = MethodNode(Opcodes.API_VERSION)
|
||||||
generateIsCheck(InstructionAdapter(newMethodNode), kotlinType, asmType, isReleaseCoroutines)
|
generateIsCheck(InstructionAdapter(newMethodNode), kotlinType, asmType, isReleaseCoroutines)
|
||||||
|
|
||||||
instructions.insert(insn, newMethodNode.instructions)
|
instructions.insert(insn, newMethodNode.instructions)
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ package org.jetbrains.kotlin.codegen.inline
|
|||||||
|
|
||||||
import org.jetbrains.org.objectweb.asm.ClassReader
|
import org.jetbrains.org.objectweb.asm.ClassReader
|
||||||
import org.jetbrains.org.objectweb.asm.ClassVisitor
|
import org.jetbrains.org.objectweb.asm.ClassVisitor
|
||||||
|
import org.jetbrains.org.objectweb.asm.Opcodes
|
||||||
|
|
||||||
class SamWrapperTransformationInfo(override val oldClassName: String, private val inliningContext: InliningContext, private val alreadyRegenerated: Boolean): TransformationInfo {
|
class SamWrapperTransformationInfo(override val oldClassName: String, private val inliningContext: InliningContext, private val alreadyRegenerated: Boolean): TransformationInfo {
|
||||||
override val nameGenerator: NameGenerator
|
override val nameGenerator: NameGenerator
|
||||||
@@ -54,7 +55,7 @@ class SamWrapperTransformer(transformationInfo: SamWrapperTransformationInfo, pr
|
|||||||
val classReader = createClassReader()
|
val classReader = createClassReader()
|
||||||
val classBuilder = createRemappingClassBuilderViaFactory(inliningContext)
|
val classBuilder = createRemappingClassBuilderViaFactory(inliningContext)
|
||||||
|
|
||||||
classReader.accept(object : ClassVisitor(API, classBuilder.visitor) {
|
classReader.accept(object : ClassVisitor(Opcodes.API_VERSION, classBuilder.visitor) {
|
||||||
override fun visit(version: Int, access: Int, name: String, signature: String?, superName: String, interfaces: Array<String>) {
|
override fun visit(version: Int, access: Int, name: String, signature: String?, superName: String, interfaces: Array<String>) {
|
||||||
classBuilder.defineClass(null, version, access, name, signature, superName, interfaces)
|
classBuilder.defineClass(null, version, access, name, signature, superName, interfaces)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -273,7 +273,7 @@ class PsiSourceCompilerForInline(private val codegen: ExpressionCodegen, overrid
|
|||||||
val inliningFunction = element as KtDeclarationWithBody?
|
val inliningFunction = element as KtDeclarationWithBody?
|
||||||
|
|
||||||
val node = MethodNode(
|
val node = MethodNode(
|
||||||
API,
|
Opcodes.API_VERSION,
|
||||||
AsmUtil.getMethodAsmFlags(callableDescriptor, context.contextKind, state) or if (callDefault) Opcodes.ACC_STATIC else 0,
|
AsmUtil.getMethodAsmFlags(callableDescriptor, context.contextKind, state) or if (callDefault) Opcodes.ACC_STATIC else 0,
|
||||||
asmMethod.name,
|
asmMethod.name,
|
||||||
asmMethod.descriptor, null, null
|
asmMethod.descriptor, null, null
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ import java.io.PrintWriter
|
|||||||
import java.io.StringWriter
|
import java.io.StringWriter
|
||||||
|
|
||||||
const val GENERATE_SMAP = true
|
const val GENERATE_SMAP = true
|
||||||
const val API = Opcodes.API_VERSION
|
|
||||||
const val NUMBERED_FUNCTION_PREFIX = "kotlin/jvm/functions/Function"
|
const val NUMBERED_FUNCTION_PREFIX = "kotlin/jvm/functions/Function"
|
||||||
const val INLINE_FUN_VAR_SUFFIX = "\$iv"
|
const val INLINE_FUN_VAR_SUFFIX = "\$iv"
|
||||||
|
|
||||||
@@ -98,7 +97,7 @@ internal fun getMethodNode(
|
|||||||
lines[0] = Integer.MAX_VALUE
|
lines[0] = Integer.MAX_VALUE
|
||||||
lines[1] = Integer.MIN_VALUE
|
lines[1] = Integer.MIN_VALUE
|
||||||
|
|
||||||
cr.accept(object : ClassVisitor(API) {
|
cr.accept(object : ClassVisitor(Opcodes.API_VERSION) {
|
||||||
|
|
||||||
override fun visitSource(source: String?, debug: String?) {
|
override fun visitSource(source: String?, debug: String?) {
|
||||||
super.visitSource(source, debug)
|
super.visitSource(source, debug)
|
||||||
@@ -114,7 +113,7 @@ internal fun getMethodNode(
|
|||||||
exceptions: Array<String>?
|
exceptions: Array<String>?
|
||||||
): MethodVisitor? {
|
): MethodVisitor? {
|
||||||
if (methodName == name && methodDescriptor == desc) {
|
if (methodName == name && methodDescriptor == desc) {
|
||||||
node = object : MethodNode(API, access, name, desc, signature, exceptions) {
|
node = object : MethodNode(Opcodes.API_VERSION, access, name, desc, signature, exceptions) {
|
||||||
override fun visitLineNumber(line: Int, start: Label) {
|
override fun visitLineNumber(line: Int, start: Label) {
|
||||||
super.visitLineNumber(line, start)
|
super.visitLineNumber(line, start)
|
||||||
lines[0] = Math.min(lines[0], line)
|
lines[0] = Math.min(lines[0], line)
|
||||||
@@ -240,7 +239,7 @@ internal fun isAnonymousClass(internalName: String) =
|
|||||||
internalName.substringAfterLast('/').substringAfterLast("$", "").isInteger()
|
internalName.substringAfterLast('/').substringAfterLast("$", "").isInteger()
|
||||||
|
|
||||||
fun wrapWithMaxLocalCalc(methodNode: MethodNode) =
|
fun wrapWithMaxLocalCalc(methodNode: MethodNode) =
|
||||||
MaxStackFrameSizeAndLocalsCalculator(API, methodNode.access, methodNode.desc, methodNode)
|
MaxStackFrameSizeAndLocalsCalculator(Opcodes.API_VERSION, methodNode.access, methodNode.desc, methodNode)
|
||||||
|
|
||||||
private fun String.isInteger(radix: Int = 10) = toIntOrNull(radix) != null
|
private fun String.isInteger(radix: Int = 10) = toIntOrNull(radix) != null
|
||||||
|
|
||||||
@@ -292,7 +291,7 @@ internal fun insertNodeBefore(from: MethodNode, to: MethodNode, beforeNode: Abst
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun createEmptyMethodNode() = MethodNode(API, 0, "fake", "()V", null, null)
|
internal fun createEmptyMethodNode() = MethodNode(Opcodes.API_VERSION, 0, "fake", "()V", null, null)
|
||||||
|
|
||||||
internal fun createFakeContinuationMethodNodeForInline(): MethodNode {
|
internal fun createFakeContinuationMethodNodeForInline(): MethodNode {
|
||||||
val methodNode = createEmptyMethodNode()
|
val methodNode = createEmptyMethodNode()
|
||||||
@@ -543,7 +542,7 @@ internal fun createSpecialEnumMethodBody(
|
|||||||
val isValueOf = "enumValueOf" == name
|
val isValueOf = "enumValueOf" == name
|
||||||
val invokeType = typeMapper.mapType(type)
|
val invokeType = typeMapper.mapType(type)
|
||||||
val desc = getSpecialEnumFunDescriptor(invokeType, isValueOf)
|
val desc = getSpecialEnumFunDescriptor(invokeType, isValueOf)
|
||||||
val node = MethodNode(API, Opcodes.ACC_STATIC, "fake", desc, null, null)
|
val node = MethodNode(Opcodes.API_VERSION, Opcodes.ACC_STATIC, "fake", desc, null, null)
|
||||||
ExpressionCodegen.putReifiedOperationMarkerIfTypeIsReifiedParameterWithoutPropagation(
|
ExpressionCodegen.putReifiedOperationMarkerIfTypeIsReifiedParameterWithoutPropagation(
|
||||||
type,
|
type,
|
||||||
ReifiedTypeInliner.OperationKind.ENUM_REIFIED,
|
ReifiedTypeInliner.OperationKind.ENUM_REIFIED,
|
||||||
|
|||||||
+2
-5
@@ -36,10 +36,7 @@ import org.jetbrains.kotlin.load.java.JvmAbi
|
|||||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin
|
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin
|
||||||
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodGenericSignature
|
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodGenericSignature
|
||||||
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature
|
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature
|
||||||
import org.jetbrains.org.objectweb.asm.AnnotationVisitor
|
import org.jetbrains.org.objectweb.asm.*
|
||||||
import org.jetbrains.org.objectweb.asm.ClassVisitor
|
|
||||||
import org.jetbrains.org.objectweb.asm.FieldVisitor
|
|
||||||
import org.jetbrains.org.objectweb.asm.MethodVisitor
|
|
||||||
import org.jetbrains.org.objectweb.asm.commons.Method
|
import org.jetbrains.org.objectweb.asm.commons.Method
|
||||||
import org.jetbrains.org.objectweb.asm.tree.MethodNode
|
import org.jetbrains.org.objectweb.asm.tree.MethodNode
|
||||||
|
|
||||||
@@ -118,7 +115,7 @@ class IrSourceCompilerForInline(
|
|||||||
val functionCodegen = object : FunctionCodegen(irFunction, fakeClassCodegen) {
|
val functionCodegen = object : FunctionCodegen(irFunction, fakeClassCodegen) {
|
||||||
override fun createMethod(flags: Int, signature: JvmMethodGenericSignature): MethodVisitor {
|
override fun createMethod(flags: Int, signature: JvmMethodGenericSignature): MethodVisitor {
|
||||||
node = MethodNode(
|
node = MethodNode(
|
||||||
API,
|
Opcodes.API_VERSION,
|
||||||
flags,
|
flags,
|
||||||
signature.asmMethod.name, signature.asmMethod.descriptor,
|
signature.asmMethod.name, signature.asmMethod.descriptor,
|
||||||
signature.genericsSignature, null
|
signature.genericsSignature, null
|
||||||
|
|||||||
+1
-2
@@ -29,7 +29,6 @@ import com.intellij.psi.search.GlobalSearchScope
|
|||||||
import com.intellij.util.containers.ConcurrentFactoryMap
|
import com.intellij.util.containers.ConcurrentFactoryMap
|
||||||
import com.sun.jdi.Location
|
import com.sun.jdi.Location
|
||||||
import com.sun.jdi.ReferenceType
|
import com.sun.jdi.ReferenceType
|
||||||
import org.jetbrains.kotlin.codegen.inline.API
|
|
||||||
import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
||||||
import org.jetbrains.kotlin.idea.debugger.evaluate.KotlinDebuggerCaches
|
import org.jetbrains.kotlin.idea.debugger.evaluate.KotlinDebuggerCaches
|
||||||
import org.jetbrains.kotlin.idea.refactoring.getLineCount
|
import org.jetbrains.kotlin.idea.refactoring.getLineCount
|
||||||
@@ -204,7 +203,7 @@ private fun findClassFileByPath(packageName: String, className: String, outputDi
|
|||||||
private fun readLineNumberTableMapping(bytes: ByteArray): Map<BytecodeMethodKey, Map<String, Set<Int>>> {
|
private fun readLineNumberTableMapping(bytes: ByteArray): Map<BytecodeMethodKey, Map<String, Set<Int>>> {
|
||||||
val lineNumberMapping = HashMap<BytecodeMethodKey, Map<String, Set<Int>>>()
|
val lineNumberMapping = HashMap<BytecodeMethodKey, Map<String, Set<Int>>>()
|
||||||
|
|
||||||
ClassReader(bytes).accept(object : ClassVisitor(API) {
|
ClassReader(bytes).accept(object : ClassVisitor(Opcodes.API_VERSION) {
|
||||||
override fun visitMethod(access: Int, name: String?, desc: String?, signature: String?, exceptions: Array<out String>?): MethodVisitor? {
|
override fun visitMethod(access: Int, name: String?, desc: String?, signature: String?, exceptions: Array<out String>?): MethodVisitor? {
|
||||||
if (name == null || desc == null) {
|
if (name == null || desc == null) {
|
||||||
return null
|
return null
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ package org.jetbrains.kotlin.idea.debugger
|
|||||||
|
|
||||||
import com.intellij.openapi.project.Project
|
import com.intellij.openapi.project.Project
|
||||||
import com.intellij.psi.search.GlobalSearchScope
|
import com.intellij.psi.search.GlobalSearchScope
|
||||||
import org.jetbrains.kotlin.codegen.inline.API
|
|
||||||
import org.jetbrains.kotlin.codegen.inline.FileMapping
|
import org.jetbrains.kotlin.codegen.inline.FileMapping
|
||||||
import org.jetbrains.kotlin.codegen.inline.SMAP
|
import org.jetbrains.kotlin.codegen.inline.SMAP
|
||||||
import org.jetbrains.kotlin.codegen.inline.SMAPParser
|
import org.jetbrains.kotlin.codegen.inline.SMAPParser
|
||||||
@@ -26,6 +25,7 @@ import org.jetbrains.kotlin.psi.KtFile
|
|||||||
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
|
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
|
||||||
import org.jetbrains.org.objectweb.asm.ClassReader
|
import org.jetbrains.org.objectweb.asm.ClassReader
|
||||||
import org.jetbrains.org.objectweb.asm.ClassVisitor
|
import org.jetbrains.org.objectweb.asm.ClassVisitor
|
||||||
|
import org.jetbrains.org.objectweb.asm.Opcodes
|
||||||
|
|
||||||
enum class SourceLineKind {
|
enum class SourceLineKind {
|
||||||
CALL_LINE,
|
CALL_LINE,
|
||||||
@@ -62,7 +62,7 @@ fun mapStacktraceLineToSource(smapData: SmapData,
|
|||||||
fun readDebugInfo(bytes: ByteArray): SmapData? {
|
fun readDebugInfo(bytes: ByteArray): SmapData? {
|
||||||
val cr = ClassReader(bytes)
|
val cr = ClassReader(bytes)
|
||||||
var debugInfo: String? = null
|
var debugInfo: String? = null
|
||||||
cr.accept(object : ClassVisitor(API) {
|
cr.accept(object : ClassVisitor(Opcodes.API_VERSION) {
|
||||||
override fun visitSource(source: String?, debug: String?) {
|
override fun visitSource(source: String?, debug: String?) {
|
||||||
debugInfo = debug
|
debugInfo = debug
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user