RFR: 8251438: Issues with our POSIX set_signal_handler()

Thomas Stuefe stuefe at openjdk.java.net
Sat Dec 12 07:34:58 UTC 2020


On Fri, 11 Dec 2020 19:33:07 GMT, Gerard Ziemski <gziemski at openjdk.org> wrote:

>> src/hotspot/os/posix/signals_posix.cpp line 743:
>> 
>>> 741: // Implementation may use the same storage for both the sa_sigaction field and the sa_handler field,
>>> 742: // so check for "sigAct.sa_flags == SA_SIGINFO"
>>> 743: static address get_signal_handler(struct sigaction action) {
>> 
>> This copies the structure by value. While the compiler will probably optimize this out, I'd still not do it. Please use 
>> static address get_signal_handler(const struct sigaction*) 
>>  
>> instead.
>
> Thank you Thomas for the review.
> 
> How about:
> 
> `static address get_signal_handler(struct sigaction &action)`
> 
> ?

Meh. I am not a big fan of references :) since at the call site they are indistinguishable from by-value parameters. But if you use them, please make them const.

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

PR: https://git.openjdk.java.net/jdk/pull/1680


More information about the hotspot-runtime-dev mailing list