Skip to content

Commit 908274d

Browse files
authored
Merge pull request #128 from JasonFengJ9/addnotcriusafemore
Add NotCheckpointSafe annotations & JPP support for generated source
2 parents f808858 + 33d1912 commit 908274d

File tree

6 files changed

+83
-0
lines changed

6 files changed

+83
-0
lines changed

closed/GensrcJ9JCL.gmk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,12 @@ $(eval $(call SetupCopyFiles,COPY_OVERLAY_FILES, \
5151
SRC := $(TOPDIR), \
5252
DEST := $(SUPPORT_OUTPUTDIR)/overlay, \
5353
FILES := \
54+
src/java.base/share/classes/java/lang/ClassValue.java \
55+
src/java.base/share/classes/java/lang/invoke/ClassSpecializer.java \
5456
src/java.base/share/classes/java/security/Security.java \
5557
src/java.base/share/classes/java/util/Timer.java \
5658
src/java.base/share/classes/java/util/TimerTask.java \
59+
src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java \
5760
src/java.base/unix/classes/java/lang/ProcessEnvironment.java \
5861
))
5962

make/modules/java.base/gensrc/GensrcCharsetMapping.gmk

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
# questions.
2424
#
2525

26+
# ===========================================================================
27+
# (c) Copyright IBM Corp. 2022, 2022 All Rights Reserved
28+
# ===========================================================================
29+
2630
################################################################################
2731
#
2832
# Generate StandardCharsets.java and individul sun.nio.cs charset class using
@@ -40,6 +44,26 @@ CHARSET_STANDARD_JAVA_TEMPLATES := \
4044
$(TOPDIR)/src/java.base/share/classes/sun/nio/cs/StandardCharsets.java.template
4145
CHARSET_STANDARD_OS := stdcs-$(OPENJDK_TARGET_OS)
4246

47+
J9TOOLS_DIR := $(SUPPORT_OUTPUTDIR)/j9tools
48+
JPP_JAR := $(J9TOOLS_DIR)/jpp.jar
49+
JPP_TAGS := PLATFORM-$(OPENJ9_PLATFORM_CODE)
50+
51+
define RunJPP
52+
@$(BOOT_JDK)/bin/java \
53+
-cp "$(call FixPath,$(JPP_JAR))" \
54+
-Dfile.encoding=US-ASCII \
55+
com.ibm.jpp.commandline.CommandlineBuilder \
56+
-verdict \
57+
-config $1 \
58+
-baseDir "$(call FixPath,$(dir $2))" \
59+
-srcRoot $(notdir $2)/ \
60+
-xml "$(call FixPath,$(OPENJ9_TOPDIR)/jcl/jpp_configuration.xml)" \
61+
-dest "$(call FixPath,$(SUPPORT_OUTPUTDIR)$(strip $3))" \
62+
-tag:define "$(subst $(SPACE),;,$(sort $(JPP_TAGS)))" \
63+
-includeIfUnsure \
64+
-noWarnIncludeIf
65+
endef # RunJPP
66+
4367
$(CHARSET_DONE_BASE)-stdcs: $(CHARSET_DATA_DIR)/charsets \
4468
$(wildcard $(CHARSET_DATA_DIR)/$(CHARSET_STANDARD_OS)) \
4569
$(CHARSET_TEMPLATES) $(CHARSET_STANDARD_JAVA_TEMPLATES) \
@@ -51,6 +75,10 @@ $(CHARSET_DONE_BASE)-stdcs: $(CHARSET_DATA_DIR)/charsets \
5175
$(CHARSET_STANDARD_JAVA_TEMPLATES) $(CHARSET_EXTSRC_DIR) \
5276
$(CHARSET_COPYRIGHT_HEADER) \
5377
$(LOG_DEBUG)
78+
$(MKDIR) -p $(SUPPORT_OUTPUTDIR)/overlay-gensrc/src/java.base/sun/nio/cs
79+
$(CP) $(CHARSET_GENSRC_JAVA_DIR_BASE)/StandardCharsets.java $(SUPPORT_OUTPUTDIR)/overlay-gensrc/src/java.base/sun/nio/cs/
80+
$(call RunJPP, JAVA$(VERSION_FEATURE), $(SUPPORT_OUTPUTDIR)/overlay-gensrc, /overlay-result)
81+
$(CP) $(SUPPORT_OUTPUTDIR)/overlay-result/java.base/sun/nio/cs/StandardCharsets.java $(CHARSET_GENSRC_JAVA_DIR_BASE)/
5482
$(TOUCH) '$@'
5583

5684
TARGETS += $(CHARSET_DONE_BASE)-stdcs

src/java.base/share/classes/java/lang/ClassValue.java

Lines changed: 13 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. 2022, 2022 All Rights Reserved
29+
* ===========================================================================
30+
*/
31+
2632
package java.lang;
2733

