JVM option XX:UseFastEmptyMethods/XX:UseFastAccessorMethods
Asked Answered
G

1

8

While looking at possible JVM flags for optimizing launching startup time of my RCP product, I found these attractively-named -XX:UseFastEmptyMethods and -XX:UseFastAccessorMethods.

It seems that those flags were available on JDK-6 (and on by default), while they were defaulted to off on JDK-7. Also, I read that the trade-off for this optimization is that they do not increase method invocation counters.

What is the impact of not using invocation counters? Does that affect garbage collection?

Glogau answered 14/3, 2013 at 4:45 Comment(1)
im guessing it wont affect GC but might affect JIT since those counters are used to determine "hot" code paths for optimizationWillin
R
9

It is for getting the invocation count of methods correctly so that the VM can identify the hotspots in your code better.

Following the discussion from here

If you're on JDK6, you may need to include these two VM flags in your target Java application:
-XX:-UseFastEmptyMethods -XX:-UseFastAccessorMethods

Otherwise empty methods and accessor methods will not show up in the list, because the "fast" version doesn't increment the invocation counter for these methods. In JDK7 these two flags default to false, so you don't have to bother setting them to false explicitly.


See Also :

UseFastEmptyMethods/UseFastAccessorMethods considered harmful

Rimbaud answered 14/3, 2013 at 5:1 Comment(1)
+1 thanks. While the first part of the answer is a bit unrelated (I am asking why and what consequences for turning the flags on), the second link is useful. Still I'd learn in what circumstances turning those flag on is to be considered safe.Glogau

© 2022 - 2024 — McMap. All rights reserved.