From 4e7c4c397651dd3272dfce6c6dac1825a66f4751 Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Fri, 22 Sep 2017 14:40:28 +0300 Subject: [PATCH] Minor: inline single use of 'analyzeMethodNodeBeforeInline' --- .../kotlin/codegen/inline/MethodInliner.kt | 26 ++++++++----------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/MethodInliner.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/MethodInliner.kt index 40c24f14e20..bb9d73c2219 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/MethodInliner.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/MethodInliner.kt @@ -394,9 +394,9 @@ class MethodInliner( ): MethodNode { val processingNode = prepareNode(node, finallyDeepShift) - normalizeLocalReturns(processingNode, labelOwner) + normalizeNodeBeforeInline(processingNode, labelOwner) - val sources = analyzeMethodNodeWithoutMandatoryTransformations(processingNode) + val sources = analyzeMethodNodeBeforeInline(processingNode) val toDelete = SmartSet.create() val instructions = processingNode.instructions @@ -508,7 +508,14 @@ class MethodInliner( return processingNode } - private fun normalizeLocalReturns(node: MethodNode, labelOwner: LabelOwner) { + private fun normalizeNodeBeforeInline(node: MethodNode, labelOwner: LabelOwner) { + try { + FixStackWithLabelNormalizationMethodTransformer().transform("fake", node) + } + catch (e: Throwable) { + throw wrapException(e, node, "couldn't inline method call") + } + val frames = analyzeMethodNodeBeforeInline(node) val localReturnsNormalizer = LocalReturnsNormalizer() @@ -540,17 +547,6 @@ class MethodInliner( return info != null && info.shouldRegenerate(true) } - private fun analyzeMethodNodeBeforeInline(node: MethodNode): Array?> { - try { - FixStackWithLabelNormalizationMethodTransformer().transform("fake", node) - } - catch (e: Throwable) { - throw wrapException(e, node, "couldn't inline method call") - } - - return analyzeMethodNodeWithoutMandatoryTransformations(node) - } - private fun buildConstructorInvocation( anonymousType: String, desc: String, @@ -729,7 +725,7 @@ class MethodInliner( ) } - private fun analyzeMethodNodeWithoutMandatoryTransformations(node: MethodNode): Array?> { + private fun analyzeMethodNodeBeforeInline(node: MethodNode): Array?> { val analyzer = object : Analyzer(SourceInterpreter()) { override fun newFrame(nLocals: Int, nStack: Int): Frame { return object : Frame(nLocals, nStack) {