Bad assert in OuterStripMinedLoopNode::transform_to_counted_loop?

Christian Hagedorn christian.hagedorn at oracle.com
Mon Jan 6 09:37:03 UTC 2025


Hi Matthias

Thanks for your report! I was able to reproduce this and trace it back to
JDK-8343394 [1]. But this only changed the underlying memory segment Java code.
So, this must have revealed an existing issue.

I filed JDK-8347040 [2] for this bug.

Best regards,
Christian


[1] https://bugs.openjdk.org/browse/JDK-8343394
[2] https://bugs.openjdk.org/browse/JDK-8347040


On 02.01.25 17:11, Matthias Ernst wrote:
> In fact, the assertion can be triggered by just this code:
> 
> import static java.lang.foreign.ValueLayout.JAVA_LONG;
> 
> import java.lang.foreign.Arena;
> import java.lang.foreign.MemorySegment;
> 
> public class Repro {
>   static final int COUNT = 100000;
>   static final MemorySegment segment = Arena.global().allocate(JAVA_LONG, COUNT);
> 
>   public static void main(String[] args) {
>     var i = 0;
>     var j = 0;
>     while (i < COUNT) {
>       segment.setAtIndex(JAVA_LONG, i++, 0);
>       segment.setAtIndex(JAVA_LONG, j++, 0);
>     }
>   }
> }
> 
> 
> 
> On Tue, Dec 31, 2024 at 13:26 Matthias Ernst <matthias at mernst.org
> <mailto:matthias at mernst.org>> wrote:
> 
>     Hi, I've come across an assertion tripping in JDK debug builds (24, latest,
>     not 23) in combination with new foreign memory apis. Product builds seem to
>     be functioning ok:
> 
>     |# Internal Error (src/hotspot/share/opto/loopnode.cpp:3196), pid=27, tid=44
>     # Error: assert(!loop->_body.contains(in)) failed |
> 
> 
>     I've been able to narrow it down somewhat, repro code/data as well as crash
>     logs can be found here: https://github.com/mernst-github/repro/tree/main/
>     loopnode-assertion <https://github.com/mernst-github/repro/tree/main/
>     loopnode-assertion> (this was originally a standard `quicksort` on top of a
>     MemorySegment).
> 
>     I have not been able to discover anything more systematic. Small changes to
>     the input data, or using a heap array instead of a MemorySegment make the
>     issue go away.
> 
>     Cheers
>     Matthias
>     (PS: lmk if this is not an opportune place to report such an issue)
> 



More information about the hotspot-compiler-dev mailing list