jdk icon indicating copy to clipboard operation
jdk copied to clipboard

8372754: Add wrapper for <cstdlib>

Open kimbarrett opened this issue 2 months ago • 8 comments

Please review this change that adds a HotSpot wrapper for . It also includes the forbidden function declarations for functions declared there, moving them from forbiddenFunctions.hpp and friends.

The AIX-specific workaround for its macro-based renaming of malloc/calloc is also moved to this wrapper, so there is a single location for it. Also cleaned it up a bit, based on further investigation of the problem.

Also changed uses of and <stdlib.h> to include the wrapper instead. There are still a couple of includes of <stdlib.h> in the hotspot directory, because they can't use the hotspot wrapper: os/windows/include/jvm_md.h and share/adlc/adlc.hpp. I looked at removing the one in windows jvm_md.h, but there are a lot of dependencies on that implicit include in non-HotSpot code.

While updating to use the wrapper, I also did a small amount of include cleanup here and there. The changes around immediate_aarch64.hpp are perhaps a little less trivial than I should have made here.

Testing: mach5 tier1

This should probably be retested by aix port maintainer folks, although I don't think I made any relevant changes since you last tested it.

This change also resolves: /issue JDK-8369205


Progress

  • [ ] Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • [x] Change must not contain extraneous whitespace
  • [x] Commit message must refer to an issue

Issues

  • JDK-8372754: Add wrapper for <cstdlib> (Enhancement - P4)
  • JDK-8369205: AIX build break in forbiddenFunctions.hpp (Bug - P2)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/28562/head:pull/28562
$ git checkout pull/28562

Update a local copy of the PR:
$ git checkout pull/28562
$ git pull https://git.openjdk.org/jdk.git pull/28562/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 28562

View PR using the GUI difftool:
$ git pr show -t 28562

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/28562.diff

Using Webrev

Link to Webrev Comment

kimbarrett avatar Nov 29 '25 05:11 kimbarrett

:wave: Welcome back kbarrett! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

bridgekeeper[bot] avatar Nov 29 '25 05:11 bridgekeeper[bot]

@kimbarrett This change is no longer ready for integration - check the PR body for details.

openjdk[bot] avatar Nov 29 '25 05:11 openjdk[bot]

@kimbarrett The following label will be automatically applied to this pull request:

  • hotspot

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

openjdk[bot] avatar Nov 29 '25 05:11 openjdk[bot]

Are we using wrappers for C Standard Library headers as well now?

TheShermanTanker avatar Nov 29 '25 06:11 TheShermanTanker

@kimbarrett I've successfully built Temurin on our AIX 7.2 ndoe with this patch, many thanks https://ci.adoptium.net/job/build-scripts/job/jobs/job/jdk/job/jdk-aix-ppc64-temurin/457/console

andrew-m-leonard avatar Dec 01 '25 16:12 andrew-m-leonard

@kimbarrett Adding additional issue to issue list: 8369205: AIX build break in forbiddenFunctions.hpp.

openjdk[bot] avatar Dec 10 '25 22:12 openjdk[bot]

Are we using wrappers for C Standard Library headers as well now?

For those with corresponding C++ headers, yes. Those .h files were deprecated forever, but then in some more recent C++ Standard they were undeprecated but described as being intented for use only in code that was intended to be valid as both C and C++.

I'm thinking we might want to introduce wrappers for at least some other C library headers, again as a shared place HotSpot-specific tailoring. But that's something for (possibly much) later. First working through the C++ Standard Library headers.

kimbarrett avatar Dec 10 '25 22:12 kimbarrett

Webrevs

mlbridge[bot] avatar Dec 10 '25 22:12 mlbridge[bot]