SexScripts : Method code too large?! - https://ss.deviatenow.com:443/viewtopic.php?f=4&t=313 Page 1 of 1

Method code too large?!

Banjo [ Sun Apr 21, 2013 7:46 am ]

After fixing other bugs, I suddenly get this error:

Code:
Error org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
General error during class generation: Method code too large!
   at org.objectweb.asm.MethodWriter.a(Unknown Source)
   at org.objectweb.asm.ClassWriter.toByteArray(Unknown Source)
   at org.codehaus.groovy.control.CompilationUnit$14.call(CompilationUnit.java:788)
   at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1027)
   at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:564)
   at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:542)
   at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:519)
   at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:279)
   at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:258)
   at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:244)
   at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:202)
   at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:212)
   at ss.EditorFrame.threadedTest(EditorFrame.java:878)
   at ss.EditorFrame.access$22(EditorFrame.java:870)
   at ss.EditorFrame$32.run(EditorFrame.java:849)
1 error


... but since it doesn't tell me where the error originates, I have no idea how to fix it (or even if this is a program glitch, not a script one). Surely it doesn't mean the SCRIPT FILE is too large, does it? It's only 102kb! If that's SexScripts' (or Groovy's) hardcoded size limit for scripts, that's a MAJOR problem that needs solving.

However, I tried a previous version of the script (96kb) and it ran fine. So I whittled my new version down to 94kb... same error! Leading me to think that it can't be a file size issue, since the larger (old) version runs and the newer one doesn't.... meaning an error in my additions to the script! But how do I find the error with no further information?

I tried splitting the script into three files, in case it WAS a size problem... but of course then the script doesn't work because values aren't carried across from one script to the other (right?)... and with more than 45 of them needing to be set at the start of the script, that's a LOT to try and convert and store in data.properties before each segment loads!!!

Re: Method code too large?!

doti [ Sun Apr 21, 2013 8:59 am ]

You'll find a solution here : http://ss.deviatenow.com/viewtopic.php?p=1077#p1077

Summary : go from
Code:
setInfo(...)
//long code 1
//long code 2

to :
Code:
setInfo(...)
def longcode1 = {
//long code 1
}
longcode1()

def longcode2 = {
//long code 2
}
longcode2()

Re: Method code too large?!

Banjo [ Sun Apr 21, 2013 9:06 am ]

doti wrote:
Ok I could replicate the error. :)
And I do not see any solution (apart splitting the script in multiple ones). :(


Wow, really? That's a MAJOR issue, then. Not being able to write scripts longer than 100kb, combined with no easy way to "jump around" (CyberMistress style) within a script, makes writing for SexScripts a real pain for anything other than short scripts. Can this not be fixed? Is it a groovy bug?

I noticed a very complicated method in that other thread of splitting files internally, but I doubt most users will want to go to all that effort to work around the bug. it's going to turn people off scripting, IMO, it it takes too much work fiddling with code rather than the "fun part" of actually writing.

EDIT:
doti wrote:
You'll find a solution here : http://ss.deviatenow.com/viewtopic.php?p=1077#p1077

Summary : go from
Code:
setInfo(...)

to :
def longcode1 = {
//long code 1
}
longcode1()

def longcode2 = {
//long code 2
}

So... does that mean simply randomly choosing sequential "blocks" of a script and dividing it up with "longcode" curly brackets? Does that fix the error? And are values carried across between "longcode" sections? How "big" should each "longcode" section be (line-wise)?

Re: Method code too large?!

doti [ Sun Apr 21, 2013 9:13 am ]

Yes, it is enough. Avoid cutting blocks themselves, for example do not write this :

Code:
setInfo(...)
def longcode1 = {
   if(....){...
}
longcode1()

def longcode2 = {
   ....}
}
longcode2()



The problem with wait (error : "IllegalMonitorStateException") will be removed soon.

Re: Method code too large?!

Banjo [ Sun Apr 21, 2013 9:20 am ]

doti wrote:
The problem with wait (error : "IllegalMonitorStateException") will be removed soon.


Okay, thanks. Split the script up and didn't get the "too big" error, but did get the IllegalMonitor" one.

So, no use working on my script anymore until it's fixed (since it won't run due to that error)? :(

Re: Method code too large?!

doti [ Sun Apr 21, 2013 9:40 am ]

This error can be easilly corrected using super.wait(...) instead of wait(...). (it won't be needed after the next release).

Re: Method code too large?!

Banjo [ Thu Apr 25, 2013 2:30 pm ]

doti wrote:
This error can be easilly corrected using super.wait(...) instead of wait(...). (it won't be needed after the next release).


Thanks. Given how many "waits" would need to be changed (!), I'll hold off finishing my scripts until the next update or hotfix (hopefully it's an easy thing to fix and will be soon! :) ).

Page 1 of 1 All times are UTC + 1 hour [ DST ]
https://ss.deviatenow.com:443/
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Maroon Fusion theme created by Oxydo
Software, theme modifications, phpBB modification by Doti 2010, 2011