InstrumentBranchesPhaseTest

Aleksandar Prokopec aleksandar.prokopec at oracle.com
Tue Dec 6 13:27:09 UTC 2016


Hi Andrew,

The InstrumentBranchesPhase is used to instrument the code paths at 
different branches in the program.
For each "if" statement in the compiled program, the phase effectively 
tracks whether the "true" branch or the "else" branch was taken.
It does so by adding a counter at the beginning of each branch.
When the JVM terminates, information about all the branches is printed 
to the standard output.

This functionality proved useful for Truffle language developers, as it 
allows them to quickly figure out which optimization paths were 
correctly taken in their language implementations. I'll add a bit of 
JavaDoc to the phase.

The test in question checks that the branch instrumentation output is 
correct, i.e., that it reports that the "else" branch of the "execute" 
method of the Truffle "SimpleIfTestNode" is taken exactly once.

I am unsure why this fails on AArch64, but two things that come to mind:

1) It is possible that there is an optimization somewhere that somehow 
folds away the entire if-else statement, and that this happens only on 
AArch64.
2) It is possible that NodeSourcePositions are somehow not created on 
AArch64.

Cheers,
Alex

On 06.12.2016 12:01, Doug Simon wrote:
> Alex,
>
> Do you know why Andrew may be getting this failure? Also, maybe you could add some javadoc to InstrumentBranchesPhase at some point ;-)
>
> -Doug
>
>> On 6 Dec 2016, at 11:55, Andrew Haley <aph at redhat.com> wrote:
>>
>> I'm baffled by InstrumentBranchesPhaseTest.  I'm getting a failure here:
>>
>>         Assert.assertTrue(stackOutput.contains("[bci: 4]\n[0] state = ELSE(if=0#, else=1#)"));
>>
>> but the output is:
>>
>> {com.oracle.graal.truffle.test.InstrumentBranchesPhaseTest$SimpleIfTestNode.execute(InstrumentBranchesPhaseTest.java:48) [bci: 4]=[0] state = NONE(if=0#, else=0#)}
>>
>> I don't know what this test does, and I don't understand how any of
>> this might be AArch64-specific.
>>
>> Thanks,
>>
>> Andrew.



More information about the graal-dev mailing list