Skip to content

Commit

Permalink
Merge openj9 into openj9-staging
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Shipton <[email protected]>
  • Loading branch information
pshipton committed Aug 28, 2024
2 parents 9ec3ede + 5f9204b commit d440eb1
Show file tree
Hide file tree
Showing 22 changed files with 592 additions and 11 deletions.
10 changes: 9 additions & 1 deletion closed/GensrcJ9JCL.gmk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ===========================================================================
# (c) Copyright IBM Corp. 2020, 2023 All Rights Reserved
# (c) Copyright IBM Corp. 2020, 2024 All Rights Reserved
# ===========================================================================
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
Expand Down Expand Up @@ -39,6 +39,7 @@ $(eval $(call SetupCopyFiles,COPY_OVERLAY_FILES, \
SRC := $(TOPDIR), \
DEST := $(SUPPORT_OUTPUTDIR)/overlay, \
FILES := \
make/data/jdwp/jdwp.spec \
src/java.base/share/classes/com/sun/crypto/provider/HmacCore.java \
src/java.base/share/classes/java/lang/ClassValue.java \
src/java.base/share/classes/java/lang/invoke/ClassSpecializer.java \
Expand All @@ -56,6 +57,13 @@ $(eval $(call SetupCopyFiles,COPY_OVERLAY_FILES, \
src/java.base/share/classes/sun/security/provider/SecureRandom.java \
src/java.base/unix/classes/java/lang/ProcessEnvironment.java \
src/java.base/unix/classes/sun/security/provider/NativePRNG.java \
src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/EventHandler.java \
src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/EventNotifier.java \
src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTY.java \
src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources.java \
src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources_ja.java \
src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources_zh_CN.java \
src/jdk.jdi/share/classes/com/sun/tools/jdi/EventSetImpl.java \
))

IncludeIfUnsure := -includeIfUnsure -noWarnIncludeIf
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*[INCLUDE-IF CRIU_SUPPORT]*/
/*
* ===========================================================================
* (c) Copyright IBM Corp. 2023, 2024 All Rights Reserved
* ===========================================================================
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* IBM designates this particular file as subject to the "Classpath" exception
* as provided by IBM in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, see <http://www.gnu.org/licenses/>.
*
* ===========================================================================
*/
package com.sun.jdi.event;

import com.sun.jdi.ThreadReference;
import com.sun.jdi.VirtualMachine;

/**
* Notification of when the VM is restored from a checkpoint. Similar to
* VMStartEvent this occurs before application code has run, including any
* application hooks for the restore event.
* The event is generated even if not explicitly requested.
*
* @see VMStartEvent
* @see VMDeathEvent
* @see EventQueue
* @see VirtualMachine
*/
public interface VMRestoreEvent extends Event {

/**
* Returns the thread which is restoring the VM from a checkpoint.
*
* @return a {@link ThreadReference} representing the restore thread
* on the target VM.
*/
public ThreadReference thread();
}
20 changes: 20 additions & 0 deletions make/data/jdwp/jdwp.spec
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
* questions.
*/

/*
* ===========================================================================
* (c) Copyright IBM Corp. 2023, 2024 All Rights Reserved
* ===========================================================================
*/

JDWP "Java(tm) Debug Wire Protocol"
(CommandSet VirtualMachine=1
(Command Version=1
Expand Down Expand Up @@ -3090,6 +3096,17 @@ JDWP "Java(tm) Debug Wire Protocol"
(int requestID
"Request that generated event")
)
/*[IF CRIU_SUPPORT]*/
(Alt VMRestore=JDWP.EventKind.VM_RESTORE
"Notification of when the VM is restored from a checkpoint. Similar to"
"VMStartEvent this occurs before application code has run, including any"
"application hooks for the restore event."
"The event is generated even if not explicitly requested."

(int requestID "Request that generated event")
(threadObject thread "The thread restoring the VM from a checkpoint.")
)
/*[ENDIF] CRIU_SUPPORT */
)
)
)
Expand Down Expand Up @@ -3219,6 +3236,9 @@ JDWP "Java(tm) Debug Wire Protocol"
(Constant VM_INIT =90 "obsolete - was used in jvmdi")
(Constant VM_DEATH =99 )
(Constant VM_DISCONNECTED =100 "Never sent across JDWP")
/*[IF CRIU_SUPPORT]*/
(Constant VM_RESTORE =101 "OpenJ9 VM Restored")
/*[ENDIF] CRIU_SUPPORT */
)

