问题
I was wondering if there is a method maximum size for JIT C2 to compile it. Let's assume there is a method which just maps one class to another, but this class contains a lot of fields. It became hot, C1 optimizes it but at some point C2 will kick in. If byte code is long enough, will C2 ignore that method and do not compile it? I couldn't find any answer for my question. Maybe there is not such a thing?
回答1:
There are a number of JIT compiler limits.
One of them is HugeMethodLimit
equal to 8000 and not tunable in product JVM builds. The methods with more than 8000 bytes of bytecode will not be compiled, neither by C2 nor by C1. This limit can be turned off with -XX:-DontCompileHugeMethods
.
C2 can also cease compilation of smaller methods, if the total number of IR nodes (not bytes of bytecode) reaches 80000. This limit can be tuned with -XX:MaxNodeLimit
(C2-specific option).
There many other thresholds (see 1, 2) that affect inlining and certain JIT optimizations.
来源:https://stackoverflow.com/questions/57005557/jit-c2-method-maximum-size