Potential compiler bug

Stefan Marr java at stefan-marr.de
Fri Nov 7 13:46:22 UTC 2014


Hi:

> On 07 Nov 2014, at 14:39, Thomas Wuerthinger <thomas.wuerthinger at oracle.com> wrote:
> 
> Thanks for looking detailed at this. Can you upload the exported IdealGraphVisualizer file somewhere? Thanks, thomas

Sure, I guess the ’save all groups’ button is the way to go:

http://stefan-marr.de/downloads/truffle/Bounce-miscompilation-igv.xml.bz2

Thanks
Stefan


> 
> On 07 Nov 2014, at 14:05, Stefan Marr <java at stefan-marr.de> wrote:
> 
>> Hi:
>> 
>> I think, I found the place where the optimizer does something that is potentially wrong.
>> 
>> Further investigating the issue made me realize that when IGV is used, it takes time until the compiled method gets installed. It seems, it is only used after IGV finished loading/receiving all the information.
>> 
>> The main benchmark method is of course too large, so I tried to find the smallest method that has the issue when being compiled, and that seems to be Ball class’ initializer:
>> 
>> mx --vm server vm -G:TruffleCompileOnly="Ball>>#initialize" -G:Dump=Truffle,TruffleTree -Xbootclasspath/a:build/classes:libs/truffle.jar som.vm.Universe -cp Smalltalk Examples/Benchmarks/BenchmarkHarness.som Bounce 1500 0 200
>> 
>> So, the characteristic I looked for in the graph is the Random number generator. The constants 1309 and 13849 are easily found after the inlining of the Random methods.
>> In IGV, it is the first subtree of OCT::callRoot. The Random methods are inlined in step 146.
>> 
>> The results look fine, and step 156 “After phase DeadCodeElimination” is still correct. The next Canonicalizer step however reduces the random number computation to a constant. On the Smalltalk level, I don’t understand why that would be possible. The initializer of the Random class with it’s constant does not seem to be inlined. So, the value of Random’s seed field is not merely a data dependency.
>> On the program level, each Ball is initialize independently, and the ‘global’ seed value is changed after each new Ball object is created.
>> 
>> So, I think, that’s where something is going wrong.
>> Would be great if someone with more knowledge of the optimizer could have a look at this.
>> 
>> The relevant TruffleSOM code can be obtained by:
>> 
>> git clone -b mt-vs-pe/without-object-layout --recursive https://github.com/smarr/TruffleSOM
>> ant jar
>> 
>> Thanks
>> Stefan
>> 
>> -- 
>> Stefan Marr
>> INRIA Lille - Nord Europe
>> http://stefan-marr.de/research/
>> 
>> 
>> 
> 

-- 
Stefan Marr
INRIA Lille - Nord Europe
http://stefan-marr.de/research/





More information about the graal-dev mailing list