Minor. Use trailing lambda syntax in FixStackMethodTransformer
This commit is contained in:
+14
-13
@@ -105,14 +105,14 @@ class FixStackMethodTransformer : MethodTransformer() {
|
|||||||
}
|
}
|
||||||
val actualStackContent = analyzer.getActualStack(gotoNode)
|
val actualStackContent = analyzer.getActualStack(gotoNode)
|
||||||
?: throw AssertionError("Jump at $gotoIndex should be alive")
|
?: throw AssertionError("Jump at $gotoIndex should be alive")
|
||||||
actions.add({ replaceMarkerWithPops(methodNode, gotoNode.previous, expectedStackSize, actualStackContent) })
|
actions.add { replaceMarkerWithPops(methodNode, gotoNode.previous, expectedStackSize, actualStackContent) }
|
||||||
}
|
}
|
||||||
else if (actualStackSize >= 0 && expectedStackSize < 0) {
|
else if (actualStackSize >= 0 && expectedStackSize < 0) {
|
||||||
throw AssertionError("Live jump $gotoIndex to dead label $labelIndex")
|
throw AssertionError("Live jump $gotoIndex to dead label $labelIndex")
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
val marker = gotoNode.previous
|
val marker = gotoNode.previous
|
||||||
actions.add({ methodNode.instructions.remove(marker) })
|
actions.add { methodNode.instructions.remove(marker) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -149,12 +149,12 @@ class FixStackMethodTransformer : MethodTransformer() {
|
|||||||
val savedStackValues = analyzer.getStackToSpill(marker)
|
val savedStackValues = analyzer.getStackToSpill(marker)
|
||||||
if (savedStackValues != null) {
|
if (savedStackValues != null) {
|
||||||
val savedStackDescriptor = localVariablesManager.allocateVariablesForSaveStackMarker(marker, savedStackValues)
|
val savedStackDescriptor = localVariablesManager.allocateVariablesForSaveStackMarker(marker, savedStackValues)
|
||||||
actions.add({ saveStack(methodNode, marker, savedStackDescriptor, false) })
|
actions.add { saveStack(methodNode, marker, savedStackDescriptor, false) }
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// marker is dead code
|
// marker is dead code
|
||||||
localVariablesManager.allocateVariablesForSaveStackMarker(marker, emptyList())
|
localVariablesManager.allocateVariablesForSaveStackMarker(marker, emptyList())
|
||||||
actions.add({ methodNode.instructions.remove(marker) })
|
actions.add { methodNode.instructions.remove(marker) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -165,7 +165,7 @@ class FixStackMethodTransformer : MethodTransformer() {
|
|||||||
localVariablesManager: LocalVariablesManager
|
localVariablesManager: LocalVariablesManager
|
||||||
) {
|
) {
|
||||||
val savedStackDescriptor = localVariablesManager.getSavedStackDescriptor(marker)
|
val savedStackDescriptor = localVariablesManager.getSavedStackDescriptor(marker)
|
||||||
actions.add({ restoreStack(methodNode, marker, savedStackDescriptor) })
|
actions.add { restoreStack(methodNode, marker, savedStackDescriptor) }
|
||||||
localVariablesManager.markRestoreStackMarkerEmitted(marker)
|
localVariablesManager.markRestoreStackMarkerEmitted(marker)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,20 +183,21 @@ class FixStackMethodTransformer : MethodTransformer() {
|
|||||||
1 -> {
|
1 -> {
|
||||||
val returnValue = stackContentAfterInline.last()
|
val returnValue = stackContentAfterInline.last()
|
||||||
val returnValueLocalVarIndex = localVariablesManager.createReturnValueVariable(returnValue)
|
val returnValueLocalVarIndex = localVariablesManager.createReturnValueVariable(returnValue)
|
||||||
actions.add({
|
actions.add {
|
||||||
restoreStackWithReturnValue(methodNode, inlineMarker, savedStackDescriptor,
|
restoreStackWithReturnValue(methodNode, inlineMarker, savedStackDescriptor,
|
||||||
returnValue, returnValueLocalVarIndex)
|
returnValue, returnValueLocalVarIndex
|
||||||
})
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
0 ->
|
0 ->
|
||||||
actions.add({ restoreStack(methodNode, inlineMarker, savedStackDescriptor) })
|
actions.add { restoreStack(methodNode, inlineMarker, savedStackDescriptor) }
|
||||||
else ->
|
else ->
|
||||||
throw AssertionError("Inline method should not leave more than 1 value on stack")
|
throw AssertionError("Inline method should not leave more than 1 value on stack")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// after inline marker is dead code
|
// after inline marker is dead code
|
||||||
actions.add({ methodNode.instructions.remove(inlineMarker) })
|
actions.add { methodNode.instructions.remove(inlineMarker) }
|
||||||
}
|
}
|
||||||
localVariablesManager.markAfterInlineMarkerEmitted(inlineMarker)
|
localVariablesManager.markAfterInlineMarkerEmitted(inlineMarker)
|
||||||
}
|
}
|
||||||
@@ -211,12 +212,12 @@ class FixStackMethodTransformer : MethodTransformer() {
|
|||||||
val savedStackValues = analyzer.getStackToSpill(inlineMarker)
|
val savedStackValues = analyzer.getStackToSpill(inlineMarker)
|
||||||
if (savedStackValues != null) {
|
if (savedStackValues != null) {
|
||||||
val savedStackDescriptor = localVariablesManager.allocateVariablesForBeforeInlineMarker(inlineMarker, savedStackValues)
|
val savedStackDescriptor = localVariablesManager.allocateVariablesForBeforeInlineMarker(inlineMarker, savedStackValues)
|
||||||
actions.add({ saveStack(methodNode, inlineMarker, savedStackDescriptor, false) })
|
actions.add { saveStack(methodNode, inlineMarker, savedStackDescriptor, false) }
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// before inline marker is dead code
|
// before inline marker is dead code
|
||||||
localVariablesManager.allocateVariablesForBeforeInlineMarker(inlineMarker, emptyList())
|
localVariablesManager.allocateVariablesForBeforeInlineMarker(inlineMarker, emptyList())
|
||||||
actions.add({ methodNode.instructions.remove(inlineMarker) })
|
actions.add { methodNode.instructions.remove(inlineMarker) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user