RFR: 8297534: Specify the size of MEMFLAGS [v2]
Johan Sjölen
jsjolen at openjdk.org
Thu Nov 24 11:25:21 UTC 2022
> Hi!
>
> In MallocHeader we assume that MEMFLAGS can be stored in a uint8_t, see:
>
> ```c++
> class MallocHeader {
>
> NOT_LP64(uint32_t _alt_canary);
> const size_t _size;
> const uint32_t _mst_marker;
> const uint8_t _flags;
> const uint8_t _unused;
> uint16_t _canary;
> // SNIP!
> inline MEMFLAGS flags() const { return (MEMFLAGS)_flags; }
>
>
> With C++11 we can specify the underlying type of an `enum class`, so let's just do that. If we generate 257 memflags we'll get a compile error. I don't believe that this would lead to any change in the behavior of the code.
>
> Testing: Compiled the code. Running tier1 testing right now.
Johan Sjölen has updated the pull request incrementally with one additional commit since the last revision:
Make _flags be of type MEMFLAGS
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/11336/files
- new: https://git.openjdk.org/jdk/pull/11336/files/046f6abc..ce9a1d24
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=11336&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=11336&range=00-01
Stats: 3 lines in 2 files changed: 0 ins; 0 del; 3 mod
Patch: https://git.openjdk.org/jdk/pull/11336.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/11336/head:pull/11336
PR: https://git.openjdk.org/jdk/pull/11336
More information about the hotspot-runtime-dev
mailing list