Skip to content

Conversation

@iklam
Copy link
Member

@iklam iklam commented Apr 17, 2024

CompileCommand is used both as a enum type (compilerOracle.hpp), and a global variable (compiler_globals.hpp).

This makes very awkward to the enum type -- we are forced to use enum CompileCommand in the source code whenever a type is needed:

This simple c++ file illustrates the problem:

enum class CompileCommand { a, b, c };
void foo(CompileCommand x) {}
char* CompileCommand; // can no longer use "CompileCommand" as a type
void good(enum CompileCommand x) {}
void bad(CompileCommand x) {}

$ g++ -c ~/enum.cpp
/home/iklam/enum.cpp:5:6: error: variable or field ?bad? declared void
    5 | void bad(CompileCommand x) {}

The fix is to rename the enum type to CompileCommandEnum.

This also makes it possible to forward-declare CompileCommandEnum (see vmEnum.hpp) without including compilerOracle.hpp. This improves HotSpot build time by reducing the number of .o files that include compilerOracle.hpp from 456 to 16.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8330540: Rename the enum type CompileCommand to CompileCommandEnum (Enhancement - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/18829/head:pull/18829
$ git checkout pull/18829

Update a local copy of the PR:
$ git checkout pull/18829
$ git pull https://git.openjdk.org/jdk.git pull/18829/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 18829

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/18829.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 17, 2024

👋 Welcome back iklam! 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
Copy link

openjdk bot commented Apr 17, 2024

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

8330540: Rename the enum type CompileCommand to CompileCommandEnum

Reviewed-by: kvn, dlong

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 no new commits pushed to the master branch. If another commit should be pushed before you perform the /integrate command, your PR will be automatically rebased. If you prefer to avoid any potential 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 rfr Pull request is ready for review label Apr 17, 2024
@openjdk
Copy link

openjdk bot commented Apr 17, 2024

@iklam The following labels will be automatically applied to this pull request:

  • graal
  • hotspot

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

@openjdk openjdk bot added graal graal-dev@openjdk.org hotspot hotspot-dev@openjdk.org labels Apr 17, 2024
@mlbridge
Copy link

mlbridge bot commented Apr 17, 2024

Webrevs

#include "code/scopeDesc.hpp"
#include "compiler/compileBroker.hpp"
#include "compiler/compilerEvent.hpp"
#include "compiler/compilerOracle.hpp"
Copy link
Contributor

Choose a reason for hiding this comment

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

Why you need it here?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's needed by this:

jvmciCompilerToVM.cpp:571:21: error: 'CompilerOracle' has not been declared
  571 |   return !Inline || CompilerOracle::should_not_inline(method) || method->dont_inline();

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.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Apr 17, 2024
@dean-long
Copy link
Member

The char* CompileCommand for the flag seems to be used much less than the enum (I could only find it used once). So if we could rename that variable, that would be a simpler solution. But it looks like that would require some advanced macro tricks in DECLARE_FLAGS to allow customization on a per-flag basis.

@iklam
Copy link
Member Author

iklam commented Apr 20, 2024

Thanks @dean-long and @vnkozlov for the review
/integrate

@openjdk
Copy link

openjdk bot commented Apr 20, 2024

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

  • f6feeb0: 8330703: Improve link syntax in javax.lang.model.util
  • df04358: 8330179: Clean up non-standard use of /** comments in jdk.compiler
  • c1dd82b: 8329644: Discuss expected visitor evolution patterns in javax.lang.model.util
  • b704e91: 8329433: Reduce nmethod header size
  • 8da175d: 8330008: [s390x] Test bit "in-memory" in case of DiagnoseSyncOnValueBasedClasses
  • 3c1d1d9: 8320522: Remove code related to RegisterFinalizersAtInit
  • 650ca65: 8329330: NoClassDefFoundError: Could not initialize class jdk.jfr.internal.MirrorEvents
  • 177092b: 8330569: Rename Nix to Posix in platform-dependent attachListener code
  • eb60822: 8310072: JComboBox/DisabledComboBoxFontTestAuto: Enabled and disabled ComboBox does not match in these LAFs: GTK+
  • 85261bc: 8330266: RISC-V: Restore frm to RoundingMode::rne after JNI
  • ... and 4 more: https://git.openjdk.org/jdk/compare/32946e1882e9b22c983cbba3c6bda3cc7295946a...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Apr 20, 2024
@openjdk openjdk bot closed this Apr 20, 2024
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Apr 20, 2024
@openjdk
Copy link

openjdk bot commented Apr 20, 2024

@iklam Pushed as commit 6d56996.

💡 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

graal graal-dev@openjdk.org hotspot hotspot-dev@openjdk.org integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

3 participants