Skip to content

Commit

Permalink
8176567: nsk/jdi/ReferenceType/instances/instances002: TestFailure: U…
Browse files Browse the repository at this point in the history
…nexpected size of referenceType.instances(nsk.share.jdi.TestInterfaceImplementer1): 11, expected: 10

Reviewed-by: sspitsyn, amenkov
  • Loading branch information
plummercj committed Jan 18, 2022
1 parent e314a4c commit 46fd683
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions src/jdk.jdwp.agent/share/native/libjdwp/invoker.c
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -752,7 +752,9 @@ invoker_completeInvokeRequest(jthread thread)
}
id = request->id;
exc = request->exception;
request->exception = NULL;
returnValue = request->returnValue;
request->returnValue.l = NULL;

/* Release return value and exception references, but delay the release
* until after the return packet was sent. */
Expand Down Expand Up @@ -790,23 +792,20 @@ invoker_completeInvokeRequest(jthread thread)
(void)outStream_writeValue(env, &out, tag, returnValue);
(void)outStream_writeObjectTag(env, &out, exc);
(void)outStream_writeObjectRef(env, &out, exc);
/*
* Delete potentially saved global references for return value
* and exception. This must be done before sending the reply or
* these objects will briefly be viewable by the debugger as live
* when they shouldn't be.
*/
if (mustReleaseReturnValue && returnValue.l != NULL) {
tossGlobalRef(env, &returnValue.l);
}
if (exc != NULL) {
tossGlobalRef(env, &exc);
}
outStream_sendReply(&out);
}

/*
* Delete potentially saved global references of return value
* and exception
*/
eventHandler_lock(); // for proper lock order
debugMonitorEnter(invokerLock);
if (mustReleaseReturnValue && returnValue.l != NULL) {
tossGlobalRef(env, &returnValue.l);
}
if (exc != NULL) {
tossGlobalRef(env, &exc);
}
debugMonitorExit(invokerLock);
eventHandler_unlock();
}

jboolean
Expand Down

1 comment on commit 46fd683

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

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

Please sign in to comment.