On 12/7/17 2:41 AM, David Holmes wrote:
Hi Chris,

On 7/12/2017 5:44 PM, Chris Plummer wrote:
New webrev:

https://bugs.openjdk.java.net/browse/JDK-8191229
http://cr.openjdk.java.net/~cjplummer/8191229/webrev.01/

testClass now initialized from JNI_OnLoad(), and use memset to clear callbacks. Also updated to use JVMTI_VERSION_9 when calling GetEnv().

  71         // JNI_OnLoad has not been called yet, so can't possibly be an instance of TEST_CLASS.

You can't be executing this method before JNI_OnLoad has executed. If JNI_Onload has executed then you can't execute this method and find NULL as that means JNI_Onload failed and hence library loading fails and so you can't be executing this method. So this method reduces to a simple instanceof check, which can go straight into the calling method.
That's what I thought, but it was crashing because testClass was NULL. I think Agent_OnLoad() is being called before JNI_OnLoad. I'll add traces and see for sure.

Chris

 183     if (testClass == NULL) {

That can just be "else {" - but as I said it can't be NULL anyway.

Thanks,
David

thanks,

Chris



Reply via email to