RFR(XS): 8229450: C2 compilation fails with assert(found_sfpt) failed

Liu Xin navy.xliu at gmail.com
Tue Aug 27 08:34:00 UTC 2019


Hello, MailList,

I make a new revision of that bugfix for JDK-8229450
<https://bugs.openjdk.java.net/browse/JDK-8229450>. Could you review it?
It's a very corner case. In graph
https://bugs.openjdk.java.net/secure/attachment/84402/JDK-8229450.png, 364
Bool is shared by two if blocks. One happens to dominate another one and
the one happens to be CountedLoopedEnd of a strip-mined loop.  A safepoint
node is middle of it.

I followed Tobias' guideline.  I make a testcase: TestMe.java. It's very
similar to the graph generated from replay file. I intend to force line 40
and 53 share the boolean expression 'len < BINARY_VERSION_MARKER_SIZE', but
still no luck.
IGVN always removes one of them. I am pretty sure that replay file compiles
the same graph, but some profile data keep 364 Bool like that. Could you
give me a hint?

thanks,
--lx

On Tue, Aug 20, 2019 at 12:52 AM Liu Xin <navy.xliu at gmail.com> wrote:

> hi, Tobias,
>
> Thank you for providing this information. I will work on it with this
> guideline.
>
> thanks,
> --lx
>
>
>
> On Mon, Aug 19, 2019 at 11:46 PM Tobias Hartmann <
> tobias.hartmann at oracle.com> wrote:
>
>>
>> On 19.08.19 10:26, Liu Xin wrote:
>> > I still have 2 questions.  Could reviewers help me out?
>> >
>> > 1. I'd like to  add a testcase,  but JVM won't hit it even though I
>> repeat
>> > invoke that function thousands of times. I can see that function is
>> > compiled by C2, but C2 succeeds to compile it.
>> > The only way to reproduce that problem is using replay file. Is that
>> > possible to build a testcase from a replay file?  or What kinda of
>> > information should I pull out of the replay file?
>>
>> Generating a simple regression test is a science in itself but such tests
>> are extremely valuable.
>>
>> If a replay compilation file reproduces the failure, I usually attempt
>> the following to create a
>> simple regression test:
>> - Try to simplify the replay compilation file as far as possible by
>> removing inline statements
>> - Disable as many C1/C2 optimizations [1] as possible so that the issue
>> still reproduces (this will
>> simplify the graph)
>> - Debug the issue using replay compilation until you get a good
>> understanding of the root cause and
>> the required conditions (inlining, optimistic optimizations based on
>> profiling, IR shape, ...)
>> - Look at the Java code that is compiled and the way it is
>> invoked/profiled. Not being able to
>> reproduce with a normal run usually suggests that the profiling is
>> different.
>> - Write a test that invokes the same method in the same way (same
>> arguments, same inlining). Use
>> CompileCommands to control inling if necessary. Compare the IR generated
>> for your test to the IR
>> generated with the replay file (flags like -XX:+TraceLoopOpts also help)
>> and modify your test to get
>> closer. Sometimes this takes days but it's worth it.
>> - Once the failure triggers, simplify the test as good as possible.
>> - If you don't have a fix yet, use the simple regression test to debug
>> further.
>>
>> > 2. I found you guys sometimes paste a sub-graph of Ideal nodes in JBS
>> > issues. Do you have a script to render a IdealLoopTree? So far, I only
>> have
>> > idealgraphvisualizer. It renders the whole function.Too big to
>> understand.
>>
>> Do you mean sub-graphs like [2]? That graph is created by the
>> IdealGraphVisualizer. You can search
>> for nodes or apply filters to find the interesting parts of the usually
>> large graph and then click
>> on nodes to expand/collapse other parts of the graph.
>>
>> I usually print the ids of offending nodes by modifying the sources and
>> then look at the surrounding
>> nodes with the IdealGraphVisualizer or directly at the -XX:+PrintIdeal
>> output. Stepping through the
>> optimization phases might help as well.
>>
>> Best regards,
>> Tobias
>>
>> [1] Here are some C2 optimizations you might want to try to disable
>> -XX:-OptimizePtrCompare -XX:-OptoPeephole -XX:LoopUnrollLimit=0
>> -XX:LoopMaxUnroll=0
>> -XX:-SuperWordLoopUnrollAnalysis -XX:-UseCountedLoopSafepoints
>> -XX:-UseLoopPredicate
>> -XX:-PartialPeelAtUnsignedTests -XX:-LoopUnswitching -XX:-UseSuperWord
>> -XX:-SubsumeLoads
>> -XX:-OptimizeStringConcat -XX:-SplitIfBlocks -XX:-RangeCheckElimination
>> [2] http://cr.openjdk.java.net/~thartmann/8228888/8228888_graph.png
>>
>


More information about the hotspot-compiler-dev mailing list