We are using deprecation warnings to block the use of certain C functions that we don't want HotSpot code to (normally) use. The same approach can be taken to block the use of most global allocation and deallocation functions. But we need to make the deprecation declarations visible to potential users.
JDK-8369186 proposes the use of wrappers for Standard Library headers. Such a wrapper for <new> would provide a place for such deprecation declarations. This is generally an improvement on the existing link-time check for references to these functions, since it happens at compile time and the warning provides the context of the reference, rather than trying to infer it from an objdump.
It's not completely bulletproof, since 3rd-party headers might include <new> directly, making those functions accessible to HotSpot code without an inclusion of our wrapper. But following include-what-you-use style, that problem should be minimized.
It's also not completely bulletproof, since there are a few allocation and deallocation functions that are implicitly declared in all translation units. So we still need the existing link-time check for references to those.
JDK-8369186 proposes the use of wrappers for Standard Library headers. Such a wrapper for <new> would provide a place for such deprecation declarations. This is generally an improvement on the existing link-time check for references to these functions, since it happens at compile time and the warning provides the context of the reference, rather than trying to infer it from an objdump.
It's not completely bulletproof, since 3rd-party headers might include <new> directly, making those functions accessible to HotSpot code without an inclusion of our wrapper. But following include-what-you-use style, that problem should be minimized.
It's also not completely bulletproof, since there are a few allocation and deallocation functions that are implicitly declared in all translation units. So we still need the existing link-time check for references to those.
- is blocked by
-
JDK-8369186 HotSpot Style Guide should permit some uses of the C++ Standard Library
-
- New
-
- relates to
-
JDK-8369188 Update link-time check for HotSpot uses of allocation and deallocation functions
-
- Open
-