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:
+2
-1
@@ -67,7 +67,8 @@ class OptimizationMethodVisitor(
|
|||||||
|
|
||||||
fun canBeOptimizedUsingSourceInterpreter(node: MethodNode): Boolean {
|
fun canBeOptimizedUsingSourceInterpreter(node: MethodNode): Boolean {
|
||||||
val frameSize = node.maxLocals + node.maxStack
|
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
|
return totalFramesSizeMb < MEMORY_LIMIT_BY_METHOD_MB
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user