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

Backport-of: 46fd683820bb7149c0605a0ba03f59e76de69c16
  • Loading branch information
GoeLin committed Oct 25, 2023
1 parent ffb4ef2 commit 748ccc5
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
Original file line number Diff line number Diff line change
@@ -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 @@ -753,7 +753,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 @@ -796,23 +798,20 @@ invoker_completeInvokeRequest(jthread thread)
(void)outStream_writeObjectTag(env, &out, exc);
(void)outStream_writeObjectRef(env, &out, exc);
outStream_sendReply(&out);
/*
* 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_destroy(&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 748ccc5

@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.