Reuse some available variables in JVM backend
This commit is contained in:
@@ -56,9 +56,9 @@ const val NUMBERED_FUNCTION_PREFIX = "kotlin/jvm/functions/Function"
|
|||||||
const val INLINE_FUN_VAR_SUFFIX = "\$iv"
|
const val INLINE_FUN_VAR_SUFFIX = "\$iv"
|
||||||
|
|
||||||
internal const val FIRST_FUN_LABEL = "$$$$\$ROOT$$$$$"
|
internal const val FIRST_FUN_LABEL = "$$$$\$ROOT$$$$$"
|
||||||
internal const val SPECIAL_TRANSFORMATION_NAME = "\$special"
|
const val SPECIAL_TRANSFORMATION_NAME = "\$special"
|
||||||
const val INLINE_TRANSFORMATION_SUFFIX = "\$inlined"
|
const val INLINE_TRANSFORMATION_SUFFIX = "\$inlined"
|
||||||
internal const val INLINE_CALL_TRANSFORMATION_SUFFIX = "$$INLINE_TRANSFORMATION_SUFFIX"
|
const val INLINE_CALL_TRANSFORMATION_SUFFIX = "$$INLINE_TRANSFORMATION_SUFFIX"
|
||||||
internal const val INLINE_FUN_THIS_0_SUFFIX = "\$inline_fun"
|
internal const val INLINE_FUN_THIS_0_SUFFIX = "\$inline_fun"
|
||||||
internal const val DEFAULT_LAMBDA_FAKE_CALL = "$$\$DEFAULT_LAMBDA_FAKE_CALL$$$"
|
internal const val DEFAULT_LAMBDA_FAKE_CALL = "$$\$DEFAULT_LAMBDA_FAKE_CALL$$$"
|
||||||
internal const val CAPTURED_FIELD_FOLD_PREFIX = "$$$"
|
internal const val CAPTURED_FIELD_FOLD_PREFIX = "$$$"
|
||||||
|
|||||||
+2
-2
@@ -131,9 +131,9 @@ class ClassCodegen private constructor(
|
|||||||
private val regeneratedObjectNameGenerators = mutableMapOf<String, NameGenerator>()
|
private val regeneratedObjectNameGenerators = mutableMapOf<String, NameGenerator>()
|
||||||
|
|
||||||
fun getRegeneratedObjectNameGenerator(function: IrFunction): NameGenerator {
|
fun getRegeneratedObjectNameGenerator(function: IrFunction): NameGenerator {
|
||||||
val name = if (function.name.isSpecial) "special" else function.name.asString()
|
val name = if (function.name.isSpecial) SPECIAL_TRANSFORMATION_NAME else "\$${function.name.asString()}"
|
||||||
return regeneratedObjectNameGenerators.getOrPut(name) {
|
return regeneratedObjectNameGenerators.getOrPut(name) {
|
||||||
NameGenerator("${type.internalName}\$$name\$\$inlined")
|
NameGenerator("${type.internalName}$name$INLINE_CALL_TRANSFORMATION_SUFFIX")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1359,7 +1359,7 @@ class ExpressionCodegen(
|
|||||||
val clauseStart = markNewLabel()
|
val clauseStart = markNewLabel()
|
||||||
val parameter = clause.catchParameter
|
val parameter = clause.catchParameter
|
||||||
val descriptorType = parameter.asmType
|
val descriptorType = parameter.asmType
|
||||||
val index = frameMap.enter(clause.catchParameter, descriptorType)
|
val index = frameMap.enter(parameter, descriptorType)
|
||||||
clause.markLineNumber(true)
|
clause.markLineNumber(true)
|
||||||
mv.store(index, descriptorType)
|
mv.store(index, descriptorType)
|
||||||
val afterStore = markNewLabel()
|
val afterStore = markNewLabel()
|
||||||
|
|||||||
+1
-1
@@ -98,7 +98,7 @@ class IrSourceCompilerForInline(
|
|||||||
override fun generateFinallyBlocks(finallyNode: MethodNode, curFinallyDepth: Int, returnType: Type, afterReturnLabel: Label, target: Label?) {
|
override fun generateFinallyBlocks(finallyNode: MethodNode, curFinallyDepth: Int, returnType: Type, afterReturnLabel: Label, target: Label?) {
|
||||||
ExpressionCodegen(
|
ExpressionCodegen(
|
||||||
codegen.irFunction, codegen.signature, codegen.frameMap, InstructionAdapter(finallyNode), codegen.classCodegen,
|
codegen.irFunction, codegen.signature, codegen.frameMap, InstructionAdapter(finallyNode), codegen.classCodegen,
|
||||||
codegen.smap, codegen.reifiedTypeParametersUsages
|
sourceMapper, codegen.reifiedTypeParametersUsages
|
||||||
).also {
|
).also {
|
||||||
it.finallyDepth = curFinallyDepth
|
it.finallyDepth = curFinallyDepth
|
||||||
}.generateFinallyBlocksIfNeeded(returnType, afterReturnLabel, data, target)
|
}.generateFinallyBlocksIfNeeded(returnType, afterReturnLabel, data, target)
|
||||||
|
|||||||
Reference in New Issue
Block a user