- 
                Notifications
    
You must be signed in to change notification settings  - Fork 6.1k
 
8367689: Revert removal of several compilation-related vmStructs fields #27318
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
Conversation
| 
          
 👋 Welcome back fandreuzzi! A progress list of the required criteria for merging this PR into   | 
    
| 
           @fandreuz 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: 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 37 new commits pushed to the  
 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. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@coleenp, @kevinjwalls) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type   | 
    
          
Webrevs
  | 
    
| \ | ||
| nonstatic_field(CompilerThread, _env, ciEnv*) \ | ||
| nonstatic_field(ciEnv, _task, CompileTask*) \ | ||
| c2_nonstatic_field(Compile, _method, ciMethod*) \ | 
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.
It would be really easy for someone to notice that these aren't used and delete them again, and it's unfortunate that this macro has to be propagated throughout all the vmStructs macros. I can see some external tool needing CompilerThread env and ciEnv task (the current compile task) but maybe this can not need Compile::_method?
Instead of adding the c2 macros, can you change the code to have:
COMPILER2_PRESENT(nontstatic_field(Compile, _method, ciMethod*))
COMPILER2_PRESENT(declare_toplevel_type(Compile))
etc.
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.
Add a comment that these fields are needed.
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 can see some external tool needing CompilerThread env and ciEnv task (the current compile task) but maybe this can not need Compile::_method?
This is how we use Compile::_method in Async-Profiler:
VMMethod* compiledMethod() {
    const char* env = *(const char**) at(_comp_env_offset);
    if (env != NULL) {
        const char* task = *(const char**) (env + _comp_task_offset);
        if (task != NULL) {
            return *(VMMethod**) (task + _comp_method_offset);
        }
    }
    return NULL;
}so we can get a jmethodID to the method being compiled. That's the only use case we have for these fields.
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.
@coleenp Good catch, thanks. Compile::_method is redundant, indeed. CompileTask::_method is what async-profiler needs, but it's still in place.
@fandreuz I think this PR can do without platform-dependent changes.
For the context, it's this feature that embeds method name of the current compile task right in the C1/C2 stack traces.
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.
Good catch, thanks. Compile::_method is redundant,
I see, thanks! 3a263b3
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 think this PR can do without platform-dependent changes.
Right, many things turned out to be unnecessary. Thanks
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.
Oh that is much better! Thanks.
| 
           Test failure seems unrelated: https://github.com/fandreuz/jdk/actions/runs/17780614141/job/50541594076#step:10:2426  | 
    
| static_field(VMRegImpl, stack0, VMReg) \ | ||
| \ | ||
| /**************/ \ | ||
| /* CI (NOTE: these fields should not be removed, they can be used by external tools) */ \ | 
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.
Can you also clarify what "external tools" are in the comment so that when/if those external tools stop using them, we can re-evaluate?
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.
Do you mean I should explicitly mention Async-Profiler?
| 
           We should clarify: Async-Profiler is great, but is this change the right solution? Are there other fields which other software would have liked to stay around, and what else can not be removed? Curious how did Async-Profiler break when these are removed? Is it a crash that Async-Profiler needs to workaround, or is there less information in the collected profile.  | 
    
| 
           @kevinjwalls Right, VMStructs is not a public supported interface, the JVM is not obliged to maintain it. Yet, some external tools (async-profiler and eBPF based profilers) softly rely on that in the lack of standard supported alternatives. At the same time, we are improving OpenJDK built-in capabilities that can eventually serve as such an alternative. A recent example is JEP 509: JFR CPU-Time Profiling. It's still a long path until JFR or other built-in tools can satisfy today's demand; in the meantime, VMStructs provides a temporary solution. VMStructs is a reasonable trade-off, very cheap from the maintenance perspective as opposed to AsyncGetCallTrace (async-profiler no longer depends on the latter). To emphasize, we do not expect others to maintain VM structures that async-profiler relies on, that is our (profiler + Corretto) responsibility. Infrequent changes will be small, localized and safe, like in this PR. As for the question how async-profiler breaks: if it is an optional feature (like here), it gracefully reduces functionality. Async-profiler attempts to detect essential VM changes and fail fast to prevent from crashing at runtime.  | 
    
| 
           Thanks @apangin Andrei I thought we should be open and explicit about this, good to have that exchange in the review. Async-Profiler knew what it was getting into. 8-) In the comment being added above, what is it appropriate to say... Saying "should not removed... they can be used by external tools" as an instruction seems like an overreach. Maybe more like: "These CI fields are retained in VMStructs for the benefit of external tools, to ease their migration to a future alternative."  | 
    
| /* CI (NOTE: these CI fields are retained in VMStructs for the benefit of external tools, */ \ | ||
| /* to ease their migration to a future alternative. */ \ | ||
| /******************************************************************************************/ \ | ||
| \ | 
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.
oops just a missing close ), but yes other than that I think we're done 8-)
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.
Thanks, fixed in d7c4db0
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.
OK, thanks!
| 
           /integrate  | 
    
| 
           /sponsor  | 
    
| 
          
 Going to push as commit 4c5e901. 
 Your commit was automatically rebased without conflicts.  | 
    
| 
          
 @kevinjwalls @fandreuz Pushed as commit 4c5e901. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.  | 
    
| 
           /backport jdk25u  | 
    
| 
          
 @fandreuz the backport was successfully created on the branch backport-fandreuz-4c5e901c-master in my personal fork of openjdk/jdk25u. To create a pull request with this backport targeting openjdk/jdk25u:master, just click the following link: The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body: 
 If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk25u:  | 
    
#23782 (JDK-8315488) removed several vmStructs fields. A small subset was used in Async-Profiler:
I propose a small patch to bring them back. It helps third-party tools in building useful features on the JDK. For example, Async-Profiler uses these fields to display the current method being compiled in a compiler thread.
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/27318/head:pull/27318$ git checkout pull/27318Update a local copy of the PR:
$ git checkout pull/27318$ git pull https://git.openjdk.org/jdk.git pull/27318/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 27318View PR using the GUI difftool:
$ git pr show -t 27318Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/27318.diff
Using Webrev
Link to Webrev Comment