[15] RFR (S): 8242289: C2: Support platform-specific node cloning in Matcher

Vladimir Ivanov vladimir.x.ivanov at oracle.com
Tue Apr 7 17:29:55 UTC 2020


http://cr.openjdk.java.net/~vlivanov/8242289/webrev.00/
https://bugs.openjdk.java.net/browse/JDK-8242289

Introduce a platform-specific entry point (Matcher::pd_clone_node) and 
move platform-specific node cloning during matching.

Matcher processes every node only once unless it is marked as shared.
It is too restrictive in some cases, so the workaround is to explicitly 
check for particular IR patterns and clone relevant nodes during 
matching phase.

As an example, take a look at ShiftCntV. There are the following match 
rules in aarch64.ad:

   match(Set dst (RShiftVB src (RShiftCntV shift)));

By default, RShiftCntV node is matched only once, so when it has 
multiple users, only it will be folded only into one of them and for the 
rest the value it produces will be put in register. To overcome that, 
Matcher is taught to detect such pattern and "clone" RShiftCntV input 
every time it matches RShiftV node. In case of RShiftCntV, it's 
arm32/aarch64-specific and other platforms (x86 in particular) don't 
optimize for it.

To avoid polluting shared code (in matcher.cpp) with platform-specific 
portions, I propose to add Matcher::pd_clone_node and place 
platform-specific checks there.

Also, as a cleanup, renamed Matcher::clone_address_expressions() to 
pd_clone_address_expressions since it's a platform-specific method.

Testing: hs-precheckin-comp, hs-tier1, hs-tier2,
          cross-builds on all affected platforms

Thanks!

Best regards,
Vladimir Ivanov


More information about the hotspot-compiler-dev mailing list