Skip to content

Commit

Permalink
Merge pull request #92 from ibmruntimes/revert-62-fix_jdwp
Browse files Browse the repository at this point in the history
Revert "Fix race condition in jdwp"
  • Loading branch information
pshipton authored May 27, 2018
2 parents 32a374a + a1dd6b7 commit c2aa034
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 129 deletions.
62 changes: 1 addition & 61 deletions jdk/src/share/back/debugInit.c
Original file line number Diff line number Diff line change
@@ -1,24 +1,3 @@
/*******************************************************************************
* (c) Copyright IBM Corp. 2018, 2018 All Rights Reserved
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
* or the Apache License, Version 2.0 which accompanies this distribution and
* is available at https://www.apache.org/licenses/LICENSE-2.0.
*
* This Source Code may also be made available under the following
* Secondary Licenses when the conditions for such availability set
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
* General Public License, version 2 with the GNU Classpath
* Exception [1] and GNU General Public License, version 2 with the
* OpenJDK Assembly Exception [2].
*
* [1] https://www.gnu.org/software/classpath/license.html
* [2] http://openjdk.java.net/legal/assembly-exception.html
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
*******************************************************************************/
/*
* Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
Expand Down Expand Up @@ -79,7 +58,6 @@
static jboolean vmInitialized;
static jrawMonitorID initMonitor;
static jboolean initComplete;
static jboolean VMInitComplete;
static jbyte currentSessionID;

/*
Expand Down Expand Up @@ -476,9 +454,8 @@ cbEarlyVMInit(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thread)
if ( gdata->vmDead ) {
EXIT_ERROR(AGENT_ERROR_INTERNAL,"VM dead at VM_INIT time");
}
if (initOnStartup) {
if (initOnStartup)
initialize(env, thread, EI_VM_INIT);
}
vmInitialized = JNI_TRUE;
LOG_MISC(("END cbEarlyVMInit"));
}
Expand Down Expand Up @@ -658,41 +635,6 @@ debugInit_waitInitComplete(void)
debugMonitorExit(initMonitor);
}

void
signalVMInitComplete(void)
{
/*
* VM Initialization is complete
*/
LOG_MISC(("signal VM initialization complete"));
debugMonitorEnter(initMonitor);
VMInitComplete = JNI_TRUE;
debugMonitorNotifyAll(initMonitor);
debugMonitorExit(initMonitor);
}

/*
* Determine if VM initialization is complete.
*/
jboolean
debugInit_isVMInitComplete(void)
{
return VMInitComplete;
}

/*
* Wait for VM initialization to complete.
*/
void
debugInit_waitVMInitComplete(void)
{
debugMonitorEnter(initMonitor);
while (!VMInitComplete) {
debugMonitorWait(initMonitor);
}
debugMonitorExit(initMonitor);
}

/* All process exit() calls come from here */
void
forceExit(int exit_code)
Expand Down Expand Up @@ -748,7 +690,6 @@ initialize(JNIEnv *env, jthread thread, EventIndex triggering_ei)
LOG_MISC(("Begin initialize()"));
currentSessionID = 0;
initComplete = JNI_FALSE;
VMInitComplete = JNI_FALSE;

if ( gdata->vmDead ) {
EXIT_ERROR(AGENT_ERROR_INTERNAL,"VM dead at initialize() time");
Expand Down Expand Up @@ -858,7 +799,6 @@ debugInit_reset(JNIEnv *env)

currentSessionID++;
initComplete = JNI_FALSE;
VMInitComplete = JNI_TRUE; /* The VM Is already initialized */

eventHandler_reset(currentSessionID);
transport_reset();
Expand Down
24 changes: 0 additions & 24 deletions jdk/src/share/back/debugInit.h
Original file line number Diff line number Diff line change
@@ -1,24 +1,3 @@
/*******************************************************************************
* (c) Copyright IBM Corp. 2018, 2018 All Rights Reserved
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
* or the Apache License, Version 2.0 which accompanies this distribution and
* is available at https://www.apache.org/licenses/LICENSE-2.0.
*
* This Source Code may also be made available under the following
* Secondary Licenses when the conditions for such availability set
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
* General Public License, version 2 with the GNU Classpath
* Exception [1] and GNU General Public License, version 2 with the
* OpenJDK Assembly Exception [2].
*
* [1] https://www.gnu.org/software/classpath/license.html
* [2] http://openjdk.java.net/legal/assembly-exception.html
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
*******************************************************************************/
/*
* Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
Expand Down Expand Up @@ -60,9 +39,6 @@ void debugInit_reset(JNIEnv *env);
void debugInit_exit(jvmtiError, const char *);
void forceExit(int);

void debugInit_waitVMInitComplete(void);
void signalVMInitComplete(void);

JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *, char *, void *);
JNIEXPORT void JNICALL Agent_OnUnload(JavaVM *);

Expand Down
22 changes: 0 additions & 22 deletions jdk/src/share/back/debugLoop.c
Original file line number Diff line number Diff line change
@@ -1,24 +1,3 @@
/*******************************************************************************
* (c) Copyright IBM Corp. 2018, 2018 All Rights Reserved
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
* or the Apache License, Version 2.0 which accompanies this distribution and
* is available at https://www.apache.org/licenses/LICENSE-2.0.
*
* This Source Code may also be made available under the following
* Secondary Licenses when the conditions for such availability set
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
* General Public License, version 2 with the GNU Classpath
* Exception [1] and GNU General Public License, version 2 with the
* OpenJDK Assembly Exception [2].
*
* [1] https://www.gnu.org/software/classpath/license.html
* [2] http://openjdk.java.net/legal/assembly-exception.html
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
*******************************************************************************/
/*
* Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
Expand Down Expand Up @@ -119,7 +98,6 @@ debugLoop_run(void)
standardHandlers_onConnect();
threadControl_onConnect();

debugInit_waitVMInitComplete();
/* Okay, start reading cmds! */
while (shouldListen) {
if (!dequeue(&p)) {
Expand Down
22 changes: 0 additions & 22 deletions jdk/src/share/back/eventHelper.c
Original file line number Diff line number Diff line change
@@ -1,24 +1,3 @@
/*******************************************************************************
* (c) Copyright IBM Corp. 2018, 2018 All Rights Reserved
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
* or the Apache License, Version 2.0 which accompanies this distribution and
* is available at https://www.apache.org/licenses/LICENSE-2.0.
*
* This Source Code may also be made available under the following
* Secondary Licenses when the conditions for such availability set
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
* General Public License, version 2 with the GNU Classpath
* Exception [1] and GNU General Public License, version 2 with the
* OpenJDK Assembly Exception [2].
*
* [1] https://www.gnu.org/software/classpath/license.html
* [2] http://openjdk.java.net/legal/assembly-exception.html
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
*******************************************************************************/
/*
* Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
Expand Down Expand Up @@ -595,7 +574,6 @@ handleReportVMInitCommand(JNIEnv* env, ReportVMInitCommand *command)
(void)threadControl_suspendThread(command->thread, JNI_FALSE);
}

signalVMInitComplete();
outStream_initCommand(&out, uniqueID(), 0x0,
JDWP_COMMAND_SET(Event),
JDWP_COMMAND(Event, Composite));
Expand Down

0 comments on commit c2aa034

Please sign in to comment.