Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8254734: "dead loop detected" assert failure with patch from 8223051 #649

wants to merge 1 commit into from


Copy link

@rwestrel rwestrel commented Oct 14, 2020

compiler/c2/ ran with -server -Xcomp
-XX:+CreateCoredumpOnCrash -ea -esa -XX:CompileThreshold=100
-XX:+UnlockExperimentalVMOptions -server -XX:-TieredCompilation and
the patch from 8223051 (long counted loops, not integrated yet) fails

assert(no_dead_loop) failed: dead loop detected

I can reproduce the failure with only this change from 8223051:

diff --git a/src/hotspot/share/opto/callnode.cpp b/src/hotspot/share/opto/callnode.cpp
index 268cec7732c..295cb4ecaf9 100644
--- a/src/hotspot/share/opto/callnode.cpp
+++ b/src/hotspot/share/opto/callnode.cpp
@@ -1159,7 +1159,7 @@ Node* SafePointNode::Identity(PhaseGVN* phase) {
   if( in(TypeFunc::Control)->is_SafePoint() )
     return in(TypeFunc::Control);
-  if( in(0)->is_Proj() ) {
+  if (in(0)->is_Proj() && !phase->C->major_progress()) {
     Node *n0 = in(0)->in(0);
     // Check if he is a call projection (except Leaf Call)
     if( n0->is_Catch() ) {
diff --git a/src/hotspot/share/opto/parse1.cpp b/src/hotspot/share/opto/parse1.cpp
index 4b88c379dea..baf2bf9bacc 100644
--- a/src/hotspot/share/opto/parse1.cpp
+++ b/src/hotspot/share/opto/parse1.cpp
@@ -2254,23 +2254,7 @@ void Parse::return_current(Node* value) {
 void Parse::add_safepoint() {
-  // See if we can avoid this safepoint.  No need for a SafePoint immediately
-  // after a Call (except Leaf Call) or another SafePoint.
-  Node *proj = control();
   uint parms = TypeFunc::Parms+1;
-  if( proj->is_Proj() ) {
-    Node *n0 = proj->in(0);
-    if( n0->is_Catch() ) {
-      n0 = n0->in(0)->in(0);
-      assert( n0->is_Call(), "expect a call here" );
-    }
-    if( n0->is_Call() ) {
-      if( n0->as_Call()->guaranteed_safepoint() )
-        return;
-    } else if( n0->is_SafePoint() && n0->req() >= parms ) {
-      return;
-    }
-  }
   // Clear out dead values from the debug info.

so it's unrelated to the long counted loops transformation itself.

At IGVN time, a dead loop is optimized. The loop contains the
following subgraph:

(LoadI .. (AddP (CastPP .. (Phi (Proj (CallStaticJava .. (AddI

The projection is on the backedge of the phi. The AddI points back to
the LoadI. The CallStaticJava is a boxing method call. The LoadI is a
boxed value load.

The phi is optimized out as the loop is unreachable:

(LoadI .. (AddP (Proj (CallStaticJava .. (AddI

The LoadI is then optimized by code MemNode::can_see_stored_value():

    // Load boxed value from result of valueOf() call is input parameter.
    if (this->is_Load() && ld_adr->is_AddP() &&
        (tp != NULL) && tp->is_ptr_to_boxed_value()) {
      intptr_t ignore = 0;
      Node* base = AddPNode::Ideal_base_and_offset(ld_adr, phase, ignore);
      BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
      base = bs->step_over_gc_barrier(base);
      if (base != NULL && base->is_Proj() &&
          base->as_Proj()->_con == TypeFunc::Parms &&
          base->in(0)->is_CallStaticJava() &&
          base->in(0)->as_CallStaticJava()->is_boxing_method()) {
        return base->in(0)->in(TypeFunc::Parms);

to the AddI. Because the AddI has the LoadI as input we end up with a
dead loop. I propose extending the dead loop safe logic to take the
pattern with a boxing method load into account.


  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed


Linux x64 Windows x64 macOS x64
Build ✔️ (5/5 passed) ✔️ (2/2 passed) ✔️ (2/2 passed)
Test (tier1) ✔️ (9/9 passed) ✔️ (9/9 passed) ✔️ (9/9 passed)




$ git fetch pull/649/head:pull/649
$ git checkout pull/649

Copy link

bridgekeeper bot commented Oct 14, 2020

👋 Welcome back roland! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Pull request is ready for review label Oct 14, 2020
Copy link

openjdk bot commented Oct 14, 2020

@rwestrel The following label will be automatically applied to this pull request:

  • hotspot-compiler

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the hotspot-compiler label Oct 14, 2020
Copy link

mlbridge bot commented Oct 14, 2020


Copy link

@chhagedorn chhagedorn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a reasonable fix. I was thinking about something similar before when I was fixing JDK-8251544. Looks good to me.

Copy link

openjdk bot commented Oct 14, 2020

@rwestrel This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file for details.

After integration, the commit message for the final commit will be:

8254734: "dead loop detected" assert failure with patch from 8223051

Reviewed-by: chagedorn, kvn

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 36 new commits pushed to the master branch:

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Oct 14, 2020
Copy link

@vnkozlov vnkozlov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


Copy link
Contributor Author

@chhagedorn @vnkozlov thanks for the review

Copy link
Contributor Author


@openjdk openjdk bot closed this Oct 15, 2020
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Oct 15, 2020
Copy link

openjdk bot commented Oct 15, 2020

@rwestrel Since your change was applied there have been 42 commits pushed to the master branch:

  • 7f73474: 8254773: Remove unimplemented ciReplay::is_loaded(Klass* klass)
  • 167c192: 8254771: Remove unimplemented ciSignature::get_all_klasses
  • 81a8ff1: 8254769: Remove unimplemented BCEscapeAnalyzer::{add_dependence, propagate_dependencies}
  • 7e5eb49: 8253402: Convert vmSymbols::SID to enum class
  • 038f58d: 8226236: [TESTBUG] win32: gc/metaspace/ fails
  • 5194f11: 8254792: Disable intrinsic StringLatin1.indexOf until 8254790 is fixed
  • 55d760d: 8254263: Remove special_runtime_exit_condition() check from ~ThreadInVMForHandshake()
  • 03fa733: 8254777: Remove unimplemented Management::get_loaded_classes
  • 8fb294a: 8254781: Remove unimplemented ClassFieldMap::compute_field_count
  • da2f5ab: 8254780: EnterInterpOnlyModeClosure::completed() always returns true
  • ... and 32 more:

Your commit was automatically rebased without conflicts.

Pushed as commit f44fc6d.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
hotspot-compiler integrated Pull request has been integrated
3 participants