Fix complexity formula for SourceInterpreter

It is actually N^2 * F (VERY pessimistic case),
N = number of instructions
F = frame size
because frames contain sets of instructions.
This commit is contained in:
Dmitry Petrov
2017-06-22 10:16:36 +03:00
parent a84c2a6f31
commit f1183d98a9
@@ -67,7 +67,8 @@ class OptimizationMethodVisitor(
fun canBeOptimizedUsingSourceInterpreter(node: MethodNode): Boolean {
val frameSize = node.maxLocals + node.maxStack
val totalFramesSizeMb = node.instructions.size().toLong() * frameSize * frameSize / (1024 * 1024)
val methodSize = node.instructions.size().toLong()
val totalFramesSizeMb = methodSize * methodSize * frameSize / (1024 * 1024)
return totalFramesSizeMb < MEMORY_LIMIT_BY_METHOD_MB
}
}