[reportlab-users] [Jython2.5.1] issue: Invalid method Code length 656615 + patch proposal

Raphaël Valyi rvalyi at gmail.com
Wed Feb 10 08:07:23 EST 2010


Hello guys,

I should say I'm sad to see that despite I provide you that trivial patch
one year ago on that mailing list and you still did nothing for Jython,
despite even the clear failure of Unladen Swallow to save CPython (only 1.5
faster at best while using more memory; JRuby is 5x faster than CRuby, aside
from JRuby lead Charles Nutter being an awesome alien, there is no reason
why Jython couldn't offer the same advantages given a larger momentum).

So, yes Andy, I confirm your point.
Again, here is my patch http://pastie.org/818080 , this is for reportlab 2.3
or may be a beta of it (please double check with a diff against you trunk,
you could re-indent or use Meld for that). It doesn't actually matter,
please just re-apply the logic of the patch to Reportlab trunk:
I remind you the logic: because Jython will map each Python method to a Java
method and because by specification, the JVM is limited regarding to the
method size, we need Python programs to avoid methods that are too fat such
as the ones found in your fontdata.py file (a general good practice in
software engineering BTW).

So, in my patch, I just wrap some fonts initialization code into
the fill_encodings method I introduce. This does the trick and is totally
transparent for CPython usage, so please just apply it.
After that Reportlab seems to work on Jython.

Thank you if you could play it nice with Jython this time. The JVM is an
amazing piece of engineering, I think that's foolish to ignore it. Google
tried to ignore it with Unladen Swallow -> they failed.

Raphaël Valyi


On Wed, Feb 10, 2010 at 8:23 AM, Andy Robinson <andy at reportlab.com> wrote:


> On 10 February 2010 10:18, Robin Becker <robin at reportlab.com> wrote:

> >> I have found a simple fix based on information in this thread :

>

> I don't know much Java or Jython, but I THINK the guy in your thread

> is saying that

> (a) Jython creates a Java class for each module,

> (b) it creates a Java method for each function in the module,

> (c) it creates one extra Java method for all the top-level code in the

> module.

>

> All our arrays are top-level so the Java-bytecode for (c) is too big.

> So, if we broke this up into a little function for each font, which

> adds the extra info for that font to a top-level dictionary, we'd be

> OK - and still readable.

>

> Jython gurus, does that sound right?

>

> - Andy

> _______________________________________________

> reportlab-users mailing list

> reportlab-users at lists2.reportlab.com

> http://two.pairlist.net/mailman/listinfo/reportlab-users

>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20100210/1c0f47d6/attachment.htm>


More information about the reportlab-users mailing list