Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (108)
games submitted by our members
Games in WIP (536)
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  
  How to search for bugs between jvm impelmentation?  (Read 1619 times)
0 Members and 1 Guest are viewing this topic.
Offline moogie

JGO Knight


Medals: 12
Projects: 6
Exp: 10 years


Java games rock!


« Posted 2004-03-26 10:30:19 »

I have recently come back to my pet project of developing a lossless video codec, and have actually have the preliminary version working! yay! Smiley

Ah, i thought, i can speed things up by using the -server jvm as i dont mind a longer start up if it means faster compression over all. So i then tried my program with the -sever jvm... but it causes my program to crash with an array out of bounds error.

What distresses me even more is that the time and point at which the program crashes seems to be arbitary! In my efforts to locate the error i introduced some println statements, with the addition of these statements the program now crashes on the 5th frame instead of the 3rd frame of a sequence!

This arbitary crashing seems to be like there is some sort of threading issue... however my program is only the main process. Does the -server jvm make my non threaded program threaded?

I then tried compiling the program to native win32 binaries via excelsior JET. The program compiles and runs perfectly (and faster).


It will be about 10 hours before i am able to respond to any replies.
How do i go about finding and correcting the bug causing this? (assuming it is a bug on my end, which i dont doubt for a second!)

The code for the video compresser is http://www.geocities.com/budgetanime/hdiffindex.html

some frames that will cause the error are also included.

to run the compressor:

java -server hdiffC clock -alt -scan -autoDelta 3

assuming that the clock bitmaps are in the same directory as the program.

The program will run perfectly if you use the client jvm... i.e. remove the -server from the above line.

Offline moogie

JGO Knight


Medals: 12
Projects: 6
Exp: 10 years


Java games rock!


« Reply #1 - Posted 2004-03-26 10:35:39 »

also, i cannot respond to any reply for the next 9-10 hours.
Offline moogie

JGO Knight


Medals: 12
Projects: 6
Exp: 10 years


Java games rock!


« Reply #2 - Posted 2004-03-26 19:44:19 »

hmm, must be a tricky problem Wink
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline dleskov

Senior Member


Medals: 10



« Reply #3 - Posted 2004-03-28 10:46:41 »

It seems there is a bug in the server VM's dynamic compiler, i.e. your code works ok on the interpreter but the compiled code fails. To prove this, I have run your program on HotSpot 1.4.2_03 three times: as you suggested, with -Xint (interpreter mode) option added and with -XX:CompileThreshold=2 (compile on second call/branch, default is 10000 for the server VM) option added:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
> java -server hdiffC clock -alt -scan -autoDelta 3
Frame 0 as KeyFrame.
Frame: 1 as Key Frame: 95017 as Delta Frame: 109123
Frame: 2 as Key Frame: 95057 as Delta Frame: 108831
Frame: 3Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -777
        at deltaC.run(deltaC.java:363)
        at hdiffC.encode(hdiffC.java:228)
        at hdiffC.run(hdiffC.java:201)
        at hdiffC.mainInst(hdiffC.java:131)
        at hdiffC.main(hdiffC.java:42)


1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
> java -server -Xint hdiffC clock -alt -scan -autoDelta 3
Frame 0 as KeyFrame.
Frame: 1 as Key Frame: 95017 as Delta Frame: 109123
Frame: 2 as Key Frame: 95057 as Delta Frame: 108831
Frame: 3 as Key Frame: 95558 as Delta Frame: 108781
Frame: 4 as Key Frame: 95441 as Delta Frame: 108194
Frame: 5 as Key Frame: 95763 as Delta Frame: 107765
Frame: 6 as Key Frame: 95413 as Delta Frame: 106442
Frame: 7 as Key Frame: 95033 as Delta Frame: 106478
Frame: 8 as Key Frame: 95251 as Delta Frame: 107457
Frame: 9 as Key Frame: 95244 as Delta Frame: 108264
Frame: 10 as Key Frame: 95785 as Delta Frame: 108130
No of Frames: 11
avg time taken: 92510
avg time taken per frame: 8410


1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
> java -server -XX:CompileThreshold=2 hdiffC clock -alt -scan -autoDelta 3
Frame 0 as KeyFrame.
Frame: 1 as Key Frame: 95017 as Delta Frame: 109123
Frame: 2 as Key Frame: 95057 as Delta Frame: 108831
Frame: 3 as Key Frame: 95558 as Delta Frame: 108781
Frame: 4 as Key Frame: 95441 as Delta Frame: 108194
Frame: 5 as Key Frame: 95763 as Delta Frame: 107765
Frame: 6 as Key Frame: 95413 as Delta Frame: 106442
Frame: 7Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -777
        at deltaC.run(deltaC.java:504)
        at hdiffC.encode(hdiffC.java:228)
        at hdiffC.run(hdiffC.java:201)
        at hdiffC.mainInst(hdiffC.java:131)
        at hdiffC.main(hdiffC.java:42)

