From: jefftc at leland.Stanford.EDU (Jeffrey Chang)
Date: Tue, 27 Apr 1999 14:54:03 -0700
Subject: JPython 64K limit on source-code size?
In-Reply-To: <7g4mgd$uo7$1@nnrp1.dejanews.com>
References: <7g4mgd$uo7$1@nnrp1.dejanews.com>
Message-ID: <Pine.GSO.3.96.990427143251.9096A-100000@saga15.Stanford.EDU>
Content-Length: 1206
X-UID: 51                                                  

[Monty]
> I have a JPython program I'm using as a test suite.  It's generated code and
> around 74K long.  When I try to run it with JPython I get this message:
> 
> Traceback (innermost last):
>   (no code object) at line 0
> java.lang.ClassFormatError: org/python/pycode/_pyx0 (Code of a method longer
> than 65535 bytes)

[...]

> If this 64K ceiling is indeed a basic limitation of JPython because of Java,
> I'm wondering if there is an easy way to split the file into pieces in a
> chain-like fashion.  Any ideas?

Yep, this is a java thingy.  From the stack trace, it looks like you have
a method that is >64K long.  According to Sun's JVM specification, the
maximum code allowed for any individual method is 65536 bytes:
http://www.javasoft.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#88659

That limit includes any code that it may have generated to initialize
variables that you declared.  For example, initializing a large array of
strings as a class or instance variable could get you up to that limit, if
you're not careful.

It doesn't look like you will need to split up your file, but you will
need to either split up your method or load your variables at run time.

Jeff





