JVM don't optimize out starting ASTORE of TCB handler
This commit is contained in:
committed by
TeamCityServer
parent
dcbc2ea2b3
commit
7e943ab757
+8
@@ -64,6 +64,14 @@ class TemporaryValsAnalyzer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Some coroutine transformations require exception handler to start from an ASTORE instruction.
|
||||||
|
for (tcb in methodNode.tryCatchBlocks) {
|
||||||
|
val handlerFirstInsn = tcb.handler.next ?: continue
|
||||||
|
if (handlerFirstInsn.opcode == Opcodes.ASTORE) {
|
||||||
|
potentiallyTemporaryStores.remove(handlerFirstInsn)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If the method is big, and we couldn't eliminate enough temporary variable store candidates,
|
// If the method is big, and we couldn't eliminate enough temporary variable store candidates,
|
||||||
// bail out, treat all variables as non-temporary.
|
// bail out, treat all variables as non-temporary.
|
||||||
// Here we estimate memory required to store all relevant information as O(N * M * K),
|
// Here we estimate memory required to store all relevant information as O(N * M * K),
|
||||||
|
|||||||
+3
-1
@@ -43,6 +43,8 @@ fun box(): String {
|
|||||||
|
|
||||||
// 1 LOCALVARIABLE i Ljava/lang/String; L.* 3
|
// 1 LOCALVARIABLE i Ljava/lang/String; L.* 3
|
||||||
// 1 PUTFIELD VarValueConflictsWithTableSameSortKt\$box\$1.L\$0 : Ljava/lang/Object;
|
// 1 PUTFIELD VarValueConflictsWithTableSameSortKt\$box\$1.L\$0 : Ljava/lang/Object;
|
||||||
|
/* 1 load in the catch (e: Throwable) { throw e } block which is implicitly wrapped around try/finally */
|
||||||
|
// 1 ALOAD 3\s+ATHROW
|
||||||
/* 1 load in result = s */
|
/* 1 load in result = s */
|
||||||
// 1 ALOAD 3\s+PUTFIELD kotlin/jvm/internal/Ref\$ObjectRef\.element
|
// 1 ALOAD 3\s+PUTFIELD kotlin/jvm/internal/Ref\$ObjectRef\.element
|
||||||
/* 1 load in spill */
|
/* 1 load in spill */
|
||||||
@@ -50,7 +52,7 @@ fun box(): String {
|
|||||||
/* 2 loads in println(s) */
|
/* 2 loads in println(s) */
|
||||||
// 2 ALOAD 3\s+INVOKEVIRTUAL java/io/PrintStream.println \(Ljava/lang/Object;\)V
|
// 2 ALOAD 3\s+INVOKEVIRTUAL java/io/PrintStream.println \(Ljava/lang/Object;\)V
|
||||||
/* But no further load when spilling 's' to the continuation */
|
/* But no further load when spilling 's' to the continuation */
|
||||||
// 4 ALOAD 3
|
// 5 ALOAD 3
|
||||||
|
|
||||||
// We merge LVT records for two consequent branches, but we split the local over the restore code.
|
// We merge LVT records for two consequent branches, but we split the local over the restore code.
|
||||||
// JVM_IR_TEMPLATES
|
// JVM_IR_TEMPLATES
|
||||||
|
|||||||
Reference in New Issue
Block a user