Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8346990: Remove INTX_FORMAT and UINTX_FORMAT macros #22916

Closed
wants to merge 6 commits into from

Conversation

coleenp
Copy link
Contributor

@coleenp coleenp commented Jan 3, 2025

There are a lot of format modifiers that are noisy and unnecessary in the code. This change removes the INTX variants. It's not that disruptive even for backporting because %z modifier has been available for a long time so should backport fine. This was mostly done with a sed script plus some hand fixups.

Testing mach5 and other platform cross compilations in progress. Opening this for GHA testing.


Progress

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

Issue

  • JDK-8346990: Remove INTX_FORMAT and UINTX_FORMAT macros (Enhancement - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 22916

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jan 3, 2025

👋 Welcome back coleenp! 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.

@openjdk
Copy link

openjdk bot commented Jan 3, 2025

@coleenp This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8346990: Remove INTX_FORMAT and UINTX_FORMAT macros

Reviewed-by: kbarrett, dholmes, matsaave

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 136 new commits pushed to the master branch:

  • 13a1775: 8344146: Remove temporary font file tracking code.
  • 61dc07c: 8346869: [AIX] Add regression test for handling 4 Byte aligned doubles in structures
  • 13e1ea5: 8346038: [REDO] - [C1] LIR Operations with one input should be implemented as LIR_Op1
  • 7c883c2: 8347605: Use spec tag to refer to IEEE 754 standard
  • 4e0ffda: 8346972: Test java/nio/channels/FileChannel/LoopingTruncate.java fails sometimes with IOException: There is not enough space on the disk
  • e0f2f4b: 8313396: Portable implementation of FORBID_C_FUNCTION and ALLOW_C_FUNCTION
  • b0c131e: 8345368: java/io/File/createTempFile/SpecialTempFile.java fails on Windows Server 2025
  • a7915bb: 8346468: SM cleanup of common test library
  • f67b703: 8347427: JTabbedPane/8134116/Bug8134116.java has no license header
  • 062f2dc: 8347554: [BACKOUT] C2: implement optimization for series of Add of unique value
  • ... and 126 more: https://git.openjdk.org/jdk/compare/84e6432bb73e35b32f12cdc0e1a172b7c973e618...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the rfr Pull request is ready for review label Jan 3, 2025
@openjdk
Copy link

openjdk bot commented Jan 3, 2025

@coleenp The following labels will be automatically applied to this pull request:

  • graal
  • hotspot
  • serviceability
  • shenandoah

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

@openjdk openjdk bot added graal graal-dev@openjdk.org serviceability serviceability-dev@openjdk.org hotspot hotspot-dev@openjdk.org shenandoah shenandoah-dev@openjdk.org labels Jan 3, 2025
@mlbridge
Copy link

mlbridge bot commented Jan 3, 2025

Webrevs

@TheShermanTanker
Copy link
Contributor

Speaking of %z, there is a non Standard %Ix in os_windows.cpp

tty->print_cr("reserve_memory of %Ix bytes took " JLONG_FORMAT " ms (" JLONG_FORMAT " ticks)", bytes,
                    reserveTimer.milliseconds(), reserveTimer.ticks());

Could changing that to %zu be trivial enough to fit into this change?

@coleenp
Copy link
Contributor Author

coleenp commented Jan 3, 2025

I was going to take on the other FORMAT ones in separate PRs.
Sorry I see what you're saying. yes, I'll fix that too.

Copy link

@kimbarrett kimbarrett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uses of [U]INTX_FORMAT_X have been replaced with 0x%zx. I mentioned the
possibility of instead using %#zx. I don't know if we really want to use some of
the (to me) more obscure flag options though.

@coleenp
Copy link
Contributor Author

coleenp commented Jan 6, 2025

Kim, thanks for slogging through this change. I've updated the patch with your suggested changes.

Copy link
Contributor

@matias9927 matias9927 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I've looked at so far it looks good! I noticed there are several cases where you mix format specifiers with macros. I understand that replacing other macros may not be in the scope of this change but I find it inconsistent in places where we have both.

I listed out some of the cases below, but if you don't believe this to be necessary you can ignore me.

@coleenp
Copy link
Contributor Author

coleenp commented Jan 9, 2025

The intention is to keep INTPTR_FORMAT and some of the other format specifiers that vary by platform. I have another issue to remove the SIZE_FORMAT ones but that's a bigger change. So this mixture is intentional.

JLONG_FORMAT might be something we can remove too but I didn't want to do it all at once.

Copy link
Contributor

@matias9927 matias9927 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I saw the discussion on UINTPTR_FORMAT_X_0 so I left it alone.

@@ -2497,7 +2497,7 @@ void ObjectMonitor::Initialize2() {
void ObjectMonitor::print_on(outputStream* st) const {
// The minimal things to print for markWord printing, more can be added for debugging and logging.
st->print("{contentions=0x%08x,waiters=0x%08x"
",recursions=" INTX_FORMAT ",owner=" INT64_FORMAT "}",
",recursions=%zd,owner=" INT64_FORMAT "}",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is INT64_FORMAT different from INTX_FORMAT?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently yes. The type underlying [u]intx varies by platform, being a 32-bit type on 32-bit platforms and a
64-bit type on 64-bit platforms. We've been trimming the set of supported 32-bit platforms though, so maybe
someday we won't need that distinction any more.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jan 9, 2025
Copy link

@kimbarrett kimbarrett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

Copy link
Member

@dholmes-ora dholmes-ora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for a "dumb" question but %z is for size_t arguments, so why are we using it to replace INTX/UINTX_FORMAT ??? I get that size_t and intx happen to be the same size but still ... if I see %z I expect to see a size_t argument passed in.

@coleenp
Copy link
Contributor Author

coleenp commented Jan 13, 2025

They are interchangeable and some places used UINTX_FORMAT when they should have used SIZE_FORMAT.
Better to have just one and just use %zu, which looks better in the format specifiers. I'm going to do SIZE_FORMAT next but still negotiating how to handle review tedium.

The error message can be confusing though because the error message for %z refers to size_t. But some of our use of intx should probably be size_t.

@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Jan 13, 2025
Copy link

@kimbarrett kimbarrett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still good.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jan 13, 2025
@coleenp
Copy link
Contributor Author

coleenp commented Jan 13, 2025

Thank you Matias, Kim and David.
/integrate

@openjdk
Copy link

openjdk bot commented Jan 13, 2025

Going to push as commit 379d05b.
Since your change was applied there have been 137 commits pushed to the master branch:

  • d3a7ac2: 8346383: Cannot use DllMain in libdt_socket for static builds
  • 13a1775: 8344146: Remove temporary font file tracking code.
  • 61dc07c: 8346869: [AIX] Add regression test for handling 4 Byte aligned doubles in structures
  • 13e1ea5: 8346038: [REDO] - [C1] LIR Operations with one input should be implemented as LIR_Op1
  • 7c883c2: 8347605: Use spec tag to refer to IEEE 754 standard
  • 4e0ffda: 8346972: Test java/nio/channels/FileChannel/LoopingTruncate.java fails sometimes with IOException: There is not enough space on the disk
  • e0f2f4b: 8313396: Portable implementation of FORBID_C_FUNCTION and ALLOW_C_FUNCTION
  • b0c131e: 8345368: java/io/File/createTempFile/SpecialTempFile.java fails on Windows Server 2025
  • a7915bb: 8346468: SM cleanup of common test library
  • f67b703: 8347427: JTabbedPane/8134116/Bug8134116.java has no license header
  • ... and 127 more: https://git.openjdk.org/jdk/compare/84e6432bb73e35b32f12cdc0e1a172b7c973e618...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jan 13, 2025
@openjdk openjdk bot closed this Jan 13, 2025
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jan 13, 2025
@openjdk
Copy link

openjdk bot commented Jan 13, 2025

@coleenp Pushed as commit 379d05b.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@coleenp coleenp deleted the zmod branch January 13, 2025 22:03
@dholmes-ora
Copy link
Member

We have belatedly discovered that 0x%zx and %#zx behave differently in their handling of zero. The former prints 0x0 while the latter just prints 0. This has broken the compiler replay tests as the parsing of 0 no longer works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
graal graal-dev@openjdk.org hotspot hotspot-dev@openjdk.org integrated Pull request has been integrated serviceability serviceability-dev@openjdk.org shenandoah shenandoah-dev@openjdk.org
Development

Successfully merging this pull request may close these issues.

5 participants