-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
8257853: Remove dependencies on JNF's JNI utility functions in AWT and 2D code #1679
Conversation
👋 Welcome back prr! A progress list of the required criteria for merging this PR into |
Webrevs
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it have been nice to have a new file having same JNF macros so it will not result in changing any source code but just instead of mapping to apple provided JNF layer, we will map to our macro through JNF wrapper and link/unlink apple JNF lib based on version or so in makefile?
This siunds good, especially considering JEP-391, where we have to link ( at build time) with custom made JNF.framework and then provide jdk with JNF.framework in JAVA_HOME/lib The alternative is to integrate JNF (bsd3 license) into openjdk. |
No. Not really. We should not keep the JNF namespace. Nor is there any desitre to have that 1:1 mapping. |
I updated this fix with the additional changes for the accessibility files. |
Updated with some fixes for the A11Y support. |
I have tested the a11y part and haven't found any functional degradation there. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Accessibility part is perfectly fine, no regressions.
@prrace 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:
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 263 new commits pushed to the
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 |
anyone up for reviewing the rest of it ? |
@@ -314,7 +335,7 @@ + (void)initialize | |||
(*env)->DeleteLocalRef(env, jString); | |||
} | |||
|
|||
sAccessibilityClass = JNFCallStaticObjectMethod(env, jm_getAccessibility, result); // AWT_THREADING Safe (known object) | |||
sAccessibilityClass = (*env)->CallStaticObjectMethod(env, sjc_CAccessibility, jm_getAccessibility, result); // AWT_THREADING Safe (known object) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need CHECK_EXCEPTION();
after CallStaticObjectMethod
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will add it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we could add CHECK_EXCEPTION in few places...pointing those out...
There seems to be a pattern where we replace There are places where currently in this fix, this pattern is missing the Can we replace This would make this change more robust and make it easier to review it. |
Its is a reasonable idea and I thought about it but on the whole I'd prefer not to do it and insted fix missing cases. For comparison I've been running JDK 15 with -Xcheck:jni and there were a number of places that generated So I believe we may end up more (theoretically) robust with my changes than we were before. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should take care of native exceptions, and probably use more objective-c than the macro.
We will take care of native exceptions - the ENTER/EXIT macros which have yet to be updated will handle these if they occur. |
I guess it should work already in the JNF case? The java exception should be wrapped by the NSException in the JNFCallObjectMethod/etc and unwrapped in the JNF_COCOA_ENTER before exists to the java method?
I am not sure about that. |
No, you skipped all exceptions in the JNI up-calls, which I am talking about. |
Not sure what you mean. |
That is the pattern I know is there today and I don't think is needed.
I am looking at JNI warnings - not just guessing. |
Non of your macro raises exceptions like it was before. All of them just log and clear a java exception, while before such exceptions were transformed to the NSException and handled appropriately. |
No, it is quite useful, and it will be good to preserve it. It is possible to work "locally" when the call site if come from java, but not if we are in the infinite native loop.
I am looking at a new code that is not as good as before. |
an NS exception on the appkit will terminate the app - if unhandled - and probably will even if handled
I guess we disagree. I think this is better and simpler. |
Not trying to prolong or expand this discussion but a 1:1 mapping to JNF to really minimise the review needs to account for
|
Mailing list message from Alan Snyder on awt-dev: I use JNF in my own (non-JDK) code, and I assume others do also. Will the macOS JNI support functions and macros you want to use in the JDK be available for use in non-JDK code? |
Mailing list message from Philip Race on awt-dev: Not something I'd considered as a goal. -phil. On 12/18/20, 4:23 PM, Alan Snyder wrote:
|
Mailing list message from Alan Snyder on awt-dev: If it?s better than JNF, as you suggest, perhaps it should be released and supported. Alan
|
Mailing list message from Philip Race on awt-dev: Ah .. not my call .. complicated. -phil. On 12/18/20, 4:40 PM, Alan Snyder wrote:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me.
/integrate |
@prrace Since your change was applied there have been 266 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit fa50877. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
It is a mistake that this fix was integrated, actually without proper approval of the AWT side. It would be good to roll back it one way or another. |
It is just horrible usage of macros in the objective-c code. |
This defines some macros to support declaring and initialising statically allocated instances of jclass, jmethodID and jfieldID
and changes many existing uses of JNF macros/functions to use these instead.
Then calls to JNFCall* and JNFNewObject - etc are updated to directly call JNI methods
JNI exception checking macros are added as needed.
Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jdk pull/1679/head:pull/1679
$ git checkout pull/1679