Correctness Issues after adopting latest version of Graal

Stefan Marr java at
Thu Apr 10 21:23:55 UTC 2014


After adopting the latest Graal/Truffle version, I am seeing correctness issues when running on top of Graal.

I do not see these issues when running on a standard VM with Truffle alone.
So, I am thinking it might be a code generation issue of sorts.
The only clue I found is that the issue is more deterministic when background compilation is disabled, and the results vary when background compilation is enabled.

Not sure, but it might have something to do with function calls.
The smallest test case that I found, which still exhibits the issue is at [1]. Here a sketch:

        sum := 0.
        1 to: 1000 do: [:i |
            i > 500 ifFalse: [sum := sum + 1]].
        sum = 500 ifFalse: [ self error: 'Expected 500, got: ' + sum asString].

Note, I tried several things to simplify it, but for instance, when I inline the body of the #> message (greater than), then the problem disappears. It also disappears, if I sprinkle print statements into the benchmark method.
Not sure how to proceed from here, every suggestion welcome.

To reproduce the problem, you’ll need the following branch and execution.
Note, Truffle needs a little patch [2] to compile TruffleSOM at the moment, because Java’s has some issues with the used interfaces.

To checkout the relevant branch of TruffleSOM ( will need you to set $GRAAL_HOME to work out of the box):

git clone --recursive -b exp/greater-than 
ant jar
./ -cp Smalltalk Examples/Benchmarks/BenchmarkHarness.som GreaterThan 1000 0 1000

The Truffle patch is at [2], and the relevant code can be checked out with:
  git clone -b master

Do you have any suggestions, how I could verify whether this is a compilation issue, or something in my TruffleSOM code?


Stefan Marr
INRIA Lille - Nord Europe

More information about the graal-dev mailing list