-
Couldn't load subscription status.
- Fork 6.1k
8350097: Make Compilation::current() and Compile::current() safer #23635
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
8350097: Make Compilation::current() and Compile::current() safer #23635
Conversation
|
👋 Welcome back stuefe! A progress list of the required criteria for merging this PR into |
|
❗ This change is not yet ready to be integrated. |
3c2a32a to
a103b45
Compare
Webrevs
|
| #include "compiler/compilerDefinitions.inline.hpp" | ||
| #include "compiler/compilerDirectives.hpp" | ||
| #include "runtime/deoptimization.hpp" | ||
| #include "utilities/debug.hpp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DEBUG_ONLY lives in utilities/macros.hpp, include that one directly?
|
|
||
|
|
||
| static Compilation* current() { | ||
| DEBUG_ONLY(ciEnv::current()->check_compiler_data_c1_or_null();) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, can it be just some sort of:
assert(CompilerThread::current()->compiler()->is_c1(), "sanity");
...without any other changes in ciEnv?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Context: I think ciEnv is pretty compiler-agnostic, and it would be better to avoid exposing the fact C1/C2 exist to that interface, even if only for asserts. Seems cleaner to check that we are calling Compilation::current() from C1 and Compile::current() from C2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with Aleksey here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I like this too. Simpler. Okay, I try that.
|
If we derive C2 Compile and C1 Compilation from a common superclass, then ciEnv::compiler_data() could return that superclass and self-identify using a type field or virtual function. When looking into how we handle failure messages and how complicated it is, I thought moving some fields into a common superclass would be useful. Eventually we could even look into making ciEnv the common superclass, because the lifetimes are almost identical. |
This reverts commit e370e14.
I thought about that, but Compile inherits from Phase, so any common superclass becomes one of Phase, too. I did not want to change the inheritance structure to deal with such a tiny problem. |
|
Since the callers already need to know which compiler they are asking about, I don't see the value in forcing void* through a single interface. How about we improve things by replacing compiler_data with c1_compiler_data() and c2_compiler_data()? |
|
@tstuefe This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration! |
|
@tstuefe This pull request has been inactive for more than 8 weeks and will now be automatically closed. If you would like to continue working on this pull request in the future, feel free to reopen it! This can be done using the |
Somewhat trivial.
I recently hunted a bug for an hour until I realized that I had accessed ciEnv::compiler_data() as C2
Compilewhen, in fact, it was C1Compilation. Stupid mistake, but an assert is easy to do and saves time.Progress
Issue
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/23635/head:pull/23635$ git checkout pull/23635Update a local copy of the PR:
$ git checkout pull/23635$ git pull https://git.openjdk.org/jdk.git pull/23635/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 23635View PR using the GUI difftool:
$ git pr show -t 23635Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/23635.diff
Using Webrev
Link to Webrev Comment