Java Reference
In-Depth Information
41418 87 % 4 net.sdo.StockPriceHistoryImpl::<init> @ 48 (156 bytes)
41434 84 % 3 net.sdo.StockPriceHistoryImpl::<init> @ -2 (156 bytes)
made not entrant
41458 3749 4 net.sdo.StockPriceHistoryImpl::<init> (156 bytes)
41469 3697 3 net.sdo.StockPriceHistoryImpl::<init> (156 bytes)
made not entrant
42772 3697 3 net.sdo.StockPriceHistoryImpl::<init> (156 bytes)
made zombie
42861 84 % 3 net.sdo.StockPriceHistoryImpl::<init> @ -2 (156 bytes)
made zombie
Here, the constructor is first OSR-compiled at level 3, and then fully compiled also at level
3. A second later, the OSR code becomes eligible for level 4 compilation, so it is compiled at
level 4 and the level 3 OSR code is made not entrant. The same process then occurs for the
standard compilation, and then finally the level 3 code becomes a zombie.
Deoptimizing Zombie Code
When the compilation log reports that it has made zombie code, it is saying that it has re-
claimed some previous code that was made not entrant. In the last example, after a test was
run with the StockPriceHistoryLogger implementation, the code for the StockPriceHis-
toryImpl class was made not entrant. But there were still objects of the StockPriceHis-
toryImpl class around. Eventually all those objects were reclaimed by GC. When that
happened, the compiler noticed that the methods of that class were now eligible to be marked
as zombie code.
For performance, this is a good thing. Recall that the compiled code is held in a fixed-size
code cache; when zombie methods are identified, it means that the code in question can be
removed from the code cache, making room for other classes to be compiled (or limiting the
amount of memory the JVM will need to allocate later).
The possible downside here is that if the code for the class is made zombie and then later re-
loaded and heavily used again, the JVM will need to recompile and reoptimize the code.
Still, that's exactly what happened in the scenario described above where the test was run
without logging, then with logging, and then without logging; performance in that case was
not noticeably affected. In general, the small recompilations that occur when zombie code is
recompiled will not have a measurable effect on most applications.
Search WWH ::




Custom Search