Debugging NPE during CanonicalizerPhase

Stefan Marr java at stefan-marr.de
Thu Aug 8 02:39:27 PDT 2013


Hi Andreas:

On 07 Aug 2013, at 23:51, Andreas Woess <andreas.woess at jku.at> wrote:

> I've found the bug and I think I have a workaround for you until this is
> fixed.
> In ReturnNonLocalNode you have try {... throw new ReturnException ...}
> catch (FrameSlotTypeException) {...}. Avoid this try-catch block around
> any throw of a ControlFlowException. I suggest factoring out
> "try-getObject-catch-shouldNotHappen" into a separate method -- you use
> this pattern in several places.

Again, spot on. Thanks a lot.

Refactoring ReturnNonLocalNode to use methods that encapsulate the "try-getObject-catch-shouldNotHappen" solves the issue immediately.
Now I get performance that is roughly on par with the 'interpreted' version that is just running on HotSpot.

Applying the pattern for all these getObject cases doesn't seem to make a significant difference. Guess for most cases the compiler is already doing the correct thing.

Some numbers below.

Thanks
Stefan

With Graal
----------

$ ./mx.sh --vm server vm -G:-TraceTruffleCompilation -Xbootclasspath/a:../som/build/classes som.vm.Universe -cp ../som/Smalltalk ../som/Examples/Benchmarks/All.som
Starting Fibonacci benchmark ...
   Iterations: 30 (elapsed time 15393 ms)
   RESULT: 59 ms

Starting Dispatch benchmark ...
   Iterations: 66 (elapsed time 3005 ms)
   RESULT: 32 ms

Starting Bounce benchmark ...
   Iterations: 30 (elapsed time 17745 ms)
   RESULT: 51 ms

Starting Loop benchmark ...
   Iterations: 30 (elapsed time 3015 ms)
   RESULT: 37 ms

Starting Permute benchmark ...
   Iterations: 30 (elapsed time 5028 ms)
   RESULT: 41 ms

Starting Queens benchmark ...
   Iterations: 30 (elapsed time 9221 ms)
   RESULT: 48 ms

Starting List benchmark ...
   Iterations: 30 (elapsed time 6592 ms)
   RESULT: 60 ms

Starting Recurse benchmark ...
   Iterations: 108 (elapsed time 3008 ms)
   RESULT: 20 ms

Starting Storage benchmark ...
   Iterations: 30 (elapsed time 3497 ms)
   RESULT: 56 ms

Starting Sieve benchmark ...
   Iterations: 30 (elapsed time 3108 ms)
   RESULT: 43 ms

Starting BubbleSort benchmark ...
   Iterations: 30 (elapsed time 4726 ms)
   RESULT: 36 ms

Starting QuickSort benchmark ...
   Iterations: 30 (elapsed time 9070 ms)
   RESULT: 41 ms

Starting Sum benchmark ...
   Iterations: 79 (elapsed time 3000 ms)
   RESULT: 35 ms

Starting Towers benchmark ...
   Iterations: 30 (elapsed time 7996 ms)
   RESULT: 59 ms

Starting TreeSort benchmark ...
   Iterations: 30 (elapsed time 8416 ms)
   RESULT: 69 ms

Starting IntegerLoop benchmark ...
   Iterations: 40 (elapsed time 3041 ms)
   RESULT: 69 ms

All tests completed (756 ms)


Without Graal
-------------

$ ./som.sh -cp Smalltalk Examples/Benchmarks/All.som                                                         ✹ ✭getObject-catch-idiom
Starting Fibonacci benchmark ...
   Iterations: 38 (elapsed time 3002 ms)
   RESULT: 66 ms

Starting Dispatch benchmark ...
   Iterations: 81 (elapsed time 3027 ms)
   RESULT: 35 ms

Starting Bounce benchmark ...
   Iterations: 78 (elapsed time 3028 ms)
   RESULT: 36 ms

Starting Loop benchmark ...
   Iterations: 82 (elapsed time 3033 ms)
   RESULT: 35 ms

Starting Permute benchmark ...
   Iterations: 77 (elapsed time 3019 ms)
   RESULT: 38 ms

Starting Queens benchmark ...
   Iterations: 69 (elapsed time 3005 ms)
   RESULT: 41 ms

Starting List benchmark ...
   Iterations: 49 (elapsed time 3025 ms)
   RESULT: 57 ms

Starting Recurse benchmark ...
   Iterations: 108 (elapsed time 3013 ms)
   RESULT: 27 ms

Starting Storage benchmark ...
   Iterations: 60 (elapsed time 3009 ms)
   RESULT: 48 ms

Starting Sieve benchmark ...
   Iterations: 69 (elapsed time 3018 ms)
   RESULT: 41 ms

Starting BubbleSort benchmark ...
   Iterations: 93 (elapsed time 3012 ms)
   RESULT: 31 ms

Starting QuickSort benchmark ...
   Iterations: 77 (elapsed time 3031 ms)
   RESULT: 37 ms

Starting Sum benchmark ...
   Iterations: 86 (elapsed time 3033 ms)
   RESULT: 34 ms

Starting Towers benchmark ...
   Iterations: 51 (elapsed time 3019 ms)
   RESULT: 57 ms

Starting TreeSort benchmark ...
   Iterations: 40 (elapsed time 3049 ms)
   RESULT: 73 ms

Starting IntegerLoop benchmark ...
   Iterations: 44 (elapsed time 3049 ms)
   RESULT: 67 ms

All tests completed (723 ms)


-- 
Stefan Marr
Software Languages Lab
Vrije Universiteit Brussel
Pleinlaan 2 / B-1050 Brussels / Belgium
http://soft.vub.ac.be/~smarr
Phone: +32 2 629 2974
Fax:   +32 2 629 3525



More information about the graal-dev mailing list