Knut Anders Hatlen wrote:
They use a pattern of first copying the instance variables into local variables, then do the work on the local variables, and finally write back to the instance variables. While I find that a little confusing because I would expect the run-time compiler to be able to perform that kind of optimization itself, that's a different issue from what is discussed in this thread.
Can the run-time optimizer/compiler perform such an optimization when the instance variable is not final? I would have thought not. You also have to remember that most of the store code was written in the early days of java, before JITs existed, thus such optimizations would not occur.
Dan.