As you may see, you program runs ok on the interpreter and fails at different points depending on when it gets natively compiled by HotSpot. The server VM uses a substantially different compiler than the client VM, this is why you program does not fail on the latter.

I'd suggest that you file a bug report at Sun and use the client VM for now. You may also wish to try IBM VM which is often faster than HotSpot Server on this type of applications.

Out of curiosity, how much faster is the JET-compiled version?

Offline moogie

JGO Knight


Medals: 12
Projects: 6
Exp: 10 years


Java games rock!


« Reply #4 - Posted 2004-03-29 11:21:13 »

Quote
It seems there is a bug in the server VM's dynamic compiler, i.e. your code works ok on the interpreter but the compiled code fails. To prove this, I have run your program on HotSpot 1.4.2_03 three times: as you suggested, with -Xint (interpreter mode) option added and with -XX:CompileThreshold=2 (compile on second call/branch, default is 10000 for the server VM) option added:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
> java -server hdiffC clock -alt -scan -autoDelta 3
Frame 0 as KeyFrame.
Frame: 1 as Key Frame: 95017 as Delta Frame: 109123
Frame: 2 as Key Frame: 95057 as Delta Frame: 108831
Frame: 3Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -777
        at deltaC.run(deltaC.java:363)
        at hdiffC.encode(hdiffC.java:228)
        at hdiffC.run(hdiffC.java:201)
        at hdiffC.mainInst(hdiffC.java:131)
        at hdiffC.main(hdiffC.java:42)


1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
> java -server -Xint hdiffC clock -alt -scan -autoDelta 3
Frame 0 as KeyFrame.
Frame: 1 as Key Frame: 95017 as Delta Frame: 109123
Frame: 2 as Key Frame: 95057 as Delta Frame: 108831
Frame: 3 as Key Frame: 95558 as Delta Frame: 108781
Frame: 4 as Key Frame: 95441 as Delta Frame: 108194
Frame: 5 as Key Frame: 95763 as Delta Frame: 107765
Frame: 6 as Key Frame: 95413 as Delta Frame: 106442
Frame: 7 as Key Frame: 95033 as Delta Frame: 106478
Frame: 8 as Key Frame: 95251 as Delta Frame: 107457
Frame: 9 as Key Frame: 95244 as Delta Frame: 108264
Frame: 10 as Key Frame: 95785 as Delta Frame: 108130
No of Frames: 11
avg time taken: 92510
avg time taken per frame: 8410


1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
> java -server -XX:CompileThreshold=2 hdiffC clock -alt -scan -autoDelta 3
Frame 0 as KeyFrame.
Frame: 1 as Key Frame: 95017 as Delta Frame: 109123
Frame: 2 as Key Frame: 95057 as Delta Frame: 108831
Frame: 3 as Key Frame: 95558 as Delta Frame: 108781
Frame: 4 as Key Frame: 95441 as Delta Frame: 108194
Frame: 5 as Key Frame: 95763 as Delta Frame: 107765
Frame: 6 as Key Frame: 95413 as Delta Frame: 106442
Frame: 7Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -777
        at deltaC.run(deltaC.java:504)
        at hdiffC.encode(hdiffC.java:228)
        at hdiffC.run(hdiffC.java:201)
        at hdiffC.mainInst(hdiffC.java:131)
        at hdiffC.main(hdiffC.java:42)

As you may see, you program runs ok on the interpreter and fails at different points depending on when it gets natively compiled by HotSpot. The server VM uses a substantially different compiler than the client VM, this is why you program does not fail on the latter.

I'd suggest that you file a bug report at Sun and use the client VM for now. You may also wish to try IBM VM which is often faster than HotSpot Server on this type of applications.

Out of curiosity, how much faster is the JET-compiled version?


wow! I knew my programming was bad... but bad enough to crash a well developed jvm? Wink

Thanks for all your help! I really appreciate it. Its a load off my mind. I was fretting that i had a major latent bug in my code.

I have tried obtaining the IBM's jvm... however i have had no luck finding a download for it. (and no amount of snazzy search queries on the IBMs site has revealed where i can get a copy Sad )

I will take your suggestion of placing a bug report.... once i figure out how to do that. Time to browse suns's "wonderful" website.

The JET compiled native code is about 1.2x-1.5x as fast as the sun's client JVM. not a huge improvement, however over a lot of frames it is noticable.
Offline dleskov

Senior Member


Medals: 10



« Reply #5 - Posted 2004-03-30 06:18:48 »

Quote
I have tried obtaining the IBM's jvm... however i have had no luck finding a download for it. (and no amount of snazzy search queries on the IBMs site has revealed where i can get a copy Sad )

