Skip to content

Commit d440eb1

Browse files
committed
Merge openj9 into openj9-staging
Signed-off-by: Peter Shipton <[email protected]>
2 parents 9ec3ede + 5f9204b commit d440eb1

File tree

22 files changed

+592
-11
lines changed

22 files changed

+592
-11
lines changed

closed/GensrcJ9JCL.gmk

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# ===========================================================================
2-
# (c) Copyright IBM Corp. 2020, 2023 All Rights Reserved
2+
# (c) Copyright IBM Corp. 2020, 2024 All Rights Reserved
33
# ===========================================================================
44
# This code is free software; you can redistribute it and/or modify it
55
# under the terms of the GNU General Public License version 2 only, as
@@ -39,6 +39,7 @@ $(eval $(call SetupCopyFiles,COPY_OVERLAY_FILES, \
3939
SRC := $(TOPDIR), \
4040
DEST := $(SUPPORT_OUTPUTDIR)/overlay, \
4141
FILES := \
42+
make/data/jdwp/jdwp.spec \
4243
src/java.base/share/classes/com/sun/crypto/provider/HmacCore.java \
4344
src/java.base/share/classes/java/lang/ClassValue.java \
4445
src/java.base/share/classes/java/lang/invoke/ClassSpecializer.java \
@@ -56,6 +57,13 @@ $(eval $(call SetupCopyFiles,COPY_OVERLAY_FILES, \
5657
src/java.base/share/classes/sun/security/provider/SecureRandom.java \
5758
src/java.base/unix/classes/java/lang/ProcessEnvironment.java \
5859
src/java.base/unix/classes/sun/security/provider/NativePRNG.java \
60+
src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/EventHandler.java \
61+
src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/EventNotifier.java \
62+
src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTY.java \
63+
src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources.java \
64+
src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources_ja.java \
65+
src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources_zh_CN.java \
66+
src/jdk.jdi/share/classes/com/sun/tools/jdi/EventSetImpl.java \
5967
))
6068

6169
IncludeIfUnsure := -includeIfUnsure -noWarnIncludeIf
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*[INCLUDE-IF CRIU_SUPPORT]*/
2+
/*
3+
* ===========================================================================
4+
* (c) Copyright IBM Corp. 2023, 2024 All Rights Reserved
5+
* ===========================================================================
6+
*
7+
* This code is free software; you can redistribute it and/or modify it
8+
* under the terms of the GNU General Public License version 2 only, as
9+
* published by the Free Software Foundation.
10+
*
11+
* IBM designates this particular file as subject to the "Classpath" exception
12+
* as provided by IBM in the LICENSE file that accompanied this code.
13+
*
14+
* This code is distributed in the hope that it will be useful, but WITHOUT
15+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17+
* version 2 for more details (a copy is included in the LICENSE file that
18+
* accompanied this code).
19+
*
20+
* You should have received a copy of the GNU General Public License version
21+
* 2 along with this work; if not, see <http://www.gnu.org/licenses/>.
22+
*
23+
* ===========================================================================
24+
*/
25+
package com.sun.jdi.event;
26+
27+
import com.sun.jdi.ThreadReference;
28+
import com.sun.jdi.VirtualMachine;
29+
30+
/**
31+
* Notification of when the VM is restored from a checkpoint. Similar to
32+
* VMStartEvent this occurs before application code has run, including any
33+
* application hooks for the restore event.
34+
* The event is generated even if not explicitly requested.
35+
*
36+
* @see VMStartEvent
37+
* @see VMDeathEvent
38+
* @see EventQueue
39+
* @see VirtualMachine
40+
*/
41+
public interface VMRestoreEvent extends Event {
42+
43+
/**
44+
* Returns the thread which is restoring the VM from a checkpoint.
45+
*
46+
* @return a {@link ThreadReference} representing the restore thread
47+
* on the target VM.
48+
*/
49+
public ThreadReference thread();
50+
}

make/data/jdwp/jdwp.spec

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@
2323
* questions.
2424
*/
2525

26+
/*
27+
* ===========================================================================
28+
* (c) Copyright IBM Corp. 2023, 2024 All Rights Reserved
29+
* ===========================================================================
30+
*/
31+
2632
JDWP "Java(tm) Debug Wire Protocol"
2733
(CommandSet VirtualMachine=1
2834
(Command Version=1
@@ -3090,6 +3096,17 @@ JDWP "Java(tm) Debug Wire Protocol"
30903096
(int requestID
30913097
"Request that generated event")
30923098
)
3099+
/*[IF CRIU_SUPPORT]*/
3100+
(Alt VMRestore=JDWP.EventKind.VM_RESTORE
3101+
"Notification of when the VM is restored from a checkpoint. Similar to"
3102+
"VMStartEvent this occurs before application code has run, including any"
3103+
"application hooks for the restore event."
3104+
"The event is generated even if not explicitly requested."
3105+
3106+
(int requestID "Request that generated event")
3107+
(threadObject thread "The thread restoring the VM from a checkpoint.")
3108+
)
3109+
/*[ENDIF] CRIU_SUPPORT */
30933110
)
30943111
)
30953112
)
@@ -3219,6 +3236,9 @@ JDWP "Java(tm) Debug Wire Protocol"
32193236
(Constant VM_INIT =90 "obsolete - was used in jvmdi")
32203237
(Constant VM_DEATH =99 )
32213238
(Constant VM_DISCONNECTED =100 "Never sent across JDWP")
3239+
/*[IF CRIU_SUPPORT]*/
3240+
(Constant VM_RESTORE =101 "OpenJ9 VM Restored")
3241+
/*[ENDIF] CRIU_SUPPORT */
32223242
)
32233243

