RFR: 8257988: Remove JNF dependency from libsaproc/MacosxDebuggerLocal.m

Chris Plummer cjplummer at openjdk.java.net
Tue Feb 2 20:47:43 UTC 2021


On Thu, 28 Jan 2021 22:40:57 GMT, Phil Race <prr at openjdk.org> wrote:

> This removes the JNF dependency from the jdk.hotspot.agent module.
> The macro expansions are the same as already used in the Java desktop module - which actually uses a macro
> still but there there are hundreds of uses.
> The function of this macro code is to prevent NSExceptions escaping to Java and also to drain the auto-release pool.
> What test group would be good for verifying this change ?

src/jdk.hotspot.agent/macosx/native/libsaproc/MacosxDebuggerLocal.m line 294:

> 292: 
> 293:   NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
> 294:   @try {

Although there are only 3 places where the `JNF_COCOA_ENTER/EXIT` macros are used, it seems it would still be worth taking the same approach you did for `java.desktop` and add the replacement macros instead of inlining them. So just copy what you added to `src/java.desktop/macosx/native/libosxapp/JNIUtilities.h`, and replace `JNF_COCOA_ENTER` with `JNI_COCOA_ENTER/EXIT`. Otherwise the `JNF_COCOA_ENTER/EXIT` changes look fine to me, but I'm just basing this on a comparison with what you've done with `java.desktop`. I'm no expert in this area.

src/jdk.hotspot.agent/macosx/native/libsaproc/MacosxDebuggerLocal.m line 296:

> 294:   @try {
> 295: 
> 296:   NSString *symbolNameString = JavaStringToNSString(env, symbolName);

Is there a reason why `java.desktop` continues to use `JNFJavaToNSString`? I was looking to see how this was handled in other places, but I couldn't find an example where `JNFJavaToNSString` was converted to call a newly implemented `JavaStringToNSString`.

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

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



More information about the build-dev mailing list