JVM minor reuse updateMaxStack in CoroutineTransformerMethodVisitor

This commit is contained in:
Dmitry Petrov
2021-08-16 13:03:51 +03:00
committed by TeamCityServer
parent 7b3d5b7863
commit bddfd086f6
@@ -83,7 +83,7 @@ class CoroutineTransformerMethodVisitor(
RedundantLocalsEliminationMethodTransformer(suspensionPoints)
.transform(containingClassInternalName, methodNode)
ChangeBoxingMethodTransformer.transform(containingClassInternalName, methodNode)
updateMaxStack(methodNode)
methodNode.updateMaxStack()
checkForSuspensionPointInsideMonitor(methodNode, suspensionPoints)
@@ -119,7 +119,7 @@ class CoroutineTransformerMethodVisitor(
}
// Actual max stack might be increased during the previous phases
updateMaxStack(methodNode)
methodNode.updateMaxStack()
UninitializedStoresProcessor(methodNode, shouldPreserveClassInitialization).run()
@@ -428,20 +428,6 @@ class CoroutineTransformerMethodVisitor(
)
}
private fun updateMaxStack(methodNode: MethodNode) {
methodNode.instructions.resetLabels()
methodNode.accept(
MaxStackFrameSizeAndLocalsCalculator(
Opcodes.API_VERSION, methodNode.access, methodNode.desc,
object : MethodVisitor(Opcodes.API_VERSION) {
override fun visitMaxs(maxStack: Int, maxLocals: Int) {
methodNode.maxStack = maxStack
}
}
)
)
}
private fun prepareMethodNodePreludeForNamedFunction(methodNode: MethodNode) {
val objectTypeForState = Type.getObjectType(classBuilderForCoroutineState.thisName)
val continuationArgumentIndex = getLastParameterIndex(methodNode.desc, methodNode.access)