proguard issues

I get this when running proguard 3.5 on my class, any ideas?

Runtime error while processing class file [P]
Exception in thread “main” java.lang.StackOverflowError
at proguard.optimize.evaluation.value.InstructionOffsetValue.generalize(InstructionOffsetValue.java:106)
at proguard.optimize.evaluation.value.InstructionOffsetValue.generalize(InstructionOffsetValue.java:159)
at proguard.optimize.evaluation.TracedStack$MutableValue.generalizeContainedValue(TracedStack.java:479)
at proguard.optimize.evaluation.TracedStack.consumerPop(TracedStack.java:445)
at proguard.optimize.evaluation.TracedStack.tracePop(TracedStack.java:431)
at proguard.optimize.evaluation.TracedStack.pop(TracedStack.java:228)
at proguard.optimize.evaluation.Stack.ipop(Stack.java:276)
at proguard.optimize.evaluation.Processor.visitBranchInstruction(Processor.java:761)
at proguard.classfile.instruction.BranchInstruction.accept(BranchInstruction.java:104)
at proguard.optimize.evaluation.PartialEvaluator.evaluateInstructionBlock(PartialEvaluator.java:519)
at proguard.optimize.evaluation.PartialEvaluator.evaluateInstructionBlock(PartialEvaluator.java:674)
at proguard.optimize.evaluation.PartialEvaluator.evaluateInstructionBlock(PartialEvaluator.java:674)
at proguard.optimize.evaluation.PartialEvaluator.evaluateInstructionBlock(PartialEvaluator.java:674)
at proguard.optimize.evaluation.PartialEvaluator.evaluateInstructionBlock(PartialEvaluator.java:674)

Edit: After running joga, the problem goes away. Unfortunately, I’m still at 10 KB, and not even done the AI yet. Time to start cutting, I guess.

[quote=“EnderGT,post:1,topic:26237”]
10 kilobytes?! :o Yikes! How many classes have you packed in there? Have you made sure you use as few methods as possible? (Preferably only one +/- event handlers.) Have you read the tips on the wiki? Also, do you recompress with 7Zip (or KZip/BJWDeflate) right after you JoGa/Proguard it?

I’m afraid that if you’re following all the tips and you’re still at 10K, you may need to completely rewrite from the ground up. :frowning:

As a rule of thumb, try to pack everything in a single class and keep that uncompressed, unobfusticated class file to around 8k during initial development (obviously less if you also have a data file). After obfustication & compression, this comes in around the 4k mark. Try to minimise global variables & the number of methods in the class, as this makes a big difference. As jbanes pointed out, there’s lots of great tips in the Wiki (some of which I ought to be doing myself :wink: )

Alan

The main issue is still the exception. I get the same exception when I try to Proguard Asteroids.

[quote=“CaptainJester,post:4,topic:26237”]
Try this:

java -Xss4096k -jar proguard.jar

If you’re still getting a Proguard exception, then there’s something seriously wrong in the code. (Perhaps you ran it through an older obfuscator that puts in invalid links to confuse decompilers?)

I had another kind of problem with proguard -worms4K-, as it seems to increase CPU consumption. Markus_persson -dachon4K- had the same problem.

By the way, I must recognize that a 4K program -at least mine- does not respect all java coding rules, this may be the problem :wink:

[quote=“Myself,post:6,topic:26237”]
I was actually referring to the internal class structure. The compiler shouldn’t let you do anything outright invalid, but obfuscators sometimes pop excess data in there that just barely squeeks by the validators. There was actually a big problem during the Java 1.2 days when the validator got turned on by default. All the obfuscators that had intentionally corrupted code were now paying for it by producing code that was not 1.2 compatible. Whoops. :slight_smile:

No, no older obfuscators. I do have 3 classes, one main that extends JComponent and two very small helpers (~200B each) that I needed because I have to do some sorting and didn’t want to be using Integer, what with all the casts, .intValue() calls, etc.

I do think I am doing something very wrong, though - I commented out all the AI code that I thought would be the bulkiest, and it only removed 2K from the final jar. This is my 3rd rewrite - I’m starting to think it’s just not possible. But then again, it has to be - Riven got 3D cards working with gameplay in 4K - I’m only doing 2D cards!

You could post your current source and people might be able to point out some solutions to reduce bytes.

unless doing so effects the elligability for the contest?

I’m sure I’m just too used to “normal” java development. I just took a look at Riven’s Poker4K code, and there’s definitely a lot of optimization there that I haven’t done. I’ll keep working on it, and if I can make it work, then bonus. If not, well, I’m having fun trying anyway. :slight_smile:

I found that too. Proguard 3.2 was fine, but Proguard 3.4 slowed my code down. I think proguard 3.4 did some optimisations that upset JIT compilation somehow.