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

8262837: handle split_USE correctly #2791

Closed
wants to merge 3 commits into from
Closed

Conversation

kuaiwei
Copy link
Contributor

@kuaiwei kuaiwei commented Mar 2, 2021

I look into reg_split.cpp and found a potential issue.
Function split_USE usually creates a new spill copy node, but in some cases it just connect def to use and no new node created. But in caller side, they will assume it will create a new node. The code is like:

maxlrg = split_USE(...)
if (!maxlrg) {
   return 0;
}
insidx++;  // Reset iterator to skip USE side split

So if no node is created, the iterator index is updated and the next instruction will be skipped.

The change is let split_USE return the new node count, so the caller can update its index and maxlrg.


Progress

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

Issue

Reviewers

Download

$ git fetch https://git.openjdk.java.net/jdk pull/2791/head:pull/2791
$ git checkout pull/2791

@bridgekeeper
Copy link

bridgekeeper bot commented Mar 2, 2021

👋 Welcome back kuaiwei! 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 Mar 2, 2021
@openjdk
Copy link

openjdk bot commented Mar 2, 2021

@kuaiwei 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.

@kuaiwei
Copy link
Contributor Author

kuaiwei commented Mar 2, 2021

/label add hotspot-compiler

@openjdk openjdk bot added the hotspot-compiler hotspot-compiler-dev@openjdk.org label Mar 2, 2021
@openjdk
Copy link

openjdk bot commented Mar 2, 2021

@kuaiwei The hotspot-compiler label was already applied.

@mlbridge
Copy link

mlbridge bot commented Mar 2, 2021

Webrevs

src/hotspot/share/opto/reg_split.cpp Outdated Show resolved Hide resolved
@@ -272,15 +273,15 @@ uint PhaseChaitin::split_USE(MachSpillCopyNode::SpillType spill_type, Node *def,
}

Node *spill = get_spillcopy_wide(spill_type, def, use, useidx );
if( !spill ) return 0; // Bailed out
if( !spill ) return -1; // Bailed out
// Insert SpillCopy before the USE, which uses the reaching DEF as
// its input, and defs a new live range, which is used by this node.
insert_proj( b, bindex, spill, maxlrg++ );
Copy link
Contributor

Choose a reason for hiding this comment

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

maxlrg++ again

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Remove post-increment

@@ -1099,12 +1105,13 @@ uint PhaseChaitin::Split(uint maxlrg, ResourceArea* split_arena) {
Node *spill = new MachSpillCopyNode(MachSpillCopyNode::MemToReg, def, dmask, *tmp_rm);
insert_proj( b, insidx, spill, maxlrg );
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it missed maxlrg increment. May be also use insidx++ here so in the following code you need to increment only by delta.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added maxlrg++ and insidx++, the following insidx is added with delta

@@ -497,6 +498,7 @@ uint PhaseChaitin::Split(uint maxlrg, ResourceArea* split_arena) {

uint bidx, pidx, slidx, insidx, inpidx, twoidx;
uint non_phi = 1, spill_cnt = 0;
int delta;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it should be local variable where it is used.

Copy link
Contributor Author

@kuaiwei kuaiwei Mar 3, 2021

Choose a reason for hiding this comment

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

changed to local variable.

// Insert SpillCopy before the USE, which uses the reaching DEF as
// its input, and defs a new live range, which is used by this node.
insert_proj( b, bindex, spill, maxlrg++ );
// Use the spill/clone
use->set_req(useidx,spill);

// return updated live range count
return maxlrg;
// return generated node count
Copy link
Contributor

Choose a reason for hiding this comment

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

The comment is confusing. I would suggest to add comment at the header of this method to describe all returned values [-1, 0, 1].

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Add comment in method header of split_USE and remove this comment.

Copy link
Contributor

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

Good.
Passed tier1-4 testing.

@openjdk
Copy link

openjdk bot commented Mar 3, 2021

@kuaiwei 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:

8262837: handle split_USE correctly

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 33 new commits pushed to the master branch:

  • 84c93d5: 8257137: Revise smov and umov in aarch64 assembler
  • d93fa0d: 8253940: com/sun/jdi/JdwpAttachTest.java failed with "RuntimeException: ERROR: LingeredApp.startApp was able to attach"
  • 104a262: 8224775: test/jdk/com/sun/jdi/JdwpListenTest.java failed to attach
  • 2848938: 8262927: Explicitly state fields examined for BigDecimal.hashCode
  • b397472: 8262915: java.awt.color.ColorSpace.getName() is not thread-safe
  • 268d9b7: 8261447: MethodInvocationCounters frequently run into overflow
  • 75aa154: 8259267: Refactor LoaderLeak shell test as java test.
  • a118185: 8261862: Expand discussion of rationale for BigDecimal equals/compareTo semantics
  • 2d2ef08: 8262885: Shenandoah: FullGC prologue does not need to save/restore heap has_forwarded_object flag
  • 1d2c1e6: 8248314: Parallel: Parallelize parallel full gc Adjust Roots phase
  • ... and 23 more: https://git.openjdk.java.net/jdk/compare/dd33a8eaaab1e0a9bc816d08daedbfbb7f0d6c6a...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 Pull request is ready to be integrated label Mar 3, 2021
@kuaiwei
Copy link
Contributor Author

kuaiwei commented Mar 4, 2021

Good.
Passed tier1-4 testing.

Thanks for your help.

@kuaiwei
Copy link
Contributor Author

kuaiwei commented Mar 4, 2021

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Mar 4, 2021
@openjdk
Copy link

openjdk bot commented Mar 4, 2021

@kuaiwei
Your change (at version 1fa77b7) is now ready to be sponsored by a Committer.

@vnkozlov
Copy link
Contributor

vnkozlov commented Mar 4, 2021

/sponsor

@openjdk openjdk bot closed this Mar 4, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and removed sponsor Pull request is ready to be sponsored ready Pull request is ready to be integrated rfr Pull request is ready for review labels Mar 4, 2021
@openjdk
Copy link

openjdk bot commented Mar 4, 2021

@vnkozlov @kuaiwei Since your change was applied there have been 44 commits pushed to the master branch:

  • bd1a806: 8263040: fix for JDK-8262122 fails validate-source
  • a6427c8: 8259709: Disable SHA-1 XML Signatures
  • ef5e13d: 8263030: Remove Shenandoah leftovers from ReferenceProcessor
  • 222a17e: 8262122: [TESTBUG] Shenandoah-specific variant of TestReferenceRefersTo
  • a777e82: 8254717: isAssignableFrom checks in KeyFactorySpi.engineGetKeySpec appear to be backwards
  • d2c4ed0: 8262000: jdk/jfr/event/gc/detailed/TestPromotionFailedEventWithParallelScavenge.java failed with "OutOfMemoryError: Java heap space"
  • 94f26e4: 8261450: JShell crashes with SIOOBE in tab completion
  • b817855: 8262935: Add missing logging to sun.net.httpserver.ServerImpl
  • 2251319: 8262828: Format of OS information is different on macOS
  • 4cfecce: 8261730: C2 compilation fails with assert(store->find_edge(load) != -1) failed: missing precedence edge
  • ... and 34 more: https://git.openjdk.java.net/jdk/compare/dd33a8eaaab1e0a9bc816d08daedbfbb7f0d6c6a...master

Your commit was automatically rebased without conflicts.

Pushed as commit f56c918.

💡 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
Labels
hotspot-compiler hotspot-compiler-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

2 participants