On Wed, 19 Nov 2025 15:20:31 GMT, Matthias Baesken <[email protected]> wrote:
> There seem to be attributes for this kind of use case in clang, e.g. retain > https://reviews.llvm.org/D97447 > https://clang.llvm.org/docs/AttributeReference.html#retain > Should we add this to 'class Metadata' ? > If we can do it with attributes or something similar (and without changing > lots of code locations) it sounds better to me than adjusting the coding. > 'Pseudo dead' stuff that is used from external tools (so it is not really > 'dead' in practise) should be somehow marked to assist the tools. > There is also an attribute 'used' that looks similar. I tried the following but it didn't work. Perhaps I don't have the syntax right: --- a/src/hotspot/share/oops/metadata.hpp +++ b/src/hotspot/share/oops/metadata.hpp @@ -30,6 +30,7 @@ #include "utilities/ostream.hpp" // This is the base class for an internal Class related metadata +#pragma retain Metadata class Metadata : public MetaspaceObj { // Debugging hook to check that the metadata has not been deleted. NOT_PRODUCT(int _valid;) Note `retain` and `used` are listed under function attributes. They probably don't apply to data. ------------- PR Comment: https://git.openjdk.org/jdk/pull/28319#issuecomment-3553656342
