On Wed, 24 Jun 2026 10:23:44 GMT, Andrew Dinn <[email protected]> wrote:

>> src/hotspot/share/code/vtableStubs.hpp line 197:
>> 
>>> 195: 
>>> 196: template <typename F>
>>> 197: void VtableStubs::vtable_stub_do(F f) {
>> 
>> Why did you move / update this function? IMHO we can keep current 
>> implementation.
>> (this change is for using lambda? I'm not sure)
>
> It allows the lambda to be used. That's fine by me.

To expand on what adinn said: In `CodeCache::write_perf_map`, we need to call 
`fs.print_cr(...)` for each vtable trampoline. That means we need access to 
`fs`, a local variable in `write_perf_map`. The old `vtable_stub_do` only took 
a function pointer, so it was not possible to access `fs` in the callback. With 
the template implementation of `vtable_stub_do`, `write_perf_map` can pass use 
a lambda that closes over `fs` as the callback.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/31638#discussion_r3467896347

Reply via email to