RFR: 8367689: Revert removal of several compilation-related vmStructs fields [v2]

Francesco Andreuzzi fandreuzzi at openjdk.org
Tue Sep 16 22:25:11 UTC 2025


On Tue, 16 Sep 2025 19:13:39 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> src/hotspot/share/runtime/vmStructs.cpp line 677:
>> 
>>> 675:   nonstatic_field(CompilerThread,              _env,                                          ciEnv*)                                \
>>> 676:   nonstatic_field(ciEnv,                       _task,                                         CompileTask*)                          \
>>> 677:   c2_nonstatic_field(Compile,                  _method,                                       ciMethod*)                             \
>> 
>> 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.
>
> Add a comment that these fields are needed.

>  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.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/27318#discussion_r2353458447


More information about the graal-dev mailing list