[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:
> 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)
> 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
> 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?
[/quote]
wow! I knew my programming was bad… but bad enough to crash a well developed jvm? 
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
)
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.