(ConstantSet ThreadStatus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@
* this sample code.
*/

/*
* ===========================================================================
* (c) Copyright IBM Corp. 2023, 2024 All Rights Reserved
* ===========================================================================
*/

package com.sun.tools.example.debug.tty;

Expand Down Expand Up @@ -118,6 +123,10 @@ private boolean handleEvent(Event event) {
return threadDeathEvent(event);
} else if (event instanceof VMStartEvent) {
return vmStartEvent(event);
/*[IF CRIU_SUPPORT]*/
} else if (event instanceof VMRestoreEvent restoreEvent) {
return vmRestoreEvent(restoreEvent);
/*[ENDIF] CRIU_SUPPORT */
} else {
return handleExitEvent(event);
}
Expand Down Expand Up @@ -179,6 +188,10 @@ private ThreadReference eventThread(Event event) {
return ((ThreadDeathEvent)event).thread();
} else if (event instanceof VMStartEvent) {
return ((VMStartEvent)event).thread();
/*[IF CRIU_SUPPORT]*/
} else if (event instanceof VMRestoreEvent restoreEvent) {
return restoreEvent.thread();
/*[ENDIF] CRIU_SUPPORT */
} else {
return null;
}
Expand Down Expand Up @@ -210,6 +223,13 @@ private boolean vmStartEvent(Event event) {
return stopOnVMStart;
}

/*[IF CRIU_SUPPORT]*/
private boolean vmRestoreEvent(VMRestoreEvent restoreEvent) {
notifier.vmRestoreEvent(restoreEvent);
return stopOnVMStart;
}
/*[ENDIF] CRIU_SUPPORT */

private boolean breakpointEvent(Event event) {
BreakpointEvent be = (BreakpointEvent)event;
notifier.breakpointEvent(be);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
* questions.
*/

/*
* ===========================================================================
* (c) Copyright IBM Corp. 2023, 2024 All Rights Reserved
* ===========================================================================
*/

/*
* This source code is provided to illustrate the usage of a given feature
* or technique and has been deliberately simplified. Additional steps
Expand All @@ -38,6 +44,9 @@

interface EventNotifier {
void vmStartEvent(VMStartEvent e);
/*[IF CRIU_SUPPORT]*/
void vmRestoreEvent(VMRestoreEvent e);
/*[ENDIF] CRIU_SUPPORT */
void vmDeathEvent(VMDeathEvent e);
void vmDisconnectEvent(VMDisconnectEvent e);

Expand Down
14 changes: 14 additions & 0 deletions src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTY.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
* questions.
*/

/*
* ===========================================================================
* (c) Copyright IBM Corp. 2023, 2024 All Rights Reserved
* ===========================================================================
*/

/*
* This source code is provided to illustrate the usage of a given feature
* or technique and has been deliberately simplified. Additional steps
Expand Down Expand Up @@ -73,6 +79,14 @@ public void vmStartEvent(VMStartEvent se) {
MessageOutput.lnprint("VM Started:");
}

/*[IF CRIU_SUPPORT]*/
@Override
public void vmRestoreEvent(VMRestoreEvent re) {
Thread.yield(); // fetch output
MessageOutput.lnprint("VM Restored:");
}
/*[ENDIF] CRIU_SUPPORT */

@Override
public void vmDeathEvent(VMDeathEvent e) {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
* questions.
*/

/*
* ===========================================================================
* (c) Copyright IBM Corp. 2023, 2024 All Rights Reserved
* ===========================================================================
*/

/*
* This source code is provided to illustrate the usage of a given feature
* or technique and has been deliberately simplified. Additional steps
Expand Down Expand Up @@ -484,6 +490,9 @@ public Object[][] getContents() {
"<arguments> are the arguments passed to the main() method of <class>\n" +
"\n" +
"For command help type ''help'' at {0} prompt"},
/*[IF CRIU_SUPPORT]*/
{"VM Restored:", "VM restored from checkpoint:"},
/*[ENDIF] CRIU_SUPPORT */
// END OF MATERIAL TO LOCALIZE
};

Expand Down
Loading

0 comments on commit d440eb1

Please sign in to comment.