RFR: 8324129: C2: Remove some ttyLocker usages in preparation for JDK-8306767

David Holmes dholmes at openjdk.org
Mon Jan 22 10:32:34 UTC 2024


On Fri, 19 Jan 2024 07:46:13 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> src/hotspot/share/code/nmethod.hpp line 624:
>> 
>>> 622:   // print output in opt build for disassembler library
>>> 623:   void print_relocations()                        PRODUCT_RETURN;
>>> 624:   void print_pcs() { print_pcs_on(tty); }
>> 
>> This is a very common pattern, so I was wondering why you got rid of it?
>
> There is simply no use of `print_pcs` any more, I changed everything to `print_pcs_on`.
> So I thought I'd remove it, is that ok?
> Plus: `print_pcs` used to be the virtual method, and `print_pcs_on` only a local method, that was called by this override. But now I'd rather use `print_pcs_on` with a parameter outputStream, and so I made that one the virtual method.

It is kind of undoing a well established pattern/convention though. We could replace all `print_foo()` with `print_foo_on(tty)` and so render `print_foo()` unnecessary - but that defeats the whole point of the pattern.

Can't comment on the virtual/non-virtual aspect: not sure what the right/best arrangement is for that.

Anyway, not requesting any changes, just curious about the motivation.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17486#discussion_r1461655725


More information about the hotspot-dev mailing list