--- a/.hgtags Thu Mar 21 21:37:09 2019 -0700
+++ b/.hgtags Fri Mar 22 14:39:16 2019 +0530
@@ -549,3 +549,5 @@
8e069f7b4fabfe05d9f500783e6d56cb0196d25c jdk-13+10
21ea4076a275a0f498afa517e9ee1b94a9cf0255 jdk-13+11
1d7aec80147a6d92b101a76aef92f3ddc88bedf4 jdk-13+12
+b67884871b5fff79c5ef3eb8ac74dd48d71ea9b1 jdk-12-ga
+83cace4142c8563b6a921787db02388e1bc48d01 jdk-13+13
--- a/src/hotspot/os/linux/os_linux.cpp Thu Mar 21 21:37:09 2019 -0700
+++ b/src/hotspot/os/linux/os_linux.cpp Fri Mar 22 14:39:16 2019 +0530
@@ -2140,46 +2140,87 @@
st->print("container (cgroup) information:\n");
const char *p_ct = OSContainer::container_type();
- st->print("container_type: %s\n", p_ct != NULL ? p_ct : "failed");
+ st->print("container_type: %s\n", p_ct != NULL ? p_ct : "not supported");
char *p = OSContainer::cpu_cpuset_cpus();
- st->print("cpu_cpuset_cpus: %s\n", p != NULL ? p : "failed");
+ st->print("cpu_cpuset_cpus: %s\n", p != NULL ? p : "not supported");
free(p);
p = OSContainer::cpu_cpuset_memory_nodes();
- st->print("cpu_memory_nodes: %s\n", p != NULL ? p : "failed");
+ st->print("cpu_memory_nodes: %s\n", p != NULL ? p : "not supported");
free(p);
int i = OSContainer::active_processor_count();
+ st->print("active_processor_count: ");
if (i > 0) {
- st->print("active_processor_count: %d\n", i);
+ st->print("%d\n", i);
} else {
- st->print("active_processor_count: failed\n");
+ st->print("not supported\n");
}
i = OSContainer::cpu_quota();
- st->print("cpu_quota: %d\n", i);
+ st->print("cpu_quota: ");
+ if (i > 0) {
+ st->print("%d\n", i);
+ } else {
+ st->print("%s\n", i == OSCONTAINER_ERROR ? "not supported" : "no quota");
+ }
i = OSContainer::cpu_period();
- st->print("cpu_period: %d\n", i);
+ st->print("cpu_period: ");
+ if (i > 0) {
+ st->print("%d\n", i);
+ } else {
+ st->print("%s\n", i == OSCONTAINER_ERROR ? "not supported" : "no period");
+ }
i = OSContainer::cpu_shares();
- st->print("cpu_shares: %d\n", i);
+ st->print("cpu_shares: ");
+ if (i > 0) {
+ st->print("%d\n", i);
+ } else {
+ st->print("%s\n", i == OSCONTAINER_ERROR ? "not supported" : "no shares");
+ }
jlong j = OSContainer::memory_limit_in_bytes();
- st->print("memory_limit_in_bytes: " JLONG_FORMAT "\n", j);
+ st->print("memory_limit_in_bytes: ");
+ if (j > 0) {
+ st->print(JLONG_FORMAT "\n", j);
+ } else {
+ st->print("%s\n", j == OSCONTAINER_ERROR ? "not supported" : "unlimited");
+ }
j = OSContainer::memory_and_swap_limit_in_bytes();
- st->print("memory_and_swap_limit_in_bytes: " JLONG_FORMAT "\n", j);
+ st->print("memory_and_swap_limit_in_bytes: ");
+ if (j > 0) {
+ st->print(JLONG_FORMAT "\n", j);
+ } else {
+ st->print("%s\n", j == OSCONTAINER_ERROR ? "not supported" : "unlimited");
+ }
j = OSContainer::memory_soft_limit_in_bytes();
- st->print("memory_soft_limit_in_bytes: " JLONG_FORMAT "\n", j);
+ st->print("memory_soft_limit_in_bytes: ");
+ if (j > 0) {
+ st->print(JLONG_FORMAT "\n", j);
+ } else {
+ st->print("%s\n", j == OSCONTAINER_ERROR ? "not supported" : "unlimited");
+ }
j = OSContainer::OSContainer::memory_usage_in_bytes();
- st->print("memory_usage_in_bytes: " JLONG_FORMAT "\n", j);
+ st->print("memory_usage_in_bytes: ");
+ if (j > 0) {
+ st->print(JLONG_FORMAT "\n", j);
+ } else {
+ st->print("%s\n", j == OSCONTAINER_ERROR ? "not supported" : "unlimited");
+ }
j = OSContainer::OSContainer::memory_max_usage_in_bytes();
- st->print("memory_max_usage_in_bytes: " JLONG_FORMAT "\n", j);
+ st->print("memory_max_usage_in_bytes: ");
+ if (j > 0) {
+ st->print(JLONG_FORMAT "\n", j);
+ } else {
+ st->print("%s\n", j == OSCONTAINER_ERROR ? "not supported" : "unlimited");
+ }
st->cr();
}
--- a/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp Thu Mar 21 21:37:09 2019 -0700
+++ b/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp Fri Mar 22 14:39:16 2019 +0530
@@ -48,7 +48,7 @@
#include "oops/oop.inline.hpp"
#include "runtime/handles.inline.hpp"
-template<UpdateRefsMode UPDATE_REFS, StringDedupMode STRING_DEDUP>
+template<UpdateRefsMode UPDATE_REFS>
class ShenandoahInitMarkRootsClosure : public OopClosure {
private:
ShenandoahObjToScanQueue* _queue;
@@ -57,7 +57,7 @@
template <class T>
inline void do_oop_work(T* p) {
- ShenandoahConcurrentMark::mark_through_ref<T, UPDATE_REFS, STRING_DEDUP>(p, _heap, _queue, _mark_context);
+ ShenandoahConcurrentMark::mark_through_ref<T, UPDATE_REFS, NO_DEDUP>(p, _heap, _queue, _mark_context);
}
public:
@@ -99,13 +99,8 @@
ShenandoahObjToScanQueue* q = queues->queue(worker_id);
- if (ShenandoahStringDedup::is_enabled()) {
- ShenandoahInitMarkRootsClosure<UPDATE_REFS, ENQUEUE_DEDUP> mark_cl(q);
- do_work(heap, &mark_cl, worker_id);
- } else {
- ShenandoahInitMarkRootsClosure<UPDATE_REFS, NO_DEDUP> mark_cl(q);
- do_work(heap, &mark_cl, worker_id);
- }
+ ShenandoahInitMarkRootsClosure<UPDATE_REFS> mark_cl(q);
+ do_work(heap, &mark_cl, worker_id);
}
private:
--- a/src/hotspot/share/opto/library_call.cpp Thu Mar 21 21:37:09 2019 -0700
+++ b/src/hotspot/share/opto/library_call.cpp Fri Mar 22 14:39:16 2019 +0530
@@ -2407,7 +2407,7 @@
}
// Can base be NULL? Otherwise, always on-heap access.
- bool can_access_non_heap = TypePtr::NULL_PTR->higher_equal(_gvn.type(heap_base_oop));
+ bool can_access_non_heap = TypePtr::NULL_PTR->higher_equal(_gvn.type(base));
if (!can_access_non_heap) {
decorators |= IN_HEAP;
--- a/src/hotspot/share/runtime/arguments.cpp Thu Mar 21 21:37:09 2019 -0700
+++ b/src/hotspot/share/runtime/arguments.cpp Fri Mar 22 14:39:16 2019 +0530
@@ -530,6 +530,7 @@
{ "UseMembar", JDK_Version::jdk(10), JDK_Version::jdk(12), JDK_Version::undefined() },
{ "CompilationPolicyChoice", JDK_Version::jdk(13), JDK_Version::jdk(14), JDK_Version::undefined() },
{ "FailOverToOldVerifier", JDK_Version::jdk(13), JDK_Version::jdk(14), JDK_Version::undefined() },
+ { "AllowJNIEnvProxy", JDK_Version::jdk(13), JDK_Version::jdk(14), JDK_Version::jdk(15) },
{ "ThreadLocalHandshakes", JDK_Version::jdk(13), JDK_Version::jdk(14), JDK_Version::jdk(15) },
// --- Deprecated alias flags (see also aliased_jvm_flags) - sorted by obsolete_in then expired_in:
--- a/src/hotspot/share/runtime/globals.hpp Thu Mar 21 21:37:09 2019 -0700
+++ b/src/hotspot/share/runtime/globals.hpp Fri Mar 22 14:39:16 2019 +0530
@@ -861,7 +861,7 @@
"by the application (Solaris & Linux only)") \
\
product(bool, AllowJNIEnvProxy, false, \
- "Allow JNIEnv proxies for jdbx") \
+ "(Deprecated) Allow JNIEnv proxies for jdbx") \
\
product(bool, RestoreMXCSROnJNICalls, false, \
"Restore MXCSR when returning from JNI calls") \
@@ -1234,7 +1234,7 @@
"exit") \
\
product(bool, PrintFlagsRanges, false, \
- "Print VM flags and their ranges and exit VM") \
+ "Print VM flags and their ranges") \
\
diagnostic(bool, SerializeVMOutput, true, \
"Use a mutex to serialize output to tty and LogFile") \
--- a/src/java.base/share/classes/java/io/DataInput.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/io/DataInput.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2019, 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
@@ -48,7 +48,7 @@
* may be thrown if the input stream has been
* closed.
*
- * <h3><a id="modified-utf-8">Modified UTF-8</a></h3>
+ * <h2><a id="modified-utf-8">Modified UTF-8</a></h2>
* <p>
* Implementations of the DataInput and DataOutput interfaces represent
* Unicode strings in a format that is a slight modification of UTF-8.
--- a/src/java.base/share/classes/java/io/File.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/io/File.java Fri Mar 22 14:39:16 2019 +0530
@@ -128,7 +128,7 @@
* created, the abstract pathname represented by a <code>File</code> object
* will never change.
*
- * <h3>Interoperability with {@code java.nio.file} package</h3>
+ * <h2>Interoperability with {@code java.nio.file} package</h2>
*
* <p> The <a href="../../java/nio/file/package-summary.html">{@code java.nio.file}</a>
* package defines interfaces and classes for the Java virtual machine to access
--- a/src/java.base/share/classes/java/lang/Character.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/lang/Character.java Fri Mar 22 14:39:16 2019 +0530
@@ -44,7 +44,7 @@
* and for converting characters from uppercase to lowercase and vice
* versa.
*
- * <h3><a id="conformance">Unicode Conformance</a></h3>
+ * <h2><a id="conformance">Unicode Conformance</a></h2>
* <p>
* The fields and methods of class {@code Character} are defined in terms
* of character information from the Unicode Standard, specifically the
@@ -59,7 +59,7 @@
* {@code U+32FF}, from the first version of the Unicode Standard
* after 11.0 that assigns the code point.
*
- * <h3><a id="unicode">Unicode Character Representations</a></h3>
+ * <h2><a id="unicode">Unicode Character Representations</a></h2>
*
* <p>The {@code char} data type (and therefore the value that a
* {@code Character} object encapsulates) are based on the
--- a/src/java.base/share/classes/java/lang/ClassLoader.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/lang/ClassLoader.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, 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
@@ -126,7 +126,7 @@
* duration of the class loading process (see {@link #loadClass
* loadClass} methods).
*
- * <h3> <a id="builtinLoaders">Run-time Built-in Class Loaders</a></h3>
+ * <h2> <a id="builtinLoaders">Run-time Built-in Class Loaders</a></h2>
*
* The Java run-time has the following built-in class loaders:
*
--- a/src/java.base/share/classes/java/lang/ModuleLayer.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/lang/ModuleLayer.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, 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
@@ -120,7 +120,7 @@
* in this class causes a {@link NullPointerException NullPointerException} to
* be thrown. </p>
*
- * <h3> Example usage: </h3>
+ * <h2> Example usage: </h2>
*
* <p> This example creates a configuration by resolving a module named
* "{@code myapp}" with the configuration for the boot layer as the parent. It
--- a/src/java.base/share/classes/java/lang/doc-files/ValueBased.html Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/lang/doc-files/ValueBased.html Fri Mar 22 14:39:16 2019 +0530
@@ -5,7 +5,7 @@
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
</head>
<body>
-<h2 id="ValueBased">Value-based Classes</h2>
+<h1 id="ValueBased">Value-based Classes</h1>
Some classes, such as <code>java.util.Optional</code> and
<code>java.time.LocalDateTime</code>, are <em>value-based</em>. Instances of a
--- a/src/java.base/share/classes/java/lang/doc-files/threadPrimitiveDeprecation.html Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/lang/doc-files/threadPrimitiveDeprecation.html Fri Mar 22 14:39:16 2019 +0530
@@ -1,6 +1,6 @@
<!doctype html>
<!--
- Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2005, 2019, 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
@@ -29,9 +29,9 @@
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
</head>
<body>
-<h2>Java Thread Primitive Deprecation</h2>
+<h1>Java Thread Primitive Deprecation</h1>
<hr>
-<h3>Why is <code>Thread.stop</code> deprecated?</h3>
+<h2>Why is <code>Thread.stop</code> deprecated?</h2>
<p>Because it is inherently unsafe. Stopping a thread causes it to
unlock all the monitors that it has locked. (The monitors are
unlocked as the <code>ThreadDeath</code> exception propagates up
@@ -46,8 +46,8 @@
manifest itself at any time after the actual damage occurs, even
hours or days in the future.</p>
<hr>
-<h3>Couldn't I just catch the <code>ThreadDeath</code> exception
-and fix the damaged object?</h3>
+<h2>Couldn't I just catch the <code>ThreadDeath</code> exception
+and fix the damaged object?</h2>
<p>In theory, perhaps, but it would <em>vastly</em> complicate the
task of writing correct multithreaded code. The task would be
nearly insurmountable for two reasons:</p>
@@ -62,7 +62,7 @@
</ol>
In sum, it just isn't practical.
<hr>
-<h3>What should I use instead of <code>Thread.stop</code>?</h3>
+<h2>What should I use instead of <code>Thread.stop</code>?</h2>
<p>Most uses of <code>stop</code> should be replaced by code that
simply modifies some variable to indicate that the target thread
should stop running. The target thread should check this variable
@@ -117,8 +117,8 @@
}
</pre>
<hr>
-<h3>How do I stop a thread that waits for long periods (e.g., for
-input)?</h3>
+<h2>How do I stop a thread that waits for long periods (e.g., for
+input)?</h2>
<p>That's what the <code>Thread.interrupt</code> method is for. The
same "state based" signaling mechanism shown above can be used, but
the state change (<code>blinker = null</code>, in the previous
@@ -145,8 +145,8 @@
This ensures that the Thread will reraise the
<code>InterruptedException</code> as soon as it is able.
<hr>
-<h3>What if a thread doesn't respond to
-<code>Thread.interrupt</code>?</h3>
+<h2>What if a thread doesn't respond to
+<code>Thread.interrupt</code>?</h2>
<p>In some cases, you can use application specific tricks. For
example, if a thread is waiting on a known socket, you can close
the socket to cause the thread to return immediately.
@@ -158,8 +158,8 @@
operations for which thread.stop and thread.interrupt do not work
properly.</p>
<hr>
-<h3>Why are <code>Thread.suspend</code> and
-<code>Thread.resume</code> deprecated?</h3>
+<h2>Why are <code>Thread.suspend</code> and
+<code>Thread.resume</code> deprecated?</h2>
<p><code>Thread.suspend</code> is inherently deadlock-prone. If the
target thread holds a lock on the monitor protecting a critical
system resource when it is suspended, no thread can access this
@@ -168,8 +168,8 @@
to calling <code>resume</code>, deadlock results. Such deadlocks
typically manifest themselves as "frozen" processes.</p>
<hr>
-<h3>What should I use instead of <code>Thread.suspend</code> and
-<code>Thread.resume</code>?</h3>
+<h2>What should I use instead of <code>Thread.suspend</code> and
+<code>Thread.resume</code>?</h2>
<p>As with <code>Thread.stop</code>, the prudent approach is to
have the "target thread" poll a variable indicating the desired
state of the thread (active or suspended). When the desired state
@@ -283,8 +283,8 @@
}
</pre>
<hr size="3" noshade="noshade" />
-<h3>Can I combine the two techniques to produce a thread that may
-be safely "stopped" or "suspended"?</h3>
+<h2>Can I combine the two techniques to produce a thread that may
+be safely "stopped" or "suspended"?</h2>
Yes, it's reasonably straightforward. The one subtlety is that the
target thread may already be suspended at the time that another
thread tries to stop it. If the <code>stop</code> method merely sets
--- a/src/java.base/share/classes/java/lang/invoke/MethodHandle.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/lang/invoke/MethodHandle.java Fri Mar 22 14:39:16 2019 +0530
@@ -52,7 +52,7 @@
* {@linkplain java.lang.invoke.MethodHandles#dropArguments deletion},
* and {@linkplain java.lang.invoke.MethodHandles#filterArguments substitution}.
*
- * <h1>Method handle contents</h1>
+ * <h2>Method handle contents</h2>
* Method handles are dynamically and strongly typed according to their parameter and return types.
* They are not distinguished by the name or the defining class of their underlying methods.
* A method handle must be invoked using a symbolic type descriptor which matches
@@ -89,7 +89,7 @@
* from its specific class, as the method handle class hierarchy (if any)
* may change from time to time or across implementations from different vendors.
*
- * <h1>Method handle compilation</h1>
+ * <h2>Method handle compilation</h2>
* A Java method call expression naming {@code invokeExact} or {@code invoke}
* can invoke a method handle from Java source code.
* From the viewpoint of source code, these methods can take any arguments
@@ -121,7 +121,7 @@
* The ambiguity with the type {@code Void} is harmless, since there are no references of type
* {@code Void} except the null reference.
*
- * <h1>Method handle invocation</h1>
+ * <h2>Method handle invocation</h2>
* The first time an {@code invokevirtual} instruction is executed
* it is linked by symbolically resolving the names in the instruction
* and verifying that the method call is statically legal.
@@ -164,7 +164,7 @@
* (<em>Note:</em> The adjusted method handle {@code M2} is not directly observable,
* and implementations are therefore not required to materialize it.)
*
- * <h1>Invocation checking</h1>
+ * <h2>Invocation checking</h2>
* In typical programs, method handle type matching will usually succeed.
* But if a match fails, the JVM will throw a {@link WrongMethodTypeException},
* either directly (in the case of {@code invokeExact}) or indirectly as if
@@ -205,7 +205,7 @@
* They should not be passed to untrusted code unless their use from
* the untrusted code would be harmless.
*
- * <h1>Method handle creation</h1>
+ * <h2>Method handle creation</h2>
* Java code can create a method handle that directly accesses
* any method, constructor, or field that is accessible to that code.
* This is done via a reflective, capability-based API called
@@ -263,7 +263,7 @@
* of an {@code invokevirtual} or {@code invokeinterface} instruction on
* a private method (as applicable).
*
- * <h1>Usage examples</h1>
+ * <h2>Usage examples</h2>
* Here are some examples of usage:
* <blockquote><pre>{@code
Object x, y; String s; int i;
@@ -309,7 +309,7 @@
* be a method which calls {@link java.util.Objects#equals(Object,Object) Objects.equals}
* on its arguments, and asserts that the result is true.
*
- * <h1>Exceptions</h1>
+ * <h2>Exceptions</h2>
* The methods {@code invokeExact} and {@code invoke} are declared
* to throw {@link java.lang.Throwable Throwable},
* which is to say that there is no static restriction on what a method handle
@@ -322,7 +322,7 @@
* throwables locally, rethrowing only those which are legal in the context,
* and wrapping ones which are illegal.
*
- * <h1><a id="sigpoly"></a>Signature polymorphism</h1>
+ * <h2><a id="sigpoly"></a>Signature polymorphism</h2>
* The unusual compilation and linkage behavior of
* {@code invokeExact} and plain {@code invoke}
* is referenced by the term <em>signature polymorphism</em>.
@@ -347,7 +347,7 @@
* Tools which determine symbolic linkage are required to accept such
* untransformed descriptors, without reporting linkage errors.
*
- * <h1>Interoperation between method handles and the Core Reflection API</h1>
+ * <h2>Interoperation between method handles and the Core Reflection API</h2>
* Using factory methods in the {@link java.lang.invoke.MethodHandles.Lookup Lookup} API,
* any class member represented by a Core Reflection API object
* can be converted to a behaviorally equivalent method handle.
@@ -389,7 +389,7 @@
* to call {@code invokeExact} or plain {@code invoke},
* for any specified type descriptor .
*
- * <h1>Interoperation between method handles and Java generics</h1>
+ * <h2>Interoperation between method handles and Java generics</h2>
* A method handle can be obtained on a method, constructor, or field
* which is declared with Java generic types.
* As with the Core Reflection API, the type of the method handle
@@ -416,7 +416,7 @@
* genericity with a Java type parameter.</li>
* </ul>
*
- * <h1><a id="maxarity"></a>Arity limits</h1>
+ * <h2><a id="maxarity"></a>Arity limits</h2>
* The JVM imposes on all methods and constructors of any kind an absolute
* limit of 255 stacked arguments. This limit can appear more restrictive
* in certain cases:
--- a/src/java.base/share/classes/java/lang/invoke/MethodHandleInfo.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/lang/invoke/MethodHandleInfo.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, 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
@@ -35,7 +35,7 @@
* A symbolic reference obtained by cracking a direct method handle
* into its consitutent symbolic parts.
* To crack a direct method handle, call {@link Lookup#revealDirect Lookup.revealDirect}.
- * <h1><a id="directmh"></a>Direct Method Handles</h1>
+ * <h2><a id="directmh"></a>Direct Method Handles</h2>
* A <em>direct method handle</em> represents a method, constructor, or field without
* any intervening argument bindings or other transformations.
* The method, constructor, or field referred to by a direct method handle is called
@@ -58,7 +58,7 @@
* to convert a {@link Field} into a method handle.
* </ul>
*
- * <h1>Restrictions on Cracking</h1>
+ * <h2>Restrictions on Cracking</h2>
* Given a suitable {@code Lookup} object, it is possible to crack any direct method handle
* to recover a symbolic reference for the underlying method, constructor, or field.
* Cracking must be done via a {@code Lookup} object equivalent to that which created
@@ -77,7 +77,7 @@
* handle with symbolic information (or caller binding) from an unexpected scope.
* Use {@link java.lang.invoke.MethodHandles#reflectAs} to override this limitation.
*
- * <h1><a id="refkinds"></a>Reference kinds</h1>
+ * <h2><a id="refkinds"></a>Reference kinds</h2>
* The <a href="MethodHandles.Lookup.html#lookups">Lookup Factory Methods</a>
* correspond to all major use cases for methods, constructors, and fields.
* These use cases may be distinguished using small integers as follows:
--- a/src/java.base/share/classes/java/lang/invoke/MethodHandles.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/lang/invoke/MethodHandles.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2019, 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
@@ -268,7 +268,7 @@
* This includes all methods, constructors, and fields which are allowed to the lookup class,
* even private ones.
*
- * <h1><a id="lookups"></a>Lookup Factory Methods</h1>
+ * <h2><a id="lookups"></a>Lookup Factory Methods</h2>
* The factory methods on a {@code Lookup} object correspond to all major
* use cases for methods, constructors, and fields.
* Each method handle created by a factory method is the functional
@@ -395,7 +395,7 @@
* <a href="MethodHandle.html#maxarity">too many parameters.</a>
* </ul>
*
- * <h1><a id="access"></a>Access checking</h1>
+ * <h2><a id="access"></a>Access checking</h2>
* Access checks are applied in the factory methods of {@code Lookup},
* when a method handle is created.
* This is a key difference from the Core Reflection API, since
@@ -529,7 +529,7 @@
* whose <a href="MethodHandles.Lookup.html#equiv">bytecode behaviors</a> and Java language access permissions
* can be reliably determined and emulated by method handles.
*
- * <h1><a id="secmgr"></a>Security manager interactions</h1>
+ * <h2><a id="secmgr"></a>Security manager interactions</h2>
* Although bytecode instructions can only refer to classes in
* a related class loader, this API can search for methods in any
* class, as long as a reference to its {@code Class} object is
@@ -588,7 +588,7 @@
* or else that is being accessed from a lookup class that has
* rights to access the member or class.
*
- * <h1><a id="callsens"></a>Caller sensitive methods</h1>
+ * <h2><a id="callsens"></a>Caller sensitive methods</h2>
* A small number of Java methods have a special property called caller sensitivity.
* A <em>caller-sensitive</em> method can behave differently depending on the
* identity of its immediate caller.
--- a/src/java.base/share/classes/java/lang/invoke/MutableCallSite.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/lang/invoke/MutableCallSite.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2019, 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
@@ -197,7 +197,7 @@
* processed before the method returns abnormally.
* Which elements these are (if any) is implementation-dependent.
*
- * <h1>Java Memory Model details</h1>
+ * <h4>Java Memory Model details</h4>
* In terms of the Java Memory Model, this operation performs a synchronization
* action which is comparable in effect to the writing of a volatile variable
* by the current thread, and an eventual volatile read by every other thread
--- a/src/java.base/share/classes/java/lang/invoke/VarHandle.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/lang/invoke/VarHandle.java Fri Mar 22 14:39:16 2019 +0530
@@ -234,7 +234,7 @@
* precise phrasing of the specification of access mode methods and memory fence
* methods may accompany future updates of the Java Language Specification.
*
- * <h1>Compiling invocation of access mode methods</h1>
+ * <h2>Compiling invocation of access mode methods</h2>
* A Java method call expression naming an access mode method can invoke a
* VarHandle from Java source code. From the viewpoint of source code, these
* methods can take any arguments and their polymorphic result (if expressed)
@@ -266,7 +266,7 @@
* except the null reference.
*
*
- * <h1><a id="invoke">Performing invocation of access mode methods</a></h1>
+ * <h2><a id="invoke">Performing invocation of access mode methods</a></h2>
* The first time an {@code invokevirtual} instruction is executed it is linked
* by symbolically resolving the names in the instruction and verifying that
* the method call is statically legal. This also holds for calls to access mode
@@ -329,7 +329,7 @@
* Where, in this case, the method handle is bound to the VarHandle instance.
*
*
- * <h1>Invocation checking</h1>
+ * <h2>Invocation checking</h2>
* In typical programs, VarHandle access mode type matching will usually
* succeed. But if a match fails, the JVM will throw a
* {@link WrongMethodTypeException}.
@@ -364,7 +364,7 @@
* untrusted code unless their use from the untrusted code would be harmless.
*
*
- * <h1>VarHandle creation</h1>
+ * <h2>VarHandle creation</h2>
* Java code can create a VarHandle that directly accesses any field that is
* accessible to that code. This is done via a reflective, capability-based
* API called {@link java.lang.invoke.MethodHandles.Lookup
@@ -383,7 +383,7 @@
* class outside the current package, the receiver argument will be narrowed to
* the type of the accessing class.
*
- * <h1>Interoperation between VarHandles and the Core Reflection API</h1>
+ * <h2>Interoperation between VarHandles and the Core Reflection API</h2>
* Using factory methods in the {@link java.lang.invoke.MethodHandles.Lookup
* Lookup} API, any field represented by a Core Reflection API object
* can be converted to a behaviorally equivalent VarHandle.
@@ -428,7 +428,7 @@
* any specified access mode type and is equivalent in behaviour to
* {@link java.lang.invoke.MethodHandles#varHandleInvoker}.
*
- * <h1>Interoperation between VarHandles and Java generics</h1>
+ * <h2>Interoperation between VarHandles and Java generics</h2>
* A VarHandle can be obtained for a variable, such as a field, which is
* declared with Java generic types. As with the Core Reflection API, the
* VarHandle's variable type will be constructed from the erasure of the
--- a/src/java.base/share/classes/java/lang/invoke/package-info.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/lang/invoke/package-info.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2019, 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
@@ -53,12 +53,12 @@
* </li>
* </ul>
*
- * <h1><a id="jvm_mods"></a>Dynamic resolution of call sites and constants</h1>
+ * <h2><a id="jvm_mods"></a>Dynamic resolution of call sites and constants</h2>
* The following low-level information summarizes relevant parts of the
* Java Virtual Machine specification. For full details, please see the
* current version of that specification.
*
- * <h2><a id="indyinsn"></a>Dynamically-computed call sites</h2>
+ * <h3><a id="indyinsn"></a>Dynamically-computed call sites</h3>
* An {@code invokedynamic} instruction is originally in an unlinked state.
* In this state, there is no target method for the instruction to invoke.
* <p>
@@ -74,7 +74,7 @@
* The constant pool reference also specifies the invocation's name and method type descriptor,
* just like {@code invokestatic} and the other invoke instructions.
*
- * <h2><a id="condycon"></a>Dynamically-computed constants</h2>
+ * <h3><a id="condycon"></a>Dynamically-computed constants</h3>
* The constant pool may contain constants tagged {@code CONSTANT_Dynamic},
* equipped with bootstrap methods which perform their resolution.
* Such a <em>dynamic constant</em> is originally in an unresolved state.
@@ -90,7 +90,7 @@
* (Roughly speaking, a dynamically-computed constant is to a dynamically-computed call site
* as a {@code CONSTANT_Fieldref} is to a {@code CONSTANT_Methodref}.)
*
- * <h2><a id="bsm"></a>Execution of bootstrap methods</h2>
+ * <h3><a id="bsm"></a>Execution of bootstrap methods</h3>
* Resolving a dynamically-computed call site or constant
* starts with resolving constants from the constant pool for the
* following items:
@@ -136,7 +136,7 @@
* subsequent attempts to execute the {@code invokedynamic} instruction or load the
* dynamically-computed constant.
*
- * <h2>Timing of resolution</h2>
+ * <h3>Timing of resolution</h3>
* An {@code invokedynamic} instruction is linked just before its first execution.
* A dynamically-computed constant is resolved just before the first time it is used
* (by pushing it on the stack or linking it as a bootstrap method parameter).
@@ -171,7 +171,7 @@
* just before its first invocation.
* There is no way to undo the effect of a completed bootstrap method call.
*
- * <h2>Types of bootstrap methods</h2>
+ * <h3>Types of bootstrap methods</h3>
* For a dynamically-computed call site, the bootstrap method is invoked with parameter
* types {@code MethodHandles.Lookup}, {@code String}, {@code MethodType}, and the types
* of any static arguments; the return type is {@code CallSite}.
--- a/src/java.base/share/classes/java/lang/module/Configuration.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/lang/module/Configuration.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, 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
@@ -75,7 +75,7 @@
* ModuleLayer.boot().configuration()}. The configuration for the boot layer
* will often be the parent when creating new configurations. </p>
*
- * <h3> Example </h3>
+ * <h2> Example </h2>
*
* <p> The following example uses the {@link
* #resolve(ModuleFinder,ModuleFinder,Collection) resolve} method to resolve a
--- a/src/java.base/share/classes/java/lang/module/package-info.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/lang/module/package-info.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, 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
@@ -34,7 +34,7 @@
* will cause a {@code NullPointerException}, unless otherwise specified. </p>
*
*
- * <h1><a id="resolution"></a>{@index "Module Resolution"}</h1>
+ * <h2><a id="resolution"></a>{@index "Module Resolution"}</h2>
*
* <p> Resolution is the process of computing how modules depend on each other.
* The process occurs at compile time and run time. </p>
@@ -45,7 +45,7 @@
* The readability graph embodies how modules depend on each other, which in
* turn controls access across module boundaries. </p>
*
- * <h2> Step 1: Recursive enumeration </h2>
+ * <h3> Step 1: Recursive enumeration </h3>
*
* <p> Recursive enumeration takes a set of module names, looks up each of their
* module declarations, and for each module declaration, recursively enumerates:
@@ -91,7 +91,7 @@
*
* <p> Otherwise, resolution proceeds to step 2. </p>
*
- * <h2> Step 2: Computing the readability graph </h2>
+ * <h3> Step 2: Computing the readability graph </h3>
*
* <p> A 'requires' directive (irrespective of 'transitive') expresses that
* one module depends on some other module. The effect of the 'transitive'
@@ -147,7 +147,7 @@
* <p> Otherwise, resolution succeeds, and the result of resolution is the
* readability graph.
*
- * <h2> Root modules </h2>
+ * <h3> Root modules </h3>
*
* <p> The set of root modules at compile-time is usually the set of modules
* being compiled. At run-time, the set of root modules is usually the
@@ -158,7 +158,7 @@
* that is observable on the upgrade module path or among the system modules,
* and that exports at least one package without qualification. </p>
*
- * <h2> Observable modules </h2>
+ * <h3> Observable modules </h3>
*
* <p> The set of observable modules at both compile-time and run-time is
* determined by searching several different paths, and also by searching
@@ -183,7 +183,7 @@
*
* </ol>
*
- * <h2> 'requires' directives with 'static' modifier </h2>
+ * <h3> 'requires' directives with 'static' modifier </h3>
*
* <p> 'requires' directives that have the 'static' modifier express an optional
* dependence at run time. If a module declares that it 'requires static M' then
@@ -191,7 +191,7 @@
* However, if M is recursively enumerated at step 1 then all modules that are
* enumerated and `requires static M` will read M. </p>
*
- * <h2> Completeness </h2>
+ * <h3> Completeness </h3>
*
* <p> Resolution may be partial at compile-time in that the complete transitive
* closure may not be required to compile a set of modules. Minimally, the
--- a/src/java.base/share/classes/java/lang/reflect/Proxy.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/lang/reflect/Proxy.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2019, 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
@@ -156,7 +156,7 @@
* like they do for instances of {@code java.lang.Object}.
* </ul>
*
- * <h3><a id="membership">Package and Module Membership of Proxy Class</a></h3>
+ * <h2><a id="membership">Package and Module Membership of Proxy Class</a></h2>
*
* The package and module to which a proxy class belongs are chosen such that
* the accessibility of the proxy class is in line with the accessibility of
--- a/src/java.base/share/classes/java/net/Inet4Address.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/net/Inet4Address.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, 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
@@ -36,7 +36,7 @@
* and <a href="http://www.ietf.org/rfc/rfc2365.txt"><i>RFC 2365:
* Administratively Scoped IP Multicast</i></a>
*
- * <h3> <a id="format">Textual representation of IP addresses</a> </h3>
+ * <h2> <a id="format">Textual representation of IP addresses</a> </h2>
*
* Textual representation of IPv4 address used as input to methods
* takes one of the following forms:
@@ -70,7 +70,7 @@
* <p> For methods that return a textual representation as output
* value, the first form, i.e. a dotted-quad string, is used.
*
- * <h4> The Scope of a Multicast Address </h4>
+ * <h3> The Scope of a Multicast Address </h3>
*
* Historically the IPv4 TTL field in the IP header has doubled as a
* multicast scope field: a TTL of 0 means node-local, 1 means
--- a/src/java.base/share/classes/java/net/Inet6Address.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/net/Inet6Address.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, 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
@@ -38,7 +38,7 @@
* Defined by <a href="http://www.ietf.org/rfc/rfc2373.txt">
* <i>RFC 2373: IP Version 6 Addressing Architecture</i></a>.
*
- * <h3> <a id="format">Textual representation of IP addresses</a> </h3>
+ * <h2> <a id="format">Textual representation of IP addresses</a> </h2>
*
* Textual representation of IPv6 address used as input to methods
* takes one of the following forms:
@@ -116,7 +116,7 @@
* form because it is unambiguous when used in combination with other
* textual data.
*
- * <h4> Special IPv6 address </h4>
+ * <h3> Special IPv6 address </h3>
*
* <blockquote>
* <table class="borderless">
@@ -135,7 +135,7 @@
* address.</td></tr>
* </table></blockquote>
*
- * <h4><a id="scoped">Textual representation of IPv6 scoped addresses</a></h4>
+ * <h3><a id="scoped">Textual representation of IPv6 scoped addresses</a></h3>
*
* <p> The textual representation of IPv6 addresses as described above can be
* extended to specify IPv6 scoped addresses. This extension to the basic
--- a/src/java.base/share/classes/java/net/InetAddress.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/net/InetAddress.java Fri Mar 22 14:39:16 2019 +0530
@@ -71,7 +71,7 @@
* with a host name or whether it has already done reverse host name
* resolution).
*
- * <h3> Address types </h3>
+ * <h2> Address types </h2>
*
* <table class="striped" style="margin-left:2em">
* <caption style="display:none">Description of unicast and multicast address types</caption>
@@ -105,7 +105,7 @@
* </tbody>
* </table>
*
- * <h4> IP address scope </h4>
+ * <h3> IP address scope </h3>
*
* <p> <i>Link-local</i> addresses are designed to be used for addressing
* on a single link for purposes such as auto-address configuration,
@@ -116,7 +116,7 @@
*
* <p> <i>Global</i> addresses are unique across the internet.
*
- * <h4> Textual representation of IP addresses </h4>
+ * <h3> Textual representation of IP addresses </h3>
*
* The textual representation of an IP address is address family specific.
*
@@ -130,7 +130,7 @@
* <P>There is a <a href="doc-files/net-properties.html#Ipv4IPv6">couple of
* System Properties</a> affecting how IPv4 and IPv6 addresses are used.</P>
*
- * <h4> Host Name Resolution </h4>
+ * <h3> Host Name Resolution </h3>
*
* Host name-to-IP address <i>resolution</i> is accomplished through
* the use of a combination of local machine configuration information
@@ -145,7 +145,7 @@
* <p> The InetAddress class provides methods to resolve host names to
* their IP addresses and vice versa.
*
- * <h4> InetAddress Caching </h4>
+ * <h3> InetAddress Caching </h3>
*
* The InetAddress class has a cache to store successful as well as
* unsuccessful host name resolutions.
--- a/src/java.base/share/classes/java/net/URI.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/net/URI.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, 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
@@ -64,7 +64,7 @@
* and relativizing URI instances. Instances of this class are immutable.
*
*
- * <h3> URI syntax and components </h3>
+ * <h2> URI syntax and components </h2>
*
* At the highest level a URI reference (hereinafter simply "URI") in string
* form has the syntax
@@ -168,7 +168,7 @@
* will be defined and the user-information and port components may be defined.
*
*
- * <h4> Operations on URI instances </h4>
+ * <h3> Operations on URI instances </h3>
*
* The key operations supported by this class are those of
* <i>normalization</i>, <i>resolution</i>, and <i>relativization</i>.
@@ -247,7 +247,7 @@
* yields the relative URI {@code sample/a/index.html#28}.
*
*
- * <h4> Character categories </h4>
+ * <h3> Character categories </h3>
*
* RFC 2396 specifies precisely which characters are permitted in the
* various components of a URI reference. The following categories, most of
@@ -298,7 +298,7 @@
* characters.
*
*
- * <h4> Escaped octets, quotation, encoding, and decoding </h4>
+ * <h3> Escaped octets, quotation, encoding, and decoding </h3>
*
* RFC 2396 allows escaped octets to appear in the user-info, path, query, and
* fragment components. Escaping serves two purposes in URIs:
@@ -390,7 +390,7 @@
* </ul>
*
*
- * <h4> Identities </h4>
+ * <h3> Identities </h3>
*
* For any URI <i>u</i>, it is always the case that
*
@@ -426,7 +426,7 @@
* authority.
*
*
- * <h4> URIs, URLs, and URNs </h4>
+ * <h3> URIs, URLs, and URNs </h3>
*
* A URI is a uniform resource <i>identifier</i> while a URL is a uniform
* resource <i>locator</i>. Hence every URL is a URI, abstractly speaking, but
--- a/src/java.base/share/classes/java/text/ChoiceFormat.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/text/ChoiceFormat.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, 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
@@ -151,7 +151,7 @@
* }</pre>
* </blockquote>
*
- * <h3><a id="synchronization">Synchronization</a></h3>
+ * <h2><a id="synchronization">Synchronization</a></h2>
*
* <p>
* Choice formats are not synchronized.
--- a/src/java.base/share/classes/java/text/CompactNumberFormat.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/text/CompactNumberFormat.java Fri Mar 22 14:39:16 2019 +0530
@@ -73,7 +73,7 @@
* String result = fmt.format(1000);
* </pre></blockquote>
*
- * <h3><a id="compact_number_style">Style</a></h3>
+ * <h2><a id="compact_number_style">Style</a></h2>
* <p>
* A number can be formatted in the compact forms with two different
* styles, {@link NumberFormat.Style#SHORT SHORT}
@@ -88,7 +88,7 @@
* {@link NumberFormat.Style#LONG LONG} style instance in same locale
* formats {@code 10000} as {@code "10 thousand"}.
*
- * <h3><a id="compact_number_patterns">Compact Number Patterns</a></h3>
+ * <h2><a id="compact_number_patterns">Compact Number Patterns</a></h2>
* <p>
* The compact number patterns are represented in a series of patterns where each
* pattern is used to format a range of numbers. An example of
@@ -151,7 +151,7 @@
* unless noted otherwise, if they are to appear in the prefix or suffix
* as literals. For example, 0\u0915'.'.
*
- * <h3>Formatting</h3>
+ * <h2>Formatting</h2>
* The default formatting behavior returns a formatted string with no fractional
* digits, however users can use the {@link #setMinimumFractionDigits(int)}
* method to include the fractional part.
@@ -165,14 +165,14 @@
* {@link java.text.DecimalFormat DecimalFormat}
* for the specified locale is used.
*
- * <h3>Parsing</h3>
+ * <h2>Parsing</h2>
* The default parsing behavior does not allow a grouping separator until
* grouping used is set to {@code true} by using
* {@link #setGroupingUsed(boolean)}. The parsing of the fractional part
* depends on the {@link #isParseIntegerOnly()}. For example, if the
* parse integer only is set to true, then the fractional part is skipped.
*
- * <h3>Rounding</h3>
+ * <h2>Rounding</h2>
* {@code CompactNumberFormat} provides rounding modes defined in
* {@link java.math.RoundingMode} for formatting. By default, it uses
* {@link java.math.RoundingMode#HALF_EVEN RoundingMode.HALF_EVEN}.
--- a/src/java.base/share/classes/java/text/DateFormat.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/text/DateFormat.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, 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
@@ -140,7 +140,7 @@
* on the screen.
* </ul>
*
- * <h3><a id="synchronization">Synchronization</a></h3>
+ * <h2><a id="synchronization">Synchronization</a></h2>
*
* <p>
* Date formats are not synchronized.
--- a/src/java.base/share/classes/java/text/DecimalFormat.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/text/DecimalFormat.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, 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
@@ -84,7 +84,7 @@
* the <code>NumberFormat</code> factory methods, the pattern and symbols are
* read from localized <code>ResourceBundle</code>s.
*
- * <h3>Patterns</h3>
+ * <h2>Patterns</h2>
*
* <code>DecimalFormat</code> patterns have the following syntax:
* <blockquote><pre>
@@ -154,7 +154,7 @@
* used. So <code>"#,##,###,####"</code> == <code>"######,####"</code> ==
* <code>"##,####,####"</code>.
*
- * <h4><a id="special_pattern_character">Special Pattern Characters</a></h4>
+ * <h3><a id="special_pattern_character">Special Pattern Characters</a></h3>
*
* <p>Many characters in a pattern are taken literally; they are matched during
* parsing and output unchanged during formatting. Special characters, on the
@@ -245,7 +245,7 @@
* </table>
* </blockquote>
*
- * <h4>Scientific Notation</h4>
+ * <h3>Scientific Notation</h3>
*
* <p>Numbers in scientific notation are expressed as the product of a mantissa
* and a power of ten, for example, 1234 can be expressed as 1.234 x 10^3. The
@@ -292,13 +292,13 @@
* <li>Exponential patterns may not contain grouping separators.
* </ul>
*
- * <h4>Rounding</h4>
+ * <h3>Rounding</h3>
*
* <code>DecimalFormat</code> provides rounding modes defined in
* {@link java.math.RoundingMode} for formatting. By default, it uses
* {@link java.math.RoundingMode#HALF_EVEN RoundingMode.HALF_EVEN}.
*
- * <h4>Digits</h4>
+ * <h3>Digits</h3>
*
* For formatting, <code>DecimalFormat</code> uses the ten consecutive
* characters starting with the localized zero digit defined in the
@@ -328,7 +328,7 @@
* and <code>isParseIntegerOnly()</code> are false.
* </ul>
*
- * <h4><a id="synchronization">Synchronization</a></h4>
+ * <h3><a id="synchronization">Synchronization</a></h3>
*
* <p>
* Decimal formats are generally not synchronized.
@@ -336,7 +336,7 @@
* If multiple threads access a format concurrently, it must be synchronized
* externally.
*
- * <h4>Example</h4>
+ * <h3>Example</h3>
*
* <blockquote><pre>{@code
* <strong>// Print out a number using the localized number, integer, currency,
--- a/src/java.base/share/classes/java/text/Format.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/text/Format.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, 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
@@ -58,7 +58,7 @@
* no separator in between, and in this case the <code>parseObject</code> could
* not tell which digits belong to which number.
*
- * <h3>Subclassing</h3>
+ * <h2>Subclassing</h2>
*
* <p>
* The Java Platform provides three specialized subclasses of <code>Format</code>--
@@ -115,7 +115,7 @@
* the field. For examples of these constants, see <code>ERA_FIELD</code> and its
* friends in {@link DateFormat}.
*
- * <h4><a id="synchronization">Synchronization</a></h4>
+ * <h3><a id="synchronization">Synchronization</a></h3>
*
* <p>
* Formats are generally not synchronized.
--- a/src/java.base/share/classes/java/text/MessageFormat.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/text/MessageFormat.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, 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
@@ -68,7 +68,7 @@
* behavior is defined by the pattern that you provide as well as the
* subformats used for inserted arguments.
*
- * <h3><a id="patterns">Patterns and Their Interpretation</a></h3>
+ * <h2><a id="patterns">Patterns and Their Interpretation</a></h2>
*
* <code>MessageFormat</code> uses patterns of the following form:
* <blockquote><pre>
@@ -220,7 +220,7 @@
* </tbody>
* </table>
*
- * <h4>Usage Information</h4>
+ * <h3>Usage Information</h3>
*
* <p>
* Here are some examples of usage.
@@ -326,7 +326,7 @@
* // result now equals {new String("z")}
* </pre></blockquote>
*
- * <h4><a id="synchronization">Synchronization</a></h4>
+ * <h3><a id="synchronization">Synchronization</a></h3>
*
* <p>
* Message formats are not synchronized.
--- a/src/java.base/share/classes/java/text/NumberFormat.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/text/NumberFormat.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, 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
@@ -175,7 +175,7 @@
* numbers: "(12)" for -12.
* </ol>
*
- * <h3><a id="synchronization">Synchronization</a></h3>
+ * <h2><a id="synchronization">Synchronization</a></h2>
*
* <p>
* Number formats are generally not synchronized.
--- a/src/java.base/share/classes/java/text/SimpleDateFormat.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/text/SimpleDateFormat.java Fri Mar 22 14:39:16 2019 +0530
@@ -74,7 +74,7 @@
* For more information on using these methods, see
* {@link DateFormat}.
*
- * <h3>Date and Time Patterns</h3>
+ * <h2>Date and Time Patterns</h2>
* <p>
* Date and time formats are specified by <em>date and time pattern</em>
* strings.
@@ -370,7 +370,7 @@
* <code>SimpleDateFormat</code> does not deal with the localization of text
* other than the pattern letters; that's up to the client of the class.
*
- * <h4>Examples</h4>
+ * <h3>Examples</h3>
*
* The following examples show how date and time patterns are interpreted in
* the U.S. locale. The given date and time are 2001-07-04 12:08:56 local time
@@ -421,7 +421,7 @@
* </table>
* </blockquote>
*
- * <h4><a id="synchronization">Synchronization</a></h4>
+ * <h3><a id="synchronization">Synchronization</a></h3>
*
* <p>
* Date formats are not synchronized.
--- a/src/java.base/share/classes/java/time/Instant.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/time/Instant.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, 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
@@ -108,7 +108,7 @@
* For both the epoch-second and nanosecond parts, a larger value is always later on the time-line
* than a smaller value.
*
- * <h3>Time-scale</h3>
+ * <h2>Time-scale</h2>
* <p>
* The length of the solar day is the standard way that humans measure time.
* This has traditionally been subdivided into 24 hours of 60 minutes of 60 seconds,
--- a/src/java.base/share/classes/java/time/ZoneId.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/time/ZoneId.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, 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
@@ -111,7 +111,7 @@
* Similarly, a comparison of two IDs only examines the ID, whereas
* a comparison of two rules examines the entire data set.
*
- * <h3>Time-zone IDs</h3>
+ * <h2>Time-zone IDs</h2>
* The ID is unique within the system.
* There are three types of ID.
* <p>
@@ -147,7 +147,7 @@
* The recommended format for region IDs from groups other than TZDB is 'group~region'.
* Thus if IATA data were defined, Utrecht airport would be 'IATA~UTC'.
*
- * <h3>Serialization</h3>
+ * <h2>Serialization</h2>
* This class can be serialized and stores the string zone ID in the external form.
* The {@code ZoneOffset} subclass uses a dedicated format that only stores the
* offset from UTC/Greenwich.
--- a/src/java.base/share/classes/java/time/chrono/ChronoLocalDate.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/time/chrono/ChronoLocalDate.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, 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
@@ -99,7 +99,7 @@
* The chronology defines how the calendar system operates and the meaning of
* the standard fields.
*
- * <h3>When to use this interface</h3>
+ * <h2>When to use this interface</h2>
* The design of the API encourages the use of {@code LocalDate} rather than this
* interface, even in the case where the application needs to deal with multiple
* calendar systems.
--- a/src/java.base/share/classes/java/time/chrono/ChronoLocalDateImpl.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/time/chrono/ChronoLocalDateImpl.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, 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
@@ -121,7 +121,7 @@
* first, last);
* </pre>
*
- * <h3>Adding Calendars</h3>
+ * <h2>Adding Calendars</h2>
* <p> The set of calendars is extensible by defining a subclass of {@link ChronoLocalDate}
* to represent a date instance and an implementation of {@code Chronology}
* to be the factory for the ChronoLocalDate subclass.
--- a/src/java.base/share/classes/java/time/chrono/ChronoLocalDateTime.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/time/chrono/ChronoLocalDateTime.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, 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
@@ -102,7 +102,7 @@
* The chronology defines how the calendar system operates and the meaning of
* the standard fields.
*
- * <h3>When to use this interface</h3>
+ * <h2>When to use this interface</h2>
* The design of the API encourages the use of {@code LocalDateTime} rather than this
* interface, even in the case where the application needs to deal with multiple
* calendar systems. The rationale for this is explored in detail in {@link ChronoLocalDate}.
--- a/src/java.base/share/classes/java/time/chrono/ChronoZonedDateTime.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/time/chrono/ChronoZonedDateTime.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, 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
@@ -103,7 +103,7 @@
* The chronology defines how the calendar system operates and the meaning of
* the standard fields.
*
- * <h3>When to use this interface</h3>
+ * <h2>When to use this interface</h2>
* The design of the API encourages the use of {@code ZonedDateTime} rather than this
* interface, even in the case where the application needs to deal with multiple
* calendar systems. The rationale for this is explored in detail in {@link ChronoLocalDate}.
--- a/src/java.base/share/classes/java/time/chrono/Chronology.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/time/chrono/Chronology.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, 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
@@ -133,7 +133,7 @@
* <li> {@link #date(TemporalAccessor) date(TemporalAccessor)}
* </ul>
*
- * <h3 id="addcalendars">Adding New Calendars</h3>
+ * <h2 id="addcalendars">Adding New Calendars</h2>
* The set of available chronologies can be extended by applications.
* Adding a new calendar system requires the writing of an implementation of
* {@code Chronology}, {@code ChronoLocalDate} and {@code Era}.
--- a/src/java.base/share/classes/java/time/format/DateTimeFormatter.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/time/format/DateTimeFormatter.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, 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
@@ -150,7 +150,7 @@
* class for formatting. The {@link #toFormat()} method returns an
* implementation of {@code java.text.Format}.
*
- * <h3 id="predefined">Predefined Formatters</h3>
+ * <h2 id="predefined">Predefined Formatters</h2>
* <table class="striped" style="text-align:left">
* <caption>Predefined Formatters</caption>
* <thead>
@@ -258,7 +258,7 @@
* </tbody>
* </table>
*
- * <h3 id="patterns">Patterns for Formatting and Parsing</h3>
+ * <h2 id="patterns">Patterns for Formatting and Parsing</h2>
* Patterns are based on a simple sequence of letters and symbols.
* A pattern is used to create a Formatter using the
* {@link #ofPattern(String)} and {@link #ofPattern(String, Locale)} methods.
@@ -434,7 +434,7 @@
* that you want to output directly to ensure that future changes do not break
* your application.
*
- * <h3 id="resolving">Resolving</h3>
+ * <h2 id="resolving">Resolving</h2>
* Parsing is implemented as a two-phase operation.
* First, the text is parsed using the layout defined by the formatter, producing
* a {@code Map} of field to value, a {@code ZoneId} and a {@code Chronology}.
--- a/src/java.base/share/classes/java/time/temporal/IsoFields.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/time/temporal/IsoFields.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, 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
@@ -91,7 +91,7 @@
* <p>
* This class defines fields and units that are specific to the ISO calendar system.
*
- * <h3>Quarter of year</h3>
+ * <h2>Quarter of year</h2>
* The ISO-8601 standard is based on the standard civic 12 month year.
* This is commonly divided into four quarters, often abbreviated as Q1, Q2, Q3 and Q4.
* <p>
@@ -107,7 +107,7 @@
* <li>{@link ChronoField#YEAR YEAR} - the standard ISO year
* </ul>
*
- * <h3>Week based years</h3>
+ * <h2>Week based years</h2>
* The ISO-8601 standard was originally intended as a data interchange format,
* defining a string format for dates and times. However, it also defines an
* alternate way of expressing the date, based on the concept of week-based-year.
--- a/src/java.base/share/classes/java/time/temporal/JulianFields.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/time/temporal/JulianFields.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, 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
@@ -115,7 +115,7 @@
* the Julian Day value is validated against the range of valid values.
* In {@linkplain ResolverStyle#LENIENT lenient mode} no validation occurs.
*
- * <h3>Astronomical and Scientific Notes</h3>
+ * <h4>Astronomical and Scientific Notes</h4>
* The standard astronomical definition uses a fraction to indicate the time-of-day,
* where each day is counted from midday to midday. For example,
* a fraction of 0 represents midday, a fraction of 0.25
@@ -169,7 +169,7 @@
* the Modified Julian Day value is validated against the range of valid values.
* In {@linkplain ResolverStyle#LENIENT lenient mode} no validation occurs.
*
- * <h3>Astronomical and Scientific Notes</h3>
+ * <h4>Astronomical and Scientific Notes</h4>
* <pre>
* | ISO date | Modified Julian Day | Decimal MJD |
* | 1970-01-01T00:00 | 40,587 | 40,587.0 |
--- a/src/java.base/share/classes/java/time/temporal/Temporal.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/time/temporal/Temporal.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, 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
@@ -92,7 +92,7 @@
* of this interface may be in calendar systems other than ISO.
* See {@link java.time.chrono.ChronoLocalDate} for a fuller discussion of the issues.
*
- * <h3>When to implement</h3>
+ * <h2>When to implement</h2>
* <p>
* A class should implement this interface if it meets three criteria:
* <ul>
--- a/src/java.base/share/classes/java/time/temporal/WeekFields.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/time/temporal/WeekFields.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, 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
@@ -120,7 +120,7 @@
* </ul>
* Together these two values allow a year or month to be divided into weeks.
*
- * <h3>Week of Month</h3>
+ * <h2>Week of Month</h2>
* One field is used: week-of-month.
* The calculation ensures that weeks never overlap a month boundary.
* The month is divided into periods where each period starts on the defined first day-of-week.
@@ -145,14 +145,14 @@
* </tbody>
* </table>
*
- * <h3>Week of Year</h3>
+ * <h2>Week of Year</h2>
* One field is used: week-of-year.
* The calculation ensures that weeks never overlap a year boundary.
* The year is divided into periods where each period starts on the defined first day-of-week.
* The earliest period is referred to as week 0 if it has less than the minimal number of days
* and week 1 if it has at least the minimal number of days.
*
- * <h3>Week Based Year</h3>
+ * <h2>Week Based Year</h2>
* Two fields are used for week-based-year, one for the
* {@link #weekOfWeekBasedYear() week-of-week-based-year} and one for
* {@link #weekBasedYear() week-based-year}. In a week-based-year, each week
--- a/src/java.base/share/classes/java/util/Calendar.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/util/Calendar.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, 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
@@ -97,7 +97,7 @@
* concrete subclass, such as <code>ERA</code>. See individual field
* documentation and subclass documentation for details.
*
- * <h3>Getting and Setting Calendar Field Values</h3>
+ * <h2>Getting and Setting Calendar Field Values</h2>
*
* <p>The calendar field values can be set by calling the <code>set</code>
* methods. Any field values set in a <code>Calendar</code> will not be
@@ -106,7 +106,7 @@
* <code>get</code>, <code>getTimeInMillis</code>, <code>getTime</code>,
* <code>add</code> and <code>roll</code> involves such calculation.
*
- * <h4>Leniency</h4>
+ * <h3>Leniency</h3>
*
* <p><code>Calendar</code> has two modes for interpreting the calendar
* fields, <em>lenient</em> and <em>non-lenient</em>. When a
@@ -125,7 +125,7 @@
* calculating its time or calendar field values if any out-of-range field
* value has been set.
*
- * <h4><a id="first_week">First Week</a></h4>
+ * <h3><a id="first_week">First Week</a></h3>
*
* <code>Calendar</code> defines a locale-specific seven day week using two
* parameters: the first day of the week and the minimal days in first week
@@ -150,7 +150,7 @@
* designate the week before week 1 of a year as week <code><i>n</i></code> of
* the previous year.
*
- * <h4>Calendar Fields Resolution</h4>
+ * <h3>Calendar Fields Resolution</h3>
*
* When computing a date and time from the calendar fields, there
* may be insufficient information for the computation (such as only
@@ -210,7 +210,7 @@
* runtime. Use {@link DateFormat}
* to format dates.
*
- * <h4>Field Manipulation</h4>
+ * <h3>Field Manipulation</h3>
*
* The calendar fields can be changed using three methods:
* <code>set()</code>, <code>add()</code>, and <code>roll()</code>.
--- a/src/java.base/share/classes/java/util/Formatter.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/util/Formatter.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, 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
@@ -140,7 +140,7 @@
* // -> s == "Duke's Birthday: May 23, 1995"
* </pre></blockquote>
*
- * <h3><a id="org">Organization</a></h3>
+ * <h2><a id="org">Organization</a></h2>
*
* <p> This specification is divided into two sections. The first section, <a
* href="#summary">Summary</a>, covers the basic formatting concepts. This
@@ -150,13 +150,13 @@
* details. It is intended for users who want more precise specification of
* formatting behavior.
*
- * <h3><a id="summary">Summary</a></h3>
+ * <h2><a id="summary">Summary</a></h2>
*
* <p> This section is intended to provide a brief overview of formatting
* concepts. For precise behavioral details, refer to the <a
* href="#detail">Details</a> section.
*
- * <h4><a id="syntax">Format String Syntax</a></h4>
+ * <h3><a id="syntax">Format String Syntax</a></h3>
*
* <p> Every method which produces formatted output requires a <i>format
* string</i> and an <i>argument list</i>. The format string is a {@link
@@ -236,7 +236,7 @@
*
* </ul>
*
- * <h4> Conversions </h4>
+ * <h3> Conversions </h3>
*
* <p> Conversions are divided into the following categories:
*
@@ -376,7 +376,7 @@
* <p> Any characters not explicitly defined as conversions are illegal and are
* reserved for future extensions.
*
- * <h4><a id="dt">Date/Time Conversions</a></h4>
+ * <h3><a id="dt">Date/Time Conversions</a></h3>
*
* <p> The following date and time conversion suffix characters are defined for
* the {@code 't'} and {@code 'T'} conversions. The types are similar to but
@@ -550,7 +550,7 @@
* <p> Any characters not explicitly defined as date/time conversion suffixes
* are illegal and are reserved for future extensions.
*
- * <h4> Flags </h4>
+ * <h3> Flags </h3>
*
* <p> The following table summarizes the supported flags. <i>y</i> means the
* flag is supported for the indicated argument types.
@@ -636,13 +636,13 @@
* <p> Any characters not explicitly defined as flags are illegal and are
* reserved for future extensions.
*
- * <h4> Width </h4>
+ * <h3> Width </h3>
*
* <p> The width is the minimum number of characters to be written to the
* output. For the line separator conversion, width is not applicable; if it
* is provided, an exception will be thrown.
*
- * <h4> Precision </h4>
+ * <h3> Precision </h3>
*
* <p> For general argument types, the precision is the maximum number of
* characters to be written to the output.
@@ -657,7 +657,7 @@
* and line separator conversions, the precision is not applicable; if a
* precision is provided, an exception will be thrown.
*
- * <h4> Argument Index </h4>
+ * <h3> Argument Index </h3>
*
* <p> The argument index is a decimal integer indicating the position of the
* argument in the argument list. The first argument is referenced by
@@ -676,7 +676,7 @@
* </pre></blockquote>
*
* <hr>
- * <h3><a id="detail">Details</a></h3>
+ * <h2><a id="detail">Details</a></h2>
*
* <p> This section is intended to provide behavioral details for formatting,
* including conditions and exceptions, supported data types, localization, and
@@ -717,7 +717,7 @@
* invocation, then the {@link java.util.Locale.Category#FORMAT default locale}
* is used.
*
- * <h4><a id="dgen">General</a></h4>
+ * <h3><a id="dgen">General</a></h3>
*
* <p> The following general conversions may be applied to any argument type:
*
@@ -814,7 +814,7 @@
* the precision. If the precision is not specified then there is no explicit
* limit on the number of characters.
*
- * <h4><a id="dchar">Character</a></h4>
+ * <h3><a id="dchar">Character</a></h3>
*
* This conversion may be applied to {@code char} and {@link Character}. It
* may also be applied to the types {@code byte}, {@link Byte},
@@ -853,7 +853,7 @@
* <p> The precision is not applicable. If the precision is specified then an
* {@link IllegalFormatPrecisionException} will be thrown.
*
- * <h4><a id="dnum">Numeric</a></h4>
+ * <h3><a id="dnum">Numeric</a></h3>
*
* <p> Numeric conversions are divided into the following categories:
*
@@ -1547,7 +1547,7 @@
* href="#floatDPrec">precision</a> is the same as defined for Float and
* Double.
*
- * <h4><a id="ddt">Date/Time</a></h4>
+ * <h3><a id="ddt">Date/Time</a></h3>
*
* <p> This conversion may be applied to {@code long}, {@link Long}, {@link
* Calendar}, {@link Date} and {@link TemporalAccessor TemporalAccessor}
@@ -1796,7 +1796,7 @@
* <p> The precision is not applicable. If the precision is specified then an
* {@link IllegalFormatPrecisionException} will be thrown.
*
- * <h4><a id="dper">Percent</a></h4>
+ * <h3><a id="dper">Percent</a></h3>
*
* <p> The conversion does not correspond to any argument.
*
@@ -1824,7 +1824,7 @@
* </tbody>
* </table>
*
- * <h4><a id="dls">Line Separator</a></h4>
+ * <h3><a id="dls">Line Separator</a></h3>
*
* <p> The conversion does not correspond to any argument.
*
@@ -1843,7 +1843,7 @@
* {@link IllegalFormatFlagsException}, {@link IllegalFormatWidthException},
* and {@link IllegalFormatPrecisionException}, respectively will be thrown.
*
- * <h4><a id="dpos">Argument Index</a></h4>
+ * <h3><a id="dpos">Argument Index</a></h3>
*
* <p> Format specifiers can reference arguments in three ways:
*
--- a/src/java.base/share/classes/java/util/GregorianCalendar.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/util/GregorianCalendar.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, 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
@@ -91,7 +91,7 @@
* adjustment may be made if desired for dates that are prior to the Gregorian
* changeover and which fall between January 1 and March 24.
*
- * <h3><a id="week_and_year">Week Of Year and Week Year</a></h3>
+ * <h2><a id="week_and_year">Week Of Year and Week Year</a></h2>
*
* <p>Values calculated for the {@link Calendar#WEEK_OF_YEAR
* WEEK_OF_YEAR} field range from 1 to 53. The first week of a
@@ -133,7 +133,7 @@
* ends on January 10, 1998; the first three days of 1998 then are
* part of week 53 of 1997 and their week year is 1997.
*
- * <h4>Week Of Month</h4>
+ * <h3>Week Of Month</h3>
*
* <p>Values calculated for the <code>WEEK_OF_MONTH</code> field range from 0
* to 6. Week 1 of a month (the days with <code>WEEK_OF_MONTH =
@@ -153,7 +153,7 @@
* <code>getMinimalDaysInFirstWeek()</code> is changed to 3, then January 1
* through January 3 have a <code>WEEK_OF_MONTH</code> of 1.
*
- * <h4>Default Fields Values</h4>
+ * <h3>Default Fields Values</h3>
*
* <p>The <code>clear</code> method sets calendar field(s)
* undefined. <code>GregorianCalendar</code> uses the following
--- a/src/java.base/share/classes/java/util/Locale.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/util/Locale.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, 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
@@ -190,7 +190,7 @@
* requirement (is well-formed), but does not validate the value
* itself. See {@link Builder} for details.
*
- * <h3><a id="def_locale_extension">Unicode locale/language extension</a></h3>
+ * <h2><a id="def_locale_extension">Unicode locale/language extension</a></h2>
*
* <p>UTS#35, "Unicode Locale Data Markup Language" defines optional
* attributes and keywords to override or refine the default behavior
@@ -230,17 +230,17 @@
* implementations in a Java Runtime Environment might not support any
* particular Unicode locale attributes or key/type pairs.
*
- * <h4>Creating a Locale</h4>
+ * <h3>Creating a Locale</h3>
*
* <p>There are several different ways to create a <code>Locale</code>
* object.
*
- * <h5>Builder</h5>
+ * <h4>Builder</h4>
*
* <p>Using {@link Builder} you can construct a <code>Locale</code> object
* that conforms to BCP 47 syntax.
*
- * <h5>Constructors</h5>
+ * <h4>Constructors</h4>
*
* <p>The <code>Locale</code> class provides three constructors:
* <blockquote>
@@ -254,12 +254,12 @@
* with language, country and variant, but you cannot specify
* script or extensions.
*
- * <h5>Factory Methods</h5>
+ * <h4>Factory Methods</h4>
*
* <p>The method {@link #forLanguageTag} creates a <code>Locale</code>
* object for a well-formed BCP 47 language tag.
*
- * <h5>Locale Constants</h5>
+ * <h4>Locale Constants</h4>
*
* <p>The <code>Locale</code> class provides a number of convenient constants
* that you can use to create <code>Locale</code> objects for commonly used
@@ -271,7 +271,7 @@
* </pre>
* </blockquote>
*
- * <h4><a id="LocaleMatching">Locale Matching</a></h4>
+ * <h3><a id="LocaleMatching">Locale Matching</a></h3>
*
* <p>If an application or a system is internationalized and provides localized
* resources for multiple locales, it sometimes needs to find one or more
@@ -292,7 +292,7 @@
* language ranges: basic and extended. See
* {@link Locale.LanguageRange Locale.LanguageRange} for details.
*
- * <h5>Filtering</h5>
+ * <h4>Filtering</h4>
*
* <p>The filtering operation returns all matching language tags. It is defined
* in RFC 4647 as follows:
@@ -310,7 +310,7 @@
* {@link Locale.FilteringMode} is a parameter to specify how filtering should
* be done.
*
- * <h5>Lookup</h5>
+ * <h4>Lookup</h4>
*
* <p>The lookup operation returns the best matching language tags. It is
* defined in RFC 4647 as follows:
@@ -342,7 +342,7 @@
* an {@link Iterator} over a {@link Collection} of language tags is treated as
* the best matching one.
*
- * <h4>Use of Locale</h4>
+ * <h3>Use of Locale</h3>
*
* <p>Once you've created a <code>Locale</code> you can query it for information
* about itself. Use <code>getCountry</code> to get the country (or region)
@@ -385,7 +385,7 @@
* <STRONG>just</STRONG> a mechanism for identifying objects,
* <STRONG>not</STRONG> a container for the objects themselves.
*
- * <h4>Compatibility</h4>
+ * <h3>Compatibility</h3>
*
* <p>In order to maintain compatibility with existing usage, Locale's
* constructors retain their behavior prior to the Java Runtime
@@ -410,7 +410,7 @@
* Clients desiring a string representation of the complete locale can
* then always rely on <code>toLanguageTag</code> for this purpose.
*
- * <h5><a id="special_cases_constructor">Special cases</a></h5>
+ * <h4><a id="special_cases_constructor">Special cases</a></h4>
*
* <p>For compatibility reasons, two
* non-conforming locales are treated as special cases. These are
@@ -435,7 +435,7 @@
* constructor is called with the arguments "th", "TH", "TH", the
* extension "u-nu-thai" is automatically added.
*
- * <h5>Serialization</h5>
+ * <h4>Serialization</h4>
*
* <p>During serialization, writeObject writes all fields to the output
* stream, including extensions.
@@ -444,7 +444,7 @@
* in <a href="#special_cases_constructor">Special Cases</a>, only
* for the two cases th_TH_TH and ja_JP_JP.
*
- * <h5>Legacy language codes</h5>
+ * <h4>Legacy language codes</h4>
*
* <p>Locale's constructor has always converted three language codes to
* their earlier, obsoleted forms: {@code he} maps to {@code iw},
@@ -462,7 +462,7 @@
* lookup mechanism also implements this mapping, so that resources
* can be named using either convention, see {@link ResourceBundle.Control}.
*
- * <h5>Three-letter language/country(region) codes</h5>
+ * <h4>Three-letter language/country(region) codes</h4>
*
* <p>The Locale constructors have always specified that the language
* and the country param be two characters in length, although in
--- a/src/java.base/share/classes/java/util/ResourceBundle.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/util/ResourceBundle.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, 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
@@ -204,18 +204,18 @@
* known concrete subclasses {@code ListResourceBundle} and
* {@code PropertyResourceBundle} are thread-safe.
*
- * <h3><a id="resource-bundle-modules">Resource Bundles and Named Modules</a></h3>
+ * <h2><a id="resource-bundle-modules">Resource Bundles and Named Modules</a></h2>
*
* Resource bundles can be deployed in modules in the following ways:
*
- * <h4>Resource bundles together with an application</h4>
+ * <h3>Resource bundles together with an application</h3>
*
* Resource bundles can be deployed together with an application in the same
* module. In that case, the resource bundles are loaded
* by code in the module by calling the {@link #getBundle(String)}
* or {@link #getBundle(String, Locale)} method.
*
- * <h4><a id="service-providers">Resource bundles as service providers</a></h4>
+ * <h3><a id="service-providers">Resource bundles as service providers</a></h3>
*
* Resource bundles can be deployed in one or more <em>service provider modules</em>
* and they can be located using {@link ServiceLoader}.
@@ -232,7 +232,7 @@
* provide resource bundles in any format such XML which replaces the need
* of {@link Control ResourceBundle.Control}.
*
- * <h4><a id="other-modules">Resource bundles in other modules and class path</a></h4>
+ * <h3><a id="other-modules">Resource bundles in other modules and class path</a></h3>
*
* Resource bundles in a named module may be <em>encapsulated</em> so that
* it cannot be located by code in other modules. Resource bundles
@@ -255,7 +255,7 @@
* resource bundle provider</a>, it does not fall back to the
* class loader search.
*
- * <h4>Resource bundles in automatic modules</h4>
+ * <h3>Resource bundles in automatic modules</h3>
*
* A common format of resource bundles is in {@linkplain PropertyResourceBundle
* .properties} file format. Typically {@code .properties} resource bundles
@@ -300,7 +300,7 @@
* the first one returned from {@link ServiceLoader} will be used.
* A custom {@link Control} implementation is ignored by named modules.
*
- * <h3>Cache Management</h3>
+ * <h2>Cache Management</h2>
*
* Resource bundle instances created by the <code>getBundle</code> factory
* methods are cached by default, and the factory methods return the same
@@ -316,7 +316,7 @@
* Control#needsReload(String, Locale, String, ClassLoader, ResourceBundle,
* long) ResourceBundle.Control.needsReload} for details.
*
- * <h3>Example</h3>
+ * <h2>Example</h2>
*
* The following is a very simple example of a <code>ResourceBundle</code>
* subclass, <code>MyResources</code>, that manages two resources (for a larger number of
--- a/src/java.base/share/classes/java/util/Scanner.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/util/Scanner.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, 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
@@ -155,7 +155,7 @@
* {@link #reset} method will reset the value of the scanner's radix to
* {@code 10} regardless of whether it was previously changed.
*
- * <h3> <a id="localized-numbers">Localized numbers</a> </h3>
+ * <h2> <a id="localized-numbers">Localized numbers</a> </h2>
*
* <p> An instance of this class is capable of scanning numbers in the standard
* formats as well as in the formats of the scanner's locale. A scanner's
@@ -216,7 +216,7 @@
* getInfinity()}
* </dl></blockquote>
*
- * <h4> <a id="number-syntax">Number syntax</a> </h4>
+ * <h3> <a id="number-syntax">Number syntax</a> </h3>
*
* <p> The strings that can be parsed as numbers by an instance of this class
* are specified in terms of the following regular-expression grammar, where
--- a/src/java.base/share/classes/java/util/ServiceLoader.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/util/ServiceLoader.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, 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
@@ -69,7 +69,7 @@
* service providers (based on the functionality they expose through the service),
* and handling the possibility that no service providers are located.
*
- * <h3> Obtaining a service loader </h3>
+ * <h2> Obtaining a service loader </h2>
*
* <p> An application obtains a service loader for a given service by invoking
* one of the static {@code load} methods of {@code ServiceLoader}. If the
@@ -141,7 +141,7 @@
* <li> {@code get()} yields an instance of {@code CodecFactory} </li>
* </ol>
*
- * <h3> Designing services </h3>
+ * <h2> Designing services </h2>
*
* <p> A service is a single type, usually an interface or abstract class. A
* concrete class can be used, but this is not recommended. The type may have
@@ -167,7 +167,7 @@
* or complicated to produce certain codecs. </p></li>
* </ol>
*
- * <h3> <a id="developing-service-providers">Developing service providers</a> </h3>
+ * <h2> <a id="developing-service-providers">Developing service providers</a> </h2>
*
* <p> A service provider is a single type, usually a concrete class. An
* interface or abstract class is permitted because it may declare a static
@@ -188,7 +188,7 @@
* the service loader's stream, without knowledge of the service providers'
* locations.
*
- * <h3> Deploying service providers as modules </h3>
+ * <h2> Deploying service providers as modules </h2>
*
* <p> A service provider that is developed in a module must be specified in a
* <i>provides</i> directive in the module declaration. The provides directive
@@ -253,7 +253,7 @@
* the service provider) will be instantiated by an entity (that is, a service
* loader) which is outside the class's package.
*
- * <h3> Deploying service providers on the class path </h3>
+ * <h2> Deploying service providers on the class path </h2>
*
* A service provider that is packaged as a JAR file for the class path is
* identified by placing a <i>provider-configuration file</i> in the resource
@@ -293,7 +293,7 @@
* not necessarily the class loader which ultimately locates the
* provider-configuration file.
*
- * <h3> Timing of provider discovery </h3>
+ * <h2> Timing of provider discovery </h2>
*
* <p> Service providers are loaded and instantiated lazily, that is, on demand.
* A service loader maintains a cache of the providers that have been loaded so
@@ -306,7 +306,7 @@
* locates any remaining providers. Caches are cleared via the {@link #reload
* reload} method.
*
- * <h3> <a id="errors">Errors</a> </h3>
+ * <h2> <a id="errors">Errors</a> </h2>
*
* <p> When using the service loader's {@code iterator}, the {@link
* Iterator#hasNext() hasNext} and {@link Iterator#next() next} methods will
@@ -361,7 +361,7 @@
*
* </ul>
*
- * <h3> Security </h3>
+ * <h2> Security </h2>
*
* <p> Service loaders always execute in the security context of the caller
* of the iterator or stream methods and may also be restricted by the security
@@ -370,7 +370,7 @@
* the methods of the iterators which they return, from within a privileged
* security context.
*
- * <h3> Concurrency </h3>
+ * <h2> Concurrency </h2>
*
* <p> Instances of this class are not safe for use by multiple concurrent
* threads.
--- a/src/java.base/share/classes/java/util/TimeZone.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/util/TimeZone.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, 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
@@ -114,7 +114,7 @@
* </pre></blockquote>
* For example, TimeZone.getTimeZone("GMT-8").getID() returns "GMT-08:00".
*
- * <h3>Three-letter time zone IDs</h3>
+ * <h2>Three-letter time zone IDs</h2>
*
* For compatibility with JDK 1.1.x, some other three-letter time zone IDs
* (such as "PST", "CTT", "AST") are also supported. However, <strong>their
--- a/src/java.base/share/classes/java/util/doc-files/coll-designfaq.html Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/util/doc-files/coll-designfaq.html Fri Mar 22 14:39:16 2019 +0530
@@ -1,6 +1,6 @@
<!DOCTYPE html>
<!--
- Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 1998, 2019, 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
@@ -29,14 +29,14 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
-<h2>Java Collections API Design FAQ</h2>
+<h1>Java Collections API Design FAQ</h1>
<!-- Body text begins here -->
<hr>
This document answers frequently asked questions concerning the
design of the Java collections framework. It is derived from the
large volume of traffic on the collections-comments alias. It
serves as a design rationale for the collections framework.
-<h3>Core Interfaces - General Questions</h3>
+<h2>Core Interfaces - General Questions</h2>
<ol>
<li><a href="#a1"><b>Why don't you support immutability directly in
the core collection interfaces so that you can do away with
@@ -50,7 +50,7 @@
<li><a href="#a28"><b>Why didn't you use "Beans-style names" for
consistency?</b></a></li>
</ol>
-<h3>Collection Interface</h3>
+<h2>Collection Interface</h2>
<ol>
<li><a href="#a5"><b>Why doesn't Collection extend Cloneable and
Serializable?</b></a></li>
@@ -67,7 +67,7 @@
<li><a href="#a10"><b>Why don't you provide an Iterator.add
method?</b></a></li>
</ol>
-<h3>List Interface</h3>
+<h2>List Interface</h2>
<ol>
<li><a href="#a11"><b>Why don't you rename the List interface to
Sequence; doesn't "list" generally suggest "linked list"? Also,
@@ -75,12 +75,12 @@
<li><a href="#a12"><b>Why don't you rename List's set method to
replace, to avoid confusion with Set.</b></a></li>
</ol>
-<h3>Map Interface</h3>
+<h2>Map Interface</h2>
<ol>
<li><a href="#a14"><b>Why doesn't Map extend
Collection?</b></a></li>
</ol>
-<h3>Iterator Interface</h3>
+<h2>Iterator Interface</h2>
<ol>
<li><a href="#a18"><b>Why doesn't Iterator extend
Enumeration?</b></a></li>
@@ -88,7 +88,7 @@
that allows you to look at the next element in an iteration without
advancing the iterator?</b></a></li>
</ol>
-<h3>Miscellaneous</h3>
+<h2>Miscellaneous</h2>
<ol>
<li><a href="#a23"><b>Why did you write a new collections framework
instead of adopting JGL (a preexisting collections package from
@@ -102,7 +102,7 @@
modified?</b></a></li>
</ol>
<hr>
-<h3>Core Interfaces - General Questions</h3>
+<h2>Core Interfaces - General Questions</h2>
<ol>
<li><a id="a1"><b>Why don't you support immutability
directly in the core collection interfaces so that you can do away
@@ -204,7 +204,7 @@
Beans style.</li>
</ol>
<hr>
-<h3>Collection Interface</h3>
+<h2>Collection Interface</h2>
<ol>
<li><a id="a5"><b>Why doesn't Collection extend Cloneable
and Serializable?</b></a>
@@ -264,7 +264,7 @@
</li>
</ol>
<hr>
-<h3>List Interface</h3>
+<h2>List Interface</h2>
<ol>
<li><a id="a11"><b>Why don't you rename the List
interface to Sequence; doesn't "list" generally suggest "linked
@@ -288,7 +288,7 @@
</li>
</ol>
<hr>
-<h3>Map Interface</h3>
+<h2>Map Interface</h2>
<ol>
<li><a id="a14"><b>Why doesn't Map extend
Collection?</b></a>
@@ -314,7 +314,7 @@
</li>
</ol>
<hr>
-<h3>Iterator Interface</h3>
+<h2>Iterator Interface</h2>
<ol>
<li><a id="a18"><b>Why doesn't Iterator extend
Enumeration?</b></a>
@@ -335,7 +335,7 @@
</li>
</ol>
<hr>
-<h3>Miscellaneous</h3>
+<h2>Miscellaneous</h2>
<ol>
<li><a id="a23"><b>Why did you write a new collections
framework instead of adopting JGL (a preexisting collections
--- a/src/java.base/share/classes/java/util/regex/Pattern.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/util/regex/Pattern.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2019, 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
@@ -77,7 +77,7 @@
* such use.
*
*
- * <h3><a id="sum">Summary of regular-expression constructs</a></h3>
+ * <h2><a id="sum">Summary of regular-expression constructs</a></h2>
*
* <table class="borderless">
* <caption style="display:none">Regular expression constructs, and what they match</caption>
@@ -378,7 +378,7 @@
* <hr>
*
*
- * <h3><a id="bs">Backslashes, escapes, and quoting</a></h3>
+ * <h2><a id="bs">Backslashes, escapes, and quoting</a></h2>
*
* <p> The backslash character ({@code '\'}) serves to introduce escaped
* constructs, as defined in the table above, as well as to quote characters
@@ -406,7 +406,7 @@
* {@code (hello)} the string literal {@code "\\(hello\\)"}
* must be used.
*
- * <h3><a id="cc">Character Classes</a></h3>
+ * <h2><a id="cc">Character Classes</a></h2>
*
* <p> Character classes may appear within other character classes, and
* may be composed by the union operator (implicit) and the intersection
@@ -449,7 +449,7 @@
* character class, while the expression {@code -} becomes a range
* forming metacharacter.
*
- * <h3><a id="lt">Line terminators</a></h3>
+ * <h2><a id="lt">Line terminators</a></h2>
*
* <p> A <i>line terminator</i> is a one- or two-character sequence that marks
* the end of a line of the input character sequence. The following are
@@ -484,9 +484,9 @@
* except at the end of input. When in {@link #MULTILINE} mode {@code $}
* matches just before a line terminator or the end of the input sequence.
*
- * <h3><a id="cg">Groups and capturing</a></h3>
+ * <h2><a id="cg">Groups and capturing</a></h2>
*
- * <h4><a id="gnumber">Group number</a></h4>
+ * <h3><a id="gnumber">Group number</a></h3>
* <p> Capturing groups are numbered by counting their opening parentheses from
* left to right. In the expression {@code ((A)(B(C)))}, for example, there
* are four such groups: </p>
@@ -505,7 +505,7 @@
* subsequence may be used later in the expression, via a back reference, and
* may also be retrieved from the matcher once the match operation is complete.
*
- * <h4><a id="groupname">Group name</a></h4>
+ * <h3><a id="groupname">Group name</a></h3>
* <p>A capturing group can also be assigned a "name", a {@code named-capturing group},
* and then be back-referenced later by the "name". Group names are composed of
* the following characters. The first character must be a {@code letter}.
@@ -534,7 +534,7 @@
* that do not capture text and do not count towards the group total, or
* <i>named-capturing</i> group.
*
- * <h3> Unicode support </h3>
+ * <h2> Unicode support </h2>
*
* <p> This class is in conformance with Level 1 of <a
* href="http://www.unicode.org/reports/tr18/"><i>Unicode Technical
@@ -688,7 +688,7 @@
* available through the same <code>\p{</code><i>prop</i><code>}</code> syntax where
* the specified property has the name <code>java<i>methodname</i></code></a>.
*
- * <h3> Comparison to Perl 5 </h3>
+ * <h2> Comparison to Perl 5 </h2>
*
* <p>The {@code Pattern} engine performs traditional NFA-based matching
* with ordered alternation as occurs in Perl 5.
--- a/src/java.base/share/classes/java/util/spi/LocaleServiceProvider.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/util/spi/LocaleServiceProvider.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, 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
@@ -42,7 +42,7 @@
* interfaces to offer support for locales beyond the set of locales
* supported by the Java runtime environment itself.
*
- * <h3>Packaging of Locale Sensitive Service Provider Implementations</h3>
+ * <h2>Packaging of Locale Sensitive Service Provider Implementations</h2>
* Implementations of these locale sensitive services can be made available
* by adding them to the application's class path. A provider identifies itself with a
* provider-configuration file in the resource directory META-INF/services,
@@ -75,7 +75,7 @@
* </pre>
* which is the fully qualified class name of the class implementing
* <code>DateFormatProvider</code>.
- * <h4>Invocation of Locale Sensitive Services</h4>
+ * <h3>Invocation of Locale Sensitive Services</h3>
* <p>
* Locale sensitive factory methods and methods for name retrieval in the
* <code>java.text</code> and <code>java.util</code> packages invoke
--- a/src/java.base/share/classes/java/util/spi/ResourceBundleProvider.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/java/util/spi/ResourceBundleProvider.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, 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
@@ -35,7 +35,7 @@
* factory methods to locate and load the service providers that are deployed as
* modules via {@link java.util.ServiceLoader ServiceLoader}.
*
- * <h3>Developing resource bundle services</h3>
+ * <h2>Developing resource bundle services</h2>
*
* A service for a resource bundle of a given <em>{@code baseName}</em> must have
* a fully-qualified class name of the form:
@@ -55,7 +55,7 @@
* }
* }</pre></blockquote>
*
- * <h3>Deploying resource bundle service providers</h3>
+ * <h2>Deploying resource bundle service providers</h2>
*
* Resource bundles can be deployed in one or more service providers
* in modules. For example, a provider for a service
@@ -114,7 +114,7 @@
* provides com.example.app.spi.MyResourcesProvider with com.example.impl.MyResourcesProviderImpl;
* </pre>
*
- * <h3><a id="obtain-resource-bundle">Obtaining resource bundles from providers</a></h3>
+ * <h2><a id="obtain-resource-bundle">Obtaining resource bundles from providers</a></h2>
*
* The module declaration of the <em>consumer module</em> that calls one of the
* {@code ResourceBundle.getBundle} factory methods to obtain a resource
--- a/src/java.base/share/classes/jdk/internal/loader/URLClassPath.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/jdk/internal/loader/URLClassPath.java Fri Mar 22 14:39:16 2019 +0530
@@ -103,10 +103,13 @@
DISABLE_ACC_CHECKING = p != null ? p.equals("true") || p.isEmpty() : false;
// This property will be removed in a later release
- p = props.getProperty("jdk.net.URLClassPath.disableClassPathURLCheck", "true");
+ p = props.getProperty("jdk.net.URLClassPath.disableClassPathURLCheck");
+ DISABLE_CP_URL_CHECK = p != null ? p.equals("true") || p.isEmpty() : false;
- DISABLE_CP_URL_CHECK = p != null ? p.equals("true") || p.isEmpty() : false;
- DEBUG_CP_URL_CHECK = "debug".equals(p);
+ // Print a message for each Class-Path entry that is ignored (assuming
+ // the check is not disabled).
+ p = props.getProperty("jdk.net.URLClassPath.showIgnoredClassPathEntries");
+ DEBUG_CP_URL_CHECK = p != null ? p.equals("true") || p.isEmpty() : false;
}
/* The original search path of URLs. */
--- a/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java Fri Mar 22 14:39:16 2019 +0530
@@ -342,15 +342,8 @@
@Override
public synchronized SSLSession getHandshakeSession() {
- if (conContext.handshakeContext != null) {
- synchronized (this) {
- if (conContext.handshakeContext != null) {
- return conContext.handshakeContext.handshakeSession;
- }
- }
- }
-
- return null;
+ return conContext.handshakeContext == null ?
+ null : conContext.handshakeContext.handshakeSession;
}
@Override
--- a/src/java.base/unix/native/libnet/PlainDatagramSocketImpl.c Thu Mar 21 21:37:09 2019 -0700
+++ b/src/java.base/unix/native/libnet/PlainDatagramSocketImpl.c Fri Mar 22 14:39:16 2019 +0530
@@ -1496,6 +1496,7 @@
CHECK_NULL_RETURN(ni_class, NULL);
}
ni = Java_java_net_NetworkInterface_getByInetAddress0(env, ni_class, addr);
+ JNU_CHECK_EXCEPTION_RETURN(env, NULL);
if (ni) {
return ni;
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/IntegerStampShiftTest.java Fri Mar 22 14:39:16 2019 +0530
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2019, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * 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, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+
+package org.graalvm.compiler.core.test;
+
+import org.junit.Test;
+
+public class IntegerStampShiftTest extends GraalCompilerTest {
+
+ public static int unsignedShiftPositiveInt(boolean f) {
+ int h = f ? 0x7FFFFFF0 : 0x7FFFFF00;
+ return h >>> 8;
+ }
+
+ @Test
+ public void testUnsignedShiftPositiveInt() {
+ test("unsignedShiftPositiveInt", false);
+ }
+
+ public static int unsignedShiftNegativeInt(boolean f) {
+ int h = f ? 0xFFFFFFF0 : 0xFFFFFF00;
+ return h >>> 8;
+ }
+
+ @Test
+ public void testUnsignedShiftNegativeInt() {
+ test("unsignedShiftNegativeInt", false);
+ }
+
+ public static long unsignedShiftPositiveLong(boolean f) {
+ long h = f ? 0x7FFFFFFFFFFFFFF0L : 0x7FFFFFFFFFFFFF00L;
+ return h >>> 8;
+ }
+
+ @Test
+ public void testUnsignedShiftPositiveLong() {
+ test("unsignedShiftPositiveLong", false);
+ }
+
+ public static long unsignedShiftNegativeLong(boolean f) {
+ long h = f ? 0xFFFFFFFFFFFFFFF0L : 0xFFFFFFFFFFFFFF00L;
+ return h >>> 8;
+ }
+
+ @Test
+ public void testUnsignedShiftNegativeLong() {
+ test("unsignedShiftNegativeLong", false);
+ }
+}
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/CompilationWrapper.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/CompilationWrapper.java Fri Mar 22 14:39:16 2019 +0530
@@ -25,7 +25,7 @@
package org.graalvm.compiler.core;
import static org.graalvm.compiler.core.CompilationWrapper.ExceptionAction.ExitVM;
-import static org.graalvm.compiler.core.GraalCompilerOptions.CompilationBailoutAction;
+import static org.graalvm.compiler.core.GraalCompilerOptions.CompilationBailoutAsFailure;
import static org.graalvm.compiler.core.GraalCompilerOptions.CompilationFailureAction;
import static org.graalvm.compiler.core.GraalCompilerOptions.ExitVMOnException;
import static org.graalvm.compiler.core.GraalCompilerOptions.MaxCompilationProblemsPerAction;
@@ -45,14 +45,13 @@
import org.graalvm.compiler.debug.DiagnosticsOutputDirectory;
import org.graalvm.compiler.debug.PathUtilities;
import org.graalvm.compiler.debug.TTY;
-import org.graalvm.compiler.options.EnumOptionKey;
import org.graalvm.compiler.options.OptionValues;
import jdk.vm.ci.code.BailoutException;
/**
* Wrapper for a compilation that centralizes what action to take based on
- * {@link GraalCompilerOptions#CompilationBailoutAction} and
+ * {@link GraalCompilerOptions#CompilationBailoutAsFailure} and
* {@link GraalCompilerOptions#CompilationFailureAction} when an uncaught exception occurs during
* compilation.
*/
@@ -71,14 +70,17 @@
* Print nothing to the console.
*/
Silent,
+
/**
* Print a stack trace to the console.
*/
Print,
+
/**
* An exception causes the compilation to be retried with extra diagnostics enabled.
*/
Diagnose,
+
/**
* Same as {@link #Diagnose} except that the VM process is exited after retrying.
*/
@@ -122,27 +124,30 @@
protected abstract T handleException(Throwable t);
/**
- * Gets the action to take based on the value of {@code actionKey} in {@code options}.
+ * Gets the action to take based on the value of
+ * {@link GraalCompilerOptions#CompilationBailoutAsFailure},
+ * {@link GraalCompilerOptions#CompilationFailureAction} and
+ * {@link GraalCompilerOptions#ExitVMOnException} in {@code options}.
*
- * Subclasses can override this to choose a different action based on factors such as whether
- * {@code actionKey} has been explicitly set in {@code options} for example.
+ * Subclasses can override this to choose a different action.
*
* @param cause the cause of the bailout or failure
*/
- protected ExceptionAction lookupAction(OptionValues options, EnumOptionKey<ExceptionAction> actionKey, Throwable cause) {
- if (actionKey == CompilationFailureAction) {
- if (ExitVMOnException.getValue(options)) {
- assert CompilationFailureAction.getDefaultValue() != ExceptionAction.ExitVM;
- assert ExitVMOnException.getDefaultValue() != true;
- if (CompilationFailureAction.hasBeenSet(options) && CompilationFailureAction.getValue(options) != ExceptionAction.ExitVM) {
- TTY.printf("WARNING: Ignoring %s=%s since %s=true has been explicitly specified.%n",
- CompilationFailureAction.getName(), CompilationFailureAction.getValue(options),
- ExitVMOnException.getName());
- }
- return ExceptionAction.ExitVM;
+ protected ExceptionAction lookupAction(OptionValues options, Throwable cause) {
+ if (cause instanceof BailoutException && !CompilationBailoutAsFailure.getValue(options)) {
+ return ExceptionAction.Silent;
+ }
+ if (ExitVMOnException.getValue(options)) {
+ assert CompilationFailureAction.getDefaultValue() != ExceptionAction.ExitVM;
+ assert ExitVMOnException.getDefaultValue() != true;
+ if (CompilationFailureAction.hasBeenSet(options) && CompilationFailureAction.getValue(options) != ExceptionAction.ExitVM) {
+ TTY.printf("WARNING: Ignoring %s=%s since %s=true has been explicitly specified.%n",
+ CompilationFailureAction.getName(), CompilationFailureAction.getValue(options),
+ ExitVMOnException.getName());
}
+ return ExceptionAction.ExitVM;
}
- return actionKey.getValue(options);
+ return CompilationFailureAction.getValue(options);
}
/**
@@ -173,15 +178,6 @@
} catch (Throwable cause) {
OptionValues initialOptions = initialDebug.getOptions();
- String causeType = "failure";
- EnumOptionKey<ExceptionAction> actionKey;
- if (cause instanceof BailoutException) {
- actionKey = CompilationBailoutAction;
- causeType = "bailout";
- } else {
- actionKey = CompilationFailureAction;
- causeType = "failure";
- }
synchronized (CompilationFailureAction) {
// Serialize all compilation failure handling.
// This prevents retry compilation storms and interleaving
@@ -191,9 +187,9 @@
// forced crash (i.e., use of GraalCompilerOptions.CrashAt)
// is truncated.
- ExceptionAction action = lookupAction(initialOptions, actionKey, cause);
+ ExceptionAction action = lookupAction(initialOptions, cause);
- action = adjustAction(initialOptions, actionKey, action);
+ action = adjustAction(initialOptions, action);
if (action == ExceptionAction.Silent) {
return handleException(cause);
@@ -204,16 +200,14 @@
try (PrintStream ps = new PrintStream(baos)) {
ps.printf("%s: Compilation of %s failed: ", Thread.currentThread(), this);
cause.printStackTrace(ps);
- ps.printf("To disable compilation %s notifications, set %s to %s (e.g., -Dgraal.%s=%s).%n",
- causeType,
- actionKey.getName(), ExceptionAction.Silent,
- actionKey.getName(), ExceptionAction.Silent);
- ps.printf("To capture more information for diagnosing or reporting a compilation %s, " +
+ ps.printf("To disable compilation failure notifications, set %s to %s (e.g., -Dgraal.%s=%s).%n",
+ CompilationFailureAction.getName(), ExceptionAction.Silent,
+ CompilationFailureAction.getName(), ExceptionAction.Silent);
+ ps.printf("To capture more information for diagnosing or reporting a compilation failure, " +
"set %s to %s or %s (e.g., -Dgraal.%s=%s).%n",
- causeType,
- actionKey.getName(), ExceptionAction.Diagnose,
+ CompilationFailureAction.getName(), ExceptionAction.Diagnose,
ExceptionAction.ExitVM,
- actionKey.getName(), ExceptionAction.Diagnose);
+ CompilationFailureAction.getName(), ExceptionAction.Diagnose);
}
TTY.print(baos.toString());
return handleException(cause);
@@ -249,15 +243,13 @@
try (PrintStream ps = new PrintStream(baos)) {
ps.printf("%s: Compilation of %s failed:%n", Thread.currentThread(), this);
cause.printStackTrace(ps);
- ps.printf("To disable compilation %s notifications, set %s to %s (e.g., -Dgraal.%s=%s).%n",
- causeType,
- actionKey.getName(), ExceptionAction.Silent,
- actionKey.getName(), ExceptionAction.Silent);
- ps.printf("To print a message for a compilation %s without retrying the compilation, " +
+ ps.printf("To disable compilation failure notifications, set %s to %s (e.g., -Dgraal.%s=%s).%n",
+ CompilationFailureAction.getName(), ExceptionAction.Silent,
+ CompilationFailureAction.getName(), ExceptionAction.Silent);
+ ps.printf("To print a message for a compilation failure without retrying the compilation, " +
"set %s to %s (e.g., -Dgraal.%s=%s).%n",
- causeType,
- actionKey.getName(), ExceptionAction.Print,
- actionKey.getName(), ExceptionAction.Print);
+ CompilationFailureAction.getName(), ExceptionAction.Print,
+ CompilationFailureAction.getName(), ExceptionAction.Print);
if (dumpPath != null) {
ps.println("Retrying compilation of " + this);
} else {
@@ -320,7 +312,7 @@
* Adjusts {@code initialAction} if necessary based on
* {@link GraalCompilerOptions#MaxCompilationProblemsPerAction}.
*/
- private ExceptionAction adjustAction(OptionValues initialOptions, EnumOptionKey<ExceptionAction> actionKey, ExceptionAction initialAction) {
+ private ExceptionAction adjustAction(OptionValues initialOptions, ExceptionAction initialAction) {
ExceptionAction action = initialAction;
int maxProblems = MaxCompilationProblemsPerAction.getValue(initialOptions);
if (action != ExceptionAction.ExitVM) {
@@ -329,7 +321,7 @@
int problems = problemsHandledPerAction.getOrDefault(action, 0);
if (problems >= maxProblems) {
if (problems == maxProblems) {
- TTY.printf("Warning: adjusting %s from %s to %s after %s (%d) failed compilations%n", actionKey, action, action.quieter(),
+ TTY.printf("Warning: adjusting %s from %s to %s after %s (%d) failed compilations%n", CompilationFailureAction, action, action.quieter(),
MaxCompilationProblemsPerAction, maxProblems);
// Ensure that the message above is only printed once
problemsHandledPerAction.put(action, problems + 1);
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/GraalCompilerOptions.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/GraalCompilerOptions.java Fri Mar 22 14:39:16 2019 +0530
@@ -44,13 +44,12 @@
"suffix will raise a bailout exception and a ':PermanentBailout' " +
"suffix will raise a permanent bailout exception.", type = OptionType.Debug)
public static final OptionKey<String> CrashAt = new OptionKey<>(null);
- @Option(help = "file:doc-files/CompilationBailoutActionHelp.txt", type = OptionType.User)
- public static final EnumOptionKey<ExceptionAction> CompilationBailoutAction = new EnumOptionKey<>(ExceptionAction.Silent);
- @Option(help = "Specifies the action to take when compilation fails with a bailout exception. " +
- "The accepted values are the same as for CompilationBailoutAction.", type = OptionType.User)
- public static final EnumOptionKey<ExceptionAction> CompilationFailureAction = new EnumOptionKey<>(ExceptionAction.Diagnose);
- @Option(help = "The maximum number of compilation failures or bailouts to handle with the action specified " +
- "by CompilationFailureAction or CompilationBailoutAction before changing to a less verbose action. " +
+ @Option(help = "Treat compilation bailouts like compilation failures.", type = OptionType.User)
+ public static final OptionKey<Boolean> CompilationBailoutAsFailure = new OptionKey<>(false);
+ @Option(help = "file:doc-files/CompilationFailureActionHelp.txt", type = OptionType.User)
+ public static final EnumOptionKey<ExceptionAction> CompilationFailureAction = new EnumOptionKey<>(ExceptionAction.Silent);
+ @Option(help = "The maximum number of compilation failures to handle with the action specified " +
+ "by CompilationFailureAction before changing to a less verbose action. " +
"This does not apply to the ExitVM action.", type = OptionType.User)
public static final OptionKey<Integer> MaxCompilationProblemsPerAction = new OptionKey<>(2);
@Option(help = "Alias for CompilationFailureAction=ExitVM.", type = OptionType.User)
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/doc-files/CompilationBailoutActionHelp.txt Thu Mar 21 21:37:09 2019 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-Specifies the action to take when compilation fails with a bailout exception.
-The accepted values are:
- Silent - Print nothing to the console.
- Print - Print a stack trace to the console.
- Diagnose - Retry the compilation with extra diagnostics.
- ExitVM - Same as Diagnose except that the VM process exits after retrying.
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/doc-files/CompilationFailureActionHelp.txt Fri Mar 22 14:39:16 2019 +0530
@@ -0,0 +1,6 @@
+Specifies the action to take when compilation fails.
+The accepted values are:
+ Silent - Print nothing to the console.
+ Print - Print a stack trace to the console.
+ Diagnose - Retry the compilation with extra diagnostics.
+ ExitVM - Same as Diagnose except that the VM process exits after retrying.
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64ArrayEqualsStub.java Fri Mar 22 14:39:16 2019 +0530
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2019, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * 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, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package org.graalvm.compiler.hotspot.amd64;
+
+import org.graalvm.compiler.api.replacements.Snippet;
+import org.graalvm.compiler.core.common.spi.ForeignCallDescriptor;
+import org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage;
+import org.graalvm.compiler.hotspot.meta.HotSpotProviders;
+import org.graalvm.compiler.hotspot.stubs.SnippetStub;
+import org.graalvm.compiler.options.OptionValues;
+import org.graalvm.compiler.replacements.nodes.ArrayEqualsNode;
+import jdk.internal.vm.compiler.word.Pointer;
+
+import jdk.vm.ci.meta.JavaKind;
+
+public final class AMD64ArrayEqualsStub extends SnippetStub {
+
+ public static final ForeignCallDescriptor STUB_BOOLEAN_ARRAY_EQUALS = new ForeignCallDescriptor(
+ "booleanArraysEquals", boolean.class, Pointer.class, Pointer.class, int.class);
+ public static final ForeignCallDescriptor STUB_BYTE_ARRAY_EQUALS = new ForeignCallDescriptor(
+ "byteArraysEquals", boolean.class, Pointer.class, Pointer.class, int.class);
+ public static final ForeignCallDescriptor STUB_CHAR_ARRAY_EQUALS = new ForeignCallDescriptor(
+ "charArraysEquals", boolean.class, Pointer.class, Pointer.class, int.class);
+ public static final ForeignCallDescriptor STUB_SHORT_ARRAY_EQUALS = new ForeignCallDescriptor(
+ "shortArraysEquals", boolean.class, Pointer.class, Pointer.class, int.class);
+ public static final ForeignCallDescriptor STUB_INT_ARRAY_EQUALS = new ForeignCallDescriptor(
+ "intArraysEquals", boolean.class, Pointer.class, Pointer.class, int.class);
+ public static final ForeignCallDescriptor STUB_LONG_ARRAY_EQUALS = new ForeignCallDescriptor(
+ "longArraysEquals", boolean.class, Pointer.class, Pointer.class, int.class);
+ public static final ForeignCallDescriptor STUB_FLOAT_ARRAY_EQUALS = new ForeignCallDescriptor(
+ "floatArraysEquals", boolean.class, Pointer.class, Pointer.class, int.class);
+ public static final ForeignCallDescriptor STUB_DOUBLE_ARRAY_EQUALS = new ForeignCallDescriptor(
+ "doubleArraysEquals", boolean.class, Pointer.class, Pointer.class, int.class);
+
+ public AMD64ArrayEqualsStub(ForeignCallDescriptor foreignCallDescriptor, OptionValues options, HotSpotProviders providers, HotSpotForeignCallLinkage linkage) {
+ super(foreignCallDescriptor.getName(), options, providers, linkage);
+ }
+
+ @Snippet
+ private static boolean booleanArraysEquals(Pointer array1, Pointer array2, int length) {
+ return ArrayEqualsNode.equals(array1, array2, length, JavaKind.Boolean);
+ }
+
+ @Snippet
+ private static boolean byteArraysEquals(Pointer array1, Pointer array2, int length) {
+ return ArrayEqualsNode.equals(array1, array2, length, JavaKind.Byte);
+ }
+
+ @Snippet
+ private static boolean charArraysEquals(Pointer array1, Pointer array2, int length) {
+ return ArrayEqualsNode.equals(array1, array2, length, JavaKind.Char);
+ }
+
+ @Snippet
+ private static boolean shortArraysEquals(Pointer array1, Pointer array2, int length) {
+ return ArrayEqualsNode.equals(array1, array2, length, JavaKind.Short);
+ }
+
+ @Snippet
+ private static boolean intArraysEquals(Pointer array1, Pointer array2, int length) {
+ return ArrayEqualsNode.equals(array1, array2, length, JavaKind.Int);
+ }
+
+ @Snippet
+ private static boolean longArraysEquals(Pointer array1, Pointer array2, int length) {
+ return ArrayEqualsNode.equals(array1, array2, length, JavaKind.Long);
+ }
+
+ @Snippet
+ private static boolean floatArraysEquals(Pointer array1, Pointer array2, int length) {
+ return ArrayEqualsNode.equals(array1, array2, length, JavaKind.Float);
+ }
+
+ @Snippet
+ private static boolean doubleArraysEquals(Pointer array1, Pointer array2, int length) {
+ return ArrayEqualsNode.equals(array1, array2, length, JavaKind.Double);
+ }
+}
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64HotSpotBackendFactory.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64HotSpotBackendFactory.java Fri Mar 22 14:39:16 2019 +0530
@@ -25,6 +25,7 @@
package org.graalvm.compiler.hotspot.amd64;
import static jdk.vm.ci.common.InitTimer.timer;
+import static org.graalvm.compiler.serviceprovider.JavaVersionUtil.JAVA_SPECIFICATION_VERSION;
import java.util.ArrayList;
import java.util.List;
@@ -160,7 +161,7 @@
HotSpotConstantReflectionProvider constantReflection, HotSpotHostForeignCallsProvider foreignCalls, HotSpotMetaAccessProvider metaAccess,
HotSpotSnippetReflectionProvider snippetReflection, HotSpotReplacementsImpl replacements, HotSpotWordTypes wordTypes) {
Plugins plugins = HotSpotGraphBuilderPlugins.create(compilerConfiguration, config, wordTypes, metaAccess, constantReflection, snippetReflection, foreignCalls, replacements);
- AMD64GraphBuilderPlugins.register(plugins, replacements.getDefaultReplacementBytecodeProvider(), (AMD64) target.arch, false);
+ AMD64GraphBuilderPlugins.register(plugins, replacements.getDefaultReplacementBytecodeProvider(), (AMD64) target.arch, false, JAVA_SPECIFICATION_VERSION >= 9);
return plugins;
}
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64HotSpotForeignCallsProvider.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64HotSpotForeignCallsProvider.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, 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
@@ -121,6 +121,22 @@
link(new AMD64ArrayIndexOfStub(AMD64ArrayIndexOf.STUB_INDEX_OF_4_CHARS, options, providers,
registerStubCall(AMD64ArrayIndexOf.STUB_INDEX_OF_4_CHARS, LEAF, REEXECUTABLE, NO_LOCATIONS)));
+ link(new AMD64ArrayEqualsStub(AMD64ArrayEqualsStub.STUB_BOOLEAN_ARRAY_EQUALS, options, providers,
+ registerStubCall(AMD64ArrayEqualsStub.STUB_BOOLEAN_ARRAY_EQUALS, LEAF, REEXECUTABLE, NO_LOCATIONS)));
+ link(new AMD64ArrayEqualsStub(AMD64ArrayEqualsStub.STUB_BYTE_ARRAY_EQUALS, options, providers,
+ registerStubCall(AMD64ArrayEqualsStub.STUB_BYTE_ARRAY_EQUALS, LEAF, REEXECUTABLE, NO_LOCATIONS)));
+ link(new AMD64ArrayEqualsStub(AMD64ArrayEqualsStub.STUB_CHAR_ARRAY_EQUALS, options, providers,
+ registerStubCall(AMD64ArrayEqualsStub.STUB_CHAR_ARRAY_EQUALS, LEAF, REEXECUTABLE, NO_LOCATIONS)));
+ link(new AMD64ArrayEqualsStub(AMD64ArrayEqualsStub.STUB_SHORT_ARRAY_EQUALS, options, providers,
+ registerStubCall(AMD64ArrayEqualsStub.STUB_SHORT_ARRAY_EQUALS, LEAF, REEXECUTABLE, NO_LOCATIONS)));
+ link(new AMD64ArrayEqualsStub(AMD64ArrayEqualsStub.STUB_INT_ARRAY_EQUALS, options, providers,
+ registerStubCall(AMD64ArrayEqualsStub.STUB_INT_ARRAY_EQUALS, LEAF, REEXECUTABLE, NO_LOCATIONS)));
+ link(new AMD64ArrayEqualsStub(AMD64ArrayEqualsStub.STUB_LONG_ARRAY_EQUALS, options, providers,
+ registerStubCall(AMD64ArrayEqualsStub.STUB_LONG_ARRAY_EQUALS, LEAF, REEXECUTABLE, NO_LOCATIONS)));
+ link(new AMD64ArrayEqualsStub(AMD64ArrayEqualsStub.STUB_FLOAT_ARRAY_EQUALS, options, providers,
+ registerStubCall(AMD64ArrayEqualsStub.STUB_FLOAT_ARRAY_EQUALS, LEAF, REEXECUTABLE, NO_LOCATIONS)));
+ link(new AMD64ArrayEqualsStub(AMD64ArrayEqualsStub.STUB_DOUBLE_ARRAY_EQUALS, options, providers,
+ registerStubCall(AMD64ArrayEqualsStub.STUB_DOUBLE_ARRAY_EQUALS, LEAF, REEXECUTABLE, NO_LOCATIONS)));
super.initialize(providers, options);
}
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64HotSpotLIRGenerator.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64HotSpotLIRGenerator.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, 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
@@ -676,4 +676,32 @@
protected StrategySwitchOp createStrategySwitchOp(SwitchStrategy strategy, LabelRef[] keyTargets, LabelRef defaultTarget, Variable key, AllocatableValue temp) {
return new AMD64HotSpotStrategySwitchOp(strategy, keyTargets, defaultTarget, key, temp);
}
+
+ @Override
+ public ForeignCallLinkage lookupArrayEqualsStub(JavaKind kind, int constantLength) {
+ if (constantLength >= 0 && constantLength * kind.getByteCount() < 2 * getMaxVectorSize()) {
+ // Yield constant-length arrays comparison assembly
+ return null;
+ }
+ switch (kind) {
+ case Boolean:
+ return getForeignCalls().lookupForeignCall(AMD64ArrayEqualsStub.STUB_BOOLEAN_ARRAY_EQUALS);
+ case Byte:
+ return getForeignCalls().lookupForeignCall(AMD64ArrayEqualsStub.STUB_BYTE_ARRAY_EQUALS);
+ case Char:
+ return getForeignCalls().lookupForeignCall(AMD64ArrayEqualsStub.STUB_CHAR_ARRAY_EQUALS);
+ case Short:
+ return getForeignCalls().lookupForeignCall(AMD64ArrayEqualsStub.STUB_SHORT_ARRAY_EQUALS);
+ case Int:
+ return getForeignCalls().lookupForeignCall(AMD64ArrayEqualsStub.STUB_INT_ARRAY_EQUALS);
+ case Long:
+ return getForeignCalls().lookupForeignCall(AMD64ArrayEqualsStub.STUB_LONG_ARRAY_EQUALS);
+ case Float:
+ return getForeignCalls().lookupForeignCall(AMD64ArrayEqualsStub.STUB_FLOAT_ARRAY_EQUALS);
+ case Double:
+ return getForeignCalls().lookupForeignCall(AMD64ArrayEqualsStub.STUB_DOUBLE_ARRAY_EQUALS);
+ default:
+ return null;
+ }
+ }
}
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.jdk9.test/src/org/graalvm/compiler/hotspot/jdk9/test/StringUTF16ToBytesGetCharsTest.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.jdk9.test/src/org/graalvm/compiler/hotspot/jdk9/test/StringUTF16ToBytesGetCharsTest.java Fri Mar 22 14:39:16 2019 +0530
@@ -26,8 +26,6 @@
import static org.junit.Assume.assumeFalse;
-import jdk.vm.ci.code.InstalledCode;
-import jdk.vm.ci.meta.ResolvedJavaMethod;
import org.graalvm.compiler.core.common.CompilationIdentifier;
import org.graalvm.compiler.hotspot.replacements.StringUTF16Substitutions;
import org.graalvm.compiler.nodes.StructuredGraph;
@@ -35,9 +33,11 @@
import org.graalvm.compiler.replacements.arraycopy.ArrayCopyCallNode;
import org.graalvm.compiler.replacements.test.MethodSubstitutionTest;
import org.graalvm.compiler.test.AddExports;
-import org.junit.Before;
import org.junit.Test;
+import jdk.vm.ci.code.InstalledCode;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
+
/**
* Test substitutions for (innate) methods StringUTF16.toBytes and StringUTF16.getChars provided by
* {@link StringUTF16Substitutions}.
@@ -48,8 +48,7 @@
private static final int N = 1000;
private static final int N_OVERFLOW = 10;
- @Before
- public void checkAMD64() {
+ public StringUTF16ToBytesGetCharsTest() {
assumeFalse(Java8OrEarlier);
}
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/BigIntegerIntrinsicsTest.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/BigIntegerIntrinsicsTest.java Fri Mar 22 14:39:16 2019 +0530
@@ -21,6 +21,8 @@
* questions.
*/
+
+
package org.graalvm.compiler.hotspot.test;
import java.lang.reflect.InvocationTargetException;
@@ -193,8 +195,7 @@
Object invokeCode(Object... args) {
try {
return testcode.executeVarargs(args);
- }
- catch (InvalidInstalledCodeException e) {
+ } catch (InvalidInstalledCodeException e) {
// Ensure the installed code is valid, possibly recompiled.
testcode = getCode(testmethod);
@@ -208,8 +209,7 @@
private Object invokeSafe(ResolvedJavaMethod method, Object receiver, Object... args) {
try {
return invoke(method, receiver, args);
- } catch (IllegalAccessException | InvocationTargetException |
- IllegalArgumentException | InstantiationException e) {
+ } catch (IllegalAccessException | InvocationTargetException | IllegalArgumentException | InstantiationException e) {
throw new RuntimeException(e);
}
}
@@ -220,8 +220,7 @@
private InstalledCode testcode;
}
- private static GraalHotSpotVMConfig config =
- ((HotSpotGraalRuntimeProvider) Graal.getRequiredCapability(RuntimeProvider.class)).getVMConfig();
+ private static GraalHotSpotVMConfig config = ((HotSpotGraalRuntimeProvider) Graal.getRequiredCapability(RuntimeProvider.class)).getVMConfig();
private static BigInteger bigTwo = BigInteger.valueOf(2);
private static Random rnd = new Random(17);
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CompileTheWorld.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CompileTheWorld.java Fri Mar 22 14:39:16 2019 +0530
@@ -26,7 +26,7 @@
import static java.util.Collections.singletonList;
import static org.graalvm.compiler.core.CompilationWrapper.ExceptionAction.Print;
-import static org.graalvm.compiler.core.GraalCompilerOptions.CompilationBailoutAction;
+import static org.graalvm.compiler.core.GraalCompilerOptions.CompilationBailoutAsFailure;
import static org.graalvm.compiler.core.GraalCompilerOptions.CompilationFailureAction;
import static org.graalvm.compiler.core.test.ReflectionOptionDescriptors.extractEntries;
import static org.graalvm.compiler.debug.MemUseTrackerKey.getCurrentThreadAllocatedBytes;
@@ -215,7 +215,7 @@
compilationOptionsCopy.putAll(compilationOptions);
// We want to see stack traces when a method fails to compile
- CompilationBailoutAction.putIfAbsent(compilationOptionsCopy, Print);
+ CompilationBailoutAsFailure.putIfAbsent(compilationOptionsCopy, true);
CompilationFailureAction.putIfAbsent(compilationOptionsCopy, Print);
// By default only report statistics for the CTW threads themselves
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CompileTheWorldTest.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CompileTheWorldTest.java Fri Mar 22 14:39:16 2019 +0530
@@ -24,7 +24,7 @@
package org.graalvm.compiler.hotspot.test;
-import static org.graalvm.compiler.core.GraalCompilerOptions.CompilationBailoutAction;
+import static org.graalvm.compiler.core.GraalCompilerOptions.CompilationBailoutAsFailure;
import static org.graalvm.compiler.core.GraalCompilerOptions.CompilationFailureAction;
import jdk.internal.vm.compiler.collections.EconomicMap;
@@ -44,7 +44,7 @@
@Test
public void testJDK() throws Throwable {
- ExceptionAction originalBailoutAction = CompilationBailoutAction.getValue(getInitialOptions());
+ boolean originalBailoutAction = CompilationBailoutAsFailure.getValue(getInitialOptions());
ExceptionAction originalFailureAction = CompilationFailureAction.getValue(getInitialOptions());
// Compile a couple classes in rt.jar
HotSpotJVMCIRuntime runtime = HotSpotJVMCIRuntime.runtime();
@@ -52,7 +52,7 @@
OptionValues initialOptions = getInitialOptions();
EconomicMap<OptionKey<?>, Object> compilationOptions = CompileTheWorld.parseOptions("Inline=false");
new CompileTheWorld(runtime, (HotSpotGraalCompiler) runtime.getCompiler(), CompileTheWorld.SUN_BOOT_CLASS_PATH, 1, 5, null, null, false, initialOptions, compilationOptions).compile();
- assert CompilationBailoutAction.getValue(initialOptions) == originalBailoutAction;
+ assert CompilationBailoutAsFailure.getValue(initialOptions) == originalBailoutAction;
assert CompilationFailureAction.getValue(initialOptions) == originalFailureAction;
}
}
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/GraalOSRTestBase.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/GraalOSRTestBase.java Fri Mar 22 14:39:16 2019 +0530
@@ -31,7 +31,6 @@
import org.graalvm.compiler.bytecode.BytecodeDisassembler;
import org.graalvm.compiler.bytecode.BytecodeStream;
import org.graalvm.compiler.bytecode.ResolvedJavaMethodBytecode;
-import org.graalvm.compiler.core.CompilationWrapper.ExceptionAction;
import org.graalvm.compiler.core.GraalCompilerOptions;
import org.graalvm.compiler.core.target.Backend;
import org.graalvm.compiler.core.test.GraalCompilerTest;
@@ -134,8 +133,8 @@
OptionValues goptions = options;
// Silence diagnostics for permanent bailout errors as they
// are expected for some OSR tests.
- if (!GraalCompilerOptions.CompilationBailoutAction.hasBeenSet(options)) {
- goptions = new OptionValues(options, GraalCompilerOptions.CompilationBailoutAction, ExceptionAction.Silent);
+ if (!GraalCompilerOptions.CompilationBailoutAsFailure.hasBeenSet(options)) {
+ goptions = new OptionValues(options, GraalCompilerOptions.CompilationBailoutAsFailure, false);
}
// ensure eager resolving
StructuredGraph graph = parseEager(method, AllowAssumptions.YES, goptions);
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/CompilationTask.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/CompilationTask.java Fri Mar 22 14:39:16 2019 +0530
@@ -26,7 +26,7 @@
import static org.graalvm.compiler.core.CompilationWrapper.ExceptionAction.Diagnose;
import static org.graalvm.compiler.core.CompilationWrapper.ExceptionAction.ExitVM;
-import static org.graalvm.compiler.core.GraalCompilerOptions.CompilationBailoutAction;
+import static org.graalvm.compiler.core.GraalCompilerOptions.CompilationBailoutAsFailure;
import static org.graalvm.compiler.core.GraalCompilerOptions.CompilationFailureAction;
import static org.graalvm.compiler.core.phases.HighTier.Options.Inline;
import static org.graalvm.compiler.java.BytecodeParserOptions.InlineDuringParsing;
@@ -47,7 +47,6 @@
import org.graalvm.compiler.debug.DebugDumpScope;
import org.graalvm.compiler.debug.GraalError;
import org.graalvm.compiler.debug.TimerKey;
-import org.graalvm.compiler.options.EnumOptionKey;
import org.graalvm.compiler.options.OptionKey;
import org.graalvm.compiler.options.OptionValues;
import org.graalvm.compiler.printer.GraalDebugHandlersFactory;
@@ -145,25 +144,34 @@
}
@Override
- protected ExceptionAction lookupAction(OptionValues values, EnumOptionKey<ExceptionAction> actionKey, Throwable cause) {
- // Respect current action if it has been explicitly set.
- if (!actionKey.hasBeenSet(values)) {
- if (actionKey == CompilationFailureAction) {
- // Automatically exit on non-bailout during bootstrap
- // or when assertions are enabled.
- if (Assertions.assertionsEnabled() || compiler.getGraalRuntime().isBootstrapping()) {
- return ExitVM;
- }
- } else if (actionKey == CompilationBailoutAction && ((BailoutException) cause).isPermanent()) {
- // Get more info for permanent bailouts during bootstrap
- // or when assertions are enabled.
- assert CompilationBailoutAction.getDefaultValue() == ExceptionAction.Silent;
- if (Assertions.assertionsEnabled() || compiler.getGraalRuntime().isBootstrapping()) {
- return Diagnose;
+ protected ExceptionAction lookupAction(OptionValues values, Throwable cause) {
+ if (cause instanceof BailoutException) {
+ BailoutException bailout = (BailoutException) cause;
+ if (bailout.isPermanent()) {
+ // Respect current action if it has been explicitly set.
+ if (!CompilationBailoutAsFailure.hasBeenSet(values)) {
+ // Get more info for permanent bailouts during bootstrap
+ // or when assertions are enabled.
+ if (Assertions.assertionsEnabled() || compiler.getGraalRuntime().isBootstrapping()) {
+ return Diagnose;
+ }
+
}
}
+ if (!CompilationBailoutAsFailure.getValue(values)) {
+ return super.lookupAction(values, cause);
+ }
}
- return super.lookupAction(values, actionKey, cause);
+
+ // Respect current action if it has been explicitly set.
+ if (!CompilationFailureAction.hasBeenSet(values)) {
+ // Automatically exit on failure during bootstrap
+ // or when assertions are enabled.
+ if (Assertions.assertionsEnabled() || compiler.getGraalRuntime().isBootstrapping()) {
+ return ExitVM;
+ }
+ }
+ return super.lookupAction(values, cause);
}
@SuppressWarnings("try")
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalOptionValues.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalOptionValues.java Fri Mar 22 14:39:16 2019 +0530
@@ -41,6 +41,7 @@
import jdk.vm.ci.common.InitTimer;
import jdk.vm.ci.common.NativeImageReinitialize;
+import jdk.vm.ci.services.Services;
/**
* The {@link #defaultOptions()} method returns the options values initialized in a HotSpot VM. The
@@ -89,15 +90,14 @@
}
/**
- * Global options. The values for these options are initialized by parsing the file denoted by
- * the {@code VM.getSavedProperty(String) saved} system property named
- * {@value #GRAAL_OPTIONS_FILE_PROPERTY_NAME} if the file exists followed by parsing the options
- * encoded in saved system properties whose names start with
- * {@value #GRAAL_OPTION_PROPERTY_PREFIX}. Key/value pairs are parsed from the aforementioned
- * file with {@link Properties#load(java.io.Reader)}.
+ * Gets and parses options based on {@linkplain Services#getSavedProperties() saved system
+ * properties}. The values for these options are initialized by parsing the file denoted by the
+ * {@value #GRAAL_OPTIONS_FILE_PROPERTY_NAME} property followed by parsing the options encoded
+ * in properties whose names start with {@value #GRAAL_OPTION_PROPERTY_PREFIX}. Key/value pairs
+ * are parsed from the aforementioned file with {@link Properties#load(java.io.Reader)}.
*/
@SuppressWarnings("try")
- private static OptionValues initializeOptions() {
+ public static EconomicMap<OptionKey<?>, Object> parseOptions() {
EconomicMap<OptionKey<?>, Object> values = OptionValues.newOptionMap();
try (InitTimer t = timer("InitializeOptions")) {
@@ -142,7 +142,17 @@
}
OptionsParser.parseOptions(optionSettings, values, loader);
- return new OptionValues(values);
+ return values;
}
}
+
+ /**
+ * Substituted by
+ * {@code com.oracle.svm.graal.hotspot.libgraal.Target_org_graalvm_compiler_hotspot_HotSpotGraalOptionValues}
+ * to update {@code com.oracle.svm.core.option.RuntimeOptionValues.singleton()} instead of
+ * creating a new {@link OptionValues} object.
+ */
+ private static OptionValues initializeOptions() {
+ return new OptionValues(parseOptions());
+ }
}
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64ArrayIndexOfOp.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64ArrayIndexOfOp.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, 2019 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, 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
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/gen/LIRGeneratorTool.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/gen/LIRGeneratorTool.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, 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
@@ -269,6 +269,11 @@
Variable emitArrayEquals(JavaKind kind, Value array1, Value array2, Value length, int constantLength, boolean directPointers);
@SuppressWarnings("unused")
+ default ForeignCallLinkage lookupArrayEqualsStub(JavaKind kind, int constantLength) {
+ return null;
+ }
+
+ @SuppressWarnings("unused")
default Variable emitArrayEquals(JavaKind kind1, JavaKind kind2, Value array1, Value array2, Value length, int constantLength, boolean directPointers) {
throw GraalError.unimplemented("Array.equals with different types substitution is not implemented on this architecture");
}
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/calc/UnsignedRightShiftNode.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/calc/UnsignedRightShiftNode.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, 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
@@ -24,6 +24,7 @@
package org.graalvm.compiler.nodes.calc;
+import jdk.vm.ci.code.CodeUtil;
import org.graalvm.compiler.core.common.type.ArithmeticOpTable;
import org.graalvm.compiler.core.common.type.ArithmeticOpTable.ShiftOp.UShr;
import org.graalvm.compiler.core.common.type.IntegerStamp;
@@ -84,10 +85,13 @@
Stamp xStampGeneric = forX.stamp(view);
if (xStampGeneric instanceof IntegerStamp) {
IntegerStamp xStamp = (IntegerStamp) xStampGeneric;
+ long xMask = CodeUtil.mask(xStamp.getBits());
+ long xLowerBound = xStamp.lowerBound() & xMask;
+ long xUpperBound = xStamp.upperBound() & xMask;
- if (xStamp.lowerBound() >>> amount == xStamp.upperBound() >>> amount) {
+ if (xLowerBound >>> amount == xUpperBound >>> amount) {
// The result of the shift is constant.
- return ConstantNode.forIntegerKind(stamp.getStackKind(), xStamp.lowerBound() >>> amount);
+ return ConstantNode.forIntegerKind(stamp.getStackKind(), xLowerBound >>> amount);
}
if (amount == xStamp.getBits() - 1 && xStamp.lowerBound() == -1 && xStamp.upperBound() == 0) {
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.amd64/src/org/graalvm/compiler/replacements/amd64/AMD64GraphBuilderPlugins.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.amd64/src/org/graalvm/compiler/replacements/amd64/AMD64GraphBuilderPlugins.java Fri Mar 22 14:39:16 2019 +0530
@@ -32,7 +32,6 @@
import static org.graalvm.compiler.replacements.nodes.UnaryMathIntrinsicNode.UnaryOperation.LOG10;
import static org.graalvm.compiler.replacements.nodes.UnaryMathIntrinsicNode.UnaryOperation.SIN;
import static org.graalvm.compiler.replacements.nodes.UnaryMathIntrinsicNode.UnaryOperation.TAN;
-import static org.graalvm.compiler.serviceprovider.JavaVersionUtil.JAVA_SPECIFICATION_VERSION;
import static org.graalvm.compiler.serviceprovider.JavaVersionUtil.Java11OrEarlier;
import static org.graalvm.compiler.serviceprovider.JavaVersionUtil.Java8OrEarlier;
@@ -71,7 +70,7 @@
public class AMD64GraphBuilderPlugins {
- public static void register(Plugins plugins, BytecodeProvider replacementsBytecodeProvider, AMD64 arch, boolean explicitUnsafeNullChecks) {
+ public static void register(Plugins plugins, BytecodeProvider replacementsBytecodeProvider, AMD64 arch, boolean explicitUnsafeNullChecks, boolean emitJDK9StringSubstitutions) {
InvocationPlugins invocationPlugins = plugins.getInvocationPlugins();
invocationPlugins.defer(new Runnable() {
@Override
@@ -83,8 +82,10 @@
new JavaKind[]{JavaKind.Int, JavaKind.Long, JavaKind.Object, JavaKind.Boolean, JavaKind.Byte, JavaKind.Short, JavaKind.Char, JavaKind.Float, JavaKind.Double});
registerUnsafePlugins(invocationPlugins, replacementsBytecodeProvider, explicitUnsafeNullChecks);
registerStringPlugins(invocationPlugins, replacementsBytecodeProvider);
- registerStringLatin1Plugins(invocationPlugins, replacementsBytecodeProvider);
- registerStringUTF16Plugins(invocationPlugins, replacementsBytecodeProvider);
+ if (emitJDK9StringSubstitutions) {
+ registerStringLatin1Plugins(invocationPlugins, replacementsBytecodeProvider);
+ registerStringUTF16Plugins(invocationPlugins, replacementsBytecodeProvider);
+ }
registerMathPlugins(invocationPlugins, arch, replacementsBytecodeProvider);
registerArraysEqualsPlugins(invocationPlugins, replacementsBytecodeProvider);
}
@@ -215,30 +216,26 @@
}
private static void registerStringLatin1Plugins(InvocationPlugins plugins, BytecodeProvider replacementsBytecodeProvider) {
- if (JAVA_SPECIFICATION_VERSION >= 9) {
- Registration r = new Registration(plugins, "java.lang.StringLatin1", replacementsBytecodeProvider);
- r.setAllowOverwrite(true);
- r.registerMethodSubstitution(AMD64StringLatin1Substitutions.class, "compareTo", byte[].class, byte[].class);
- r.registerMethodSubstitution(AMD64StringLatin1Substitutions.class, "compareToUTF16", byte[].class, byte[].class);
- r.registerMethodSubstitution(AMD64StringLatin1Substitutions.class, "inflate", byte[].class, int.class, char[].class, int.class, int.class);
- r.registerMethodSubstitution(AMD64StringLatin1Substitutions.class, "inflate", byte[].class, int.class, byte[].class, int.class, int.class);
- r.registerMethodSubstitution(AMD64StringLatin1Substitutions.class, "indexOf", byte[].class, int.class, int.class);
- r.registerMethodSubstitution(AMD64StringLatin1Substitutions.class, "indexOf", byte[].class, int.class, byte[].class, int.class, int.class);
- }
+ Registration r = new Registration(plugins, "java.lang.StringLatin1", replacementsBytecodeProvider);
+ r.setAllowOverwrite(true);
+ r.registerMethodSubstitution(AMD64StringLatin1Substitutions.class, "compareTo", byte[].class, byte[].class);
+ r.registerMethodSubstitution(AMD64StringLatin1Substitutions.class, "compareToUTF16", byte[].class, byte[].class);
+ r.registerMethodSubstitution(AMD64StringLatin1Substitutions.class, "inflate", byte[].class, int.class, char[].class, int.class, int.class);
+ r.registerMethodSubstitution(AMD64StringLatin1Substitutions.class, "inflate", byte[].class, int.class, byte[].class, int.class, int.class);
+ r.registerMethodSubstitution(AMD64StringLatin1Substitutions.class, "indexOf", byte[].class, int.class, int.class);
+ r.registerMethodSubstitution(AMD64StringLatin1Substitutions.class, "indexOf", byte[].class, int.class, byte[].class, int.class, int.class);
}
private static void registerStringUTF16Plugins(InvocationPlugins plugins, BytecodeProvider replacementsBytecodeProvider) {
- if (JAVA_SPECIFICATION_VERSION >= 9) {
- Registration r = new Registration(plugins, "java.lang.StringUTF16", replacementsBytecodeProvider);
- r.setAllowOverwrite(true);
- r.registerMethodSubstitution(AMD64StringUTF16Substitutions.class, "compareTo", byte[].class, byte[].class);
- r.registerMethodSubstitution(AMD64StringUTF16Substitutions.class, "compareToLatin1", byte[].class, byte[].class);
- r.registerMethodSubstitution(AMD64StringUTF16Substitutions.class, "compress", char[].class, int.class, byte[].class, int.class, int.class);
- r.registerMethodSubstitution(AMD64StringUTF16Substitutions.class, "compress", byte[].class, int.class, byte[].class, int.class, int.class);
- r.registerMethodSubstitution(AMD64StringUTF16Substitutions.class, "indexOfCharUnsafe", byte[].class, int.class, int.class, int.class);
- r.registerMethodSubstitution(AMD64StringUTF16Substitutions.class, "indexOfUnsafe", byte[].class, int.class, byte[].class, int.class, int.class);
- r.registerMethodSubstitution(AMD64StringUTF16Substitutions.class, "indexOfLatin1Unsafe", byte[].class, int.class, byte[].class, int.class, int.class);
- }
+ Registration r = new Registration(plugins, "java.lang.StringUTF16", replacementsBytecodeProvider);
+ r.setAllowOverwrite(true);
+ r.registerMethodSubstitution(AMD64StringUTF16Substitutions.class, "compareTo", byte[].class, byte[].class);
+ r.registerMethodSubstitution(AMD64StringUTF16Substitutions.class, "compareToLatin1", byte[].class, byte[].class);
+ r.registerMethodSubstitution(AMD64StringUTF16Substitutions.class, "compress", char[].class, int.class, byte[].class, int.class, int.class);
+ r.registerMethodSubstitution(AMD64StringUTF16Substitutions.class, "compress", byte[].class, int.class, byte[].class, int.class, int.class);
+ r.registerMethodSubstitution(AMD64StringUTF16Substitutions.class, "indexOfCharUnsafe", byte[].class, int.class, int.class, int.class);
+ r.registerMethodSubstitution(AMD64StringUTF16Substitutions.class, "indexOfUnsafe", byte[].class, int.class, byte[].class, int.class, int.class);
+ r.registerMethodSubstitution(AMD64StringUTF16Substitutions.class, "indexOfLatin1Unsafe", byte[].class, int.class, byte[].class, int.class, int.class);
}
private static void registerUnsafePlugins(InvocationPlugins plugins, BytecodeProvider replacementsBytecodeProvider, boolean explicitUnsafeNullChecks) {
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/nodes/ArrayEqualsNode.java Thu Mar 21 21:37:09 2019 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/nodes/ArrayEqualsNode.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, 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
@@ -26,11 +26,14 @@
import static org.graalvm.compiler.nodeinfo.InputType.Memory;
+import org.graalvm.compiler.api.replacements.Snippet;
+import org.graalvm.compiler.core.common.spi.ForeignCallLinkage;
import org.graalvm.compiler.core.common.type.StampFactory;
import org.graalvm.compiler.graph.Node;
import org.graalvm.compiler.graph.NodeClass;
import org.graalvm.compiler.graph.spi.Canonicalizable;
import org.graalvm.compiler.graph.spi.CanonicalizerTool;
+import org.graalvm.compiler.lir.gen.LIRGeneratorTool;
import org.graalvm.compiler.nodeinfo.NodeCycles;
import org.graalvm.compiler.nodeinfo.NodeInfo;
import org.graalvm.compiler.nodeinfo.NodeSize;
@@ -48,11 +51,14 @@
import org.graalvm.compiler.nodes.spi.VirtualizerTool;
import org.graalvm.compiler.nodes.util.GraphUtil;
import org.graalvm.compiler.nodes.virtual.VirtualObjectNode;
+import org.graalvm.compiler.options.Option;
+import org.graalvm.compiler.options.OptionKey;
import jdk.internal.vm.compiler.word.LocationIdentity;
import jdk.vm.ci.meta.ConstantReflectionProvider;
import jdk.vm.ci.meta.JavaConstant;
import jdk.vm.ci.meta.JavaKind;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
import jdk.vm.ci.meta.Value;
// JaCoCo Exclude
@@ -63,6 +69,13 @@
@NodeInfo(cycles = NodeCycles.CYCLES_UNKNOWN, size = NodeSize.SIZE_128)
public final class ArrayEqualsNode extends FixedWithNextNode implements LIRLowerable, Canonicalizable, Virtualizable, MemoryAccess {
+ public static class Options {
+ // @formatter:off
+ @Option(help = "Use Array equals stubs instead of embedding all the emitted code.")
+ public static final OptionKey<Boolean> ArrayEqualsStubs = new OptionKey<>(true);
+ // @formatter:on
+ }
+
public static final NodeClass<ArrayEqualsNode> TYPE = NodeClass.create(ArrayEqualsNode.class);
/** {@link JavaKind} of the arrays to compare. */
protected final JavaKind kind;
@@ -178,7 +191,7 @@
}
@NodeIntrinsic
- static native boolean equals(Object array1, Object array2, int length, @ConstantNodeParameter JavaKind kind);
+ public static native boolean equals(Object array1, Object array2, int length, @ConstantNodeParameter JavaKind kind);
public static boolean equals(boolean[] array1, boolean[] array2, int length) {
return equals(array1, array2, length, JavaKind.Boolean);
@@ -214,11 +227,25 @@
@Override
public void generate(NodeLIRBuilderTool gen) {
+ LIRGeneratorTool tool = gen.getLIRGeneratorTool();
int constantLength = -1;
if (length.isConstant()) {
constantLength = length.asJavaConstant().asInt();
}
- Value result = gen.getLIRGeneratorTool().emitArrayEquals(kind, gen.operand(array1), gen.operand(array2), gen.operand(length), constantLength, false);
+
+ if (Options.ArrayEqualsStubs.getValue(graph().getOptions())) {
+ ResolvedJavaMethod method = graph().method();
+ if (method != null && method.getAnnotation(Snippet.class) == null) {
+ ForeignCallLinkage linkage = tool.lookupArrayEqualsStub(kind, constantLength);
+ if (linkage != null) {
+ Value result = tool.emitForeignCall(linkage, null, gen.operand(array1), gen.operand(array2), gen.operand(length));
+ gen.setResult(this, result);
+ return;
+ }
+ }
+ }
+
+ Value result = tool.emitArrayEquals(kind, gen.operand(array1), gen.operand(array2), gen.operand(length), constantLength, false);
gen.setResult(this, result);
}
--- a/src/utils/hsdis/Makefile Thu Mar 21 21:37:09 2019 -0700
+++ b/src/utils/hsdis/Makefile Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# The Universal Permissive License (UPL), Version 1.0
@@ -201,6 +201,10 @@
$(TARGET_DIR)/opcodes/libopcodes.a \
$(TARGET_DIR)/libiberty/libiberty.a
+ifneq ($(MINGW),)
+LIBRARIES += $(TARGET_DIR)/zlib/libz.a
+endif
+
DEMO_TARGET = $(TARGET_DIR)/hsdis-demo
DEMO_SOURCE = hsdis-demo.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/gc/shenandoah/compiler/TestUnsafeOffheapSwap.java Fri Mar 22 14:39:16 2019 +0530
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2019, Red Hat, Inc. 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * 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, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test TestUnsafeOffheapSwap
+ * @summary Miscompilation in Unsafe off-heap swap routines
+ * @key gc
+ * @requires vm.gc.Shenandoah
+ * @modules java.base/jdk.internal.misc:+open
+ *
+ * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:-TieredCompilation
+ * -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC
+ * TestUnsafeOffheapSwap
+ */
+
+import java.util.*;
+import jdk.internal.misc.Unsafe;
+
+public class TestUnsafeOffheapSwap {
+
+ static final int SIZE = 10000;
+ static final long SEED = 1;
+
+ static final jdk.internal.misc.Unsafe UNSAFE = Unsafe.getUnsafe();
+ static final int SCALE = UNSAFE.ARRAY_INT_INDEX_SCALE;
+
+ static Memory mem;
+ static int[] arr;
+
+ public static void main(String[] args) throws Exception {
+ // Bug is exposed when memory.addr is not known statically
+ mem = new Memory(SIZE*SCALE);
+ arr = new int[SIZE];
+
+ for (int i = 0; i < 10; i++) {
+ test();
+ }
+ }
+
+ static void test() {
+ Random rnd = new Random(SEED);
+ for (int i = 0; i < SIZE; i++) {
+ int value = rnd.nextInt();
+ mem.setInt(i, value);
+ arr[i] = value;
+ }
+
+ for (int i = 0; i < SIZE; i++) {
+ if (arr[i] != mem.getInt(i)) {
+ throw new IllegalStateException("TESTBUG: Values mismatch before swaps");
+ }
+ }
+
+ for (int i = 1; i < SIZE; i++) {
+ mem.swap(i - 1, i);
+ int tmp = arr[i - 1];
+ arr[i - 1] = arr[i];
+ arr[i] = tmp;
+ }
+
+ for (int i = 0; i < SIZE; i++) {
+ if (arr[i] != mem.getInt(i)) {
+ throw new IllegalStateException("Values mismatch after swaps");
+ }
+ }
+ }
+
+ static class Memory {
+ private final long addr;
+
+ Memory(int size) {
+ addr = UNSAFE.allocateMemory(size);
+ }
+
+ public int getInt(int idx) {
+ return UNSAFE.getInt(addr + idx*SCALE);
+ }
+
+ public void setInt(int idx, int val) {
+ UNSAFE.putInt(addr + idx*SCALE, val);
+ }
+
+ public void swap(int a, int b) {
+ int tmp = getInt(a);
+ setInt(a, getInt(b));
+ setInt(b, tmp);
+ }
+ }
+}
--- a/test/hotspot/jtreg/runtime/CommandLine/VMDeprecatedOptions.java Thu Mar 21 21:37:09 2019 -0700
+++ b/test/hotspot/jtreg/runtime/CommandLine/VMDeprecatedOptions.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, 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
@@ -46,6 +46,7 @@
{"InitialRAMFraction", "64"},
{"TLABStats", "false"},
{"ThreadLocalHandshakes", "true"},
+ {"AllowJNIEnvProxy", "true"},
// deprecated alias flags (see also aliased_jvm_flags):
{"DefaultMaxRAMFraction", "4"},
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove/remove004/TestDescription.java Thu Mar 21 21:37:09 2019 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove/remove004/TestDescription.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, 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
@@ -73,6 +73,6 @@
* -waittime=5
* -debugee.vmkind=java
* -transport.address=dynamic
- * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}"
+ * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts} -Dtest.timeout.factor=${test.timeout.factor}"
*/
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l004/TestDescription.java Thu Mar 21 21:37:09 2019 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l004/TestDescription.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, 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
@@ -74,6 +74,6 @@
* -waittime=5
* -debugee.vmkind=java
* -transport.address=dynamic
- * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}"
+ * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts} -Dtest.timeout.factor=${test.timeout.factor}"
*/
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Breakpoint/breakpoint001/breakpoint001.cpp Thu Mar 21 21:37:09 2019 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Breakpoint/breakpoint001/breakpoint001.cpp Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, 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
@@ -52,7 +52,7 @@
static jvmtiEnv *jvmti = NULL;
static jvmtiEventCallbacks callbacks;
-static int vm_started = 0;
+static volatile int callbacksEnabled = NSK_TRUE;
static jrawMonitorID agent_lock;
static void initCounters() {
@@ -82,7 +82,7 @@
jvmti->RawMonitorEnter(agent_lock);
- if (vm_started) {
+ if (callbacksEnabled) {
// GetClassSignature may be called only during the start or the live phase
if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &sig, &generic)))
env->FatalError("failed to obtain a class signature\n");
@@ -196,11 +196,20 @@
VMStart(jvmtiEnv *jvmti_env, JNIEnv* jni_env) {
jvmti->RawMonitorEnter(agent_lock);
- vm_started = 1;
+ callbacksEnabled = NSK_TRUE;
jvmti->RawMonitorExit(agent_lock);
}
+
+void JNICALL
+VMDeath(jvmtiEnv *jvmti_env, JNIEnv* jni_env) {
+ jvmti->RawMonitorEnter(agent_lock);
+
+ callbacksEnabled = NSK_FALSE;
+
+ jvmti->RawMonitorExit(agent_lock);
+}
/************************/
JNIEXPORT jint JNICALL
@@ -268,6 +277,8 @@
callbacks.ClassLoad = &ClassLoad;
callbacks.Breakpoint = &Breakpoint;
callbacks.VMStart = &VMStart;
+ callbacks.VMDeath = &VMDeath;
+
if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
@@ -275,6 +286,8 @@
if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, NULL)))
return JNI_ERR;
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL)))
+ return JNI_ERR;
if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, NULL)))
return JNI_ERR;
if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL)))
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/FramePop/framepop002/framepop002.cpp Thu Mar 21 21:37:09 2019 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/FramePop/framepop002/framepop002.cpp Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, 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
@@ -62,6 +62,9 @@
static int max_depth = 0;
static thr threads[MAX_THREADS];
+static volatile int callbacksEnabled = NSK_FALSE;
+static jrawMonitorID agent_lock;
+
static
int isTestThread(jvmtiEnv *jvmti_env, jthread thr) {
jvmtiError err;
@@ -211,12 +214,20 @@
if (watch_events == JNI_FALSE) return;
+ jvmti->RawMonitorEnter(agent_lock);
+
+ if (!callbacksEnabled) {
+ jvmti->RawMonitorExit(agent_lock);
+ return;
+ }
+
err = jvmti_env->GetFrameCount(thr, &frameCount);
if (err != JVMTI_ERROR_NONE) {
printf("(GetFrameCount#entry) unexpected error: %s (%d)\n",
TranslateError(err), err);
printInfo(jvmti_env, thr, method, frameCount);
result = STATUS_FAILED;
+ jvmti->RawMonitorExit(agent_lock);
return;
}
@@ -259,6 +270,25 @@
}
}
}
+
+ jvmti->RawMonitorExit(agent_lock);
+}
+
+void JNICALL VMStart(jvmtiEnv *jvmti_env, JNIEnv* jni_env) {
+ jvmti->RawMonitorEnter(agent_lock);
+
+ callbacksEnabled = NSK_TRUE;
+
+ jvmti->RawMonitorExit(agent_lock);
+}
+
+
+void JNICALL VMDeath(jvmtiEnv *jvmti_env, JNIEnv* jni_env) {
+ jvmti->RawMonitorEnter(agent_lock);
+
+ callbacksEnabled = NSK_FALSE;
+
+ jvmti->RawMonitorExit(agent_lock);
}
void JNICALL FramePop(jvmtiEnv *jvmti_env, JNIEnv *env,
@@ -266,12 +296,19 @@
jvmtiError err;
jint frameCount;
+ jvmti->RawMonitorEnter(agent_lock);
+
+ if (!callbacksEnabled) {
+ jvmti->RawMonitorExit(agent_lock);
+ return;
+ }
err = jvmti_env->GetFrameCount(thr, &frameCount);
if (err != JVMTI_ERROR_NONE) {
printf("(GetFrameCount#entry) unexpected error: %s (%d)\n",
TranslateError(err), err);
printInfo(jvmti_env, thr, method, frameCount);
result = STATUS_FAILED;
+ jvmti->RawMonitorExit(agent_lock);
return;
}
@@ -296,6 +333,8 @@
result = STATUS_FAILED;
}
}
+
+ jvmti->RawMonitorExit(agent_lock);
}
#ifdef STATIC_BUILD
@@ -355,12 +394,24 @@
caps.can_generate_method_entry_events) {
callbacks.MethodEntry = &MethodEntry;
callbacks.FramePop = &FramePop;
+ callbacks.VMStart = &VMStart;
+ callbacks.VMDeath = &VMDeath;
+
err = jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks));
if (err != JVMTI_ERROR_NONE) {
printf("(SetEventCallbacks) unexpected error: %s (%d)\n",
TranslateError(err), err);
return JNI_ERR;
}
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, NULL)))
+ return JNI_ERR;
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL)))
+ return JNI_ERR;
+
+ if (jvmti->CreateRawMonitor("agent_lock", &agent_lock) != JVMTI_ERROR_NONE) {
+ return JNI_ERR;
+ }
+
} else {
printf("Warning: FramePop or MethodEntry event is not implemented\n");
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SingleStep/singlestep003/singlestep003.cpp Thu Mar 21 21:37:09 2019 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SingleStep/singlestep003/singlestep003.cpp Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, 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
@@ -61,6 +61,9 @@
static jvmtiEnv *jvmti = NULL;
static jvmtiEventCallbacks callbacks;
+static volatile int callbacksEnabled = NSK_FALSE;
+static jrawMonitorID agent_lock;
+
static void setBP(jvmtiEnv *jvmti_env, JNIEnv *env, jclass klass) {
jmethodID mid;
@@ -76,6 +79,13 @@
ClassLoad(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thread, jclass klass) {
char *sig, *generic;
+ jvmti->RawMonitorEnter(agent_lock);
+
+ if (!callbacksEnabled) {
+ jvmti->RawMonitorExit(agent_lock);
+ return;
+ }
+
if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &sig, &generic)))
env->FatalError("failed to obtain a class signature\n");
@@ -86,6 +96,27 @@
sig);
setBP(jvmti_env, env, klass);
}
+
+ jvmti->RawMonitorExit(agent_lock);
+}
+
+void JNICALL
+VMStart(jvmtiEnv *jvmti_env, JNIEnv* jni_env) {
+ jvmti->RawMonitorEnter(agent_lock);
+
+ callbacksEnabled = NSK_TRUE;
+
+ jvmti->RawMonitorExit(agent_lock);
+}
+
+
+void JNICALL
+VMDeath(jvmtiEnv *jvmti_env, JNIEnv* jni_env) {
+ jvmti->RawMonitorEnter(agent_lock);
+
+ callbacksEnabled = NSK_FALSE;
+
+ jvmti->RawMonitorExit(agent_lock);
}
void JNICALL
@@ -94,6 +125,13 @@
jclass klass;
char *sig, *generic;
+ jvmti->RawMonitorEnter(agent_lock);
+
+ if (!callbacksEnabled) {
+ jvmti->RawMonitorExit(agent_lock);
+ return;
+ }
+
NSK_DISPLAY0("Breakpoint event received\n");
if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodDeclaringClass(method, &klass)))
NSK_COMPLAIN0("TEST FAILURE: unable to get method declaring class\n\n");
@@ -113,6 +151,8 @@
NSK_COMPLAIN1("TEST FAILURE: unexpected breakpoint event in method of class \"%s\"\n\n",
sig);
}
+
+ jvmti->RawMonitorExit(agent_lock);
}
void JNICALL
@@ -276,16 +316,27 @@
callbacks.ClassLoad = &ClassLoad;
callbacks.Breakpoint = &Breakpoint;
callbacks.SingleStep = &SingleStep;
+ callbacks.VMStart = &VMStart;
+ callbacks.VMDeath = &VMDeath;
+
if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n");
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, NULL)))
+ return JNI_ERR;
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL)))
+ return JNI_ERR;
if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, NULL)))
return JNI_ERR;
if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL)))
return JNI_ERR;
NSK_DISPLAY0("enabling the events done\n\n");
+ if (jvmti->CreateRawMonitor("agent_lock", &agent_lock) != JVMTI_ERROR_NONE) {
+ return JNI_ERR;
+ }
+
return JNI_OK;
}
--- a/test/jdk/ProblemList.txt Thu Mar 21 21:37:09 2019 -0700
+++ b/test/jdk/ProblemList.txt Fri Mar 22 14:39:16 2019 +0530
@@ -684,6 +684,7 @@
sun/security/pkcs11/tls/TestMasterSecret.java 8204203 windows-all
sun/security/pkcs11/tls/TestPRF.java 8204203 windows-all
sun/security/pkcs11/tls/TestPremaster.java 8204203 windows-all
+sun/security/pkcs11/tls/tls12/TestTLS12.java 8221271 windows-all
sun/security/tools/keytool/NssTest.java 8204203 windows-all
############################################################################
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/net/Socket/AsyncShutdown.java Fri Mar 22 14:39:16 2019 +0530
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2019, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * 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, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @requires (os.family == "linux" | os.family == "mac")
+ * @run testng AsyncShutdown
+ * @summary Test shutdownInput/shutdownOutput with threads blocked in read/write
+ */
+
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.net.SocketTimeoutException;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+
+import org.testng.annotations.Test;
+import static org.testng.Assert.*;
+
+@Test
+public class AsyncShutdown {
+
+ public void testShutdownInput1() throws IOException {
+ withConnection((s1, s2) -> {
+ scheduleShutdownInput(s1, 2000);
+ int n = s1.getInputStream().read();
+ assertTrue(n == -1);
+ });
+ }
+
+ public void testShutdownInput2() throws IOException {
+ withConnection((s1, s2) -> {
+ scheduleShutdownInput(s1, 2000);
+ s1.setSoTimeout(30*1000);
+ int n = s1.getInputStream().read();
+ assertTrue(n == -1);
+ });
+ }
+
+ public void testShutdownOutput1() throws IOException {
+ withConnection((s1, s2) -> {
+ scheduleShutdownOutput(s1, 2000);
+ byte[] data = new byte[128*1024];
+ try {
+ while (true) {
+ s1.getOutputStream().write(data);
+ }
+ } catch (IOException expected) { }
+ });
+ }
+
+ public void testShutdownOutput2() throws IOException {
+ withConnection((s1, s2) -> {
+ s1.setSoTimeout(100);
+ try {
+ s1.getInputStream().read();
+ assertTrue(false);
+ } catch (SocketTimeoutException e) { }
+
+ scheduleShutdownOutput(s1, 2000);
+ byte[] data = new byte[128*1024];
+ try {
+ while (true) {
+ s1.getOutputStream().write(data);
+ }
+ } catch (IOException expected) { }
+ });
+ }
+
+ static void scheduleShutdownInput(Socket s, long delay) {
+ schedule(() -> {
+ try {
+ s.shutdownInput();
+ } catch (IOException ioe) { }
+ }, delay);
+ }
+
+ static void scheduleShutdownOutput(Socket s, long delay) {
+ schedule(() -> {
+ try {
+ s.shutdownOutput();
+ } catch (IOException ioe) { }
+ }, delay);
+ }
+
+ static void schedule(Runnable task, long delay) {
+ ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
+ try {
+ executor.schedule(task, delay, TimeUnit.MILLISECONDS);
+ } finally {
+ executor.shutdown();
+ }
+ }
+
+ interface ThrowingBiConsumer<T, U> {
+ void accept(T t, U u) throws IOException;
+ }
+
+ static void withConnection(ThrowingBiConsumer<Socket, Socket> consumer)
+ throws IOException
+ {
+ Socket s1 = null;
+ Socket s2 = null;
+ try (ServerSocket ss = new ServerSocket(0)) {
+ s1 = new Socket();
+ s1.connect(ss.getLocalSocketAddress());
+ s2 = ss.accept();
+ consumer.accept(s1, s2);
+ } finally {
+ if (s1 != null) s1.close();
+ if (s2 != null) s2.close();
+ }
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/net/Socket/ConnectionReset.java Fri Mar 22 14:39:16 2019 +0530
@@ -0,0 +1,218 @@
+/*
+ * Copyright (c) 2019, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * 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, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @requires os.family != "solaris"
+ * @run testng ConnectionReset
+ * @summary Test behavior of read and available when a connection is reset
+ */
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.ServerSocket;
+import java.net.Socket;
+
+import org.testng.annotations.Test;
+import static org.testng.Assert.*;
+
+@Test
+public class ConnectionReset {
+
+ static final int REPEAT_COUNT = 5;
+
+ /**
+ * Tests available before read when there are no bytes to read
+ */
+ public void testAvailableBeforeRead1() throws IOException {
+ System.out.println("testAvailableBeforeRead1");
+ withResetConnection(null, s -> {
+ InputStream in = s.getInputStream();
+ for (int i=0; i<REPEAT_COUNT; i++) {
+ int bytesAvailable = in.available();
+ System.out.format("available => %d%n", bytesAvailable);
+ assertTrue(bytesAvailable == 0);
+ try {
+ int bytesRead = in.read();
+ if (bytesRead == -1) {
+ System.out.println("read => EOF");
+ } else {
+ System.out.println("read => 1 byte");
+ }
+ assertTrue(false);
+ } catch (IOException ioe) {
+ System.out.format("read => %s (expected)%n", ioe);
+ }
+ }
+ });
+ }
+
+ /**
+ * Tests available before read when there are bytes to read
+ */
+ public void testAvailableBeforeRead2() throws IOException {
+ System.out.println("testAvailableBeforeRead2");
+ byte[] data = { 1, 2, 3 };
+ withResetConnection(data, s -> {
+ InputStream in = s.getInputStream();
+ int remaining = data.length;
+ for (int i=0; i<REPEAT_COUNT; i++) {
+ int bytesAvailable = in.available();
+ System.out.format("available => %d%n", bytesAvailable);
+ assertTrue(bytesAvailable <= remaining);
+ try {
+ int bytesRead = in.read();
+ if (bytesRead == -1) {
+ System.out.println("read => EOF");
+ assertTrue(false);
+ } else {
+ System.out.println("read => 1 byte");
+ assertTrue(remaining > 0);
+ remaining--;
+ }
+ } catch (IOException ioe) {
+ System.out.format("read => %s%n", ioe);
+ remaining = 0;
+ }
+ }
+ });
+ }
+
+ /**
+ * Tests read before available when there are no bytes to read
+ */
+ public void testReadBeforeAvailable1() throws IOException {
+ System.out.println("testReadBeforeAvailable1");
+ withResetConnection(null, s -> {
+ InputStream in = s.getInputStream();
+ for (int i=0; i<REPEAT_COUNT; i++) {
+ try {
+ int bytesRead = in.read();
+ if (bytesRead == -1) {
+ System.out.println("read => EOF");
+ } else {
+ System.out.println("read => 1 byte");
+ }
+ assertTrue(false);
+ } catch (IOException ioe) {
+ System.out.format("read => %s (expected)%n", ioe);
+ }
+ int bytesAvailable = in.available();
+ System.out.format("available => %d%n", bytesAvailable);
+ assertTrue(bytesAvailable == 0);
+ }
+ });
+ }
+
+ /**
+ * Tests read before available when there are bytes to read
+ */
+ public void testReadBeforeAvailable2() throws IOException {
+ System.out.println("testReadBeforeAvailable2");
+ byte[] data = { 1, 2, 3 };
+ withResetConnection(data, s -> {
+ InputStream in = s.getInputStream();
+ int remaining = data.length;
+ for (int i=0; i<REPEAT_COUNT; i++) {
+ try {
+ int bytesRead = in.read();
+ if (bytesRead == -1) {
+ System.out.println("read => EOF");
+ assertTrue(false);
+ } else {
+ System.out.println("read => 1 byte");
+ assertTrue(remaining > 0);
+ remaining--;
+ }
+ } catch (IOException ioe) {
+ System.out.format("read => %s%n", ioe);
+ remaining = 0;
+ }
+ int bytesAvailable = in.available();
+ System.out.format("available => %d%n", bytesAvailable);
+ assertTrue(bytesAvailable <= remaining);
+ }
+ });
+ }
+
+ /**
+ * Tests available and read on a socket closed after connection reset
+ */
+ public void testAfterClose() throws IOException {
+ System.out.println("testAfterClose");
+ withResetConnection(null, s -> {
+ InputStream in = s.getInputStream();
+ try {
+ in.read();
+ assertTrue(false);
+ } catch (IOException ioe) {
+ // expected
+ }
+ s.close();
+ try {
+ int bytesAvailable = in.available();
+ System.out.format("available => %d%n", bytesAvailable);
+ assertTrue(false);
+ } catch (IOException ioe) {
+ System.out.format("available => %s (expected)%n", ioe);
+ }
+ try {
+ int n = in.read();
+ System.out.format("read => %d%n", n);
+ assertTrue(false);
+ } catch (IOException ioe) {
+ System.out.format("read => %s (expected)%n", ioe);
+ }
+ });
+ }
+
+ interface ThrowingConsumer<T> {
+ void accept(T t) throws IOException;
+ }
+
+ /**
+ * Invokes a consumer with a Socket connected to a peer that has closed the
+ * connection with a "connection reset". The peer sends the given data bytes
+ * before closing (when data is not null).
+ */
+ static void withResetConnection(byte[] data, ThrowingConsumer<Socket> consumer)
+ throws IOException
+ {
+ var loopback = InetAddress.getLoopbackAddress();
+ try (var listener = new ServerSocket()) {
+ listener.bind(new InetSocketAddress(loopback, 0));
+ try (var socket = new Socket()) {
+ socket.connect(listener.getLocalSocketAddress());
+ try (Socket peer = listener.accept()) {
+ if (data != null) {
+ peer.getOutputStream().write(data);
+ }
+ peer.setSoLinger(true, 0);
+ }
+ consumer.accept(socket);
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/net/Socket/Timeouts.java Fri Mar 22 14:39:16 2019 +0530
@@ -0,0 +1,497 @@
+/*
+ * Copyright (c) 2019, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * 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, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @library /test/lib
+ * @build jdk.test.lib.Utils
+ * @run testng Timeouts
+ * @summary Test Socket timeouts
+ */
+
+import java.io.Closeable;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.ConnectException;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.net.SocketAddress;
+import java.net.SocketException;
+import java.net.SocketTimeoutException;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+
+import org.testng.annotations.Test;
+import static org.testng.Assert.*;
+import jdk.test.lib.Utils;
+
+@Test
+public class Timeouts {
+
+ /**
+ * Test timed connect where connection is established
+ */
+ public void testTimedConnect1() throws IOException {
+ try (ServerSocket ss = new ServerSocket(0)) {
+ try (Socket s = new Socket()) {
+ s.connect(ss.getLocalSocketAddress(), 2000);
+ }
+ }
+ }
+
+ /**
+ * Test timed connect where connection is refused
+ */
+ public void testTimedConnect2() throws IOException {
+ try (Socket s = new Socket()) {
+ SocketAddress remote = Utils.refusingEndpoint();
+ try {
+ s.connect(remote, 2000);
+ } catch (ConnectException expected) { }
+ }
+ }
+
+ /**
+ * Test connect with a timeout of Integer.MAX_VALUE
+ */
+ public void testTimedConnect3() throws IOException {
+ try (ServerSocket ss = new ServerSocket(0)) {
+ try (Socket s = new Socket()) {
+ s.connect(ss.getLocalSocketAddress(), Integer.MAX_VALUE);
+ }
+ }
+ }
+
+ /**
+ * Test connect with a negative timeout. This case is not currently specified
+ * but the long standing behavior is to throw IllegalArgumentException.
+ */
+ public void testTimedConnect4() throws IOException {
+ try (ServerSocket ss = new ServerSocket(0)) {
+ try (Socket s = new Socket()) {
+ try {
+ s.connect(ss.getLocalSocketAddress(), -1);
+ assertTrue(false);
+ } catch (IllegalArgumentException expected) { }
+ }
+ }
+ }
+
+ /**
+ * Test timed read where the read succeeds immediately
+ */
+ public void testTimedRead1() throws IOException {
+ withConnection((s1, s2) -> {
+ s1.getOutputStream().write(99);
+ s2.setSoTimeout(30*1000);
+ int b = s2.getInputStream().read();
+ assertTrue(b == 99);
+ });
+ }
+
+ /**
+ * Test timed read where the read succeeds after a delay
+ */
+ public void testTimedRead2() throws IOException {
+ withConnection((s1, s2) -> {
+ scheduleWrite(s1.getOutputStream(), 99, 2000);
+ s2.setSoTimeout(30*1000);
+ int b = s2.getInputStream().read();
+ assertTrue(b == 99);
+ });
+ }
+
+ /**
+ * Test timed read where the read times out
+ */
+ public void testTimedRead3() throws IOException {
+ withConnection((s1, s2) -> {
+ s2.setSoTimeout(2000);
+ try {
+ s2.getInputStream().read();
+ assertTrue(false);
+ } catch (SocketTimeoutException expected) { }
+ });
+ }
+
+ /**
+ * Test timed read that succeeds after a previous read has timed out
+ */
+ public void testTimedRead4() throws IOException {
+ withConnection((s1, s2) -> {
+ s2.setSoTimeout(2000);
+ try {
+ s2.getInputStream().read();
+ assertTrue(false);
+ } catch (SocketTimeoutException e) { }
+ s1.getOutputStream().write(99);
+ int b = s2.getInputStream().read();
+ assertTrue(b == 99);
+ });
+ }
+
+ /**
+ * Test timed read that succeeds after a previous read has timed out and
+ * after a short delay
+ */
+ public void testTimedRead5() throws IOException {
+ withConnection((s1, s2) -> {
+ s2.setSoTimeout(2000);
+ try {
+ s2.getInputStream().read();
+ assertTrue(false);
+ } catch (SocketTimeoutException e) { }
+ s2.setSoTimeout(30*3000);
+ scheduleWrite(s1.getOutputStream(), 99, 2000);
+ int b = s2.getInputStream().read();
+ assertTrue(b == 99);
+ });
+ }
+
+ /**
+ * Test untimed read that succeeds after a previous read has timed out
+ */
+ public void testTimedRead6() throws IOException {
+ withConnection((s1, s2) -> {
+ s2.setSoTimeout(2000);
+ try {
+ s2.getInputStream().read();
+ assertTrue(false);
+ } catch (SocketTimeoutException e) { }
+ s1.getOutputStream().write(99);
+ s2.setSoTimeout(0);
+ int b = s2.getInputStream().read();
+ assertTrue(b == 99);
+ });
+ }
+
+ /**
+ * Test untimed read that succeeds after a previous read has timed out and
+ * after a short delay
+ */
+ public void testTimedRead7() throws IOException {
+ withConnection((s1, s2) -> {
+ s2.setSoTimeout(2000);
+ try {
+ s2.getInputStream().read();
+ assertTrue(false);
+ } catch (SocketTimeoutException e) { }
+ scheduleWrite(s1.getOutputStream(), 99, 2000);
+ s2.setSoTimeout(0);
+ int b = s2.getInputStream().read();
+ assertTrue(b == 99);
+ });
+ }
+
+ /**
+ * Test async close of timed read
+ */
+ public void testTimedRead8() throws IOException {
+ withConnection((s1, s2) -> {
+ s2.setSoTimeout(30*1000);
+ scheduleClose(s2, 2000);
+ try {
+ s2.getInputStream().read();
+ assertTrue(false);
+ } catch (SocketException expected) { }
+ });
+ }
+
+ /**
+ * Test read with a timeout of Integer.MAX_VALUE
+ */
+ public void testTimedRead9() throws IOException {
+ withConnection((s1, s2) -> {
+ scheduleWrite(s1.getOutputStream(), 99, 2000);
+ s2.setSoTimeout(Integer.MAX_VALUE);
+ int b = s2.getInputStream().read();
+ assertTrue(b == 99);
+ });
+ }
+
+ /**
+ * Test writing after a timed read.
+ */
+ public void testTimedWrite1() throws IOException {
+ withConnection((s1, s2) -> {
+ s1.getOutputStream().write(99);
+ s2.setSoTimeout(3000);
+ int b = s2.getInputStream().read();
+ assertTrue(b == 99);
+
+ // schedule thread to read s1 to EOF
+ scheduleReadToEOF(s1.getInputStream(), 3000);
+
+ // write a lot so that write blocks
+ byte[] data = new byte[128*1024];
+ for (int i = 0; i < 100; i++) {
+ s2.getOutputStream().write(data);
+ }
+ });
+ }
+
+ /**
+ * Test async close of writer (after a timed read).
+ */
+ public void testTimedWrite2() throws IOException {
+ withConnection((s1, s2) -> {
+ s1.getOutputStream().write(99);
+ s2.setSoTimeout(3000);
+ int b = s2.getInputStream().read();
+ assertTrue(b == 99);
+
+ // schedule s2 to be be closed
+ scheduleClose(s2, 3000);
+
+ // write a lot so that write blocks
+ byte[] data = new byte[128*1024];
+ try {
+ while (true) {
+ s2.getOutputStream().write(data);
+ }
+ } catch (SocketException expected) { }
+ });
+ }
+
+ /**
+ * Test timed accept where a connection is established immediately
+ */
+ public void testTimedAccept1() throws IOException {
+ Socket s1 = null;
+ Socket s2 = null;
+ try (ServerSocket ss = new ServerSocket(0)) {
+ s1 = new Socket();
+ s1.connect(ss.getLocalSocketAddress());
+ ss.setSoTimeout(30*1000);
+ s2 = ss.accept();
+ } finally {
+ if (s1 != null) s1.close();
+ if (s2 != null) s2.close();
+ }
+ }
+
+ /**
+ * Test timed accept where a connection is established after a short delay
+ */
+ public void testTimedAccept2() throws IOException {
+ try (ServerSocket ss = new ServerSocket(0)) {
+ ss.setSoTimeout(30*1000);
+ scheduleConnect(ss.getLocalSocketAddress(), 2000);
+ Socket s = ss.accept();
+ s.close();
+ }
+ }
+
+ /**
+ * Test timed accept where the accept times out
+ */
+ public void testTimedAccept3() throws IOException {
+ try (ServerSocket ss = new ServerSocket(0)) {
+ ss.setSoTimeout(2000);
+ try {
+ Socket s = ss.accept();
+ s.close();
+ assertTrue(false);
+ } catch (SocketTimeoutException expected) { }
+ }
+ }
+
+ /**
+ * Test timed accept where a connection is established immediately after a
+ * previous accept timed out.
+ */
+ public void testTimedAccept4() throws IOException {
+ try (ServerSocket ss = new ServerSocket(0)) {
+ ss.setSoTimeout(2000);
+ try {
+ Socket s = ss.accept();
+ s.close();
+ assertTrue(false);
+ } catch (SocketTimeoutException expected) { }
+ try (Socket s1 = new Socket()) {
+ s1.connect(ss.getLocalSocketAddress());
+ Socket s2 = ss.accept();
+ s2.close();
+ }
+ }
+ }
+
+ /**
+ * Test untimed accept where a connection is established after a previous
+ * accept timed out
+ */
+ public void testTimedAccept5() throws IOException {
+ try (ServerSocket ss = new ServerSocket(0)) {
+ ss.setSoTimeout(2000);
+ try {
+ Socket s = ss.accept();
+ s.close();
+ assertTrue(false);
+ } catch (SocketTimeoutException expected) { }
+ ss.setSoTimeout(0);
+ try (Socket s1 = new Socket()) {
+ s1.connect(ss.getLocalSocketAddress());
+ Socket s2 = ss.accept();
+ s2.close();
+ }
+ }
+ }
+
+ /**
+ * Test untimed accept where a connection is established after a previous
+ * accept timed out and after a short delay
+ */
+ public void testTimedAccept6() throws IOException {
+ try (ServerSocket ss = new ServerSocket(0)) {
+ ss.setSoTimeout(2000);
+ try {
+ Socket s = ss.accept();
+ s.close();
+ assertTrue(false);
+ } catch (SocketTimeoutException expected) { }
+ ss.setSoTimeout(0);
+ scheduleConnect(ss.getLocalSocketAddress(), 2000);
+ Socket s = ss.accept();
+ s.close();
+ }
+ }
+
+ /**
+ * Test async close of a timed accept
+ */
+ public void testTimedAccept7() throws IOException {
+ try (ServerSocket ss = new ServerSocket(0)) {
+ ss.setSoTimeout(30*1000);
+ scheduleClose(ss, 2000);
+ try {
+ ss.accept().close();
+ assertTrue(false);
+ } catch (SocketException expected) { }
+ }
+ }
+
+ /**
+ * Test Socket setSoTimeout with a negative timeout. This case is not currently
+ * specified but the long standing behavior is to throw IllegalArgumentException.
+ */
+ @Test(expectedExceptions = { IllegalArgumentException.class })
+ public void testBadTimeout1() throws IOException {
+ try (Socket s = new Socket()) {
+ s.setSoTimeout(-1);
+ }
+ }
+
+ /**
+ * Test ServerSocket setSoTimeout with a negative timeout. This case is not
+ * currently specified but the long standing behavior is to throw
+ * IllegalArgumentException.
+ */
+ @Test(expectedExceptions = { IllegalArgumentException.class })
+ public void testBadTimeout2() throws IOException {
+ try (ServerSocket ss = new ServerSocket()) {
+ ss.setSoTimeout(-1);
+ }
+ }
+
+ interface ThrowingBiConsumer<T, U> {
+ void accept(T t, U u) throws IOException;
+ }
+
+ /**
+ * Invokes the consumer with a connected pair of sockets
+ */
+ static void withConnection(ThrowingBiConsumer<Socket, Socket> consumer)
+ throws IOException
+ {
+ Socket s1 = null;
+ Socket s2 = null;
+ try (ServerSocket ss = new ServerSocket(0)) {
+ s1 = new Socket();
+ s1.connect(ss.getLocalSocketAddress());
+ s2 = ss.accept();
+ consumer.accept(s1, s2);
+ } finally {
+ if (s1 != null) s1.close();
+ if (s2 != null) s2.close();
+ }
+ }
+
+ /**
+ * Schedule c to be closed after a delay
+ */
+ static void scheduleClose(Closeable c, long delay) {
+ schedule(() -> {
+ try {
+ c.close();
+ } catch (IOException ioe) { }
+ }, delay);
+ }
+
+ /**
+ * Schedule a thread to connect to the given end point after a delay
+ */
+ static void scheduleConnect(SocketAddress remote, long delay) {
+ schedule(() -> {
+ try (Socket s = new Socket()) {
+ s.connect(remote);
+ } catch (IOException ioe) { }
+ }, delay);
+ }
+
+ /**
+ * Schedule a thread to read to EOF after a delay
+ */
+ static void scheduleReadToEOF(InputStream in, long delay) {
+ schedule(() -> {
+ byte[] bytes = new byte[8192];
+ try {
+ while (in.read(bytes) != -1) { }
+ } catch (IOException ioe) { }
+ }, delay);
+ }
+
+ /**
+ * Schedule a thread to write after a delay
+ */
+ static void scheduleWrite(OutputStream out, byte[] data, long delay) {
+ schedule(() -> {
+ try {
+ out.write(data);
+ } catch (IOException ioe) { }
+ }, delay);
+ }
+ static void scheduleWrite(OutputStream out, int b, long delay) {
+ scheduleWrite(out, new byte[] { (byte)b }, delay);
+ }
+
+ static void schedule(Runnable task, long delay) {
+ ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
+ try {
+ executor.schedule(task, delay, TimeUnit.MILLISECONDS);
+ } finally {
+ executor.shutdown();
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/net/Socket/UdpSocket.java Fri Mar 22 14:39:16 2019 +0530
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2019, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * 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, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @run main UdpSocket
+ * @summary Basic test for a Socket to a UDP socket
+ */
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+import java.net.SocketAddress;
+import java.nio.ByteBuffer;
+import java.nio.channels.DatagramChannel;
+import java.util.Arrays;
+
+public class UdpSocket {
+
+ static final String MESSAGE = "hello";
+
+ public static void main(String[] args) throws IOException {
+ try (DatagramChannel dc = DatagramChannel.open()) {
+ var loopback = InetAddress.getLoopbackAddress();
+ dc.bind(new InetSocketAddress(loopback, 0));
+
+ int port = ((InetSocketAddress) dc.getLocalAddress()).getPort();
+ try (Socket s = new Socket(loopback, port, false)) {
+
+ // send datagram with socket output stream
+ byte[] array1 = MESSAGE.getBytes("UTF-8");
+ s.getOutputStream().write(array1);
+
+ // receive the datagram
+ var buf = ByteBuffer.allocate(100);
+ SocketAddress remote = dc.receive(buf);
+ buf.flip();
+ if (buf.remaining() != MESSAGE.length())
+ throw new RuntimeException("Unexpected size");
+
+ // echo the datagram
+ dc.send(buf, remote);
+
+ // receive datagram with the socket input stream
+ byte[] array2 = new byte[100];
+ int n = s.getInputStream().read(array2);
+ if (n != MESSAGE.length())
+ throw new RuntimeException("Unexpected size");
+ if (!Arrays.equals(array1, 0, n, array2, 0, n))
+ throw new RuntimeException("Unexpected contents");
+ }
+ }
+ }
+}
--- a/test/jdk/java/util/Scanner/ScanTest.java Thu Mar 21 21:37:09 2019 -0700
+++ b/test/jdk/java/util/Scanner/ScanTest.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, 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
@@ -24,7 +24,7 @@
/**
* @test
* @bug 4313885 4926319 4927634 5032610 5032622 5049968 5059533 6223711 6277261 6269946 6288823
- * 8072722 8139414 8166261
+ * 8072722 8139414 8166261 8172695
* @summary Basic tests of java.util.Scanner methods
* @key randomness
* @modules jdk.localedata
@@ -49,26 +49,12 @@
private static File inputFile = new File(System.getProperty("test.src", "."), "input.txt");
public static void main(String[] args) throws Exception {
-
- Locale reservedLocale = Locale.getDefault();
- String lang = reservedLocale.getLanguage();
+ Locale defaultLocale = Locale.getDefault();
try {
- if (!"en".equals(lang) &&
- !"zh".equals(lang) &&
- !"ko".equals(lang) &&
- !"ja".equals(lang)) {
- //Before we have resource to improve the test to be ready for
- //arbitrary locale, force the default locale to be "English"
- //for now. First we check whether the "English" locale is
- //available on the system as it could be absent due to varying
- //configurations.
- if (!Arrays.asList(Locale.getAvailableLocales())
- .contains(Locale.ENGLISH)) {
- throw new RuntimeException
- ("The \"English\" Locale is unavailable on this system");
- }
- Locale.setDefault(Locale.ENGLISH);
- }
+ // Before we have resource to improve the test to be ready for
+ // arbitrary locale, force the default locale to be ROOT for now.
+ Locale.setDefault(Locale.US);
+
skipTest();
findInLineTest();
findWithinHorizonTest();
@@ -128,7 +114,7 @@
System.err.println("OKAY: All tests passed.");
} finally {
// restore the default locale
- Locale.setDefault(reservedLocale);
+ Locale.setDefault(defaultLocale);
}
}
--- a/test/jdk/jdk/internal/platform/docker/MetricsMemoryTester.java Thu Mar 21 21:37:09 2019 -0700
+++ b/test/jdk/jdk/internal/platform/docker/MetricsMemoryTester.java Fri Mar 22 14:39:16 2019 +0530
@@ -64,10 +64,15 @@
long count = Metrics.systemMetrics().getMemoryFailCount();
// Allocate 512M of data
- long[][] longs = new long[64][];
- for (int i = 1; i <= 64; i++) {
+ byte[][] bytes = new byte[64][];
+ for (int i = 0; i < 64; i++) {
try {
- longs[i] = new long[8 * 1024 * 1024];
+ bytes[i] = new byte[8 * 1024 * 1024];
+ // Break out as soon as we see an increase in failcount
+ // to avoid getting killed by the OOM killer.
+ if (Metrics.systemMetrics().getMemoryFailCount() > count) {
+ break;
+ }
} catch (Error e) { // OOM error
break;
}
--- a/test/jdk/jdk/internal/platform/docker/TestDockerMemoryMetrics.java Thu Mar 21 21:37:09 2019 -0700
+++ b/test/jdk/jdk/internal/platform/docker/TestDockerMemoryMetrics.java Fri Mar 22 14:39:16 2019 +0530
@@ -90,6 +90,7 @@
new DockerRunOptions(imageName, "/jdk/bin/java", "MetricsMemoryTester");
opts.addDockerOpts("--volume", Utils.TEST_CLASSES + ":/test-classes/")
.addDockerOpts("--memory=" + value)
+ .addJavaOpts("-Xmx" + value)
.addJavaOpts("-cp", "/test-classes/")
.addJavaOpts("--add-exports", "java.base/jdk.internal.platform=ALL-UNNAMED")
.addClassOptions("failcount");
--- a/test/jdk/sun/security/ec/SignatureDigestTruncate.java Thu Mar 21 21:37:09 2019 -0700
+++ b/test/jdk/sun/security/ec/SignatureDigestTruncate.java Fri Mar 22 14:39:16 2019 +0530
@@ -91,22 +91,25 @@
String privateKeyStr, String msgStr, String kStr, String sigStr)
throws Exception {
+ System.out.println("Testing " + alg + " with " + curveName);
+
byte[] privateKey = Convert.hexStringToByteArray(privateKeyStr);
byte[] msg = Convert.hexStringToByteArray(msgStr);
byte[] k = Convert.hexStringToByteArray(kStr);
byte[] expectedSig = Convert.hexStringToByteArray(sigStr);
- AlgorithmParameters params = AlgorithmParameters.getInstance("EC");
+ AlgorithmParameters params =
+ AlgorithmParameters.getInstance("EC", "SunEC");
params.init(new ECGenParameterSpec(curveName));
ECParameterSpec ecParams =
params.getParameterSpec(ECParameterSpec.class);
- KeyFactory kf = KeyFactory.getInstance("EC");
+ KeyFactory kf = KeyFactory.getInstance("EC", "SunEC");
BigInteger s = new BigInteger(1, privateKey);
ECPrivateKeySpec privKeySpec = new ECPrivateKeySpec(s, ecParams);
PrivateKey privKey = kf.generatePrivate(privKeySpec);
- Signature sig = Signature.getInstance(alg);
+ Signature sig = Signature.getInstance(alg, "SunEC");
sig.initSign(privKey, new FixedRandom(k));
sig.update(msg);
byte[] computedSig = sig.sign();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/sun/security/pkcs11/tls/tls12/TestTLS12.java Fri Mar 22 14:39:16 2019 +0530
@@ -0,0 +1,474 @@
+/*
+ * Copyright (c) 2019, Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * 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.
+ *
+ * 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, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8029661
+ * @summary Test TLS 1.2
+ * @modules java.base/sun.security.internal.spec
+ * java.base/sun.security.util
+ * java.base/com.sun.crypto.provider
+ * @library /test/lib ../..
+ * @run main/othervm/timeout=120 TestTLS12
+ */
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.nio.ByteBuffer;
+
+import java.security.interfaces.RSAPrivateKey;
+import java.security.interfaces.RSAPublicKey;
+import java.security.KeyStore;
+import java.security.NoSuchAlgorithmException;
+import java.security.Provider;
+import java.security.SecureRandom;
+import java.security.Security;
+
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.crypto.Cipher;
+import javax.crypto.KeyGenerator;
+import javax.crypto.SecretKey;
+import javax.crypto.spec.SecretKeySpec;
+
+import javax.net.ssl.KeyManagerFactory;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLEngine;
+import javax.net.ssl.SSLEngineResult;
+import javax.net.ssl.SSLEngineResult.HandshakeStatus;
+import javax.net.ssl.SSLParameters;
+import javax.net.ssl.SSLSession;
+import javax.net.ssl.TrustManagerFactory;
+
+import sun.security.internal.spec.TlsMasterSecretParameterSpec;
+import sun.security.internal.spec.TlsPrfParameterSpec;
+import sun.security.internal.spec.TlsRsaPremasterSecretParameterSpec;
+
+public final class TestTLS12 extends SecmodTest {
+
+ private static final boolean enableDebug = true;
+
+ private static Provider sunPKCS11NSSProvider;
+ private static Provider sunJCEProvider;
+ private static KeyStore ks;
+ private static KeyStore ts;
+ private static char[] passphrase = "JAHshj131@@".toCharArray();
+ private static RSAPrivateKey privateKey;
+ private static RSAPublicKey publicKey;
+
+ public static void main(String[] args) throws Exception {
+ try {
+ initialize();
+ } catch (Exception e) {
+ System.out.println("Test skipped: failure during" +
+ " initialization");
+ if (enableDebug) {
+ System.out.println(e);
+ }
+ return;
+ }
+
+ if (shouldRun()) {
+ // Test against JCE
+ testTlsAuthenticationCodeGeneration();
+
+ // Self-integrity test (complete TLS 1.2 communication)
+ new testTLS12SunPKCS11Communication().run();
+
+ System.out.println("Test PASS - OK");
+ } else {
+ System.out.println("Test skipped: TLS 1.2 mechanisms" +
+ " not supported by current SunPKCS11 back-end");
+ }
+ }
+
+ private static boolean shouldRun() {
+ if (sunPKCS11NSSProvider == null) {
+ return false;
+ }
+ try {
+ KeyGenerator.getInstance("SunTls12MasterSecret",
+ sunPKCS11NSSProvider);
+ KeyGenerator.getInstance(
+ "SunTls12RsaPremasterSecret", sunPKCS11NSSProvider);
+ KeyGenerator.getInstance("SunTls12Prf", sunPKCS11NSSProvider);
+ } catch (NoSuchAlgorithmException e) {
+ return false;
+ }
+ return true;
+ }
+
+ private static void testTlsAuthenticationCodeGeneration()
+ throws Exception {
+ // Generate RSA Pre-Master Secret in SunPKCS11 provider
+ SecretKey rsaPreMasterSecret = null;
+ @SuppressWarnings("deprecation")
+ TlsRsaPremasterSecretParameterSpec rsaPreMasterSecretSpec =
+ new TlsRsaPremasterSecretParameterSpec(0x0303, 0x0303);
+ {
+ KeyGenerator rsaPreMasterSecretKG = KeyGenerator.getInstance(
+ "SunTls12RsaPremasterSecret", sunPKCS11NSSProvider);
+ rsaPreMasterSecretKG.init(rsaPreMasterSecretSpec, null);
+ rsaPreMasterSecret = rsaPreMasterSecretKG.generateKey();
+ }
+
+ // Get RSA Pre-Master Secret in plain (from SunPKCS11 provider)
+ byte[] rsaPlainPreMasterSecret = null;
+ {
+ Cipher rsaPreMasterSecretWrapperCipher =
+ Cipher.getInstance("RSA/ECB/PKCS1Padding",
+ sunPKCS11NSSProvider);
+ rsaPreMasterSecretWrapperCipher.init(Cipher.WRAP_MODE, publicKey,
+ new SecureRandom());
+ byte[] rsaEncryptedPreMasterSecret =
+ rsaPreMasterSecretWrapperCipher.wrap(rsaPreMasterSecret);
+ Cipher rsaPreMasterSecretUnwrapperCipher =
+ Cipher.getInstance("RSA/ECB/PKCS1Padding", sunJCEProvider);
+ rsaPreMasterSecretUnwrapperCipher.init(Cipher.UNWRAP_MODE,
+ privateKey, rsaPreMasterSecretSpec);
+ rsaPlainPreMasterSecret = rsaPreMasterSecretUnwrapperCipher.unwrap(
+ rsaEncryptedPreMasterSecret, "TlsRsaPremasterSecret",
+ Cipher.SECRET_KEY).getEncoded();
+
+ if (enableDebug) {
+ System.out.println("rsaPlainPreMasterSecret:");
+ for (byte b : rsaPlainPreMasterSecret) {
+ System.out.printf("%02X, ", b);
+ }
+ System.out.println("");
+ }
+ }
+
+ // Generate Master Secret
+ SecretKey sunPKCS11MasterSecret = null;
+ SecretKey jceMasterSecret = null;
+ {
+ KeyGenerator sunPKCS11MasterSecretGenerator =
+ KeyGenerator.getInstance("SunTls12MasterSecret",
+ sunPKCS11NSSProvider);
+ KeyGenerator jceMasterSecretGenerator = KeyGenerator.getInstance(
+ "SunTls12MasterSecret", sunJCEProvider);
+ @SuppressWarnings("deprecation")
+ TlsMasterSecretParameterSpec sunPKCS11MasterSecretSpec =
+ new TlsMasterSecretParameterSpec(rsaPreMasterSecret, 3, 3,
+ new byte[32], new byte[32], "SHA-256", 32, 64);
+ @SuppressWarnings("deprecation")
+ TlsMasterSecretParameterSpec jceMasterSecretSpec =
+ new TlsMasterSecretParameterSpec(
+ new SecretKeySpec(rsaPlainPreMasterSecret,
+ "Generic"), 3, 3, new byte[32],
+ new byte[32], "SHA-256", 32, 64);
+ sunPKCS11MasterSecretGenerator.init(sunPKCS11MasterSecretSpec,
+ null);
+ jceMasterSecretGenerator.init(jceMasterSecretSpec, null);
+ sunPKCS11MasterSecret =
+ sunPKCS11MasterSecretGenerator.generateKey();
+ jceMasterSecret = jceMasterSecretGenerator.generateKey();
+ if (enableDebug) {
+ System.out.println("Master Secret (SunJCE):");
+ if (jceMasterSecret != null) {
+ for (byte b : jceMasterSecret.getEncoded()) {
+ System.out.printf("%02X, ", b);
+ }
+ System.out.println("");
+ }
+ }
+ }
+
+ // Generate authentication codes
+ byte[] sunPKCS11AuthenticationCode = null;
+ byte[] jceAuthenticationCode = null;
+ {
+ // Generate SunPKCS11 authentication code
+ {
+ @SuppressWarnings("deprecation")
+ TlsPrfParameterSpec sunPKCS11AuthenticationCodeSpec =
+ new TlsPrfParameterSpec(sunPKCS11MasterSecret,
+ "client finished", "a".getBytes(), 12,
+ "SHA-256", 32, 64);
+ KeyGenerator sunPKCS11AuthCodeGenerator =
+ KeyGenerator.getInstance("SunTls12Prf",
+ sunPKCS11NSSProvider);
+ sunPKCS11AuthCodeGenerator.init(
+ sunPKCS11AuthenticationCodeSpec);
+ sunPKCS11AuthenticationCode =
+ sunPKCS11AuthCodeGenerator.generateKey().getEncoded();
+ }
+
+ // Generate SunJCE authentication code
+ {
+ @SuppressWarnings("deprecation")
+ TlsPrfParameterSpec jceAuthenticationCodeSpec =
+ new TlsPrfParameterSpec(jceMasterSecret,
+ "client finished", "a".getBytes(), 12,
+ "SHA-256", 32, 64);
+ KeyGenerator jceAuthCodeGenerator =
+ KeyGenerator.getInstance("SunTls12Prf",
+ sunJCEProvider);
+ jceAuthCodeGenerator.init(jceAuthenticationCodeSpec);
+ jceAuthenticationCode =
+ jceAuthCodeGenerator.generateKey().getEncoded();
+ }
+
+ if (enableDebug) {
+ System.out.println("SunPKCS11 Authentication Code: ");
+ for (byte b : sunPKCS11AuthenticationCode) {
+ System.out.printf("%02X, ", b);
+ }
+ System.out.println("");
+ System.out.println("SunJCE Authentication Code: ");
+ for (byte b : jceAuthenticationCode) {
+ System.out.printf("%02X, ", b);
+ }
+ System.out.println("");
+ }
+ }
+
+ if (sunPKCS11AuthenticationCode == null ||
+ jceAuthenticationCode == null ||
+ sunPKCS11AuthenticationCode.length == 0 ||
+ jceAuthenticationCode.length == 0 ||
+ !Arrays.equals(sunPKCS11AuthenticationCode,
+ jceAuthenticationCode)) {
+ throw new Exception("Authentication codes from JCE" +
+ " and SunPKCS11 differ.");
+ }
+ }
+
+ private static class testTLS12SunPKCS11Communication {
+ public static void run() throws Exception {
+ SSLEngine[][] enginesToTest = getSSLEnginesToTest();
+
+ for (SSLEngine[] engineToTest : enginesToTest) {
+
+ SSLEngine clientSSLEngine = engineToTest[0];
+ SSLEngine serverSSLEngine = engineToTest[1];
+
+ // SSLEngine code based on RedhandshakeFinished.java
+
+ boolean dataDone = false;
+
+ ByteBuffer clientOut = null;
+ ByteBuffer clientIn = null;
+ ByteBuffer serverOut = null;
+ ByteBuffer serverIn = null;
+ ByteBuffer cTOs;
+ ByteBuffer sTOc;
+
+ SSLSession session = clientSSLEngine.getSession();
+ int appBufferMax = session.getApplicationBufferSize();
+ int netBufferMax = session.getPacketBufferSize();
+
+ clientIn = ByteBuffer.allocate(appBufferMax + 50);
+ serverIn = ByteBuffer.allocate(appBufferMax + 50);
+
+ cTOs = ByteBuffer.allocateDirect(netBufferMax);
+ sTOc = ByteBuffer.allocateDirect(netBufferMax);
+
+ clientOut = ByteBuffer.wrap(
+ "Hi Server, I'm Client".getBytes());
+ serverOut = ByteBuffer.wrap(
+ "Hello Client, I'm Server".getBytes());
+
+ SSLEngineResult clientResult;
+ SSLEngineResult serverResult;
+
+ while (!dataDone) {
+ clientResult = clientSSLEngine.wrap(clientOut, cTOs);
+ runDelegatedTasks(clientResult, clientSSLEngine);
+ serverResult = serverSSLEngine.wrap(serverOut, sTOc);
+ runDelegatedTasks(serverResult, serverSSLEngine);
+ cTOs.flip();
+ sTOc.flip();
+
+ if (enableDebug) {
+ System.out.println("Client -> Network");
+ printTlsNetworkPacket("", cTOs);
+ System.out.println("");
+ System.out.println("Server -> Network");
+ printTlsNetworkPacket("", sTOc);
+ System.out.println("");
+ }
+
+ clientResult = clientSSLEngine.unwrap(sTOc, clientIn);
+ runDelegatedTasks(clientResult, clientSSLEngine);
+ serverResult = serverSSLEngine.unwrap(cTOs, serverIn);
+ runDelegatedTasks(serverResult, serverSSLEngine);
+
+ cTOs.compact();
+ sTOc.compact();
+
+ if (!dataDone &&
+ (clientOut.limit() == serverIn.position()) &&
+ (serverOut.limit() == clientIn.position())) {
+ checkTransfer(serverOut, clientIn);
+ checkTransfer(clientOut, serverIn);
+ dataDone = true;
+ }
+ }
+ }
+ }
+
+ static void printTlsNetworkPacket(String prefix, ByteBuffer bb) {
+ ByteBuffer slice = bb.slice();
+ byte[] buffer = new byte[slice.remaining()];
+ slice.get(buffer);
+ for (int i = 0; i < buffer.length; i++) {
+ System.out.printf("%02X, ", (byte)(buffer[i] & (byte)0xFF));
+ if (i % 8 == 0 && i % 16 != 0) {
+ System.out.print(" ");
+ }
+ if (i % 16 == 0) {
+ System.out.println("");
+ }
+ }
+ System.out.flush();
+ }
+
+ private static void checkTransfer(ByteBuffer a, ByteBuffer b)
+ throws Exception {
+ a.flip();
+ b.flip();
+ if (!a.equals(b)) {
+ throw new Exception("Data didn't transfer cleanly");
+ }
+ a.position(a.limit());
+ b.position(b.limit());
+ a.limit(a.capacity());
+ b.limit(b.capacity());
+ }
+
+ private static void runDelegatedTasks(SSLEngineResult result,
+ SSLEngine engine) throws Exception {
+
+ if (result.getHandshakeStatus() == HandshakeStatus.NEED_TASK) {
+ Runnable runnable;
+ while ((runnable = engine.getDelegatedTask()) != null) {
+ runnable.run();
+ }
+ HandshakeStatus hsStatus = engine.getHandshakeStatus();
+ if (hsStatus == HandshakeStatus.NEED_TASK) {
+ throw new Exception(
+ "handshake shouldn't need additional tasks");
+ }
+ }
+ }
+
+ private static SSLEngine[][] getSSLEnginesToTest() throws Exception {
+ SSLEngine[][] enginesToTest = new SSLEngine[2][2];
+ String[][] preferredSuites = new String[][]{ new String[] {
+ "TLS_RSA_WITH_AES_128_CBC_SHA256"
+ }, new String[] {
+ "TLS_DHE_RSA_WITH_AES_128_CBC_SHA256"
+ }};
+ for (int i = 0; i < enginesToTest.length; i++) {
+ enginesToTest[i][0] = createSSLEngine(true);
+ enginesToTest[i][1] = createSSLEngine(false);
+ enginesToTest[i][0].setEnabledCipherSuites(preferredSuites[i]);
+ enginesToTest[i][1].setEnabledCipherSuites(preferredSuites[i]);
+ }
+ return enginesToTest;
+ }
+
+ static private SSLEngine createSSLEngine(boolean client)
+ throws Exception {
+ SSLEngine ssle;
+ KeyManagerFactory kmf = KeyManagerFactory.getInstance("PKIX", "SunJSSE");
+ kmf.init(ks, passphrase);
+
+ TrustManagerFactory tmf = TrustManagerFactory.getInstance("PKIX", "SunJSSE");
+ tmf.init(ts);
+
+ SSLContext sslCtx = SSLContext.getInstance("TLSv1.2", "SunJSSE");
+ sslCtx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
+ ssle = sslCtx.createSSLEngine("localhost", 443);
+ ssle.setUseClientMode(client);
+ SSLParameters sslParameters = ssle.getSSLParameters();
+ ssle.setSSLParameters(sslParameters);
+
+ return ssle;
+ }
+ }
+
+ private static void initialize() throws Exception {
+ if (initSecmod() == false) {
+ return;
+ }
+ String configName = BASE + SEP + "nss.cfg";
+ sunPKCS11NSSProvider = getSunPKCS11(configName);
+ System.out.println("SunPKCS11 provider: " + sunPKCS11NSSProvider);
+
+ List<Provider> installedProviders = new LinkedList<>();
+ for (Provider p : Security.getProviders()){
+ installedProviders.add(p);
+ Security.removeProvider(p.getName());
+ }
+ Security.addProvider(sunPKCS11NSSProvider);
+ for (Provider p : installedProviders){
+ String providerName = p.getName();
+ if (providerName.equals("SunJSSE") ||
+ providerName.equals("SUN") ||
+ providerName.equals("SunJCE")) {
+ Security.addProvider(p);
+ if (providerName.equals("SunJCE")) {
+ sunJCEProvider = p;
+ }
+ }
+ }
+
+ ks = KeyStore.getInstance("PKCS11", sunPKCS11NSSProvider);
+ ks.load(null, "test12".toCharArray());
+ ts = ks;
+
+ KeyStore ksPlain = readTestKeyStore();
+ privateKey = (RSAPrivateKey)ksPlain.getKey("rh_rsa_sha256",
+ passphrase);
+ publicKey = (RSAPublicKey)ksPlain.getCertificate(
+ "rh_rsa_sha256").getPublicKey();
+
+ // Extended Master Secret is not currently supported in SunPKCS11
+ // cryptographic provider
+ System.setProperty("jdk.tls.useExtendedMasterSecret", "false");
+ String disabledAlgorithms =
+ Security.getProperty("jdk.tls.disabledAlgorithms");
+ if (disabledAlgorithms.length() > 0) {
+ disabledAlgorithms += ", ";
+ }
+ // RSASSA-PSS is not currently supported in SunPKCS11
+ // cryptographic provider
+ disabledAlgorithms += "RSASSA-PSS";
+ Security.setProperty("jdk.tls.disabledAlgorithms", disabledAlgorithms);
+ }
+
+ private static KeyStore readTestKeyStore() throws Exception {
+ File file = new File(System.getProperty("test.src", "."), "keystore");
+ InputStream in = new FileInputStream(file);
+ KeyStore ks = KeyStore.getInstance("JKS");
+ ks.load(in, "passphrase".toCharArray());
+ in.close();
+ return ks;
+ }
+}
Binary file test/jdk/sun/security/pkcs11/tls/tls12/cert8.db has changed
Binary file test/jdk/sun/security/pkcs11/tls/tls12/key3.db has changed
Binary file test/jdk/sun/security/pkcs11/tls/tls12/keystore has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/sun/security/pkcs11/tls/tls12/nss.cfg Fri Mar 22 14:39:16 2019 +0530
@@ -0,0 +1,19 @@
+
+name = NSSKeyStore
+
+nssSecmodDirectory = ${pkcs11test.nss.db}
+
+nssLibraryDirectory = ${pkcs11test.nss.libdir}
+
+nssModule = fips
+
+# NSS needs CKA_NETSCAPE_DB for DSA and DH private keys
+# just put an arbitrary value in there to make it happy
+
+attributes(*,CKO_PRIVATE_KEY,CKK_DSA) = {
+ CKA_NETSCAPE_DB = 0h00
+}
+
+attributes(*,CKO_PRIVATE_KEY,CKK_DH) = {
+ CKA_NETSCAPE_DB = 0h00
+}
Binary file test/jdk/sun/security/pkcs11/tls/tls12/secmod.db has changed
--- a/test/langtools/tools/javac/modules/MOptionTest.java Thu Mar 21 21:37:09 2019 -0700
+++ b/test/langtools/tools/javac/modules/MOptionTest.java Fri Mar 22 14:39:16 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, 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
@@ -23,7 +23,7 @@
/**
* @test
- * @bug 8146946 8176743
+ * @bug 8146946 8176743 8200286
* @summary implement javac -m option
* @library /tools/lib
* @modules
@@ -39,7 +39,6 @@
import toolbox.JavacTask;
import toolbox.Task;
-import toolbox.ToolBox;
public class MOptionTest extends ModuleTestBase {
public static void main(String... args) throws Exception {
@@ -93,9 +92,10 @@
throw new AssertionError("Classfile update!");
}
- Thread.sleep(2000); //timestamps
-
- Files.setLastModifiedTime(testTest, FileTime.fromMillis(System.currentTimeMillis()));
+ // Date back the source file by one second compared to the current time.
+ // Cases have been observed where the resulting class file had an earlier
+ // timestamp than the java source.
+ Files.setLastModifiedTime(testTest, FileTime.fromMillis(System.currentTimeMillis() - 1000));
new JavacTask(tb)
.options("-m", "m1x", "--module-source-path", src.toString(), "-d", build.toString())
@@ -235,10 +235,11 @@
throw new AssertionError("Classfile update!");
}
- Thread.sleep(2000); //timestamps
-
- Files.setLastModifiedTime(C1Source, FileTime.fromMillis(System.currentTimeMillis()));
- Files.setLastModifiedTime(C2Source, FileTime.fromMillis(System.currentTimeMillis()));
+ // Date back the source file by one second compared to the current time.
+ // Cases have been observed where the resulting class file had an earlier
+ // timestamp than the java source.
+ Files.setLastModifiedTime(C1Source, FileTime.fromMillis(System.currentTimeMillis() - 1000));
+ Files.setLastModifiedTime(C2Source, FileTime.fromMillis(System.currentTimeMillis() - 1000));
new JavacTask(tb)
.options("-m", "m1x,m2x", "--module-source-path", src.toString(), "-d", build.toString())