RFR(XS): 8229450: C2 compilation fails with assert(found_sfpt) failed
Tobias Hartmann
tobias.hartmann at oracle.com
Tue Aug 20 06:46:05 UTC 2019
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