RFR: 8369187: Add wrapper for <new> that forbids use of global allocation and deallocation functions [v3]
Matthias Baesken
mbaesken at openjdk.org
Fri Jan 16 14:23:51 UTC 2026
On Sun, 16 Nov 2025 01:10:40 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:
>> 8369187: Add wrapper for <new> that forbids use of global allocation and deallocation functions
>>
>> Please review this change that adds `cppstdlib/new.hpp` as a wrapper for
>> including `<new>`. All existing inclusions of `<new>` are changed to include
>> the new wrapper.
>>
>> In additional to including `<new>`, this wrapper also provides deprecation
>> declarations to prevent the use of some facilities by HotSpot code.
>>
>> However, those deprecations need to be conditionalized to not apply to gtests,
>> so this change also adds a macro definition provided by the build system for
>> use in detecting that a header is being included by a gtest.
>>
>> Testing: mach5 tier1
>
> Kim Barrett has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains five commits:
>
> - Merge branch 'master' into wrap-stdlib-new
> - poison implicit alloc/dealloc in globalDefinitions
> - Merge branch 'master' into wrap-stdlib-new
> - further conditionalize deprecation of hardare interference sizes
> - add wrapper for <new>
When experimenting with the link time gc OpenJDK configure option , I notice that the 2 symbols hardware_destructive_interference_size / fgrep hardware_constructive_interference_size are eliminated more then 2000 (!) times from the objects of libjvm (I enabled verbose priting to see what is eliminated)
fgrep hardware_destructive_interference_size build.log | wc -l
2681
fgrep hardware_constructive_interference_size build.log | wc -l
2681
With default settings (no linktime gc) I see the symbol now in HS (fortunately only 2 times , not 2000+)
strings /linuxx86_64/jdk-opt/images/jdk/lib/server/libjvm.so | grep hardware_constructive_interference_size
_ZSt39hardware_constructive_interference_size
_ZSt39hardware_constructive_interference_size
Was this intended to got into libjvm.so ?
-------------
PR Comment: https://git.openjdk.org/jdk/pull/28250#issuecomment-3760241677
More information about the build-dev
mailing list