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

8276571: C2: pass compilation options as structure #6237

Closed
wants to merge 3 commits into from

Conversation

vnkozlov
Copy link
Contributor

@vnkozlov vnkozlov commented Nov 3, 2021

Currently we pass several compilation options as separate arguments to Compile:

Compile C(env, target, entry_bci, subsume_loads, do_escape_analysis, eliminate_boxing, do_locks_coarsening, install_code, directive); 

Originally we had only subsume_loads option but we added few since then and we may add more.

I suggest to add new Options class to pass these values into Compile.


Progress

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

Issue

  • JDK-8276571: C2: pass compilation options as structure

Reviewers

Reviewing

Using git

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

Update a local copy of the PR:
$ git checkout pull/6237
$ git pull https://git.openjdk.java.net/jdk pull/6237/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 6237

View PR using the GUI difftool:
$ git pr show -t 6237

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/6237.diff

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Nov 3, 2021

👋 Welcome back kvn! 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 Nov 3, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Nov 3, 2021

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

  • hotspot

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 label Nov 3, 2021
@mlbridge
Copy link

@mlbridge mlbridge bot commented Nov 3, 2021

Webrevs

Copy link
Contributor

@shipilev shipilev left a comment

I like the way it is going, but unfortunately I find the list of unnamed boolean arguments as confusing and error-prone as before... Could we use "named parameters idiom" here, or some other way to name these parameters?

Something like:

class Options {
  Options() : _subsume_loads(false), _do_escape_analysis(false) {};
  Options& subsume_loads() { _subsume_loads = true; return *this; }
  Options& do_escape_analysis() { _do_escape_analysis = true; return *this; }
}

@@ -487,25 +487,25 @@ CompileWrapper::~CompileWrapper() {
void Compile::print_compile_messages() {
#ifndef PRODUCT
// Check if recompiling
if (_subsume_loads == false && PrintOpto) {
if ((subsume_loads() == false) && PrintOpto) {
Copy link
Contributor

@shipilev shipilev Nov 4, 2021

Choose a reason for hiding this comment

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

Suggested change
if ((subsume_loads() == false) && PrintOpto) {
if (!subsume_loads() && PrintOpto) {

Copy link
Contributor Author

@vnkozlov vnkozlov Nov 4, 2021

Choose a reason for hiding this comment

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

done

Copy link
Contributor

@shipilev shipilev left a comment

All right, this works too. Next user of Options would probably have to introduce per-use factory methods to disambiguate constructors, so maybe we could do this early on.

class Options {
  static Options for_runtime_stub_gen() const {
    return Options(
       /* subsume_loads = */ true,
       /* do_escape_analysis = */ false,
       /* eliminate_boxing = */ false,
       /* do_lock_coarsening = */ false,
       /* install_code = */ true
    );
  }
}

@openjdk
Copy link

@openjdk openjdk bot commented Nov 4, 2021

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

8276571: C2: pass compilation options as structure

Reviewed-by: shade, chagedorn

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

  • 96c396b: 8276151: AArch64: Incorrect result for double to int vector conversion
  • 7281861: 8272065: jcmd cannot rely on the old core reflection implementation which will be changed after JEP 416
  • 8e17ce0: 8275185: Remove dead code and clean up jvmstat LocalVmManager
  • 396132f: 8275509: ModuleDescriptor.hashCode isn't reproducible across builds
  • 9ad4d3d: 8276025: Hotspot's libsvml.so may conflict with user dependency
  • e21b5c7: 8276650: GenGraphs does not produce deterministic output
  • 7b1916e: 8233557: [TESTBUG] DoubleClickTitleBarTest.java fails on macOs
  • 8ec80c4: 8276653: Missing row headers in j.l.Character docs
  • 7e87f94: 8276652: Missing row headers in MethodHandles.Lookup docs
  • dcf36f8: 8275670: ciReplay: java.lang.NoClassDefFoundError when trying to load java/lang/invoke/LambdaForm$MH
  • ... and 25 more: https://git.openjdk.java.net/jdk/compare/c7f070f5f17dad661cc3296f2e3cd7a1cd5fc742...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 Nov 4, 2021
@vnkozlov
Copy link
Contributor Author

@vnkozlov vnkozlov commented Nov 4, 2021

Thank you, Aleksey, for review.

@vnkozlov
Copy link
Contributor Author

@vnkozlov vnkozlov commented Nov 4, 2021

All right, this works too. Next user of Options would probably have to introduce per-use factory methods to disambiguate constructors, so maybe we could do this early on.

I agree.

Copy link
Member

@chhagedorn chhagedorn left a comment

Looks good!

@vnkozlov
Copy link
Contributor Author

@vnkozlov vnkozlov commented Nov 5, 2021

Thank you, Aleksey and Christian.

@vnkozlov
Copy link
Contributor Author

@vnkozlov vnkozlov commented Nov 5, 2021

/integrate

@openjdk
Copy link

@openjdk openjdk bot commented Nov 5, 2021

Going to push as commit a74a839.
Since your change was applied there have been 42 commits pushed to the master branch:

  • c393ee8: 8276632: Use blessed modifier order in security-libs code
  • 7023b3f: 8276628: Use blessed modifier order in serviceability code
  • b933136: 8276641: Use blessed modifier order in jshell
  • 0616d86: 8276635: Use blessed modifier order in compiler code
  • d95299a: 8276634: Remove usePlainDatagramSocketImpl option from the test DatagramChannel/SendReceiveMaxSize.java
  • 3c0faa7: 8276173: Clean up and remove unneeded casts in HeapDumper
  • 323d201: 8275506: Rename allocated_on_stack to allocated_on_stack_or_embedded
  • 96c396b: 8276151: AArch64: Incorrect result for double to int vector conversion
  • 7281861: 8272065: jcmd cannot rely on the old core reflection implementation which will be changed after JEP 416
  • 8e17ce0: 8275185: Remove dead code and clean up jvmstat LocalVmManager
  • ... and 32 more: https://git.openjdk.java.net/jdk/compare/c7f070f5f17dad661cc3296f2e3cd7a1cd5fc742...master

Your commit was automatically rebased without conflicts.

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

@openjdk openjdk bot commented Nov 5, 2021

@vnkozlov Pushed as commit a74a839.

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

@vnkozlov vnkozlov deleted the JDK-8276571 branch Nov 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot integrated
3 participants