Skip to content

Commit

Permalink
Merge pull request #539 from ibmruntimes/openj9
Browse files Browse the repository at this point in the history
Merge jdk-11.0.16+6 and the latest OpenJ9 changes to 0.33
  • Loading branch information
JasonFengJ9 committed Jun 9, 2022
2 parents fa0ab6f + 8515bda commit 01a678d
Show file tree
Hide file tree
Showing 9 changed files with 105 additions and 50 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/submit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@ jobs:

- name: Install cygwin
run: |
Start-Process -FilePath "$HOME\cygwin\setup-x86_64.exe" -ArgumentList "--quiet-mode --packages cygwin=3.2.0-1,autoconf,make,zip,unzip --root $HOME\cygwin\cygwin64 --local-package-dir $HOME\cygwin\packages --site http://mirrors.kernel.org/sourceware/cygwin --no-desktop --no-shortcuts --no-startmenu --no-admin" -Wait -NoNewWindow
Start-Process -FilePath "$HOME\cygwin\setup-x86_64.exe" -ArgumentList "--quiet-mode --packages cygwin=3.3.5-1,autoconf,make,zip,unzip --root $HOME\cygwin\cygwin64 --local-package-dir $HOME\cygwin\packages --site http://mirrors.kernel.org/sourceware/cygwin --no-desktop --no-shortcuts --no-startmenu --no-admin" -Wait -NoNewWindow
- name: Checkout the source
uses: actions/checkout@v3
Expand Down Expand Up @@ -1083,7 +1083,7 @@ jobs:

- name: Install cygwin
run: |
Start-Process -FilePath "$HOME\cygwin\setup-x86_64.exe" -ArgumentList "--quiet-mode --packages cygwin=3.2.0-1,autoconf,make,zip,unzip --root $HOME\cygwin\cygwin64 --local-package-dir $HOME\cygwin\packages --site http://mirrors.kernel.org/sourceware/cygwin --no-desktop --no-shortcuts --no-startmenu --no-admin" -Wait -NoNewWindow
Start-Process -FilePath "$HOME\cygwin\setup-x86_64.exe" -ArgumentList "--quiet-mode --packages cygwin=3.3.5-1,autoconf,make,zip,unzip --root $HOME\cygwin\cygwin64 --local-package-dir $HOME\cygwin\packages --site http://mirrors.kernel.org/sourceware/cygwin --no-desktop --no-shortcuts --no-startmenu --no-admin" -Wait -NoNewWindow
- name: Restore jtreg artifact
id: jtreg_restore
Expand Down
2 changes: 2 additions & 0 deletions closed/GensrcJ9JCL.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ $(eval $(call SetupCopyFiles,COPY_OVERLAY_FILES, \
DEST := $(SUPPORT_OUTPUTDIR)/overlay, \
FILES := \
src/java.base/share/classes/java/security/Security.java \
src/java.base/share/classes/java/util/Timer.java \
src/java.base/share/classes/java/util/TimerTask.java \
src/java.base/unix/classes/java/lang/ProcessEnvironment.java \
))

Expand Down
2 changes: 1 addition & 1 deletion closed/openjdk-tag.gmk
Original file line number Diff line number Diff line change
@@ -1 +1 @@
OPENJDK_TAG := jdk-11.0.16+5
OPENJDK_TAG := jdk-11.0.16+6
40 changes: 40 additions & 0 deletions src/java.base/share/classes/java/util/Timer.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,20 @@
* questions.
*/

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

package java.util;
import java.util.Date;
import java.util.concurrent.atomic.AtomicInteger;

/*[IF CRIU_SUPPORT]*/
import openj9.internal.criu.InternalCRIUSupport;
/*[ENDIF] CRIU_SUPPORT*/

/**
* A facility for threads to schedule tasks for future execution in a
* background thread. Tasks may be scheduled for one-time execution, or for
Expand Down Expand Up @@ -191,6 +201,12 @@ public Timer(String name, boolean isDaemon) {
public void schedule(TimerTask task, long delay) {
if (delay < 0)
throw new IllegalArgumentException("Negative delay.");
/*[IF CRIU_SUPPORT]*/
// only tasks scheduled before Checkpoint to be adjusted
if (InternalCRIUSupport.getCheckpointRestoreNanoTimeDelta() == 0) {
task.criuAdjustRequired = true;
}
/*[ENDIF] CRIU_SUPPORT*/
sched(task, System.currentTimeMillis()+delay, 0);
}

