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

8259619: C1: 3-arg StubAssembler::call_RT stack-use condition is incorrect #2048

Closed
wants to merge 2 commits into from

Conversation

shipilev
Copy link
Contributor

@shipilev shipilev commented Jan 12, 2021

SonarCould instance reports this code smell in c1_Runtime_x86.cpp: Identical sub-expressions on both sides of operator "||"

int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry, Register arg1, Register arg2, Register arg3) {
#ifdef _LP64
  // if there is any conflict use the stack
  if (arg1 == c_rarg2 || arg1 == c_rarg3 ||
      arg2 == c_rarg1 || arg1 == c_rarg3 ||
      arg3 == c_rarg1 || arg1 == c_rarg2) { <---- HERE
    push(arg3);
    push(arg2);
    push(arg1);
    pop(c_rarg1);
    pop(c_rarg2);
    pop(c_rarg3);
  } else {
    mov(c_rarg1, arg1);
    mov(c_rarg2, arg2);
    mov(c_rarg3, arg3);
  }

It seems obvious that the right column in the condition should have been arg1, arg2, arg3.

Additional testing:

  • Linux x86_64 tier1

Progress

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

Issue

  • JDK-8259619: C1: 3-arg StubAssembler::call_RT stack-use condition is incorrect

Reviewers

Download

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

@bridgekeeper
Copy link

bridgekeeper bot commented Jan 12, 2021

👋 Welcome back shade! 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 Jan 12, 2021
@openjdk
Copy link

openjdk bot commented Jan 12, 2021

@shipilev 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 Jan 12, 2021
@mlbridge
Copy link

mlbridge bot commented Jan 12, 2021

Webrevs

Copy link
Member

@chhagedorn chhagedorn left a comment

Good catch! That looks reasonable to me.

Can you also fix this in c1_Runtime1_aarch64.cpp?

@shipilev shipilev changed the title 8259619: C1, x86: 3-arg StubAssembler::call_RT stack-use condition is incorrect 8259619: C1: 3-arg StubAssembler::call_RT stack-use condition is incorrect Jan 12, 2021
@shipilev
Copy link
Contributor Author

shipilev commented Jan 12, 2021

Can you also fix this in c1_Runtime1_aarch64.cpp?

Oh! Fixed there too.

Copy link
Member

@chhagedorn chhagedorn left a comment

Thanks, looks good!

@openjdk
Copy link

openjdk bot commented Jan 12, 2021

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

8259619: C1: 3-arg StubAssembler::call_RT stack-use condition is incorrect

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

  • c338f11: 8259349: -XX:AvgMonitorsPerThreadEstimate=1 does not work right
  • ccac7aa: 8258932: AArch64: Enhance floating-point Min/MaxReductionV with fminp/fmaxp
  • 4c75d14: 8259374: Make ThreadInVMfromNative have ResetNoHandleMark
  • 563b268: 8257709: C1: Double assignment in InstructionPrinter::print_stack
  • 400dc76: 8252015: [macos11] java.awt.TrayIcon requires updates for template images
  • ac2dee5: 8259539: JDK-8255711 broke trap messages
  • 4697cfa: 8259576: Misplaced curly brace in Matcher::find_shared_post_visit
  • a6ab9e4: 8258576: Try to get zerobased CCS if heap is above 32 and CDS is disabled
  • a3561ae: 8258243: C2: assert failed ("Bad derived pointer") with -XX:+VerifyRegisterAllocator
  • 4663704: 8259583: Remove unused decode_env::_codeBuffer
  • ... and 29 more: https://git.openjdk.java.net/jdk/compare/18a37f9453cd1a5740da47b93ce6122052ccd43b...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.

➡️ 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 label Jan 12, 2021
Copy link
Contributor

@vnkozlov vnkozlov left a comment

Good.

@shipilev
Copy link
Contributor Author

shipilev commented Jan 13, 2021

Thanks!

/integrate

@openjdk openjdk bot closed this Jan 13, 2021
@openjdk openjdk bot added integrated and removed ready rfr labels Jan 13, 2021
@openjdk
Copy link

openjdk bot commented Jan 13, 2021

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

  • 2e12454: 8259580: Shenandoah: uninitialized label in VerifyThreadGCState
  • 77ca103: 8257236: can't use var with a class named Z
  • 2243a17: 8259485: Document need for short paths when building on Windows
  • 139b6da: 8259372: remove AIX related USE_LIBRARY_BASED_TLS_ONLY and THREAD_LOCAL special handling
  • a483869: 8225045: javax/swing/JInternalFrame/8146321/JInternalFrameIconTest.java fails on linux-x64
  • 44c8379: 8256019: JLabel HTML text does not support translucent text colors
  • 0957d9e: 8259519: The java.awt.datatransfer.DataFlavor#ioInputStreamClass field is redundant
  • 65bed64: 8253635: Implement toString() for SSLEngineImpl
  • c6d798c: 8259629: aarch64 builds fail after JDK-8258932
  • 4be2173: 8259319: Illegal package access when SunPKCS11 requires SunJCE's classes
  • ... and 42 more: https://git.openjdk.java.net/jdk/compare/18a37f9453cd1a5740da47b93ce6122052ccd43b...master

Your commit was automatically rebased without conflicts.

Pushed as commit ce94512.

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

@shipilev shipilev deleted the JDK-8259619-c1-call-rt branch Jan 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-compiler integrated
3 participants