On Tue, 26 Jan 2021 12:01:30 GMT, Coleen Phillimore <cole...@openjdk.org> wrote:
>> I assume a WXVerifier class that tracks W^X mode in debug mode and does >> nothing in release mode. I've considered to do this, it's relates to small >> inefficiencies, while this patch brings zero overhead (in release) for a >> platform that does not need W^X. >> * We don't need thread instance in release to call >> `os::current_thread_enable_wx`. Having WXVerifier a part of the Thread will >> require calling `Thread::current()` first and we could only hope for >> compiler to optimize this out, not sure if it will happen at all. In some >> contexts the Thread instance is available, in some it's not. >> * An instance of the empty class (as WXVerifier will be in the release) will >> occupy non-zero space in the Thread instance. >> >> If such costs are negligible, I can do as suggested. > > I really just want the minimal number of lines of code and hooks in > thread.hpp. You can still access it through the thread, just like these > lines currently. Look at HandshakeState as an example. Please take a look at the recent changes. Changes in thread.hpp were reduced: https://github.com/openjdk/jdk/pull/2200/files#diff-abdc409967d04172ecc20e3747aa55a79e755584d570b57c4d58902a9813d188 thread.inline.hpp provides definitions of accessors (non-trivial): https://github.com/openjdk/jdk/pull/2200/files#diff-3a29f7f952bf2bd936f49e97cb3b86a7324851133e879c142dec724455310b50 And new threadWXSetters.hpp defines RAII context setter: https://github.com/openjdk/jdk/pull/2200/files#diff-6424782ec43941031282f079e89adaa76d341ce340a3b78b0e9657358ec16278 ------------- PR: https://git.openjdk.java.net/jdk/pull/2200