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

Andrei Pangin apangin at openjdk.org
Tue Sep 16 22:25:12 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.

@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](https://github.com/async-profiler/async-profiler/blob/master/docs/AdvancedStacktraceFeatures.md#display-jit-compilation-task) that embeds method name of the current compile task right in the C1/C2 stack traces.

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

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


More information about the graal-dev mailing list