RFR: 8340297: Use-after-free recognition for metaspace and class space [v4]
Axel Boldt-Christmas
aboldtch at openjdk.org
Mon Aug 25 05:13:58 UTC 2025
On Wed, 20 Aug 2025 04:53:37 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
>> src/hotspot/share/oops/metadata.hpp line 49:
>>
>>> 47: static constexpr uint32_t common_prefix_mask = BUILD_32(0xFFFF, 0);
>>> 48: static constexpr uint32_t instance_klass_token = BUILD_32(0x3E7A, 0x100);
>>> 49: static constexpr uint32_t array_klass_token = BUILD_32(0x3E7A, 0x101);
>>
>> Nit / question: Any particular reason we're building the tokens with `BUILD_32(high, low)` instead of writing out the full literal (e.g. `0x3E7A0100`)? Is it mainly for readability or are there other considerations?
>
> None whatsoever, apart from readability. I changed to use plain constants.
You can use `'` as a digit separator. If that was the readability you were looking after.
```c++
static constexpr uint32_t common_prefix = 0x3E7A'0000;
static constexpr uint32_t common_prefix_mask = 0xFFFF'0000;
static constexpr uint32_t instance_klass_token = 0x3E7A'0101;
static constexpr uint32_t array_klass_token = 0x3E7A'0102;
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25891#discussion_r2297128203
More information about the hotspot-dev
mailing list