문제

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?

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top