RFR: JDK-8296437: NMT incurs costs if disabled [v2]
Thomas Stuefe
stuefe at openjdk.org
Mon Nov 14 07:41:57 UTC 2022
On Mon, 14 Nov 2022 03:44:35 GMT, Ioi Lam <iklam at openjdk.org> wrote:
>> Thomas Stuefe has updated the pull request incrementally with two additional commits since the last revision:
>>
>> - reduce unnecessary diffs
>> - explicit constructor for fake callstacks; revert default ctor
>
> src/hotspot/share/utilities/nativeCallStack.hpp line 67:
>
>> 65: static constexpr uintptr_t _fake_address =
>> 66: (LP64_ONLY(0x4E4D54535441434BULL) // "NMTSTACK"
>> 67: NOT_LP64(0x4E4D5453)); // "NMTS"
>
> There's no guarantee that these addresses will never be a valid return address, so you may get suprious assertion failures. Since this is used only in debug mode for assertion, I think it's much better to have an extra field `bool _is_fake`.
Note that spurious asserts would be *extremely* unlikely. It would involve
- a 32-bit platform, since for 64-bit the chance is astronomically low and we are out of the usable address range for user space at least on Linux anyway.
- a platform where code pointers can be unaligned, so it rules out all but x86 ans s390
- NMT on and in detail mode
- a debug build.
Adding an explicit bool would increase the size of NMT callstacks by at least 32-bit. While that is not a show-stopper, I'd like to avoid it if possible. If we restrict it to debug only, we have a different memory layout between debug and release, which I don't like much either.
I try to think of something.
-------------
PR: https://git.openjdk.org/jdk/pull/11040
More information about the hotspot-dev
mailing list