Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (527)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (594)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  proguard issues  (Read 3419 times)
0 Members and 1 Guest are viewing this topic.
Offline EnderGT

Junior Devvie





« Posted 2006-02-16 03:00:31 »

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.
Offline jbanes

JGO Coder


Projects: 1


"Java Games? Incredible! Mr. Incredible, that is!"


« Reply #1 - Posted 2006-02-16 05:27:24 »

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.

10 kilobytes?!  Shocked 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.  Sad

Java Game Console Project
Last Journal Entry: 12/17/04
Offline Alan_W

JGO Knight


Medals: 8
Projects: 3


Java tames rock!


« Reply #2 - Posted 2006-02-16 07:42:58 »

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

Time flies like a bird. Fruit flies like a banana.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline CaptainJester

JGO Knight


Medals: 12
Projects: 2
Exp: 14 years


Make it work; make it better.


« Reply #3 - Posted 2006-02-16 19:25:52 »

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

Offline jbanes

JGO Coder


Projects: 1


"Java Games? Incredible! Mr. Incredible, that is!"


« Reply #4 - Posted 2006-02-16 19:38:22 »

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

Try this:

1  
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?)

Java Game Console Project
Last Journal Entry: 12/17/04
Offline Myself

Senior Newbie




Java games rock!


« Reply #5 - Posted 2006-02-16 20:06:52 »

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
Offline jbanes

JGO Coder


Projects: 1


"Java Games? Incredible! Mr. Incredible, that is!"


« Reply #6 - Posted 2006-02-16 20:48:40 »

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

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. Smiley

Java Game Console Project
Last Journal Entry: 12/17/04
Offline EnderGT

Junior Devvie





« Reply #7 - Posted 2006-02-17 02:20:11 »

Try this:

1  
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?)

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!
Offline moogie

JGO Knight


Medals: 13
Projects: 6
Exp: 10 years


Java games rock!


« Reply #8 - Posted 2006-02-17 02:43:12 »

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?
Offline EnderGT

Junior Devvie





« Reply #9 - Posted 2006-02-17 02:46:23 »

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.  Smiley
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Alan_W

JGO Knight


Medals: 8
Projects: 3


Java tames rock!


« Reply #10 - Posted 2006-02-17 21:31:45 »

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

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.

Time flies like a bird. Fruit flies like a banana.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

PocketCrafter7 (14 views)
2014-11-28 16:25:35

PocketCrafter7 (10 views)
2014-11-28 16:25:09

PocketCrafter7 (11 views)
2014-11-28 16:24:29

toopeicgaming1999 (76 views)
2014-11-26 15:22:04

toopeicgaming1999 (67 views)
2014-11-26 15:20:36

toopeicgaming1999 (17 views)
2014-11-26 15:20:08

SHC (30 views)
2014-11-25 12:00:59

SHC (28 views)
2014-11-25 11:53:45

Norakomi (32 views)
2014-11-25 11:26:43

Gibbo3771 (28 views)
2014-11-24 19:59:16
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!