After ClassBodyEvaluator.cook(), is there a way to dump out the java bytecode into a .class file? I see issue https://github.com/janino-compiler/janino/issues/19 and the test file show a way to dump the bytecode into a byte[], which looks like a good start. I was wondering if there's an easy way to dump out into a file?
Some context: I have some auto generated methods, whose java bytecode size could be more than 8000 bytes. Since the JVM has the default HugeMethodLimit 8000, it will not JIT these large methods. I was thinking of letting ClassBodyEvaluator dump out the .class file, then using other tools such as proguard/soot to optimize the bytecode to get a smaller .class file. After that, let the classloader to load the new smaller .class file. So dumping out the java bytecode seems the first step. Any suggestion is appreciated.
Hi,
After ClassBodyEvaluator.cook(), is there a way to dump out the java bytecode into a .class file? I see issue https://github.com/janino-compiler/janino/issues/19 and the test file show a way to dump the bytecode into a
byte[]
, which looks like a good start. I was wondering if there's an easy way to dump out into a file?Some context: I have some auto generated methods, whose java bytecode size could be more than 8000 bytes. Since the JVM has the default HugeMethodLimit 8000, it will not JIT these large methods. I was thinking of letting ClassBodyEvaluator dump out the .class file, then using other tools such as proguard/soot to optimize the bytecode to get a smaller .class file. After that, let the classloader to load the new smaller .class file. So dumping out the java bytecode seems the first step. Any suggestion is appreciated.