Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
prsadhuk committed May 9, 2020
2 parents b75ea9b + 15d7ef7 commit d8510ea
Show file tree
Hide file tree
Showing 15 changed files with 285 additions and 68 deletions.
5 changes: 4 additions & 1 deletion make/autoconf/flags-cflags.m4
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,10 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP],
fi
if test "x$TOOLCHAIN_TYPE" = xgcc; then
if test "x$FLAGS_CPU" = xarm; then
if test "x$FLAGS_CPU" = xaarch64; then
# -Wno-psabi to get rid of annoying "note: parameter passing for argument of type '<type> changed in GCC 9.1"
$1_CFLAGS_CPU="-Wno-psabi"
elif test "x$FLAGS_CPU" = xarm; then
# -Wno-psabi to get rid of annoying "note: the mangling of 'va_list' has changed in GCC 4.4"
$1_CFLAGS_CPU="-fsigned-char -Wno-psabi $ARM_ARCH_TYPE_FLAGS $ARM_FLOAT_TYPE_FLAGS -DJDK_ARCH_ABI_PROP_NAME='\"\$(JDK_ARCH_ABI_PROP_NAME)\"'"
$1_CFLAGS_CPU_JVM="-DARM"
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ void ShenandoahBarrierC2Support::test_gc_state(Node*& ctrl, Node* raw_mem, Node*
ctrl = new IfTrueNode(gc_state_iff);
test_fail_ctrl = new IfFalseNode(gc_state_iff);

IdealLoopTree* loop = phase->get_loop(ctrl);
IdealLoopTree* loop = phase->get_loop(old_ctrl);
phase->register_control(gc_state_iff, loop, old_ctrl);
phase->register_control(ctrl, loop, gc_state_iff);
phase->register_control(test_fail_ctrl, loop, gc_state_iff);
Expand Down
6 changes: 4 additions & 2 deletions src/hotspot/share/jfr/dcmd/jfrDcmds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,8 @@ JfrConfigureFlightRecorderDCmd::JfrConfigureFlightRecorderDCmd(outputStream* out
_thread_buffer_size("thread_buffer_size", "Size of a thread buffer", "MEMORY SIZE", false, "8k"),
_memory_size("memorysize", "Overall memory size, ", "MEMORY SIZE", false, "10m"),
_max_chunk_size("maxchunksize", "Size of an individual disk chunk", "MEMORY SIZE", false, "12m"),
_sample_threads("samplethreads", "Activate Thread sampling", "BOOLEAN", false, "true") {
_sample_threads("samplethreads", "Activate Thread sampling", "BOOLEAN", false, "true"),
_verbose(true) {
_dcmdparser.add_dcmd_option(&_repository_path);
_dcmdparser.add_dcmd_option(&_dump_path);
_dcmdparser.add_dcmd_option(&_stack_depth);
Expand Down Expand Up @@ -650,14 +651,15 @@ void JfrConfigureFlightRecorderDCmd::execute(DCmdSource source, TRAPS) {

static const char klass[] = "jdk/jfr/internal/dcmd/DCmdConfigure";
static const char method[] = "execute";
static const char signature[] = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;"
static const char signature[] = "(ZLjava/lang/String;Ljava/lang/String;Ljava/lang/Integer;"
"Ljava/lang/Long;Ljava/lang/Long;Ljava/lang/Long;Ljava/lang/Long;"
"Ljava/lang/Long;Ljava/lang/Boolean;)Ljava/lang/String;";

JfrJavaArguments execute_args(&result, klass, method, signature, CHECK);
execute_args.set_receiver(h_dcmd_instance);

// params
execute_args.push_int(_verbose ? 1 : 0);
execute_args.push_jobject(repository_path);
execute_args.push_jobject(dump_path);
execute_args.push_jobject(stack_depth);
Expand Down
4 changes: 4 additions & 0 deletions src/hotspot/share/jfr/dcmd/jfrDcmds.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,13 @@ class JfrConfigureFlightRecorderDCmd : public DCmdWithParser {
DCmdArgument<MemorySizeArgument> _memory_size;
DCmdArgument<MemorySizeArgument> _max_chunk_size;
DCmdArgument<bool> _sample_threads;
bool _verbose;

public:
JfrConfigureFlightRecorderDCmd(outputStream* output, bool heap);
void set_verbose(bool verbose) {
_verbose = verbose;
}
static const char* name() {
return "JFR.configure";
}
Expand Down
1 change: 1 addition & 0 deletions src/hotspot/share/jfr/recorder/service/jfrOptionSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ bool JfrOptionSet::configure(TRAPS) {
configure._sample_threads.set_is_set(_dcmd_sample_threads.is_set());
configure._sample_threads.set_value(_dcmd_sample_threads.value());

configure.set_verbose(false);
configure.execute(DCmd_Source_Internal, THREAD);

if (HAS_PENDING_EXCEPTION) {
Expand Down
42 changes: 31 additions & 11 deletions src/jdk.jfr/share/classes/jdk/jfr/internal/dcmd/DCmdConfigure.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import jdk.jfr.internal.LogTag;
import jdk.jfr.internal.Logger;
import jdk.jfr.internal.Options;
import jdk.jfr.internal.PlatformRecorder;
import jdk.jfr.internal.PrivateAccess;
import jdk.jfr.internal.Repository;
import jdk.jfr.internal.SecuritySupport.SafePath;
Expand Down Expand Up @@ -62,6 +61,7 @@ final class DCmdConfigure extends AbstractDCmd {
*/
public String execute
(
boolean verbose,
String repositoryPath,
String dumpPath,
Integer stackDepth,
Expand Down Expand Up @@ -99,66 +99,86 @@ final class DCmdConfigure extends AbstractDCmd {
} catch (Exception e) {
throw new DCmdException("Could not use " + repositoryPath + " as repository. " + e.getMessage(), e);
}
printRepositoryPath();
if (verbose) {
printRepositoryPath();
}
updated = true;
}

if (dumpPath != null) {
Options.setDumpPath(new SafePath(dumpPath));
Logger.log(LogTag.JFR, LogLevel.INFO, "Emergency dump path set to " + dumpPath);
printDumpPath();
if (verbose) {
printDumpPath();
}
updated = true;
}

if (stackDepth != null) {
Options.setStackDepth(stackDepth);
Logger.log(LogTag.JFR, LogLevel.INFO, "Stack depth set to " + stackDepth);
printStackDepth();
if (verbose) {
printStackDepth();
}
updated = true;
}

if (globalBufferCount != null) {
Options.setGlobalBufferCount(globalBufferCount);
Logger.log(LogTag.JFR, LogLevel.INFO, "Global buffer count set to " + globalBufferCount);
printGlobalBufferCount();
if (verbose) {
printGlobalBufferCount();
}
updated = true;
}

if (globalBufferSize != null) {
Options.setGlobalBufferSize(globalBufferSize);
Logger.log(LogTag.JFR, LogLevel.INFO, "Global buffer size set to " + globalBufferSize);
printGlobalBufferSize();
if (verbose) {
printGlobalBufferSize();
}
updated = true;
}

if (threadBufferSize != null) {
Options.setThreadBufferSize(threadBufferSize);
Logger.log(LogTag.JFR, LogLevel.INFO, "Thread buffer size set to " + threadBufferSize);
printThreadBufferSize();
if (verbose) {
printThreadBufferSize();
}
updated = true;
}

if (memorySize != null) {
Options.setMemorySize(memorySize);
Logger.log(LogTag.JFR, LogLevel.INFO, "Memory size set to " + memorySize);
printMemorySize();
if (verbose) {
printMemorySize();
}
updated = true;
}

if (maxChunkSize != null) {
Options.setMaxChunkSize(maxChunkSize);
Logger.log(LogTag.JFR, LogLevel.INFO, "Max chunk size set to " + maxChunkSize);
printMaxChunkSize();
if (verbose) {
printMaxChunkSize();
}
updated = true;
}

if (sampleThreads != null) {
Options.setSampleThreads(sampleThreads);
Logger.log(LogTag.JFR, LogLevel.INFO, "Sample threads set to " + sampleThreads);
printSampleThreads();
if (verbose) {
printSampleThreads();
}
updated = true;
}

if (!verbose) {
return "";
}
if (!updated) {
println("Current configuration:");
println();
Expand Down
17 changes: 16 additions & 1 deletion src/jdk.jlink/share/classes/jdk/tools/jmod/JmodOutputStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import jdk.internal.jmod.JmodFile;
Expand All @@ -44,6 +48,8 @@
* Output stream to write to JMOD file
*/
class JmodOutputStream extends OutputStream implements AutoCloseable {
private final Map<Section, Set<String>> entries = new HashMap<>();

/**
* This method creates (or overrides, if exists) the JMOD file,
* returning the the output stream to write to the JMOD file.
Expand Down Expand Up @@ -110,13 +116,22 @@ public void writeEntry(InputStream in, Entry e) throws IOException {
zos.closeEntry();
}

private ZipEntry newEntry(Section section, String path) {
private ZipEntry newEntry(Section section, String path) throws IOException {
if (contains(section, path)) {
throw new IOException("duplicate entry: " + path + " in section " + section);
}
String prefix = section.jmodDir();
String name = Paths.get(prefix, path).toString()
.replace(File.separatorChar, '/');
entries.get(section).add(path);
return new ZipEntry(name);
}

public boolean contains(Section section, String path) {
Set<String> set = entries.computeIfAbsent(section, k -> new HashSet<>());
return set.contains(path);
}

@Override
public void write(int b) throws IOException {
zos.write(b);
Expand Down
33 changes: 18 additions & 15 deletions src/jdk.jlink/share/classes/jdk/tools/jmod/JmodTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -757,21 +757,17 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
throws IOException
{
Path relPath = path.relativize(file);
if (relPath.toString().equals(MODULE_INFO)
&& !Section.CLASSES.equals(section))
warning("warn.ignore.entry", MODULE_INFO, section);

if (!relPath.toString().equals(MODULE_INFO)
&& !matches(relPath, excludes)) {
try (InputStream in = Files.newInputStream(file)) {
out.writeEntry(in, section, relPath.toString());
} catch (IOException x) {
if (x.getMessage().contains("duplicate entry")) {
warning("warn.ignore.duplicate.entry",
relPath.toString(), section);
return FileVisitResult.CONTINUE;
String name = relPath.toString();
if (name.equals(MODULE_INFO)) {
if (!Section.CLASSES.equals(section))
warning("warn.ignore.entry", name, section);
} else if (!matches(relPath, excludes)) {
if (out.contains(section, name)) {
warning("warn.ignore.duplicate.entry", name, section);
} else {
try (InputStream in = Files.newInputStream(file)) {
out.writeEntry(in, section, name);
}
throw x;
}
}
return FileVisitResult.CONTINUE;
Expand Down Expand Up @@ -808,7 +804,14 @@ public void accept(JarEntry je) {
public boolean test(JarEntry je) {
String name = je.getName();
// ## no support for excludes. Is it really needed?
return !name.endsWith(MODULE_INFO) && !je.isDirectory();
if (name.endsWith(MODULE_INFO) || je.isDirectory()) {
return false;
}
if (out.contains(Section.CLASSES, name)) {
warning("warn.ignore.duplicate.entry", name, Section.CLASSES);
return false;
}
return true;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@
import jdk.internal.org.jline.terminal.Terminal;
import jdk.internal.org.jline.terminal.TerminalBuilder;
import jdk.internal.org.jline.utils.Display;
import jdk.internal.org.jline.utils.NonBlocking;
import jdk.internal.org.jline.utils.NonBlockingInputStreamImpl;
import jdk.internal.org.jline.utils.NonBlockingReader;
import jdk.jshell.ExpressionSnippet;
import jdk.jshell.Snippet;
Expand Down Expand Up @@ -103,14 +105,20 @@ class ConsoleIOContext extends IOContext {
Map<String, Object> variables = new HashMap<>();
this.input = new StopDetectingInputStream(() -> repl.stop(),
ex -> repl.hard("Error on input: %s", ex));
InputStream nonBlockingInput = new NonBlockingInputStreamImpl(null, input) {
@Override
public int readBuffered(byte[] b) throws IOException {
return input.read(b);
}
};
Terminal terminal;
if (System.getProperty("test.jdk") != null) {
terminal = new TestTerminal(input, cmdout);
terminal = new TestTerminal(nonBlockingInput, cmdout);
input.setInputStream(cmdin);
} else {
terminal = TerminalBuilder.builder().inputStreamWrapper(in -> {
input.setInputStream(in);
return input;
return nonBlockingInput;
}).build();
}
originalAttributes = terminal.getAttributes();
Expand Down Expand Up @@ -827,7 +835,7 @@ public void replaceLastHistoryEntry(String source) {

private boolean fixes() {
try {
int c = in.getTerminal().input().read();
int c = in.getTerminal().reader().read();

if (c == (-1)) {
return true; //TODO: true or false???
Expand Down Expand Up @@ -1234,11 +1242,11 @@ private static final class TestTerminal extends LineDisciplineTerminal {

private static final int DEFAULT_HEIGHT = 24;

public TestTerminal(StopDetectingInputStream input, OutputStream output) throws Exception {
private final NonBlockingReader inputReader;

public TestTerminal(InputStream input, OutputStream output) throws Exception {
super("test", "ansi", output, Charset.forName("UTF-8"));
// setAnsiSupported(true);
// setEchoEnabled(false);
// this.input = input;
this.inputReader = NonBlocking.nonBlocking(getName(), input, encoding());
Attributes a = new Attributes(getAttributes());
a.setLocalFlag(LocalFlag.ECHO, false);
setAttributes(attributes);
Expand All @@ -1252,18 +1260,18 @@ public TestTerminal(StopDetectingInputStream input, OutputStream output) throws
// ignore
}
setSize(new Size(80, h));
new Thread(() -> {
int r;
}

try {
while ((r = input.read()) != (-1)) {
processInputByte(r);
}
slaveInput.close();
} catch (IOException ex) {
throw new IllegalStateException(ex);
}
}).start();
@Override
public NonBlockingReader reader() {
return inputReader;
}

@Override
protected void doClose() throws IOException {
super.doClose();
slaveInput.close();
inputReader.close();
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,19 @@ public synchronized int read() {
}
}

@Override
public int read(byte[] b, int off, int len) throws IOException {
if (len == 0) {
return 0;
}
int r = read();
if (r != (-1)) {
b[off] = (byte) r;
return 1;
}
return 0;
}

public synchronized void shutdown() {
state = State.CLOSED;
notifyAll();
Expand Down
1 change: 0 additions & 1 deletion test/jdk/ProblemList.txt
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,6 @@ sun/security/provider/KeyStore/DKSTest.sh 8180266 windows-
sun/security/pkcs11/KeyStore/SecretKeysBasic.sh 8209398 generic-all

security/infra/java/security/cert/CertPathValidator/certification/ActalisCA.java 8224768 generic-all
security/infra/java/security/cert/CertPathValidator/certification/LuxTrustCA.java 8237888 generic-all

sun/security/smartcardio/TestChannel.java 8039280 generic-all
sun/security/smartcardio/TestConnect.java 8039280 generic-all
Expand Down
Loading

0 comments on commit d8510ea

Please sign in to comment.