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

8263352: assert(use == polladr) failed: the use should be a safepoint polling #3061

Closed
wants to merge 2 commits into from

Conversation

@Wanghuang-Huawei
Copy link
Contributor

@Wanghuang-Huawei Wanghuang-Huawei commented Mar 18, 2021

The main reason of this failure has been shown in JDK-8263352.

  • JDK-8260637 makes a CastPP unpinned, so it can be pull out of inner loop
  • JDK-8247307 assert use == polladr and makes it crash here.
  • I think we can only intrinsify_fill the array when it is really safe here, so I fix this bug by return other cases.
    In this patch, I will give a small test case called Test8263352.java to reproduct this failure.
    Thanks to @vnkozlov , who found this failure for the first time (to me).
    Thanks to @nsjian,who found the case which can reproduct this failure everytime.
    Thanks to @pfustc, who changed notes with us.

Progress

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

Issue

  • JDK-8263352: assert(use == polladr) failed: the use should be a safepoint polling

Reviewers

Contributors

  • Wang Huang <whuang@openjdk.org>
  • Wu Yan <wuyan34@huawei.com>

Download

To checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/3061/head:pull/3061
$ git checkout pull/3061

To update a local copy of the PR:
$ git checkout pull/3061
$ git pull https://git.openjdk.java.net/jdk pull/3061/head

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Mar 18, 2021

👋 Welcome back whuang! 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 label Mar 18, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Mar 18, 2021

@Wanghuang-Huawei
Contributor Wang Huang <whuang@openjdk.org> successfully added.

@openjdk
Copy link

@openjdk openjdk bot commented Mar 18, 2021

@Wanghuang-Huawei
Contributor Wu Yan <wuyan34@huawei.com> successfully added.

@openjdk
Copy link

@openjdk openjdk bot commented Mar 18, 2021

@Wanghuang-Huawei 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.

@mlbridge
Copy link

@mlbridge mlbridge bot commented Mar 18, 2021

Webrevs

@vnkozlov
Copy link
Contributor

@vnkozlov vnkozlov commented Mar 18, 2021

I have question for @rwestrel who did strip mining. Looking on nodes I see:

 1247  CountedLoop  ===  1247  1246  794  [[ 1247  788  741  738  781  1242 ]] inner stride: 1  strip mined !orig=[1237],[731] !jvms: ComponentSampleModel::<init> @ bci:147 (line 162)
 1242  CountedLoopEnd  ===  1247  1241  [[ 1243  794 ]] [lt] P=0.646827, C=6564.000000 !orig=[793] !jvms: ComponentSampleModel::<init> @ bci:144 (line 161)
 1243  IfFalse  ===  1242  [[ 1248 ]] #0 !orig=795 !jvms: ComponentSampleModel::<init> @ bci:144 (line 161)

 788  LoadP  ===  1247  659  787  [[ 1248 ]]  @rawptr:BotPTR, idx=Raw; #rawptr:BotPTR (does not depend only on test) !jvms: ComponentSampleModel::<init> @ bci:158 (line 161)
 1248  SafePoint  ===  1243  1  784  1  1  788  10  1  1  1  1  1  1  782  [[ 1244 ]]  SafePoint  !orig=783 !jvms: ComponentSampleModel::<init> @ bci:158 (line 161)

So why Poll's LoadP node's control edge is not the same as SafePoint's control edge? Why it points to inner loop head?
If we adjust LoadP's control edge to the same node as Safepoint (exit from inner loop), we would not need this special case in match_fill_loop().

