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

JDK-8326140: src/jdk.accessibility/windows/native/libjavaaccessbridge/AccessBridgeJavaEntryPoints.cpp ReleaseStringChars might be missing in early returns #17915

Closed
wants to merge 2 commits into from

Conversation

MBaesken
Copy link
Member

@MBaesken MBaesken commented Feb 19, 2024

In AccessBridgeJavaEntryPoints.cpp we have a couple of exception checks with potential early returns. Those miss ReleaseStringChars .


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-8326140: src/jdk.accessibility/windows/native/libjavaaccessbridge/AccessBridgeJavaEntryPoints.cpp ReleaseStringChars might be missing in early returns (Bug - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 17915

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Feb 19, 2024

👋 Welcome back mbaesken! 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 openjdk bot added the rfr Pull request is ready for review label Feb 19, 2024
@openjdk
Copy link

openjdk bot commented Feb 19, 2024

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

  • client

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 openjdk bot added the client client-libs-dev@openjdk.org label Feb 19, 2024
@MBaesken
Copy link
Member Author

MBaesken commented Feb 19, 2024

btw there might be further room for improvement / simplification. The current macro code blocks look like this

            EXCEPTION_CHECK_WITH_RELEASE("message1", FALSE, js, stringBytes);
            EXCEPTION_CHECK("message2 for ReleaseStringChars()", FALSE);

The second parameter could be omitted because it is always FALSE anyway in those EXCEPTION_CHECK_WITH_RELEASE blocks.
The second line EXCEPTION_CHECK could be moved into the macro EXCEPTION_CHECK_WITH_RELEASE itself .

@mlbridge
Copy link

mlbridge bot commented Feb 19, 2024

Webrevs

Copy link
Contributor

@RealCLanger RealCLanger left a comment

Choose a reason for hiding this comment

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

LGTM

@openjdk
Copy link

openjdk bot commented Feb 21, 2024

@MBaesken 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:

8326140: src/jdk.accessibility/windows/native/libjavaaccessbridge/AccessBridgeJavaEntryPoints.cpp ReleaseStringChars might be missing in early returns

Reviewed-by: clanger, prr

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 130 new commits pushed to the master branch:

  • be2b92b: 8326694: Defer setting of autocapitalize attribute
  • 38ad514: 8326687: Inconsistent use of "ZIP", "Zip" and "zip" in java.util.zip/jar zipfs javadoc
  • b938a5c: 8324969: C2: prevent elimination of unbalanced coarsened locking regions
  • a93605f: 8326763: Consolidate print methods in ContiguousSpace
  • 41242cb: 8325762: Use PassFailJFrame.Builder.splitUI() in PrintLatinCJKTest.java
  • 5db50ac: 8326892: Remove unused PSAdaptiveSizePolicyResizeVirtualSpaceAlot develop flag
  • eb4b6fa: 8326590: Improve description of MarkStackSize[Max] flags
  • e7e8083: 8326781: G1ConcurrentMark::top_at_rebuild_start() should take a HeapRegion* not an uint
  • e6b3bda: 8326509: Clean up JNIEXPORT in Hotspot after JDK-8017234
  • 1ab6bd4: 8326135: Enhance adlc to report unused operands
  • ... and 120 more: https://git.openjdk.org/jdk/compare/d422811bb7d96d61f7d795ffd4ba84f569a09422...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 ready Pull request is ready to be integrated label Feb 21, 2024
@@ -1735,11 +1743,10 @@ AccessBridgeJavaEntryPoints::getAccessibleContextInfo(jobject accessibleContext,
EXCEPTION_CHECK("Getting AccessibleName - call to GetStringChars()", FALSE);
wcsncpy(info->name, stringBytes, (sizeof(info->name) / sizeof(wchar_t)));
length = jniEnv->GetStringLength(js);
EXCEPTION_CHECK_WITH_RELEASE("Getting AccessibleName - call to GetStringLength()", FALSE, js, stringBytes);
EXCEPTION_CHECK("Getting AccessibleName - call to ReleaseStringChars()", FALSE);
Copy link
Contributor

Choose a reason for hiding this comment

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

So this is for the call to ReleaseStringChars() when there is no exception doing the GetStringLength
Since all the calls to ReleaseStringChars are now moved inside the WITH_RELEASE macro, it would seem more
logical to me to move this 2nd macro call inside the definition of the new macro (option 1)
Either that OR (option 1) do not move the "no previous exception" case inside the new macro at all
In other words, this CHECK should be placed next to where I can see the call that requires it.
Now, you'll probably tell me it isn't needed in the cases where the method immediately returns, so if that causes
a problem then option 2 seems like it would be better.

@MBaesken
Copy link
Member Author

In other words, this CHECK should be placed next to where I can see the call that requires it.

Hi Phil, I thought about this too. Just one EXCEPTION_CHECK_WITH_RELEASE macro and there the second check inside this macro, the two EXCEPTION_CHECK_WITH_RELEASE and EXCEPTION_CHECK just after it look a bit odd.
Should I change it this way and use just one macro ? Btw. at some places the EXCEPTION_CHECK_WITH_RELEASE is placed not directly placed after the jniEnv->GetStringLength call ; should I move it up there or keep it where it was ?

@MBaesken
Copy link
Member Author

In other words, this CHECK should be placed next to where I can see the call that requires it.

Hi Phil, I thought about this too. Just one EXCEPTION_CHECK_WITH_RELEASE macro and there the second check inside this macro, the two EXCEPTION_CHECK_WITH_RELEASE and EXCEPTION_CHECK just after it look a bit odd.

Adjusted the coding, now do more in the EXCEPTION_CHECK_WITH_RELEASE macro. Please check .

Copy link
Contributor

@prrace prrace left a comment

Choose a reason for hiding this comment

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

LGTM

@MBaesken
Copy link
Member Author

Hi Christoph and Phil, thanks for the reviews !

/integrate

@openjdk
Copy link

openjdk bot commented Feb 29, 2024

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

  • 998d0ba: 8324799: Use correct extension for C++ test headers
  • 0735c8a: 8318302: ThreadCountLimit.java failed with "Native memory allocation (mprotect) failed to protect 16384 bytes for memory to guard stack pages"
  • 5fa2bdc: 8326953: Race in creation of win-exports.def with static-libs
  • be2b92b: 8326694: Defer setting of autocapitalize attribute
  • 38ad514: 8326687: Inconsistent use of "ZIP", "Zip" and "zip" in java.util.zip/jar zipfs javadoc
  • b938a5c: 8324969: C2: prevent elimination of unbalanced coarsened locking regions
  • a93605f: 8326763: Consolidate print methods in ContiguousSpace
  • 41242cb: 8325762: Use PassFailJFrame.Builder.splitUI() in PrintLatinCJKTest.java
  • 5db50ac: 8326892: Remove unused PSAdaptiveSizePolicyResizeVirtualSpaceAlot develop flag
  • eb4b6fa: 8326590: Improve description of MarkStackSize[Max] flags
  • ... and 123 more: https://git.openjdk.org/jdk/compare/d422811bb7d96d61f7d795ffd4ba84f569a09422...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Feb 29, 2024

@MBaesken Pushed as commit d9ef16d.

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

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

Successfully merging this pull request may close these issues.

3 participants