RFR: 8261914: IfNode::fold_compares_helper faces non-canonicalized bool when running JRuby JSON workload [v2]

Roland Westrelin roland at openjdk.java.net
Mon Mar 1 08:53:00 UTC 2021


> The assert fires because the current IfNode's condition was not
> canonicalized when it's being folded with a dominating
> IfNode. idealize_test() should have taken care of that because it
> executed before fold_compares() but it didn't because:
> 
>   Node* new_b = phase->transform( new BoolNode(b->in(1), bt.negate()) );
>   if( !new_b->is_Bool() ) return NULL;
> 
> caused it to bail out. new_b is a constant. This happens because of
> the order in which nodes are processed by IGVN. The If's current Bool
> would also constant fold but it's in the IGVN worklist and hasn't been
> processed yet.
> 
> The fix I propose is to keep Aleksey's defensive fix but to check that
> the Bool input is indeed about to be transformed by IGVN and that that
> would cause the IfNode to be reprocessed.
> 
> I tried to write a test case but didn't succeed. The 2 If nodes come
> from a tableswitch that's transformed into a series of If based on
> profile data. I couldn't reproduce the profile data with a simple test
> case.

Roland Westrelin has updated the pull request incrementally with one additional commit since the last revision:

  missing comment

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/2707/files
  - new: https://git.openjdk.java.net/jdk/pull/2707/files/aa598fb9..273ed8db

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=2707&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=2707&range=00-01

  Stats: 1 line in 1 file changed: 1 ins; 0 del; 0 mod
  Patch: https://git.openjdk.java.net/jdk/pull/2707.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/2707/head:pull/2707

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


More information about the hotspot-compiler-dev mailing list