Expand Down Expand Up @@ -246,6 +262,12 @@ public void schedule(TimerTask task, long delay, long period) {
throw new IllegalArgumentException("Negative delay.");
if (period <= 0)
throw new IllegalArgumentException("Non-positive period.");
/*[IF CRIU_SUPPORT]*/
// only tasks scheduled before Checkpoint to be adjusted
if (InternalCRIUSupport.getCheckpointRestoreNanoTimeDelta() == 0) {
task.criuAdjustRequired = true;
}
/*[ENDIF] CRIU_SUPPORT*/
sched(task, System.currentTimeMillis()+delay, -period);
}

Expand Down Expand Up @@ -326,6 +348,12 @@ public void scheduleAtFixedRate(TimerTask task, long delay, long period) {
throw new IllegalArgumentException("Negative delay.");
if (period <= 0)
throw new IllegalArgumentException("Non-positive period.");
/*[IF CRIU_SUPPORT]*/
// only tasks scheduled before Checkpoint to be adjusted
if (InternalCRIUSupport.getCheckpointRestoreNanoTimeDelta() == 0) {
task.criuAdjustRequired = true;
}
/*[ENDIF] CRIU_SUPPORT*/
sched(task, System.currentTimeMillis()+delay, period);
}

Expand Down Expand Up @@ -537,6 +565,18 @@ private void mainLoop() {
continue; // No action required, poll queue again
}
currentTime = System.currentTimeMillis();
/*[IF CRIU_SUPPORT]*/
if (task.criuAdjustRequired) {
long checkpointRestoreTimeDelta = InternalCRIUSupport.getCheckpointRestoreNanoTimeDelta();
// A zero checkpointRestoreTimeDelta value indicates no Checkpoint performed yet,
// it can't be negative, otherwise a RestoreException already was thrown.
if (checkpointRestoreTimeDelta > 0) {
task.nextExecutionTime += (checkpointRestoreTimeDelta / 1000000);
// clear the flag - only one time adjustment required
task.criuAdjustRequired = false;
}
}
/*[ENDIF] CRIU_SUPPORT*/
executionTime = task.nextExecutionTime;
if (taskFired = (executionTime<=currentTime)) {
if (task.period == 0) { // Non-repeating, remove
Expand Down
13 changes: 13 additions & 0 deletions src/java.base/share/classes/java/util/TimerTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
* questions.
*/

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

package java.util;

/**
Expand Down Expand Up @@ -84,6 +90,13 @@ public abstract class TimerTask implements Runnable {
*/
long period = 0;

/*[IF CRIU_SUPPORT]*/
/**
* Determine if the nextExecutionTime is to be adjusted.
*/
boolean criuAdjustRequired;
/*[ENDIF] CRIU_SUPPORT*/

/**
* Creates a new timer task.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 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 @@ -62,6 +62,7 @@
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.util.zip.ZipException;

import javax.lang.model.SourceVersion;
import javax.tools.FileObject;
Expand Down Expand Up @@ -511,7 +512,11 @@ public ArchiveContainer(Path archivePath) throws IOException, ProviderNotFoundEx
Map<String,String> env = Collections.singletonMap("multi-release", multiReleaseValue);
FileSystemProvider jarFSProvider = fsInfo.getJarFSProvider();
Assert.checkNonNull(jarFSProvider, "should have been caught before!");
this.fileSystem = jarFSProvider.newFileSystem(archivePath, env);
try {
this.fileSystem = jarFSProvider.newFileSystem(archivePath, env);
} catch (ZipException ze) {
throw new IOException("ZipException opening \"" + archivePath.getFileName() + "\": " + ze.getMessage(), ze);
}
} else {
this.fileSystem = FileSystems.newFileSystem(archivePath, null);
}
Expand Down
75 changes: 34 additions & 41 deletions src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -1102,9 +1102,9 @@ private byte[] initCEN() throws IOException {
zerror("invalid CEN header (bad header size)");
}
IndexNode inode = new IndexNode(cen, pos, nlen);
if (hasDotOrDotDot(inode.name)) {
if (inode.pathHasDotOrDotDot()) {
throw new ZipException("ZIP file can't be opened as a file system " +
"because an entry has a '.' or '..' element in its name");
"because entry \"" + inode.nameAsString() + "\" has a '.' or '..' element in its name");
}
inodes.put(inode, inode);
if (zc.isUTF8() || (flag & FLAG_USE_UTF8) != 0) {
Expand All @@ -1122,44 +1122,6 @@ private byte[] initCEN() throws IOException {
return cen;
}

/**
* Check Inode.name to see if it includes a "." or ".." in the name array
* @param path the path as stored in Inode.name to verify
* @return true if the path contains a "." or ".." entry; false otherwise
*/
private boolean hasDotOrDotDot(byte[] path) {
// Inode.name always includes "/" in path[0]
assert path[0] == '/';
if (path.length == 1) {
return false;
}
int index = 1;
while (index < path.length) {
int starting = index;
while (index < path.length && path[index] != '/') {
index++;
}
// Check the path snippet for a "." or ".."
if (isDotOrDotDotPath(path, starting, index)) {
return true;
}
index++;
}
return false;
}

/**
* Check the path to see if it includes a "." or ".."
* @param path the path to check
* @return true if the path contains a "." or ".." entry; false otherwise
*/
private boolean isDotOrDotDotPath(byte[] path, int start, int index) {
int pathLen = index - start;
if ((pathLen == 1 && path[start] == '.'))
return true;
return (pathLen == 2 && path[start] == '.') && path[start + 1] == '.';
}

private final void checkUTF8(byte[] a) throws ZipException {
try {
int end = a.length;
Expand Down Expand Up @@ -2181,6 +2143,37 @@ boolean isDir() {
return isdir;
}

/**
* Check name if it contains a "." or ".." path element
* @return true if the path contains a "." or ".." entry; false otherwise
*/
private boolean pathHasDotOrDotDot() {
// name always includes "/" in path[0]
assert name[0] == '/';
if (name.length == 1) {
return false;
}
int index = 1;
while (index < name.length) {
int start = index;
while (index < name.length && name[index] != '/') {
index++;
}
if (name[start] == '.') {
int len = index - start;
if (len == 1 || (name[start + 1] == '.' && len == 2)) {
return true;
}
}
index++;
}
return false;
}

protected String nameAsString() {
return new String(name);
}

public boolean equals(Object other) {
if (!(other instanceof IndexNode)) {
return false;
Expand Down Expand Up @@ -2751,7 +2744,7 @@ public byte[] comment() {
public String toString() {
StringBuilder sb = new StringBuilder(1024);
Formatter fm = new Formatter(sb);
fm.format(" name : %s%n", new String(name));
fm.format(" name : %s%n", nameAsString());
fm.format(" creationTime : %tc%n", creationTime().toMillis());
fm.format(" lastAccessTime : %tc%n", lastAccessTime().toMillis());
fm.format(" lastModifiedTime: %tc%n", lastModifiedTime().toMillis());
Expand Down
4 changes: 3 additions & 1 deletion test/jdk/ProblemList.txt
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ javax/security/auth/kerberos/KerberosTixDateTest.java 8039280 generic-
sun/security/provider/PolicyFile/GrantAllPermToExtWhenNoPolicy.java 8039280 generic-all
sun/security/provider/PolicyParser/ExtDirsChange.java 8039280 generic-all
sun/security/provider/PolicyParser/PrincipalExpansionError.java 8039280 generic-all
sun/security/ssl/SSLSessionImpl/NoInvalidateSocketException.java 8277970 linux-all,macosx-x64
sun/security/ssl/SSLSessionImpl/NoInvalidateSocketException.java 8277970,8280158 generic-all

sun/security/ssl/X509TrustManagerImpl/Symantec/Distrust.java 8287109 generic-all

Expand Down Expand Up @@ -813,6 +813,8 @@ com/sun/jdi/RepStep.java 8043571 generic-

com/sun/jdi/NashornPopFrameTest.java 8187143 generic-all

com/sun/jdi/InvokeHangTest.java 8218463 linux-all

############################################################################

# jdk_time
Expand Down
6 changes: 3 additions & 3 deletions test/jdk/java/nio/file/Files/probeContentType/Basic.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/

/* @test
* @bug 4313887 8129632 8129633 8162624 8146215 8162745 8273655
* @bug 4313887 8129632 8129633 8162624 8146215 8162745 8273655 8274171
* @summary Unit test for probeContentType method
* @library ../..
* @build Basic SimpleFileTypeDetector
Expand Down Expand Up @@ -178,8 +178,8 @@ public static void main(String[] args) throws IOException {
new ExType("png", List.of("image/png")),
new ExType("ppt", List.of("application/vnd.ms-powerpoint")),
new ExType("pptx",List.of("application/vnd.openxmlformats-officedocument.presentationml.presentation")),
new ExType("py", List.of("text/plain", "text/x-python-script")),
new ExType("rar", List.of("application/vnd.rar")),
new ExType("py", List.of("text/plain", "text/x-python", "text/x-python-script")),
new ExType("rar", List.of("application/rar", "application/vnd.rar")),
new ExType("rtf", List.of("application/rtf", "text/rtf")),
new ExType("webm", List.of("video/webm")),
new ExType("webp", List.of("image/webp")),
Expand Down

0 comments on commit 01a678d

Please sign in to comment.