RFR: 8264707: HotSpot Style Guide should permit use of lambda

Kim Barrett kbarrett at openjdk.java.net
Sat Aug 21 16:48:21 UTC 2021


On Sat, 21 Aug 2021 08:45:48 GMT, Andrew Haley <aph at openjdk.org> wrote:

> So here's an oink in the flightment:
> 
> ```
> macroAssembler_aarch64_aes.o: Error: Use of global operators new and delete is not allowed in Hotspot:
>                  U operator delete(void*)
>                  U operator new(unsigned long)
> See: /Users/aph/theRealAph-jdk/make/hotspot/lib/CompileJvm.gmk
> ```
> 
> This happened on MacOS/AArch64, and was caused by an apparently innocuous Lambda. GCC doesn't generate new and delete for this construct, but AArch64 clang does for some reason. And I guess it's true that C++ compilers are free to do this, and even if one compiler doesn't do so today, it might tomorrow.
> 
> What should we do? At least for my application, it doesn't matter if new and delete are used, but in some cases it might. Do we need a blanket prohibition against new and delete, when the programmer has no control over it?

Bleh!  Why would a lambda need new/delete?

Can you give more details about how you encountered this?  I've not seen
anything of the sort.

The purpose of that error is to prevent HotSpot code from bypassing NMT. NMT
can't just override the global operator new/delete because an application
might want to use its own for its native code.

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

PR: https://git.openjdk.java.net/jdk/pull/5144


More information about the hotspot-dev mailing list