8313713: Allow CompileCommand flag to specify compilation level#30352
8313713: Allow CompileCommand flag to specify compilation level#30352kirill-shirokov wants to merge 20 commits intoopenjdk:masterfrom
Conversation
…ial draft implementation
…uld_not_inline(). Replace compiler arument with comp_level in DirectivesStack::getMatchingDirective()
…. Fix level checking in WB_IsMethodCompilable()
…n ClearDirectivesFileStackTest. Sort includes. Update copyright year.
…evel is excluded for the method. Fix WB_IsMethodCompilable for levels 1-3
…mpileonly and exclude CompileCommands with a level argument
…tput without WhiteBox
…o communicate with testee via stdin
…se added to CompileLevelParseTest.java. CompileTask::release_direcive() added for ownership clarity. Null pointer crash fixed in CompilationPolicy::select_task()
|
👋 Welcome back kshiroko! A progress list of the required criteria for merging this PR into |
|
❗ This change is not yet ready to be integrated. |
|
@kirill-shirokov The following label will be automatically applied to this pull request:
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. |
Webrevs
|
vnkozlov
left a comment
There was a problem hiding this comment.
Nice work, thank you. I have few comments.
| if (compile_state == nullptr) { | ||
| // This compile didn't come through the CompileBroker so perform the printing here | ||
| DirectiveSet* directive = DirectivesStack::getMatchingDirective(method, compiler); | ||
| DirectiveSet* directive = DirectivesStack::getMatchingDirective(method, compiler == nullptr || compiler->is_c1() ? CompLevel_simple : CompLevel_full_optimization); |
There was a problem hiding this comment.
At this point compiler should be JVMCI compiler and not NULL. It used in nmethod::new_nmethod() during registration. So, just use CompLevel_full_optimization here.
| option(Quiet, "quiet", Unknown) \ | ||
| option(Log, "log", Bool) \ | ||
| option(Print, "print", Bool) \ | ||
| option(Print, "print", Intx) \ |
There was a problem hiding this comment.
For an other RFE. intx is 64 bits in 64-bits VM we have now. We should introduce normal int for small values like you added in these changes.
| if (max_task != nullptr && max_method != nullptr) { | ||
| methodHandle max_method_h(THREAD, max_method); | ||
| DirectiveSet * directive = DirectivesStack::getMatchingDirective(max_method_h, CompLevel_limited_profile); |
There was a problem hiding this comment.
Is it possible to use and update task->directive() here? Because max_task->set_comp_level(CompLevel_limited_profile) will not match it - it was created for CompLevel_full_profile.
| // All C1 levels | 7 | ||
| // All levels | 15 | ||
| inline int comp_level_bitmask(int comp_level) { | ||
| assert(comp_level > 0 && comp_level < CompLevel_count, "CompLevel out of bounds"); |
There was a problem hiding this comment.
Use CompLevel_none instead of 0.
| } | ||
| // clear the stack | ||
| builder.add(new JcmdCommand(Command.NONEXISTENT, null, null, | ||
| builder.add(new JcmdCommand(Command.NONEXISTENT, true, null, null, |
There was a problem hiding this comment.
Don you know how we were able to run it before? The JcmdCommand was changed 3 years ago.
There was a problem hiding this comment.
I just came across this package and this file did not compile, so I fixed it.
Technically it does not belong to this PR. I can file a separate bug and fix it there, if needed.
Implemented intx arguments in -XX:CompileCommand={break,compileonly,exclude,print} commands that allow to select specific compilation levels.
E.g.
-XX:CompileCommand=compileonly,java/lang/Object::wait,9would allow to compile the wait() method only on CompLevel 1 and 4 (1 << (4 - 1) | 1 << (1 - 1) == 9).For compatibility with the old format, specifying the commands without intx argument is also supported. In this case all levels will be covered (using a default value of 15). Specifying boolean values is not supported anymore.
New tests are provided and I ran them manually. The tests are not included into any tiers yet.
Some implementation choices I made (and I open to discussing/modifying them):
CompilationPolicy::select_task(), see line 817+CodeInstaller::install()method processes compilation level like this:DirectiveSet* directive = DirectivesStack::getMatchingDirective(method, compiler == nullptr || compiler->is_c1() ? CompLevel_simple : CompLevel_full_optimization);Please let me know if this needs changing.
C2V_VMENTRY_0(jboolean, hasNeverInlineDirective,(JNIEnv* env, jobject, ARGUMENT_PAIR(method))):return !Inline || CompilerOracle::should_not_inline(method, CompLevel_full_optimization) || method->dont_inline();(level 4 is assumed, please let me know if this has to be changed)
Verified by running tier1 tests on linux + macosx aarch64.
Progress
Issue
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/30352/head:pull/30352$ git checkout pull/30352Update a local copy of the PR:
$ git checkout pull/30352$ git pull https://git.openjdk.org/jdk.git pull/30352/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 30352View PR using the GUI difftool:
$ git pr show -t 30352Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/30352.diff
Using Webrev
Link to Webrev Comment