JVM IR: do not use AsmUtil.putJavaLangClassInstance
To get rid of the last external usage of IrTypeMapper.kotlinTypeMapper
This commit is contained in:
+6
-1
@@ -941,7 +941,12 @@ class ExpressionCodegen(
|
|||||||
putReifiedOperationMarkerIfTypeIsReifiedParameter(classType, ReifiedTypeInliner.OperationKind.JAVA_CLASS, mv, this)
|
putReifiedOperationMarkerIfTypeIsReifiedParameter(classType, ReifiedTypeInliner.OperationKind.JAVA_CLASS, mv, this)
|
||||||
}
|
}
|
||||||
|
|
||||||
putJavaLangClassInstance(mv, typeMapper.mapType(classType), classType.toKotlinType(), typeMapper.kotlinTypeMapper)
|
val asmType = typeMapper.mapType(classType)
|
||||||
|
if (classType.getClass()?.isInline == true || !isPrimitive(asmType)) {
|
||||||
|
mv.aconst(typeMapper.boxType(classType))
|
||||||
|
} else {
|
||||||
|
mv.getstatic(boxType(asmType).internalName, "TYPE", "Ljava/lang/Class;")
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
throw AssertionError("not an IrGetClass or IrClassReference: ${classReference.dump()}")
|
throw AssertionError("not an IrGetClass or IrClassReference: ${classReference.dump()}")
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-3
@@ -10,7 +10,6 @@ import org.jetbrains.kotlin.builtins.functions.FunctionClassDescriptor
|
|||||||
import org.jetbrains.kotlin.builtins.isSuspendFunctionType
|
import org.jetbrains.kotlin.builtins.isSuspendFunctionType
|
||||||
import org.jetbrains.kotlin.builtins.transformSuspendFunctionToRuntimeFunctionType
|
import org.jetbrains.kotlin.builtins.transformSuspendFunctionToRuntimeFunctionType
|
||||||
import org.jetbrains.kotlin.codegen.AsmUtil
|
import org.jetbrains.kotlin.codegen.AsmUtil
|
||||||
import org.jetbrains.kotlin.codegen.ClassBuilderMode
|
|
||||||
import org.jetbrains.kotlin.codegen.JvmCodegenUtil
|
import org.jetbrains.kotlin.codegen.JvmCodegenUtil
|
||||||
import org.jetbrains.kotlin.codegen.signature.AsmTypeFactory
|
import org.jetbrains.kotlin.codegen.signature.AsmTypeFactory
|
||||||
import org.jetbrains.kotlin.codegen.signature.JvmSignatureWriter
|
import org.jetbrains.kotlin.codegen.signature.JvmSignatureWriter
|
||||||
@@ -32,7 +31,6 @@ import org.jetbrains.kotlin.types.Variance
|
|||||||
import org.jetbrains.org.objectweb.asm.Type
|
import org.jetbrains.org.objectweb.asm.Type
|
||||||
|
|
||||||
class IrTypeMapper(private val context: JvmBackendContext) {
|
class IrTypeMapper(private val context: JvmBackendContext) {
|
||||||
val kotlinTypeMapper: KotlinTypeMapper = context.state.typeMapper
|
|
||||||
private val typeSystem = IrTypeCheckerContext(context.irBuiltIns)
|
private val typeSystem = IrTypeCheckerContext(context.irBuiltIns)
|
||||||
|
|
||||||
fun classInternalName(irClass: IrClass): String =
|
fun classInternalName(irClass: IrClass): String =
|
||||||
@@ -71,7 +69,7 @@ class IrTypeMapper(private val context: JvmBackendContext) {
|
|||||||
|
|
||||||
// TODO: rewrite this part to produce the correct Type without the fake descriptor
|
// TODO: rewrite this part to produce the correct Type without the fake descriptor
|
||||||
if (type.toKotlinType().isSuspendFunctionType) {
|
if (type.toKotlinType().isSuspendFunctionType) {
|
||||||
return kotlinTypeMapper.mapType(
|
return context.state.typeMapper.mapType(
|
||||||
transformSuspendFunctionToRuntimeFunctionType(type.toKotlinType(), isReleaseCoroutines = true), sw, mode
|
transformSuspendFunctionToRuntimeFunctionType(type.toKotlinType(), isReleaseCoroutines = true), sw, mode
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -27,7 +27,7 @@ import org.jetbrains.org.objectweb.asm.commons.Method
|
|||||||
|
|
||||||
class MethodSignatureMapper(context: JvmBackendContext) {
|
class MethodSignatureMapper(context: JvmBackendContext) {
|
||||||
private val typeMapper: IrTypeMapper = context.typeMapper
|
private val typeMapper: IrTypeMapper = context.typeMapper
|
||||||
private val kotlinTypeMapper: KotlinTypeMapper = typeMapper.kotlinTypeMapper
|
private val kotlinTypeMapper: KotlinTypeMapper = context.state.typeMapper
|
||||||
|
|
||||||
fun mapAsmMethod(irFunction: IrFunction): Method =
|
fun mapAsmMethod(irFunction: IrFunction): Method =
|
||||||
kotlinTypeMapper.mapAsmMethod(irFunction.descriptor)
|
kotlinTypeMapper.mapAsmMethod(irFunction.descriptor)
|
||||||
|
|||||||
Reference in New Issue
Block a user