IBM 1.3 JDK used to be available from http://www.ibm.com/developerworks/java/. As for 1.4, some posts at JavaLobby.org suggested the following:

1. Download WebSphere MQ Evaluation (free, requires registration.) from http://www-306.ibm.com/software/integration/wmq/v53/

2. Start the installation program and click Next repeatedly until it displays a message box with animation asking whether you want to start WebSphere MQ installation now.

3. The IBM 1.4.0 JDK is now in

system-drive:\Program Files\IBM\Source\WebSphere MQ t_en_us\Prereqs\JDK\ibm-java2-sdk-140.exe

Copy it to the desired location.

4. Voila! Now you may cancel WebSphere MQ installation (unless you are interested in evaluating it.)

Quote
The JET compiled native code is about 1.2x-1.5x as fast as the sun's client JVM. not a huge improvement, however over a lot of frames it is noticable.

Well, not that much indeed. If your code is CPU-intensive, esp. floating-point intensive, give IBM JRE a try.

Offline moogie

JGO Knight


Medals: 12
Projects: 6
Exp: 10 years


Java games rock!


« Reply #6 - Posted 2004-03-30 11:51:05 »

heh, tricky!

no wonder i had little luck finding it then Smiley

Cheers for the info!

Actually most of the the processing is on integers and bytes... i wonder if i will achieve any improvement using IBM jvm.

The java version of the compressor is more of a proof of concept, so speed is not a major issue... tho faster is always better Smiley I (or some other person(s) ) will then migrate it in to C and then optimize the code such that it can be used as a standard vfw video codec.


and wouldnt you know it?! Suns bug submission form has a bug! (oh the irony!) and so i cant submit the bug. Will try again tomorrow.
Offline moogie

JGO Knight


Medals: 12
Projects: 6
Exp: 10 years


Java games rock!


« Reply #7 - Posted 2004-04-01 08:16:07 »

I did download the IBM's jvm and the code runs fine on it as well.

I optimized the code a bit and ran some simple bench marks. I ran the compressor over 67 frames on each jvm type 5 times:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
     IBM       IBM        Sun     JET
     -Xcomp Vanilla Client  

1    425       531        304     225
2    449       461        302     209
3    433       498        301     209
4    494       456        300     209
5    494       500        301     209

Avg  459       489.2      301.6   212.2


These are the average time to compress each frame. (in msec)

Hmm, it seems my optimizing really helped with the JET compiled native code! it is nearly 100 msecs faster than Sun's client JVM!

I am a little dissappointed with IBM's jvm I expect it to perform on par or better than suns client JVM.

I tired it wil the -Xcomp option and it is moderately faster than the vanilla IBM jvm call.

Maybe someone who knows the IBM jvm can tell me what options are optimal for programs that perform lots of array access and computation?



On related news... I sent an email to Sun saying their bug submission page has errors... but no repsonce and I still cannot submit a bug Sad
Offline dleskov

Senior Member


Medals: 10



« Reply #8 - Posted 2004-04-05 12:15:58 »

We would be very interested in using your codec as a benchmark. Can we have snapshots of (i) your Java sources, taken right before you start rewriting them in C, and (ii) of your C sources, taken right after they are rewritten?

Offline moogie

JGO Knight


Medals: 12
Projects: 6
Exp: 10 years


Java games rock!


« Reply #9 - Posted 2004-04-05 12:48:10 »

Well, I would say yes, however it will be a long time in comming... This codec is my Honours Thesis so it will not be finished until at least October, September... The conversion to C will start after that time. I am considering making it an open source project as i am not proficient in C/C++ as i am in java and i feel that i will not be able to do the conversion by my self.

In the process of being converted there are parts of my java code which are not as efficent as they can be and so I (or others) will probably make enough changes to make a direct comparision between the java version and the C version to not meaningful.

I am trying to make my java code  "referance" code for myself or others to make more efficient C/C++ code with.
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.

CogWheelz (18 views)
2014-07-30 21:08:39

Riven (23 views)
2014-07-29 18:09:19

Riven (15 views)
2014-07-29 18:08:52

Dwinin (12 views)
2014-07-29 10:59:34

E.R. Fleming (33 views)
2014-07-29 03:07:13

E.R. Fleming (12 views)
2014-07-29 03:06:25

pw (43 views)
2014-07-24 01:59:36

Riven (43 views)
2014-07-23 21:16:32

Riven (30 views)
2014-07-23 21:07:15

Riven (31 views)
2014-07-23 20:56:16
List of Learning Resources
by SilverTiger
2014-07-31 18:29:50

List of Learning Resources
by SilverTiger
2014-07-31 18:26:06

List of Learning Resources
by SilverTiger
2014-07-31 13:54:12

HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54
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!