Question

I'm compiling a piece of Delphi code with Free Pascal with a JVM backend.

On an off chance that someone who's involved in porting Free Pascal to the JVM back-end is reading this, here's a compilation error message I'm getting:

MyFile.j:379326: JAS Error: reference from line 10039 exceed size for short.

The file is pretty big (>6000 lines), and the functions in it are, too. So there can be some resource that's getting exhausted. Can one hint me as what exactly to to simplify to get rid of this?

Was it helpful?

Solution

Tracked down the error message to the Jasmin assembler: http://www.java2s.com/Open-Source/Java/Byte-Code/Jasmin-2.4/jas/InsnOperand.java.htm

Looks like the error manifests when there's a goto command in the bytecode assembly file that points to a label that's more than 32KB away. So it seems that block size is to blame - the assembly generator in FPC assumes the byte code for a single if/loop body fits into a 64K block. I couldn't find any goto_w commands in generated assembly - guess FPC does not emit them.

The issue was fixed in Jasmin - it now replaces goto with goto_w where appropriate. Grab a copy at ftp://ftp.freepascal.org/pub/fpc/contrib/jvm/fpcjvmutilities.zip

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top