On Thu, 9 Apr 2026 13:04:28 GMT, Stefan Karlsson <[email protected]> wrote:

>> src/hotspot/share/oops/markWord.hpp line 142:
>> 
>>> 140:   static const int hash_shift                     = 
>>> valhalla_reserved_shift + valhalla_reserved_bits;
>>> 141: 
>>> 142:   #define mask_in_place(bits, shift) (right_n_bits(bits) << (shift))
>> 
>> Nit: I skimmed the HotSpot style guide and couldn't find anything regarding 
>> case, but I was under the impression we used all uppercase for runtime 
>> macros. For example, `#define DISABLE_FLAG_AND_WARN_IF_NOT_DEFAULT(flag)`.
>
> You are probably right, but I really dislike seeing screamy macros in my 
> code. I would rather just get rid of these macros and checks just to not have 
> to pollute this code with upper-case macros.
> 
> I had one version of this that used template functions, but I couldn't get it 
> to work confined to the markWord class. One alternative would be to put those 
> functions high up in the file, but I prefer to keep the markWord class the 
> first entity in this file. Another alternative would be to put it in 
> globalDefinitions.hpp, but `bit_in_place` is somewhat obscure because of the 
> static assert.
> 
> Let me think a little bit about this.

I removed the macros and added explicit static_asserts instead.

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

PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2310#discussion_r3058132401

Reply via email to