2834
import java.util.WeakHashMap;
@@ -34,6 +40,10 @@
3440
import static java.lang.ClassValue.ClassValueMap.probeHomeLocation;
3541
import static java.lang.ClassValue.ClassValueMap.probeBackupLocations;
3642

43+
/*[IF CRIU_SUPPORT]*/
44+
import openj9.internal.criu.NotCheckpointSafe;
45+
/*[ENDIF] CRIU_SUPPORT */
46+
3747
/**
3848
* Lazily associate a computed value with (potentially) every type.
3949
* For example, if a dynamic language needs to construct a message dispatch
@@ -372,6 +382,9 @@ private static ClassValueMap getMap(Class<?> type) {
372382

373383
private static final Object CRITICAL_SECTION = new Object();
374384
private static final Unsafe UNSAFE = Unsafe.getUnsafe();
385+
/*[IF CRIU_SUPPORT]*/
386+
@NotCheckpointSafe
387+
/*[ENDIF] CRIU_SUPPORT */
375388
private static ClassValueMap initializeMap(Class<?> type) {
376389
ClassValueMap map;
377390
synchronized (CRITICAL_SECTION) { // private object to avoid deadlocks

src/java.base/share/classes/java/lang/invoke/ClassSpecializer.java

Lines changed: 13 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. 2022, 2022 All Rights Reserved
29+
* ===========================================================================
30+
*/
31+
2632
package java.lang.invoke;
2733

2834
import jdk.internal.access.SharedSecrets;
@@ -53,6 +59,10 @@
5359
import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
5460
import static jdk.internal.org.objectweb.asm.Opcodes.*;
5561

62+
/*[IF CRIU_SUPPORT]*/
63+
import openj9.internal.criu.NotCheckpointSafe;
64+
/*[ENDIF] CRIU_SUPPORT */
65+
5666
/**
5767
* Class specialization code.
5868
* @param <T> top class under which species classes are created.
@@ -159,6 +169,9 @@ public Object apply(Object key) {
159169
}
160170
};
161171

172+
/*[IF CRIU_SUPPORT]*/
173+
@NotCheckpointSafe
174+
/*[ENDIF] CRIU_SUPPORT */
162175
public final S findSpecies(K key) {
163176
// Note: Species instantiation may throw VirtualMachineError because of
164177
// code cache overflow. If this happens the species bytecode may be

src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@
3333
* http://creativecommons.org/publicdomain/zero/1.0/
3434
*/
3535

36+
/*
37+
* ===========================================================================
38+
* (c) Copyright IBM Corp. 2022, 2022 All Rights Reserved
39+
* ===========================================================================
40+
*/
41+
3642
package java.util.concurrent;
3743

3844
import java.io.ObjectStreamField;
@@ -70,6 +76,10 @@
7076
import java.util.stream.Stream;
7177
import jdk.internal.misc.Unsafe;
7278

79+
/*[IF CRIU_SUPPORT]*/
80+
import openj9.internal.criu.NotCheckpointSafe;
81+
/*[ENDIF] CRIU_SUPPORT */
82+
7383
/**
7484
* A hash table supporting full concurrency of retrievals and
7585
* high expected concurrency for updates. This class obeys the
@@ -1688,6 +1698,9 @@ boolean removeValueIf(Predicate<? super V> function) {
16881698
* @throws RuntimeException or Error if the mappingFunction does so,
16891699
* in which case the mapping is left unestablished
16901700
*/
1701+
/*[IF CRIU_SUPPORT]*/
1702+
@NotCheckpointSafe
1703+
/*[ENDIF] CRIU_SUPPORT */
16911704
public V computeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction) {
16921705
if (key == null || mappingFunction == null)
16931706
throw new NullPointerException();

src/java.base/share/classes/sun/nio/cs/StandardCharsets.java.template

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@
2525
*
2626
*/
2727

28+
/*
29+
* ===========================================================================
30+
* (c) Copyright IBM Corp. 2022, 2022 All Rights Reserved
31+
* ===========================================================================
32+
*/
33+
2834
// -- This file was mechanically generated: Do not edit! -- //
2935

3036
package sun.nio.cs;
@@ -36,6 +42,10 @@ import java.util.Map;
3642
import java.util.Set;
3743
import jdk.internal.vm.annotation.Stable;
3844

45+
/*[IF CRIU_SUPPORT]*/
46+
import openj9.internal.criu.NotCheckpointSafe;
47+
/*[ENDIF] CRIU_SUPPORT */
48+
3949
public class StandardCharsets extends CharsetProvider {
4050

4151
_INCLUDE_ALIASES_TABLES_
@@ -165,6 +175,9 @@ public class StandardCharsets extends CharsetProvider {
165175
return cs;
166176
}
167177

178+
/*[IF CRIU_SUPPORT]*/
179+
@NotCheckpointSafe
180+
/*[ENDIF] CRIU_SUPPORT */
168181
public final Charset charsetForName(String charsetName) {
169182
synchronized (this) {
170183
return lookup(charsetName);

0 commit comments

Comments
 (0)