Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to circumvent the "Method too large" error in Java Compilation?

Tags:

java

bigloo

I have a parser written in bigloo scheme functional language which I need to compile into a java class. The whole of the parser is written as a single function. Unfortunately this is causing the JVM compiler to throw a "Method too large" warning and later give "far label in localvar" error. Is there any possible way where I can circumvent this error? I read somewhere about a DontCompileHugeMethods option, does it work? Splitting the function doesnt seem to be a viable option to me :( !!

like image 695
Aditya Avatar asked Oct 25 '22 11:10

Aditya


1 Answers

Is there any possible way where I can circumvent this error?

Well, the root cause of this compiler error is that there are hard limits in the format of bytecode files. In this case, the problem is that a single method can consist of at most 65536 bytes of bytecodes. (See the JVM spec).

The only workaround is to split the method.

like image 119
Stephen C Avatar answered Nov 15 '22 05:11

Stephen C