Question about ZAddress::finalizable_good and ZAddress::mark_good
Hi all, I notice the methods `ZAddress::finalizable_good` and `ZAddress::mark_good` have the following code, which are very strange and confuse me. ``` const uintptr_t non_mark_bits_mask = ZPointerMarkMetadataMask ^ ZPointerAllMetadataMask; const uintptr_t non_mark_prev_bits = untype(prev) & non_mark_bits_mask; return color(addr, <other contents> | non_mark_prev_bits | ZPointerRememberedMask); ``` The expression `ZPointerMarkMetadataMask ^ ZPointerAllMetadataMask` would have the result `48`, which is equal to `ZPointerRememberedMask`. Then the expression `non_mark_prev_bits | ZPointerRememberedMask` in the last statement will always be `48` as well. So I think the first two statements which compute the `non_mark_prev_bits` can be removed or simplified. What do you think about it? Any ideas are appreciated. Best Regards, -- Guoxiong
Hi Guoxiong, On 2024-04-19 15:51, Guoxiong Li wrote:
Hi all,
I notice the methods `ZAddress::finalizable_good` and `ZAddress::mark_good` have the following code, which are very strange and confuse me.
``` const uintptr_t non_mark_bits_mask = ZPointerMarkMetadataMask ^ ZPointerAllMetadataMask; const uintptr_t non_mark_prev_bits = untype(prev) & non_mark_bits_mask; return color(addr, <other contents> | non_mark_prev_bits | ZPointerRememberedMask); ```
The expression `ZPointerMarkMetadataMask ^ ZPointerAllMetadataMask` would have the result `48`, which is equal to `ZPointerRememberedMask`. Then the expression `non_mark_prev_bits | ZPointerRememberedMask` in the last statement will always be `48` as well.
So I think the first two statements which compute the `non_mark_prev_bits` can be removed or simplified. What do you think about it? Any ideas are appreciated.
Yes, the code gradually changed until the point that this doesn't make any sense anymore. FWIW, If you want to read about why we add in ZPointerRememberedMask, se the comment starting with: // ... then the explanation. Time to put your seat belt on. Thanks, StefanK
Best Regards, -- Guoxiong
Hi Stefan, Thanks for your answer.
Yes, the code gradually changed until the point that this doesn't make any sense anymore.
Filed https://bugs.openjdk.org/browse/JDK-8330693 to follow up. FWIW, If you want to read about why we add in ZPointerRememberedMask, se
the comment starting with: // ... then the explanation. Time to put your seat belt on.
Thanks for the guide. I will read/investigate it later. Best Regards, -- Guoxiong
participants (2)
-
Guoxiong Li
-
Stefan Karlsson