Will the JVM ever implement object instance variables and methods?

Suppose I have a very tight inner loop, each iteration of which accesses and modifies one accounting object that stores some simple data about the algorithm and has simple logic for managing it.

The accounting object is closed and final, and all its methods are private, final and @inline. Here is an example (in Scala syntax):

object Frobnicate {
  private class DataRemaining(val start: Int, val end: Int) {
    @inline private def nextChunk = ....
  }

  def frobnicate {
    // ...
    val bookkeeper = new DataRemaining(0, 1000)
    while( bookeeper.hasData ) {
      val data = bookkeeper.nextChunk
      // ......
    }
  }
 }

Will the JVM ever inline the entire DataRemaining object in Frobnicate.frobnicate? That is, whether it will be processed startand endas local variables and embed the following code directly in the cell frobnicate?

+3
source share
1 answer

Java , . , . , Scala .

+3

All Articles