RFR: 8271954: C2: assert(false) failed: Bad graph detected in build_loop_late [v4]

Christian Hagedorn chagedorn at openjdk.java.net
Fri Aug 27 09:12:28 UTC 2021


On Fri, 27 Aug 2021 07:24:10 GMT, Roland Westrelin <roland at openjdk.org> wrote:

>> I want to pass a tristate: [no unswitching, fast loop, slow loop]. I initially had two bool flags passed to this function for that. But then I thought since `old_new` is only non-null in the fast loop case, I can use that one as "flag" to decide if we need to clone for the fast loop. I use `unswitch_is_slow_loop` as flag for the slow loop since `old_new` is `NULL` in this case. `false` and `NULL` is then the third state for no unswitching. But maybe it's better to introduce the second bool flag again to make it more clear.
>
> It would seem a single variable that carries the tri state would be the clearest option. That would require an enum though so not sure if it's worth it. Anyway, I'm good with the change as it is. I only found the 2 boolean variables a bit confusing.

I agree that this is confusing. I think your suggestion with an enum is the most clean way and also improves the readability. I'll change that.

-------------

PR: https://git.openjdk.java.net/jdk/pull/5185


More information about the hotspot-compiler-dev mailing list