RFR: 8344251: C2: remove blackholes with dead control input

Marc Chevalier mchevalier at openjdk.org
Tue Apr 15 17:32:46 UTC 2025


On Tue, 15 Apr 2025 16:38:29 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

>> I've added the `-Xcomp` flag because the dead `if` branch was compiled into an uncommon trap (reason = unstable_if), and I had no `BlackholeNode`. Looking at the code emitting the trap, it seems to come from some profiling information, but that the generation of this uncommon trap is explicitly disabled if `-Xcomp` is given. I am not entirely sure why, but `-XX:CompileThreshold=100` does the job to make the compilation of the dead `if` branch happen as well. But if I give no such flag, the test fails for lack of a `BlackholeNode` after parsing (also meaning that the test doesn't exercise the deletion of the `BlackholeNode`).
>> 
>> I'm currently testing further with `-XX:CompileThreshold=100` as suggested (it works on my laptop so far), but if you have a more canonical trick to inhibit the uncommon trap in the dead branch, I'd take happily!
>
> Last time I had this problem, I did this:
> https://github.com/openjdk/jdk/blob/cec48ed270d3bdf704c389a091b42a32c2ed6440/test/hotspot/jtreg/compiler/c2/irTests/gc/ReferenceClearTests.java#L48-L49
> 
> https://github.com/openjdk/jdk/blob/cec48ed270d3bdf704c389a091b42a32c2ed6440/test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/CtwRunner.java#L303-L307

That looks exactly like what I'm trying to achieve. I'll re-test with that. Thanks!

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24663#discussion_r2045135410


More information about the hotspot-compiler-dev mailing list