Reputation: 10710
I recently read on Jon Masamitsu's Weblog that huge methods (8000 bytes of bytecode) are not JIT compiled with HotSpot.
So my question is: how do I find out (as a programmer) how many bytes of bytecode a particular method has?
The JIT compiler of course seems to know. Can I extract this piece of information from the .class
file?
Upvotes: 4
Views: 1994
Reputation: 533492
You can use javap -c mypackage.MyClass
to dump the bytecode of your class (and see the size of each method)
Generally speaking, you should know that a method is too large to read and understand before you hit this limit. IMHO its more a problem for generated code. BTW There is a hard limit of 65536 bytes in a method.
Upvotes: 7