32243244
(ConstantSet ThreadStatus

src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/EventHandler.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@
3131
* this sample code.
3232
*/
3333

34+
/*
35+
* ===========================================================================
36+
* (c) Copyright IBM Corp. 2023, 2024 All Rights Reserved
37+
* ===========================================================================
38+
*/
3439

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

@@ -118,6 +123,10 @@ private boolean handleEvent(Event event) {
118123
return threadDeathEvent(event);
119124
} else if (event instanceof VMStartEvent) {
120125
return vmStartEvent(event);
126+
/*[IF CRIU_SUPPORT]*/
127+
} else if (event instanceof VMRestoreEvent restoreEvent) {
128+
return vmRestoreEvent(restoreEvent);
129+
/*[ENDIF] CRIU_SUPPORT */
121130
} else {
122131
return handleExitEvent(event);
123132
}
@@ -179,6 +188,10 @@ private ThreadReference eventThread(Event event) {
179188
return ((ThreadDeathEvent)event).thread();
180189
} else if (event instanceof VMStartEvent) {
181190
return ((VMStartEvent)event).thread();
191+
/*[IF CRIU_SUPPORT]*/
192+
} else if (event instanceof VMRestoreEvent restoreEvent) {
193+
return restoreEvent.thread();
194+
/*[ENDIF] CRIU_SUPPORT */
182195
} else {
183196
return null;
184197
}
@@ -210,6 +223,13 @@ private boolean vmStartEvent(Event event) {
210223
return stopOnVMStart;
211224
}
212225

226+
/*[IF CRIU_SUPPORT]*/
227+
private boolean vmRestoreEvent(VMRestoreEvent restoreEvent) {
228+
notifier.vmRestoreEvent(restoreEvent);
229+
return stopOnVMStart;
230+
}
231+
/*[ENDIF] CRIU_SUPPORT */
232+
213233
private boolean breakpointEvent(Event event) {
214234
BreakpointEvent be = (BreakpointEvent)event;
215235
notifier.breakpointEvent(be);

src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/EventNotifier.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@
2323
* questions.
2424
*/
2525

26+
/*
27+
* ===========================================================================
28+
* (c) Copyright IBM Corp. 2023, 2024 All Rights Reserved
29+
* ===========================================================================
30+
*/
31+
2632
/*
2733
* This source code is provided to illustrate the usage of a given feature
2834
* or technique and has been deliberately simplified. Additional steps
@@ -38,6 +44,9 @@
3844

3945
interface EventNotifier {
4046
void vmStartEvent(VMStartEvent e);
47+
/*[IF CRIU_SUPPORT]*/
48+
void vmRestoreEvent(VMRestoreEvent e);
49+
/*[ENDIF] CRIU_SUPPORT */
4150
void vmDeathEvent(VMDeathEvent e);
4251
void vmDisconnectEvent(VMDisconnectEvent e);
4352

src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTY.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@
2323
* questions.
2424
*/
2525

26+
/*
27+
* ===========================================================================
28+
* (c) Copyright IBM Corp. 2023, 2024 All Rights Reserved
29+
* ===========================================================================
30+
*/
31+
2632
/*
2733
* This source code is provided to illustrate the usage of a given feature
2834
* or technique and has been deliberately simplified. Additional steps
@@ -73,6 +79,14 @@ public void vmStartEvent(VMStartEvent se) {
7379
MessageOutput.lnprint("VM Started:");
7480
}
7581

82+
/*[IF CRIU_SUPPORT]*/
83+
@Override
84+
public void vmRestoreEvent(VMRestoreEvent re) {
85+
Thread.yield(); // fetch output
86+
MessageOutput.lnprint("VM Restored:");
87+
}
88+
/*[ENDIF] CRIU_SUPPORT */
89+
7690
@Override
7791
public void vmDeathEvent(VMDeathEvent e) {
7892
}

src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@
2323
* questions.
2424
*/
2525

26+
/*
27+
* ===========================================================================
28+
* (c) Copyright IBM Corp. 2023, 2024 All Rights Reserved
29+
* ===========================================================================
30+
*/
31+
2632
/*
2733
* This source code is provided to illustrate the usage of a given feature
2834
* or technique and has been deliberately simplified. Additional steps
@@ -484,6 +490,9 @@ public Object[][] getContents() {
484490
"<arguments> are the arguments passed to the main() method of <class>\n" +
485491
"\n" +
486492
"For command help type ''help'' at {0} prompt"},
493+
/*[IF CRIU_SUPPORT]*/
494+
{"VM Restored:", "VM restored from checkpoint:"},
495+
/*[ENDIF] CRIU_SUPPORT */
487496
// END OF MATERIAL TO LOCALIZE
488497
};
489498

0 commit comments

Comments
 (0)