@@ -0,0 +1,74 @@
/*

This comment has been minimized.

@vnkozlov

vnkozlov Mar 18, 2021
Contributor

We don't use bug ID for tests anymore. Rename it to something meaningful and move it to corresponding compiler/loopopts/ or compiler/loopstripmining/ directory.

@rwestrel
Copy link
Contributor

@rwestrel rwestrel commented Mar 19, 2021

I have question for @rwestrel who did strip mining. Looking on nodes I see:

 1247  CountedLoop  ===  1247  1246  794  [[ 1247  788  741  738  781  1242 ]] inner stride: 1  strip mined !orig=[1237],[731] !jvms: ComponentSampleModel::<init> @ bci:147 (line 162)
 1242  CountedLoopEnd  ===  1247  1241  [[ 1243  794 ]] [lt] P=0.646827, C=6564.000000 !orig=[793] !jvms: ComponentSampleModel::<init> @ bci:144 (line 161)
 1243  IfFalse  ===  1242  [[ 1248 ]] #0 !orig=795 !jvms: ComponentSampleModel::<init> @ bci:144 (line 161)

 788  LoadP  ===  1247  659  787  [[ 1248 ]]  @rawptr:BotPTR, idx=Raw; #rawptr:BotPTR (does not depend only on test) !jvms: ComponentSampleModel::<init> @ bci:158 (line 161)
 1248  SafePoint  ===  1243  1  784  1  1  788  10  1  1  1  1  1  1  782  [[ 1244 ]]  SafePoint  !orig=783 !jvms: ComponentSampleModel::<init> @ bci:158 (line 161)

So why Poll's LoadP node's control edge is not the same as SafePoint's control edge? Why it points to inner loop head?
If we adjust LoadP's control edge to the same node as Safepoint (exit from inner loop), we would not need this special case in match_fill_loop().

That makes sense but needs to be done explicitly:

diff --git a/src/hotspot/share/opto/loopnode.cpp b/src/hotspot/share/opto/loopnode.cpp
index bf5a685960c..42e5b940dc5 100644
--- a/src/hotspot/share/opto/loopnode.cpp
+++ b/src/hotspot/share/opto/loopnode.cpp
@@ -1636,6 +1636,13 @@ bool PhaseIdealLoop::is_counted_loop(Node* x, IdealLoopTree*&loop, BasicType iv_
         Node* sfpt = sfpt2->clone();
         sfpt->set_req(0, iffalse);
         outer_le->set_req(0, sfpt);
+        Node* polladdr = sfpt->in(TypeFunc::Parms)->clone();
+        assert(polladdr->is_Load(), "");
+        Node* new_polladdr = polladdr->clone();
+        new_polladdr->set_req(0, iffalse);
+        _igvn.register_new_node_with_optimizer(new_polladdr, polladdr);
+        set_ctrl(new_polladdr, iffalse);
+        sfpt->set_req(TypeFunc::Parms, new_polladdr);
         // When this code runs, loop bodies have not yet been populated.
         const bool body_populated = false;
         register_control(sfpt, outer_ilt, iffalse, body_populated);
@vnkozlov
Copy link
Contributor

@vnkozlov vnkozlov commented Mar 19, 2021

Yes, that is it.

@rwestrel why you need first clone?

Node* polladdr = sfpt->in(TypeFunc::Parms)->clone();

I think we can use original one because it is only used to copy notes in register_new_node_with_optimizer()

And do we always have this Load? May be runtime check instead of assert?

@rwestrel
Copy link
Contributor

@rwestrel rwestrel commented Mar 19, 2021

@rwestrel why you need first clone?

Right. It's likely not needed;

And do we always have this Load? May be runtime check instead of assert?

That I don't know.

@vnkozlov
Copy link
Contributor

@vnkozlov vnkozlov commented Mar 23, 2021

@Wanghuang-Huawei are you working on Roland's implementation? Or you want us to work on it?

Copy link
Contributor

@vnkozlov vnkozlov left a comment

Okay. Lets push the fix as suggested in match_fill_loop() and new test.
And I will file separate RFE for Roland's changes.

@openjdk
Copy link

@openjdk openjdk bot commented Mar 23, 2021

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

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

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

8263352: assert(use == polladr) failed: the use should be a safepoint polling

Co-authored-by: Wang Huang <whuang@openjdk.org>
Co-authored-by: Wu Yan <wuyan34@huawei.com>
Reviewed-by: 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 98 new commits pushed to the master branch:

  • 8d63bb6: 8260565: JFR: Fix copyright header in tests
  • 0b2aa1b: 8263978: Clarify why 0 argument is ignored in SecureRandom::setSeed
  • 15bcf6d: 8264055: backout JDK-8248904 in order to resubmit with additional attribution.
  • 2425462: 8263903: Use Cleaner instead of finalize to auto stop Timer thread
  • 35102cb: 8263992: Remove dead code NativeLookup::base_library_lookup
  • 91d86e6: 8263572: Output from jstack mixed mode is misaligned
  • 47ef038: 8263905: Remove finalize methods for SocketInput/OutputStream
  • 1c9817b: 8261479: CDS runtime code should check exceptions
  • 087c8bf: 8264041: Incorrect comments for ParallelCompactData::summarize_dense_prefix
  • c087f3e: 8263995: Incorrect double-checked locking in Types.arraySuperType()
  • ... and 88 more: https://git.openjdk.java.net/jdk/compare/9225a23023f3f18122247e85027146014ab2a07b...master

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.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@vnkozlov) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready label Mar 23, 2021
@Wanghuang-Huawei
Copy link
Contributor Author

@Wanghuang-Huawei Wanghuang-Huawei commented Mar 24, 2021

@Wanghuang-Huawei are you working on Roland's implementation? Or you want us to work on it?

I am not sure if polladdr->is_Load() is always true?

Okay. Lets push the fix as suggested in match_fill_loop() and new test.
And I will file separate RFE for Roland's changes.

Thank you for your review. I've renamed the test case (which can also be used as test case of JDK-8264063 ?) and pushed that.

@Wanghuang-Huawei
Copy link
Contributor Author

@Wanghuang-Huawei Wanghuang-Huawei commented Mar 24, 2021

I filed https://bugs.openjdk.java.net/browse/JDK-8264063

Thank you for your work !

@vnkozlov
Copy link
Contributor

@vnkozlov vnkozlov commented Mar 24, 2021

Yes, the test will be very useful for 8264063. The test looks good now.

@Wanghuang-Huawei
Copy link
Contributor Author

@Wanghuang-Huawei Wanghuang-Huawei commented Mar 24, 2021

/integrate

@openjdk openjdk bot added the sponsor label Mar 24, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Mar 24, 2021

@Wanghuang-Huawei
Your change (at version d0e7a27) is now ready to be sponsored by a Committer.

@vnkozlov
Copy link
Contributor

@vnkozlov vnkozlov commented Mar 24, 2021

/sponsor

@openjdk openjdk bot closed this Mar 24, 2021
@openjdk openjdk bot removed the rfr label Mar 24, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Mar 24, 2021

@vnkozlov @Wanghuang-Huawei Since your change was applied there have been 98 commits pushed to the master branch:

  • 8d63bb6: 8260565: JFR: Fix copyright header in tests
  • 0b2aa1b: 8263978: Clarify why 0 argument is ignored in SecureRandom::setSeed
  • 15bcf6d: 8264055: backout JDK-8248904 in order to resubmit with additional attribution.
  • 2425462: 8263903: Use Cleaner instead of finalize to auto stop Timer thread
  • 35102cb: 8263992: Remove dead code NativeLookup::base_library_lookup
  • 91d86e6: 8263572: Output from jstack mixed mode is misaligned
  • 47ef038: 8263905: Remove finalize methods for SocketInput/OutputStream
  • 1c9817b: 8261479: CDS runtime code should check exceptions
  • 087c8bf: 8264041: Incorrect comments for ParallelCompactData::summarize_dense_prefix
  • c087f3e: 8263995: Incorrect double-checked locking in Types.arraySuperType()
  • ... and 88 more: https://git.openjdk.java.net/jdk/compare/9225a23023f3f18122247e85027146014ab2a07b...master

Your commit was automatically rebased without conflicts.

Pushed as commit 6e3a158.

💡 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
3 participants