JDK-8252583 : Clean up unused phi-to-copy degradation mechanism
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 16
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2020-08-31
  • Updated: 2024-11-22
  • Resolved: 2020-09-24
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 16
16 b18Fixed
Related Reports
Relates :  
Description
PhiNode::is_copy() performs some assertion checks and then always returns NULL:

  Node* is_copy() const {
    // The node is a real phi if _in[0] is a Region node.
    DEBUG_ONLY(const Node* r = _in[Region];)
    assert(r != NULL && r->is_Region(), "Not valid control");
    return NULL;  // not a copy!
  }

This could be cleaned up and turned into complete debug code.

An example of such an occurrence in PhiNode::Ideal():
// The next should never happen after 6297035 fix.
if( is_copy() )               // Already degraded to a Copy ?
  return NULL;                // No change

Edit: It turns out that phis are not degraded to copies anymore [1], so PhiNode::is_copy() and the rest of code that handles "phi copies" can be simply removed.

[1] https://github.com/openjdk/jdk/pull/275#issuecomment-696369295
Comments
Changeset: f3ea0d36 Author: Roberto Castaneda Lozano <roberto.castaneda.lozano@oracle.com> Committer: Tobias Hartmann <thartmann@openjdk.org> Date: 2020-09-24 08:10:56 +0000 URL: https://git.openjdk.java.net/jdk/commit/f3ea0d36
24-09-2020

Updated the issue to reflect that there is indeed no more PhiNode-to-copy degradation, and the code can be cleaned up accordingly.
22-09-2020

JDK-6297035 might have removed the last points where PhiNodes are degraded to copies.
14-09-2020

There are other occurrences in the code that check implicitly whether a PhiNode has been degraded to a copy, e.g. [1], however I cannot find any point where such "degradation" takes place for a PhiNode (only indirectly through its corresponding RegionNode). If there is no PhiNode-to-copy degradation, those implicit checks could also be removed or replaced with assertions. [1] https://github.com/openjdk/jdk/blob/68da63dcdead52418b41f80d381b105ce71a8162/src/hotspot/share/opto/cfgnode.cpp#L1380
14-09-2020