How many bytes of bytecode has a particular method in Java?

后端 未结 1 1150
谎友^
谎友^ 2021-01-03 09:08

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 p

相关标签:
1条回答
  • 2021-01-03 09:55

    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.

    0 讨论(0)
提交回复
热议问题